@font-face { font-family: 'Cairo'; src: url('/fonts/cairo-arabic-wght-normal.woff2') format('woff2-variations'); font-weight: 200 1000; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+200C-200E, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: 'Cairo'; src: url('/fonts/cairo-latin-wght-normal.woff2') format('woff2-variations'); font-weight: 200 1000; font-display: swap; unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2212, U+2264, U+2265; }

:root {
  color-scheme: dark;
  --ink: 255 255 255; --well: 0 0 0;
  --card-bg: linear-gradient(180deg, rgba(38,41,50,.86), rgba(30,32,39,.92));
  --glow-base: rgba(38,41,50,.9); --pill-bg: rgba(38,41,50,.8); --col-bg: rgba(30,32,39,.72); --chat-bg: rgba(25,26,32,.72); --bar-bg: rgba(20,21,26,.9);
  --seg-on: linear-gradient(180deg, #3a3d4a, #2c2f3a); --on-ink: #fff;
  --text-2: #d5d6e0; --warn-ink: #ffbd80; --crit-ink: #ff9dab; --abn-ink: #cdb7ff; --ok-ink: #79e7c6; --teal-ink: #6fe3e0; --pink-ink: #ff6d97;
  --bg: #14151a; --bg-2: #191a20;
  --panel: #1e2027; --panel-2: #262932; --panel-3: #2f323d;
  --line: rgb(var(--ink) / .07); --line-2: rgb(var(--ink) / .14);
  --text: #f3f3f6; --muted: #a2a4b2; --faint: #7d7f8e;
  --orange: #ff7a1a; --orange-2: #ff5e1f; --pink: #ff2f6d; --purple: #8f4bff; --teal: #17c3c5; --lime: #d4f23c; --red: #ff5c6c; --green: #2fd6a4; --blue: #6aa9ff;
  --grad: linear-gradient(120deg, #ff8a1f 0%, #ff4d3d 60%, #ff2f6d 100%);
  --grad-soft: linear-gradient(135deg, rgba(255,122,26,.22), rgba(255,47,109,.14));
  --chart-1: #e6640f; --chart-2: #109a9c;
  --st-registered: #6aa9ff; --st-collected: #d4f23c; --st-processing: #ff5fae; --st-review: #b08bff; --st-approved: #2fd6c0; --st-delivered: #a2a4b2; --st-cancelled: #ff5c6c;
  --radius: 20px; --radius-sm: 12px;
  --shadow: 0 10px 30px rgb(var(--well) / .28), inset 0 1px 0 rgb(var(--ink) / .04);
  --topbar: 68px;
}

/* النسخة البيضاء: نفس الهوية بالتدرج البرتقالي، بدرجات نصوص أغمق لتبقى مقروءة على الأبيض */
:root[data-theme="light"] {
  color-scheme: light;
  --ink: 24 26 40; --well: 165 170 190;
  --card-bg: #ffffff;
  --glow-base: #ffffff; --pill-bg: #ffffff; --col-bg: #ecedf3; --chat-bg: #ffffff; --bar-bg: rgba(255,255,255,.92);
  --seg-on: #ffffff; --on-ink: #1b1c24;
  --text-2: #3c3e4c; --warn-ink: #8f4a00; --crit-ink: #ae1730; --abn-ink: #5a2fc0; --ok-ink: #06735a; --teal-ink: #07706f; --pink-ink: #bd1b52;
  --bg: #f4f4f8; --bg-2: #ffffff;
  --panel: #ffffff; --panel-2: #ffffff; --panel-3: #e7e8ef;
  --text: #1b1c24; --muted: #50535f; --faint: #5f6270;
  --orange: #d9540a; --orange-2: #e8590c; --purple: #6f2fe0; --teal: #0a8587; --red: #c9233a; --green: #0a7d5c; --blue: #2563c4;
  --st-registered: #2259b3; --st-collected: #5f6f00; --st-processing: #b81f77; --st-review: #6233cc; --st-approved: #087a6b; --st-delivered: #5d6070; --st-cancelled: #c9233a;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif; font-size: 14.5px; line-height: 1.6; min-height: 100dvh;
  background-image:
    radial-gradient(520px 380px at 12% 8%, rgba(143,75,255,.16), transparent 70%),
    radial-gradient(620px 420px at 88% 42%, rgba(255,106,26,.11), transparent 70%),
    radial-gradient(520px 420px at 22% 92%, rgba(255,47,109,.08), transparent 70%);
  background-attachment: fixed;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; font-weight: 800; line-height: 1.3; }
h2 { font-size: 16px; font-weight: 700; }
h3 { font-size: 14.5px; font-weight: 700; }
a { color: inherit; text-decoration: none; }
code { font-family: Consolas, 'Cascadia Mono', monospace; font-size: .92em; color: var(--text-2); direction: ltr; unicode-bidi: isolate; }
small { font-size: 12.5px; }
ul, ol { list-style: none; margin: 0; padding: 0; }
dl, dd { margin: 0; }
.muted { color: var(--muted); }
.block { display: block; }
.nowrap { white-space: nowrap; }
.text-warn { color: var(--warn-ink); }
.text-good { color: var(--green); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pad { padding: 16px 18px; }
.pad-x { padding-inline: 18px; }
.ic { width: 18px; height: 18px; flex: none; vertical-align: -4px; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* ---- Controls ---- */
input, select, textarea {
  font: inherit; color: var(--text); background: rgb(var(--ink) / .05); border: 1px solid var(--line-2); border-radius: 10px; padding: 8px 12px; width: 100%; min-height: 40px;
}
textarea { resize: vertical; }
select option { background: var(--panel-2); color: var(--text); }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { border-color: var(--orange); outline: 2px solid rgba(255,122,26,.25); outline-offset: 0; }
input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--orange); padding: 0; flex: none; }
input[type="month"] { width: auto; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 0; border-radius: 12px; padding: 8px 16px; min-height: 40px; font: inherit; font-weight: 700; cursor: pointer; color: var(--text); white-space: nowrap; transition: transform .12s, filter .15s, background .15s; }
.btn:hover:not(:disabled) { filter: brightness(1.1); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .42; cursor: not-allowed; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 6px 18px rgba(255,90,40,.28); }
.btn-soft { background: var(--panel-3); }
.btn-ghost { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn-ghost:hover:not(:disabled) { color: var(--text); }
.btn-danger { background: #d9344a; color: #fff; }
.btn-sm { min-height: 32px; padding: 3px 11px; font-size: 13px; border-radius: 9px; }
.btn-lg { min-height: 48px; padding: 10px 22px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 8px; align-items: center; }
.btn-row.wrap { flex-wrap: wrap; }
.btn-row.end { justify-content: flex-end; }
.push { margin-inline-start: auto; }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; border: 0; background: transparent; color: var(--muted); cursor: pointer; flex: none; }
.icon-btn:hover { background: rgb(var(--ink) / .07); color: var(--text); }
.link { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); background: none; border: 0; font: inherit; font-size: 13px; cursor: pointer; }
.link:hover { color: var(--orange); }
.link .ic { width: 15px; height: 15px; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 13px; color: var(--muted); font-weight: 600; }
.field-inline { flex-direction: row; align-items: center; gap: 8px; }
.field-inline > span { white-space: nowrap; }
.field-inline input { width: auto; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.form-error { background: rgba(255,92,108,.14); color: var(--crit-ink); padding: 8px 12px; border-radius: 10px; font-size: 13.5px; margin-top: 10px; }
.check-row { display: flex; gap: 8px; align-items: center; cursor: pointer; padding: 5px 0; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 2px 14px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-lg { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.segmented { display: inline-flex; gap: 3px; padding: 4px; background: rgb(var(--well) / .28); border-radius: 13px; box-shadow: inset 0 1px 3px rgb(var(--well) / .4); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 700; font-size: 13.5px; padding: 6px 13px; border-radius: 10px; cursor: pointer; white-space: nowrap; min-height: 34px; position: relative; }
.seg:hover { color: var(--text); }
.seg.on { background: var(--seg-on); color: var(--on-ink); box-shadow: 0 2px 6px rgb(var(--well) / .4), inset 0 1px 0 rgb(var(--ink) / .08); }
.seg .ic { width: 16px; height: 16px; }

.search { display: flex; align-items: center; gap: 8px; background: rgb(var(--ink) / .05); border: 1px solid var(--line-2); border-radius: 11px; padding-inline: 12px; min-width: 240px; color: var(--muted); }
.search input { background: transparent; border: 0; padding-inline: 0; outline: 0; }
.search:focus-within { border-color: var(--orange); }
.search-sm { min-width: 180px; }
.grow { flex: 1; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar select { width: auto; }
.toolbar-tight { margin-bottom: 8px; }

/* ---- Chips ---- */
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; background: color-mix(in srgb, currentColor 11%, transparent); }
.chip .ic { width: 13px; height: 13px; }
.chip-registered { color: var(--st-registered); } .chip-collected { color: var(--st-collected); } .chip-processing { color: var(--st-processing); }
.chip-review { color: var(--st-review); } .chip-approved { color: var(--st-approved); } .chip-delivered { color: var(--st-delivered); } .chip-cancelled { color: var(--st-cancelled); }
.flag { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 7px; white-space: nowrap; vertical-align: 1px; }
.flag .ic { width: 12px; height: 12px; }
.flag-off { background: rgba(255,163,77,.16); color: var(--warn-ink); }
.flag-crit { background: rgba(255,60,90,.18); color: var(--crit-ink); }
.flag-abn { background: rgba(176,139,255,.18); color: var(--abn-ink); }
.flag-ok { background: rgba(47,214,164,.14); color: var(--ok-ink); }
.flag-muted { background: rgb(var(--ink) / .07); color: var(--muted); }
.stat-chip { padding: 6px 12px; border-radius: 11px; background: rgba(255,163,77,.13); color: var(--warn-ink); font-size: 13px; }

.avatar { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; font-size: 13.5px; font-weight: 800; color: #fff; flex: none; line-height: 1; }
.av-0 { background: linear-gradient(135deg,#ff8a1f,#ff2f6d); } .av-1 { background: linear-gradient(135deg,#8f4bff,#ff2f9d); } .av-2 { background: linear-gradient(135deg,#17c3c5,#3f6fff); }
.av-3 { background: linear-gradient(135deg,#d0a51a,#f4611a); } .av-4 { background: linear-gradient(135deg,#2fb98a,#178fb0); } .av-5 { background: linear-gradient(135deg,#5f6bff,#8f4bff); }
.person { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.person > span:last-child { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.person small { color: var(--muted); }
a.person:hover strong { color: var(--orange); }
.person-sm .avatar { width: 26px; height: 26px; border-radius: 8px; font-size: 10.5px; }

/* ---- Topbar ---- */
.app { min-height: 100dvh; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; height: var(--topbar); padding-inline: 18px; background: var(--bar-bg); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 800; font-size: 15px; min-width: 0; flex: none; }
.brand-name { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-mark { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--grad); color: #fff; flex: none; }
.brand-lg { font-size: 18px; }
.tabs { flex: 1; display: flex; align-self: stretch; gap: 2px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; display: inline-flex; align-items: center; gap: 6px; padding-inline: 10px; color: var(--muted); font-weight: 700; font-size: 13.5px; white-space: nowrap; }
.tab .ic { width: 16px; height: 16px; opacity: .85; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--on-ink); }
.tab.active .ic { color: var(--orange); opacity: 1; }
.tab.active::after { content: ''; position: absolute; inset-inline: 8px; bottom: 0; height: 2.5px; border-radius: 3px 3px 0 0; background: var(--grad); }
.top-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.user-card { position: relative; display: flex; align-items: center; gap: 9px; padding: 5px 9px; border-radius: 13px; cursor: default; }
.user-card:hover, .user-card:focus-within { background: rgb(var(--ink) / .06); }
.user-meta { display: flex; flex-direction: column; line-height: 1.25; }
.user-meta strong { font-size: 13px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta small { color: var(--muted); font-size: 11.5px; }
.user-menu { position: absolute; top: 100%; inset-inline-end: 0; width: 220px; padding: 6px; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: 0 18px 40px rgb(var(--well) / .5); display: none; margin-top: 2px; }
.user-card:hover .user-menu, .user-card:focus-within .user-menu { display: block; }
.user-menu a, .user-menu button { display: flex; gap: 9px; align-items: center; width: 100%; padding: 8px 10px; border: 0; background: none; color: var(--text); font: inherit; font-size: 13.5px; border-radius: 9px; cursor: pointer; text-align: start; }
.user-menu a:hover, .user-menu button:hover { background: rgb(var(--ink) / .07); }
.btn-plus { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--grad); color: #fff; box-shadow: 0 6px 16px rgba(255,80,50,.35); flex: none; }
.badge { position: absolute; top: 1px; inset-inline-end: 1px; min-width: 17px; height: 17px; padding-inline: 4px; border-radius: 9px; background: #c8420a; color: #fff; font-size: 10.5px; font-weight: 800; display: grid; place-items: center; line-height: 1; }
.dot { position: absolute; top: 6px; inset-inline-end: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--orange); }
.seg .dot { position: static; display: inline-block; margin-inline-start: 2px; }

/* ---- Layout ---- */
.layout { display: flex; align-items: flex-start; }
#view { flex: 1; min-width: 0; padding: 18px 20px 40px; outline: 0; }
.chat { display: none; width: 320px; flex: none; position: sticky; top: var(--topbar); height: calc(100dvh - var(--topbar)); border-inline-start: 1px solid var(--line); background: var(--chat-bg); flex-direction: column; }
.chat-open .chat { display: flex; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.back { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.back:hover { color: var(--orange); }
.card { background: var(--card-bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); min-width: 0; }
.card-flush { padding: 0; overflow: hidden; }
.block-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.block-head h2 { display: inline-flex; align-items: center; gap: 7px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, 1fr); gap: 16px; align-items: start; margin-top: 16px; }
.three-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 16px; }
.loading { display: flex; justify-content: center; gap: 7px; padding: 56px 0; }
.loading span { width: 10px; height: 10px; border-radius: 50%; background: var(--orange); animation: pulse 1s infinite ease-in-out; }
.loading span:nth-child(2) { animation-delay: .15s; } .loading span:nth-child(3) { animation-delay: .3s; }
@keyframes pulse { 0%, 100% { opacity: .25; transform: scale(.8); } 50% { opacity: 1; transform: scale(1); } }
.empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 30px 16px; text-align: center; color: var(--muted); }
.empty .ic { width: 28px; height: 28px; opacity: .55; margin-bottom: 4px; }
.empty strong { color: var(--text); font-size: 14.5px; }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { font-size: 12.5px; font-weight: 700; color: var(--muted); text-align: start; padding: 11px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: rgb(var(--ink) / .022); }
.table-sm th, .table-sm td { padding: 7px 10px; }
.td-end { text-align: end; white-space: nowrap; }
.td-start { text-align: start; unicode-bidi: plaintext; }
[dir="rtl"] td[dir="ltr"].td-start { text-align: right; }
.row-off { opacity: .55; }
.row-crit { background: rgba(255,60,90,.08); }
.pager { display: flex; justify-content: center; align-items: center; gap: 12px; padding: 12px; color: var(--muted); font-size: 13px; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.kpi { background: var(--card-bg); border: 1px solid var(--line); border-radius: 16px; padding: 12px 16px; display: flex; flex-direction: column; min-width: 0; }
.kpi small { color: var(--muted); }
.kpi strong { font-size: 20px; font-weight: 800; line-height: 1.4; }
.kpi span { color: var(--muted); font-size: 12.5px; }
.kpi-hero { background: var(--grad); border: 0; color: #fff; }
.kpi-hero small, .kpi-hero span { color: rgba(255,255,255,.9); }
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); text-align: center; padding: 0 12px 14px; }
.kpi-row strong { display: block; font-size: 20px; }
.kpi-row small { color: var(--muted); }

/* ---- Dashboard ---- */
.dash { display: flex; flex-direction: column; gap: 14px; }
.dash-top { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(220px, .8fr) minmax(300px, 1.15fr); gap: 14px; }
.dash-top.no-chart { grid-template-columns: 1fr; }
.card-chart { padding: 12px 14px; display: flex; flex-direction: column; justify-content: center; }
.card-hero { position: relative; overflow: hidden; border: 0; color: #fff; background: linear-gradient(135deg, #ff2f6d 0%, #ff6a1f 62%, #ffa01f 100%); display: flex; flex-direction: column; gap: 2px; }
.card-hero.hero-calm { background: linear-gradient(135deg, #0f8f8f, #17c3a5); justify-content: center; }
.card-hero header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.hero-count { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: rgba(20,21,26,.85); font-weight: 800; }
.hero-nav { display: flex; gap: 4px; }
.hero-arrow { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 9px; background: rgba(255,255,255,.2); color: #fff; cursor: pointer; }
.hero-arrow:hover { background: rgba(255,255,255,.32); }
.hero-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 700; }
.hero-tag .ic { width: 14px; height: 14px; }
.card-hero h3 { font-size: 20px; font-weight: 800; line-height: 1.3; }
.card-hero p { font-weight: 600; }
.card-hero small { color: rgba(255,255,255,.88); }
.hero-link { margin-top: auto; padding-top: 8px; display: inline-flex; gap: 3px; align-items: center; font-weight: 700; font-size: 13px; }
.card-control { display: flex; flex-direction: column; gap: 10px; background: radial-gradient(420px 200px at 8% 110%, rgba(143,75,255,.34), transparent 70%), var(--card-bg); }
.card-control .segmented { align-self: stretch; }
.card-control .seg { flex: 1; justify-content: center; }
.control-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.control-row .muted { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; }
.control-cta { margin-top: auto; flex-wrap: wrap; }
.control-cta > div { display: flex; flex-direction: column; }
.control-cta .btn { flex: 1; min-width: 170px; }
.big { font-size: 19px; font-weight: 800; }
.neon-chips { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.neon { --c: var(--line-2); display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 10px; border-radius: 14px; border: 1.5px solid var(--c); box-shadow: 0 0 12px color-mix(in srgb, var(--c) 28%, transparent), inset 0 0 10px color-mix(in srgb, var(--c) 10%, transparent); background: transparent; color: var(--text); font: inherit; cursor: pointer; min-width: 0; }
.neon strong { font-size: 17px; font-weight: 800; }
.neon span { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.neon:hover { background: color-mix(in srgb, var(--c) 10%, transparent); }
.neon-registered { --c: var(--st-registered); } .neon-collected { --c: var(--st-collected); } .neon-processing { --c: var(--st-processing); } .neon-review { --c: var(--st-review); } .neon-approved { --c: var(--st-approved); } .neon-delivered { --c: var(--st-delivered); } .neon-all { --c: var(--orange); }
.neon-sm { grid-template-columns: repeat(7, minmax(0, 1fr)); margin-bottom: 14px; }
.neon.on { background: color-mix(in srgb, var(--c) 20%, transparent); }
.stat-pills { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.stat-pill { display: flex; align-items: center; gap: 11px; padding: 9px 14px; border-radius: 16px; background: var(--pill-bg); border: 1px solid var(--line); min-width: 0; }
a.stat-pill:hover { border-color: var(--line-2); }
.stat-pill strong { display: block; font-size: 15.5px; font-weight: 800; line-height: 1.3; }
.stat-pill small { color: var(--muted); }
.pill-ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; flex: none; }
.pill-orange { background: rgba(255,122,26,.16); color: var(--orange); } .pill-pink { background: rgba(255,47,109,.16); color: var(--pink-ink); } .pill-teal { background: rgba(23,195,197,.16); color: var(--teal); } .pill-purple { background: rgba(143,75,255,.2); color: var(--st-review); } .pill-red { background: rgba(255,92,108,.2); color: var(--red); }
.dash-bottom { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(280px, 1fr); gap: 14px; align-items: start; }
.dash-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.glow-rows { display: flex; flex-direction: column; gap: 9px; }
.glow-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 16px; border: 1px solid var(--line); transition: transform .12s; }
.glow-row:hover { transform: translateX(-2px); border-color: var(--line-2); }
.glow-0 { background: linear-gradient(90deg, var(--glow-base), rgba(143,75,255,.14)); }
.glow-1 { background: linear-gradient(90deg, var(--glow-base), rgba(23,195,197,.15)); }
.glow-2 { background: linear-gradient(90deg, var(--glow-base), rgba(255,122,26,.12)); }
.glow-main { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.4; }
.glow-main small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.glow-amount { color: var(--teal-ink); font-weight: 700; font-size: 13.5px; white-space: nowrap; }
.glow-status { padding: 3px 11px; border-radius: 9px; background: linear-gradient(135deg, #0fb5b5, #14d0c0); color: #06292a; font-weight: 800; font-size: 13px; direction: ltr; }
.punch-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.punch { padding: 10px 12px; border-radius: 14px; background: rgb(var(--well) / .22); display: flex; flex-direction: column; align-items: flex-start; gap: 1px; }
.punch small { color: var(--muted); }
.punch strong { font-size: 17px; font-weight: 800; }
.team-line { margin-top: 10px; color: var(--muted); font-size: 13px; }
.team-line strong { color: var(--text); }
.mini-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.mini-list li:last-child { border-bottom: 0; }
.mini-list li > a { display: flex; flex: 1; justify-content: space-between; gap: 10px; align-items: center; min-width: 0; }
.mini-list li > a:hover strong { color: var(--orange); }
.mini-list li > div { display: flex; flex-direction: column; min-width: 0; }
.mini-list strong { font-size: 13.5px; font-weight: 600; }
.mini-list span { font-size: 12.5px; color: var(--muted); }
.mini-list b { white-space: nowrap; }
.card-alert { border-color: rgba(255,60,90,.4); background: linear-gradient(180deg, rgba(255,60,90,.13), var(--panel)); }
.card-alert h2 .ic { color: var(--red); }

/* ---- Charts ---- */
.chart { position: relative; margin: 0; display: grid; grid-template-columns: auto minmax(0,1fr); column-gap: 8px; }
.chart-yaxis { display: flex; flex-direction: column; justify-content: space-between; font-size: 11px; color: var(--faint); text-align: right; padding-block: 5px; }
.chart-plot { position: relative; min-width: 0; touch-action: pan-y; }
.chart-plot svg { display: block; overflow: visible; }
.chart-grid { stroke: rgb(var(--ink) / .07); stroke-width: 1; stroke-dasharray: 3 4; }
.chart-band { fill: rgba(47,214,164,.11); }
.chart-dot { position: absolute; width: 9px; height: 9px; border-radius: 50%; transform: translate(-50%, -50%); box-shadow: 0 0 0 2px var(--panel); pointer-events: none; }
.chart-cross { position: absolute; top: 0; bottom: 0; width: 1px; background: rgb(var(--ink) / .35); pointer-events: none; }
.chart-tip { position: absolute; top: 2px; z-index: 3; color: #fff; background: rgba(12,13,17,.95); border: 1px solid var(--line-2); border-radius: 10px; padding: 5px 10px; font-size: 12.5px; pointer-events: none; display: flex; flex-direction: column; white-space: nowrap; }
.chart-tip span { display: flex; align-items: center; gap: 5px; }
.chart-tip i, .chart-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.chart-xaxis { grid-column: 2; display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); padding-top: 4px; }
.chart-legend { grid-column: 1 / -1; display: flex; gap: 14px; justify-content: center; font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.chart-legend span { display: inline-flex; gap: 6px; align-items: center; }
.chart-hero { position: absolute; inset: 0 0 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; text-align: center; z-index: 2; }
.chart-hero strong { font-size: 32px; font-weight: 900; line-height: 1.15; text-shadow: 0 2px 14px rgb(var(--well) / .65); }
.chart-hero span { font-size: 12.5px; color: var(--text-2); text-shadow: 0 1px 6px rgb(var(--well) / .8); }
.chart-hero em { font-style: normal; color: var(--warn-ink); }
.barlist li { margin-bottom: 10px; }
.barlist-head { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; }
.barlist-track { height: 8px; border-radius: 4px; background: rgb(var(--ink) / .06); margin-top: 3px; }
.barlist-track span { display: block; height: 100%; border-radius: 4px; }
.barlist small { color: var(--faint); }

/* ---- Chat ---- */
.chat-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px 4px; }
.chat-head h2 { display: inline-flex; gap: 7px; align-items: center; font-size: 14.5px; }
.chat-channels { display: flex; gap: 3px; padding: 6px 12px; overflow-x: auto; scrollbar-width: none; }
.chat-channels .seg { font-size: 12.5px; padding: 3px 10px; min-height: 28px; }
.chat-list { flex: 1; overflow-y: auto; padding: 8px 12px; display: flex; flex-direction: column; gap: 8px; scrollbar-width: thin; scrollbar-color: var(--panel-3) transparent; }
.msg { display: flex; gap: 9px; padding: 8px 10px; border-radius: 14px; background: rgb(var(--ink) / .035); }
.msg .avatar { width: 30px; height: 30px; border-radius: 9px; font-size: 11px; }
.msg > div { flex: 1; min-width: 0; }
.msg header { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.msg header strong { font-weight: 600; }
.msg p { font-size: 13.5px; overflow-wrap: anywhere; white-space: pre-wrap; line-height: 1.5; }
.msg.mine { background: var(--grad); color: #fff; }
.msg.mine header { color: rgba(255,255,255,.9); }
.chat-form { display: flex; gap: 8px; align-items: center; padding: 10px 12px 12px; }
.chat-form input { background: rgb(var(--ink) / .06); border-color: transparent; border-radius: 12px; }
.btn-send { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border: 0; border-radius: 12px; background: var(--grad); color: #fff; cursor: pointer; }

/* ---- Modal ---- */
.modal { border: 1px solid var(--line-2); border-radius: 20px; background: var(--panel); color: var(--text); padding: 0; width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); box-shadow: 0 30px 80px rgb(var(--well) / .6); }
.modal-wide { width: min(880px, calc(100vw - 24px)); }
.modal::backdrop { background: rgba(5,6,10,.66); backdrop-filter: blur(3px); }
.modal[open] { display: flex; }
.modal-form { display: flex; flex-direction: column; width: 100%; min-height: 0; max-height: calc(100dvh - 26px); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 16.5px; }
.modal-body { padding: 16px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; flex: 1; min-height: 0; }
.modal-foot { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
.modal-foot .btn-ghost { margin-inline-start: auto; }
.modal-text { color: var(--text-2); }
.modal-sub { font-size: 14px; }
.entry-input { min-width: 90px; }
.note-line { display: flex; gap: 6px; align-items: flex-start; padding: 7px 10px; border-radius: 10px; background: rgb(var(--ink) / .04); font-size: 13px; margin-top: 6px; }
.note-line .ic { width: 15px; height: 15px; margin-top: 2px; }
.note-line.warn { background: rgba(255,163,77,.11); color: var(--warn-ink); }
.notif-list { display: flex; flex-direction: column; gap: 5px; }
.notif { display: flex; gap: 10px; padding: 9px 10px; border-radius: 12px; }
.notif.unread { background: rgba(255,122,26,.09); }
.notif-ic { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: rgb(var(--ink) / .07); flex: none; }
.notif-critical .notif-ic, .notif-urgent .notif-ic { background: rgba(255,60,90,.2); color: var(--crit-ink); }
.notif-warning .notif-ic { background: rgba(255,163,77,.2); color: var(--warn-ink); }
.notif-success .notif-ic { background: rgba(47,214,164,.18); color: var(--green); }
.notif a:hover strong { color: var(--orange); }
.notif p { font-size: 13px; color: var(--muted); }
.notif time { font-size: 11.5px; color: var(--faint); }

/* ---- Patient / order pages ---- */
.profile-head { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-bottom: 16px; }
.profile-head .avatar { width: 54px; height: 54px; border-radius: 16px; font-size: 18px; }
.profile-main { flex: 1; min-width: 240px; }
.profile-main h1 { font-size: 21px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.profile-notes { display: flex; gap: 6px; font-size: 13px; color: var(--warn-ink); margin-top: 3px; }
.link-box { padding: 9px 12px; border-radius: 11px; background: rgb(var(--well) / .28); border: 1px dashed var(--line-2); overflow-wrap: anywhere; margin-block: 8px 10px; text-align: left; direction: ltr; }
.link-box code { font-size: 12.5px; }
.portal-card { background: radial-gradient(380px 200px at 90% -10%, rgba(255,106,26,.2), transparent 70%), var(--card-bg); }
.portal-card.is-off { opacity: .8; }
.portal-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.visit-list li a { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.visit-list li:last-child a { border-bottom: 0; }
.visit-list li a:hover strong code { color: var(--orange); }
.visit-list li a > div:first-child { min-width: 0; display: flex; flex-direction: column; }
.visit-list p { font-size: 13px; color: var(--text-2); }
.visit-end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: end; flex: none; }
.result-group { border-bottom: 1px solid var(--line); }
.result-group:last-child { border-bottom: 0; }
.result-group summary { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; padding: 9px 0; cursor: pointer; list-style: none; }
.result-group summary::-webkit-details-marker { display: none; }
.result-group summary strong { flex: 1 1 140px; }
.stepper { display: flex; justify-content: space-between; gap: 4px; overflow-x: auto; }
.stepper li { flex: 1; min-width: 74px; display: flex; flex-direction: column; align-items: center; gap: 3px; position: relative; color: var(--muted); text-align: center; }
.stepper li span { z-index: 1; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--panel-3); font-weight: 800; font-size: 13px; }
.stepper li .ic { width: 15px; height: 15px; }
.stepper li::after { content: ''; position: absolute; top: 14px; inset-inline-start: 50%; width: 100%; height: 2px; background: var(--panel-3); }
.stepper li:last-child::after { display: none; }
.stepper li.done { color: var(--muted); }
.stepper li.done span { background: rgba(47,214,192,.22); color: var(--st-approved); }
.stepper li.done::after { background: var(--st-approved); }
.stepper li.now { color: var(--text); font-weight: 700; }
.stepper li.now span { background: var(--grad); color: #fff; box-shadow: 0 0 14px rgba(255,90,40,.5); }
.item-list { display: flex; flex-direction: column; gap: 10px; }
.item { padding: 11px 13px; background: rgb(var(--well) / .18); border-radius: 14px; }
.item-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.item-head > div { display: flex; flex-direction: column; min-width: 0; }
.item-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-top: 7px; }
.sum-list > div { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid var(--line); gap: 10px; }
.sum-list dt { color: var(--muted); }
.sum-strong { font-weight: 800; font-size: 15.5px; border-bottom: 0 !important; }
.cat-title { font-size: 13px; color: var(--muted); margin-block: 13px 7px; font-weight: 700; }
.pay-list li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.pay-list li > div { display: flex; flex-direction: column; }
.pay-list .refund strong { color: var(--warn-ink); }

/* ---- New order ---- */
.order-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(290px, 1fr); gap: 16px; align-items: start; }
.order-cart { position: sticky; top: calc(var(--topbar) + 12px); display: flex; flex-direction: column; gap: 10px; max-height: calc(100dvh - var(--topbar) - 24px); overflow-y: auto; }
.order-cart .block-head { margin-bottom: 0; }
.step-no { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; background: var(--grad); color: #fff; font-size: 13px; }
.picked { display: flex; gap: 11px; align-items: center; padding: 8px 10px; border-radius: 13px; background: rgba(255,122,26,.09); }
.picked > div { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.pick-results { display: flex; flex-direction: column; gap: 3px; }
.pick-row { display: flex; gap: 10px; align-items: center; padding: 7px 9px; border: 0; border-radius: 11px; background: transparent; color: var(--text); font: inherit; cursor: pointer; text-align: start; }
.pick-row:hover { background: rgb(var(--ink) / .06); }
.pick-row span:last-child { display: flex; flex-direction: column; line-height: 1.35; }
.pick-row small { color: var(--muted); }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 8px; }
.pick-card { display: flex; flex-direction: column; gap: 1px; padding: 8px 11px; text-align: start; border: 1.5px solid var(--line); border-radius: 13px; background: rgb(var(--well) / .18); color: var(--text); font: inherit; cursor: pointer; min-width: 0; }
.pick-card:hover:not(:disabled) { border-color: var(--line-2); }
.pick-card small { color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-card b { font-size: 13px; color: var(--warn-ink); }
.pick-card.on { border-color: var(--orange); background: rgba(255,122,26,.13); }
.pick-card:disabled { opacity: .6; cursor: default; }
.pick-card.pkg { background: linear-gradient(135deg, rgba(143,75,255,.2), rgba(255,47,109,.11)); }
.pick-card.pkg.on { border-color: var(--orange); }
.cart-lines li { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; font-size: 13.5px; border-bottom: 1px dashed var(--line); }
.cart-lines b { white-space: nowrap; font-weight: 600; }
.prep-box { display: flex; gap: 8px; padding: 8px 11px; border-radius: 11px; background: rgba(255,163,77,.11); color: var(--warn-ink); font-size: 13px; }
.cart-sum > div { display: flex; justify-content: space-between; color: var(--muted); padding-bottom: 7px; }
.cart-sum .field-inline { justify-content: space-between; }
.cart-sum input { width: 110px; }
.cart-total { display: flex; justify-content: space-between; align-items: center; padding: 8px 13px; border-radius: 13px; background: var(--grad-soft); font-weight: 700; }
.cart-total strong { font-size: 20px; font-weight: 900; }

/* ---- Workflow ---- */
.wf-board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(235px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.wf-board.single { grid-auto-flow: row; grid-template-columns: 1fr; }
.wf-board.single .wf-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.wf-col { --c: var(--line-2); background: var(--col-bg); border: 1px solid var(--line); border-radius: 18px; padding: 10px; min-width: 0; }
.wf-col-registered { --c: var(--st-registered); } .wf-col-collected { --c: var(--st-collected); } .wf-col-processing { --c: var(--st-processing); } .wf-col-review { --c: var(--st-review); } .wf-col-approved { --c: var(--st-approved); } .wf-col-delivered { --c: var(--st-delivered); }
.wf-col.is-mine { border-color: color-mix(in srgb, var(--c) 60%, transparent); box-shadow: 0 0 18px color-mix(in srgb, var(--c) 16%, transparent); }
.wf-col > header { display: flex; align-items: center; gap: 7px; padding: 2px 5px 9px; }
.wf-col > header h2 { font-size: 13.5px; flex: 1; }
.wf-col > header b { font-size: 12.5px; background: rgb(var(--ink) / .08); padding: 0 8px; border-radius: 8px; }
.wf-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); flex: none; }
.wf-cards { display: flex; flex-direction: column; gap: 8px; }
.wf-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 12px 0; }
.wf-card { background: rgb(var(--well) / .24); border: 1px solid var(--line); border-radius: 13px; padding: 9px 11px; display: flex; flex-direction: column; gap: 2px; }
.wf-card.urgent { border-color: rgba(255,60,90,.55); }
.wf-card.overdue { background: rgba(255,163,77,.07); }
.wf-card header { display: flex; justify-content: space-between; gap: 6px; align-items: flex-start; }
.wf-card header a:hover strong { color: var(--orange); }
.wf-patient { font-size: 13.5px; line-height: 1.4; }
.wf-meta { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-card footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px; margin-top: 5px; }
.wf-card footer .ic { width: 13px; height: 13px; vertical-align: -2px; }

/* ---- Catalog / tasks ---- */
.pkg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; padding: 14px; }
.pkg-card { display: flex; flex-direction: column; gap: 8px; padding: 13px 15px; border-radius: 16px; background: linear-gradient(135deg, rgba(143,75,255,.17), rgba(255,47,109,.08)); border: 1px solid var(--line); }
.pkg-card header { display: flex; justify-content: space-between; align-items: center; }
.pkg-card li { font-size: 13.5px; color: var(--text-2); }
.pkg-card li .ic { width: 14px; height: 14px; color: var(--st-approved); vertical-align: -2px; }
.pkg-card footer { margin-top: auto; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pkg-card footer strong { font-size: 17px; font-weight: 800; }
.params-table input, .params-table select { min-height: 34px; padding: 3px 7px; min-width: 66px; font-size: 13px; }
.params-table .p-name { min-width: 150px; }
.param-row[data-kind="text"] .only-num { display: none; }
.param-row:not([data-kind="text"]) .only-text { display: none; }
.task-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: start; }
.task-col { background: var(--col-bg); border: 1px solid var(--line); border-radius: 18px; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.task-col > header { display: flex; justify-content: space-between; padding: 2px 6px 3px; }
.task-col > header b { font-size: 12.5px; background: rgb(var(--ink) / .08); padding: 0 8px; border-radius: 8px; }
.task-card { background: rgb(var(--well) / .24); border: 1px solid var(--line); border-radius: 13px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.task-card header { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.task-card footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.task-card footer .ic { width: 13px; height: 13px; vertical-align: -2px; }
.perm-table th:not(:first-child), .perm-table td:not(:first-child) { text-align: center; }
.perm-table input { vertical-align: middle; }
.perm-group th { background: rgb(var(--ink) / .04); color: var(--text); text-align: start !important; }
.card-punch h2 { font-size: 18px; margin-bottom: 10px; }

/* ---- Login ---- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(480px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 26px; padding: 26px; box-shadow: 0 30px 90px rgb(var(--well) / .5); display: flex; flex-direction: column; gap: 12px; }
.login-card h1 { font-size: 22px; margin-top: 8px; }
.demo-box { margin-top: 8px; padding-top: 13px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 5px; }
.demo-box p { font-size: 13px; }
.demo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-top: 5px; }
.demo-account { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 12px; border: 1px solid var(--line); background: rgb(var(--well) / .18); color: var(--text); font: inherit; cursor: pointer; text-align: start; min-width: 0; }
.demo-account:hover { border-color: var(--orange); }
.demo-account .avatar { width: 32px; height: 32px; border-radius: 10px; font-size: 11.5px; }
.demo-account span:last-child { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.demo-account strong { font-size: 13px; }
.demo-account small { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- شريط نسخة العرض ---- */
.demo-strip { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; padding: 4px 14px; font-size: 12.5px; font-weight: 600; text-align: center; color: var(--text-2); background: rgba(255,122,26,.13); border-bottom: 1px solid rgba(255,122,26,.3); }
.demo-strip a { color: var(--warn-ink); font-weight: 800; text-decoration: underline; }

/* ---- الرئيسية حسب الوظيفة ---- */
.dash-top-two { grid-template-columns: minmax(0, 1.5fr) minmax(240px, 1fr); }
.dash-top-two:has(> :only-child) { grid-template-columns: minmax(0, 1fr); }
.focus-card { display: flex; flex-direction: column; gap: 8px; background: radial-gradient(420px 200px at 8% 110%, rgba(143,75,255,.22), transparent 70%), var(--card-bg); }
.focus-num { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.focus-num strong { font-size: 46px; font-weight: 900; line-height: 1.15; }
.focus-num span { font-size: 16px; font-weight: 700; }
.focus-card .toolbar { margin-bottom: 0; }
.focus-card .search { min-width: 0; }
.focus-cta { margin-top: auto; align-self: flex-start; }
.queue-row .glow-main:hover strong { color: var(--orange); }
.queue-row .flag .ic { width: 12px; height: 12px; }

/* ---- تفاصيل النسخة البيضاء ---- */
:root[data-theme="light"] .wf-card, :root[data-theme="light"] .task-card { background: #fff; }
:root[data-theme="light"] .wf-card.overdue { background: #fff6ec; }
:root[data-theme="light"] .chart-hero strong, :root[data-theme="light"] .chart-hero span { text-shadow: 0 0 10px #fff, 0 0 3px #fff; }

/* ---- Welcome: اختيار النسخة ---- */
.login-card { position: relative; }
.card-corner { position: absolute; top: 14px; inset-inline-end: 14px; }
:root[data-theme="light"] .only-dark, :root:not([data-theme="light"]) .only-light { display: none; }
.welcome { width: min(780px, 100%); display: flex; flex-direction: column; gap: 16px; }
.welcome-head { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.welcome-head h1 { margin-top: 6px; }
.theme-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.theme-card { display: flex; flex-direction: column; gap: 10px; padding: 10px; border: 2px solid var(--line-2); border-radius: 22px; background: var(--card-bg); color: var(--text); font: inherit; cursor: pointer; text-align: start; box-shadow: var(--shadow); transition: transform .14s, border-color .14s; min-width: 0; }
.theme-card:hover { transform: translateY(-3px); border-color: var(--orange); }
.theme-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 2px 6px 4px; }
.theme-card-foot > span:first-child { display: flex; flex-direction: column; min-width: 0; }
.theme-card-foot strong { font-size: 16px; font-weight: 800; }
.theme-card-foot small { color: var(--muted); }
.theme-go { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--grad); color: #fff; flex: none; }
/* معاينة مصغرة بألوان ثابتة: تعرض شكل كل نسخة مهما كان المظهر الحالي */
.tp { display: flex; flex-direction: column; gap: 7px; padding: 10px; border-radius: 14px; aspect-ratio: 16 / 10; overflow: hidden; border: 1px solid rgb(var(--ink) / .1); }
.tp-dark { background: radial-gradient(160px 110px at 12% 12%, rgba(143,75,255,.3), transparent 70%), #14151a; --p: #262932; --l: rgba(255,255,255,.2); }
.tp-light { background: #f4f4f8; --p: #ffffff; --l: rgba(24,26,40,.16); }
.tp-bar { display: flex; align-items: center; gap: 6px; }
.tp-logo { width: 15px; height: 15px; border-radius: 5px; background: var(--grad); }
.tp-line { width: 42px; height: 5px; border-radius: 3px; background: var(--l); }
.tp-line.short { width: 24px; }
.tp-top { display: grid; grid-template-columns: 1.5fr 1fr; gap: 7px; flex: 1; min-height: 0; }
.tp-chart { background: var(--p); border-radius: 9px; overflow: hidden; display: flex; align-items: flex-end; box-shadow: 0 2px 6px rgba(20,22,40,.12); }
.tp-chart svg { width: 100%; height: 72%; display: block; }
.tp-hero { border-radius: 9px; background: linear-gradient(135deg, #ff2f6d, #ff6a1f 62%, #ffa01f); }
.tp-chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.tp-chips i { height: 11px; border-radius: 4px; border: 1.5px solid; }
.tp-chips i:nth-child(1) { border-color: #2fd6a4; } .tp-chips i:nth-child(2) { border-color: #ff5fae; } .tp-chips i:nth-child(3) { border-color: #b9d21f; } .tp-chips i:nth-child(4) { border-color: #8f4bff; }
.tp-row { height: 13px; border-radius: 5px; background: var(--p); box-shadow: 0 1px 3px rgba(20,22,40,.1); }
.customize-note { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 18px; background: var(--grad-soft); border: 1px solid rgba(255,122,26,.4); }
.customize-note p { flex: 1; font-weight: 700; min-width: 0; }
.customize-ic { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--grad); color: #fff; flex: none; }
.customize-note-sm { padding: 9px 11px; gap: 9px; border-radius: 14px; }
.customize-note-sm p { font-size: 13px; }
.customize-note-sm .customize-ic { width: 30px; height: 30px; border-radius: 9px; }
.customize-note-sm .btn { min-height: 32px; padding: 3px 11px; font-size: 13px; }
@media (max-width: 560px) {
  .theme-choices { grid-template-columns: minmax(0, 1fr); }
  .customize-note { flex-wrap: wrap; }
  .customize-note p { flex: 1 1 60%; }
  .customize-note .btn { width: 100%; }
}

/* ---- Toasts ---- */
#toasts { position: fixed; bottom: 18px; inset-inline-start: 18px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; pointer-events: none; max-width: calc(100vw - 36px); }
.toast { padding: 9px 15px; border-radius: 12px; color: #fff; background: #0f3f3a; border: 1px solid rgba(47,214,192,.5); box-shadow: 0 10px 30px rgb(var(--well) / .5); font-size: 13.5px; font-weight: 600; animation: rise .2s; transition: opacity .25s; }
.toast-error { background: #4a1820; border-color: rgba(255,92,108,.6); }
.toast.out { opacity: 0; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

/* ---- Patient portal ---- */
.portal { max-width: 760px; margin-inline: auto; padding-bottom: 86px; }
.p-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; }
.p-main { padding: 0 16px 20px; }
.p-hero { position: relative; overflow: hidden; color: #fff; border-radius: 24px; padding: 18px 18px 14px; background: linear-gradient(135deg, #ff2f6d 0%, #ff6a1f 60%, #ffa01f 100%); box-shadow: 0 16px 40px rgba(255,70,50,.28); }
.p-hero h1 { font-size: 23px; }
.p-hero small { color: rgba(255,255,255,.92); }
.p-hero p { font-size: 13.5px; color: rgba(255,255,255,.95); }
.p-hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 13px; }
.p-hero-stats button { background: rgba(20,21,26,.3); border: 0; border-radius: 13px; color: #fff; font: inherit; padding: 6px 4px; cursor: pointer; }
.p-hero-stats button:hover { background: rgba(20,21,26,.45); }
.p-hero-stats strong { display: block; font-size: 19px; font-weight: 900; line-height: 1.3; }
.p-section { font-size: 15.5px; margin-bottom: 8px; }
.p-track h3 { font-size: 15px; }
.p-percent { font-size: 19px; font-weight: 900; color: var(--orange); }
.p-bar { height: 9px; border-radius: 5px; background: rgb(var(--ink) / .08); overflow: hidden; margin-bottom: 8px; }
.p-bar span { display: block; height: 100%; border-radius: 5px; background: var(--grad); }
.p-items li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.p-items li:last-child { border-bottom: 0; }
.p-items li > div { display: flex; flex-direction: column; min-width: 0; }
.p-prep { color: var(--warn-ink); display: flex; gap: 4px; }
.p-prep .ic { width: 14px; height: 14px; margin-top: 3px; }
.p-result { padding: 0; }
.p-result > summary { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 15px; cursor: pointer; list-style: none; }
.p-result > summary::-webkit-details-marker { display: none; }
.p-result > summary > div { display: flex; flex-direction: column; min-width: 0; }
.p-result-body { padding: 0 15px 12px; }
.p-values li { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 7px 0; border-top: 1px solid var(--line); }
.p-values li.row-crit { background: rgba(255,60,90,.09); padding-inline: 8px; border-radius: 9px; }
.p-values li > div:first-child { display: flex; flex-direction: column; min-width: 0; }
.p-val { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; }
.p-val strong { font-size: 15.5px; font-weight: 800; }
.p-val strong small { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.p-result-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-top: 9px; }
.p-disclaimer { display: flex; gap: 6px; color: var(--muted); font-size: 13px; margin-top: 10px; }
.p-disclaimer .ic { width: 15px; height: 15px; margin-top: 3px; }
.p-timeline { display: flex; flex-direction: column; gap: 12px; position: relative; }
.p-timeline::before { content: ''; position: absolute; inset-block: 8px; inset-inline-start: 14px; width: 2px; background: var(--line-2); }
.p-timeline li { position: relative; }
.p-timeline > li { display: flex; gap: 10px; align-items: flex-start; }
.p-timeline > li > .card { flex: 1; min-width: 0; }
.p-node { z-index: 1; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--panel-3); color: var(--muted); flex: none; }
.p-node .ic { width: 15px; height: 15px; }
.p-node.done { background: rgba(47,214,192,.24); color: var(--st-approved); }
.p-trends { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.p-trends .block-head { flex-wrap: nowrap; align-items: flex-start; }
.p-contact { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.p-contact > div:first-child { display: flex; flex-direction: column; }
.kpi-3 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.p-nav { position: fixed; bottom: 0; inset-inline: 0; z-index: 20; display: flex; justify-content: center; background: var(--bar-bg); backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding: 5px 6px calc(5px + env(safe-area-inset-bottom)); }
.p-nav button { flex: 1; max-width: 150px; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 4px 2px; min-height: 48px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 11.5px; font-weight: 700; cursor: pointer; border-radius: 11px; }
.p-nav button.on { color: var(--on-ink); background: rgba(255,122,26,.16); }
.p-nav button.on .ic { color: var(--orange); }

/* ---- Printing ---- */
#print-root { display: none; }
@media print {
  body { background: #fff !important; color: #000; font-size: 12.5px; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block !important; }
  @page { margin: 12mm; }
}
.doc { color: #111; background: #fff; }
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #111; padding-bottom: 8px; margin-bottom: 10px; }
.doc-head h1 { font-size: 19px; }
.doc-head p { color: #444; font-size: 12px; }
.doc-title { font-size: 15px; font-weight: 800; }
.doc-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 14px; border: 1px solid #bbb; border-radius: 6px; padding: 7px 10px; margin-bottom: 12px; }
.doc-meta dt { color: #555; font-size: 11px; }
.doc-meta dd { font-weight: 700; }
.doc-test { break-inside: avoid; margin-bottom: 12px; }
.doc-test h2 { font-size: 14px; background: #eee; padding: 3px 8px; margin-bottom: 3px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.doc table { width: 100%; border-collapse: collapse; }
.doc th, .doc td { border-bottom: 1px solid #ccc; padding: 3px 8px; text-align: start; }
.doc th { font-size: 11.5px; color: #333; }
.doc td[dir="ltr"] { text-align: right; }
.doc-val { font-weight: 800; }
.doc .is-abn td { font-weight: 700; }
.doc-note { font-size: 12px; margin-top: 3px; }
.doc-sign-line { font-size: 11px; color: #555; margin-top: 2px; }
.doc-total td { font-weight: 800; font-size: 13.5px; }
.doc-foot { margin-top: 20px; border-top: 1px solid #111; padding-top: 7px; font-size: 11.5px; color: #333; }
.doc-sign { display: flex; flex-direction: column; margin-bottom: 7px; }

/* ---- Responsive ---- */
@media (max-width: 1400px) {
  .chat-open .dash-top { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .chat-open .dash-top .card-chart { grid-column: span 2; }
  .chat-open .neon-chips:not(.neon-sm) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1280px) {
  .user-meta { display: none; }
  .chat { position: fixed; inset-block: var(--topbar) 0; inset-inline-end: 0; z-index: 25; height: auto; box-shadow: -14px 0 40px rgb(var(--well) / .45); background: var(--bg-2); }
}
@media (max-width: 1080px) {
  :root { --topbar: 110px; }
  .topbar { flex-wrap: wrap; height: auto; min-height: var(--topbar); padding-block: 8px 0; row-gap: 3px; }
  .top-actions { margin-inline-start: auto; }
  .tabs { order: 3; flex: 1 0 100%; height: 42px; }
  .dash-top, .chat-open .dash-top { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .dash-top .card-chart, .chat-open .dash-top .card-chart { grid-column: span 2; }
  .dash-top-two, .chat-open .dash-top-two { grid-template-columns: minmax(0, 1fr); }
  .dash-bottom, .two-col, .order-layout { grid-template-columns: minmax(0, 1fr); }
  .order-cart { position: static; max-height: none; }
  .neon-chips:not(.neon-sm) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .neon-sm { display: flex; overflow-x: auto; scrollbar-width: none; padding: 6px 3px; }
  .neon-sm .neon { flex: none; }
  .task-board { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  #view { padding: 12px 12px 30px; }
  h1 { font-size: 21px; }
  .topbar { padding-inline: 12px; gap: 8px; }
  .brand-name { max-width: 130px; font-size: 13.5px; }
  .chat { width: 100%; }
  .dash-top, .chat-open .dash-top { grid-template-columns: minmax(0, 1fr); }
  .dash-top .card-chart, .chat-open .dash-top .card-chart { grid-column: auto; }
  .chart-hero strong { font-size: 26px; }
  .form-grid, .form-grid-3 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .search { min-width: 0; flex: 1 1 100%; }
  .page-head > .btn-row { flex-wrap: wrap; }
  .glow-amount { display: none; }
  .queue-row { flex-wrap: wrap; }
  .queue-row .glow-main { flex: 1 1 60%; }
  .queue-row .btn { width: 100%; }
  .wf-board:not(.single) { grid-auto-columns: 82vw; }
  .kpi-row { padding-inline: 4px; }
  .doc-meta { grid-template-columns: repeat(2, 1fr); }
  .card { padding: 13px 14px; }
  .card-flush { padding: 0; }
  .modal-foot .btn-ghost { margin-inline-start: 0; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
