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

:root {
  --slate:       #0b1728;
  --slate-mid:   #132240;
  --slate-light: #1e3560;
  --orange:      #2244cc;
  --orange-dark: #1a36b0;
  --orange-glow: rgba(34,68,204,0.15);
  --bg:          #f0f3f8;
  --surface:     #ffffff;
  --surface-2:   #f5f7fb;
  --border:      #dde3ef;
  --text:        #0b1728;
  --text-mid:    #3d5278;
  --text-muted:  #7a90b0;
  --green:       #22c55e;
  --red:         #ef4444;
  --yellow:      #f59e0b;
  --radius:      10px;
  --radius-sm:   6px;
  --shadow:      0 1px 4px rgba(0,0,0,0.07), 0 4px 16px rgba(0,0,0,0.05);
  --shadow-lg:   0 8px 32px rgba(0,0,0,0.14);
  --sidebar-w:   240px;
  --transition:  0.18s ease;
}

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

html { font-size: 15px; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

/* ── 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: 'Big Shoulders Display', sans-serif;
  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: 'Big Shoulders Display', sans-serif;
  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: 'Big Shoulders Display', sans-serif;
  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;
}

.view-title {
  font-family: 'Big Shoulders Display', sans-serif;
  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 {
  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(--orange); }

.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: 'Big Shoulders Display', sans-serif;
  font-size: 42px;
  font-weight: 800;
  color: var(--slate);
  line-height: 1;
  margin-bottom: 4px;
}

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

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

.charts-row {
  display: grid;
  grid-template-columns: repeat(3, 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);
}

.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(--orange); color: var(--orange); }
.page-btn.active { background: var(--orange); color: #fff; border-color: var(--orange); }

/* ── 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: 'Big Shoulders Display', sans-serif;
  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: 'Inter', sans-serif;
  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(--orange);
  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: 'Inter', sans-serif;
}

.btn-primary:hover { background: var(--orange-dark); transform: translateY(-1px); box-shadow: 0 4px 10px rgba(249,115,22,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: 'Inter', sans-serif;
}

.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: 'Inter', sans-serif;
}

.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: repeat(2, 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-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(--green); }

.inv-kpi-val {
  font-family: 'Big Shoulders Display', sans-serif;
  font-size: 34px;
  font-weight: 800;
  color: var(--slate);
  line-height: 1;
  margin-top: 6px;
}

.inv-kpi.accent .inv-kpi-val { color: var(--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%;
}

.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: 'Big Shoulders Display', sans-serif;
  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: 'Inter', sans-serif;
  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: 'Inter', sans-serif;
  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: #f0f4ff;
  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:'Big Shoulders Display',sans-serif;font-size:22px;font-weight:800; }
.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(--orange);
  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(--orange);
  color: #fff;
  border-color: var(--orange);
}

/* ── 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 {
  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: 1.4rem;
  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;
}
