@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --border: #e8ecf1;
  --accent: #3CB4A0;
  --accent2: #1B3A5C;
  --text: #1e293b;
  --muted: #64748b;
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #3CB4A0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.06);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
}

/* ===== Sidebar (Google Drive style) ===== */
.sidebar {
  width: 240px;
  background: #fff;
  padding: 16px 0;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
}

.sidebar-brand {
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  padding: 8px 20px 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.2px;
}

.sidebar-nav { list-style: none; padding: 4px 12px; flex: 1; }

.sidebar-nav li { margin-bottom: 2px; }

.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
  border-radius: 24px;
  border-left: none;
}

.sidebar-nav li a:hover {
  background: #f1f3f4;
  color: var(--text);
}

.sidebar-nav li a.active {
  background: #c2e7ff;
  color: #001d35;
  font-weight: 600;
}

.sidebar-nav li a .nav-icon { width: 20px; height: 20px; flex-shrink: 0; color: var(--muted); }
.sidebar-nav li a.active .nav-icon { color: #001d35; }

.nav-group-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #b0b8c4;
  padding: 14px 16px 4px;
  pointer-events: none;
  user-select: none;
}

/* Sidebar footer */
.sidebar-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  padding: 12px 16px;
}
.sidebar-powered {
  font-size: 10px;
  color: #b0b8c4;
  line-height: 1.5;
  margin-bottom: 2px;
}
.sidebar-powered a { color: #b0b8c4; text-decoration: none; }
.sidebar-powered a:hover { color: var(--muted); }
.sidebar-reporter {
  font-size: 10px;
  color: #b0b8c4;
  margin-bottom: 10px;
  display: block;
}
.sidebar-footer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sidebar-signout {
  font-size: 11px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s;
}
.sidebar-signout:hover { color: var(--text); }

/* ===== Main Content ===== */
.main-content {
  margin-left: 240px;
  flex: 1;
  padding: 0 32px 32px;
  min-height: 100vh;
}

/* ===== Page Header ===== */
.page-header {
  background: linear-gradient(135deg, #ffffff 0%, #f0f4f8 100%);
  margin: 0 -32px 28px;
  padding: 32px 32px 28px;
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.page-header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent2) 100%);
}

.page-header::after {
  content: '';
  position: absolute;
  right: 40px;
  top: 50%;
  transform: translateY(-50%);
  width: 100px;
  height: 100px;
  background: radial-gradient(circle, rgba(60,180,160,0.1) 1px, transparent 1px);
  background-size: 10px 10px;
  border-radius: 50%;
  opacity: 0.8;
}

.page-header-content { position: relative; z-index: 1; }

.page-header h1 {
  font-weight: 800;
  font-size: 26px;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}

.page-header .subtitle {
  font-size: 13px;
  color: var(--muted);
  font-weight: 400;
}

/* ===== Hero Cards (top KPIs) ===== */
.hero-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.hero-card {
  border-radius: 14px;
  padding: 24px 20px;
  position: relative;
  overflow: hidden;
  text-align: center;
}

.hero-card::after {
  content: '';
  position: absolute;
  bottom: -20px;
  right: -20px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
}

.hero-icon {
  margin-bottom: 10px;
  opacity: 0.9;
}

.hero-number {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.1;
  margin-bottom: 6px;
}

.hero-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.85;
  margin-bottom: 4px;
}

.hero-sub {
  font-size: 11px;
  opacity: 0.6;
}

.hero-accent {
  background: linear-gradient(135deg, var(--accent2) 0%, #234b73 100%);
  color: #fff;
}

.hero-navy {
  background: linear-gradient(135deg, #0f766e 0%, var(--accent) 100%);
  color: #fff;
}

.hero-teal {
  background: linear-gradient(135deg, var(--accent) 0%, #2dd4bf 100%);
  color: #fff;
}

.hero-green {
  background: linear-gradient(135deg, #059669 0%, #34d399 100%);
  color: #fff;
}

/* ===== Section Labels ===== */
.section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent2);
  margin-bottom: 14px;
  margin-top: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent);
  width: fit-content;
}

/* ===== Cards ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card h2 {
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.card-desc {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
  line-height: 1.5;
}

.card-footnote {
  font-size: 11px;
  color: var(--muted);
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* ===== Platform Cards ===== */
.platform-card { padding: 0; overflow: hidden; }

.platform-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
}

.ios-header { background: linear-gradient(135deg, var(--accent2) 0%, #234b73 100%); }
.android-header { background: linear-gradient(135deg, #0f766e 0%, var(--accent) 100%); }

.platform-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}

.period-badge {
  background: rgba(255,255,255,0.2);
  color: #fff;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.platform-card .stat-grid-3,
.platform-card .chart-section,
.platform-card .card-inline-stats {
  padding: 0 24px;
}

.platform-card .stat-grid-3 { padding-top: 20px; }
.platform-card .card-inline-stats { padding-bottom: 20px; }

/* ===== Mini Stats Grid ===== */
.stat-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.mini-stat {
  text-align: center;
  padding: 12px 8px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.mini-val {
  display: block;
  font-size: 22px;
  font-weight: 800;
  color: var(--accent2);
  line-height: 1.2;
  margin-bottom: 4px;
}

.mini-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--muted);
}

.mini-arrow {
  display: block;
  font-size: 11px;
  font-weight: 700;
  margin-top: 4px;
}

.mini-arrow .arrow-up { color: var(--success); font-size: 11px; }
.mini-arrow .arrow-down { color: var(--danger); font-size: 11px; }

/* ===== Chart Section ===== */
.chart-section {
  margin-bottom: 16px;
}

.chart-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--muted);
  margin-bottom: 8px;
}

/* ===== Inline Stats ===== */
.card-inline-stats {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.inline-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.inline-stat:first-child { border-top: 1px solid var(--border); }

.inline-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.inline-val {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.accent-text { color: var(--accent2) !important; }
.success-text { color: var(--success) !important; }
.danger-text { color: var(--danger) !important; }

/* ===== Hero Number Inline ===== */
.hero-number-inline {
  font-size: 42px;
  font-weight: 800;
  color: var(--accent2);
  letter-spacing: -1px;
  line-height: 1;
  margin-bottom: 4px;
}

.hero-unit {
  font-size: 16px;
  font-weight: 600;
  color: var(--muted);
  margin-left: 4px;
  letter-spacing: 0;
}

.context-text {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 16px;
}

/* ===== Baseline / Insight Notes ===== */
.baseline-note {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  padding: 10px 14px;
  background: #fefce8;
  border-radius: 8px;
  border-left: 3px solid var(--warning);
  margin-top: 12px;
}

.baseline-note strong { color: var(--text); }

.insight-bar {
  display: none;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 18px;
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 28px;
  margin-top: 16px;
}

.insight-bar i { color: var(--warning); margin-top: 2px; }
.insight-bar strong { color: var(--accent2); }
.insight-bar code { background: rgba(0,0,0,0.06); padding: 2px 6px; border-radius: 4px; font-size: 12px; }

/* ===== Uptime Cards ===== */
.uptime-card {
  text-align: center;
  padding: 28px 20px;
}

.uptime-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f0fdf9 0%, #ecfdf5 100%);
  color: var(--accent);
  margin-bottom: 12px;
}

.uptime-val {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent2);
  margin-bottom: 4px;
}

.uptime-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
}

/* ===== Content Stat List ===== */
.content-stat-list {
  display: flex;
  flex-direction: column;
}

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

.content-stat-row:last-child { border-bottom: none; }

.content-stat-label {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}

.content-stat-val {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent2);
}

/* ===== Ranking ===== */
.ranking-list { display: flex; flex-direction: column; gap: 8px; }

.ranking-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.ranking-pos {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent2);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.ranking-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.ranking-count {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
}

/* ===== Grid Layouts ===== */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 28px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin-bottom: 28px;
}

.grid-2-1 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 18px;
  margin-bottom: 28px;
}

.full-width { margin-bottom: 28px; }

.card-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ===== Chart Containers (legacy) ===== */
.chart-wrap { position: relative; height: 280px; }
.chart-wrap-md { position: relative; height: 200px; }
.chart-wrap-sm { position: relative; height: 160px; }

/* ===== Legacy Metric Table ===== */
.metric-table { width: 100%; border-collapse: collapse; }
.metric-table tr { border-bottom: 1px solid var(--border); }
.metric-table tr:last-child { border-bottom: none; }
.metric-table td { padding: 14px 0; vertical-align: middle; }
.metric-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; color: var(--text); line-height: 1.4; }
.metric-sub { font-weight: 400; text-transform: none; color: var(--muted); font-size: 11px; }
.metric-value { font-size: 24px; font-weight: 700; color: var(--accent2); text-align: right; padding-right: 8px; }
.metric-arrow { width: 32px; text-align: center; font-size: 16px; }
.arrow-up { color: var(--success); }
.arrow-down { color: var(--danger); }

/* ===== Legacy Lifetime Stat ===== */
.lifetime-stat { display: flex; justify-content: space-between; align-items: center; background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; }
.lifetime-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; color: var(--muted); }
.lifetime-value { font-size: 24px; font-weight: 700; color: var(--accent2); }

/* ===== Legacy Big Stat ===== */
.big-stat-row { display: flex; justify-content: space-between; align-items: center; background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; padding: 18px 20px; }
.big-stat-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; color: var(--text); line-height: 1.4; }
.big-stat-value { font-size: 32px; font-weight: 800; color: var(--accent2); }

/* ===== Comments Section ===== */
.comments-section { margin-top: 16px; }
.comments-section h3 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); margin-bottom: 8px; }
.comments-section p { font-size: 13px; color: var(--text); line-height: 1.6; }
.comments-section ul { font-size: 13px; color: var(--text); line-height: 1.8; padding-left: 20px; }

/* ===== Push Sent Row ===== */
.push-sent-row { display: flex; gap: 16px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.push-sent-item { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.push-sent-item strong { color: var(--text); font-size: 16px; }

/* ===== Database ===== */
.db-header-row { display: grid; grid-template-columns: 200px 1fr; gap: 24px; }
.db-desc { font-size: 13px; color: var(--muted); margin-bottom: 16px; line-height: 1.5; }
.db-sub { font-size: 11px; color: var(--muted); margin-top: 4px; }
.db-chart-area { min-width: 0; }

/* ===== ZIP ===== */
.zip-stat { display: flex; justify-content: space-between; align-items: center; background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; padding: 14px 18px; margin-bottom: 20px; }
.zip-label { font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--muted); }
.zip-value { font-size: 22px; font-weight: 800; color: var(--accent); }

/* ===== Conversion ===== */
.conversion-label-row { display: flex; justify-content: space-between; align-items: center; background: var(--accent2); color: #fff; border-radius: 10px; padding: 12px 18px; margin-top: 12px; font-size: 13px; font-weight: 500; }
.conversion-label-row strong { font-size: 18px; }

/* ===== Chat Panel ===== */
.chat-panel { margin-top: 8px; margin-bottom: 32px; }

.chat-messages {
  max-height: 360px;
  overflow-y: auto;
  margin-bottom: 16px;
  padding: 12px;
  background: var(--bg);
  border-radius: 10px;
  border: 1px solid var(--border);
  min-height: 120px;
}

.chat-msg { margin-bottom: 12px; padding: 10px 14px; border-radius: 10px; font-size: 13px; line-height: 1.6; max-width: 85%; }
.chat-msg.user { background: rgba(27,58,92,0.08); margin-left: auto; text-align: right; }
.chat-msg.assistant { background: rgba(60,180,160,0.1); }
.chat-msg.typing { color: var(--muted); font-style: italic; }

.chat-input-row { display: flex; gap: 8px; }
.chat-input-row input {
  flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 16px; color: var(--text); font-family: 'Inter', sans-serif; font-size: 13px; outline: none;
  transition: border-color 0.2s;
}
.chat-input-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(60,180,160,0.1); }
.chat-input-row button {
  background: linear-gradient(135deg, var(--accent) 0%, #2da08e 100%); color: #fff; border: none; border-radius: 10px;
  padding: 12px 24px; font-family: 'Inter', sans-serif; font-weight: 600; font-size: 13px; cursor: pointer;
}
.chat-input-row button:hover { opacity: 0.85; }

/* ===== Badges ===== */
.badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.badge-open { background: rgba(60,180,160,0.12); color: var(--success); }
.badge-closed { background: rgba(100,116,139,0.12); color: var(--muted); }
.badge-ux { background: rgba(168,85,247,0.1); color: #a855f7; }
.badge-performance { background: rgba(245,158,11,0.1); color: var(--warning); }
.badge-data { background: rgba(27,58,92,0.1); color: var(--accent2); }
.badge-integration { background: rgba(60,180,160,0.1); color: var(--accent); }
.badge-other { background: rgba(100,116,139,0.1); color: var(--muted); }

/* ===== Backlog ===== */
.backlog-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.backlog-filters { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; align-items: center; }
.backlog-filters select, .backlog-filters input { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; color: var(--text); font-family: 'Inter', sans-serif; font-size: 13px; }
.filter-btn { background: transparent; border: 1px solid var(--border); border-radius: 8px; padding: 8px 16px; color: var(--muted); font-family: 'Inter', sans-serif; font-size: 13px; cursor: pointer; transition: all 0.2s; }
.filter-btn.active, .filter-btn:hover { border-color: var(--accent); color: var(--accent); background: rgba(60,180,160,0.04); }
.backlog-stats { display: flex; gap: 24px; margin-bottom: 20px; font-size: 13px; }
.backlog-stats span { color: var(--muted); }
.backlog-stats .count { color: var(--text); font-weight: 600; }
.backlog-list { display: grid; gap: 12px; }
.backlog-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; box-shadow: var(--shadow-sm); }
.backlog-card .card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.backlog-card .card-title { font-weight: 600; font-size: 14px; color: var(--text); }
.backlog-card .card-desc { font-size: 13px; color: var(--muted); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 12px; cursor: pointer; }
.backlog-card .card-desc.expanded { -webkit-line-clamp: unset; }
.backlog-card .card-meta { display: flex; align-items: center; gap: 12px; font-size: 11px; color: var(--muted); }
.toggle-status { border: none; border-radius: 12px; padding: 4px 12px; font-family: 'Inter', sans-serif; font-size: 11px; font-weight: 600; cursor: pointer; }
.toggle-status.open { background: rgba(60,180,160,0.12); color: var(--success); }
.toggle-status.closed { background: rgba(100,116,139,0.12); color: var(--muted); }

.btn-primary { background: linear-gradient(135deg, var(--accent) 0%, #2da08e 100%); color: #fff; border: none; border-radius: 10px; padding: 10px 20px; font-family: 'Inter', sans-serif; font-weight: 600; font-size: 13px; cursor: pointer; }
.btn-primary:hover { opacity: 0.85; }
.btn-secondary { background: transparent; color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 10px 20px; font-family: 'Inter', sans-serif; font-size: 13px; cursor: pointer; }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

/* ===== Modal ===== */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); z-index: 200; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
.modal-overlay.active { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 32px; width: 100%; max-width: 500px; box-shadow: 0 20px 60px rgba(0,0,0,0.15); }
.modal h2 { font-weight: 700; font-size: 20px; margin-bottom: 20px; text-transform: none; letter-spacing: 0; border-bottom: none; }
.modal label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; margin-top: 14px; font-weight: 500; }
.modal input, .modal textarea, .modal select { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; color: var(--text); font-family: 'Inter', sans-serif; font-size: 13px; }
.modal textarea { min-height: 80px; resize: vertical; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; }

/* ===== Upload ===== */
.upload-area { border: 2px dashed var(--border); border-radius: 14px; padding: 60px 40px; text-align: center; cursor: pointer; }
.upload-area:hover, .upload-area.dragover { border-color: var(--accent); background: rgba(60,180,160,0.03); }
.upload-area .upload-icon { font-size: 48px; margin-bottom: 16px; }
.upload-area .upload-text { font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.upload-area .upload-hint { font-size: 12px; color: var(--muted); }
.preview-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 16px; }
.preview-table th, .preview-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; }
.preview-table th { color: var(--muted); font-weight: 500; text-transform: uppercase; font-size: 11px; letter-spacing: 0.3px; }

/* ===== Latest Report Card ===== */
.latest-report-card { border: 1px solid var(--border); }

.latest-report-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.report-icon-circle {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, #dbeafe, #eff6ff);
  color: #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ===== Section Description ===== */
.section-desc {
  font-size: 13px;
  color: var(--muted);
  margin-top: -8px;
  margin-bottom: 18px;
  line-height: 1.5;
}

.section-desc strong { color: var(--text); }

/* ===== Compare Bar ===== */
.compare-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}

.compare-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.compare-group label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
  white-space: nowrap;
}

.compare-select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  min-width: 140px;
  transition: border-color 0.2s;
}

.compare-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(60,180,160,0.1);
}

.compare-toggle {
  display: flex;
  background: var(--bg);
  border-radius: 10px;
  padding: 3px;
  border: 1px solid var(--border);
  margin-right: 8px;
}

.toggle-btn {
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.toggle-btn.active {
  background: #fff;
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.toggle-btn:hover:not(.active) {
  color: var(--text);
}

.compare-arrow {
  display: flex;
  align-items: center;
}

/* ===== Growth Grid ===== */
.growth-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.growth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: box-shadow 0.2s;
}

.growth-card:hover { box-shadow: var(--shadow-md); }

.growth-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.growth-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.growth-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
}

.growth-current {
  font-size: 32px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
  line-height: 1.0;
}

.growth-period {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
  font-weight: 500;
}

.growth-comparison {
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.growth-comparison-hdr {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #b0b8c4;
  margin-bottom: 6px;
}

.growth-comparison-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.growth-from {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.growth-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1px;
  flex-shrink: 0;
}

.growth-badge.up {
  background: #d1fae5;
  color: #059669;
}

.growth-badge.down {
  background: #fee2e2;
  color: #dc2626;
}

/* ===== History Table ===== */
.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.history-table thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
  padding: 10px 14px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.history-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.history-table tbody tr:last-child td { border-bottom: none; }

.history-table .td-period {
  font-weight: 600;
  white-space: nowrap;
  color: var(--accent2);
}

.history-table .row-latest {
  background: linear-gradient(135deg, #f0fdf9 0%, #eff6ff 100%);
}

.history-table .row-latest td {
  font-weight: 600;
}

.history-table .row-latest .td-period {
  position: relative;
}

.history-table .row-latest .td-period::after {
  content: 'Latest';
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 10px;
  background: #d1fae5;
  color: #059669;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  vertical-align: middle;
}

/* ===== Mobile ===== */
.mobile-menu-btn {
  display: none; position: fixed; top: 16px; left: 16px; z-index: 101;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; color: var(--text); font-size: 18px; cursor: pointer;
}

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

@media (max-width: 768px) {
  .sidebar { position: fixed; left: -240px; transition: left 0.3s; }
  .sidebar.open { left: 0; }
  .main-content { margin-left: 0; }
  .grid-3, .grid-2, .grid-2-1 { grid-template-columns: 1fr; }
  .hero-grid { grid-template-columns: 1fr 1fr; }
  .growth-grid { grid-template-columns: 1fr 1fr; }
  .db-header-row { grid-template-columns: 1fr; }
  .mobile-menu-btn { display: block; }
  .stat-grid-3 { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .history-table { font-size: 12px; }
  .history-table thead th, .history-table tbody td { padding: 8px 10px; }
  .latest-report-header { flex-direction: column; align-items: flex-start; }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

/* ===== Edit Mode ===== */
.edit-mode-only { display: none !important; }
body.edit-mode .edit-mode-only { display: block !important; }
body.edit-mode .insight-bar { display: flex !important; }

/* Sidebar toggle */
.sidebar-edit-toggle { display: inline; }
.edit-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  font-weight: 500;
}
.edit-mode-btn:hover {
  background: var(--bg);
  color: var(--text);
}
.edit-mode-btn.active {
  background: #6366f1;
  border-color: #6366f1;
  color: #fff;
}

/* Global Data Editor Panel */
.data-editor-panel {
  position: fixed;
  bottom: 0;
  left: 240px;
  right: 0;
  z-index: 90;
  background: #fff;
  border-top: 2px solid #c7d2fe;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
  height: 320px;
  min-height: 120px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
.data-editor-panel .de-resize-handle {
  height: 8px;
  cursor: ns-resize;
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.de-resize-handle::after {
  content: '';
  width: 40px;
  height: 3px;
  background: #cbd5e1;
  border-radius: 2px;
}
.data-editor-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.data-editor-tabs { display: flex; gap: 4px; }
.de-tab {
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.de-tab:hover { border-color: #6366f1; color: #6366f1; }
.de-tab.active { background: #6366f1; color: #fff; border-color: #6366f1; }
.data-editor-actions { display: flex; gap: 6px; }
.de-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.de-btn-apply { background: #10b981; color: #fff; border-color: #10b981; }
.de-btn-apply:hover { background: #059669; }
.de-btn-copy { background: #fff; color: #475569; }
.de-btn-copy:hover { border-color: #6366f1; color: #6366f1; }
.de-btn-reset { background: #fff; color: #94a3b8; }
.de-btn-reset:hover { color: #ef4444; border-color: #ef4444; }
#de-textarea {
  display: block;
  width: 100%;
  border: none;
  padding: 12px 16px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 12px;
  line-height: 1.6;
  color: #1e293b;
  resize: none;
  outline: none;
  overflow-y: auto;
  box-sizing: border-box;
}
.data-editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  font-size: 11px;
  flex-shrink: 0;
}
#de-status { font-weight: 600; }
.de-hint { color: #94a3b8; }
.de-hint code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-size: 10px; }

/* When editor is open, give main content bottom padding */
body.edit-mode .main-content { padding-bottom: 340px; }

@media (max-width: 768px) {
  .data-editor-panel { left: 0; }
}
e .main-content { padding-bottom: 340px; }

@media (max-width: 768px) {
  .data-editor-panel { left: 0; }
}
