:root {
  --ink: #0f172a;
  --muted: #5b6677;
  --line: #e3e8ec;
  --ground: #f4f6f7;
  --card: #ffffff;
  --brand: #0b6b4d;
  --brand-dark: #0b3d2b;
  --brand-soft: #e7f4ee;
  --brand-ink: #0b5c42;
  --red: #b42318;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: var(--ground);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand-ink); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.top {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
  background: var(--card); border-bottom: 1px solid var(--line); padding: 10px 24px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; text-decoration: none; color: var(--ink); }
.mark {
  width: 34px; height: 34px; border-radius: 9px; background: var(--brand-dark); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px;
}
.mark b { color: #5bd69a; font-weight: 700; }
.nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
.nav a {
  padding: 8px 12px; border-radius: 9px; text-decoration: none; color: #334155; font-weight: 500;
}
.nav a:hover { background: #f1f4f6; }
.nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }

.page { max-width: 1100px; margin: 0 auto; padding: 24px 24px 60px; display: flex; flex-direction: column; gap: 18px; }
.page h1 { margin: 0; font-size: 26px; letter-spacing: -0.01em; }
.page h2 { margin: 0 0 10px; font-size: 16px; }
.sub { margin: 4px 0 0; color: var(--muted); }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.kpi span { color: var(--muted); font-size: 13px; }
.kpi strong { font-size: 26px; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; align-items: start; }

.tablewrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 11px 10px; border-bottom: 1px solid #f0f3f5; vertical-align: top; }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.t tr.voided td { color: #6b7686; text-decoration: line-through; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; background: #eef2f5; color: #334155; white-space: nowrap; }
.b-green { background: #dcfce7; color: #14532d; }
.b-amber { background: #fef3c7; color: #78350f; }
.b-red { background: #fee2e2; color: #7f1d1d; }
.b-blue { background: #dbeafe; color: #1e3a8a; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid #d5dbe1;
  background: #fff; font-weight: 600; cursor: pointer; text-decoration: none; color: #1f2937;
}
.btn:hover { background: #f8fafb; }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: #095c42; }
.btn-danger { background: #fff; border-color: #f0b8b3; color: var(--red); }
.btn-small { height: 32px; padding: 0 12px; font-size: 13px; }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 500; }
input[type="text"], input[type="password"], input[type="date"], input[type="number"], input[type="search"], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #d5dbe1; border-radius: 9px; background: #fff;
}
textarea { resize: vertical; min-height: 64px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row > .field { flex: 1 1 160px; margin-bottom: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 6px 14px; border-radius: 20px; border: 1px solid #d5dbe1; background: #fff; cursor: pointer; font-size: 13px; font-weight: 600; color: #334155; }
.chip[aria-pressed="true"] { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }

.hint { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.err { color: var(--red); font-size: 14px; margin: 8px 0 0; }
.ok { color: #14532d; font-size: 14px; margin: 8px 0 0; }
.mono { font-family: ui-monospace, Consolas, Menlo, monospace; font-size: 12.5px; overflow-wrap: anywhere; word-break: break-all; }
.copybox { background: #f1f4f6; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.warn { background: #fff7e0; border: 1px solid #f0d58a; color: #6b4a00; border-radius: 12px; padding: 12px 14px; }
.check { display: flex; gap: 8px; align-items: flex-start; margin: 8px 0; }
.check input { margin-top: 4px; }
dl.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

.login { max-width: 400px; margin: 9vh auto 0; padding: 0 20px; }
.login .card { padding: 26px; }
.login h1 { font-size: 22px; margin: 14px 0 4px; }

#toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  background: var(--brand-dark); color: #fff; padding: 10px 18px; border-radius: 10px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
#toast.show { opacity: 1; }
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }
@media (max-width: 640px) { .page { padding: 16px 14px 50px; } .top { padding: 10px 14px; } }
