:root {
  /* Working tool: left rail for the six areas, a scan-first canvas; the site map runs full-bleed with a room panel. */
  --bg: #edf0f2;
  --surface: #ffffff;
  --surface-2: #f5f7f8;
  --ink: #15212b;
  --muted: #5a6773;
  --line: #d6dde2;
  --accent: #0c6780;
  --accent-ink: #ffffff;
  --accent-soft: #d9ebf0;
  --red: #c4372d;
  --red-soft: #f8e1df;
  --amber: #b97700;
  --amber-soft: #fbedd1;
  --green: #2a8352;
  --green-soft: #dcf0e4;
  --grey: #87929c;
  --grey-soft: #e7ebee;
  --done: #4867a0;
  --done-soft: #e1e8f5;
  --plan-bg: #ffffff;
  --font-display: "IBM Plex Sans Condensed", "Segoe UI Semibold", "Segoe UI", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --radius: 6px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f161c; --surface: #172129; --surface-2: #1c2831; --ink: #e4eaee; --muted: #9aa8b3; --line: #2c3a45;
    --accent: #4fb3cf; --accent-ink: #062029; --accent-soft: #163a46;
    --red: #ef7468; --red-soft: #3d1f1d; --amber: #e3a940; --amber-soft: #3a2d12; --green: #5cc58a; --green-soft: #173325;
    --grey: #8794a0; --grey-soft: #25313a; --done: #8fa9dc; --done-soft: #1f2a40; --plan-bg: #d9dee2;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f161c; --surface: #172129; --surface-2: #1c2831; --ink: #e4eaee; --muted: #9aa8b3; --line: #2c3a45;
  --accent: #4fb3cf; --accent-ink: #062029; --accent-soft: #163a46;
  --red: #ef7468; --red-soft: #3d1f1d; --amber: #e3a940; --amber-soft: #3a2d12; --green: #5cc58a; --green-soft: #173325;
  --grey: #8794a0; --grey-soft: #25313a; --done: #8fa9dc; --done-soft: #1f2a40; --plan-bg: #d9dee2;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 var(--font-body); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; letter-spacing: 0.005em; }
h1 { font-size: 24px; font-weight: 600; }
h2 { font-size: 18px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
.mono { font-family: var(--font-mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

.app { display: grid; grid-template-columns: 208px 1fr; height: 100%; }
.rail { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; padding: 16px 10px; }
.brand { padding: 4px 10px 16px; border-bottom: 1px solid var(--line); margin-bottom: 8px; display: flex; align-items: center; gap: 10px; min-width: 0; }
.brandtext { min-width: 0; }
.brandlogo { flex: none; display: block; max-height: 40px; max-width: 72px; object-fit: contain; }
.brandlogo.big { max-height: 56px; max-width: 180px; }
.brand b { display: block; font-family: var(--font-display); font-size: 17px; font-weight: 700; letter-spacing: 0.02em; }
.brand span { font-size: 12px; color: var(--muted); }
.nav a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: var(--radius); color: var(--ink); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--surface-2); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.nav .count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav a[aria-current="page"] .count { color: var(--accent); }
.rail .foot { margin-top: auto; padding: 10px; font-size: 12px; color: var(--muted); display: grid; gap: 6px; }
.live { display: inline-flex; align-items: center; gap: 6px; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--grey); display: inline-block; }
.live.ok i { background: var(--green); }
.live.bad i { background: var(--red); }

main { overflow: auto; min-width: 0; position: relative; }
.page { padding: 22px 28px 48px; display: grid; gap: 22px; max-width: 2200px; margin: 0 auto; }
.pagehead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.pagehead p { margin: 4px 0 0; color: var(--muted); }
.banner { padding: 10px 14px; border-radius: var(--radius); background: var(--amber-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--amber) 40%, transparent); }
.banner.info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; min-width: 0; }
.card > h2, .card > h3 { margin-bottom: 12px; }
.cardhead { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 18px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; border-left: 4px solid var(--line); display: grid; gap: 2px; }
.tile b { font: 600 26px/1.1 var(--font-display); font-variant-numeric: tabular-nums; }
.tile span { color: var(--muted); font-size: 12.5px; }
.tile.red { border-left-color: var(--red); } .tile.amber { border-left-color: var(--amber); } .tile.green { border-left-color: var(--green); }
.tile.accent { border-left-color: var(--accent); } .tile.done { border-left-color: var(--done); }
button.tile { text-align: left; cursor: pointer; }
button.tile:hover { border-color: var(--accent); }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 500; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--red); }
.btn.small { padding: 4px 9px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar .grow { flex: 1 1 220px; }
input:not([type]), input[type="search"], input[type="text"], input[type="email"], input[type="password"], input[type="date"], select, textarea {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 7px 9px; min-width: 0; }
textarea { resize: vertical; width: 100%; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 6px 11px; cursor: pointer; border-right: 1px solid var(--line); font-weight: 500; }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--grey-soft); color: var(--ink); }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.amber { background: var(--amber-soft); color: var(--amber); }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.done { background: var(--done-soft); color: var(--done); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.dot.red { background: var(--red); } .dot.amber { background: var(--amber); } .dot.green { background: var(--green); } .dot.done { background: var(--done); } .dot.none { background: var(--grey); }

table { border-collapse: collapse; width: 100%; }
.tablewrap { overflow-x: auto; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: none; white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-2); }

/* tasks */
.wsgroup { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.wshead { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.wshead h3 { flex: 1 1 auto; }
.wshead .stat { font-size: 12.5px; color: var(--muted); }
.trow { display: grid; grid-template-columns: 4px 26px 22px 74px minmax(220px, 1fr) 150px 120px 110px 92px; align-items: center; gap: 10px; padding: 8px 14px 8px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.trow:last-child { border-bottom: 0; }
.trow:hover { background: var(--surface-2); }
.trow .stripe { align-self: stretch; }
.trow .stripe.red { background: var(--red); } .trow .stripe.amber { background: var(--amber); } .trow .stripe.green { background: var(--green); } .trow .stripe.done { background: var(--done); } .trow .stripe.none { background: var(--grey-soft); }
.trow .ttl { min-width: 0; }
.trow .ttl div { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.trow .ttl small { color: var(--muted); }
.trow.sub { background: var(--surface-2); }
.trow.sub .ref { padding-left: 12px; }
.caret { border: 0; background: transparent; cursor: pointer; width: 22px; height: 22px; border-radius: 4px; color: var(--muted); }
.caret:hover { background: var(--grey-soft); }
.owner.none { color: var(--red); font-weight: 500; }
.due.over { color: var(--red); font-weight: 600; }
.due.soon { color: var(--amber); font-weight: 600; }
.prog { display: grid; gap: 3px; font-size: 12px; color: var(--muted); }
.bar { height: 6px; border-radius: 3px; background: var(--grey-soft); overflow: hidden; display: flex; }
.bar i { display: block; height: 100%; }
.bar i.green { background: var(--green); } .bar i.amber { background: var(--amber); } .bar i.red { background: var(--red); } .bar i.done { background: var(--done); } .bar i.none { background: var(--grey); } .bar i.accent { background: var(--accent); }

/* drawer */
.scrim { position: fixed; inset: 0; background: rgba(10, 20, 28, .35); z-index: 20; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100%); background: var(--surface); border-left: 1px solid var(--line); z-index: 21; display: flex; flex-direction: column; box-shadow: -10px 0 30px rgba(0,0,0,.12); }
.drawer header { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: flex-start; }
.drawer header h2 { flex: 1; }
.drawer .body { overflow: auto; padding: 16px 18px 40px; display: grid; gap: 20px; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form label { display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.form label.full { grid-column: 1 / -1; }
.form input, .form select, .form textarea { color: var(--ink); font-size: 14px; width: 100%; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.updates { display: grid; gap: 10px; }
.update { border-left: 3px solid var(--line); padding: 2px 0 2px 10px; }
.update .who { font-size: 12px; color: var(--muted); }
.update.note { border-left-color: var(--accent); }
.subrow { display: grid; grid-template-columns: 22px 1fr auto auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.subrow:last-child { border-bottom: 0; }
.subrow button.link { border: 0; background: none; padding: 0; text-align: left; cursor: pointer; color: var(--ink); }
.subrow button.link:hover { color: var(--accent); text-decoration: underline; }
.addsub { display: grid; grid-template-columns: 1fr 140px 140px auto; gap: 8px; margin-top: 10px; }

/* map */
.maplayout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; grid-template-rows: auto minmax(0, 1fr); height: 100%; }
.maplayout > * { min-height: 0; }
#mdept { max-width: 240px; }
.mapbar { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 14px; background: var(--surface); border-bottom: 1px solid var(--line); }
.floors { display: flex; gap: 4px; flex-wrap: wrap; }
.floors button { border: 1px solid var(--line); background: var(--surface); padding: 4px 8px; border-radius: var(--radius); cursor: pointer; font-weight: 600; font-family: var(--font-mono); font-size: 12.5px; display: grid; line-height: 1.15; text-align: center; min-width: 40px; }
.floors button small { font: 400 10.5px var(--font-body); color: var(--muted); }
.floors button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.floors button[aria-pressed="true"] small { color: var(--accent-ink); }
.mapstage { position: relative; overflow: hidden; background: var(--plan-bg); min-height: 360px; }
#plan { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; user-select: none; }
#plan.dragging { cursor: grabbing; }
#plan path.rm { fill-rule: evenodd; stroke: rgba(20,33,43,.35); stroke-width: .6; vector-effect: non-scaling-stroke; cursor: pointer; transition: fill-opacity .15s; }
#plan path.rm.infra { cursor: default; }
#plan path.rm:hover { stroke: #0c6780; stroke-width: 2; }
#plan path.rm.sel { stroke: #0c6780; stroke-width: 3.5; fill-opacity: .8 !important; }
#plan path.rm.hit { stroke: #b6283a; stroke-width: 3; }
#plan path.rm.multi { stroke: #b6283a; stroke-width: 2.5; stroke-dasharray: 5 3; fill-opacity: .75 !important; }
#plan .badge circle { fill: #0c6780; stroke: #fff; stroke-width: 1.2; vector-effect: non-scaling-stroke; }
#plan .badge text { fill: #fff; font: 600 7px var(--font-body); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
#plan .badge { pointer-events: none; }
#plan .resus path { fill: #c4372d; stroke: #fff; stroke-width: 1; vector-effect: non-scaling-stroke; }
.mapctl { position: absolute; right: 12px; top: 12px; display: grid; gap: 4px; }
.mapctl button { width: 34px; height: 34px; border-radius: var(--radius); border: 1px solid #c6ced5; background: #fff; color: #15212b; cursor: pointer; font-size: 16px; font-weight: 600; }
.legend { position: absolute; left: 12px; bottom: 12px; background: rgba(255,255,255,.94); color: #15212b; border: 1px solid #c6ced5; border-radius: var(--radius); padding: 8px 10px; font-size: 12px; display: grid; gap: 4px; max-width: 320px; max-height: 45%; overflow: auto; }
.legend div { display: flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 10px; border-radius: 2px; border: 1px solid rgba(0,0,0,.2); flex: none; }
.tip { position: absolute; pointer-events: none; background: #15212b; color: #fff; padding: 6px 8px; border-radius: 5px; font-size: 12px; max-width: 280px; z-index: 5; }
.roompanel { border-left: 1px solid var(--line); background: var(--surface); overflow: auto; padding: 16px; display: grid; gap: 16px; align-content: start; }
.roompanel h2 { font-size: 20px; }
.kv { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); }
.checks { display: grid; gap: 6px; }
.check { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; }
.check .seg button { padding: 3px 9px; font-size: 12.5px; }
.check .seg button[aria-pressed="true"].ok { background: var(--green); color: #fff; }
.check .seg button[aria-pressed="true"].gap { background: var(--red); color: #fff; }
.check .seg button[aria-pressed="true"].unk { background: var(--grey); color: #fff; }
.devlist { display: grid; gap: 0; }
.dev { display: grid; grid-template-columns: 64px 1fr; gap: 2px 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.dev .tags { grid-column: 2; display: flex; flex-wrap: wrap; gap: 4px; }
.search-results { position: absolute; top: 100%; left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.12); z-index: 10; max-height: 340px; overflow: auto; }
.search-results button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 7px 10px; cursor: pointer; border-bottom: 1px solid var(--line); }
.search-results button:hover, .search-results button:focus { background: var(--surface-2); }
.rel { position: relative; }

.empty { padding: 22px; text-align: center; color: var(--muted); }
.list { display: grid; }
.li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line); }
.li:last-child { border-bottom: 0; }
.dialog { position: fixed; inset: 0; display: grid; place-items: center; z-index: 40; background: rgba(10,20,28,.4); }
.dialog .box { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 18px 20px; width: min(440px, calc(100% - 32px)); display: grid; gap: 14px; }
.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: 90%; pointer-events: none; }
.toast { pointer-events: auto; background: var(--ink); color: var(--bg); padding: 9px 14px; border-radius: 6px; font-size: 13px; display: flex; gap: 14px; align-items: center; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.toastbtn { background: transparent; border: 1px solid currentColor; color: inherit; border-radius: 4px; padding: 2px 10px; cursor: pointer; font-weight: 600; }
.tick { width: 18px; height: 18px; accent-color: var(--done); cursor: pointer; margin: 0; }
.deptrow { display: grid; grid-template-columns: 14px 1fr; gap: 8px; align-items: center; }
.swatch { width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(0,0,0,.2); display: inline-block; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 8px; border: 1px solid var(--line); border-radius: 999px; font-size: 12.5px; background: var(--surface-2); }
.chip button { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0 4px; font-size: 14px; line-height: 1; }
.stage-sel { min-width: 150px; }
#delBody td:nth-child(4) { min-width: 160px; }
.inline-in { width: 100%; min-width: 90px; padding: 4px 6px !important; font-size: 13px; }
.stagebar { display: grid; grid-template-columns: repeat(6, minmax(110px, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.stagebar button { border: 0; border-right: 1px solid var(--line); background: transparent; padding: 10px 12px; text-align: left; cursor: pointer; display: grid; gap: 2px; }
.stagebar button:last-child { border-right: 0; }
.stagebar button b { font: 600 22px var(--font-display); font-variant-numeric: tabular-nums; }
.stagebar button span { font-size: 12px; color: var(--muted); }
.stagebar button[aria-pressed="true"] { background: var(--accent-soft); }
.wsprog { display: grid; grid-template-columns: minmax(160px, 1.3fr) 2fr 70px; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.wsprog:last-child { border-bottom: 0; }

@media (max-width: 1100px) {
  .maplayout { grid-template-columns: 1fr; grid-template-rows: auto 60vh auto; height: auto; }
  .roompanel { border-left: 0; border-top: 1px solid var(--line); }
  .trow { grid-template-columns: 4px 26px 22px 70px 1fr 110px 92px; }
  .trow .c-owner, .trow .c-prog { display: none; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr !important; grid-template-rows: auto minmax(0, 1fr) !important; }
  .rail { width: auto; overflow-y: visible; }
  .rail { flex-direction: row; overflow-x: auto; padding: 8px 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand, .rail .foot { display: none; }
  .nav { display: flex; gap: 4px; }
  .nav a { white-space: nowrap; }
  .page { padding: 16px; }
  .grid2 { grid-template-columns: 1fr; }
  .form { grid-template-columns: 1fr; }
  .trow { grid-template-columns: 4px 26px 22px 1fr 92px; }
  .trow .ref, .trow .c-due { display: none; }
  .addsub { grid-template-columns: 1fr; }
  .stagebar { grid-template-columns: repeat(3, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* sign-in page */
.loginpage { display: grid; place-items: center; min-height: 100%; padding: 24px; }
.loginbox { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 26px 28px; display: grid; gap: 16px; }
.loginbox form { display: grid; gap: 14px; }
.loginbox label { display: grid; gap: 5px; font-size: 13px; color: var(--muted); font-weight: 500; }
.loginbox input { font-size: 15px; padding: 9px 10px; color: var(--ink); }
.loginbox .btn { justify-content: center; padding: 9px 12px; }
.loginmsg { margin: 0; padding: 9px 12px; border-radius: 6px; background: var(--red-soft); color: var(--red); }
.small { font-size: 12.5px; }
/* user box, documents, admin */
.userbox { display: grid; gap: 6px; padding: 10px; border-top: 1px solid var(--line); }
.userbox b { font-size: 13.5px; }
.userbox .actions { gap: 6px; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; font-size: 12.5px; }
.dropzone { border: 2px dashed var(--line); border-radius: 8px; padding: 14px; display: grid; gap: 8px; text-align: center; background: var(--surface-2); transition: border-color .15s, background .15s; }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; }
.dropzone input[type=file] { display: none; }
.uplist { display: grid; gap: 4px; text-align: left; font-size: 12.5px; }
.uplist .bar { height: 4px; }
.files { display: grid; }
.file { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.file:last-child { border-bottom: 0; }
.ficon { width: 34px; height: 40px; border-radius: 4px; display: grid; place-items: center; font: 600 10px var(--font-mono); color: #fff; text-transform: uppercase; }
.file a.fname { font-weight: 500; word-break: break-word; }
.file small { color: var(--muted); }
.file .acts { display: flex; gap: 6px; align-items: center; }
.file select { padding: 3px 6px; font-size: 12.5px; }
.doccount { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; }

/* ===================== cloud version: friendlier layout ===================== */
body { font-size: 15px; }
.rail { width: 220px; }
.app { grid-template-columns: 220px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); height: 100vh; height: 100dvh; }
.rail { overflow-y: auto; }
.nav a { padding: 9px 10px; gap: 10px; justify-content: flex-start; }
.nav a .count { margin-left: auto; }
.nav svg, .btn svg, .iconbtn svg { width: 17px; height: 17px; flex: none; }
.nav a svg { color: var(--muted); }
.nav a[aria-current="page"] svg { color: var(--accent); }
.btn { padding: 8px 13px; }
.btn.small { padding: 5px 10px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--line); }
.iconbtn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 6px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; }
.iconbtn:hover { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
.iconbtn.danger:hover { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.pagehead h1 { font-size: 26px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs a { padding: 9px 14px; text-decoration: none; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
.tabs a:hover { color: var(--ink); }
.rowacts { display: flex; gap: 2px; justify-content: flex-end; opacity: .55; }
.trow:hover .rowacts, .trow:focus-within .rowacts { opacity: 1; }
.trow { grid-template-columns: 4px 26px 22px 74px minmax(220px, 1fr) 150px 110px 104px 70px; }
@media (max-width: 1100px) { .trow { grid-template-columns: 4px 26px 22px 70px 1fr 110px 104px 70px; } }
@media (max-width: 760px) { .trow { grid-template-columns: 4px 26px 22px 1fr 70px; } .trow .c-status { display: none; } }
/* facts grid in the task panel */
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; }
.facts div { display: grid; gap: 2px; }
.facts dt { font-size: 12px; color: var(--muted); font-weight: 500; }
.facts dd { margin: 0; white-space: pre-wrap; word-break: break-word; }
.facts .full { grid-column: 1 / -1; }
@media (max-width: 600px) { .facts { grid-template-columns: 1fr; } }
/* updates and documents thread */
.thread { display: grid; gap: 14px; }
.compose { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); display: grid; transition: border-color .15s, box-shadow .15s; }
.compose:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.compose.over { border-color: var(--accent); background: var(--accent-soft); }
.compose textarea { border: 0; border-radius: 8px 8px 0 0; padding: 11px 12px; min-height: 64px; background: transparent; }
.compose textarea:focus { outline: none; }
.compose .bar2 { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 10px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 8px 8px; }
.compose .bar2 .grow { flex: 1; }
.compose input[type=file] { display: none; }
.pending { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 10px 8px; }
.pending:empty { display: none; }
.upd { display: grid; grid-template-columns: 34px 1fr; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font: 600 12.5px var(--font-body); color: #fff; background: var(--accent); flex: none; }
.upd .head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.upd .head b { font-weight: 600; }
.upd .head small { color: var(--muted); }
.upd .text { white-space: pre-wrap; word-break: break-word; margin-top: 2px; }
.upd .acts { display: flex; gap: 2px; margin-left: auto; }
.attach { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.fchip { display: inline-flex; align-items: center; gap: 8px; padding: 5px 8px 5px 5px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); cursor: pointer; max-width: 100%; font-size: 13px; text-align: left; color: var(--ink); }
.fchip:hover { border-color: var(--accent); }
.fchip .ficon { width: 28px; height: 32px; font-size: 9px; }
.fchip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
.fchip small { color: var(--muted); }
.fchip .x { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 15px; padding: 0 2px; }
/* settings */
.mgrid { display: grid; gap: 0; }
.mrow { display: grid; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.mrow:last-child { border-bottom: 0; }
.mrow.head { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--surface-2); }
.dept-row { grid-template-columns: 44px minmax(160px, 1fr) 190px 70px 190px; }
.mrow .n { text-align: right; font-variant-numeric: tabular-nums; }
.mrow .rowacts { justify-content: flex-end; }
.mrow select { width: 100%; }
.ws-row { grid-template-columns: minmax(200px, 1fr) 90px auto; }
.ppl-row { grid-template-columns: minmax(160px, 1fr) minmax(160px, 1fr) 170px auto; }
.room-row { grid-template-columns: 26px 110px minmax(140px, 1fr) 50px 60px minmax(220px, 320px) 40px; }
input[type=color] { width: 40px; height: 32px; padding: 2px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); cursor: pointer; }
.inline { border: 1px solid transparent; background: transparent; padding: 5px 7px; border-radius: 5px; width: 100%; }
.inline:hover { border-color: var(--line); background: var(--surface); }
.inline:focus { border-color: var(--accent); background: var(--surface); outline: none; }
.bulkbar { position: sticky; bottom: 12px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.bulkbar select { color: var(--ink); }
.notice { padding: 12px 14px; border-radius: 8px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.notice.warn { background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 35%, transparent); }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.progress { height: 8px; border-radius: 4px; background: var(--grey-soft); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); transition: width .2s; }
.center-screen { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.panel { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 26px 28px; display: grid; gap: 16px; }
.panel form { display: grid; gap: 14px; }
.panel label { display: grid; gap: 5px; font-size: 13px; color: var(--muted); font-weight: 500; }
.panel input { font-size: 15px; padding: 9px 10px; color: var(--ink); }
.panel .btn { justify-content: center; }
.err { margin: 0; padding: 9px 12px; border-radius: 6px; background: var(--red-soft); color: var(--red); }
.ok { margin: 0; padding: 9px 12px; border-radius: 6px; background: var(--green-soft); color: var(--green); }
.swatches { display: flex; flex-wrap: wrap; gap: 4px; }
.swatches button { width: 20px; height: 20px; border-radius: 4px; border: 1px solid rgba(0,0,0,.2); cursor: pointer; padding: 0; }
.drawer .body { gap: 22px; }
.drawer header .actions { flex-wrap: wrap; justify-content: flex-end; }
.kv .pill { font-size: 12.5px; }

@media (max-width: 760px) {
  .rail { width: auto; overflow-x: auto; overflow-y: visible; }
  .nav a { padding: 8px 10px; }
  .dept-row { grid-template-columns: 44px minmax(120px, 1fr) 70px; }
  .dept-row > select, .dept-row > .rowacts { grid-column: span 3; }
  .room-row { grid-template-columns: 26px 1fr; }
  .room-row > * { grid-column: span 1; }
  .ppl-row { grid-template-columns: 1fr; }
}

/* drawer header + misc fixes */
.drawer header.dhead { display: grid; gap: 8px; padding: 12px 18px 14px; }
.drawer header.dhead h2 { font-size: 19px; line-height: 1.3; }
.drawer header.dhead .actions { justify-content: flex-start; }
.dtop { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 30px; }
.drawer .body > * { min-width: 0; }
.compose .cat { max-width: 210px; }
svg.ic { width: 17px; height: 17px; flex: none; }
.dropzone svg.ic { width: 20px; height: 20px; }
.addsub { grid-template-columns: minmax(0, 1fr) 130px 150px auto; }
.addsub > * { min-width: 0; }
input.inline { border-color: transparent; background: transparent; }
input.inline:hover { border-color: var(--line); background: var(--surface); }
input.inline:focus { border-color: var(--accent); background: var(--surface); }

/* ===================== 1:50 drawing dock ===================== */
.dock { position: absolute; top: 0; right: 0; bottom: 0; width: 50%; min-width: 420px; background: var(--surface); border-left: 2px solid var(--accent); display: flex; flex-direction: column; z-index: 6; box-shadow: -6px 0 18px rgba(0,0,0,.08); }
.dock[hidden] { display: none; }
.dock.full { position: fixed; inset: 0; width: auto; min-width: 0; z-index: 40; border-left: 0; }
.mapstage.docked .mapctl { right: calc(max(50%, 420px) + 12px); }
.dockhead { display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--line); min-height: 48px; }
.dockt { min-width: 0; line-height: 1.3; }
.dockt b { font-family: var(--font-mono); font-size: 13px; }
.dockt span { font-weight: 600; }
.dockt small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dockbtns { display: flex; gap: 2px; flex: none; }
.dockbtns .iconbtn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.docktabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.docktabs button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 10px; font-size: 12.5px; cursor: pointer; }
.docktabs button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.dockbody { position: relative; flex: 1; min-height: 0; background: #e9edf0; }
#sheetSvg { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; user-select: none; }
#sheetSvg.dragging { cursor: grabbing; }
#sheetSvg .shsel { fill: rgba(12, 103, 128, .16); stroke: #0c6780; stroke-width: 3; vector-effect: non-scaling-stroke; pointer-events: none; }
#sheetSvg .shring { fill: none; stroke: #d2462f; stroke-width: 3; vector-effect: non-scaling-stroke; pointer-events: none; animation: ringpulse 1.6s ease-in-out infinite; }
#sheetSvg .shring.est { stroke-dasharray: 6 5; }
@keyframes ringpulse { 0%, 100% { stroke-opacity: 1; } 50% { stroke-opacity: .35; } }
@media (prefers-reduced-motion: reduce) { #sheetSvg .shring { animation: none; } }
#sheetSvg .shr path, #sheetSvg .shr circle { fill: transparent; stroke: transparent; stroke-width: 2; vector-effect: non-scaling-stroke; cursor: pointer; }
#sheetSvg .shr:hover path, #sheetSvg .shr:hover circle { fill: rgba(12, 103, 128, .08); stroke: rgba(12, 103, 128, .7); }
.dockload { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; font-size: 13.5px; box-shadow: 0 4px 14px rgba(0,0,0,.08); max-width: 80%; text-align: center; }
.docknote { position: absolute; left: 10px; bottom: 10px; right: 10px; font-size: 12px; color: var(--muted); pointer-events: none; text-shadow: 0 0 4px #fff, 0 0 4px #fff; }
.dockmsg { padding: 18px; }
.dockmsg p { margin: 0 0 8px; }
@media (max-width: 1100px) {
  .dock:not([hidden]) { position: fixed; inset: auto 0 0 0; height: 70vh; width: auto; min-width: 0; border-left: 0; border-top: 2px solid var(--accent); z-index: 40; }
  .mapstage.docked .mapctl { right: 12px; }
}

/* ===================== my tasks ===================== */
.mycard .cardhead h2 { display: flex; align-items: center; gap: 8px; }
.myadd { display: grid; grid-template-columns: minmax(0, 1fr) 150px auto auto; gap: 8px; align-items: center; }
.myadd > * { min-width: 0; }
.flagtoggle { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 10px; background: var(--surface); cursor: pointer; font-size: 13.5px; color: var(--muted); }
.flagtoggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.flagtoggle:has(input:checked) { border-color: #c4372d; color: #c4372d; background: #fdecea; }
.flagtoggle:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.mylist { display: grid; }
.myrow { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto 40px; gap: 10px; align-items: center; padding: 9px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.myrow:last-child { border-bottom: 0; }
.myrow:hover { background: var(--surface-2); }
.myrow .ttl div { font-weight: 500; display: flex; align-items: center; gap: 6px; }
.myrow .ttl small { color: var(--muted); display: block; margin-top: 2px; }
.myrow.done .ttl div { text-decoration: line-through; color: var(--muted); font-weight: 400; }
.myrow .hi { color: #c4372d; display: inline-flex; }
.myrow .hi svg.ic { width: 15px; height: 15px; }
.myrow input[type=checkbox], .trow input[type=checkbox] { width: 18px; height: 18px; }
.pill.private { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); display: inline-flex; align-items: center; gap: 5px; }
.pill.private svg.ic { width: 13px; height: 13px; }
.fchipwrap { display: inline-flex; align-items: center; gap: 2px; }
.dropzone.small { padding: 10px; }
.mytodo-banner { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
@media (max-width: 760px) { .myadd { grid-template-columns: 1fr 1fr; } .myadd input[name=title] { grid-column: 1 / -1; } }
.mysum { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); text-decoration: none; }
.mysum:hover { border-color: var(--accent); }
.mysum .grow { flex: 1; }
.mysum > span:last-child { color: var(--accent); font-weight: 600; white-space: nowrap; }
a.btn { text-decoration: none; }
.dockhead .grow { flex: 1; }
.docknote { left: 10px; right: auto; max-width: calc(100% - 20px); width: fit-content; background: rgba(255,255,255,.88); border-radius: 6px; padding: 4px 8px; text-shadow: none; }
.docknote:empty { display: none; }
.dialog.viewer .box { width: min(1100px, 96vw); max-width: none; height: min(88vh, 900px); display: flex; flex-direction: column; padding: 0; gap: 0; }
.vhead { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.vhead b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vhead .grow { flex: 1; }
.vbody { flex: 1; min-height: 0; display: grid; place-items: center; background: var(--surface-2); overflow: auto; }
.vbody img { max-width: 100%; max-height: 100%; object-fit: contain; }
.vbody iframe { width: 100%; height: 100%; border: 0; background: #fff; }

/* ===================== pins ===================== */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pin { cursor: pointer; }
.pin path { stroke: #fff; stroke-width: 1.6; filter: drop-shadow(0 1px 1.5px rgba(0,0,0,.45)); }
.pin text { fill: #fff; font: 700 8.5px/1 system-ui, sans-serif; text-anchor: middle; dominant-baseline: middle; pointer-events: none; }
.pin:hover path, .pin.on path { stroke: #15212b; stroke-width: 2.2; }
.pin.drag { cursor: grabbing; opacity: .85; }
.pinchip { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 10px 10px 10px 2px; color: #fff; font: 700 11px/1 system-ui, sans-serif; flex: none; vertical-align: middle; margin-right: 6px; }
.pincard { position: fixed; z-index: 55; width: 300px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 28px rgba(0,0,0,.18); padding: 12px 14px; display: grid; gap: 8px; }
.pincard label { display: grid; gap: 3px; font-size: 12.5px; color: var(--muted); }
.pincard .pchead { display: flex; align-items: center; gap: 4px; }
.pincard .pchead .grow { flex: 1; }
.pincard .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pinmenu { position: fixed; z-index: 55; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 28px rgba(0,0,0,.16); padding: 6px; display: grid; min-width: 250px; }
.pinmenu button { display: flex; align-items: center; gap: 4px; border: 0; background: transparent; padding: 7px 8px; border-radius: 6px; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.pinmenu button:hover, .pinmenu button:focus-visible { background: var(--surface-2); }
.placehint { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 8; background: #15212b; color: #fff; border-radius: 999px; padding: 6px 8px 6px 16px; display: flex; align-items: center; gap: 10px; font-size: 13.5px; box-shadow: 0 6px 18px rgba(0,0,0,.2); }
.placehint[hidden] { display: none; }
.placehint b { color: #ffd479; }
.mapstage.placing #plan, .dock.placing #sheetSvg { cursor: crosshair; }
.mapstage.docked .placehint { left: calc((100% - max(50%, 420px)) / 2); }
.legend .pinleg { display: flex; align-items: center; gap: 2px; cursor: pointer; font-size: 12.5px; }
.legend .pinleg input { margin: 0 4px 0 0; }
.legend .pinleg .pinchip { min-width: 16px; height: 16px; font-size: 9.5px; margin-right: 4px; }
.resussum { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 8px; font-size: 13px; }
.pinli { grid-template-columns: auto 1fr auto !important; }
.pt-row { grid-template-columns: 44px 60px minmax(160px, 1fr) 90px 60px 50px; }
.inline-check { display: flex; justify-content: center; }
/* ===================== rooms & departments on tasks ===================== */
.picker { display: grid; gap: 10px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--surface-2); }
.pickrow { display: grid; gap: 6px; }
.pickrow > label { font-size: 12.5px; color: var(--muted); }
.pickctl { display: flex; gap: 6px; }
.pickctl input, .pickctl select { flex: 1; min-width: 0; }
.chip.linkchip { text-decoration: none; color: var(--ink); display: inline-flex; align-items: center; gap: 5px; }
.chip.linkchip:hover { border-color: var(--accent); }
.facts dd.chips { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 760px) { .pt-row { grid-template-columns: 44px 52px 1fr; } .pt-row > :nth-child(n+4) { grid-column: span 1; } }

/* first-time connection helper */
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.checks li { display: grid; gap: 3px; padding: 9px 12px 9px 36px; border-radius: 6px; position: relative; font-size: 14px; background: var(--grey-soft); }
.checks li span { color: var(--ink); font-size: 13px; }
.checks li::before { position: absolute; left: 12px; top: 9px; font-weight: 700; }
.checks li.yes { background: var(--green-soft); } .checks li.yes::before { content: '✓'; color: var(--green); }
.checks li.no { background: var(--red-soft); } .checks li.no::before { content: '✕'; color: var(--red); }
.checks li.warn { background: var(--amber-soft); } .checks li.warn::before { content: '!'; color: var(--amber); }
.checks li.wait::before { content: '…'; }
.cfgdone { display: grid; gap: 12px; }
.cfgdone .steps .btn { justify-content: flex-start; }
.cfgpre { margin: 8px 0 0; padding: 10px; background: var(--grey-soft); border-radius: 6px; font-size: 11.5px; white-space: pre-wrap; word-break: break-all; max-height: 220px; overflow: auto; }
.panel details summary { cursor: pointer; color: var(--accent); }

/* name & logo settings */
.brgrid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.brfields { display: grid; gap: 14px; }
.brfields label:not(.btn):not(.inline-check) { display: grid; gap: 5px; font-size: 13px; color: var(--muted); font-weight: 500; }
.lbl { font-size: 13px; color: var(--muted); font-weight: 500; }
.brprev { margin-top: 5px; display: grid; gap: 12px; }
.brprev > .brand { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin: 0; }
.brprev2 { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
@media (max-width: 760px) { .brgrid { grid-template-columns: 1fr; } }
.brfields .inline-check { justify-self: start; display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); }
.brand:has(.brandlogo.big) { flex-direction: column; align-items: flex-start; gap: 6px; }
.rail .brandlogo.big { max-width: 100%; }

.tabmock { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #dfe3e8; padding: 8px 8px 0; }
.tabmock-tab { display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 8px 8px 0 0; padding: 7px 10px; width: 230px; font-size: 12px; color: #202124; }
.tabmock-tab img { width: 16px; height: 16px; flex: none; }
.tabmock-tab span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tabmock-tab i { font-style: normal; color: #5f6368; }
.tabmock-bar { height: 10px; background: #fff; }
