/* Workbench — hand-written stylesheet, no frameworks. */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --border: #e2e5ea;
  --border-strong: #cdd2da;
  --text: #1c2330;
  --text-2: #566072;
  --text-3: #8a93a3;
  --accent: #1f6f5c;
  --accent-hover: #185a4a;
  --accent-soft: #e3f2ed;
  --accent-text: #145041;
  --danger: #b4372f;
  --danger-soft: #fbeae8;
  --warning: #9a5b0b;
  --warning-soft: #fdf1dc;
  --info: #2a5d9f;
  --info-soft: #e6eefa;
  --purple: #5b4bb5;
  --purple-soft: #ecebfb;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(20, 30, 50, .06), 0 1px 1px rgba(20, 30, 50, .04);
  --shadow-lg: 0 8px 24px rgba(20, 30, 50, .12);
  --sidebar: #16202e;
  --sidebar-text: #b8c1cf;
  --sidebar-active: #243246;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11151c; --surface: #181e27; --surface-2: #1f2631; --border: #2a3240; --border-strong: #3a4454;
    --text: #e6e9ee; --text-2: #a9b1be; --text-3: #7c8594;
    --accent: #3fa98c; --accent-hover: #52bb9e; --accent-soft: #173a31; --accent-text: #8fe0c7;
    --danger: #e0685f; --danger-soft: #3a1f1d; --warning: #e0a44a; --warning-soft: #372a15;
    --info: #6d9de0; --info-soft: #1b2a40; --purple: #a59af0; --purple-soft: #27234a;
    --sidebar: #0c1016; --sidebar-active: #1c2533;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 14.5px; line-height: 1.5; color: var(--text); background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5rem; font-weight: 600; }
h1 { font-size: 1.45rem; } h2 { font-size: 1.1rem; } h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
code, pre { font-family: var(--mono); font-size: .88em; }
code { background: var(--surface-2); padding: .1em .35em; border-radius: 4px; }
pre { background: var(--surface-2); padding: .75rem; border-radius: 6px; overflow-x: auto; }
pre code { background: none; padding: 0; }
.icon { flex-shrink: 0; vertical-align: -3px; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: .85rem; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { background: var(--sidebar); color: var(--sidebar-text); padding: 16px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 1.05rem; padding: 4px 8px 18px; }
.brand-mark { width: 30px; height: 30px; border-radius: 7px; background: var(--accent); display: grid; place-items: center; color: #fff; }
.nav-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #6f7b8d; padding: 10px 10px 4px; }
.nav a { display: flex; align-items: center; gap: 10px; color: var(--sidebar-text); padding: 5px 10px; border-radius: 6px; margin-bottom: 1px; }
.nav a:hover { background: var(--sidebar-active); color: #fff; text-decoration: none; }
.nav a.active { background: var(--sidebar-active); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav .count { margin-left: auto; background: var(--accent); color: #fff; border-radius: 10px; font-size: .72rem; padding: 0 7px; font-weight: 600; }
.sidebar-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid #243042; }
.me { display: flex; gap: 10px; align-items: center; padding: 8px; color: #fff; }
.me small { display: block; color: #7f8a9b; font-size: .75rem; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 28px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.topbar form { flex: 1; max-width: 520px; position: relative; }
.topbar input[type=search] { padding-left: 34px; }
.topbar .search-icon { position: absolute; left: 10px; top: 9px; color: var(--text-3); }
.topbar .spacer { flex: 1; }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; color: var(--text-2); background: transparent; border: 0; cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.icon-btn .dot { position: absolute; top: 5px; right: 5px; min-width: 16px; height: 16px; font-size: .65rem; padding: 0 4px; border-radius: 8px; background: var(--danger); color: #fff; display: grid; place-items: center; font-weight: 700; }
.menu-toggle { display: none; }
.content { padding: 24px 28px 48px; max-width: 1400px; width: 100%; }
.content.wide { max-width: none; }
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .titles { flex: 1; min-width: 240px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { font-size: .82rem; color: var(--text-3); margin-bottom: 4px; }
.crumbs a { color: var(--text-2); }
.intro { color: var(--text-2); max-width: 760px; margin: 2px 0 0; }
.intro a { white-space: nowrap; }

/* ---------- Cards & grid ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); }
.card-body { padding: 16px 18px; }
.card-head { display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { margin: 0; flex: 1; font-size: .98rem; }
.card-foot { padding: 10px 18px; border-top: 1px solid var(--border); font-size: .88rem; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
.stack > * + * { margin-top: 16px; }
.stat { padding: 14px 16px; }
.stat .label { color: var(--text-2); font-size: .82rem; display: flex; gap: 6px; align-items: center; }
.stat .value { font-size: 1.6rem; font-weight: 650; margin-top: 2px; }
.stat .value.warn { color: var(--warning); }
.stat .value.bad { color: var(--danger); }
.stat a { color: inherit; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 550; cursor: pointer; line-height: 1.35; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-sm { padding: 4px 10px; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
form.inline { display: inline; }

/* ---------- Forms ---------- */
input[type=text], input[type=search], input[type=email], input[type=password], input[type=number], input[type=url], input[type=date], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; }
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.field { margin-bottom: 16px; }
.field > label, .field-label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 5px; }
.field .help { color: var(--text-3); font-size: .82rem; margin-top: 4px; }
.field .errorlist { color: var(--danger); list-style: none; padding: 0; margin: 4px 0 0; font-size: .85rem; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
.form-errors { background: var(--danger-soft); color: var(--danger); padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; }
.form-errors ul { margin: 0; padding-left: 18px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px 16px; max-height: 240px; overflow-y: auto; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); }
.checks label, .radios label { font-weight: 400; display: flex; gap: 8px; align-items: center; padding: 2px 0; }
.checks ul, .radios ul { list-style: none; margin: 0; padding: 0; display: contents; }
.radios ul { display: block; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.form-grid .full { grid-column: 1 / -1; }
.form-card { max-width: 820px; }
.form-actions { display: flex; gap: 8px; padding-top: 6px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters select, .filters input { width: auto; min-width: 150px; padding: 6px 10px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); font-weight: 600; padding: 9px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--surface-2); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .row-bad td { background: var(--danger-soft); }
.table .row-warn td { background: var(--warning-soft); }
.table .row-good td { background: var(--accent-soft); }
.table .row-muted td { color: var(--text-3); }
.table tfoot td { font-weight: 650; background: var(--surface-2); }

/* ---------- Badges & pills ---------- */
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: .76rem; font-weight: 600; background: var(--surface-2); color: var(--text-2); white-space: nowrap; border: 1px solid transparent; }
.badge-todo, .badge-planned, .badge-draft, .badge-design { background: var(--surface-2); color: var(--text-2); border-color: var(--border); }
.badge-in_progress, .badge-ordered, .badge-open, .badge-pending { background: var(--info-soft); color: var(--info); }
.badge-review, .badge-partial { background: var(--purple-soft); color: var(--purple); }
.badge-done, .badge-received, .badge-completed, .badge-released, .badge-merged, .badge-success, .badge-active, .badge-processed, .badge-approved { background: var(--accent-soft); color: var(--accent-text); }
.badge-cancelled, .badge-closed, .badge-obsolete, .badge-archived, .badge-ignored { background: var(--surface-2); color: var(--text-3); text-decoration: line-through; }
.badge-ignored { text-decoration: none; }
.badge-failure, .badge-rejected, .badge-error, .badge-changes_requested, .badge-urgent { background: var(--danger-soft); color: var(--danger); }
.badge-high, .badge-on_hold, .badge-nrnd, .badge-low-stock { background: var(--warning-soft); color: var(--warning); }
.badge-role { background: var(--accent-soft); color: var(--accent-text); }
.kind { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); }
.key { font-family: var(--mono); font-size: .82rem; color: var(--text-2); white-space: nowrap; }
.prio { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: 1px; }
.prio-1 { background: var(--border-strong); } .prio-2 { background: var(--info); } .prio-3 { background: var(--warning); } .prio-4 { background: var(--danger); }
.overdue { color: var(--danger); font-weight: 600; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); display: inline-grid; place-items: center; font-size: .72rem; font-weight: 700; flex-shrink: 0; }
.avatar.sm { width: 22px; height: 22px; font-size: .62rem; }
.avatar.gh { background: #24292f; color: #fff; }
.avatar.wb { background: var(--accent); color: #fff; }
.person { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Progress (widths via classes: CSP forbids inline styles) ---------- */
.progress { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; border: 1px solid var(--border); }
.progress > span { display: block; height: 100%; background: var(--accent); }
.w-0{width:0}.w-5{width:5%}.w-10{width:10%}.w-15{width:15%}.w-20{width:20%}.w-25{width:25%}.w-30{width:30%}.w-35{width:35%}.w-40{width:40%}.w-45{width:45%}.w-50{width:50%}.w-55{width:55%}.w-60{width:60%}.w-65{width:65%}.w-70{width:70%}.w-75{width:75%}.w-80{width:80%}.w-85{width:85%}.w-90{width:90%}.w-95{width:95%}.w-100{width:100%}

/* ---------- Alerts / messages ---------- */
.messages { list-style: none; padding: 0; margin: 0 0 16px; }
.alert { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 8px; border: 1px solid transparent; display: flex; gap: 10px; align-items: flex-start; }
.alert-success { background: var(--accent-soft); color: var(--accent-text); }
.alert-info { background: var(--info-soft); color: var(--info); }
.alert-warning { background: var(--warning-soft); color: var(--warning); }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.tip { background: var(--info-soft); color: var(--text); border-left: 3px solid var(--info); padding: 10px 14px; border-radius: 0 var(--radius) var(--radius) 0; margin-bottom: 16px; font-size: .92rem; }
.tip strong { color: var(--info); }

/* ---------- Empty states ---------- */
.empty { text-align: center; padding: 36px 20px; color: var(--text-2); }
.empty .icon { color: var(--text-3); margin-bottom: 8px; }
.empty h3 { color: var(--text); }
.empty p { max-width: 460px; margin: 0 auto 14px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* ---------- Kanban board ---------- */
.board { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 14px; align-items: start; overflow-x: auto; padding-bottom: 8px; }
.column { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px; min-height: 180px; }
.column.drop-target { outline: 2px dashed var(--accent); outline-offset: -4px; background: var(--accent-soft); }
.column-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px 10px; font-weight: 650; font-size: .9rem; }
.column-head .n { color: var(--text-3); font-weight: 500; }
.column-head a { margin-left: auto; color: var(--text-3); }
.column-hint { font-size: .78rem; color: var(--text-3); padding: 0 4px 8px; }
.tcard { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 11px; margin-bottom: 8px; box-shadow: var(--shadow); cursor: grab; display: block; color: var(--text); }
.tcard:hover { border-color: var(--border-strong); text-decoration: none; }
.tcard.dragging { opacity: .5; }
.tcard .t-title { font-weight: 550; margin: 3px 0 8px; line-height: 1.35; }
.tcard .t-meta { display: flex; align-items: center; gap: 8px; font-size: .78rem; color: var(--text-3); flex-wrap: wrap; }
.tcard .t-meta .avatar { margin-left: auto; }
.tcard .pr-chip { display: inline-flex; gap: 3px; align-items: center; }

/* ---------- Timeline / activity ---------- */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.feed li:last-child { border-bottom: 0; }
.feed .when { color: var(--text-3); font-size: .78rem; white-space: nowrap; margin-left: auto; padding-left: 8px; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain > li { padding: 9px 0; border-bottom: 1px solid var(--border); display: flex; gap: 10px; align-items: center; }
.list-plain > li:last-child { border-bottom: 0; }

/* ---------- Task detail ---------- */
.desc { overflow-wrap: anywhere; }
.comment { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.comment .body { flex: 1; min-width: 0; }
.comment .who { font-weight: 600; }
.comment .when { color: var(--text-3); font-size: .8rem; margin-left: 6px; }
.props { display: grid; grid-template-columns: 110px 1fr; gap: 10px 12px; font-size: .92rem; align-items: center; }
.props dt { color: var(--text-3); }
.props dd { margin: 0; }
.status-switch { display: flex; gap: 4px; flex-wrap: wrap; }
.status-switch button { border: 1px solid var(--border-strong); background: var(--surface); border-radius: 16px; padding: 3px 11px; font: inherit; font-size: .82rem; cursor: pointer; color: var(--text-2); }
.status-switch button.current { background: var(--accent); border-color: var(--accent); color: #fff; }
.copy-box { display: flex; gap: 6px; }
.copy-box input { font-family: var(--mono); font-size: .82rem; }

/* ---------- Chat ---------- */
.chat { display: grid; grid-template-columns: 250px 1fr; height: calc(100vh - 57px); }
.chat-side { border-right: 1px solid var(--border); background: var(--surface); overflow-y: auto; padding: 12px 8px; }
.chat-side h4 { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); margin: 14px 8px 6px; display: flex; align-items: center; }
.chat-side h4 a { margin-left: auto; color: var(--text-3); }
.chat-side a.ch { display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 6px; color: var(--text-2); }
.chat-side a.ch:hover { background: var(--surface-2); text-decoration: none; }
.chat-side a.ch.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.chat-side a.ch.unread { color: var(--text); font-weight: 650; }
.chat-side .count { margin-left: auto; background: var(--danger); color: #fff; font-size: .7rem; border-radius: 9px; padding: 0 6px; font-weight: 700; }
.chat-side form { padding: 4px 8px; }
.chat-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--surface); }
.chat-head { padding: 12px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.chat-head h2 { margin: 0; }
.chat-head .topic { color: var(--text-2); font-size: .88rem; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-log { flex: 1; overflow-y: auto; padding: 12px 20px; }
.msg { display: flex; gap: 10px; padding: 5px 8px; margin: 0 -8px; border-radius: 6px; }
.msg:hover { background: var(--surface-2); }
.msg .avatar { margin-top: 2px; }
.msg .m-body { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.msg .m-head { display: flex; gap: 8px; align-items: baseline; }
.msg .m-name { font-weight: 650; }
.msg .m-time { color: var(--text-3); font-size: .75rem; }
.msg .m-tools { margin-left: auto; opacity: 0; font-size: .78rem; }
.msg:hover .m-tools { opacity: 1; }
.msg.cont { padding-top: 0; }
.msg.cont .m-head { display: none; }
.msg.cont .avatar { visibility: hidden; height: 0; }
.msg.bot .m-text { color: var(--text-2); }
.msg .mention { background: var(--warning-soft); color: var(--warning); border-radius: 3px; padding: 0 2px; font-weight: 600; }
.day-sep { text-align: center; margin: 14px 0 6px; font-size: .78rem; color: var(--text-3); display: flex; align-items: center; gap: 10px; }
.day-sep::before, .day-sep::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.chat-compose { border-top: 1px solid var(--border); padding: 12px 20px 16px; }
.chat-compose form { display: flex; gap: 8px; align-items: flex-end; }
.chat-compose textarea { min-height: 42px; max-height: 200px; resize: none; }
.chat-compose .hint { font-size: .75rem; color: var(--text-3); margin-top: 5px; }
.task-ref { font-family: var(--mono); font-size: .9em; background: var(--accent-soft); color: var(--accent-text); padding: 0 4px; border-radius: 4px; }

/* ---------- Auth pages ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .brand { color: var(--text); justify-content: center; padding-bottom: 14px; }
.auth-card .card-body { padding: 26px 28px; }
.qr { display: block; margin: 8px auto 12px; width: 190px; height: 190px; background: #fff; padding: 8px; border-radius: 8px; border: 1px solid var(--border); }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-family: var(--mono); font-size: 1rem; background: var(--surface-2); padding: 14px; border-radius: 8px; text-align: center; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0 0 16px; }
.steps li { counter-increment: s; position: relative; padding-left: 34px; margin-bottom: 12px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; font-weight: 700; font-size: .8rem; }

/* ---------- Checklist (getting started) ---------- */
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); align-items: flex-start; }
.checklist li:last-child { border-bottom: 0; }
.checklist .tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); flex-shrink: 0; display: grid; place-items: center; color: #fff; }
.checklist li.done .tick { background: var(--accent); border-color: var(--accent); }
.checklist li.done .what { color: var(--text-3); text-decoration: line-through; }
.checklist .what { font-weight: 600; }
.checklist .btn { margin-left: auto; }

/* ---------- Help ---------- */
.help-layout { display: grid; grid-template-columns: 220px minmax(0, 760px); gap: 28px; }
.help-nav a { display: block; padding: 6px 10px; border-radius: 6px; color: var(--text-2); }
.help-nav a.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.prose h2 { margin-top: 1.6rem; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li { margin-bottom: .35rem; }
.prose table { border-collapse: collapse; width: 100%; margin-bottom: 1rem; }
.prose th, .prose td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; vertical-align: top; }
.prose th { background: var(--surface-2); }
kbd { font-family: var(--mono); font-size: .8em; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: var(--surface); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 250px; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .menu-toggle { display: inline-grid; }
  .content { padding: 18px 16px 40px; }
  .topbar { padding: 8px 12px; }
  .grid-2, .grid-3, .form-grid { grid-template-columns: 1fr; }
  .chat { grid-template-columns: 1fr; }
  .chat-side { display: none; }
  .help-layout { grid-template-columns: 1fr; }
}

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); background: var(--text); color: var(--surface); padding: 9px 16px; border-radius: 8px; opacity: 0; pointer-events: none; transition: all .2s; z-index: 100; font-size: .9rem; box-shadow: var(--shadow-lg); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--danger); color: #fff; }
.nav-logout { width: 100%; justify-content: flex-start; color: var(--sidebar-text); padding: 7px 10px; font-weight: 400; gap: 10px; }
.nav-logout:hover { background: var(--sidebar-active); color: #fff; }
.check-label { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.check-label input { width: auto; }
.section-title { display: flex; align-items: center; gap: 8px; margin: 26px 0 10px; }
.section-title h2 { margin: 0; flex: 1; }
.kv { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: .92rem; }
.kv:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--text-2); }
.auth-note { text-align: center; margin-top: 14px; }
.list-plain .right, .kv .right { margin-left: auto; }
.content.chat-content { padding: 0; max-width: none; }
.content.chat-content .messages { margin: 12px 20px 0; }
.chat-side select { font-size: .85rem; padding: 5px 8px; }
.qty-input { width: 90px !important; text-align: right; padding: 4px 8px !important; }
.auth-card form + form { margin-top: 12px; }
.bullets { margin: 0; padding-left: 18px; }
.bullets li { margin-bottom: 8px; }
.kv { gap: 16px; }
.kv > span:last-child { text-align: right; }

/* ---------- v1.1 additions ---------- */
.space-card { color: var(--text); display: block; }
.space-card:hover { border-color: var(--accent); text-decoration: none; }
.dropzone { border: 2px dashed var(--border-strong); border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; background: var(--surface); color: var(--text-2); }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.upload-progress { margin-top: 10px; display: grid; gap: 6px; }
.input-sm { width: auto !important; min-width: 180px; padding: 5px 9px !important; font-size: .9rem; }
.grow { flex: 1; min-width: 200px; }
.preview iframe { width: 100%; height: 75vh; border: 0; border-radius: 10px; display: block; background: #fff; }
.preview img { max-width: 100%; max-height: 75vh; }
.preview .center { text-align: center; }
.text-preview { margin: 0; max-height: 70vh; overflow: auto; border-radius: 10px; font-size: .8rem; white-space: pre; }
.blocked-chip { font-size: .76rem; color: var(--danger); background: var(--danger-soft); border-radius: 5px; padding: 2px 6px; margin: -2px 0 8px; }
.tick-btn { cursor: pointer; background: var(--surface); padding: 0; }
.checklist form { margin: 0; }
.checklist .right { margin-left: auto; }
.time-form { display: grid; grid-template-columns: 80px 1fr; gap: 6px; margin-top: 10px; }
.time-form input[name=note] { grid-column: 1 / -1; }
.time-form button { grid-column: 1 / -1; justify-self: start; }
.week-nav { gap: 12px; }
.week-nav .right { margin-left: auto; }
.big { font-size: 1.3rem; }
.clock-row { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; border-bottom: 1px solid var(--border); }
.clock-row:last-of-type { border-bottom: 0; }
.clock-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); margin-top: 6px; flex-shrink: 0; }
.clock-row.working .clock-dot { background: var(--accent); }
.clock-time { color: var(--text-2); }
.chat-compose .attach { cursor: pointer; }
.print-only { display: none; }
@media print {
  .sidebar, .topbar, .no-print, .alert { display: none !important; }
  .app { display: block; }
  .content { padding: 0; }
  .print-only { display: block; }
  .card { box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
}
.meta-item + .meta-item::before { content: " · "; color: var(--text-3); }
.warn-text { color: var(--warning); }
.ok-text { color: var(--accent-text); }
.changelog-entry { padding: 10px 0; border-bottom: 1px solid var(--border); }
.changelog-entry:last-child { border-bottom: 0; }
.changelog-entry h3 { margin-bottom: 4px; }
details.recall { margin: 8px 0 12px; }
details.recall summary { cursor: pointer; color: var(--danger); list-style: none; }
details.recall form { margin-top: 8px; display: grid; gap: 8px; justify-items: start; }
.brand-logo { display: block; max-height: 36px; max-width: 180px; width: auto; height: auto; }
.auth-card .brand-logo { max-height: 56px; max-width: 260px; }
.brand-badge { background: #fff; border-radius: 8px; padding: 6px 10px; display: inline-block; }
.logo-preview { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.logo-preview > div { flex: 1; min-width: 200px; border: 1px solid var(--border); border-radius: 10px; padding: 16px; display: grid; gap: 10px; justify-items: start; }
.logo-preview .on-light { background: #fff; }
.logo-preview .on-dark { background: var(--sidebar); color: var(--sidebar-text); }
.logo-preview img { max-height: 56px; max-width: 220px; }
.logo-preview .caption { font-size: .8rem; color: var(--text-3); }
.logo-preview .on-dark .caption { color: #8a95a6; }
.badge-ready { background: var(--accent-soft); color: var(--accent-text); }
.badge-running { background: var(--info-soft); color: var(--info); }
.badge-failed { background: var(--danger-soft); color: var(--danger); }
.badge-recalled { background: var(--danger-soft); color: var(--danger); font-weight: 700; }
.badge-deprecated { background: var(--surface-2); color: var(--text-3); }
.badge-testing { background: var(--purple-soft); color: var(--purple); }
.md-h { display: inline-block; margin-top: 4px; font-size: 1.02em; }
.logo-preview .on-dark .link-btn { color: #8fe0c7; }

/* Storage settings */
.alert-block { display: block; margin-top: 12px; }
.alert-block p { margin: 0 0 8px; }
.storage-now { display: flex; gap: 14px; align-items: center; padding-bottom: 12px; margin-bottom: 6px; border-bottom: 1px solid var(--border); }
.storage-icon { width: 52px; height: 52px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; flex: none; }
.storage-where { font-size: 1.15rem; font-weight: 600; }
.storage-step { margin-top: 16px; border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.storage-step.ok { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.storage-step.bad { border-color: var(--danger); background: color-mix(in srgb, var(--danger-soft) 45%, transparent); }
.storage-step-head { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 8px; }
.storage-step.ok .storage-step-head > .icon { color: var(--accent); }
.storage-step.bad .storage-step-head > .icon { color: var(--danger); }
.provider-help { background: var(--surface-2); border-radius: 8px; padding: 8px 10px; margin: 4px 0 12px; }
.provider-help:empty { display: none; }
.progress-lg { height: 14px; border-radius: 7px; margin: 12px 0 6px; }
.progress > span { transition: width .4s; }
[hidden] { display: none !important; }
.kv-stack p { margin: 0 0 8px; }

/* PCB design files & board viewer */
.board-thumb { display: block; background: #23272e; padding: 14px; text-align: center; }
.board-thumb img { max-width: 100%; max-height: 260px; }
.board-facts { display: grid; gap: 2px; }
.board-facts > div { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.board-facts > div:last-child { border-bottom: 0; }
.board-facts span { color: var(--text-2); }
.board-facts strong { font-weight: 600; text-align: right; }
.pcb-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .pcb-layout { grid-template-columns: 1fr; } }
.pcb-stage { overflow: hidden; }
.pcb-toolbar, .pcb-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.pcb-foot { border-bottom: 0; border-top: 1px solid var(--border); }
.pcb-coords { margin-left: auto; color: var(--text-2); min-width: 170px; text-align: right; }
.pcb-canvas { height: min(68vh, 720px); background: #1d2127; position: relative; }
.pcb-canvas .pcb-svg { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.pcb-canvas .pcb-svg.grabbing { cursor: grabbing; }
.pcb-canvas .pcb-svg.measuring { cursor: crosshair; }
.pcb-canvas .pcb-svg.on-layers { background: #111317; }
.pcb-loading { position: absolute; inset: 0; display: grid; place-items: center; color: #aab; font-size: .95rem; }
.pcb-measure line { stroke: #ffd84a; stroke-width: 1.5px; vector-effect: non-scaling-stroke; }
.pcb-measure circle { fill: #ffd84a; }
.pcb-measure text { fill: #ffd84a; text-anchor: middle; paint-order: stroke; stroke: #111; stroke-width: 3px; vector-effect: non-scaling-stroke; font-family: var(--font-mono, monospace); }
.seg { display: inline-flex; border: 1px solid var(--border-strong, var(--border)); border-radius: 8px; overflow: hidden; }
.seg button { background: var(--surface); color: var(--text); border: 0; padding: 6px 12px; font: inherit; font-size: .88rem; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.active { background: var(--accent); color: #fff; }
.seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.seg-sm button { padding: 3px 9px; font-size: .8rem; }
.swatches { display: inline-flex; gap: 6px; }
.swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); cursor: pointer; padding: 0; }
.swatch.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.swatch-green { background: #2c7a48; } .swatch-black { background: #262626; } .swatch-blue { background: #1f4ea3; }
.swatch-red { background: #b0302c; } .swatch-purple { background: #5d3389; } .swatch-yellow { background: #dcbc3a; } .swatch-white { background: #f3f3ef; }
.layer-list { display: grid; gap: 4px; }
.layer-row { display: flex; gap: 9px; align-items: flex-start; padding: 4px 0; cursor: pointer; }
.layer-row > span:last-child { display: grid; }
.layer-name { font-size: .9rem; }
.layer-dot { width: 12px; height: 12px; border-radius: 3px; margin-top: 4px; flex: none; }
.select-sm { padding: 3px 6px; font-size: .85rem; width: auto; display: inline-block; }
.table-compact td, .table-compact th { padding: 5px 8px; font-size: .82rem; }
@media (max-width: 700px) { .hide-sm { display: none; } .pcb-coords { display: none; } }
.design-strip { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); border-bottom: 1px solid var(--border); }
.design-strip .board-facts { align-content: start; }
.design-strip .board-facts .btn { margin-top: 8px; justify-self: start; }
@media (max-width: 700px) { .design-strip { grid-template-columns: 1fr; } }
.file-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.file-chip { display: grid; border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: .88rem; color: var(--text); text-decoration: none; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.file-chip:hover { border-color: var(--accent); }

/* Builds: stages, finishing steps, board with parts marked */
.stepper { list-style: none; display: flex; gap: 0; margin: 0 0 16px; padding: 0; counter-reset: s; overflow-x: auto; }
.stepper li { flex: 1; min-width: 120px; display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-size: .88rem; color: var(--text-2);
  border-bottom: 3px solid var(--border); }
.stepper li .dot { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: .78rem; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--border); flex: none; }
.stepper li.done { color: var(--text); border-bottom-color: var(--accent); }
.stepper li.done .dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.stepper li.now { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); }
.stepper li.now .dot { border: 2px solid var(--accent); color: var(--accent-text); background: var(--accent-soft); }
.next-card { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-soft); }
.howto { margin: 0 0 14px; padding-left: 20px; }
.howto li { margin-bottom: 6px; }
.steps { display: grid; }
.step-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) 70px auto; gap: 12px; align-items: center; padding: 12px 16px;
  border-bottom: 1px solid var(--border); }
.step-row:last-child { border-bottom: 0; }
.step-row.complete { background: color-mix(in srgb, var(--accent-soft) 40%, transparent); }
.step-row.complete .step-num { background: var(--accent); color: #fff; border-color: var(--accent); }
.step-row.highlight { outline: 2px solid #f2b705; outline-offset: -2px; }
.step-num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); font-size: .8rem; font-weight: 600; }
.step-title { font-weight: 600; }
.step-main .progress { margin-top: 6px; }
.step-count { text-align: right; font-size: 1.1rem; line-height: 1.1; }
.step-buttons { display: flex; gap: 4px; }
.step-buttons .btn { min-width: 40px; justify-content: center; }
@media (max-width: 700px) {
  .step-row { grid-template-columns: 30px minmax(0, 1fr) 60px; }
  .step-buttons { grid-column: 1 / -1; justify-content: flex-end; }
  .step-buttons .btn { min-width: 52px; min-height: 40px; }
}
.board-marked { position: relative; background: #23272e; padding: 12px; border-bottom: 1px solid var(--border); }
.board-marked img { display: block; width: 100%; max-height: 360px; object-fit: contain; }
.board-marked .board-markers { position: absolute; inset: 12px; width: calc(100% - 24px); height: calc(100% - 24px); }
.board-markers .marker circle { fill: rgba(242, 183, 5, .35); stroke: #f2b705; stroke-width: 2px; vector-effect: non-scaling-stroke; }
.board-markers .marker.bottom circle { stroke-dasharray: 3 2; }
.board-markers .marker text { fill: #ffe082; text-anchor: middle; font-weight: 700; paint-order: stroke; stroke: #111; stroke-width: 3px;
  vector-effect: non-scaling-stroke; font-family: var(--font, sans-serif); }
.board-markers .marker.dim { opacity: .25; }
.board-markers .marker.hot circle { fill: rgba(242, 183, 5, .7); }
.pulse { animation: pulse 1.4s ease-in-out 3; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 var(--accent-soft); } 50% { box-shadow: 0 0 0 6px var(--accent-soft); } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } .progress > span { transition: none; } }
.traveler .traveler-board img { max-height: 420px; }
.traveler-table td.sign { min-width: 150px; border-bottom: 1px solid var(--border); }
.sign-line { display: inline-block; min-width: 160px; border-bottom: 1px solid var(--text-3); height: 1.2em; }
@media print {
  .traveler .card { border: 1px solid #bbb; }
  .board-marked { background: #fff; }
  .traveler-table th, .traveler-table td { font-size: 10pt; }
}
.assembly-card .card-body { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.fitted-toggle button { padding: 3px 8px; white-space: nowrap; }
.fitted-toggle button.active.house { background: #b7791f; }
.fab-list { list-style: none; padding: 0; margin: 0 0 12px; counter-reset: f; }
.fab-list li { counter-increment: f; position: relative; padding: 4px 0 12px 40px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.fab-list li:last-child { border-bottom: 0; margin-bottom: 0; }
.fab-list li::before { content: counter(f); position: absolute; left: 0; top: 2px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 600; font-size: .85rem; background: var(--surface-2); border: 1px solid var(--border); }
.fab-list li.ok::before { content: "✓"; background: var(--accent); color: #fff; border-color: var(--accent); }
.fab-list li.bad::before { content: "!"; background: var(--danger); color: #fff; border-color: var(--danger); }
.fab-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; }
.fab-list p { margin: 4px 0 0; }
.badge-at_fab { background: var(--info-soft); color: var(--info); }
.badge-finishing { background: var(--warning-soft); color: var(--warning); }
.badge-testing { background: var(--info-soft); color: var(--info); }

/* --- 3D viewer ------------------------------------------------------------ */
.cad-viewer { display: flex; flex-direction: column; background: var(--surface); border-radius: inherit; }
.cad-toolbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.cad-toolbar .seg { display: inline-flex; }
.cad-toolbar .seg .btn { border-radius: 0; margin-left: -1px; }
.cad-toolbar .seg .btn:first-child { border-radius: 6px 0 0 6px; margin-left: 0; }
.cad-toolbar .seg .btn:last-child { border-radius: 0 6px 6px 0; }
.cad-toolbar .btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.cad-toolbar .right { margin-left: auto; display: inline-flex; gap: 6px; }
.cad-section { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--text-2); }
.cad-section select { padding: 2px 6px; font-size: .85rem; }
.cad-section input[type=range] { width: 120px; }
.cad-stage { position: relative; background: #21262d; }
.cad-large .cad-stage { height: 560px; }
.cad-small .cad-stage { height: 300px; }
.cad-stage canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.cad-stage canvas:active { cursor: grabbing; }
.cad-stage canvas.measuring { cursor: crosshair; }
.cad-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 24px; color: #d5dbe3; font-size: .95rem; }
.cad-overlay.error { color: #f4c9a0; }
.cad-readout { position: absolute; left: 10px; bottom: 10px; background: rgba(0, 0, 0, .65); color: #ffd33d; padding: 4px 10px; border-radius: 6px; font-family: var(--mono, monospace); font-size: .85rem; }
.cad-parts { position: absolute; top: 10px; right: 10px; width: 240px; max-height: calc(100% - 20px); overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: .85rem; }
.cad-parts ul { list-style: none; margin: 6px 0 0; padding: 0; }
.cad-parts li label { display: flex; align-items: center; gap: 6px; padding: 2px 0; cursor: pointer; }
.cad-parts li span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cad-swatch { width: 12px; height: 12px; border-radius: 3px; background: var(--swatch, #aaa); flex: none; border: 1px solid rgba(0,0,0,.2); }
.cad-foot { display: flex; gap: 10px; padding: 7px 12px; border-top: 1px solid var(--border); }
.cad-foot .right { margin-left: auto; }
.cad-viewer:fullscreen { background: var(--surface); }
.cad-viewer:fullscreen .cad-stage { flex: 1; height: auto; }
.hw-thumb { background: #23272e; height: 150px; display: flex; align-items: center; justify-content: center; border-radius: 10px 10px 0 0; overflow: hidden; }
.hw-thumb img { max-width: 92%; max-height: 136px; }
.hw-thumb-icon { color: #7d8794; }
.hw-card .card-body { padding-top: 12px; }
@media (max-width: 700px) { .cad-large .cad-stage { height: 380px; } .cad-foot .right { display: none; } }
.cad-section label { display: inline-flex; align-items: center; gap: 6px; }
.hw-thumb-light { background: #eaeef3; }
.row-active td { background: var(--accent-soft, rgba(31, 111, 92, .07)); }

/* --- block diagrams ----------------------------------------------------------------- */
.badge-concept { background: var(--surface-2); color: var(--text-2); border-color: var(--border); }
.badge-prototype { background: var(--purple-soft); color: var(--purple); }
.badge-obsolete { background: var(--surface-2); color: var(--text-3); text-decoration: line-through; }
details.menu { position: relative; display: inline-block; }
details.menu > summary { list-style: none; cursor: pointer; }
details.menu > summary::-webkit-details-marker { display: none; }
.menu-list { position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); min-width: 220px; padding: 6px; display: flex; flex-direction: column; }
.menu-list a, .menu-list button { text-align: left; padding: 7px 10px; border-radius: 6px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; }
.menu-list a:hover, .menu-list button:hover { background: var(--surface-2); text-decoration: none; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.stack-sm label { display: flex; flex-direction: column; gap: 4px; }
.diagram-thumb { background: #fff; height: 170px; display: flex; align-items: center; justify-content: center; border-bottom: 1px solid var(--border); border-radius: 10px 10px 0 0; overflow: hidden; padding: 8px; }
.diagram-thumb img { max-width: 100%; max-height: 100%; }
.diagram-canvas { height: 560px; overflow: hidden; background: #fff; border-radius: 10px 10px 0 0; cursor: grab; touch-action: none; }
.diagram-canvas:active { cursor: grabbing; }
.diagram-canvas svg { width: 100%; height: 100%; display: block; }
.diagram-canvas .hl { outline: none; }
.diagram-comment { padding: 10px 0; border-bottom: 1px solid var(--border); }
.diagram-comment[data-node-ref] { cursor: pointer; }
.diagram-comment[data-node-ref]:hover { background: var(--surface-2); }
.diagram-comment.resolved { opacity: .55; }
.diagram-comment .comment-text { margin: 6px 0 0 34px; }
.tag-node { display: inline-flex; align-items: center; gap: 3px; font-size: .75rem; background: #fff4e0; color: #7a4a00; border-radius: 10px; padding: 1px 8px; }

/* --- diagram editor ------------------------------------------------------------------- */
.dg-editor { display: flex; flex-direction: column; height: calc(100vh - 110px); min-height: 520px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); overflow: hidden; }
.dg-top { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.dg-title .crumbs { margin: 0; }
.dg-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dg-sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.dg-zoom { min-width: 42px; text-align: center; color: var(--text-2); }
.dg-note { width: 210px; }
.dg-draft { margin: 8px 12px 0; }
.dg-body { flex: 1; display: grid; grid-template-columns: 200px 1fr 280px; min-height: 0; }
.dg-palette { border-right: 1px solid var(--border); overflow-y: auto; padding: 10px; }
.dg-group-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); margin: 10px 0 6px; font-weight: 700; }
.dg-group-title:first-child { margin-top: 0; }
.dg-shapes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.dg-shape { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: grab; font-size: .72rem; color: var(--text-2); }
.dg-shape:hover { border-color: var(--accent); color: var(--text); }
.dg-kinds { display: flex; flex-direction: column; gap: 3px; }
.dg-kind { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border: 1px solid transparent; border-radius: 6px; background: none; cursor: pointer; font-size: .76rem; color: var(--text-2); text-align: left; }
.dg-kind:hover { background: var(--surface-2); }
.dg-kind.active { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.dg-kind svg { flex: none; }
.dg-canvas { position: relative; overflow: hidden; background: #fff; outline: none; }
.dg-canvas svg { width: 100%; height: 100%; display: block; user-select: none; touch-action: none; }
.dg-canvas.panning svg { cursor: grab; }
.dg-hit { fill: transparent; cursor: move; }
.dg-hit-frame { fill: none; stroke: transparent; stroke-width: 10; cursor: move; pointer-events: stroke; }
.dg-hit-edge { fill: none; stroke: transparent; stroke-width: 12; cursor: pointer; }
.dg-sel { fill: none; stroke: #2563eb; pointer-events: none; }
.dg-handle { fill: #fff; stroke: #2563eb; cursor: nwse-resize; }
.dg-handle.dg-ne, .dg-handle.dg-sw { cursor: nesw-resize; }
.dg-edge-sel { fill: none; stroke: rgba(37, 99, 235, .28); stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.dg-port circle { fill: #fff; stroke: #2563eb; cursor: crosshair; }
.dg-port path { stroke: #2563eb; pointer-events: none; }
.dg-port:hover circle { fill: #2563eb; }
.dg-port:hover path { stroke: #fff; }
.dg-band { fill: rgba(37, 99, 235, .07); stroke: #2563eb; pointer-events: none; }
.dg-temp { fill: none; stroke: #2563eb; pointer-events: none; }
.dg-props { border-left: 1px solid var(--border); overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.dg-props h3 { margin: 0; font-size: .95rem; }
.dg-field { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; color: var(--text-2); }
.dg-field textarea, .dg-field input, .dg-field select { font-size: .88rem; }
.dg-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dg-swatches { display: flex; flex-wrap: wrap; gap: 5px; }
.dg-swatch { width: 24px; height: 24px; border-radius: 6px; border: 2px solid var(--stroke); background: var(--fill); cursor: pointer; padding: 0; }
.dg-swatch.active { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px #2563eb; }
.dg-align { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.dg-check { font-size: .85rem; display: flex; gap: 6px; align-items: flex-start; }
.dg-tips ul { padding-left: 18px; margin: 6px 0 0; color: var(--text-2); }
.dg-tips li { margin-bottom: 4px; }
.dg-tips kbd { font-size: .72rem; border: 1px solid var(--border); border-radius: 3px; padding: 0 3px; background: var(--surface-2); }
@media (max-width: 1100px) { .dg-body { grid-template-columns: 150px 1fr 230px; } .dg-note { width: 140px; } }
@media (max-width: 800px) { .dg-body { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; } .dg-palette { border-right: 0; border-bottom: 1px solid var(--border); max-height: 150px; } .dg-shapes { grid-template-columns: repeat(6, 1fr); } .dg-props { border-left: 0; border-top: 1px solid var(--border); max-height: 220px; } }
.diagram-slot { border-style: dashed; display: flex; align-items: center; }
.diagram-slot p { margin: 6px 0 10px; color: var(--text-2); }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form input[type=password] { max-width: 220px; }
.bad-text { color: var(--danger, #b42318); }
.cancel-return { display: flex; gap: 8px; align-items: flex-start; }
.cancel-return input { margin-top: 3px; flex: none; }
.fw-slot { padding: 8px 0; border-bottom: 1px solid var(--border); display: grid; gap: 4px; }
.fw-slot:last-of-type { border-bottom: 0; margin-bottom: 8px; }

/* Sources: file tree, code viewer and syntax colours (Pygments token classes) */
.file-tree td:first-child { width: 70%; }
.lock-badge { background: var(--warning-soft); color: var(--warning); margin-left: 6px; }
.path-crumbs { border-bottom: 1px solid var(--border); }
.history-row { padding: 6px 0; border-bottom: 1px solid var(--border); }
.history-row:last-child { border-bottom: 0; }
.history-row.current { font-weight: 600; }
.readme pre, .code-view { overflow-x: auto; }
.code-view { font-family: var(--mono); font-size: .82rem; }
table.code { border-collapse: collapse; width: 100%; }
table.code td { padding: 0 10px; vertical-align: top; white-space: pre; line-height: 1.5; }
table.code td.ln { text-align: right; color: var(--text-3); user-select: none; width: 1%; border-right: 1px solid var(--border); }
table.code td.ln a { color: inherit; text-decoration: none; }
table.code tr:target td { background: var(--warning-soft); }
.image-view img { max-width: 100%; height: auto; }
:root { --hl-kw: #8839ef; --hl-str: #2e7d32; --hl-com: #6b7280; --hl-num: #b45309; --hl-fn: #1d4ed8; --hl-type: #0f766e; --hl-pre: #9d174d; }
@media (prefers-color-scheme: dark) { :root { --hl-kw: #c4a7ff; --hl-str: #8fd694; --hl-com: #9aa1ab; --hl-num: #f5b971; --hl-fn: #8ab4ff; --hl-type: #6fd3c4; --hl-pre: #f5a3c7; } }
.code .k, .code .kd, .code .kn, .code .kr, .code .kc, .code .ow { color: var(--hl-kw); }
.code .kt, .code .nc, .code .nn { color: var(--hl-type); }
.code .s, .code .s1, .code .s2, .code .sb, .code .sc, .code .sd, .code .se, .code .si, .code .sa { color: var(--hl-str); }
.code .c, .code .c1, .code .cm, .code .cs, .code .ch { color: var(--hl-com); font-style: italic; }
.code .cp, .code .cpf { color: var(--hl-pre); }
.code .m, .code .mi, .code .mf, .code .mh, .code .mo, .code .mb, .code .il { color: var(--hl-num); }
.code .nf, .code .fm, .code .nb, .code .bp { color: var(--hl-fn); }
.compare-pick { gap: 6px; align-items: center; }
.diff tr.add td.src, .diff td.src.add { background: var(--accent-soft); }
.diff tr.del td.src, .diff td.src.del { background: var(--danger-soft); }
.diff td.src.empty { background: var(--surface-2); }
.diff tr.fold td { background: var(--surface-2); color: var(--text-3); text-align: center; font-style: italic; }
.diff.split td.src { width: 50%; }
.sch-canvas svg { background: #fff; cursor: grab; }
.sch-canvas g.sym, .sch-canvas g.sheet { cursor: pointer; }
.sch-canvas g.sym.selected polygon, .sch-canvas g.sym.selected polyline, .sch-canvas g.sym.selected circle { stroke: #1d4ed8; }
.sch-canvas g.hl-added polygon, .sch-canvas g.hl-added polyline, .sch-canvas g.hl-added line { stroke: #2e9e44; stroke-width: 0.4; }
.sch-canvas g.hl-removed polygon, .sch-canvas g.hl-removed polyline, .sch-canvas g.hl-removed line { stroke: #d23c3c; stroke-width: 0.4; }
.sch-canvas g.hl-changed polygon, .sch-canvas g.hl-changed polyline, .sch-canvas g.hl-changed line { stroke: #e09a1f; stroke-width: 0.4; }
.only-changes g.sym:not([class*="hl-"]), .only-changes polyline, .only-changes g.sheet { opacity: 0.25; }
.only-changes g.sym[class*="hl-"] polyline { opacity: 1; }
.parts-scroll { max-height: 360px; overflow-y: auto; }
tr.selected td { background: var(--info-soft); }
.compare-canvas { background: #fff; min-height: 320px; padding: 6px; }
.compare-canvas svg { width: 100%; height: auto; display: block; }
.compare-canvas.only-changes g.sym:not([class*="hl-"]) { opacity: 0.2; }
.compare-canvas g.hl-added polygon, .compare-canvas g.hl-added polyline, .compare-canvas g.hl-added line { stroke: #2e9e44; stroke-width: 0.4; }
.compare-canvas g.hl-removed polygon, .compare-canvas g.hl-removed polyline, .compare-canvas g.hl-removed line { stroke: #d23c3c; stroke-width: 0.4; }
.compare-canvas g.hl-changed polygon, .compare-canvas g.hl-changed polyline, .compare-canvas g.hl-changed line { stroke: #e09a1f; stroke-width: 0.4; }
.compare-canvas.only-changes g[data-view] > :not([class^="hl-"]) { opacity: 0.25; }
