:root {
  --bg: #f5f4ef; --surface: #ffffff; --surface-2: #f0efe9; --border: #e2e0d8;
  --text: #1f2421; --muted: #6b716c; --accent: #2f5d50; --accent-2: #3f7a69; --accent-soft: #e3eee9;
  --good: #2e7d4f; --warn: #b26b00; --bad: #b3261e; --info: #2c5d8f;
  --c1: #3f7a69; --c2: #c9893b; --c3: #5577aa; --c4: #a05570; --c5: #7a8a3a; --c6: #8a6bb0;
  --radius: 12px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
  --nav-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141716; --surface: #1c201e; --surface-2: #232826; --border: #2f3532;
    --text: #e8ebe8; --muted: #9aa39d; --accent: #6fb39d; --accent-2: #86c4b0; --accent-soft: #1f3530;
    --good: #5cc28a; --warn: #e0a24a; --bad: #ef7a72; --info: #79a8db;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
.boot { padding: 3rem; text-align: center; color: var(--muted); }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.good { color: var(--good); } .bad { color: var(--bad); } .warn { color: var(--warn); }

/* layout */
.shell { display: flex; min-height: 100vh; }
.sidebar { display: none; }
.main { flex: 1; min-width: 0; padding: 16px 16px calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); max-width: 1200px; margin: 0 auto; width: 100%; }
.bottomnav { position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--border); display: flex; z-index: 20; }
.bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); text-decoration: none; font-size: .72rem; }
.bottomnav a.active { color: var(--accent); font-weight: 600; }
.bottomnav svg, .sidebar svg { width: 22px; height: 22px; }
@media (min-width: 900px) {
  .bottomnav { display: none; }
  .sidebar { display: flex; flex-direction: column; width: 220px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border); padding: 20px 12px; position: sticky; top: 0; height: 100vh; }
  .sidebar .brand { font-weight: 700; font-size: 1.1rem; padding: 4px 10px 20px; display: flex; gap: 8px; align-items: center; }
  .sidebar a.nav { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 8px; color: var(--text); text-decoration: none; }
  .sidebar a.nav:hover { background: var(--surface-2); }
  .sidebar a.nav.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
  .sidebar .spacer { flex: 1; }
  .main { padding: 28px 32px 48px; }
}
.pagehead { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.pagehead .sub { color: var(--muted); margin-top: -4px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.section { margin-top: 24px; }
.section > .head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }

/* cards & tiles */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 12px; }
.grid > .card + .card, .grid > .card { margin-top: 0; }
.grid { display: grid; gap: 12px; }
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 700px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } .grid.two { grid-template-columns: 1fr 1fr; } .grid.three { grid-template-columns: repeat(3, 1fr); } }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); min-width: 0; }
.tile .label { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.tile .value { font-size: 1.35rem; font-weight: 650; font-variant-numeric: tabular-nums; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; }
.tile .hint { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; }
.kv .k { color: var(--muted); } .kv .v { text-align: right; font-variant-numeric: tabular-nums; }
.kv .total { font-weight: 650; border-top: 1px solid var(--border); padding-top: 6px; }
.propcard { cursor: pointer; display: block; color: inherit; text-decoration: none; }
.propcard:hover { border-color: var(--accent); }

/* buttons & forms */
button, .btn { font: inherit; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 8px 14px; border-radius: 9px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; min-height: 38px; }
button:hover, .btn:hover { background: var(--surface-2); }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { button.primary, .btn.primary { color: #0e1a16; } }
button.primary:hover { background: var(--accent-2); }
button.danger { color: var(--bad); }
button.ghost { border-color: transparent; background: transparent; }
button.small { padding: 4px 10px; min-height: 30px; font-size: .85rem; }
button:disabled { opacity: .5; cursor: default; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--muted); }
input, select, textarea { font: inherit; font-size: 16px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 9px 10px; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); }
textarea { min-height: 80px; resize: vertical; }
.formgrid { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.formgrid .full { grid-column: 1 / -1; }
@media (max-width: 520px) { .formgrid { grid-template-columns: 1fr; } }
.check { flex-direction: row !important; align-items: center; gap: 8px !important; color: var(--text) !important; font-size: .95rem !important; }
.error { color: var(--bad); font-size: .9rem; min-height: 1.2em; }

/* tabs */
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--border); margin-bottom: 16px; scrollbar-width: none; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--accent); border-color: var(--accent); font-weight: 600; }

/* tables -> cards on mobile */
table.list { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table.list th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; padding: 10px 12px; background: var(--surface-2); }
table.list td { padding: 10px 12px; border-top: 1px solid var(--border); vertical-align: top; }
table.list tr.click { cursor: pointer; } table.list tr.click:hover td { background: var(--surface-2); }
table.list tfoot td { font-weight: 650; background: var(--surface-2); }
table.list th.num, table.list td.num { text-align: right; }
@media (max-width: 700px) {
  table.list, table.list tbody, table.list tfoot { display: block; border: 0; background: none; box-shadow: none; }
  table.list thead { display: none; }
  table.list tr { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; padding: 6px 0; }
  table.list td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 4px 14px; text-align: right; }
  table.list td::before { content: attr(data-label); color: var(--muted); font-size: .85rem; text-align: left; }
  table.list td.primary { font-weight: 600; font-size: 1rem; text-align: left; }
  table.list td.primary::before { content: none; }
  table.list td.empty-cell { display: none; }
}
.empty { text-align: center; padding: 28px 16px; color: var(--muted); background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }

/* badges & bars */
.badge { display: inline-block; font-size: .75rem; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; font-weight: 500; }
.badge.green { background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--good); }
.badge.amber { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.badge.red { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }
.badge.blue { background: color-mix(in srgb, var(--info) 15%, transparent); color: var(--info); }
.bar { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; position: relative; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.bar.over > span { background: var(--bad); }
.hbars { display: grid; gap: 10px; }
.hbar .top { display: flex; justify-content: space-between; gap: 8px; font-size: .9rem; margin-bottom: 4px; }
.hbar .top .v { font-variant-numeric: tabular-nums; color: var(--muted); }

/* category groups */
.catgroup { margin-bottom: 18px; }
.cathead { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; padding: 6px 2px; flex-wrap: wrap; }
.cathead h3 { margin: 0; }

/* task list */
.tasklist .task { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-top: 1px solid var(--border); cursor: pointer; }
.tasklist .task:first-child { border-top: 0; }
.tasklist .task:hover { background: var(--surface-2); }
.tasklist .task .t-title { font-weight: 550; }
.tasklist .task.done .t-title { text-decoration: line-through; color: var(--muted); }
.tasklist .meta { display: flex; gap: 6px 10px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); margin-top: 3px; }
.tasklist.card { padding: 0; overflow: hidden; }
.phase-title { margin: 18px 2px 8px; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; }

/* gantt */
.gantt-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.gantt { min-width: 760px; position: relative; }
.gantt .g-row { display: grid; grid-template-columns: 200px 1fr; border-top: 1px solid var(--border); min-height: 34px; }
.gantt .g-row.g-phase { background: var(--surface-2); font-weight: 650; font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.gantt .g-label { padding: 7px 10px; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-right: 1px solid var(--border); position: sticky; left: 0; background: inherit; z-index: 2; background-color: var(--surface); }
.gantt .g-phase .g-label { background-color: var(--surface-2); }
.gantt .g-track { position: relative; }
.gantt .g-bar { position: absolute; top: 7px; height: 20px; border-radius: 6px; background: color-mix(in srgb, var(--accent) 35%, transparent); cursor: pointer; overflow: hidden; min-width: 6px; }
.gantt .g-bar > i { position: absolute; inset: 0 auto 0 0; background: var(--accent); }
.gantt .g-bar.done > i { background: var(--good); }
.gantt .g-bar.late { outline: 2px solid var(--bad); }
.gantt .g-head { display: grid; grid-template-columns: 200px 1fr; position: sticky; top: 0; background: var(--surface); z-index: 3; }
.gantt .g-months { position: relative; height: 30px; }
.gantt .g-month { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--border); font-size: .75rem; color: var(--muted); padding: 7px 5px; white-space: nowrap; }
.gantt .g-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--bad); opacity: .7; z-index: 1; pointer-events: none; }
.gantt .g-grid { position: absolute; top: 0; bottom: 0; border-left: 1px dashed var(--border); pointer-events: none; }

/* calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--border); gap: 1px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cal .dow { background: var(--surface-2); text-align: center; font-size: .75rem; color: var(--muted); padding: 6px 0; font-weight: 600; }
.cal .day { background: var(--surface); min-height: 92px; padding: 4px; cursor: pointer; min-width: 0; }
.cal .day.other { background: var(--surface-2); opacity: .55; }
.cal .day.sel { outline: 2px solid var(--accent); outline-offset: -2px; }
.cal .day .dn { font-size: .8rem; color: var(--muted); }
.cal .day.today .dn { background: var(--accent); color: #fff; border-radius: 999px; padding: 0 6px; display: inline-block; }
.cal .chip { font-size: .72rem; padding: 1px 5px; border-radius: 4px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--accent-soft); color: var(--accent); }
.cal .chip.start { background: color-mix(in srgb, var(--info) 15%, transparent); color: var(--info); }
.cal .chip.draw { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.cal .chip.done { opacity: .5; text-decoration: line-through; }
.cal .dots { display: none; gap: 3px; flex-wrap: wrap; margin-top: 4px; }
.cal .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.cal .dots i.draw { background: var(--warn); } .cal .dots i.start { background: var(--info); }
@media (max-width: 700px) { .cal .day { min-height: 54px; } .cal .chip { display: none; } .cal .dots { display: flex; } }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: var(--surface); width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; border-radius: 16px 16px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); }
@media (min-width: 700px) { .modal-back { align-items: center; } .modal { border-radius: 16px; } }
.modal .mhead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal .mfoot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.modal .mfoot .left { margin-right: auto; }
#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 60; max-width: 90vw; }
#toast.show { opacity: 1; }

/* auth */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.auth .card { width: 100%; max-width: 400px; }
.auth form { display: grid; gap: 12px; }
.auth .logo { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; font-weight: 700; font-size: 1.2rem; }
.copybox { display: flex; gap: 8px; } .copybox input { font-size: .85rem; }
.permgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* files */
.dropzone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 18px 16px; text-align: center; background: var(--surface); }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.upstatus { display: grid; gap: 8px; margin-top: 10px; text-align: left; }
.upstatus:empty { display: none; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.filegrid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
@media (max-width: 420px) { .filegrid { grid-template-columns: 1fr 1fr; } }
.filecard { display: flex; flex-direction: column; align-items: stretch; gap: 3px; text-align: left; padding: 8px; min-height: 0; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); min-width: 0; }
.filecard:hover { border-color: var(--accent); background: var(--surface); }
.filecard .thumbwrap { aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: var(--surface-2); display: flex; align-items: center; justify-content: center; margin-bottom: 4px; }
.filecard .thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.filecard .fname { font-weight: 550; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filecard .fcat { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ficon { width: 64px; height: 76px; border-radius: 6px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 10px; font-size: .72rem; font-weight: 700; letter-spacing: .03em; color: #fff; background: #7b8580; position: relative; }
.ficon::before { content: ""; position: absolute; top: 0; right: 0; border-style: solid; border-width: 0 16px 16px 0; border-color: transparent var(--surface-2) rgba(255,255,255,.35) transparent; }
.ficon.pdf { background: #c0453a; } .ficon.doc { background: #2f6db3; } .ficon.sheet { background: #2e7d4f; } .ficon.cad { background: #8a6bb0; }
.fcat .badge { max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }

/* report menu & import preview */
.reportopt { display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 12px 14px; width: 100%; }
.reportopt > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.reportopt .ricon { font-size: 1.4rem; line-height: 1; width: 28px; text-align: center; }
details.small ul { padding-left: 18px; margin: 6px 0 0; } details summary { cursor: pointer; }
.msgbox { border-radius: 10px; padding: 10px 14px; margin-top: 12px; font-size: .9rem; }
.msgbox ul { margin: 6px 0 0; padding-left: 18px; }
.msgbox.bad { background: color-mix(in srgb, var(--bad) 10%, transparent); color: var(--text); border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent); }
.msgbox.bad strong { color: var(--bad); }
.msgbox.warn { background: color-mix(in srgb, var(--warn) 10%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); }
table.list.compact td, table.list.compact th { padding: 7px 10px; }

/* printable report */
.report { max-width: 1100px; margin: 0 auto; padding: 20px 24px 40px; background: #fff; color: #1f2421; min-height: 100vh; }
.report .muted { color: #6b716c; }
.rtoolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 0 18px; border-bottom: 1px solid #e2e0d8; margin-bottom: 18px; }
.rtoolbar button { background: #fff; color: #1f2421; border-color: #d8d6ce; }
.rtoolbar button.primary { background: #2f5d50; border-color: #2f5d50; color: #fff; }
.rhead { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; border-bottom: 3px solid #2f5d50; padding-bottom: 10px; margin-bottom: 18px; }
.rhead h1 { margin: 2px 0 0; font-size: 1.6rem; }
.rbrand { color: #2f5d50; font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; }
.rboxes { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 18px; }
.rbox { border: 1px solid #e2e0d8; border-radius: 8px; padding: 10px 12px; break-inside: avoid; }
.rbox h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: #2f5d50; margin: 0 0 6px; }
.rkv { width: 100%; border-collapse: collapse; font-size: .88rem; }
.rkv td { padding: 2px 0; } .rkv td:first-child { color: #555; }
.rkv tr.tot td { font-weight: 700; border-top: 1px solid #e2e0d8; padding-top: 4px; color: #1f2421; }
.rkv tr.bad td:last-child { color: #b3261e; font-weight: 700; } .rkv tr.good td:last-child { color: #2e7d4f; font-weight: 700; }
.rsub { margin: 18px 0 8px; font-size: 1.1rem; }
.rsection { margin-top: 22px; }
.rsection h2 { font-size: 1.1rem; border-bottom: 1px solid #e2e0d8; padding-bottom: 4px; margin-bottom: 8px; }
.rcount { font-weight: 400; color: #6b716c; font-size: .85rem; }
.rtable { width: 100%; border-collapse: collapse; font-size: .82rem; }
.rtable th { text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: #6b716c; border-bottom: 1.5px solid #c9c7bf; padding: 5px 6px; }
.rtable td { padding: 4px 6px; border-bottom: 1px solid #eeede8; vertical-align: top; }
.rtable .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rtable td.nw { white-space: nowrap; }
.rtable td.notes { color: #555; max-width: 260px; }
.rtable tr.grp td { background: #f0efe9; font-weight: 700; color: #2f5d50; padding-top: 6px; }
.rtable tr.sub td { font-weight: 600; color: #444; border-bottom: 1.5px solid #c9c7bf; }
.rtable tfoot td { font-weight: 700; border-top: 2px solid #1f2421; border-bottom: 0; }
.rtable thead { display: table-header-group; }
.rtable tfoot { display: table-row-group; }
.rtable tr { break-inside: avoid; }
.rscroll { overflow-x: auto; }
@media (max-width: 700px) { .report { padding: 12px 16px 32px; } .rhead { flex-direction: column; align-items: flex-start; } .rhead > div:last-child { text-align: left !important; } }
@page { size: letter landscape; margin: 12mm; }
@media print {
  body { background: #fff; }
  .noprint, #toast, #modal-root { display: none !important; }
  .report { padding: 0; max-width: none; }
  .rsection { break-inside: auto; }
  .rscroll { overflow: visible; }
  .rsection h2 { break-after: avoid; }
}

/* plans */
.plangrid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.plancard { padding: 8px; gap: 6px; cursor: default; }
.plancard-main { all: unset; cursor: pointer; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.plancard-main:focus-visible { outline: 2px solid var(--accent); border-radius: 8px; }
.plancard .thumbwrap { background: #fff; border: 1px solid var(--border); }
.thumb.contain { object-fit: contain; }
.sheetno { display: inline-block; font-size: .75rem; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 0 5px; margin-right: 6px; vertical-align: 1px; }
.linkbtn { all: unset; color: inherit; text-decoration: underline; cursor: pointer; font-weight: 600; }

/* plan viewer */
body.pv-open { overflow: hidden; }
.pv { position: fixed; inset: 0; z-index: 40; background: #1b1e1d; color: #eef1ee; display: flex; flex-direction: column; }
.pv-top { display: flex; align-items: center; gap: 10px; padding: 8px 10px; padding-top: calc(8px + env(safe-area-inset-top)); background: #111413; border-bottom: 1px solid #2c312f; flex-wrap: wrap; }
.pv-title { display: flex; flex-direction: column; min-width: 0; flex: 1 1 160px; }
.pv-title strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-sub { font-size: .78rem; color: #9aa39d; }
.pv-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pv-group { display: inline-flex; align-items: center; gap: 2px; background: #232826; border-radius: 9px; padding: 2px; }
.pv-btn { background: #232826; color: #eef1ee; border: 1px solid #343a37; border-radius: 8px; min-height: 34px; padding: 4px 10px; font: inherit; font-size: .9rem; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.pv-group .pv-btn { border: 0; background: transparent; min-width: 34px; }
.pv-btn:hover { background: #2f3532; }
.pv-btn.active, .pv-add.active { background: #e0a24a; color: #1b1e1d; border-color: #e0a24a; }
.pv-btn.small { min-height: 28px; padding: 2px 8px; }
.pv-zoomlbl, .pv-pagelbl { font-size: .8rem; min-width: 48px; text-align: center; font-variant-numeric: tabular-nums; color: #c9cfcb; }
.pv-rev { width: auto; background: #232826; color: #eef1ee; border-color: #343a37; padding: 6px 8px; font-size: .9rem; }
.pv-banner { padding: 6px 14px; font-size: .85rem; background: #232826; color: #c9cfcb; border-bottom: 1px solid #2c312f; }
.pv-banner:empty { display: none; }
.pv-banner.old { background: #5a3d10; color: #ffe2b0; }
.pv-body { flex: 1; display: flex; min-height: 0; position: relative; }
.pv-stage { flex: 1; position: relative; overflow: hidden; touch-action: none; cursor: grab; background: #2a2f2d; user-select: none; -webkit-user-select: none; }
.pv-stage:active { cursor: grabbing; }
.pv.adding .pv-stage { cursor: crosshair; }
.pv-content { position: absolute; left: 0; top: 0; transform-origin: 0 0; box-shadow: 0 4px 30px rgba(0,0,0,.5); background: #fff; will-change: transform; }
.pv-surface, .pv-pins { position: absolute; inset: 0; }
.pv-canvas { width: 100%; height: 100%; display: block; pointer-events: none; }
.pv-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 20px; color: #c9cfcb; z-index: 2; pointer-events: auto; }
.pv-pin { position: absolute; width: 30px; height: 30px; margin: 0; padding: 0; border: 2px solid #fff; border-radius: 50% 50% 50% 0; transform: translate(-0%, -100%) scale(var(--inv, 1)) rotate(-45deg); transform-origin: 0 100%; background: #d9822b; color: #fff; font: 700 13px/1 system-ui, sans-serif; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.4); min-height: 0; }
.pv-pin span { transform: rotate(45deg); }
.pv-pin.resolved { background: #2e7d4f; opacity: .85; }
.pv-pin.focus { box-shadow: 0 0 0 4px rgba(255,255,255,.95), 0 0 0 7px #2c5d8f; z-index: 2; }
.pv-pin.temp { background: #b3261e; pointer-events: none; }
.pv-panel { width: 0; overflow: hidden; background: #151817; border-left: 1px solid #2c312f; display: flex; flex-direction: column; }
.pv.panel-open .pv-panel { width: 320px; }
.pv-panel-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid #2c312f; }
.pv-notes { overflow-y: auto; flex: 1; }
.pv-note { all: unset; display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid #23282600; border-top: 1px solid #222725; cursor: pointer; width: 100%; box-sizing: border-box; }
.pv-note:hover { background: #1f2422; }
.pv-note.resolved .pv-note-body > span:first-child { text-decoration: line-through; color: #9aa39d; }
.pv-note-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.pv-note .muted { color: #9aa39d; }
.pv-num { flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%; background: #d9822b; color: #fff; font-weight: 700; font-size: .78rem; display: flex; align-items: center; justify-content: center; }
.pv-num.resolved { background: #2e7d4f; }
.pv-hint { display: none; position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom)); background: #e0a24a; color: #1b1e1d; padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: .9rem; z-index: 3; pointer-events: none; }
.pv.adding .pv-hint { display: block; }
@media (max-width: 899px) {
  .pv.panel-open .pv-panel { position: absolute; left: 0; right: 0; bottom: 0; width: auto; max-height: 55%; border-left: 0; border-top: 1px solid #2c312f; border-radius: 14px 14px 0 0; z-index: 4; padding-bottom: env(safe-area-inset-bottom); }
  .pv-top { gap: 6px; }
  .pv-tools { width: 100%; }
  .pv-zoomlbl { min-width: 40px; }
}
@media (pointer: coarse) { .pv-zbtn, .pv-zoomlbl { display: none; } }

.resetreq { border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); background: color-mix(in srgb, var(--warn) 7%, var(--surface)); }

.forgotlinks { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.forgotlinks .btn { font-size: .9rem; min-height: 34px; padding: 6px 12px; }

/* affordability */
.atable { width: 100%; border-collapse: collapse; min-width: 720px; }
.atable .num .small { white-space: normal; max-width: 170px; margin-left: auto; }
.atable td:last-child { white-space: nowrap; }
.atable th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; padding: 10px 12px; background: var(--surface-2); }
.atable td { padding: 10px 12px; border-top: 1px solid var(--border); vertical-align: top; }
.atable .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.atable tr.plan td { background: var(--accent-soft); }
ul.advice { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 10px; }
ul.advice li { display: flex; gap: 10px; align-items: flex-start; line-height: 1.45; }
.aicon { flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700; color: #fff; background: var(--info); margin-top: 1px; }
ul.advice li.good .aicon { background: var(--good); } ul.advice li.warn .aicon { background: var(--warn); } ul.advice li.bad .aicon { background: var(--bad); }
.kv .k .small { font-weight: 400; }
@media (max-width: 700px) {
  .atable { min-width: 0; }
  .atable thead { display: none; }
  .atable, .atable tbody, .atable tr, .atable td { display: block; }
  .atable tr { border-top: 1px solid var(--border); padding: 10px 0; }
  .atable tr:first-child { border-top: 0; }
  .atable td { border: 0; padding: 3px 14px; }
  .atable td.num { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; }
  .atable td.num::before { content: attr(data-label); color: var(--muted); font-size: .85rem; }
  .atable td.num .small { width: 100%; max-width: none; text-align: right; }
  .atable td.verdict { padding-top: 6px; }
}

.atable tr td.shortcash, .atable tr.plan td.shortcash { color: var(--bad); font-weight: 650; background: color-mix(in srgb, var(--bad) 9%, transparent); }
.cashalert { border: 1px solid color-mix(in srgb, var(--bad) 45%, var(--border)); background: color-mix(in srgb, var(--bad) 9%, var(--surface)); color: var(--text); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; display: grid; gap: 4px; }
.cashalert > strong:first-child { color: var(--bad); }
.atable .verdicts { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.atable td.rowhead { min-width: 130px; }
.atable .breakdown { line-height: 1.35; margin-top: 2px; }
.atable .num .breakdown { max-width: none; white-space: nowrap; }
.atable th, .atable td { padding-left: 9px; padding-right: 9px; }
