/* ============================================================
   EEP — App Shared Styles
   Used by: login.html, dashboard.html, load-analysis.html,
            reports.html, team.html, single-line.html
   ============================================================ */

:root {
  --font-ui: "Inter", "Segoe UI", Roboto, Arial, sans-serif;
  --page-bg: #f7f9fc;
  --white: #ffffff;
  --navy-950: #061836;
  --navy-900: #082048;
  --blue-700: #0b5ed7;
  --blue-650: #1268e8;
  --blue-600: #176ff2;
  --blue-500: #2d86ff;
  --blue-75: #f2f7ff;
  --text-950: #0c1f3f;
  --text-850: #162b52;
  --text-700: #3d4c66;
  --text-600: #526176;
  --text-500: #718097;
  --line: #dfe7f2;
  --line-soft: #edf2f8;
  --green: #17a56b;
  --green-light: #e6f7f1;
  --orange: #e07a10;
  --orange-light: #fff4e6;
  --red: #d93a3a;
  --red-light: #fdeaea;
  --shadow-soft: 0 10px 28px rgba(15, 38, 77, 0.07);
  --shadow-blue: 0 14px 28px rgba(18, 104, 232, 0.22);

  /* Sidebar */
  --sidebar-width: 220px;
  --sidebar-bg: #061836;
  --topbar-height: 54px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: -0.01em;
  background: var(--page-bg);
  color: var(--text-950);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

/* ─── APP SHELL ─── */

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ─── SIDEBAR ─── */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 40;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}

.brand-logo {
  color: #fff;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.09em;
  line-height: 1;
}

.brand-divider {
  width: 1px;
  height: 24px;
  background: rgba(255,255,255,0.22);
  flex-shrink: 0;
}

.brand-subtitle {
  color: #9fc3f5;
  font-size: 9px;
  line-height: 1.2;
  font-weight: 600;
}

.sidebar-nav {
  flex: 1;
  padding: 10px 0;
}

.nav-section-label {
  padding: 10px 16px 4px;
  color: rgba(255,255,255,0.3);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 36px;
  padding: 0 14px;
  border-radius: 7px;
  margin: 1px 8px;
  color: rgba(255,255,255,0.62);
  font-size: 12px;
  font-weight: 500;
  transition: background 150ms, color 150ms;
  cursor: pointer;
  white-space: nowrap;
}

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

.nav-item.active {
  background: rgba(45, 134, 255, 0.18);
  color: #fff;
}

.nav-item.active .nav-icon { color: var(--blue-500); }

.nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.nav-sub-item {
  display: block;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 500;
  color: rgba(255,255,255,0.5);
  border-radius: 5px;
  margin: 1px 0;
  transition: background 130ms, color 130ms;
}
.nav-sub-item:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.8); }
.nav-sub-item.active { color: #fff; font-weight: 600; background: rgba(45,134,255,0.15); }

.sidebar-project {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}

.project-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
}

.project-pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}

.project-pill-name {
  flex: 1;
  min-width: 0;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-pill-num {
  color: rgba(255,255,255,0.38);
  font-size: 9px;
}

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

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-700), var(--blue-500));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}

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

.user-name {
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  color: rgba(255,255,255,0.4);
  font-size: 9px;
}

/* ─── MAIN ─── */

.app-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ─── TOPBAR ─── */

.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-height);
  background: rgba(255,255,255,0.96);
  border-bottom: 1px solid var(--line-soft);
  backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 22px;
  z-index: 30;
}

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1;
}

.topbar-breadcrumb a {
  color: var(--text-500);
  font-size: 12px;
  font-weight: 500;
}

.topbar-breadcrumb a:hover { color: var(--blue-700); }

.breadcrumb-sep {
  color: var(--text-500);
  font-size: 11px;
}

.topbar-title {
  color: var(--text-950);
  font-size: 14px;
  font-weight: 700;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--green);
  font-size: 11px;
  font-weight: 600;
}

.topbar-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

.topbar-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-600);
  cursor: pointer;
  transition: background 150ms, border-color 150ms;
}

.topbar-icon-btn:hover {
  background: var(--blue-75);
  border-color: #c5d9f5;
  color: var(--blue-700);
}

.topbar-icon-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

/* ─── BUTTONS ─── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: 7px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 150ms, box-shadow 150ms, background 150ms;
  text-decoration: none;
}

.btn:hover { transform: translateY(-1px); }

.btn-primary {
  color: white;
  background: linear-gradient(135deg, var(--blue-700), var(--blue-500));
  box-shadow: var(--shadow-blue);
}

.btn-secondary {
  color: var(--blue-700);
  background: white;
  border-color: #bcd2f3;
  box-shadow: 0 4px 12px rgba(15,38,77,0.05);
}

.btn-ghost {
  color: var(--text-600);
  background: transparent;
  border-color: var(--line);
}

.btn-ghost:hover {
  background: var(--blue-75);
  color: var(--blue-700);
  border-color: #c5d9f5;
}

.btn-danger {
  color: var(--red);
  background: var(--red-light);
  border-color: #f5c6c6;
}

.btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

/* ─── CARDS ─── */

.card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: var(--shadow-soft);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
}

.card-title {
  color: var(--text-850);
  font-size: 13px;
  font-weight: 700;
}

.card-body { padding: 18px; }

/* ─── STAT CARDS ─── */

.stat-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: var(--shadow-soft);
}

.stat-label {
  color: var(--text-500);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.stat-value {
  color: var(--text-950);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-sub {
  color: var(--text-500);
  font-size: 10px;
  font-weight: 500;
}

.stat-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--blue-75);
  border: 1px solid #cfe0f8;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--blue-700);
  margin-bottom: 10px;
}

.stat-icon-wrap svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

/* ─── BADGES ─── */

.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-blue { background: var(--blue-75); color: var(--blue-700); border: 1px solid #cde0ff; }
.badge-green { background: var(--green-light); color: #0e7a50; border: 1px solid #b8ead8; }
.badge-orange { background: var(--orange-light); color: var(--orange); border: 1px solid #f5d8a0; }
.badge-red { background: var(--red-light); color: var(--red); border: 1px solid #f5c6c6; }
.badge-gray { background: #f4f7fb; color: var(--text-600); border: 1px solid var(--line); }

/* ─── TABLES ─── */

.table-wrap {
  overflow-x: auto;
  border-radius: 11px;
  border: 1px solid var(--line);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

thead th {
  background: #f8fafd;
  color: var(--text-500);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--text-700);
  font-size: 12px;
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: 0; }

tbody tr:hover td { background: #fafcff; }

/* ─── PROGRESS BAR ─── */

.progress-bar {
  height: 4px;
  background: var(--line-soft);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue-700), var(--blue-500));
  border-radius: 999px;
}

/* ─── FORM ELEMENTS ─── */

.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  color: var(--text-700);
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 6px;
}

.form-input,
.form-select {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--text-950);
  font-size: 13px;
  transition: border-color 150ms, box-shadow 150ms;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgba(18,104,232,0.09);
}

.form-input::placeholder { color: var(--text-500); }

/* ─── RIGHT PANEL ─── */

.right-panel {
  width: 280px;
  flex-shrink: 0;
  border-left: 1px solid var(--line-soft);
  background: white;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel-section-title {
  color: var(--text-850);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.panel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 11px;
}

.panel-row:last-child { border-bottom: 0; }

.panel-row-label { color: var(--text-500); font-weight: 500; }
.panel-row-value { color: var(--text-950); font-weight: 600; }
.panel-row-value.blue { color: var(--blue-700); }

/* ─── PAGE CONTENT ─── */

.page-content {
  flex: 1;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.page-header-left {}

.page-title {
  color: var(--text-950);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.page-subtitle {
  color: var(--text-500);
  font-size: 12px;
  margin-top: 3px;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── GRID LAYOUTS ─── */

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

/* ─── AVATAR STACK ─── */

.avatar-stack {
  display: flex;
  align-items: center;
}

.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: white;
  margin-left: -7px;
  flex-shrink: 0;
}

.avatar:first-child { margin-left: 0; }

.avatar-more {
  background: var(--line-soft);
  color: var(--text-500);
  font-size: 8px;
}

/* ─── TAGS ─── */

.tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--blue-75);
  color: var(--blue-700);
}

/* ─── SEARCH INPUT ─── */

.search-wrap {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  stroke: var(--text-500);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.search-input {
  width: 100%;
  height: 32px;
  padding: 0 10px 0 32px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--text-950);
  font-size: 12px;
  transition: border-color 150ms, box-shadow 150ms;
}

.search-input:focus {
  outline: none;
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgba(18,104,232,0.09);
}

/* ─── FOOTER (landing-style footer in app) ─── */

.app-footer {
  margin-top: auto;
  padding: 14px 22px;
  border-top: 1px solid var(--line-soft);
  background: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-size: 11px;
  color: var(--text-500);
}

/* ─── DONUT CHART ─── */

.donut {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.donut-label {
  position: absolute;
  text-align: center;
}

.donut-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-950);
  letter-spacing: -0.04em;
  display: block;
}

.donut-sub {
  font-size: 9px;
  color: var(--text-500);
  font-weight: 500;
}

/* ─── EMPTY STATE ─── */

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-500);
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  background: var(--blue-75);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  color: var(--blue-700);
}

.empty-state-icon svg {
  width: 26px;
  height: 26px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

/* ─── TOOLTIP ─── */

[data-tip] { position: relative; cursor: help; }

/* ─── RESPONSIVE ─── */

@media (max-width: 1100px) {
  :root { --sidebar-width: 60px; }
  .brand-subtitle, .brand-divider, .nav-section-label,
  .nav-item span, .project-pill-name, .project-pill-num,
  .user-info { display: none; }
  .nav-item { justify-content: center; padding: 0; }
  .project-pill { justify-content: center; padding: 8px; }
  .sidebar-user { justify-content: center; padding: 10px 0; }
  .right-panel { width: 240px; }
}

@media (max-width: 768px) {
  .app-main { margin-left: 0; }
  .sidebar { transform: translateX(-100%); }
  .right-panel { display: none; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-5 { grid-template-columns: repeat(2, 1fr); }
}

/* ─── LAYOUT HELPERS ─── */

.main-area {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.content-body {
  padding: 24px 28px;
  flex: 1;
}

.page-header { margin-bottom: 20px; }
.page-title { font-size: 20px; font-weight: 800; color: var(--text-950); letter-spacing: -0.03em; }
.page-sub { font-size: 12px; color: var(--text-500); margin-top: 3px; }

/* ─── DATA TABLE ─── */

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.data-table th {
  text-align: left;
  padding: 9px 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-500);
  background: var(--page-bg);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--text-700);
  vertical-align: middle;
}
.data-table tbody tr:hover { background: var(--blue-75); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ═══════════════════════════════════════════════════════
   EEP EXTENSIONS — Phase 6 Complete
   All additions maintain exact design token compatibility
   with uploaded template (eep-frontend-package_-_very_good.zip)
═══════════════════════════════════════════════════════ */

/* ── Advisory Labels (Rulebook Ch11 §11.2) ── */
.advisory-label {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 5px;
  font-size: 11px; font-weight: 800; letter-spacing: 0.04em;
  text-transform: uppercase; white-space: nowrap;
}
.advisory-label.final    { background:#e6f7f1; color:#0b6e43; border:1px solid #b8ead8; }
.advisory-label.advisory { background:#fff4e6; color:#9a3e00; border:1px solid #f5cfa0; }
.advisory-label.review   { background:#fef3c7; color:#92400e; border:1px solid #f5d8a0; }
.advisory-label.draft    { background:var(--blue-75); color:var(--blue-700); border:1px solid #cde0ff; }
.advisory-label.blocked  { background:var(--red-light); color:var(--red); border:1px solid #f5c6c6; }
.advisory-label.prelim   { background:#f5f3ff; color:#6d28d9; border:1px solid #ddd6fe; }

/* ── Professional Review Notice Banner (MANDATORY §15.2) ── */
.review-notice {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 16px; border-radius: 8px;
  background: #fff4e6; border: 1.5px solid #f5cfa0;
  margin-bottom: 16px;
}
.review-notice-icon { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.review-notice-text strong { color: #9a3e00; font-size: 12px; display: block; margin-bottom: 3px; }
.review-notice-text p { color: #78350f; font-size: 11px; line-height: 1.5; margin: 0; }

/* ── TraceStep Display (Rulebook Ch15) ── */
.trace-container { margin-top: 16px; }
.trace-toggle-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--white);
  color: var(--text-600); font-size: 11.5px; font-weight: 600;
  cursor: pointer; margin-bottom: 10px; transition: all 150ms;
}
.trace-toggle-btn:hover { background: var(--blue-75); color: var(--blue-700); border-color: #cde0ff; }
.trace-step {
  display: flex; gap: 10px; margin-bottom: 8px;
  animation: fadeIn 200ms ease;
}
.trace-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--blue-75); border: 1.5px solid #cde0ff;
  color: var(--blue-700); font-size: 9px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 2px;
}
.trace-body {
  flex: 1; background: #fafcff; border: 1px solid var(--line-soft);
  border-radius: 8px; padding: 8px 12px;
}
.trace-label { font-size: 11.5px; font-weight: 700; color: var(--text-950); margin-bottom: 3px; }
.trace-formula {
  font-size: 11px; font-family: "Fira Code", "Consolas", monospace;
  background: #f0f4fb; border-radius: 5px; padding: 4px 8px;
  color: var(--text-700); margin-bottom: 4px;
}
.trace-sourceref {
  display: inline-flex; align-items: center; height: 18px;
  padding: 0 7px; border-radius: 3px; font-size: 9.5px;
  font-weight: 700; font-family: monospace; background: var(--blue-75);
  color: var(--blue-700); border: 1px solid #cde0ff;
}
.trace-warning {
  display: flex; gap: 8px; padding: 6px 10px; border-radius: 6px;
  font-size: 11px; margin-top: 4px;
}
.trace-warning.info     { background: var(--blue-75); border: 1px solid #cde0ff; color: var(--blue-700); }
.trace-warning.warning  { background: #fff4e6; border: 1px solid #f5cfa0; color: #92400e; }
.trace-warning.critical { background: var(--red-light); border: 1px solid #f5c6c6; color: var(--red); }
.trace-warning.sgp      { background: #f5f3ff; border: 1px solid #ddd6fe; color: #6d28d9; }

/* ── Overlay Status (Rulebook Ch14) ── */
.overlay-badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 9px; border-radius: 99px;
  font-size: 10px; font-weight: 700; white-space: nowrap;
}
.overlay-badge.unresolved { background: var(--red-light); color: var(--red); border: 1px solid #f5c6c6; }
.overlay-badge.resolved   { background: var(--green-light); color: #0b6e43; border: 1px solid #b8ead8; }
.overlay-badge.na         { background: var(--line-soft); color: var(--text-500); border: 1px solid var(--line); }
.overlay-card {
  border: 1.5px solid var(--line); border-radius: 10px;
  padding: 14px 16px; margin-bottom: 10px; background: var(--white);
  transition: border-color 150ms;
}
.overlay-card.blocking { border-color: #f5c6c6; background: #fffafb; }
.overlay-card.resolved { border-color: #b8ead8; }

/* ── Contractor Toolbox ── */
.tool-card {
  background: var(--white); border: 1px solid var(--line);
  border-radius: 12px; padding: 18px; cursor: pointer;
  transition: transform 180ms, box-shadow 180ms, border-color 180ms;
}
.tool-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-soft); border-color: #cde0ff; }
.tool-icon { font-size: 26px; margin-bottom: 10px; }
.tool-name { font-size: 13px; font-weight: 700; color: var(--text-950); margin-bottom: 4px; }
.tool-desc { font-size: 11px; color: var(--text-500); line-height: 1.45; }

/* ── Form elements ── */
.form-group { margin-bottom: 14px; }
.form-label { display: block; color: var(--text-700); font-size: 11px; font-weight: 600; margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.04em; }
.form-input, .form-select, .form-textarea {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1.5px solid var(--line); border-radius: 8px;
  background: var(--white); color: var(--text-950); font-size: 13px;
  font-family: var(--font-ui); outline: none;
  transition: border-color 150ms, box-shadow 150ms;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--blue-600); box-shadow: 0 0 0 3px rgba(18,111,242,0.09);
}
.form-input::placeholder { color: var(--text-500); }
.form-textarea { height: 100px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.form-hint { font-size: 11px; color: var(--text-500); margin-top: 4px; }
.form-error { font-size: 11px; color: var(--red); margin-top: 4px; }
.form-select { cursor: pointer; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ── Loading states ── */
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: white; animation: spin 0.6s linear infinite;
  display: inline-block;
}
.spinner-blue { border-color: rgba(11,94,215,0.2); border-top-color: var(--blue-700); }
.btn-loading { pointer-events: none; opacity: 0.8; }
.skeleton { background: linear-gradient(90deg,#f0f4f8 25%,#e2e8f0 50%,#f0f4f8 75%); background-size: 400px 100%; animation: shimmer 1.4s ease-in-out infinite; border-radius: 6px; }

/* ── Error/Empty states ── */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-state-icon { font-size: 36px; margin-bottom: 12px; opacity: 0.5; }
.empty-state-title { font-size: 15px; font-weight: 700; color: var(--text-950); margin-bottom: 6px; }
.empty-state-desc { font-size: 13px; color: var(--text-500); line-height: 1.55; margin-bottom: 20px; }
.alert { display: flex; gap: 10px; padding: 12px 14px; border-radius: 9px; font-size: 12.5px; margin-bottom: 14px; }
.alert-error   { background: var(--red-light); border: 1px solid #f5c6c6; color: #991b1b; }
.alert-success { background: var(--green-light); border: 1px solid #b8ead8; color: #065f46; }
.alert-info    { background: var(--blue-75); border: 1px solid #cde0ff; color: var(--blue-700); }
.alert-warning { background: #fff4e6; border: 1px solid #f5cfa0; color: #92400e; }

/* ── Toast notifications ── */
.toast-stack { position: fixed; bottom: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 10px; background: var(--white); border: 1px solid var(--line); box-shadow: 0 10px 28px rgba(15,38,77,0.15); font-size: 13px; min-width: 260px; animation: slideIn 250ms ease; }
.toast-success { border-left: 3px solid var(--green); }
.toast-error   { border-left: 3px solid var(--red); }
.toast-info    { border-left: 3px solid var(--blue-700); }

/* ── Modal ── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 998; display: flex; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(4px); }
.modal { background: var(--white); border-radius: 16px; box-shadow: 0 32px 64px rgba(0,0,0,0.22); overflow: hidden; width: 100%; max-width: 520px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.modal-title { font-size: 16px; font-weight: 800; color: var(--text-950); }
.modal-close { width: 28px; height: 28px; border-radius: 7px; border: 1px solid var(--line); background: var(--page-bg); cursor: pointer; color: var(--text-500); display: flex; align-items: center; justify-content: center; }
.modal-body { padding: 22px 24px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--line); }

/* ── Voltage system badge ── */
.vsys-badge {
  display: inline-flex; align-items: center; height: 20px;
  padding: 0 8px; border-radius: 4px; font-size: 10px;
  font-weight: 800; font-family: monospace; background: var(--navy-950);
  color: rgba(255,255,255,0.9);
}

/* ── Role badge ── */
.role-badge {
  display: inline-flex; align-items: center; height: 20px;
  padding: 0 8px; border-radius: 99px; font-size: 10px; font-weight: 700;
}
.role-badge.engineer    { background: var(--blue-75); color: var(--blue-700); border: 1px solid #cde0ff; }
.role-badge.contractor  { background: #fff4e6; color: #92400e; border: 1px solid #f5cfa0; }
.role-badge.admin       { background: #f5f3ff; color: #6d28d9; border: 1px solid #ddd6fe; }
.role-badge.gc-desk     { background: var(--green-light); color: #0b6e43; border: 1px solid #b8ead8; }
.role-badge.free        { background: var(--page-bg); color: var(--text-500); border: 1px solid var(--line); }

/* ── Animations ── */
@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes fadeIn  { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }
