:root {
  --brand-primary: #0f4c81;
  --brand-teal: #0e8a8a;
  --brand-gold: #c9a84c;
  
  --bg-base: #070d1a;
  --bg-surface: #0c1526;
  --bg-card: #111e33;
  --bg-card-hover: #162440;
  --bg-glass: rgba(255,255,255,0.04);
  --bg-glass-hover: rgba(255,255,255,0.08);
  --bg-nav: rgba(7,13,26,0.85);
  
  --text-primary: #f0f4ff;
  --text-secondary: #8a9bc5;
  --text-muted: #4a5a7a;
  
  --status-up: #22c55e;
  --status-down: #ef4444;
  
  --border: rgba(255,255,255,0.07);
  --border-accent: rgba(10,140,200,0.25);
  
  --shadow-card: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 40px rgba(14,138,138,0.12);
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

/* Sidebar */
.rail {
  background: var(--bg-nav);
  backdrop-filter: blur(20px);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  margin-bottom: 32px;
}

.brand .mark {
  width: 44px;
  height: 44px;
  background: var(--brand-teal);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 18px;
}

.brand strong {
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 600;
}

.brand small {
  color: var(--text-secondary);
  font-size: 12px;
}

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

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
  text-align: left;
}

.nav-link:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
}

.nav-link.is-active {
  background: var(--brand-teal);
  color: white;
}

.nav-link svg {
  width: 20px;
  height: 20px;
}

.session-card {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: auto;
}

.session-card .user-info {
  color: var(--text-primary);
  font-weight: 600;
}

.session-card .user-email {
  color: var(--text-secondary);
  font-size: 13px;
}

.session-card .role-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  margin-top: 8px;
}

.role-badge.staff { background: var(--brand-gold); color: #000; }
.role-badge.user { background: var(--brand-teal); color: white; }

/* Main content */
.content {
  padding: 32px;
  background: var(--bg-base);
}

/* Panel */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-card);
}

.panel-head {
  margin-bottom: 32px;
}

.panel-head h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}

.panel-head p {
  color: var(--text-secondary);
  font-size: 15px;
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-weight: 500;
  font-size: 14px;
  color: var(--text-secondary);
}

.form-grid label.span-2 { grid-column: span 2; }

.form-grid input,
.form-grid select,
.form-grid textarea {
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  background: var(--bg-surface);
  color: var(--text-primary);
  transition: all 0.2s;
}

.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus {
  outline: none;
  border-color: var(--brand-teal);
  box-shadow: 0 0 0 3px rgba(14,138,138,0.15);
}

.form-grid select option {
  background: var(--bg-surface);
}

.form-grid optgroup {
  color: var(--text-secondary);
}

.form-actions {
  display: flex;
  gap: 16px;
  margin-top: 24px;
  align-items: center;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--brand-teal);
  color: white;
  font-size: 15px;
  font-weight: 600;
  padding: 14px 32px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(14,138,138,0.35);
}

.form-status {
  color: var(--text-secondary);
  font-size: 14px;
}

/* Cards */
.cards { display: flex; flex-direction: column; gap: 16px; }

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: all 0.2s;
}

.card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.card-id {
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-gold);
}

.card-title {
  font-size: 17px;
  font-weight: 600;
  margin: 8px 0;
}

.card-desc {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 16px;
}

.card-meta {
  display: flex;
  gap: 24px;
  font-size: 13px;
}

.card-meta dt { color: var(--text-muted); margin-bottom: 2px; }
.card-meta dd { font-weight: 600; }

.badge {
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
}

.badge-submitted, .badge-pending { background: rgba(245,158,11,0.2); color: #f59e0b; }
.badge-in-progress, .badge-triage { background: rgba(59,130,246,0.2); color: #3b82f6; }
.badge-approved, .badge-completed { background: rgba(34,197,94,0.2); color: #22c55e; }
.badge-rejected, .badge-cancelled { background: rgba(239,68,68,0.2); color: #ef4444; }
.badge-waiting-vendor { background: rgba(139,92,246,0.2); color: #8b5cf6; }

.priority-critical { color: #ef4444; }
.priority-high { color: #f97316; }
.priority-medium { color: #eab308; }
.priority-low { color: #22c55e; }

.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

/* Views */
.view { display: none; }
.view.is-active { display: block; }
.is-hidden { display: none !important; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }
.stat-block {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}
.stat-block h3 { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
.stat-block pre { font-size: 14px; white-space: pre-wrap; color: var(--text-secondary); }

/* Settings */
.settings-section { margin-bottom: 32px; }
.settings-section h3 { font-size: 16px; margin-bottom: 16px; }
.category-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.btn-danger {
  background: var(--status-down);
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
}

/* Detail */
.detail-header {
  display: flex;
  justify-content: space-between;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.back-btn {
  background: none;
  border: none;
  color: var(--brand-teal);
  cursor: pointer;
  font-size: 14px;
  margin-bottom: 16px;
}
.back-btn:hover { text-decoration: underline; }

/* Timeline */
.timeline { position: relative; padding-left: 32px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}
.timeline-event { position: relative; padding: 16px 0; }
.timeline-event::before {
  content: "";
  position: absolute;
  left: -28px;
  top: 20px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--brand-teal);
  border: 3px solid var(--bg-card);
}
.timeline-time { font-size: 12px; color: var(--text-muted); }
.timeline-actor { font-weight: 600; }
.timeline-detail { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }

/* Responsive */
@media (max-width: 768px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: fixed; bottom: 0; top: auto; width: 100%; height: auto; flex-direction: row; padding: 12px; z-index: 100; }
  .nav { flex-direction: row; overflow-x: auto; }
  .brand, .session-card { display: none; }
  .content { padding: 16px; padding-bottom: 80px; }
  .form-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
}