/* PigBal UI: design tokens and shared components (sign-in pages + v2 app). */
:root {
  --font: "Public Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;

  --bg: #f5f6f4;
  --surface: #ffffff;
  --surface-2: #f0f2ee;
  --ink: #17201b;
  --ink-2: #4a554e;
  --muted: #6c7770;
  --line: #e1e5df;
  --line-strong: #c9d0c8;

  --accent: #146c4b;
  --accent-ink: #ffffff;
  --accent-soft: #e3f1ea;
  --accent-strong: #0e5237;
  --brand: #a3171c;

  --warn: #9a5b00;
  --warn-soft: #fdf1dc;
  --danger: #b42318;
  --danger-soft: #fdeceb;
  --ok: #146c4b;

  --chart-1: #146c4b; --chart-2: #3b82c4; --chart-3: #d08a1e; --chart-4: #8a5cc2; --chart-5: #c4473b; --chart-6: #4aa3a0;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgb(16 24 20 / .06), 0 4px 16px rgb(16 24 20 / .05);
  --shadow-lg: 0 10px 40px rgb(16 24 20 / .16);
  --focus: 0 0 0 3px rgb(20 108 75 / .25);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1412; --surface: #161d1a; --surface-2: #1c2521; --ink: #e8eee9; --ink-2: #bcc7c0; --muted: #8e9b93;
    --line: #26312c; --line-strong: #34413a; --accent: #3fb886; --accent-ink: #06140e; --accent-soft: #163428; --accent-strong: #63cf9f;
    --brand: #ff6b6b; --warn: #f0b354; --warn-soft: #33270f; --danger: #ff7a6e; --danger-soft: #3a1714;
    --chart-1: #3fb886; --chart-2: #6aa8e0; --chart-3: #e3a948; --chart-4: #ad8ae0; --chart-5: #ea7a6e; --chart-6: #6cc5c1;
    --shadow: 0 1px 2px rgb(0 0 0 / .3); --shadow-lg: 0 10px 40px rgb(0 0 0 / .5); --focus: 0 0 0 3px rgb(63 184 134 / .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1412; --surface: #161d1a; --surface-2: #1c2521; --ink: #e8eee9; --ink-2: #bcc7c0; --muted: #8e9b93;
  --line: #26312c; --line-strong: #34413a; --accent: #3fb886; --accent-ink: #06140e; --accent-soft: #163428; --accent-strong: #63cf9f;
  --brand: #ff6b6b; --warn: #f0b354; --warn-soft: #33270f; --danger: #ff7a6e; --danger-soft: #3a1714;
  --chart-1: #3fb886; --chart-2: #6aa8e0; --chart-3: #e3a948; --chart-4: #ad8ae0; --chart-5: #ea7a6e; --chart-6: #6cc5c1;
  --shadow: 0 1px 2px rgb(0 0 0 / .3); --shadow-lg: 0 10px 40px rgb(0 0 0 / .5); --focus: 0 0 0 3px rgb(63 184 134 / .35);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font: 14px/1.5 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); }

.wordmark { font-weight: 800; font-size: 18px; letter-spacing: -.02em; color: var(--ink); text-decoration: none; white-space: nowrap; }
.wordmark span { color: var(--brand); }
.wordmark small { font-weight: 600; font-size: 11px; color: var(--muted); margin-left: 6px; letter-spacing: 0; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-weight: 600; font-size: 13px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn[disabled] { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--danger); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn.block { width: 100%; height: 40px; }
.btn[hidden] { display: none; }

/* form controls */
.input, .select, .field input:not([type="checkbox"]):not([type="radio"]), .field select { height: 36px; width: 100%; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); }
.input:focus, .select:focus, .field input:focus, .field select:focus { border-color: var(--accent); box-shadow: var(--focus); outline: none; }
.field { display: grid; gap: 5px; margin-bottom: 14px; }
.field > label { font-weight: 600; font-size: 13px; }
.field .help, .help { color: var(--muted); font-size: 12px; }
.help ul { margin: 4px 0 0; padding-left: 18px; }
.errorlist { list-style: none; margin: 0; padding: 0; color: var(--danger); font-size: 12.5px; font-weight: 600; }
.alert { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger); font-weight: 600; font-size: 13px; margin-bottom: 14px; }
.alert.ok { background: var(--accent-soft); color: var(--accent-strong); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.badge { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 99px; font-size: 11px; font-weight: 700; background: var(--surface-2); color: var(--ink-2); }
.badge.accent { background: var(--accent-soft); color: var(--accent-strong); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }

/* auth pages */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.auth .card { width: min(420px, 100%); padding: 28px; }
.auth h1 { font-size: 22px; margin: 18px 0 4px; }
.auth .sub { color: var(--muted); margin: 0 0 20px; }
.auth .links { margin-top: 18px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13px; }
