/* Shared visual system for the cabinet — see DESIGN.md. */
:root {
  color-scheme: light dark;
  --bg: oklch(0.980 0.004 250);
  --surface: oklch(1 0 0);
  --surface-sunken: oklch(0.965 0.005 250);
  --line: oklch(0.905 0.006 250);
  --ink: oklch(0.235 0.018 255);
  --ink-muted: oklch(0.505 0.016 255);
  --accent: oklch(0.505 0.135 258);
  --accent-ink: oklch(0.40 0.13 258);
  --accent-wash: oklch(0.505 0.135 258 / 0.08);
  --on-accent: oklch(1 0 0);
  --money: oklch(0.55 0.12 72);
  --ok: oklch(0.50 0.11 155);
  --warn: oklch(0.58 0.11 75);
  --danger: oklch(0.505 0.175 27);
  --danger-wash: oklch(0.505 0.175 27 / 0.10);
  --shadow: 0 1px 2px oklch(0.235 0.018 255 / 0.06), 0 8px 24px oklch(0.235 0.018 255 / 0.06);
  --radius: 12px;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --z-dialog: 30;
  --z-toast: 40;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: oklch(0.175 0.012 258);
    --surface: oklch(0.215 0.014 258);
    --surface-sunken: oklch(0.245 0.014 258);
    --line: oklch(0.315 0.014 258);
    --ink: oklch(0.955 0.005 258);
    --ink-muted: oklch(0.735 0.012 258);
    --accent: oklch(0.72 0.12 258);
    --accent-ink: oklch(0.80 0.10 258);
    --accent-wash: oklch(0.72 0.12 258 / 0.14);
    --on-accent: oklch(0.18 0.012 258);
    --money: oklch(0.82 0.11 78);
    --ok: oklch(0.74 0.13 158);
    --warn: oklch(0.79 0.12 78);
    --danger: oklch(0.70 0.16 27);
    --danger-wash: oklch(0.70 0.16 27 / 0.14);
    --shadow: 0 1px 2px oklch(0 0 0 / 0.4), 0 10px 30px oklch(0 0 0 / 0.35);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh;
  background: var(--bg); color: var(--ink);
  font: 400 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-variant-numeric: tabular-nums;
}
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; font-variant-numeric: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---- brand ---------------------------------------------------------- */
/* The mark is NooLogic's own artwork; the wordmark is set in text so it keeps
   its contrast in both themes (the supplied lockup has it in white). */
.brand {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 0.9375rem; font-weight: 600; letter-spacing: -0.01em;
  text-decoration: none; color: inherit;
}
.brand .mark { height: 22px; width: auto; flex: none; }
.brand .sub { color: var(--ink-muted); font-weight: 400; }

/* ---- buttons -------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 0 15px;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface); font-size: 0.875rem; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: background 150ms var(--ease), border-color 150ms var(--ease);
}
.btn:hover:not(:disabled) { background: var(--surface-sunken); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn-danger { color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger-wash); }
.btn-sm { min-height: 31px; padding: 0 10px; font-size: 0.8125rem; }
.btn-block { width: 100%; min-height: 46px; font-size: 0.9375rem; font-weight: 600; }
.btn-quiet { border-color: transparent; background: transparent; color: var(--ink-muted); }
.btn-quiet:hover:not(:disabled) { background: var(--surface-sunken); color: var(--ink); }

/* ---- fields --------------------------------------------------------- */
.field {
  width: 100%; min-height: 42px; padding: 0 13px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 9px;
  transition: border-color 150ms var(--ease);
}
.field:hover { border-color: var(--ink-muted); }
.field::placeholder { color: var(--ink-muted); }
label.stack { display: block; font-size: 0.8125rem; color: var(--ink-muted); margin-bottom: 14px; }
label.stack .field { margin-top: 5px; }

/* ---- dialog --------------------------------------------------------- */
dialog {
  width: min(26rem, calc(100vw - 32px));
  padding: 22px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
  z-index: var(--z-dialog);
}
dialog::backdrop { background: oklch(0.235 0.018 255 / 0.4); }
dialog[open] { animation: rise 160ms var(--ease); }
dialog h2 { font-size: 1.0625rem; font-weight: 600; margin: 0 0 4px; }
dialog p { color: var(--ink-muted); font-size: 0.875rem; margin: 0 0 16px; }
dialog .row-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ---- toast ---------------------------------------------------------- */
.toast {
  position: fixed; inset: auto 16px 16px; margin: 0 auto; width: fit-content;
  max-width: calc(100vw - 32px);
  padding: 11px 16px; border-radius: 9px; z-index: var(--z-toast);
  background: var(--ink); color: var(--bg); font-size: 0.875rem;
  box-shadow: var(--shadow); animation: rise 160ms var(--ease);
}
.toast.bad { background: var(--danger); color: oklch(1 0 0); }

.error { color: var(--danger); font-size: 0.875rem; margin: 12px 0 0; }
.muted { color: var(--ink-muted); }

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