:root {
  --ink: #1A0000;
  --brand: #8B1A1A;
  --brand-deep: #6E1414;
  --paper: #FFFFFF;
  --mist: #F7F3F3;
  --line: #E6DADA;
  --text: #241717;
  --muted: #6E5E5E;
  --red: #B42318; --red-soft: #FDECEA;
  --amber: #B7791F; --amber-soft: #FFF4DD;
  --green: #1F7A4D; --green-soft: #E9F5EE;
  --blue: #1D4ED8; --blue-soft: #E8EFFD;
  --display: "Montserrat", Arial, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --rs: 8px; --rm: 12px;
  --shadow: 0 1px 2px rgba(26,0,0,.06), 0 4px 16px rgba(26,0,0,.05);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--mist); color: var(--text); font: 15px/1.5 var(--body); }
a { color: var(--brand); }
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -.01em; }
.h1 { font-size: 26px; font-weight: 700; line-height: 1.2; }
.h2 { font-size: 15px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.count { background: var(--line); color: var(--text); font: 600 12px var(--body); padding: 1px 8px; border-radius: 999px; }
.lead { color: var(--muted); margin: 6px 0 18px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .mono { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.opt { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 4px; }
.lbl { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; margin-bottom: 2px; }

/* top bar */
.top { background: var(--ink); color: #fff; }
.top-inner { max-width: 1040px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.top-inner.wide { max-width: 1240px; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.brand img { height: 30px; width: auto; display: block; }
.brand-word { font: 700 13px var(--display); letter-spacing: .14em; text-transform: uppercase; opacity: .85; border-left: 1px solid rgba(255,255,255,.25); padding-left: 12px; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav-link { color: rgba(255,255,255,.85); text-decoration: none; padding: 8px 10px; border-radius: var(--rs); font-weight: 500; font-size: 14px; }
.nav-link:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-user { color: rgba(255,255,255,.6); font-size: 13px; padding: 0 10px; }
.nav-sub { color: rgba(255,255,255,.5); font-size: 12px; margin-left: 4px; }
.btn-link { background: none; border: 0; cursor: pointer; font: inherit; }

/* layout */
.main { max-width: 1040px; margin: 0 auto; padding: 24px 20px 60px; }
.main.wide { max-width: 1240px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 20px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head.proj { align-items: flex-start; }
.head-meta { color: var(--muted); font-size: 13px; }
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.crumb a { color: var(--muted); }
.sect { margin: 0 0 26px; }
.sect-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--rm); padding: 22px; box-shadow: var(--shadow); }
.card.auth { max-width: 440px; margin: 40px auto; }
.card.form { max-width: 620px; margin: 10px auto; }
.flash { padding: 10px 14px; border-radius: var(--rs); margin-bottom: 16px; font-weight: 500; }
.flash.ok { background: var(--green-soft); color: var(--green); }
.flash.err { background: var(--red-soft); color: var(--red); }
.empty { color: var(--muted); padding: 18px; background: var(--paper); border: 1px dashed var(--line); border-radius: var(--rm); text-align: center; }
.allclear { color: var(--green); background: var(--green-soft); padding: 14px 16px; border-radius: var(--rm); font-weight: 500; }

/* chips & dots */
.chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; border: 1px solid transparent; line-height: 1.5; white-space: nowrap; }
.chip.red { background: var(--red-soft); color: var(--red); border-color: #F3B7B1; }
.chip.amber { background: var(--amber-soft); color: var(--amber); border-color: #F0D29A; }
.chip.green { background: var(--green-soft); color: var(--green); border-color: #BFE3CC; }
.chip.blue { background: var(--blue-soft); color: var(--blue); border-color: #C3D3F7; }
.chip.grey { background: #F1EDED; color: #6E5E5E; border-color: #E0D6D6; }
.chip.test { background: #EEE; color: #555; border-color: #DDD; font-size: 11px; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; margin-top: 7px; }
.dot.red { background: var(--red); } .dot.amber { background: var(--amber); } .dot.green { background: var(--green); } .dot.blue { background: var(--blue); }

/* needs attention */
.attn { list-style: none; margin: 0; padding: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--rm); box-shadow: var(--shadow); }
.attn-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
.attn-row:first-child { border-top: 0; }
.attn-text { flex: 1; min-width: 0; }
.attn-biz { font-weight: 600; color: var(--text); text-decoration: none; margin-right: 8px; }
.attn-biz:hover { color: var(--brand); }
.attn-what { color: var(--text); }
.attn-actions { display: flex; gap: 6px; flex: none; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

/* project rows */
.plist { background: var(--paper); border: 1px solid var(--line); border-radius: var(--rm); box-shadow: var(--shadow); overflow: hidden; }
.prow { display: grid; grid-template-columns: 2.2fr 2fr 1fr .9fr .9fr 1fr; gap: 12px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); border-left: 4px solid transparent; color: var(--text); text-decoration: none; }
.prow:first-child { border-top: 0; }
.prow:hover { background: #FBF8F8; }
.prow.red { border-left-color: var(--red); } .prow.amber { border-left-color: var(--amber); } .prow.green { border-left-color: var(--green); }
.pc .lbl { display: none; }
.pname { font-weight: 600; color: var(--text); text-decoration: none; }
.pname:hover { color: var(--brand); }
.prow.head { padding: 8px 16px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; background: #FBF8F8; }
.prow.head:hover { background: #FBF8F8; }
.brand-text { font: 700 14px var(--display); letter-spacing: .12em; }
.psub { display: block; color: var(--muted); font-size: 13px; }
.pc.flags { display: flex; gap: 4px; flex-wrap: wrap; }
.pc.last, .pc.date, .pc.hours, .pc.dev { font-size: 14px; }

/* quotes */
.qrow { display: grid; grid-template-columns: 2.4fr 1.6fr .9fr 1fr 1.3fr; gap: 12px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); border-left: 4px solid transparent; color: var(--text); text-decoration: none; }
.qrow:first-child { border-top: 0; }
.qrow:hover { background: #FBF8F8; }
.qrow.red { border-left-color: var(--red); } .qrow.amber { border-left-color: var(--amber); } .qrow.green { border-left-color: var(--green); } .qrow.blue { border-left-color: #C3D3F7; }
.qrow.head { padding: 8px 16px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; background: #FBF8F8; }
.qc .lbl { display: none; }
.qc.flags { display: flex; gap: 4px; flex-wrap: wrap; }
.qc.hours, .qc.date, .qc.by { font-size: 14px; }
.calc { min-height: 44px; display: flex; align-items: center; padding: 10px 12px; background: var(--mist); border: 1px dashed #D9CACA; border-radius: var(--rs); font-weight: 600; }
.calc.on { background: var(--green-soft); color: var(--green); border-style: solid; border-color: #BFE3CC; }
.decide { display: flex; gap: 10px; flex-wrap: wrap; }
.linkbox { background: var(--blue-soft); color: var(--blue); padding: 12px 14px; border-radius: var(--rm); margin: -12px 0 24px; }
.linkbox .tog { display: inline-block; margin-left: 6px; }
.card.scope { padding: 16px 18px; }
.qnote { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.late { color: var(--red); font-weight: 600; }

/* row file drawers, search, owed banner */
.clipbtn { background: none; border: 1px solid transparent; border-radius: 999px; cursor: pointer; padding: 1px 7px; font: inherit; font-size: 12px; color: var(--muted); }
.clipbtn:hover, .clipbtn.on { border-color: var(--line); background: var(--mist); color: var(--text); }
.rowdocs { grid-column: 1 / -1; background: var(--mist); border-radius: var(--rs); padding: 10px 12px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
.rd-list { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px 16px; flex-wrap: wrap; flex: 1; }
.rd-list a { font-weight: 600; }
.rd-x { color: var(--muted); font-size: 16px; padding: 0 4px; line-height: 1; }
.rd-x:hover { color: var(--red); }
.search { width: 220px; min-height: 36px; padding: 6px 10px; font-size: 14px; }
.owed { background: var(--green-soft); color: var(--green); padding: 12px 14px; border-radius: var(--rm); margin-bottom: 18px; }
.owed.due { background: var(--amber-soft); color: var(--amber); }
.thread.notes { border-left: 0; display: grid; gap: 8px; }
.thread.notes li { background: var(--paper); border: 1px solid var(--line); border-radius: var(--rm); padding: 10px 12px; font-size: 14px; box-shadow: var(--shadow); }
.prow.done.amber { border-left-color: var(--amber); }

/* documents */
.docs { list-style: none; margin: 0; padding: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--rm); box-shadow: var(--shadow); }
.doc { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); }
.doc:first-child { border-top: 0; }
.doc-ic { flex: none; font: 700 10px var(--display); letter-spacing: .06em; background: var(--ink); color: #fff; border-radius: 6px; padding: 6px 7px; min-width: 40px; text-align: center; }
.doc-main { flex: 1; min-width: 0; }
.doc-name { font-weight: 600; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.doc-name:hover { color: var(--brand); }
.doc-meta { font-size: 12px; color: var(--muted); }
.doc-actions { display: flex; gap: 6px; flex: none; }
input[type=file] { width: 100%; font: inherit; padding: 8px 0; }
.upbtn { cursor: pointer; }
.clip { font-size: 12px; color: var(--muted); margin-left: 6px; white-space: nowrap; }

/* project page */
.flagrow { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 18px; margin: 0; min-width: 320px; }
.facts div { min-width: 0; }
.facts dt { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.stages { list-style: none; display: flex; gap: 4px; padding: 0; margin: 6px 0 12px; counter-reset: st; }
.stages li { flex: 1; text-align: center; font-size: 12px; color: var(--muted); padding: 8px 4px 0; border-top: 4px solid var(--line); }
.stages li.past { border-top-color: #C9A3A3; color: var(--text); }
.stages li.now { border-top-color: var(--brand); color: var(--brand); font-weight: 700; }
.stage-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 26px; }

.wlist { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.witem { background: var(--paper); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: var(--rm); padding: 12px 14px; box-shadow: var(--shadow); }
.witem.red { border-left-color: var(--red); } .witem.amber { border-left-color: var(--amber); }
.witem.closed { opacity: .8; background: #FBF9F9; }
.w-top { display: flex; gap: 10px; }
.w-main { flex: 1; min-width: 0; }
.w-what { font-weight: 600; }
.w-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.w-meta .late { color: var(--red); }
.w-answer { margin-top: 8px; background: var(--green-soft); padding: 8px 10px; border-radius: var(--rs); }
.w-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; align-items: flex-start; }
.thread { list-style: none; margin: 8px 0 0; padding: 0; border-left: 2px solid var(--line); }
.thread li { padding: 4px 10px; font-size: 13px; }
.thread li.chased .t-body { color: var(--muted); font-style: italic; }
.t-by { font-weight: 600; } .t-at { color: var(--muted); font-size: 12px; }
.fold { margin-top: 10px; }
.fold summary.sum { font-size: 15px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 4px 0; }
.fold summary.sum .muted { text-transform: none; letter-spacing: 0; font-weight: 500; }
a.chip { text-decoration: none; } .fold summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 500; padding: 6px 0; }
.fold > *:not(summary) { margin-top: 8px; }

.update, .cupdate { background: var(--paper); border: 1px solid var(--line); border-radius: var(--rm); padding: 12px 14px; margin-bottom: 10px; box-shadow: var(--shadow); }
.u-head { font-size: 13px; color: var(--muted); margin-bottom: 8px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.u-grid { display: grid; gap: 8px; }
.pre { white-space: pre-wrap; font: inherit; margin: 0; }
.hrow { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.hrow.total { border-bottom: 0; font-size: 16px; }
.pay { margin-top: 10px; background: var(--blue-soft); color: var(--blue); padding: 10px 12px; border-radius: var(--rs); display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.pay.done { background: var(--green-soft); color: var(--green); }
.draft { background: var(--paper); border: 1px solid var(--line); border-radius: var(--rm); padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow); }
.draft textarea { width: 100%; margin: 6px 0 10px; }
.hist { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.hist li { padding: 4px 0; border-bottom: 1px solid var(--line); }

/* forms */
.stack { display: grid; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row3 { display: grid; grid-template-columns: 2fr 1.2fr 1.5fr auto; gap: 12px; align-items: end; margin-top: 12px; }
.field label, .field legend { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.field fieldset, fieldset.field { border: 0; padding: 0; margin: 0; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=url], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: #fff; border: 1px solid #D9CACA; border-radius: var(--rs); padding: 10px 12px; min-height: 44px;
}
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(139,26,26,.35); outline-offset: 1px; border-color: var(--brand); }
.hint { color: var(--muted); font-size: 12px; margin-top: 5px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.check.tall { padding-top: 30px; }
.check input { width: 18px; height: 18px; }
.radios { display: flex; gap: 18px; } .radios label { display: flex; align-items: center; gap: 6px; }
[hidden] { display: none !important; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 600 14px var(--body); padding: 10px 16px; border-radius: var(--rs); border: 1px solid transparent; cursor: pointer; text-decoration: none; min-height: 44px; white-space: nowrap; }
.btn.primary { background: var(--brand); color: #fff; } .btn.primary:hover { background: var(--brand-deep); }
.btn.ghost { background: #fff; color: var(--text); border-color: #D9CACA; } .btn.ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn.danger { background: #fff; color: var(--red); border-color: #F3B7B1; } .btn.danger:hover { background: var(--red-soft); }
.btn.sm { padding: 6px 12px; min-height: 34px; font-size: 13px; }
.btn.copied { background: var(--green-soft); color: var(--green); border-color: #BFE3CC; }
.inline { display: inline; }
.tog summary { list-style: none; } .tog summary::-webkit-details-marker { display: none; }
.tog[open] > summary { background: var(--mist); color: var(--text); border-color: var(--line); }
.tog-body { background: var(--paper); border: 1px solid var(--line); border-radius: var(--rm); padding: 16px; margin-top: 8px; box-shadow: var(--shadow); min-width: min(100%, 420px); }
.stage-actions .tog { position: relative; }
.stage-actions .tog-body { position: absolute; z-index: 5; width: 420px; max-width: calc(100vw - 40px); }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.pick { font: 600 15px var(--body); padding: 14px; border: 1px solid #D9CACA; border-radius: var(--rs); background: #fff; cursor: pointer; }
.pick:hover { border-color: var(--brand); color: var(--brand); }
.or { text-align: center; color: var(--muted); font-size: 13px; }
.chipbtn { font: 500 12px var(--body); background: var(--mist); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; cursor: pointer; }
.chipbtn:hover { border-color: var(--brand); color: var(--brand); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14px; box-shadow: var(--shadow); z-index: 9; }

/* phones */
@media (max-width: 760px) {
  .main { padding: 16px 14px 48px; }
  .top-inner { padding: 8px 14px; }
  .brand-word { display: none; }
  .nav-user { display: none; }
  .h1 { font-size: 22px; }
  .page-head.proj { flex-direction: column; }
  .facts { min-width: 0; grid-template-columns: 1fr 1fr; }
  .prow { grid-template-columns: 1fr 1fr; gap: 8px 12px; }
  .prow.head { display: none; }
  .qrow { grid-template-columns: 1fr 1fr; gap: 8px 12px; }
  .qrow.head { display: none; }
  .qc.biz, .qc.flags { grid-column: 1 / -1; }
  .qc .lbl { display: block; }
  .doc { flex-wrap: wrap; } .doc-actions { width: 100%; padding-left: 52px; }
  .pc.biz { grid-column: 1 / -1; }
  .pc.flags { grid-column: 1 / -1; }
  .pc .lbl { display: block; }
  .attn-row { flex-wrap: wrap; }
  .attn-actions { width: 100%; justify-content: flex-start; padding-left: 22px; }
  .row2, .row3 { grid-template-columns: 1fr; }
  .check.tall { padding-top: 0; }
  .stages li { font-size: 10px; }
  .stage-actions .tog-body { position: static; width: auto; }
  .card { padding: 16px; }
  .card.auth { margin: 16px auto; }
}
