/* SGM Pricing Calculator styles */
:root {
  --bg:       #0e0e10;
  --surface:  #161618;
  --surface2: #1c1c1f;
  --surface3: #222226;
  --border:   #28282e;
  --border2:  #323238;
  --acc:      #ff4d2e;
  --acc2:     #ff6b4a;
  --acc-dim:  rgba(255,77,46,.12);
  --text:     #eaeaec;
  --text2:    #a0a0a8;
  --muted:    #606068;
  --green:    #22c55e;
  --amber:    #f59e0b;
  --amber-bg: #1e1808;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'IBM Plex Mono', 'Menlo', 'Consolas', monospace;
  font-size: 12px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ─── App shell ─────────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: 1fr 400px;
  grid-template-rows: 48px 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ─── Topbar ─────────────────────────────────────────────────────── */
.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  gap: 16px;
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar-logo {
  width: 22px; height: 22px;
  background: var(--acc);
  clip-path: polygon(0 0, 100% 0, 100% 60%, 60% 100%, 0 100%);
  flex-shrink: 0;
}
.topbar-name {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text);
}
.topbar-sep {
  width: 1px; height: 18px;
  background: var(--border2);
}
.topbar-label {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: .06em;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.rate-chip {
  background: var(--acc-dim);
  border: 1px solid rgba(255,77,46,.25);
  color: var(--acc);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .08em;
  padding: 3px 10px;
  border-radius: 2px;
}

/* ─── Left column ────────────────────────────────────────────────── */
.left {
  overflow-y: auto;
  padding: 16px 18px 24px;
  border-right: 1px solid var(--border);
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}
.left::-webkit-scrollbar { width: 3px; }
.left::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* ─── Tabs ───────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.tab {
  padding: 7px 14px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: -1px;
  transition: color .12s, border-color .12s;
}
.tab:hover { color: var(--text2); }
.tab.active { color: var(--acc); border-bottom-color: var(--acc); }

/* ─── Search ─────────────────────────────────────────────────────── */
.search-wrap {
  position: relative;
  margin-bottom: 10px;
}
.search-wrap svg {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.search-wrap input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 10px 7px 30px;
  border-radius: 3px;
  font-family: inherit;
  font-size: 11px;
  transition: border-color .12s;
}
.search-wrap input::placeholder { color: var(--muted); }
.search-wrap input:focus { outline: none; border-color: var(--border2); }

/* ─── Section head ───────────────────────────────────────────────── */
.sec-head {
  font-size: 9px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 14px 0 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.sec-head:first-child { padding-top: 4px; }

/* ─── Task grid ──────────────────────────────────────────────────── */
.task-grid { display: grid; gap: 3px; }

.task-row {
  display: grid;
  grid-template-columns: 1fr 68px 66px 28px;
  gap: 6px;
  align-items: center;
  padding: 7px 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 3px;
  transition: border-color .1s, background .1s;
  cursor: default;
}
.task-row:hover { border-color: var(--border2); }
.task-row.selected {
  border-color: rgba(255,77,46,.45);
  background: #1a100d;
}

.task-name { font-size: 11px; color: var(--text); line-height: 1.3; }
.task-range {
  font-size: 9.5px;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}
.bulk-tag {
  display: inline-block;
  font-size: 8px;
  letter-spacing: .04em;
  color: var(--amber);
  background: var(--amber-bg);
  border: 1px solid rgba(245,158,11,.2);
  border-radius: 2px;
  padding: 0 4px;
  margin-top: 2px;
}

.task-qty {
  width: 100%;
  background: var(--surface3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 5px;
  border-radius: 2px;
  font-family: inherit;
  font-size: 11px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  transition: border-color .1s;
}
.task-qty:focus { outline: none; border-color: var(--border2); }

.task-add {
  background: var(--acc);
  border: none;
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 2px;
  cursor: pointer;
  font-size: 15px;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background .1s;
  flex-shrink: 0;
}
.task-add:hover { background: var(--acc2); }

/* ─── Travel ─────────────────────────────────────────────────────── */
.travel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-bottom: 8px;
}
.field label {
  display: block;
  font-size: 9px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.field input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 8px;
  border-radius: 3px;
  font-family: inherit;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  transition: border-color .1s;
}
.field input:focus { outline: none; border-color: var(--border2); }

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0 2px;
}
.check-row input[type=checkbox] {
  accent-color: var(--acc);
  width: 13px; height: 13px;
  cursor: pointer;
  flex-shrink: 0;
}
.check-row label { font-size: 11px; color: var(--text2); cursor: pointer; }

/* ─── Revision slider ────────────────────────────────────────────── */
.slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0 2px;
}
.slider-row label { font-size: 10px; color: var(--muted); white-space: nowrap; }
.slider-row input[type=range] { flex: 1; accent-color: var(--acc); }
.slider-val { font-size: 11px; color: var(--acc); min-width: 28px; text-align: right; font-variant-numeric: tabular-nums; }

/* ─── Right column ───────────────────────────────────────────────── */
.right {
  overflow-y: auto;
  padding: 16px 18px 24px;
  background: var(--surface);
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}
.right::-webkit-scrollbar { width: 3px; }
.right::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

.panel-head {
  font-size: 9px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

/* ─── Line items ─────────────────────────────────────────────────── */
.line-items { display: grid; gap: 4px; margin-bottom: 14px; }

.line-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 6px;
  align-items: center;
  padding: 7px 9px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 3px;
}
.li-name { font-size: 11px; color: var(--text); }
.li-qty  { font-size: 10px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.li-cost { font-size: 11px; color: var(--acc); text-align: right; min-width: 90px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.li-rm {
  background: none; border: none;
  color: var(--muted); cursor: pointer;
  font-size: 13px; padding: 0 0 0 4px;
  line-height: 1; transition: color .1s;
}
.li-rm:hover { color: var(--acc); }

/* ─── Travel breakdown ───────────────────────────────────────────── */
.travel-section { margin-bottom: 14px; }
.travel-line {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  padding: 4px 0;
  color: var(--text2);
  border-bottom: 1px solid var(--border);
}
.travel-line:last-child { border-bottom: none; }
.travel-line span:last-child { color: var(--text); font-variant-numeric: tabular-nums; }

/* ─── Totals ─────────────────────────────────────────────────────── */
.totals {
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 14px;
}
.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 11px;
  font-size: 11px;
  border-bottom: 1px solid var(--border);
}
.total-row:last-child { border-bottom: none; background: var(--surface2); }
.total-row.grand { padding: 11px; font-size: 14px; font-weight: 500; }
.total-row .lbl { color: var(--text2); }
.total-row .val { color: var(--text); font-variant-numeric: tabular-nums; }
.total-row.grand .val { color: var(--acc); }

/* ─── Scope ──────────────────────────────────────────────────────── */
.scope-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 11px 12px;
  margin-bottom: 14px;
}
.scope-box p { font-size: 10.5px; color: var(--text2); line-height: 1.75; }
.scope-box strong { color: var(--text); }
.scope-box em { color: var(--muted); font-style: italic; }

/* ─── Client summary ─────────────────────────────────────────────── */
.summary-area {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 10.5px;
  line-height: 1.75;
  padding: 11px 12px;
  border-radius: 3px;
  resize: none;
  min-height: 150px;
  transition: border-color .1s;
}
.summary-area:focus { outline: none; border-color: var(--border2); }

.copy-btn {
  width: 100%;
  padding: 9px;
  margin-top: 7px;
  background: var(--acc);
  border: none;
  color: #fff;
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  border-radius: 3px;
  cursor: pointer;
  transition: background .12s;
}
.copy-btn:hover { background: var(--acc2); }
.copy-btn.ok { background: var(--green); }

/* ─── Empty state ────────────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}
.empty-icon {
  font-size: 22px;
  display: block;
  margin-bottom: 8px;
  opacity: .4;
}

/* ─── Narrow screens: stack the picker above the estimate ────────── */
@media (max-width: 860px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: 48px auto auto;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }
  .left, .right { overflow: visible; }
  .left { border-right: none; border-bottom: 1px solid var(--border); }
  .topbar-label, .topbar-sep { display: none; }
  .travel-grid { grid-template-columns: 1fr; }
}

/* ─── 404 page ───────────────────────────────────────────────────── */
.page { max-width: 480px; margin: 80px auto; padding: 0 16px; }
.page h1 { font-size: 14px; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 10px; }
.page a { color: var(--acc); }
