/* ============================================================
   MIIC INVENTORY TRACKER — Stylesheet
   Makerere Innovation and Incubation Centre
   ============================================================ */

/* ── CSS Custom Properties ────────────────────────────────── */
:root {
  --brand-primary:   #1B4F8A;
  --brand-secondary: #00A686;
  --brand-accent:    #FF6B35;

  --sidebar-bg:      #0F1C2E;
  --sidebar-text:    #CBD5E1;
  --sidebar-hover:   rgba(255,255,255,0.06);
  --sidebar-active:  rgba(0,166,134,0.18);
  --sidebar-active-border: #00A686;

  --bg:              #F0F4F8;
  --surface:         #FFFFFF;
  --surface-2:       #F8FAFC;
  --border:          #E2E8F0;
  --border-hover:    #CBD5E1;

  --text-primary:    #1A202C;
  --text-secondary:  #4A5568;
  --text-muted:      #718096;

  --good:            #22C55E;
  --good-bg:         #F0FDF4;
  --good-border:     #BBF7D0;

  --repair:          #EAB308;
  --repair-bg:       #FEFCE8;
  --repair-border:   #FEF08A;

  --replace:         #EF4444;
  --replace-bg:      #FEF2F2;
  --replace-border:  #FECACA;

  --restock:         #3B82F6;
  --restock-bg:      #EFF6FF;
  --restock-border:  #BFDBFE;

  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  16px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08);
  --shadow:     0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.12);

  --sidebar-w:  248px;
  --topbar-h:   64px;
  --transition: 180ms ease;
}

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font: inherit; }
input, select, textarea { font: inherit; }
img { max-width: 100%; }
ul { list-style: none; }

/* ── Auth Screen ──────────────────────────────────────────── */
#auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0F1C2E 0%, #1B4F8A 50%, #00A686 100%);
}
.auth-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.auth-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.auth-logo-icon {
  width: 48px; height: 48px;
  background: var(--brand-primary);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: #fff;
}
.auth-logo-text { font-size: 20px; font-weight: 700; color: var(--brand-primary); }
.auth-subtitle { color: var(--text-muted); font-size: 13px; margin-bottom: 32px; }
.auth-form label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.auth-form input {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text-primary);
  transition: border-color var(--transition);
  outline: none;
  margin-bottom: 16px;
}
.auth-form input:focus { border-color: var(--brand-primary); }
.auth-error { color: var(--replace); font-size: 13px; margin-bottom: 12px; min-height: 18px; }
.btn-login {
  width: 100%; padding: 12px;
  background: linear-gradient(135deg, var(--brand-primary), #2563EB);
  color: #fff; font-size: 15px; font-weight: 600;
  border-radius: var(--radius-sm);
  transition: opacity var(--transition);
}
.btn-login:hover { opacity: 0.9; }
.demo-creds {
  margin-top: 24px;
  background: var(--surface-2); border-radius: var(--radius-sm);
  padding: 14px; font-size: 12px; color: var(--text-muted);
}
.demo-creds strong { display: block; margin-bottom: 4px; color: var(--text-secondary); }

/* ── App Shell ────────────────────────────────────────────── */
#app-shell { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width var(--transition), min-width var(--transition);
  z-index: 100;
}
.sidebar.collapsed { width: 64px; min-width: 64px; }

.sidebar-header {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.sidebar-logo-icon {
  width: 36px; height: 36px; flex-shrink: 0;
  background: var(--brand-secondary);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800; color: #fff;
}
.sidebar-logo-text {
  font-size: 13px; font-weight: 700; color: #fff;
  white-space: nowrap; overflow: hidden;
}
.sidebar-logo-sub { font-size: 10px; color: var(--sidebar-text); opacity: 0.7; }
.sidebar-toggle {
  margin-left: auto; color: var(--sidebar-text); font-size: 18px;
  opacity: 0.6; transition: opacity var(--transition); flex-shrink: 0;
}
.sidebar-toggle:hover { opacity: 1; }

.sidebar-section { padding: 16px 0 8px; }
.sidebar-section-label {
  padding: 0 16px 6px;
  font-size: 10px; font-weight: 600; letter-spacing: 0.08em;
  color: var(--sidebar-text); text-transform: uppercase; opacity: 0.5;
  white-space: nowrap; overflow: hidden;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px;
  color: var(--sidebar-text);
  font-size: 13.5px; font-weight: 500;
  border-radius: 0; cursor: pointer;
  transition: background var(--transition), color var(--transition);
  border-left: 3px solid transparent;
  white-space: nowrap; overflow: hidden;
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active {
  background: var(--sidebar-active);
  color: #fff;
  border-left-color: var(--sidebar-active-border);
}
.nav-item .nav-icon { font-size: 17px; flex-shrink: 0; }
.nav-item .nav-label { overflow: hidden; text-overflow: ellipsis; }
.nav-item .nav-badge {
  margin-left: auto; flex-shrink: 0;
  background: var(--replace); color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 99px;
}
.nav-divider { height: 1px; background: rgba(255,255,255,0.07); margin: 8px 16px; }

.sidebar-footer {
  margin-top: auto;
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.07);
}
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.05);
}
.user-avatar {
  width: 32px; height: 32px; flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
}
.user-info { overflow: hidden; flex: 1; }
.user-name { font-size: 12px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 10px; color: var(--sidebar-text); text-transform: capitalize; opacity: 0.7; }
.btn-logout {
  font-size: 14px; color: var(--sidebar-text); opacity: 0.6;
  transition: opacity var(--transition); flex-shrink: 0;
}
.btn-logout:hover { opacity: 1; color: var(--replace); }

/* ── Main Content ─────────────────────────────────────────── */
.main-content {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; min-width: 0;
}

/* ── Topbar ───────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px;
  flex-shrink: 0;
}
.topbar-title { font-size: 17px; font-weight: 600; color: var(--text-primary); flex: 1; }
.topbar-subtitle { font-size: 12px; color: var(--text-muted); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.topbar-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1.5px solid var(--border);
  border-radius: 99px; padding: 7px 14px;
}
.topbar-search input {
  border: none; background: none; outline: none;
  font-size: 13px; color: var(--text-primary); width: 180px;
}
.topbar-search span { color: var(--text-muted); font-size: 16px; }
.topbar-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--surface-2); border: 1.5px solid var(--border);
  color: var(--text-secondary); font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition), border-color var(--transition);
}
.topbar-btn:hover { background: var(--border); border-color: var(--border-hover); }
.notification-dot {
  position: relative;
}
.notification-dot::after {
  content: '';
  position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px;
  background: var(--replace); border-radius: 50%;
  border: 2px solid var(--surface);
}

/* ── Page Container ───────────────────────────────────────── */
#page-content {
  flex: 1; overflow-y: auto;
  padding: 24px;
}

/* ── Stat Cards ───────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 8px;
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: default;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-label { font-size: 12px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-size: 32px; font-weight: 700; color: var(--text-primary); line-height: 1; }
.stat-sub { font-size: 12px; color: var(--text-muted); }
.stat-icon {
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; margin-bottom: 4px;
}
.stat-card.stat-good    .stat-icon { background: var(--good-bg);    color: var(--good); }
.stat-card.stat-repair  .stat-icon { background: var(--repair-bg);  color: var(--repair); }
.stat-card.stat-replace .stat-icon { background: var(--replace-bg); color: var(--replace); }
.stat-card.stat-restock .stat-icon { background: var(--restock-bg); color: var(--restock); }
.stat-card.stat-total   .stat-icon { background: #EEF2FF;           color: #6366F1; }
.stat-value.text-good    { color: var(--good); }
.stat-value.text-repair  { color: var(--repair); }
.stat-value.text-replace { color: var(--replace); }
.stat-value.text-restock { color: var(--restock); }

/* ── Charts Grid ─────────────────────────────────────────── */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.chart-card.wide { grid-column: span 2; }
.chart-title {
  font-size: 14px; font-weight: 600; color: var(--text-primary);
  margin-bottom: 4px;
}
.chart-subtitle { font-size: 12px; color: var(--text-muted); margin-bottom: 16px; }
.chart-wrap { position: relative; }
.chart-wrap.donut { max-width: 280px; margin: 0 auto; }

/* ── Category Cards ──────────────────────────────────────── */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.cat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  position: relative; overflow: hidden;
}
.cat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--cat-color, var(--brand-primary));
}
.cat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-hover); }
.cat-icon { font-size: 28px; margin-bottom: 10px; }
.cat-name { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.cat-count { font-size: 22px; font-weight: 700; color: var(--text-primary); }
.cat-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.cat-alerts {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 10px;
  font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 99px;
}
.cat-alerts.has-alerts { background: var(--replace-bg); color: var(--replace); }
.cat-alerts.no-alerts  { background: var(--good-bg);    color: var(--good); }

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 99px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
  border: 1px solid transparent;
}
.badge-good    { background: var(--good-bg);    color: #15803D;  border-color: var(--good-border); }
.badge-repair  { background: var(--repair-bg);  color: #A16207;  border-color: var(--repair-border); }
.badge-replace { background: var(--replace-bg); color: #B91C1C;  border-color: var(--replace-border); }
.badge-restock { background: var(--restock-bg); color: #1D4ED8;  border-color: var(--restock-border); }

/* ── Tables ───────────────────────────────────────────────── */
.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}
.table-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap; gap: 10px;
}
.table-title { font-size: 15px; font-weight: 600; color: var(--text-primary); flex: 1; }
.table-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 7px 12px;
}
.table-search input {
  border: none; background: none; outline: none;
  font-size: 13px; width: 160px;
}
.filter-select {
  border: 1.5px solid var(--border); background: var(--surface-2);
  border-radius: var(--radius-sm); padding: 7px 10px;
  font-size: 13px; color: var(--text-secondary); outline: none;
  cursor: pointer;
}
.filter-select:focus { border-color: var(--brand-primary); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead tr { background: var(--surface-2); }
th {
  padding: 11px 16px;
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted);
  text-align: left; white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 12px 16px;
  font-size: 13.5px; color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
tbody tr.clickable { cursor: pointer; }
.qty-cell { font-weight: 600; font-size: 14px; }
.qty-low  { color: var(--replace); }
.qty-mid  { color: var(--repair); }
.stock-bar-wrap { display: flex; align-items: center; gap: 8px; }
.stock-bar {
  flex: 1; height: 6px; background: var(--border);
  border-radius: 99px; overflow: hidden; min-width: 60px;
}
.stock-bar-fill {
  height: 100%; border-radius: 99px;
  transition: width 0.4s ease;
}
.stock-bar-fill.good    { background: var(--good); }
.stock-bar-fill.repair  { background: var(--repair); }
.stock-bar-fill.replace { background: var(--replace); }
.stock-bar-fill.restock { background: var(--restock); }
.stock-pct { font-size: 11px; color: var(--text-muted); font-weight: 600; white-space: nowrap; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  transition: opacity var(--transition), background var(--transition), transform var(--transition);
  white-space: nowrap;
}
.btn:hover { opacity: 0.88; }
.btn:active { transform: scale(0.97); }
.btn-primary   { background: var(--brand-primary); color: #fff; }
.btn-secondary { background: var(--brand-secondary); color: #fff; }
.btn-danger    { background: var(--replace); color: #fff; }
.btn-outline {
  background: transparent; color: var(--text-secondary);
  border: 1.5px solid var(--border);
}
.btn-outline:hover { background: var(--surface-2); border-color: var(--border-hover); }
.btn-icon {
  width: 34px; height: 34px; padding: 0;
  justify-content: center; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface-2); color: var(--text-secondary);
  font-size: 15px;
}
.btn-icon:hover { background: var(--border); }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ── Alerts Panel ────────────────────────────────────────── */
.alerts-list { display: flex; flex-direction: column; gap: 10px; }
.alert-item {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 16px;
  box-shadow: var(--shadow-sm); transition: box-shadow var(--transition);
  cursor: pointer;
}
.alert-item:hover { box-shadow: var(--shadow); }
.alert-item.alert-repair  { border-left: 3px solid var(--repair); }
.alert-item.alert-replace { border-left: 3px solid var(--replace); }
.alert-item.alert-restock { border-left: 3px solid var(--restock); }
.alert-icon {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; flex-shrink: 0;
}
.alert-item.alert-repair  .alert-icon { background: var(--repair-bg);  color: var(--repair); }
.alert-item.alert-replace .alert-icon { background: var(--replace-bg); color: var(--replace); }
.alert-item.alert-restock .alert-icon { background: var(--restock-bg); color: var(--restock); }
.alert-body { flex: 1; min-width: 0; }
.alert-title { font-size: 13.5px; font-weight: 600; color: var(--text-primary); }
.alert-meta  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.alert-action { font-size: 12px; color: var(--brand-primary); font-weight: 500; margin-top: 4px; }

/* ── Detail View ─────────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}
.detail-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  box-shadow: var(--shadow-sm);
}
.detail-header { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.detail-icon {
  width: 56px; height: 56px; border-radius: var(--radius);
  background: #EEF2FF; font-size: 28px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.detail-title { font-size: 20px; font-weight: 700; color: var(--text-primary); }
.detail-id    { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.detail-info-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 16px; margin-bottom: 24px;
}
.info-item label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; display: block; }
.info-item span  { font-size: 14px; font-weight: 600; color: var(--text-primary); }

.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item {
  display: flex; gap: 14px; padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.timeline-item:last-child { border-bottom: none; }
.timeline-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--brand-primary);
  flex-shrink: 0; margin-top: 5px;
}
.timeline-date  { color: var(--text-muted); font-weight: 500; white-space: nowrap; }
.timeline-desc  { color: var(--text-primary); flex: 1; }
.timeline-tech  { color: var(--text-muted); font-size: 12px; }
.timeline-cost  { color: var(--text-secondary); font-weight: 600; white-space: nowrap; font-size: 12px; }

.notes-area {
  width: 100%; min-height: 90px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: 13px; color: var(--text-primary);
  resize: vertical; outline: none;
  transition: border-color var(--transition);
  background: var(--surface-2);
}
.notes-area:focus { border-color: var(--brand-primary); background: #fff; }

.section-title {
  font-size: 14px; font-weight: 600; color: var(--text-primary);
  margin-bottom: 14px; padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}

/* ── Monthly Tracker ─────────────────────────────────────── */
.monthly-row {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 10px; margin-bottom: 20px;
}
.month-cell {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 10px; text-align: center;
}
.month-label { font-size: 11px; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; }
.month-qty   { font-size: 20px; font-weight: 700; color: var(--text-primary); }
.month-change {
  font-size: 11px; margin-top: 2px;
  font-weight: 600;
}
.month-change.up   { color: var(--good); }
.month-change.down { color: var(--replace); }
.month-change.same { color: var(--text-muted); }

/* ── Admin Panel ─────────────────────────────────────────── */
.admin-tabs {
  display: flex; gap: 4px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 4px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.admin-tab {
  padding: 7px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
}
.admin-tab.active { background: #fff; color: var(--brand-primary); box-shadow: var(--shadow-sm); font-weight: 600; }

.form-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: span 2; }
.form-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.form-input, .form-select, .form-textarea {
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 12px; font-size: 13.5px; color: var(--text-primary);
  background: var(--surface-2); outline: none;
  transition: border-color var(--transition), background var(--transition);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--brand-primary); background: #fff;
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }

/* ── Reports Page ─────────────────────────────────────────── */
.reports-grid {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 20px; margin-bottom: 24px;
}
.report-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 12px;
}
.report-card-icon {
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  background: #EEF2FF; font-size: 22px;
  display: flex; align-items: center; justify-content: center;
}
.report-card-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.report-card-desc  { font-size: 12px; color: var(--text-muted); flex: 1; }

/* ── Modal ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45); backdrop-filter: blur(3px);
  z-index: 200; display: flex; align-items: center; justify-content: center;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 28px; width: 100%; max-width: 560px;
  box-shadow: var(--shadow-lg); position: relative;
  max-height: 90vh; overflow-y: auto;
  animation: modalIn 0.2s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-title {
  font-size: 18px; font-weight: 700; margin-bottom: 4px;
}
.modal-subtitle { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; }
.modal-close {
  position: absolute; top: 20px; right: 20px;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 16px; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
.modal-close:hover { background: var(--border); color: var(--text-primary); }

/* ── Toast ────────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 999; display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--sidebar-bg); color: #fff;
  border-radius: var(--radius-sm); padding: 12px 18px;
  font-size: 13.5px; font-weight: 500;
  box-shadow: var(--shadow-lg); min-width: 240px;
  display: flex; align-items: center; gap: 10px;
  animation: toastIn 0.2s ease;
}
.toast.toast-success { border-left: 3px solid var(--good); }
.toast.toast-error   { border-left: 3px solid var(--replace); }
.toast.toast-info    { border-left: 3px solid var(--brand-secondary); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Page Header ─────────────────────────────────────────── */
.page-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 24px; flex-wrap: wrap;
}
.page-back {
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); font-size: 16px;
  transition: background var(--transition);
  cursor: pointer;
}
.page-back:hover { background: var(--border); }
.page-title-block { flex: 1; }
.page-title { font-size: 20px; font-weight: 700; color: var(--text-primary); }
.page-breadcrumb { font-size: 12px; color: var(--text-muted); }
.page-breadcrumb span { color: var(--brand-primary); cursor: pointer; }
.page-breadcrumb span:hover { text-decoration: underline; }

/* ── Empty State ─────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
.empty-state-desc  { font-size: 13px; }

/* ── Progress Donut (small) ──────────────────────────────── */
.mini-donut {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.legend-dot {
  width: 10px; height: 10px; border-radius: 50%;
  display: inline-block; flex-shrink: 0;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 1100px) {
  .charts-grid { grid-template-columns: 1fr; }
  .chart-card.wide { grid-column: span 1; }
  .reports-grid { grid-template-columns: 1fr 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  :root { --sidebar-w: 64px; }
  .sidebar { width: 64px; min-width: 64px; }
  .sidebar-logo-text, .nav-label, .sidebar-section-label,
  .user-info, .nav-badge { display: none; }
  .sidebar-footer .user-chip { justify-content: center; padding: 8px; }
  .sidebar-footer .btn-logout { display: none; }
  #page-content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group.full { grid-column: span 1; }
  .reports-grid { grid-template-columns: 1fr; }
  .monthly-row { grid-template-columns: repeat(3, 1fr); }
  .detail-info-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .category-grid { grid-template-columns: 1fr 1fr; }
  .topbar-search { display: none; }
}

/* ── Utilities ───────────────────────────────────────────── */
.hidden    { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-bold { font-weight: 700; }
.flex      { display: flex; }
.flex-1    { flex: 1; }
.gap-8     { gap: 8px; }
.gap-12    { gap: 12px; }
.gap-16    { gap: 16px; }
.mt-16     { margin-top: 16px; }
.mb-16     { margin-bottom: 16px; }
.mb-24     { margin-bottom: 24px; }

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }
