:root {
  --bg: #f6f7f9; --surface: #fff; --text: #14181f; --muted: #667085; --line: #e4e7ec;
  --accent: #0e7c66; --accent-ink: #fff; --accent-soft: #e3f4ef; --danger: #c0352b; --warn: #b7791f; --ok: #0e7c66;
  --radius: 12px; --shadow: 0 1px 2px rgba(16, 24, 40, .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116; --surface: #161b22; --text: #e8ecf1; --muted: #8b95a5; --line: #262d38;
    --accent: #34c3a0; --accent-ink: #06231b; --accent-soft: #12332b; --danger: #ff7b72; --warn: #e3b341; --ok: #34c3a0;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
[v-cloak] { display: none; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
.muted { color: var(--muted); }
small { font-size: 12.5px; }
a { color: var(--accent); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; word-break: break-all; }

#app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; }
.brand { font-weight: 650; font-size: 16px; display: flex; gap: 8px; align-items: center; padding: 0 8px; }
.logo { color: var(--accent); font-size: 20px; }
.side nav { display: grid; gap: 2px; }
.side nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 500; }
.side nav a:hover { background: var(--bg); color: var(--text); }
.side nav a.active { background: var(--accent-soft); color: var(--accent); }
.ico { display: inline-flex; width: 18px; height: 18px; }
.ico svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.logout { margin-top: auto; }
.main { min-width: 0; }
.top { display: flex; align-items: center; gap: 14px; padding: 18px 28px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.top h2 { font-size: 18px; flex: 1; }
.who { font-weight: 550; }
.burger { display: none; padding: 6px 10px; }
.content { padding: 24px 28px 48px; max-width: 1180px; display: grid; gap: 20px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card h3 { font-size: 15px; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 26px; font-weight: 650; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.grid2 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 14px; }
.grid2.even { grid-template-columns: 1fr 1fr; }

.btn { font: inherit; font-weight: 550; border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 9px 16px; border-radius: 9px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

form.stack, .auth-card form { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-weight: 550; font-size: 13.5px; }
input, select, textarea { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; width: 100%; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { color: var(--muted); font-size: 12.5px; font-weight: 400; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-weight: 550; font-size: 12.5px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.pos { color: var(--ok); } .neg { color: var(--danger); }
.scroll { overflow-x: auto; }
.empty { text-align: center; padding: 28px; color: var(--muted); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--bg); color: var(--muted); border: 1px solid var(--line); text-transform: capitalize; }
.badge.paid, .badge.success { color: var(--ok); background: var(--accent-soft); border-color: transparent; }
.badge.pending, .badge.processing, .badge.pending_approval, .badge.approved, .badge.creating { color: var(--warn); }
.badge.failed, .badge.rejected, .badge.expired, .badge.risky, .badge.review { color: var(--danger); }

.pager { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 12px; color: var(--muted); font-size: 13px; }
.chart { width: 100%; height: 190px; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; }
.list { display: grid; }
.list .item { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list .item:last-child { border-bottom: 0; }
.summary { background: var(--bg); border-radius: 9px; padding: 10px 12px; font-size: 13.5px; display: grid; gap: 4px; }
.summary div { display: flex; justify-content: space-between; }

.modal-wrap { position: fixed; inset: 0; background: rgba(8, 12, 18, .55); display: grid; place-items: center; padding: 16px; z-index: 20; }
.modal { background: var(--surface); border-radius: 14px; padding: 22px; width: min(520px, 100%); max-height: 90vh; overflow: auto; display: grid; gap: 14px; }
.kv { display: grid; gap: 3px; }
.kv .k { color: var(--muted); font-size: 12.5px; }
.kv .v { display: flex; gap: 8px; align-items: center; justify-content: space-between; }

.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 40; }
.toast { background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 9px; font-weight: 550; max-width: 340px; }
.toast.err { background: var(--danger); color: #fff; }

.auth { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 32px; width: min(400px, 100%); display: grid; gap: 14px; box-shadow: var(--shadow); }
.auth-card .brand { padding: 0; margin-bottom: 6px; }
.alert { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); border-radius: 9px; padding: 10px 12px; font-weight: 550; font-size: 14px; }

@media (max-width: 900px) {
  #app { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 30; width: 250px; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; }
  .burger { display: inline-flex; }
  .stats { grid-template-columns: 1fr 1fr; }
  .grid2, .grid2.even { grid-template-columns: 1fr; }
  .top, .content { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 520px) { .stats, .row { grid-template-columns: 1fr; } }
