:root {
  --bg: #0b0f1a;
  --bg2: #0d1220;
  --surface: #111827;
  --surface2: #151d2e;
  --surface3: #1a2338;
  --border: #1e2d45;
  --border2: #243556;
  --accent: #4f9cf9;
  --accent2: #38e8b5;
  --accent3: #f97316;
  --accent4: #a78bfa;
  --accent5: #f472b6;
  --text: #e2eaf8;
  --text2: #7a9ab8;
  --text3: #3d5472;
  --danger: #f43f5e;
  --warning: #fbbf24;
  --success: #10b981;
  --mono: 'Roboto Mono', monospace;
  --sans: 'Roboto', sans-serif;
  --sidebar-w: 240px;
  --header-h: 64px;
  --radius: 12px;
  --glow-blue: 0 0 24px rgba(79,156,249,0.18);
  --glow-green: 0 0 24px rgba(56,232,181,0.15);
}

/* ── LIGHT MODE ─────────────────────────────────────────── */
body.light-mode {
  --bg: #f0f4fa;
  --bg2: #e8eef8;
  --surface: #ffffff;
  --surface2: #f5f8ff;
  --surface3: #eaf0fb;
  --border: #ccd8ee;
  --border2: #aabcd8;
  --text: #1a2540;
  --text2: #3d5472;
  --text3: #7a9ab8;
}
body.light-mode .topbar {
  background: rgba(240,244,250,0.92);
}
body.light-mode .search-bar,
body.light-mode input,
body.light-mode select,
body.light-mode textarea {
  background: #eaf0fb;
  color: var(--text);
}
body.light-mode select option { background: #ffffff; }
body.light-mode .label-preview { box-shadow: 0 4px 40px rgba(0,0,0,0.12); }
body.light-mode body::before { background-image: linear-gradient(rgba(79,156,249,0.04) 1px, transparent 1px), linear-gradient(90deg, rgba(79,156,249,0.04) 1px, transparent 1px); }

/* ── CALENDAR SIDE PANEL ─────────────────────────────────── */
.cal-side-panel {
  position: fixed;
  top: 0;
  right: -480px;
  width: 460px;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 500;
  display: flex;
  flex-direction: column;
  transition: right 0.3s cubic-bezier(0.4,0,0.2,1);
  box-shadow: -8px 0 40px rgba(0,0,0,0.3);
  overflow-y: auto;
}
.cal-side-panel.open { right: 0; }
.cal-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 18px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 10;
}
.cal-panel-title {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
}
.cal-panel-close {
  width: 32px; height: 32px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text2);
  font-size: 16px;
  transition: all 0.2s;
}
.cal-panel-close:hover { border-color: var(--danger); color: var(--danger); }
.cal-panel-body { padding: 24px; flex: 1; }
.cal-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 499;
  display: none;
  backdrop-filter: blur(2px);
}
.cal-panel-overlay.open { display: block; }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100%;
  display: flex;
  overflow: hidden;
  height: 100vh;
}

/* Subtle grid overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(79,156,249,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79,156,249,0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

/* ── SIDEBAR ─────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
  backdrop-filter: blur(20px);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 18px;
  border-bottom: 1px solid var(--border);
}

.logo-mark {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--accent), var(--accent4));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  color: white;
  box-shadow: var(--glow-blue);
  flex-shrink: 0;
}

.logo-text {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.04em;
}
.logo-text span { color: var(--accent); }
.logo-sub {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text3);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-top: 1px;
}

.sidebar-section-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text3);
  padding: 18px 20px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  cursor: pointer;
  border-radius: 0;
  transition: all 0.18s;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--text2);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-left: 3px solid transparent;
  position: relative;
}

.nav-item:hover {
  color: var(--text);
  background: rgba(79,156,249,0.06);
}

.nav-item.active {
  color: var(--accent);
  background: rgba(79,156,249,0.1);
  border-left-color: var(--accent);
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}
.nav-item.active .nav-icon { opacity: 1; }

.sidebar-footer {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text3);
  letter-spacing: 0.06em;
}

.status-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--success);
  margin-right: 6px;
  box-shadow: 0 0 6px var(--success);
}

/* ── MAIN LAYOUT ──────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  z-index: 1;
}

/* ── TOPBAR ──────────────────────────────────────────── */
.topbar {
  height: var(--header-h);
  background: rgba(11,15,26,0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  flex-shrink: 0;
  z-index: 100;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.page-title {
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.page-breadcrumb {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 14px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text3);
  cursor: pointer;
  transition: border-color 0.2s;
}
.search-bar:hover { border-color: var(--border2); }

.topbar-btn {
  width: 36px; height: 36px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text2);
  font-size: 16px;
  transition: all 0.2s;
}
.topbar-btn:hover { border-color: var(--accent); color: var(--accent); }

.avatar {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent4));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  color: white;
  cursor: pointer;
}

/* ── PAGE CONTENT ────────────────────────────────────── */
/* Scrollable content area — sits below the sticky topbar */
.page-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.page {
  display: none;
  padding: 28px 32px 60px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  animation: fadeIn 0.18s ease;
}
.page.active { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* Hub panels — shown/hidden by hubSwitchTab */
.hub-panel { 
  display: none;
  width: 100%;
}
.hub-panel[style*="display: block"] {
  display: block !important;
  width: 100%;
}

/* Ensure only one panel is visible at a time */
.page .hub-panel:not([style*="display: block"]) {
  display: none !important;
}


/* ── CARDS ───────────────────────────────────────────── */
