/* COE Requests. Concept: an HR document desk. The page is a calm desk surface; the certificate itself
   (a sheet of paper, set in a book serif) is the one object with depth and character.
   Fonts are self-hosted (the CSP blocks font CDNs): Public Sans for the interface, Source Serif 4 for paper. Both OFL. */

@font-face { font-family: "Public Sans"; src: url("fonts/public-sans-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Public Sans"; src: url("fonts/public-sans-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Public Sans"; src: url("fonts/public-sans-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Public Sans"; src: url("fonts/public-sans-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Source Serif 4"; src: url("fonts/source-serif-4-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Source Serif 4"; src: url("fonts/source-serif-4-latin-600-normal.woff2") format("woff2"); font-weight: 600 700; font-display: swap; }

:root {
  --desk: #eef1f5;
  --paper: #ffffff;
  --ink: #1b2a4a;
  --ink-soft: #56627a;
  --line: #d8dee8;
  --line-soft: #e8ecf2;
  --brand: #1e6fc6;
  --brand-deep: #154f91;
  --brand-wash: #e7f0fa;
  --seal: #0f7b6c;
  --seal-wash: #e2f3f0;
  --amber: #a86a12;
  --amber-wash: #fdf3e1;
  --red: #b42318;
  --red-wash: #fdecea;

  --sans: "Public Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --serif: "Source Serif 4", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;

  --r-control: 8px;
  --r-panel: 12px;
  --r-paper: 3px;
  --paper-shadow: 0 1px 1px rgba(27, 42, 74, .06), 0 6px 14px -4px rgba(27, 42, 74, .14), 0 22px 40px -18px rgba(27, 42, 74, .22);
  --focus: 0 0 0 3px #fff, 0 0 0 5px var(--brand);

  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--desk);
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
[hidden] { display: none !important; }
a { color: var(--brand); text-underline-offset: 2px; }
a:hover { color: var(--brand-deep); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -.015em; }
h2 { font-size: 1.08rem; font-weight: 600; margin-bottom: .8rem; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0 0 .7rem; }
strong, b { font-weight: 600; }
code { font-family: var(--mono); font-size: .86em; background: var(--desk); padding: .08rem .35rem; border-radius: 4px; }
kbd { font-family: var(--mono); font-size: .75rem; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 .35rem; color: var(--ink-soft); background: #fff; }
.soft { color: var(--ink-soft); }
.small { font-size: .86rem; }
.center { text-align: center; }
.right { text-align: right; }
.block-sm { display: block; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: #fff; padding: .5rem 1rem; z-index: 50; }
.skip:focus { left: 1rem; top: .5rem; }
.okText { color: var(--seal); }
.warnText { color: var(--amber); }

.ico { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Frame ---------- */
.wrap { width: 100%; max-width: 1160px; margin: 0 auto; padding: 1.75rem 1.5rem 2.5rem; flex: 1; }
.bar { background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 20; }
.bar-inner { max-width: 1160px; margin: 0 auto; padding: 0 1.5rem; height: 58px; display: flex; align-items: center; gap: 2rem; }
.brand { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; font-weight: 600; white-space: nowrap; }
.brand:hover { color: #fff; }
.brand-mark { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 7px; background: var(--brand); }
.brand-mark .ico { width: 18px; height: 18px; }
.nav { display: flex; gap: .25rem; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav a { color: #c9d3e4; text-decoration: none; padding: .45rem .8rem; border-radius: 7px; font-weight: 500; white-space: nowrap; display: inline-flex; align-items: center; gap: .45rem; }
.nav a:hover { color: #fff; background: rgba(255, 255, 255, .07); }
.nav a[aria-current] { color: #fff; background: rgba(255, 255, 255, .12); }
.count { display: inline-grid; place-items: center; min-width: 1.35rem; height: 1.35rem; padding: 0 .35rem; border-radius: 999px; background: #f2b33d; color: var(--ink); font-size: .74rem; font-weight: 700; }
.count.hot { background: var(--amber); color: #fff; }
.me { position: relative; margin-left: auto; }
.me summary { list-style: none; display: flex; align-items: center; gap: .55rem; cursor: pointer; padding: .3rem .4rem; border-radius: 8px; color: #dbe3f0; }
.me summary::-webkit-details-marker { display: none; }
.me summary:hover { background: rgba(255, 255, 255, .07); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: #3a4c72; color: #fff; font-weight: 600; font-size: .82rem; }
.me-menu { position: absolute; right: 0; top: calc(100% + 8px); width: 260px; background: #fff; color: var(--ink); border-radius: 10px; border: 1px solid var(--line); box-shadow: 0 14px 30px -12px rgba(27, 42, 74, .35); padding: 1rem; display: flex; flex-direction: column; gap: .4rem; }
.me-menu p { margin: 0 0 .3rem; }
.linkish { background: none; border: 0; padding: 0; color: var(--red); font: inherit; cursor: pointer; }
.foot { border-top: 1px solid var(--line); }
.foot-inner { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-top: 1rem; padding-bottom: 1.2rem; font-size: .84rem; color: var(--ink-soft); flex: none; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; top: 70px; right: 1.25rem; z-index: 40; display: flex; flex-direction: column; gap: .6rem; width: min(420px, calc(100vw - 2.5rem)); }
.toast { display: flex; gap: .7rem; align-items: flex-start; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--seal); border-radius: 10px; padding: .8rem .9rem; box-shadow: 0 16px 30px -14px rgba(27, 42, 74, .4); animation: toast-in .28s ease-out; }
.toast > .ico { color: var(--seal); margin-top: .15rem; }
.toast.t-warn { border-left-color: var(--amber); } .toast.t-warn > .ico { color: var(--amber); }
.toast.t-error { border-left-color: var(--red); } .toast.t-error > .ico { color: var(--red); }
.toast-body { flex: 1; }
.toast-body p { margin: 0; font-weight: 500; }
.toast-body ul { margin: .35rem 0 0; padding-left: 1.1rem; font-size: .88rem; color: var(--ink-soft); }
.toast-x { background: none; border: 0; color: var(--ink-soft); cursor: pointer; padding: .1rem; border-radius: 4px; }
.toast.leaving { opacity: 0; transform: translateX(12px); transition: .25s ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

/* ---------- Surfaces ---------- */
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--r-panel); padding: 1.35rem 1.5rem; margin-bottom: 1.5rem; }
.panel.flush { padding: 0; overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .9rem; }
.panel-head h2 { margin: 0; }
.panel-head.padded { padding: 1.1rem 1.5rem 0; }
.pagehead { margin-bottom: 1.4rem; }
.pagehead h1 + p { margin: .35rem 0 0; max-width: 70ch; }
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.back { display: inline-flex; gap: .4rem; align-items: center; text-decoration: none; font-weight: 500; font-size: .92rem; margin-bottom: .8rem; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: start; margin-bottom: 1.5rem; }
.split.wide-left { grid-template-columns: 1.55fr 1fr; }
.split > .panel, .stackgap > .panel { margin-bottom: 0; }
.stackgap { display: flex; flex-direction: column; gap: 1.5rem; }
.note { background: var(--brand-wash); border-radius: var(--r-control); padding: .7rem .9rem; color: var(--brand-deep); }
.note.warn { background: var(--amber-wash); color: var(--amber); }

/* ---------- Controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: .55rem 1rem; border-radius: var(--r-control); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1.3; transition: background .15s, border-color .15s; }
.btn:hover { border-color: #b7c3d6; background: #f8fafc; color: var(--ink); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-deep); border-color: var(--brand-deep); color: #fff; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); border-color: #efc5c0; }
.btn.danger:hover { background: var(--red-wash); }
.btn.ghost.danger { border-color: transparent; }
.btn.small { padding: .3rem .65rem; font-size: .86rem; }
.btn.big { padding: .75rem 1.3rem; font-size: 1rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.is-busy { cursor: progress; opacity: .75; }
.btn.is-done { color: var(--seal); border-color: #b6e0d8; }
.btnrow { display: flex; gap: .6rem; flex-wrap: wrap; }

form { margin: 0; }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: .35rem; border: 0; margin: 0; padding: 0; min-width: 0; }
.field > span:first-child, .field > legend { font-weight: 600; font-size: .9rem; padding: 0; }
.field > legend { margin-bottom: .45rem; }
.narrowfield { max-width: 260px; }
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1px solid #c9d2df; border-radius: var(--r-control); padding: .55rem .7rem; width: 100%; transition: border-color .15s, box-shadow .15s; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(30, 111, 198, .18); }
input:disabled, textarea:disabled { background: #f6f8fb; color: var(--ink-soft); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--brand); }
textarea.mono { font-family: var(--mono); font-size: .86rem; line-height: 1.6; }
.check { display: flex; align-items: center; gap: .55rem; cursor: pointer; }
.counter { align-self: flex-end; font-size: .76rem; color: var(--ink-soft); margin-top: -.15rem; }
.counter.near { color: var(--amber); }

.toggle { display: flex; align-items: center; gap: .8rem; cursor: pointer; padding: .8rem 1rem; background: var(--desk); border-radius: var(--r-control); position: relative; }
.toggle input { position: absolute; opacity: 0; }
.toggle-ui { width: 40px; height: 22px; border-radius: 999px; background: #b9c3d3; position: relative; flex: none; transition: background .15s; }
.toggle-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.toggle input:checked + .toggle-ui { background: var(--seal); }
.toggle input:checked + .toggle-ui::after { transform: translateX(18px); }
.toggle input:focus-visible + .toggle-ui { box-shadow: var(--focus); }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.pchip { position: relative; cursor: pointer; }
.pchip input { position: absolute; opacity: 0; inset: 0; }
.pchip span, .pchip.static { display: inline-block; padding: .45rem .9rem; border: 1px solid #c9d2df; border-radius: 999px; background: #fff; font-size: .92rem; transition: .15s; }
.pchip:hover span { border-color: var(--brand); }
.pchip input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.pchip input:focus-visible + span { box-shadow: var(--focus); }
.pchip.static { font-size: .84rem; padding: .25rem .7rem; color: var(--ink-soft); }
.preview-chips:empty { display: none; }
.pchip-btn { border: 1px dashed #c4cddb; background: #fff; border-radius: 8px; padding: .4rem .6rem; font: inherit; font-size: .82rem; text-align: left; cursor: pointer; color: var(--ink-soft); }
.pchip-btn:hover { border-color: var(--brand); color: var(--ink); }
.small-chips { gap: .4rem; }
.chip { display: inline-block; font-size: .74rem; font-weight: 600; padding: .1rem .5rem; border-radius: 999px; background: var(--desk); color: var(--ink-soft); white-space: nowrap; }
.chip.warm { background: var(--amber-wash); color: var(--amber); }

/* choice cards */
.choices { display: grid; gap: .7rem; }
.choice { display: flex; gap: .8rem; align-items: flex-start; padding: .95rem 1rem; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; transition: border-color .15s, background .15s; }
.choice:hover { border-color: #a9bad3; }
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-wash); }
.choice:has(input:focus-visible) { box-shadow: var(--focus); }
.choice input { margin-top: .25rem; }
.choice.is-off { cursor: not-allowed; background: #f7f9fb; }
.choice.is-off .choice-title { color: var(--ink-soft); }
.choice-body { display: flex; flex-direction: column; gap: .2rem; }
.choice-title { font-weight: 600; }
.choice-desc { color: var(--ink-soft); font-size: .9rem; }
.choice-meta { display: flex; gap: .4rem; margin-top: .25rem; }
.choice-why { color: var(--amber); font-size: .86rem; }

/* badges */
.badge { display: inline-flex; align-items: center; gap: .35rem; font-size: .78rem; font-weight: 600; padding: .2rem .65rem; border-radius: 999px; white-space: nowrap; background: var(--desk); color: var(--ink-soft); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-pending_approval, .st-generating { background: var(--brand-wash); color: var(--brand-deep); }
.st-flagged, .st-failed { background: var(--amber-wash); color: var(--amber); }
.st-ready { background: var(--seal-wash); color: var(--seal); }
.st-rejected { background: var(--red-wash); color: var(--red); }
.emp-active { background: var(--seal-wash); color: var(--seal); }
.emp-on_leave, .emp-suspended { background: var(--amber-wash); color: var(--amber); }

/* ---------- Tables, tabs, search ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th { text-align: left; font-weight: 600; font-size: .82rem; color: var(--ink-soft); background: #f7f9fc; padding: .65rem 1rem; border-bottom: 1px solid var(--line); }
.table td { padding: .8rem 1rem; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr[data-href] { cursor: pointer; }
.table tr[data-href]:hover td { background: #f8fbff; }
.rowlink { color: var(--ink); text-decoration: none; }
.row-flag td:first-child { box-shadow: inset 3px 0 0 var(--amber); }
.row-fail td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.row-overdue td { background: #fffaf0; }
.notes { margin: .4rem 0 0; padding-left: 1.1rem; }

.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--line); margin-bottom: 1.25rem; overflow-x: auto; }
.tabs a { padding: .6rem .9rem; color: var(--ink-soft); text-decoration: none; font-weight: 600; font-size: .93rem; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; align-items: center; gap: .45rem; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current] { color: var(--brand-deep); border-bottom-color: var(--brand); }

.searchbar { display: flex; align-items: center; gap: .5rem; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .25rem .5rem .25rem .8rem; margin-bottom: 1rem; }
.searchbar:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(30, 111, 198, .15); }
.searchbar input { border: 0; padding: .5rem .2rem; box-shadow: none !important; }
.search-ico { color: var(--ink-soft); display: flex; }
.hint-key { margin-right: .3rem; }
.filterbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .8rem; font-size: .92rem; }

.seg { display: inline-flex; background: var(--desk); border-radius: 9px; padding: 3px; }
.seg button { border: 0; background: none; font: inherit; font-size: .88rem; font-weight: 600; color: var(--ink-soft); padding: .35rem .8rem; border-radius: 7px; cursor: pointer; display: inline-flex; gap: .4rem; }
.seg button span { color: #8b95a8; font-weight: 500; }
.seg button[aria-selected=true] { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(27, 42, 74, .12); }

.empty { text-align: center; padding: 2.2rem 1rem; color: var(--ink-soft); }
.empty p { margin: .3rem auto; max-width: 46ch; }
.empty.big { padding: 4rem 1rem; }
.empty.big h1 { margin: .5rem 0; color: var(--ink); }
.empty-ico { width: 38px; height: 38px; color: #9aa6ba; stroke-width: 1.4; }

/* ---------- Progress tracker (the request's real sequence) ---------- */
.tracker { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; }
.tracker li { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; gap: .4rem; font-size: .85rem; color: var(--ink-soft); text-align: center; }
.tracker li::before { content: ""; position: absolute; top: 15px; right: 50%; width: 100%; height: 2px; background: var(--line); }
.tracker li:first-child::before { display: none; }
.tracker li.done::before, .tracker li.now::before, .tracker li.stop::before { background: var(--brand); }
.tracker .dot { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 2px solid var(--line); position: relative; z-index: 1; }
.tracker .dot .ico { width: 16px; height: 16px; stroke-width: 2.4; }
.tracker .done .dot { background: var(--brand); border-color: var(--brand); color: #fff; }
.tracker .now .dot { border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 5px var(--brand-wash); }
.tracker .now { color: var(--ink); font-weight: 600; }
.tracker .now.warn .dot { border-color: var(--amber); color: var(--amber); box-shadow: 0 0 0 5px var(--amber-wash); }
.tracker .stop.bad .dot { background: var(--red); border-color: var(--red); color: #fff; }
.tracker .stop.bad { color: var(--red); font-weight: 600; }
.tracker .stop.muted .dot { background: #9aa6ba; border-color: #9aa6ba; color: #fff; }
.tracker li:last-child.done .dot { background: var(--seal); border-color: var(--seal); }
.tracker li:last-child.done { color: var(--seal); font-weight: 600; }
.tracker.compact { margin: 0; min-width: 210px; }
.tracker.compact li { font-size: .74rem; gap: .25rem; }
.tracker.compact li::before { top: 9px; }
.tracker.compact .dot { width: 20px; height: 20px; }
.tracker.compact .dot .ico { width: 11px; height: 11px; }
.tracker.compact .now .dot { box-shadow: 0 0 0 3px var(--brand-wash); }

.nextstep { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .8rem 1.1rem; margin-bottom: 1.5rem; font-weight: 500; }

/* ---------- Home: compose + paper preview ---------- */
.compose { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr); gap: 2rem; align-items: start; margin-bottom: 1.5rem; }
.compose-form { margin-bottom: 0; }
.steps { display: flex; flex-direction: column; gap: 1.6rem; }
.step { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: .7rem; }
.step legend { font-weight: 600; display: flex; align-items: center; gap: .6rem; margin-bottom: .7rem; padding: 0; }
.step legend .soft { font-weight: 400; font-size: .88rem; }
.step-n { width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: #fff; display: inline-grid; place-items: center; font-size: .82rem; font-weight: 700; }
.step > .soft.small { margin: 0; }
.submit-row { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; border-top: 1px solid var(--line-soft); padding-top: 1.2rem; }
.submit-row .soft { flex: 1; min-width: 200px; }

.preview-col { position: sticky; top: 82px; }
.paper { background: var(--paper); border-radius: var(--r-paper); box-shadow: var(--paper-shadow); padding: 2.2rem 2.4rem 1.6rem; font-family: var(--serif); font-size: 1rem; line-height: 1.75; color: #24324f; position: relative; border-top: 6px solid var(--brand); }
.paper p { margin: 0 0 .9rem; text-align: justify; hyphens: manual; }
.paper b { font-weight: 600; color: var(--ink); }
.paper-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.4rem; font-family: var(--sans); }
.paper-logo { color: #a6b3c7; }
.paper-logo .ico { width: 28px; height: 28px; stroke-width: 1.3; }
.paper-ref { font-size: .74rem; color: #8b97ab; border: 1px solid var(--line); border-radius: 999px; padding: .05rem .55rem; }
.paper-title { text-align: center; font-family: var(--serif); font-size: 1.12rem; letter-spacing: .08em; font-weight: 600; color: var(--ink); margin: 0 0 1.3rem; }
.paper-salute { font-weight: 600; }
.gap { background: var(--amber-wash); color: var(--amber); border-bottom: 1.5px dashed var(--amber); padding: 0 .3rem; font-family: var(--sans); font-size: .85em; }
.redact { background: #263552; color: transparent; border-radius: 2px; user-select: none; padding: 0 .2rem; }
.purpose { border-bottom: 1.5px dashed #9fb3cf; font-weight: 400 !important; color: #8b97ab !important; }
.purpose.filled { border-bottom-color: transparent; font-weight: 600 !important; color: var(--ink) !important; }
.paper.pulse .purpose.filled { animation: ink-in .7s ease-out; }
@keyframes ink-in { from { background: var(--brand-wash); } to { background: transparent; } }
.paper-sign { display: flex; flex-direction: column; margin-top: 2rem; width: 55%; font-family: var(--sans); }
.sign-line { display: block; height: 1px; background: #7f8ba0; margin-bottom: .35rem; width: 100%; }
.paper-foot { display: flex; gap: .8rem; align-items: center; margin-top: 1.8rem; padding-top: .8rem; border-top: 1px solid var(--line-soft); font-family: var(--sans); font-size: .76rem; color: #8b97ab; }
.qr { width: 34px; height: 34px; flex: none; border: 1.5px dashed #c3ccda; border-radius: 3px; }
.preview-note { display: flex; gap: .45rem; align-items: flex-start; margin: 1rem .25rem 0; }
.preview-col .note { margin-top: .8rem; }

/* paper, small (admin previews) */
.paper.mini { padding: 1.4rem 1.5rem 1.2rem; font-size: .9rem; line-height: 1.65; }
.paper.mini .paper-title { font-size: .95rem; margin-bottom: 1rem; }
.paper.mini p { text-align: left; }
.paper.mini mark { background: var(--brand-wash); color: var(--ink); font-weight: inherit; padding: 0 .1rem; border-radius: 2px; }
.paper.mini strong { font-weight: 700; color: var(--ink); }
.paper.mini mark.bad { background: var(--red-wash); color: var(--red); font-family: var(--mono); font-size: .82em; font-weight: 400; padding: 0 .2rem; border-radius: 3px; }
.paper.mini .paper-sign { margin-top: 1.4rem; width: 70%; }
.lh-top { display: flex; gap: .8rem; align-items: flex-start; border-bottom: 1px solid var(--line-soft); padding-bottom: .9rem; margin-bottom: 1.1rem; font-family: var(--sans); }
.lh-logo { max-height: 44px; max-width: 120px; }
.lh-company { font-weight: 700; font-size: 1.02rem; margin: 0 !important; color: var(--ink); }
.lh-lines { white-space: pre-line; font-size: .76rem; line-height: 1.45; color: var(--ink-soft); margin: 0 !important; }
.lh-foot { white-space: pre-line; font-family: var(--sans); font-size: .72rem !important; color: #8b97ab; border-top: 1px solid var(--line-soft); padding-top: .6rem; margin-top: 1.2rem !important; }
.ghostline { display: block; height: 7px; background: var(--line-soft); border-radius: 4px; margin: .55rem 0; }
.ghostline.short { width: 60%; margin-bottom: 1rem; }

/* ---------- My requests ---------- */
.reqlist { list-style: none; margin: 0; padding: 0; }
.req { display: grid; grid-template-columns: minmax(0, 1fr) 230px 170px; align-items: center; gap: 1.2rem; padding: .95rem 0; border-top: 1px solid var(--line-soft); }
.req:first-child { border-top: 0; }
.req-main { display: flex; gap: .8rem; align-items: center; text-decoration: none; color: var(--ink); min-width: 0; }
.req-main:hover .req-title { color: var(--brand); }
.req-ico { width: 38px; height: 38px; border-radius: 9px; background: var(--desk); color: var(--ink-soft); display: grid; place-items: center; flex: none; }
.req-text { display: flex; flex-direction: column; min-width: 0; }
.req-title { font-weight: 600; }
.req-text .soft { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.req-act { text-align: right; }
.empty-filter { text-align: center; padding: 1.2rem; }

/* ---------- Request detail ---------- */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.5rem; align-items: start; }
.detail:not(:has(.detail-side)) { grid-template-columns: minmax(0, 760px); }
.detail-side { position: sticky; top: 82px; }
.detail-side .panel { margin-bottom: 0; }
.ref { font-family: var(--mono); font-size: .9em; color: var(--ink); }
.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: .55rem 1rem; margin: 0 0 1rem; }
.kv dt { color: var(--ink-soft); font-size: .9rem; }
.kv dd { margin: 0; }
.reason { background: var(--red-wash); color: var(--red); padding: .4rem .7rem; border-radius: 6px; }
.codecell { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.vcode { font-size: .95rem; letter-spacing: .04em; background: var(--desk); padding: .2rem .5rem; }

.issued { margin-bottom: 1.5rem; }
.issued-sheet { background: var(--paper); border-radius: var(--r-paper); box-shadow: var(--paper-shadow); border-top: 6px solid var(--seal); padding: 1.6rem 1.8rem 1.4rem; position: relative; overflow: hidden; }
.issued.is-revoked .issued-sheet { border-top-color: var(--red); }
.issued-name { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; margin-bottom: 1rem; padding-right: 7rem; word-break: break-all; }
.issued-actions { display: flex; gap: .7rem; flex-wrap: wrap; margin: .3rem 0 .8rem; }
/* The one orchestrated moment: the stamp lands once when an issued certificate is shown. */
.stamp { position: absolute; top: 1.3rem; right: 1.4rem; font-family: var(--serif); font-weight: 600; font-size: 1.15rem; letter-spacing: .14em; text-transform: uppercase; color: var(--seal); border: 3px double var(--seal); border-radius: 6px; padding: .2rem .75rem; transform: rotate(-8deg); opacity: .88; animation: stamp-in .5s cubic-bezier(.2, 1.4, .4, 1) .25s both; }
.stamp-void { color: var(--red); border-color: var(--red); }
@keyframes stamp-in { from { opacity: 0; transform: rotate(-8deg) scale(1.9); } to { opacity: .88; transform: rotate(-8deg) scale(1); } }

.review h2 { margin-bottom: 1rem; }
.review > form, .review > .fixlist, .review > details { margin-bottom: 1rem; }
.review > :last-child { margin-bottom: 0; }
.fixlist { background: var(--amber-wash); border-radius: 10px; padding: .9rem 1rem; color: #6d470c; }
.fixlist ul { list-style: none; margin: .2rem 0 .6rem; padding: 0; }
.fixlist li { display: flex; gap: .45rem; margin-bottom: .3rem; }
.fixlist li .ico { color: var(--amber); margin-top: .15rem; }
.fixlist li { margin-bottom: .6rem; }
.fixhow { display: block; font-size: .84rem; color: #8a5d16; margin-top: .15rem; }
.fixhow a { color: inherit; font-weight: 600; }
.fixlist form { margin-top: .6rem; }
.reject { border-top: 1px solid var(--line-soft); padding-top: .8rem; }
.reject summary, .more summary { cursor: pointer; font-weight: 600; color: var(--ink-soft); font-size: .92rem; }
.reject[open] summary { margin-bottom: .8rem; color: var(--ink); }
.more { margin-top: 1rem; border-top: 1px solid var(--line-soft); padding-top: .9rem; }
.more[open] summary { margin-bottom: .9rem; }

.activity { list-style: none; margin: 0; padding: 0; }
.activity li { display: grid; grid-template-columns: 18px 1fr; gap: .7rem; position: relative; padding-bottom: .9rem; }
.activity li::before { content: ""; position: absolute; left: 6px; top: 16px; bottom: 0; width: 2px; background: var(--line-soft); }
.activity li:last-child::before { display: none; }
.activity p { margin: 0; }
.act-dot { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid #b4c0d2; margin-top: .3rem; position: relative; z-index: 1; }
.act-approve .act-dot, .act-generate .act-dot { border-color: var(--seal); }
.act-reject .act-dot, .act-revoke .act-dot, .act-fail .act-dot { border-color: var(--red); }
.act-flag .act-dot { border-color: var(--amber); }
.act-request .act-dot { border-color: var(--brand); }
.act-comment { background: var(--desk); border-radius: 8px; padding: .4rem .7rem; margin-top: .35rem !important; font-size: .9rem; }

/* ---------- Login ---------- */
.page-login { background: linear-gradient(180deg, var(--ink) 0 300px, var(--desk) 300px); }
.page-login .bar { background: transparent; position: static; }
.login { display: grid; grid-template-columns: 1.1fr .9fr; gap: 3rem; align-items: start; padding-top: 1.5rem; }
.login-pitch { color: #fff; padding-top: .5rem; }
.login-pitch h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(1.8rem, 3.4vw, 2.6rem); line-height: 1.18; letter-spacing: -.01em; max-width: 20ch; margin-bottom: 2.2rem; }
.how { list-style: none; counter-reset: how; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1rem; color: var(--ink); max-width: 30rem; }
.how li { counter-increment: how; display: grid; grid-template-columns: 34px 1fr; column-gap: .9rem; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .9rem 1rem; }
.how li::before { content: counter(how); grid-row: span 2; width: 30px; height: 30px; border-radius: 50%; background: var(--brand-wash); color: var(--brand-deep); display: grid; place-items: center; font-weight: 700; font-size: .88rem; }
.how li span { color: var(--ink-soft); font-size: .9rem; }
.login-card { padding: 1.8rem; box-shadow: 0 24px 48px -24px rgba(27, 42, 74, .35); }
.login-card h2 { font-size: 1.35rem; margin-bottom: .3rem; }
.login-card .btn.big { margin: .4rem 0 .6rem; }
.devlogin { margin-top: 1.5rem; padding-top: 1.3rem; border-top: 1px dashed var(--line); margin-bottom: 1rem; }
.devlogin h3 { margin-bottom: .2rem; }

/* ---------- Verify ---------- */
.verify { max-width: 640px; margin: 0 auto; }
.verify-mark { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--seal-wash); color: var(--seal); margin-bottom: .8rem; }
.verify-mark .ico { width: 28px; height: 28px; }
.verify .pagehead p { margin-left: auto; margin-right: auto; }
.verify-form { display: flex; gap: .6rem; margin-bottom: 1.5rem; }
.verify-form input { font-family: var(--mono); font-size: 1.1rem; letter-spacing: .08em; text-align: center; padding: .7rem; }
.verdict { background: #fff; border: 1px solid var(--line); border-radius: var(--r-panel); padding: 1.4rem 1.5rem; border-top: 6px solid var(--seal); }
.verdict-head { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1.1rem; }
.verdict-head h2 { margin: 0 0 .2rem; font-size: 1.2rem; }
.verdict-ico { width: 40px; height: 40px; padding: 8px; border-radius: 50%; background: var(--seal-wash); color: var(--seal); stroke-width: 2.4; }
.v-expired { border-top-color: var(--amber); } .v-expired .verdict-ico { background: var(--amber-wash); color: var(--amber); }
.v-revoked { border-top-color: var(--red); } .v-revoked .verdict-ico { background: var(--red-wash); color: var(--red); }

/* ---------- Admin ---------- */
.setup { border-left: 4px solid var(--brand); }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.checklist li { display: flex; gap: .7rem; align-items: flex-start; }
.checklist li > .ico { margin-top: .2rem; color: #9aa6ba; }
.checklist li.done > .ico { color: var(--seal); }
.checklist li.done strong { text-decoration: line-through; text-decoration-color: #9aa6ba; color: var(--ink-soft); }
.statline { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; margin-bottom: 1rem; }
.stat { background: var(--desk); border-radius: 9px; padding: .6rem .8rem; }
.stat strong { display: block; font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat span { font-size: .8rem; color: var(--ink-soft); }
.lastsync { display: flex; gap: .5rem; align-items: flex-start; font-size: .9rem; }
.lastsync.bad { color: var(--red); }
.lastsync + form { margin-bottom: .4rem; }
.typelist { list-style: none; margin: 0; padding: 0; }
.typelist li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .8rem 0; border-top: 1px solid var(--line-soft); }
.typelist li:first-child { border-top: 0; padding-top: 0; }
.typelist a { display: flex; flex-direction: column; text-decoration: none; }
.type-name { font-weight: 600; }
.type-state { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: flex-end; }
.versions { list-style: none; margin: 0 0 1rem; padding: 0; }
.ver { display: grid; grid-template-columns: auto auto 1fr; gap: .7rem; align-items: center; padding: .6rem 0; border-top: 1px solid var(--line-soft); }
.ver:first-child { border-top: 0; }
.ver .soft { text-align: right; }
.ver-retired a { color: var(--ink-soft); }

.editor { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, 1fr); gap: 1.5rem; align-items: start; }
.editor-side { display: flex; flex-direction: column; gap: 1.5rem; }
.editor-side .panel, .editor-main { margin-bottom: 0; }
.tokens { display: flex; flex-wrap: wrap; gap: .4rem; }
.token { border: 1px solid #c9d6e8; background: var(--brand-wash); color: var(--brand-deep); border-radius: 6px; padding: .25rem .55rem; font: inherit; font-size: .82rem; font-weight: 500; cursor: pointer; }
.token:hover:not(:disabled) { background: var(--brand); color: #fff; border-color: var(--brand); }
.token.warm { background: var(--amber-wash); color: var(--amber); border-color: #f0d9b0; }
.token:disabled { cursor: default; opacity: .75; }
.publish { margin-top: 1.4rem; padding: 1rem 1.1rem; border-radius: 10px; background: var(--seal-wash); }
.publish form { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.publish form .soft { flex: 1; min-width: 200px; }
.publish.blocked { background: var(--amber-wash); color: #6d470c; }
.publish ul { list-style: none; padding: 0; margin: .3rem 0 .5rem; }
.publish li { display: flex; gap: .45rem; margin-bottom: .25rem; }
.publish li .ico { color: var(--amber); margin-top: .15rem; }
.tpl-warn { margin: -.4rem 0 0; }
.field-top { display: flex; justify-content: space-between; align-items: flex-end; gap: .5rem; }
.field-top label { font-weight: 600; font-size: .9rem; }
.field-top label .soft { font-weight: 400; }
.boldbtn { min-width: 2.2rem; font-family: var(--serif); font-size: 1rem; border-color: var(--line); }

.drop { position: relative; display: flex; flex-direction: column; gap: .7rem; border: 1.5px dashed #b9c5d6; border-radius: 10px; padding: 1rem; cursor: pointer; background: #fbfcfe; transition: .15s; }
.drop:hover, .drop.is-over { border-color: var(--brand); background: var(--brand-wash); }
.drop.has-file { border-style: solid; border-color: var(--seal); background: #f5fbfa; }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.drop:focus-within { box-shadow: var(--focus); }
.drop-face { display: flex; gap: .8rem; align-items: center; pointer-events: none; }
.drop-face > .ico { width: 26px; height: 26px; color: var(--brand); flex: none; }
.drop-face > span { display: flex; flex-direction: column; }
.drop .hint { font-size: .82rem; color: var(--ink-soft); }
.drop-preview { max-height: 90px; max-width: 100%; align-self: flex-start; border-radius: 4px; background: repeating-conic-gradient(#f0f2f6 0 25%, #fff 0 50%) 0 0 / 14px 14px; padding: .3rem; pointer-events: none; }
.dropgrid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.logo-current { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem; border: 1px solid var(--line-soft); border-radius: 8px; margin-bottom: 1rem; }
.logo-current img { max-height: 54px; max-width: 70%; }
.role { font-weight: 600; font-size: .88rem; }
.role-admin { color: var(--brand-deep); }
.role-compensation_officer { color: var(--amber); }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .compose, .detail, .editor, .split, .split.wide-left, .login { grid-template-columns: 1fr; }
  .detail:not(:has(.detail-side)) { grid-template-columns: 1fr; }
  .preview-col, .detail-side { position: static; }
  .req { grid-template-columns: 1fr; gap: .6rem; }
  .req-act { text-align: left; }
  .login { gap: 1.5rem; }
  .page-login { background: linear-gradient(180deg, var(--ink) 0 460px, var(--desk) 460px); }
}
@media (max-width: 640px) {
  :root { font-size: 15px; }
  .wrap { padding: 1.2rem 1rem 2rem; }
  .bar-inner { padding: 0 1rem; gap: .8rem; }
  .brand-name, .me-name, .hint-key { display: none; }
  .panel { padding: 1.1rem; }
  .paper { padding: 1.5rem 1.3rem 1.2rem; }
  .paper p { text-align: left; }
  .row2, .dropgrid { grid-template-columns: 1fr; }
  .statline { grid-template-columns: 1fr 1fr; }
  .kv { grid-template-columns: 1fr; gap: .1rem; }
  .kv dd { margin-bottom: .5rem; }
  .table thead { display: none; }
  .table tr { display: block; padding: .7rem 1rem; border-bottom: 1px solid var(--line-soft); }
  .table td { display: block; padding: .15rem 0; border: 0; }
  .table .num { text-align: left; }
  .verify-form { flex-direction: column; }
  .detail-head { flex-direction: column; }
}

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

@media print {
  .bar, .foot, .toasts, .detail-side, .btn, form { display: none !important; }
  body { background: #fff; }
}
