/* پنل پشتیبان خدمات — tokens from the phone app (ui/theme/tokens.dart) and the approved preview. */

@font-face { font-family: Vazirmatn; font-weight: 400; font-display: swap; src: url("../fonts/Vazirmatn-Regular.ttf") format("truetype"); }
@font-face { font-family: Vazirmatn; font-weight: 500; font-display: swap; src: url("../fonts/Vazirmatn-Medium.ttf") format("truetype"); }
@font-face { font-family: Vazirmatn; font-weight: 700; font-display: swap; src: url("../fonts/Vazirmatn-Bold.ttf") format("truetype"); }
@font-face { font-family: Vazirmatn; font-weight: 800; font-display: swap; src: url("../fonts/Vazirmatn-ExtraBold.ttf") format("truetype"); }

:root {
  --primary: #1E40AF; --primary-dark: #1E3A8A; --primary-soft: #DBEAFE; --primary-line: #93C5FD;
  --accent: #C2410C; --accent-soft: #FFEDD5;
  --bg: #EFF6FF; --surface: #FFFFFF; --surface-muted: #F8FAFC;
  --text: #0F172A; --text-label: #334155; --text-muted: #475569; --on-dark: #FFFFFF; --on-dark-muted: #DBEAFE;
  --border: #E2E8F0; --border-input: #BFDBFE; --border-chip: #CBD5E1; --divider: #F1F5F9; --chevron: #94A3B8;
  --success: #15803D; --success-soft: #DCFCE7; --success-line: #BBF7D0;
  --warning: #B45309; --warning-soft: #FEF3C7; --warning-line: #FCD34D;
  --danger: #B91C1C; --danger-soft: #FEE2E2; --danger-line: #FECACA;
  --neutral: #334155; --neutral-soft: #F1F5F9;
  --r-tag: 6px; --r-small: 10px; --r-control: 12px; --r-button: 14px; --r-card: 16px; --r-large: 20px;
  --touch: 48px; --control: 52px; --cta: 56px;
  --font: Vazirmatn, Tahoma, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.7; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
a:hover { color: var(--primary-dark); }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--primary-line); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
svg.icon { flex-shrink: 0; }

/* ---------- shell ---------- */
.shell { min-height: 100vh; display: flex; align-items: stretch; }
.sidebar { width: 264px; flex-shrink: 0; background: var(--surface); border-left: 1px solid var(--border); padding: 20px 16px; display: flex; flex-direction: column; gap: 20px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar.dark { background: var(--primary-dark); color: var(--on-dark); border-left: none; }
.content { flex: 1; min-width: 0; padding: 24px; padding-bottom: 48px; }
.content-inner { max-width: 1040px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 44px; height: 44px; border-radius: 14px; background: var(--primary); color: var(--on-dark); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sidebar.dark .brand-mark { background: var(--surface); color: var(--primary-dark); }
.brand-name { font-size: 16px; font-weight: 800; color: var(--primary-dark); display: block; }
.brand-sub { font-size: 12px; color: var(--text-muted); display: block; }
.sidebar.dark .brand-name { color: var(--on-dark); }
.sidebar.dark .brand-sub { color: var(--on-dark-muted); }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-link { height: var(--touch); border-radius: var(--r-control); color: var(--text-label); text-decoration: none; display: flex; align-items: center; gap: 10px; padding: 0 12px; font-size: 15px; font-weight: 500; }
.side-link:hover { background: var(--surface-muted); color: var(--primary-dark); }
.side-link[aria-current="page"] { background: var(--primary-soft); color: var(--primary-dark); font-weight: 700; }
.sidebar.dark .side-link { color: var(--on-dark); }
.sidebar.dark .side-link:hover { background: rgba(255,255,255,0.08); color: var(--on-dark); }
.sidebar.dark .side-link[aria-current="page"] { background: var(--surface); color: var(--primary-dark); }
.side-link .grow { flex: 1; }
.count { min-width: 24px; height: 24px; border-radius: 999px; background: var(--primary); color: var(--on-dark); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; }
.count.warn { background: var(--warning-soft); color: var(--warning); }
.side-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--divider); padding-top: 14px; }
.sidebar.dark .side-foot { border-top-color: rgba(255,255,255,0.15); }
.side-note { font-size: 12px; line-height: 1.9; color: var(--on-dark-muted); }
.avatar { width: 40px; height: 40px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-dark); font-size: 15px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.avatar.lg { width: 48px; height: 48px; font-size: 18px; }
.avatar.grey { background: var(--neutral-soft); color: var(--neutral); }
.who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.who strong { font-size: 14px; }
.who span { font-size: 12px; color: var(--text-muted); }
.sidebar.dark .who span { color: var(--on-dark-muted); }

.bottom-nav { display: none; }
.mobile-head { display: none; }

@media (max-width: 899px) {
  .sidebar { display: none; }
  .content { padding: 14px 16px 112px; }
  .mobile-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--surface); border-bottom: 1px solid var(--border); padding: 10px 16px; position: sticky; top: 0; z-index: 5; }
  .shell { flex-direction: column; }
  .bottom-nav { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); position: fixed; bottom: 0; left: 0; right: 0; height: 76px; background: var(--surface); border-top: 1px solid var(--border); z-index: 10; padding-bottom: env(safe-area-inset-bottom); }
  .bottom-link { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-decoration: none; color: var(--text-muted); font-size: 12px; font-weight: 500; position: relative; }
  .bottom-link .pill { width: 56px; height: 30px; border-radius: 999px; display: flex; align-items: center; justify-content: center; }
  .bottom-link[aria-current="page"] { color: var(--primary); font-weight: 700; }
  .bottom-link[aria-current="page"] .pill { background: var(--primary-soft); }
  .bottom-link .dot { position: absolute; top: 8px; margin-inline-start: 30px; min-width: 18px; height: 18px; font-size: 11px; }
  .fab { position: fixed; bottom: 92px; left: 16px; z-index: 9; }
  .desktop-only { display: none !important; }
}
@media (min-width: 900px) { .mobile-only { display: none !important; } }

/* ---------- type ---------- */
.page-title { font-size: 22px; font-weight: 800; color: var(--primary-dark); }
.page-sub { font-size: 14px; color: var(--text-muted); }
.section-title { font-size: 16px; font-weight: 700; color: var(--primary-dark); display: flex; align-items: center; gap: 8px; }
.small-title { font-size: 14px; font-weight: 700; color: var(--text-label); }
.muted { color: var(--text-muted); }
.meta { font-size: 12px; color: var(--text-muted); display: inline-flex; align-items: center; gap: 4px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.tight { gap: 6px; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.card.large { border-radius: var(--r-large); padding: 20px; }
.card.muted { background: var(--surface-muted); }
.card.flush { padding: 6px; gap: 0; }
.note { display: flex; align-items: flex-start; gap: 10px; border-radius: 14px; padding: 12px 14px; font-size: 13px; line-height: 1.8; background: var(--primary-soft); color: var(--primary-dark); }
.note svg { margin-top: 3px; }
.note.success { background: var(--success-soft); color: var(--success); }
.note.danger { background: var(--danger-soft); color: var(--danger); }
.note.plain { background: var(--surface-muted); color: var(--text-label); font-size: 12px; border-radius: var(--r-control); }

/* ---------- chips ---------- */
.chip { font-size: 12px; font-weight: 700; border-radius: 999px; padding: 3px 10px; display: inline-flex; align-items: center; gap: 4px; line-height: 1.5; white-space: nowrap; }
.tone-info { color: var(--primary-dark); background: var(--primary-soft); }
.tone-unread { color: var(--primary); background: var(--primary-soft); }
.tone-success { color: var(--success); background: var(--success-soft); }
.tone-warning { color: var(--warning); background: var(--warning-soft); }
.tone-danger { color: var(--danger); background: var(--danger-soft); }
.tone-accent { color: var(--accent); background: var(--accent-soft); }
.tone-neutral { color: var(--neutral); background: var(--neutral-soft); }

/* ---------- buttons ---------- */
.btn { height: var(--touch); border-radius: var(--r-control); border: 1px solid transparent; padding: 0 18px; font-size: 15px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; text-decoration: none; background: var(--surface); color: var(--text); }
.btn:disabled { background: #E2E8F0; color: #64748B; border-color: transparent; cursor: not-allowed; box-shadow: none; }
.btn.block { width: 100%; height: var(--control); font-size: 16px; }
.btn.primary { background: var(--primary); color: var(--on-dark); }
.btn.primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn.cta { background: var(--accent); color: var(--on-dark); border-radius: var(--r-button); box-shadow: 0 4px 12px rgba(194,65,12,0.25); }
.btn.cta.block { height: var(--cta); }
.btn.cta:hover:not(:disabled) { background: #9A3412; }
.btn.outline { border-color: var(--border-input); color: var(--primary); }
.btn.outline:hover { background: var(--primary-soft); }
.btn.ghost { background: transparent; color: var(--text-muted); }
.btn.icon-only { width: var(--touch); padding: 0; }
.btn.small { height: 40px; padding: 0 12px; font-size: 13px; border-radius: var(--r-small); }
.btn.tone-warning { border-color: var(--warning-line); }
.btn.tone-success { border-color: var(--success-line); }
.btn.tone-danger { border-color: var(--danger-line); background: var(--surface); }
.btn.tone-neutral { border-color: var(--border-chip); background: var(--surface); }
.btn.danger-text { color: var(--danger); background: transparent; }
.btn.menu { justify-content: flex-start; height: var(--control); background: transparent; font-weight: 500; width: 100%; padding: 0 12px; }
.btn.menu:hover { background: var(--surface-muted); }
.btn.menu.danger-text { font-weight: 700; }
.btn.busy { opacity: 0.7; pointer-events: none; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .legend { font-size: 13px; font-weight: 500; color: var(--text-label); }
.field .hint { font-size: 12px; color: var(--text-muted); }
.field .opt { font-weight: 400; color: var(--text-muted); }
.input, .select, .textarea { width: 100%; border-radius: var(--r-control); border: 1px solid var(--border-input); background: var(--surface); padding: 0 14px; font-size: 15px; color: var(--text); outline: none; }
.input, .select { height: var(--control); }
.textarea { padding: 12px 14px; line-height: 1.8; resize: vertical; min-height: 96px; }
.input:focus, .select:focus, .textarea:focus { border: 1.5px solid var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input.ltr-input { direction: ltr; text-align: right; letter-spacing: 1px; font-size: 17px; }
.input.code-input { direction: ltr; text-align: center; font-size: 28px; font-weight: 800; letter-spacing: 14px; height: 60px; color: var(--primary-dark); }
.input.link-input { direction: ltr; text-align: center; font-size: 22px; font-weight: 800; letter-spacing: 6px; height: 56px; color: var(--primary-dark); text-transform: uppercase; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap svg { position: absolute; inset-inline-start: 14px; color: var(--text-muted); pointer-events: none; }
.input-wrap .input { padding-inline-start: 42px; }
.search { width: 300px; max-width: 100%; }
.search .input { height: var(--touch); font-size: 14px; }
fieldset { border: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
legend { padding: 0; margin-bottom: 8px; }
.choice { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); padding: 14px; display: flex; align-items: center; gap: 12px; cursor: pointer; }
.choice:has(input:checked) { border: 2px solid var(--primary); padding: 13px; }
.choice input { width: 20px; height: 20px; accent-color: var(--primary); margin: 0; flex-shrink: 0; }
.choice .badge-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--neutral-soft); color: var(--neutral); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.choice:has(input:checked) .badge-icon { background: var(--primary-soft); color: var(--primary); }
.choice-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.choice-text strong { font-size: 15px; }
.choice-text span { font-size: 12px; line-height: 1.7; color: var(--text-muted); }
.segmented { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.seg { height: var(--control); border-radius: var(--r-control); border: 1px solid var(--border-chip); background: var(--surface); color: var(--neutral); display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 14px; font-weight: 700; cursor: pointer; position: relative; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg:has(input:focus-visible) { outline: 3px solid var(--primary-line); outline-offset: 2px; }
.seg.normal:has(input:checked) { border: 2px solid var(--neutral); background: var(--neutral-soft); }
.seg.high:has(input:checked) { border: 2px solid var(--accent); background: var(--accent-soft); color: var(--accent); }
.seg.urgent:has(input:checked) { border: 2px solid var(--danger); background: var(--danger-soft); color: var(--danger); }
.form-error { color: var(--danger); font-size: 13px; font-weight: 500; }

/* ---------- tabs ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-button); padding: 4px; align-self: flex-start; }
.tab { height: 44px; border-radius: var(--r-small); border: none; background: transparent; color: var(--text-label); padding: 0 16px; font-size: 14px; font-weight: 500; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; text-decoration: none; }
.tab[aria-selected="true"] { background: var(--primary); color: var(--on-dark); font-weight: 700; }
.tab .count { background: var(--neutral-soft); color: var(--neutral); min-width: 22px; height: 22px; }
.tab[aria-selected="true"] .count { background: var(--surface); color: var(--primary); }
@media (max-width: 899px) { .tabs { align-self: stretch; } .tab { flex: 1; justify-content: center; padding: 0 8px; } }

/* ---------- tickets ---------- */
.ticket-list { display: flex; flex-direction: column; gap: 10px; }
.ticket { text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); padding: 14px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; }
.ticket:hover { border-color: var(--primary-line); color: var(--text); }
.ticket.unread { border: 1.5px solid var(--primary-line); }
.ticket-main { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.ticket-num { font-size: 13px; font-weight: 700; color: var(--text-muted); }
.ticket-title { font-size: 16px; font-weight: 700; }
.ticket.unread .ticket-title { font-weight: 800; }
.ticket-preview { font-size: 13px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticket-side { flex: 0 1 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
@media (max-width: 899px) { .ticket-side { flex-direction: row; justify-content: space-between; align-items: center; width: 100%; border-top: 1px solid var(--divider); padding-top: 10px; } }
.empty { text-align: center; padding: 40px 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--text-muted); }
.empty .badge-icon { width: 64px; height: 64px; border-radius: 20px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; }
.empty strong { color: var(--text); font-size: 16px; }

/* ---------- thread ---------- */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; }
.crumbs a { height: var(--touch); display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font-weight: 700; }
.crumbs .sep { color: var(--chevron); }
.thread-grid { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px; }
.thread-main { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.thread-aside { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.thread-title { font-size: 20px; font-weight: 800; color: var(--primary-dark); }
.thread-desc { font-size: 14px; line-height: 1.9; color: var(--text-label); white-space: pre-wrap; }
.messages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 78%; display: flex; flex-direction: column; gap: 4px; }
.msg.theirs { align-self: flex-start; align-items: flex-start; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg-author { font-size: 12px; font-weight: 700; color: var(--text-label); }
.msg.mine .msg-author { color: var(--primary-dark); }
.bubble { padding: 10px 14px; font-size: 14px; line-height: 1.9; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.theirs .bubble { background: var(--surface); border: 1px solid var(--border); border-radius: 16px 16px 4px 16px; }
.msg.mine .bubble { background: var(--primary-soft); border-radius: 16px 16px 16px 4px; }
.event { align-self: center; font-size: 12px; border-radius: 999px; padding: 4px 12px; display: inline-flex; align-items: center; gap: 6px; text-align: center; }
.divider-new { display: flex; align-items: center; gap: 10px; color: var(--primary); font-size: 12px; font-weight: 700; }
.divider-new::before, .divider-new::after { content: ""; flex: 1; height: 1px; background: var(--primary-line); }
.seen { color: var(--success); }
.reply { position: relative; }
@media (max-width: 899px) {
  .msg { max-width: 86%; }
  .reply.sticky { position: sticky; bottom: 84px; z-index: 4; box-shadow: 0 -6px 16px rgba(15,23,42,0.06); }
}
dl.facts { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 16px; font-size: 13px; }
dl.facts dt { color: var(--text-muted); }
dl.facts dd { margin: 0; font-weight: 500; }

/* ---------- tables, tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.tile span { font-size: 13px; color: var(--text-muted); display: inline-flex; align-items: center; gap: 4px; }
.tile strong { font-size: 24px; font-weight: 800; color: var(--primary-dark); line-height: 1.2; }
.tile.warn { border-color: var(--warning-line); }
.tile.warn span, .tile.warn strong { color: var(--warning); }
.table-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); overflow-x: auto; }
table { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 14px; }
th { background: var(--surface-muted); color: var(--text-label); text-align: right; padding: 12px 16px; font-size: 13px; font-weight: 700; }
td { padding: 12px 16px; border-top: 1px solid var(--divider); vertical-align: middle; }
td.actions { padding: 8px 16px; }
td.actions .row { justify-content: flex-end; flex-wrap: nowrap; }
.cell-name { display: flex; flex-direction: column; }
.cell-name span { font-size: 12px; color: var(--text-muted); }

/* ---------- auth pages ---------- */
.auth { min-height: 100vh; display: flex; justify-content: center; padding: 56px 20px 24px; }
.auth-inner { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 24px; }
.auth-hero { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.hero-mark { width: 72px; height: 72px; border-radius: 22px; background: var(--primary); color: var(--on-dark); display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 20px rgba(30,64,175,0.25); }
.hero-mark.soft { width: 64px; height: 64px; border-radius: 20px; background: var(--primary-soft); color: var(--primary); box-shadow: none; }
.auth-title { font-size: 24px; font-weight: 800; color: var(--primary-dark); }
.auth-sub { font-size: 14px; line-height: 1.8; color: var(--text-muted); }
.card-title { font-size: 18px; font-weight: 700; color: var(--primary-dark); }
.back-link { align-self: flex-start; height: var(--touch); display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font-size: 14px; font-weight: 700; background: none; border: none; color: var(--primary); cursor: pointer; padding: 0; }
.timer { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 13px; color: var(--text-muted); }
.link-button { background: none; border: none; color: var(--primary); font-weight: 700; cursor: pointer; padding: 8px; min-height: 44px; font-size: 13px; }

/* ---------- link code, QR ---------- */
.code-card .code { font-size: 22px; font-weight: 800; letter-spacing: 3px; color: var(--primary-dark); direction: ltr; }
.qr { width: 180px; height: 180px; border: 1px solid var(--border-chip); border-radius: var(--r-small); background: #fff; padding: 6px; }
.qr-mini { width: 52px; height: 52px; padding: 2px; }
.print-area { display: none; }
@media print {
  body.printing > *:not(.print-area) { display: none !important; }
  body.printing .print-area { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 24px; text-align: center; }
  .print-area img { width: 60mm; height: 60mm; }
}

/* ---------- dialog, toast, loading ---------- */
dialog.confirm { border: none; border-radius: var(--r-large); padding: 20px; width: min(420px, calc(100vw - 32px)); background: var(--surface); color: var(--text); }
dialog.confirm::backdrop { background: rgba(15,23,42,0.45); }
dialog.confirm h2 { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
dialog.confirm p { font-size: 14px; color: var(--text-muted); line-height: 1.8; }
dialog.confirm .row { margin-top: 18px; justify-content: flex-start; }
.btn.danger { background: var(--danger); color: var(--on-dark); }
.btn.success { background: var(--success); color: var(--on-dark); }
.toast-zone { position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
@media (min-width: 900px) { .toast-zone { bottom: 24px; } }
.toast { background: var(--text); color: var(--on-dark); border-radius: var(--r-control); padding: 12px 16px; font-size: 14px; box-shadow: 0 8px 20px rgba(15,23,42,0.2); }
.toast.error { background: var(--danger); }
.loading { padding: 40px; text-align: center; color: var(--text-muted); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--primary-soft); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.9s linear infinite; margin: 0 auto 10px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
.flip { transform: scaleX(-1); }
.content-inner.narrow { max-width: 640px; }
.tab-box { display: flex; }
@media (max-width: 899px) { .tab-box .tabs { flex: 1; } }
@media (max-width: 899px) {
  .reply.sticky { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; padding: 10px 12px; }
  .reply.sticky .legend { grid-column: 1 / -1; font-size: 12px; }
  .reply.sticky .textarea { min-height: 48px; height: 48px; padding: 12px; line-height: 1.6; resize: none; }
  .reply.sticky .row .meta, .reply.sticky .btn-text { display: none; }
  .reply.sticky .btn { width: var(--touch); padding: 0; }
}
.sidebar.dark .btn.ghost { color: var(--on-dark-muted); }

/* ---------- documents, admin panel (approved preview boards 12-17) ---------- */
.grow { flex: 1; min-width: 0; }
.pad { padding: 10px 12px 4px; }
.nowrap { white-space: nowrap; }
.warn-text { color: var(--warning); }
.file-row { border: 1px solid var(--border); border-radius: var(--r-control); padding: 10px 12px; display: flex; align-items: center; gap: 10px; }
.file-icon { width: 40px; height: 40px; border-radius: var(--r-small); background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.file-name { font-size: 14px; font-weight: 500; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn.dropzone { min-height: 64px; height: auto; border: 2px dashed var(--border-input); background: var(--surface); color: var(--primary); width: 100%; }
.btn.dropzone:hover { background: var(--primary-soft); }
.btn.dropzone.attention { border-color: var(--accent); background: #FFF7ED; color: var(--accent); }
.admin-note { border-radius: var(--r-control); padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; background: var(--accent-soft); color: #9A3412; }
.admin-note strong { font-size: 12px; }
.admin-note p { font-size: 13px; line-height: 1.8; }
.admin-note.rejected { background: var(--danger-soft); color: var(--danger); }
.notice-banner { display: flex; align-items: flex-start; gap: 10px; border-radius: 14px; padding: 12px 14px; background: var(--primary-soft); color: var(--primary-dark); }
.notice-banner > svg { margin-top: 3px; }
.notice-banner.important { background: var(--warning-soft); color: #92400E; }
.notice-banner strong { font-size: 14px; display: block; }
.notice-banner p { font-size: 13px; line-height: 1.8; white-space: pre-wrap; }
.notice-banner .btn { color: inherit; }
.check-row { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; cursor: pointer; }
.check-row input { width: 20px; height: 20px; accent-color: var(--primary); margin: 0; }
dialog.viewer { width: min(860px, calc(100vw - 32px)); }
.viewer-img { display: block; max-width: 100%; max-height: 70vh; margin: 12px auto 0; border-radius: var(--r-small); }
.tiles .tile small { font-size: 12px; color: var(--text-muted); }
.tile.link { text-decoration: none; }
.tile.warn small { color: var(--warning); }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 12px; }
@media (max-width: 420px) { .chart-grid { grid-template-columns: minmax(0, 1fr); } }
figure.chart { margin: 0; }
.bars { position: relative; height: 180px; border-bottom: 1px solid var(--border-chip); display: flex; align-items: flex-end; gap: 10px; padding: 0 4px;
  background: linear-gradient(to bottom, var(--border) 1px, transparent 1px) 0 0 / 100% 50%; }
.bar { position: relative; flex: 1; height: 100%; display: flex; align-items: flex-end; outline: none; }
.bar-fill { position: relative; display: block; width: 100%; height: 0; background: var(--primary); border-radius: 4px 4px 0 0; transition: height 0.3s; }
.bar:hover .bar-fill, .bar:focus-visible .bar-fill { background: var(--primary-dark); }
.bar .tip { display: none; position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--text); color: var(--on-dark); font-size: 12px; border-radius: 8px; padding: 4px 8px; white-space: nowrap; z-index: 2; }
.bar:hover .tip, .bar:focus-visible .tip { display: block; }
.bar-value { position: absolute; bottom: 100%; inset-inline: 0; margin-bottom: 4px; text-align: center; font-size: 12px; font-weight: 700; color: var(--text); }
.chart-table { min-width: 0; font-size: 13px; }
@media (prefers-reduced-motion: reduce) { .bar-fill { transition: none; } }
.todo-row { min-height: 56px; border-radius: var(--r-control); text-decoration: none; color: var(--text); display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-top: 1px solid var(--divider); }
.todo-row:first-of-type { border-top: none; }
a.todo-row:hover { background: var(--surface-muted); color: var(--text); }
.split { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px; }
.split > .queue { flex: 1 1 260px; min-width: 0; }
.split > .review-detail { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.split.wide-first > form { flex: 1 1 420px; min-width: 0; }
.split.wide-first > .stack { flex: 1 1 340px; min-width: 0; }
.queue { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.queue-item { text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.queue-item[aria-current="true"] { border: 2px solid var(--primary); padding: 11px 13px; }
.facts-grid { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px 16px; font-size: 13px; }
.facts-grid dt { color: var(--text-muted); }
.facts-grid dd { margin: 0; font-weight: 500; }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
figure.doc { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.thumb { height: 130px; border-radius: var(--r-control); background: var(--neutral-soft); border: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--text-muted); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.decide-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.decide-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 520px) { .decide-grid { grid-template-columns: minmax(0, 1fr); } }
.decide { min-height: 56px; border-radius: var(--r-control); border: 1px solid var(--border-chip); background: var(--surface); display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 14px; font-weight: 700; cursor: pointer; }
.decide input { width: 18px; height: 18px; margin: 0; }
.decide.success { color: var(--success); } .decide.success input { accent-color: var(--success); }
.decide.success:has(input:checked) { border: 2px solid var(--success); background: var(--success-soft); }
.decide.accent { color: var(--accent); } .decide.accent input { accent-color: var(--accent); }
.decide.accent:has(input:checked) { border: 2px solid var(--accent); background: var(--accent-soft); }
.decide.danger { color: var(--danger); } .decide.danger input { accent-color: var(--danger); }
.decide.danger:has(input:checked) { border: 2px solid var(--danger); background: var(--danger-soft); }
.decide.info { color: var(--primary-dark); } .decide.info input { accent-color: var(--primary); }
.decide.info:has(input:checked) { border: 2px solid var(--primary); background: var(--primary-soft); }
.decide.warning { color: var(--warning); } .decide.warning input { accent-color: var(--warning); }
.decide.warning:has(input:checked) { border: 2px solid var(--warning); background: var(--warning-soft); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
table.wide { min-width: 900px; }
tr.muted-row { background: var(--surface-muted); }
.cell-name { text-decoration: none; color: var(--text); }
a.cell-name:hover strong { color: var(--primary); }
.filters { align-items: flex-end; }
.filters .select { width: 240px; max-width: 100%; height: var(--touch); }

/* ---------- temporary suspension (approved board 18) ---------- */
.decide.tall { flex-direction: column; gap: 2px; padding: 8px; min-height: 64px; text-align: center; }
.decide.tall small { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.decide.tall .row { gap: 6px; flex-wrap: nowrap; }
.segmented.four { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.seg.days { height: var(--touch); }
.seg.days:has(input:checked) { border: 2px solid var(--primary); background: var(--primary-soft); color: var(--primary-dark); }
.btn.warning-solid { background: var(--warning); color: var(--on-dark); }
.btn.warning-solid:hover { background: #92400E; }

/* ---------- SMS panels, admin password, site texts, ads, sign-up place and terms ---------- */
.credit { font-size: 12px; font-weight: 700; color: var(--text-muted); text-align: center; margin-top: 8px; }
.credit.side { margin-top: 0; }
.sidebar.dark .credit { color: var(--on-dark-muted); }
.link-button.center { align-self: center; display: inline-flex; align-items: center; gap: 6px; }
.input-wrap.tight { border-radius: var(--r-control); border: 1px solid var(--border-input); background: var(--surface); padding-inline-end: 2px; }
.input-wrap.tight:focus-within { border: 1.5px solid var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input.bare, input.bare { border: none; box-shadow: none !important; background: transparent; height: 50px; padding: 0 14px; flex: 1; min-width: 0; font-size: 16px; outline: none; }
.input-wrap.tight svg { position: static; pointer-events: auto; }
.label { font-size: 13px; font-weight: 500; color: var(--text-label); }
.form-grid.two { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.form-grid.tight { gap: 0 12px; }
.date-row { display: grid; grid-template-columns: 72px 1fr 92px; gap: 6px; }
.terms-row { align-items: flex-start; line-height: 1.9; background: var(--surface-muted); border-radius: var(--r-control); padding: 10px 12px; }
.terms-row input { margin-top: 4px; flex-shrink: 0; }
.check-row.boxed { align-items: flex-start; line-height: 1.9; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-control); padding: 10px 12px; }
.check-row.boxed input { margin-top: 4px; flex-shrink: 0; }
.seg-grid { display: grid; gap: 6px; }
.seg-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.seg-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.seg-choice { height: var(--touch); border-radius: var(--r-control); border: 1px solid var(--border-chip); background: var(--surface); color: var(--text-label); display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; cursor: pointer; position: relative; }
.seg-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg-choice:has(input:checked) { border: 2px solid var(--primary); background: var(--primary-soft); color: var(--primary-dark); }
.seg-choice:has(input:focus-visible) { outline: 3px solid var(--primary-line); outline-offset: 2px; }
.seg-choice:has(input:disabled) { cursor: default; opacity: 0.8; }
.note.warning { background: var(--warning-soft); color: #92400E; }
.note.tight { padding: 8px 10px; border-radius: var(--r-small); }
dialog.confirm.wide { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow-y: auto; }
.panel-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.panel-row { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.panel-row .order { width: 36px; height: 36px; border-radius: 10px; background: var(--primary); color: var(--on-dark); display: flex; align-items: center; justify-content: center; font-weight: 800; flex-shrink: 0; }
.panel-row .order.off { background: var(--border); color: var(--text-muted); }
.panel-row .grow { flex: 1 1 280px; min-width: 0; }
.panel-name { font-size: 16px; font-weight: 800; }
.meta-row { gap: 6px 18px; font-size: 13px; color: var(--text-label); }
.row.wrap { flex-wrap: wrap; }
.mono { font-family: ui-monospace, Consolas, monospace; }
.bullets { margin: 0; padding: 0 18px 0 0; font-size: 13px; line-height: 2; color: var(--text-label); }
.split.texts > .text-nav { flex: 1 1 220px; max-width: 280px; padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.split.texts > .stack { flex: 999 1 480px; min-width: 0; }
@media (max-width: 899px) { .split.texts > .text-nav { max-width: none; } }
.text-item { min-height: 56px; border-radius: var(--r-control); padding: 8px 12px; display: flex; flex-direction: column; justify-content: center; gap: 2px; text-decoration: none; color: var(--text); }
.text-item span { font-size: 12px; color: var(--text-muted); }
.text-item[aria-current="page"] { background: var(--primary-soft); }
.text-item[aria-current="page"] strong { color: var(--primary-dark); }
.textarea.tall { min-height: 320px; line-height: 2; padding: 14px; }
.text-view { display: flex; flex-direction: column; gap: 8px; font-size: 14px; line-height: 2; color: var(--text-label); margin: 8px 0; }
.text-view .text-head { font-size: 15px; font-weight: 800; color: var(--primary-dark); margin-top: 6px; }
.text-fold { border: 1px solid var(--border); border-radius: var(--r-control); padding: 0 12px; }
.text-fold summary { min-height: 48px; display: flex; align-items: center; font-weight: 700; color: var(--primary); cursor: pointer; }
.chip-input { min-height: var(--control); border-radius: var(--r-control); border: 1px solid var(--border-input); background: var(--surface); padding: 6px 8px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip-input:focus-within { border: 1.5px solid var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.chip-input input { height: 36px; min-width: 140px; font-size: 14px; }
.chip-x { width: 28px; height: 28px; border: none; background: transparent; color: inherit; cursor: pointer; font-size: 16px; line-height: 1; padding: 0; }
.filter-chip { min-height: 40px; border-radius: 999px; border: 1px solid var(--border-chip); background: var(--surface); color: var(--text-label); padding: 0 14px; display: inline-flex; align-items: center; font-size: 13px; font-weight: 700; text-decoration: none; }
.filter-chip[aria-current="page"] { border: 2px solid var(--primary); background: var(--primary-soft); color: var(--primary-dark); }
nav.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.ads-table td { vertical-align: middle; }
.ads-table td:last-child { min-width: 260px; }
.input.file { height: auto; padding: 10px; font-size: 14px; }
.ad-slot { margin: 0; }
.ad { position: relative; border-radius: var(--r-card); }
.ad-label { font-size: 11px; font-weight: 700; color: var(--neutral); background: var(--neutral-soft); border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.ad-card { background: var(--surface); border: 1px solid var(--border); padding: 14px 16px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.ad-card .grow { flex: 1 1 200px; min-width: 0; }
.ad-icon { width: 48px; height: 48px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ad-banner { overflow: hidden; background: var(--surface); border: 1px solid var(--border); }
.ad-banner > .ad-label { position: absolute; top: 10px; inset-inline-end: 10px; background: rgba(255,255,255,0.92); z-index: 1; }
.ad-img { display: block; width: 100%; height: auto; max-height: 220px; object-fit: cover; }
.ad-banner-link { display: block; }
.ad-banner-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; }
.message-row { display: flex; flex-direction: column; gap: 8px; }
.message-row.unread { border: 2px solid var(--primary-line); }
.message-body { white-space: pre-wrap; font-size: 14px; line-height: 1.9; }
@media (max-width: 899px) {
  /* The admin has many sections: the bottom menu scrolls sideways instead of squeezing ten labels. */
  .bottom-nav.many { grid-auto-columns: 84px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
  .bottom-nav.many::-webkit-scrollbar { display: none; }
  .bottom-nav.many .bottom-link { white-space: nowrap; font-size: 11px; }
}
