:root {
  --bg: #070d18;
  --sidebar: #0c1424;
  --surface: #111b2e;
  --surface-2: #172338;
  --border: rgba(255, 255, 255, 0.07);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #f59e0b;
  --accent-2: #fbbf24;
  --success: #34d399;
  --danger: #f87171;
  --radius: 12px;
}

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

body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 0 8px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #d97706, var(--accent));
  color: #111;
  font-weight: 800;
  font-size: 14px;
  display: grid;
  place-items: center;
}

.sidebar-brand strong { display: block; font-size: 14px; }
.sidebar-brand span { font-size: 11px; color: var(--muted); }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }

.nav-item {
  text-align: left;
  background: none;
  border: none;
  color: var(--muted);
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: 0.15s;
}

.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active { background: rgba(245, 158, 11, 0.12); color: var(--accent-2); }

.sidebar-footer { padding-top: 16px; }
.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  padding: 8px;
}
.link-btn:hover { color: var(--accent); }

.main {
  padding: 28px 32px 40px;
  overflow: auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 24px;
}

.topbar h1 { font-size: 26px; letter-spacing: -0.03em; }
.muted { color: var(--muted); font-size: 13px; margin-top: 4px; }
.muted.note { font-size: 11px; margin-top: 6px; opacity: 0.85; }

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}

.select, .search {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
}

.search { min-width: 260px; }

.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, #d97706, var(--accent));
  color: #111827;
}
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.progress-banner, .error-banner {
  margin-bottom: 20px;
  padding: 14px 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}

.error-banner {
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.25);
  color: #fecaca;
  font-size: 13px;
}

.progress-text {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.progress-track {
  height: 6px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #d97706, var(--accent));
  transition: width 0.25s;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.kpi-card.highlight {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(245, 158, 11, 0.04));
  border-color: rgba(245, 158, 11, 0.25);
}

.kpi-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.kpi-value { display: block; font-size: 32px; font-weight: 700; margin-top: 6px; line-height: 1; }
.kpi-card.highlight .kpi-value { color: var(--accent-2); }
.kpi-sub { display: block; font-size: 11px; color: var(--muted); margin-top: 6px; }

.split-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.panel-header h2 { font-size: 15px; }
.panel-body { padding: 16px 20px; }
.panel-body.scroll { max-height: 360px; overflow: auto; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.table-wrap { overflow: auto; max-height: calc(100vh - 200px); }

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

.data-table th {
  text-align: left;
  padding: 12px 16px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  position: sticky;
  top: 0;
  z-index: 1;
}

.data-table th.num, .data-table td.num { text-align: right; }

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tr:hover td { background: rgba(255, 255, 255, 0.02); }

.cover-thumb {
  width: 36px;
  height: 50px;
  border-radius: 4px;
  object-fit: cover;
  background: var(--surface-2);
}

.cover-placeholder {
  width: 36px;
  height: 50px;
  border-radius: 4px;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  font-size: 16px;
}

.title-cell { max-width: 320px; font-weight: 500; line-height: 1.35; }
.sub-cell { color: var(--muted); font-size: 12px; }

.badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent);
  margin-right: 4px;
}

.badge.zero { background: var(--surface-2); color: var(--muted); }

.sales-strong { color: var(--success); font-weight: 700; }

.rank-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.rank-item:last-child { border-bottom: none; }
.rank-title { font-size: 13px; font-weight: 500; flex: 1; }
.rank-qty { font-size: 18px; font-weight: 700; color: var(--accent-2); }

.day-block {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.day-block h3 { font-size: 14px; margin-bottom: 10px; color: var(--accent-2); }

.day-row {
  display: grid;
  grid-template-columns: 1fr repeat(4, 80px);
  gap: 8px;
  font-size: 12px;
  padding: 6px 0;
  color: var(--muted);
}

.day-row.header { font-weight: 600; text-transform: uppercase; font-size: 10px; }
.day-row span:not(:first-child) { text-align: right; color: var(--text); }

.hidden { display: none !important; }

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .split-grid { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}
