:root {
  --bg: #f6f5f1;
  --surface: #fcfcfb;
  --surface-2: #f0efea;
  --line: #e2e0d8;
  --line-strong: #cfcdc3;
  --ink: #1d1c19;
  --ink-2: #57554d;
  --ink-3: #8a877d;
  --brand: #1f6f5c;
  --brand-ink: #ffffff;
  --brand-soft: #e3f0ec;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --warn: #9a6200;
  --warn-soft: #fdf3dc;
  --ok: #18794e;
  --ok-soft: #e4f4ea;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(29, 28, 25, .06), 0 4px 16px rgba(29, 28, 25, .05);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.45 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font: 600 26px/1.15 var(--display); letter-spacing: -.01em; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.hidden { display: none !important; }

/* Buttons & inputs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font: 550 14px var(--font); cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--danger); border-color: #f0c2bd; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.lg { height: 48px; padding: 0 20px; font-size: 16px; }
.btn.block { width: 100%; }

label.field { display: grid; gap: 5px; font-size: 13px; font-weight: 550; color: var(--ink-2); }
input, select, textarea {
  width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 8px;
  background: #fff; color: var(--ink); font: 14px var(--font);
}
textarea { height: auto; min-height: 80px; padding: 9px 11px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 1px; border-color: var(--brand); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--brand); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stack { display: grid; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.hint { font-size: 12px; color: var(--ink-3); font-weight: 400; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 18px; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }

.badge { font-family: var(--font); display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.plain::before { display: none; }
.badge.paid, .badge.fulfilled, .badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.pending, .badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.refunded, .badge.cancelled, .badge.bad { background: var(--danger-soft); color: var(--danger); }

table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; padding: 10px 14px; border-bottom: 1px solid var(--line); }
table.t td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: var(--surface-2); }
table.t .r { text-align: right; }

.toast-wrap { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 1000; }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow); font-weight: 500; animation: pop .18s ease-out; }
.toast.err { background: var(--danger); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

.modal-back { position: fixed; inset: 0; background: rgba(29, 28, 25, .38); display: grid; place-items: center; z-index: 900; padding: 20px; }
.modal { background: var(--surface); border-radius: 14px; width: min(520px, 100%); max-height: calc(100vh - 40px); overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-h { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-b { padding: 20px; }
.modal-f { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); }
.empty { padding: 40px 20px; text-align: center; color: var(--ink-3); }
.err-msg { color: var(--danger); font-size: 13px; min-height: 18px; }
