:root {
  --concrete: #E7EAE9;
  --panel: #F7F8F7;
  --line: #CBD1CF;
  --ink: #1C2226;
  --ink-2: #4A555B;
  --ink-3: #75828A;
  --brick: #7A2E22;
  --brick-2: #5E2219;
  --slate: #2E5961;
  --slate-2: #234950;
  --amber: #C98E12;
  --amber-bg: #FBF1D9;
  --red: #B3261E;
  --red-bg: #F9E3E1;
  --green: #2F7D4F;
  --green-bg: #E1F1E7;
  --radius-s: 6px;
  --radius-m: 10px;
  --wide: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --narrow: "Archivo", "Arial Narrow", Arial, sans-serif;
  color-scheme: light;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
}
*, *::before, *::after { box-sizing: inherit; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--concrete);
  color: var(--ink);
  font-family: var(--wide);
  font-variation-settings: "wdth" 100;
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}
.narrow { font-family: var(--narrow); font-variation-settings: "wdth" 72; }
a { color: var(--slate); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--slate); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.boot { display: grid; place-items: center; min-height: 100vh; color: var(--ink-3); }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side {
  background: var(--ink); color: #DCE3E6; padding: 20px 14px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 4px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand-mark { width: 30px; height: 22px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; }
.brand-mark i { background: var(--brick); display: block; }
.brand-mark i:nth-child(1) { grid-column: span 2; } .brand-mark i:nth-child(2) { grid-column: span 2; }
.brand-mark i:nth-child(4) { grid-column: span 2; }
.brand b { font-family: var(--narrow); font-variation-settings: "wdth" 72; font-size: 20px; letter-spacing: .01em; color: #fff; }
.brand small { display: block; color: #8E9CA3; font-size: 12px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-s);
  color: #C5CFD3; text-decoration: none; font-size: 15px;
}
.nav a:hover { background: #2A3237; color: #fff; }
.nav a.on { background: #2E363B; color: #fff; box-shadow: inset 3px 0 0 var(--brick); }
.nav .count { margin-left: auto; background: var(--brick); color: #fff; font-size: 12px; padding: 1px 7px; border-radius: 99px; }
.side .who { margin-top: auto; font-size: 13px; color: #8E9CA3; padding: 8px; border-top: 1px solid #2E363B; }
.side .who button { background: none; border: 0; color: #C5CFD3; padding: 0; cursor: pointer; text-decoration: underline; }

.main { padding: 26px 30px 90px; max-width: 1180px; width: 100%; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.head h1 { font-family: var(--narrow); font-variation-settings: "wdth" 72; font-size: 34px; line-height: 1.05; margin: 0; letter-spacing: -.005em; }
.head p { margin: 4px 0 0; color: var(--ink-2); max-width: 64ch; }

.tabbar { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .main { padding: 16px 14px 104px; }
  .head h1 { font-size: 28px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0;
    background: var(--ink); padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)); z-index: 40;
  }
  .tabbar a { color: #AEBBC1; text-decoration: none; text-align: center; font-size: 12px; padding: 6px 2px; border-radius: var(--radius-s); }
  .tabbar a svg { display: block; margin: 0 auto 2px; }
  .tabbar a.on { color: #fff; background: #2E363B; }
}

/* ---------- surfaces ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 18px; }
.panel + .panel { margin-top: 14px; }
.panel h2 { font-size: 17px; margin: 0 0 12px; }
.panel h3 { font-size: 15px; margin: 16px 0 8px; color: var(--ink-2); }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 860px) { .g2, .g3 { grid-template-columns: 1fr; } .g4 { grid-template-columns: repeat(2, 1fr); } }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }

/* ---------- form ---------- */
label.f { display: block; }
label.f > span { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 4px; font-weight: 600; }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date], input[type=time],
input[type=password], input[type=search], select, textarea {
  width: 100%; padding: 10px 11px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-s);
  min-height: 44px;
}
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--slate); outline: none; box-shadow: 0 0 0 3px rgba(46,89,97,.18); }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; background: #fff; }
.seg button { border: 0; background: none; padding: 10px 6px; min-height: 44px; cursor: pointer; border-left: 1px solid var(--line); line-height: 1.2; }
.seg button:first-child { border-left: 0; }
.seg button small { display: block; color: var(--ink-3); font-size: 12px; }
.seg button.on { background: var(--ink); color: #fff; }
.seg button.on small { color: #B8C4C9; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: #fff;
  border-radius: 99px; padding: 8px 13px; cursor: pointer; min-height: 40px; font-size: 14px;
}
.chip input { margin: 0; accent-color: var(--brick); width: 16px; height: 16px; }
.chip.on { border-color: var(--brick); background: #F6EAE7; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
  padding: 10px 16px; border-radius: var(--radius-s); border: 1px solid transparent; cursor: pointer;
  font-weight: 650; text-decoration: none; background: var(--slate); color: #fff;
}
.btn:hover { background: var(--slate-2); }
.btn.brick { background: var(--brick); } .btn.brick:hover { background: var(--brick-2); }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink-3); }
.btn.sm { min-height: 34px; padding: 6px 11px; font-size: 14px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.linkbtn { background: none; border: 0; color: var(--slate); cursor: pointer; padding: 0; text-decoration: underline; }

/* ---------- the sign: quote total ---------- */
.sign {
  background: var(--brick); color: #fff; border-radius: var(--radius-m); padding: 18px 20px 16px;
  box-shadow: inset 0 -4px 0 var(--brick-2);
}
.sign .lab { font-size: 13px; color: #EBC9C2; }
.sign .price { font-family: var(--narrow); font-variation-settings: "wdth" 62; font-weight: 800; font-size: 64px; line-height: .95; letter-spacing: -.01em; margin: 4px 0; }
.sign .sub { color: #F2DAD4; font-size: 14px; }
.gate { margin-top: 12px; border-radius: var(--radius-s); padding: 10px 12px; font-size: 14px; font-weight: 600; }
.gate.pass { background: var(--green-bg); color: var(--green); }
.gate.warn { background: var(--amber-bg); color: #7A5508; }
.gate.block { background: var(--red-bg); color: var(--red); }
.gate ul { margin: 6px 0 0; padding-left: 18px; font-weight: 500; }

.stickybar { display: none; }
@media (max-width: 860px) {
  .stickybar {
    display: flex; position: fixed; left: 0; right: 0; bottom: calc(58px + env(safe-area-inset-bottom, 0px));
    background: var(--brick); color: #fff; padding: 9px 14px; z-index: 35; align-items: center; justify-content: space-between;
    box-shadow: 0 -2px 0 var(--brick-2);
  }
  .stickybar b { font-family: var(--narrow); font-variation-settings: "wdth" 62; font-size: 28px; }
  .stickybar .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 6px; }
}

/* ---------- metrics ---------- */
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px 16px; }
.kpi b { display: block; font-family: var(--narrow); font-variation-settings: "wdth" 70; font-size: 30px; line-height: 1.05; }
.kpi span { font-size: 13px; color: var(--ink-2); }
.kpi.alert { border-color: var(--red); background: var(--red-bg); }
.kpi.alert b { color: var(--red); }

/* ---------- tables and lists ---------- */
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-weight: 650; color: var(--ink-2); border-bottom: 2px solid var(--line); padding: 8px 8px; font-size: 13px; }
table.t td { border-bottom: 1px solid #DFE3E2; padding: 9px 8px; vertical-align: top; }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t tr.tot td { font-weight: 750; border-top: 2px solid var(--ink); border-bottom: 0; }
table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: #EEF1F0; }
.scrollx { overflow-x: auto; }

.item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid #DFE3E2; align-items: flex-start; }
.item:last-child { border-bottom: 0; }
.item .grow { flex: 1; min-width: 0; }
.item .title { font-weight: 650; }
.score {
  flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--narrow); font-variation-settings: "wdth" 70; font-weight: 800; font-size: 18px; color: #fff; background: var(--ink-3);
}
.score.hot { background: var(--brick); } .score.warm { background: var(--amber); }

.tag { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: #E0E5E4; color: var(--ink-2); white-space: nowrap; }
.tag.red { background: var(--red-bg); color: var(--red); }
.tag.amber { background: var(--amber-bg); color: #7A5508; }
.tag.green { background: var(--green-bg); color: var(--green); }
.tag.slate { background: #DCE8EA; color: var(--slate-2); }

/* requirements checklist */
.req { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; padding: 10px 0; border-bottom: 1px solid #DFE3E2; }
.req:last-child { border-bottom: 0; }
.req input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--green); margin-top: 2px; }
.req .t { font-weight: 600; }
.req .d { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.req .c { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.req.done .t { text-decoration: line-through; color: var(--ink-3); }
.req.blocker { background: var(--red-bg); margin: 0 -10px; padding: 10px; border-radius: var(--radius-s); border: 0; }
.req .when { text-align: right; font-size: 13px; white-space: nowrap; }

/* kanban */
.board { display: grid; grid-template-columns: repeat(6, minmax(190px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.col { background: #DDE2E1; border-radius: var(--radius-m); padding: 10px; min-height: 180px; }
.col h3 { margin: 2px 4px 10px; font-size: 14px; color: var(--ink-2); display: flex; justify-content: space-between; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px; margin-bottom: 8px; font-size: 14px; }
.card .n { font-weight: 650; }
.card select { min-height: 34px; padding: 4px 6px; margin-top: 8px; font-size: 13px; }

/* drawer / modal */
.scrim { position: fixed; inset: 0; background: rgba(20,26,29,.45); z-index: 60; display: flex; justify-content: flex-end; }
.drawer { background: var(--panel); width: min(560px, 100%); height: 100%; overflow-y: auto; padding: 20px; box-shadow: -6px 0 24px rgba(0,0,0,.18); }
.drawer .x { float: right; }
.modal-wrap { position: fixed; inset: 0; background: rgba(20,26,29,.45); z-index: 70; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--panel); border-radius: var(--radius-m); padding: 20px; width: min(620px, 100%); max-height: 90vh; overflow-y: auto; }

#toast {
  position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 11px 16px; border-radius: var(--radius-s); font-size: 14px; z-index: 90; display: none; max-width: 92vw;
}
#toast.show { display: block; }

.empty { text-align: center; padding: 34px 16px; color: var(--ink-2); }
.empty p { margin: 6px 0 14px; }
.notice { background: var(--amber-bg); border: 1px solid #E8CF8E; color: #5B3F05; border-radius: var(--radius-m); padding: 14px 16px; }

/* auth + public proposal */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth .box { width: min(420px, 100%); }
.auth h1 { font-family: var(--narrow); font-variation-settings: "wdth" 70; font-size: 40px; margin: 12px 0 4px; }
.proposal { max-width: 760px; margin: 0 auto; padding: 28px 18px 60px; }
.proposal h1 { font-family: var(--narrow); font-variation-settings: "wdth" 70; font-size: 42px; margin: 0; line-height: 1; }

@media print {
  .side, .tabbar, .stickybar, .noprint { display: none !important; }
  .shell { display: block; } .main { padding: 0; } body { background: #fff; }
}
