/* ═══════════════════════════════════════════════════════
   CERIOAPP INVENTORY PLANNING — MAIN STYLES
   Palette: Navy #0b1728 / Electric Blue #1a6fff / White surfaces
   Aligned with CERIO brand identity
═══════════════════════════════════════════════════════ */

:root {
  /* Cerio brand blue (accent) — var name kept so all existing usages remap */
  --orange:      #012BBF;
  --orange-dark: #011f8f;
  --orange-glow: #EEF1FB;         /* blue tint: selected nav, subtle accent bg */

  /* Text hierarchy */
  --slate:       #1A1A1A;         /* text primary (also KPI numbers) */
  --slate-mid:   #1A1A1A;
  --slate-light: #5F5E5A;
  --text:        #1A1A1A;
  --text-mid:    #5F5E5A;
  --text-muted:  #888780;
  --text-faint:  #B4B2A9;
  --text-tertiary: #888780;
  --cerio-blue-tint-dark: #E6EBFB;

  /* Surfaces */
  --bg:          #FAFAF7;         /* warm off-white page (NOT pure white) */
  --surface:     #FFFFFF;         /* cards, modals, dropdowns */
  --surface-2:   #F4F3EE;         /* subtle surface: inactive pills/buttons */

  /* Borders */
  --border:      #E5E4DE;
  --border-soft: #F0EFE9;
  --border-strong:#D8D6CE;

  /* Semantic (mapped to guide severity / tone) */
  --green:       #0F6E56;
  --red:         #A32D2D;
  --yellow:      #BA7517;

  /* KPI card indicators — bright, meant to pop (separate from muted severity) */
  --kpi-red:     #FA534A;
  --kpi-yellow:  #FFFD55;
  --kpi-blue:    #3282F6;
  --kpi-blue-dark: #1f6fe0;   /* hover shade for buttons that use the KPI blue */
  --kpi-green:   #75FA8D;
  --kpi-gray:    #5F5E5A;

  /* Fonts */
  --font-display:'Plus Jakarta Sans', ui-sans-serif, system-ui, sans-serif;
  --font-body:   'DM Sans', ui-sans-serif, system-ui, sans-serif;

  --radius:      11px;
  --radius-sm:   6px;
  --shadow:      none;
  --shadow-lg:   none;
  --sidebar-w:   200px;
  --transition:  0.15s ease;
}

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

html { font-size: 15px; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Utilities ── */
.hidden { display: none !important; }
.screen { min-height: 100vh; }

/* ═══════════════════════════════════════════════════════
   LOGIN
═══════════════════════════════════════════════════════ */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0b1728 0%, #132240 60%, #1a3a6b 100%);
  padding: 24px;
}

.login-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 48px 44px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 28px;
}

.login-logo-img { width: 52px; height: 52px; }

.login-brand {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  color: var(--slate);
  line-height: 1;
  text-align: left;
}

.login-sub {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: left;
}

.login-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--slate);
  margin-bottom: 10px;
}

.login-desc {
  font-size: 0.9rem;
  color: var(--text-mid);
  margin-bottom: 32px;
  line-height: 1.6;
}

.sso-buttons { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }

.sso-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 13px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text);
  width: 100%;
}

.sso-btn:hover {
  border-color: var(--orange);
  background: var(--orange-glow);
  color: var(--orange-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(249,115,22,0.2);
}

.login-error {
  background: #fef2f2;
  color: var(--red);
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.85rem;
  margin-bottom: 12px;
}

.login-footer {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 24px;
}

/* ═══════════════════════════════════════════════════════
   APP LAYOUT
═══════════════════════════════════════════════════════ */
#app-screen {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--slate);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  overflow: hidden;
  transition: transform 0.25s ease;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo-img { width: 36px; height: 36px; }

.sidebar-brand {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  line-height: 1;
}

.sidebar-sub {
  font-size: 9.5px;
  font-weight: 500;
  color: rgba(255,255,255,0.45);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  color: rgba(255,255,255,0.6);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.9);
}

.nav-item.active {
  background: var(--orange);
  color: #fff;
  font-weight: 600;
}

.nav-item.active svg { stroke: #fff; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 14px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--orange);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}

.user-info { flex: 1; min-width: 0; }

.user-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.logout-btn {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.35);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color var(--transition);
  flex-shrink: 0;
}

.logout-btn:hover { color: var(--orange); }

/* ── Main Content ── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 32px 36px;
  min-height: 100vh;
}

.view { display: none !important; }
.view.active { display: block !important; }

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
  padding-right: 56px; /* clearance for the fixed global "+" button (top-right) */
}
@media (max-width: 768px) {
  .view-header { padding-right: 0; } /* the "+" moves to bottom-right on mobile */
}

.view-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--slate);
}

.view-date {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.view-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ═══════════════════════════════════════════════════════
   DASHBOARD
═══════════════════════════════════════════════════════ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}

.kpi-card {
  container-type: inline-size;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px;
  height: 100%;
  background: var(--slate-light);
  border-radius: 4px 0 0 4px;
}

.kpi-card.accent::before { background: var(--kpi-blue); }

.kpi-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.kpi-value {
  font-family: var(--font-display);
  font-size: clamp(22px, 20cqi, 42px);
  white-space: nowrap;
  font-weight: 800;
  color: var(--slate);
  line-height: 1;
  margin-bottom: 4px;
}

.kpi-card.accent .kpi-value { color: var(--kpi-blue); }

.kpi-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.charts-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.chart-card, .upcoming-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.chart-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.bar-chart { display: flex; flex-direction: column; gap: 10px; }

.bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bar-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-mid);
  width: 100px;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  flex: 1;
  height: 8px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--orange);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.bar-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-mid);
  width: 28px;
  text-align: right;
  flex-shrink: 0;
}

.prob-high .bar-fill { background: var(--green); }
.prob-medium .bar-fill { background: var(--yellow); }
.prob-low .bar-fill { background: var(--red); }

.upcoming-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.upcoming-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.upcoming-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--orange);
  width: 90px;
  flex-shrink: 0;
}

.upcoming-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.upcoming-units {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-mid);
}

.upcoming-empty {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  padding: 20px;
}

/* ═══════════════════════════════════════════════════════
   PROJECTS TABLE
═══════════════════════════════════════════════════════ */
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-wrap svg {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  padding: 8px 14px 8px 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  background: var(--surface);
  color: var(--text);
  width: 220px;
  transition: border-color var(--transition);
}

.search-input:focus {
  outline: none;
  border-color: var(--orange);
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-select {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color var(--transition);
}

.filter-select:focus {
  outline: none;
  border-color: var(--orange);
}

.filter-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: border-color var(--transition);
}
.filter-check:hover { border-color: var(--kpi-blue); }
.filter-check input { accent-color: var(--kpi-blue); cursor: pointer; margin: 0; }

/* Multi-select checkbox filters */
.ms-filter { position: relative; display: inline-block; }
.ms-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color var(--transition);
  max-width: 220px;
}
.ms-btn:hover { border-color: var(--kpi-blue); }
.ms-btn.ms-active { border-color: var(--kpi-blue); color: var(--kpi-blue); }
.ms-btn-text { overflow: hidden; text-overflow: ellipsis; }
.ms-caret { margin-left: auto; font-size: 0.7rem; opacity: 0.7; }
.ms-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 60;
  min-width: 210px;
  max-height: 300px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 6px 20px rgba(0,0,0,0.18);
  padding: 6px;
}
.ms-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px 6px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.ms-clear { background: none; border: none; color: var(--kpi-blue); cursor: pointer; font-size: 0.75rem; padding: 0; }
.ms-clear:disabled { color: var(--text-muted); cursor: default; }
.ms-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 0.83rem;
  color: var(--text);
  cursor: pointer;
}
.ms-opt:hover { background: var(--surface-2); }
.ms-opt input { accent-color: var(--kpi-blue); cursor: pointer; margin: 0; flex-shrink: 0; }
.ms-empty { padding: 8px; color: var(--text-muted); font-size: 0.8rem; }

.table-wrap {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: auto;
  max-width: 100%;
  width: 100%;
}

.proj-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.proj-table thead {
  background: var(--surface-2);
  border-bottom: 2px solid var(--border);
}

.proj-table th {
  padding: 10px 10px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
}

.proj-table th.sortable { cursor: pointer; user-select: none; }
.proj-table th.sortable:hover { color: var(--orange); }
.sort-icon { font-size: 10px; opacity: 0.5; margin-left: 2px; }

.proj-table td {
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.proj-table tr:last-child td { border-bottom: none; }

.proj-table tbody tr:hover { background: var(--surface-2); }

.table-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 48px !important;
  font-size: 0.9rem;
}

.col-actions {
  width: 80px;
  text-align: center !important;
  position: sticky;
  right: 0;
  background: var(--surface);
  box-shadow: -2px 0 6px rgba(0,0,0,0.06);
  z-index: 2;
}
.proj-table thead .col-actions {
  background: var(--surface-2);
}
.proj-table tbody tr:hover .col-actions {
  background: var(--surface-2);
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.pagination { display: flex; gap: 6px; }

.page-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.82rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.page-btn:hover { border-color: var(--kpi-blue); color: var(--kpi-blue); }
.page-btn.active { background: var(--kpi-blue); color: #fff; border-color: var(--kpi-blue); }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge-green  { background: #dcfce7; color: #15803d; }
.badge-yellow { background: #fef9c3; color: #a16207; }
.badge-red    { background: #fee2e2; color: #b91c1c; }
.badge-slate  { background: #e2e8f0; color: #475569; }
.badge-orange { background: #fff7ed; color: #c2410c; }

.prob-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
}

.prob-high   { background: #dcfce7; color: #15803d; }
.prob-medium { background: #fef9c3; color: #a16207; }
.prob-low    { background: #fee2e2; color: #b91c1c; }

/* ── Row Action Buttons ── */
.action-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 5px 7px;
  border-radius: 4px;
  color: var(--text-muted);
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
}

.action-btn:hover { background: var(--bg); color: var(--orange); }
.action-btn.del:hover { color: var(--red); }

/* ═══════════════════════════════════════════════════════
   MODAL
═══════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28,35,51,0.65);
  backdrop-filter: blur(3px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal {
  background: var(--surface);
  border-radius: 14px;
  width: 100%;
  max-width: 860px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-sm { max-width: 440px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 28px 18px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--slate);
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
  transition: color var(--transition);
}

.modal-close:hover { color: var(--red); }

.modal-body { padding: 24px 28px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.form-group { display: flex; flex-direction: column; gap: 5px; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }

.form-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.req { color: var(--orange); }

.form-input {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  transition: border-color var(--transition);
  width: 100%;
}

.form-input:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-glow);
}

.form-textarea { resize: vertical; min-height: 72px; }

.form-error {
  background: #fef2f2;
  color: var(--red);
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.84rem;
  margin-top: 14px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════ */
.btn-primary {
  background: var(--kpi-blue);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 20px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-body);
}

.btn-primary:hover { background: var(--kpi-blue-dark); transform: translateY(-1px); box-shadow: 0 4px 10px rgba(50,130,246,0.3); }

.btn-ghost {
  background: transparent;
  color: var(--text-mid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 18px;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-body);
}

.btn-ghost:hover { border-color: var(--slate-light); color: var(--text); }

.btn-danger {
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 20px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
  font-family: var(--font-body);
}

.btn-danger:hover { background: #dc2626; }

/* ═══════════════════════════════════════════════════════
   ADMIN
═══════════════════════════════════════════════════════ */
.admin-info {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 20px;
  font-size: 0.88rem;
  color: var(--text-mid);
  line-height: 1.6;
  box-shadow: var(--shadow);
}

.role-select {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
  background: var(--surface);
  cursor: pointer;
}

/* ═══════════════════════════════════════════════════════
   TOAST
═══════════════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--slate);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  z-index: 999;
  box-shadow: var(--shadow-lg);
  max-width: 320px;
  animation: slideUp 0.22s ease;
}

.toast.success { border-left: 4px solid var(--green); }
.toast.error   { border-left: 4px solid var(--red); }
.toast.info    { border-left: 4px solid var(--orange); }

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

/* ═══════════════════════════════════════════════════════
   MOBILE TOPBAR & HAMBURGER
═══════════════════════════════════════════════════════ */
.mobile-topbar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: var(--slate);
  z-index: 150;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.mobile-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  color: #fff;
}

.mobile-topbar-right {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.hamburger {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: rgba(255,255,255,0.9);
  border-radius: 2px;
}

.sidebar-close {
  display: none;
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.5);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  margin-left: auto;
  line-height: 1;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 98;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.sidebar-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE — LARGE (≤1300px)
═══════════════════════════════════════════════════════ */
@media (max-width: 1300px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr) !important; }
  .charts-row { grid-template-columns: 1fr; }
}

@media (max-width: 1100px) {
  .charts-row { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE — TABLET (≤900px)
═══════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .main-content { padding: 24px 16px; }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .span-3 { grid-column: span 2; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .dash-two-col { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE — MOBILE (≤700px)
═══════════════════════════════════════════════════════ */
@media (max-width: 700px) {
  /* Show mobile topbar */
  .mobile-topbar { display: flex; }
  .sidebar-close  { display: block; }

  /* Sidebar hidden off-screen, slides in when JS adds .open */
  .sidebar {
    transform: translateX(-100%) !important;
    z-index: 99;
  }

  .sidebar.open {
    transform: translateX(0) !important;
    box-shadow: 6px 0 32px rgba(0,0,0,0.45);
  }

  /* Main content fills full width, padded below topbar */
  .main-content {
    margin-left: 0 !important;
    padding: 16px 12px;
    padding-top: 72px;
  }

  /* KPIs 2×2 */
  .kpi-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .kpi-card { padding: 14px 16px; }
  .kpi-value { font-size: 26px; }
  .kpi-sub { font-size: 0.72rem; }

  .inv-kpi-strip { grid-template-columns: repeat(2, 1fr) !important; gap: 10px; }
  .inv-kpi-val { font-size: 22px; }
  .inv-kpi { padding: 12px 14px; }
  .inv-kpi .kpi-label { font-size: 0.68rem; }

  /* Charts stack */
  .charts-row { grid-template-columns: 1fr; gap: 12px; }
  .dash-two-col { grid-template-columns: 1fr; gap: 12px; }

  /* View header stacks */
  .view-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .view-actions { width: 100%; flex-wrap: wrap; gap: 8px; }
  .search-input { flex: 1; min-width: 0; }
  .search-wrap { flex: 1; }

  /* Filter bar */
  .filter-bar { flex-wrap: wrap; gap: 6px; }
  .filter-select { font-size: 0.82rem; padding: 6px 8px; }

  /* Tables stay as scrollable rows */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Modals slide up from bottom */
  .modal-overlay { padding: 0 !important; align-items: flex-end !important; }
  .modal { max-width: 100% !important; max-height: 92vh; border-radius: 16px 16px 0 0 !important; }
  .modal-sm { max-width: 100% !important; border-radius: 16px 16px 0 0 !important; }
  .modal-body { padding: 16px; }
  .modal-header { padding: 16px 16px 12px; }
  .modal-footer { flex-wrap: wrap; gap: 8px; }

  /* Form single col */
  .form-grid { grid-template-columns: 1fr !important; }
  .span-2, .span-3 { grid-column: span 1 !important; }

  /* Delivery / alloc add rows */
  .delivery-add-row { flex-direction: column !important; gap: 8px; }
  .delivery-add-row > * { width: 100% !important; }

  /* View-only single col */
  .view-only-grid { grid-template-columns: 1fr !important; }
  .view-section.span-2 { grid-column: span 1 !important; }

  /* Conflict & unallocated */
  .conflict-item { flex-wrap: wrap; gap: 8px; }
  .conflict-days { font-size: 20px; width: auto; }
  .unallocated-item { flex-direction: column; align-items: flex-start; gap: 8px; }

  /* Inv avail chart */
  .inv-avail-months { height: 90px; }
  .inv-avail-count  { font-size: 0.58rem; }
  .inv-avail-label  { font-size: 0.56rem; }

  /* Alloc meter */
  .alloc-meter-wrap { flex-direction: column; align-items: flex-start; max-width: 100%; }

  /* Login */
  .login-card { padding: 28px 20px; }
  .login-brand { font-size: 22px; }

  /* Table footer */
  .table-footer { flex-direction: column; gap: 8px; }
}

@media (max-width: 420px) {
  .kpi-grid { grid-template-columns: 1fr !important; }
  .inv-kpi-strip { grid-template-columns: 1fr !important; }
}

/* ── Email/Password Login Form ── */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
  text-align: left;
}

.btn-login-submit {
  width: 100%;
  padding: 12px;
  font-size: 0.95rem;
  margin-top: 4px;
}

/* ═══════════════════════════════════════════════════════
   FILE ATTACHMENTS
═══════════════════════════════════════════════════════ */
.files-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.files-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.file-upload-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.82rem;
  padding: 6px 14px;
}

.file-input-hidden {
  display: none;
}

.files-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.files-empty {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 16px;
  text-align: center;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
}

.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition);
}

.file-item:hover {
  border-color: var(--orange);
}

.file-icon {
  flex-shrink: 0;
  width: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-info {
  flex: 1;
  min-width: 0;
}

.file-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.file-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.file-upload-progress {
  margin-top: 10px;
  font-size: 0.83rem;
  color: var(--orange);
  font-weight: 500;
  padding: 8px 12px;
  background: var(--orange-glow);
  border-radius: var(--radius-sm);
}

/* ═══════════════════════════════════════════════════════
   DELIVERY SCHEDULE
═══════════════════════════════════════════════════════ */
.delivery-add-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.delivery-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.delivery-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition);
}

.delivery-item:hover { border-color: var(--orange); }

.delivery-date {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--slate);
  width: 140px;
  flex-shrink: 0;
}
.delivery-date svg { flex-shrink: 0; }

.delivery-units { flex-shrink: 0; }

.delivery-notes {
  flex: 1;
  font-size: 0.82rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.delivery-summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: var(--orange-glow);
  border: 1px solid rgba(249,115,22,0.2);
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
  color: var(--text-mid);
  margin-top: 4px;
}

.delivery-summary strong { color: var(--slate); }

/* ═══════════════════════════════════════════════════════
   INVENTORY
═══════════════════════════════════════════════════════ */
.inv-kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.inv-kpi {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  border-left: 4px solid var(--slate-light);
}

.inv-kpi.accent { border-left-color: var(--kpi-green); }

.inv-kpi-val {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 800;
  color: var(--slate);
  line-height: 1;
  margin-top: 6px;
}

.inv-kpi.accent .inv-kpi-val { color: var(--kpi-green); }

/* Allocation meter */
.alloc-meter-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  max-width: 300px;
}

.alloc-meter-track {
  flex: 1;
  height: 10px;
  background: var(--bg);
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.alloc-meter-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.4s ease, background 0.4s ease;
}

.alloc-meter-label {
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text-mid);
}

/* Dashboard two-column layout */
.dash-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}


/* ═══════════════════════════════════════════════════════
   INVENTORY AVAILABILITY CHART
═══════════════════════════════════════════════════════ */
.inv-avail-chart {
  width: 100%;
}

.proj-inv-flow {
  width: 100%;
  overflow-x: auto;
}
.proj-inv-flow .flow-node:hover rect {
  stroke-width: 1.5;
}

.inv-avail-months {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 140px;
  padding-bottom: 0;
}

.inv-avail-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  cursor: default;
  position: relative;
}

.inv-avail-col:hover .inv-avail-bar { opacity: 0.8; }

.inv-avail-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--orange);
  height: 16px;
  line-height: 16px;
  text-align: center;
}

.inv-avail-bar-wrap {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  padding: 0 1px;
}

.inv-avail-bar {
  width: 100%;
  background: var(--orange);
  border-radius: 3px 3px 0 0;
  transition: height 0.5s ease, opacity 0.2s;
  min-height: 4px;
}

.inv-avail-bar-empty {
  background: var(--border);
  min-height: 4px !important;
  height: 4px !important;
}

.inv-avail-bar-now {
  background: var(--slate);
}

.inv-avail-label {
  font-size: 0.58rem;
  font-weight: 500;
  color: var(--text-muted);
  text-align: center;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.inv-avail-label-now {
  color: var(--slate);
  font-weight: 700;
}

.inv-avail-footer {
  margin-top: 12px;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: right;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

/* ═══════════════════════════════════════════════════════
   CONFLICT ALERTS
═══════════════════════════════════════════════════════ */
.conflicts-card {
  border: 1px solid #fecaca !important;
  background: #fff8f8 !important;
}

.conflicts-card .chart-title {
  color: var(--red) !important;
  margin-bottom: 14px;
}

.conflict-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  border: 1px solid;
}

.conflict-high {
  background: #fef2f2;
  border-color: #fecaca;
}

.conflict-medium {
  background: #fffbeb;
  border-color: #fde68a;
}

.conflict-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  padding-top: 2px;
  width: 72px;
  flex-shrink: 0;
}

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

.conflict-project {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.conflict-item-name {
  font-size: 0.8rem;
  color: var(--text-mid);
  margin-bottom: 3px;
}

.conflict-detail {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.conflict-days {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  text-align: center;
  line-height: 1;
  flex-shrink: 0;
  width: 52px;
  padding-top: 2px;
}

.conflict-days-high { color: var(--red); }
.conflict-days-med  { color: var(--yellow); }

/* Expand KPI grid to 5 columns */
.kpi-grid {
  grid-template-columns: repeat(5, 1fr) !important;
}


/* ── Sort indicators ── */
.proj-table th.sortable,
.inv-sortable {
  cursor: pointer;
  user-select: none;
  transition: color var(--transition);
  white-space: nowrap;
}

.proj-table th.sortable:hover,
.inv-sortable:hover {
  color: var(--orange);
}

.sort-icon {
  font-size: 10px;
  opacity: 0.5;
  margin-left: 3px;
  transition: opacity var(--transition);
}

th[style*="color: var(--orange)"] .sort-icon,
th[style*="color:var(--orange)"] .sort-icon {
  opacity: 1;
}

/* Make both tables scroll horizontally on wide data */
/* proj-table min-width removed — table now scrolls within wrapper */
#inv-table  { min-width: 1000px; }

/* ═══════════════════════════════════════════════════════
   PROJECT COMPLETE TOGGLE
═══════════════════════════════════════════════════════ */
.col-complete {
  width: 44px;
  text-align: center !important;
  padding: 8px 6px !important;
}

.complete-toggle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease;
  color: transparent;
  flex-shrink: 0;
}

.complete-toggle:hover {
  border-color: var(--green);
  color: var(--green);
  background: #dcfce7;
  transform: scale(1.1);
}

.complete-toggle.complete-on {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.complete-toggle.complete-on:hover {
  background: #16a34a;
  border-color: #16a34a;
  color: #fff;
}

.complete-toggle:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Completed rows are visually dimmed */
.row-complete td {
  opacity: 0.55;
}

.row-complete td.col-complete {
  opacity: 1;
}

.row-complete td strong {
  text-decoration: line-through;
  color: var(--text-muted);
}


/* ── Complete button in modal footer ── */
.btn-complete-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-body);
  border: 2px solid var(--green);
  background: transparent;
  color: var(--green);
  transition: all var(--transition);
}

.btn-complete-toggle:hover {
  background: var(--green);
  color: #fff;
}

.btn-complete-toggle.btn-complete-done {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

.btn-complete-toggle.btn-complete-done:hover {
  background: #16a34a;
  border-color: #16a34a;
}

.btn-complete-toggle:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Conflict clickable links */
.conflict-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: inherit;
  color: inherit;
  padding: 0;
  text-align: left;
  transition: color var(--transition);
}

.conflict-link:hover {
  color: var(--orange);
  text-decoration: underline;
}

.conflict-link svg {
  flex-shrink: 0;
  opacity: 0.5;
}

.conflict-link:hover svg {
  opacity: 1;
}

/* Inventory KPI strip — 5 columns */
.inv-kpi-strip {
  grid-template-columns: repeat(5, 1fr) !important;
}


/* ═══════════════════════════════════════════════════════
   VIEW-ONLY MODALS
═══════════════════════════════════════════════════════ */
.view-only-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.view-section {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.view-section.span-2 { grid-column: span 2; }

.view-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.view-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.view-field {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.view-field-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 100px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.view-field-val {
  font-size: 0.88rem;
  color: var(--text);
}

/* Clickable rows */
.proj-table tbody tr:hover,
#inv-table tbody tr:hover {
  background: var(--surface-2);
  cursor: pointer;
}


/* ═══════════════════════════════════════════════════════
   UNALLOCATED PROJECTS ALERT
═══════════════════════════════════════════════════════ */
.unallocated-card {
  border: 1px solid #fde68a !important;
  background: #fffdf0 !important;
}

.unallocated-card .chart-title {
  color: #92400e !important;
  margin-bottom: 14px;
}

.unallocated-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  transition: border-color var(--transition);
}

.unallocated-item:last-child { margin-bottom: 0; }
.unallocated-item:hover { border-color: var(--orange); }

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

.unallocated-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.unallocated-meta span::before {
  content: '·';
  margin-right: 5px;
  opacity: 0.4;
}

.unallocated-meta span:first-child::before { display: none; }

.unallocated-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.unallocated-date {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.unallocated-date.urgency-high { color: var(--red); font-weight: 700; }
.unallocated-date.urgency-med  { color: var(--yellow); font-weight: 600; }

/* Expand KPI grid for extra cards */
.kpi-grid {
  grid-template-columns: repeat(3, 1fr) !important;
}


/* ── New tab elements ── */
.nav-badge { display:inline-flex;align-items:center;justify-content:center;min-width:18px;height:18px;padding:0 4px;border-radius:99px;background:var(--red);color:#fff;font-size:0.65rem;font-weight:700;margin-left:auto;line-height:1; }
.kpi-card-link { cursor:pointer;border:none;text-align:left;width:100%;font-family:inherit;transition:all var(--transition); }
.kpi-card-link:hover { transform:translateY(-2px);box-shadow:0 4px 16px rgba(0,0,0,0.12); }
.kpi-card-link .kpi-sub { color:var(--orange);font-weight:600; }
.alert-summary-strip { display:flex;gap:12px;margin-bottom:20px;flex-wrap:wrap; }
.alert-summary-chip { display:flex;align-items:center;gap:10px;padding:10px 18px;border-radius:var(--radius);border:1px solid; }
.chip-red    { background:#fef2f2;border-color:#fecaca;color:#b91c1c; }
.chip-slate  { background:var(--surface-2);border-color:var(--border);color:var(--text-mid); }
.alert-chip-btn { cursor:pointer;font-family:inherit;font-size:inherit;transition:all var(--transition); }
.alert-chip-btn:hover { transform:translateY(-1px);box-shadow:0 2px 8px rgba(0,0,0,0.12); }
.alert-chip-btn.chip-active { outline:2px solid var(--orange);outline-offset:2px; }
.chip-label  { font-size:0.78rem;font-weight:600; }
.chip-val    { font-family:var(--font-display);font-size:22px;font-weight:500; }
.alert-meta-chip { display:inline-flex;align-items:center;gap:3px;font-size:0.76rem;font-weight:500;color:var(--text-mid);background:var(--surface);border:1px solid var(--border);border-radius:4px;padding:2px 7px;white-space:nowrap; }
.badge-yellow { background:#fef9c3;color:#a16207; }
.status-won     { background:#dcfce7;color:#15803d; }
.status-lost    { background:#fee2e2;color:#b91c1c; }
.status-expired { background:#fef9c3;color:#a16207; }
.status-active  { background:var(--surface-2);color:var(--text-muted); }

/* ── Request Access ── */
.link-btn {
  background: transparent;
  border: none;
  color: var(--orange);
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
  padding: 0;
  text-decoration: underline;
  font-weight: 600;
}

.link-btn:hover { color: var(--orange-dark); }

.req-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.req-item:last-child { border-bottom: none; }

.req-info { flex: 1; min-width: 0; }

.req-name { font-size: 0.9rem; margin-bottom: 3px; }

.req-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.req-actions { display: flex; gap: 8px; flex-shrink: 0; }

.form-success { color:var(--green);font-size:0.85rem;padding:6px 10px;background:#f0fdf4;border:1px solid #86efac;border-radius:6px; }

/* ── AI Spec Review Panel ─────────────────────────────── */
.ai-review-panel {
  background: linear-gradient(135deg, #f0f7ff 0%, #fafafa 100%);
  border: 1px solid #c7dff7;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 18px;
}
.ai-review-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--text-1);
}
.ai-review-header svg { color: var(--orange); flex-shrink: 0; }
.ai-review-hint { font-size: 0.8rem; color: var(--text-2); margin-left: 4px; }
.ai-review-body {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.ai-upload-zone {
  flex: 1;
  min-width: 200px;
  border: 2px dashed #93c5fd;
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-2);
  background: #fff;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.ai-upload-zone:hover { border-color: var(--orange); background: #fff9f5; }
.ai-upload-zone svg { flex-shrink: 0; color: #60a5fa; }
.ai-file-link { color: var(--orange); cursor: pointer; text-decoration: underline; }
.ai-file-chosen { font-weight: 600; color: var(--text-1); font-size: 0.82rem; }
.ai-existing-files {
  width: 100%;
  margin-bottom: 8px;
  font-size: 0.82rem;
  color: var(--text-2);
}
.ai-existing-file-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  margin: 3px 4px 3px 0;
  border: 1px solid #93c5fd;
  border-radius: 20px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition);
}
.ai-existing-file-btn:hover { background: #dbeafe; border-color: var(--orange); color: var(--orange); }
.ai-existing-file-btn.selected { background: var(--orange); border-color: var(--orange); color: #fff; }
.ai-review-result {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1.5;
}
.ai-review-result.success {
  background: #f0fdf4;
  border: 1px solid #86efac;
  color: #166534;
}
.ai-review-result.error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}
.ai-review-result.loading {
  background: #f0f7ff;
  border: 1px solid #c7dff7;
  color: #1e40af;
  display: flex;
  align-items: center;
  gap: 10px;
}
.ai-filled-fields { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.ai-field-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 12px;
  background: #dcfce7;
  border: 1px solid #86efac;
  color: #166534;
  font-size: 0.78rem;
  font-weight: 600;
}
.ai-spinner {
  width: 16px; height: 16px;
  border: 2px solid #c7dff7;
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.ai-field-highlight { animation: ai-flash 1.2s ease; }
@keyframes ai-flash {
  0%   { background: #fef9c3; }
  100% { background: transparent; }
}

/* ── Custom dropdown + add option button ─────────────── */
.custom-select-wrap {
  display: flex;
  gap: 6px;
  align-items: center;
}
.custom-select-wrap select {
  flex: 1;
}
.btn-add-option {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--kpi-blue);
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  line-height: 1;
}
.btn-add-option:hover {
  background: var(--kpi-blue);
  color: #fff;
  border-color: var(--kpi-blue);
}

/* ── Quote Tool ──────────────────────────────────────── */
.quote-tool-wrap {
  max-width: 700px;
}

.quote-mode-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
}

.quote-mode-btn {
  flex: 1;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-mid);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.quote-mode-btn.active {
  background: var(--orange);
  color: #fff;
  box-shadow: 0 2px 8px rgba(34,68,204,0.25);
}

.quote-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 28px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.quote-card-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.quote-fields {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.quote-field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.quote-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-mid);
}

.quote-input {
  font-size: 1rem !important;
}

.quote-results {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quote-result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.quote-result-label {
  font-size: 0.85rem;
  color: var(--text-mid);
  font-weight: 500;
}

.quote-result-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.quote-result-highlight {
  color: var(--orange);
  font-size: 1.1rem;
}

.quote-result-profit {
  color: var(--green);
}

.quote-defs {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.quote-def {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.quote-def strong {
  color: var(--text-mid);
}

@media (max-width: 600px) {
  .quote-fields { grid-template-columns: 1fr; }
  .quote-mode-bar { flex-direction: column; }
}

/* ── Project KPI Strip ───────────────────────────────── */
.proj-kpi-strip {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.proj-kpi-card {
  container-type: inline-size;
  flex: 1;
  min-width: 110px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow);
  border-left: 3px solid var(--orange);
}
.proj-kpi-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.proj-kpi-val {
  font-size: clamp(0.85rem, 8cqi, 1.4rem);
  white-space: nowrap;
  font-weight: 700;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  line-height: 1.2;
}
.proj-kpi-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Project Map ──────────────────────────────────────────── */
.map-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
#project-map {
  width: 100%;
  height: calc(100vh - 190px);
  min-height: 420px;
  background: var(--surface-2);
}
.leaflet-container { font-family: var(--font-body), system-ui, sans-serif; }
.leaflet-popup-content { margin: 10px 12px; font-size: 0.85rem; color: var(--text); }
.map-popup-title { font-weight: 600; color: var(--slate); margin-bottom: 2px; }
.map-popup-loc   { color: var(--text-mid); font-size: 0.78rem; margin-bottom: 6px; }
.map-popup-proj  { padding: 4px 0; border-top: 1px solid var(--border); line-height: 1.3; }
.map-popup-proj .cust { color: var(--text-muted); font-size: 0.76rem; }
.map-marker-count {
  background: var(--orange); color: #fff; border-radius: 50%;
  width: 26px; height: 26px; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.8rem; box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  border: 2px solid #fff;
}

/* ── New status badges ────────────────────────────────────── */
.status-active    { background:#e0e7ff; color:#3730a3; }
.status-execution { background:#ffedd5; color:#b45309; }
.status-delivered { background:#ccfbf1; color:#0f766e; }

/* ── Completed Projects status sections ───────────────────── */
.comp-section-row td {
  background: var(--surface-2);
  color: var(--text);
  border-left: 3px solid var(--orange);
  border-top: 2px solid var(--border);
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 10px 16px;
}
.comp-section-count {
  display: inline-block;
  margin-left: 8px;
  background: var(--slate);
  color: #fff;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 9px;
  vertical-align: middle;
}
.comp-section-note {
  margin-left: 10px;
  font-weight: 500;
  font-size: 0.74rem;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
}

/* ── Open Projects: rows colour-coded by alert type ───────── */
.proj-table tbody tr.row-alert-pastdue td      { background:#fecaca; }   /* red  — past-due delivery */
.proj-table tbody tr.row-alert-pastdue:hover td { background:#fca5a5; }
.proj-table tbody tr.row-alert-conflict td      { background:#ffedd5; }  /* orange — timing conflict */
.proj-table tbody tr.row-alert-conflict:hover td { background:#fed7aa; }
.proj-table tbody tr.row-alert-unallocated td      { background:#fef9c3; } /* yellow — no inventory */
.proj-table tbody tr.row-alert-unallocated:hover td { background:#fdee9e; }

.alert-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 4px 2px 12px;
  font-size: 0.78rem;
  color: var(--text-mid);
}
.alert-legend-label { font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.72rem; }
.alert-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.alert-swatch { width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(0,0,0,0.12); display: inline-block; }
.sw-pastdue     { background:#fecaca; }
.sw-conflict    { background:#ffedd5; }
.sw-unallocated { background:#fef9c3; }

/* ── Scheduled View (delivery matrix) ─────────────────────── */
.schedule-wrap {
  overflow: auto;
  max-height: calc(100vh - 235px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--surface);
}
.schedule-table { border-collapse: separate; border-spacing: 0; font-size: 0.82rem; width: max-content; min-width: 100%; }
.schedule-table th, .schedule-table td {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 6px 10px;
  white-space: nowrap;
}
/* sticky header (two rows) */
.schedule-table thead th { position: sticky; background: var(--surface-2); z-index: 3; }
.schedule-table thead tr:first-child th { top: 0; height: 30px; }
.schedule-table thead tr:nth-child(2) th { top: 31px; }
.sched-year  { text-align: center; font-weight: 800; color: var(--slate); }
.sched-month { text-align: center; font-weight: 600; color: var(--text-mid); min-width: 48px; }
/* sticky first column */
.sched-corner, .sched-proj {
  position: sticky; left: 0; background: var(--surface); z-index: 2;
  text-align: left; min-width: 190px; max-width: 240px;
}
.schedule-table thead .sched-corner { z-index: 4; background: var(--surface-2); vertical-align: middle; }
.sched-proj-name { font-weight: 600; color: var(--slate); white-space: normal; line-height: 1.2; }
.sched-proj-cust { font-size: 0.72rem; color: var(--text-muted); white-space: normal; }
.sched-cell { text-align: center; font-family: 'JetBrains Mono', monospace; color: var(--text-mid); }
.sched-cell.has-units { background: var(--orange-glow); font-weight: 700; color: var(--slate); }
.sched-total-col, .sched-rowtotal { font-weight: 800; background: var(--surface-2); color: var(--slate); }
/* current-month emphasis */
.sched-cell.sched-current { background: rgba(245,158,11,0.10); }
.sched-cell.sched-current.has-units { background: rgba(245,158,11,0.28); }
.schedule-table thead th.sched-current { background: #fde68a; color: var(--slate); }
/* totals footer pinned to bottom */
.sched-foot { position: sticky; bottom: 0; background: var(--surface-2); font-weight: 800; color: var(--slate); z-index: 2; }
.sched-foot.sched-proj { z-index: 3; }
.schedule-table tbody tr { cursor: pointer; }
.schedule-table tbody tr:hover td:not(.has-units):not(.sched-rowtotal) { background: var(--surface-2); }

/* ── Scheduled View: info columns, stage sections, issue rows ── */
.sched-info-head { text-align: center; font-weight: 600; color: var(--text-mid); }
.sched-info { text-align: center; color: var(--text-mid); font-size: 0.8rem; min-width: 90px; }
.sched-section-cell {
  position: sticky; left: 0;
  background: var(--slate); color: #fff;
  font-weight: 800; font-size: 0.8rem; letter-spacing: 0.03em;
  padding: 7px 14px; text-align: left; z-index: 1;
}
/* whole-row issue colour-coding */
.schedule-table tbody tr.sched-alert-pastdue     td, .schedule-table tbody tr.sched-alert-pastdue     th.sched-proj { background:#fecaca; }
.schedule-table tbody tr.sched-alert-pastdue     td.has-units { background:#f87171; }
.schedule-table tbody tr.sched-alert-conflict    td, .schedule-table tbody tr.sched-alert-conflict    th.sched-proj { background:#ffedd5; }
.schedule-table tbody tr.sched-alert-conflict    td.has-units { background:#fdba74; }
.schedule-table tbody tr.sched-alert-unallocated td, .schedule-table tbody tr.sched-alert-unallocated th.sched-proj { background:#fef9c3; }
.schedule-table tbody tr.sched-alert-unallocated td.has-units { background:#fde047; }
.sw-stage-active    { background:#eef0ff; border-color:#6366f1; }
.sw-stage-execution { background:#fff7ea; border-color:#f59e0b; }

/* ── Availability units summary / mismatch alert ──────────── */
.avail-summary { font-size: 0.8rem; font-weight: 700; padding: 3px 12px; border-radius: 999px; }
.avail-summary:empty { display: none; }
.avail-summary.ok      { background:#dcfce7; color:#15803d; }
.avail-summary.warn    { background:#fef9c3; color:#a16207; }
.avail-summary.over    { background:#fee2e2; color:#b91c1c; }
.avail-summary.neutral { background:var(--surface-2); color:var(--text-mid); }

/* ── Inventory units mismatch flag ────────────────────────── */
.avail-flag { color: var(--red); font-weight: 700; cursor: help; margin-left: 2px; }

/* ── Role preview banner ──────────────────────────────────── */
.preview-banner {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  background: #fde68a;
  color: #713f12;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  padding: 10px 16px;
  margin-bottom: 18px;
  font-size: 0.86rem;
  box-shadow: var(--shadow);
}
.preview-banner strong { color: #713f12; }
.preview-banner button {
  background: #713f12;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.preview-banner button:hover { background: #92500f; }

/* ═══════════════════════════════════════════════════════════
   CERIO THEME ALIGNMENT  (full design-system reskin)
   Overrides that bring the app in line with the Cerio Theme Guide.
═══════════════════════════════════════════════════════════ */

/* Fonts & weight restraint (guide: two fonts, max weight 500) */
body { font-family: var(--font-body); }
h1,h2,h3,h4,h5,h6,
.view-title,.sidebar-brand,.kpi-value,.proj-kpi-val,.chart-title,.modal-title,
.login-title { font-family: var(--font-display); letter-spacing: -0.01em; }
h1,h2,h3,h4,h5,h6,.view-title,.sidebar-brand,.kpi-value,.proj-kpi-val,
.modal-title,.login-title,strong,b,.nav-item.active,.btn-primary,.badge,
th,.kpi-label { font-weight: 500 !important; }

/* Borders 0.5px, no shadows (guide) */
.kpi-card,.proj-kpi-card,.card,.chart-card,.admin-info,.table-wrap,.schedule-wrap,
.modal,.login-card,.filter-select,.form-input,.map-wrap,.view-section,
.delivery-item,.files-section { box-shadow: none !important; border-width: 0.5px !important; }

/* ── Sidebar → white (guide) ── */
.sidebar { background: var(--surface); border-right: 0.5px solid var(--border); }
.sidebar-logo { border-bottom: 0.5px solid var(--border); }
.sidebar-brand { color: var(--text); }
.sidebar-sub { color: var(--text-tertiary, #888780); }
.nav-item { color: var(--text-secondary, #5F5E5A); font-weight: 400; }
.nav-item svg { stroke: #5F5E5A; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--orange-glow); color: var(--orange); }
.nav-item.active svg { stroke: var(--orange); }
.sidebar-user { border-top: 0.5px solid var(--border); }
.user-avatar { background: var(--cerio-blue-tint-dark, #E6EBFB); color: var(--orange); font-weight: 500; }
.user-name { color: var(--text); }
.user-role { color: var(--text-muted); }
.logout-btn { color: var(--text-muted); }
.logout-btn:hover { color: var(--orange); }
.sidebar-close { color: var(--text-mid); }

/* ── Login → off-white page, clean card (guide) ── */
.login-wrap { background: var(--bg); }
.login-card { background: var(--surface); border: 0.5px solid var(--border); box-shadow: none; }

/* ── KPI numbers: display font, weight 500, primary text ── */
.kpi-value { color: var(--text); font-weight: 500 !important; }

/* ── Buttons (guide) ── */
.btn-primary { background: var(--kpi-blue); color: #fff; border-radius: 6px; }
.btn-primary:hover { background: var(--kpi-blue-dark); }
.btn-ghost { border-radius: 6px; }

/* ── Severity / alert tints remapped to guide palette ── */
/* Open Projects rows */
.proj-table tbody tr.row-alert-pastdue td,
.proj-table tbody tr.row-alert-pastdue:hover td      { background:#FCEBEB; }
.proj-table tbody tr.row-alert-conflict td,
.proj-table tbody tr.row-alert-conflict:hover td     { background:#FBF3E1; }
.proj-table tbody tr.row-alert-unallocated td,
.proj-table tbody tr.row-alert-unallocated:hover td  { background:#F4F3EE; }
/* Legend swatches */
.sw-pastdue     { background:#FCEBEB; border-color:#F0BABA; }
.sw-conflict    { background:#FBF3E1; border-color:#EFE0BC; }
.sw-unallocated { background:#F4F3EE; border-color:#E5E4DE; }
/* Schedule whole-row tints */
.schedule-table tbody tr.sched-alert-pastdue td,
.schedule-table tbody tr.sched-alert-pastdue th.sched-proj      { background:#FCEBEB; }
.schedule-table tbody tr.sched-alert-pastdue td.has-units       { background:#F6D6D6; }
.schedule-table tbody tr.sched-alert-conflict td,
.schedule-table tbody tr.sched-alert-conflict th.sched-proj     { background:#FBF3E1; }
.schedule-table tbody tr.sched-alert-conflict td.has-units      { background:#F3E3BE; }
.schedule-table tbody tr.sched-alert-unallocated td,
.schedule-table tbody tr.sched-alert-unallocated th.sched-proj  { background:#F4F3EE; }
.schedule-table tbody tr.sched-alert-unallocated td.has-units   { background:#E9E7DF; }
/* has-units accent (non-alert) → blue tint */
.sched-cell.has-units { background: var(--orange-glow); color: var(--text); }
.sched-cell.sched-current { background:#FBF3E1; }
.schedule-table thead th.sched-current { background:#FBF3E1; color: var(--text); }
/* Schedule stage section header → subtle surface + blue accent (not near-black) */
.sched-section-cell { background: var(--surface-2); color: var(--text); border-left: 3px solid var(--orange); }

/* Availability summary pill → guide tints */
.avail-summary.ok      { background:#F2F8EA; color:#3B6D11; }
.avail-summary.warn    { background:#FBF3E1; color:#854F0B; }
.avail-summary.over    { background:#FCEBEB; color:#791F1F; }
.avail-summary.neutral { background:var(--surface-2); color:var(--text-mid); }

/* Inventory mismatch flag */
.avail-flag { color:#A32D2D; }

/* ── Preview banner → guide medium/amber tint (not saturated yellow) ── */
.preview-banner { background:#FBF3E1; color:#633806; border:0.5px solid #EFE0BC; box-shadow:none; }
.preview-banner strong { color:#633806; }
.preview-banner button { background:#633806; }
.preview-banner button:hover { background:#7a4708; }

/* ── Badges softened to guide tints ── */
.badge-green { background:#F2F8EA; color:#3B6D11; }
.badge-slate { background:#F4F3EE; color:#444441; }

/* Mobile top bar → white (guide: light header) */
.mobile-topbar { background: var(--surface); border-bottom: 0.5px solid var(--border); }
.mobile-topbar, .mobile-topbar .mobile-view-title, .mobile-topbar .hamburger { color: var(--text); }
.hamburger svg, .sidebar-close svg, .mobile-topbar svg { stroke: var(--text); }
/* Completed-section count badge → blue tint */
.comp-section-count { background: var(--orange-glow); color: var(--orange); }

/* ═══════════════════════════════════════════════════════════
   THEME TOGGLE + DARK MODE
═══════════════════════════════════════════════════════════ */
.theme-toggle { display:inline-flex; background:var(--surface-2); border:0.5px solid var(--border); border-radius:12px; padding:3px; gap:2px; }
.theme-opt { border:none; background:transparent; color:var(--text-mid); font-family:var(--font-body); font-size:0.82rem; font-weight:500; padding:6px 18px; border-radius:9px; cursor:pointer; transition:all var(--transition); }
.theme-opt.active { background:var(--surface); color:var(--orange); border:0.5px solid var(--border); }

/* ── Dark palette (tokens) ── */
html.dark {
  --orange:      #6E8BFF;                 /* lightened Cerio blue for contrast on dark */
  --orange-dark: #5877f0;
  --orange-glow: rgba(110,139,255,0.16);
  --slate:       #F2F1EC;
  --slate-mid:   #F2F1EC;
  --slate-light: #B8B7B0;
  --text:        #F2F1EC;
  --text-mid:    #B8B7B0;
  --text-muted:  #8A8981;
  --text-faint:  #6E6D66;
  --text-tertiary:#8A8981;
  --bg:          #16161A;
  --surface:     #1E1E24;
  --surface-2:   #26262C;
  --border:      #33333B;
  --border-soft: #2A2A31;
  --border-strong:#42424C;
  --green:       #6FC59B;
  --red:         #E88C8C;
  --yellow:      #E0B15C;
  --cerio-blue-tint-dark: #262C44;
}

/* Sidebar icon strokes follow text in dark */
html.dark .nav-item svg { stroke: var(--text-mid); }

/* Toast (uses --slate which flips light in dark) */
html.dark .toast { background:#2E2E36; color:var(--text); border:0.5px solid var(--border); }

/* Base badges */
html.dark .badge-green  { background:#1F3320; color:#8FD3A5; }
html.dark .badge-yellow { background:#33290F; color:#E0B15C; }
html.dark .badge-red    { background:#3A2020; color:#E88C8C; }
html.dark .badge-slate  { background:#2A2A2E; color:#B8B7B0; }
html.dark .badge-orange { background:#33290F; color:#E0A56C; }

/* Status badges */
html.dark .status-won,
html.dark .status-delivered { background:#163B36; color:#7FD3C4; }
html.dark .status-lost      { background:#3A2020; color:#E88C8C; }
html.dark .status-expired   { background:#33290F; color:#E0B15C; }
html.dark .status-active    { background:#23293F; color:#A9B8FF; }
html.dark .status-execution { background:#3A2E14; color:#E0B15C; }

/* Severity / alert tints — Open Projects rows */
html.dark .proj-table tbody tr.row-alert-pastdue td,
html.dark .proj-table tbody tr.row-alert-pastdue:hover td      { background:#3A2020; }
html.dark .proj-table tbody tr.row-alert-conflict td,
html.dark .proj-table tbody tr.row-alert-conflict:hover td     { background:#33290F; }
html.dark .proj-table tbody tr.row-alert-unallocated td,
html.dark .proj-table tbody tr.row-alert-unallocated:hover td  { background:#2A2A2E; }
/* Legend swatches */
html.dark .sw-pastdue     { background:#3A2020; border-color:#5A2E2E; }
html.dark .sw-conflict    { background:#33290F; border-color:#524015; }
html.dark .sw-unallocated { background:#2A2A2E; border-color:#42424C; }
/* Scheduled View rows */
html.dark .schedule-table tbody tr.sched-alert-pastdue td,
html.dark .schedule-table tbody tr.sched-alert-pastdue th.sched-proj      { background:#3A2020; }
html.dark .schedule-table tbody tr.sched-alert-pastdue td.has-units       { background:#4E2A2A; }
html.dark .schedule-table tbody tr.sched-alert-conflict td,
html.dark .schedule-table tbody tr.sched-alert-conflict th.sched-proj     { background:#33290F; }
html.dark .schedule-table tbody tr.sched-alert-conflict td.has-units      { background:#473814; }
html.dark .schedule-table tbody tr.sched-alert-unallocated td,
html.dark .schedule-table tbody tr.sched-alert-unallocated th.sched-proj  { background:#2A2A2E; }
html.dark .schedule-table tbody tr.sched-alert-unallocated td.has-units   { background:#35353B; }
html.dark .sched-cell.sched-current { background:#33290F; }
html.dark .schedule-table thead th.sched-current { background:#33290F; color:var(--text); }

/* Availability summary pill */
html.dark .avail-summary.ok      { background:#1F3320; color:#8FD3A5; }
html.dark .avail-summary.warn    { background:#33290F; color:#E0B15C; }
html.dark .avail-summary.over    { background:#3A2020; color:#E88C8C; }
html.dark .avail-flag { color:#E88C8C; }

/* Preview banner */
html.dark .preview-banner { background:#33290F; color:#E6C877; border-color:#524015; }
html.dark .preview-banner strong { color:#E6C877; }
html.dark .preview-banner button { background:#E6C877; color:#1A1A1A; }
html.dark .preview-banner button:hover { background:#f0d488; }

/* "Disabled" user badge */
html.dark .badge[style*="fee2e2"] { background:#3A2020 !important; color:#E88C8C !important; }

/* ═══════════════════════════════════════════════════════════
   TWEAKS — muted chart tints, clearer alert colors, section headers
═══════════════════════════════════════════════════════════ */

/* Probability chart row tints → guide tints (light + dark) */
.prob-high   { background:#F2F8EA; color:#3B6D11; }
.prob-medium { background:#FBF3E1; color:#854F0B; }
.prob-low    { background:#FCEBEB; color:#791F1F; }
html.dark .prob-high   { background:#1F3320; color:#8FD3A5; }
html.dark .prob-medium { background:#33290F; color:#E0B15C; }
html.dark .prob-low    { background:#3A2020; color:#E88C8C; }

/* Inventory timing conflict → pastel orange ; No inventory → pastel yellow */
/* Legend swatches (shared by Open Projects + Scheduled View) */
.sw-conflict    { background:#FBDCC0; border-color:#F0B27E; }
.sw-unallocated { background:#FCF3B8; border-color:#ECDC6E; }
html.dark .sw-conflict    { background:#3E2E17; border-color:#5C4620; }
html.dark .sw-unallocated { background:#3A3410; border-color:#565015; }

/* Open Projects rows */
.proj-table tbody tr.row-alert-conflict td,
.proj-table tbody tr.row-alert-conflict:hover td     { background:#FBDCC0; }
.proj-table tbody tr.row-alert-unallocated td,
.proj-table tbody tr.row-alert-unallocated:hover td  { background:#FCF3B8; }
html.dark .proj-table tbody tr.row-alert-conflict td,
html.dark .proj-table tbody tr.row-alert-conflict:hover td     { background:#3E2E17; }
html.dark .proj-table tbody tr.row-alert-unallocated td,
html.dark .proj-table tbody tr.row-alert-unallocated:hover td  { background:#3A3410; }

/* Scheduled View rows + has-units */
.schedule-table tbody tr.sched-alert-conflict td,
.schedule-table tbody tr.sched-alert-conflict th.sched-proj     { background:#FBDCC0; }
.schedule-table tbody tr.sched-alert-conflict td.has-units      { background:#F5C193; }
.schedule-table tbody tr.sched-alert-unallocated td,
.schedule-table tbody tr.sched-alert-unallocated th.sched-proj  { background:#FCF3B8; }
.schedule-table tbody tr.sched-alert-unallocated td.has-units   { background:#F6E98A; }
html.dark .schedule-table tbody tr.sched-alert-conflict td,
html.dark .schedule-table tbody tr.sched-alert-conflict th.sched-proj     { background:#3E2E17; }
html.dark .schedule-table tbody tr.sched-alert-conflict td.has-units      { background:#54401D; }
html.dark .schedule-table tbody tr.sched-alert-unallocated td,
html.dark .schedule-table tbody tr.sched-alert-unallocated th.sched-proj  { background:#3A3410; }
html.dark .schedule-table tbody tr.sched-alert-unallocated td.has-units   { background:#4E4718; }

/* Scheduled View: stage section headers slightly larger than rows */
.sched-section-cell { font-size: 0.92rem; font-weight: 500; letter-spacing: 0.01em; }

/* ═══════════════════════════════════════════════════════════
   Option A — tinted KPI status cards (alerts / no-inventory)
   High Probability + all neutral cards stay white/gray.
═══════════════════════════════════════════════════════════ */
.kpi-card.kpi-tint-red    { background:#FCEBEB; }
.kpi-card.kpi-tint-red::before { background:#D85A5A; }
.kpi-card.kpi-tint-red .kpi-value { color:#791F1F; }
.kpi-card.kpi-tint-red .kpi-label,
.kpi-card.kpi-tint-red .kpi-sub   { color:#8A2A2A; }

.kpi-card.kpi-tint-yellow { background:#FCF3B8; }
.kpi-card.kpi-tint-yellow::before { background:#E0A800; }
.kpi-card.kpi-tint-yellow .kpi-value { color:#6B5308; }
.kpi-card.kpi-tint-yellow .kpi-label,
.kpi-card.kpi-tint-yellow .kpi-sub   { color:#7A5F0A; }

.kpi-card.kpi-tint-green  { background:#EAF6EF; }
.kpi-card.kpi-tint-green::before { background:#4CA574; }
.kpi-card.kpi-tint-green .kpi-value { color:#1F6B4A; }
.kpi-card.kpi-tint-green .kpi-label,
.kpi-card.kpi-tint-green .kpi-sub   { color:#2F7D57; }

/* Dark mode — deep tints so cards don't glow */
html.dark .kpi-card.kpi-tint-red    { background:#2E1A1A; }
html.dark .kpi-card.kpi-tint-red::before { background:#E88C8C; }
html.dark .kpi-card.kpi-tint-red .kpi-value { color:#F0B4B4; }
html.dark .kpi-card.kpi-tint-red .kpi-label,
html.dark .kpi-card.kpi-tint-red .kpi-sub   { color:#E0A0A0; }

html.dark .kpi-card.kpi-tint-yellow { background:#2E2810; }
html.dark .kpi-card.kpi-tint-yellow::before { background:#E0B15C; }
html.dark .kpi-card.kpi-tint-yellow .kpi-value { color:#E6C877; }
html.dark .kpi-card.kpi-tint-yellow .kpi-label,
html.dark .kpi-card.kpi-tint-yellow .kpi-sub   { color:#D9B96A; }

html.dark .kpi-card.kpi-tint-green  { background:#16261E; }
html.dark .kpi-card.kpi-tint-green::before { background:#6FC59B; }
html.dark .kpi-card.kpi-tint-green .kpi-value { color:#8FD3A5; }
html.dark .kpi-card.kpi-tint-green .kpi-label,
html.dark .kpi-card.kpi-tint-green .kpi-sub   { color:#7FC59A; }

/* ═══════════════════════════════════════════════════════════
   Alerts tab — color-code cards + chips by TYPE
   (matches scheduled view / KPI palette; proper dark variants)
   past-due = red · timing conflict = orange · no inventory = yellow
═══════════════════════════════════════════════════════════ */
.conflict-item.alert-type-pastdue     { background:#FCEBEB; border-color:#F0BABA; }
.conflict-item.alert-type-conflict    { background:#FBDCC0; border-color:#F0B27E; }
.conflict-item.alert-type-unallocated { background:#FCF3B8; border-color:#ECDC6E; }
html.dark .conflict-item.alert-type-pastdue     { background:#2E1A1A; border-color:#5A2E2E; }
html.dark .conflict-item.alert-type-conflict    { background:#3E2E17; border-color:#5C4620; }
html.dark .conflict-item.alert-type-unallocated { background:#2E2810; border-color:#524015; }

.alert-summary-chip.chip-pastdue     { background:#FCEBEB;border-color:#F0BABA;color:#791F1F; }
.alert-summary-chip.chip-conflict    { background:#FBDCC0;border-color:#F0B27E;color:#7A3D0F; }
.alert-summary-chip.chip-unallocated { background:#FCF3B8;border-color:#ECDC6E;color:#7A5F0A; }
html.dark .alert-summary-chip.chip-pastdue     { background:#2E1A1A;border-color:#5A2E2E;color:#F0B4B4; }
html.dark .alert-summary-chip.chip-conflict    { background:#3E2E17;border-color:#5C4620;color:#E8B583; }
html.dark .alert-summary-chip.chip-unallocated { background:#2E2810;border-color:#524015;color:#E6C877; }

/* Dark-mode fix for the dashboard Conflicts / No-Inventory cards (shared too-light bug) */
html.dark .conflicts-card   { background:#241416 !important; border-color:#5A2E2E !important; }
html.dark .unallocated-card { background:#241E10 !important; border-color:#524015 !important; }
html.dark .unallocated-card .chart-title { color:#E0B15C !important; }
html.dark .conflict-high    { background:#2E1A1A; border-color:#5A2E2E; }
html.dark .conflict-medium  { background:#33290F; border-color:#524015; }
html.dark .unallocated-item { background:#26262C; border-color:#524015; }

/* ═══════════════════════════════════════════════════════════
   Inventory split section headers + mobile fixes
═══════════════════════════════════════════════════════════ */
.inv-section-cell {
  background: var(--surface-2);
  color: var(--text);
  border-left: 3px solid var(--orange);
  border-top: 2px solid var(--border);
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 10px 16px;
  text-align: left;
}

/* Mobile hamburger + close button: legible in light AND dark (was hardcoded white) */
.hamburger span { background: var(--text); }
.sidebar-close  { color: var(--text-mid); }

/* Contain Leaflet's internal z-index so the map can't cover the nav/menus */
.map-wrap { position: relative; z-index: 1; }

@media (max-width: 700px) {
  .mobile-topbar   { z-index: 1100; }
  .sidebar         { z-index: 1200; }
  .sidebar-overlay { z-index: 1150; }
}

/* ═══════════════════════════════════════════════════════════
   Dashboard chart colors — muted blue/green to match the palette
═══════════════════════════════════════════════════════════ */
:root { --chart-blue: #5E77B8; --chart-green: #6E9E82; }
html.dark { --chart-blue: #7B93D0; --chart-green: #84B89C; }

/* Salesperson bars (default bar-fill) → muted blue */
.bar-fill { background: var(--chart-blue); }
/* Probability "High" bar → muted green (medium/low keep their tints) */
.prob-high .bar-fill { background: var(--chart-green); }

/* ── Revenue Metrics tab ─────────────────────────────── */
.rev-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:16px; margin-top:16px; }
@media (max-width:900px){ .rev-grid { grid-template-columns:1fr; } }
.rev-table { width:100%; border-collapse:collapse; font-size:0.85rem; }
.rev-table th { text-align:left; font-family:var(--font-display); font-weight:500; font-size:0.72rem; text-transform:uppercase; letter-spacing:0.04em; color:var(--text-mid); padding:6px 8px; border-bottom:0.5px solid var(--border); }
.rev-table td { padding:7px 8px; border-bottom:0.5px solid var(--border); color:var(--text); }
.rev-table tbody tr:last-child td { border-bottom:none; }
.rev-table .rev-total td { font-weight:700; border-top:1px solid var(--border); border-bottom:none; }
.rev-num { text-align:right; font-family:'JetBrains Mono', monospace; white-space:nowrap; }

/* ═══════════════════════════════════════════════════════
   TRAINING VIEW
═══════════════════════════════════════════════════════ */
.training-doc {
  max-width: 860px;
  color: var(--text);
  line-height: 1.6;
  font-size: 0.95rem;
}
.training-lead {
  font-size: 1.02rem;
  color: var(--text-muted);
  margin: 0 0 8px;
}
.training-h {
  font-size: 1.18rem;
  font-weight: 700;
  color: var(--text);
  margin: 30px 0 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--border);
}
.training-h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 18px 0 6px;
}
.training-doc p { margin: 0 0 12px; }
.training-list, .training-steps { margin: 0 0 12px; padding-left: 22px; }
.training-list li, .training-steps li { margin-bottom: 6px; }
.training-note-inline { color: var(--text-muted); font-size: 0.9rem; }

/* Definition lists */
.training-defs { margin: 0 0 14px; }
.training-defs dt {
  font-weight: 700;
  color: var(--kpi-blue);
  margin-top: 10px;
}
.training-defs dd {
  margin: 2px 0 0;
  padding-left: 0;
}

/* Callouts */
.training-callout {
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin: 6px 0 16px;
  font-size: 0.92rem;
  border-left: 4px solid var(--border-strong);
  background: var(--surface-2);
}
.training-callout-important { border-left-color: #e0952b; background: rgba(224,149,43,0.08); }
.training-callout-tip       { border-left-color: var(--kpi-blue); background: rgba(43,113,224,0.07); }
.training-callout-key       { border-left-color: var(--orange); background: rgba(1,43,191,0.06); }

/* Screenshot placeholders (replace inner div with <img> later) */
.training-shot { margin: 4px 0 16px; }
.training-shot img { max-width: 100%; height: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); display: block; }
.training-shot-ph {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 22px 18px;
  text-align: center;
  font-style: italic;
}

/* Quick-reference table */
.training-table {
  width: 100%;
  border-collapse: collapse;
  margin: 4px 0 16px;
  font-size: 0.9rem;
}
.training-table th, .training-table td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
}
.training-table th { background: var(--surface-2); font-weight: 700; }

/* Allocations Chart legend */
.flow-legend { display:flex; align-items:center; flex-wrap:wrap; gap:14px; margin:2px 0 10px; font-size:0.8rem; color:var(--text-muted); }
.flow-legend-item { display:inline-flex; align-items:center; gap:6px; }
.flow-legend-swatch { width:14px; height:14px; border-radius:3px; display:inline-block; flex-shrink:0; }
.flow-legend-open { background: var(--surface-2); border:1px solid var(--border-strong); }
.flow-legend-done { background: rgba(95,158,121,0.14); border:1.75px solid #5f9e79; }
.flow-legend-note { font-style: italic; opacity:0.85; }

/* Dropdown Options manager (User Admin) */
.dd-group { margin-bottom: 14px; }
.dd-group-title { font-size: 0.82rem; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.dd-options { display: flex; flex-wrap: wrap; gap: 8px; }
.dd-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.83rem;
}
.dd-chip-val { color: var(--text); }
.dd-chip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  line-height: 1;
  padding: 0;
}
.dd-chip-btn:hover { background: var(--kpi-blue); color: #fff; }
.dd-chip-del:hover { background: var(--red, #d64545); color: #fff; }

/* Global quick-add button */
.global-add { position: fixed; top: 14px; right: 18px; z-index: 96; }
.global-add-btn {
  width: 42px; height: 42px; border-radius: 50%;
  border: none; background: var(--kpi-blue); color: #fff;
  font-size: 1.6rem; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 12px rgba(0,0,0,0.22);
  transition: background var(--transition), transform var(--transition);
}
.global-add-btn:hover { background: var(--kpi-blue-dark); transform: translateY(-1px); }
.global-add-menu {
  position: absolute; top: 50px; right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: 0 6px 22px rgba(0,0,0,0.18);
  padding: 6px; min-width: 200px; display: flex; flex-direction: column; gap: 2px;
}
.global-add-menu[hidden] { display: none; }
.global-add-item {
  text-align: left; background: none; border: none; cursor: pointer;
  padding: 10px 12px; border-radius: 6px; font-size: 0.88rem; color: var(--text);
}
.global-add-item:hover { background: var(--surface-2); }
@media (max-width: 768px) {
  /* Move clear of the mobile top bar and any per-tab header buttons */
  .global-add { top: auto; bottom: 20px; right: 16px; }
  .global-add-menu { top: auto; bottom: 52px; }
}

/* Feedback */
.fb-type-toggle { display: flex; gap: 8px; }
#feedback-modal-overlay .modal-body { display: flex; flex-direction: column; gap: 16px; }
#feedback-modal-overlay .modal-footer { padding: 18px 28px 24px; }
.fb-type-btn {
  flex: 1; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface);
  color: var(--text); cursor: pointer; font-size: 0.88rem;
}
.fb-type-btn.active { border-color: var(--kpi-blue); background: rgba(43,113,224,0.08); color: var(--kpi-blue); font-weight: 600; }
.fb-list { display: flex; flex-direction: column; gap: 10px; }
.fb-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface); }
.fb-card-top { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.fb-type { font-size: 0.82rem; font-weight: 600; color: var(--text); }
.fb-date { font-size: 0.76rem; color: var(--text-muted); }
.fb-msg { font-size: 0.9rem; color: var(--text); white-space: pre-wrap; }
.fb-page, .fb-meta { font-size: 0.76rem; color: var(--text-muted); margin-top: 6px; }
.fb-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* Quote tool — multi cost lines */
.q-cost-lines { display: flex; flex-direction: column; gap: 6px; }
.q-cost-line { display: flex; gap: 6px; align-items: center; }
.q-cost-line .q-cost-desc { flex: 1 1 auto; min-width: 0; }
.q-cost-line .q-cost-amt { width: 140px; flex-shrink: 0; text-align: right; }
.q-cost-remove {
  flex-shrink: 0; width: 30px; height: 30px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text-muted);
  cursor: pointer; font-size: 0.8rem; line-height: 1;
}
.q-cost-remove:hover { background: var(--red, #d64545); color: #fff; border-color: transparent; }
.q-add-cost-btn {
  align-self: flex-start; margin-top: 8px;
  background: none; border: 1px dashed var(--border); border-radius: 6px;
  color: var(--kpi-blue); cursor: pointer; font-size: 0.8rem; padding: 6px 12px;
}
.q-add-cost-btn:hover { background: var(--surface-2); border-color: var(--kpi-blue); }
.q-cost-total-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border);
}
.q-cost-total-label { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); }
.q-cost-total-val { font-family: 'JetBrains Mono', monospace; font-weight: 700; color: var(--text); }
