/* Console */
html, body { height: 100%; }
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100dvh; }
.rail { position: sticky; top: 0; height: 100dvh; background: var(--panel); color: var(--panel-fg); display: flex; flex-direction: column; padding: 22px 14px; gap: 28px; }
.rail-brand { padding: 0 8px; }
.rail-brand img { filter: invert(1); height: 20px; width: auto; }
.tabs { display: grid; gap: 2px; }
.tabs a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 10px; border-radius: var(--r); color: var(--panel-muted); text-decoration: none; font-weight: 600; font-size: 15px; }
.tabs a svg { width: 18px; height: 18px; fill: currentColor; flex: none; }
.tabs a:hover { color: #fff; background: var(--panel-2); }
.tabs a[aria-current="page"] { color: #fff; background: var(--on); }
.rail-foot { margin-top: auto; display: grid; gap: 12px; padding: 14px 8px 0; border-top: 1px solid var(--panel-line); }
.who { display: grid; min-width: 0; }
.who b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who span { font-size: 12px; color: var(--panel-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail .btn.line { color: var(--panel-fg); border-color: var(--panel-line); }
.rail .btn.line:hover { border-color: #fff; }

.main { padding: clamp(20px, 3.4vw, 44px) clamp(16px, 3.4vw, 48px) 72px; min-width: 0; max-width: 1240px; width: 100%; outline: none; }
.loading { color: var(--muted); }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 24px; }
.page-head h1 { font-size: clamp(26px, 3.4vw, 36px); font-weight: 800; }
.page-head p { color: var(--muted); font-size: 15px; margin-top: 6px; max-width: 60ch; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.stack { display: grid; gap: 20px; }
.cols { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: clamp(16px, 2.2vw, 22px); min-width: 0; }
.card > h2, .card-head h2 { font-size: 17px; font-weight: 800; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.card > h2 { margin-bottom: 14px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); display: grid; gap: 12px; justify-items: center; font-size: 15px; border: 1px dashed var(--line); border-radius: 8px; }

/* summary tiles */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px; display: grid; gap: 6px; align-content: start; text-decoration: none; min-width: 0; }
a.tile:hover { border-color: var(--ink); }
.tile span { font-size: 13px; color: var(--muted); font-weight: 600; }
.tile b { font-size: clamp(24px, 2.6vw, 32px); font-weight: 800; line-height: 1.1; overflow-wrap: normal; }
.tile small { font-size: 13px; color: var(--muted); }
.tile.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.tile.dark span, .tile.dark small { color: #b4b9c4; }
.meter { height: 6px; background: var(--line-2); border-radius: 1px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--on); }

/* lists */
.rows { display: grid; }
.rows > li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.rows > li:last-child { border-bottom: 0; padding-bottom: 0; }
.rows > li:first-child { padding-top: 0; }
.row-main { min-width: 0; display: grid; gap: 2px; }
.row-main b { font-size: 15px; }
.row-main span { font-size: 13px; color: var(--muted); }
.todo li { grid-template-columns: 34px minmax(0, 1fr) auto; }
.todo input[type="checkbox"] { width: 20px; height: 20px; margin: 0; accent-color: var(--on); cursor: pointer; }
.todo label.row-main { cursor: pointer; }
.auto-mark { justify-self: start; white-space: nowrap; padding: 2px 4px; border-radius: 2px; background: var(--line-2); color: var(--muted); font-size: 10px; font-weight: 800; line-height: 1.3; }
.owner-name { font-size: 11px; font-weight: 600; color: var(--on); }
.out-list { display: grid; gap: 8px; }
.out-list button { display: grid; gap: 2px; text-align: left; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.out-list button:hover { border-color: var(--on); background: var(--on-soft); }
.out-list b { font-size: 15px; } .out-list span { font-size: 13px; color: var(--muted); }
.print-head { display: none; }
body.printing [data-pane] { display: grid !important; }
.log li { grid-template-columns: minmax(0, 1fr); gap: 2px; padding: 10px 0; }
.log b { font-size: 14px; font-weight: 600; }
.log span { font-size: 12px; color: var(--muted); }

/* seats */
.seat { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line-2); }
.seat:last-child { border-bottom: 0; }
.seat-main { min-width: 0; display: grid; gap: 3px; }
.seat-main b { font-size: 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.seat-main span { font-size: 13px; color: var(--muted); }
.seat-side { display: grid; justify-items: end; gap: 4px; text-align: right; }
.seat-side b { font-size: 14px; }
.seat.is-off .seat-main b { color: var(--muted); }
.bill { display: grid; gap: 8px; }
.bill div { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.bill dt { color: var(--muted); }
.bill .big { padding-top: 12px; border-top: 2px solid var(--ink); align-items: baseline; }
.bill .big dd { font-size: 28px; font-weight: 800; }
.adder { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.adder button { display: grid; gap: 2px; padding: 12px; text-align: left; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); min-height: 64px; }
.adder button:hover { border-color: var(--on); background: var(--on-soft); }
.adder b { font-size: 15px; } .adder span { font-size: 13px; color: var(--muted); }
.packs-mini { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* governance */
.wizard { display: grid; gap: 26px; max-width: 760px; }
.wizard fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.wizard legend { padding: 0; font-size: 17px; font-weight: 800; margin-bottom: 10px; }
.choice { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.choice label { position: relative; display: block; }
.choice input { position: absolute; opacity: 0; inset: 0; }
.choice span { display: grid; gap: 2px; height: 100%; padding: 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); cursor: pointer; }
.choice b { font-size: 15px; } .choice small { font-size: 13px; color: var(--muted); }
.choice input:checked + span { border-color: var(--on); background: var(--on-soft); box-shadow: inset 0 0 0 1px var(--on); }
.choice input:focus-visible + span { outline: 2px solid var(--on); outline-offset: 2px; }
.score { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 24px; align-items: center; background: var(--ink); color: #fff; border-radius: 8px; padding: clamp(18px, 2.6vw, 28px); }
.score-num { font-size: clamp(48px, 7vw, 76px); font-weight: 900; line-height: 1; }
.score-num small { font-size: .4em; font-weight: 700; }
.score-side { display: grid; gap: 12px; min-width: 0; }
.score-side p { color: #c8ccd4; font-size: 14px; }
.areas { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.areas div { display: grid; gap: 6px; font-size: 13px; }
.areas .meter { background: #3a3c42; }
.subnav { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.subnav::-webkit-scrollbar { display: none; }
.subnav button { flex: none; min-height: 38px; padding: 0 14px; border: 1px solid var(--line); border-radius: 2px; background: var(--surface); font-size: 14px; font-weight: 700; color: var(--ink-2); }
.subnav button[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.checks li { grid-template-columns: 28px minmax(0, 1fr) auto; align-items: start; }
.checks input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--on); }
.checks .auto { width: 22px; height: 22px; border: 2px solid var(--line); border-radius: 2px; display: grid; place-items: center; font-size: 14px; font-weight: 900; color: #fff; }
.checks .auto.done { background: var(--ok); border-color: var(--ok); }
.checks li.done .row-main b { color: var(--muted); text-decoration: line-through; }
.owners { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.bodies { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.body-card { border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: grid; gap: 8px; align-content: start; }
.body-card h3 { font-size: 16px; font-weight: 800; display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.body-card h3 small { font-size: 12px; color: var(--on); font-weight: 700; white-space: nowrap; }
.body-card ul { font-size: 14px; color: var(--ink-2); display: grid; gap: 3px; }
.body-card li { padding-left: 12px; position: relative; }
.body-card li::before { content: ""; position: absolute; left: 0; top: 10px; width: 5px; height: 5px; background: var(--ink); }
.raci td, .raci th { text-align: center; padding: 10px 8px; }
.raci th:first-child, .raci td:first-child { text-align: left; white-space: nowrap; font-weight: 700; }
.raci thead th { white-space: normal; min-width: 72px; }
.raci-c { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 2px; font: 800 13px var(--display); background: var(--line-2); color: var(--muted); }
.raci-c.R { background: var(--on); color: #fff; } .raci-c.A { background: var(--ink); color: #fff; } .raci-c.C { background: var(--on-soft); color: var(--on); }
.gate-list { display: grid; gap: 10px; counter-reset: gate; }
.gate { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.gate-no { width: 44px; height: 44px; display: grid; place-items: center; background: var(--line-2); color: var(--muted); font: 800 15px var(--display); border-radius: 2px; }
.gate.approved .gate-no { background: var(--ok); color: #fff; }
.gate.open { border-color: var(--on); box-shadow: inset 3px 0 0 var(--on); }
.gate.open .gate-no { background: var(--on); color: #fff; }
.gate-body { display: grid; gap: 8px; min-width: 0; }
.gate-body h3 { font-size: 17px; font-weight: 800; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.gate-body p { font-size: 14px; color: var(--muted); }
.docs { display: flex; flex-wrap: wrap; gap: 6px; }
.gate-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 4px; }
.gate-actions input { flex: 1 1 220px; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r); font-size: 16px; }
.policy { border-top: 1px solid var(--line-2); padding: 14px 0; }
.policy:first-of-type { border-top: 0; padding-top: 0; }
.policy h3 { font-size: 16px; font-weight: 800; margin-bottom: 6px; }
.policy li { font-size: 14px; color: var(--ink-2); padding: 3px 0 3px 14px; position: relative; }
.policy li::before { content: ""; position: absolute; left: 0; top: 13px; width: 5px; height: 5px; background: var(--on); }
.principles { display: grid; gap: 10px; counter-reset: pr; }
.principles li { counter-increment: pr; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; font-size: 14px; }
.principles li::before { content: counter(pr); font: 800 15px var(--display); color: var(--on); }
.principles b { display: block; font-size: 15px; }
.export { display: flex; flex-wrap: wrap; gap: 8px; }
pre.md { margin: 14px 0 0; padding: 14px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); font: 13px/1.6 ui-monospace, "Cascadia Mono", Menlo, monospace; white-space: pre-wrap; max-height: 360px; overflow: auto; }

/* projects */
.proj { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); text-decoration: none; }
.proj:hover { border-color: var(--ink); }
.proj b { font-size: 17px; font-weight: 800; }
.proj-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-top: 6px; font-size: 13px; color: var(--muted); }
.track { display: grid; grid-template-columns: repeat(5, 22px); gap: 4px; }
.track i { height: 22px; background: var(--line-2); border-radius: 2px; }
.track i.done { background: var(--ok); } .track i.cur { background: var(--on); }
.digest { margin-top: 12px; }
.digest summary { cursor: pointer; font-weight: 700; font-size: 14px; }

/* connect */
.conn { display: grid; gap: 14px; align-content: start; }
.conn-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.conn-head h2 { font-size: 20px; font-weight: 800; }
.conn p { font-size: 14px; color: var(--ink-2); }
.conn ol { font-size: 14px; color: var(--muted); display: grid; gap: 4px; padding-left: 18px; list-style: decimal; }
.conn form { display: flex; flex-wrap: wrap; gap: 8px; }
.conn form input { flex: 1 1 220px; min-width: 0; }
.kv { display: grid; gap: 4px; font-size: 14px; }
.kv div { display: flex; gap: 10px; } .kv dt { color: var(--muted); width: 72px; flex: none; }

/* seat request: coupon */
.coupon-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.coupon-row .input { text-transform: uppercase; }
.coupon-row .btn { min-height: 46px; }
.bill dt { min-width: 0; }
.bill dd { white-space: nowrap; }
.orders s { font-size: 12px; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 80; background: rgba(18, 18, 18, .55); display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.modal-box { width: 100%; max-width: 560px; background: var(--surface); border-radius: 8px; padding: clamp(18px, 3vw, 26px); display: grid; gap: 16px; max-height: calc(100dvh - 32px); overflow-y: auto; }
.modal-box h2 { font-size: 20px; font-weight: 800; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.pick { display: grid; gap: 6px; max-height: 280px; overflow-y: auto; }
.pick button { display: grid; gap: 2px; text-align: left; padding: 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.pick button:hover { border-color: var(--on); background: var(--on-soft); }
.pick b { font-size: 15px; } .pick span { font-size: 13px; color: var(--muted); }

/* ───────── responsive ───────── */
@media (max-width: 1080px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 800px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { position: fixed; inset: auto 0 0 0; height: auto; z-index: 40; flex-direction: row; padding: 0 4px env(safe-area-inset-bottom, 0px); gap: 0; border-top: 1px solid var(--panel-line); }
  .rail-brand, .rail-foot { display: none; }
  .tabs { display: flex; width: 100%; gap: 0; }
  .tabs a { flex: 1; flex-direction: column; justify-content: center; gap: 4px; min-height: 58px; padding: 6px 2px; font-size: 11px; border-radius: 0; min-width: 0; }
  .tabs a[aria-current="page"] { background: none; color: #fff; box-shadow: inset 0 3px 0 var(--on); }
  .main { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
  .toast { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  .mobile-top { display: flex !important; }
}
.mobile-top { display: none; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.mobile-top img { height: 18px; width: auto; }
.mobile-top .who { text-align: right; }
.mobile-top .who span { color: var(--muted); }
@media (max-width: 560px) {
  .tiles { gap: 8px; } .tile { padding: 14px 12px; }
  .choice { grid-template-columns: minmax(0, 1fr); }
  .seat { grid-template-columns: 52px minmax(0, 1fr); }
  .seat-side { grid-column: 2; justify-items: start; text-align: left; grid-auto-flow: column; justify-content: start; align-items: center; gap: 10px; }
  .score { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .gate { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .proj { grid-template-columns: minmax(0, 1fr); }
  .page-actions, .page-actions .btn { width: 100%; }
  .modal-actions .btn { flex: 1; }
}
@media print {
  /* keep coloured marks (RACI letters, ✓) visible: browsers drop backgrounds when printing */
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .rail, .page-actions, .subnav, .toast, .export, .mobile-top, .modal, #ownersForm .page-actions { display: none !important; }
  .page-head { display: none; }
  .print-head { display: grid !important; gap: 4px; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 2px solid var(--ink); }
  .print-head b { font-size: 22px; } .print-head span { font-size: 13px; color: var(--muted); }
  .raci-c { border: 1px solid var(--ink); }
  .checks input[type="checkbox"] { accent-color: var(--ink); }
  .shell { display: block; } .main { padding: 0; max-width: none; }
  .card, .gate, .score { break-inside: avoid; }
  [data-pane] { display: block !important; margin-bottom: 20px; }
}
