/* Mitō design tokens — extracted from packages/web/src/index.css (Tailwind v4
   @theme). Dark admin theme, border-radius 0 everywhere, tinted-square badges.
   Handwritten utility + component classes; no build step. */

:root {
  --background: oklch(0.145 0 0);
  --foreground: oklch(0.985 0 0);
  --card: oklch(0.205 0 0);
  --card-foreground: oklch(0.985 0 0);
  --primary: oklch(0.922 0 0);
  --primary-foreground: oklch(0.205 0 0);
  --secondary: oklch(0.269 0 0);
  --muted: oklch(0.269 0 0);
  --muted-foreground: oklch(0.708 0 0);
  --accent: oklch(0.371 0 0);
  --destructive: oklch(0.704 0.191 22.216);
  --border: oklch(1 0 0 / 10%);
  --input: oklch(1 0 0 / 15%);
  --ring: oklch(0.556 0 0);

  --green-400: #4ade80; --green-500: #22c55e;
  --red-400: #f87171;   --red-500: #ef4444;
  --yellow-400: #facc15;--yellow-500: #eab308;
  --blue-400: #60a5fa;  --blue-500: #3b82f6;
  --purple-400: #c084fc;--purple-500: #a855f7;
  --orange-400: #fb923c;--orange-500: #f97316;
}

/* ---- base ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; border-radius: 0 !important; }
* { border-color: var(--border); }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
}
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: none; }
button { font: inherit; color: inherit; }

/* ---- typography (Mitō rules: xl+ regular, lg medium) --------------------- */
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; font-weight: 500; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; font-weight: 400; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; font-weight: 400; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; font-weight: 400; }
.font-medium { font-weight: 500; }
.text-muted { color: var(--muted-foreground); }
.text-pos { color: var(--green-400); }
.text-neg { color: var(--red-400); }
.text-warn { color: var(--yellow-400); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.tabular { font-variant-numeric: tabular-nums; }
.uppercase { text-transform: uppercase; letter-spacing: 0.05em; }

/* ---- layout -------------------------------------------------------------- */
.container { max-width: 72rem; margin: 0 auto; padding: 0 1rem; }
.main { padding-top: 1.5rem; padding-bottom: 3rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.items-baseline { align-items: baseline; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 0.25rem; } .gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; } .gap-6 { gap: 1.5rem; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mt-2 { margin-top: 0.5rem; } .mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; } .mt-8 { margin-top: 2rem; }
.mb-2 { margin-bottom: 0.5rem; } .mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.w-full { width: 100%; }
@media (max-width: 40rem) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
}
@media (min-width: 40.0625rem) and (max-width: 56rem) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---- nav ----------------------------------------------------------------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--background);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between;
  min-height: 3.5rem; gap: 1rem; }
.nav-left { display: flex; align-items: center; gap: 1.25rem; min-width: 0; }
.wordmark { font-size: 1rem; font-weight: 500; letter-spacing: 0.18em; }
.nav-links { display: flex; align-items: center; gap: 0.25rem;
  overflow-x: auto; }
.nav-link {
  white-space: nowrap; flex-shrink: 0;
  padding: 0.5rem 1rem; font-size: 0.875rem;
  color: var(--foreground);
  transition: background-color 0.15s;
}
.nav-link:hover { background: oklch(0.269 0 0 / 50%); }
.nav-link.active { background: var(--muted); }
.nav-actions { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }

/* ---- cards & stats ------------------------------------------------------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 1.25rem;
}
.card-title { font-size: 1.125rem; font-weight: 500; margin-bottom: 0.75rem; }
.stat { display: flex; flex-direction: column; gap: 0.125rem; }
.stat-label { font-size: 0.75rem; color: var(--muted-foreground);
  text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-size: 1.5rem; font-weight: 400;
  font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 0.875rem; color: var(--muted-foreground); }

/* ---- tables -------------------------------------------------------------- */
.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.table th {
  text-align: left; font-weight: 500;
  color: var(--muted-foreground);
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); }
.table tr:last-child td { border-bottom: none; }
.table .num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table tbody tr:hover { background: oklch(1 0 0 / 3%); }
.row-highlight td { background: oklch(1 0 0 / 6%); }
.row-warn td { background: rgb(239 68 68 / 0.1); }
.table-wrap { overflow-x: auto; }

/* ---- badges (tinted squares, per Mitō convention) ------------------------ */
.badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  font-size: 0.75rem; line-height: 1rem; font-weight: 500;
  white-space: nowrap;
  background: var(--muted); color: var(--muted-foreground);
}
.badge-green  { background: rgb(34 197 94 / 0.15);  color: var(--green-400); }
.badge-red    { background: rgb(239 68 68 / 0.15);  color: var(--red-400); }
.badge-yellow { background: rgb(234 179 8 / 0.15);  color: var(--yellow-400); }
.badge-blue   { background: rgb(59 130 246 / 0.15); color: var(--blue-400); }
.badge-purple { background: rgb(168 85 247 / 0.15); color: var(--purple-400); }
.badge-orange { background: rgb(249 115 22 / 0.15); color: var(--orange-400); }
.badge-neutral { background: var(--muted); color: var(--muted-foreground); }

/* ---- buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem; font-weight: 500;
  background: transparent;
  border: 1px solid var(--input);
  color: var(--foreground);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.btn:hover { background: var(--accent); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 0.25rem 0.75rem; }
.btn-primary { background: var(--primary); color: var(--primary-foreground);
  border-color: transparent; }
.btn-primary:hover { background: oklch(0.85 0 0); }
.btn-outline-destructive {
  border-color: var(--destructive);
  color: var(--destructive);
}
.btn-outline-destructive:hover { background: var(--destructive); color: #fff; }
.btn-ghost { background: transparent; border: none; padding: 0.5rem 0.75rem;
  font-size: 0.875rem; color: var(--muted-foreground); cursor: pointer; }
.btn-ghost:hover { color: var(--foreground); background: oklch(0.269 0 0 / 50%); }

/* ---- forms --------------------------------------------------------------- */
.field { margin-bottom: 1rem; }
.label { display: block; font-size: 0.875rem; font-weight: 500;
  margin-bottom: 0.375rem; }
.input, select.input, textarea.input {
  display: block; width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem; font-family: inherit;
  background: transparent;
  border: 1px solid var(--input);
  color: var(--foreground);
}
.input::placeholder { color: var(--muted-foreground); }
.input:focus { outline: 2px solid var(--ring); outline-offset: -1px; }
input[type="file"].input { padding: 0.375rem 0.75rem; }
.alert-error {
  background: rgb(239 68 68 / 0.15); color: var(--red-400);
  padding: 0.5rem 0.75rem; font-size: 0.875rem; margin-bottom: 1rem;
}
.alert-success {
  background: rgb(34 197 94 / 0.15); color: var(--green-400);
  padding: 0.5rem 0.75rem; font-size: 0.875rem; margin-bottom: 1rem;
}

/* ---- login --------------------------------------------------------------- */
.login-wrap { display: flex; justify-content: center; padding-top: 10vh; }
.login-card { width: 100%; max-width: 22rem; }
.login-card h1 { margin-bottom: 1.25rem; }

/* ---- footer -------------------------------------------------------------- */
.footer {
  border-top: 1px solid var(--border);
  padding-top: 0.75rem; padding-bottom: 1.5rem;
  font-size: 0.75rem; color: var(--muted-foreground);
}
.footer-freshness { display: flex; align-items: center; gap: 0.5rem;
  flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.freshness-item.ok { color: var(--muted-foreground); }
.freshness-item.warn { color: var(--yellow-400); }
.freshness-item.missing { color: var(--muted-foreground); opacity: 0.6; }
.footer .dot { opacity: 0.5; }
.footer-notes { margin-top: 0.375rem; opacity: 0.8; }
