/* SC365 Approvals web UI — Southern Cross 365 brand (navy #0b1f4b, blue #1e6eff, cyan #00d4ff). Light + dark. */
:root {
  --navy: #0b1f4b; --blue: #1e6eff; --cyan: #00d4ff;
  --bg: #f3f6fb; --surface: #ffffff; --surface-2: #f7f9fd; --fg: #0f1e3d; --muted: #55627d; --border: #d7deea;
  --accent: #1e6eff; --accent-fg: #ffffff; --accent-weak: #e6efff; --focus: #1e6eff;
  --good: #0f7a3d; --good-bg: #e5f6ec; --warn: #8a5300; --warn-bg: #fff3d6; --bad: #b42318; --bad-bg: #fde8e6; --info: #1450c8; --info-bg: #e6efff;
  --neutral: #4a5670; --neutral-bg: #eef1f6;
  --radius: 12px; --shadow: 0 1px 2px rgba(11, 31, 75, .06), 0 4px 16px rgba(11, 31, 75, .06);
  --topbar: #0b1f4b; --topbar-fg: #ffffff;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #071233; --surface: #0f1d45; --surface-2: #13244f; --fg: #e8eefc; --muted: #a3b1cf; --border: #24386b;
    --accent: #4d8dff; --accent-fg: #ffffff; --accent-weak: #18306a; --focus: #00d4ff;
    --good: #5fd391; --good-bg: #113a2a; --warn: #ffc65c; --warn-bg: #3d2e0d; --bad: #ff8a80; --bad-bg: #44181a; --info: #8fb5ff; --info-bg: #18306a;
    --neutral: #c0cbe3; --neutral-bg: #1d2d58;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    --topbar: #050d26;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #071233; --surface: #0f1d45; --surface-2: #13244f; --fg: #e8eefc; --muted: #a3b1cf; --border: #24386b;
  --accent: #4d8dff; --accent-fg: #ffffff; --accent-weak: #18306a; --focus: #00d4ff;
  --good: #5fd391; --good-bg: #113a2a; --warn: #ffc65c; --warn-bg: #3d2e0d; --bad: #ff8a80; --bad-bg: #44181a; --info: #8fb5ff; --info-bg: #18306a;
  --neutral: #c0cbe3; --neutral-bg: #1d2d58;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  --topbar: #050d26;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif; background: var(--bg); color: var(--fg); min-height: 100vh; overflow-x: hidden; }
#root { min-height: 100vh; display: flex; flex-direction: column; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 0 0 .5rem; }
h3 { font-size: 1rem; margin: 1rem 0 .25rem; }
p { margin: 0 0 .5rem; }
a { color: var(--accent); }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .9em; overflow-wrap: anywhere; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--surface); color: var(--fg); padding: 8px 12px; z-index: 100; border-radius: 8px; }
.skip-link:focus { left: 8px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.stack > * + * { margin-top: 1rem; }
.grow { flex: 1 1 auto; min-width: 0; }
.center { justify-content: center; }

/* ------------------------------------------------------------------ layout */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 8px 16px; padding-top: max(8px, env(safe-area-inset-top)); background: var(--topbar); color: var(--topbar-fg); box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.topbar a { color: inherit; text-decoration: none; }
.topbar-brand { flex: 0 0 auto; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; }
.brand img { border-radius: 8px; }
.brand-name { font-size: 1.05rem; letter-spacing: .01em; }
.topnav { display: flex; gap: 4px; flex: 1 1 auto; margin-left: 8px; }
.nav-link { padding: 8px 12px; border-radius: 8px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; color: #c9d6f5 !important; }
.nav-link:hover { background: rgba(255,255,255,.08); }
.nav-link.active { color: #fff !important; background: rgba(30,110,255,.35); box-shadow: inset 0 -2px 0 var(--cyan); }
.count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--cyan); color: #04122f; font-size: .78rem; font-weight: 800; }
.user-menu { position: relative; }
.user-btn { display: inline-flex; align-items: center; gap: 8px; background: transparent; border: 1px solid rgba(255,255,255,.2); color: inherit; border-radius: 999px; padding: 3px 12px 3px 3px; cursor: pointer; font: inherit; }
.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--blue), var(--cyan)); color: #fff; font-weight: 800; font-size: .85rem; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px; background: var(--surface); color: var(--fg); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; z-index: 30; display: flex; flex-direction: column; }
.menu a, .menu button { text-align: left; padding: 10px 12px; border-radius: 8px; color: var(--fg) !important; background: none; border: 0; font: inherit; cursor: pointer; text-decoration: none; }
.menu a:hover, .menu button:hover { background: var(--surface-2); }
.menu-head { padding: 8px 12px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; display: flex; flex-direction: column; font-size: .9rem; }
.banner { padding: 10px 16px; font-size: .93rem; border-bottom: 1px solid var(--border); }
.content { flex: 1 1 auto; width: 100%; max-width: 1200px; margin: 0 auto; padding: 20px 16px 96px; }
.footer { text-align: center; font-size: .8rem; padding: 16px; }
.centered { flex: 1 1 auto; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 500px at 50% -10%, rgba(30,110,255,.18), transparent), var(--bg); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.card.narrow { width: 100%; max-width: 440px; }
.card.wizard { width: 100%; max-width: 640px; }
.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.page-head p { margin: 4px 0 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.grid2 { display: grid; gap: 0 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid3 { display: grid; gap: 0 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { margin-bottom: 0; }
.back { display: inline-block; margin-bottom: 8px; text-decoration: none; font-weight: 600; }

/* ------------------------------------------------------------------ controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--fg); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn-primary:hover { background: #1557d6; }
.btn-good { background: #12854a; border-color: #12854a; color: #fff; }
.btn-good:hover { background: #0e6e3c; }
.btn-danger { background: var(--surface); border-color: var(--bad); color: var(--bad); }
.btn-danger:hover { background: var(--bad-bg); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn-ghost:hover { background: var(--accent-weak); }
.icon-btn { background: none; border: 0; color: var(--muted); font-size: 1.1rem; width: 44px; height: 44px; border-radius: 10px; cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); }

.field { margin-bottom: 14px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
.field label, fieldset legend { font-weight: 600; font-size: .93rem; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--fg); font: inherit; font-size: 16px;
}
textarea { resize: vertical; min-height: 80px; }
input:disabled, select:disabled { background: var(--surface-2); color: var(--muted); }
input[type=file] { font: inherit; max-width: 100%; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--bad); }
.hint { color: var(--muted); font-size: .85rem; }
.field-error { color: var(--bad); font-size: .88rem; font-weight: 600; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent); flex: 0 0 auto; }
.check label { display: flex; flex-direction: column; font-weight: 500; }
fieldset { border: 1px solid var(--border); border-radius: 10px; padding: 8px 14px; margin: 0; }
.code-field input { font-size: 1.5rem !important; letter-spacing: .35em; font-variant-numeric: tabular-nums; max-width: 240px; text-align: center; }
.search { display: flex; gap: 8px; margin: 12px 0; }
.search input { flex: 1 1 auto; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.tone-neutral { background: var(--neutral-bg); color: var(--neutral); }
.tone-info { background: var(--info-bg); color: var(--info); }
.tone-good { background: var(--good-bg); color: var(--good); }
.tone-warn { background: var(--warn-bg); color: var(--warn); }
.tone-bad { background: var(--bad-bg); color: var(--bad); }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.alert { border-radius: 10px; padding: 12px 14px; border: 1px solid currentColor; border-color: color-mix(in srgb, currentColor 30%, transparent); }
.alert strong { display: block; margin-bottom: 2px; }
.alert a { color: inherit; font-weight: 700; }
.empty { text-align: center; padding: 40px 16px; border: 2px dashed var(--border); border-radius: var(--radius); color: var(--muted); }
.empty strong { display: block; color: var(--fg); font-size: 1.1rem; margin-bottom: 4px; }
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 16px 0; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: spin 0.8s linear infinite; display: inline-block; }
.spinner.sm { width: 14px; height: 14px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--border); margin-bottom: 12px; scrollbar-width: none; }
.tab { background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 14px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; }
.tab.active { color: var(--fg); border-bottom-color: var(--accent); }

/* ------------------------------------------------------------------ dialog + toasts */
.dialog { border: 0; padding: 0; border-radius: 16px; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 24px); background: var(--surface); color: var(--fg); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.dialog.wide { width: min(780px, calc(100vw - 24px)); }
.dialog::backdrop { background: rgba(5, 13, 38, .55); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px 6px 20px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.dialog-head h2 { margin: 0; }
.dialog-body { padding: 16px 20px 20px; }
.dialog-foot { padding: 12px 20px 16px; display: flex; justify-content: flex-end; gap: 8px; }
.toasts { position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 1000; width: min(480px, calc(100vw - 32px)); pointer-events: none; }
.toast { padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 600; border: 1px solid var(--border); background: var(--surface); }
.toast.tone-good { background: var(--good-bg); }

/* ------------------------------------------------------------------ setup + login */
.wizard-head, .login-head { text-align: center; margin-bottom: 16px; }
.wizard-head h1 { margin: 12px 0 4px; }
.login-head p { margin: 6px 0 0; }
.by { font-size: .78rem; margin: 2px 0 0 !important; letter-spacing: .02em; }
.stepper { list-style: none; padding: 0; margin: 0 0 20px; display: flex; gap: 4px; }
.stepper li { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: .8rem; color: var(--muted); text-align: center; position: relative; }
.stepper .dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--neutral-bg); color: var(--neutral); font-weight: 800; }
.stepper li.current { color: var(--fg); font-weight: 700; }
.stepper li.current .dot { background: var(--accent); color: #fff; box-shadow: 0 0 0 4px var(--accent-weak); }
.stepper li.done .dot { background: var(--good-bg); color: var(--good); }
.totp-enrol { display: grid; gap: 8px; }
.qr { display: grid; place-items: center; }
.qr img { background: #fff; padding: 10px; border-radius: 12px; border: 1px solid var(--border); width: 220px; height: 220px; }
.secret { display: inline-block; font-size: 1.05rem; padding: 4px 8px; background: var(--surface-2); border-radius: 8px; letter-spacing: .05em; }
.plain-steps { margin: 0; padding-left: 1.3em; }
.plain-steps li { margin: 2px 0; }

/* ------------------------------------------------------------------ inbox */
.req-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
.req-main > * { min-width: 0; }
.req-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--fg); text-decoration: none; box-shadow: var(--shadow); }
.req-card:hover { border-color: var(--accent); }
.req-card.mine { border-left: 5px solid var(--cyan); }
.req-main { flex: 1 1 auto; min-width: 0; display: grid; gap: 4px; }
.req-title { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.req-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.amount { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.req-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .88rem; }
.req-status { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.overdue { color: var(--bad); font-weight: 700; }
.chev { color: var(--muted); font-size: 1.6rem; }

/* ------------------------------------------------------------------ request page */
.req-summary-top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.req-summary-top p { margin: 0 0 2px; }
.big-amount { font-size: 1.8rem; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--fg); }
.req-badges { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 8px 0 4px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px 20px; margin: 12px 0 0; }
.facts div { min-width: 0; }
.facts .wide { grid-column: 1 / -1; }
.facts dt { font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.action-bar { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
.req-columns { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 16px; align-items: start; margin-top: 16px; }
.steps, .timeline { list-style: none; margin: 0; padding: 0; }
.step { display: flex; gap: 12px; padding: 10px 0; position: relative; }
.step + .step { border-top: 1px solid var(--border); }
.step-dot { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .9rem; }
.step-name { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.step.st-waiting { background: linear-gradient(90deg, var(--info-bg), transparent); margin: 0 -10px; padding: 10px; border-radius: 10px; }
.comment { margin: 6px 0 0; padding: 6px 10px; border-left: 3px solid var(--border); background: var(--surface-2); border-radius: 0 8px 8px 0; font-size: .92rem; white-space: pre-wrap; }
.timeline li { padding: 10px 0 10px 18px; border-left: 2px solid var(--border); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 16px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }
.audit-details { margin-top: 12px; }
.audit-details summary, details > summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.audit-list { list-style: none; padding: 0; margin: 8px 0 0; font-size: .88rem; display: grid; gap: 4px; }
.sig-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.sig-list li { display: flex; gap: 12px; align-items: flex-start; }
.action-summary { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }

.pdf-viewer { display: flex; flex-direction: column; gap: 8px; }
.pdf-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.pdf-zoom { display: inline-flex; align-items: center; gap: 2px; }
.pdf-pages { background: var(--surface-2); border-radius: 10px; padding: 8px 0; overflow: auto; max-height: 85vh; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; min-height: 200px; }
.pdf-page { background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.25); margin: 0 auto; flex: 0 0 auto; }
.pdf-page canvas { display: block; }

/* ------------------------------------------------------------------ admin */
.admin { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start; }
.admin-nav { position: sticky; top: 72px; display: flex; flex-direction: column; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; }
.admin-nav a { padding: 10px 12px; border-radius: 8px; color: var(--fg); text-decoration: none; font-weight: 600; }
.admin-nav a:hover { background: var(--surface-2); }
.admin-nav a.active { background: var(--accent-weak); color: var(--accent); }
.admin-page { min-width: 0; }
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr.dim td { opacity: .6; }
.row-actions { text-align: right; white-space: nowrap; }
.more { position: relative; display: inline-block; }
.more > summary { list-style: none; }
.more > summary::-webkit-details-marker { display: none; }
.more .menu { right: 0; }
.simple-list { list-style: none; padding: 0; margin: 0; }
.simple-list > li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.simple-list.card > li { padding: 12px 0; }
.simple-list > li:last-child { border-bottom: 0; }
.invite { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px; font-size: .9rem; overflow-wrap: anywhere; }
.route-card { color: var(--fg); text-decoration: none; display: grid; gap: 4px; }
.route-card:hover { border-color: var(--accent); }
.route-card-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.preview { margin: 6px 0 0; padding-left: 1.2em; }
.preview li { margin: 4px 0; }
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.preview-card { position: sticky; top: 72px; border-top: 4px solid var(--cyan); }
.step-editor { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.step-card-head { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.step-num { width: 32px; height: 32px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 800; margin-top: 30px; flex: 0 0 auto; }
.step-tools { display: flex; margin-top: 26px; }
.step-tools .btn { min-width: 44px; padding: 8px 10px; }
.lic-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.meter-label { display: flex; justify-content: space-between; }
.meter-bar { height: 12px; background: var(--neutral-bg); border-radius: 6px; overflow: hidden; margin: 6px 0; }
.meter-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--cyan)); }
.meter-bar span.full { background: var(--bad); }
.fingerprint { display: grid; gap: 2px; padding: 12px; background: var(--surface-2); border-radius: 10px; border: 1px solid var(--border); }
.fingerprint code { font-size: .95rem; letter-spacing: .02em; }

/* ------------------------------------------------------------------ electronic forms (fill page, renderer, designer) */
.ef-page { max-width: 820px; margin: 0 auto; width: 100%; }
.ef-card header h1, .ef-title { margin: 2px 0 6px; }
.ef-intro { white-space: pre-wrap; }
.ef-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 16px; }
.ef-item { min-width: 0; }
@media (min-width: 641px) { .ef-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ef-full { grid-column: 1 / -1; } }
.ef-heading { font-size: 1.1rem; margin: 12px 0 8px; padding-bottom: 4px; border-bottom: 2px solid var(--cyan); }
.ef-text { white-space: pre-wrap; margin: 4px 0 12px; }
.ef-divider { border: 0; border-top: 1px solid var(--border); margin: 8px 0 16px; }
.ef-req { color: var(--bad); }
.ef-opt { color: var(--muted); font-weight: 400; font-size: .85em; }
.ef-label { font-weight: 600; font-size: .93rem; }
.ef-fieldset { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
.ef-fieldset legend { padding: 0; margin-bottom: 6px; }
.ef-auto, .field input.ef-auto, .field select.ef-auto, .field textarea.ef-auto { background: color-mix(in srgb, var(--cyan) 9%, var(--surface)); }
.ef-src { font-size: .8rem; color: var(--info); font-weight: 600; }
.ef-src::before { content: "✓ "; }
.ef-money { display: flex; align-items: stretch; }
.ef-money-sym { display: grid; place-items: center; padding: 0 10px; border: 1px solid var(--border); border-right: 0; border-radius: 10px 0 0 10px; background: var(--surface-2); font-weight: 700; color: var(--muted); }
.ef-money input { border-top-left-radius: 0 !important; border-bottom-left-radius: 0 !important; flex: 1 1 auto; min-width: 0; }
.choice-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; font-weight: 600; }
.choice input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.choice.on { border-color: var(--accent); background: var(--accent-weak); }
.choice:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.ef-declaration { padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.ef-next { border-top: 1px solid var(--border); padding-top: 12px; }
.ef-next ol { margin: 4px 0 8px; padding-left: 1.3em; }
.ef-actions { padding-top: 4px; }
.form-card-name { font-size: 1.05rem; }
.ef-answers .page-head { margin-bottom: 0; }
.stack-sm > * + * { margin-top: .5rem; }
.add-detail { align-items: flex-end; }
.add-detail .field { flex: 1 1 220px; margin-bottom: 0; }
.dept-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0 12px; margin-top: 8px; }
.problems { margin: 4px 0 0; padding-left: 1.2em; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }
.designer { display: grid; grid-template-columns: 200px minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.designer-palette, .designer-props { position: sticky; top: 72px; max-height: calc(100vh - 88px); overflow: auto; }
.palette-group { display: flex; flex-direction: column; gap: 2px; }
.palette-group .btn { justify-content: flex-start; min-height: 38px; padding: 6px 10px; font-weight: 500; }
.designer-tip { margin-bottom: 10px; }
.ef-design { position: relative; border: 1px dashed transparent; border-radius: 8px; padding: 2px 6px; margin: 0 -6px; }
.ef-design:hover { border-color: var(--border); }
.ef-design.selected { border: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 5%, transparent); }
.ef-design.has-problem { border-color: var(--bad); }
.ef-pick { position: absolute; inset: 0; width: 100%; background: transparent; border: 0; cursor: pointer; z-index: 2; border-radius: 8px; }
.ef-item-error { position: relative; z-index: 3; margin-bottom: 8px; }
.item-tools .btn { min-height: 38px; padding: 6px 10px; }
@media (max-width: 1100px) {
  .designer { grid-template-columns: minmax(0, 1fr) 300px; }
  .designer-palette { grid-column: 1 / -1; position: static; max-height: none; }
  .designer-palette .palette-group { flex-direction: row; flex-wrap: wrap; }
}
@media (max-width: 900px) {
  .designer { grid-template-columns: minmax(0, 1fr); }
  .designer-props { position: static; max-height: none; }
}
@media (max-width: 640px) {
  .ef-actions { flex-direction: column; align-items: stretch; }
  .ef-actions .btn { width: 100%; }
  .choice { flex: 1 1 auto; }
}

/* ------------------------------------------------------------------ narrow screens (phones, 375px) */
@media (max-width: 900px) {
  .req-columns, .editor-grid { grid-template-columns: minmax(0, 1fr); }
  .preview-card { position: static; }
  .admin { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .admin-nav { position: static; flex-direction: row; overflow-x: auto; padding: 4px; scrollbar-width: thin; }
  .admin-nav a { white-space: nowrap; }
  .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  h1 { font-size: 1.35rem; }
  .content { padding: 12px 12px 120px; }
  .card { padding: 16px; }
  .grid2, .grid3 { grid-template-columns: minmax(0, 1fr); }
  .user-name { display: none; }
  .user-btn { padding: 3px; }
  .brand-name { font-size: .95rem; }
  .topbar { gap: 6px; padding-left: 12px; padding-right: 12px; }
  .topnav { margin-left: 0; }
  .nav-link { padding: 8px 8px; }
  .big-amount { font-size: 1.5rem; }
  .stepper .label { display: none; }
  .stepper li.current .label { display: block; }
  /* sticky action bar so approvers never scroll to find the buttons */
  .action-bar { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; z-index: 15; padding: 10px 12px; padding-bottom: max(10px, env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -4px 16px rgba(0,0,0,.12); }
  .action-bar .btn { flex: 1 1 0; padding: 8px 10px; }
  .pdf-pages { max-height: none; }
  .table.responsive thead { display: none; }
  .table.responsive tr { display: block; border-bottom: 1px solid var(--border); padding: 8px 0; }
  .table.responsive td { display: block; border: 0; padding: 4px 14px; }
  .table.responsive td[data-label]::before { content: attr(data-label); display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
  .row-actions { text-align: left; }
  .dialog { width: 100vw; max-width: 100vw; max-height: 100dvh; height: auto; margin: auto 0 0; border-radius: 16px 16px 0 0; }
  .code-field input { max-width: none; }
  .search { flex-direction: column; }
}
@media (max-width: 380px) { .topbar .brand-name { display: none; } }
@media print { .topbar, .action-bar, .footer, .admin-nav { display: none; } body { background: #fff; } }
