/* =====================================================================
   Woody - site stylesheet (custom, no framework)
   Brand: ink #1a1a1a, cream #fffcf0, woodpecker yellow #ffcc00,
          crest red #e8321f, salmon #ff9a66. Font: Lato.
   Light by default, dark when the device asks for it.
   ===================================================================== */

:root {
  --ink: #1a1a1a;
  --cream: #fffcf0;
  --yellow: #ffcc00;
  --yellow-strong: #e6b800;
  --crest: #e8321f;
  --salmon: #ff9a66;

  --bg: #f7f5ee;
  --surface: #ffffff;
  --surface-2: #f1eee4;
  --text: #1a1a1a;
  --text-muted: #5f5b52;
  --border: #e3dfd2;
  --focus: #1a1a1a;
  --ok: #1e7a44;
  --warn: #9a6400;
  --danger: #b3261e;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(26,26,26,.06), 0 4px 16px rgba(26,26,26,.06);
  --gap: 16px;
  --maxw: 1120px;
  --topbar-h: 60px;
  --tabbar-h: 64px;
  --font: "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141414;
    --surface: #1f1f1f;
    --surface-2: #262626;
    --text: #fffcf0;
    --text-muted: #b9b5a8;
    --border: #333333;
    --focus: #ffcc00;
    --ok: #5cc98a;
    --warn: #f0b64a;
    --danger: #ff7a70;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(24px, 4vw, 32px); font-weight: 900; letter-spacing: -.01em; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
p { margin: 0 0 1em; }
.muted { color: var(--text-muted); }
.mono { font-family: var(--mono); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--topbar-h);
  background: var(--ink); color: var(--cream);
  padding-top: env(safe-area-inset-top);
}
.topbar__inner {
  max-width: var(--maxw); height: var(--topbar-h); margin: 0 auto; padding: 0 16px;
  display: flex; align-items: center; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 900; font-size: 20px; letter-spacing: .01em; }
.brand img { width: 30px; height: auto; }   /* outlined mark: cream edge keeps it readable on ink */
.nav { display: flex; gap: 4px; flex: 1; }
.nav a {
  text-decoration: none; padding: 8px 12px; border-radius: 999px;
  color: #d9d5c8; font-weight: 700; font-size: 15px;
}
.nav a:hover { color: var(--cream); background: rgba(255,252,240,.08); }
.nav a.active { color: var(--ink); background: var(--yellow); }
.topbar__actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 999px;
  background: transparent; border: 0; color: inherit; cursor: pointer; position: relative;
}
.icon-btn:hover { background: rgba(255,252,240,.1); }
.icon-btn svg { width: 22px; height: 22px; }
.badge-dot { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--crest); }

/* ---------- page ---------- */
.page { max-width: var(--maxw); margin: 0 auto; padding: 24px 16px 48px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 0; }

/* ---------- mobile tab bar (installed PWA feel) ---------- */
.tabbar { display: none; }
@media (max-width: 760px) {
  .nav { display: none; }
  .page { padding-bottom: calc(var(--tabbar-h) + 32px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface); border-top: 1px solid var(--border);
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    font-size: 11px; font-weight: 700; color: var(--text-muted); text-decoration: none;
  }
  .tabbar a svg { width: 22px; height: 22px; }
  .tabbar a.active { color: var(--text); }
  .tabbar a.capture {
    width: 56px; height: 56px; margin: -22px auto 0; border-radius: 50%;
    background: var(--yellow); color: var(--ink); justify-content: center;
    box-shadow: 0 4px 14px rgba(0,0,0,.25);
  }
  .tabbar a.capture svg { width: 26px; height: 26px; }
}

/* ---------- surfaces ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.card + .card { margin-top: var(--gap); }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.grid { display: grid; gap: var(--gap); }
.grid--stats { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.stat__label { font-size: 13px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.stat__value { font-size: 28px; font-weight: 900; margin-top: 4px; font-variant-numeric: tabular-nums; }
.empty { text-align: center; padding: 40px 16px; }
.empty img { width: 72px; margin: 0 auto 12px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 999px;
  border: 1px solid transparent; font: inherit; font-weight: 700; font-size: 15px;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn svg { width: 18px; height: 18px; }
.btn--primary { background: var(--yellow); color: var(--ink); }
.btn--primary:hover { background: var(--yellow-strong); }
.btn--dark { background: var(--ink); color: var(--cream); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn--ghost:hover { background: var(--surface-2); }
.btn--danger { background: var(--danger); color: #fff; }
.btn[disabled], .btn.aspNetDisabled { opacity: .5; cursor: not-allowed; }
.btn--block { width: 100%; }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 700; font-size: 14px; }
.field .hint { font-size: 13px; color: var(--text-muted); }
.input, .field input[type=text], .field input[type=email], .field input[type=password], .field input[type=number],
.field input[type=date], .field input[type=tel], .field select, .field textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit;
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
.field .error, .validation { color: var(--danger); font-size: 13px; font-weight: 700; }
.form-row { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* ---------- alerts ---------- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid; margin-bottom: 16px; font-weight: 700; }
.alert--ok { color: var(--ok); border-color: currentColor; background: color-mix(in srgb, var(--ok) 8%, transparent); }
.alert--warn { color: var(--warn); border-color: currentColor; background: color-mix(in srgb, var(--warn) 8%, transparent); }
.alert--danger { color: var(--danger); border-color: currentColor; background: color-mix(in srgb, var(--danger) 8%, transparent); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: 15px; }
table.data th, table.data td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); background: var(--surface-2); }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tbody tr:hover { background: var(--surface-2); }

/* ---------- status pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; border: 1px solid var(--border); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill--draft { color: var(--text-muted); }
.pill--submitted { color: var(--warn); }
.pill--approved, .pill--posted { color: var(--ok); }
.pill--rejected, .pill--failed { color: var(--danger); }

/* ---------- footer ---------- */
.footer { max-width: var(--maxw); margin: 0 auto; padding: 24px 16px; font-size: 13px; color: var(--text-muted); display: flex; gap: 16px; flex-wrap: wrap; }
.footer a { color: inherit; }
@media (max-width: 760px) { .footer { display: none; } }

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

/* ---------- sign-in pages (Auth.master) ---------- */
.auth-body { background: var(--ink); }
@media (prefers-color-scheme: light) {
  .auth-body { background: radial-gradient(circle at 50% 0%, #2a2a2a 0%, #1a1a1a 60%); }
}
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px; gap: 20px; }
.auth__brand { display: flex; align-items: center; gap: 10px; color: var(--cream); text-decoration: none; font-weight: 900; font-size: 26px; }
.auth__brand img { width: 38px; height: auto; }
.auth__card { width: 100%; max-width: 420px; padding: 28px 24px; }
.auth__card h1 { font-size: 24px; margin-bottom: 6px; }
.auth__card .lede { color: var(--text-muted); margin-bottom: 20px; }
.auth__foot { display: flex; gap: 16px; font-size: 13px; margin: 0; }
.auth__foot a { color: #b9b5a8; }
.auth__links { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; font-size: 14px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 15px; margin: 4px 0 18px; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }
.code-input { font-size: 24px !important; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.qr { display: grid; place-items: center; padding: 12px; background: #fff; border-radius: var(--radius-sm); border: 1px solid var(--border); margin: 8px 0 12px; }
.qr img { width: 200px; height: 200px; image-rendering: pixelated; }
.secret { font-family: var(--mono); font-size: 15px; letter-spacing: .08em; word-break: break-all; background: var(--surface-2); padding: 10px 12px; border-radius: var(--radius-sm); }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-family: var(--mono); font-size: 15px; background: var(--surface-2); padding: 12px; border-radius: var(--radius-sm); margin: 12px 0 16px; }
.steps { padding-left: 20px; margin: 0 0 16px; }
.steps li { margin-bottom: 6px; }
.topbar__user { display: flex; align-items: center; gap: 8px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--yellow); color: var(--ink); display: grid; place-items: center; font-weight: 900; font-size: 13px; }
.linkbtn { background: none; border: 0; color: inherit; font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; padding: 8px 10px; border-radius: 999px; }
.linkbtn:hover { background: rgba(255,252,240,.1); }
