/* ==========================================================================
   دستیار سامی — design system
   Mobile-first, RTL, soft corners, cards. Category colours come from --cat on each element.
   Font: Vazirmatn FD (Persian digits) shipped in wwwroot/fonts (OFL), so every phone looks the same offline.
   Colours: every text colour passes WCAG AA (4.5:1) on white and on --bg; borders of controls pass 3:1.
   ========================================================================== */
@font-face { font-family: Vazirmatn; src: url("fonts/Vazirmatn-FD-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url("fonts/Vazirmatn-FD-SemiBold.woff2") format("woff2"); font-weight: 500 600; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url("fonts/Vazirmatn-FD-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url("fonts/Vazirmatn-FD-ExtraBold.woff2") format("woff2"); font-weight: 800 900; font-display: swap; }
:root {
    --brand: #0f766e;          /* teal */
    --brand-strong: #115e59;
    --brand-soft: #e3f3f1;
    --ink: #1e293b;
    --ink-2: #475569;
    --muted: #5b6676;
    --line: #e3e8ee;          /* separators and card borders */
    --surface-2: #f6f8fb;     /* table heads, stat chips */
    --track: #e7ecf1;         /* progress tracks */
    --field-line: #8d98a7;    /* borders of inputs and the idle tick: 3:1 */
    --bg: #f2f5f8;
    --card: #ffffff;
    --ok: #137538;
    --ok-soft: #e6f6ec;
    --warn: #92580c;
    --warn-soft: #fdf3dc;
    --danger: #c42b2b;
    --danger-soft: #fdecec;
    --info: #2459b8;
    --info-soft: #eaf1fd;
    --r-lg: 16px;
    --r-md: 14px;
    --r-sm: 10px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 14px rgba(15, 23, 42, .05);
    --shadow-up: 0 -4px 18px rgba(15, 23, 42, .07);
    --side-w: 272px;
    --bottom-nav-h: 64px;
    --tap: 44px;              /* minimum touch target */
    --focus: 0 0 0 3px rgba(15, 118, 110, .35);
}

* { box-sizing: border-box; }
html, body {
    margin: 0; background: var(--bg); color: var(--ink);
    font-family: Vazirmatn, "Vazir", Tahoma, "Segoe UI", sans-serif;
    font-size: 16px; line-height: 1.7; -webkit-tap-highlight-color: transparent;
}
h1 { font-size: 1.45rem; margin: 0 0 .75rem; font-weight: 800; color: var(--ink); }
h2 { font-size: 1.02rem; margin: 0 0 .6rem; font-weight: 700; }
a { color: var(--brand); }
.muted { color: var(--muted); }
.no-margin { margin: 0; }
code { background: var(--brand-soft); padding: .1rem .4rem; border-radius: 6px; }
.icon { flex: none; vertical-align: middle; }

/* ---------- Shell ----------
   Phone: top bar + bottom nav; the sidebar is a drawer opened by «بیشتر».
   Desktop (900px+): the sidebar is fixed on the right and the page sits beside it. */
.shell { min-height: 100vh; }
.main-col { min-width: 0; }
.topbar {
    position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .75rem;
    min-height: 60px; padding: .5rem 1rem; background: rgba(255, 255, 255, .9); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 800; color: var(--ink); text-decoration: none; font-size: 1.05rem; }
.brand-mark { width: 32px; height: 32px; border-radius: 10px; background: var(--brand); color: #fff; display: grid; place-items: center; flex: none; }
.topbar-date { display: none; align-items: center; gap: .45rem; color: var(--ink-2); font-size: .9rem; }
.who { margin-inline-start: auto; display: flex; align-items: center; gap: .5rem; color: var(--ink-2); font-size: .9rem; font-weight: 600; }
.avatar { width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center;
    background: var(--brand-soft); color: var(--brand); font-weight: 800; }
.avatar.sm { width: 32px; height: 32px; font-size: .9rem; }
.logout { margin: 0; }
.link { background: none; border: 0; font: inherit; cursor: pointer; width: 100%; text-align: start; }

/* Real, focusable checkbox kept off-screen: Tab reaches it, Space opens the drawer. */
.nav-toggle { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; margin: 0; }

.sidebar {
    position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 50; width: var(--side-w); max-width: 86vw;
    display: flex; flex-direction: column; background: var(--card); border-inline-end: 1px solid var(--line);
    transform: translateX(100%); transition: transform .25s ease-out, visibility .25s; visibility: hidden;
}
.nav-toggle:checked ~ .sidebar { transform: none; visibility: visible; box-shadow: -16px 0 40px rgba(15, 23, 42, .18); }
.scrim { position: fixed; inset: 0; z-index: 45; background: rgba(15, 23, 42, .35); opacity: 0; pointer-events: none; transition: opacity .2s; }
.nav-toggle:checked ~ .scrim { opacity: 1; pointer-events: auto; }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-height: 60px; padding: .5rem .75rem .5rem 1rem; border-bottom: 1px solid var(--line); }
.side-nav { flex: 1; overflow-y: auto; padding: .25rem .75rem 1rem; display: flex; flex-direction: column; gap: .15rem; }
.side-group { font-size: .75rem; font-weight: 700; color: var(--muted); padding: 1rem .75rem .35rem; }
.side-nav a {
    display: flex; align-items: center; gap: .7rem; min-height: var(--tap); padding: .4rem .8rem; border-radius: var(--r-sm);
    color: var(--ink-2); text-decoration: none; font-size: .95rem; transition: background-color .15s, color .15s;
}
.side-nav a:hover { background: var(--brand-soft); color: var(--brand); }
.side-nav a.active { background: var(--brand); color: #fff; font-weight: 700; box-shadow: 0 6px 14px rgba(15, 118, 110, .25); }
.side-user {
    display: flex; align-items: center; gap: .25rem; margin: .75rem; padding: .5rem .6rem;
    border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line);
}
.side-user-name { flex: 1; min-width: 0; margin-inline-start: .3rem; font-weight: 700; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.content { max-width: 1200px; margin: 0 auto; padding: 1.25rem 1rem calc(var(--bottom-nav-h) + 1.5rem); }

/* Bottom navigation (phone) */
.bottom-nav {
    position: fixed; inset-inline: 0; bottom: 0; z-index: 30; height: var(--bottom-nav-h);
    display: flex; justify-content: space-around; align-items: stretch;
    background: #fff; border-top: 1px solid var(--line); box-shadow: var(--shadow-up);
    padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a, .bottom-nav label {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem;
    color: var(--muted); text-decoration: none; font-size: .75rem; cursor: pointer;
}
.bottom-nav a.active { color: var(--brand); font-weight: 700; }
.bottom-nav a.active .icon { stroke-width: 2.4; }

.fab {
    position: fixed; z-index: 31; inset-inline-start: 1rem; bottom: calc(var(--bottom-nav-h) + 1rem);
    width: 56px; height: 56px; border-radius: 18px; background: var(--brand); color: #fff;
    display: grid; place-items: center; box-shadow: 0 8px 20px rgba(15, 118, 110, .35); text-decoration: none;
}

@media (min-width: 900px) {
    .shell:has(.sidebar) { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); }
    .sidebar { position: sticky; top: 0; height: 100vh; grid-column: 1; grid-row: 1; max-width: none;
        transform: none; visibility: visible; transition: none; box-shadow: none; }
    .main-col { grid-column: 2; grid-row: 1; }
    .nav-toggle, .scrim, .side-close, .topbar-brand, .bottom-nav { display: none; }
    .topbar-date { display: flex; }
    .topbar { padding-inline: 1.75rem; }
    .content { padding: 1.75rem 1.75rem 2.5rem; }
    .fab { bottom: 1.5rem; }
}

/* ---------- Cards & layout ---------- */
.card {
    background: var(--card); border-radius: var(--r-lg); padding: 1.1rem 1.25rem; margin-bottom: 1rem;
    box-shadow: var(--shadow); border: 1px solid var(--line);
}
.card.narrow { max-width: 460px; margin-inline: auto; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .9rem; }
.page-head h1 { margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 0 1rem; }
@media (min-width: 700px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.actions { margin: 1rem 0; }
.row-gap { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; align-items: center; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: .35rem 0; border-bottom: 1px solid var(--line); }
ul.plain li:last-child { border-bottom: 0; }
ul.tree { margin: 0; padding-inline-start: 1.2rem; }
.section-title { display: flex; align-items: center; gap: .4rem; margin: 1.1rem .25rem .55rem; font-size: .9rem; color: var(--muted); font-weight: 700; }
.section-title .count { background: var(--track); color: var(--ink-2); border-radius: 999px; padding: 0 .5rem; font-size: .78rem; }

/* ---------- Forms ---------- */
.field { display: block; margin-bottom: .85rem; }
.field > span { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .25rem; }
input:not([type=checkbox]):not([type=color]), select, textarea {
    width: 100%; font: inherit; padding: .6rem .8rem; min-height: 46px;
    border: 1px solid var(--field-line); border-radius: var(--r-md); background: #fbfcfd; color: var(--ink);
    transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 70px; margin-bottom: .4rem; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15, 118, 110, .15); background: #fff; }
input[type=color] { width: 56px; height: 46px; border: 1px solid var(--field-line); border-radius: var(--r-md); padding: 3px; background: #fff; }
.check { display: flex; align-items: center; gap: .55rem; margin: .5rem 0; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }
.validation-message { color: var(--danger); font-size: .85rem; }
.search { margin-bottom: 1rem; }
.membership { display: grid; grid-template-columns: 1fr 1fr auto; gap: .5rem; margin-bottom: .5rem; align-items: center; }
@media (max-width: 600px) { .membership { grid-template-columns: 1fr; } }
.date-input { display: flex; gap: .4rem; align-items: center; }
.date-input input { flex: 1; }
.weekdays { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin-bottom: .75rem; }
.narrow-input { width: 80px; }
td input:not([type=checkbox]), td select { min-width: 110px; min-height: var(--tap); }

/* Category picker chips */
.chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.chip {
    --cat: #64748b;
    display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .75rem .35rem .6rem; min-height: var(--tap);
    border-radius: 999px; border: 1.5px solid color-mix(in srgb, var(--cat) 30%, white);
    background: #fff; color: var(--cat); font: inherit; font-size: .9rem; cursor: pointer;
}
.chip.selected { background: var(--cat); border-color: var(--cat); color: #fff; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    min-height: var(--tap); padding: .5rem 1.1rem; border-radius: var(--r-md);
    border: 1px solid var(--line); background: #fff; color: var(--ink);
    font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; transition: transform .05s, background .15s;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-strong); }
.btn.danger { color: var(--danger); border-color: #f6cfcf; }
.btn.ok { color: var(--ok); border-color: #c4ead3; }
.btn.small { min-height: var(--tap); padding: .25rem .8rem; font-size: .88rem; border-radius: var(--r-sm); }
.btn.wide { width: 100%; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.icon-only { width: var(--tap); min-height: var(--tap); padding: 0; border-radius: 12px; }
.btn:disabled { opacity: .55; cursor: default; }

/* ---------- Alerts, badges, tags ---------- */
.alert { padding: .75rem 1rem; border-radius: var(--r-md); margin-bottom: 1rem; }
.alert.error { background: var(--danger-soft); color: var(--danger); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.info { background: var(--info-soft); color: #1f4f9a; }
.alert.small { padding: .4rem .7rem; margin: 0; font-size: .85rem; }

/* inline-flex + isolate: Persian letters never join across a title and its tag. */
.tag, .badge {
    display: inline-flex; align-items: center; gap: .2rem; unicode-bidi: isolate;
    font-size: .75rem; font-weight: 600; padding: .1rem .55rem; border-radius: 999px; white-space: nowrap; line-height: 1.6;
}
.badge { background: #eef2f6; color: var(--ink-2); }
.tag { background: var(--warn-soft); color: var(--warn); }
.st-planned { background: #eef0f3; color: #5b6472; }
.st-open { background: var(--info-soft); color: var(--info); }
.st-pending { background: var(--warn-soft); color: var(--warn); }
.st-done { background: var(--ok-soft); color: var(--ok); }
.st-bad { background: var(--danger-soft); color: var(--danger); }
.st-closed { background: #eef2f6; color: var(--muted); }
.tag.pr-urgent { background: var(--danger); color: #fff; }
.tag.pr-important { background: var(--warn-soft); color: var(--warn); }

/* Category tile */
.cat-tile {
    --cat: #64748b;
    width: 46px; height: 46px; border-radius: 14px; flex: none;
    display: grid; place-items: center;
    background: color-mix(in srgb, var(--cat) 13%, white); color: var(--cat);
}
.cat-tile.sm { width: 30px; height: 30px; border-radius: 10px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .6rem .75rem; text-align: start; border-bottom: 1px solid var(--line); white-space: nowrap; }
thead th { background: var(--surface-2); font-weight: 700; font-size: .85rem; color: var(--ink-2); }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
tr.inactive td { color: var(--muted); text-decoration: line-through; }
table.matrix td { text-align: center; font-size: .82rem; }
table.matrix td.none { color: var(--muted); }
table.matrix td.scope-all { background: #e6f4ea; }
table.matrix td.scope-department { background: #fdf3df; }
table.matrix td.scope-own { background: #eef2f8; }
table.matrix tbody th { position: sticky; inset-inline-start: 0; background: #fff; font-weight: 500; }
table.compact th, table.compact td { padding: .45rem .55rem; }
td.bad { color: var(--danger); font-weight: 700; }
td.warn { color: var(--warn); font-weight: 700; }

/* ---------- Account pages ---------- */
.account-shell { min-height: 100vh; display: grid; place-items: center; padding: 1rem;
    background: radial-gradient(circle at 20% 10%, #d5efeb 0, transparent 45%), var(--bg); }
.account-card { width: 100%; max-width: 400px; background: var(--card); border-radius: 24px; padding: 1.6rem; box-shadow: var(--shadow); }
.account-brand { display: flex; align-items: center; gap: .5rem; color: var(--brand); font-weight: 800; margin-bottom: 1.1rem; font-size: 1.1rem; }

/* ---------- Day header (my tasks) ---------- */
.day-card { background: var(--card); border-radius: 24px; padding: 1rem 1.1rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.day-nav { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.day-title { text-align: center; flex: 1; }
.day-title .big { font-size: 1.15rem; font-weight: 800; }
.day-title .sub { color: var(--muted); font-size: .82rem; }
.progress { height: 12px; border-radius: 999px; background: var(--track); overflow: hidden; margin: .9rem 0 .7rem; }
.progress > div { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #36b37e, #1f9d55); transition: width .4s; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.stat { background: var(--surface-2); border-radius: var(--r-md); padding: .45rem .6rem; display: flex; align-items: center; gap: .45rem; }
.stat .num { font-weight: 800; font-size: 1.05rem; }
.stat .lbl { color: var(--muted); font-size: .78rem; }
.stat.ok .icon { color: var(--ok); }
.stat.bad .icon { color: var(--danger); }
.stat.warn .icon { color: var(--warn); }

/* ---------- Task card ---------- */
.task {
    --cat: #64748b;
    display: grid; grid-template-columns: auto 1fr auto; gap: .5rem .85rem; align-items: center;
    background: var(--card); border-radius: var(--r-lg); padding: .8rem .9rem; margin-bottom: .65rem;
    box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.task::before { content: ""; position: absolute; inset-block: 12px; inset-inline-start: 0; width: 4px; border-radius: 4px; background: var(--cat); opacity: .85; }
.task.urgent { background: linear-gradient(270deg, #fff 70%, #fff5f5); }
.task.urgent::before { background: var(--danger); }
.task.late { box-shadow: var(--shadow), inset 0 0 0 1.5px #f3b8b8; }
.task.final .task-title, .task.final .cat-tile { opacity: .6; }
.task-main { min-width: 0; }
.task-title { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; font-weight: 700; font-size: 1rem; line-height: 1.5; }
.task-title a { color: var(--ink); text-decoration: none; }
.task.final .task-title a { text-decoration: line-through; text-decoration-color: #c8bfb8; }
.task-meta { display: flex; flex-wrap: wrap; gap: .2rem .7rem; font-size: .8rem; color: var(--muted); margin-top: .2rem; align-items: center; }
.task-meta .m { display: inline-flex; align-items: center; gap: .2rem; }
.task-actions { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: flex-end; align-items: center; }
.task-prompt, .task .alert, .task-extra { grid-column: 1 / -1; }
.task-prompt { display: grid; gap: .4rem; }
.task-prompt > div { display: flex; gap: .4rem; }
.task-extra { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: flex-end; }

/* The big round tick (like a habit tracker) */
.tick {
    width: 48px; height: 48px; border-radius: 50%; flex: none; cursor: pointer; padding: 0;
    display: grid; place-items: center; background: #fff; color: var(--field-line);
    border: 2.5px solid var(--field-line); transition: background-color .15s, border-color .15s, color .15s;
}
.tick:hover:not(:disabled) { border-color: var(--ok); color: var(--ok); }
.tick.done { background: var(--ok); border-color: var(--ok); color: #fff; }
.tick.pending { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.tick.bad { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.tick.idle { border-style: dashed; }
.tick:disabled { cursor: default; }

.card.empty { text-align: center; padding: 2rem 1rem; }
.card.empty .big { font-size: 2.6rem; color: var(--ok); }
.card.slim { padding: .9rem; display: flex; gap: .5rem; align-items: center; justify-content: center; }
details.done-list summary { cursor: pointer; list-style: none; }
details.done-list summary::-webkit-details-marker { display: none; }

/* Tabs & filters */
.tabs { display: flex; gap: .35rem; overflow-x: auto; margin-bottom: .8rem; padding-bottom: .2rem; }
.tab {
    background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: .35rem .9rem; min-height: var(--tap); font: inherit; font-size: .88rem;
    cursor: pointer; white-space: nowrap; color: var(--ink-2);
}
.tab.active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .8rem; align-items: flex-start; }
.filters > * { flex: 1 1 200px; }

/* Task detail */
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }
.desc { white-space: pre-wrap; margin: .75rem 0 0; }
.discrepancy.open { box-shadow: var(--shadow), inset 0 0 0 2px #f3b8b8; }
ol.timeline { list-style: none; padding: 0; margin: 0 0 1rem; position: relative; }
ol.timeline li { padding: .5rem 1.4rem .5rem 0; position: relative; font-size: .92rem; }
ol.timeline li::before { content: ""; position: absolute; inset-inline-start: 3px; top: .95rem; width: 9px; height: 9px; border-radius: 50%; background: var(--brand); opacity: .5; }
ol.timeline li::after { content: ""; position: absolute; inset-inline-start: 7px; top: 1.6rem; bottom: -.4rem; width: 1px; background: var(--line); }
ol.timeline li:last-child::after { display: none; }
ol.timeline .when { color: var(--muted); font-size: .8rem; margin-inline-end: .5rem; direction: ltr; unicode-bidi: isolate; }
ol.timeline .note { margin-top: .2rem; white-space: pre-wrap; background: var(--surface-2); padding: .35rem .6rem; border-radius: var(--r-sm); }

/* ---------- Dashboard ---------- */
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); vertical-align: middle; animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.attention { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.queue { background: var(--card); border-radius: var(--r-lg); padding: .85rem; box-shadow: var(--shadow); }
.queue.empty-q { opacity: .55; }
.queue h2 { display: flex; align-items: center; gap: .45rem; font-size: .98rem; }
.queue .more { margin-inline-start: auto; font-size: .82rem; font-weight: 600; }
.queue-item { display: flex; gap: .55rem; align-items: center; padding: .45rem 0; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.queue-item .txt { display: flex; flex-direction: column; min-width: 0; }
.queue-item .muted { font-size: .78rem; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .65rem; margin-bottom: 1rem; }
.kpi { background: var(--card); border-radius: var(--r-lg); padding: .8rem .9rem; box-shadow: var(--shadow); display: flex; gap: .7rem; align-items: center; }
.kpi .cat-tile { width: 42px; height: 42px; }
.kpi-value { font-size: 1.55rem; font-weight: 800; line-height: 1.2; }
.kpi-label { color: var(--muted); font-size: .82rem; }
.kpi.bad .kpi-value { color: var(--danger); }
.kpi.warn .kpi-value { color: var(--warn); }
.cat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .6rem; margin-bottom: 1rem; }
.cat-card { --cat: #64748b; background: var(--card); border-radius: var(--r-lg); padding: .75rem; box-shadow: var(--shadow); display: flex; gap: .6rem; align-items: center; }
.cat-card .name { font-weight: 700; font-size: .9rem; }
.cat-card .body { flex: 1; min-width: 0; }
.bar { position: relative; min-width: 90px; height: 20px; background: var(--track); border-radius: 999px; overflow: hidden; font-size: .75rem; margin-top: .2rem; }
.bar-fill { position: absolute; inset-block: 0; inset-inline-start: 0; background: color-mix(in srgb, var(--cat, #1f9d55) 45%, white); border-radius: 999px; }
.bar span { position: relative; padding-inline: .5rem; line-height: 20px; font-weight: 600; }
.small-note { font-size: .82rem; }
.link-code { font-size: 2.2rem; letter-spacing: .4rem; text-align: center; font-weight: 800; margin: 1rem 0; padding: .7rem; background: var(--brand-soft); border-radius: var(--r-lg); }

/* ---------- Blazor ---------- */
#blazor-error-ui {
    display: none; position: fixed; inset-inline: 0; bottom: 0; z-index: 1000;
    padding: .75rem 1rem; background: var(--warn-soft); color: var(--warn);
}
#blazor-error-ui .reload { margin-inline-start: .5rem; }

/* ---------- Materials & purchases (phase 3) ---------- */
a.task.mat-card { text-decoration: none; color: inherit; }
.mat-lines { font-size: .82rem; color: var(--ink-2); margin-top: .25rem; }
.pick-list { display: grid; gap: .35rem; margin-bottom: .8rem; max-height: 260px; overflow-y: auto; }
.pick { display: flex; justify-content: space-between; gap: .5rem; align-items: center; padding: .55rem .8rem; border: 1px solid var(--line);
    border-radius: var(--r-md); background: #fff; font: inherit; cursor: pointer; text-align: start; }
.pick:hover { border-color: var(--brand); background: var(--brand-soft); }
.mat-line { display: grid; grid-template-columns: 1fr 160px auto; gap: .5rem; align-items: center; padding: .55rem 0; border-bottom: 1px dashed var(--line); }
.mat-line:has(input[placeholder="نام کالا"]) { grid-template-columns: 1.4fr .8fr .8fr 140px auto; }
@media (max-width: 700px) { .mat-line, .mat-line:has(input[placeholder="نام کالا"]) { grid-template-columns: 1fr 1fr; } }
.qty { display: flex; align-items: center; gap: .35rem; }
.qty span { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.mat-check { padding: .7rem 0; border-bottom: 1px solid var(--line); }
.mat-check:last-of-type { border-bottom: 0; }
.mat-head { display: flex; flex-wrap: wrap; gap: .3rem .7rem; align-items: baseline; margin-bottom: .35rem; }
.mat-req { margin-inline-start: auto; font-weight: 700; color: var(--ink-2); }
.mat-facts { display: flex; flex-wrap: wrap; gap: .3rem 1rem; font-size: .9rem; }
.mat-facts .bad { color: var(--danger); }
.deliver-row { display: grid; grid-template-columns: 130px 1fr auto; gap: .5rem; margin-top: .5rem; align-items: center; }
@media (max-width: 600px) { .deliver-row { grid-template-columns: 1fr; } }

/* ---------- Focus, menu, FAB, motion (UI review) ---------- */
/* One visible focus ring for keyboard users on every control (mouse/touch clicks don't show it). */
a:focus-visible, button:focus-visible, .tab:focus-visible, .chip:focus-visible, .pick:focus-visible, summary:focus-visible {
    outline: none; box-shadow: var(--focus); border-radius: var(--r-sm);
}
/* Keyboard focus on the hidden menu checkbox shows on the «بیشتر» button. */
.shell:has(.nav-toggle:focus-visible) .bottom-nav label { box-shadow: var(--focus); border-radius: var(--r-sm); color: var(--brand); }
/* The + button never covers the open menu, and pages that show it keep room under their last card. */
.shell:has(.nav-toggle:checked) .fab { display: none; }
@media (min-width: 900px) { .shell:has(.nav-toggle:checked) .fab { display: grid; } }
.shell:has(.fab) .content { padding-bottom: calc(var(--bottom-nav-h) + 56px + 2.5rem); }
@media (min-width: 900px) { .shell:has(.fab) .content { padding-bottom: calc(56px + 3rem); } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Admin-dashboard look (cards, KPIs, page heads) ---------- */
.day-card, .queue, .kpi, .cat-card, .task, .table-wrap, .account-card { border: 1px solid var(--line); }
.page-head { margin-bottom: 1.1rem; }
.page-head h1 { font-size: 1.5rem; }
.card > h2, .queue h2 { font-size: 1rem; color: var(--ink); }
.kpis { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; }
.kpi { justify-content: space-between; align-items: flex-start; padding: 1rem 1.1rem; }
.kpi-label { font-weight: 600; font-size: .82rem; color: var(--muted); }
.kpi-value { font-size: 1.8rem; margin-top: .2rem; color: var(--ink); }
.kpi .cat-tile { width: 42px; height: 42px; border-radius: 12px; }
thead th { background: var(--surface-2); color: var(--muted); font-size: .8rem; }
tbody tr:hover td { background: #fafcfd; }
.tab.active { box-shadow: 0 4px 10px rgba(15, 118, 110, .22); }
.btn.primary { box-shadow: 0 4px 10px rgba(15, 118, 110, .22); }
/* Sidebar user card: name on one row, actions on the next, so a long name is never cut. */
.side-user { flex-wrap: wrap; row-gap: .35rem; }
.side-user-name { flex-basis: calc(100% - 50px); }
.side-user > .btn, .side-user > form { flex: 1; }
.side-user .btn.icon-only { width: 100%; }
@media (min-width: 900px) { .sidebar .side-close { display: none; } }

/* Blazor focuses the page heading after navigation (for screen readers); no ring for that. */
h1:focus { outline: none; }
