/* saraban — e-saraban for Thai local government
   TH Sarabun New (SIPA, GPL + font exception) is the same face used in the generated PDFs (FR-01-42). */
@font-face {
    font-family: "TH Sarabun New";
    src: url("fonts/THSarabunNew.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: "TH Sarabun New";
    src: url("fonts/THSarabunNew-Bold.woff2") format("woff2");
    font-weight: 700;
    font-display: swap;
}

/*
 * Typography
 * TH Sarabun New is small on screen: Thai base glyphs are 0.40 em tall and x-height is 0.34 em, against ~0.54 em
 * for common UI fonts. A 22 px root gives roughly the visual size of 16 px Tahoma. Stacked marks reach 0.83 em
 * above and 0.22 em below the baseline, so body text needs generous leading and headings never go below 1.25.
 * The root is set in % so a user's browser font-size preference still scales the whole page.
 * Smallest text (--text-xs) stays above 16 px (SRS UI-01).
 */
:root {
    --text-xs: 0.8rem;    /* 17.6 px — meta, badges */
    --text-sm: 0.9rem;    /* 19.8 px — secondary text */
    --text-base: 1rem;    /* 22 px — body */
    --text-md: 1.15rem;   /* 25 px — lead, card titles */
    --text-lg: 1.35rem;   /* 30 px — panel titles */
    --text-xl: 1.7rem;    /* 37 px */
    --text-2xl: 2.1rem;   /* 46 px — section titles */
    --text-3xl: 2.7rem;   /* 59 px — page title */

    --leading-tight: 1.25;
    --leading-snug: 1.4;
    --leading-body: 1.6;

    --paper: #f7f5ef;
    --surface: #ffffff;
    --ink: #1a2238;
    --ink-soft: #4d566b;
    --line: #e3dfd3;
    --brand: #1f3a6e;
    --brand-deep: #152a52;
    --brand-tint: #e8eef8;
    --gold: #c9962f;
    --gold-tint: #fbf3e2;
    --ok: #1d7a4c;
    --ok-tint: #e3f4ea;
    --bad: #b3261e;
    --bad-tint: #fbe7e5;
    --muted: #6e7589;
    --muted-tint: #eff0f3;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(26, 34, 56, .06), 0 8px 24px rgba(26, 34, 56, .06);
}

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 137.5%; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: "TH Sarabun New", "Sarabun", "Noto Sans Thai", "Leelawadee UI", Tahoma, sans-serif;
    font-size: var(--text-base);
    line-height: var(--leading-body);
    color: var(--ink);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); }
h1, h2, h3 { line-height: var(--leading-tight); margin: 0; }
p { margin: 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.75em; }

.container { width: 100%; max-width: 1180px; margin-inline: auto; padding-inline: 20px; }

.skip-link { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 6px 12px; border-radius: 8px; z-index: 10; }
.skip-link:focus { left: 8px; }

/* Buttons */
.button {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
    background: var(--brand); color: #fff; text-decoration: none; border: 0; cursor: pointer;
    font: inherit; font-size: var(--text-base); line-height: var(--leading-snug); font-weight: 700;
    padding: 6px 22px; border-radius: 10px;
}
.button:hover, .button:focus-visible { background: var(--brand-deep); }
.button--light { background: #fff; color: var(--brand); }
.button--light:hover, .button--light:focus-visible { background: var(--gold-tint); color: var(--brand-deep); }
.button--ghost { background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, .55); min-height: 40px; padding: 2px 16px; font-size: var(--text-sm); }
.button--ghost:hover, .button--ghost:focus-visible { background: rgba(255, 255, 255, .12); }
.button--block { width: 100%; margin-top: 24px; min-height: 52px; }
.inline-form { margin: 0; }

/* Header */
.site-header { background: var(--brand); color: #fff; border-bottom: 3px solid var(--gold); }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 12px; }
.brand { display: flex; align-items: center; gap: 14px; color: #fff; text-decoration: none; min-width: 0; }
.brand__mark { width: 48px; height: 48px; flex: none; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .25)); }
.brand__text { display: flex; flex-direction: column; min-width: 0; }
.brand__title { font-size: var(--text-lg); font-weight: 700; line-height: var(--leading-tight); }
.brand__subtitle { font-size: var(--text-sm); line-height: var(--leading-snug); opacity: .85; }
.site-header__actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.user-chip { display: flex; flex-direction: column; align-items: flex-end; color: #fff; text-decoration: none; line-height: var(--leading-tight); }
.user-chip__name { font-weight: 700; font-size: var(--text-sm); }
.user-chip__org { font-size: var(--text-xs); opacity: .8; }
.env-badge { flex: none; font-size: var(--text-xs); line-height: var(--leading-snug); padding: 2px 14px; border-radius: 999px; background: var(--gold-tint); color: #7a5412; font-weight: 700; }

.site-nav { background: var(--brand-deep); }
.site-nav__wrap { position: relative; }
.site-nav__inner { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .35) transparent; }
.site-nav__inner::-webkit-scrollbar { height: 4px; }
.site-nav__inner::-webkit-scrollbar-track { background: transparent; }
.site-nav__inner::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .35); border-radius: 999px; }
.site-nav__inner:hover::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .55); }
.site-nav a { display: inline-flex; align-items: center; gap: 7px; color: #dbe4f5; text-decoration: none; font-size: var(--text-base); line-height: var(--leading-snug); padding: 8px 14px; white-space: nowrap; border-bottom: 2px solid transparent; }
.site-nav a:hover, .site-nav a:focus-visible { color: #fff; border-bottom-color: var(--gold); }
/* Shown only while that side really has more menu hidden behind it. The fade tells the eye that the row is cut off. */
.site-nav__arrow {
    position: absolute; top: 0; bottom: 4px; width: 38px; display: flex; align-items: center; justify-content: center;
    border: 0; padding: 0; cursor: pointer; color: #fff; background: var(--brand-deep);
}
.site-nav__arrow[hidden] { display: none; }
.site-nav__arrow .icon { width: 20px; height: 20px; stroke-width: 2; }
.site-nav__arrow--start { left: 0; background: linear-gradient(90deg, var(--brand-deep) 65%, rgba(21, 42, 82, 0)); justify-content: flex-start; padding-left: 4px; }
.site-nav__arrow--end { right: 0; background: linear-gradient(270deg, var(--brand-deep) 65%, rgba(21, 42, 82, 0)); justify-content: flex-end; padding-right: 4px; }
.site-nav__arrow:hover, .site-nav__arrow:focus-visible { color: var(--gold); }

/* Icons — inline SVG, no icon font or CDN (the system must work inside a closed network) */
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.bell .icon { width: 20px; height: 20px; }

.site-main { flex: 1; }

/* Sections */
.section { padding-block: 48px; }
.section + .section { padding-top: 8px; }
.section__head { margin-bottom: 24px; }
.section__eyebrow { color: #9a6f1c; font-weight: 700; font-size: var(--text-sm); line-height: var(--leading-snug); letter-spacing: .02em; }
.section__title { font-size: var(--text-2xl); }
.section__lead { color: var(--ink-soft); font-size: var(--text-md); line-height: var(--leading-body); margin-top: 6px; max-width: 58ch; }

/* Hero */
.hero { padding-block: 52px 40px; background: linear-gradient(180deg, var(--brand-tint), var(--paper)); }
.hero__grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 36px; align-items: center; }
.hero__title { font-size: var(--text-3xl); font-weight: 700; color: var(--brand-deep); }
.hero__title em { font-style: normal; color: var(--gold); }
.hero__text { font-size: var(--text-md); line-height: var(--leading-body); color: var(--ink-soft); margin: 16px 0 22px; max-width: 48ch; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; list-style: none; }
.chip { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 2px 14px; font-size: var(--text-sm); line-height: var(--leading-snug); }

.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.fact { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 20px; border-top: 3px solid var(--brand); }
.fact:nth-child(2) { border-top-color: var(--gold); }
.fact:nth-child(3) { border-top-color: var(--ok); }
.fact:nth-child(4) { border-top-color: #6b4fa0; }
.fact__value { font-size: var(--text-2xl); font-weight: 700; line-height: 1.1; color: var(--brand-deep); }
.fact__label { color: var(--ink-soft); font-size: var(--text-sm); line-height: var(--leading-snug); margin-top: 4px; }

/* Animated document flow */
.flow-anim { padding-top: 12px; }
.flow-anim__head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.flow-anim__stage { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 8px 4px; overflow-x: auto; }
.flow-anim__svg { display: block; width: 100%; min-width: 860px; height: auto; font-family: "TH Sarabun New", "Sarabun", "Noto Sans Thai", sans-serif; }
.flow-anim__label { font-size: 26px; font-weight: 700; fill: var(--ink); }
.flow-anim__who { font-size: 18px; fill: var(--muted); }
.flow-anim__num-bg { fill: #c9962f; stroke: #fff; stroke-width: 3; }
.flow-anim__num { font-size: 17px; font-weight: 700; fill: #fff; }
.flow-anim__caption-title { font-size: 26px; font-weight: 700; fill: var(--brand-deep); }
.flow-anim__caption-text { font-size: 22px; fill: var(--ink-soft); }
/* The animation is the point of the panel; its pause control stays out of the way. */
.flow-anim__toggle { min-height: 34px; width: 34px; padding: 0; border-radius: 50%; flex: none; }
.flow-anim__toggle .icon { width: 18px; height: 18px; }
.flow-anim__dash { animation: flow-dash 1.6s linear infinite; }
@keyframes flow-dash { to { stroke-dashoffset: -32; } }
.flow-anim__list { margin: 18px 0 0; padding-left: 1.3em; color: var(--ink-soft); font-size: var(--text-sm); line-height: 1.6; columns: 2; column-gap: 32px; }
.flow-anim__list li { break-inside: avoid; margin-bottom: 6px; }
@media (max-width: 820px) { .flow-anim__list { columns: 1; } }
@media (prefers-reduced-motion: reduce) {
    .flow-anim__dash { animation: none; }
    .flow-anim__token { display: none; }
}

/* Lifecycle */
.flow { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
.flow__step { position: relative; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 16px 16px; display: flex; flex-direction: column; gap: 8px; }
.flow__step:not(:last-child)::after {
    content: ""; position: absolute; top: 38px; right: -12px; width: 10px; height: 10px;
    border-top: 3px solid var(--gold); border-right: 3px solid var(--gold); transform: rotate(45deg);
}
.flow__icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-tint); color: var(--brand); }
.flow__icon svg { width: 26px; height: 26px; }
.flow__name { font-size: var(--text-lg); font-weight: 700; line-height: var(--leading-tight); }
.flow__desc { color: var(--ink-soft); font-size: var(--text-sm); line-height: 1.5; flex: 1; }
.flow__ref { white-space: nowrap; align-self: flex-start; font-size: var(--text-xs); line-height: var(--leading-snug); background: var(--gold-tint); color: #7a5412; border-radius: 6px; padding: 1px 8px; }
.flow-note { margin-top: 18px; padding: 14px 20px; border-left: 4px solid var(--brand); background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; line-height: var(--leading-body); }

/* Registers */
.registers { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.register { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start; }
.register__no { flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: var(--text-sm); line-height: 1; }
.register__name { font-weight: 700; font-size: var(--text-md); line-height: var(--leading-snug); }
.register__form { color: var(--muted); font-size: var(--text-sm); line-height: var(--leading-snug); }

/* Service status — the operator page at /system-status; not shown to the public */
.panel { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.panel__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.panel__title { font-size: var(--text-lg); }
.panel__meta { color: var(--muted); font-size: var(--text-sm); line-height: var(--leading-snug); text-align: right; }
.services { list-style: none; margin: 0; padding: 0; }
.service { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--line); line-height: var(--leading-snug); }
.service:last-child { border-bottom: 0; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 4px var(--muted-tint); }
.dot--up { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-tint); }
.dot--down { background: var(--bad); box-shadow: 0 0 0 4px var(--bad-tint); }
.service__name { font-weight: 700; font-size: var(--text-base); }
.service__purpose { color: var(--ink-soft); font-size: var(--text-sm); }
.service__detail { grid-column: 2 / 4; color: var(--muted); font-size: var(--text-xs); overflow-wrap: anywhere; }
.state { font-size: var(--text-xs); line-height: var(--leading-snug); font-weight: 700; border-radius: 999px; padding: 1px 10px; white-space: nowrap; }
.state--up { background: var(--ok-tint); color: var(--ok); }
.state--down { background: var(--bad-tint); color: var(--bad); }
.state--unconfigured { background: var(--muted-tint); color: var(--muted); }

/* The regulations and laws the system follows, on the public home page */
.standards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 16px; }
.standard { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 20px; }
.standard__name { font-weight: 700; font-size: var(--text-md); line-height: var(--leading-snug); }
.standard__what { color: var(--ink-soft); font-size: var(--text-sm); line-height: 1.5; margin-top: 4px; }

.hero__actions { margin-top: 26px; }

/* Sign-in */
.auth { padding-block: 56px 64px; background: linear-gradient(180deg, var(--brand-tint), var(--paper)); }
.auth__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 460px); gap: 48px; align-items: center; }
.auth__intro h1 { font-size: var(--text-2xl); color: var(--brand-deep); margin-top: 4px; }
.auth__intro p { font-size: var(--text-md); color: var(--ink-soft); margin-top: 12px; max-width: 44ch; }
.auth__points { margin: 20px 0 0; padding-left: 1.2em; color: var(--ink-soft); font-size: var(--text-sm); line-height: var(--leading-body); }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px 30px 26px; }
.form-title { font-size: var(--text-xl); }
.field { display: flex; flex-direction: column; gap: 4px; margin-top: 18px; }
.field label { font-weight: 700; font-size: var(--text-sm); line-height: var(--leading-snug); }
.field input {
    font: inherit; font-size: var(--text-base); line-height: 1.4; color: var(--ink); background: #fff;
    min-height: 50px; padding: 6px 14px; border: 1px solid #cdc7b6; border-radius: 10px;
}
.field input:focus { border-color: var(--brand); outline: 3px solid rgba(31, 58, 110, .2); outline-offset: 0; }
.field__hint { font-size: var(--text-xs); color: var(--muted); line-height: var(--leading-snug); }
.alert { margin-top: 16px; padding: 10px 14px; border-radius: 10px; background: var(--bad-tint); color: var(--bad); border: 1px solid #f0c4bf; font-size: var(--text-sm); line-height: 1.5; }
.form-note { margin-top: 16px; font-size: var(--text-xs); color: var(--muted); line-height: 1.5; }

/* Workspace */
.workspace-head { padding-block: 40px 8px; background: linear-gradient(180deg, var(--brand-tint), var(--paper)); }
.workspace-head h1 { font-size: var(--text-2xl); color: var(--brand-deep); margin-top: 2px; }
.workspace-head__meta { color: var(--ink-soft); margin-top: 8px; }
.workspace-head__positions { margin-top: 12px; }
.section--compact { padding-block: 24px 48px; }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.stat { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; border-top: 3px solid var(--gold); grid-column: 1 / -1; }
.stat__value { font-size: var(--text-3xl); font-weight: 700; line-height: 1.05; color: var(--brand-deep); }
.stat__label { font-size: var(--text-md); font-weight: 700; line-height: var(--leading-snug); margin-top: 4px; }
.stat__note { font-size: var(--text-sm); color: var(--muted); margin-top: 2px; }

/* Page chrome for app pages */
.page-head { padding-block: 32px 12px; background: linear-gradient(180deg, var(--brand-tint), var(--paper)); }
.page-head__inner { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.page-head__title { font-size: var(--text-2xl); color: var(--brand-deep); margin-top: 2px; }
.page-head__lead { color: var(--ink-soft); margin-top: 6px; max-width: 64ch; }
.page-head__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.button--secondary { background: var(--surface); color: var(--brand); border: 1px solid #c9d3e6; }
.button--secondary:hover, .button--secondary:focus-visible { background: var(--brand-tint); color: var(--brand-deep); }
.button--danger { background: var(--bad); }
.button--danger:hover, .button--danger:focus-visible { background: #8f1d17; }
.flash { margin-top: 16px; padding: 10px 16px; border-radius: 10px; font-size: var(--text-sm); line-height: 1.5; border: 1px solid; }
.flash--success { background: var(--ok-tint); color: #145c38; border-color: #b9e0c9; }
.flash--error { background: var(--bad-tint); color: var(--bad); border-color: #f0c4bf; }
.list-meta { color: var(--muted); font-size: var(--text-sm); margin: 12px 0; }
.empty { background: var(--surface); border: 1px dashed #cfc9b8; border-radius: var(--radius); padding: 28px; text-align: center; color: var(--ink-soft); }
.empty strong { display: block; font-size: var(--text-md); color: var(--ink); }

/* Badges */
.badge { display: inline-block; font-size: var(--text-xs); font-weight: 700; line-height: 1.35; padding: 0 10px; border-radius: 999px; vertical-align: middle; white-space: nowrap; }
.badge--urgent { background: #fff1d6; color: #8a5a00; }
.badge--very_urgent { background: #ffe0cc; color: #9a3d00; }
.badge--most_urgent { background: var(--bad); color: #fff; }
.badge--cancelled { background: var(--muted-tint); color: var(--muted); }

/* Forms */
.input { font: inherit; font-size: var(--text-base); line-height: 1.4; color: var(--ink); background: #fff; width: 100%; min-height: 48px; padding: 6px 12px; border: 1px solid #cdc7b6; border-radius: 10px; }
textarea.input { min-height: 0; resize: vertical; }
select.input { padding-right: 32px; }
.input:focus { border-color: var(--brand); outline: 3px solid rgba(31, 58, 110, .2); outline-offset: 0; }
.field__label { font-weight: 700; font-size: var(--text-sm); line-height: var(--leading-snug); }
.field--error .input { border-color: var(--bad); }
.field__error { color: var(--bad); font-size: var(--text-xs); line-height: var(--leading-snug); }
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 360px); gap: 20px; align-items: start; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.form-grid__wide { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }
.form-aside .facts-list, .facts-list--padded { padding: 12px 20px 16px; }
.toolbar { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 18px; }
.field--inline { margin-top: 0; }
.field--grow { flex: 1 1 280px; }
.steps { margin: 0; padding: 12px 20px 16px 44px; font-size: var(--text-sm); line-height: 1.5; color: var(--ink-soft); }
.steps li + li { margin-top: 6px; }
.mail-body { margin: 0 20px 18px; padding: 12px 14px; background: var(--paper); border-radius: 10px; font-size: var(--text-sm); line-height: 1.5; max-height: 320px; overflow: auto; }

/* Definition lists */
.facts-list { margin: 0; }
.facts-list dt { font-size: var(--text-xs); color: var(--muted); font-weight: 700; margin-top: 10px; line-height: var(--leading-snug); }
.facts-list dt:first-child { margin-top: 0; }
.facts-list dd { margin: 0; line-height: 1.5; overflow-wrap: anywhere; }
.facts-list--grid { display: grid; grid-template-columns: minmax(0, 11rem) minmax(0, 1fr); gap: 8px 16px; }
.facts-list--grid dt { margin-top: 0; padding-top: 3px; }
.card__title { font-size: var(--text-lg); margin-bottom: 14px; }
details > summary.card__title { cursor: pointer; margin-bottom: 4px; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 380px); gap: 20px; align-items: start; }
.stack { display: grid; gap: 20px; }

/* Intake */
.intake-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.intake-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 20px; align-items: start; }
.intake-item__subject { font-size: var(--text-md); line-height: var(--leading-snug); margin-top: 4px; }
.intake-item__meta { color: var(--muted); font-size: var(--text-sm); margin-top: 4px; }
.intake-item__hint { font-size: var(--text-sm); margin-top: 4px; }
.intake-item__actions { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; min-width: 220px; }
.dismiss summary { cursor: pointer; color: var(--bad); font-size: var(--text-sm); text-align: right; }
.dismiss__form { display: grid; gap: 8px; margin-top: 8px; width: min(320px, 70vw); }
.danger-zone summary { cursor: pointer; color: var(--bad); list-style: none; }
.danger-zone__form { display: grid; gap: 8px; padding: 0 20px 18px; }

/* Tabs */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs__item { padding: 4px 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--ink-soft); font-size: var(--text-sm); }
.tabs__item.is-active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }

/* Forwarding */
.forward-form { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.checks { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.checks legend { margin-bottom: 6px; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; font-size: var(--text-sm); cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }
.table-wrap--flat { box-shadow: none; border: 1px solid var(--line); }

/* Administration */
.chip--small { font-size: var(--text-xs); padding: 0 10px; margin: 0 4px 4px 0; display: inline-block; }
.unit-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.unit-row .input { flex: 1 1 240px; }
.workspace-head__links { margin-top: 6px; font-size: var(--text-sm); }

/* MFA */
.mfa-qr { display: block; width: 220px; height: 220px; margin: 8px 0 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.mfa-secret { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; letter-spacing: .08em; background: var(--paper); padding: 8px 12px; border-radius: 8px; overflow-wrap: anywhere; }
.input--code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.2rem; letter-spacing: .25em; max-width: 14ch; }
.recovery-codes { columns: 2; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; line-height: 1.9; padding-left: 1.6em; }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); line-height: 1.45; }
.table th { text-align: left; font-size: var(--text-xs); color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 2px solid var(--line); white-space: nowrap; background: #fbfaf6; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-weight: 700; white-space: nowrap; }
.table .nowrap { white-space: nowrap; }
.table tr.is-cancelled td { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(110, 117, 137, .5); }
.table tr.is-cancelled td .badge { text-decoration: none; }
.register-table { min-width: 1100px; }
.pager { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 16px; }
.pager a, .pager__current { min-width: 40px; text-align: center; padding: 2px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; }
.pager__current { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 12px 20px 16px; }
.timeline__item { position: relative; padding: 0 0 12px 18px; border-left: 2px solid var(--line); line-height: 1.45; }
.timeline__item::before { content: ""; position: absolute; left: -6px; top: 8px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__meta, .timeline__reason { display: block; color: var(--muted); font-size: var(--text-xs); }
.timeline__changes { margin: 4px 0 0; padding-left: 18px; font-size: var(--text-xs); color: var(--ink-soft); }

/* Print (แบบที่ ๑๓) */
.print-sheet { padding-block: 24px; }
.print-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.print-title { text-align: center; font-size: var(--text-xl); }
.print-subtitle { text-align: center; color: var(--ink-soft); margin-bottom: 14px; }
.print-table { width: 100%; border-collapse: collapse; background: #fff; font-size: var(--text-sm); line-height: 1.3; }
.print-table th, .print-table td { border: 1px solid #333; padding: 4px 6px; vertical-align: top; }
.print-table th { font-weight: 700; text-align: center; }
.print-table .num { text-align: center; }
.print-empty { text-align: center; color: var(--muted); padding: 24px; }
/* Cover sheets of classified letters (M10) */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.card__head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.card__meta { color: var(--ink-soft); font-size: var(--text-sm); line-height: var(--leading-snug); margin: 6px 0 0; }
.card__actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.field--wide { grid-column: 1 / -1; }
.muted { color: var(--muted); }

@media print {
    .icon, .icon-sprite, .site-nav__arrow { display: none; }
    @page { size: A4 landscape; margin: 1.2cm; }
    html { font-size: 11pt; }
    body { background: #fff; }
    .site-header, .site-footer, .skip-link, .no-print { display: none !important; }
    .container { max-width: none; padding-inline: 0; }
    .print-sheet { padding-block: 0; }
    .print-table { font-size: 14pt; }
    .print-table thead { display: table-header-group; }
    .print-table tr { page-break-inside: avoid; }
}

/* Footer */
.site-footer { background: var(--brand-deep); color: #c8d3ea; margin-top: 40px; }
.site-footer__inner { display: flex; justify-content: space-between; gap: 24px; padding-block: 24px; flex-wrap: wrap; }
.site-footer strong { color: #fff; font-size: var(--text-md); line-height: var(--leading-snug); }
.site-footer p { margin-top: 4px; font-size: var(--text-sm); line-height: 1.5; max-width: 68ch; }
.site-footer__meta { display: flex; flex-direction: column; align-items: flex-end; font-size: var(--text-sm); line-height: var(--leading-snug); }

/* Error page */
.error-page { padding-block: 72px; text-align: center; }
.error-page__code { font-size: 5rem; font-weight: 700; color: var(--brand); line-height: 1; }
.error-page__title { font-size: var(--text-2xl); margin: 12px 0; }
.error-page p { color: var(--ink-soft); margin: 6px auto; max-width: 52ch; }
.error-page .button { margin-top: 20px; }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

@media (max-width: 1080px) {
    .flow { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .flow__step:nth-child(3n)::after { display: none; }
    .registers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
    .hero__grid, .auth__grid, .workspace-grid, .form-layout, .detail-layout { grid-template-columns: minmax(0, 1fr); }
    .form-grid, .facts-list--grid { grid-template-columns: minmax(0, 1fr); }
    .intake-item { grid-template-columns: minmax(0, 1fr); }
    .intake-item__actions { align-items: flex-start; }
    .dismiss summary { text-align: left; }
    .auth { padding-block: 32px 48px; }
    .hero__title { font-size: var(--text-2xl); }
}
@media (max-width: 560px) {
    html { font-size: 125%; } /* 20 px root on phones */
    .flow { grid-template-columns: minmax(0, 1fr); }
    .flow__step::after { display: none; }
    .registers { grid-template-columns: minmax(0, 1fr); }
    .brand__subtitle, .user-chip__org { display: none; }
    .card { padding: 22px 18px; }
    .section__title { font-size: var(--text-xl); }
    .site-footer__meta { align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}

/* ---- M02 เสนอและเกษียน ---- */
.thread { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.thread__item { border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 10px; padding: .75rem 1rem; background: var(--surface); }
.thread__item--propose, .thread__item--forward { border-left-color: var(--gold); }
.thread__item--return, .thread__item--recall { border-left-color: var(--bad); }
.thread__item--approve, .thread__item--acknowledge { border-left-color: var(--ok); }
.thread__head { display: flex; flex-wrap: wrap; gap: .25rem .75rem; align-items: baseline; font-size: var(--text-sm); line-height: var(--leading-snug); color: var(--ink-soft); }
.thread__kind { font-weight: 700; color: var(--ink); }
.thread__time { margin-left: auto; }
.thread__body { margin: .4rem 0 0; line-height: var(--leading-body); white-space: normal; }
.thread__sign { display: flex; flex-direction: column; align-items: flex-end; margin-top: .5rem; font-size: var(--text-sm); line-height: var(--leading-snug); text-align: right; }
.thread__name { font-weight: 600; }
.thread__title { color: var(--ink-soft); }
.routing-status, .case-status { margin: 1rem 0 .5rem; line-height: var(--leading-snug); }
.desk-group { display: flex; align-items: center; gap: .5rem; margin: 1.5rem 0 .75rem; font-size: var(--text-lg); line-height: var(--leading-tight); }
.desk-group__count { min-width: 1.8em; padding: 0 .5em; border-radius: 999px; background: var(--brand-tint); color: var(--brand); font-size: var(--text-sm); text-align: center; }
.decision__body { display: grid; gap: 1rem; padding: 1rem 1.25rem 1.25rem; margin: 0; }
.decision__forward { border: 1px dashed var(--line); border-radius: 10px; padding: .75rem; margin: 0; display: grid; gap: .5rem; }
.badge--ok { background: var(--ok-tint); color: var(--ok); }
.file-list { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .5rem; }
.file-list__item { display: flex; flex-wrap: wrap; gap: .25rem .75rem; align-items: baseline; padding: .5rem .75rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.file-list__name { font-weight: 600; overflow-wrap: anywhere; }
.file-list__meta { font-size: var(--text-sm); line-height: var(--leading-snug); color: var(--ink-soft); }
.stamp-permanent { color: var(--bad); }
.stamp-keep { color: var(--brand); }
.tiles { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.tile { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.tile a { display: block; padding: .9rem 1rem; text-decoration: none; color: inherit; }
.tile--alert { border-color: var(--bad); }
.tile__value { display: block; font-size: var(--text-2xl); line-height: var(--leading-tight); font-weight: 700; color: var(--brand); }
.tile--alert .tile__value { color: var(--bad); }
.tile__label { display: block; font-weight: 600; }
.tile__note { display: block; font-size: var(--text-sm); line-height: var(--leading-snug); color: var(--ink-soft); }
.bar { display: block; height: 8px; border-radius: 4px; background: var(--brand); min-width: 2px; margin-bottom: 3px; }
.bar--out { background: var(--gold); }
.bell { display: inline-flex; align-items: center; gap: .35rem; padding: 6px 10px; border-radius: 999px; background: rgba(255, 255, 255, .12); color: inherit; text-decoration: none; font-size: var(--text-sm); }
.bell__count { min-width: 1.6em; padding: 0 .4em; border-radius: 999px; background: var(--gold); color: #1a2238; font-weight: 700; text-align: center; }

