/* ═══════════════════════════════════════════════════════════════════
RepairIQ — Admin Console (Modernized)
Dark glass aesthetic matching the public view.
═══════════════════════════════════════════════════════════════════ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

:root {
  --bg: #0b0c0f;
  --bg-2: #111318;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-2: rgba(255, 255, 255, 0.06);
  --surface-3: rgba(255, 255, 255, 0.09);
  --border: rgba(255, 255, 255, 0.085);
  --border-hi: rgba(255, 255, 255, 0.18);
  --text: #f2f3f5;
  --text-dim: #9fa5b1;
  --text-faint: #5c6270;

  /* Workshop identity: amber = primary action (tools/garage), steel-blue = secondary/info */
  --accent: #f2994a;
  --accent-2: #f7b955;
  --accent-glow: rgba(242, 153, 74, 0.32);
  --info: #4fa8e0;
  --info-2: #7cc4ee;

  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --font-ui: 'Inter', system-ui, -apple-system, sans-serif;
  --font-head: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', Consolas, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

html,
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Ambient background ──────────────────────────────────────────── */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.4;
  pointer-events: none;
  z-index: 0;
}

.bg-glow-1 {
  width: 650px;
  height: 650px;
  top: -260px;
  left: -180px;
  background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
  opacity: 0.10;
}

.bg-glow-2 {
  width: 750px;
  height: 750px;
  bottom: -340px;
  right: -220px;
  background: radial-gradient(circle, var(--info) 0%, transparent 70%);
  opacity: 0.08;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 40%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}

/* ── Shell / layout ──────────────────────────────────────────────── */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ── Header ──────────────────────────────────────────────────────── */
/* The blur/background live on a ::before, not on `header` itself —
   `backdrop-filter` (like `transform`/`filter`) makes an element the
   containing block for any `position:fixed` descendant, which broke
   .primary-nav's fixed-to-viewport-bottom mobile tab bar below (it was
   fixing to the header's own box instead of the viewport). */
header {
  border-bottom: 1px solid var(--border);
  color: var(--text);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
}
header::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(17, 19, 24, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: -1;
}

header .brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

header .brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #17110a;
  font-weight: 700;
  font-size: 16px;
  box-shadow: 0 4px 16px var(--accent-glow);
}

header h1 {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

header h1 strong {
  color: var(--accent-2);
  font-weight: 700;
}

.badge {
  font-size: 10px;
  font-weight: 700;
  background: linear-gradient(135deg, rgba(242, 153, 74, 0.2), rgba(79, 168, 224, 0.15));
  border: 1px solid rgba(242, 153, 74, 0.3);
  color: var(--accent-2);
  border-radius: 100px;
  padding: 3px 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Primary destination pills, sit in the header next to the brand */
.primary-nav {
  display: flex;
  align-items: center;
  gap: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 3px;
  margin-left: 12px;
}

.primary-nav .nav-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  width: auto;
  margin: 0;
  padding: 7px 16px;
  border: none;
  background: transparent;
  border-radius: 100px;
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font-ui);
  color: var(--text-dim);
  font-weight: 600;
  transition: all 0.15s var(--ease);
  white-space: nowrap;
}

.primary-nav .nav-btn:hover {
  color: var(--text);
}

.primary-nav .nav-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #17110a;
  box-shadow: 0 2px 10px var(--accent-glow);
}

.primary-nav .nav-btn .ic { font-size: 14px; line-height: 1; }

.header-links {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Kebab menu — only shown at narrow widths, see the mobile media query below */
.header-menu-btn {
  display: none;
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 18px;
  line-height: 1;
  padding: 6px 12px;
  cursor: pointer;
}
.header-menu-btn:hover { background: var(--surface-2); color: var(--text); }

.header-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 8px;
  transition: all 0.15s;
}

.header-links a:hover {
  background: var(--surface-2);
  color: var(--text);
}

/* Live system-health dot in the header — click opens Settings > System */
.health-dot-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 5px 10px 5px 8px;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  transition: all 0.15s;
}
.health-dot-btn:hover { background: var(--surface-2); color: var(--text); }
.health-dot-btn .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-faint);
  transition: background 0.2s;
}
.health-dot-btn .dot.ok { background: var(--success); box-shadow: 0 0 6px rgba(52,211,153,0.6); }
.health-dot-btn .dot.err { background: var(--danger); box-shadow: 0 0 6px rgba(248,113,113,0.6); }

/* ── Mobile header/nav ─────────────────────────────────────────────
   Below this width the header (brand + primary-nav + header-links)
   no longer fits in one row. Primary nav becomes a fixed bottom tab
   bar (same nav-btn elements, same switchTab() JS — just repositioned
   and restyled, not duplicated) and header-links collapse behind the
   kebab button into a dropdown. ── */
@media (max-width: 760px) {
  header { gap: 8px; }

  .header-menu-btn { display: flex; align-items: center; justify-content: center; }

  .header-links {
    display: none;
    position: absolute;
    top: 54px;
    right: 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    background: var(--bg-2, var(--bg));
    border: 1px solid var(--border);
    border-radius: var(--radius, 12px);
    padding: 8px;
    box-shadow: 0 10px 40px -15px rgba(0, 0, 0, 0.6);
    z-index: 150;
    min-width: 200px;
  }
  .header-links.open { display: flex; }
  .header-links a,
  .header-links .health-dot-btn,
  .header-links .btn {
    width: 100%;
    justify-content: flex-start;
  }

  .primary-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    width: 100%;
    margin: 0;
    gap: 2px;
    border: none;
    border-top: 1px solid var(--border);
    border-radius: 0;
    background: rgba(17, 19, 24, 0.94);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 6px max(6px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
  }
  .primary-nav .nav-btn {
    flex: 1;
    flex-direction: column;
    gap: 2px;
    padding: 6px 4px;
    font-size: 10.5px;
    justify-content: center;
  }
  .primary-nav .nav-btn .ic { font-size: 18px; }

  .content { padding-bottom: 84px; }
}

/* ── Main layout (single-column — no sidebar in the workshop shell) ── */
.main-layout {
  display: flex;
  flex: 1;
  width: 100%;
}

/* ── Content ─────────────────────────────────────────────────────── */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px 60px;
  min-width: 0;
  max-width: 1180px;
  margin: 0 auto;
  width: 100%;
}

.tab-panel {
  display: none;
  animation: fadeUp 0.4s var(--ease);
}

.tab-panel.active {
  display: block;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Settings sub-navigation (pill tabs within the Settings view) ─── */
.settings-subnav {
  display: flex;
  gap: 6px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.settings-subnav .subnav-btn {
  padding: 10px 18px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-ui);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transform: translateY(1px);
  transition: all 0.15s var(--ease);
  display: flex;
  align-items: center;
  gap: 7px;
}

.settings-subnav .subnav-btn:hover { color: var(--text); }

.settings-subnav .subnav-btn.active {
  color: var(--accent-2);
  border-bottom-color: var(--accent);
}

.settings-subview { display: none; animation: fadeUp 0.3s var(--ease); }
.settings-subview.active { display: block; }

/* ── Cards ───────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  margin-bottom: 22px;
  overflow: hidden;
  box-shadow: 0 10px 40px -15px rgba(0, 0, 0, 0.4);
}

.card-head {
  background: linear-gradient(135deg, rgba(242, 153, 74, 0.10), rgba(79, 168, 224, 0.05));
  border-bottom: 1px solid var(--border);
  color: var(--text);
  padding: 15px 22px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-head);
  font-size: 14.5px;
  font-weight: 600;
}

.card-head .ic { font-size: 16px; }

.card-head .method {
  font-size: 10px;
  font-weight: 700;
  border-radius: 5px;
  padding: 3px 9px;
  letter-spacing: 0.5px;
  font-family: var(--font-mono);
}

.m-post {
  background: linear-gradient(135deg, var(--success), #10b981);
  color: #fff;
}

.m-get {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #17110a;
}

.card-body {
  padding: 22px;
}

/* ── Forms ───────────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
  align-items: stretch;
}

.form-grid.wide {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

/* Grid stretches every cell in a row to the tallest cell's height, but a
   two-line label (e.g. "Public Kiosk — Allow Paid Parts Vendor") otherwise
   pushes just its own input down further than a neighbor with a one-line
   label. Pinning each field's content to the bottom of its cell keeps every
   input/select in a row on the same baseline regardless of label length. */
.form-grid > div {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.optional-tag {
  text-transform: none;
  font-weight: 400;
  color: var(--text-faint);
  letter-spacing: 0;
  margin-left: 4px;
}

input[type=text],
input[type=number],
input[type=email],
input[type=password],
input[type=date],
select,
textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-ui);
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  color-scheme: dark;
  transition: all 0.15s;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-faint);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(242, 153, 74, 0.05);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea {
  resize: vertical;
  min-height: 72px;
}

/* File inputs default to the browser's own unstyled button ("Choose
   File") which clashes with every other themed button — restyle just
   the button part via ::file-selector-button, keeping the native
   picker/filename text behavior intact. */
input[type="file"] {
  color: var(--text-dim);
  font-size: 12.5px;
  font-family: var(--font-ui);
}
input[type="file"]::file-selector-button {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 12px;
  padding: 6px 13px;
  margin-right: 10px;
  cursor: pointer;
  transition: all 0.15s var(--ease);
}
input[type="file"]::file-selector-button:hover {
  border-color: var(--border-hi);
  color: var(--text);
  background: var(--surface-3);
}

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239a9aab' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 34px;
}

select option {
  background: #1a1a24;
  color: var(--text);
}

/* ── Drop zone ───────────────────────────────────────────────────── */
.drop-zone {
  border: 1.5px dashed var(--border-hi);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  position: relative;
  background: rgba(255, 255, 255, 0.015);
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--accent);
  background: rgba(242, 153, 74, 0.06);
}

.drop-zone input[type=file] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.drop-zone .dz-text {
  color: var(--text-dim);
  font-size: 12.5px;
  margin-top: 6px;
}

/* Low-resolution rejection — lives inside the dropzone itself, not a
   toast/panel elsewhere on the page, so it can't be missed or time out
   before the technician reads it. */
.dz-reject-msg {
  font-size: 12.5px;
  color: var(--warning);
  margin-top: 10px;
  padding: 9px 12px;
  background: rgba(251,191,36,0.1);
  border-radius: 8px;
  border: 1px solid rgba(251,191,36,0.3);
  text-align: left;
}

/* Parts & Materials — advisory note that AI evidence-photo crops can be
   imprecise, pointing at the existing "Replace Photo" flow. Same inline,
   can't-miss-it placement convention as .dz-reject-msg above, info tint
   (not warning) since this isn't flagging an error on this specific
   estimate — it's general guidance shown on every estimate. */
.parts-photo-note {
  font-size: 12.5px;
  color: var(--text-dim);
  margin-bottom: 10px;
  padding: 9px 12px;
  background: rgba(79, 168, 224, 0.08);
  border-radius: 8px;
  border: 1px solid rgba(79, 168, 224, 0.25);
  text-align: left;
  line-height: 1.5;
}

.parts-photo-note strong {
  color: var(--info-2);
}

.preview-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.preview-item {
  position: relative;
  width: 94px;
}

.preview-item img {
  width: 94px;
  height: 72px;
  object-fit: cover;
  border-radius: 9px;
  border: 1px solid var(--border);
  display: block;
  background: #000;
}

.preview-item select {
  width: 100%;
  font-size: 10px;
  padding: 3px 5px;
  margin-top: 4px;
  border-radius: 6px;
}

.remove-img {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  border: 2px solid var(--bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
}

.remove-img:hover {
  transform: scale(1.1);
}

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-ui);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s var(--ease);
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 6px 20px -6px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 10px 26px -6px var(--accent-glow);
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 6px 20px -6px var(--accent-glow);
}

.btn-success {
  background: linear-gradient(135deg, var(--success), #10b981);
  color: #fff;
  box-shadow: 0 6px 20px -6px rgba(52, 211, 153, 0.4);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #ef4444);
  color: #fff;
  box-shadow: 0 6px 20px -6px rgba(248, 113, 113, 0.4);
}

.btn-ghost {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
}

.btn-ghost:hover:not(:disabled) {
  border-color: var(--border-hi);
  color: var(--text);
  background: var(--surface-3);
}

.btn-sm {
  padding: 6px 13px;
  font-size: 12px;
}

.btn-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

/* ── Result stats ────────────────────────────────────────────────── */
.result-summary,
.cost-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-align: center;
  transition: border-color 0.15s;
}

.stat-box:hover {
  border-color: var(--border-hi);
}

.stat-box .val {
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  display: block;
}

.stat-box .lbl {
  font-size: 10px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

.severity-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sev-none {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
}

.sev-minor {
  background: rgba(52, 211, 153, 0.12);
  color: var(--success);
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.sev-moderate {
  background: rgba(251, 191, 36, 0.12);
  color: var(--warning);
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.sev-severe {
  background: rgba(248, 113, 113, 0.12);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.sev-total_loss {
  background: var(--danger);
  color: #fff;
}

/* ── Parts table ─────────────────────────────────────────────────── */
.parts-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
}

table.parts-tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.parts-tbl th {
  background: var(--surface-3);
  color: var(--text-dim);
  padding: 10px 12px;
  text-align: left;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}

.parts-tbl td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.parts-tbl tr:last-child td {
  border-bottom: none;
}

.parts-tbl tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.parts-tbl .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.chip-repair {
  background: rgba(79, 168, 224, 0.12);
  color: var(--accent-2);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 100px;
}

.chip-replace {
  background: rgba(248, 113, 113, 0.12);
  color: var(--danger);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 100px;
}

.chip-no_work {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 100px;
}

.chip-inspect {
  background: rgba(251, 191, 36, 0.14);
  color: var(--warning);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 100px;
}

.chip-rate-override {
  background: rgba(242, 153, 74, 0.16);
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 100px;
  white-space: nowrap;
}

.chip-rate-default {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 100px;
  white-space: nowrap;
}

.chip-manual-op {
  background: rgba(167, 139, 250, 0.14);
  color: #a78bfa;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 100px;
  text-transform: capitalize;
}

/* ── Cost tables ─────────────────────────────────────────────────── */
.cost-line-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
  margin-bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.cost-line-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
}

.cost-line-table tr:last-child td {
  border-bottom: none;
}

.cost-line-table thead th {
  background: var(--surface-3);
  color: var(--text-dim);
  padding: 10px 14px;
  font-size: 10.5px;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}

.cost-line-table thead th.num {
  text-align: right;
}

.cost-line-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.cost-line-table .subtotal td {
  background: rgba(242, 153, 74, 0.06);
  font-weight: 600;
  color: var(--text);
}

.cost-line-table .grand-total td {
  background: linear-gradient(135deg, rgba(242, 153, 74, 0.18), rgba(79, 168, 224, 0.1));
  color: var(--text);
  font-weight: 700;
  font-size: 14px;
  font-family: var(--font-head);
}

.tl-banner {
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 12.5px;
  margin-bottom: 14px;
  display: flex;
  gap: 10px;
  color: var(--text);
}

.tl-banner .icon {
  font-size: 18px;
  flex-shrink: 0;
}

.tl-banner strong {
  color: var(--danger);
}

/* ── Rate table ──────────────────────────────────────────────────── */
.rate-search-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  align-items: flex-end;
}

/* Fix for Estimate Browser search bar - give input reasonable width */
#br-search {
  flex: 0 1 380px;
  min-width: 250px;
}

#br-state {
  flex: 0 1 200px;
  min-width: 150px;
}

/* #br-vin/#br-claim previously fell through to the generic
   ".rate-search-bar input { flex: 1 }" rule below with no min-width, and
   the bar had no flex-wrap — on a typical viewport the two fixed-width
   fields above already claim most of the row, so these two got squeezed
   down to near their content minimum and rendered more like buttons than
   text inputs. flex-wrap above lets the bar drop to a second line instead
   of crushing them once space runs out. */
#br-vin,
#br-claim {
  flex: 0 1 200px;
  min-width: 160px;
}

.rate-search-bar input {
  flex: 1;
}

#rate-table-wrap {
  overflow-x: auto;
  max-height: 560px;
  overflow-y: auto;
  border-radius: var(--radius);
}

/* Estimate Browser and Users tables are the same wide .rate-tbl pattern
   (white-space: nowrap cells) but weren't given a scrolling wrapper, so
   trailing columns — notably the row action button — were clipped off the
   right edge of the card with no way to reach them. */
#br-results-wrap,
#users-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
}

table.rate-tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
  white-space: nowrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.rate-tbl th {
  background: var(--surface-3);
  color: var(--text-dim);
  padding: 10px 14px;
  text-align: left;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 1px solid var(--border);
}

.rate-tbl th.num,
.rate-tbl td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.rate-tbl td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

/* Row action column (Open/Delete, Reset PW/Disable/Delete, etc.) pinned to
   the right edge of the scroll container — overflow-x:auto alone leaves the
   actions reachable only by scrolling, with zero visual hint that there's
   more to the right, so in practice they read as "missing" rather than
   "off-screen". Sticky keeps them on screen regardless of scroll position. */
.rate-tbl td.sticky-actions {
  position: sticky;
  right: 0;
  background: var(--surface);
  box-shadow: -8px 0 12px -8px rgba(0, 0, 0, 0.4);
}
.rate-tbl tbody tr:hover td.sticky-actions {
  background: var(--surface-2);
}
.rate-tbl th.sticky-actions {
  position: sticky;
  right: 0;
  z-index: 3; /* above both the plain sticky header (z-index 2) and sticky body cells */
}

.rate-tbl tr:last-child td {
  border-bottom: none;
}

.rate-tbl tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.edit-row-btn {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 7px;
  border: 1px solid var(--border-hi);
  background: var(--surface-2);
  color: var(--text-dim);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.15s;
}

.edit-row-btn:hover {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border-color: transparent;
}

/* ── Health ──────────────────────────────────────────────────────── */
.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}

.health-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: border-color 0.15s;
}

.health-card:hover {
  border-color: var(--border-hi);
}

.health-card .hk {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.health-card .hv {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 600;
  margin-top: 6px;
}

.hv.ok {
  color: var(--success);
}

.hv.warn {
  color: var(--warning);
}

.hv.err {
  color: var(--danger);
}

/* ── Toast ───────────────────────────────────────────────────────── */
#toast-wrap {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: rgba(15, 15, 23, 0.9);
  backdrop-filter: blur(20px);
  color: var(--text);
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 12.5px;
  max-width: 340px;
  box-shadow: 0 12px 40px -8px rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  animation: tIn 0.25s var(--ease);
  pointer-events: auto;
}

.toast.ok {
  border-left-color: var(--success);
}

.toast.err {
  border-left-color: var(--danger);
}

.toast.wrn {
  border-left-color: var(--warning);
}

@keyframes tIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ── Misc ────────────────────────────────────────────────────────── */
.section-title {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 20px 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.id-pill {
  display: inline-block;
  background: rgba(242, 153, 74, 0.12);
  color: var(--accent-2);
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 3px 10px;
  border-radius: 100px;
  cursor: pointer;
  user-select: all;
  border: 1px solid rgba(242, 153, 74, 0.25);
}

.id-pill:hover {
  background: rgba(242, 153, 74, 0.2);
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ── Mode toggle (Photo Analysis / Fault Codes Only) ─────────────── */
.mode-toggle {
  display: flex;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 4px;
  margin-bottom: 20px;
  max-width: 460px;
}

.mode-btn {
  flex: 1;
  padding: 10px 16px;
  border: none;
  background: transparent;
  border-radius: 100px;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-ui);
  cursor: pointer;
  transition: all 0.15s var(--ease);
}

.mode-btn:hover { color: var(--text); }

.mode-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #17110a;
  box-shadow: 0 2px 12px var(--accent-glow);
}

/* ── Quick-open-by-ID box (Search view) ──────────────────────────── */
.quick-open-box {
  display: flex;
  gap: 10px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 22px;
  align-items: flex-end;
}

.quick-open-box .field { flex: 1; }
.quick-open-box label { margin-bottom: 6px; }

/* ── Collapsible damage report (Workbench results) ───────────────── */
.collapsible {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 20px;
  overflow: hidden;
}

.collapsible-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 14px;
}

.collapsible-head .chev {
  margin-left: auto;
  transition: transform 0.2s var(--ease);
  color: var(--text-faint);
  font-size: 12px;
}

/* Direct-child combinators (not descendant) — a .collapsible can nest
   another .collapsible (e.g. "Parts Sourcing" inside "Vehicle Photos"),
   and these must only react to their OWN .open, not an ancestor's. */
.collapsible.open > .collapsible-head .chev { transform: rotate(180deg); }

.collapsible-body {
  display: none;
  padding: 4px 18px 18px;
  border-top: 1px solid var(--border);
}

.collapsible.open > .collapsible-body { display: block; }

/* ── Empty state ──────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-faint);
}

.empty-state .es-icon { font-size: 34px; margin-bottom: 10px; opacity: 0.7; }
.empty-state .es-title { font-size: 14px; font-weight: 600; color: var(--text-dim); margin-bottom: 4px; }
.empty-state .es-sub { font-size: 12.5px; }

/* ── Progress track (pipeline SSE) ───────────────────────────────── */
.progress-track {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px;
}

.progress-step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 8px;
  position: relative;
  border-radius: var(--radius);
  transition: background 0.2s;
}

.progress-step:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 23px;
  top: 44px;
  bottom: -4px;
  width: 2px;
  background: var(--border);
}

.progress-step.done::after {
  background: linear-gradient(to bottom, var(--success), rgba(52, 211, 153, 0.3));
}

.progress-step.active::after {
  background: linear-gradient(to bottom, var(--accent), rgba(242, 153, 74, 0.3));
}

.step-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  z-index: 1;
  transition: all 0.25s var(--ease);
}

.progress-step.done .step-icon {
  background: linear-gradient(135deg, var(--success), #10b981);
  border-color: transparent;
  color: #fff;
}

.progress-step.active .step-icon {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #fff;
  animation: pulse 1.4s ease infinite;
}

.progress-step.error .step-icon {
  background: linear-gradient(135deg, var(--danger), #ef4444);
  border-color: transparent;
  color: #fff;
}

@keyframes pulse {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(242, 153, 74, 0.5);
  }

  50% {
    box-shadow: 0 0 0 8px rgba(242, 153, 74, 0);
  }
}

.step-body {
  flex: 1;
  padding-top: 5px;
  min-width: 0;
}

.step-label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.step-sub {
  font-size: 11.5px;
  color: var(--text-dim);
  margin-top: 3px;
}

.step-elapsed {
  font-size: 10px;
  color: var(--text-faint);
  font-family: var(--font-mono);
  float: right;
}

.progress-step.done .step-label {
  color: var(--success);
}

.progress-step.active .step-label {
  color: var(--accent-2);
}

.progress-step.error .step-label {
  color: var(--danger);
}

/* ── Persistent error panel ──────────────────────────────────────── */
.error-panel {
  background: rgba(248, 113, 113, 0.06);
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}

.error-panel-head {
  background: linear-gradient(135deg, rgba(248, 113, 113, 0.2), rgba(239, 68, 68, 0.12));
  color: var(--text);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
}

.error-panel-head span:first-child {
  color: var(--danger);
}

.error-dismiss {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.error-dismiss:hover {
  background: rgba(255, 255, 255, 0.15);
}

.error-panel-msg {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  word-break: break-word;
}

.error-panel-detail {
  margin: 0 14px 14px;
  padding: 12px 14px;
  background: #0a0a12;
  color: var(--danger);
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.55;
  border-radius: 8px;
  border: 1px solid var(--border);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 320px;
  overflow-y: auto;
  user-select: all;
}

/* ── Editable estimate UI ────────────────────────────────────────── */
.muted-sm {
  font-size: 11px;
  color: var(--text-faint);
}

.num-strong {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.edited-banner {
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 12.5px;
  color: var(--text);
  margin-bottom: 14px;
}

.edited-note {
  margin-top: 4px;
  font-style: italic;
  font-size: 11.5px;
  color: var(--warning);
}

/* Labor hours edit rows */
.labor-edit-wrap {
  margin-bottom: 10px;
}

.labor-edit-row {
  display: grid;
  grid-template-columns: 140px 1fr 130px 110px;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.labor-edit-row.subtotal-row {
  border-bottom: none;
  border-top: 1.5px solid var(--border-hi);
  font-weight: 700;
  padding-top: 12px;
  margin-top: 6px;
}

.labor-edit-type {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.labor-edit-hours {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hr-step {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: all 0.15s;
}

.hr-step:hover {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border-color: transparent;
}

.hr-input {
  width: 68px;
  text-align: center;
  padding: 6px 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  background: var(--surface);
  color: var(--text);
}

.hr-unit {
  font-size: 11px;
  color: var(--text-faint);
}

.labor-edit-rate {
  font-size: 12px;
  color: var(--text-dim);
  text-align: right;
}

.labor-edit-subtotal {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-2);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ADAS read-only rows */
.adas-edit-wrap {
  margin-bottom: 10px;
}

.adas-edit-row {
  display: grid;
  grid-template-columns: 1fr 220px 110px 36px;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}

.adas-edit-row.subtotal-row {
  border-bottom: none;
  border-top: 1.5px solid var(--border-hi);
  font-weight: 700;
  padding-top: 10px;
}

.adas-name-input,
.adas-location-input {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12.5px;
  background: var(--surface);
  color: var(--text);
}

.adas-name-input {
  font-weight: 700;
  width: 45%;
}

.adas-location-input {
  width: 45%;
  color: var(--text-dim);
}

/* Parts edit list — card-based */
.parts-edit-wrap,
.manual-lines-edit-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 6px;
}

.part-card {
  display: grid;
  grid-template-columns: 1fr 110px 110px 100px;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  transition: all 0.15s;
}

.part-card:hover {
  border-color: var(--border-hi);
  background: var(--surface-2);
}

.part-card.editing {
  display: block;
  background: rgba(242, 153, 74, 0.06);
  border-color: var(--accent);
}

.part-card-main {
  min-width: 0;
}

.part-card-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.part-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.part-card-total {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-2);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.part-card-source {
  text-align: center;
}

.part-card-thumb {
  width: 52px;
  height: 42px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface-2);
}

.photo-upload-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.photo-upload-row input[type="file"] {
  font-size: 11.5px;
  max-width: 180px;
}

.photo-thumb-preview {
  width: 44px;
  height: 36px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.intake-photo-thumb {
  position: relative;
  display: inline-block;
}

.intake-photo-thumb img {
  width: 84px;
  height: 64px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.intake-photo-thumb .icon-btn {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--surface);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 10px;
  line-height: 1;
  padding: 0;
}

.part-card-actions {
  display: flex;
  gap: 5px;
  justify-content: flex-end;
}

.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  transition: all 0.15s;
}

.icon-btn:hover {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border-color: transparent;
}

.icon-btn.danger:hover {
  background: linear-gradient(135deg, var(--danger), #ef4444);
}

.ebay-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--accent-2);
  text-decoration: none;
  padding: 4px 10px;
  border: 1px solid rgba(242, 153, 74, 0.3);
  border-radius: 100px;
  white-space: nowrap;
  background: rgba(242, 153, 74, 0.08);
  transition: all 0.15s;
}

.ebay-link-btn:hover {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border-color: transparent;
}

/* Part card — editing mode */
.part-card-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.pce-field label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.pce-field input,
.pce-field select {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12.5px;
  background: var(--surface);
  color: var(--text);
}

.part-card-actions {
  margin-top: 8px;
}

.chip-sourcing {
  background: rgba(167, 139, 250, 0.14);
  color: #a78bfa;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 100px;
}

.part-search-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.part-search-row select {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12.5px;
  background: var(--surface);
  color: var(--text);
}

.part-search-row select option:disabled {
  color: var(--text-faint);
}

.parts-edit-subtotal-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 14px;
  margin-top: 6px;
  background: rgba(242, 153, 74, 0.06);
  border: 1px solid rgba(242, 153, 74, 0.2);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

/* Sticky save/discard bar */
.save-changes-bar {
  position: fixed;
  bottom: 0;
  left: 230px;
  right: 0;
  background: rgba(15, 15, 23, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  color: var(--text);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 -10px 40px -10px rgba(0, 0, 0, 0.6);
  z-index: 500;
}

.save-changes-msg {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.save-note-input {
  flex: 1;
  padding: 9px 14px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 12.5px;
}

.save-note-input::placeholder {
  color: var(--text-faint);
}

.save-note-input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(242, 153, 74, 0.05);
}

@media (max-width: 900px) {
  .save-changes-bar {
    left: 0;
    flex-wrap: wrap;
  }

  .part-card {
    grid-template-columns: 1fr;
  }

  .part-card-total,
  .part-card-source,
  .part-card-actions {
    text-align: left;
    justify-content: flex-start;
  }
}

/* ── OBD / Fault Code UI ─────────────────────────────────────────── */
.obd-chip-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  min-height: 44px;
  margin-bottom: 10px;
  cursor: text;
  transition: border-color 0.15s;
}

.obd-chip-wrap:focus-within {
  border-color: var(--accent);
  background: rgba(242, 153, 74, 0.04);
}

.obd-chip-wrap.obd-required {
  border-color: rgba(242, 153, 74, 0.4);
}

.obd-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.obd-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border-radius: 6px;
  padding: 3px 9px;
  font-size: 12px;
  font-family: var(--font-mono);
  font-weight: 700;
}

.obd-chip.confirmed {
  background: linear-gradient(135deg, var(--success), #22c55e);
}

.obd-chip-confirm-toggle {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  line-height: 1;
}

.obd-chip-confirm-toggle:hover {
  color: #fff;
}

.obd-chip.confirmed .obd-chip-confirm-toggle {
  color: #fff;
}

.obd-chip-remove {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  font-size: 13px;
  padding: 0;
  line-height: 1;
}

.obd-chip-remove:hover {
  color: #fff;
}

.obd-chip-input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 13px;
  min-width: 180px;
  flex: 1;
  font-family: var(--font-ui);
  color: var(--text);
}

.obd-chip-input::placeholder {
  color: var(--text-faint);
}

.obd-code-browser {
  margin-bottom: 14px;
}

.obd-chip-hint {
  font-size: 11px;
  color: var(--text-faint);
  margin: -4px 0 10px;
}

/* Vision cross-reference verdicts shown on the Analyze tab */
.obd-assessment-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.obd-assessment-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12.5px;
}

.obd-assessment-row.confirmed {
  border-left: 3px solid var(--success);
}

.obd-assessment-row.pending {
  border-left: 3px solid var(--warning);
}

.obd-assessment-code {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text);
  min-width: 70px;
}

.obd-assessment-body {
  flex: 1;
}

.obd-assessment-reasoning {
  color: var(--text-dim);
  margin-top: 2px;
}

.code-browser-grid {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 4px;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 8px;
}

.code-suggestion {
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12.5px;
  transition: all 0.12s;
  color: var(--text-dim);
}

.code-suggestion:hover {
  background: rgba(242, 153, 74, 0.1);
  color: var(--text);
}

.code-suggestion strong {
  font-family: var(--font-mono);
  color: var(--accent-2);
}

/* OBD fault line cards */
.obd-fault-edit-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.obd-fault-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.obd-fault-row.obd-fault-pending {
  border-left-color: var(--warning);
}

.obd-fault-row.obd-fault-confirmed {
  border-left-color: var(--success);
}

.obd-fault-note {
  font-size: 11.5px;
  font-style: italic;
  margin: -2px 0 10px;
  padding: 6px 10px;
  border-radius: 6px;
}

.obd-fault-note.pending {
  color: var(--warning);
  background: rgba(251, 191, 36, 0.08);
}

.obd-fault-note.confirmed {
  color: var(--success);
  background: rgba(52, 211, 153, 0.08);
}

.obd-fault-actions {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.obd-fault-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.obd-fault-code {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  padding: 3px 10px;
  border-radius: 7px;
}

.obd-fault-system {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  background: var(--surface-3);
  padding: 3px 9px;
  border-radius: 100px;
}

.obd-fault-confidence {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 100px;
  margin-left: auto;
}

.obd-conf-high {
  background: rgba(52, 211, 153, 0.15);
  color: var(--success);
}

.obd-conf-medium {
  background: rgba(251, 191, 36, 0.15);
  color: var(--warning);
}

.obd-conf-low {
  background: rgba(248, 113, 113, 0.15);
  color: var(--danger);
}

.obd-conf-pending_inspection {
  background: rgba(251, 191, 36, 0.15);
  color: var(--warning);
}

.obd-conf-manual {
  background: rgba(79, 168, 224, 0.15);
  color: var(--accent-2);
}

.obd-fault-desc {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text);
}

.obd-fault-op {
  font-size: 11.5px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.obd-fault-fields {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

.obd-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.obd-field label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.obd-field-val {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.obd-field-total {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-2);
  min-width: 85px;
}

/* Inline OBD section inside main estimate view */
.obd-inline-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.obd-inline-row {
  display: grid;
  grid-template-columns: 160px 1fr 110px;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12.5px;
}

.obd-inline-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.obd-inline-total {
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-head);
  color: var(--accent-2);
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .sidebar {
    width: 200px;
  }

  .save-changes-bar {
    left: 200px;
  }
}

@media (max-width: 900px) {
  .sidebar {
    display: none;
  }

  .save-changes-bar {
    left: 0;
  }

  .content {
    padding: 20px;
  }
}

/* Drop zone visual feedback when images are uploaded */
.dropzone.has-images {
  padding: 18px;
  text-align: left;
  cursor: default;
  background: var(--surface);
  /* Use the theme's surface color */
  border-style: solid;
  border-color: var(--border-hi);
}

.drop-zone.has-images:hover {
  border-color: var(--accent);
  background: var(--surface);
}

/* ── Login overlay ─────────────────────────────────────────────────
   Stays fully opaque so the app-shell underneath (always in the DOM,
   never itself hidden pre-auth) doesn't leak through — but nests its
   own copy of the ambient glow/grid treatment (same classes the main
   shell and Public kiosk hero use) so it isn't a flat, bare screen. ── */
#login-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  padding: 20px;
  background: var(--bg);
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.login-brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: 0 8px 28px var(--accent-glow);
}

.login-brand-name {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: var(--text);
}
.login-brand-name strong { color: var(--accent-2); font-weight: 700; }

.login-card {
  width: min(380px, 100%);
}

.login-error {
  margin-top: 10px;
  font-size: 13px;
  color: var(--danger);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  padding: 20px;
}

/* ── Replace-photo modals (source picker + crop editor) ─────────────── */
.photo-source-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.photo-source-btn {
  width: 100%;
  text-align: left;
  justify-content: flex-start;
}

.original-photo-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.original-photo-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 92px;
  padding: 6px;
  background: var(--surface-2, rgba(255, 255, 255, 0.06));
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}

.original-photo-option:hover {
  border-color: var(--accent);
}

.original-photo-option.current {
  border-color: var(--accent);
  background: rgba(242, 153, 74, 0.12);
}

.original-photo-option img {
  width: 64px;
  height: 48px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--surface-2);
}

.original-photo-option span {
  font-size: 10px;
  text-align: center;
}

/* Was reusing .login-card (width: min(380px, 100%)) — its own inline
   max-width:640px override was a no-op (max-width only clamps a width
   down, never expands it past a smaller `width`), so the crop image
   rendered far smaller than the source photo regardless of resolution —
   a real problem when cropping a small part like a door handle. This
   dedicated class gives the crop editor real room to work with. */
.photo-crop-card {
  width: min(920px, 94vw);
}

.photo-crop-canvas-wrap {
  position: relative;
  width: 100%;
  max-height: 75vh;
  overflow: hidden;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2, #000);
  touch-action: none;
  cursor: crosshair;
}

#photo-crop-img {
  display: block;
  width: 100%;
  max-height: 75vh;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.photo-crop-selection {
  position: absolute;
  border: 2px dashed var(--accent);
  background: rgba(242, 153, 74, 0.2);
  pointer-events: none;
}