:root {
  --bg: #f6f4ef;
  --bg-soft: #efece4;
  --surface: #ffffff;
  --surface-2: #fbfaf6;
  --border: #e4ddd0;
  --border-strong: #d4cbb8;
  --text: #2c2418;
  --text-muted: #6d6456;
  --text-dim: #93897a;
  --accent: #0f7a5a;
  --accent-2: #c45c26;
  --accent-3: #8a5a2b;
  --warn: #c45c26;
  --danger: #b42318;
  --ok: #0f7a5a;
  --shadow: 0 10px 24px rgba(44, 36, 24, 0.07);
  --radius: 14px;
  --sidebar-w: 232px;
  --font: "IBM Plex Sans", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", "Consolas", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
}

body {
  background-image:
    radial-gradient(900px 420px at 0% -10%, rgba(15, 122, 90, 0.07), transparent 55%),
    radial-gradient(700px 360px at 100% 0%, rgba(196, 92, 38, 0.06), transparent 50%);
}

.site-header {
  background: #1b365d;
  color: #fff;
}

.site-header-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 22px 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.site-header h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.site-header-sub {
  margin-top: 6px;
  color: rgba(255,255,255,0.72);
  font-size: 14px;
}

.header-actions {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

.btn {
  appearance: none;
  font: inherit;
  cursor: pointer;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 600;
  font-size: 14px;
}

.btn-light {
  background: #fff;
  color: #1b365d;
  border: 1px solid #fff;
}

.btn-light:hover { background: #f3f6fb; }

.btn-outline {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.75);
}

.btn-outline:hover { background: rgba(255,255,255,0.08); }

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #1b365d;
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 50;
  display: none;
}

.toast.show { display: block; }

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: calc(100vh - 92px);
}

.sidebar {
  position: sticky;
  top: 0;
  height: calc(100vh - 92px);
  padding: 20px 12px;
  border-right: 1px solid var(--border);
  background: #fffdf8;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 10px 18px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0f7a5a, #c45c26);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #fff;
}

.brand h1 { font-size: 15px; font-weight: 650; }
.brand p { color: var(--text-muted); font-size: 11px; margin-top: 2px; }

.nav-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-btn:hover { background: var(--bg-soft); color: var(--text); }
.nav-btn.active {
  background: #e7f4ee;
  color: var(--accent);
  font-weight: 550;
}

.nav-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.sidebar-meta {
  margin-top: auto;
  padding: 12px;
  border-radius: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.7;
}

.sidebar-meta strong { color: var(--text); }

.main { min-width: 0; }

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 253, 248, 0.92);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar h2 { font-size: 17px; font-weight: 650; }
.topbar-sub { color: var(--text-muted); font-size: 12px; margin-top: 2px; }

.search {
  display: flex;
  align-items: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  min-width: 280px;
}

.search input {
  background: transparent;
  border: 0;
  outline: none;
  color: var(--text);
  width: 100%;
  font: inherit;
}

.content { padding: 22px 28px 48px; display: none; }
.content.active { display: block; }

.kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}

.kpi-exports {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.kpi .label {
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.kpi .value {
  font-size: 22px;
  font-weight: 650;
  margin: 7px 0 3px;
  font-variant-numeric: tabular-nums;
}

.kpi .hint { color: var(--text-dim); font-size: 12px; }

.grid-2 {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 12px;
  margin-bottom: 12px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px 18px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.card h3 {
  font-size: 13px;
  font-weight: 650;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card h3 .card-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.card h3 .card-title small {
  color: var(--text-muted);
  font-weight: 450;
  font-size: 11px;
}

.card-exports {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.xbtn {
  appearance: none;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 4px 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 550;
  cursor: pointer;
}

.xbtn:hover {
  border-color: #1b365d;
  color: #1b365d;
  background: #f4f7fb;
}

.chart-wrap { position: relative; height: 280px; }
.chart-wrap.tall { height: 340px; }
.chart-wrap.short { height: 230px; }

.table-wrap {
  overflow: auto;
  max-height: 540px;
  border: 1px solid var(--border);
  border-radius: 12px;
}

table { width: 100%; border-collapse: collapse; font-size: 13px; }

th, td {
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  background: #f3efe6;
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 600;
  cursor: pointer;
}

tbody tr:hover { background: #faf7f0; }

.num { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right !important; }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  font-family: var(--mono);
}

.r1 { background: #dcfce7; color: #166534; }
.r2 { background: #f3eee4; color: #6d4c2b; }
.r3 { background: #ffedd5; color: #c2410c; }
.r4 { background: #fee2e2; color: #b91c1c; }
.r5 { background: #ffe4e6; color: #9f1239; }
.rq { background: #f1eee8; color: #6d6456; }

.bar {
  height: 7px;
  background: #eee8dc;
  border-radius: 99px;
  overflow: hidden;
  min-width: 80px;
}

.bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #0f7a5a, #c45c26);
  border-radius: 99px;
}

.filters { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }

.chip {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-muted);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  font: inherit;
}

.chip.active {
  color: var(--accent);
  border-color: #9ad4bf;
  background: #e7f4ee;
}

.empty { color: var(--text-muted); padding: 28px; text-align: center; }

.note {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  margin-bottom: 12px;
}

@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .search { min-width: 0; width: 180px; }
  .site-header-inner { padding: 16px 18px; flex-direction: column; align-items: flex-start; }
  .site-header h1 { font-size: 20px; }
}
