/* @import MUST be first rule (before any other rules) per CSS spec */
@import url('https://fonts.googleapis.com/css2?family=Cormorant:wght@300;400;500;600;700&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;0,9..40,800;1,9..40,400&display=swap');

/* ================================================================
   SmartPlans — Design System & Styles
   3D Technology Services Corporate Theme — Clean White Editorial
   White + Teal Accent | www.3dtsi.com
   ================================================================ */

/* ─── Reset & Base ─── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Color Tokens — Clean White Editorial Theme */
  --bg-deep: #FFFFFF;
  --bg-surface: #FFFFFF;
  --bg-surface-2: #FAFBFC;
  --bg-surface-hover: rgba(13, 148, 136, 0.03);

  --accent-teal: #0D9488;
  --accent-teal-light: #14B8A6;
  --accent-teal-dark: #0F766E;
  --accent-gold: #0D9488;
  --accent-gold-light: #14B8A6;

  --accent-sky: #0D9488;
  --accent-indigo: #0D9488;
  --accent-emerald: #0D9488;
  --accent-amber: #D97706;
  --accent-rose: #E11D48;

  --text-primary: #1A1A2E;
  --text-secondary: rgba(0, 0, 0, 0.55);
  --text-muted: rgba(0, 0, 0, 0.35);

  --border-subtle: rgba(180, 140, 20, 0.45);
  --border-medium: rgba(180, 140, 20, 0.6);
  --border-accent: rgba(180, 140, 20, 0.8);

  --radius-sm: 0px;
  --radius-md: 0px;
  --radius-lg: 2px;
  --radius-xl: 2px;
  --radius-pill: 0px;

  --shadow-glow: none;
  --shadow-card: none;

  --font-sans: 'DM Sans', 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-serif: 'Cormorant', Georgia, serif;
  --font-mono: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;

  --transition-fast: 0.15s ease;
  --transition-med: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: #FFFFFF;
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
  accent-color: #0D9488;
}

::selection {
  background: rgba(13, 148, 136, 0.15);
  color: #1A1A2E;
}

option:checked {
  background: #0D9488 !important;
  color: #FFFFFF !important;
}

option:hover {
  background: #0F766E !important;
  color: #FFFFFF !important;
}

select:focus,
input:focus,
textarea:focus {
  outline: 1px solid #0D9488;
  outline-offset: -1px;
}

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.02);
}

::-webkit-scrollbar-thumb {
  background: rgba(180, 140, 20, 0.65);
  border-radius: 0;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(180, 140, 20, 0.7);
}

/* ─── Animated Background ─── */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: #FFFFFF;
}

.bg-grid-lines {
  display: none;
}

.bg-orb {
  display: none;
}

.bg-orb-1 {
  display: none;
}

.bg-orb-2 {
  display: none;
}

.bg-orb-3 {
  display: none;
}

@keyframes orbFloat1 {

  0%,
  100% {
    transform: translate(0, 0)
  }

  33% {
    transform: translate(40px, -50px)
  }

  66% {
    transform: translate(-20px, 30px)
  }
}

@keyframes orbFloat2 {

  0%,
  100% {
    transform: translate(0, 0)
  }

  50% {
    transform: translate(-35px, 40px)
  }
}

@keyframes orbFloat3 {

  0%,
  100% {
    transform: translate(0, 0)
  }

  50% {
    transform: translate(30px, -25px)
  }
}

/* ─── App Shell ─── */
#app-shell {
  position: relative;
  z-index: 1;
  max-width: 95vw;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #FFFFFF;
  border-left: 1px solid rgba(180, 140, 20, 0.4);
  border-right: 1px solid rgba(180, 140, 20, 0.4);
  box-shadow: none;
}

/* ─── Header ─── */
#app-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 28px;
  border-bottom: 1px solid rgba(180, 140, 20, 0.5);
  background: #FFFFFF;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-logo {
  flex-shrink: 0;
}

.header-logo img {
  display: block;
  height: 42px;
  width: auto;
}

#usage-stats {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

.usage-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.usage-stat-value {
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.usage-stat-value--green { color: #10b981; }
.usage-stat-value--amber { color: #f59e0b; }

.usage-stat-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.usage-stat-reset {
  display: none;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(239, 68, 68, 0.25);
  background: transparent;
  color: #f43f5e;
  cursor: pointer;
  font-size: 14px;
  border-radius: 0;
}

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

.header-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  min-width: 110px;
  border: 1px solid rgba(180, 140, 20, 0.65);
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-sans);
  text-decoration: none;
  border-radius: 0;
  box-sizing: border-box;
}

.header-btn--start {
  border-color: rgba(16, 185, 129, 0.65);
  color: #10b981;
}
.header-btn--start:hover {
  background: rgba(16, 185, 129, 0.08);
  border-color: #10b981;
}

.header-btn--stop {
  border-color: rgba(239, 68, 68, 0.65);
  color: #ef4444;
}
.header-btn--stop:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: #ef4444;
}

.header-btn:hover {
  background: rgba(13, 148, 136, 0.04);
  border-color: #0D9488;
  color: #0D9488;
}

.header-btn [data-lucide] {
  width: 14px;
  height: 14px;
}

.header-btn-label {
  /* visible by default, hidden on mobile */
}

/* ─── PDF Tool Modal ─── */
.pdf-tool-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}
.pdf-tool-modal {
  background: #fff;
  width: 640px;
  max-width: 92vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(180, 140, 20, 0.5);
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.pdf-tool-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(180, 140, 20, 0.3);
}
.pdf-tool-header h3 {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 400;
  margin: 0;
  color: var(--text-primary);
}
.pdf-tool-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px 8px;
}
.pdf-tool-close:hover { color: var(--text-primary); }
.pdf-tool-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}
.pdf-tool-section {
  margin-bottom: 18px;
}
.pdf-tool-section label {
  display: block;
  font-size: 13px;
  font-weight: 650;
  color: var(--text-primary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.pdf-tool-section .hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
  line-height: 1.5;
}
.pdf-tool-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(180, 140, 20, 0.5);
  border-radius: 0;
  font-size: 14px;
  font-family: var(--font-mono);
  background: #FAFBFC;
  box-sizing: border-box;
}
.pdf-tool-input:focus {
  outline: none;
  border-color: #0D9488;
}
.pdf-tool-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(13, 148, 136, 0.06);
  border: 1px solid rgba(13, 148, 136, 0.2);
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 14px;
}
.pdf-tool-info strong { color: var(--text-primary); }
.pdf-tool-filename {
  padding: 10px 14px;
  background: #FAFBFC;
  border: 1px solid rgba(180, 140, 20, 0.5);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.pdf-tool-filename .name { font-weight: 600; color: var(--text-primary); }
.pdf-tool-filename .meta { color: var(--text-muted); font-size: 12px; }
.pdf-tool-actions {
  display: flex;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid rgba(180, 140, 20, 0.3);
  justify-content: flex-end;
}
.pdf-tool-btn {
  padding: 10px 22px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid rgba(180, 140, 20, 0.65);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  transition: all 0.15s;
}
.pdf-tool-btn:hover {
  border-color: #0D9488;
  color: #0D9488;
  background: rgba(13, 148, 136, 0.04);
}
.pdf-tool-btn--primary {
  background: #0D9488;
  color: #fff;
  border-color: #0D9488;
}
.pdf-tool-btn--primary:hover {
  background: #0B7C72;
  border-color: #0B7C72;
  color: #fff;
}
.pdf-tool-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.pdf-tool-drop {
  border: 1px dashed rgba(180, 140, 20, 0.7);
  padding: 32px 24px;
  text-align: center;
  cursor: pointer;
  position: relative;
  background: #fff;
  transition: all 0.15s;
}
.pdf-tool-drop:hover,
.pdf-tool-drop.drag-over {
  border-color: #0D9488;
  background: rgba(13, 148, 136, 0.02);
}
.pdf-tool-drop input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.pdf-tool-drop .icon { font-size: 28px; margin-bottom: 6px; opacity: 0.6; }
.pdf-tool-drop .text { font-size: 13px; color: var(--text-secondary); }
.pdf-tool-preview {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid rgba(180, 140, 20, 0.3);
  margin-top: 10px;
}
.pdf-tool-preview table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.pdf-tool-preview th {
  background: #FAFBFC;
  padding: 6px 10px;
  text-align: left;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 11px;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(180, 140, 20, 0.3);
  position: sticky;
  top: 0;
}
.pdf-tool-preview td {
  padding: 5px 10px;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  color: var(--text-secondary);
}
.pdf-tool-preview tr.kept td { color: var(--text-primary); font-weight: 500; }
.pdf-tool-preview tr.removed td { color: var(--text-muted); text-decoration: line-through; opacity: 0.5; }
.pdf-tool-status {
  padding: 10px 14px;
  font-size: 13px;
  margin-top: 10px;
  border: 1px solid rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.06);
  color: #065f46;
}
.pdf-tool-status.error {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.06);
  color: #991b1b;
}
.pdf-tool-output-name {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(180, 140, 20, 0.5);
  border-radius: 0;
  font-size: 14px;
  font-family: var(--font-sans);
  background: #FAFBFC;
  box-sizing: border-box;
}
.pdf-tool-output-name:focus {
  outline: none;
  border-color: #0D9488;
}

/* ─── API Health Traffic Light ─── */
.api-health-indicator {
  position: relative;
  flex-shrink: 0;
  margin-left: 4px;
}

.api-health-light {
  position: relative;
  width: 18px;
  height: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.api-health-light__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #10b981;
  transition: background 0.4s ease, box-shadow 0.4s ease;
  z-index: 1;
}

.api-health-light__pulse {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #10b981;
  opacity: 0;
  z-index: 0;
}

/* GREEN state */
.api-health-light[data-status="GREEN"] .api-health-light__dot {
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
}

/* YELLOW state */
.api-health-light[data-status="YELLOW"] .api-health-light__dot {
  background: #f59e0b;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}
.api-health-light[data-status="YELLOW"] .api-health-light__pulse {
  background: #f59e0b;
  animation: healthPulse 2s ease-in-out infinite;
}

/* RED state */
.api-health-light[data-status="RED"] .api-health-light__dot {
  background: #ef4444;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
}
.api-health-light[data-status="RED"] .api-health-light__pulse {
  background: #ef4444;
  animation: healthPulse 1s ease-in-out infinite;
}

@keyframes healthPulse {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(2.5); opacity: 0; }
}

/* Tooltip (dropdown panel) */
.api-health-tooltip {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: 260px;
  background: #1a1a2e;
  border: 1px solid rgba(180, 140, 20, 0.3);
  border-radius: 10px;
  padding: 14px 16px;
  z-index: 200;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.85);
}

.api-health-tooltip::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: #1a1a2e;
  border-top: 1px solid rgba(180, 140, 20, 0.3);
  border-left: 1px solid rgba(180, 140, 20, 0.3);
}

.api-health-indicator--open .api-health-tooltip {
  display: block;
  animation: tooltipFadeIn 0.2s ease-out;
}

@keyframes tooltipFadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-4px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.api-health-tooltip__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.api-health-tooltip__title {
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(255, 255, 255, 0.5);
}

.api-health-tooltip__badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.8px;
}

.api-health-tooltip__badge[data-status="GREEN"] {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}
.api-health-tooltip__badge[data-status="YELLOW"] {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}
.api-health-tooltip__badge[data-status="RED"] {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.api-health-tooltip__body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.api-health-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
}

.api-health-row strong {
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
}

.api-health-row--bad strong { color: #ef4444; }
.api-health-row--warn strong { color: #f59e0b; }

.api-health-tooltip__footer {
  margin-top: 10px;
}

.api-health-abort-msg {
  font-size: 11px;
  color: #ef4444;
  font-weight: 600;
  padding: 6px 0;
  text-align: center;
}

.api-health-warn-msg {
  font-size: 11px;
  color: #f59e0b;
  padding: 6px 0;
  text-align: center;
}

.api-health-override-msg {
  font-size: 11px;
  color: #f59e0b;
  font-weight: 600;
  padding: 6px 0;
  text-align: center;
}

.api-health-override-btn {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 6px 12px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #f59e0b;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.api-health-override-btn:hover {
  background: rgba(245, 158, 11, 0.2);
  border-color: #f59e0b;
}

/* ─── Step Navigation ─── */
#step-nav {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  overflow-x: auto;
  background: #FAFBFC;
  border-bottom: 1px solid rgba(180, 140, 20, 0.4);
  gap: 0;
  scrollbar-width: none;
}

#step-nav::-webkit-scrollbar {
  display: none;
}

.step-item {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.step-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: default;
  padding: 4px 4px;
  min-width: 0;
  opacity: 0.3;
  transition: opacity var(--transition-med), transform var(--transition-fast);
}

.step-btn.clickable {
  cursor: pointer;
  opacity: 1;
}

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

.step-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  transition: all var(--transition-med);
  border: 1px solid rgba(180, 140, 20, 0.65);
  background: #FFFFFF;
  color: var(--text-muted);
  position: relative;
}

.step-btn.active .step-circle {
  background: #FFFFFF;
  border-color: #0D9488;
  border-width: 2px;
  color: #0D9488;
  box-shadow: none;
}

.step-btn.completed .step-circle {
  background: #0D9488;
  border-color: #0D9488;
  color: #FFFFFF;
  font-size: 14px;
  box-shadow: none;
}

.step-label {
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80px;
  transition: color var(--transition-med);
}

.step-btn.active .step-label {
  color: #0D9488;
  font-weight: 700;
}

.step-btn.completed .step-label {
  color: #0D9488;
}

.step-connector {
  flex: 1;
  height: 2px;
  min-width: 8px;
  background: rgba(180, 140, 20, 0.5);
  border-radius: 0;
  margin: 0 3px 20px;
  transition: background var(--transition-slow);
}

.step-connector.done {
  background: #0D9488;
}

/* ─── Main Content ─── */
#step-content {
  flex: 1;
  overflow-y: auto;
  padding: 32px 36px;
  scroll-behavior: smooth;
}

.step-heading {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 300;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.step-subheading {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 28px;
  line-height: 1.6;
}

/* ─── Form Elements ─── */
.form-group {
  margin-bottom: 22px;
}

.form-label {
  display: block;
  font-size: 13.5px;
  font-weight: 650;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.form-label .required {
  color: var(--accent-rose);
  margin-left: 2px;
}

.form-hint {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.55;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(180, 140, 20, 0.65);
  background: #FFFFFF;
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: #0D9488;
  box-shadow: none;
  background: #FFFFFF;
}

.form-input::placeholder,
.form-select::placeholder,
.form-textarea::placeholder {
  color: rgba(0, 0, 0, 0.3);
}

.form-select option {
  background: #FFFFFF;
  color: #1A1A2E;
}

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

/* ─── Accuracy-Critical Input Highlight ─── */
/* Light teal tint on fields that most impact bid accuracy */
.accuracy-critical {
  background: rgba(13, 148, 136, 0.06) !important;
  border-color: rgba(13, 148, 136, 0.35) !important;
}
.accuracy-critical:focus {
  background: rgba(13, 148, 136, 0.10) !important;
  border-color: #0D9488 !important;
}
/* Teal tint for chip grids and grouped inputs that affect accuracy */
.accuracy-critical-group {
  background: rgba(13, 148, 136, 0.04);
  border: 1px solid rgba(13, 148, 136, 0.18);
  border-radius: var(--radius-md);
  padding: 10px;
}

/* ─── Chip / Multi-Select Buttons ─── */
.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 6px 14px;
  border-radius: 0;
  border: 1px solid rgba(180, 140, 20, 0.65);
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.chip:hover {
  background: rgba(13, 148, 136, 0.04);
  border-color: #0D9488;
  color: #0D9488;
  transform: none;
  box-shadow: none;
}

.chip.selected {
  border-color: #0D9488;
  background: rgba(13, 148, 136, 0.06);
  color: #0D9488;
  font-weight: 600;
  box-shadow: none;
}

/* v5.144.0: Auto-detected discipline (from spec scan) — subtle ring + sparkle */
.chip.auto-detected {
  border-color: rgba(13, 148, 136, 0.85);
  position: relative;
}
.chip.auto-detected.selected {
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.10), rgba(13, 148, 136, 0.04));
  box-shadow: 0 0 0 1px rgba(13, 148, 136, 0.35);
}
.chip .auto-badge {
  display: inline-block;
  margin-left: 4px;
  font-size: 10px;
  vertical-align: baseline;
  filter: drop-shadow(0 0 2px rgba(191, 144, 0, 0.4));
}

/* ─── Toggle Buttons ─── */
.toggle-row {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.toggle-btn {
  flex: 1;
  padding: 16px 22px;
  border-radius: 0;
  border: 1px solid rgba(180, 140, 20, 0.65);
  background: #FFFFFF;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}

.toggle-btn:hover {
  background: rgba(13, 148, 136, 0.03);
  border-color: #0D9488;
  transform: none;
  box-shadow: none;
}

.toggle-btn.selected {
  border-color: #0D9488;
  background: rgba(13, 148, 136, 0.04);
  color: #0D9488;
  font-weight: 600;
  box-shadow: none;
}

/* ─── File Upload Zone ─── */
.upload-zone {
  border: 1px dashed rgba(180, 140, 20, 0.7);
  border-radius: 0;
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: #FFFFFF;
  position: relative;
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: #0D9488;
  background: rgba(13, 148, 136, 0.02);
}

.upload-zone.drag-over {
  box-shadow: none;
}

.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-icon {
  font-size: 36px;
  margin-bottom: 10px;
  opacity: 0.7;
}

.upload-text {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.upload-formats {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 6px;
  font-family: var(--font-mono);
}

/* File List */
.file-list {
  margin-top: 12px;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #FAFBFC;
  border: 1px solid rgba(180, 140, 20, 0.5);
  border-radius: 0;
  margin-bottom: 5px;
  animation: slideIn 0.2s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.file-item-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.file-item-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.file-item-name {
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-item-size {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.file-remove-btn {
  background: rgba(225, 29, 72, 0.06);
  border: 1px solid rgba(225, 29, 72, 0.15);
  color: var(--accent-rose);
  border-radius: 0;
  padding: 3px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.file-remove-btn:hover {
  background: rgba(225, 29, 72, 0.12);
}

/* ─── Info Cards ─── */
.info-card {
  border-radius: 0;
  padding: 24px 28px;
  margin-bottom: 18px;
  border: 1px solid rgba(180, 140, 20, 0.5);
  position: relative;
  overflow: hidden;
  background: #FFFFFF;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
}

.info-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
}

.info-card--sky {
  background: #FFFFFF;
  border-color: rgba(180, 140, 20, 0.5);
}

.info-card--sky::before {
  background: #0D9488;
}

.info-card--amber {
  background: #FFFFFF;
  border-color: rgba(180, 140, 20, 0.5);
}

.info-card--amber::before {
  background: #D97706;
}

.info-card--rose {
  background: #FFFFFF;
  border-color: rgba(180, 140, 20, 0.5);
}

.info-card--rose::before {
  background: #E11D48;
}

.info-card--indigo {
  background: #FFFFFF;
  border-color: rgba(180, 140, 20, 0.5);
}

.info-card--indigo::before {
  background: #0D9488;
}

.info-card--emerald {
  background: #FFFFFF;
  border-color: rgba(180, 140, 20, 0.5);
}

.info-card--emerald::before {
  background: #0D9488;
}

.info-card-title {
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-bottom: 8px;
  padding-left: 8px;
}

.info-card--sky .info-card-title {
  color: var(--accent-sky);
}

.info-card--amber .info-card-title {
  color: var(--accent-amber);
}

.info-card--rose .info-card-title {
  color: var(--accent-rose);
}

.info-card--indigo .info-card-title {
  color: var(--accent-indigo);
}

.info-card--emerald .info-card-title {
  color: var(--accent-emerald);
}

.info-card-body {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
  padding-left: 8px;
}

.info-card-body div {
  margin-bottom: 3px;
}

.info-card-body strong {
  color: var(--text-primary);
}

/* ─── Format Quality Badge ─── */
.format-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 0;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.format-badge.best {
  background: rgba(13, 148, 136, 0.06);
  color: #0D9488;
  border: 1px solid rgba(13, 148, 136, 0.2);
}

.format-badge.ok {
  background: rgba(217, 119, 6, 0.06);
  color: #D97706;
  border: 1px solid rgba(217, 119, 6, 0.2);
}

.format-badge.poor {
  background: rgba(225, 29, 72, 0.06);
  color: #E11D48;
  border: 1px solid rgba(225, 29, 72, 0.2);
}

/* ─── Review Summary Grid ─── */
.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 22px;
}

.summary-card {
  padding: 20px 22px;
  background: #FFFFFF;
  border: 1px solid rgba(180, 140, 20, 0.5);
  border-radius: 0;
  transition: border-color var(--transition-fast);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.summary-card:hover {
  border-color: rgba(13, 148, 136, 0.3);
}

.summary-card-label {
  font-size: 10.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 5px;
  font-weight: 600;
}

.summary-card-value {
  font-size: 14px;
  font-weight: 650;
  color: var(--text-primary);
}

.summary-card-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ─── File Summary Panel ─── */
.files-summary {
  padding: 18px 22px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 22px;
}

.files-summary-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 14px;
}

.files-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.files-summary-row:last-child {
  border-bottom: none;
}

.files-summary-row-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.files-summary-count {
  font-size: 13px;
  font-weight: 650;
  font-family: var(--font-mono);
}

.files-summary-count.has-files {
  color: var(--accent-emerald);
}

.files-summary-count.no-files {
  color: var(--text-muted);
}

/* ─── Accuracy Gauge ─── */
.accuracy-panel {
  padding: 40px;
  background: #FFFFFF;
  border: 1px solid rgba(180, 140, 20, 0.5);
  border-radius: 0;
  text-align: center;
  margin-bottom: 22px;
  position: relative;
  overflow: hidden;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.accuracy-panel::after {
  display: none;
}

.accuracy-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
  font-weight: 600;
  position: relative;
  z-index: 1;
}

.accuracy-value {
  font-family: var(--font-serif);
  font-size: 56px;
  font-weight: 300;
  letter-spacing: -0.02em;
  color: #0D9488;
  line-height: 1;
  position: relative;
  z-index: 1;
}

.accuracy-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
  position: relative;
  z-index: 1;
}

.accuracy-traffic-light {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
  position: relative;
  z-index: 1;
}

.traffic-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(180, 140, 20, 0.55);
  transition: all 0.3s ease;
}

.traffic-dot:hover {
  transform: scale(1.15);
}

/* ─── Analysis Progress ─── */
.analysis-overlay {
  text-align: center;
  padding: 60px 20px;
  animation: fadeInUp 0.4s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.analysis-ring {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 36px;
  position: relative;
}

.analysis-ring-inner {
  width: 106px;
  height: 106px;
  border-radius: 50%;
  background: var(--bg-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.analysis-pct {
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 400;
  color: #0D9488;
  letter-spacing: -0.03em;
  line-height: 1;
}

.analysis-title {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 400;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.analysis-stage {
  font-size: 14px;
  color: #0D9488;
  min-height: 22px;
  transition: opacity 0.3s;
}

.analysis-bar-track {
  width: 100%;
  max-width: 420px;
  height: 4px;
  background: rgba(180, 140, 20, 0.4);
  border-radius: 0;
  margin: 22px auto 0;
  overflow: hidden;
}

.analysis-bar-fill {
  height: 100%;
  background: #0D9488;
  border-radius: 0;
  transition: width 0.25s linear;
}

/* ─── Brain Dashboard ─── */
.brain-dashboard {
  margin-top: 28px;
  padding: 24px 28px;
  background: #FFFFFF;
  border: 1px solid rgba(180, 140, 20, 0.5);
  border-radius: 0;
  max-width: 60%;
  margin-left: auto;
  margin-right: auto;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.brain-wave-header {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #0D9488;
  margin-top: 14px;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(180, 140, 20, 0.4);
}

.brain-wave-header:first-child {
  margin-top: 0;
}

.brain-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  opacity: 0.5;
}

.brain-row:hover {
  background: rgba(13, 148, 136, 0.03);
}

.brain-emoji {
  font-size: 14px;
  flex-shrink: 0;
  width: 22px;
  text-align: center;
}

.brain-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  flex: 1;
}

.brain-status {
  font-size: 14px;
  flex-shrink: 0;
  width: 22px;
  text-align: center;
  transition: all var(--transition-fast);
}

@keyframes brainPulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

/* ─── Results Page ─── */
.results-hero {
  padding: 40px;
  background: #FFFFFF;
  border: 1px solid rgba(180, 140, 20, 0.5);
  border-radius: 0;
  margin-bottom: 24px;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.results-top {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 20px;
}

.results-ring {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.results-ring-inner {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--bg-deep);
  display: flex;
  align-items: center;
  justify-content: center;
}

.results-ring-pct {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 400;
  color: #0D9488;
}

.results-confidence-label {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 400;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.results-confidence-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.results-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.results-stat {
  text-align: center;
  padding: 20px;
  background: #FFFFFF;
  border-radius: 0;
  border: 1px solid rgba(180, 140, 20, 0.5);
}

.results-stat-icon {
  font-size: 22px;
  margin-bottom: 6px;
}

.results-stat-value {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 400;
  color: #0D9488;
}

.results-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-top: 4px;
}

/* ─── RFI List ─── */
.rfi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 28px 0 14px;
  flex-wrap: wrap;
  gap: 10px;
}

.rfi-title {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 400;
  color: var(--text-primary);
}

.rfi-actions {
  display: flex;
  gap: 8px;
}

.rfi-action-btn {
  padding: 7px 16px;
  border-radius: 0;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.rfi-action-btn--select {
  border: 1px solid #0D9488;
  background: rgba(13, 148, 136, 0.06);
  color: #0D9488;
}

.rfi-action-btn--clear {
  border: 1px solid rgba(180, 140, 20, 0.65);
  background: transparent;
  color: var(--text-secondary);
}

.rfi-action-btn:hover {
  opacity: 0.85;
}

.rfi-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.6;
}

.rfi-item {
  margin-bottom: 8px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface-2);
  overflow: hidden;
  transition: all var(--transition-fast);
}

.rfi-item.selected {
  border-color: var(--border-accent);
  background: rgba(20, 184, 166, 0.05);
}

.rfi-item-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  cursor: pointer;
  user-select: none;
}

.rfi-checkbox {
  width: 22px;
  height: 22px;
  border-radius: 0;
  border: 2px solid var(--border-medium);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 12px;
  color: #fff;
  font-weight: 700;
  transition: all var(--transition-fast);
}

.rfi-checkbox.checked {
  border-color: #0D9488;
  background: #0D9488;
}

.rfi-item-content {
  flex: 1;
  min-width: 0;
}

.rfi-item-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.rfi-tag {
  font-size: 10px;
  font-weight: 500;
  padding: 2px 9px;
  border-radius: 0;
  font-family: var(--font-sans);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.rfi-tag--id {
  color: #0D9488;
  background: rgba(13, 148, 136, 0.06);
}

.rfi-tag--discipline {
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.04);
}

.rfi-item-question {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.5;
}

.rfi-item-question.truncated {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rfi-expand-icon {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.rfi-expand-icon.open {
  transform: rotate(180deg);
}

.rfi-item-reason {
  padding: 0 16px 14px 50px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  animation: slideIn 0.15s ease;
}

.rfi-item-reason strong {
  color: #0D9488;
}

/* ─── Export Button ─── */
.export-btn {
  width: 100%;
  margin-top: 22px;
  padding: 16px 32px;
  border-radius: 0;
  border: none;
  background: #0D9488;
  color: #fff;
  font-size: 11.2px;
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition-fast);
  box-shadow: none;
  font-family: var(--font-sans);
}

.export-btn:hover {
  transform: none;
  background: #0F766E;
  box-shadow: none;
}

/* ─── Footer Nav ─── */
#step-footer {
  padding: 16px 36px;
  border-top: 1px solid rgba(180, 140, 20, 0.4);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.footer-btn {
  padding: 14px 28px;
  border-radius: 0;
  font-size: 11.2px;
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-sans);
  border: none;
}

.footer-btn--back {
  border: 1px solid #0D9488;
  background: transparent;
  color: #0D9488;
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-size: 11.2px;
}

.footer-btn--back:hover:not(:disabled) {
  background: rgba(13, 148, 136, 0.04);
  border-color: #0F766E;
  color: #0F766E;
}

.footer-btn--back:disabled {
  opacity: 0.3;
  cursor: default;
}

.footer-btn--next {
  background: #0D9488;
  color: #fff;
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-size: 11.2px;
  box-shadow: none;
}

.footer-btn--next:hover:not(:disabled) {
  transform: none;
  background: #0F766E;
  box-shadow: none;
}

.footer-btn--next:disabled {
  background: rgba(13, 148, 136, 0.2);
  color: rgba(0, 0, 0, 0.3);
  box-shadow: none;
  cursor: default;
  opacity: 0.65;
}

.footer-step-indicator {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.footer-btn--restart {
  padding: 11px 24px;
  border-radius: 0;
  border: 1px solid rgba(180, 140, 20, 0.65);
  background: transparent;
  color: var(--text-secondary);
  font-size: 11.2px;
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-sans);
  margin: 0 auto;
}

.footer-btn--restart:hover {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(180, 140, 20, 0.7);
  color: var(--text-primary);
}

/* ─── Upload count badge ─── */
.upload-count {
  padding: 12px 18px;
  background: rgba(13, 148, 136, 0.04);
  border: 1px solid rgba(13, 148, 136, 0.15);
  border-radius: 0;
  font-size: 13px;
  color: #0D9488;
  font-weight: 500;
  margin-top: 14px;
}

/* Lucide icon defaults */
[data-lucide] {
  display: inline-block;
  vertical-align: middle;
  stroke: currentColor;
  stroke-width: 1.75;
  fill: none;
}

/* ─── Responsive ─── */
@media (max-width: 640px) {
  #step-content {
    padding: 22px 18px;
  }

  #step-footer {
    padding: 14px 18px;
  }

  #app-header {
    padding: 14px 18px;
  }

  .step-heading {
    font-size: 22px;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .results-stats {
    grid-template-columns: 1fr;
  }

  .accuracy-value {
    font-size: 40px;
  }

  .saved-est-label {
    display: none;
  }

  .saved-est-btn {
    padding: 8px 12px !important;
    font-size: 18px !important;
  }
}

/* ─── Saved Estimates Button ─── */
.saved-est-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 0;
  border: 1px solid #0D9488;
  background: transparent;
  color: #0D9488;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-sans);
}

.saved-est-btn:hover {
  background: rgba(13, 148, 136, 0.04);
  border-color: #0F766E;
  transform: none;
  box-shadow: none;
}

/* ─── Saved Estimates Panel ─── */
.saved-panel-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(180, 140, 20, 0.7);
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.saved-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 440px;
  max-width: 95vw;
  height: 100vh;
  background: #FFFFFF;
  border-left: 1px solid rgba(180, 140, 20, 0.5);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -4px 0 20px rgba(180, 140, 20, 0.5);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
  }

  to {
    transform: translateX(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.saved-panel-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.saved-panel-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.saved-panel-close {
  width: 34px;
  height: 34px;
  border-radius: 0;
  border: 1px solid rgba(180, 140, 20, 0.65);
  background: #FFFFFF;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.saved-panel-close:hover {
  background: rgba(225, 29, 72, 0.04);
  border-color: rgba(225, 29, 72, 0.2);
  color: var(--accent-rose);
}

.saved-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

/* ─── Estimate Cards ─── */
.est-card {
  padding: 16px 18px;
  border-radius: 0;
  border: 1px solid rgba(180, 140, 20, 0.5);
  background: #FFFFFF;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.est-card:hover {
  border-color: rgba(13, 148, 136, 0.3);
  background: rgba(13, 148, 136, 0.02);
  transform: none;
}

.est-card-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.est-card-meta {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.6;
}

.est-card-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 0;
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.est-card-status--draft {
  background: rgba(217, 119, 6, 0.06);
  color: #D97706;
}

.est-card-status--analyzed {
  background: rgba(13, 148, 136, 0.06);
  color: #0D9488;
}

.est-card-status--exported {
  background: rgba(13, 148, 136, 0.06);
  color: #0D9488;
}

.est-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.est-card-btn {
  padding: 6px 14px;
  border-radius: 0;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-sans);
  border: none;
}

.est-card-btn--load {
  background: rgba(13, 148, 136, 0.06);
  border: 1px solid #0D9488;
  color: #0D9488;
}

.est-card-btn--load:hover {
  background: rgba(13, 148, 136, 0.1);
  border-color: #0F766E;
}

.est-card-btn--delete {
  background: rgba(225, 29, 72, 0.04);
  border: 1px solid rgba(225, 29, 72, 0.2);
  color: var(--accent-rose);
}

.est-card-btn--delete:hover {
  background: rgba(225, 29, 72, 0.08);
}

/* ─── Toast Notification ─── */
.sp-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 22px;
  border-radius: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  z-index: 2000;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
  font-family: var(--font-sans);
  box-shadow: 0 2px 8px rgba(180, 140, 20, 0.55);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: #FFFFFF;
  border: 1px solid rgba(180, 140, 20, 0.5);
}

.sp-toast--success {
  background: #FFFFFF;
  border-left: 3px solid #0D9488;
}

.sp-toast--error {
  background: #FFFFFF;
  border-left: 3px solid #E11D48;
}

.sp-toast--info {
  background: #FFFFFF;
  border-left: 3px solid #0D9488;
}

@keyframes toastIn {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

/* ─── Professional Proposal Button ─── */
.proposal-gen-btn {
  position: relative;
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 0;
  border: 1px solid #0D9488;
  border-radius: 0;
  background: #FFFFFF;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.proposal-gen-btn:hover {
  transform: none;
  box-shadow: none;
  border-color: #0F766E;
  background: rgba(13, 148, 136, 0.02);
}

.proposal-gen-btn:active {
  transform: translateY(0);
}

.proposal-gen-btn:disabled {
  cursor: wait;
  opacity: 0.85;
}

.proposal-gen-btn__shine {
  display: none;
}

@keyframes proposalShine {
  0%, 100% { left: -100%; }
  50% { left: 150%; }
}

.proposal-gen-btn__content {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 22px;
  z-index: 1;
}

.proposal-gen-btn__icon {
  font-size: 28px;
  flex-shrink: 0;
}

.proposal-gen-btn__title {
  font-size: 13px;
  font-weight: 500;
  color: #0D9488;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.proposal-gen-btn__sub {
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-top: 3px;
  font-weight: 400;
}

.proposal-gen-btn__arrow {
  margin-left: auto;
  font-size: 20px;
  color: var(--text-muted);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.proposal-gen-btn:hover .proposal-gen-btn__arrow {
  transform: translateX(4px);
  color: #0D9488;
}

.proposal-gen-btn.generating .proposal-gen-btn__icon {
  animation: proposalSpin 1.2s linear infinite;
}

.proposal-gen-btn.generating .proposal-gen-btn__shine {
  animation: proposalShine 1.5s ease-in-out infinite;
}

@keyframes proposalSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ─── Quota Warning Banner ─── */
@keyframes quotaBannerSlideIn {
  from {
    opacity: 0;
    transform: translateY(-12px);
    max-height: 0;
  }
  to {
    opacity: 1;
    transform: translateY(0);
    max-height: 200px;
  }
}

@keyframes quotaBannerSlideOut {
  from {
    opacity: 1;
    transform: translateY(0);
    max-height: 200px;
  }
  to {
    opacity: 0;
    transform: translateY(-12px);
    max-height: 0;
    padding: 0;
    margin: 0;
    border-width: 0;
  }
}

#quota-warning-banner {
  font-family: var(--font-sans);
}

#quota-warning-banner button:hover {
  opacity: 0.9;
}

/* ================================================================
   Enhanced Responsive Breakpoints
   ================================================================ */

/* ─── Tablet Breakpoint (768px) ─── */
@media (max-width: 768px) {

  /* Header: allow wrapping and tighter spacing */
  #app-header {
    flex-wrap: wrap;
    padding: 14px 18px;
    gap: 10px;
  }

  /* Usage stats shrink on tablet */
  #usage-stats {
    gap: 6px !important;
  }

  #usage-stats > div {
    padding: 4px 8px !important;
  }

  #usage-stats span {
    font-size: 11px !important;
  }

  /* Step nav: ensure horizontal scroll works cleanly */
  #step-nav {
    padding: 10px 14px;
    gap: 0;
    -webkit-overflow-scrolling: touch;
  }

  .step-circle {
    width: 32px;
    height: 32px;
    font-size: 13px;
  }

  .step-label {
    font-size: 8.5px;
    max-width: 64px;
  }

  .step-connector {
    min-width: 6px;
    margin: 0 2px 16px;
  }

  /* Upload zones: constrain to viewport */
  .upload-zone {
    padding: 24px 16px;
    max-width: 100%;
  }

  /* Inline 2-column grids from app.js → single column */
  #step-content [style*="grid-template-columns: 1fr 1fr"],
  #step-content [style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Results stats: 2 columns on tablet instead of 3 */
  .results-stats {
    grid-template-columns: 1fr 1fr;
  }

  /* Brain dashboard: full width on tablet */
  .brain-dashboard {
    max-width: 100%;
    padding: 16px 18px;
  }

  /* Footer buttons: adequate tap targets */
  .footer-btn {
    min-height: 44px;
    padding: 12px 20px;
    font-size: 14px;
  }

  #step-footer {
    padding: 14px 18px;
  }

  /* Saved panel cards: full width */
  .saved-panel {
    width: 100%;
    max-width: 100vw;
  }

  .est-card-actions {
    flex-wrap: wrap;
  }

  .est-card-btn {
    flex: 1;
    min-width: 80px;
    text-align: center;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Toast notifications: full width on smaller screens */
  .sp-toast {
    left: 16px;
    right: 16px;
    bottom: 16px;
  }

  /* Proposal button: tighter padding */
  .proposal-gen-btn__content {
    padding: 14px 16px;
    gap: 10px;
  }
}

/* ─── Mobile Breakpoint (640px) — extends existing rules ─── */
@media (max-width: 640px) {

  /* Header: stack into rows */
  #app-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Logo + text take full row */
  .header-logo {
    flex-shrink: 0;
  }

  .header-text {
    flex: 1;
    min-width: 0;
  }

  .header-text h1 {
    font-size: 15px;
  }

  .header-text p {
    font-size: 10px;
  }

  /* Usage stats: compress further */
  #usage-stats {
    order: 3;
    width: 100%;
    justify-content: flex-start !important;
    margin-left: 0 !important;
    gap: 6px !important;
    flex-wrap: wrap;
  }

  /* Header buttons: stack vertically with full width */
  #app-header > div:last-child {
    order: 4;
    width: 100%;
    flex-direction: column !important;
    gap: 6px !important;
  }

  #app-header > div:last-child .saved-est-btn {
    width: 100%;
    justify-content: center;
    padding: 10px 14px !important;
    font-size: 13px !important;
    min-height: 44px;
  }

  /* Step nav: compact mode */
  #step-nav {
    padding: 8px 10px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
  }

  .step-item {
    scroll-snap-align: start;
    flex-shrink: 0;
  }

  .step-circle {
    width: 30px;
    height: 30px;
    font-size: 12px;
  }

  .step-label {
    font-size: 8px;
    max-width: 56px;
  }

  .step-connector {
    min-width: 4px;
    margin: 0 1px 14px;
  }

  /* Upload zone: mobile sizing */
  .upload-zone {
    padding: 20px 14px;
  }

  .upload-icon {
    font-size: 28px;
  }

  /* Brain dashboard: compact rows */
  .brain-dashboard {
    max-width: 100%;
    padding: 14px 12px;
    margin-top: 20px;
  }

  .brain-row {
    gap: 6px;
    padding: 4px 6px;
  }

  .brain-name {
    font-size: 11px;
  }

  .brain-emoji {
    font-size: 12px;
    width: 18px;
  }

  .brain-status {
    font-size: 12px;
    width: 18px;
  }

  .brain-wave-header {
    font-size: 9px;
    margin-top: 10px;
    margin-bottom: 6px;
  }

  /* Footer: ensure proper tap targets */
  .footer-btn {
    min-height: 44px;
    padding: 12px 18px;
  }

  /* Results stats: single column */
  .results-stats {
    grid-template-columns: 1fr;
  }

  /* Saved panel: full screen takeover */
  .saved-panel {
    width: 100vw;
    max-width: 100vw;
  }

  .saved-panel-header {
    padding: 16px 18px;
  }

  .saved-panel-body {
    padding: 12px 14px;
  }

  .est-card {
    padding: 14px;
  }

  .est-card-actions {
    flex-direction: column;
    gap: 6px;
  }

  .est-card-btn {
    width: 100%;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    padding: 8px 14px;
  }
}

/* ─── Small Mobile Breakpoint (480px) ─── */
@media (max-width: 480px) {

  /* Hide usage stats on very small screens */
  #usage-stats {
    display: none !important;
  }

  /* Header: minimal layout */
  #app-header {
    padding: 10px 14px;
    gap: 6px;
  }

  .header-text h1 {
    font-size: 14px;
  }

  .header-text p {
    display: none;
  }

  /* Header buttons: icon-only mode */
  .saved-est-label {
    display: none;
  }

  #app-header > div:last-child {
    flex-direction: row !important;
    width: auto !important;
    order: 2;
    margin-left: auto;
  }

  #app-header > div:last-child .saved-est-btn {
    width: auto;
    min-height: 40px;
    padding: 8px 12px !important;
    font-size: 16px !important;
  }

  /* Step nav: icon-only, hide labels */
  .step-label {
    display: none;
  }

  .step-btn {
    gap: 2px;
    padding: 4px 2px;
  }

  .step-circle {
    width: 28px;
    height: 28px;
    font-size: 11px;
  }

  .step-connector {
    margin-bottom: 0;
  }

  #step-nav {
    padding: 8px;
  }

  /* Content area: tighter padding */
  #step-content {
    padding: 16px 12px;
  }

  .step-heading {
    font-size: 19px;
  }

  /* Upload zone: even more compact */
  .upload-zone {
    padding: 16px 10px;
  }

  .upload-icon {
    font-size: 24px;
    margin-bottom: 6px;
  }

  /* Inline grids from app.js: single column + tighter gap */
  #step-content [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  /* Footer: full width buttons stacked */
  #step-footer {
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
  }

  .footer-btn {
    width: 100%;
    text-align: center;
    min-height: 48px;
    font-size: 14px;
  }

  .footer-btn--back {
    order: 2;
  }

  .footer-btn--next,
  [class*="footer-btn"]:last-child {
    order: 1;
  }

  /* Brain dashboard: ultra compact */
  .brain-dashboard {
    padding: 10px 8px;
    margin-top: 16px;
  }

  .brain-row {
    padding: 3px 4px;
    gap: 4px;
  }

  .brain-name {
    font-size: 10.5px;
  }

  /* Summary cards: single column with tighter spacing */
  .summary-card {
    padding: 12px 14px;
  }

  /* Accuracy readout */
  .accuracy-value {
    font-size: 34px;
  }

  /* Proposal button */
  .proposal-gen-btn__content {
    padding: 12px 14px;
    gap: 8px;
  }

  .proposal-gen-btn__icon {
    font-size: 22px;
  }

  .proposal-gen-btn__title {
    font-size: 13px;
  }

  .proposal-gen-btn__sub {
    font-size: 10.5px;
  }

  /* Toast: tighter margin */
  .sp-toast {
    left: 10px;
    right: 10px;
    bottom: 10px;
    font-size: 12px;
    padding: 12px 16px;
  }
}

/* ─── Offline State ─── */
.is-offline .btn, .is-offline button[type="submit"] {
  opacity: 0.5;
  pointer-events: none;
}
.is-offline::after {
  content: 'OFFLINE';
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  background: #E11D48;
  color: white;
  padding: 4px 16px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 0;
  z-index: 9999;
}

/* ─── Actuals vs Estimate — Variance Coloring ─── */
.variance-green {
  color: #059669;
  background: rgba(5, 150, 105, 0.08);
}

.variance-yellow {
  color: #D97706;
  background: rgba(217, 119, 6, 0.08);
}

.variance-red {
  color: #E11D48;
  background: rgba(225, 29, 72, 0.08);
}

.variance-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 0;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  min-width: 60px;
}

.variance-badge.variance-green {
  border: 1px solid rgba(5, 150, 105, 0.25);
}

.variance-badge.variance-yellow {
  border: 1px solid rgba(217, 119, 6, 0.25);
}

.variance-badge.variance-red {
  border: 1px solid rgba(225, 29, 72, 0.25);
}

.actuals-input {
  width: 80px;
  padding: 4px 6px;
  border: 1px solid var(--border-medium);
  background: var(--bg-surface-2);
  color: var(--text-primary);
  font-size: 12px;
  font-family: var(--font-sans);
  text-align: right;
  outline: none;
  transition: border-color var(--transition-fast);
}

.actuals-input:focus {
  border-color: var(--accent-teal);
}

.actuals-summary-row {
  font-weight: 700;
  font-size: 13px;
  background: rgba(13, 148, 136, 0.06);
}

.actuals-summary-row td {
  padding: 10px 12px !important;
}

.benchmark-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 0;
  font-size: 10px;
  font-weight: 600;
  color: var(--accent-teal);
  background: rgba(13, 148, 136, 0.06);
  border: 1px solid rgba(13, 148, 136, 0.15);
  cursor: help;
  white-space: nowrap;
}

.benchmark-tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  padding: 8px 12px;
  font-size: 11px;
  color: var(--text-primary);
  white-space: nowrap;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(180, 140, 20, 0.55);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.benchmark-indicator:hover .benchmark-tooltip {
  opacity: 1;
}

/* ─── Bid Strategy ─── */
.bs-th {
  padding: 8px 12px;
  font-size: 10px;
  color: var(--accent-teal);
  font-weight: 700;
  border-bottom: 2px solid rgba(13, 148, 136, 0.2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
}

.bs-summary-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.bs-action-btn {
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: var(--font-sans);
}

.bs-action-btn--apply {
  flex: 1;
  border: 2px solid rgba(13, 148, 136, 0.4);
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.08), rgba(13, 148, 136, 0.02));
  color: var(--accent-teal);
}

.bs-action-btn--apply:hover {
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.15), rgba(13, 148, 136, 0.06));
  border-color: rgba(13, 148, 136, 0.6);
}

.bs-action-btn--reset {
  border: 1px solid var(--border-medium);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 12px;
}

.bs-action-btn--reset:hover {
  background: var(--bg-surface-2);
  border-color: var(--border-accent);
}

.bs-applied-banner {
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.2);
  font-size: 12px;
  color: #10b981;
  font-weight: 600;
}

.bid-strategy-row:hover {
  background: var(--bg-surface-hover);
}

.bid-strategy-input:focus {
  border-color: var(--accent-teal) !important;
  box-shadow: 0 0 0 1px rgba(13, 148, 136, 0.2);
}

.bid-strategy-input:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Confidence badge colors for select */
.bs-confidence option[value="high"] { color: #10b981; }
.bs-confidence option[value="medium"] { color: #f59e0b; }
.bs-confidence option[value="low"] { color: #ef4444; }

/* ─── Exclusions & Assumptions Panel ─── */
.excl-item:hover {
  background: rgba(13, 148, 136, 0.03) !important;
}

.excl-item button[disabled] {
  opacity: 0.25;
  cursor: default;
}

.excl-tab {
  transition: color 0.15s, border-bottom-color 0.15s;
}

.excl-tab:hover {
  color: var(--accent-teal) !important;
}

#excl-add-text:focus {
  border-color: rgba(13, 148, 136, 0.4);
  outline: none;
  background: #FFFFFF;
}

#excl-add-category:focus {
  border-color: rgba(13, 148, 136, 0.4);
  outline: none;
}

#excl-add-btn:hover {
  background: rgba(13, 148, 136, 0.15);
}

#excl-load-defaults:hover {
  background: rgba(0, 0, 0, 0.05);
}

#excl-auto-generate:hover {
  background: rgba(13, 148, 136, 0.12);
}

.excl-edit-btn:hover {
  color: var(--accent-teal) !important;
}

.excl-delete-btn:hover {
  color: #dc2626 !important;
}

.excl-inline-edit:focus {
  outline: none;
  border-color: var(--accent-teal) !important;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ─── Bid Phase Badges ─── */
.bid-phase-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
}

.bid-phase-badge--base {
  background: rgba(13, 148, 136, 0.08);
  color: #0D9488;
  border: 1px solid rgba(13, 148, 136, 0.25);
}

.bid-phase-badge--add {
  background: rgba(5, 150, 105, 0.08);
  color: #059669;
  border: 1px solid rgba(5, 150, 105, 0.25);
}

.bid-phase-badge--deduct {
  background: rgba(217, 119, 6, 0.08);
  color: #D97706;
  border: 1px solid rgba(217, 119, 6, 0.25);
}

.bid-phase-badge--optional {
  background: rgba(0, 0, 0, 0.03);
  color: var(--text-muted);
  border: 1px solid rgba(180, 140, 20, 0.55);
}

/* ─── Bid Phase Category Chips ─── */
.bid-phase-cat-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid rgba(180, 140, 20, 0.5);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.bid-phase-cat-chip:hover {
  border-color: rgba(13, 148, 136, 0.3);
  background: rgba(13, 148, 136, 0.04);
}

.bid-phase-cat-chip--active {
  background: rgba(13, 148, 136, 0.08);
  border-color: rgba(13, 148, 136, 0.35);
  color: #0D9488;
  font-weight: 600;
}

/* ─── Bid Phase Row ─── */
.bid-phase-row {
  transition: all var(--transition-fast);
}

.bid-phase-row:hover {
  background: var(--bg-surface-hover) !important;
}

/* ═══════════════════════════════════════════════════════════════
   Rate Library — Slide-out Panel & Components
   ═══════════════════════════════════════════════════════════════ */

.rate-library-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(180, 140, 20, 0.7);
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.rate-library-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 480px;
  max-width: 95vw;
  height: 100vh;
  background: #FFFFFF;
  border-left: 1px solid rgba(180, 140, 20, 0.5);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -4px 0 20px rgba(180, 140, 20, 0.5);
}

.rate-library-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.rate-library-header h2 {
  font-family: 'Cormorant', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

.rate-library-toolbar {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--bg-surface-2);
}

.rate-search-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border-medium);
  border-radius: 0;
  font-size: 13px;
  color: var(--text-primary);
  background: #FFFFFF;
  outline: none;
  transition: border-color var(--transition-fast);
}

.rate-search-input:focus {
  border-color: var(--accent-teal);
}

.rate-category-select {
  padding: 8px 12px;
  border: 1px solid var(--border-medium);
  border-radius: 0;
  font-size: 12px;
  color: var(--text-primary);
  background: #FFFFFF;
  outline: none;
  cursor: pointer;
  min-width: 120px;
}

.rate-library-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

/* ─── Rate Cards ─── */
.rate-card {
  padding: 14px 16px;
  border: 1px solid rgba(180, 140, 20, 0.5);
  background: #FFFFFF;
  margin-bottom: 8px;
  transition: all var(--transition-fast);
}

.rate-card:hover {
  border-color: rgba(13, 148, 136, 0.25);
  background: rgba(13, 148, 136, 0.02);
}

.rate-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.rate-card-name {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.3;
}

.rate-card-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.rate-card-actions button {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(180, 140, 20, 0.5);
  background: #FFFFFF;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: all var(--transition-fast);
  padding: 0;
}

.rate-card-actions button:hover {
  border-color: rgba(13, 148, 136, 0.3);
  background: rgba(13, 148, 136, 0.06);
}

.rate-card-details {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  align-items: center;
}

.rate-tag {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(13, 148, 136, 0.08);
  border: 1px solid rgba(13, 148, 136, 0.2);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-teal);
}

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

.rate-card-meta {
  margin-top: 6px;
  font-size: 10px;
  color: var(--text-muted);
}

/* ─── Rate Form ─── */
.rate-add-form {
  padding: 16px;
  border: 1px solid rgba(13, 148, 136, 0.2);
  background: rgba(13, 148, 136, 0.02);
  margin-bottom: 12px;
}

.rate-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.rate-form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rate-form-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.rate-form-input {
  padding: 8px 10px;
  border: 1px solid var(--border-medium);
  border-radius: 0;
  font-size: 13px;
  color: var(--text-primary);
  background: #FFFFFF;
  outline: none;
  transition: border-color var(--transition-fast);
}

.rate-form-input:focus {
  border-color: var(--accent-teal);
}

/* ─── Rate Buttons ─── */
.rate-btn-primary {
  padding: 8px 16px;
  border: 1px solid var(--accent-teal);
  background: var(--accent-teal);
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.rate-btn-primary:hover {
  background: var(--accent-teal-dark);
  border-color: var(--accent-teal-dark);
}

.rate-btn-secondary {
  padding: 8px 16px;
  border: 1px solid var(--border-medium);
  background: #FFFFFF;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.rate-btn-secondary:hover {
  border-color: var(--accent-rose);
  color: var(--accent-rose);
  background: rgba(225, 29, 72, 0.04);
}

/* ── Competitor Bid Comparison ── */
.bid-compare-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.bid-compare-metric {
  padding: 16px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  text-align: center;
}
.bid-compare-metric-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(0, 0, 0, 0.45);
  font-weight: 600;
  margin-bottom: 6px;
}
.bid-compare-metric-value {
  font-family: 'Cormorant', Georgia, serif;
  font-size: 22px;
  font-weight: 400;
  color: #1a1a2e;
}
.bid-compare-metric--positive .bid-compare-metric-value { color: #059669; }
.bid-compare-metric--negative .bid-compare-metric-value { color: #dc2626; }

.bid-compare-breakdown {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}
.bid-compare-breakdown-card {
  padding: 14px 16px;
  border: 1px solid rgba(0, 0, 0, 0.08);
}
.bid-compare-breakdown-card--higher {
  border-left: 3px solid #dc2626;
  background: rgba(220, 38, 38, 0.03);
}
.bid-compare-breakdown-card--lower {
  border-left: 3px solid #059669;
  background: rgba(5, 150, 105, 0.03);
}

.bid-compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-bottom: 16px;
}
.bid-compare-table th {
  background: #0D9488;
  color: white;
  padding: 8px 10px;
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  white-space: nowrap;
}
.bid-compare-table th:nth-child(n+2) { text-align: right; }
.bid-compare-table td {
  padding: 7px 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.bid-compare-table td:nth-child(n+2) { text-align: right; font-variant-numeric: tabular-nums; }

.bid-compare-row--higher {
  background: rgba(220, 38, 38, 0.04);
}
.bid-compare-row--lower {
  background: rgba(5, 150, 105, 0.04);
}
.bid-compare-row--match {
  background: transparent;
}
.bid-compare-row--higher:hover { background: rgba(220, 38, 38, 0.08); }
.bid-compare-row--lower:hover { background: rgba(5, 150, 105, 0.08); }
.bid-compare-row--match:hover { background: rgba(0, 0, 0, 0.02); }

.bid-compare-cat-header {
  background: rgba(0, 0, 0, 0.03);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.bid-compare-unmatched {
  margin-top: 16px;
  padding: 12px 16px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(0, 0, 0, 0.01);
}
.bid-compare-unmatched summary {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(0, 0, 0, 0.5);
  cursor: pointer;
  padding: 4px 0;
}
.bid-compare-unmatched li {
  font-size: 12px;
  padding: 3px 0;
  color: rgba(0, 0, 0, 0.6);
}

.bid-compare-clear {
  display: inline-block;
  margin-top: 12px;
  padding: 8px 20px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: white;
  color: rgba(0, 0, 0, 0.6);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s;
}
.bid-compare-clear:hover {
  border-color: #dc2626;
  color: #dc2626;
}

/* Responsive */
@media (max-width: 768px) {
  .bid-compare-summary { grid-template-columns: repeat(2, 1fr); }
  .bid-compare-breakdown { grid-template-columns: 1fr; }
  .bid-compare-table { font-size: 11px; }
  .bid-compare-table th, .bid-compare-table td { padding: 5px 6px; }
}
@media (max-width: 480px) {
  .bid-compare-summary { grid-template-columns: 1fr; }
}

/* ─── Responsive ─── */
@media (max-width: 640px) {
  .rate-library-panel {
    width: 100vw;
  }

  .rate-library-toolbar {
    flex-wrap: wrap;
  }

  .rate-form-grid {
    grid-template-columns: 1fr;
  }
}

/* ─── BOM Item Tooltip ─── */
.bom-item-cell {
  position: relative;
}
.bom-item-cell:hover .bom-tooltip {
  display: block;
}
.bom-item-cell .bom-info-icon:hover {
  background: rgba(99, 102, 241, 0.25);
  color: rgba(99, 102, 241, 1);
}

/* ─── Print Styles ─── */
@media print {
  .bg-grid, .bg-orb, .bg-grid-lines { display: none !important; }
  #app-header, #step-nav, #step-footer { display: none !important; }
  #sp-update-banner, .sp-toast { display: none !important; }
  .saved-panel, .saved-panel-backdrop { display: none !important; }
  #app-shell { border: none !important; box-shadow: none !important; background: white !important; }
  body { background: white !important; color: black !important; }
  #step-content { padding: 0 !important; }
  * { box-shadow: none !important; text-shadow: none !important; }
  a { color: inherit !important; text-decoration: none !important; }
}
