:root {
  /* 3.4.1 brand: Dark Amethyst #510158, White, Gunmetal #444444,
     Carbon Black #222222 and Onyx #101010. */
  --bg: #f5f5f5;
  --panel: #ffffff;
  --sidebar: #ececec;
  --ink: #101010;
  --ink-2: #444444;
  --ink-3: #7a7a7a;
  --line: #e4e4e4;
  --line-2: #d2d2d2;
  --hover: rgba(16, 16, 16, .05);
  --accent: #510158;      /* text, links, highlights */
  --brand: #510158;       /* filled buttons and the logo, always with white on it */
  --brand-edge: #510158;
  --accent-ink: #ffffff;
  --danger: #c92a2a;
  --ok: #2b8a3e;
  --warn: #c77700;
  --shadow: 0 1px 2px rgba(16,16,16,.06), 0 4px 16px rgba(16,16,16,.06);
  --radius: 10px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Mono", Consolas, ui-monospace, monospace;
  color-scheme: light;
}
/* Dark: Onyx behind, Carbon Black panels, Gunmetal lines. #510158 is too dark
   to read on them, so text and highlights use a lighter shade of it. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101010; --panel: #222222; --sidebar: #181818; --ink: #ffffff; --ink-2: #c8c8c8;
    --ink-3: #8e8e8e; --line: #333333; --line-2: #444444; --hover: rgba(255,255,255,.06);
    --accent: #cc89d2; --brand-edge: #7d3685; --accent-ink: #ffffff; --danger: #ff6b6b; --ok: #69db7c; --warn: #ffc14d;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #101010; --panel: #222222; --sidebar: #181818; --ink: #ffffff; --ink-2: #c8c8c8;
  --ink-3: #8e8e8e; --line: #333333; --line-2: #444444; --hover: rgba(255,255,255,.06);
  --accent: #cc89d2; --brand-edge: #7d3685; --accent-ink: #ffffff; --danger: #ff6b6b; --ok: #69db7c; --warn: #ffc14d;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: calc(14px * var(--fs, 1))/1.5 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.app { display: grid; grid-template-columns: 264px 1fr; height: 100vh; }

/* ---------- sidebar ---------- */
.sidebar { background: var(--sidebar); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 12px; font: 600 calc(16px * var(--fs, 1)) var(--font-display); letter-spacing: -.01em; }
.brand .logo { width: 26px; height: 26px; border-radius: 7px; background: var(--brand); display: grid; place-items: center; }
.brand .logo i { display: block; height: 3px; border-radius: 2px; background: #fff; margin: 1.5px 0; }
.search { margin: 0 12px 8px; position: relative; }
.search input { width: 100%; padding: 7px 10px 7px 30px; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; outline: none; }
.search input:focus { border-color: var(--accent); }
.search svg { position: absolute; left: 9px; top: 9px; color: var(--ink-3); }
.nav { flex: 1; overflow-y: auto; padding: 4px 8px 12px; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: 0; background: none; border-radius: 7px; text-align: left; color: var(--ink-2); }
.nav-item:hover { background: var(--hover); color: var(--ink); }
.nav-item.active { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.nav-item .name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item .count { font-size: calc(12px * var(--fs, 1)); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.nav-item .count.alert { color: var(--danger); font-weight: 600; }
.dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.nav-label { display: flex; align-items: center; justify-content: space-between; padding: 14px 10px 4px; font-size: calc(11px * var(--fs, 1)); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.nav-label button { border: 0; background: none; color: var(--ink-3); padding: 2px; border-radius: 5px; display: grid; }
.nav-label button:hover { color: var(--ink); background: var(--hover); }
.sidebar-foot { border-top: 1px solid var(--line); padding: 8px; }
.new-project { margin: 4px 12px 10px; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px; border-radius: 8px; border: 1px dashed var(--line-2); background: none; color: var(--ink-2); }
.new-project:hover { border-color: var(--accent); color: var(--accent); }
.new-project { margin-bottom: 4px; }
.import-link { margin: 0 12px 10px; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 4px; border: 0; border-radius: 6px; background: none; color: var(--ink-3); font-size: calc(12.5px * var(--fs, 1)); }
.import-link .i { width: 14px; height: 14px; }
.import-link:hover { color: var(--accent); }
.import-link:disabled { opacity: .45; cursor: default; }
.imp-sources { display: grid; gap: 6px; margin: 4px 0 2px; padding: 0; list-style: none; }
.imp-sources li { font-size: calc(13px * var(--fs, 1)); color: var(--ink-2); }
.imp-sources b { color: var(--ink); font-weight: 600; }
.imp-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin: 2px 0; }
.imp-stats div { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.imp-stats b { display: block; font-size: calc(18px * var(--fs, 1)); font-family: var(--font-display); }
.imp-stats span { font-size: calc(12px * var(--fs, 1)); color: var(--ink-3); }

/* ---------- main ---------- */
.main { overflow-y: auto; min-width: 0; }
.page { max-width: 1120px; margin: 0 auto; padding: 28px 36px 64px; }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -.015em; margin: 0; }
h1 { font-size: calc(28px * var(--fs, 1)); font-weight: 650; }
h2 { font-size: calc(15px * var(--fs, 1)); font-weight: 600; }
.muted { color: var(--ink-3); }
.small { font-size: calc(12px * var(--fs, 1)); }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel); white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: var(--ink-3); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand-edge); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover:not(:disabled) { filter: brightness(1.22); border-color: var(--accent); }
.btn.ghost { border-color: transparent; background: none; color: var(--ink-2); }
.btn.ghost:hover { background: var(--hover); color: var(--ink); border-color: transparent; }
.btn.danger { color: var(--danger); }
.icon-btn { display: inline-grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 7px; background: none; color: var(--ink-3); }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn.on { color: var(--accent); }

.field { width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); outline: none; }
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.field.mono { font-family: var(--mono); font-size: calc(13px * var(--fs, 1)); }
select.field { width: auto; padding-right: 28px; }

/* project header */
.p-head { display: flex; align-items: flex-start; gap: 14px; }
.badge-btn { border: 0; padding: 0; background: none; border-radius: 12px; flex: none; margin-top: 1px; cursor: pointer; }
.badge-btn:hover:not(:disabled) .pbadge { box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 45%, transparent); }
.badge-btn:disabled { cursor: default; }
.title-input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font: 650 calc(28px * var(--fs, 1)) var(--font-display); letter-spacing: -.015em; padding: 0; border-radius: 6px; text-overflow: ellipsis; }
.title-input:focus { box-shadow: 0 0 0 2px var(--line-2); }
.desc-input { width: 100%; border: 0; background: none; outline: none; resize: none; color: var(--ink-2); padding: 2px 0; margin: 4px 0 0 32px; font-size: calc(15px * var(--fs, 1)); overflow: hidden; }
.p-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 14px 0 0 32px; }
.status { padding: 4px 26px 4px 10px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel); font-size: calc(13px * var(--fs, 1)); font-weight: 600; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%238c867c' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 7px center; background-size: 14px; }
.status[data-s="active"] { color: var(--ok); }
.status[data-s="paused"] { color: var(--warn); }
.status[data-s="idea"] { color: #7048e8; }
.status[data-s="done"] { color: var(--ink-3); }
.progress { display: inline-flex; align-items: center; gap: 8px; font-size: calc(13px * var(--fs, 1)); color: var(--ink-3); }
.bar { width: 120px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 3px; }

/* links card */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.links { margin: 22px 0 0; padding: 14px 16px; display: grid; gap: 10px; }
.link-row { display: grid; grid-template-columns: 92px 1fr auto; gap: 10px; align-items: center; }
.link-row .lbl { display: flex; align-items: center; gap: 7px; font-weight: 600; color: var(--ink-2); font-size: calc(13px * var(--fs, 1)); }
.link-row .lbl-input { font-weight: 600; font-size: calc(13px * var(--fs, 1)); padding: 5px 8px; }
.link-row .acts { display: flex; gap: 6px; }
.link-add { justify-self: start; }

/* tabs */
.tabs { display: flex; gap: 2px; margin: 26px 0 16px; border-bottom: 1px solid var(--line); }
.tab { display: flex; align-items: center; gap: 7px; padding: 9px 14px; border: 0; background: none; color: var(--ink-3); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }
.tab .n { font-weight: 500; font-size: calc(12px * var(--fs, 1)); background: var(--hover); padding: 0 6px; border-radius: 999px; }

/* board */
.quick-add { display: flex; gap: 8px; margin-bottom: 14px; }
.board { display: grid; gap: 14px; align-items: start; overflow-x: auto; padding-bottom: 10px; }
.col { background: var(--sidebar); border-radius: var(--radius); padding: 10px; min-height: 140px; border: 1px solid transparent; transition: border-color .15s; }
.col.drop { border-color: var(--accent); border-style: dashed; }
.col-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 10px; font-weight: 600; font-size: calc(13px * var(--fs, 1)); }
.col-head .n { color: var(--ink-3); font-weight: 500; }
.tasks { display: grid; gap: 8px; }
.task { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: start; cursor: grab; box-shadow: 0 1px 1px rgba(0,0,0,.03); }
.task:hover { border-color: var(--line-2); }
.task.dragging { opacity: .4; }
.task.insert-before { box-shadow: 0 -3px 0 var(--accent); }
.task .check { width: 18px; height: 18px; margin-top: 1px; border-radius: 5px; border: 1.6px solid var(--line-2); background: none; padding: 0; display: grid; place-items: center; color: transparent; }
.task .check:hover { border-color: var(--ok); }
.task.done .check { background: var(--ok); border-color: var(--ok); color: #fff; }
.task.done .t-title { color: var(--ink-3); text-decoration: line-through; }
.t-title { word-break: break-word; cursor: text; }
.t-meta { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.chip { font-size: calc(11.5px * var(--fs, 1)); padding: 1px 7px; border-radius: 999px; background: var(--hover); color: var(--ink-2); display: inline-flex; align-items: center; gap: 4px; }
.chip.late { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); font-weight: 600; }
.chip.today { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); font-weight: 600; }
.chip.high { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); font-weight: 600; }
.task .tools { opacity: 0; display: flex; }
.task:hover .tools, .task:focus-within .tools { opacity: 1; }
.task-edit { grid-column: 1 / -1; display: grid; gap: 8px; }
.task-edit .row { display: flex; gap: 8px; flex-wrap: wrap; }
.task-edit .row .field { width: auto; flex: 1; }
.empty-col { color: var(--ink-3); font-size: calc(13px * var(--fs, 1)); text-align: center; padding: 18px 0; }

/* notes */
.notes { display: grid; grid-template-columns: 240px 1fr; gap: 14px; min-height: 420px; }
.note-list { display: flex; flex-direction: column; gap: 4px; }
.note-item { text-align: left; border: 1px solid transparent; background: none; border-radius: 8px; padding: 8px 10px; }
.note-item:hover { background: var(--hover); }
.note-item.active { background: var(--panel); border-color: var(--line); box-shadow: var(--shadow); }
.note-item b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-item span { display: block; font-size: calc(12px * var(--fs, 1)); color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.editor { display: flex; flex-direction: column; padding: 18px 20px; }
.editor .note-title { border: 0; outline: none; background: none; font: 600 calc(19px * var(--fs, 1)) var(--font-display); padding: 0; }
.editor textarea { flex: 1; border: 0; outline: none; background: none; resize: none; min-height: 360px; margin-top: 10px; line-height: 1.65; font-size: calc(14.5px * var(--fs, 1)); }
.editor .foot { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding-top: 10px; }

/* reminders */
.rem-add { display: grid; grid-template-columns: 1fr 220px auto; gap: 8px; margin-bottom: 16px; }
.rem-list { display: grid; gap: 8px; }
.rem { display: grid; grid-template-columns: auto 1fr 220px auto; gap: 10px; align-items: center; padding: 10px 12px; }
.rem.done { opacity: .55; }
.rem.due { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.rem .text { border: 0; background: none; outline: none; padding: 4px 0; }
.rem.done .text { text-decoration: line-through; }

/* today */
.today-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 18px; margin-top: 22px; align-items: start; }
.section { padding: 16px 18px; }
.section h2 { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.item { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 8px 6px; border-radius: 8px; }
.item + .item { border-top: 1px solid var(--line); border-radius: 0; }
.item .proj { font-size: calc(12px * var(--fs, 1)); color: var(--ink-3); display: flex; align-items: center; gap: 5px; cursor: pointer; }
.item .proj:hover { color: var(--ink); }
.empty { color: var(--ink-3); padding: 10px 6px; }
.p-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-top: 18px; }
.p-card { padding: 14px 16px; cursor: pointer; border-top: 3px solid var(--c); display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; min-width: 0; }
.p-card > * { min-width: 0; }
.p-card:hover { border-color: var(--line-2); border-top-color: var(--c); }
.p-card .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.p-card .next { font-size: calc(13px * var(--fs, 1)); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-card .bar { width: 100%; }

/* dialogs and toasts */
dialog { border: 1px solid var(--line); border-radius: 14px; padding: 0; background: var(--panel); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.25); width: min(480px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(16, 16, 16, .45); }
.dlg { padding: 20px 22px; display: grid; gap: 16px; }
.dlg .set { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.dlg .set p { margin: 2px 0 0; }
.dlg .acts { display: flex; justify-content: flex-end; gap: 8px; }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line-2); transition: .15s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .15s; }
.switch input:checked + span { background: var(--brand); box-shadow: inset 0 0 0 1px var(--brand-edge); }
.switch input:checked + span::after { transform: translateX(16px); }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px; }
.swatches button { width: 24px; height: 24px; border-radius: 6px; border: 2px solid transparent; }
.swatches button.on { border-color: var(--ink); }
.pop { position: fixed; z-index: 20; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.menu { padding: 4px; min-width: 180px; display: grid; }
.menu button { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 0; background: none; border-radius: 6px; text-align: left; }
.menu button:hover { background: var(--hover); }
.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 30; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); max-width: 360px; animation: up .2s ease-out; }
.toast.err { background: var(--danger); color: #fff; }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }
.saved { font-size: calc(12px * var(--fs, 1)); color: var(--ink-3); transition: opacity .3s; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .page { padding: 20px 16px 48px; }
  .board, .today-grid, .notes { grid-template-columns: 1fr; }
  .link-row, .rem-add, .rem { grid-template-columns: 1fr; }
  .desc-input, .p-meta { margin-left: 0; }
}

/* ---------- v2 additions ---------- */
.nav-label .acts { display: flex; gap: 2px; }
.nav-label .ws-name { display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-label .ws-name svg { width: 13px; height: 13px; flex: none; }
.nav-note { font-size: calc(12px * var(--fs, 1)); color: var(--ink-3); padding: 2px 10px 6px; }
.nav-note.warn { color: var(--warn); }
.nav-item .shared { width: 13px; height: 13px; color: var(--ink-3); }
.nav-item.subtle { color: var(--ink-3); font-size: calc(13px * var(--fs, 1)); }
.join-ws { margin: 10px 4px 0; }

.chip.ws { background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--ink-2); }
.chip svg { width: 12px; height: 12px; }
.ro-banner { margin: 16px 0 0; padding: 9px 14px; border-radius: 8px; background: var(--hover); color: var(--ink-2); font-size: calc(13px * var(--fs, 1)); display: flex; gap: 8px; align-items: center; }
.field:disabled, .title-input:read-only, .desc-input:read-only { cursor: default; }
.field:disabled { opacity: .7; }

/* generic modal */
#modal { width: min(520px, calc(100vw - 32px)); }
#modal.wide { width: min(680px, calc(100vw - 32px)); }
.dlg h2.title { font-size: calc(19px * var(--fs, 1)); display: flex; align-items: center; gap: 10px; }
.dlg .back { margin: -4px 0 -8px -8px; justify-self: start; }
.dlg label.f { display: grid; gap: 5px; font-size: calc(13px * var(--fs, 1)); font-weight: 600; color: var(--ink-2); }
.dlg .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dlg .hint { font-size: calc(12.5px * var(--fs, 1)); color: var(--ink-3); margin: -6px 0 0; }
.dlg .err { color: var(--danger); font-size: calc(13px * var(--fs, 1)); min-height: 0; }
.dlg .err:empty { display: none; }
.dlg .banner { padding: 10px 12px; border-radius: 8px; font-size: calc(13px * var(--fs, 1)); background: var(--hover); color: var(--ink-2); }
.dlg .banner.warn { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--ink); }
.dlg .banner.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ink); }
.dlg .muted-p { margin: 0; color: var(--ink-2); }
.choice { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; text-align: left; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); width: 100%; }
.choice:hover { border-color: var(--accent); }
.choice .ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.choice .ic svg { width: 20px; height: 20px; }
.choice b { display: block; font-size: calc(15px * var(--fs, 1)); }
.choice span { display: block; color: var(--ink-3); font-size: calc(13px * var(--fs, 1)); margin-top: 2px; }
.step { display: grid; grid-template-columns: 28px 1fr; gap: 12px; }
.step .num { width: 26px; height: 26px; border-radius: 50%; background: var(--hover); display: grid; place-items: center; font-weight: 700; font-size: calc(13px * var(--fs, 1)); }
.step b { display: block; margin-top: 2px; }
.step p { margin: 4px 0 10px; color: var(--ink-2); font-size: calc(13.5px * var(--fs, 1)); }
.step .btns { display: flex; gap: 8px; flex-wrap: wrap; }
pre.code { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); font: calc(12.5px * var(--fs, 1))/1.6 var(--mono); white-space: pre-wrap; word-break: break-all; }
.copy-row { display: flex; gap: 8px; align-items: center; }
.copy-row code { flex: 1; min-width: 0; padding: 7px 10px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); font: 600 calc(14px * var(--fs, 1)) var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; user-select: all; }
.seg { display: flex; gap: 2px; padding: 3px; background: var(--hover); border-radius: 9px; }
.seg button { flex: 1; border: 0; background: none; padding: 6px 10px; border-radius: 7px; color: var(--ink-2); font-weight: 600; }
.seg button.on { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.dlg-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: -6px 0 0; }
.dlg-tabs .tab { padding: 7px 12px; }
.people { display: grid; gap: 2px; max-height: 340px; overflow-y: auto; }
.person { display: grid; grid-template-columns: 32px 1fr auto auto; gap: 10px; align-items: center; padding: 7px 4px; border-radius: 8px; }
.person:hover { background: var(--hover); }
.person.off { opacity: .55; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: calc(13px * var(--fs, 1)); color: #fff; }
.person .who b { display: block; font-weight: 600; }
.person .who span { font-size: calc(12px * var(--fs, 1)); color: var(--ink-3); }
.add-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; }
.secret { font: 700 calc(18px * var(--fs, 1)) var(--mono); letter-spacing: .04em; text-align: center; padding: 12px; border-radius: 8px; background: var(--bg); border: 1px dashed var(--line-2); user-select: all; }
.set select.field { max-width: 230px; }
@media (max-width: 900px) { .dlg .grid2 { grid-template-columns: 1fr; } .person { grid-template-columns: 32px 1fr auto; } }
.join-ws .name { white-space: normal; line-height: 1.35; }

/* ---------- project space ---------- */
.space-pick { margin: 0 12px 12px; display: grid; gap: 4px; }
.space-pick label { font-size: calc(11px * var(--fs, 1)); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.space-row { display: flex; gap: 4px; align-items: center; }
.space-row select { flex: 1; min-width: 0; font-weight: 600; padding: 7px 8px; background: var(--panel); }
.space-row .icon-btn { width: 32px; height: 32px; flex: none; }
.new-project:disabled, .search input:disabled { opacity: .45; cursor: default; }
.signin-page { display: grid; place-items: center; min-height: calc(100vh - 40px); padding-top: 40px; }
.signin { width: min(440px, 100%); padding: 28px; display: grid; gap: 14px; }
.signin .mark { width: 44px; height: 44px; border-radius: 12px; background: var(--brand); display: grid; place-items: center; color: #fff; }
.signin .mark svg { width: 22px; height: 22px; }
.signin h1 { font-size: calc(22px * var(--fs, 1)); }
.signin .sub { margin: -8px 0 0; color: var(--ink-3); }
.signin .err { color: var(--danger); font-size: calc(13px * var(--fs, 1)); }
.signin .err:empty { display: none; }
.signin label.f { display: grid; gap: 5px; font-size: calc(13px * var(--fs, 1)); font-weight: 600; color: var(--ink-2); }
.signin .hint { font-size: calc(12.5px * var(--fs, 1)); color: var(--ink-3); font-weight: 400; }
.signin .banner { padding: 10px 12px; border-radius: 8px; font-size: calc(13px * var(--fs, 1)); background: var(--hover); color: var(--ink-2); }
.signin .banner.warn { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--ink); }
.signin .primary-row { display: flex; justify-content: flex-end; }
.signin .alt { border-top: 1px solid var(--line); padding-top: 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.signin .alt .muted { font-size: calc(13px * var(--fs, 1)); }
.switch-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
[hidden] { display: none !important; }
.space-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px; align-items: center; }
.space-row select { width: 100%; text-overflow: ellipsis; }

/* ---------- project badges (icon or first letter on a tint of the colour) ---------- */
.pbadge { --tint: color-mix(in srgb, var(--c) 15%, transparent); --fg: var(--c);
  display: inline-grid; place-items: center; flex: none; background: var(--tint); color: var(--fg);
  width: 20px; height: 20px; border-radius: 6px; transition: box-shadow .12s; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pbadge { --tint: color-mix(in srgb, var(--c) 24%, transparent); --fg: color-mix(in srgb, var(--c) 72%, white); } }
:root[data-theme="dark"] .pbadge { --tint: color-mix(in srgb, var(--c) 24%, transparent); --fg: color-mix(in srgb, var(--c) 72%, white); }
.pbadge .pi { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.pbadge b { font: 700 calc(11px * var(--fs, 1))/1 var(--font-display); }
.pbadge.faded { opacity: .45; }
.pbadge.xs { width: 16px; height: 16px; border-radius: 5px; }
.pbadge.xs .pi { width: 11px; height: 11px; }
.pbadge.xs b { font-size: calc(9.5px * var(--fs, 1)); }
.pbadge.md { width: 26px; height: 26px; border-radius: 7px; }
.pbadge.md .pi { width: 16px; height: 16px; }
.pbadge.md b { font-size: calc(13px * var(--fs, 1)); }
.pbadge.lg { width: 44px; height: 44px; border-radius: 12px; }
.pbadge.lg .pi { width: 24px; height: 24px; stroke-width: 1.9; }
.pbadge.lg b { font-size: calc(20px * var(--fs, 1)); }
.p-card-name { display: flex; align-items: center; gap: 9px; min-width: 0; flex: 1; }
.p-card-links { display: flex; flex: none; }
.p-card-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- appearance picker ---------- */
.appear { width: 336px; padding: 12px; display: grid; gap: 10px; }
.appear-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.appear-head b { font-size: calc(12px * var(--fs, 1)); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.appear-head .field { width: 170px; padding: 5px 9px; font-size: calc(13px * var(--fs, 1)); }
.appear-head .hex { width: 96px; text-transform: lowercase; }
.ic-grid { --tint: color-mix(in srgb, var(--c) 15%, transparent); display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px;
  max-height: 212px; overflow-y: auto; padding: 2px; margin: 0 -2px; }
.ic-tile { aspect-ratio: 1; border: 0; border-radius: 8px; background: none; color: var(--ink-2); display: grid; place-items: center; padding: 0; }
.ic-tile:hover { background: var(--hover); color: var(--ink); }
.ic-tile.on { background: var(--tint); color: var(--c); box-shadow: inset 0 0 0 1.5px var(--c); }
.ic-tile .pi { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic-tile b { font: 700 calc(14px * var(--fs, 1))/1 var(--font-display); }
.ic-none { grid-column: 1 / -1; margin: 6px 4px; }
.appear .swatches { padding: 0; gap: 6px; }
.appear .swatches button, .custom-colour { width: 26px; height: 26px; border-radius: 7px; border: 2px solid transparent; }
.custom-colour { position: relative; display: block; cursor: pointer; overflow: hidden;
  background: conic-gradient(from 90deg, #e03131, #e67700, #f5c518, #2b8a3e, #1971c2, #6741d9, #c2255c, #e03131); }
.custom-colour.on { border-color: var(--ink); }
.custom-colour input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; border: 0; padding: 0; }
.appear-foot { margin: 0; border-top: 1px solid var(--line); padding-top: 9px; font-size: calc(12px * var(--fs, 1)); color: var(--ink-3); }

/* ---------- email and codes ---------- */
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font-size: calc(13px * var(--fs, 1)); cursor: pointer; justify-self: start; text-align: left; }
.link-btn:hover { text-decoration: underline; }
.row-links { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.code-input { font-size: calc(20px * var(--fs, 1)); letter-spacing: .25em; text-align: center; padding: 8px 10px; }
.code-row .code-input { width: 150px; flex: none; font-size: calc(17px * var(--fs, 1)); padding: 6px 8px; }
.switch-row.off { opacity: .65; }
.pi { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.signin .mark .pi { width: 22px; height: 22px; }
.dlg .grid2 { align-items: start; }

/* ---------- 2.4: sign-in, passkeys ---------- */
.primary-row { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: calc(12px * var(--fs, 1)); text-transform: uppercase; letter-spacing: .06em; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.passkey-btn { width: 100%; justify-content: center; padding: 9px 12px; }
.link-btn.subtle { color: var(--ink-3); font-size: calc(12.5px * var(--fs, 1)); }
.link-btn.subtle:hover { color: var(--ink); }
.pk-wait { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 10px; background: var(--hover); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid color-mix(in srgb, var(--accent) 25%, transparent); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.avatar.pk-av { background: var(--hover); color: var(--ink-2); }
.avatar.pk-av .i { width: 16px; height: 16px; }
.add-row.four { grid-template-columns: 1fr 1fr 1.3fr auto; }
@media (max-width: 900px) { .add-row.four { grid-template-columns: 1fr 1fr; } }
.dlg .copy-row .field { flex: 1; }

/* ---------- 2.5: settings with sections ---------- */
#modal.xwide { width: min(860px, calc(100vw - 32px)); }
.settings { display: grid; grid-template-columns: minmax(210px, max-content) 1fr; height: min(640px, calc(100vh - 64px)); }
.set-nav { background: var(--sidebar); border-right: 1px solid var(--line); padding: 16px 10px; display: grid; align-content: start; gap: 2px; border-radius: 12px 0 0 12px; }
.set-tab { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 8px 10px; border-radius: 8px; text-align: left; color: var(--ink-2); font-weight: 500; }
.set-tab:hover { background: var(--hover); color: var(--ink); }
.set-tab.on { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.set-tab .tier { margin-left: auto; padding-left: 6px; }
.set-tab { white-space: nowrap; }
.tier { font-size: calc(10px * var(--fs, 1)); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent); padding: 2px 6px; border-radius: 999px; }
.set-body { padding: 22px 26px 18px; display: flex; flex-direction: column; gap: 18px; overflow-y: auto; min-height: 0; }
.set-body > h2.title { font-size: calc(19px * var(--fs, 1)); margin: 0; }
.set-body .set select.field { min-width: 250px; width: auto; }
.set-body .set { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.set-body .set p { margin: 2px 0 0; }
.set-group { display: grid; gap: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.set-body > .set-group:first-of-type, .set-body > .tier-banner + .set-group { border-top: 0; padding-top: 0; }
.set-group h3 { margin: 0; font-size: calc(12px * var(--fs, 1)); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.set-foot { margin-top: auto; padding-top: 6px; display: flex; justify-content: flex-end; }
.ctl-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.tier-banner { background: color-mix(in srgb, var(--accent) 9%, transparent); color: var(--ink); border-radius: 10px; padding: 12px 14px; font-size: calc(13px * var(--fs, 1)); }
.person.acct { background: var(--hover); border-radius: 10px; padding: 10px 12px; }
.about-head { display: flex; align-items: center; gap: 14px; }
.about-head > div:nth-child(2) { flex: 1; }
.about-head p { margin: 2px 0 0; }
.logo.big { width: 48px; height: 48px; border-radius: 13px; background: var(--brand); display: grid; place-items: center; flex: none; }
.logo.big i { display: block; height: 5.5px; border-radius: 3px; background: #fff; margin: 2.75px 0; }
.upd-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.upd-status { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.upd-status.ok { color: var(--ok); }
.upd-status.bad { color: var(--danger); font-weight: 500; }
.upd-status.new { color: var(--accent); }
.upd-notes { background: var(--hover); border-radius: 10px; padding: 12px 14px; }
.upd-notes p { margin: 6px 0 0; white-space: pre-wrap; color: var(--ink-2); }
.danger-title .i { color: var(--danger); }
.warn-list { margin: -6px 0 0; padding-left: 20px; color: var(--ink-2); display: grid; gap: 4px; }
.btn.danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 600; }
.btn.danger-solid:hover:not(:disabled) { filter: brightness(1.06); border-color: var(--danger); }
.toast.action { display: flex; align-items: center; gap: 12px; }
.toast.action button { border: 0; background: var(--brand); box-shadow: inset 0 0 0 1px var(--brand-edge); color: #fff; font-weight: 600; border-radius: 7px; padding: 5px 10px; cursor: pointer; white-space: nowrap; }
details.diag summary { cursor: pointer; color: var(--ink-2); font-size: calc(13px * var(--fs, 1)); }
details.diag pre { margin: 8px 0 0; padding: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; font: calc(12px * var(--fs, 1))/1.5 var(--mono); white-space: pre-wrap; max-height: 180px; overflow: auto; }
@media (max-width: 760px) { .settings { grid-template-columns: 1fr; } .set-nav { grid-auto-flow: column; overflow-x: auto; border-radius: 12px 12px 0 0; border-right: 0; border-bottom: 1px solid var(--line); } .set-tab .tier { display: none; } }

.set-body .set { flex-wrap: wrap; }
.set-body .set > div:first-child { flex: 1 1 260px; }

/* ---------- 2.6: board columns ---------- */
.col.tinted { background: color-mix(in srgb, var(--cc) 13%, var(--sidebar)); }
.col-head { gap: 6px; border-radius: 8px; }
.col-head .col-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-head.tinted { background: var(--hc); padding: 6px 6px 6px 10px; margin: -2px -2px 10px; }
.col-head.tinted .n, .col-head.tinted .col-done { color: inherit; opacity: .8; }
.col-head .col-done { color: var(--ok); display: inline-flex; }
.col-head .col-done svg { width: 14px; height: 14px; }
.col-head .col-more { width: 24px; height: 24px; color: inherit; opacity: .65; }
.col-head .col-more:hover { opacity: 1; }
.add-col { align-self: stretch; min-height: 140px; width: 44px; padding: 0; border: 1.5px dashed var(--line-2); background: none; border-radius: var(--radius); color: var(--ink-3); display: flex; align-items: center; justify-content: center; gap: 6px; font-weight: 600; }
.add-col:hover { color: var(--ink); border-color: var(--ink-3); }
.col-menu { padding: 12px; display: grid; gap: 8px; width: 270px; }
.col-menu > b { font-size: calc(12px * var(--fs, 1)); color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.col-menu .menu { padding: 4px 0 0; border-top: 1px solid var(--line); min-width: 0; }
.swatches.small { padding: 0; gap: 5px; }
.swatches.small button, .swatches.small .custom-colour { width: 22px; height: 22px; }
.swatches button.none { background: var(--panel); border: 1.5px dashed var(--line-2); display: grid; place-items: center; color: var(--ink-3); padding: 0; }
.swatches button.none.on { border-style: solid; border-color: var(--ink); }
.swatches button.none svg { width: 12px; height: 12px; }
.check-row { display: flex; gap: 8px; align-items: center; font-size: calc(13.5px * var(--fs, 1)); cursor: pointer; }
.check-row input { width: 16px; height: 16px; accent-color: var(--accent); }

/* task cards */
.task { cursor: pointer; }
.t-body { min-width: 0; }
.t-title { cursor: inherit; }
.t-labels { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 5px; }
.lbl { font-size: calc(11px * var(--fs, 1)); font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--lc); line-height: 1.6; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-meta .mini { display: inline-flex; align-items: center; gap: 3px; font-size: calc(11.5px * var(--fs, 1)); color: var(--ink-3); }
.t-meta .mini svg { width: 13px; height: 13px; }
.t-meta .mini.ok { color: var(--ok); }
.avs { display: inline-flex; margin-left: auto; }
.av { width: 20px; height: 20px; border-radius: 50%; color: #fff; font-size: 9px; font-weight: 700; display: inline-grid; place-items: center; flex: none; }
.avs .av { margin-left: -5px; border: 2px solid var(--panel); width: 22px; height: 22px; }
.t-link { cursor: pointer; }
.t-link:hover { text-decoration: underline; }

/* the task dialog */
#modal[data-kind="task"] { width: min(760px, calc(100vw - 32px)); }
.task-dlg { gap: 14px; }
.task-top { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; }
.task-title { border: 0; background: none; font-size: calc(20px * var(--fs, 1)); font-weight: 700; color: var(--ink); resize: none; outline: none; padding: 2px 0; line-height: 1.3; overflow: hidden; font-family: inherit; }
.task-title:focus { box-shadow: 0 2px 0 var(--accent); }
.check.big { width: 26px; height: 26px; margin-top: 3px; border-radius: 8px; border: 2px solid var(--line-2); background: none; padding: 0; display: grid; place-items: center; color: transparent; }
.check.big:hover { border-color: var(--ok); }
.check.big.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.task-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 900px) { .task-grid { grid-template-columns: 1fr 1fr; } }
.task-sec { display: grid; gap: 7px; }
.task-sec > b { font-size: calc(12px * var(--fs, 1)); color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; display: flex; align-items: center; gap: 6px; }
.task-sec > b .n { background: var(--hover); color: var(--ink-2); border-radius: 999px; padding: 0 7px; font-size: calc(11px * var(--fs, 1)); text-transform: none; letter-spacing: 0; }
.task-desc { resize: vertical; min-height: 70px; line-height: 1.5; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip-add { display: inline-flex; align-items: center; gap: 4px; border: 1px dashed var(--line-2); background: none; border-radius: 999px; padding: 2px 10px; color: var(--ink-2); font-size: calc(12.5px * var(--fs, 1)); }
.chip-add:hover { border-color: var(--ink-3); color: var(--ink); }
.chip-add svg { width: 12px; height: 12px; }
.person-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--hover); border-radius: 999px; padding: 2px 4px 2px 2px; font-size: calc(13px * var(--fs, 1)); }
.person-chip .x { border: 0; background: none; padding: 0 2px; color: var(--ink-3); display: inline-grid; }
.person-chip .x svg { width: 12px; height: 12px; }
.menu .av { margin-right: 2px; }
.checklist { display: grid; gap: 4px; }
.checklist .progress { margin-bottom: 4px; }
.cl-item { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; }
.cl-item input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--ok); }
.cl-text { border: 0; background: none; padding: 4px 2px; outline: none; border-bottom: 1px solid transparent; color: var(--ink); }
.cl-text:focus { border-bottom-color: var(--line-2); }
.cl-item.done .cl-text { color: var(--ink-3); text-decoration: line-through; }
.cl-item .icon-btn { width: 26px; height: 26px; opacity: .5; }
.cl-item:hover .icon-btn { opacity: 1; }
.comments { display: grid; gap: 10px; }
.comment { display: grid; gap: 4px; }
.c-head { display: flex; gap: 8px; align-items: center; }
.c-head .c-acts { margin-left: auto; display: flex; gap: 10px; }
.c-text { white-space: pre-wrap; word-break: break-word; padding-left: 28px; line-height: 1.5; }
.say { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
.history summary { cursor: pointer; font-size: calc(12px * var(--fs, 1)); color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.history ul { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; font-size: calc(13px * var(--fs, 1)); }
.history li { display: flex; justify-content: space-between; gap: 12px; }
.link-btn.danger { color: var(--danger); }
.label-menu { padding: 10px; display: grid; gap: 8px; width: 260px; }
.label-menu .menu { padding: 0; min-width: 0; max-height: 220px; overflow-y: auto; }
.lbl-row { display: grid; grid-template-columns: 1fr auto; align-items: center; }
.lbl-row .icon-btn { width: 28px; height: 28px; opacity: .45; }
.lbl-row:hover .icon-btn { opacity: 1; }
.lbl-pick { display: flex !important; gap: 8px; align-items: center; min-width: 0; }
.lbl-pick .tick { width: 16px; display: inline-grid; color: var(--ok); }
.lbl-pick .tick svg { width: 14px; height: 14px; }
@media (max-width: 640px) { .task-grid { grid-template-columns: 1fr; } }

/* encryption */
.chip.e2e { background: color-mix(in srgb, var(--ok) 13%, transparent); color: var(--ok); font-weight: 600; }
.nav-item .name.locked { color: var(--ink-3); font-style: italic; }
.locked-card { padding: 34px 28px; text-align: center; max-width: 540px; margin: 40px auto 0; display: grid; gap: 12px; justify-items: center; }
.locked-card .mark, .signin.keys .mark { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.locked-card .mark svg, .signin.keys .mark svg { width: 26px; height: 26px; }
.locked-card h1 { margin: 0; font-size: calc(22px * var(--fs, 1)); }
.signin.keys .ticks { margin: 0; padding-left: 20px; display: grid; gap: 6px; color: var(--ink-2); }
.recovery span { white-space: nowrap; }
.recovery { font-family: ui-monospace, Consolas, Menlo, monospace; font-size: calc(17px * var(--fs, 1)); font-weight: 600; letter-spacing: .04em; text-align: center; padding: 14px; border-radius: 10px; background: var(--hover); border: 1px dashed var(--line-2); user-select: all; line-height: 1.6; }
.code-big { font-family: ui-monospace, Consolas, Menlo, monospace; font-size: calc(30px * var(--fs, 1)); font-weight: 700; letter-spacing: .12em; text-align: center; padding: 10px; }
.sec-code { font-family: ui-monospace, Consolas, Menlo, monospace; font-size: calc(13px * var(--fs, 1)); background: var(--hover); padding: 4px 8px; border-radius: 6px; white-space: nowrap; }
.e2e-banner { display: flex; gap: 6px; align-items: flex-start; }
.e2e-banner svg { flex: none; margin-top: 2px; color: var(--ok); }
.danger-solid[disabled] { opacity: .5; }
.space-name { flex: 1; min-width: 0; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* authenticator apps (2.7) */
.alt-signin { display: flex; flex-wrap: wrap; gap: 4px 16px; justify-content: center; }
.alt-signin .link-btn .i { width: 15px; height: 15px; vertical-align: -3px; margin-right: 4px; }
.totp-setup { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.totp-qr-wrap { background: #fff; padding: 8px; border-radius: 10px; border: 1px solid var(--line); line-height: 0; flex: none; }
.totp-qr { width: 176px; height: 176px; image-rendering: pixelated; }
.totp-steps { flex: 1; min-width: 240px; display: flex; flex-direction: column; gap: 8px; }
.totp-steps p { margin: 0; }
.copy-row code.totp-key { white-space: normal; overflow: visible; text-overflow: clip; letter-spacing: .04em; line-height: 1.6; }

/* ---------- 3.0: project views ---------- */
.page.wide { max-width: 1480px; }
.view-top { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.view-switch { display: flex; gap: 2px; padding: 3px; background: var(--hover); border-radius: 10px; overflow-x: auto; max-width: 100%; }
.vs-btn { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 6px 11px; border-radius: 8px; color: var(--ink-2); font-weight: 600; white-space: nowrap; }
.vs-btn:hover:not(:disabled) { color: var(--ink); }
.vs-btn.on { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.vs-btn.locked { opacity: .55; cursor: not-allowed; }
.vs-btn svg { width: 15px; height: 15px; }
.view-filters { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.view-filters .vq { width: 220px; }
.check-row.small { font-size: calc(13px * var(--fs, 1)); color: var(--ink-2); }
.all-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin-bottom: 20px; }
.flip svg { transform: rotate(180deg); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; }

/* table */
.table-card { overflow: hidden; }
.table-wrap { overflow-x: auto; }
table.tv { width: 100%; border-collapse: collapse; font-size: calc(13.5px * var(--fs, 1)); }
table.tv th { text-align: left; font-weight: 600; color: var(--ink-3); font-size: calc(12px * var(--fs, 1)); padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; user-select: none; }
table.tv th.sortable { cursor: pointer; }
table.tv th.sortable:hover, table.tv th.sorted { color: var(--ink); }
table.tv th .arrow { margin-left: 4px; }
table.tv td { padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tv tbody tr:last-child td { border-bottom: 0; }
table.tv tbody tr:hover td { background: var(--hover); }
table.tv tr.done .c-title .t-link { color: var(--ink-3); text-decoration: line-through; }
table.tv .c-check { width: 34px; }
table.tv .c-title { min-width: 220px; }
table.tv .t-link { border: 0; background: none; padding: 0; text-align: left; font-weight: 600; }
table.tv .c-proj .proj { border: 0; background: none; padding: 0; display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); white-space: nowrap; }
table.tv select.field, table.tv .date-in { padding: 3px 6px; min-width: 0; height: 30px; font-size: calc(13px * var(--fs, 1)); border-color: transparent; background-color: transparent; }
table.tv select.field:hover, table.tv .date-in:hover, table.tv select.field:focus, table.tv .date-in:focus { border-color: var(--line-2); background-color: var(--panel); }
table.tv .date-in { width: 140px; }
table.tv .date-in.late { color: var(--danger); font-weight: 600; }
table.tv .pri-high { color: var(--accent); font-weight: 600; }
table.tv .c-labels { white-space: nowrap; }
table.tv .c-labels .lbl { margin-right: 4px; display: inline-block; max-width: 120px; vertical-align: middle; }
table.tv .avs { margin-left: 6px; }
table.tv .num { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.check { width: 18px; height: 18px; border-radius: 5px; border: 1.6px solid var(--line-2); background: none; padding: 0; display: grid; place-items: center; color: transparent; }
.check:hover:not(:disabled) { border-color: var(--ok); }
.check.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.check svg { width: 12px; height: 12px; }
.table-card .empty { text-align: center; padding: 26px; }

/* calendar */
.cal { padding: 14px; }
.cal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-nav h2 { font-size: calc(17px * var(--fs, 1)); margin: 0 6px; min-width: 170px; text-align: center; }
.cal-tools { display: flex; align-items: center; gap: 12px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal-dow { font-size: calc(12px * var(--fs, 1)); font-weight: 600; color: var(--ink-3); padding: 6px 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-transform: capitalize; }
.cal-day { min-height: 112px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px 5px 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day.we { background: color-mix(in srgb, var(--ink) 2.5%, transparent); }
.cal-day.out { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.cal-day.out .cal-num span { color: var(--ink-3); }
.cal-day.drop { outline: 2px solid var(--accent); outline-offset: -2px; }
.cal-num { display: flex; justify-content: space-between; align-items: center; font-size: calc(12.5px * var(--fs, 1)); font-weight: 600; color: var(--ink-2); height: 22px; }
.cal-day.today .cal-num span { background: var(--brand); color: var(--accent-ink); border-radius: 999px; min-width: 22px; height: 22px; display: inline-grid; place-items: center; padding: 0 6px; }
.cal-add { border: 0; background: none; color: var(--ink-3); width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; opacity: 0; }
.cal-day:hover .cal-add, .cal-add:focus { opacity: 1; }
.cal-add:hover { background: var(--hover); color: var(--ink); }
.cal-add svg { width: 14px; height: 14px; }
.cal-items { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-chip { display: flex; align-items: center; gap: 5px; width: 100%; min-width: 0; border: 0; text-align: left; font-size: calc(12px * var(--fs, 1)); line-height: 1.35; padding: 3px 6px; border-radius: 6px;
  background: color-mix(in srgb, var(--cc, var(--accent)) 13%, var(--panel)); color: var(--ink); }
.cal-chip span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-chip .dot { width: 7px; height: 7px; background: var(--cc, var(--accent)); }
.cal-chip:hover { background: color-mix(in srgb, var(--cc, var(--accent)) 22%, var(--panel)); }
.cal-chip.done { opacity: .6; }
.cal-chip.done span:last-child { text-decoration: line-through; }
.cal-chip.late { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--danger) 55%, transparent); }
.cal-chip.rem { background: var(--hover); color: var(--ink-2); }
.cal-chip.rem svg { width: 12px; height: 12px; }
.cal-chip.dragging { opacity: .4; }
.cal-more { border: 0; background: none; color: var(--ink-3); font-size: calc(12px * var(--fs, 1)); text-align: left; padding: 1px 6px; border-radius: 6px; }
.cal-more:hover { color: var(--ink); background: var(--hover); }
.cal-pop { display: flex; flex-direction: column; gap: 4px; min-width: 220px; max-width: 300px; padding: 4px; }
@media (max-width: 760px) { .cal-day { min-height: 74px; padding: 3px; } .cal-chip .dot { display: none; } .cal-chip { padding: 2px 4px; font-size: 11px; } }

/* timeline */
.tl { padding: 0; overflow: hidden; --tl-we: color-mix(in srgb, var(--ink) 4%, transparent); }
.tl-top { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); gap: 10px; }
.tl-zoom { width: auto; }
.tl-scroll { overflow-x: auto; overflow-y: hidden; }
.tl-body { position: relative; }
.tl-row { display: flex; min-height: 34px; border-bottom: 1px solid var(--line); }
.tl-row:last-of-type { border-bottom: 0; }
.tl-lbl { position: sticky; left: 0; z-index: 2; width: var(--lbl); flex: none; background: var(--panel); border-right: 1px solid var(--line); padding: 6px 12px; display: flex; align-items: center; gap: 8px; min-width: 0; }
.tl-lbl .t-link { border: 0; background: none; padding: 0; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tl-lbl .muted.small { white-space: nowrap; }
.tl-row.done .tl-lbl .t-link { color: var(--ink-3); text-decoration: line-through; }
.tl-group .tl-lbl { background: color-mix(in srgb, var(--ink) 3%, var(--panel)); }
.tl-group .tl-lbl b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-group .tl-lbl .n { color: var(--ink-3); font-size: calc(12px * var(--fs, 1)); margin-left: auto; }
.tl-group .tl-track { background: color-mix(in srgb, var(--ink) 3%, var(--panel)); }
.tl-track { position: relative; flex: none; }
.tl-track.plan { cursor: copy; }
.tl-track.plan:hover { background-color: color-mix(in srgb, var(--accent) 5%, transparent); }
.tl-head { min-height: 46px; position: sticky; top: 0; z-index: 3; background: var(--panel); }
.tl-corner { background: var(--panel); }
.tl-month { position: absolute; top: 0; height: 22px; border-left: 1px solid var(--line); font-size: calc(12px * var(--fs, 1)); font-weight: 600; color: var(--ink-2); padding: 3px 6px; overflow: hidden; white-space: nowrap; text-transform: capitalize; }
.tl-tick { position: absolute; top: 24px; height: 22px; border-left: 1px solid var(--line); font-size: calc(11px * var(--fs, 1)); color: var(--ink-3); padding: 3px 4px; font-variant-numeric: tabular-nums; overflow: hidden; }
.tl-tick.we { background: var(--tl-we); }
.tl-today { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--accent); z-index: 1; pointer-events: none; opacity: .8; }
.tl-bar { position: absolute; top: 6px; height: 22px; border-radius: 6px; background: color-mix(in srgb, var(--bc, var(--accent)) 80%, var(--panel)); color: #fff; display: flex; align-items: center; cursor: grab; touch-action: none; box-shadow: 0 0 0 2px var(--panel); }
.tl-bar.ro { cursor: pointer; }
.tl-bar.dragging { cursor: grabbing; opacity: .85; z-index: 4; }
.tl-bar.done { opacity: .45; }
.tl-bar.late { box-shadow: 0 0 0 2px var(--panel), 0 0 0 3.5px var(--danger); }
.tl-bar-t { padding: 0 8px; font-size: calc(12px * var(--fs, 1)); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; text-shadow: 0 1px 1px rgba(0,0,0,.25); pointer-events: none; }
.tl-h { width: 8px; align-self: stretch; cursor: ew-resize; flex: none; border-radius: 6px; }
.tl-h:hover { background: rgba(255,255,255,.35); }
.tl .empty { padding: 26px; text-align: center; }
@media (max-width: 760px) { .tl-body { --lbl: 150px !important; } }

/* dashboard */
.dash .stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat { padding: 14px 16px; }
.stat-l { color: var(--ink-2); font-size: calc(13px * var(--fs, 1)); display: flex; align-items: center; gap: 6px; }
.stat-v { font-size: calc(30px * var(--fs, 1)); font-weight: 650; letter-spacing: -.01em; margin-top: 2px; }
.stat.bad .stat-l { color: var(--danger); font-weight: 600; }
.stat.bad .stat-l svg { width: 14px; height: 14px; }
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
.dash-card { padding: 14px 16px 16px; }
.dash-card.wide { grid-column: 1 / -1; }
.dash-card h3 { margin: 0 0 10px; font-size: calc(14px * var(--fs, 1)); }
.hbars { display: flex; flex-direction: column; gap: 8px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 34%) 1fr; gap: 10px; align-items: center; font-size: calc(13px * var(--fs, 1)); }
.hb-l { display: flex; align-items: center; gap: 7px; color: var(--ink-2); min-width: 0; }
.hb-l span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-t { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hb-t i { display: block; height: 14px; border-radius: 0 4px 4px 0; background: var(--accent); max-width: calc(100% - 40px); }
.hb-t i.bad { background: var(--danger); }
.hb-t b { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); }
.vbars { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 10px; align-items: end; height: 170px; }
.vbar { display: flex; flex-direction: column; align-items: center; height: 100%; gap: 4px; min-width: 0; }
.vbar b { font-size: calc(12px * var(--fs, 1)); font-variant-numeric: tabular-nums; height: 16px; }
.vb-t { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; border-bottom: 1px solid var(--line-2); }
.vb-t i { display: block; width: min(24px, 70%); background: var(--accent); border-radius: 4px 4px 0 0; }
.vb-l { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.dash-projects { display: flex; flex-direction: column; }
.dp-row { display: grid; grid-template-columns: auto minmax(0, 1fr) 190px auto; gap: 10px; align-items: center; border: 0; background: none; text-align: left; padding: 8px 6px; border-radius: 8px; }
.dp-row:hover { background: var(--hover); }
.dp-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dp-row .progress .bar { width: 120px; }
@media (max-width: 900px) { .dash .stats { grid-template-columns: 1fr 1fr; } .dash-grid { grid-template-columns: 1fr; } .dp-row { grid-template-columns: auto minmax(0, 1fr) auto; } .dp-row .progress { display: none; } .view-filters .vq { width: 100%; } }
.tl-out { position: absolute; top: 9px; font-size: calc(12px * var(--fs, 1)); color: var(--ink-2); white-space: nowrap; pointer-events: none; }
.tl-out.done { color: var(--ink-3); text-decoration: line-through; }
table.tv .date-in.empty:not(:focus) { color: var(--ink-3); opacity: .55; }
.dl-steps { margin: 6px 0 0; padding-left: 1.2em; color: var(--ink-2); display: grid; gap: 4px; }
.legal-note { font-size: calc(12.5px * var(--fs, 1)); color: var(--ink-3); margin: 2px 0 0; }
.legal-note a { color: var(--accent); }
/* devices (3.2) */
.dev-list { display: grid; gap: 8px; margin-top: 10px; }
.dev { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.dev.current { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.dev-ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--hover); color: var(--ink-2); }
.dev-main { min-width: 0; }
.dev-main b { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; overflow-wrap: anywhere; }
.dev-main p { margin: 2px 0 0; overflow-wrap: anywhere; }
.dev .chip { font-weight: 600; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.dev .chip.muted { background: var(--hover); color: var(--ink-3); }
.dev .ctl-row { flex-wrap: wrap; justify-content: flex-end; }
.btn.sm { padding: 4px 10px; font-size: calc(12.5px * var(--fs, 1)); }
.btn.danger-text { color: var(--danger); }
@media (max-width: 640px) { .dev { grid-template-columns: auto minmax(0, 1fr); } .dev .ctl-row { grid-column: 1 / -1; justify-content: flex-start; } }
/* uploaded project icons (3.2) */
.pbadge.img { background: transparent; overflow: hidden; } /* 3.4: the project chooses what shows behind it */
.pbadge.img img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit; }
.appear-img { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.appear-img .appear-foot { border-top: 0; padding-top: 0; }

/* encryption codes: an input with a Paste button (3.2) */
.paste-row { display: flex; gap: 8px; align-items: center; }
.paste-row .field { flex: 1; min-width: 0; }
.paste-row .btn { flex: none; }

/* ---------- 3.4: @mentions, the inbox and attachments ---------- */
.mention { color: var(--accent); font-weight: 600; background: color-mix(in srgb, var(--accent) 10%, transparent); border-radius: 4px; padding: 0 2px; }
.mention-wrap { position: relative; }
.mention-pop { position: absolute; left: 0; bottom: calc(100% + 4px); z-index: 30; min-width: 220px; max-width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 4px; display: grid; }
.mention-pop[hidden] { display: none; }
.mention-pop button { display: flex; align-items: center; gap: 8px; text-align: left; padding: 6px 8px; border: 0; background: none; border-radius: 7px; color: var(--ink); min-width: 0; }
.mention-pop button b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mention-pop button.on, .mention-pop button:hover { background: var(--hover); }

.inbox h1 { margin: 0; }
.inbox .row.between { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.notes-list { display: grid; padding: 4px; }
.note-row { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; text-align: left; padding: 12px; border: 0; background: none; border-radius: 8px; color: var(--ink); width: 100%; }
.note-row + .note-row { border-top: 1px solid var(--line); border-radius: 0; }
.note-row:hover { background: var(--hover); }
.note-row .av { width: 30px; height: 30px; font-size: 11px; }
.note-row.unread .note-title b::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: 7px; vertical-align: middle; }
.note-row:not(.unread) .note-title b { font-weight: 500; color: var(--ink-2); }
.note-body { display: grid; gap: 3px; min-width: 0; }
.note-title { display: flex; align-items: center; gap: 6px; }
.note-title svg { width: 14px; height: 14px; color: var(--ink-3); flex: none; }
.note-body .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-snip { color: var(--ink-2); font-size: calc(13px * var(--fs, 1)); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.note-at { white-space: nowrap; }
.empty-inbox { display: grid; justify-items: center; gap: 6px; padding: 40px 16px; text-align: center; }
.empty-inbox svg { width: 34px; height: 34px; color: var(--ink-3); }

.att-list { display: grid; gap: 6px; border-radius: 10px; padding: 2px; transition: background .12s, box-shadow .12s; }
.att-list.drop { background: color-mix(in srgb, var(--accent) 8%, transparent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); }
.att-list > .chip-add { justify-self: start; }
.att-hint { margin-top: -2px; }
.att { display: flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 8px; padding: 4px 4px 4px 4px; min-width: 0; }
.att-main { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; text-align: left; border: 0; background: none; padding: 2px; border-radius: 6px; color: var(--ink); }
.att-main:hover { background: var(--hover); }
.att-thumb { width: 40px; height: 40px; border-radius: 6px; background: var(--hover); display: grid; place-items: center; overflow: hidden; flex: none; color: var(--ink-3); }
.att-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att-thumb svg { width: 18px; height: 18px; }
.att-text { display: grid; min-width: 0; }
.att-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.att.uploading { opacity: .75; padding: 6px; }
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(10,10,10,.82); display: grid; grid-template-rows: 1fr auto; place-items: center; padding: 24px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 110px); object-fit: contain; border-radius: 6px; box-shadow: 0 10px 40px rgba(0,0,0,.4); }
.lb-bar { display: flex; align-items: center; gap: 10px; color: #fff; margin-top: 14px; cursor: default; max-width: 100%; }
.lb-bar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-bar .icon-btn { color: #fff; }
.meter { width: 120px; height: 7px; border-radius: 4px; background: var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); }
.meter.full i { background: var(--danger); }

/* ---------- 3.4: the icon editor ---------- */
.icon-editor .ie-body { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: start; margin: 4px 0 6px; }
.ie-frame { position: relative; border-radius: 14px; overflow: hidden; box-shadow: 0 0 0 1px var(--line); touch-action: none; }
.ie-stage { width: 100%; height: 100%; display: block; cursor: grab; outline: none; }
.ie-stage.grab { cursor: grabbing; }
.ie-stage:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.ie-mask { position: absolute; inset: 0; pointer-events: none; border-radius: 27%; box-shadow: 0 0 0 999px rgba(16, 16, 16, .42), inset 0 0 0 1.5px rgba(255,255,255,.85); }
.ie-side { display: grid; gap: 8px; align-content: start; min-width: 0; }
.ie-label { font-size: calc(12px * var(--fs, 1)); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin-top: 6px; }
.ie-prevs { display: flex; align-items: end; gap: 12px; }
.ie-prev { display: block; box-shadow: 0 0 0 1px var(--line); }
.ie-zoomrow { display: flex; align-items: center; gap: 6px; }
.ie-zoom { flex: 1; accent-color: var(--accent); }
.ie-zoomrow .icon-btn { font-size: 18px; width: 28px; height: 28px; }
.seg.ie-bg { display: inline-flex; }
.seg.ie-bg.small button { font-size: calc(12px * var(--fs, 1)); padding: 3px 9px; }
@media (max-width: 620px) { .icon-editor .ie-body { grid-template-columns: 1fr; justify-items: center; } }

/* ---------- 3.5: the menu bar along the top ---------- */
.topbar { display: none; }
html.layout-top .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
html.layout-top .sidebar { display: none; }
html.layout-top .topbar { display: flex; align-items: center; gap: 4px; padding: 7px 14px; background: var(--panel); border-bottom: 1px solid var(--line); min-width: 0; position: relative; z-index: 5; }
.tb-brand { display: flex; align-items: center; gap: 9px; border: 0; background: none; padding: 4px 8px 4px 2px; border-radius: 8px; color: var(--ink); margin-right: 6px; flex: none; }
.tb-brand:hover { background: var(--hover); }
.tb-brand b { font: 650 calc(15px * var(--fs, 1))/1 var(--font-display); letter-spacing: -.01em; white-space: nowrap; }
.tb-brand .logo { width: 28px; height: 28px; border-radius: 8px; background: var(--brand); display: grid; place-items: center; flex: none; }
.tb-brand .logo > span { display: grid; gap: 2.5px; }
.tb-brand .logo i { display: block; height: 3px; border-radius: 2px; background: #fff; }
.tb-menus { display: flex; gap: 2px; flex: none; }
.tb-menu { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 7px 10px; border-radius: 8px; color: var(--ink); font-weight: 600; white-space: nowrap; min-width: 0; }
.tb-menu:hover:not(:disabled), .tb-menu.on { background: var(--hover); }
.tb-menu:disabled { opacity: .45; cursor: default; }
.tb-menu .tb-sub { font-weight: 400; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.tb-menu .tb-chev svg { width: 13px; height: 13px; color: var(--ink-3); }
.tb-menu { flex: none; }
.tb-menu .tb-ic { display: none; }
.tb-menu .tb-ic svg { width: 17px; height: 17px; color: var(--ink-2); }
.tb-search { position: relative; flex: 0 1 300px; min-width: 120px; margin-left: 8px; }
.tb-search > svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--ink-3); pointer-events: none; }
.tb-search input { width: 100%; padding: 7px 10px 7px 32px; border: 1px solid var(--line); background: var(--bg); border-radius: 999px; outline: none; }
.tb-search input:focus { border-color: var(--accent); background: var(--panel); }
.tb-search.off { opacity: .5; }
.tb-new { margin-left: 6px; flex: none; }
.tb-gap { flex: 1 1 auto; }
.tb-icon { position: relative; width: 36px; height: 36px; border-radius: 9px; }
.tb-icon.on { background: var(--hover); color: var(--accent); }
.tb-icon svg { width: 18px; height: 18px; }
.tb-count { position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--brand); box-shadow: 0 0 0 2px var(--panel), inset 0 0 0 1px var(--brand-edge); color: #fff; font: 700 10.5px/17px var(--font); text-align: center; }
.tb-me { border: 0; background: none; padding: 3px; border-radius: 999px; margin-left: 4px; flex: none; }
.tb-me:hover { background: var(--hover); }
.av.tb-av { width: 30px; height: 30px; font-size: 11.5px; }
.av.tb-av.none { background: var(--hover); color: var(--ink-2); }
.av.tb-av.none svg { width: 16px; height: 16px; }
.av.big { width: 38px; height: 38px; font-size: 14px; }
.av.huge { width: 64px; height: 64px; font-size: 22px; }
.av.pic, .avatar.pic { background: var(--hover) !important; overflow: hidden; }
.av.pic img, .avatar.pic img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.avatar-btn { border: 0; background: none; padding: 0; border-radius: 50%; cursor: pointer; }
.avatar-btn:hover .avatar { box-shadow: 0 0 0 2px var(--accent); }

.pop.top-pop .tb-list { min-width: 260px; max-width: min(360px, calc(100vw - 24px)); max-height: min(70vh, 560px); overflow-y: auto; }
.tb-list > button, .tb-scroll > button { display: flex; align-items: center; gap: 9px; text-align: left; min-width: 0; }
.tb-list button.on { background: var(--hover); }
.tb-head { font-size: calc(11.5px * var(--fs, 1)); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 700; padding: 8px 10px 4px; }
.tb-sep { height: 1px; background: var(--line); margin: 4px 2px; }
.tb-item { display: grid; min-width: 0; flex: 1; }
.tb-item > span, .tb-item.name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-tick svg { width: 15px; height: 15px; color: var(--accent); }
.tb-list .count { font-size: calc(12px * var(--fs, 1)); color: var(--ink-3); }
.tb-list .count.alert { color: var(--danger); font-weight: 700; }
.tb-scroll { display: grid; max-height: 46vh; overflow-y: auto; }
.tb-arch .tb-chev { margin-left: auto; display: inline-flex; }
.tb-arch .tb-chev svg { width: 13px; height: 13px; }
.tb-none { padding: 6px 10px; margin: 0; }
.tb-who { display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
.tb-who b { font-size: calc(14px * var(--fs, 1)); }
.tb-results { min-width: 280px; }
.profile-dlg .profile-top { display: flex; align-items: center; gap: 14px; margin: 4px 0 6px; }

@media (max-width: 1040px) { .tb-menu .tb-sub { display: none; } }
@media (max-width: 860px) { .tb-brand b { display: none; } .tb-new span { display: none; } }
@media (max-width: 640px) {
  html.layout-top .topbar { padding: 6px 8px; gap: 2px; }
  .tb-menu { padding: 7px 7px; }
  .tb-menu .tb-label, .tb-menus .tb-chev { display: none; }
  .tb-menu .tb-ic { display: inline-flex; }
  .tb-search { flex: 1 1 auto; min-width: 60px; margin-left: 4px; }
  .tb-brand { margin-right: 0; }
}
