@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap");

:root {
  /* Budd's brand: logo red, logo yellow, black */
  --bg-1: #ffffff;
  --bg-2: #ffffff;
  --ink: #121212;
  --ink-2: #4a4a50;
  --ink-3: #8b8b93;
  --line: rgba(17, 17, 24, .10);
  --glass: #ffffff;
  --glass-2: #ffffff;
  --fill: #f4f4f6;
  --glass-edge: rgba(17, 17, 24, .08);
  --shadow: 0 16px 36px -20px rgba(17, 17, 24, .22), 0 1px 3px rgba(17, 17, 24, .05);
  --red: #e01b22;
  --red-soft: #fde4e4;
  --yellow: #f5c518;
  --yellow-soft: #fff3c7;
  --gold: #c99a00;
  --black: #121212;
  --grey: #a4a4ab;
  --r-xl: 30px;
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;
  --font: "Outfit", ui-sans-serif, -apple-system, "Segoe UI", sans-serif;
}
[data-theme="dark"] {
  --bg-1: #121212;
  --bg-2: #1c1a17;
  --ink: #f3f1ec;
  --ink-2: #c2bdb4;
  --ink-3: #8a857d;
  --line: rgba(255, 240, 210, .10);
  --glass: rgba(34, 32, 29, .62);
  --glass-2: rgba(44, 41, 37, .86);
  --fill: rgba(255, 255, 255, .06);
  --glass-edge: rgba(255, 255, 255, .06);
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, .6);
  --red-soft: rgba(224, 27, 34, .18);
  --yellow-soft: rgba(245, 197, 24, .16);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; min-height: 100dvh; color: var(--ink); font: 400 14px/1.45 var(--font); }
body { background: linear-gradient(180deg, var(--bg-1), var(--bg-2)); }
button, input, select, textarea { font: inherit; color: inherit; }
svg { display: block; }

/* ---------- shell ---------- */
.topbar { position: sticky; top: 0; z-index: 30; display: grid; grid-template-columns: 300px 1fr 300px; align-items: center;
  padding: 14px 28px 14px 96px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  background: linear-gradient(to bottom, color-mix(in srgb, var(--bg-1) 85%, transparent), transparent); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { width: 38px; height: 38px; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.brand-name { font-size: 19px; letter-spacing: -.2px; }
.brand-name b { font-weight: 700; }
.brand-name span { font-weight: 300; color: var(--ink-2); }
nav { display: flex; justify-content: center; gap: 6px; }
nav button { background: none; border: 0; color: var(--ink-2); padding: 9px 20px; border-radius: 999px; cursor: pointer;
  font-size: 13.5px; font-weight: 400; transition: background .2s, color .2s, transform .1s; }
nav button:hover { color: var(--ink); background: var(--glass); }
nav button:active { transform: scale(.97); }
nav button.active { color: #fff; background: #111216; font-weight: 500; }
[data-theme="dark"] nav button.active { color: #111216; background: #f2f3f6; }
.top-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 13px;
  background: var(--red); color: #fff; box-shadow: 0 0 0 3px var(--glass-2); }

.ibtn { position: relative; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  background: var(--glass-2); border: 1px solid var(--line); color: var(--ink-2);
  transition: transform .15s, background .2s, color .2s, box-shadow .2s; }
.ibtn:hover { color: var(--ink); box-shadow: var(--shadow); transform: translateY(-1px); }
.ibtn:active { transform: scale(.95); }
.ibtn.sm { width: 32px; height: 32px; }
.ibtn svg { width: 17px; height: 17px; }
.ibtn.sm svg { width: 15px; height: 15px; }
.ibtn .dot { position: absolute; top: 6px; right: 7px; min-width: 15px; height: 15px; padding: 0 4px; border-radius: 999px;
  background: var(--red); color: #fff; font-size: 9.5px; font-weight: 600; display: grid; place-items: center; }

.rail { position: fixed; left: 18px; top: 84px; bottom: 18px; z-index: 25; width: 56px; display: flex; flex-direction: column;
  align-items: center; gap: 10px; padding: 14px 0; border-radius: 28px; background: var(--glass); border: 1px solid var(--glass-edge);
  box-shadow: var(--shadow); }
.rail .ibtn { background: transparent; border-color: transparent; }
.rail .ibtn:hover { background: var(--glass-2); border-color: var(--line); }
.rail .spacer { flex: 1; }
.theme { display: flex; flex-direction: column; gap: 8px; padding: 6px; border-radius: 999px; background: var(--glass-2); border: 1px solid var(--line); }
.theme .ibtn { width: 36px; height: 36px; border: 0; }
.theme .ibtn.on { background: #111216; color: #fff; }
[data-theme="dark"] .theme .ibtn.on { background: #f2f3f6; color: #111216; }

main { position: relative; z-index: 1; max-width: 1480px; margin: 0 auto; padding: 8px 32px 80px 104px; }
.view { display: none; }
.view.active { display: block; animation: rise .35s cubic-bezier(.2,.7,.2,1); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

h1 { font-size: 34px; font-weight: 700; letter-spacing: -.8px; line-height: 1.1; margin: 6px 0 6px; text-wrap: balance; }
h2 { font-size: 17px; font-weight: 600; letter-spacing: -.2px; margin: 0; }
h3 { font-size: 15px; font-weight: 600; }
.sub { color: var(--ink-2); margin: 0 0 20px; max-width: 75ch; font-weight: 300; }
.sub b { font-weight: 600; color: var(--ink); }
.muted { color: var(--ink-3); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- panels ---------- */
.panel, .card { position: relative; background: var(--glass); border: 1px solid var(--glass-edge); border-radius: var(--r-xl);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.55); }
[data-theme="dark"] .panel, [data-theme="dark"] .card { box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.04); }
.panel + .panel, .card + .card { margin-top: 18px; }
.panel-head, .card-head { display: flex; align-items: center; gap: 16px; padding: 22px 26px 8px; }
.panel-head h2, .card-head h2 { flex: none; }
.panel-head .grow { flex: 1; }
.card-head { justify-content: space-between; }
.card-head .hint { color: var(--ink-3); font-size: 12px; font-weight: 300; }
.card-body { padding: 10px 26px 24px; }
.icon-group { display: flex; gap: 8px; margin-left: auto; }

/* crew row (the avatar strip) */
.crew { display: flex; align-items: center; gap: 4px; padding: 6px 12px; border-radius: 999px; background: var(--glass-2); border: 1px solid var(--line); margin: 0 auto; }
.crew .av { margin-left: -6px; }
.crew .av:first-child { margin-left: 0; }
.av { position: relative; width: 38px; height: 38px; flex: none; border-radius: 50%; display: grid; place-items: center;
  font-weight: 600; font-size: 12.5px; color: #fff; box-shadow: 0 0 0 3px var(--glass-2); }
.av .cnt { position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%); min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: var(--black); color: #fff; font-size: 9.5px; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--glass-2); }
.av .cnt.c { background: var(--red); }
.av-0 { background: linear-gradient(135deg, #ffd84a, #f0b800); color: #121212; }
.av-1 { background: linear-gradient(135deg, #f0444a, #c8141b); }
.av-2 { background: linear-gradient(135deg, #3a3835, #121212); }
.av-3 { background: linear-gradient(135deg, #b8262b, #7d1216); }
.av-4 { background: linear-gradient(135deg, #e0b232, #a87f00); }
.av-5 { background: linear-gradient(135deg, #b9b4ab, #85807a); }

/* ---------- flow ---------- */
.flow { position: relative; display: grid; grid-template-columns: 1fr 1.15fr 1.15fr 1fr; gap: 34px; padding: 14px 26px 18px; }
.flow-col { position: relative; z-index: 1; display: flex; flex-direction: column; }
.flow-card { flex: 1; border-radius: var(--r-lg); padding: 14px 12px; background: var(--glass-2); border: 1px solid var(--glass-edge);
  box-shadow: 0 10px 24px -16px rgba(70, 88, 130, .35); display: flex; flex-direction: column; gap: 6px; min-height: 236px; }
.flow-cap { text-align: center; margin-top: 14px; font-size: 13.5px; font-weight: 500; color: var(--ink-2); }
.node { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 14px; cursor: pointer; transition: background .2s; }
.node:hover { background: var(--glass); }
.node .nl { flex: 1; min-width: 0; line-height: 1.2; }
.node .nl b { display: block; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.node .nl small { display: block; font-size: 11px; color: var(--ink-3); font-weight: 300; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.node .nl.light b { font-weight: 400; color: var(--ink-2); }
.node .check { color: var(--ink-3); }
.node .check svg { width: 16px; height: 16px; }
.node .val { font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--glass); white-space: nowrap; }
.node .anchor, .flow-card .anchor { position: absolute; }
.node.add { color: var(--ink-3); }
.node.add .plus { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; border: 1px dashed var(--line); }
.node .av { width: 34px; height: 34px; font-size: 11.5px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; flex: 1; }
.tile { border-radius: 18px; padding: 14px 14px; background: var(--glass-2); border: 1px solid var(--glass-edge);
  box-shadow: 0 10px 24px -16px rgba(70, 88, 130, .35); display: flex; flex-direction: column; justify-content: space-between; min-height: 72px; }
.tile .l { font-size: 11.5px; color: var(--ink-3); font-weight: 300; }
.tile .v { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.2px; }
.tile.hero { grid-column: span 2; background: #111216; color: #fff; border-color: #111216; box-shadow: 0 18px 30px -16px rgba(17,18,22,.6); }
.tile.hero .l { color: var(--yellow); }
.tile.hero .v { font-size: 30px; font-weight: 700; letter-spacing: -.8px; }
[data-theme="dark"] .tile.hero { background: #f2f3f6; color: #111216; border-color: #f2f3f6; }
[data-theme="dark"] .tile.hero .l { color: #8a6c00; }
.wires { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: visible; }

/* ---------- lower panels ---------- */
.lower { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr); gap: 18px; margin-top: 18px; align-items: start; }
.lower .panel + .panel { margin-top: 0; }
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--glass-2); border: 1px solid var(--line); }
.seg button { border: 0; background: none; padding: 7px 14px; border-radius: 999px; cursor: pointer; font-size: 13px; color: var(--ink-2); transition: background .2s, color .2s; }
.seg button.on { background: #111216; color: #fff; }
[data-theme="dark"] .seg button.on { background: #f2f3f6; color: #111216; }
.seg button .n { font-size: 11px; opacity: .6; margin-left: 4px; }
.tab { display: none; padding: 8px 26px 24px; }
.tab.on { display: block; }

.grid { display: grid; gap: 14px 16px; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--ink-3); font-weight: 400; }
.span2 { grid-column: span 2; } .span3 { grid-column: span 3; } .span6 { grid-column: span 6; }
input, select, textarea { border: 1px solid var(--line); background: var(--glass-2); border-radius: var(--r-sm); padding: 9px 12px; min-width: 0;
  transition: border-color .2s, box-shadow .2s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--yellow); box-shadow: 0 0 0 4px var(--yellow-soft); }
input[type=number] { text-align: right; font-variant-numeric: tabular-nums; }
textarea { resize: vertical; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 400; font-size: 12.5px; color: var(--ink-3); padding: 12px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
td input, td select { width: 100%; }
td input[type=number] { width: 84px; margin-left: auto; display: block; }
td.out { color: var(--ink-2); }
td.strong { font-weight: 600; }
td.price-from { white-space: nowrap; }
td.price-from .muted { font-size: 12px; }
tfoot td { font-weight: 600; border-top: 1px solid var(--line); }
tbody tr { transition: background .15s; }
tbody tr:hover { background: color-mix(in srgb, var(--glass-2) 60%, transparent); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--glass-2);
  padding: 10px 18px; border-radius: 999px; cursor: pointer; white-space: nowrap; font-weight: 500; transition: transform .12s, box-shadow .2s, background .2s; }
.btn:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.btn:active { transform: scale(.97); }
.btn.primary { background: #111216; color: #fff; border-color: #111216; }
[data-theme="dark"] .btn.primary { background: #f2f3f6; color: #111216; border-color: #f2f3f6; }
.btn.yellow { background: var(--yellow); color: #121212; border-color: var(--yellow); }
.btn.small { padding: 6px 12px; font-size: 12.5px; }
.icon { border: 0; background: none; cursor: pointer; color: var(--ink-3); padding: 6px; border-radius: 50%; display: grid; place-items: center; transition: background .2s, color .2s; }
.icon:hover { background: var(--red-soft); color: var(--red); }
.icon svg { width: 15px; height: 15px; }
.add { margin-top: 12px; }

.pill, .badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 500; padding: 4px 12px; border-radius: 999px; white-space: nowrap; }
.b-current { background: var(--black); color: #fff; }
.b-aging { background: var(--yellow); color: #121212; }
.b-old { background: var(--red); color: #fff; }
.b-none { background: transparent; color: var(--ink-3); border: 1px solid var(--line); }
.was { font-size: 11px; color: var(--ink-3); margin-top: 3px; }

/* side panel: half donuts */
.donuts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 6px 22px 0; }
.donut { position: relative; text-align: center; }
.donut .arc { position: relative; }
.donut .big { position: absolute; left: 0; right: 0; bottom: 0; line-height: 1.15; }
.donut .big b { display: block; font-size: 22px; font-weight: 700; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.donut .big span { font-size: 11.5px; color: var(--ink-3); }
.donut .cap { margin-top: 8px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.legend { display: grid; gap: 8px; padding: 18px 26px 4px; }
.legend .row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.legend .row i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.legend .row span:last-of-type { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 500; }
.fresh { margin: 16px 22px 0; padding: 14px 16px; border-radius: var(--r-md); background: var(--glass-2); border: 1px solid var(--line); }
.fresh p { margin: 0 0 10px; font-size: 13px; }
.fresh.warn { border-color: color-mix(in srgb, var(--red) 35%, transparent); background: color-mix(in srgb, var(--red-soft) 55%, var(--glass-2)); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 18px 22px 24px; }

/* ---------- other views ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--glass-2); border: 1px solid var(--glass-edge); border-radius: var(--r-lg); padding: 18px 20px; box-shadow: var(--shadow); }
.stat .v { font-size: 30px; font-weight: 700; letter-spacing: -.8px; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--ink-3); font-size: 12.5px; font-weight: 300; }
.stat.c .v { color: var(--ink); } .stat.a .v { color: var(--gold); } .stat.o .v { color: var(--red); }
.stat.dark { background: #111216; color: #fff; border-color: #111216; }
.stat.dark .l { color: var(--yellow); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input[type=search] { width: 300px; border-radius: 999px; padding-left: 16px; }
.toolbar select { border-radius: 999px; }
.chips { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--glass-2); border: 1px solid var(--line); }
.chip { border: 0; background: none; padding: 6px 13px; border-radius: 999px; cursor: pointer; font-size: 12.5px; color: var(--ink-2); }
.chip.on { background: #111216; color: #fff; }
[data-theme="dark"] .chip.on { background: #f2f3f6; color: #111216; }
.scroll { max-height: calc(100dvh - 330px); overflow: auto; }
.scroll thead th { position: sticky; top: 0; background: var(--bg-1); z-index: 1; }
.section-row td { font-size: 11px; font-weight: 600; letter-spacing: .8px; color: var(--ink-3); padding-top: 18px; }
.price-input { width: 104px; }
.ok-mark { display: inline-flex; padding: 4px 12px; border-radius: 999px; background: var(--black); color: #fff; font-size: 11.5px; font-weight: 500; }
.bad-mark { display: inline-flex; padding: 4px 12px; border-radius: 999px; background: var(--yellow); color: #121212; font-size: 11.5px; font-weight: 500; }
.finding { padding: 14px 18px; background: var(--glass-2); border: 1px solid var(--line); border-radius: var(--r-md); margin-bottom: 10px; position: relative; padding-left: 44px; }
.finding::before { content: ""; position: absolute; left: 18px; top: 19px; width: 10px; height: 10px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }
.finding b { display: block; margin-bottom: 3px; font-weight: 600; }
.past-list .row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; cursor: pointer; }
.past-list .row:hover { background: var(--glass-2); }
.past-list .row .nl { flex: 1; }
.past-list .row small { color: var(--ink-3); }

/* modal + toast */
.modal { position: fixed; inset: 0; background: rgba(21, 20, 18, .42); display: flex; align-items: flex-start; justify-content: center; padding: 7vh 16px; z-index: 50; }
.modal.hidden { display: none; }
.modal-card { background: var(--bg-1); border: 1px solid var(--glass-edge); border-radius: 26px; width: min(820px, 100%); max-height: 84vh; overflow: auto; box-shadow: 0 30px 80px rgba(20, 24, 40, .35); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg-1); z-index: 2; }
.modal-head h3 { margin: 0; font-size: 17px; }
#modal-body { padding: 18px 22px; }
.draft { border: 1px solid var(--line); border-radius: var(--r-md); margin-bottom: 14px; overflow: hidden; background: var(--glass); }
.draft-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.draft-head span { display: flex; align-items: center; gap: 10px; }
.draft pre { margin: 0; padding: 14px; white-space: pre-wrap; font: 13px/1.55 ui-monospace, "SF Mono", Menlo, monospace; }
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: #111216; color: #fff; padding: 11px 18px; border-radius: 999px; z-index: 60; transition: opacity .25s, transform .25s; font-size: 13px; }
.toast.hidden { opacity: 0; pointer-events: none; transform: translate(-50%, 8px); }

/* proposal (opened in its own window) */
.proposal { background: #fff; color: #15171c; max-width: 820px; margin: 0 auto; padding: 44px 52px; border-radius: 26px; box-shadow: var(--shadow); }
.proposal header { display: flex; justify-content: space-between; align-items: center; border-bottom: 3px solid var(--red); padding-bottom: 16px; margin-bottom: 22px; }
.proposal header img { width: 76px; }
.proposal h2 { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.proposal .total { font-size: 24px; font-weight: 700; text-align: right; margin: 20px 0; }
.proposal ul { padding-left: 18px; color: #4b5160; }
@media print {
  .topbar, nav, .rail, .no-print { display: none !important; }
  body { background: #fff; } body::after { display: none; }
  .proposal { box-shadow: none; padding: 0; }
}
@media (max-width: 1180px) {
  .flow { grid-template-columns: 1fr 1fr; }
  .lower { grid-template-columns: 1fr; }
  .topbar { grid-template-columns: auto 1fr auto; }
}

[data-theme="dark"] .b-current, [data-theme="dark"] .ok-mark { background: #f3f1ec; color: #121212; }
[data-theme="dark"] .stat.c .v { color: var(--ink); }

.btn svg { width: 15px; height: 15px; flex: none; }
.donut .cap { margin-top: 12px; }
[data-pane="materials"] table { table-layout: fixed; }
[data-pane="materials"] th:nth-child(1) { width: 34%; }
[data-pane="materials"] th:nth-child(2) { width: 7%; }
[data-pane="materials"] th:nth-child(3), [data-pane="materials"] th:nth-child(4) { width: 12%; }
[data-pane="materials"] th:nth-child(6) { width: 13%; }
[data-pane="materials"] th:nth-child(7) { width: 44px; }
td.price-from { white-space: normal; line-height: 1.6; }

/* ---------- simpler layout (v2) ---------- */
.flow { grid-template-columns: 1fr 1fr .82fr; gap: 64px; padding: 26px 30px 22px; }
.flow-card { min-height: 0; gap: 4px; padding: 12px; }
.flow-cap { display: flex; justify-content: center; gap: 8px; color: var(--ink-3); font-weight: 400; }
.flow-cap b { color: var(--ink); font-weight: 600; }
.node { padding: 8px 8px; }
.node .nl b { font-size: 13px; font-weight: 500; }
.node.more { justify-content: center; color: var(--ink-3); font-size: 12.5px; }
.tiles { grid-template-columns: 1fr 1fr; align-content: start; }
.tile { min-height: 0; gap: 10px; padding: 14px 16px; }
.tile.hero { padding: 18px 18px; gap: 18px; }
.lower { grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); }
.panel-head { padding: 20px 24px 6px; }
.tab { padding: 6px 24px 22px; }
.donuts.one { grid-template-columns: 1fr; padding: 4px 64px 0; }
.legend { padding: 16px 28px 0; }
.notice { display: flex; align-items: center; gap: 10px; width: calc(100% - 44px); margin: 16px 22px 0; padding: 12px 14px; border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--red) 30%, transparent); background: color-mix(in srgb, var(--red-soft) 50%, var(--glass-2));
  color: var(--ink); text-align: left; cursor: pointer; font-size: 13px; }
.notice i { width: 8px; height: 8px; border-radius: 50%; background: var(--red); flex: none; }
.notice u { text-decoration-color: var(--red); text-underline-offset: 3px; }
.link { border: 0; background: none; padding: 0; color: var(--ink); font-weight: 500; text-decoration: underline;
  text-decoration-color: var(--yellow); text-decoration-thickness: 2px; text-underline-offset: 3px; cursor: pointer; }
details.more { margin-top: 18px; }
details.more summary { cursor: pointer; color: var(--ink-3); font-size: 13px; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
details.more summary::before { content: "+"; display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line); font-size: 12px; }
details.more[open] summary::before { content: "–"; }
details.more .grid { margin-top: 14px; }
.qty { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.qty span { font-size: 11.5px; color: var(--ink-3); width: 30px; }
.qty input { width: 76px !important; margin: 0 !important; }
[data-pane="materials"] th:nth-child(1) { width: 38%; }
[data-pane="materials"] th:nth-child(2) { width: 15%; }
[data-pane="materials"] th:nth-child(3) { width: 12%; }
[data-pane="materials"] th:nth-child(4) { width: 15%; }
[data-pane="materials"] th:nth-child(5) { width: 13%; }
[data-pane="materials"] th:nth-child(6) { width: 44px; }
.flow .av { width: 32px; height: 32px; font-size: 11px; }

/* ---------- v3: tooltips, past-job preview, richer price rows ---------- */
.tip { position: fixed; left: 0; top: 0; z-index: 80; pointer-events: none; max-width: 260px; padding: 7px 11px; border-radius: 10px;
  background: #121212; color: #fff; font-size: 12px; line-height: 1.35; box-shadow: 0 8px 22px rgba(0,0,0,.22);
  opacity: 0; transition: opacity .12s; }
.tip.on { opacity: 1; transition-delay: .15s; }
[data-theme="dark"] .tip { background: #f3f1ec; color: #121212; }

.modal-card.wide { width: min(1080px, 100%); }
.pj { display: grid; grid-template-columns: 400px 1fr; gap: 20px; min-height: 520px; }
.pj-left { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pj-left input[type=search] { border-radius: 999px; padding-left: 16px; }
.pj-left .chips { flex-wrap: wrap; }
.pj-count { font-size: 12px; padding: 0 4px; }
.pj-list { overflow: auto; max-height: 56vh; display: flex; flex-direction: column; gap: 2px; padding-right: 4px; }
.pj-list .row { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 14px; cursor: pointer; transition: background .15s; }
.pj-list .row:hover { background: var(--glass-2); }
.pj-list .row.on { background: #121212; color: #fff; }
.pj-list .row.on small { color: #bdb8af; }
[data-theme="dark"] .pj-list .row.on { background: #f3f1ec; color: #121212; }
.pj-list .row .nl { flex: 1; min-width: 0; }
.pj-list .row .nl b { display: block; font-weight: 500; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pj-list .row .nl small { display: block; color: var(--ink-3); font-size: 11.5px; }
.pj-list .row .val { font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pj-list .av { width: 32px; height: 32px; font-size: 11px; }
.pj-preview { background: var(--glass-2); border: 1px solid var(--line); border-radius: 20px; padding: 20px 22px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pv-head h3 { margin: 0 0 4px; font-size: 19px; font-weight: 700; letter-spacing: -.3px; }
.pv-head .muted { font-size: 12.5px; }
.pv-prices { display: flex; align-items: center; gap: 16px; margin: 14px 0 6px; padding: 14px 16px; border-radius: 16px; background: var(--fill); border: 1px solid var(--line); }
.pv-prices > div { display: flex; flex-direction: column; }
.pv-prices .l { font-size: 11.5px; color: var(--ink-3); }
.pv-prices b { font-size: 22px; font-weight: 700; letter-spacing: -.4px; font-variant-numeric: tabular-nums; }
.pv-prices .arrow { color: var(--ink-3); font-size: 18px; }
.pv-prices .badge { margin-left: auto; }
.pj-preview h4 { margin: 12px 0 6px; font-size: 13px; font-weight: 600; }
.pj-preview h4 .muted { font-weight: 400; margin-left: 6px; }
.pv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pv-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pv-chips span { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--fill); border: 1px solid var(--line); }
.pv-mats { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; }
.pv-mats > div { display: grid; grid-template-columns: 1fr auto 80px; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.pv-mats > div:last-child { border-bottom: 0; }
.pv-mats b { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.pv-actions { margin-top: auto; padding-top: 16px; display: flex; justify-content: flex-end; }

table.rich td { padding-top: 10px; padding-bottom: 10px; }
table.rich .item { display: flex; flex-direction: column; line-height: 1.25; }
table.rich .item b { font-weight: 500; }
table.rich .item .muted { font-size: 11.5px; }
table.rich .priced { white-space: nowrap; }
table.rich .priced .muted { margin-left: 8px; font-size: 12px; }
.sup { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.av.av-sm { width: 24px; height: 24px; font-size: 9.5px; box-shadow: none; }

/* ---------- v4: labeled tool nav on the left, panel tabs on top ---------- */
.rail { display: none; }
.side { position: fixed; left: 16px; top: 16px; bottom: 16px; z-index: 25; width: 216px; display: flex; flex-direction: column; gap: 4px;
  padding: 18px 12px 12px; border-radius: 26px; background: var(--glass-2); border: 1px solid var(--glass-edge); box-shadow: var(--shadow); }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 0 6px 18px; }
.side .brand img { width: 38px; height: 38px; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.side .brand-name { display: flex; flex-direction: column; line-height: 1.15; }
.side .brand-name b { font-size: 17px; font-weight: 700; letter-spacing: -.2px; }
.side .brand-name span { font-size: 11px; color: var(--ink-3); font-weight: 400; }
.side-label { font-size: 11px; color: var(--ink-3); padding: 6px 10px 6px; letter-spacing: .4px; text-transform: uppercase; }
.side-item { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none; padding: 10px 12px; border-radius: 14px;
  cursor: pointer; color: var(--ink-2); font-size: 14px; text-align: left; transition: background .15s, color .15s; }
.side-item:hover:not(:disabled) { background: var(--fill); color: var(--ink); }
.side-item.on { background: #121212; color: #fff; }
[data-theme="dark"] .side-item.on { background: #f3f1ec; color: #121212; }
.side-item:disabled { cursor: default; color: var(--ink-3); }
.side-item .st { flex: 1; }
.side-item em { font-style: normal; font-size: 10.5px; padding: 2px 8px; border-radius: 999px; background: var(--yellow-soft); color: var(--gold); }
.si { width: 20px; height: 20px; display: grid; place-items: center; flex: none; }
.si svg { width: 19px; height: 19px; }
.side .spacer { flex: 1; }
.side-theme { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 999px; background: var(--fill); border: 1px solid var(--line); }
.side-theme button { display: flex; align-items: center; justify-content: center; gap: 6px; border: 0; background: none; padding: 7px 8px; border-radius: 999px;
  cursor: pointer; font-size: 12.5px; color: var(--ink-2); }
.side-theme button.on { background: #121212; color: #fff; }
[data-theme="dark"] .side-theme button.on { background: #f3f1ec; color: #121212; }
.side-theme .si { width: 15px; height: 15px; } .side-theme .si svg { width: 15px; height: 15px; }

.topbar { grid-template-columns: 220px 1fr 220px; padding: 16px 32px 14px 272px; }
.module-title { font-size: 15px; font-weight: 600; color: var(--ink-2); }
main { padding: 6px 32px 80px 272px; max-width: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-actions { display: flex; gap: 8px; padding-bottom: 8px; }
@media (max-width: 1180px) { .side { width: 72px; } .side .st, .side em, .side .brand-name, .side-label, .side-theme { display: none; }
  .topbar { padding-left: 120px; } main { padding-left: 120px; } }

/* fix: header must not slide under/over the sidebar */
.side { z-index: 40; }
.topbar { margin-left: 248px; padding: 16px 32px 14px 24px; grid-template-columns: 200px 1fr 200px;
  backdrop-filter: none; -webkit-backdrop-filter: none;
  background: linear-gradient(to bottom, var(--bg-1) 72%, color-mix(in srgb, var(--bg-1) 0%, transparent)); }
main { padding-left: 272px; }
@media (max-width: 1180px) { .topbar { margin-left: 96px; } main { padding-left: 120px; } }

/* white base: cards keep definition with a hairline + soft shadow; inner cards get a light fill */
.flow-card, .tile:not(.hero), .stat, .pj-preview { background: var(--fill); box-shadow: none; border-color: transparent; }
[data-theme="dark"] .flow-card, [data-theme="dark"] .tile:not(.hero), [data-theme="dark"] .stat, [data-theme="dark"] .pj-preview { background: var(--glass-2); border-color: var(--glass-edge); }
.side { background: #fff; }
[data-theme="dark"] .side { background: var(--glass-2); }
.seg, .chips, .crew { background: var(--fill); }
input, select, textarea { background: #fff; }
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea { background: var(--glass-2); }

/* website request card */
.req-card { border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px; margin-bottom: 18px; background: var(--fill); }
.req-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.req-head b { display: block; font-size: 15px; } .req-head small { color: var(--ink-3); font-size: 12px; }
.req-head a { color: var(--ink-2); text-underline-offset: 3px; }
.req-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 18px; font-size: 13px; }
.req-grid > div { display: flex; flex-direction: column; min-width: 0; }
.req-grid .l { font-size: 11px; color: var(--ink-3); }
.req-grid span:last-child { overflow-wrap: anywhere; }
.req-words { margin: 12px 0 0; font-size: 13.5px; color: var(--ink); line-height: 1.5; }
.pj-preview .req-card { background: #fff; margin: 10px 0 0; }
[data-theme="dark"] .pj-preview .req-card { background: var(--glass-2); }

/* collapsible left menu */
.side { transition: width .25s cubic-bezier(.2,.7,.2,1), padding .25s; }
.topbar { transition: margin-left .25s cubic-bezier(.2,.7,.2,1); }
main { transition: padding-left .25s cubic-bezier(.2,.7,.2,1); }
.side-toggle { position: absolute; top: 30px; right: -13px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2); cursor: pointer; box-shadow: 0 2px 8px rgba(17,17,24,.08); z-index: 2;
  transition: transform .25s, color .15s; }
.side-toggle:hover { color: var(--ink); }
.side-toggle svg { width: 14px; height: 14px; transition: transform .25s; }
[data-theme="dark"] .side-toggle { background: var(--glass-2); }
.side .st, .side em, .side .brand-name, .side-label { transition: opacity .15s; white-space: nowrap; }
html.nav-collapsed .side { width: 72px; padding: 18px 10px 12px; }
html.nav-collapsed .side-toggle svg { transform: rotate(180deg); }
html.nav-collapsed .side .st, html.nav-collapsed .side em, html.nav-collapsed .side .brand-name, html.nav-collapsed .side-label { opacity: 0; width: 0; overflow: hidden; display: none; }
html.nav-collapsed .side .brand { padding: 0 0 18px; justify-content: center; }
html.nav-collapsed .side-item { justify-content: center; padding: 11px 0; }
html.nav-collapsed .side-theme { grid-template-columns: 1fr; border-radius: 22px; }
html.nav-collapsed .side-theme button { padding: 8px 0; }
html.nav-collapsed .topbar { margin-left: 96px; }
html.nav-collapsed main { padding-left: 120px; }
@media (max-width: 1180px) { .side-toggle { display: none; } }

/* ---------- modern dropdowns (combo.js) ---------- */
.sel-native { display: none !important; }
.sel-btn { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-width: 0; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; color: var(--ink); cursor: pointer; text-align: left;
  transition: border-color .15s, box-shadow .15s; }
.sel-btn:hover { border-color: color-mix(in srgb, var(--ink) 25%, transparent); }
.sel-btn:focus-visible, .sel-btn[aria-expanded="true"] { outline: none; border-color: var(--yellow); box-shadow: 0 0 0 4px var(--yellow-soft); }
.sel-btn .sel-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sel-btn svg { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--ink-3); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.sel-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.toolbar .sel-btn { width: auto; min-width: 180px; border-radius: 999px; padding-left: 16px; }
[data-theme="dark"] .sel-btn { background: var(--glass-2); }

.pop { position: fixed; left: 0; top: 0; z-index: 70; max-width: min(640px, calc(100vw - 16px)); max-height: 380px; overflow: auto; padding: 6px;
  background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 18px 44px -12px rgba(17,17,24,.28), 0 2px 6px rgba(17,17,24,.06);
  animation: popIn .14s cubic-bezier(.2,.7,.2,1); }
@keyframes popIn { from { opacity: 0; transform: var(--t, none) translateY(-4px); } }
[data-theme="dark"] .pop { background: #24221f; }
.pop-search { width: 100%; margin-bottom: 6px; border-radius: 10px; }
.opt { display: flex; align-items: center; gap: 14px; padding: 9px 10px; border-radius: 10px; cursor: pointer; font-size: 13.5px; }
.opt.hot { background: var(--fill); }
.opt.sel { font-weight: 600; }
.opt .tick { margin-left: auto; color: var(--ink-2); }
.opt-main { flex: 1; min-width: 0; line-height: 1.3; }
.opt-main b { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opt-main small { display: block; color: var(--ink-3); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opt-side { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.opt-price { font-weight: 600; font-variant-numeric: tabular-nums; }
.opt-group { font-size: 10.5px; letter-spacing: .6px; text-transform: uppercase; color: var(--ink-3); padding: 10px 10px 4px; }
.opt-empty { padding: 14px; color: var(--ink-3); font-size: 13px; }
.pop mark { background: var(--yellow-soft); color: inherit; border-radius: 3px; padding: 0 1px; }
/* cleaner number fields: no tiny native spinner arrows */
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }

/* hitlist */
.side-item em.count { background: var(--red); color: #fff; }
html.nav-collapsed .side-item em.count { display: none; }
.hl-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; margin-top: 4px; }
.hl-col { background: var(--fill); border-radius: 22px; padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 160px; }
.hl-col-head { display: flex; justify-content: space-between; padding: 4px 6px; font-size: 13.5px; }
.hl-card { text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 16px; padding: 12px 14px; cursor: pointer;
  display: flex; flex-direction: column; gap: 6px; transition: box-shadow .15s, transform .1s; font-size: 13.5px; color: var(--ink); }
.hl-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.hl-card p { margin: 0; color: var(--ink-2); font-size: 12.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hl-top { display: flex; justify-content: space-between; align-items: center; font-size: 12px; }
.hl-foot { display: flex; align-items: center; gap: 8px; font-size: 12px; margin-top: 2px; }
.hl-cm { margin-left: auto; }
.hl-empty { padding: 14px 8px; font-size: 13px; }
.hl-form { margin-bottom: 18px; }
.hl-detail .hl-meta { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: 13px; }
.hl-text { white-space: pre-wrap; font-size: 14px; line-height: 1.55; }
.hl-controls { display: flex; align-items: center; gap: 12px; margin: 12px 0; }
.hl-controls .field { width: 160px; }
.hl-comments { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.hl-c { display: flex; gap: 10px; } .hl-c p { margin: 2px 0 0; font-size: 13.5px; }
.hl-reply { display: grid; grid-template-columns: 130px 1fr auto; gap: 8px; align-items: center; }
.hl-danger { margin-top: 16px; text-align: right; font-size: 12.5px; }
.hl-danger .link { text-decoration-color: var(--red); color: var(--ink-3); }
[data-theme="dark"] .hl-card { background: var(--glass-2); }
@media (max-width: 1000px) { .hl-board { grid-template-columns: 1fr; } }

.me-menu { position: fixed; z-index: 75; min-width: 230px; padding: 6px; background: #fff; border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 18px 44px -12px rgba(17,17,24,.28); display: flex; flex-direction: column; }
.me-menu[hidden] { display: none; }
.me-who { padding: 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.me-who b { display: block; } .me-who small { color: var(--ink-3); font-size: 12px; }
.me-menu a, .me-menu button { text-align: left; padding: 9px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; background: none; border: 0; cursor: pointer; font-size: 13.5px; }
.me-menu a:hover, .me-menu button:hover { background: var(--fill); }
[data-theme="dark"] .me-menu { background: #24221f; }
