/* Telavang Design System 1.0.1 — tokens (section 2.7), written as plain CSS (no Tailwind build available offline). Light only. */
@font-face {
  font-family: 'Vazirmatn';
  src: url('fonts/Vazirmatn-wght.woff2') format('woff2-variations'), url('fonts/Vazirmatn-wght.woff2') format('woff2');
  font-weight: 100 900; font-display: swap;
}
:root {
  color-scheme: only light;
  --canvas: #f7f9fc; --surface: #ffffff; --surface-2: #fafbfd;
  --ink: #2f3a45; --ink-2: #6b7280; --ink-3: #6b7280;
  --separator: #dce3ea; --separator-strong: #c2ccd7; --header-line: #cdd3da;
  --selected: #eaf0f8; --row-hover: #f3f4f6; --hover: rgb(18 62 124 / 0.06);
  --accent: #123e7c; --accent-hover: #0d3163; --accent-soft: #e7eef7; --accent-press: #d3e1f2; --accent-ink: #ffffff;
  --brand-orange: #fd8204;
  --signal-overdue: #b42318; --signal-overdue-soft: #fdecea; --signal-overdue-press: #f8d7d3;
  --signal-done: #067647; --signal-done-soft: #e6f4ec;
  --signal-soon: #9a3d06; --signal-soon-soft: #fdf1e6;
  --cat-meeting: #0f6672; --cat-meeting-soft: #e6f2f4; --cat-task: #475467; --cat-task-soft: #f2f4f7;
  --focus: #123e7c; --shadow-pane: 0 1px 2px rgb(47 58 69 / 0.06); --touch: 44px;
  --radius-sm: 6px; --radius-md: 10px; --radius-lg: 14px;
  --font-sans: 'Vazirmatn', system-ui, sans-serif;
}
.bg-selected, .bg-accent-soft, [aria-current='page'], .tint, .grid-row.selected, .chip.prog, .badge.accent { --ink-2: #5b6370; --ink-3: #5b6370; }

html { font-size: 100%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: #f7f9fc; }
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--canvas); color: var(--ink); font-family: var(--font-sans); font-size: 1rem; line-height: 1.8;
  font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1; -webkit-font-smoothing: antialiased; overflow-x: hidden; min-height: 100dvh;
}
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-sm); }
button, input, select, textarea { font: inherit; color: inherit; }
button, [role='button'], a { cursor: pointer; touch-action: manipulation; }
::selection { background: var(--accent-soft); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap-anywhere { overflow-wrap: anywhere; word-break: normal; }
.ltr-run { unicode-bidi: isolate; direction: ltr; }
.code { unicode-bidi: isolate; direction: ltr; font-size: 13px; color: var(--ink-2); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
.icon { display: inline-block; flex-shrink: 0; vertical-align: middle; }

/* ---------- shell ---------- */
.skip { position: absolute; inset-inline-start: 16px; top: -60px; background: var(--surface); padding: 8px 12px; border-radius: var(--radius-md); z-index: 100; }
.skip:focus { top: 8px; }
.topbar { position: sticky; top: 0; z-index: 40; background: var(--surface); border-bottom: 1px solid var(--separator); min-height: 64px; display: flex; align-items: center; gap: 16px; padding: 0 16px; }
.lockup { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; min-height: 44px; }
.lockup:hover { text-decoration: none; }
.crown { position: relative; display: inline-block; flex-shrink: 0; overflow: visible; }
.crown img { position: absolute; max-width: none; }
.lockup-name { font-size: 15px; font-weight: 600; line-height: 24px; }
.topbar-tools { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.user-label { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); padding-block: 2px; }
.user-label select { min-height: 40px; max-width: 290px; font-size: 14px; }
.banner { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--separator); padding: 8px 16px; font-size: 13.5px; line-height: 24px; }
.banner.neutral { background: var(--surface-2); }
.banner.neutral .icon { color: var(--ink-2); }
.banner.act { background: var(--selected); --ink-2: #5b6370; }
.banner.act .icon { color: var(--accent); }
.layout { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: calc(100dvh - 64px); }
.sidebar { position: sticky; top: 64px; align-self: start; height: calc(100dvh - 64px); overflow-y: auto; background: var(--surface); border-inline-end: 1px solid var(--separator); padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }
.nav-row { position: relative; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: var(--radius-md); color: var(--ink); font-size: 15px; text-decoration: none; transition: background-color .15s; }
.nav-row:hover { background: var(--hover); text-decoration: none; }
.nav-row .icon { color: var(--ink-2); }
.nav-row[aria-current='page'] { background: var(--selected); color: var(--accent); font-weight: 600; }
.nav-row[aria-current='page'] .icon { color: var(--accent); }
.nav-row[aria-current='page']::before { content: ''; position: absolute; inset-block: 10px; inset-inline-start: 0; width: 3px; border-radius: 9999px; background: var(--brand-orange); }
.nav-row .count { margin-inline-start: auto; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--separator); padding-top: 12px; font-size: 11.5px; line-height: 20px; color: var(--ink-3); }
main { min-width: 0; padding: 0 0 200px; }
.page { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.page-head { display: flex; align-items: center; gap: 12px; min-height: 56px; padding-top: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; line-height: 28px; font-weight: 700; margin: 0; }
.page-head .actions { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.lead { color: var(--ink-2); font-size: 14px; line-height: 24px; margin: 4px 0 16px; max-width: 70ch; }
h2 { font-size: 17px; line-height: 28px; font-weight: 600; margin: 24px 0 8px; }
h3 { font-size: 15px; line-height: 24px; font-weight: 600; margin: 0 0 8px; }
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; border-inline-end: 0; border-bottom: 1px solid var(--separator); padding: 8px 12px; }
  .nav-row { font-size: 16px; }
  .sidebar-foot { width: 100%; margin-top: 4px; }
  .user-label .lbl { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  .user-label select { max-width: 170px; min-height: 44px; font-size: 16px; }
  .lockup-name { font-size: 14px; }
}

/* ---------- buttons ---------- */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: var(--radius-md); font-weight: 500; transition: background-color .15s, border-color .15s, color .15s; user-select: none; min-height: var(--touch); padding: 0 16px; font-size: 15px; background: var(--surface); color: var(--ink); border-color: var(--separator-strong); text-decoration: none; white-space: nowrap; }
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { min-height: 36px; min-width: 36px; padding: 0 12px; font-size: 14px; }
.btn.sm::after { content: ''; position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; transform: translate(-50%, -50%); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: 0 1px 0 rgb(47 58 69 / 0.06); }
.btn.primary:enabled:hover { background: var(--accent-hover); }
.btn.secondary:enabled:hover, .btn:not(.primary):not(.ghost):not(.danger):enabled:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.btn.secondary:enabled:active { background: var(--accent-press); }
.btn.ghost { background: transparent; color: var(--accent); border-color: transparent; }
.btn.ghost:enabled:hover { background: var(--accent-soft); }
.btn.ghost:enabled:active { background: var(--accent-press); }
.btn.danger { background: var(--surface); color: var(--signal-overdue); border-color: rgb(180 35 24 / .4); }
.btn.danger:enabled:hover { border-color: var(--signal-overdue); background: var(--signal-overdue-soft); }
.btn.danger:enabled:active { background: var(--signal-overdue-press); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.icon-btn { position: relative; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 9999px; border: 0; background: transparent; color: var(--ink-2); }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

/* ---------- fields ---------- */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field > label, .field > .label { font-size: 15px; font-weight: 500; line-height: 24px; }
.req { color: var(--signal-overdue); }
.hint { font-size: 14px; line-height: 20px; color: var(--ink-2); }
.input, select.input, textarea.input { width: 100%; min-height: var(--touch); border-radius: var(--radius-md); border: 1px solid var(--separator-strong); background: var(--surface); padding: 0 12px; font-size: 16px; color: var(--ink); transition: border-color .15s; }
.input::placeholder { color: var(--ink-3); }
.input:hover { border-color: var(--ink-3); }
.input:focus { border-color: var(--accent); }
select.input { appearance: none; padding-inline-end: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235B6370' 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: left 12px center; }
textarea.input { padding-block: 10px; min-height: 96px; line-height: 1.625; }
.check-row { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding-block: 10px; font-size: 15px; line-height: 24px; }
.check-row input { width: 20px; height: 20px; accent-color: var(--accent); margin: 2px 0 0; flex-shrink: 0; }
.check-row .desc { display: block; font-size: 14px; color: var(--ink-2); line-height: 20px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
fieldset { border: 1px solid var(--separator); border-radius: var(--radius-md); padding: 8px 12px 4px; margin: 0 0 12px; }
legend { font-size: 12.5px; font-weight: 600; color: var(--ink-2); padding: 0 4px; }
.line-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px 44px; gap: 8px; align-items: center; margin-bottom: 8px; }

/* ---------- surfaces ---------- */
.card { border: 1px solid var(--separator); background: var(--surface); border-radius: var(--radius-lg); padding: 16px; }
.card + .card { margin-top: 12px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.card.link { transition: border-color .15s, box-shadow .15s; display: block; color: inherit; }
.card.link:hover { border-color: var(--separator-strong); box-shadow: 0 2px 10px rgb(18 62 124 / 0.08); text-decoration: none; }
.card.link:hover .card-title { color: var(--accent); }
.card-title { font-size: 15px; font-weight: 600; line-height: 24px; margin: 0 0 4px; }
.meta { font-size: 13px; line-height: 20px; color: var(--ink-2); }
.note { border-radius: var(--radius-md); border: 1px solid var(--separator-strong); background: var(--surface-2); padding: 12px 16px; font-size: 15px; line-height: 28px; margin: 0 0 12px; }
.caution { border-radius: var(--radius-md); border: 1px solid rgb(154 61 6 / .4); background: var(--signal-soon-soft); padding: 10px 14px; font-size: 14px; line-height: 24px; color: var(--ink); margin: 0 0 12px; --ink-2: #5b6370; display: flex; gap: 8px; align-items: flex-start; }
.caution .icon { color: var(--signal-soon); margin-top: 3px; }
.danger-note { border-radius: var(--radius-md); border: 1px solid rgb(180 35 24 / .4); background: var(--signal-overdue-soft); padding: 10px 14px; font-size: 14px; line-height: 24px; margin: 0 0 12px; display: flex; gap: 8px; align-items: flex-start; --ink-2: #5b6370; }
.danger-note .icon { color: var(--signal-overdue); margin-top: 3px; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 16px; font-size: 14px; line-height: 24px; margin: 0; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; }
.section { margin-top: 20px; }

/* ---------- badges & chips ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; border-radius: 9999px; border: 1px solid transparent; padding: 0 8px; font-size: 12.5px; font-weight: 500; line-height: 20px; white-space: nowrap; }
.badge.neutral { background: var(--surface-2); color: var(--ink-2); border-color: var(--separator); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.overdue { background: var(--signal-overdue-soft); color: var(--signal-overdue); }
.badge.done { background: var(--signal-done-soft); color: var(--signal-done); }
.badge.soon { background: var(--signal-soon-soft); color: var(--signal-soon); }
.chip { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; border-radius: 9999px; padding: 0 8px; font-size: 13px; font-weight: 500; line-height: 24px; }
.chip.wait, .chip.closed { background: var(--surface-2); color: var(--ink-2); }
.chip.prog { background: var(--accent-soft); color: var(--accent); }
.chip.done { background: var(--signal-done-soft); color: var(--signal-done); }
.cond { display: inline-flex; align-items: center; gap: 4px; color: var(--signal-overdue); font-size: 13px; font-weight: 500; line-height: 24px; }
.count { min-width: 22px; border-radius: 9999px; background: var(--accent-soft); padding: 0 6px; text-align: center; font-size: 12.5px; font-weight: 600; line-height: 22px; color: var(--accent); }
[aria-current='page'] .count { background: var(--surface); }

/* ---------- data grid (container queries) ---------- */
.grid-wrap { container-type: inline-size; border: 1px solid var(--separator); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }
.grid-head { display: none; }
.grid-row { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; border-bottom: 1px solid var(--separator); position: relative; }
.grid-row:last-child { border-bottom: 0; }
.grid-row .cell { font-size: 14px; line-height: 24px; min-width: 0; overflow-wrap: anywhere; }
.grid-row .cell[data-l]::before { content: attr(data-l) ': '; color: var(--ink-2); }
@container (min-width: 46rem) {
  .grid-head, .grid-row { display: grid; grid-template-columns: var(--cols); gap: 12px; align-items: center; }
  .grid-head { padding: 8px 16px; background: var(--surface-2); border-bottom: 1px solid var(--separator); font-size: 13px; font-weight: 600; color: var(--ink-2); }
  .grid-row .cell[data-l]::before { content: none; }
}
.grid-row.selected { background: var(--selected); }
.grid-row.selected::before { content: ''; position: absolute; inset-block: 0; inset-inline-start: 0; width: 3px; background: var(--brand-orange); }
.num { text-align: end; }
.missing { color: var(--signal-overdue); font-weight: 500; }
.table-scroll { overflow-x: auto; border: 1px solid var(--separator); border-radius: var(--radius-lg); background: var(--surface); }
table.t { border-collapse: collapse; width: 100%; font-size: 14px; line-height: 24px; }
table.t th, table.t td { border-bottom: 1px solid var(--separator); padding: 8px 12px; text-align: start; vertical-align: top; }
table.t th { background: var(--surface-2); font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
table.t tr:last-child td { border-bottom: 0; }

/* ---------- dialog ---------- */
dialog.dlg { margin: auto; width: min(100vw - 2rem, var(--w, 34rem)); max-height: calc(100dvh - 2rem); overflow: auto; border-radius: var(--radius-lg); border: 1px solid var(--separator); background: var(--surface); padding: 0; color: var(--ink); box-shadow: 0 25px 50px -12px rgb(0 0 0 / .25); }
dialog.dlg[open] { animation: dlg-in .18s ease-out; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
dialog.dlg::backdrop { background: rgb(47 58 69 / .4); }
.dlg-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--separator); padding: 16px 20px; }
.dlg-head h2 { font-size: 18px; line-height: 28px; font-weight: 700; margin: 0; }
.dlg-head p { margin: 2px 0 0; font-size: 14px; line-height: 22px; color: var(--ink-2); }
.dlg-body { padding: 16px 20px; }
.dlg-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--separator); padding: 12px 20px; }

/* ---------- toast ---------- */
.toasts { position: fixed; inset-inline: 0; bottom: 24px; z-index: 100; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { pointer-events: auto; max-width: 28rem; width: 100%; display: flex; align-items: center; gap: 12px; border-radius: var(--radius-md); border: 1px solid var(--separator-strong); background: var(--surface); padding: 12px 16px; font-size: 15px; line-height: 24px; box-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1); }
.toast.success { border-color: rgb(6 118 71 / .3); } .toast.success .ti { color: var(--signal-done); }
.toast.error { border-color: rgb(180 35 24 / .4); } .toast.error .ti { color: var(--signal-overdue); }
.toast.info .ti { color: var(--accent); }
.toast .msg { flex: 1; }
.toast .x { position: relative; width: 36px; height: 36px; border-radius: 9999px; border: 0; background: transparent; color: var(--ink-2); display: grid; place-items: center; }
.toast .x::after { content: ''; position: absolute; inset: -4px; }
.toast .x:hover { background: var(--surface-2); }

/* ---------- empty state ---------- */
.empty { text-align: center; padding: 64px 24px; }
.empty .ill { position: relative; display: inline-block; color: var(--ink-3); }
.empty .ill::after { content: ''; position: absolute; top: -2px; inset-inline-end: -4px; width: 10px; height: 10px; border-radius: 9999px; background: var(--brand-orange); }
.empty h2 { font-size: 18px; font-weight: 600; margin: 8px 0 4px; }
.empty p { font-size: 15px; color: var(--ink-2); max-width: 24rem; margin: 0 auto; }

/* ---------- trace ---------- */
.trace { list-style: none; margin: 0; padding: 0; }
.trace > li { position: relative; padding: 0 0 16px; padding-inline-start: 28px; }
.trace > li::before { content: ''; position: absolute; inset-inline-start: 9px; top: 26px; bottom: 0; width: 1px; background: var(--separator-strong); }
.trace > li:last-child::before { display: none; }
.trace .dot { position: absolute; inset-inline-start: 0; top: 4px; width: 20px; height: 20px; border-radius: 9999px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.ok-text { color: var(--signal-done); font-weight: 500; }
.bad-text { color: var(--signal-overdue); font-weight: 500; }

/* ---------- hit targets (DS 4.1, technique T1 for inline text links) ---------- */
main a:not(.btn):not(.card) { position: relative; }
main a:not(.btn):not(.card)::after { content: ''; position: absolute; left: 50%; top: 50%; width: max(100%, 44px); height: 44px; transform: translate(-50%, -50%); }
.skip { min-height: 44px; display: inline-flex; align-items: center; }
a.btn:hover { text-decoration: none; border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
a.btn.ghost:hover { border-color: transparent; }

/* ---------- re-test round (Platform Version 2) ---------- */
/* Links inside running text are underlined so they are not identified by colour alone (DS 6.3, WCAG 1.4.1). */
main p a, main dd a, main .meta a, main .note a, main .caution a, main .danger-note a, .banner a { text-decoration: underline; text-underline-offset: 3px; }
/* A table that scrolls sideways is a focusable region, so keyboard users can scroll it (WCAG 2.1.1). */
.table-scroll[tabindex]:focus-visible { outline-offset: 2px; }

/* ---------- R&D pilot: sign-in and session (Platform Version 3) ---------- */
[hidden] { display: none !important; }
.login-page { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(100%, 26rem); background: var(--surface); border: 1px solid var(--separator); border-radius: var(--radius-lg); box-shadow: var(--shadow-pane); padding: 24px; }
.login-logo { display: block; height: 72px; max-width: 140px; width: auto; margin: 0 auto 22px; object-fit: contain; }
.login-card h1 { font-size: 24px; line-height: 32px; font-weight: 700; margin: 0 0 4px; text-align: center; }
.login-card > .meta { text-align: center; margin: 0 0 16px; }
.session-box { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 14px; }
.session-name { color: var(--ink); font-weight: 500; }
@media (max-width: 900px) { .session-name .meta { display: none; } }
body[aria-busy='true'] { cursor: progress; }
