@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap");

:root {
  --font-sans: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --bg: #101112;
  --surface: #17191a;
  --raised: #1e2123;
  --paper: #e7e4dc;
  --paper-2: #ddd8cd;
  --ink: #161513;
  --ink-soft: #3c3a35;
  --fg: #eceae4;
  --muted: #8d8f89;
  --faint: #5c5e59;
  --border: #2a2d2e;
  --line: #c8c2b4;
  --accent: #c9cdc6;
  --accent-fg: #121312;
  --good: #7d9a78;
  --warn: #c4a46a;
  --bad: #c47a6e;
  --ring: #c9cdc6;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --header-h: 3.5rem;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font-sans); }
html { -webkit-text-size-adjust: 100%; }
body { min-height: 100dvh; overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.tabular, .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.app { min-height: 100dvh; overflow-x: hidden; background: var(--bg); color: var(--fg); }

.site-header {
  position: sticky; top: 0; z-index: 40;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(8px);
}
.header-inner {
  max-width: 80rem; margin: 0 auto;
  display: flex; align-items: center; gap: 0.75rem;
  height: var(--header-h); padding: 0 1rem;
}
@media (min-width: 640px) {
  .header-inner { height: 4rem; padding: 0 1.5rem; }
}
.brand { display: flex; align-items: center; gap: 0.625rem; }
.brand-mark {
  width: 2rem; height: 2rem; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--accent-fg);
  display: grid; place-items: center; flex-shrink: 0;
}
.brand-mark svg { width: 1rem; height: 1rem; }
.brand-name { display: block; font-weight: 500; letter-spacing: -0.025em; line-height: 1.15; }
.brand-sub { display: none; font-size: 11px; color: var(--muted); line-height: 1.2; }
@media (min-width: 640px) { .brand-sub { display: block; } }

.desk-nav { display: none; margin-left: 1rem; align-items: center; gap: 2px; }
@media (min-width: 768px) { .desk-nav { display: flex; } }
.desk-nav a, .header-link {
  border-radius: var(--radius-sm); padding: 0.5rem 0.75rem;
  font-size: 0.875rem; color: var(--muted); transition: color 150ms, background 150ms;
}
.desk-nav a:hover, .header-link:hover { color: var(--fg); }
.desk-nav a.active { background: var(--raised); color: var(--fg); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }
.header-link.alspec { font-size: 0.8125rem; }

.page {
  max-width: 80rem; margin: 0 auto; overflow-x: hidden;
  padding: 1.25rem 1rem calc(7rem + var(--safe-bottom));
}
@media (min-width: 640px) { .page { padding: 2rem 1.5rem 2.5rem; } }
@media (min-width: 768px) { .page { padding-bottom: 2.5rem; } }

.bottom-nav {
  position: fixed; inset: auto 0 0 0; z-index: 40;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 95%, transparent);
  padding-bottom: var(--safe-bottom);
  backdrop-filter: blur(8px);
}
@media (min-width: 768px) { .bottom-nav { display: none; } }
.more-sheet {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
  border-bottom: 1px solid var(--border); background: var(--surface);
  padding: 0.5rem;
}
.more-sheet a {
  display: flex; height: 3rem; align-items: center; justify-content: center; gap: 0.5rem;
  border-radius: var(--radius-sm); font-size: 0.875rem; color: var(--muted);
}
.more-sheet a.active { background: var(--raised); color: var(--fg); }
.tab-bar { display: grid; grid-template-columns: repeat(5, 1fr); }
.tab-bar a, .tab-bar button {
  display: flex; min-height: 3.5rem; flex-direction: column;
  align-items: center; justify-content: center; gap: 0.25rem;
  font-size: 0.75rem; color: var(--muted);
}
.tab-bar a.active, .tab-bar button.active, .tab-bar button[aria-expanded="true"] { color: var(--fg); }
.tab-bar svg { width: 1.25rem; height: 1.25rem; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  white-space: nowrap; font-weight: 500; border-radius: var(--radius-sm);
  height: 2.75rem; padding: 0 0.75rem; font-size: 0.875rem;
  transition: opacity 150ms, background 150ms, color 150ms;
}
.btn svg { width: 1rem; height: 1rem; flex-shrink: 0; }
.btn:disabled { opacity: 0.4; pointer-events: none; }
.btn-primary { background: var(--accent); color: var(--accent-fg); }
.btn-primary:hover { opacity: 0.92; }
.btn-secondary { border: 1px solid var(--border); background: var(--raised); color: var(--fg); }
.btn-secondary:hover { background: var(--surface); }
.btn-ghost { color: var(--fg); }
.btn-ghost:hover { background: var(--raised); }
.btn-sm { height: 2.25rem; padding: 0 0.75rem; font-size: 0.875rem; }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-ink:hover { opacity: 0.9; }
.btn-paper { color: var(--ink); }
.btn-paper:hover { background: var(--paper-2); }

.field, .input, select.input, textarea.input {
  width: 100%; height: 2.75rem; border-radius: var(--radius-md);
  border: 1px solid var(--border); background: var(--raised);
  padding: 0 0.75rem; font-size: 1rem; color: var(--fg);
}
@media (min-width: 768px) { .field, .input, select.input { font-size: 0.875rem; } }
textarea.input { height: auto; min-height: 4.5rem; padding: 0.6rem 0.75rem; resize: vertical; }
.input-bare {
  width: 100%; border: 0; background: transparent; padding: 0;
  color: inherit; outline: none;
}
.search-box {
  display: flex; height: 3rem; align-items: center; gap: 0.5rem;
  border-radius: var(--radius-md); border: 1px solid var(--border);
  background: var(--raised); padding: 0 0.75rem;
}
.search-box.h-11 { height: 2.75rem; }
.search-box input {
  height: 100%; width: 100%; background: transparent; border: 0; outline: none;
  font-size: 1rem; color: var(--fg);
}
.search-box input::placeholder { color: var(--faint); }
@media (min-width: 768px) { .search-box input { font-size: 0.875rem; } }
.search-box svg { width: 1rem; height: 1rem; color: var(--muted); flex-shrink: 0; }

.chip {
  height: 2.25rem; flex-shrink: 0; border-radius: 999px; padding: 0 0.75rem;
  font-size: 0.875rem; background: var(--raised); color: var(--muted);
}
.chip:hover { color: var(--fg); }
.chip.on { background: var(--accent); color: var(--accent-fg); }
.chip-row { display: flex; gap: 0.5rem; overflow-x: auto; padding-bottom: 0.25rem; }
.seg {
  height: 2.5rem; border-radius: var(--radius-sm); font-size: 0.875rem;
  background: var(--raised); color: var(--muted); padding: 0 0.5rem;
}
.seg.on { background: var(--accent); color: var(--accent-fg); }

.card {
  border-radius: var(--radius-lg); border: 1px solid var(--border);
  background: var(--surface); padding: 0.75rem 1rem;
}
@media (min-width: 640px) { .card { padding: 1rem 1.25rem; } }
.card-h { font-size: 1.125rem; font-weight: 500; letter-spacing: -0.025em; margin: 0; }
.kicker { margin: 0; font-size: 0.75rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.lede { margin: 0.5rem 0 0; max-width: 42rem; font-size: 0.875rem; color: var(--muted); }
.page-title { margin: 0.25rem 0 0; font-size: 1.875rem; font-weight: 500; letter-spacing: -0.025em; }
.badge {
  display: inline-flex; align-items: center; border-radius: 999px;
  padding: 0.125rem 0.5rem; font-size: 0.75rem; font-weight: 500;
  background: var(--raised); color: var(--muted); border: 1px solid var(--border);
}

/* Quote paper */
.quote-grid {
  display: grid; gap: 1.25rem;
}
@media (min-width: 1024px) {
  .quote-grid { grid-template-columns: minmax(0, 1fr) 20rem; }
}
@media (min-width: 1280px) {
  .quote-grid { grid-template-columns: minmax(0, 1fr) 22rem; }
}
.job-card {
  min-width: 0; overflow: hidden; border-radius: 24px;
  background: var(--paper); color: var(--ink);
  box-shadow: 0 18px 50px -24px #0000008c;
  padding: 1rem;
}
@media (min-width: 640px) { .job-card { padding: 1.5rem; } }
.job-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--line); padding-bottom: 1rem; }
.job-kicker { margin: 0; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-soft); }
.job-title { margin-top: 0.25rem; width: 100%; border: 0; background: transparent; padding: 0;
  font-size: 1.5rem; font-weight: 500; letter-spacing: -0.025em; color: var(--ink); outline: none; }
@media (min-width: 640px) { .job-title { font-size: 1.875rem; } }
.job-total-label { margin: 0; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft); text-align: right; }
.job-total { margin: 0; font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 1.5rem; letter-spacing: -0.025em; text-align: right; }
@media (min-width: 640px) { .job-total { font-size: 1.875rem; } }
.job-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.job-meta { display: grid; gap: 0.75rem; margin-top: 1rem; }
@media (min-width: 640px) { .job-meta { grid-template-columns: 1fr 8rem 1fr; } }
.meta-label { display: block; margin-bottom: 0.25rem; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft); }
.meta-input {
  width: 100%; border: 1px solid var(--line); background: transparent;
  border-radius: var(--radius-sm); height: 2.5rem; padding: 0 0.5rem; color: var(--ink);
}
.meta-input::placeholder { color: color-mix(in srgb, var(--ink-soft) 60%, transparent); }
.lines-empty { margin: 1rem 0; font-size: 0.875rem; color: var(--ink-soft); }

.line-card { border-top: 1px solid var(--line); padding: 0.75rem 0; }
.line-name { width: 100%; border: 0; background: transparent; font-weight: 500; color: var(--ink); outline: none; }
.line-note { margin: 0.15rem 0 0; font-size: 11px; color: var(--ink-soft); }
.line-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-top: 0.5rem; }
.line-amt { margin: 0.35rem 0 0; font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 500; }
.icon-btn {
  display: grid; width: 2.75rem; height: 2.75rem; place-items: center;
  border-radius: var(--radius-sm); color: var(--ink-soft);
}
.icon-btn:hover { background: var(--paper-2); color: var(--ink); }
.icon-btn svg { width: 1rem; height: 1rem; }
.line-tools { display: flex; gap: 2px; margin-top: 0.25rem; }

.lines-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.875rem; margin-top: 0.75rem; }
.lines-table th { font-weight: 500; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft); padding: 0.5rem 0.4rem; border-bottom: 1px solid var(--line); }
.lines-table td { padding: 0.45rem 0.4rem; border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); vertical-align: middle; }
.lines-table input {
  width: 100%; border: 1px solid transparent; background: transparent; color: var(--ink);
  font-family: var(--font-mono); font-variant-numeric: tabular-nums; padding: 0.2rem 0.25rem; border-radius: 4px;
}
.lines-table input:focus { border-color: var(--line); outline: none; background: var(--paper-2); }
@media (max-width: 767px) { .desk-only { display: none !important; } }
@media (min-width: 768px) { .mobile-only { display: none !important; } }

.totals { margin-top: 1rem; font-size: 0.875rem; }
.totals dl { margin: 0; display: grid; gap: 0.35rem; }
.totals .row { display: flex; justify-content: space-between; align-items: baseline; color: var(--ink-soft); }
.totals .row dd { margin: 0; color: var(--ink); font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.totals .grand { display: flex; justify-content: space-between; border-top: 1px solid var(--ink); padding-top: 0.5rem; font-size: 1rem; font-weight: 500; color: var(--ink); }
.totals .hours { margin: 0.25rem 0 0; font-size: 11px; color: var(--ink-soft); }
.pct-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 0.75rem 0; }
.pct-row label { font-size: 0.75rem; color: var(--ink-soft); }
.pct-row input { width: 4.5rem; height: 2.25rem; border: 1px solid var(--line); border-radius: 6px; background: transparent; padding: 0 0.4rem; font-family: var(--font-mono); color: var(--ink); }
.gst-toggle { margin-top: 0.25rem; height: 2.25rem; padding: 0 0.6rem; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); font-size: 0.875rem; }

.aside { min-width: 0; scroll-margin-top: 5rem; display: flex; flex-direction: column; gap: 1rem; }
.mobile-quote-bar {
  position: fixed; left: 0; right: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  border-top: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 95%, transparent);
  padding: 0.5rem 1rem; backdrop-filter: blur(8px);
  bottom: calc(3.5rem + var(--safe-bottom));
}
@media (min-width: 768px) { .mobile-quote-bar { display: none; } }

/* Catalog tables */
.list-card { overflow: hidden; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); }
.cat-grid { display: grid; gap: 0.5rem; }
@media (min-width: 640px) { .cat-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .cat-grid { grid-template-columns: 1fr 1fr 1fr; } }
.cat-link {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem;
  border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface);
  padding: 0.75rem 1rem;
}
.cat-link:hover { background: var(--raised); }
.price-warn { color: var(--warn); font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.875rem; }
.data-table th {
  font-weight: 400; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); padding: 0.625rem 0.75rem; border-bottom: 1px solid var(--border);
}
.data-table td { padding: 0.5rem 0.75rem; border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.item-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; padding: 0.75rem; border-bottom: 1px solid var(--border); }
.item-row:last-child { border-bottom: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.good { color: var(--good); }
.tiny { font-size: 11px; }
.back-link { display: inline-flex; height: 2.5rem; align-items: center; gap: 0.375rem; font-size: 0.875rem; color: var(--muted); }
.back-link:hover { color: var(--fg); }

.rate-grid { display: grid; gap: 0.75rem; }
@media (min-width: 640px) { .rate-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1280px) { .rate-grid { grid-template-columns: 1fr 1fr 1fr; } }
.rate-card { display: flex; flex-direction: column; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); padding: 1rem; }
.jobs-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.jobs-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); }
.jobs-list li:last-child { border-bottom: 0; }
.empty-box { border: 1px dashed var(--border); border-radius: var(--radius-lg); padding: 3.5rem 1.5rem; text-align: center; color: var(--muted); font-size: 0.875rem; }

.award-table { width: 100%; min-width: 40rem; border-collapse: collapse; text-align: left; font-size: 0.875rem; }
.award-table th { padding: 0.75rem 1rem; font-weight: 500; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); background: var(--surface); }
.award-table td { padding: 0.75rem 1rem; border-top: 1px solid var(--border); }
.award-table tr { cursor: pointer; }
.award-table tr:hover { background: var(--surface); }
.award-table tr.on { background: var(--raised); }
.scroll-x { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }

.stepper { display: flex; align-items: center; gap: 0.25rem; }
.stepper button { width: 2.25rem; height: 2.25rem; border-radius: 6px; background: var(--raised); color: var(--fg); }
.stepper input { width: 4.5rem; height: 2.25rem; text-align: center; border: 1px solid var(--border); border-radius: 6px; background: var(--raised); font-family: var(--font-mono); }

.cut-box { margin-top: 1rem; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--raised); padding: 0.5rem 0.75rem; }
.diagram { width: 100%; height: 8rem; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--raised); padding: 0.5rem; }
.diagram svg { width: 100%; height: 100%; }

.toast-wrap {
  position: fixed; right: 1rem; bottom: calc(5.5rem + var(--safe-bottom)); z-index: 60;
  display: flex; flex-direction: column; gap: 0.4rem; pointer-events: none;
}
@media (min-width: 768px) { .toast-wrap { bottom: 1.5rem; } }
.toast {
  pointer-events: auto; min-width: 14rem; max-width: 22rem;
  border-radius: var(--radius-md); border: 1px solid var(--border);
  background: var(--raised); color: var(--fg); padding: 0.65rem 0.85rem;
  font-size: 0.875rem; box-shadow: 0 8px 24px #0008;
}
.toast.error { border-color: var(--bad); }

.space-y-8 > * + * { margin-top: 2rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }
.space-y-5 > * + * { margin-top: 1.25rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-end { align-items: flex-end; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-3 { gap: 0.75rem; }
.gap-2 { gap: 0.5rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
@media (min-width: 1024px) { .lg-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; } }

.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem; }
.login-card { width: 100%; max-width: 24rem; }
.note-box { margin-top: 1.25rem; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); padding: 1rem; font-size: 0.875rem; color: var(--muted); line-height: 1.5; }

input[type=range] { width: 100%; accent-color: var(--accent); margin-top: 0.5rem; }

@media print {
  html, body { color: #000 !important; background: #fff !important; }
  .no-print { display: none !important; }
  .job-card, .print-sheet { box-shadow: none !important; color: #000 !important; background: #fff !important; max-width: none !important; }
  .page { padding: 0 !important; max-width: none; }
}

.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
