/* =====================================================================
   QSYSTEM — نظام التصميم
   ===================================================================== */
@font-face { font-family: "Plex 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+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: "Plex 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+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: "Plex 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+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: "Plex 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+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: "Plex 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+2000-206F, U+20AC, U+2122; }
@font-face { font-family: "Plex 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+2000-206F, U+20AC, U+2122; }
@font-face { font-family: "Plex 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+2000-206F, U+20AC, U+2122; }
@font-face { font-family: "Plex 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+2000-206F, U+20AC, U+2122; }

:root {
  --bg: #F3F0E8;
  --surface: #FFFFFF;
  --surface-2: #FAF8F3;
  --ink: #15202B;
  --ink-2: #33404D;
  --muted: #5B6572;
  --line: #E2DDD2;
  --line-2: #D3CCBE;
  --brand: #0F766E;
  --brand-d: #0B5A54;
  --brand-soft: #E3F1EF;
  --accent: #F5B544;
  --accent-soft: #FDF3DF;
  --danger: #9D174D;
  --danger-soft: #F7E8EE;
  --warn: #B45309;
  --warn-soft: #FBEEDD;
  --info: #1D4ED8;
  --info-soft: #E6ECFB;
  --night: #0C1622;
  --night-2: #132131;
  --night-3: #1C3044;
  --night-line: #22364B;
  --night-muted: #9FB0C2;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(21, 32, 43, .05), 0 4px 16px rgba(21, 32, 43, .06);
  --shadow-lg: 0 10px 40px rgba(21, 32, 43, .18);
  --font: "Plex Arabic", "Segoe UI", Tahoma, system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-d); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 600; }
.num, .ltr { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 2px; }

/* ---------------- الشريط العلوي ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 20px; padding: 0 20px; min-height: 60px;
  background: var(--ink); color: #F3F0E8; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; color: #F3F0E8; font-weight: 700; font-size: 17px; letter-spacing: .5px; }
.brand:hover { color: #fff; }
.brand small { font-weight: 500; font-size: 13px; color: var(--night-muted); letter-spacing: 0; }
.logo {
  width: 32px; height: 32px; border-radius: 9px; background: var(--brand); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 17px; flex: none;
}
.logo img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; background: #fff; }
.nav { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; }
.nav a {
  color: #C9D3DD; padding: 7px 13px; border-radius: 8px; font-size: 14.5px; font-weight: 600; white-space: nowrap;
}
.nav a:hover { color: #fff; background: rgba(255, 255, 255, .07); }
.nav a.active { background: #F3F0E8; color: var(--ink); }
.nav a .ext { font-size: 11px; opacity: .6; margin-inline-start: 3px; }
.topbar-end { display: flex; align-items: center; gap: 14px; }
.clock { font-size: 14px; color: var(--night-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.user-menu { position: relative; }
.user-btn {
  display: flex; align-items: center; gap: 8px; background: rgba(255, 255, 255, .08); border: 0; color: #F3F0E8;
  padding: 6px 12px 6px 8px; border-radius: 999px; cursor: pointer; font-size: 14px;
}
.avatar {
  width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px;
}
.user-pop {
  position: absolute; inset-inline-end: 0; top: calc(100% + 8px); background: var(--surface); color: var(--ink);
  border-radius: 12px; box-shadow: var(--shadow-lg); min-width: 220px; padding: 8px; display: none;
}
.user-menu.open .user-pop { display: block; }
.user-pop .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.user-pop a, .user-pop button {
  display: block; width: 100%; text-align: start; padding: 9px 10px; border-radius: 8px; border: 0; background: none;
  color: var(--ink); cursor: pointer; font-size: 14px;
}
.user-pop a:hover, .user-pop button:hover { background: var(--bg); }

/* ---------------- أشرطة التنبيه (الدعم الفني / انتهاء الاشتراك) ---------------- */
.imp-bar, .expiry-bar { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 8px 16px; font-size: 14px; flex-wrap: wrap; text-align: center; }
.imp-bar { background: #6D28D9; color: #fff; }
.imp-bar button { border: 1px solid rgba(255,255,255,.6); background: transparent; color: #fff; border-radius: 8px; padding: 3px 12px; cursor: pointer; font: inherit; font-size: 13px; }
.imp-bar button:hover { background: rgba(255,255,255,.15); }
.expiry-bar { background: var(--accent-soft); color: #7A4A06; border-bottom: 1px solid #F1D9A6; }
.expiry-bar a { font-weight: 700; color: #7A4A06; text-decoration: underline; }
.usage { display: flex; flex-direction: column; gap: 6px; }
.usage .row { justify-content: space-between; }
.usage .bar { height: 8px; }
.usage .bar > span.warn { background: var(--warn); }
.usage .bar > span.full { background: var(--danger); }

/* ---------------- الصفحة ---------------- */
.page { max-width: 1360px; margin: 0 auto; padding: 24px 20px 48px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.subnav { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.subnav a { padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subnav a.active { color: var(--ink); border-color: var(--ink); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-body { padding: 20px; }
.card-body.tight { padding: 0; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.grid-side { grid-template-columns: minmax(340px, 420px) minmax(0, 1fr); align-items: start; }
@media (max-width: 1000px) { .grid-2, .grid-side { grid-template-columns: minmax(0, 1fr); } }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.kpi .k-label { color: var(--muted); font-size: 13.5px; }
.kpi .k-value { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .k-sub { font-size: 12.5px; color: var(--muted); }
.kpi.brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.kpi.brand .k-label, .kpi.brand .k-sub { color: rgba(255, 255, 255, .8); }

/* ---------------- الأزرار ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); padding: 9px 16px; border-radius: var(--radius-sm); cursor: pointer;
  font-weight: 600; font-size: 14.5px; line-height: 1.2; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { border-color: var(--ink); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-d); border-color: var(--brand-d); color: #fff; }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-dark:hover { background: #22303D; color: #fff; }
.btn-soft { background: var(--bg); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--bg); border-color: transparent; }
.btn-lg { padding: 14px 22px; font-size: 17px; border-radius: 12px; }
.btn-xl { padding: 18px 24px; font-size: 21px; border-radius: 14px; width: 100%; }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.kbd { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 5px; background: rgba(255, 255, 255, .18); direction: ltr; }
.btn:not(.btn-primary):not(.btn-dark) .kbd { background: var(--bg); color: var(--muted); }

/* ---------------- النماذج ---------------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label, .label { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 12.5px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface-2);
  font-size: 15px; outline: none; transition: border-color .15s, background .15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px var(--brand-soft); }
.input.lg { padding: 13px 14px; font-size: 18px; }
.textarea { min-height: 76px; resize: vertical; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.segmented { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 2px; }
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: 7px 14px; border-radius: 8px; font-weight: 600; font-size: 14px; color: var(--muted); }
.segmented input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
/* زر العين في حقول كلمة المرور */
.pw-wrap { position: relative; display: block; }
.pw-wrap > input { padding-left: 46px !important; }
.pw-eye {
  position: absolute; left: 6px; top: 50%; transform: translateY(-50%); width: 36px; height: 34px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.pw-eye:hover { background: var(--bg); color: var(--ink); }
.alert { padding: 12px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14.5px; border: 1px solid; }
.alert-error { background: var(--danger-soft); border-color: #EBC3D3; color: var(--danger); }
.alert-ok { background: var(--brand-soft); border-color: #BFE0DB; color: var(--brand-d); }
.alert-warn { background: var(--accent-soft); border-color: #F1D9A6; color: #7A4A06; }
.field-validation-error, .text-danger { color: var(--danger); font-size: 13px; }

/* ---------------- الشارات ---------------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; background: var(--bg); color: var(--muted); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.st-Waiting { background: var(--info-soft); color: var(--info); }
.st-Called { background: var(--accent-soft); color: #8A5306; }
.st-Done { background: var(--brand-soft); color: var(--brand-d); }
.st-NoShow { background: var(--danger-soft); color: var(--danger); }
.st-Cancelled, .st-Expired { background: #EEECE7; color: #7B8490; }
.badge.prio { background: #FCE7F3; color: #9D174D; }
.badge.kiosk { background: #EDE9FE; color: #6D28D9; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.dot.on { background: #16A34A; box-shadow: 0 0 0 3px rgba(22, 163, 74, .18); }
.dot.off { background: #9CA3AF; }
.dot.brk { background: var(--accent); box-shadow: 0 0 0 3px rgba(245, 181, 68, .25); }
.sq { width: 34px; height: 34px; border-radius: 9px; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }

/* ---------------- الجداول ---------------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th { text-align: start; font-weight: 600; color: var(--muted); font-size: 13px; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #FCFBF8; }
.table .t-label { font-weight: 700; font-size: 16px; direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }
.table tr.inactive td { opacity: .5; }
.table tr.flash td { animation: rowFlash 2.4s ease-out; }
@keyframes rowFlash { 0%, 30% { background: var(--accent-soft); } 100% { background: transparent; } }
.bar { height: 8px; background: var(--bg); border-radius: 99px; overflow: hidden; min-width: 60px; }
.bar > span { display: block; height: 100%; background: var(--brand); border-radius: inherit; }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs button { border: 1px solid transparent; background: none; padding: 6px 12px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--muted); }
.tabs button.active { background: var(--ink); color: #fff; }
.tabs button .n { font-size: 12px; opacity: .75; margin-inline-start: 4px; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty .big { font-size: 34px; margin-bottom: 6px; opacity: .5; }

/* ---------------- النوافذ المنبثقة ---------------- */
dialog.modal { border: 0; border-radius: 18px; padding: 0; width: min(520px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); color: var(--ink); }
dialog.modal::backdrop { background: rgba(12, 22, 34, .5); backdrop-filter: blur(2px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 20px 22px; max-height: 70vh; overflow: auto; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-start; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); }
.x-btn { border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); padding: 4px 8px; border-radius: 8px; }
.x-btn:hover { background: var(--bg); }
.menu { position: fixed; z-index: 60; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); padding: 6px; min-width: 190px; }
.menu button { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; text-align: start; padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.menu button:hover { background: var(--bg); }
.menu button.danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 0; }
.timeline { list-style: none; margin: 0; padding: 0; border-inline-start: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 16px 14px; }
.timeline li::before { content: ""; position: absolute; inset-inline-start: -6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); border: 2px solid #fff; }

/* ---------------- الإشعارات ---------------- */
.toasts { position: fixed; bottom: 20px; inset-inline-start: 20px; z-index: 90; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast {
  pointer-events: auto; min-width: 280px; max-width: 380px; background: var(--ink); color: #fff; border-radius: 12px; padding: 12px 16px;
  box-shadow: var(--shadow-lg); display: flex; gap: 12px; align-items: flex-start; animation: toastIn .25s ease-out;
}
.toast.ok { background: var(--brand-d); }
.toast.err { background: var(--danger); }
.toast .t-title { font-weight: 700; }
.toast .t-sub { font-size: 13px; opacity: .85; }
.toast.out { animation: toastOut .25s ease-in forwards; }
@keyframes toastIn { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toastOut { to { transform: translateY(12px); opacity: 0; } }

/* ---------------- تسجيل الدخول ---------------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background:
  radial-gradient(1200px 500px at 90% -10%, rgba(15, 118, 110, .12), transparent 60%),
  radial-gradient(900px 400px at -10% 110%, rgba(245, 181, 68, .16), transparent 60%), var(--bg); }
.auth-card { width: min(420px, 100%); background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); padding: 32px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.auth-brand .logo { width: 46px; height: 46px; font-size: 24px; border-radius: 12px; }
.auth-brand b { display: block; font-size: 22px; letter-spacing: 1px; }

/* ---------------- الاستقبال ---------------- */
.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.svc-tile {
  position: relative; text-align: start; cursor: pointer; background: var(--surface); border: 2px solid var(--line); border-radius: 14px;
  padding: 14px; display: flex; flex-direction: column; gap: 10px; min-height: 112px; transition: border-color .15s, box-shadow .15s;
}
.svc-tile:hover { border-color: var(--line-2); }
.svc-tile.selected { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(21, 32, 43, .08); }
.svc-tile.selected::after { content: "✓"; position: absolute; top: 10px; inset-inline-end: 12px; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.svc-tile .s-name { font-weight: 600; font-size: 15.5px; }
.svc-tile .s-wait { margin-top: auto; font-size: 13px; color: var(--muted); }
.issued {
  border: 2px dashed var(--ink); border-radius: 16px; padding: 22px; display: flex; gap: 20px; align-items: center; flex-wrap: wrap;
  background: linear-gradient(180deg, #fff, var(--surface-2)); animation: toastIn .3s ease-out;
}
.issued .i-label { font-size: 58px; font-weight: 700; line-height: 1; direction: ltr; font-variant-numeric: tabular-nums; }

/* ---------------- الكاونتر (نسخة الويب) ---------------- */
.counter-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.counter-pick button { cursor: pointer; background: var(--surface); border: 2px solid var(--line); border-radius: 16px; padding: 22px 16px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.counter-pick button:hover { border-color: var(--ink); }
.counter-pick .c-no { font-size: 40px; font-weight: 700; line-height: 1; }
.current-card { text-align: center; padding: 26px 20px; }
.current-label { font-size: clamp(72px, 9vw, 116px); font-weight: 700; line-height: 1; direction: ltr; font-variant-numeric: tabular-nums; }
.current-name { font-size: 24px; font-weight: 600; margin-top: 10px; }
.current-meta { display: flex; gap: 8px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.actions-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.actions-3 .btn { padding: 13px 10px; }
.q-item { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--line); cursor: default; }
.q-item:last-child { border-bottom: 0; }
.q-item .q-label { font-weight: 700; font-size: 17px; min-width: 64px; direction: ltr; text-align: end; font-variant-numeric: tabular-nums; }
.q-item .q-name { flex: 1; min-width: 0; }
.q-item .q-name b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-item.new { animation: rowFlash 3s ease-out; }
.q-list { max-height: 520px; overflow: auto; }
.break-banner { background: var(--accent-soft); color: #7A4A06; border: 1px solid #F1D9A6; border-radius: 12px; padding: 12px 16px; display: flex; align-items: center; gap: 10px; }

/* ---------------- لوحة التحكم ---------------- */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.board-item { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; background: var(--surface-2); display: flex; flex-direction: column; gap: 8px; }
.board-item .b-top { display: flex; align-items: center; gap: 8px; }
.board-item .b-label { font-size: 30px; font-weight: 700; line-height: 1; direction: ltr; text-align: end; font-variant-numeric: tabular-nums; }

/* ---------------- الإعلانات (الإدارة) ---------------- */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; cursor: pointer;
  border: 2px dashed var(--line-2); border-radius: 16px; padding: 30px 18px; background: var(--surface-2); color: var(--muted);
  transition: border-color .15s, background .15s, color .15s;
}
.dropzone b { color: var(--ink); font-size: 16px; }
.dropzone small { font-size: 12px; margin-top: 4px; }
.dropzone:hover, .dropzone.over { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-d); }
.up-item { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fff; }
.up-item .row { justify-content: space-between; flex-wrap: nowrap; }
.up-item .name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.up-item .bar { margin-top: 8px; height: 6px; }
.up-item.done .bar > span { background: var(--brand); }
.up-item.err { border-color: #EBC3D3; background: var(--danger-soft); color: var(--danger); }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.switch-row > span:first-child { display: flex; flex-direction: column; gap: 2px; }
.switch-row small { color: var(--muted); font-size: 12.5px; }
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: #D3CCBE; transition: background .2s; cursor: pointer; }
.switch i::after { content: ""; position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + i { background: var(--brand); }
.switch input:checked + i::after { transform: translateX(-20px); }
.switch input:focus-visible + i { outline: 3px solid var(--brand-soft); }
.switch.sm { width: 38px; height: 22px; }
.switch.sm i::after { width: 16px; height: 16px; }
.switch.sm input:checked + i::after { transform: translateX(-16px); }
.range { width: 100%; accent-color: var(--brand); }
.tips p { margin: 0 0 8px; color: var(--ink-2); font-size: 14px; }

.media-list { display: flex; flex-direction: column; }
.m-row { display: grid; grid-template-columns: 26px 184px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 14px 16px; border-bottom: 1px solid var(--line); background: #fff; transition: background .15s, opacity .15s; }
.m-row:last-child { border-bottom: 0; }
.m-row.off { background: var(--surface-2); }
.m-row.off .m-thumb { filter: grayscale(.8); opacity: .6; }
.m-row.dragging { opacity: .4; }
.m-row.drop-before { box-shadow: inset 0 3px 0 var(--brand); }
.m-handle { cursor: grab; color: #A8A193; display: flex; flex-direction: column; align-items: center; gap: 4px; padding-top: 4px; user-select: none; }
.m-handle button { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 13px; line-height: 1; padding: 3px; border-radius: 5px; }
.m-handle button:hover { background: var(--bg); color: var(--ink); }
.m-thumb { position: relative; width: 184px; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #0C1622; cursor: zoom-in; }
.m-thumb img, .m-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.m-thumb .m-type { position: absolute; top: 6px; right: 6px; background: rgba(12, 22, 34, .75); color: #fff; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.m-thumb .m-dur { position: absolute; bottom: 6px; left: 6px; background: rgba(12, 22, 34, .75); color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 6px; direction: ltr; }
.m-fields { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.m-fields .input { padding: 7px 10px; font-size: 14px; }
.m-fields .m-title { font-weight: 600; }
.m-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.m-meta label { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.m-meta .input, .m-meta .select { padding: 6px 8px; font-size: 13px; }
.m-meta .static { padding: 7px 2px; font-size: 13px; color: var(--ink); font-weight: 600; }
.m-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.m-side .row { gap: 6px; }
.m-file { font-size: 11.5px; color: var(--muted); direction: ltr; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-body { display: flex; align-items: center; justify-content: center; min-height: 300px; }
.pv-body img, .pv-body video { max-width: 100%; max-height: 75vh; display: block; }
@media (max-width: 1250px) { .m-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) {
  .m-row { grid-template-columns: 26px minmax(0, 1fr); }
  .m-thumb { width: 100%; grid-column: 2; }
  .m-fields, .m-side { grid-column: 2; }
  .m-side { align-items: flex-start; }
}

/* ---------------- ترحيب الحساب الجديد ---------------- */
.welcome { margin-bottom: 20px; background: linear-gradient(135deg, #fff, var(--brand-soft)); border-color: #BFE0DB; }
.welcome p { margin: 6px 0 16px; }
.welcome-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.welcome-steps a { display: flex; gap: 10px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; color: var(--ink); }
.welcome-steps a:hover { border-color: var(--brand); }
.welcome-steps b { width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.welcome-steps span { display: flex; flex-direction: column; font-weight: 600; }
.welcome-steps small { color: var(--muted); font-weight: 400; }

/* ---------------- الشاشات (إدارة الحساب) ---------------- */
.screens { display: flex; flex-direction: column; }
.scr { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.scr:last-child { border-bottom: 0; }
.scr.off { background: var(--surface-2); }
.scr.off .scr-qr { opacity: .35; }
.scr-qr { width: 96px; height: 96px; image-rendering: pixelated; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.scr-main { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.scr-name { font-weight: 700; padding: 5px 9px; max-width: 260px; background: transparent; border-color: transparent; }
.scr-name:hover { border-color: var(--line-2); }
.scr-code { font-size: 13.5px; color: var(--muted); }
.scr-code b { font-size: 16px; color: var(--ink); letter-spacing: 2px; }
.scr-link { max-width: 340px; padding: 5px 9px; font-size: 13px; }
.scr-actions { display: flex; flex-direction: column; gap: 6px; }
.scr-actions .btn { width: 100%; }
@media (max-width: 720px) { .scr { grid-template-columns: 72px minmax(0, 1fr); } .scr-qr { width: 72px; height: 72px; } .scr-actions { grid-column: 1 / -1; flex-direction: row; } }

/* ---------------- رمز الشاشة / الخدمة المتوقفة (شاشة العرض والكشك) ---------------- */
.screen-block { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: radial-gradient(900px 500px at 50% -10%, rgba(15,118,110,.35), transparent 60%), #0C1622; color: #F3F0E8; text-align: center; }
.screen-block .sb-box { max-width: 560px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.screen-block .logo { width: 64px; height: 64px; font-size: 32px; border-radius: 16px; }
.screen-block b { font-size: 28px; }
.screen-block p { color: #9FB0C2; font-size: 17px; margin: 0; line-height: 1.7; }
.screen-block form { display: flex; gap: 10px; margin-top: 10px; width: 100%; }
.screen-block input { flex: 1; font-size: 26px; font-weight: 700; letter-spacing: 4px; text-align: center; padding: 14px; border-radius: 14px;
  border: 2px solid #22364B; background: #132131; color: #fff; outline: none; text-transform: uppercase; }
.screen-block input:focus { border-color: var(--accent); }
.screen-block button { border: 0; border-radius: 14px; padding: 0 26px; font-size: 20px; font-weight: 700; background: var(--accent); color: #0C1622; cursor: pointer; }

/* ---------------- الطباعة (تذكرة 80 ملم) ---------------- */
.print-body { background: #fff; margin: 0; }
.ticket { width: 72mm; margin: 0 auto; padding: 4mm 2mm 6mm; color: #000; text-align: center; font-family: var(--font); }
.ticket .t-org { font-size: 17px; font-weight: 700; }
.ticket .t-sub { font-size: 12px; }
.ticket .t-logo { max-height: 18mm; max-width: 50mm; margin-bottom: 2mm; }
.ticket hr { border: 0; border-top: 1px dashed #000; margin: 3mm 0; }
.ticket .t-svc { font-size: 16px; font-weight: 600; }
.ticket .t-num { font-size: 58px; font-weight: 700; line-height: 1.05; direction: ltr; letter-spacing: 1px; }
.ticket .t-name { font-size: 18px; font-weight: 600; margin-top: 1mm; }
.ticket .t-grid { display: flex; justify-content: space-around; font-size: 13px; margin-top: 2mm; }
.ticket .t-grid b { display: block; font-size: 18px; }
.ticket .t-qr { width: 30mm; height: 30mm; image-rendering: pixelated; margin-top: 2mm; }
.ticket .t-foot { font-size: 12px; margin-top: 2mm; }
.ticket .t-date { font-size: 12px; direction: ltr; }
.print-actions { text-align: center; margin: 16px; }
@media print {
  @page { size: 80mm auto; margin: 0; }
  .print-actions { display: none; }
}

/* ---------------- عام للشاشات الصغيرة ---------------- */
@media (max-width: 720px) {
  .topbar { padding: 8px 12px; gap: 8px; }
  .nav { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .clock { display: none; }
  .page { padding: 16px 12px 40px; }
  .card-body { padding: 16px; }
  .actions-3 { grid-template-columns: 1fr 1fr; }
}
