:root {
  --bg: #0f1420;
  --panel: #171d2b;
  --panel-2: #1d2435;
  --border: #2a3247;
  --text: #e7ecf5;
  --muted: #8b96ad;
  --accent: #6366f1;
  --accent-2: #22d3ee;
  --up: #34d399;
  --down: #f87171;
  --warn: #f59e0b;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

.topbar {
  position: sticky;
  top: 0;
  background: rgba(15, 20, 32, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  z-index: 20;
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 700; font-size: 1.05rem; }
.brand-dot { width: 12px; height: 12px; border-radius: 4px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }

.topnav { display: flex; gap: 22px; flex-wrap: wrap; }
.topnav a { color: var(--muted); text-decoration: none; font-size: 0.9rem; font-weight: 500; }
.topnav a:hover { color: var(--text); }

main { padding: 32px 20px 60px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; flex-wrap: wrap; }
.tag { display: inline-block; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-2); margin-bottom: 8px; }
h1 { margin: 0 0 8px; font-size: 1.9rem; font-weight: 800; letter-spacing: -0.02em; }
.lede { margin: 0; color: var(--muted); max-width: 640px; font-size: 0.98rem; }

.btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0f1420;
  border: none;
  padding: 11px 18px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: filter 0.2s, transform 0.1s;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: scale(0.98); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.kpi-label { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 8px; }
.kpi-value { display: block; font-size: 1.55rem; font-weight: 800; letter-spacing: -0.02em; }
.kpi-delta { display: inline-block; margin-top: 6px; font-size: 0.8rem; font-weight: 600; }
.kpi-delta.up { color: var(--up); }
.kpi-delta.down { color: var(--down); }
.kpi-delta.warn { color: var(--warn); }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 24px; }
.card h2 { margin: 0 0 6px; font-size: 1.15rem; font-weight: 700; }
.card h2 span.note { font-size: 0.8rem; color: var(--muted); font-weight: 500; margin-left: 8px; }
.hint { margin: 0 0 18px; color: var(--muted); font-size: 0.85rem; }

.chart-wrap { position: relative; height: 320px; }
.chart-wrap.donut { height: 300px; }
.chart-wrap.bar { height: 260px; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 820px) { .two-col { grid-template-columns: 1fr; } }

.edit-hint { display:flex; align-items:center; gap:8px; color: var(--muted); font-size:0.85rem; margin-bottom:8px; }
.edit-hint::before { content:""; width:16px; height:16px; border-radius:5px; background:linear-gradient(135deg,var(--accent),var(--accent-2)); opacity:.85; }

h2.sub { margin: 22px 0 10px; font-size: 0.92rem; font-weight: 700; letter-spacing: 0.02em; color: var(--accent-2); }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; padding: 10px 12px; border-bottom: 1px solid var(--border); }
td { padding: 8px; border-bottom: 1px solid rgba(42, 50, 71, 0.5); }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: none; }

table.edit input {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.88rem;
  width: 100%;
  min-width: 70px;
}
table.edit input:focus { outline: 2px solid var(--accent); border-color: transparent; }
table.edit td.cell-num { width: 130px; }
.cell-del { width: 40px; text-align: center; }
button.del {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-size: 0.8rem; line-height:1;
}
button.del:hover { color: var(--down); border-color: var(--down); }
button.add-row {
  background: transparent; border: 1px dashed var(--border); color: var(--accent-2);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; font-family: inherit;
  font-size: 0.85rem; font-weight: 600; margin-top: 10px;
}
button.add-row:hover { background: var(--panel-2); }

.suggestions { list-style: none; padding: 0; margin: 0; }
.suggestions li {
  padding: 14px 14px 14px 42px;
  margin-bottom: 12px;
  background: var(--panel-2);
  border-radius: 10px;
  font-size: 0.88rem;
  color: #cdd5e3;
  position: relative;
}
.suggestions li::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 16px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18);
}
.suggestions li:nth-child(2)::before { background: var(--accent-2); box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.18); }
.suggestions li:nth-child(3)::before { background: var(--up); box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.18); }
.suggestions li:nth-child(4)::before { background: var(--warn); box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.18); }
.suggestions li strong { color: var(--text); }

.footer { border-top: 1px solid var(--border); padding: 22px 0; color: var(--muted); font-size: 0.82rem; background: var(--bg); }

@media (max-width: 620px) { .topbar-inner { flex-wrap: wrap; height: auto; padding: 10px 0; } .page-head { align-items: flex-start; flex-direction: column; } }