:root {
  color-scheme: dark;
  --bg: #080b0d;
  --panel: #11171b;
  --panel-2: #151d22;
  --panel-3: #0d1215;
  --line: rgba(165, 183, 189, 0.16);
  --line-strong: rgba(165, 183, 189, 0.28);
  --text: #eff5f3;
  --muted: #97a7aa;
  --muted-2: #6f8185;
  --accent: #d7aa4a;
  --accent-strong: #f1c86a;
  --accent-soft: rgba(215, 170, 74, 0.12);
  --green: #6bbf91;
  --green-soft: rgba(107, 191, 145, 0.13);
  --red: #e98579;
  --red-soft: rgba(233, 133, 121, 0.12);
  --shadow: 0 20px 55px rgba(0, 0, 0, 0.26);
  --radius: 18px;
  --radius-sm: 11px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 80% -15%, rgba(215, 170, 74, 0.12), transparent 31rem),
    radial-gradient(circle at -10% 20%, rgba(57, 118, 105, 0.11), transparent 30rem),
    var(--bg);
  color: var(--text);
}

button, input, select, textarea { font: inherit; }

button { cursor: pointer; }

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 17px clamp(16px, 4vw, 54px);
  background: rgba(8, 11, 13, 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand-lockup, .topbar-actions, .section-heading, .card-title-row, .backup-card, .compact-heading {
  display: flex;
  align-items: center;
}

.brand-lockup { gap: 12px; }

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(215, 170, 74, 0.7);
  border-radius: 12px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  background: linear-gradient(145deg, rgba(215, 170, 74, 0.2), rgba(215, 170, 74, 0.04));
}

.brand-name { font-size: 13px; font-weight: 750; letter-spacing: 0.04em; }
.brand-subtitle { margin-top: 2px; color: var(--muted); font-size: 11px; }

.topbar-actions { gap: 10px; }
.save-indicator { color: var(--green); font-size: 11px; white-space: nowrap; }

.page {
  width: min(1500px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 46px;
}

.hero-panel {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 36px;
  min-height: 240px;
  padding: clamp(25px, 5vw, 58px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 28px;
  background:
    linear-gradient(125deg, rgba(24, 35, 39, 0.92), rgba(13, 18, 21, 0.95)),
    radial-gradient(circle at 80% 0%, rgba(215, 170, 74, 0.2), transparent 24rem);
  box-shadow: var(--shadow);
}

.hero-panel::after {
  content: "";
  position: absolute;
  width: 270px;
  height: 270px;
  margin: -130px 0 0 -80px;
  border: 1px solid rgba(215, 170, 74, 0.18);
  border-radius: 50%;
  box-shadow: 0 0 0 28px rgba(215, 170, 74, 0.04), 0 0 0 56px rgba(215, 170, 74, 0.03);
  pointer-events: none;
}

.hero-copy { max-width: 720px; position: relative; z-index: 1; }
.eyebrow { margin: 0 0 9px; color: var(--accent-strong); font-size: 10px; font-weight: 800; letter-spacing: 0.19em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 14px; font-size: clamp(36px, 5vw, 68px); line-height: 0.98; letter-spacing: -0.05em; }
h2 { margin-bottom: 0; font-size: clamp(21px, 2.3vw, 31px); letter-spacing: -0.035em; }
h3 { margin-bottom: 6px; font-size: 16px; }
.hero-description { max-width: 640px; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.65; }

.hero-total {
  position: relative;
  z-index: 1;
  min-width: 230px;
  padding: 22px;
  border: 1px solid rgba(215, 170, 74, 0.28);
  border-radius: 18px;
  background: rgba(215, 170, 74, 0.07);
  text-align: right;
}

.hero-total strong { display: block; margin: 6px 0 4px; color: var(--accent-strong); font-size: clamp(28px, 4vw, 44px); letter-spacing: -0.05em; }
.metric-label, .metric-note { display: block; color: var(--muted); font-size: 11px; letter-spacing: 0.03em; }
.metric-note { color: var(--muted-2); font-size: 10px; }

.panel-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(150deg, rgba(19, 27, 31, 0.98), rgba(13, 18, 21, 0.98));
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.12);
}

.job-strip { margin-top: 18px; padding: 23px; }
.section-heading { justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.compact-heading { margin-bottom: 16px; }
.section-actions { display: flex; flex-wrap: wrap; gap: 9px; }

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(107, 191, 145, 0.26);
  border-radius: 999px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.form-grid { display: grid; gap: 14px; }
.job-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.calculator-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field span, .select-field span { color: var(--muted); font-size: 11px; font-weight: 650; }
.field-wide { grid-column: span 2; }
.field-full { margin-top: 14px; }

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: none;
  color: var(--text);
  background: rgba(6, 9, 11, 0.58);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

input, select { height: 42px; padding: 0 12px; }
textarea { min-height: 66px; padding: 11px 12px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #5f7074; }
input:focus, select:focus, textarea:focus { border-color: rgba(215, 170, 74, .75); box-shadow: 0 0 0 3px rgba(215, 170, 74, .11); background: rgba(6, 9, 11, .8); }

.tabs {
  display: flex;
  gap: 7px;
  margin: 24px 0 18px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(16, 22, 25, 0.8);
}

.tab-button {
  flex: 0 1 auto;
  min-height: 40px;
  padding: 0 17px;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 750;
}

.tab-button:hover { color: var(--text); }
.tab-button.active { color: var(--text); background: var(--accent-soft); box-shadow: inset 0 0 0 1px rgba(215, 170, 74, .21); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fade-in .22s ease both; }
@keyframes fade-in { from { opacity: .25; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.rule-callout, .privacy-note {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-bottom: 17px;
  padding: 13px 15px;
  border: 1px solid rgba(215, 170, 74, .25);
  border-radius: 12px;
  color: #cfc7ae;
  background: rgba(215, 170, 74, .07);
  font-size: 12px;
  line-height: 1.55;
}

.rule-icon {
  display: grid;
  flex: 0 0 auto;
  width: 21px;
  height: 21px;
  place-items: center;
  border-radius: 50%;
  color: #241d0e;
  background: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; margin-bottom: 17px; }
.summary-card { padding: 19px; border: 1px solid var(--line); border-radius: 14px; background: rgba(13, 18, 21, .72); }
.summary-card strong { display: block; margin: 5px 0 3px; color: var(--text); font-size: 27px; letter-spacing: -0.045em; }
.highlight-card { border-color: rgba(215, 170, 74, .27); background: linear-gradient(145deg, rgba(215, 170, 74, .11), rgba(13, 18, 21, .74)); }
.highlight-card strong { color: var(--accent-strong); }

.toolbar { display: grid; grid-template-columns: minmax(220px, 1fr) 220px auto; align-items: center; gap: 10px; margin-bottom: 12px; padding: 12px; }
.search-field { position: relative; }
.search-field input { padding-left: 38px; }
.search-icon { position: absolute; top: 9px; left: 13px; color: var(--accent); font-size: 22px; line-height: 1; transform: rotate(-20deg); pointer-events: none; }
.select-field select { color: var(--text); }
.toggle-field { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 12px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.toggle-field input { width: 17px; height: 17px; accent-color: var(--accent); }

.table-card { overflow: hidden; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid rgba(165, 183, 189, .1); }
th { padding: 13px 12px; color: var(--muted-2); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-align: left; text-transform: uppercase; white-space: nowrap; background: rgba(7, 10, 12, .54); }
td { padding: 11px 12px; color: #dfe8e6; font-size: 12px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(215, 170, 74, .035); }
.inventory-table { min-width: 1070px; }
.inventory-table .col-item { width: 58px; }
.inventory-table .col-description { min-width: 235px; }
.inventory-table .col-category { min-width: 130px; }
.inventory-table .col-cost, .inventory-table .col-applied, .inventory-table .col-total { text-align: right; }
.inventory-table .col-qty { min-width: 105px; text-align: right; }
.inventory-table .col-notes { min-width: 180px; }
.item-number { color: var(--accent-strong); font-weight: 800; }
.item-description { font-weight: 680; }
.category-tag { display: inline-flex; padding: 4px 7px; border-radius: 6px; color: #b8c9c6; background: rgba(107, 191, 145, .09); font-size: 10px; white-space: nowrap; }
.money { color: #dce7e3; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.applied-qty { color: var(--green); font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.extended-cost { color: var(--accent-strong); font-weight: 780; text-align: right; white-space: nowrap; }
.qty-input { width: 95px; height: 34px; padding: 0 9px; text-align: right; font-size: 12px; }
.note-input { min-width: 160px; height: 34px; padding: 0 9px; font-size: 11px; }
.empty-state { padding: 42px 20px; color: var(--muted); font-size: 13px; text-align: center; }
.source-note { margin: 12px 2px 0; color: var(--muted-2); font-size: 11px; line-height: 1.5; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 39px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .02em;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.button:hover { transform: translateY(-1px); }
.button-primary { color: #231b0a; background: var(--accent); }
.button-primary:hover { background: var(--accent-strong); }
.button-secondary { border-color: var(--line-strong); color: var(--text); background: rgba(255,255,255,.035); }
.button-secondary:hover, .button-ghost:hover { border-color: rgba(215,170,74,.45); background: var(--accent-soft); }
.button-ghost { min-height: 35px; border-color: var(--line); color: var(--muted); background: transparent; }
.button-danger { border-color: rgba(233,133,121,.35); color: var(--red); background: var(--red-soft); }
.button-small { min-height: 33px; padding: 0 10px; font-size: 10px; }

.calculator-layout { display: grid; grid-template-columns: minmax(350px, .85fr) minmax(0, 1.15fr); gap: 16px; align-items: start; }
.calculator-inputs { padding: 22px; }
.card-title-row { justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.card-title-row p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.calculator-grid .field input { border-color: rgba(107, 191, 145, .31); background: rgba(8, 18, 16, .42); }
.calculator-grid .field input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(107, 191, 145, .11); }
.input-suffix { position: relative; }
.input-suffix input { padding-right: 32px; }
.input-suffix em { position: absolute; top: 13px; right: 11px; color: var(--muted-2); font-size: 11px; font-style: normal; pointer-events: none; }

.scenario-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.scenario-card { padding: 19px; border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(145deg, rgba(19, 28, 31, .99), rgba(12, 17, 19, .98)); }
.scenario-card.base { border-color: rgba(215,170,74,.48); box-shadow: 0 12px 35px rgba(215,170,74,.08); }
.scenario-label { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.scenario-card.base .scenario-label { color: var(--accent-strong); }
.scenario-rate { color: var(--muted-2); font-size: 10px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.bid-number { display: block; margin-bottom: 17px; color: var(--accent-strong); font-size: clamp(27px, 3vw, 39px); font-weight: 820; letter-spacing: -.06em; }
.scenario-card.base .bid-number { text-shadow: 0 0 25px rgba(215,170,74,.18); }
.stat-line { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid rgba(165,183,189,.1); color: var(--muted); font-size: 11px; }
.stat-line strong { color: var(--text); font-variant-numeric: tabular-nums; text-align: right; }
.stat-line strong.green { color: var(--green); }
.optimization-card { margin-top: 16px; padding: 22px; }
.optimization-callout { min-width: 117px; padding: 10px 13px; border: 1px solid rgba(107,191,145,.26); border-radius: 11px; background: var(--green-soft); text-align: right; }
.optimization-callout span { display: block; color: var(--muted); font-size: 9px; }
.optimization-callout strong { display: block; margin-top: 3px; color: var(--green); font-size: 22px; }
.optimization-table th, .optimization-table td { text-align: right; }
.optimization-table th:first-child, .optimization-table td:first-child { text-align: left; }
.optimization-table td { font-variant-numeric: tabular-nums; }
.optimization-table tr.recommended { background: rgba(107,191,145,.08); }
.optimization-table tr.recommended td:first-child { color: var(--green); font-weight: 800; }

.help-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.help-card { position: relative; min-height: 190px; padding: 23px; overflow: hidden; }
.help-card::after { content: ""; position: absolute; right: -35px; bottom: -45px; width: 130px; height: 130px; border: 1px solid rgba(215,170,74,.13); border-radius: 50%; }
.help-number { display: block; margin-bottom: 28px; color: var(--accent); font-size: 11px; font-weight: 850; letter-spacing: .15em; }
.help-card p, .backup-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.backup-card { justify-content: space-between; gap: 24px; margin-top: 14px; padding: 22px; }
.backup-actions { display: flex; flex-wrap: wrap; justify-content: end; gap: 9px; }
.privacy-note { margin: 14px 0 0; border-color: rgba(107,191,145,.22); color: #aac8b9; background: var(--green-soft); }
code { padding: 2px 5px; border-radius: 5px; color: var(--accent-strong); background: rgba(215,170,74,.1); font-size: .95em; }
.footer { display: flex; justify-content: space-between; gap: 12px; padding: 20px clamp(16px, 4vw, 54px) 34px; color: var(--muted-2); font-size: 10px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 1050px) {
  .calculator-layout { grid-template-columns: 1fr; }
  .calculator-inputs { order: 1; }
  .scenario-grid { order: 2; }
}

@media (max-width: 760px) {
  .topbar { align-items: flex-start; padding: 13px 16px; }
  .topbar-actions { flex-wrap: wrap; justify-content: end; }
  .topbar-actions .save-indicator, .topbar-actions #installButton { display: none !important; }
  .page { width: min(100% - 20px, 1500px); padding-top: 15px; }
  .hero-panel { display: block; min-height: auto; padding: 28px 22px 22px; border-radius: 20px; }
  h1 { font-size: 46px; }
  .hero-description { font-size: 13px; }
  .hero-total { min-width: 0; margin-top: 25px; text-align: left; }
  .hero-total strong { font-size: 35px; }
  .job-strip, .calculator-inputs, .optimization-card, .backup-card { padding: 17px; }
  .job-grid, .calculator-grid { grid-template-columns: 1fr; }
  .field-wide, .field-full { grid-column: auto; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .section-actions { width: 100%; }
  .section-actions .button { flex: 1; }
  .summary-grid { gap: 8px; }
  .summary-card { padding: 13px 11px; }
  .summary-card strong { font-size: 22px; }
  .summary-card .metric-note { font-size: 9px; }
  .toolbar { grid-template-columns: 1fr; }
  .toggle-field { justify-content: flex-start; padding-left: 2px; }
  .scenario-grid, .help-grid { grid-template-columns: 1fr; }
  .scenario-card { padding: 17px; }
  .card-title-row { align-items: flex-start; }
  .backup-card { align-items: flex-start; flex-direction: column; }
  .backup-actions { justify-content: flex-start; }
  .footer { flex-direction: column; }
}

@media print {
  :root { color-scheme: light; }
  body { background: #fff; color: #111; }
  .topbar, .hero-panel, .tabs, .toolbar, .section-actions, .source-note, .footer, .no-print { display: none !important; }
  .page { width: 100%; padding: 0; }
  .job-strip, .table-card, .panel-card { border: 0; border-radius: 0; box-shadow: none; background: #fff; }
  .job-strip { margin: 0 0 12px; padding: 0 0 10px; border-bottom: 2px solid #222; }
  .job-strip h2 { color: #111; font-size: 22px; }
  .job-strip .eyebrow, .status-pill { color: #444; }
  .job-strip input, .job-strip textarea { height: auto; padding: 0; border: 0; color: #111; background: transparent; }
  .job-strip textarea { min-height: 0; }
  .tab-panel { display: none !important; }
  #tab-pull { display: block !important; }
  #tab-pull > .section-heading { display: flex; margin: 0 0 10px; }
  #tab-pull h2, #tab-pull .eyebrow { color: #111; }
  .rule-callout { margin-bottom: 10px; border: 1px solid #aaa; color: #222; background: #f5f5f5; }
  .summary-grid { margin-bottom: 10px; }
  .summary-card { border: 1px solid #bbb; background: #fff; }
  .summary-card strong, .metric-label, .metric-note { color: #111; }
  .table-card { overflow: visible; }
  .table-scroll { overflow: visible; }
  .inventory-table { min-width: 0; }
  th { color: #222; background: #eee; }
  td { color: #111; border-color: #ccc; }
  .category-tag { color: #222; background: #eee; }
  .item-number, .applied-qty, .extended-cost { color: #111; }
  .qty-input, .note-input { height: auto; padding: 0; border: 0; color: #111; background: transparent; }
  .inventory-table .col-notes { min-width: 0; }
}
