/* Z4 NFC — base design system. Flat: hairline borders, solid fills, no gradients, no glows. */
:root {
  color-scheme: light;
  --bg: #f6f5f2; --s1: #ffffff; --s2: #f0efeb; --s3: #e7e5df;
  --line: #e3e1db; --line2: #cfccc4;
  --tx: #141414; --tx2: #55534e; --tx3: #8a877f;
  --ink: #141414; --ink-fg: #ffffff;
  --ac: #2b4cff; --ac-soft: #e8ecff; --ac-ink: #ffffff;
  --ok: #17803d; --ok-soft: #e3f3e8;
  --er: #d63b3b; --er-soft: #fbe9e9;
  --wn: #b26a00; --wn-soft: #fbf0dc;
  --r: 12px; --r-sm: 8px; --r-xs: 6px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d0d0e; --s1: #151516; --s2: #1b1b1d; --s3: #252528;
    --line: #28282c; --line2: #38383e;
    --tx: #f3f3f1; --tx2: #a9a8a3; --tx3: #78776f;
    --ink: #f3f3f1; --ink-fg: #111111;
    --ac: #7189ff; --ac-soft: #1b2142; --ac-ink: #0d0d0e;
    --ok: #4ac27a; --ok-soft: #14291d; --er: #f06a6a; --er-soft: #321717; --wn: #e0a43a; --wn-soft: #2e2410;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0d0e; --s1: #151516; --s2: #1b1b1d; --s3: #252528;
  --line: #28282c; --line2: #38383e;
  --tx: #f3f3f1; --tx2: #a9a8a3; --tx3: #78776f;
  --ink: #f3f3f1; --ink-fg: #111111;
  --ac: #7189ff; --ac-soft: #1b2142; --ac-ink: #0d0d0e;
  --ok: #4ac27a; --ok-soft: #14291d; --er: #f06a6a; --er-soft: #321717; --wn: #e0a43a; --wn-soft: #2e2410;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--tx); font: 14.5px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3 { letter-spacing: -.025em; line-height: 1.15; font-weight: 700; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--ac); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ac); outline-offset: 2px; }
::selection { background: var(--ink); color: var(--ink-fg); }
.ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic.sm { width: 15px; height: 15px; }
.ic.lg { width: 22px; height: 22px; }
.ic.xl { width: 32px; height: 32px; stroke-width: 1.75; }
.muted { color: var(--tx3); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.eyebrow { font: 600 11px/1 var(--mono); letter-spacing: .09em; text-transform: uppercase; color: var(--tx3); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.num { font-variant-numeric: tabular-nums; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 15px;
  border-radius: var(--r-sm); border: 1px solid var(--line2); background: var(--s1); color: var(--tx);
  font-weight: 600; font-size: 14px; white-space: nowrap; transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--s2); text-decoration: none; }
.btn:active { background: var(--s3); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.pri { background: var(--ink); border-color: var(--ink); color: var(--ink-fg); }
.btn.pri:hover { opacity: .88; background: var(--ink); }
.btn.acc { background: var(--ac); border-color: var(--ac); color: var(--ac-ink); }
.btn.acc:hover { opacity: .9; background: var(--ac); }
.btn.dng { color: var(--er); }
.btn.dng:hover { background: var(--er-soft); border-color: var(--er); }
.btn.dng.solid { background: var(--er); border-color: var(--er); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--s2); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; }
.btn.lg { height: 46px; padding: 0 20px; font-size: 15px; }
.btn.block { width: 100%; }
.btn.icon { width: 34px; height: 34px; padding: 0; background: transparent; border-color: transparent; color: var(--tx3); }
.btn.icon:hover { background: var(--s2); color: var(--tx); }
.btn.icon.dng:hover { background: var(--er-soft); color: var(--er); }

/* Forms */
.field { display: grid; gap: 6px; }
.field > label, .lbl { font-size: 13px; font-weight: 600; }
.hint { font-size: 12.5px; color: var(--tx3); }
.inp {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line2); border-radius: var(--r-sm);
  background: var(--s1); color: var(--tx); outline: none; transition: border-color .12s;
}
textarea.inp { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.inp::placeholder { color: var(--tx3); }
.inp:hover { border-color: var(--tx3); }
.inp:focus { border-color: var(--ac); outline: 2px solid var(--ac-soft); outline-offset: 0; }
input[type="color"].inp { padding: 3px; cursor: pointer; }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .cols2 { grid-template-columns: 1fr; } }
.form { display: grid; gap: 16px; }

/* Misc */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 600; background: var(--s3); color: var(--tx2); white-space: nowrap; }
.badge.blue { background: var(--ac-soft); color: var(--ac); }
.badge.green { background: var(--ok-soft); color: var(--ok); }
.badge.red { background: var(--er-soft); color: var(--er); }
.badge.amber { background: var(--wn-soft); color: var(--wn); }
.card { background: var(--s1); border: 1px solid var(--line); border-radius: var(--r); }
kbd { font: 600 11px var(--mono); padding: 2px 6px; border-radius: 5px; background: var(--s3); border: 1px solid var(--line2); color: var(--tx2); }
.spinner { width: 24px; height: 24px; border: 2px solid var(--line2); border-top-color: var(--tx); border-radius: 50%; animation: spin .7s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.skel { background: var(--s2); border-radius: var(--r-sm); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } }
@keyframes fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

.switch { position: relative; width: 36px; height: 20px; flex: none; display: inline-block; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--line2); transition: background .15s; }
.switch i::after { content: ""; position: absolute; width: 16px; height: 16px; top: 2px; left: 2px; border-radius: 50%; background: #fff; transition: transform .15s var(--ease); }
.switch input:checked + i { background: var(--ink); }
.switch input:checked + i::after { transform: translateX(16px); background: var(--ink-fg); }

/* Toasts */
#toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 300; display: grid; gap: 8px; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { display: flex; align-items: center; gap: 10px; background: var(--ink); color: var(--ink-fg); padding: 11px 16px; border-radius: var(--r-sm); font-size: 14px; font-weight: 500; animation: pop .2s var(--ease); }
.toast.error { background: var(--er); color: #fff; }

/* Modal */
.mback { position: fixed; inset: 0; z-index: 120; background: rgba(10, 10, 10, .55); display: flex; align-items: flex-start; justify-content: center; padding: 7vh 16px 16px; overflow-y: auto; animation: fade .12s; }
.modal { width: 100%; max-width: 480px; padding: 24px; animation: pop .2s var(--ease); }
.modal.wide { max-width: 560px; }
.modal h2 { font-size: 20px; }
.modal .sub { color: var(--tx3); margin-top: 4px; font-size: 14px; }
.modal .form { margin-top: 18px; }
.macts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
