/* ============================================================
   Earling Labs Estimator - v0.8.0 BLUEPRINT
   Design system: deep blueprint navy + safety amber.
   Industrial drafting-table aesthetic. Operator-focused.
   ============================================================ */

:root {
  /* --- Base palette (Blueprint Navy) --- */
  --bg:           #0E1F35;
  --bg-deep:      #081429;
  --surface:      #142B45;
  --surface-2:    #1A3552;
  --surface-3:    #213F60;

  /* --- Ink (blueprint paper cream) --- */
  --ink:          #EFE5CC;
  --ink-soft:     #9FB4CC;
  --ink-dim:      #6B819A;
  --ink-deep:     #4A6080;

  /* --- Rules / borders --- */
  --rule:         rgba(155, 200, 240, 0.12);
  --rule-strong:  rgba(155, 200, 240, 0.28);
  --rule-bright:  rgba(155, 200, 240, 0.45);

  /* --- Accent (Safety Amber) --- */
  --accent:       #F5A02A;
  --accent-deep:  #C97A0F;
  --accent-soft:  rgba(245, 160, 42, 0.14);
  --accent-glow:  rgba(245, 160, 42, 0.35);

  /* --- Blueprint cyan (technical / measurements) --- */
  --blueprint:    #5BB8E6;
  --blueprint-deep: #2A8AC0;

  /* --- Semantic --- */
  --success:      #00EC6E;
  --warning:      #F5C242;
  --error:        #E25B43;

  /* --- Type --- */
  --font-display: 'Oswald', 'Arial Narrow', sans-serif;
  --font-body:    'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono:    'JetBrains Mono', 'Courier New', monospace;

  /* --- Geometry --- */
  --radius-sm: 2px;
  --radius:    4px;
  --radius-lg: 6px;
}

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

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  /* Blueprint grid background */
  background-image:
    linear-gradient(rgba(155, 200, 240, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(155, 200, 240, 0.025) 1px, transparent 1px),
    radial-gradient(ellipse at top, rgba(91, 184, 230, 0.05) 0%, transparent 60%);
  background-size: 24px 24px, 24px 24px, 100% 100%;
  background-attachment: fixed;
}

a { color: var(--blueprint); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--accent); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink);
}

code {
  font-family: var(--font-mono);
  background: var(--bg-deep);
  color: var(--blueprint);
  padding: 2px 5px;
  font-size: 12px;
  border-radius: 2px;
}

/* ============================================================
   AUTH PAGE (login / signup)
   ============================================================ */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-container {
  max-width: 460px;
  width: 100%;
}

.auth-container .brand {
  text-align: center;
  margin-bottom: 36px;
}

.auth-container .brand-svg-wrap {
  margin: 0 auto 14px;
  max-width: 300px;
  filter: drop-shadow(0 6px 16px rgba(0,0,0,0.35));
}

.auth-container .brand-svg-wrap svg {
  width: 100%;
  height: auto;
  display: block;
}

.auth-container .brand-product-name {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.44em;
  color: var(--blueprint);
  text-transform: uppercase;
  margin-bottom: 6px;
  margin-top: 8px;
}

.auth-container .brand .tagline {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  padding: 28px;
  position: relative;
  margin-bottom: 20px;
  border-radius: var(--radius);
}

/* Drafting-bracket corner marks */
.card::before,
.card::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: var(--accent);
  border-style: solid;
  border-width: 0;
  pointer-events: none;
}
.card::before {
  top: -1px;
  left: -1px;
  border-top-width: 2px;
  border-left-width: 2px;
}
.card::after {
  bottom: -1px;
  right: -1px;
  border-bottom-width: 2px;
  border-right-width: 2px;
}

.card h3 {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--blueprint);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
}

/* ============================================================
   TABS
   ============================================================ */
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--rule);
}

.tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--ink-soft);
  padding: 14px 16px;
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}

.tab.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.tab:hover:not(.active) { color: var(--ink); }

/* ============================================================
   FORMS
   ============================================================ */
.form { display: none; }
.form.active { display: block; }

.field { margin-bottom: 16px; }

.field-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.field-row .field { flex: 1; min-width: 140px; }
.field-grow { flex-grow: 2; }
.field-action { flex-grow: 0; }

.field label {
  display: block;
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
  text-transform: uppercase;
  margin-bottom: 6px;
  font-weight: 500;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  background: var(--bg-deep);
  border: 1px solid var(--rule-strong);
  color: var(--ink);
  padding: 11px 13px;
  font-family: var(--font-body);
  font-size: 14px;
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--blueprint);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(91, 184, 230, 0.12);
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--ink-deep);
}

.field textarea {
  font-family: var(--font-body);
  min-height: 80px;
  resize: vertical;
}

.checkbox-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
}

.checkbox-wrap input[type="checkbox"] {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary {
  background: var(--accent);
  color: #1A0A00;
  border: none;
  padding: 12px 26px;
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.16em;
  font-weight: 600;
  text-transform: uppercase;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background 0.15s, transform 0.05s, box-shadow 0.2s;
}

.btn-primary:hover {
  background: var(--accent-deep);
  color: #1A0A00;
  box-shadow: 0 0 24px var(--accent-glow);
}

.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--rule-strong);
  padding: 11px 22px;
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.16em;
  font-weight: 500;
  text-transform: uppercase;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn-secondary:hover {
  background: var(--surface-2);
  border-color: var(--blueprint);
  color: var(--ink);
}

.btn-danger {
  background: transparent;
  color: var(--error);
  border: 1px solid var(--error);
  padding: 11px 22px;
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
}

.btn-danger:hover { background: rgba(226, 91, 67, 0.12); }

/* ============================================================
   APP HEADER (nav bar)
   ============================================================ */
.app-header {
  background: var(--bg-deep);
  border-bottom: 1px solid var(--rule-strong);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  gap: 28px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand-small {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ink);
  padding-right: 24px;
  border-right: 1px solid var(--rule);
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-small::before {
  content: '';
  display: block;
  width: 44px;
  height: 55px;
  background-image: url('/img/earling_labs_logo.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  flex-shrink: 0;
}

.app-nav {
  display: flex;
  gap: 2px;
  flex: 1;
}

.app-nav a {
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 8px 14px;
  border-radius: var(--radius);
  position: relative;
  font-weight: 500;
  transition: color 0.15s, background 0.15s;
}

.app-nav a:hover { color: var(--ink); }

.app-nav a.active {
  color: var(--ink);
  background: var(--surface);
}

.app-nav a.active::after {
  content: '';
  position: absolute;
  bottom: -15px;
  left: 14px;
  right: 14px;
  height: 2px;
  background: var(--accent);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.user-menu #user-name { color: var(--ink); }
.user-menu .account-name { color: var(--ink-dim); }

/* ============================================================
   APP MAIN
   ============================================================ */
.app-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px;
}

.hero-row {
  display: flex;
  align-items: center;
  gap: 48px;
  margin-bottom: 28px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--rule);
}

.hero-row .welcome {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.hero-logo {
  width: 220px;
  height: auto;
  flex-shrink: 0;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.5));
}

@media (max-width: 880px) {
  .hero-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
  }
  .hero-logo {
    width: 150px;
  }
}


.welcome {
  margin-bottom: 28px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--rule);
  position: relative;
}

.welcome::before {
  content: '// MISSION BRIEF';
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.24em;
  color: var(--blueprint);
  margin-bottom: 8px;
}

.welcome h2 {
  font-family: var(--font-display);
  font-size: 38px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 10px;
  line-height: 1.05;
}

.welcome p {
  color: var(--ink-soft);
  font-size: 14px;
  max-width: 760px;
  line-height: 1.6;
}

/* ============================================================
   DASHBOARD GRID
   ============================================================ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

/* Status rows */
.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 13px;
}
.status-row:last-child { border-bottom: none; }
.status-row .label {
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
}
.status-row .value { color: var(--ink); font-weight: 500; }
.status-row .value.ok { color: var(--success); }
.status-row .value.error { color: var(--error); }

/* Trade rows */
.trade-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--rule);
}
.trade-row:last-child { border-bottom: none; }
.trade-name {
  font-family: var(--font-body);
  color: var(--ink);
  font-size: 14px;
}

.trade-badge {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 2px;
  background: var(--surface-2);
  color: var(--ink-dim);
  border: 1px solid var(--rule);
  display: inline-block;
  font-weight: 500;
}

.trade-badge.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

.trade-badge.extracted,
.trade-badge.confirmed {
  background: rgba(0, 236, 110, 0.12);
  color: var(--success);
  border-color: var(--success);
}

.trade-badge.review,
.trade-badge.processing {
  background: rgba(245, 194, 66, 0.12);
  color: var(--warning);
  border-color: var(--warning);
}

.trade-badge.failed {
  background: rgba(226, 91, 67, 0.12);
  color: var(--error);
  border-color: var(--error);
}

.trade-badge.planned {
  background: transparent;
  color: var(--ink-dim);
  border-style: dashed;
}

/* Roadmap */
.roadmap {
  list-style: none;
  font-family: var(--font-mono);
  font-size: 13px;
}

.roadmap li {
  padding: 9px 0;
  display: flex;
  gap: 12px;
  align-items: center;
  color: var(--ink-soft);
  border-bottom: 1px dashed var(--rule);
}
.roadmap li:last-child { border-bottom: none; }

.day {
  display: inline-block;
  background: var(--surface-2);
  color: var(--ink-dim);
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.14em;
  padding: 4px 9px;
  text-transform: uppercase;
  border-radius: 2px;
  min-width: 58px;
  text-align: center;
  font-weight: 500;
}

.day.done {
  background: var(--success);
  color: var(--bg-deep);
}

/* ============================================================
   WIZARD STEPPER
   ============================================================ */
.wizard-steps {
  display: flex;
  margin-bottom: 32px;
  gap: 0;
  position: relative;
}

.wizard-steps::before {
  content: '';
  position: absolute;
  top: 22px;
  left: 12%;
  right: 12%;
  height: 1px;
  background: var(--rule-strong);
  z-index: 0;
}

.step {
  position: relative;
  flex: 1;
  text-align: center;
  z-index: 1;
}

.step-num {
  display: block;
  width: 44px;
  height: 44px;
  line-height: 40px;
  margin: 0 auto 10px;
  background: var(--bg-deep);
  border: 2px solid var(--rule-strong);
  color: var(--ink-dim);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  border-radius: 50%;
  transition: all 0.2s;
}

.step.active .step-num {
  background: var(--accent);
  color: var(--bg-deep);
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
}

.step.done .step-num {
  background: var(--blueprint);
  color: var(--bg-deep);
  border-color: var(--blueprint);
}

.step-label {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-dim);
  font-weight: 500;
}

.step.active .step-label { color: var(--ink); }
.step.done .step-label { color: var(--ink-soft); }

.wizard-pane { display: none; }
.wizard-pane.active { display: block; }

.wizard-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
  flex-wrap: wrap;
}

.wizard-actions > *:only-child { margin-left: auto; }

/* ============================================================
   LINE ITEMS TABLE
   ============================================================ */
.line-items-table,
.public-items {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 14px;
}

.line-items-table thead,
.public-items thead {
  background: var(--bg-deep);
}

.line-items-table th,
.public-items th {
  text-align: left;
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--blueprint);
  padding: 10px 8px;
  border-bottom: 2px solid var(--rule-strong);
  font-weight: 500;
}

.line-items-table td,
.public-items td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
}

.line-items-table td input,
.line-items-table td select {
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink);
  padding: 5px 7px;
  font-family: inherit;
  font-size: 14px;
  width: 100%;
  border-radius: 2px;
}

.line-items-table td input:focus,
.line-items-table td select:focus {
  border-color: var(--blueprint);
  outline: none;
  background: var(--bg-deep);
}

.line-items-table .col-qty,
.line-items-table .col-price,
.line-items-table .col-total,
.public-items .col-qty,
.public-items .col-price,
.public-items .col-total,
.public-items .num {
  text-align: right;
  font-family: var(--font-mono);
}

.cat-row td {
  background: var(--bg-deep);
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--accent);
  padding: 9px 8px;
  border-bottom: 1px solid var(--rule-strong);
  font-weight: 600;
}

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

/* ============================================================
   TOTALS BLOCK
   ============================================================ */
.totals-block {
  margin-top: 20px;
  padding: 20px 24px;
  background: var(--bg-deep);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  font-family: var(--font-mono);
}

.totals-row {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.totals-row span:first-child {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
}

.totals-row.totals-total {
  margin-top: 10px;
  padding-top: 14px;
  border-top: 2px solid var(--rule-strong);
  font-family: var(--font-display);
  font-size: 24px;
  color: var(--accent);
  letter-spacing: 0.04em;
}

.totals-row.totals-total span:first-child {
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--ink-soft);
  line-height: 36px;
}

/* ============================================================
   ESTIMATES LIST
   ============================================================ */
.estimate-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  margin-bottom: 10px;
  text-decoration: none;
  background: var(--bg-deep);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.05s;
}

.estimate-row:hover {
  border-color: var(--blueprint);
  background: var(--surface-2);
}

.estimate-row:active { transform: translateY(1px); }

.estimate-row-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.estimate-filename {
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--ink);
  font-size: 15px;
}

.estimate-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-dim);
}

.estimate-row-badges {
  display: flex;
  gap: 8px;
}

/* ============================================================
   ESTIMATE DETAIL
   ============================================================ */
.estimate-header .estimate-title-row {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.estimate-header h2 {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: 0.02em;
  outline: none;
}

.estimate-header h2[contenteditable="true"]:focus {
  background: var(--bg-deep);
  padding: 2px 6px;
  border-radius: 2px;
}

.estimate-header p[contenteditable="true"]:focus {
  background: var(--bg-deep);
  padding: 4px 8px;
  border-radius: 2px;
  outline: none;
}

.estimate-meta-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.estimate-actions-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 20px;
  padding: 16px 20px;
  background: var(--bg-deep);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
}

/* Refine row */
.refine-row {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.refine-row input {
  flex: 1;
  min-width: 240px;
  background: var(--bg-deep);
  border: 1px solid var(--rule-strong);
  color: var(--ink);
  padding: 11px 13px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
}

.refine-row input:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Share */
.share-block { padding: 12px 0; }

.share-url-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.share-url-row input {
  flex: 1;
  min-width: 240px;
  background: var(--bg-deep);
  border: 1px solid var(--rule-strong);
  color: var(--blueprint);
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  border-radius: var(--radius);
}

/* ============================================================
   STATUS BANNERS
   ============================================================ */
.status-banner {
  padding: 14px 20px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--rule-strong);
  margin-bottom: 20px;
  font-family: var(--font-body);
}

.status-banner.accepted {
  background: rgba(0, 236, 110, 0.10);
  border-color: var(--success);
  color: var(--ink);
}

.status-banner.declined {
  background: rgba(226, 91, 67, 0.10);
  border-color: var(--error);
}

/* ============================================================
   ERRORS / HINTS
   ============================================================ */
.error { color: var(--error); font-size: 13px; margin-top: 6px; }

.hint {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 4px;
  line-height: 1.55;
}

.hidden { display: none !important; }

.footer-note {
  text-align: center;
  margin-top: 28px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-dim);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* ============================================================
   SPINNER
   ============================================================ */
.spinner {
  width: 40px;
  height: 40px;
  margin: 28px auto;
  border: 3px solid var(--rule-strong);
  border-top-color: var(--accent);
  border-right-color: var(--blueprint);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   PUBLIC QUOTE PAGE
   ============================================================ */
.public-page { background: var(--bg); }

.public-main {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 24px;
}

.public-card {
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  padding: 28px;
  margin-bottom: 16px;
  border-radius: var(--radius);
  position: relative;
}

.public-card::before,
.public-card::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  border-color: var(--accent);
  border-style: solid;
  border-width: 0;
  pointer-events: none;
}
.public-card::before {
  top: -1px;
  left: -1px;
  border-top-width: 2px;
  border-left-width: 2px;
}
.public-card::after {
  bottom: -1px;
  right: -1px;
  border-bottom-width: 2px;
  border-right-width: 2px;
}

.public-header {
  text-align: center;
  padding: 28px 0 12px;
}

.public-header h1 {
  font-family: var(--font-display);
  font-size: 36px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.public-subtitle {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-dim);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-top: 8px;
}

.meta-line {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
  margin: 4px 0 12px;
}

.narrative {
  color: var(--ink);
  line-height: 1.7;
}

/* Action tabs on public quote */
.action-options {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--rule);
  flex-wrap: wrap;
}

.action-tab {
  background: transparent;
  border: none;
  color: var(--ink-soft);
  padding: 12px 22px;
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  font-weight: 500;
}

.action-tab.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.action-pane { display: none; }
.action-pane.active { display: block; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 20, 41, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
  backdrop-filter: blur(4px);
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  padding: 32px;
  max-width: 720px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  border-radius: var(--radius);
}

.modal-card::before,
.modal-card::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: var(--accent);
  border-style: solid;
  border-width: 0;
}
.modal-card::before {
  top: -1px;
  left: -1px;
  border-top-width: 2px;
  border-left-width: 2px;
}
.modal-card::after {
  bottom: -1px;
  right: -1px;
  border-bottom-width: 2px;
  border-right-width: 2px;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: transparent;
  border: none;
  color: var(--ink-soft);
  font-size: 26px;
  cursor: pointer;
  line-height: 1;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
}

.modal-close:hover { color: var(--ink); background: var(--surface-2); }

.detail-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
  margin: 14px 0;
}

.detail-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--rule);
  margin: 16px 0;
}

.detail-tab {
  background: transparent;
  border: none;
  color: var(--ink-soft);
  padding: 10px 18px;
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
}

.detail-tab.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.detail-pane {
  display: none;
  font-family: var(--font-mono);
  font-size: 12px;
  max-height: 400px;
  overflow-y: auto;
  background: var(--bg-deep);
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
}

.detail-pane.active { display: block; }

.detail-pane pre {
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}

.detail-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}

/* ============================================================
   PHOTO RESULT
   ============================================================ */
.photo-result-box {
  background: var(--bg-deep);
  padding: 18px;
  border: 1px solid var(--blueprint);
  border-radius: var(--radius);
  margin-top: 16px;
}

.photo-result-box h4 {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--blueprint);
  margin: 14px 0 8px;
  font-weight: 500;
}

.photo-result-box h4:first-child { margin-top: 0; }

.confidence-pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 11px;
  margin-left: 4px;
}

.pill-good { background: rgba(0, 236, 110, 0.18); color: var(--success); }
.pill-ok { background: rgba(245, 194, 66, 0.18); color: var(--warning); }
.pill-low { background: rgba(226, 91, 67, 0.18); color: var(--error); }

.suggestions-list, .cautions-list {
  list-style: none;
  padding: 0;
}

.suggestions-list li,
.cautions-list li {
  padding: 5px 0;
  font-size: 13px;
  color: var(--ink);
  font-family: var(--font-mono);
}

.cautions-list li { color: var(--warning); }

.pre-filled {
  background: rgba(245, 160, 42, 0.10) !important;
  border-color: var(--accent) !important;
}

/* ============================================================
   STATUS LIST, NUMBERED STEPS
   ============================================================ */
.status-list {
  list-style: none;
  padding: 0;
  margin-top: 12px;
}

.status-list li {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-soft);
  padding: 5px 0;
  border-bottom: 1px dashed var(--rule);
}

.status-list li:last-child { border-bottom: none; }

.numbered-steps {
  padding-left: 22px;
  color: var(--ink-soft);
}

.numbered-steps li {
  padding: 5px 0;
}

/* ============================================================
   MESSAGES (customer thread)
   ============================================================ */
.msg-bubble {
  background: var(--bg-deep);
  border-left: 3px solid var(--blueprint);
  padding: 13px 17px;
  margin-bottom: 12px;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.msg-bubble.msg-customer {
  border-left-color: var(--accent);
}

.msg-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-dim);
  margin-bottom: 6px;
  font-family: var(--font-mono);
}

.msg-time { font-family: var(--font-mono); }

.msg-body {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  font-family: var(--font-body);
}

/* ============================================================
   UPLOAD CARD
   ============================================================ */
.upload-card .field-row { align-items: flex-end; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .app-header {
    flex-wrap: wrap;
    padding: 12px 16px;
    gap: 10px;
  }

  .brand-small {
    padding-right: 16px;
    font-size: 14px;
  }

  .app-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
  }

  .app-nav a.active::after { bottom: -12px; }

  .app-main { padding: 24px 16px; }

  .welcome h2 { font-size: 28px; }

  .auth-container .brand-svg-wrap { max-width: 240px; }

  .wizard-steps { gap: 4px; }
  .step-num { width: 38px; height: 38px; line-height: 34px; font-size: 14px; }
  .step-label { font-size: 9px; letter-spacing: 0.12em; }
}
