:root {
  --bg: #eef2f7;
  --panel: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --side: #07111f;
  --side-2: #0c1a2e;
  --accent: #2dd4bf;
  --accent-2: #38bdf8;
  --warn: #f59e0b;
  --bad: #f43f5e;
  --ok: #10b981;
  --shadow: 0 18px 50px rgba(15, 23, 42, .08);
  --radius: 18px;
  --font: "IBM Plex Sans", "PingFang SC", sans-serif;
  --display: "Outfit", "PingFang SC", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
}
a { color: #0f766e; text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; background: #f1f5f9; padding: .1em .35em; border-radius: 6px; }

.sidebar {
  position: fixed; inset: 0 auto 0 0;
  width: 260px;
  background: linear-gradient(180deg, var(--side) 0%, var(--side-2) 100%);
  color: #e2e8f0;
  display: flex; flex-direction: column;
  padding: 22px 16px;
  z-index: 20;
}
.brand {
  display: flex; gap: 12px; align-items: center;
  color: #fff; text-decoration: none; padding: 6px 8px 18px;
}
.brand strong, .login-brand h1 { font-family: var(--display); letter-spacing: .02em; }
.brand small, .login-brand p { display: block; color: #94a3b8; font-size: 12px; margin-top: 2px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #042f2e; font-family: var(--display); font-weight: 700;
  box-shadow: 0 8px 24px rgba(45, 212, 191, .35);
}
.brand-mark.lg { width: 48px; height: 48px; font-size: 22px; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  color: #cbd5e1; padding: 10px 12px; border-radius: 12px;
  text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.nav-item.is-on {
  background: linear-gradient(90deg, rgba(45,212,191,.18), rgba(56,189,248,.08));
  color: #fff; box-shadow: inset 0 0 0 1px rgba(45,212,191,.25);
}
.nav-item i::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 99px; background: currentColor; opacity: .7; }
.sidebar-foot { border-top: 1px solid rgba(255,255,255,.08); padding-top: 14px; }
.who { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.avatar {
  width: 36px; height: 36px; border-radius: 10px;
  background: #134e4a; color: var(--accent); display: grid; place-items: center; font-weight: 700;
}
.who b { display: block; font-size: 14px; }
.who small { color: #94a3b8; }

.shell { margin-left: 260px; min-height: 100vh; }
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 22px 28px 8px;
}
.topbar h1 { margin: 0; font-family: var(--display); font-size: 26px; }
.muted { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.top-meta { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.pill {
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 12px; font-size: 12px; color: var(--muted);
}
.pill-warn { background: #fff7ed; border-color: #fdba74; color: #c2410c; }
.icon-btn { display: none; border: 0; background: #fff; width: 40px; height: 40px; border-radius: 12px; cursor: pointer; }
.page { padding: 12px 28px 40px; display: flex; flex-direction: column; gap: 18px; }
.card {
  background: var(--panel); border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid rgba(226,232,240,.8);
  padding: 18px 20px 20px;
}
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-h h2 { margin: 0; font-size: 16px; font-family: var(--display); }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi {
  background: var(--panel); border-radius: var(--radius); padding: 18px 18px 16px;
  box-shadow: var(--shadow); border: 1px solid rgba(226,232,240,.8);
  position: relative; overflow: hidden;
}
.kpi::after {
  content: ""; position: absolute; right: -20px; top: -20px; width: 90px; height: 90px;
  background: radial-gradient(circle, rgba(45,212,191,.2), transparent 70%);
}
.kpi span { color: var(--muted); font-size: 12px; }
.kpi strong { display: block; font-size: 26px; margin: 8px 0 4px; font-family: var(--display); letter-spacing: -.03em; }
.kpi strong small { font-size: 14px; color: var(--muted); font-weight: 500; }
.kpi em { font-style: normal; color: #0f766e; font-size: 12px; }
.grid-2 { display: grid; grid-template-columns: 1.2fr .8fr; gap: 14px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; color: var(--muted); font-weight: 500; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 6px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
.table tr:hover td { background: #f8fafc; }
.table tr.is-dim td { opacity: .55; }
.tag {
  display: inline-flex; align-items: center; border-radius: 999px;
  padding: 2px 8px; font-size: 12px; background: #f1f5f9; color: #334155;
}
.tag-ok { background: #d1fae5; color: #047857; }
.tag-warn { background: #ffedd5; color: #c2410c; }
.tag-bad { background: #ffe4e6; color: #be123c; }
.tag-off { background: #e2e8f0; color: #64748b; }
.empty, .hint { color: var(--muted); font-size: 13px; line-height: 1.6; }
.hint { margin-top: 12px; }
.banner {
  background: linear-gradient(90deg, #ecfdf5, #e0f2fe);
  border: 1px solid #99f6e4; color: #115e59;
  padding: 12px 14px; border-radius: 14px; font-size: 14px;
}
.meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin: 0; }
.meta div { background: #f8fafc; border-radius: 12px; padding: 10px 12px; }
.meta dt { color: var(--muted); font-size: 12px; }
.meta dd { margin: 4px 0 0; font-weight: 600; }
.people { list-style: none; margin: 0; padding: 0; }
.people a { display: flex; justify-content: space-between; padding: 10px 4px; border-bottom: 1px solid #f1f5f9; color: inherit; }
.people a:hover { text-decoration: none; color: #0f766e; }
.flashes { padding: 0 28px; display: flex; flex-direction: column; gap: 8px; }
.flash { padding: 10px 14px; border-radius: 12px; font-size: 14px; }
.flash-ok { background: #d1fae5; color: #065f46; }
.flash-err { background: #ffe4e6; color: #9f1239; }
.flash-warn { background: #ffedd5; color: #9a3412; }

.stack { display: flex; flex-direction: column; gap: 12px; }
.form-row, .btn-row, .chip-row, .pager, .inline { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.inline { align-items: center; margin: 0; }
.grow { flex: 1; min-width: 180px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
label.check { flex-direction: row; align-items: center; color: var(--ink); }
input, select {
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
  font: inherit; color: var(--ink); background: #fff; min-width: 0;
}
input:focus, select:focus { outline: 2px solid rgba(45,212,191,.35); border-color: var(--accent); }
.btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 12px; padding: 10px 14px; font: inherit; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
}
.btn:hover { background: #f8fafc; text-decoration: none; }
.btn-primary {
  background: linear-gradient(135deg, #14b8a6, #0ea5e9); color: #fff; border: 0;
  box-shadow: 0 8px 18px rgba(14,165,233,.25);
}
.btn-primary:hover { filter: brightness(1.05); color: #fff; }
.btn-danger { background: #fff1f2; color: #be123c; border-color: #fecdd3; }
.btn-ghost { background: transparent; color: #cbd5e1; border-color: rgba(255,255,255,.12); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 9px; }
.table td.actions { white-space: nowrap; }
.table td.actions .inline { display: inline-flex; margin: 0; }
.btn-ok { background: #d1fae5; border-color: #a7f3d0; color: #047857; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.chip {
  border: 1px solid var(--line); background: #f8fafc; border-radius: 999px;
  padding: 6px 12px; cursor: pointer; font: inherit; color: var(--ink);
}
.chip:hover { border-color: var(--accent); color: #0f766e; }
.sep { border: 0; border-top: 1px dashed var(--line); margin: 8px 0; }
.lead { font-size: 15px; }
.pager { justify-content: center; color: var(--muted); padding-top: 12px; }
.nav-mask { display: none; }

.login-body {
  min-height: 100vh; display: grid; place-items: center; background: #061018;
}
.login-bg {
  position: fixed; inset: 0;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(45,212,191,.25), transparent 50%),
    radial-gradient(900px 400px at 90% 110%, rgba(56,189,248,.2), transparent 45%),
    linear-gradient(#061018, #0b1c2e);
}
.login-card {
  position: relative; width: min(420px, calc(100% - 32px));
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.1);
  backdrop-filter: blur(16px); border-radius: 24px; padding: 28px;
  color: #e2e8f0; box-shadow: 0 30px 80px rgba(0,0,0,.35);
}
.login-brand { display: flex; gap: 14px; align-items: center; margin-bottom: 22px; }
.login-brand h1 { margin: 0; font-size: 22px; color: #fff; }
.login-brand p { margin: 4px 0 0; color: #94a3b8; font-size: 13px; }
.login-card label span { color: #94a3b8; }
.login-card input { background: rgba(15,23,42,.6); border-color: rgba(148,163,184,.25); color: #fff; }
.login-foot { color: #64748b; font-size: 12px; margin: 16px 0 0; }
.lock-hint { color: #fda4af; font-size: 13px; margin: 0; }
.lock-hint.is-hide { display: none; }

.ledger-body {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 16px 48px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.ledger-top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.ledger-top h1 { margin: 4px 0 0; font-family: var(--display); font-size: 28px; }
.ledger-tabs, .ledger-top-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip.is-on { background: #0f766e; color: #fff; border-color: #0f766e; }
.table-wrap { overflow-x: auto; }
.ledger-foot { text-align: center; margin: 8px 0 0; }
.ledger-kpis { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 860px) {
  .ledger-kpis { grid-template-columns: 1fr 1fr; }
  .ledger-filters label { min-width: 46%; }
}

@media (max-width: 1100px) {
  .kpis, .grid-2, .meta { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-105%); transition: transform .2s ease; }
  body.nav-open .sidebar { transform: none; }
  .shell { margin-left: 0; }
  .icon-btn { display: inline-grid; place-items: center; }
  .kpis, .grid-2 { grid-template-columns: 1fr; }
  .page, .topbar, .flashes { padding-left: 16px; padding-right: 16px; }
  body.nav-open .nav-mask {
    display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 15;
  }
}
