/* Sakan — "Sakan Paper" design system.
   KitSouq's editorial paper + ink + electric lime, tuned for an operations app.
   Lime is only ever a FILL behind ink (never text on light). Logical properties keep RTL and LTR equal. */
@import url("fonts.css");

:root {
    --paper: #F6F5F0; --paper2: #EFEDE4; --card: #FFFFFF;
    --ink: #111111; --ink2: #4B4B47; --mute: #6E6D66; --line: #E2E0D6; --line2: #D4D1C4;
    --lime: #D4FF3A; --lime2: #C2F01F; --lime-soft: #F0FFC2;
    --lilac: #CFC6FF; --lilac-soft: #ECE8FF; --sky: #BFE3FF; --sky-soft: #E6F4FF;
    --sand: #EDE3CF; --sand-soft: #F7F1E5; --rose: #FFD0C7; --rose-soft: #FFEDE8; --mint: #CFF5DF;
    --ok: #1E7A46; --ok-bg: #E1F5E8; --warn: #8A5A00; --warn-bg: #FFF1CC;
    --danger: #B3261E; --danger-bg: #FDE6E3; --info: #1B5FA8; --info-bg: #E4F0FD;
    --serif: "Instrument Serif", Georgia, serif;
    --sans: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
    --r-sm: 10px; --r: 14px; --r-lg: 18px; --r-xl: 28px;
    --shadow: 0 1px 0 rgba(17, 17, 17, .04), 0 10px 30px -18px rgba(17, 17, 17, .22);
    --shadow-pop: 0 18px 40px -18px rgba(17, 17, 17, .35);
    --ease: cubic-bezier(.2, .7, .2, 1);
    --sidebar: 264px;
}
html[dir="rtl"] {
    --serif: "IBM Plex Sans Arabic", serif;
    --sans: "IBM Plex Sans Arabic", "Geist", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; min-height: 100vh; background: var(--paper); color: var(--ink);
    font: 400 15.5px/1.55 var(--sans); font-feature-settings: "tnum" 1;
    -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
html[dir="rtl"] body { line-height: 1.75; font-size: 15px; }
::selection { background: var(--lime); color: var(--ink); }
img, svg { display: block; max-width: 100%; }
a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--ink2); }
p { margin: 0 0 .75rem; }
.muted, .identity span { color: var(--mute); }
code, .mono, [dir="ltr"].mono { font-family: var(--mono); }

/* Icons */
.i { width: 20px; height: 20px; flex: none; }
.i-sm { width: 16px; height: 16px; }
.i-lg { width: 26px; height: 26px; }
html[dir="rtl"] .flip { transform: scaleX(-1); }

/* ---------- Headings ---------- */
h1, h2, h3 { margin: 0 0 .9rem; font-weight: 600; letter-spacing: -.01em; }
h1 { font: 400 clamp(2rem, 3.4vw, 2.75rem)/1.08 var(--serif); letter-spacing: -.02em; }
html[dir="rtl"] h1 { font-weight: 700; letter-spacing: 0; line-height: 1.3; font-size: clamp(1.6rem, 2.8vw, 2.15rem); }
h2 { font-size: 1.15rem; }
h1 em, .accent { font-style: italic; }
html[dir="rtl"] h1 em, html[dir="rtl"] .accent { font-style: normal; }
.mark { background: linear-gradient(transparent 58%, var(--lime) 58% 92%, transparent 92%); padding-inline: .08em; }

/* ---------- Shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
    position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px;
    padding: 22px 16px; background: var(--paper2); border-inline-end: 1px solid var(--line); overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; text-decoration: none; color: var(--ink); }
.brand-mark {
    display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--ink);
    color: var(--lime); font: 700 22px/1 "IBM Plex Sans Arabic", var(--sans);
}
.brand-name { font: 700 22px/1 "IBM Plex Sans Arabic", var(--sans); }
.brand-name small { display: block; margin-top: 4px; font: 500 11px/1 var(--mono); color: var(--mute); letter-spacing: .08em; text-transform: uppercase; }
.nav-group { margin: 14px 8px 4px; font: 500 11px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--mute); }
html[dir="rtl"] .nav-group { font: 600 12px/1 var(--sans); letter-spacing: 0; }
.nav a {
    display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 12px; border-radius: 12px;
    color: var(--ink2); text-decoration: none; font-weight: 500; transition: background .16s var(--ease), color .16s var(--ease);
}
.nav a:hover { background: var(--card); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--ink); color: #fff; }
.nav a[aria-current="page"] .i { color: var(--lime); }
.sidebar-foot { margin-top: auto; display: grid; gap: 10px; padding-top: 16px; }
.who { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); }
.avatar {
    display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; flex: none;
    background: var(--lilac); color: var(--ink); font-weight: 700; font-size: 14px;
}
.who strong { display: block; font-size: 14px; line-height: 1.3; }
.who span { font-size: 12.5px; color: var(--mute); }
.foot-actions { display: flex; gap: 8px; }
.foot-actions form { flex: 1; display: flex; }
.foot-actions button { flex: 1; }
.lang-switch { display: flex; gap: 6px; }
.lang-switch button { flex: 1; min-height: 38px; padding: 0 10px; font-size: 13px; }
.lang-switch button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 20; display: none; align-items: center; gap: 12px; height: 60px; padding: 0 16px;
    background: rgba(246, 245, 240, .86); backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line);
}
.topbar .brand { padding: 0; }
.topbar .spacer { flex: 1; }
.content { width: 100%; max-width: 1280px; margin: 0 auto; padding: 32px clamp(16px, 3vw, 40px) 64px; }

/* Phone drawer + bottom tab bar (no JS: :target opens the drawer) */
.tabbar { display: none; }
.sidebar .drawer-close, .drawer-scrim { display: none; }

@media (max-width: 1023px) {
    .app { display: block; }
    .topbar { display: flex; }
    .sidebar {
        position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 60; width: min(86vw, 320px); height: 100dvh;
        transform: translateX(-105%); transition: transform .24s var(--ease); box-shadow: var(--shadow-pop);
    }
    html[dir="rtl"] .sidebar { transform: translateX(105%); }
    .sidebar:target { transform: none; }
    html[dir="rtl"] .sidebar:target { transform: none; }
    .sidebar:target ~ .drawer-scrim { display: block; position: fixed; inset: 0; z-index: 50; background: rgba(17, 17, 17, .32); }
    .sidebar .drawer-close { display: grid; position: absolute; inset-block-start: 16px; inset-inline-end: 14px; }
    .content { padding: 20px 16px calc(96px + env(safe-area-inset-bottom)); }
    .tabbar {
        position: fixed; inset-inline: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 30;
        display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; align-items: center; height: 66px; padding: 6px;
        background: rgba(255, 255, 255, .94); backdrop-filter: blur(14px); border: 1px solid var(--line);
        border-radius: 22px; box-shadow: var(--shadow-pop);
    }
    .tabbar a {
        display: grid; justify-items: center; gap: 3px; padding: 6px 2px; border-radius: 16px; text-decoration: none;
        color: var(--mute); font-size: 11.5px; font-weight: 500; line-height: 1.1;
    }
    .tabbar a[aria-current="page"] { color: var(--ink); }
    .tabbar a[aria-current="page"] .i { color: var(--ink); }
    .tabbar a.tab-cta .tab-bubble {
        display: grid; place-items: center; width: 50px; height: 50px; margin-top: -26px; border-radius: 18px;
        background: var(--lime); color: var(--ink); border: 3px solid var(--card); box-shadow: 0 10px 22px -10px rgba(17, 17, 17, .5);
    }
}
.icon-btn {
    display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border-radius: 12px;
    background: var(--card); color: var(--ink); border: 1px solid var(--line); text-decoration: none;
}

/* ---------- Page header ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-head h1 { margin: 0; }
.kicker { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 10px; font: 500 12px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink2); }
html[dir="rtl"] .kicker { font: 600 13px/1 var(--sans); letter-spacing: 0; }
.kicker::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 3px var(--ink); }
.lede { max-width: 62ch; color: var(--ink2); margin: 8px 0 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 13.5px; color: var(--mute); }
.crumbs a { color: var(--ink2); }

/* ---------- Buttons ---------- */
button, .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px;
    border: 1.5px solid var(--ink); border-radius: var(--r); background: var(--ink); color: #fff;
    font: 600 15px/1 var(--sans); text-decoration: none; cursor: pointer; white-space: nowrap;
    transition: transform .16s var(--ease), background .16s var(--ease), box-shadow .16s var(--ease);
}
button:hover, .btn:hover { box-shadow: 0 0 0 4px var(--lime); }
button:active, .btn:active { transform: translateY(1px); }
button.secondary, .btn.secondary { background: var(--card); color: var(--ink); border-color: var(--line2); }
button.secondary:hover, .btn.secondary:hover { border-color: var(--ink); box-shadow: none; background: var(--paper2); }
.btn.go, button.go { background: var(--lime); border-color: var(--lime); color: var(--ink); }
.btn.go:hover, button.go:hover { background: var(--lime2); box-shadow: 0 0 0 4px rgba(17, 17, 17, .08); }
button.danger, .btn.danger { background: var(--card); color: var(--danger); border-color: #EBB7B1; }
.btn.small, button.small { min-height: 36px; padding: 0 14px; font-size: 13.5px; border-radius: 11px; }
.btn .i, button .i { width: 18px; height: 18px; }

/* ---------- Forms ---------- */
label { display: grid; gap: 7px; font-size: 13.5px; font-weight: 600; color: var(--ink2); }
input, select, textarea {
    width: 100%; min-height: 48px; padding: 11px 14px; border: 1px solid var(--line2); border-radius: var(--r-sm);
    background: var(--card); color: var(--ink); font: 400 15px/1.4 var(--sans);
    transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
input::placeholder, textarea::placeholder { color: #9A998F; }
input:hover, select:hover, textarea:hover { border-color: #BDB9AA; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px var(--lime); }
select {
    appearance: none; padding-inline-end: 40px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23111' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
}
html[dir="rtl"] select { background-position: left 12px center; }
select[multiple] { min-height: 128px; padding: 6px; background-image: none; }
select[multiple] option { padding: 7px 10px; border-radius: 7px; }
textarea { min-height: 96px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; min-height: 0; padding: 0; accent-color: var(--ink); }
input[type="file"] { padding: 10px; background: var(--paper2); border-style: dashed; cursor: pointer; }
input[type="file"]::file-selector-button { margin-inline-end: 12px; padding: 8px 14px; border: 0; border-radius: 9px; background: var(--ink); color: #fff; font: 600 13px var(--sans); cursor: pointer; }
.check-label { display: inline-flex; grid-template-columns: none; align-items: center; gap: 10px; font-weight: 500; color: var(--ink); cursor: pointer; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; box-shadow: 0 0 0 6px var(--lime); border-radius: 6px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }
fieldset { margin: 0; padding: 16px; border: 1px solid var(--line); border-radius: var(--r); }
legend { padding: 0 8px; font-weight: 600; }
.stack { display: grid; gap: 16px; }
.stack > button, .stack > .btn { justify-self: start; }
.form-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); align-items: end; }
.form-grid > button, .form-grid > .btn { justify-self: stretch; }

/* ---------- Cards ---------- */
.card {
    position: relative; margin-bottom: 16px; padding: 22px; background: var(--card);
    border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow);
}
.card > :last-child { margin-bottom: 0; }
.card h2 { margin-bottom: 10px; }
.card h2 a { text-decoration: none; }
.card h2 a:hover { text-decoration: underline; }
.narrow { max-width: 460px; margin-inline: auto; }
details.card { padding: 0; overflow: hidden; }
details.card > summary { padding: 18px 22px; }
details.card > :not(summary) { margin: 0 22px 22px; }
summary {
    display: flex; align-items: center; gap: 12px; list-style: none; cursor: pointer; font-weight: 600; user-select: none;
}
summary::-webkit-details-marker { display: none; }
summary::before {
    content: "+"; display: grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 9px;
    background: var(--lime); color: var(--ink); font: 600 18px/1 var(--mono); transition: transform .2s var(--ease);
}
details[open] > summary::before { content: "–"; }
details:not(.card) { margin-top: 12px; }
details:not(.card) > summary { font-size: 14px; }
details:not(.card) > summary::before { width: 22px; height: 22px; border-radius: 7px; font-size: 15px; background: var(--paper2); }
details form { margin-top: 16px; }
.user-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.user-list .card { margin: 0; }
.email { font-family: var(--mono); font-size: 13.5px; color: var(--ink2); }
dl { display: grid; grid-template-columns: minmax(120px, 34%) minmax(0, 1fr); margin: 0; }
dt, dd { margin: 0; padding: 11px 0; border-bottom: 1px solid var(--line); }
dt { padding-inline-end: 16px; font-size: 13px; font-weight: 600; color: var(--mute); }
dd { font-weight: 500; overflow-wrap: anywhere; }
dl > :nth-last-child(-n+2) { border-bottom: 0; }

/* ---------- Messages ---------- */
.notice, .error {
    display: flex; align-items: center; gap: 12px; margin: 0 0 18px; padding: 14px 16px; border-radius: var(--r);
    border: 1px solid; font-weight: 500; animation: drop .28s var(--ease);
}
.notice { background: var(--ok-bg); border-color: #B9E3C8; color: var(--ok); }
.error { background: var(--danger-bg); border-color: #F2BDB7; color: var(--danger); }
.notice::before, .error::before { content: ""; width: 10px; height: 10px; flex: none; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px rgba(255, 255, 255, .7); }
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } }

/* ---------- Badges ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
    background: var(--paper2); color: var(--ink2); font-size: 12.5px; font-weight: 600; line-height: 1.6; white-space: nowrap;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.ok, .success { background: var(--ok-bg); color: var(--ok); }
.badge.warn, .expiry-warning { background: var(--warn-bg); color: var(--warn); }
.badge.danger, .failure { background: var(--danger-bg); color: var(--danger); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.lime { background: var(--lime); color: var(--ink); }
td.expiry-warning, td.failure, td.success { font-weight: 600; }

/* ---------- Filters & toolbars ---------- */
.filter {
    display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin-bottom: 18px;
}
.filter label { min-width: 180px; flex: 1 1 180px; }
.filter .check-label { flex: 0 0 auto; min-width: 0; min-height: 48px; }
nav.filter a, .chip {
    display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 999px;
    background: var(--card); border: 1px solid var(--line); color: var(--ink); font-weight: 600; font-size: 14px; text-decoration: none;
}
nav.filter a:hover, .chip:hover { border-color: var(--ink); }
nav.filter a:first-child { background: var(--ink); color: #fff; border-color: var(--ink); }
.counts { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.counts p { margin: 0; padding: 10px 16px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); font-weight: 600; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; padding: 0; }
.table-wrap.card { padding: 0; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14.5px; }
caption { padding: 16px 18px 6px; text-align: start; font-weight: 700; }
th {
    position: sticky; top: 0; padding: 12px 16px; background: var(--paper2); color: var(--ink2); text-align: start;
    font-size: 12.5px; font-weight: 600; white-space: nowrap; border-bottom: 1px solid var(--line);
}
td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: #FBFAF6; }
tbody tr:last-child td { border-bottom: 0; }
td a { font-weight: 600; text-decoration: none; }
td a:hover { text-decoration: underline; }
td[dir="ltr"] { font-family: var(--mono); font-size: 13.5px; }
@media (max-width: 720px) {
    table.cards thead { display: none; }
    table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: 100%; }
    table.cards tr { padding: 14px 16px; border-bottom: 1px solid var(--line); }
    table.cards td { display: flex; justify-content: space-between; gap: 16px; padding: 5px 0; border: 0; }
    table.cards td::before { content: attr(data-label); color: var(--mute); font-size: 12.5px; font-weight: 600; }
    table.cards td:first-child { font-size: 16px; padding-bottom: 8px; }
    table.cards td:first-child::before { display: none; }
}

/* ---------- Pagination ---------- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 18px; }
.pagination a, .pagination span {
    display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border-radius: 999px;
    border: 1px solid var(--line); background: var(--card); text-decoration: none; font-weight: 600; font-size: 14px;
}
.pagination span { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- System checks ---------- */
.checks { display: grid; gap: 8px; padding: 0; margin: 0; list-style: none; }
.checks li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-radius: 12px; background: var(--paper); }

/* ---------- Bento / KPI tiles ---------- */
.bento { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.tile {
    position: relative; grid-column: span 3; min-height: 168px; padding: 20px; overflow: hidden; display: flex; flex-direction: column;
    border-radius: var(--r-lg); background: var(--card); border: 1px solid var(--line); text-decoration: none; color: var(--ink);
    transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
a.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-pop); }
.tile.wide { grid-column: span 6; }
.tile.lilac { background: var(--lilac); border-color: transparent; }
.tile.sky { background: var(--sky); border-color: transparent; }
.tile.sand { background: var(--sand); border-color: transparent; }
.tile.rose { background: var(--rose); border-color: transparent; }
.tile.mint { background: var(--mint); border-color: transparent; }
.tile.ink { background: var(--ink); color: #fff; border-color: var(--ink); }
.tile.ink .tile-label { color: rgba(255, 255, 255, .7); }
.tile.lime { background: var(--lime); border-color: transparent; }
.tile-label { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--ink2); }
.tile-num { margin-top: auto; font: 400 clamp(2.6rem, 4.6vw, 3.6rem)/1 var(--serif); letter-spacing: -.03em; }
html[dir="rtl"] .tile-num { font: 700 clamp(2.2rem, 4vw, 3rem)/1.1 var(--sans); letter-spacing: 0; }
.tile-num small { font: 500 14px/1 var(--sans); letter-spacing: 0; color: inherit; opacity: .65; margin-inline-start: 6px; }
.tile-foot { margin-top: 8px; font-size: 13px; opacity: .8; }
.tile .ghost {
    position: absolute; inset-inline-end: -10px; inset-block-end: -28px; font: 400 9rem/1 var(--serif); opacity: .07; pointer-events: none;
}
.tile.ink .ghost { opacity: .12; color: var(--lime); }
.meter { height: 10px; margin-top: 12px; border-radius: 99px; background: rgba(17, 17, 17, .1); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: inherit; background: var(--ink); }
.tile.ink .meter { background: rgba(255, 255, 255, .15); }
.tile.ink .meter > i { background: var(--lime); }
@media (max-width: 1100px) { .tile { grid-column: span 6; } .tile.wide { grid-column: span 12; } }
@media (max-width: 560px) {
    .bento { gap: 10px; }
    .tile { grid-column: span 6; min-height: 112px; padding: 14px; }
    .tile.wide { grid-column: span 12; min-height: 150px; }
    .tile-num { font-size: 2.3rem; }
    html[dir="rtl"] .tile-num { font-size: 1.9rem; }
    .tile-label { font-size: 12.5px; }
    .tile-foot { font-size: 12px; }
}

.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 12px; }
.quick a {
    display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--r-lg); background: var(--card);
    border: 1px solid var(--line); text-decoration: none; font-weight: 600; transition: border-color .16s, transform .16s var(--ease);
}
.quick a:hover { border-color: var(--ink); transform: translateY(-2px); }
.quick .qi { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; background: var(--paper2); flex: none; }
.quick a:nth-child(4n+1) .qi { background: var(--lilac); }
.quick a:nth-child(4n+2) .qi { background: var(--sky); }
.quick a:nth-child(4n+3) .qi { background: var(--sand); }
.quick a:nth-child(4n+4) .qi { background: var(--rose); }
.quick .go-arrow { margin-inline-start: auto; color: var(--mute); }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 28px 0 14px; }
.section-title h2 { margin: 0; font-size: 1.05rem; }

/* ---------- Buildings ---------- */
.b-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 16px; }
.b-card {
    display: flex; flex-direction: column; gap: 14px; padding: 20px; border-radius: var(--r-lg); background: var(--card);
    border: 1px solid var(--line); box-shadow: var(--shadow); text-decoration: none; transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.b-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-pop); }
.b-top { display: flex; align-items: flex-start; gap: 14px; }
.b-icon { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 15px; background: var(--lilac); flex: none; }
.b-card:nth-child(3n+2) .b-icon { background: var(--sky); }
.b-card:nth-child(3n+3) .b-icon { background: var(--sand); }
.b-title { font-size: 1.08rem; font-weight: 700; line-height: 1.35; }
.b-meta { font-size: 13px; color: var(--mute); }
.b-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.b-stats div { padding: 10px; border-radius: 12px; background: var(--paper); text-align: center; }
.b-stats b { display: block; font: 700 1.35rem/1.1 var(--sans); }
.b-stats span { font-size: 12px; color: var(--mute); }
.b-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.avatars { display: flex; }
.avatars .avatar { width: 30px; height: 30px; font-size: 11.5px; border: 2px solid var(--card); margin-inline-start: -8px; }
.avatars .avatar:first-child { margin-inline-start: 0; }
.avatars .avatar:nth-child(2) { background: var(--sky); }
.avatars .avatar:nth-child(3) { background: var(--rose); }

/* ---------- Room / bed map ---------- */
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 16px; font-size: 13px; color: var(--ink2); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 14px; }
.room {
    padding: 16px; border-radius: var(--r-lg); background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.room.inactive { opacity: .6; background: var(--paper2); }
.room-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.room-no { font: 700 1.25rem/1 var(--sans); }
.room-no small { margin-inline-start: 6px; font: 500 12px var(--sans); color: var(--mute); }
.beds { display: flex; flex-wrap: wrap; gap: 7px; }
.bed {
    display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; font: 600 12px/1 var(--mono);
    background: var(--lime); color: var(--ink); border: 1.5px solid var(--ink);
}
.bed.occupied { background: var(--ink); color: #fff; }
.bed.held { background: repeating-linear-gradient(45deg, var(--lilac) 0 5px, var(--lilac-soft) 5px 10px); border-style: dashed; }
.bed.retired { background: transparent; color: var(--mute); border: 1.5px dashed var(--line2); }
.legend .bed { width: 18px; height: 18px; border-radius: 6px; font-size: 0; }
.room .meter { height: 6px; margin-top: 14px; }
.room .meter > i { background: var(--ink); }

/* ---------- Auth (login / password) ---------- */
.auth { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); min-height: 100vh; }
.auth-art {
    position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; padding: 40px;
    background-color: var(--paper2); overflow: hidden;
    background-image: radial-gradient(rgba(17, 17, 17, .13) 1px, transparent 1.2px); background-size: 18px 18px;
}
.auth-art .brand { padding: 0; }
.auth-hero h1 { font-size: clamp(2.6rem, 5vw, 4.4rem); margin-bottom: 14px; }
html[dir="rtl"] .auth-hero h1 { font-size: clamp(2.2rem, 4.4vw, 3.6rem); }
.auth-hero p { max-width: 44ch; font-size: 1.05rem; color: var(--ink2); }
.auth-tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.auth-tiles div { display: flex; flex-direction: column; justify-content: space-between; min-height: 110px; padding: 16px; border-radius: var(--r-lg); font-weight: 600; }
.auth-tiles div:nth-child(1) { grid-column: span 3; background: var(--lime); }
.auth-tiles div:nth-child(2) { grid-column: span 3; background: var(--lilac); }
.auth-tiles div:nth-child(3) { grid-column: span 2; background: var(--sky); }
.auth-tiles div:nth-child(4) { grid-column: span 2; background: var(--sand); }
.auth-tiles div:nth-child(5) { grid-column: span 2; background: var(--ink); color: #fff; }
.auth-tiles b { font: 400 2.4rem/1 var(--serif); }
html[dir="rtl"] .auth-tiles b { font: 700 1.9rem/1 var(--sans); }
.auth-tiles .mini-beds { display: flex; gap: 5px; }
.auth-tiles .mini-beds i { width: 16px; height: 16px; border-radius: 5px; border: 1.5px solid var(--ink); background: var(--card); }
.auth-tiles .mini-beds i:nth-child(odd) { background: var(--ink); }
.auth-form { display: flex; flex-direction: column; justify-content: center; padding: 40px clamp(20px, 6vw, 80px); background: var(--paper); }
.auth-form .card { width: 100%; max-width: 440px; margin: 0 auto; padding: 32px; }
.auth-form h1 { font-size: clamp(1.9rem, 3vw, 2.4rem); }
.auth-lang { display: flex; justify-content: flex-end; max-width: 440px; width: 100%; margin: 0 auto 16px; }
.auth-form button[type="submit"] { justify-self: stretch; }
@media (max-width: 900px) {
    .auth { grid-template-columns: 1fr; }
    .auth-art { padding: 24px 20px 28px; gap: 20px; }
    .auth-tiles { display: none; }
    .auth-form { padding: 24px 16px 48px; }
    .auth-form .card { padding: 24px; }
}

/* ---------- Motion ---------- */
.content > * { animation: rise .42s var(--ease) both; }
.content > *:nth-child(2) { animation-delay: .04s; }
.content > *:nth-child(3) { animation-delay: .08s; }
.content > *:nth-child(4) { animation-delay: .12s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
    .sidebar, .topbar, .tabbar { display: none !important; }
    .app { display: block; }
    body { background: #fff; }
}

/* Meter widths in 5% steps (CSP forbids inline style attributes). */
.w-0{width:0%}.w-5{width:5%}.w-10{width:10%}.w-15{width:15%}.w-20{width:20%}.w-25{width:25%}.w-30{width:30%}.w-35{width:35%}.w-40{width:40%}.w-45{width:45%}.w-50{width:50%}.w-55{width:55%}.w-60{width:60%}.w-65{width:65%}.w-70{width:70%}.w-75{width:75%}.w-80{width:80%}.w-85{width:85%}.w-90{width:90%}.w-95{width:95%}.w-100{width:100%}
.auth-lang button { flex: 0 0 auto; min-width: 92px; }

/* ---------- Step 4a: gate, check-in result, housing panel ---------- */
.small { font-size: 13px; }
.card h2 .i { display: inline-block; vertical-align: -4px; margin-inline-end: 8px; }
.empty { display: grid; justify-items: center; gap: 8px; padding: 36px 22px; text-align: center; color: var(--ink2); }
.empty .i { color: var(--ok); }
a.bed { text-decoration: none; }
a.bed:hover { box-shadow: 0 0 0 3px var(--lime); }
button.big, .btn.big { min-height: 58px; font-size: 17px; border-radius: 16px; }
.gate { background: var(--ink); color: #fff; border-color: var(--ink); }
.gate label { color: rgba(255, 255, 255, .8); font-size: 14px; }
.gate .muted { color: rgba(255, 255, 255, .6); margin: 10px 0 0; }
.gate-row { display: flex; gap: 10px; }
.gate-input {
    flex: 1; min-height: 64px; font: 600 26px/1 var(--mono); letter-spacing: .14em; text-align: center;
    background: #1D1D1B; color: #fff; border: 1.5px solid #3A3A36; border-radius: 16px;
}
.gate-input::placeholder { color: #5D5D57; letter-spacing: .14em; }
.gate-input:focus { border-color: var(--lime); box-shadow: 0 0 0 4px rgba(212, 255, 58, .35); }
.gate .go { min-height: 64px; border-radius: 16px; padding: 0 22px; }
@media (max-width: 560px) { .gate-row { flex-direction: column; } .gate-input { font-size: 22px; } }
.result { border-inline-start: 6px solid var(--line2); }
.result.ok { border-inline-start-color: var(--ok); }
.result.warn { border-inline-start-color: #E2A400; }
.result.danger { border-inline-start-color: var(--danger); }
.result.info { border-inline-start-color: var(--info); }
.result-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.result-text { font-size: 15.5px; color: var(--ink2); }
.person { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.person h2, .person h1 { margin: 0 0 2px; }
.person p { margin: 0; }
.avatar.xl { width: 64px; height: 64px; font-size: 26px; background: var(--lilac); }
.person-head .avatar.xl { width: 76px; height: 76px; font-size: 30px; background: var(--lime); }
.badges { margin-top: 8px; }
.room-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; border: 0; padding: 0; }
.room-pick legend { padding: 0 0 10px; font-weight: 700; }
.room-option { position: relative; display: block; cursor: pointer; }
.room-option input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.room-option-body {
    display: grid; justify-items: center; gap: 2px; padding: 14px 8px; border-radius: 16px; background: var(--paper);
    border: 1.5px solid var(--line2); transition: border-color .15s, background .15s;
}
.room-option-body b { font: 700 22px/1.1 var(--sans); color: var(--ink); }
.room-option-body span { font-size: 12.5px; color: var(--mute); }
.room-option input:checked + .room-option-body { background: var(--lime); border-color: var(--ink); }
.room-option input:focus-visible + .room-option-body { box-shadow: 0 0 0 4px var(--lime), 0 0 0 6px var(--ink); }
.housing-panel h2 { display: flex; align-items: center; }
.housing-state { display: grid; gap: 8px; justify-items: start; padding: 16px; border-radius: var(--r); background: var(--paper); margin-bottom: 12px; }
.housing-state p { margin: 0; }
.housing-state.ok { background: var(--ok-bg); }
.housing-state.warn { background: var(--warn-bg); }
.housing-state form { width: 100%; margin-top: 8px; }
.gate-flow { display: flex; flex-direction: column; }
.gate-flow .result { order: -1; }

/* ---------- Step 4b: iqama photo at the gate ---------- */
.photo-button { position: relative; display: block; cursor: pointer; color: var(--ink); }
.photo-button input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; min-height: 0; }
.photo-face {
    display: flex; align-items: center; justify-content: center; gap: 14px; min-height: 76px; padding: 14px 18px;
    border-radius: 18px; background: var(--lime); color: var(--ink); text-align: start;
}
.photo-face b { display: block; font-size: 17px; }
.photo-face small { display: block; font-size: 12.5px; font-weight: 500; opacity: .75; }
.photo-button input:focus-visible + .photo-face { box-shadow: 0 0 0 4px rgba(212, 255, 58, .45); }
.photo-busy { display: none; }
.photo-form.is-reading .photo-face { display: none; }
.photo-form.is-reading .photo-busy {
    display: flex; align-items: center; justify-content: center; min-height: 76px; border-radius: 18px;
    background: repeating-linear-gradient(-45deg, var(--lime) 0 14px, var(--lime2) 14px 28px); background-size: 200% 100%;
    color: var(--ink); font-weight: 700; animation: reading 1s linear infinite;
}
@keyframes reading { to { background-position: 40px 0; } }
.or { display: flex; align-items: center; gap: 12px; margin: 16px 0 12px; color: rgba(255, 255, 255, .55); font-size: 13px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: rgba(255, 255, 255, .18); }
.read-note { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; background: rgba(212, 255, 58, .14); color: var(--lime); font-size: 14px; }
.read-note strong { color: #fff; }

/* ---------- Step 5a: stay page ---------- */
.stay-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 16px; align-items: start; }
.stay-actions .card { margin: 0; }
.checkout-card { border-color: #F2BDB7; }
html .tile-num.stay-date, html[dir="rtl"] .tile-num.stay-date { font: 600 clamp(1.15rem, 1.7vw, 1.85rem)/1.15 var(--mono); letter-spacing: 0; white-space: nowrap; }

/* Numbers and dates stay left-to-right inside, but in Arabic the cell still lines up with its heading. */
html[dir="rtl"] td[dir="ltr"], html[dir="rtl"] dd { text-align: right; }
/* dir="auto" values (an Arabic name on the English page) still line up with their column. */
html[dir="ltr"] dd { text-align: left; }

/* ---------- Step 5b: transfers ---------- */
.inline-arrow { display: inline-block; vertical-align: -3px; }
.stepper { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 0 0 20px; padding: 0; list-style: none; counter-reset: step; }
.stepper li { position: relative; display: grid; justify-items: center; gap: 8px; text-align: center; font-size: 13px; font-weight: 600; color: var(--mute); }
.stepper li::before { content: ""; position: absolute; top: 17px; inset-inline-start: calc(-50% + 22px); width: calc(100% - 44px); height: 2px; background: var(--line2); }
.stepper li:first-child::before { display: none; }
.stepper .dot { position: relative; z-index: 1; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--card); border: 1.5px solid var(--line2); font: 600 14px/1 var(--mono); }
.stepper li.done { color: var(--ink); }
.stepper li.done .dot { background: var(--ink); color: var(--lime); border-color: var(--ink); }
.stepper li.done::before, .stepper li.now::before { background: var(--ink); }
.stepper li.now { color: var(--ink); }
.stepper li.now .dot { background: var(--lime); border-color: var(--ink); }
@media (max-width: 560px) { .stepper li { font-size: 11px; } .stepper .dot { width: 30px; height: 30px; } .stepper li::before { top: 14px; } }

/* ---------- Step 5c: costs ---------- */
.cost-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 16px; align-items: start; margin-bottom: 16px; }
.cost-grid .card { margin: 0; }
nav.filter a[aria-current="page"] { background: var(--lime); color: var(--ink); border-color: var(--ink); }
html .tile-num.tile-word, html[dir="rtl"] .tile-num.tile-word { font: 700 clamp(1.5rem, 2.4vw, 2rem)/1.2 var(--sans); letter-spacing: 0; }

/* Reports: labelled bars (widths come from the .w-N classes, so no inline styles). */
ul.bars { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 10px; }
ul.bars li { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; align-items: center; gap: 10px; font-size: 14px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 10px; border-radius: 99px; background: rgba(17, 17, 17, .08); overflow: hidden; }
.bar-track > i { display: block; height: 100%; border-radius: inherit; background: var(--ink); }
.bar-value { font-family: var(--mono); font-size: 12px; color: rgba(17, 17, 17, .6); white-space: nowrap; }

/* A button that reads as a link (D365 screen toggle inside a tile). */
button.link { background: none; border: 0; padding: 0; min-height: 0; color: inherit; font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* Login: Microsoft sign-in first, password form below an "or" divider. */
.btn.microsoft { display: flex; width: 100%; justify-content: center; align-items: center; gap: 10px; margin-top: 18px; text-decoration: none; }
.btn.microsoft .i { width: 20px; height: 20px; }
p.divider { display: flex; align-items: center; gap: 12px; margin: 22px 0 6px; color: rgba(17, 17, 17, .55); font-size: 13px; }
p.divider::before, p.divider::after { content: ""; flex: 1; height: 1px; background: var(--line2); }