:root {
  --bg: #0f1117;
  --bg-card: #1a1d27;
  --bg-sidebar: #13151e;
  --bg-hover: #222639;
  --border: #2a2e3d;
  --text: #e4e6ef;
  --text-muted: #8b8fa3;
  --text-dim: #5e6278;
  --accent: #6366f1;
  --accent-light: #818cf8;
  --green: #22c55e;
  --green-dim: #16a34a;
  --red: #ef4444;
  --yellow: #eab308;
  --orange: #f97316;
  --blue: #3b82f6;
  --purple: #a855f7;
  --pink: #ec4899;
  --cyan: #06b6d4;
  --radius: 10px;
  --shadow: 0 2px 8px rgba(0,0,0,.3);
}

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

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

a { color: var(--accent-light); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Sidebar */
.sidebar {
  width: 240px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-brand {
  padding: 24px 20px 8px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-light);
  letter-spacing: -0.3px;
}

.sidebar-brand p {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
  line-height: 1.4;
  padding-bottom: 12px;
}

.sidebar-nav { padding: 12px 0; flex: 1; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: all .15s;
  border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
  background: var(--bg-hover);
  color: var(--text);
  text-decoration: none;
}

.sidebar-nav a.active {
  color: var(--accent-light);
  background: rgba(99, 102, 241, .08);
  border-left-color: var(--accent);
}

.sidebar-nav .nav-icon {
  width: 20px;
  text-align: center;
  font-size: 16px;
}

/* Main */
.main {
  margin-left: 240px;
  flex: 1;
  min-height: 100vh;
}

.topbar {
  padding: 20px 32px 0;
}

.topbar h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.topbar p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.content {
  padding: 24px 32px 48px;
}

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

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

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

.kpi-card .kpi-value {
  font-size: 32px;
  font-weight: 700;
  margin-top: 6px;
  line-height: 1;
}

.kpi-card .kpi-sub {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 6px;
}

/* Section */
.section {
  margin-bottom: 32px;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Cards grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

/* Event card */
.event-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .2s;
}

.event-card:hover {
  border-color: var(--accent);
}

.event-card-img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: var(--bg-hover);
}

.event-card-img-placeholder {
  width: 100%;
  height: 160px;
  background: linear-gradient(135deg, var(--bg-hover) 0%, var(--bg-card) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 32px;
}

.event-card-body {
  padding: 16px;
}

.event-card-body h3 {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.event-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.event-card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 12px;
}

.event-card-dates {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.event-card-actions {
  display: flex;
  gap: 8px;
}

/* Chips / Badges */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .3px;
}

.chip-games { background: rgba(99,102,241,.15); color: var(--accent-light); }
.chip-entertainment { background: rgba(236,72,153,.15); color: var(--pink); }
.chip-shopping { background: rgba(249,115,22,.15); color: var(--orange); }
.chip-finance { background: rgba(34,197,94,.15); color: var(--green); }
.chip-social { background: rgba(6,182,212,.15); color: var(--cyan); }
.chip-outro { background: rgba(139,143,163,.15); color: var(--text-muted); }

.chip-event-type {
  background: rgba(168,85,247,.15);
  color: var(--purple);
}

.chip-days {
  background: rgba(234,179,8,.15);
  color: var(--yellow);
}

.chip-days.urgent {
  background: rgba(239,68,68,.15);
  color: var(--red);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-hover);
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
}

.btn:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  text-decoration: none;
}

.btn-sm { padding: 4px 10px; font-size: 11px; }

/* Tables */
.table-wrap {
  overflow-x: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid rgba(42,46,61,.5);
  vertical-align: middle;
}

tbody tr:hover { background: var(--bg-hover); }
tbody tr:last-child td { border-bottom: none; }

.td-app { font-weight: 600; }

/* Status badges */
.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.status-success .status-dot { background: var(--green); }
.status-success { color: var(--green); }

.status-error .status-dot { background: var(--red); }
.status-error { color: var(--red); }

.status-partial .status-dot { background: var(--yellow); }
.status-partial { color: var(--yellow); }

.status-pending .status-dot { background: var(--text-dim); }
.status-pending { color: var(--text-dim); }

/* Vertical cards */
.vertical-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.vertical-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.vertical-card h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.vertical-card .v-stat {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(42,46,61,.5);
  font-size: 13px;
}

.vertical-card .v-stat:last-child { border-bottom: none; }

.vertical-card .v-stat .v-label { color: var(--text-muted); }
.vertical-card .v-stat .v-value { font-weight: 600; }

/* Insights */
.insight-box {
  background: rgba(99,102,241,.08);
  border: 1px solid rgba(99,102,241,.2);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 24px;
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
}

.insight-box strong { color: var(--accent-light); }

/* Timeline */
.timeline-group {
  margin-bottom: 28px;
}

.timeline-group h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.timeline-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  border-radius: 8px;
  transition: background .15s;
}

.timeline-item:hover { background: var(--bg-hover); }

.timeline-item-img {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg-hover);
  flex-shrink: 0;
}

.timeline-item-body { flex: 1; min-width: 0; }

.timeline-item-body h4 {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-item-body p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.timeline-item-badge { flex-shrink: 0; }

/* Filters */
.filters {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}

.filters select, .filters input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
}

.filters select:focus, .filters input:focus {
  border-color: var(--accent);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.empty-state p {
  font-size: 14px;
  line-height: 1.6;
}

/* Error page */
.error-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
}

.error-page h2 { color: var(--red); margin-bottom: 8px; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .cards-grid { grid-template-columns: 1fr; }
}
