/* Matches blackandalmconstruction.com: Noir / Charcoal / Gilded Brass / Soft Grey / Off-White,
   Fraunces headings + Inter body. */
:root {
  --noir: #121213; --charcoal: #2F2F2E; --brass: #BFA26F; --brass-dim: #a9895a; --soft-grey: #D3D3CF; --cream: #FAFAF9;
  --serif: 'Fraunces', Georgia, 'Iowan Old Style', 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;

  --ink: var(--noir); --muted: #6b6b68; --line: #e4e2dd; --bg: var(--cream); --card: #fff;
  --accent: var(--noir); --ok: var(--charcoal); --ok-bg: #ebe9e4; --warn: var(--brass-dim); --warn-bg: #f4eddf;
  --bad: #9b2c2c; --bad-bg: #f6e7e5; --hi: #f8f4ea; --link: var(--brass-dim);
  font-family: var(--sans);
  color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; line-height: 1.5; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; font-family: var(--serif); font-weight: 500; letter-spacing: -0.01em; line-height: 1.15; }
h1 { font-size: clamp(1.7rem, 3vw, 2.3rem); font-weight: 400; }
h2 { font-size: 1.2rem; }
summary h2 { display: inline; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }

/* ---------- site strip + header (same look as the public site) ---------- */
.strip { background: var(--noir); color: var(--brass); }
.strip-inner { max-width: 1200px; margin: 0 auto; padding: 0 20px; min-height: 34px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.strip span, .strip a { font-size: .68rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; color: var(--brass); text-decoration: none; }
.strip a:hover { color: var(--cream); }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; padding: 10px max(20px, calc((100vw - 1200px) / 2 + 20px)); background: rgba(250,250,249,0.97);
  border-bottom: 1px solid rgba(18,18,19,0.08); }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--ink); }
.brand img { height: 54px; width: auto; display: block; }
.brand span { font-weight: 600; letter-spacing: .16em; text-transform: uppercase; font-size: .7rem; color: var(--brass-dim);
  padding-left: 14px; border-left: 1px solid var(--soft-grey); }
.top-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.jobpick { position: relative; }
.jobpick-btn { font: inherit; font-size: .88rem; display: flex; align-items: center; gap: 10px; max-width: 380px; min-width: 240px;
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); cursor: pointer; text-align: left; }
.jobpick-btn:hover { border-color: var(--noir); }
.jobpick-btn #jobPickLabel { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jobpick-btn .caret { color: var(--muted); font-size: .75rem; }
.jobpick-panel { position: absolute; top: calc(100% + 6px); left: 0; width: min(460px, 92vw); background: #fff; border: 1px solid var(--line);
  border-top: 3px solid var(--noir); border-radius: 8px; box-shadow: 0 12px 32px rgba(0,0,0,.14); padding: 10px; z-index: 30; }
.jobpick-panel input { width: 100%; padding: 9px 10px; }
#jobList { list-style: none; margin: 8px 0 0; padding: 0; max-height: 340px; overflow-y: auto; }
#jobList li { padding: 8px 10px; border-radius: 6px; cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; }
#jobList li .jn { font-size: .9rem; }
#jobList li .jn b { font-weight: 600; margin-right: 6px; }
#jobList li .jsub { grid-column: 1; font-size: .76rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#jobList li .jp { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-size: .76rem; color: var(--muted); }
#jobList li.active { background: var(--hi); }
#jobList li.current .jn::after { content: "  ✓"; color: var(--brass-dim); }
#jobList li mark { background: #f1e4c4; color: inherit; border-radius: 2px; }
#jobList .none { cursor: default; color: var(--muted); font-size: .85rem; display: block; }
.who { font-size: .82rem; color: var(--muted); }

main { max-width: 1200px; margin: 0 auto; padding: 28px 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 18px 20px; margin-bottom: 14px; }
.card.narrow { max-width: 440px; }
.card > h2 { margin-bottom: 12px; }
details > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸"; color: var(--muted); transition: transform .15s; }
details[open] > summary::before { transform: rotate(90deg); }

.btn { font: inherit; font-size: .88rem; font-weight: 600; border: 1px solid var(--noir); background: var(--noir); color: var(--cream);
  padding: 8px 16px; border-radius: 6px; cursor: pointer; white-space: nowrap; transition: background-color .2s, color .2s, border-color .2s; }
.btn:hover { background: var(--brass); border-color: var(--brass); color: var(--noir); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--noir); }
.btn.ghost:hover { background: var(--noir); color: var(--cream); }
.btn.small { padding: 4px 10px; font-size: .82rem; }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .4; cursor: default; }
input, select, textarea { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brass); outline-offset: 0; border-color: transparent; }
input[type=checkbox], input[type=radio] { accent-color: var(--noir); }
label { display: flex; flex-direction: column; gap: 4px; font-size: .82rem; color: var(--muted); }
label.check { flex-direction: row; align-items: center; color: var(--ink); font-size: .9rem; }
.error { color: var(--bad); min-height: 1.2em; margin: 4px 0 0; }
.hint { font-size: .85rem; color: var(--muted); margin: 8px 0 12px; }
.hint.banner { background: var(--hi); border: 1px solid #efe1bb; border-radius: 8px; padding: 10px 14px; color: var(--ink); }
.stack { display: grid; gap: 12px; }
.row-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row-form input.short { width: 80px; }

/* ---------- login ---------- */
.login { max-width: 400px; margin: 50px auto; }
.login { border-top: 3px solid var(--noir); padding: 28px 30px; }
.login-logo { width: 100%; max-width: 260px; display: block; margin: 4px auto 14px; }
.login h1 { text-align: center; font-family: var(--sans); font-size: .72rem; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--brass-dim); }
.login form { display: grid; gap: 12px; margin-top: 16px; }
.pw { position: relative; display: flex; }
.pw input { flex: 1; padding-right: 40px; min-width: 0; }
.eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: none; background: none; cursor: pointer;
  font-size: 1rem; padding: 4px 6px; opacity: .45; }
.eye.on { opacity: 1; }
.setup-link { font-size: .85rem; margin: 12px 0 0; }
.setup-link a { color: var(--link); }

/* ---------- job head ---------- */
.job-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.job-num { color: var(--muted); font-size: .85rem; font-weight: 600; }
#jobName { outline: none; border-bottom: 1px dashed transparent; }
#jobName:hover, #jobName:focus { border-bottom-color: var(--muted); }
.job-meta { display: flex; gap: 12px; align-items: center; }

/* ---------- progress track ---------- */
.track { padding: 16px 18px 12px; }
.track-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.track-now { font-size: .95rem; }
.track { border-top: 3px solid var(--noir); }
.track-now { font-family: var(--serif); font-size: 1.1rem; }
.track-now b { font-weight: 500; }
.track-now .lbl { font-family: var(--sans); font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .16em; color: var(--brass-dim); margin-right: 8px; }
.track-pct { font-size: .85rem; color: var(--muted); }
.track-pct b { color: var(--ink); font-family: var(--serif); font-weight: 500; font-size: 1.5rem; }
.rail { position: relative; height: 26px; }
.rail .line { position: absolute; left: 0; right: 0; top: 11px; height: 4px; background: var(--soft-grey); border-radius: 99px; }
.rail .fill { position: absolute; left: 0; top: 11px; height: 4px; background: var(--brass); border-radius: 99px; transition: width .4s; }
.rail .thumb { position: absolute; top: 3px; width: 20px; height: 20px; margin-left: -10px; border-radius: 50%; background: var(--cream);
  border: 4px solid var(--noir); box-shadow: 0 1px 4px rgba(0,0,0,.25); transition: left .4s; }
.segs { display: flex; gap: 3px; margin-top: 6px; }
.seg { flex: 1; min-width: 0; border: none; background: #ecebe7; color: var(--muted); height: 24px; border-radius: 4px;
  font: inherit; font-size: .68rem; font-weight: 600; letter-spacing: .04em; cursor: pointer; padding: 0; overflow: hidden; }
.seg.partial { background: #eadfc7; color: #6e5631; }
.seg.done { background: var(--noir); color: var(--brass); }
.seg.hold { background: var(--bad); color: #fff; }
.seg.current { outline: 2px solid var(--brass); outline-offset: 1px; color: var(--ink); background: #fff; }
.seg.current.hold { background: var(--bad); color: #fff; }
.phases { display: flex; gap: 3px; margin-top: 5px; }
.phases div { font-size: .66rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; border-top: 1px solid #c9ccd1;
  padding-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend { display: flex; gap: 14px; margin-top: 8px; font-size: .72rem; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }

/* ---------- info ---------- */
.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 14px; }
.info-grid .wide { grid-column: 1 / -1; }
.info-grid textarea { min-height: 80px; resize: vertical; }

/* ---------- sections ---------- */
.phase-title { margin: 30px 0 10px; font-family: var(--sans); font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .16em; color: var(--brass-dim); }
.section { scroll-margin-top: 80px; }
.sec-head { flex: 1; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sec-id { color: var(--muted); font-weight: 700; margin-right: 6px; }
.sec-count { font-size: .8rem; color: var(--muted); white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.bar { width: 80px; height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--brass); transition: width .3s; }
.pill { font-size: .72rem; padding: 2px 8px; border-radius: 99px; background: var(--line); color: var(--ink); }
.pill.approved { background: var(--ok-bg); color: var(--ok); }
.pill.hold { background: var(--bad-bg); color: var(--bad); }
.pill.conditional { background: var(--warn-bg); color: var(--warn); }
.sec-note { font-size: .85rem; color: var(--muted); margin: 10px 0 0; font-style: italic; }

.tasks { margin-top: 12px; border-top: 1px solid var(--line); }
.task { display: grid; grid-template-columns: 28px 1fr auto; gap: 4px 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.task input[type=checkbox] { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--noir); }
.task.done .ttext { color: var(--muted); text-decoration: line-through; text-decoration-color: #bbb; }
.tid { color: var(--muted); font-size: .75rem; font-weight: 600; margin-right: 4px; }
.tmeta { font-size: .76rem; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; margin-top: 3px; }
.tmeta b { color: var(--ink); font-weight: 600; }
.tfields { display: flex; gap: 6px; align-items: flex-start; }
.tfields input.ini { width: 56px; text-transform: uppercase; text-align: center; }
.tfields input[type=date] { width: 140px; }
.notes-btn { font-size: .76rem; background: none; border: none; color: var(--link); cursor: pointer; padding: 0; margin-top: 4px; }
.task textarea { grid-column: 2 / -1; min-height: 54px; resize: vertical; }
.saved-by { font-size: .72rem; color: var(--muted); grid-column: 2 / -1; }

.gate { margin-top: 14px; background: var(--hi); border: 1px solid #e8dcc0; border-left: 3px solid var(--brass); border-radius: 8px; padding: 12px 14px; }
.gate h3 { margin: 0 0 4px; font-family: var(--sans); font-size: .78rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.gate p { margin: 0 0 10px; font-size: .85rem; }
.gate-grid { display: grid; grid-template-columns: 1fr 150px 1fr 150px; gap: 10px; }
.decisions { display: flex; gap: 16px; flex-wrap: wrap; margin: 12px 0 8px; font-size: .9rem; align-items: center; }
.decisions label { flex-direction: row; align-items: center; color: var(--ink); font-size: .9rem; }
.gate textarea { width: 100%; min-height: 44px; }

/* ---------- audit ---------- */
.activity { list-style: none; padding: 0; margin: 12px 0; font-size: .85rem; }
.activity li { padding: 8px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 150px 1fr; gap: 10px; }
.activity time, .audit time { color: var(--muted); white-space: nowrap; font-size: .8rem; }
.chg { margin: 4px 0 0; padding: 0; list-style: none; font-size: .78rem; color: var(--muted); }
.chg li { display: block; padding: 0; border: none; }
.chg s { color: var(--bad); text-decoration-color: rgba(180,35,24,.5); }
.chg ins { color: var(--ok); text-decoration: none; }
.chg .item { font-style: italic; }
.foot { font-size: .8rem; color: var(--muted); text-align: center; margin: 24px 0; }

/* ---------- settings ---------- */
.settings-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs button { font: inherit; font-size: .88rem; font-weight: 500; border: none; border-bottom: 2px solid transparent; background: none;
  padding: 8px 2px; cursor: pointer; color: var(--muted); margin-bottom: -1px; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--ink); border-bottom-color: var(--brass); }
table.grid { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.grid th { text-align: left; font-size: .75rem; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.grid td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.grid tr.inactive td { color: var(--muted); }
table.grid input.short { width: 70px; }
.inline-pw { display: flex; gap: 6px; margin-top: 6px; }

.ed-section { border-left: 3px solid var(--noir); }
.ed-section.inactive { opacity: .55; border-left-color: var(--soft-grey); }
.ed-head { display: grid; grid-template-columns: 70px 1fr 1fr auto; gap: 10px; align-items: end; }
.ed-head .sid { font-size: 1.3rem; font-weight: 800; }
.ed-gate { display: grid; grid-template-columns: 1fr 2fr 1fr 1fr; gap: 10px; margin-top: 10px; background: var(--hi); padding: 10px; border-radius: 8px; }
.ed-note { margin-top: 10px; }
.ed-note textarea, .ed-gate textarea { width: 100%; min-height: 38px; resize: vertical; }
.ed-tasks { margin-top: 12px; }
.ed-task { display: grid; grid-template-columns: 54px 1fr 130px 100px 160px auto; gap: 8px; align-items: start; padding: 8px 0; border-top: 1px solid var(--line); }
.ed-task.inactive { opacity: .5; }
.ed-task .tid { padding-top: 8px; }
.ed-task textarea { min-height: 38px; resize: vertical; }
.ed-task .acts { display: flex; gap: 4px; }
.ed-task .acts button { padding: 4px 8px; }
.ed-cols { display: grid; grid-template-columns: 54px 1fr 130px 100px 160px auto; gap: 8px; font-size: .72rem; color: var(--muted); margin-top: 12px; }
.ed-add { display: grid; grid-template-columns: 54px 1fr 130px 100px 160px auto; gap: 8px; padding-top: 8px; border-top: 1px dashed #c9ccd1; }

dialog { border: none; border-radius: 10px; padding: 20px; width: min(420px, 92vw); }
dialog form { display: grid; gap: 12px; }
dialog .row { display: flex; justify-content: flex-end; gap: 8px; }

.toast { position: fixed; bottom: 18px; right: 18px; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 8px;
  font-size: .85rem; opacity: 0; transform: translateY(8px); transition: all .2s; pointer-events: none; z-index: 20; }
.toast.show { opacity: 1; transform: none; }
.toast.bad { background: var(--bad); }

@media (max-width: 820px) {
  main { padding: 14px 12px; }
  .brand img { height: 40px; }
  .strip .strip-tag { display: none; }
  .strip-inner { justify-content: center; }
  .track { position: static; }
  .seg { font-size: 0; }
  .task { grid-template-columns: 28px 1fr; }
  .tfields { grid-column: 2; }
  .gate-grid, .ed-gate { grid-template-columns: 1fr 1fr; }
  .ed-head { grid-template-columns: 60px 1fr; }
  .ed-task, .ed-add, .ed-cols { grid-template-columns: 1fr 1fr; }
  .ed-cols { display: none; }
  .ed-task textarea, .ed-add input:first-of-type { grid-column: 1 / -1; }
  .activity li { grid-template-columns: 1fr; gap: 2px; }
  .jobpick-btn { min-width: 0; max-width: 70vw; }
}
@media print {
  .topbar, .notes-btn, .toast, .segs .seg { cursor: default; }
  .topbar .top-right, .notes-btn, .toast { display: none !important; }
  .track { position: static; box-shadow: none; }
  details { display: block; } details > * { display: block !important; }
  .card { break-inside: avoid; }
}
