/* Viral Reach platform: RTL-first. Use logical properties; never left/right for layout. */
@font-face { font-family: 'IBM Plex Sans Arabic'; font-weight: 400; font-display: swap; src: url(/fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2) format('woff2'); unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0898-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC; }
@font-face { font-family: 'IBM Plex Sans Arabic'; font-weight: 500; font-display: swap; src: url(/fonts/ibm-plex-sans-arabic-arabic-500-normal.woff2) format('woff2'); unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0898-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC; }
@font-face { font-family: 'IBM Plex Sans Arabic'; font-weight: 600; font-display: swap; src: url(/fonts/ibm-plex-sans-arabic-arabic-600-normal.woff2) format('woff2'); unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0898-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC; }
@font-face { font-family: 'IBM Plex Sans Arabic'; font-weight: 700; font-display: swap; src: url(/fonts/ibm-plex-sans-arabic-arabic-700-normal.woff2) format('woff2'); unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0898-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC; }
@font-face { font-family: 'IBM Plex Sans Arabic'; font-weight: 400; font-display: swap; src: url(/fonts/ibm-plex-sans-arabic-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'IBM Plex Sans Arabic'; font-weight: 500; font-display: swap; src: url(/fonts/ibm-plex-sans-arabic-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'IBM Plex Sans Arabic'; font-weight: 600; font-display: swap; src: url(/fonts/ibm-plex-sans-arabic-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'IBM Plex Sans Arabic'; font-weight: 700; font-display: swap; src: url(/fonts/ibm-plex-sans-arabic-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

:root {
  --brand: #0033FF; --brand-600: #0029CC; --brand-50: #E8EDFF; --brand-on-dark: #7D97FF;
  --ink: #0B1220; --sidebar: #0F172A; --sidebar-active: #1E293B;
  --bg: #F4F6FB; --card: #FFFFFF; --line: #E5E8EF; --muted: #667085;
  --success: #166534; --success-bg: #E7F6EC; --success-solid: #1F9D55;
  --warning: #9A6B00; --warning-bg: #FFF3CC; --warning-solid: #D9A400;
  --danger: #B42318; --danger-bg: #FDE8E6;
  --radius: 16px; --radius-sm: 12px;
  --font: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, system-ui, -apple-system, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 14px/1.5 var(--font); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.num, .ltr { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; display: inline-block; white-space: nowrap; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--sidebar); color: #cbd5e1; padding: 22px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-size: 20px; font-weight: 700; color: #fff; letter-spacing: -.2px; }
.brand b { color: var(--brand-on-dark); font-weight: 700; }
.brand svg { flex: none; }
.nav-title { font-size: 11px; color: #64748b; padding: 14px 12px 4px; }
.nav-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px; background: transparent; color: #cbd5e1; text-align: start; text-decoration: none; font-size: 14px; }
.nav-item:hover:not(.off) { background: rgba(255,255,255,.05); }
.nav-item.active { background: var(--sidebar-active); color: #fff; font-weight: 600; }
.nav-item.off { opacity: .45; cursor: default; }
.nav-item small { font-size: 10px; color: #94a3b8; }
.pill { min-width: 24px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; text-align: center; background: #334155; color: #fff; }
.pill.red { background: var(--danger); }
.pill.amber { background: #FDE68A; color: #5b4300; }
.side-foot { margin-top: auto; padding: 12px; border-top: 1px solid #1e293b; font-size: 13px; }
.side-foot .who { color: #fff; font-weight: 600; }
.side-foot button { margin-top: 8px; width: 100%; padding: 8px; border-radius: 10px; border: 1px solid #334155; background: transparent; color: #cbd5e1; }
.side-foot button:hover { background: #1e293b; }
main { padding: 24px 28px 48px; min-width: 0; }

/* ---------- cards ---------- */
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 30px; font-weight: 700; margin: 6px 0 2px; letter-spacing: -.5px; }
.stat .sub { color: var(--muted); font-size: 12px; }
.stat.green .value { color: var(--success); } .stat.amber .value { color: var(--warning); } .stat.red .value { color: var(--danger); } .stat.blue .value { color: var(--brand); }
.bar { height: 6px; border-radius: 99px; background: #E9ECF2; margin-top: 12px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: currentColor; transition: width .4s ease; }
.stat.green .bar { color: var(--success-solid); } .stat.amber .bar { color: var(--warning-solid); } .stat.red .bar { color: var(--danger); }

/* ---------- panel + table ---------- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.panel-head h1 { margin: 0; font-size: 20px; display: flex; align-items: center; gap: 8px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 4px var(--danger-bg); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: 13px; }
.chip:hover { border-color: #c5cbd8; }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.search { margin-inline-start: auto; width: min(340px, 100%); padding: 9px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.search:focus, .field:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: transparent; }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 980px; }
th { text-align: start; font-weight: 500; font-size: 12px; color: var(--muted); padding: 10px 12px; background: #FAFBFD; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
td { padding: 12px 12px; border-bottom: 1px solid #EEF0F5; vertical-align: middle; font-size: 13px; white-space: nowrap; }
td.c-name { white-space: normal; min-width: 180px; }
th.c-act, td.c-act { position: sticky; inset-inline-end: 0; background: #fff; box-shadow: 8px 0 12px -8px rgba(15,23,42,.12); }
th.c-act { background: #FAFBFD; }
tbody tr:hover td.c-act { background: #F8F9FD; }
td.c-svc { white-space: normal; min-width: 170px; }
tbody tr { cursor: pointer; transition: background .15s; }
tbody tr:hover { background: #F8F9FD; }
tbody tr.hot { box-shadow: inset 3px 0 0 var(--danger); }
tbody tr.fresh { animation: flash 6s ease-out; }
@keyframes flash { from { background: var(--brand-50); } to { background: transparent; } }
.cname { font-weight: 600; font-size: 14px; } .csub { color: var(--muted); font-size: 12px; margin-top: 1px; }
.price { font-weight: 700; font-size: 14px; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.hot { background: var(--danger-bg); color: var(--danger); } .badge.medium { background: var(--warning-bg); color: var(--warning); } .badge.cold { background: var(--success-bg); color: var(--success); }
.badge.flag { background: var(--warning-bg); color: var(--warning); margin-inline-start: 6px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 18px; border-radius: var(--radius-sm); border: 1px solid transparent; background: var(--brand); color: #fff; font-weight: 600; font-size: 14px; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--brand-600); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { padding: 7px 16px; font-size: 13px; }
.btn.ghost { background: #fff; color: var(--ink); border-color: #cfd5e2; } .btn.ghost:hover { background: #F4F6FB; }
.btn.green { background: var(--success); } .btn.amber { background: var(--warning); } .btn.red { background: #fff; color: var(--danger); border-color: #f1c0bb; }
.foot { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; color: var(--muted); font-size: 13px; }
.empty { padding: 56px 20px; text-align: center; color: var(--muted); }
.skel { height: 14px; border-radius: 6px; background: linear-gradient(90deg, #EEF0F5 25%, #F7F8FB 50%, #EEF0F5 75%); background-size: 200% 100%; animation: sh 1.2s infinite; }
@keyframes sh { to { background-position: -200% 0; } }

/* ---------- drawer + sheet ---------- */
.overlay { position: fixed; inset: 0; background: rgba(11,18,32,.45); z-index: 40; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.drawer { position: fixed; top: 0; bottom: 0; left: 0; width: min(460px, 100%); background: #fff; z-index: 41; overflow-y: auto; padding: 24px; box-shadow: 0 0 40px rgba(0,0,0,.2); animation: slide .2s ease-out; }
@keyframes slide { from { transform: translateX(-30px); opacity: 0; } }
.drawer h2 { margin: 0 0 4px; font-size: 22px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; margin: 16px 0; font-size: 13px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 500; }
.h3 { font-size: 14px; font-weight: 700; margin: 22px 0 8px; }
.tl { list-style: none; margin: 0; padding: 0; } .tl li { padding: 9px 0; border-bottom: 1px solid #EEF0F5; font-size: 13px; display: flex; justify-content: space-between; gap: 10px; }
.sheet { position: fixed; z-index: 51; inset-inline: 0; bottom: 0; margin-inline: auto; width: min(560px, 100%); background: #fff; border-radius: 20px 20px 0 0; padding: 22px 22px 26px; box-shadow: 0 -10px 40px rgba(0,0,0,.25); animation: up .2s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet h2 { margin: 0; font-size: 18px; } .sheet p { margin: 2px 0 14px; color: var(--muted); }
.outs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.out { padding: 12px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: #fff; font-weight: 600; }
.out:hover { border-color: #b8c2e0; } .out.on { border-color: var(--brand); background: var(--brand-50); color: var(--brand); }
.field { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; margin-top: 8px; }
.row2 { display: flex; gap: 10px; margin-top: 14px; } .row2 .btn { flex: 1; }
label.l { display: block; margin-top: 14px; font-size: 12px; color: var(--muted); }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(900px 400px at 80% -10%, var(--brand-50), transparent), var(--bg); }
.login form { width: min(400px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 32px 28px; box-shadow: 0 20px 50px rgba(15,23,42,.08); }
.login .logo { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 22px; font-size: 26px; font-weight: 700; }
.login .logo b { color: var(--brand); } .login .err { color: var(--danger); font-size: 13px; min-height: 20px; margin-top: 8px; }

/* ---------- toasts ---------- */
#toasts { position: fixed; z-index: 60; inset-inline-start: 20px; bottom: 20px; display: grid; gap: 8px; }
.toast { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 12px; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.25); animation: up .2s; }
.toast.ok { background: var(--success); } .toast.bad { background: var(--danger); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- mobile: sidebar becomes a bottom bar, table becomes cards ---------- */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset-inline: 0; bottom: 0; top: auto; height: auto; flex-direction: row; justify-content: space-around; padding: 6px; z-index: 30; gap: 2px; }
  .brand, .nav-title, .side-foot, .nav-item.off, .nav-item small { display: none; }
  .nav-item { flex-direction: column; gap: 2px; padding: 8px 6px; font-size: 12px; text-align: center; }
  main { padding: 16px 14px 96px; }
  .cards { grid-template-columns: 1fr; }
  .stat .value { font-size: 26px; }
  table { min-width: 0; } thead { display: none; }
  tbody tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; padding: 14px; border-bottom: 1px solid var(--line); }
  td { display: block; border: 0; padding: 0; } td::before { content: attr(data-l); display: block; font-size: 11px; color: var(--muted); }
  th.c-act, td.c-act { position: static; box-shadow: none; background: transparent; }
  td.c-name, td.c-act { grid-column: 1 / -1; } td.c-name::before, td.c-act::before { display: none; }
  .scroll { overflow: visible; }
}
