/* Imtithal design system — modern SaaS, RTL-ready (uses logical properties). */
:root {
  --navy: #0b1f33; --navy-2: #102b45; --teal: #14b8a6; --teal-d: #0d9488;
  --accent: #38bdf8; --bg: #f6f8fb; --card: #ffffff; --line: #e5eaf0;
  --text: #1b2733; --muted: #64748b; --good: #16a34a; --warn: #d97706; --bad: #dc2626;
  --radius: 14px; --shadow: 0 1px 3px rgba(16,43,69,.08), 0 8px 24px rgba(16,43,69,.06);
  --sidebar: 252px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Tahoma, "Noto Sans Arabic", sans-serif;
  color: var(--text); background: var(--bg); line-height: 1.55; font-size: 15px;
}
[dir="rtl"] body { font-family: "Noto Sans Arabic", system-ui, Tahoma, sans-serif; }
a { color: var(--teal-d); text-decoration: none; }
a:hover { text-decoration: underline; }
h1,h2,h3 { line-height: 1.2; color: var(--navy); }
.container { max-width: 1140px; margin-inline: auto; padding-inline: 20px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: .5rem; border: 1px solid transparent;
  padding: .6rem 1.1rem; border-radius: 10px; font-weight: 600; cursor: pointer; font-size: .95rem;
  transition: .15s; text-decoration: none; }
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-d); color:#fff; }
.btn-ghost { background: transparent; color: var(--navy); border-color: var(--line); }
.btn-ghost:hover { background: #eef2f7; }
.btn-light { background: rgba(255,255,255,.12); color:#fff; border-color: rgba(255,255,255,.25); }
.btn-danger { background: var(--bad); color:#fff; }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: .35rem .7rem; font-size: .85rem; border-radius: 8px; }

/* Public top nav */
.topnav { background: var(--navy); color: #fff; }
.topnav .container { display: flex; align-items: center; gap: 1rem; height: 64px; }
.brand { font-weight: 800; font-size: 1.25rem; color: #fff; letter-spacing: .3px; }
.brand .dot { color: var(--teal); }
.topnav nav { display: flex; gap: 1.25rem; margin-inline-start: auto; align-items: center; }
.topnav nav a { color: #cbd6e2; font-weight: 500; }
.topnav nav a:hover { color: #fff; text-decoration: none; }

/* Hero */
.hero { background: linear-gradient(135deg, var(--navy), var(--navy-2) 60%, #0e3a52);
  color: #fff; padding: 72px 0; }
.hero h1 { color: #fff; font-size: 2.6rem; margin: 0 0 1rem; max-width: 16ch; }
.hero p.lead { color: #b9c7d6; font-size: 1.2rem; max-width: 60ch; margin: 0 0 1.75rem; }
.hero .cta { display: flex; gap: .75rem; flex-wrap: wrap; }
.pill { display:inline-block; background: rgba(20,184,166,.15); color: #7ff0e0;
  border:1px solid rgba(20,184,166,.4); padding:.3rem .8rem; border-radius:999px; font-size:.85rem; margin-bottom:1rem; }

/* Sections */
section.block { padding: 64px 0; }
section.block.alt { background: #fff; border-block: 1px solid var(--line); }
.section-head { text-align: center; max-width: 64ch; margin: 0 auto 2.5rem; }
.section-head h2 { font-size: 2rem; margin: 0 0 .5rem; }
.section-head p { color: var(--muted); font-size: 1.05rem; }
.grid { display: grid; gap: 1.25rem; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px){ .grid.cols-3,.grid.cols-4,.grid.cols-2{ grid-template-columns:1fr; } .hero h1{font-size:2rem;} }

.feature { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.5rem; box-shadow: var(--shadow); }
.feature .ico { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center;
  background: rgba(20,184,166,.12); color: var(--teal-d); font-size: 1.3rem; margin-bottom: .9rem; }
.feature h3 { margin: 0 0 .4rem; font-size: 1.15rem; }
.feature p { color: var(--muted); margin: 0; font-size: .95rem; }
.fw-badge { display:inline-flex; flex-direction:column; gap:.2rem; padding:1.2rem 1rem; background:#fff;
  border:1px solid var(--line); border-radius:var(--radius); text-align:center; box-shadow:var(--shadow); }
.fw-badge b { color: var(--navy); font-size:1.1rem; } .fw-badge span{ color:var(--muted); font-size:.85rem; }

/* Pricing */
.plan { background:#fff; border:1px solid var(--line); border-radius:var(--radius); padding:1.75rem;
  box-shadow:var(--shadow); display:flex; flex-direction:column; }
.plan.featured { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(20,184,166,.25), var(--shadow); }
.plan h3 { margin:.2rem 0; } .plan .price { font-size:2rem; font-weight:800; color:var(--navy); }
.plan .price small { font-size:.9rem; color:var(--muted); font-weight:500; }
.plan ul { list-style:none; padding:0; margin:1rem 0 1.5rem; }
.plan ul li { padding:.35rem 0; color:var(--text); border-bottom:1px dashed var(--line); font-size:.92rem; }
.plan ul li::before { content:"✓"; color:var(--teal-d); font-weight:800; margin-inline-end:.5rem; }
.plan .btn { margin-top:auto; }

/* Footer */
footer.site { background: var(--navy); color: #9fb0c0; padding: 36px 0; margin-top: 48px; }
footer.site a { color: #cbd6e2; }

/* ---- Dashboard shell ---- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { background: var(--navy); color:#cbd6e2; padding: 18px 14px; position: sticky; top:0; align-self:start; height:100vh; overflow:auto; }
.sidebar .brand { display:block; margin: 4px 8px 18px; }
.sidebar .navgroup { font-size:.72rem; text-transform:uppercase; letter-spacing:.08em; color:#6b8099; margin:18px 10px 6px; }
.sidebar a.item { display:flex; align-items:center; gap:.6rem; padding:.55rem .75rem; border-radius:9px; color:#cbd6e2; font-weight:500; }
.sidebar a.item:hover { background: rgba(255,255,255,.06); color:#fff; text-decoration:none; }
.sidebar a.item.active { background: var(--teal); color:#fff; }
.sidebar a.item .tag { margin-inline-start:auto; font-size:.62rem; background:rgba(255,255,255,.15); padding:.05rem .4rem; border-radius:6px; }
.main { display:flex; flex-direction:column; min-width:0; }
.topbar { height:62px; background:#fff; border-bottom:1px solid var(--line); display:flex; align-items:center; gap:1rem; padding-inline:24px; }
.topbar .spacer { margin-inline-start:auto; }
.topbar .who { text-align:end; line-height:1.1; } .topbar .who b{ display:block; } .topbar .who span{ color:var(--muted); font-size:.8rem; }
.content { padding: 26px 24px; }
.page-title { display:flex; align-items:center; gap:1rem; margin: 0 0 1.25rem; }
.page-title h1 { font-size:1.6rem; margin:0; } .page-title .spacer{ margin-inline-start:auto; }
@media (max-width: 820px){ .shell{ grid-template-columns:1fr; } .sidebar{ display:none; } }

/* Cards / stats */
.stat { background:#fff; border:1px solid var(--line); border-radius:var(--radius); padding:1.2rem 1.3rem; box-shadow:var(--shadow); }
.stat .label { color:var(--muted); font-size:.85rem; } .stat .value{ font-size:1.9rem; font-weight:800; color:var(--navy); }
.stat .sub { font-size:.8rem; color:var(--muted); }
.card { background:#fff; border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow); }
.card .card-head { padding:1rem 1.25rem; border-bottom:1px solid var(--line); display:flex; align-items:center; gap:.75rem; }
.card .card-head h3 { margin:0; font-size:1.1rem; } .card .card-body { padding:1.25rem; }

/* Tables */
table.data { width:100%; border-collapse:collapse; }
table.data th, table.data td { padding:.7rem .9rem; text-align:start; border-bottom:1px solid var(--line); font-size:.92rem; }
table.data th { color:var(--muted); font-weight:600; font-size:.78rem; text-transform:uppercase; letter-spacing:.03em; }
table.data tr:hover td { background:#fafcfe; }
.toolbar { display:flex; gap:.6rem; margin-bottom:1rem; flex-wrap:wrap; }
.toolbar input[type=search]{ flex:1; min-width:200px; }

/* Badges */
.badge { display:inline-block; padding:.18rem .6rem; border-radius:999px; font-size:.75rem; font-weight:600; }
.badge.good{ background:#dcfce7; color:#166534; } .badge.warn{ background:#fef3c7; color:#92400e; }
.badge.bad{ background:#fee2e2; color:#991b1b; } .badge.info{ background:#e0f2fe; color:#075985; }
.badge.muted{ background:#eef2f7; color:#475569; }

/* Forms */
.form { max-width:460px; } .form.wide{ max-width:680px; }
.field { margin-bottom:1rem; } .field label{ display:block; font-weight:600; margin-bottom:.35rem; font-size:.9rem; }
.input, input.input, select.input, textarea.input {
  width:100%; padding:.6rem .75rem; border:1px solid var(--line); border-radius:10px; font-size:.95rem; background:#fff; }
.input:focus { outline:2px solid rgba(20,184,166,.4); border-color:var(--teal); }
.row2 { display:grid; grid-template-columns:1fr 1fr; gap:1rem; } @media(max-width:560px){ .row2{ grid-template-columns:1fr; } }
.help { color:var(--muted); font-size:.83rem; } .field-error{ color:var(--bad); font-size:.85rem; margin-top:.3rem; }

/* Auth split */
.auth-wrap { min-height:100vh; display:grid; grid-template-columns:1fr 1fr; }
.auth-aside { background:linear-gradient(150deg,var(--navy),#0e3a52); color:#fff; padding:48px; display:flex; flex-direction:column; justify-content:center; }
.auth-aside h2{ color:#fff; font-size:1.8rem; } .auth-aside p{ color:#b9c7d6; }
.auth-main { display:flex; align-items:center; justify-content:center; padding:32px; }
@media(max-width:820px){ .auth-wrap{ grid-template-columns:1fr; } .auth-aside{ display:none; } }

/* Alerts + empty/loading states */
.alert { padding:.8rem 1rem; border-radius:10px; margin-bottom:1rem; font-size:.92rem; }
.alert.err{ background:#fee2e2; color:#991b1b; border:1px solid #fca5a5; }
.alert.ok{ background:#dcfce7; color:#166534; border:1px solid #86efac; }
.alert.info{ background:#e0f2fe; color:#075985; border:1px solid #7dd3fc; }
.empty { text-align:center; padding:3rem 1rem; color:var(--muted); }
.empty .ico { font-size:2.4rem; opacity:.5; } .empty h3{ color:var(--navy); margin:.5rem 0 .25rem; }
.muted { color: var(--muted); } .mt0{margin-top:0} .mb0{margin-bottom:0}
.flex { display:flex; gap:.6rem; align-items:center; } .wrap{ flex-wrap:wrap; }
.soon { opacity:.96; }

/* ---- Notifications / tasks / modals (M-notify) ---- */
.iconbtn { position:relative; background:transparent; border:1px solid var(--line); border-radius:10px;
  width:40px; height:40px; cursor:pointer; display:grid; place-items:center; font-size:1.1rem; }
.iconbtn:hover { background:#eef2f7; }
.count-badge { position:absolute; top:-6px; inset-inline-end:-6px; min-width:18px; height:18px; padding:0 5px;
  background:var(--bad); color:#fff; border-radius:999px; font-size:.68rem; font-weight:700;
  display:inline-flex; align-items:center; justify-content:center; }
.notif-wrap { position:relative; }
.notif-panel { position:absolute; inset-inline-end:0; top:48px; width:360px; max-height:460px; overflow:auto;
  background:#fff; border:1px solid var(--line); border-radius:12px; box-shadow:var(--shadow); display:none; z-index:50; }
.notif-panel.open { display:block; }
.notif-head { display:flex; align-items:center; justify-content:space-between; padding:.75rem 1rem; border-bottom:1px solid var(--line); }
.notif-head b { font-size:.95rem; } .notif-head a { font-size:.8rem; }
.notif-item { display:block; padding:.7rem 1rem; border-bottom:1px solid var(--line); color:var(--text); }
.notif-item:hover { background:#fafcfe; text-decoration:none; }
.notif-item.unread { background:#f0f9ff; } .notif-item b { display:block; font-size:.9rem; }
.notif-item span { font-size:.82rem; color:var(--muted); }
.notif-empty { padding:2rem 1rem; text-align:center; color:var(--muted); }
.sidebar a.item .badge-num { margin-inline-start:auto; background:var(--teal); color:#fff; border-radius:999px;
  font-size:.68rem; min-width:18px; height:18px; display:inline-flex; align-items:center; justify-content:center; padding:0 5px; }

.toast { position:fixed; inset-block-end:24px; inset-inline-end:24px; background:var(--navy); color:#fff;
  padding:.85rem 1.1rem; border-radius:12px; box-shadow:var(--shadow); max-width:340px; z-index:100;
  transform:translateY(20px); opacity:0; transition:.3s; }
.toast.show { transform:translateY(0); opacity:1; }
.toast b { display:block; } .toast div { font-size:.85rem; opacity:.85; }

.modal { position:fixed; inset:0; display:none; align-items:center; justify-content:center; z-index:200; }
.modal.open { display:flex; }
.modal-backdrop { position:absolute; inset:0; background:rgba(11,31,51,.5); }
.modal-card { position:relative; background:#fff; border-radius:16px; box-shadow:var(--shadow); width:520px;
  max-width:92vw; max-height:88vh; overflow:auto; z-index:1; }
.modal-card .card-head { display:flex; align-items:center; justify-content:space-between; }
.modal-card .x { background:transparent; border:none; font-size:1.3rem; cursor:pointer; color:var(--muted); }

/* ---- Design polish: modal spacing + table refinement (UI review) ---- */
/* Modals reuse .card-head/.card-body but .modal-card is not a .card, so the
   .card .card-head/.card-body padding never applied — content sat flush to the edge. */
.modal-card .card-head { padding:1.1rem 1.25rem; border-bottom:1px solid var(--line); }
.modal-card .card-head h3 { margin:0; font-size:1.1rem; }
.modal-card .card-body { padding:1.25rem; }
.modal-card.wide { width:640px; }
.modal-card .x { padding:.25rem .45rem; border-radius:8px; line-height:1; margin-inline-end:-.25rem; }
.modal-card .x:hover { background:#eef2f7; color:var(--text); }
/* Action footer that spans the full padded card-body width with a divider. */
.modal-card .card-body .card-foot { display:flex; justify-content:flex-end; gap:.5rem;
  margin:1.25rem -1.25rem -1.25rem; padding:1rem 1.25rem; border-top:1px solid var(--line); }

/* Spacer works in card heads too (not just page-title/topbar). */
.card-head .spacer, .modal-card .card-head .spacer { margin-inline-start:auto; }

/* Tables: header fill, no dangling last border, clip to card radius, responsive scroll. */
table.data thead th { background:#f8fafc; }
table.data tbody tr:last-child td { border-bottom:none; }
table.data td:last-child, table.data th:last-child { text-align:end; }
table.data td .btn-sm { white-space:nowrap; }
.card .card-body[style*="padding:0"] { overflow:hidden; border-end-end-radius:var(--radius); border-end-start-radius:var(--radius); }
.table-wrap { width:100%; overflow-x:auto; -webkit-overflow-scrolling:touch; }
.table-wrap table.data { min-width:640px; }
