/* ═══ DESIGN TOKENS ═══ */
:root {
  --bg: #0c0f14;
  --bg2: #13181f;
  --bg3: #1a2029;
  --border: rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.12);
  --text: #e8eaf0;
  --text2: #8a9ab5;
  --text3: #5a6a80;
  --accent: #E8A820; /* Farm Choozin Gold */
  --amber: #f5a623;
  --red: #e05b5b;
  --blue: #4a9fff;
  --purple: #a78bfa;
  --large: #ff7c5c;
  --fc: #E8A820;
  --font: system-ui, -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', monospace;
  
  /* Region Colors */
  --reg-northern: #3b82f6; /* Blue */
  --reg-central: #10b981;  /* Green */
  --reg-southern: #06b6d4; /* Cyan */
  --reg-eastern: #f59e0b;  /* Orange */
  --reg-western: #f43f5e;  /* Pink */
  --reg-northeastern: #8b5cf6; /* Purple */
  --reg-bkk: #fbbf24;      /* Gold */
}

[data-theme="mango"] {
  --bg: #1A0A00; --accent: #FF6B2B;
}
[data-theme="cobalt"] {
  --bg: #060D1F; --accent: #4A9FFF;
}
[data-theme="salt"] {
  --bg: #F5F5F5; --accent: #333333;
}
[data-theme="honey"] {
  --bg: #FDF6E3; --accent: #D4860A; --fc: #B8720A;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  background-color: var(--bg);
  color: var(--text);
  font-size: 13px;
  overflow: hidden;
}

/* Global Utility */
.col-green { color: var(--positive); }
.col-red { color: var(--negative); }

/* Mobile Responsive */
@media (max-width: 768px) {
  .mobile-hamburger {
    display: block;
  }
  .sidebar-spacer {
    display: none !important;
  }
  .sidebar {
    position: fixed;
    transform: translateX(-100%);
    width: 260px !important; /* Full width drawer */
    max-width: 80vw;
    box-shadow: 4px 0 24px rgba(0,0,0,0.5);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .sidebar .logo-text,
  .sidebar .nav-section-label,
  .sidebar .nav-item span,
  .sidebar .sidebar-btn span {
    opacity: 1 !important; /* Always show text on mobile */
  }
}

/* APP SHELL */
.app-shell {
  display: flex;
  height: 100vh; /* Fallback */
  height: 100dvh;
}

.mobile-hamburger {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.sidebar-spacer {
  width: 64px;
  min-width: 64px;
  flex-shrink: 0;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar-spacer.pinned {
  width: 224px;
  min-width: 224px;
}

.sidebar {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 64px;
  z-index: 100;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s ease;
  overflow: hidden;
}

.sidebar:hover, .sidebar.pinned {
  width: 224px;
}

.sidebar-logo {
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
}

.logo-mark {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent);
  margin-right: 8px;
}

.logo-text {
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.sidebar:hover .logo-text, .sidebar.pinned .logo-text {
  opacity: 1;
  transition-delay: 0.1s;
}

.sidebar-nav {
  padding: 12px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-group { margin-bottom: 24px; }

.nav-section-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
  padding-left: 8px;
  opacity: 0;
  white-space: nowrap;
  transition: opacity 0.2s ease;
}

.sidebar:hover .nav-section-label, .sidebar.pinned .nav-section-label {
  opacity: 1;
  transition-delay: 0.1s;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 7px 8px;
  border-radius: 6px;
  gap: 8px;
  color: var(--text2);
  cursor: pointer;
  text-decoration: none;
  margin-bottom: 4px;
}

.nav-item i { font-size: 16px; flex-shrink: 0; width: 16px; text-align: center; }
.nav-item span {
  opacity: 0;
  white-space: nowrap;
  transition: opacity 0.2s ease;
}
.sidebar:hover .nav-item span, .sidebar.pinned .nav-item span {
  opacity: 1;
  transition-delay: 0.1s;
}

.nav-item:hover {
  background: var(--bg3);
  color: var(--text);
}

.nav-item.active {
  background: rgba(34,211,160,0.12);
  color: var(--accent);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text2);
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 6px;
}
}
.sidebar-btn:hover { background: var(--bg3); color: var(--text); }
.sidebar-btn span {
  opacity: 0;
  white-space: nowrap;
  transition: opacity 0.2s ease;
}
.sidebar:hover .sidebar-btn span, .sidebar.pinned .sidebar-btn span {
  opacity: 1;
  transition-delay: 0.1s;
}

.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* TOPBAR REMOVED */

.panel-container {
  flex: 1;
  padding: 0;
  overflow-y: hidden;
  display: flex;
  flex-direction: column;
}

.panel { display: none; flex: 1; min-height: 0; }
.panel.active { display: flex; flex-direction: column; height: 100%; min-height: 0; }

/* COMPONENTS */
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}
.stat-card-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text3);
  letter-spacing: 0.08em;
}
.stat-card-value {
  font-size: 24px;
  font-weight: 600;
  font-family: var(--mono);
  margin-top: 4px;
}
.stat-card-sub {
  font-size: 11px;
  color: var(--text2);
  margin-top: 4px;
}

/* ═══ UI COMPONENTS ═══ */
.region-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
}
.region-pill.region-northern { color: var(--reg-northern); background: rgba(59, 130, 246, 0.15); border: 1px solid rgba(59, 130, 246, 0.3); }
.region-pill.region-central { color: var(--reg-central); background: rgba(16, 185, 129, 0.15); border: 1px solid rgba(16, 185, 129, 0.3); }
.region-pill.region-southern { color: var(--reg-southern); background: rgba(6, 182, 212, 0.15); border: 1px solid rgba(6, 182, 212, 0.3); }
.region-pill.region-eastern { color: var(--reg-eastern); background: rgba(245, 158, 11, 0.15); border: 1px solid rgba(245, 158, 11, 0.3); }
.region-pill.region-western { color: var(--reg-western); background: rgba(244, 63, 94, 0.15); border: 1px solid rgba(244, 63, 94, 0.3); }
.region-pill.region-northeastern { color: var(--reg-northeastern); background: rgba(139, 92, 246, 0.15); border: 1px solid rgba(139, 92, 246, 0.3); }
.region-pill.region-bkk { color: var(--reg-bkk); background: rgba(251, 191, 36, 0.15); border: 1px solid rgba(251, 191, 36, 0.3); }
