/* =====================================================================
   نظام إدارة الطوابير - الهوية البصرية
   مستوحاة من لوحات الإرشاد في المستشفيات وقسائم تذاكر الانتظار
   ===================================================================== */
:root {
    color-scheme: light;
    /* الحبر والهوية */
    --ink: #0B2540;            /* كحلي حبري: القائمة والعناوين */
    --ink-2: #16395E;
    --ink-soft: #8EA3BD;       /* نص القائمة الثانوي */
    --accent: #1691D0;         /* لون الإجراءات (يُستبدل بلون الجهة) */
    --accent-strong: #0E76AD;
    --accent-tint: #E6F3FA;

    /* السطوح */
    --canvas: #EDF1F5;         /* خلفية رمادية مائلة للأزرق */
    --surface: #FFFFFF;
    --surface-2: #F6F8FB;
    --line: #DCE3EB;
    --line-soft: #E9EEF3;

    /* النص */
    --text: #0F1E2E;
    --text-2: #445468;
    --muted: #7A8BA0;

    /* ألوان الحالة */
    --ok: #12805C;      --ok-tint: #E4F4EC;
    --warn: #A15C07;    --warn-tint: #FCF1DC;
    --bad: #C2362F;     --bad-tint: #FBE7E5;
    --info: #5B4BC4;    --info-tint: #EEEBFB;

    --r: 10px;
    --r-sm: 7px;
    --sidebar-w: 248px;
    --font: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
    --mono: 'Cascadia Mono', Consolas, 'Courier New', monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; overflow-x: hidden; }
body { font-family: var(--font); background: var(--canvas); color: var(--text); font-size: 14.5px; line-height: 1.65; -webkit-font-smoothing: antialiased; }
a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
code { font-family: var(--mono); font-size: 12.5px; }
h1, h2, h3 { text-wrap: balance; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num, .tbl td, .stat .v, .unit-kpis b { font-variant-numeric: tabular-nums; }

/* ---------- الأيقونات (Lucide محلية) ---------- */
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.ic-sm { width: 15px; height: 15px; }
.ic-lg { width: 22px; height: 22px; }

/* =====================================================================
   الهيكل: قائمة جانبية حبرية + مساحة العمل
   ===================================================================== */
.app { display: flex; min-height: 100vh; }

.sidebar { width: var(--sidebar-w); flex: none; background: var(--ink); color: var(--ink-soft); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 60; align-self: flex-start; }
.sb-brand { display: flex; align-items: center; gap: 11px; padding: 20px 18px 18px; text-decoration: none !important; }
.sb-logo { width: 40px; height: 40px; border-radius: 9px; background: #fff; display: grid; place-items: center; flex: none; overflow: hidden; }
.sb-logo img { width: 34px; height: 34px; object-fit: contain; }
.sb-title { color: #fff; font-weight: 700; font-size: 14.5px; line-height: 1.3; }
.sb-sub { font-size: 11.5px; color: var(--ink-soft); }

.sb-context { margin: 2px 14px 6px; padding: 10px 12px; border-radius: var(--r-sm); background: rgba(255,255,255,.05); border: 1px dashed rgba(255,255,255,.14); }
.sb-context .k { font-size: 11px; color: var(--ink-soft); }
.sb-context .v { color: #fff; font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 6px; }

.sb-nav { flex: 1; overflow-y: auto; padding: 4px 0 16px 0; }
.sb-group { font-size: 11px; font-weight: 600; color: #5E7896; letter-spacing: .4px; margin: 18px 22px 6px; }
/* العنصر النشط: لسان متصل بمساحة العمل (الواجهة عربية دائماً، فالمحتوى على اليسار) */
.sb-link { display: flex; align-items: center; gap: 11px; padding: 9px 14px 9px 14px; margin: 1px 12px 1px 0; border-radius: 0 var(--r-sm) var(--r-sm) 0; color: #B9C8DA; font-weight: 500; font-size: 14px; text-decoration: none !important; position: relative; transition: color .15s, background .15s; }
.sb-link:hover { color: #fff; background: rgba(255,255,255,.06); }
.sb-link.active { margin-left: 0; background: var(--canvas); color: var(--ink); font-weight: 700; }
.sb-link.active .ic { color: var(--accent); }
.sb-link.sb-danger:hover { background: rgba(194,54,47,.18); color: #FFB4AE; }
.sb-link.active::before, .sb-link.active::after { content: ""; position: absolute; left: 0; width: 14px; height: 14px; pointer-events: none; }
.sb-link.active::before { top: -14px; border-bottom-left-radius: 14px; box-shadow: -5px 5px 0 5px var(--canvas); }
.sb-link.active::after { bottom: -14px; border-top-left-radius: 14px; box-shadow: -5px -5px 0 5px var(--canvas); }
.sb-link { margin-right: 10px; }
.sb-link:not(.active) { margin-left: 12px; border-radius: var(--r-sm); }

.sb-foot { padding: 12px 14px 14px; border-top: 1px solid rgba(255,255,255,.07); }
.sb-user { display: flex; align-items: center; gap: 10px; }
.sb-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; font-size: 14px; }
.sb-user .n { color: #fff; font-weight: 600; font-size: 13.5px; line-height: 1.25; }
.sb-user .r { font-size: 11.5px; color: var(--ink-soft); }
.sb-foot-links { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }
.sb-foot-links a { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 7px; border-radius: var(--r-sm); border: 1px solid rgba(255,255,255,.12); color: #B9C8DA; font-size: 12.5px; font-weight: 500; text-decoration: none !important; }
.sb-foot-links a:hover { color: #fff; border-color: rgba(255,255,255,.3); }
.sb-foot-links a.danger:hover { color: #FFB4AE; border-color: rgba(255,120,110,.5); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { min-height: 72px; display: flex; align-items: center; gap: 14px; padding: 14px 32px 6px; }
.tb-title { font-size: 22px; font-weight: 700; color: var(--ink); margin: 0; line-height: 1.25; letter-spacing: -.2px; }
.tb-crumb { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.tb-crumb a { color: var(--muted); }
.tb-crumb .ic { width: 13px; height: 13px; }
.tb-actions { display: flex; align-items: center; gap: 8px; margin-inline-start: 12px; }
.topbar .tb-menu { display: none; }
.content { padding: 12px 32px 40px; width: 100%; min-width: 0; flex: 1; }

.overlay { display: none; }
@media (max-width: 1000px) {
    .sidebar { position: fixed; top: 0; bottom: 0; right: 0; height: 100%; transform: translateX(105%); transition: transform .25s ease; box-shadow: 0 0 60px rgba(11,37,64,.35); }
    body.nav-open .sidebar { transform: none; }
    body.nav-open .overlay { display: block; position: fixed; inset: 0; background: rgba(11,37,64,.45); z-index: 55; }
    .topbar { padding: 12px 16px 4px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; min-height: 60px; }
    .topbar .tb-menu { display: inline-flex; }
    .tb-title { font-size: 18px; }
    .content { padding: 16px 16px 50px; }
}

/* =====================================================================
   المكونات
   ===================================================================== */
.page-head { display: flex; justify-content: flex-start; align-items: center; gap: 12px 24px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .sub { color: var(--text-2); font-size: 13.5px; display: flex; align-items: center; gap: 6px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px 22px; margin-bottom: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card h2, .card-head h2 { margin: 0 0 14px; font-size: 15.5px; font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 9px; }
.card-head h2 { margin: 0; }
.card h2 .ic, .card-head h2 .ic { color: var(--muted); }
.card .hint { color: var(--muted); font-size: 13px; margin: -6px 0 16px; max-width: 75ch; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid-2 > *, .grid-3 > * { min-width: 0; }
@media (max-width: 1100px) { .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* شريط الأرقام: كتلة واحدة مقسّمة بدل بطاقات منفصلة */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 18px; overflow: hidden; }
.stat { display: flex; gap: 14px; align-items: center; padding: 18px 20px; border-inline-start: 1px solid var(--line-soft); }
.stat:first-child { border-inline-start: 0; }
.stat-ic { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--accent-tint); color: var(--accent-strong); }
.stat-ic .ic { width: 19px; height: 19px; }
.stat.green .stat-ic { background: var(--ok-tint); color: var(--ok); }
.stat.amber .stat-ic { background: var(--warn-tint); color: var(--warn); }
.stat.violet .stat-ic { background: var(--info-tint); color: var(--info); }
.stat.red .stat-ic { background: var(--bad-tint); color: var(--bad); }
.stat .l { color: var(--text-2); font-size: 12.5px; font-weight: 500; }
.stat .v { color: var(--ink); font-size: 28px; font-weight: 700; line-height: 1.2; letter-spacing: -.5px; }
.stat .v small { font-size: 13px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.stat .s { color: var(--muted); font-size: 12px; }
@media (max-width: 700px) { .stat { border-inline-start: 0; border-top: 1px solid var(--line-soft); } .stat:first-child { border-top: 0; } }

/* الجداول */
.table-wrap { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }
table.tbl { width: 100%; border-collapse: collapse; min-width: 640px; }
.tbl th { color: var(--muted); font-size: 12px; font-weight: 600; padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 12px; border-bottom: 1px solid var(--line-soft); font-size: 14px; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl .num, .num { font-weight: 700; color: var(--ink); }
.muted { color: var(--muted); font-size: 12.5px; }
.tbl tr.off td { opacity: .5; }
.center { text-align: center !important; }

/* الشارات: حالة بنقطة لونية */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 1px 9px; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.9; }
.badge .ic { width: 13px; height: 13px; }
.b-green, .b-yellow, .b-red, .b-gray { padding-inline-start: 8px; }
.b-green::before, .b-yellow::before, .b-red::before, .b-gray::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.b-green { background: var(--ok-tint); color: var(--ok); }
.b-yellow { background: var(--warn-tint); color: var(--warn); }
.b-blue { background: var(--accent-tint); color: var(--accent-strong); }
.b-gray { background: #EEF2F6; color: #677A90; }
.b-red { background: var(--bad-tint); color: var(--bad); }
.b-violet { background: var(--info-tint); color: var(--info); }
a.badge { text-decoration: none; }

/* قسيمة تذكرة: لأرقام التذاكر ورموز الأقسام */
.stub { display: inline-flex; align-items: center; gap: 5px; font-family: var(--mono); font-size: 12.5px; font-weight: 600; color: var(--ink); background: var(--surface-2); border: 1px dashed #B9C6D5; border-radius: 5px; padding: 0 8px; line-height: 1.9; direction: ltr; }

/* النماذج */
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px 16px; }
label.f { display: block; }
label.f > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
label.f > small { display: block; color: var(--muted); font-size: 12px; margin-top: 5px; line-height: 1.55; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=tel], input[type=url], select, textarea {
    width: 100%; padding: 9px 12px; border: 1px solid #CFD8E3; border-radius: var(--r-sm); font-family: inherit; font-size: 14px; background: #fff; color: var(--text); transition: border-color .15s, box-shadow .15s; min-height: 40px;
}
input:hover, select:hover, textarea:hover { border-color: #B6C3D2; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(22,145,208,.15); }
input:disabled { background: var(--surface-2); color: var(--muted); }
textarea { resize: vertical; min-height: 76px; line-height: 1.7; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.check { display: inline-flex; align-items: center; gap: 9px; font-size: 14px; cursor: pointer; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.form-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

/* الأزرار */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-family: inherit; font-weight: 600; font-size: 14px; padding: 8px 15px; min-height: 38px; border-radius: var(--r-sm); border: 1px solid transparent; cursor: pointer; transition: background .15s, border-color .15s, color .15s; white-space: nowrap; line-height: 1.3; text-decoration: none !important; }
.btn .ic { width: 17px; height: 17px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); color: #fff; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: var(--ink-2); color: #fff; }
.btn-light { background: var(--surface); color: var(--text-2); border-color: var(--line); }
.btn-light:hover { color: var(--ink); border-color: #B6C3D2; background: var(--surface-2); }
.btn-danger { background: transparent; color: var(--bad); border-color: #F0C9C5; }
.btn-danger:hover { background: var(--bad-tint); color: var(--bad); }
.btn-green { background: transparent; color: var(--ok); border-color: #BFE3D1; }
.btn-green:hover { background: var(--ok-tint); color: var(--ok); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: #E3E9F0; }
.btn-sm { padding: 4px 10px; min-height: 30px; font-size: 12.5px; gap: 5px; }
.btn-sm .ic { width: 15px; height: 15px; }
.btn-icon { padding: 8px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.inline { display: inline; margin: 0; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.actions select, .actions input[type=number], .actions input[type=url] { width: auto; min-width: 180px; }

/* الرسائل */
.flash { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: var(--r-sm); margin-bottom: 14px; font-weight: 500; font-size: 14px; border: 1px solid; background: var(--surface); }
.flash .ic { flex: none; }
.flash.ok { color: var(--ok); border-color: #BFE3D1; background: var(--ok-tint); }
.flash.err { color: var(--bad); border-color: #F0C9C5; background: var(--bad-tint); }
.flash.info { color: var(--accent-strong); border-color: #C3E1F2; background: var(--accent-tint); }
.secret-box { background: var(--surface); border: 1px dashed var(--warn); border-radius: var(--r); padding: 16px; margin-bottom: 16px; text-align: center; color: var(--text-2); }
.secret-box .pw { font-family: var(--mono); font-size: 26px; font-weight: 700; letter-spacing: 3px; color: var(--ink); direction: ltr; user-select: all; margin-top: 6px; }

/* النوافذ */
dialog { border: none; border-radius: 12px; padding: 0; width: min(620px, 94vw); box-shadow: 0 24px 70px rgba(11,37,64,.28); }
dialog::backdrop { background: rgba(11,37,64,.5); }
dialog .dlg-head { padding: 16px 22px; border-bottom: 1px solid var(--line-soft); display: flex; justify-content: space-between; align-items: center; }
dialog .dlg-head h3 { margin: 0; color: var(--ink); font-size: 16.5px; display: flex; gap: 8px; align-items: center; }
dialog .dlg-body { padding: 20px 22px 22px; }
dialog .x { background: none; border: none; cursor: pointer; color: var(--muted); padding: 5px; border-radius: 6px; display: grid; }
dialog .x:hover { background: var(--surface-2); color: var(--ink); }

.empty { text-align: center; color: var(--muted); padding: 34px 20px; }
.empty .ic { width: 34px; height: 34px; color: #B6C3D2; display: block; margin: 0 auto 10px; stroke-width: 1.4; }
.toolbar { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar label.f { min-width: 170px; }

.pagination { display: flex; justify-content: center; gap: 4px; margin-top: 18px; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 34px; text-align: center; padding: 5px 10px; background: var(--surface); border: 1px solid var(--line); color: var(--text-2); border-radius: var(--r-sm); font-size: 13px; text-decoration: none; }
.pagination a.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.pagination span { border: none; background: none; }

/* الشبابيك / الغرف الآن */
.counter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 10px; }
.counter-tile { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px; background: var(--surface-2); }
.counter-tile.busy { background: var(--surface); border-color: #BFE3D1; box-shadow: inset 0 3px 0 var(--ok); }
.counter-tile .n { font-weight: 700; color: var(--ink); }
.counter-tile .who { font-size: 12.5px; color: var(--muted); }
.counter-tile .tk { font-size: 22px; font-weight: 700; color: var(--accent-strong); font-variant-numeric: tabular-nums; }

/* بطاقات الأقسام */
.unit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.unit-grid > * { min-width: 0; }
.unit-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); display: flex; flex-direction: column; overflow: hidden; }
.unit-card.off { opacity: .55; }
.unit-top { display: flex; gap: 12px; align-items: flex-start; padding: 16px 18px 10px; }
.unit-card > .unit-meta { padding: 0 18px; }
.unit-ic { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.unit-ic.pharmacy { background: var(--accent-tint); color: var(--accent-strong); }
.unit-ic.lab { background: var(--bad-tint); color: var(--bad); }
.unit-name { font-weight: 700; color: var(--ink); font-size: 15.5px; line-height: 1.4; }
.unit-meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.unit-meta span { display: inline-flex; align-items: center; gap: 4px; }
.unit-kpis { display: grid; grid-template-columns: repeat(3, 1fr); margin: 14px 18px 0; border: 1px solid var(--line-soft); border-radius: var(--r-sm); }
.unit-kpis div { padding: 8px 6px; text-align: center; border-inline-start: 1px solid var(--line-soft); }
.unit-kpis div:first-child { border-inline-start: 0; }
.unit-kpis b { display: block; font-size: 19px; color: var(--ink); line-height: 1.3; }
.unit-kpis small { color: var(--muted); font-size: 11.5px; }
.unit-actions { display: flex; gap: 6px; flex-wrap: wrap; padding: 12px 18px 14px; margin-top: 14px; background: var(--surface-2); border-top: 1px solid var(--line-soft); }
.section-title { display: flex; align-items: center; gap: 8px; margin: 26px 0 12px; font-size: 14.5px; font-weight: 700; color: var(--ink); }
.section-title .ic { color: var(--muted); }
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); margin-inline-start: 6px; }

/* الأجهزة */
.device-card { background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.device-head { display: flex; align-items: center; gap: 10px; }
.device-ic { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-tint); color: var(--accent-strong); flex: none; }
.device-ic.kiosk { background: var(--info-tint); color: var(--info); }
.device-ic.shared { background: var(--ok-tint); color: var(--ok); }
.device-title { font-weight: 700; color: var(--ink); line-height: 1.3; }
.device-sub { font-size: 12px; color: var(--muted); }
.url-box { display: flex; align-items: center; gap: 6px; background: var(--surface); border: 1px dashed #B9C6D5; border-radius: var(--r-sm); padding: 4px 4px 4px 10px; }
.url-box code { flex: 1; direction: ltr; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.grid-3 > .device-card { background: var(--surface); border-color: var(--line); }
.link-box { display: flex; gap: 8px; align-items: center; background: var(--surface-2); border-radius: var(--r-sm); padding: 8px 12px; margin-bottom: 8px; }
.link-box code { flex: 1; direction: ltr; text-align: left; overflow-wrap: anywhere; }

/* تبويبات قسم */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs a { display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; color: var(--text-2); font-weight: 500; font-size: 13.5px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none; }
.tabs a:hover { color: var(--ink); }
.tabs a.active { color: var(--ink); font-weight: 700; border-bottom-color: var(--accent); }
.tabs a .ic { width: 16px; height: 16px; color: var(--muted); }
.tabs a.active .ic { color: var(--accent); }

/* أشرطة الأداء */
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.bar-row .lbl { width: 78px; font-weight: 500; color: var(--text-2); font-size: 13px; }
.bar-row .track { flex: 1; background: var(--surface-2); border-radius: 3px; height: 8px; overflow: hidden; }
.bar-row .fill { height: 100%; background: var(--accent); border-radius: 3px; }
.bar-row .val { width: 40px; font-weight: 700; color: var(--ink); text-align: left; font-variant-numeric: tabular-nums; }

/* =====================================================================
   صفحة الدخول: تسجيل دخول فقط
   ===================================================================== */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; background: var(--canvas); position: relative; }
.login-card { position: relative; width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 16px 50px rgba(11,37,64,.10); overflow: hidden; }
.login-top { padding: 28px 30px 8px; text-align: center; }
.login-top img { height: 74px; }
.login-body { padding: 10px 30px 30px; }
.login-body h1 { margin: 0 0 20px; text-align: center; font-size: 19px; color: var(--ink); font-weight: 700; line-height: 1.5; }
.login-foot { position: relative; margin-top: 20px; color: var(--muted); font-size: 12.5px; text-align: center; line-height: 1.8; }
.app-foot { padding: 14px 32px 20px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }
@media (max-width: 1000px) { .app-foot { padding: 14px 16px 18px; } }
.app-foot .vendor-row { margin-top: 2px; font-size: 11.5px; opacity: .85; }
.vendor-line a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.vendor-line a:hover { color: var(--accent-strong); }
.input-ic { position: relative; }
.input-ic .ic { position: absolute; top: 50%; transform: translateY(-50%); inset-inline-start: 12px; color: var(--muted); pointer-events: none; }
.input-ic input { padding-inline-start: 40px; height: 46px; }
.ticket-edge { height: 12px; background: radial-gradient(circle at 8px -2px, var(--canvas) 7px, transparent 7.5px) repeat-x; background-size: 16px 12px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* رقم تذكرة داخل قسيمة (قد يحتوي بادئة عربية) */
.stub.tk { direction: rtl; font-family: var(--font); font-weight: 700; }
.unit-grid { grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }
@media (max-width: 1000px) {
    .sb-link.active { margin-left: 12px; border-radius: var(--r-sm); background: rgba(255,255,255,.1); color: #fff; }
    .sb-link.active::before, .sb-link.active::after { display: none; }
    .sb-link.active .ic { color: #7CC7EE; }
}

/* =====================================================================
   رابط اللغة في أسفل القائمة + الواجهة الإنجليزية (من اليسار لليمين)
   ===================================================================== */
.sb-foot-links a:first-child:nth-last-child(3) { grid-column: 1 / -1; }
.sb-foot-links a[lang="en"], .sb-foot-links a[lang="ar"] { font-weight: 600; }
[dir="ltr"] .sb-link { margin: 1px 0 1px 12px; border-radius: var(--r-sm) 0 0 var(--r-sm); }
[dir="ltr"] .sb-link:not(.active) { margin-right: 12px; margin-left: 10px; border-radius: var(--r-sm); }
[dir="ltr"] .sb-link.active { margin-right: 0; margin-left: 10px; }
[dir="ltr"] .sb-link.active::before, [dir="ltr"] .sb-link.active::after { left: auto; right: 0; }
[dir="ltr"] .sb-link.active::before { border-bottom-left-radius: 0; border-bottom-right-radius: 14px; box-shadow: 5px 5px 0 5px var(--canvas); }
[dir="ltr"] .sb-link.active::after { border-top-left-radius: 0; border-top-right-radius: 14px; box-shadow: 5px -5px 0 5px var(--canvas); }
@media (max-width: 1000px) {
    [dir="ltr"] .sidebar { right: auto; left: 0; transform: translateX(-105%); }
    [dir="ltr"] body.nav-open .sidebar, body.nav-open [dir="ltr"] .sidebar { transform: none; }
    [dir="ltr"] .sb-link.active { margin-right: 12px; border-radius: var(--r-sm); }
}
[dir="ltr"] .tb-crumb .ic-flip, [dir="ltr"] .ic-flip { transform: scaleX(-1); }
