/* ============================================================
   All-In-One — layout and per-view styles
   ============================================================ */

/* ---------------- auth screens ---------------- */

.auth {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(900px 500px at 15% -10%, #6366f126, transparent 60%),
    radial-gradient(800px 500px at 95% 110%, #a855f71f, transparent 60%),
    var(--bg);
}
.auth-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  padding: 28px;
}
.auth-brand {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 22px;
}
.auth-logo {
  width: 34px; height: 34px; flex: none;
  border-radius: 9px;
  background: linear-gradient(135deg, #818cf8, #6366f1);
}
.auth-brand h1 { font-size: 17px; letter-spacing: -.02em; }
.auth-title { font-size: 21px; margin-bottom: 5px; }
.auth-sub { color: var(--text-dim); font-size: 13.5px; margin-bottom: 22px; }
.auth-foot {
  margin-top: 18px; padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 13px; color: var(--text-dim); text-align: center;
}
.auth-alert {
  display: flex; gap: 9px;
  padding: 10px 12px; margin-bottom: 16px;
  border-radius: var(--r-md);
  background: var(--red-soft);
  border: 1px solid #ef444440;
  color: #fca5a5; font-size: 13px;
}
.auth-note {
  padding: 10px 12px; margin-bottom: 16px;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  border: 1px solid #6366f140;
  color: var(--accent-text); font-size: 12.5px;
}
.auth-progress {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-faint);
  margin-top: 10px;
}

.strength { display: flex; gap: 4px; margin-top: 7px; }
.strength span {
  height: 3px; flex: 1; border-radius: 99px;
  background: var(--border-strong);
  transition: background var(--med);
}
.strength[data-score="1"] span:nth-child(-n+1) { background: var(--red); }
.strength[data-score="2"] span:nth-child(-n+2) { background: var(--amber); }
.strength[data-score="3"] span:nth-child(-n+3) { background: #84cc16; }
.strength[data-score="4"] span { background: var(--green); }

.code-input {
  font-family: var(--mono);
  font-size: 22px;
  letter-spacing: .32em;
  text-align: center;
  padding: 12px;
}

.recovery-codes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
  padding: 14px;
  border-radius: var(--r-md);
  background: var(--bg);
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 12.5px;
}

.qr {
  display: grid;
  place-items: center;
  padding: 14px;
  background: #fff;
  border-radius: var(--r-md);
  margin: 0 auto 14px;
  width: fit-content;
}
.qr canvas, .qr svg { display: block; image-rendering: pixelated; }

/* ---------------- app shell ---------------- */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100dvh;
  overflow: hidden;
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.ws-switch {
  display: flex; align-items: center; gap: 9px;
  width: 100%;
  padding: 11px 12px;
  border: 0; border-bottom: 1px solid var(--border);
  background: none; color: var(--text);
  font: inherit; cursor: pointer; text-align: left;
  height: var(--topbar-h);
  flex: none;
}
.ws-switch:hover { background: var(--surface-3); }
.ws-mark {
  width: 25px; height: 25px; flex: none;
  display: grid; place-items: center;
  border-radius: 7px;
  background: var(--accent);
  color: #fff; font-size: 12px; font-weight: 700;
}
.ws-switch .name { font-weight: 600; font-size: 13.5px; }
.ws-switch .chev { color: var(--text-faint); font-size: 10px; }

.side-scroll { flex: 1; overflow-y: auto; padding: 9px 8px 20px; min-height: 0; }

.nav-group { margin-bottom: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%;
  padding: 7px 9px;
  border: 0; border-radius: var(--r-sm);
  background: none; color: var(--text-dim);
  font: inherit; font-size: 13.5px; font-weight: 500;
  text-align: left; cursor: pointer;
  transition: background var(--fast), color var(--fast);
}
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.nav-item .ico { width: 16px; flex: none; display: grid; place-items: center; opacity: .85; }
.nav-item .count {
  margin-left: auto; padding: 0 6px;
  border-radius: 99px; background: var(--surface-3);
  font-size: 11px; font-weight: 600; color: var(--text-faint);
}
.nav-item.active .count { background: #6366f133; color: var(--accent-text); }
.nav-item .unread {
  margin-left: auto;
  min-width: 17px; padding: 0 5px;
  border-radius: 99px; background: var(--accent);
  color: #fff; font-size: 10.5px; font-weight: 700; text-align: center;
}

.side-head {
  display: flex; align-items: center; gap: 6px;
  padding: 14px 9px 5px;
  font-size: 10.5px; font-weight: 680;
  color: var(--text-faint);
  text-transform: uppercase; letter-spacing: .06em;
}
.side-head .btn { margin-left: auto; }

.tree-space > .nav-item { font-weight: 600; color: var(--text); }
.tree-children { margin-left: 15px; padding-left: 8px; border-left: 1px solid var(--border); }
.tree-toggle {
  width: 13px; flex: none;
  color: var(--text-faint); font-size: 9px;
  transition: transform var(--fast);
}
.tree-toggle.open { transform: rotate(90deg); }

.side-foot {
  flex: none;
  display: flex; align-items: center; gap: 9px;
  padding: 9px 11px;
  border-top: 1px solid var(--border);
}
.side-foot .who { min-width: 0; }
.side-foot .who .n { font-size: 12.5px; font-weight: 600; }
.side-foot .who .e { font-size: 11px; color: var(--text-faint); }

/* ---------------- main column ---------------- */

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.topbar {
  display: flex; align-items: center; gap: 10px;
  height: var(--topbar-h);
  flex: none;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.topbar h2 { font-size: 14.5px; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-faint); min-width: 0; }
.crumbs .sep { opacity: .5; }
.crumbs .cur { color: var(--text); font-weight: 600; }

.searchbar {
  display: flex; align-items: center; gap: 8px;
  width: min(300px, 32vw);
  padding: 0 10px; height: 31px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg);
  color: var(--text-faint);
  font-size: 13px; cursor: pointer;
  transition: border-color var(--fast);
}
.searchbar:hover { border-color: var(--border-strong); }
.searchbar kbd { margin-left: auto; }

.view-tabs { display: flex; gap: 2px; }
.view-tab {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  border: 0; border-radius: var(--r-sm);
  background: none; color: var(--text-dim);
  font: inherit; font-size: 13px; font-weight: 520;
  cursor: pointer;
}
.view-tab:hover { background: var(--surface-3); color: var(--text); }
.view-tab.active { background: var(--surface-3); color: var(--text); font-weight: 620; }

.content { flex: 1; overflow: auto; min-height: 0; position: relative; }
.content-pad { padding: 20px; }
.content-narrow { max-width: 880px; margin: 0 auto; padding: 28px 24px 80px; }

.toolbar {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex: none;
}

/* ---------------- kanban ---------------- */

.kanban {
  display: flex;
  gap: 12px;
  padding: 14px;
  height: 100%;
  overflow-x: auto;
  /* Columns fill the height so there is always somewhere to drop a card,
     even in an empty column. */
  align-items: stretch;
}
.column {
  display: flex; flex-direction: column;
  width: 286px; flex: none;
  min-height: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
.column-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  flex: none;
}
.column-head .title { font-size: 12.5px; font-weight: 650; }
.column-head .n { color: var(--text-faint); font-size: 11.5px; font-weight: 600; }
.column-body {
  flex: 1;
  min-height: 80px;
  padding: 8px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 7px;
}
.column.drop-target { border-color: var(--accent); }
.column.drop-target .column-body { background: var(--accent-soft); }

.task-card {
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color var(--fast), transform var(--fast), box-shadow var(--fast);
  touch-action: manipulation;
}
.task-card:hover { border-color: var(--border-strong); }
.task-card.dragging { opacity: .4; }
.task-card.lifted {
  position: fixed; z-index: 70;
  pointer-events: none;
  box-shadow: var(--shadow-lg);
  transform: rotate(1.5deg);
  width: 268px;
}
.task-card .t { font-size: 13.5px; font-weight: 520; line-height: 1.4; margin-bottom: 7px; word-break: break-word; }
.task-card .meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.task-card .meta .spacer { flex: 1; }

.drop-line { height: 2px; background: var(--accent); border-radius: 2px; margin: 1px 0; }

.pri { width: 3px; height: 13px; border-radius: 2px; flex: none; }
.pri-1 { background: #64748b; }
.pri-2 { background: var(--blue); }
.pri-3 { background: var(--amber); }
.pri-4 { background: var(--red); }

.due { font-size: 11.5px; color: var(--text-faint); display: inline-flex; align-items: center; gap: 4px; }
.due.soon { color: var(--amber); }
.due.late { color: #f87171; font-weight: 600; }

.tag {
  padding: 1px 7px; border-radius: 99px;
  background: var(--surface-3); color: var(--text-dim);
  font-size: 10.5px; font-weight: 600;
}

/* ---------------- list view ---------------- */

.list-group + .list-group { margin-top: 18px; }
.list-group-head {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 4px;
  font-size: 12.5px; font-weight: 650;
  position: sticky; top: 0; z-index: 2;
  background: var(--bg);
}
.task-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-bottom-color: var(--border);
  cursor: pointer;
  transition: background var(--fast);
}
.task-row:hover { background: var(--surface); border-radius: var(--r-sm); border-color: var(--border); }
.task-row .check {
  width: 17px; height: 17px; flex: none;
  border: 1.5px solid var(--border-strong);
  border-radius: 50%;
  background: none; cursor: pointer;
  display: grid; place-items: center;
  color: transparent; font-size: 10px;
  transition: all var(--fast);
}
.task-row .check:hover { border-color: var(--green); color: var(--green); }
.task-row .check.done { background: var(--green); border-color: var(--green); color: #fff; }
.task-row .t { flex: 1; min-width: 0; font-size: 13.5px; }
.task-row.done .t { color: var(--text-faint); text-decoration: line-through; }

/* ---------------- calendar ---------------- */

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.cal-dow {
  padding: 7px; background: var(--surface);
  font-size: 11px; font-weight: 650; color: var(--text-faint);
  text-align: center; text-transform: uppercase; letter-spacing: .04em;
}
.cal-day {
  min-height: 96px; padding: 6px;
  background: var(--bg);
  display: flex; flex-direction: column; gap: 3px;
}
.cal-day.other { background: var(--surface); opacity: .5; }
.cal-day.today .n { background: var(--accent); color: #fff; }
.cal-day .n {
  align-self: flex-start;
  min-width: 20px; padding: 1px 5px;
  border-radius: 99px;
  font-size: 11.5px; font-weight: 620; text-align: center;
}
.cal-task {
  padding: 3px 6px; border-radius: 5px;
  background: var(--surface-3);
  font-size: 11px; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  border-left: 2px solid var(--accent);
}
.cal-task:hover { background: var(--surface-2); }

/* ---------------- task detail ---------------- */

.task-detail { display: grid; grid-template-columns: 1fr 250px; gap: 22px; }
@media (max-width: 860px) { .task-detail { grid-template-columns: 1fr; } }

.detail-title {
  width: 100%;
  padding: 4px 0;
  border: 0; background: none; color: var(--text);
  font: inherit; font-size: 21px; font-weight: 650; letter-spacing: -.015em;
  resize: none; overflow: hidden; line-height: 1.3;
}
.detail-title:focus { outline: none; }

.side-prop { margin-bottom: 14px; }
.side-prop > label {
  display: block; margin-bottom: 5px;
  font-size: 11px; font-weight: 650; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: .05em;
}

.checklist-item {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 0;
}
.checklist-item input[type="text"] {
  flex: 1; border: 0; background: none; color: var(--text);
  font: inherit; font-size: 13.5px; padding: 2px 0;
}
.checklist-item input[type="text"]:focus { outline: none; }
.checklist-item.done input[type="text"] { color: var(--text-faint); text-decoration: line-through; }

.comment { display: flex; gap: 10px; padding: 11px 0; border-top: 1px solid var(--border); }
.comment .body { flex: 1; min-width: 0; }
.comment .who { display: flex; align-items: baseline; gap: 7px; margin-bottom: 2px; }
.comment .who .n { font-size: 13px; font-weight: 620; }
.comment .who .t { font-size: 11.5px; color: var(--text-faint); }
.comment .text { font-size: 13.5px; white-space: pre-wrap; word-break: break-word; }

/* ---------------- docs ---------------- */

.doc-title {
  width: 100%;
  border: 0; background: none; color: var(--text);
  font: inherit; font-size: 32px; font-weight: 700; letter-spacing: -.024em;
  padding: 0; margin-bottom: 14px;
}
.doc-title:focus { outline: none; }
.doc-title::placeholder { color: var(--text-faint); }

.doc-body {
  min-height: 55vh;
  font-size: 15.5px;
  line-height: 1.72;
  outline: none;
}
.doc-body:empty::before {
  content: attr(data-placeholder);
  color: var(--text-faint);
  pointer-events: none;
}
.doc-body > * { margin: 0 0 .7em; }
.doc-body h1 { font-size: 1.65em; margin: 1.1em 0 .4em; }
.doc-body h2 { font-size: 1.32em; margin: 1em 0 .35em; }
.doc-body h3 { font-size: 1.12em; margin: .9em 0 .3em; }
.doc-body ul, .doc-body ol { padding-left: 1.4em; }
.doc-body li { margin-bottom: .25em; }
.doc-body blockquote {
  margin: 0 0 .7em;
  padding: .2em 0 .2em 1em;
  border-left: 3px solid var(--accent);
  color: var(--text-dim);
}
.doc-body pre {
  padding: 13px 15px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--border);
  overflow-x: auto;
  font-size: 13px; line-height: 1.6;
}
.doc-body code {
  padding: .12em .38em;
  border-radius: 4px;
  background: var(--surface-3);
  font-size: .88em;
}
.doc-body pre code { padding: 0; background: none; }
.doc-body hr { border: 0; border-top: 1px solid var(--border); margin: 1.4em 0; }
.doc-body img { max-width: 100%; border-radius: var(--r-md); }
.doc-body a { text-decoration: underline; }
.doc-body table { border-collapse: collapse; width: 100%; }
.doc-body td, .doc-body th { border: 1px solid var(--border); padding: 6px 9px; }
.doc-body input[type="checkbox"] { margin-right: 7px; accent-color: var(--accent); }

.doc-toolbar {
  display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky; top: 0; z-index: 3;
}
.doc-toolbar .btn { color: var(--text-dim); }
.doc-toolbar .sep { width: 1px; height: 17px; background: var(--border); margin: 0 5px; }
.save-state { margin-left: auto; font-size: 11.5px; color: var(--text-faint); }

/* ---------------- whiteboard ---------------- */

.wb { position: absolute; inset: 0; overflow: hidden; background: var(--bg); }
.wb-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
.wb-canvas.panning { cursor: grabbing; }
.wb-canvas.tool-select { cursor: default; }
.wb-canvas.tool-eraser { cursor: cell; }

.wb-tools {
  position: absolute;
  left: 50%; bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 3px;
  padding: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  box-shadow: var(--shadow-lg);
  z-index: 5;
  max-width: calc(100vw - 24px);
  overflow-x: auto;
}
.wb-tool {
  width: 36px; height: 36px; flex: none;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: none; color: var(--text-dim);
  cursor: pointer; font-size: 15px;
  transition: background var(--fast), color var(--fast);
}
.wb-tool:hover { background: var(--surface-3); color: var(--text); }
.wb-tool.active { background: var(--accent); color: #fff; }
.wb-tools .sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; flex: none; }

.wb-panel {
  position: absolute; left: 14px; top: 14px;
  width: 190px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  z-index: 5;
}
.wb-panel label { display: block; font-size: 11px; font-weight: 650; color: var(--text-faint); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .05em; }
.swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; margin-bottom: 12px; }
.swatch {
  aspect-ratio: 1; border-radius: 50%;
  /* An inner ring keeps dark swatches visible against a dark panel. */
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(127, 137, 160, .5);
  cursor: pointer; padding: 0;
  transition: transform var(--fast);
}
.swatch:hover { transform: scale(1.14); }
.swatch.active { border-color: var(--text); }

.wb-status {
  position: absolute; right: 14px; top: 14px;
  display: flex; align-items: center; gap: 7px;
  padding: 6px 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: 11.5px; color: var(--text-dim);
  z-index: 5;
}
.pen-badge { display: inline-flex; align-items: center; gap: 5px; color: var(--green); font-weight: 600; }

.wb-cursors { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.wb-cursor { position: absolute; transform: translate(-2px, -2px); transition: transform 90ms linear; }
.wb-cursor .dot { width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(0,0,0,.35); }
.wb-cursor .nm {
  margin-top: 3px; padding: 1px 6px;
  border-radius: 99px; font-size: 10.5px; font-weight: 600; color: #fff;
  white-space: nowrap;
}

input[type="range"] { width: 100%; accent-color: var(--accent); }

/* ---------------- chat ---------------- */

.chat { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 1px; }
.chat-day {
  display: flex; align-items: center; gap: 12px;
  margin: 14px 0 8px;
  font-size: 11px; font-weight: 640; color: var(--text-faint);
}
.chat-day::before, .chat-day::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.msg { display: flex; gap: 10px; padding: 3px 8px; border-radius: var(--r-sm); position: relative; }
.msg:hover { background: var(--surface); }
.msg.grouped { padding-top: 0; }
.msg.grouped .avatar { visibility: hidden; height: 0; }
.msg .body { flex: 1; min-width: 0; }
.msg .who { display: flex; align-items: baseline; gap: 8px; }
.msg .who .n { font-size: 13.5px; font-weight: 640; }
.msg .who .t { font-size: 11px; color: var(--text-faint); }
.msg .text { font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.msg .text.deleted { color: var(--text-faint); font-style: italic; }
.msg-actions {
  position: absolute; right: 8px; top: -10px;
  display: none; gap: 1px; padding: 2px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); box-shadow: var(--shadow-sm);
}
.msg:hover .msg-actions { display: flex; }

.reactions { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.reaction {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 7px;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--surface-2);
  font-size: 11.5px; cursor: pointer;
}
.reaction.mine { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }

.composer {
  flex: none;
  padding: 10px 14px max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.composer-box {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg);
  transition: border-color var(--fast);
}
.composer-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.composer-input {
  flex: 1; min-height: 22px; max-height: 180px;
  border: 0; background: none; color: var(--text);
  font: inherit; font-size: 14px; line-height: 1.5;
  resize: none; outline: none; padding: 2px 0;
}
.typing { height: 16px; padding: 2px 4px 0; font-size: 11.5px; color: var(--text-faint); font-style: italic; }

/* ---------------- command palette ---------------- */

.palette-backdrop {
  position: fixed; inset: 0;
  display: grid; align-items: start; justify-items: center;
  padding: max(9vh, 40px) 16px 16px;
  background: rgba(3, 5, 10, .55);
  backdrop-filter: blur(3px);
  z-index: 95;
  animation: fadeIn var(--fast);
}
.palette {
  width: min(600px, 100%);
  max-height: 62vh;
  display: flex; flex-direction: column;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalIn var(--med);
}
.palette-input {
  width: 100%;
  padding: 15px 17px;
  border: 0; border-bottom: 1px solid var(--border);
  background: none; color: var(--text);
  font: inherit; font-size: 15.5px; outline: none;
}
.palette-list { flex: 1; overflow-y: auto; padding: 6px; }
.palette-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 9px 11px;
  border: 0; border-radius: var(--r-sm);
  background: none; color: var(--text);
  font: inherit; font-size: 13.5px; text-align: left; cursor: pointer;
}
.palette-item.active { background: var(--accent-soft); }
.palette-item .ico {
  width: 26px; height: 26px; flex: none;
  display: grid; place-items: center;
  border-radius: 7px; background: var(--surface-3);
  font-size: 13px;
}
.palette-item .sub { font-size: 11.5px; color: var(--text-faint); }
.palette-item mark { background: none; color: var(--accent-text); font-weight: 700; }
.palette-foot {
  display: flex; gap: 14px;
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  font-size: 11px; color: var(--text-faint);
}

/* ---------------- settings ---------------- */

.settings-grid { display: grid; grid-template-columns: 178px 1fr; gap: 26px; align-items: start; }
@media (max-width: 760px) { .settings-grid { grid-template-columns: 1fr; gap: 14px; } }
.settings-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; }
@media (max-width: 760px) { .settings-nav { flex-direction: row; overflow-x: auto; position: static; } }

.setting-row {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}
.setting-row .grow strong { display: block; font-size: 13.5px; font-weight: 600; }
.setting-row .grow span { font-size: 12.5px; color: var(--text-dim); }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  padding: 8px 10px; text-align: left;
  font-size: 11px; font-weight: 650; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
}
.table td { padding: 9px 10px; border-bottom: 1px solid var(--border); }
.table tr:hover td { background: var(--surface); }
.table-wrap { overflow-x: auto; }

/* ---------------- presence ---------------- */

.presence { display: flex; align-items: center; gap: -4px; }
.presence .avatar { box-shadow: 0 0 0 2px var(--surface); }
.presence .avatar + .avatar { margin-left: -7px; }

/* ---------------- mobile ---------------- */

.mobile-only { display: none; }
.sidebar-scrim { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .mobile-only { display: flex; }
  .desktop-only { display: none !important; }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(300px, 85vw);
    z-index: 60;
    transform: translateX(-100%);
    transition: transform var(--med);
    box-shadow: var(--shadow-lg);
    padding-top: env(safe-area-inset-top);
  }
  .sidebar.open { transform: none; }
  .sidebar-scrim {
    display: block;
    position: fixed; inset: 0;
    background: rgba(3,5,10,.5);
    z-index: 59;
    animation: fadeIn var(--fast);
  }

  .topbar { padding: 0 10px; padding-top: env(safe-area-inset-top); height: calc(var(--topbar-h) + env(safe-area-inset-top)); }
  .searchbar { width: auto; flex: 1; }
  .searchbar span, .searchbar kbd { display: none; }
  .content-pad { padding: 12px; }
  .content-narrow { padding: 18px 14px 80px; }

  .kanban { padding: 10px; gap: 10px; scroll-snap-type: x mandatory; }
  .column { width: min(80vw, 300px); scroll-snap-align: start; }
  .task-card.lifted { width: min(80vw, 280px); }

  .cal-day { min-height: 62px; font-size: 11px; }
  .cal-task { font-size: 10px; }

  .wb-panel { left: 10px; top: 10px; width: 160px; padding: 10px; }
  .wb-tools { gap: 1px; padding: 4px; }
  .wb-tool { width: 38px; height: 38px; }

  .doc-title { font-size: 25px; }
  .palette-backdrop { padding: 12px; }
  .palette { max-height: 78vh; }
}

/* Larger touch targets for coarse pointers, so phones and tablets
   are comfortable without bloating the desktop layout. */
@media (pointer: coarse) {
  .btn { height: 38px; }
  .btn-sm { height: 32px; }
  .nav-item { padding: 9px; }
  .menu-item { padding: 10px 9px; }
  .task-row { padding: 11px 10px; }
}

@media print {
  .sidebar, .topbar, .toolbar, .wb-tools, .composer { display: none !important; }
  .shell { display: block; height: auto; }
  .content { overflow: visible; }
}
