:root {
  --ink: #0b0d0c; --paper: #e9e9e6; --card: #f6f6f3; --line: #c9ccc6;
  --muted: #565b55; --accent: #e3a27a; --accent-dark: #8a4a22; --night-line: #2a2e2b;
  --sans: 'Space Grotesk', Arial, sans-serif; --mono: 'IBM Plex Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--sans); color: var(--ink); background: var(--paper); font-size: 16px; line-height: 1.5; }
a { color: inherit; }
.loading { padding: 48px; font-family: var(--mono); color: var(--muted); }
.label { margin: 0; font-family: var(--mono); font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); }
h1 { margin: 0; font-size: 36px; font-weight: 400; letter-spacing: -1px; line-height: 1.15; }
h2 { margin: 0; font-size: 22px; font-weight: 500; }

/* Sign-in */
.signin { min-height: 100vh; background: var(--ink); color: #ececE8; display: flex; flex-direction: column; padding: 24px 32px; }
.signin .brand { font-size: 20px; font-weight: 600; letter-spacing: 1px; text-decoration: none; padding: 12px 0; align-self: flex-start; }
.signin .panel { margin: auto; width: 100%; max-width: 440px; border: 1px solid var(--night-line); padding: 48px 40px; display: flex; flex-direction: column; gap: 22px; }
.signin .label { color: var(--accent); }
.signin p { margin: 0; color: #b4b8b1; font-weight: 300; }
.signin label { display: flex; flex-direction: column; gap: 8px; font-family: var(--mono); font-size: 13px; color: #b4b8b1; }
.signin input { font: 17px var(--sans); color: #ececE8; background: #151816; border: 1px solid #5b605a; padding: 14px 16px; }
.signin .notice { color: var(--accent); font-weight: 400; }

/* Shell */
.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.side { flex: 1 1 220px; max-width: 100%; background: var(--ink); color: #ececE8; padding: 24px 20px; display: flex; flex-direction: column; gap: 24px; }
.side .brand { font-size: 17px; font-weight: 600; letter-spacing: 1px; text-decoration: none; padding: 12px 8px; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a { text-decoration: none; padding: 12px; border-left: 3px solid transparent; }
.side nav a[aria-current="page"] { background: #1f2421; border-left-color: var(--accent); }
.side nav a:hover { color: var(--accent); }
.side .who { margin-top: auto; padding: 0 8px; font-family: var(--mono); font-size: 12px; color: #a3a8a1; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.main { flex: 999 1 640px; min-width: 0; padding: 32px; display: flex; flex-direction: column; gap: 24px; }
.head { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: flex-end; }
.head > div { display: flex; flex-direction: column; gap: 6px; }

/* Cards, tables, forms */
.card { background: var(--card); border: 1px solid var(--line); padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.brief { background: var(--ink); color: #ececE8; border: 0; }
.brief .label { color: var(--accent); }
.brief p.text { margin: 0; font-size: 20px; font-weight: 300; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 24px; }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font: 400 12px var(--mono); color: var(--muted); padding: 8px 12px 8px 0; white-space: nowrap; }
td { border-top: 1px solid var(--line); padding: 12px 12px 12px 0; vertical-align: top; }
td.wrap { min-width: 220px; white-space: pre-line; }
.empty { margin: 0; color: var(--muted); }
.error { margin: 0; color: #9b2c1f; font-weight: 500; }
form.add { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; align-items: end; border-top: 1px solid var(--line); padding-top: 16px; }
form.add label, .field { display: flex; flex-direction: column; gap: 6px; font: 12px var(--mono); color: var(--muted); }
input, select, textarea { font: 16px var(--sans); color: var(--ink); background: #fff; border: 1px solid #6e736d; padding: 11px 12px; min-height: 44px; width: 100%; }
textarea { min-height: 80px; resize: vertical; }
td select { min-width: 120px; }
button, .button { font: 500 13px var(--mono); letter-spacing: 1px; text-transform: uppercase; cursor: pointer; min-height: 44px; padding: 12px 18px; border: 1px solid var(--ink); background: var(--ink); color: #ececE8; text-decoration: none; text-align: center; }
button.accent { background: var(--accent); border-color: var(--accent); color: var(--ink); }
button.quiet { background: transparent; color: inherit; border-color: currentColor; }
button.small { min-height: 44px; padding: 8px 12px; font-size: 12px; }
button:disabled { opacity: 0.5; cursor: default; }
:focus-visible { outline: 3px solid var(--accent-dark); outline-offset: 2px; }
.signin :focus-visible { outline-color: var(--accent); }
.qr { width: 200px; height: 200px; background: #fff; padding: 8px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
code { font-family: var(--mono); font-size: 14px; word-break: break-all; }
.me { font: 13px var(--mono); letter-spacing: 1px; padding: 12px 0; }
.tag { font: 12px var(--mono); border: 1px solid #9b2c1f; color: #9b2c1f; padding: 2px 8px; margin-left: 8px; white-space: nowrap; }
.tk-sub { color: var(--muted); font-size: 14px; }
.tk-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tk-list li { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; border-top: 1px solid var(--line); padding-top: 8px; }
.tk-list li a { flex: 1 1 240px; }
.tk-list select, .tk-detail .row select { width: auto; min-width: 120px; flex: 1 1 200px; }
.tk-list li select { flex: 0 0 auto; }
.tk-detail .wide { grid-column: 1 / -1; }
.tk-detail textarea { min-height: 200px; }
.tk-text { margin: 0; white-space: pre-wrap; max-width: 760px; }
.ch-body { display: flex; flex-direction: column; gap: 16px; }
.ch-list { list-style: none; margin: 0; padding: 0 4px 0 0; display: flex; flex-direction: column; gap: 4px; max-height: 60vh; min-height: 240px; overflow-y: auto; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ch-msg { padding: 10px 12px; border-left: 3px solid transparent; }
.ch-msg.mine { border-left-color: var(--accent-dark); background: #fff; }
.ch-meta { margin: 0; font-size: 14px; color: var(--muted); }
.ch-meta strong { color: var(--ink); font-weight: 600; }
.ch-text { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 760px; }
.ch-text a { color: var(--accent-dark); }
.ch-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ch-tools button { min-height: 36px; padding: 6px 10px; font-size: 11px; }
.ch-none { padding: 16px 12px; }
.ch-compose { display: flex; flex-direction: column; gap: 10px; }
.ch-compose textarea, .ch-edit textarea { min-height: 72px; }
.ch-edit { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.ch-status:empty { display: none; }
.ch-msg { position: relative; }
@media (hover: hover) { .ch-msg .ch-tools { opacity: 0; position: absolute; top: 6px; right: 8px; margin: 0; background: inherit; } .ch-msg:hover .ch-tools, .ch-msg:focus-within .ch-tools { opacity: 1; } }
.mp { gap: 12px; }
.mp-filters input { flex: 2 1 220px; width: auto; }
.mp-filters select { flex: 1 1 160px; width: auto; }
.mp-body { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.mp-left { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.mp-right { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 12px; max-height: 70vh; overflow-y: auto; }
.mp-map { height: 62vh; min-height: 360px; border: 1px solid var(--line); background: #dfe3df; z-index: 0; }
.mp-picking, .mp-picking .leaflet-interactive { cursor: crosshair !important; }
.mp-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; color: var(--muted); }
.mp-legend li { display: flex; align-items: center; gap: 6px; }
.mp-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #9aa09a; flex: none; }
.mp-list ul { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.mp-item { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; background: transparent; color: var(--ink); border: 0; border-bottom: 1px solid var(--line); padding: 10px 4px; font: inherit; letter-spacing: 0; text-transform: none; min-height: 44px; }
.mp-item:hover { background: #fff; }
.mp-item > span:last-child { display: flex; flex-direction: column; }
.mp-form { border-top: 0; padding-top: 0; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.mp-form .wide { grid-column: 1 / -1; }
.mp-pop p { margin: 4px 0; }
.mp-pop button { margin-top: 6px; }
.bd-body { gap: 12px; }
.bd-head { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: flex-start; }
.bd-head .row { align-items: center; }
.bd-canvas { width: 100%; height: 72vh; min-height: 420px; border: 1px solid var(--line); background: #fff; position: relative; }
.bd-miro { display: block; }
:where(.bd-canvas) button { min-height: auto; padding: revert; font: inherit; letter-spacing: normal; text-transform: none; border: revert; background: revert; color: inherit; text-align: revert; }
:where(.bd-canvas) input, :where(.bd-canvas) select, :where(.bd-canvas) textarea { min-height: auto; width: auto; padding: revert; font: inherit; border: revert; background: revert; color: inherit; }
.bd-new, .bd-edit { grid-template-columns: 1fr; }
.bd-edit { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.bd-edit .row { grid-column: 1 / -1; }
.bd-status:empty { display: none; }
.bd-new label[hidden] { display: none; }
.mt-list ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.mt-item { display: flex; flex-direction: column; gap: 4px; padding: 16px 8px; border-top: 1px solid var(--line); text-decoration: none; }
.mt-item:hover { background: #fff; }
.mt-item strong { font-size: 18px; font-weight: 500; }
.mt-date { font: 12px var(--mono); letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.mt-over { color: var(--ink); max-width: 760px; }
.mt-head { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: flex-start; }
.mt-head h2 { font-size: 28px; margin: 6px 0 4px; }
.mt-body { max-width: 720px; font-size: 17px; line-height: 1.6; }
.mt-body h3 { margin: 24px 0 8px; font: 500 13px var(--mono); letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); }
.mt-body p { margin: 0 0 12px; }
.mt-body ul { margin: 0 0 12px; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.mt-body a { color: var(--accent-dark); }
.mt-actions { border-top: 1px solid var(--line); padding-top: 16px; display: flex; flex-direction: column; gap: 10px; max-width: 900px; }
.mt-actions .tk-list li a { flex: 1 1 260px; }
.mt-done a { color: var(--muted); text-decoration: line-through; }
.mt-form .wide { grid-column: 1 / -1; }
.mt-form textarea { min-height: 320px; }
.tk-controls { align-items: flex-end; }
.tk-filter { display: flex; flex-direction: column; gap: 6px; font: 12px var(--mono); color: var(--muted); flex: 1 1 170px; }
.tk-filter select { width: 100%; }
.tk-table td select { min-width: 104px; }
.tk-group th { padding-top: 20px; font: 500 13px var(--mono); letter-spacing: 1px; text-transform: uppercase; color: var(--ink); border-bottom: 1px solid var(--ink); }
.tk-prio-high, select.tk-prio-high { color: #9b2c1f; font-weight: 600; }
.tk-prio-low, select.tk-prio-low { color: var(--muted); }
