:root {
  --bg: #eef0f3;
  --panel: #ffffff;
  --ink: #1b222c;
  --ink-2: #4a5462;
  --ink-3: #7a8494;
  --line: #dde1e7;
  --line-2: #eceff3;
  --steel: #1d2430;
  --steel-2: #2a3341;
  --accent: #e8650a;
  --accent-ink: #ffffff;
  --accent-soft: #fff1e6;
  --ok: #1f8a4c;
  --ok-soft: #e5f5ec;
  --warn: #b7791f;
  --warn-soft: #fdf3dc;
  --bad: #c0392b;
  --bad-soft: #fbe9e7;
  --info: #2563a8;
  --info-soft: #e6effa;
  --mod: #7b4fb8;
  --mod-soft: #f1eafa;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(20, 28, 40, .06), 0 4px 14px rgba(20, 28, 40, .05);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 24px; letter-spacing: -.01em; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
small, .muted { color: var(--ink-3); }
.mono { font-family: var(--mono); font-size: .92em; }
.hidden { display: none !important; }

/* ---------- layout ---------- */
#app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
#app.auth { display: block; }
#app.auth .sidebar, #app.auth .tabbar { display: none; }
#app.booting > * { visibility: hidden; }
.sidebar { background: var(--steel); color: #e9edf2; position: sticky; top: 0; height: 100vh; align-self: start; display: flex; flex-direction: column; padding: 18px 14px; }
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; text-decoration: none; padding: 4px 8px 18px; }
.brand img { width: 76px; height: 76px; border-radius: 12px; background: #fff; }
.brand b { display: block; font-size: 17px; letter-spacing: .01em; }
.brand small { display: block; color: #9aa6b6; font-size: 12px; line-height: 1.35; max-width: 180px; overflow-wrap: anywhere; }
#sideNav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
#sideNav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: #c5cdd8; font-weight: 500; }
#sideNav a:hover { background: var(--steel-2); color: #fff; }
#sideNav a.on { background: var(--accent); color: #fff; }
#sideNav a .badge { margin-left: auto; }
#sideNav .sep { height: 1px; background: #323c4b; margin: 10px 6px; }
#sideNav svg, .tabbar svg { width: 20px; height: 20px; flex: none; }
.side-user { border-top: 1px solid #323c4b; padding: 14px 8px 30px; display: flex; gap: 10px; align-items: center; }
.side-user .who { min-width: 0; flex: 1; }
.side-user b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user small { color: #9aa6b6; }
main { padding: 28px 32px 90px; max-width: 1180px; width: 100%; outline: none; }
.tabbar { display: none; }

.credit { position: fixed; right: 14px; bottom: 10px; font-size: 11.5px; color: var(--ink-3); background: rgba(255, 255, 255, .85); padding: 4px 10px; border-radius: 20px;
  border: 1px solid var(--line); z-index: 40; pointer-events: none; letter-spacing: .01em; backdrop-filter: blur(6px); }

@media (max-width: 860px) {
  #app { display: block; }
  .sidebar { display: none; }
  main { padding: 16px 14px calc(var(--tabbar-h) + 56px + var(--safe-b)); }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
    background: var(--steel); z-index: 50; justify-content: space-around; align-items: stretch; }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: #aab4c2; text-decoration: none; font-size: 11px; font-weight: 500; position: relative; }
  .tabbar a.on { color: #fff; }
  .tabbar a.on::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
  .tabbar a.new span.plus { width: 44px; height: 44px; border-radius: 14px; background: var(--accent); color: #fff; display: grid; place-items: center; margin-top: -2px; }
  .tabbar a.new span.plus svg { width: 24px; height: 24px; }
  .tabbar .badge { position: absolute; top: 6px; left: calc(50% + 6px); }
  .credit { bottom: calc(var(--tabbar-h) + var(--safe-b) + 8px); right: 10px; font-size: 10.5px; }
  #app.auth ~ .credit { bottom: calc(10px + var(--safe-b)); }
  h1 { font-size: 21px; }
}

/* ---------- common ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--ink-3); }
.back svg { width: 18px; height: 18px; }
.back { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; color: var(--ink-3); text-decoration: none; font-size: 14px; margin-bottom: 8px; }
.card { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line-2); padding: 18px; }
.card + .card, .card + .grid, .grid + .card, .grid + .grid { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: 1fr 1fr; }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
.detail-grid { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
@media (max-width: 1500px) { .detail-grid { grid-template-columns: 1fr; } }
.tbl td.main { min-width: 200px; }
@media (max-width: 860px) { .g2, .g3, .detail-grid { grid-template-columns: 1fr; } .g4 { grid-template-columns: 1fr 1fr; } .grid { gap: 12px; } .card { padding: 15px; } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: #fff; padding: 10px 16px; border-radius: 10px;
  font-weight: 600; cursor: pointer; text-decoration: none; min-height: 42px; white-space: nowrap; transition: background .12s, border-color .12s, transform .05s; }
.btn:hover { border-color: #c4cad3; background: #f9fafb; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #d35a06; }
.btn.dark { background: var(--steel); border-color: var(--steel); color: #fff; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { padding: 6px 11px; min-height: 34px; font-size: 13.5px; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 860px) { .actions .btn { flex: 1 1 auto; } }

label.f { display: block; }
label.f > span { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
label.f > span em { font-style: normal; font-weight: 400; color: var(--ink-3); }
input[type=text], input[type=number], input[type=date], input[type=search], input[type=password], input[type=tel], select, textarea {
  width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 12px; min-height: 42px; outline: none; transition: border-color .12s, box-shadow .12s; }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(232, 101, 10, .15); }
input.num { text-align: right; font-variant-numeric: tabular-nums; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(6, 1fr); }
.form-grid > .c2 { grid-column: span 2; } .form-grid > .c3 { grid-column: span 3; } .form-grid > .c4 { grid-column: span 4; } .form-grid > .c6 { grid-column: span 6; }
@media (max-width: 860px) { .form-grid { grid-template-columns: 1fr 1fr; } .form-grid > .c2, .form-grid > .c3 { grid-column: span 1; } .form-grid > .c4, .form-grid > .c6 { grid-column: span 2; } .form-grid > .full-m { grid-column: span 2; } }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; padding: 6px 0; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.check small { display: block; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 20px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.s-pending_quote { background: var(--warn-soft); color: var(--warn); }
.s-quoted { background: var(--info-soft); color: var(--info); }
.s-approved { background: var(--ok-soft); color: var(--ok); }
.s-approved_modified { background: var(--mod-soft); color: var(--mod); }
.s-denied { background: var(--bad-soft); color: var(--bad); }
.s-cancelled { background: #eef0f3; color: #6b7482; }
.s-completed { background: #e4f0ef; color: #13706a; }
.prio { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 7px; border-radius: 6px; }
.prio-urgent { background: var(--bad); color: #fff; }
.prio-low { background: #eef0f3; color: var(--ink-3); }
.badge { background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; min-width: 19px; height: 19px; border-radius: 10px; display: inline-grid; place-items: center; padding: 0 5px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; }
.empty { text-align: center; padding: 34px 16px; color: var(--ink-3); }
.empty svg { width: 40px; height: 40px; opacity: .45; margin-bottom: 6px; }

/* ---------- stats ---------- */
.stat { display: block; text-decoration: none; background: var(--panel); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); border: 1px solid var(--line-2); position: relative; overflow: hidden; }
.stat::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c, var(--accent)); }
.stat span { color: var(--ink-3); font-size: 13px; font-weight: 600; }
.stat b { display: block; font-size: 28px; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat small { display: block; margin-top: 2px; }
@media (max-width: 860px) { .stat b { font-size: 24px; } .stat { padding: 13px; } }

/* ---------- request list ---------- */
.rlist { display: flex; flex-direction: column; }
.ritem { display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; padding: 13px 4px; border-bottom: 1px solid var(--line-2); text-decoration: none; }
.ritem:last-child { border-bottom: 0; }
.ritem:hover { background: #fafbfc; }
.ritem .t { font-weight: 600; display: flex; align-items: center; gap: 8px; min-width: 0; }
.ritem .t span.title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ritem .meta { color: var(--ink-3); font-size: 13px; display: flex; gap: 6px 12px; flex-wrap: wrap; }
.ritem .right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.ritem .amt { font-weight: 600; font-variant-numeric: tabular-nums; font-size: 14px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filters input[type=search] { flex: 1 1 240px; }
.filters select { width: auto; flex: 0 1 220px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 1px solid var(--line); background: #fff; border-radius: 20px; padding: 7px 14px; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; }
.tabs button.on { background: var(--steel); color: #fff; border-color: var(--steel); }

/* ---------- items editor ---------- */
.items-ed { display: flex; flex-direction: column; gap: 10px; }
.item-row { display: grid; grid-template-columns: 30px 2.2fr 1.6fr 100px 100px 110px 40px; gap: 8px; align-items: end; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfd; }
.item-row .n { font-weight: 700; color: var(--ink-3); align-self: center; text-align: center; }
.item-row label.f > span { font-size: 12px; }
.item-row .rm { min-height: 42px; padding: 0; width: 40px; color: var(--bad); }
@media (max-width: 980px) {
  .item-row { grid-template-columns: 1fr 1fr 1fr; }
  .item-row .n { grid-column: 1 / 3; text-align: left; align-self: center; }
  .item-row .rm { grid-column: 3; grid-row: 1; justify-self: end; }
  .item-row .desc, .item-row .specs { grid-column: 1 / -1; }
}

/* ---------- tables ---------- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 11px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .n, .tbl th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tfoot td { font-weight: 700; border-top: 1px solid var(--line); border-bottom: 0; }
.tbl tr.zero td { color: var(--ink-3); text-decoration: line-through; }
.tbl tr.zero td:first-child { text-decoration: none; }
.tbl td .changed { color: var(--mod); font-weight: 700; }
.tbl input.num { max-width: 120px; margin-left: auto; display: block; }
.tbl-wrap { overflow-x: auto; margin: 0 -4px; }
@media (max-width: 700px) {
  .tbl.stack thead { display: none; }
  .tbl.stack, .tbl.stack tbody, .tbl.stack tr, .tbl.stack td, .tbl.stack tfoot { display: block; width: 100%; }
  .tbl.stack tr { padding: 10px 0; border-bottom: 1px solid var(--line-2); }
  .tbl.stack td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .tbl.stack td::before { content: attr(data-l); color: var(--ink-3); font-size: 13px; text-align: left; font-weight: 500; }
  .tbl.stack td[data-l="#"] { display: none; }
  .tbl.stack td.main { display: block; text-align: left; font-size: 15px; }
  .tbl.stack td.main::before { display: none; }
  .tbl.stack tfoot tr { border: 0; }
  .tbl.stack tfoot td::before { content: none; }
  .tbl.stack input.num { max-width: 140px; }
}

/* ---------- detail ---------- */
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px 18px; }
.kv div span { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); font-weight: 700; margin-bottom: 2px; }
.kv div b { font-weight: 600; }
.kv .wide { grid-column: 1 / -1; }
.prose { white-space: pre-wrap; }
.stepper { display: flex; gap: 0; margin: 6px 0 18px; }
.stepper div { flex: 1; text-align: center; position: relative; font-size: 12.5px; color: var(--ink-3); font-weight: 600; padding-top: 30px; }
.stepper div::before { content: ""; position: absolute; top: 9px; left: calc(50% + 14px); right: calc(-50% + 14px); height: 3px; background: var(--line); border-radius: 2px; }
.stepper div:last-child::before { display: none; }
.stepper i { position: absolute; top: 0; left: calc(50% - 11px); width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line); background: #fff; }
.stepper .done { color: var(--ink); }
.stepper .done i { background: var(--ok); border-color: var(--ok); }
.stepper .done::before { background: var(--ok); }
.stepper .cur { color: var(--accent); }
.stepper .cur i { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(232, 101, 10, .18); }
.stepper .fail i { background: var(--bad); border-color: var(--bad); }
.stepper .fail { color: var(--bad); }
.sig-box { border: 1px dashed var(--line); border-radius: 12px; padding: 10px; background: #fff; display: inline-block; }
.sig-box img { display: block; max-width: 280px; width: 100%; height: auto; }
.kv .verified, .verified { text-transform: none; letter-spacing: 0; display: inline-flex; align-items: center; gap: 6px; color: var(--ok); font-weight: 600; font-size: 13.5px; }
.verified svg { width: 18px; height: 18px; }
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 16px 26px; }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--ink-3)); box-shadow: 0 0 0 3px #fff; z-index: 1; }
.timeline li::after { content: ""; position: absolute; left: 10px; top: 12px; bottom: -4px; width: 2px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline b { font-weight: 600; }
.timeline .when { color: var(--ink-3); font-size: 12.5px; }
.timeline .det { white-space: pre-wrap; color: var(--ink-2); font-size: 13.5px; margin-top: 2px; }
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.file { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; text-decoration: none; display: flex; flex-direction: column; position: relative; }
.file .th { height: 96px; background: #f2f4f7 center/cover no-repeat; display: grid; place-items: center; color: var(--ink-3); font-weight: 700; font-size: 13px; }
.file .nm { padding: 7px 9px; font-size: 12.5px; }
.file .nm b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file .x { position: absolute; top: 5px; right: 5px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .55); color: #fff; cursor: pointer; font-size: 16px; line-height: 1; }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(to top, var(--bg) 75%, transparent); padding: 16px 0 40px; margin-top: 8px; z-index: 5; }
@media (max-width: 860px) { .sticky-actions { bottom: calc(var(--tabbar-h) + var(--safe-b)); } }

/* decision */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.seg label { border: 2px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; background: #fff; display: flex; gap: 10px; align-items: flex-start; }
.seg label input { margin-top: 3px; accent-color: var(--accent); width: 18px; height: 18px; flex: none; }
.seg label b { display: block; }
.seg label small { display: block; }
.seg label.on-approve { border-color: var(--ok); background: var(--ok-soft); }
.seg label.on-modify { border-color: var(--mod); background: var(--mod-soft); }
.seg label.on-deny { border-color: var(--bad); background: var(--bad-soft); }
@media (max-width: 700px) { .seg { grid-template-columns: 1fr; } }
.sigpad { position: relative; border: 2px dashed #c6ccd5; border-radius: 12px; background: #fff; touch-action: none; height: 190px; }
.sigpad canvas { width: 100%; height: 100%; display: block; border-radius: 10px; cursor: crosshair; }
.sigpad .hint { position: absolute; left: 16px; bottom: 34px; right: 16px; border-bottom: 1.5px solid #c6ccd5; color: var(--ink-3); font-size: 12px; pointer-events: none; padding-bottom: 2px; }
.sigpad .hint::before { content: "✕"; margin-right: 8px; }
.sigpad.signed .hint { color: transparent; }
.total-big { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px 70px;
  background: radial-gradient(1000px 500px at 20% -10%, #2f3a4b 0%, transparent 60%), linear-gradient(160deg, #1d2430 0%, #141a23 100%); }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 22px; padding: 26px 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.auth-card .logo { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; margin-bottom: 20px; }
.auth-card .logo img { width: 128px; height: 128px; border-radius: 16px; }
.auth-card .logo b { font-size: 20px; display: block; }
.users-pick { display: flex; flex-direction: column; gap: 8px; max-height: 52vh; overflow: auto; margin: 0 -4px; padding: 0 4px; }
.users-pick button { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; text-align: left; }
.users-pick button:hover { border-color: var(--accent); background: var(--accent-soft); }
.users-pick button small { display: block; }
.pin-who { text-align: center; margin-bottom: 8px; }
.pin-who .avatar { width: 58px; height: 58px; font-size: 21px; margin: 0 auto 8px; }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 18px 0 8px; }
.pin-dots i { width: 15px; height: 15px; border-radius: 50%; border: 2px solid #b8c0cb; transition: all .12s; }
.pin-dots i.on { background: var(--steel); border-color: var(--steel); }
.pin-dots.err i { border-color: var(--bad); animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.pin-msg { text-align: center; min-height: 22px; font-size: 13.5px; color: var(--bad); margin-bottom: 6px; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 300px; margin: 0 auto; }
.keypad button { height: 62px; border-radius: 16px; border: 1px solid var(--line); background: #f7f8fa; font-size: 24px; font-weight: 600; cursor: pointer; user-select: none; display: grid; place-items: center; }
.keypad button:active { background: #e6e9ee; }
.keypad button.fn { background: transparent; border-color: transparent; font-size: 14px; color: var(--ink-2); }
.keypad button.fn svg { width: 30px; height: 30px; }
.keypad button.bio { color: var(--accent); }
.link-btn { background: none; border: 0; color: var(--ink-3); cursor: pointer; text-decoration: underline; font-size: 13.5px; padding: 6px; }

/* ---------- modal & toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 20, 28, .5); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .15s; }
.modal { background: #fff; border-radius: 18px; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto; padding: 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.modal h2 { margin-bottom: 14px; font-size: 19px; }
.modal .actions { margin-top: 18px; }
@media (max-width: 700px) { .modal-bg { align-items: flex-end; padding: 0; } .modal { border-radius: 18px 18px 0 0; max-height: 92vh; padding-bottom: calc(22px + var(--safe-b)); animation: up .2s; } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: .5; } }
#toast { position: fixed; left: 50%; top: 18px; transform: translateX(-50%) translateY(calc(-100% - 40px)); background: var(--steel); color: #fff; padding: 11px 18px; border-radius: 12px; z-index: 200;
  font-weight: 500; box-shadow: 0 8px 30px rgba(0, 0, 0, .25); transition: transform .25s, opacity .25s; opacity: 0; visibility: hidden; max-width: calc(100vw - 32px); }
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; visibility: visible; }
#toast.err { background: var(--bad); }
#toast.ok { background: var(--ok); }
.loading { padding: 40px; text-align: center; color: var(--ink-3); }
.spin { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.note { background: var(--warn-soft); color: #7a5313; border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.note.info { background: var(--info-soft); color: #1e4c80; }
.note.bad { background: var(--bad-soft); color: #8e2a1f; }
.users-tbl td .act { display: flex; gap: 6px; justify-content: flex-end; }
.audit-row { padding: 10px 0; border-bottom: 1px solid var(--line-2); font-size: 14px; display: grid; grid-template-columns: 150px 160px 1fr; gap: 10px; }
.audit-row .a { font-weight: 600; }
@media (max-width: 700px) { .audit-row { grid-template-columns: 1fr; gap: 1px; } }
