
/* ── notes (P6: first band card) ── */
/* Band cards follow the board's mode until their ☀/◐ toggle stores a
   choice (lightCard() in core.js adds the -light class). */
.card-note, .card-table, .card-checklist, .card-snippet {
  color-scheme: dark;
  --danger: var(--danger-dark);
  --bg: #141412;
  --surface: #1c1c1a;
  --surface-2: #2a2a28;
  --text: #d8d4cd;
  --text-dim: #9a958e;
  --border: #3a3a38;
}
.card-note-light, .card-table-light, .card-checklist-light, .card-snippet-light {
  color-scheme: light;
  --danger: var(--danger-light);
  --bg: #f4f1ea;
  --surface: #fffdf8;
  --surface-2: #ece7da;
  --text: #23211d;
  --text-dim: #6b6760;
  --border: #d8d1c4;
}
.note-body {
  position: relative;
  flex: 1;
  padding: 10px 12px;
  overflow-y: auto;
  font-size: 13px;
}
.note-body p { margin: 0 0 6px; }
.note-body p:last-child { margin-bottom: 0; }
.note-body ul, .note-body ol { margin: 0 0 6px; padding-left: 20px; }
.note-body h1, .note-body h2, .note-body h3, .note-body h4 { margin: 0 0 6px; line-height: 1.3; }
.note-body h1 { font-size: 18px; }
.note-body h2 { font-size: 16px; }
.note-body h3, .note-body h4 { font-size: 14px; }
.note-body a { color: var(--accent); text-decoration: none; }
.note-body a:hover { text-decoration: underline; }
.note-empty { color: var(--text-dim); font-style: italic; }
.note-editable {
  outline: none;
  min-height: 60px;
}
.card.is-editing {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent);
}
.card-title-edit {
  font: inherit; font-weight: 600; color: inherit;
  background: var(--bg);
  border: 1px solid var(--accent); border-radius: 6px;
  padding: 1px 6px; width: 100%;
}
/* Add-a-Brik: the type picker is a grouped grid (glyph, name, one-line
   hint) on the left, the form on the right. Narrow screens stack them. */
#modalBack.modal-picker #modalBox { width: min(880px, 94vw); }
.ne-body { display: flex; gap: 18px; align-items: flex-start; }
.ne-tabs { flex: 1.6; min-width: 0; }
.ne-group {
  margin: 10px 0 6px; font-size: 10px; letter-spacing: 0.8px; text-transform: uppercase;
  color: var(--text-dim); font-family: var(--font-mono);
}
.ne-group:first-child { margin-top: 0; }
.ne-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
.ne-tabs button {
  font: inherit; cursor: pointer;
  display: flex; align-items: center; gap: 8px; min-width: 0;
  text-align: left;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px;
}
.ne-tabs button.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.ne-tabs button:hover { border-color: var(--accent); }
.ne-icon {
  flex: none; width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 4px; background: var(--surface-2);
  font-family: var(--font-mono); font-size: 12px; font-weight: 700; line-height: 1;
}
.ne-tabs button.active .ne-icon { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.ne-text { display: flex; flex-direction: column; min-width: 0; }
.ne-label { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ne-hint { font-size: 11px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ne-form { flex: 1; min-width: 0; padding-left: 18px; border-left: 1px solid var(--border); }
.ne-kind {
  margin-bottom: 8px; font-size: 10px; letter-spacing: 0.8px; text-transform: uppercase;
  color: var(--text-dim); font-family: var(--font-mono);
}
@media (max-width: 640px) {
  .ne-body { flex-direction: column; }
  .ne-tabs, .ne-form { width: 100%; }
  .ne-form { padding-left: 0; border-left: 0; }
}
.form-hint { font-size: 12px; color: var(--text-dim); margin: 0; }
/* icon URL input-group: live thumb square + path field in one bordered box */
.icon-field {
  display: flex; align-items: stretch;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; overflow: hidden;
}
.icon-field:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.icon-field input {
  flex: 1; min-width: 0;
  font: inherit; color: var(--text);
  background: none; border: none; border-radius: 0;
  padding: 8px 10px;
}
.icon-field input:focus { outline: none; }
.icon-thumb {
  flex: none; width: 38px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); border-right: 1px solid var(--border);
  font-size: 18px; color: var(--text-dim);
}
.icon-thumb img { width: 22px; height: 22px; border-radius: 4px; }
.icon-thumb img:not([src]) { display: none; }
.form-grid textarea {
  font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; resize: vertical;
}

/* ── tables (P7, slimmed P12, bare-lines P14) ── */
/* Plain text matrix: no fills, no full grid — one line under the header,
   one line under each row. Controls (column ✕/+, row ✕, + Add row) are
   hover-revealed so the resting card is just text and lines. */
.tbl-scroll { flex: 1; overflow: auto; padding: 0 0 4px; }
table.tbl { border-collapse: collapse; width: 100%; font-size: 12px; }
.tbl th, .tbl td { border: none; background: none; padding: 6px 8px; text-align: left; }
.tbl thead th { border-bottom: 1px solid var(--border); font-weight: 600; white-space: nowrap; }
.tbl thead th .th-label { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.tbl tbody td { border-bottom: 1px solid var(--border); }
.tbl tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
.tbl td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tfoot td { font-weight: 700; border-top: 2px solid var(--text); }
.tbl td[data-cell] { cursor: text; min-width: 40px; }
.tbl th.col-act, .tbl td.row-act { width: 30px; text-align: center; }
.col-del,
.row-del {
  background: none; border: none; color: var(--text-dim);
  cursor: pointer; font-size: 12px; padding: 3px 6px;
  visibility: hidden;
}
/* add-column: same dashed-box language as + Add row, roomy hit target */
.col-add {
  font: inherit; font-size: 14px; font-weight: 600; color: var(--text-dim);
  background: none; border: 1px dashed var(--border); border-radius: 6px;
  min-width: 30px; min-height: 26px; padding: 3px 9px;
  cursor: pointer;
  visibility: hidden;
}
th:hover .col-del, th:focus-within .col-del,
tr:hover .row-del, tr:focus-within .row-del { visibility: visible; }
.col-del:hover, .row-del:hover { color: var(--danger); }
.card-table:hover .col-add, .col-add:focus-visible { visibility: visible; }
.col-add:hover { color: var(--text); border-color: var(--accent); border-style: solid; }
/* header rename affordance: hovering a column name outlines it in accent,
   the same orange as the rename input it opens (outline = no reflow) */
th[data-col]:hover .th-label { outline: 1px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.col-edit, .cell-edit {
  font: inherit; color: inherit; background: var(--bg);
  border: 1px solid var(--accent); border-radius: 4px;
  padding: 0 4px; width: 100%;
}
.add-row { display: flex; gap: 4px; padding: 6px 8px; align-items: center; }
/* single progressive-disclosure add: no permanent "..." inputs */
.row-add {
  flex: 1;
  font: inherit; font-size: 12px; color: var(--text-dim);
  background: none; border: 1px dashed var(--border); border-radius: 6px;
  padding: 6px; cursor: pointer;
  visibility: hidden;
}
.card-table:hover .row-add, .row-add:focus-visible { visibility: visible; }
.row-add:hover { color: var(--text); border-color: var(--accent); border-style: solid; }

/* ── checklists (P26, ported from v0.3) ── */
/* Plain item rows: checkbox + text + hover-only ✕, one dashed + Add item
   (hover-revealed like tables). Done items strike through. Always-dark
   card with a ☀/◐ light variant, same as notes/tables. */
.check-list { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 6px 8px; display: flex; flex-direction: column; gap: 2px; }
.check-item { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 6px; margin: 0; cursor: default; font-weight: 400; }
.check-item:hover { background: color-mix(in srgb, var(--text) 7%, transparent); }
.check-item input[type="checkbox"] { flex: none; width: 14px; height: 14px; accent-color: var(--accent); cursor: pointer; margin: 0; }
.check-text { flex: 1; min-width: 0; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: text; }
.check-item.done .check-text { text-decoration: line-through; color: var(--text-dim); }
.check-del { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 12px; padding: 3px 6px; visibility: hidden; }
.check-item:hover .check-del, .check-item:focus-within .check-del { visibility: visible; }
.check-del:hover { color: var(--danger); }
.check-add { padding: 4px 8px; }
.check-add-btn { width: 100%; font: inherit; font-size: 12px; color: var(--text-dim); background: none; border: 1px dashed var(--border); border-radius: 6px; padding: 6px; cursor: pointer; visibility: hidden; }
.card-checklist:hover .check-add-btn, .check-add-btn:focus-visible { visibility: visible; }
.check-add-btn:hover { color: var(--text); border-color: var(--accent); border-style: solid; }
.check-add .cell-edit { width: 100%; box-sizing: border-box; }
/* edit-modal item rows: done toggle + text + remove */
.check-edit-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.check-edit-row input[type="checkbox"] { flex: none; width: 14px; height: 14px; accent-color: var(--accent); }
.check-edit-row input[type="text"] { flex: 1; min-width: 0; }
.check-edit-del { flex: none; background: none; border: 1px solid var(--border); border-radius: 6px; color: var(--text-dim); cursor: pointer; font-size: 11px; padding: 4px 8px; }
.check-edit-del:hover { color: var(--danger); border-color: var(--danger); }

/* ── snippets: plain monospace text, copy in the head ── */
.snippet-body { flex: 1; min-height: 0; position: relative; display: flex; cursor: text; }
.snippet-code {
  flex: 1; margin: 0; padding: 10px 12px; overflow: auto; tab-size: 4;
  font: 12px/1.5 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap; overflow-wrap: anywhere;   /* long commands wrap instead of hiding */
}
.snippet-lang { position: absolute; right: 8px; bottom: 6px; font-size: 10px; color: var(--text-dim); pointer-events: none; }
.snippet-edit {
  flex: 1; margin: 0; padding: 10px 12px; resize: none; tab-size: 4; white-space: pre;
  font: 12px/1.5 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--text); background: var(--bg); border: 1px solid var(--accent); border-radius: 0 0 6px 6px;
}
.form-grid .snippet-edit { border: 1px solid var(--border); border-radius: 8px; resize: vertical; }

/* ── embeds (P20, pan offsets ported from v0.3) ── */
/* Cross-origin pages can't be scrolled by the parent, so the pan offset
   translates a taller iframe. Always-dark card like notes/tables/terminals;
   the ☀/◐ head toggle flips to .card-embed-light while the framed page
   itself stays as-is (letterbox). */
.card-embed {
  color-scheme: dark;
  --danger: var(--danger-dark);
  --bg: #141412;
  --surface: #1c1c1a;
  --surface-2: #2a2a28;
  --text: #f5f3ef;
  --text-dim: #9a958e;
  --border: #3a3a38;
}
.card-embed-light {
  color-scheme: light;
  --danger: var(--danger-light);
  --bg: #f4f1ea;
  --surface: #fffdf8;
  --surface-2: #ece7da;
  --text: #23211d;
  --text-dim: #6b6760;
  --border: #d8d1c4;
}
.embed-body { flex: 1; min-height: 0; position: relative; overflow: hidden; background: #141412; }
.embed-canvas { position: absolute; inset: 0; will-change: transform; }
.embed-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: none; background: #fff; }
.embed-empty {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--text-dim); text-align: center; padding: 12px;
}
.embed-offset {
  font-size: 10px; color: var(--text-dim); white-space: nowrap; flex: none;
  font-variant-numeric: tabular-nums;
}
.card-action.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.embed-pan {
  position: absolute; inset: 0; z-index: 3;
  cursor: grab; background: rgba(28,28,26,0.04); touch-action: none;
}
.embed-pan.dragging { cursor: grabbing; }
.embed-pan-hint {
  position: absolute; top: 6px; left: 50%; transform: translateX(-50%);
  font-size: 10px; color: #f5f3ef; background: rgba(28,28,26,0.85);
  border: 1px solid #3a3a38; padding: 3px 8px; border-radius: 999px;
  white-space: nowrap; cursor: pointer;
}

/* ── credentials (P29, standalone cards; nesting renders in P30) ── */
/* Slim 1-row cards: micro-label HOST/USER/PASS rows, fixed dot mask,
   hover-only copy/open buttons. Always-dark + ☀/◐ light variant like
   the other bands; the custom tag pill lives in the header. */
.card-credential {
  color-scheme: dark;
  --danger: var(--danger-dark);
  --bg: #141412;
  --surface: #1c1c1a;
  --surface-2: #2a2a28;
  --text: #f5f3ef;
  --text-dim: #9a958e;
  --border: #3a3a38;
}
.card-credential-light {
  color-scheme: light;
  --danger: var(--danger-light);
  --bg: #f4f1ea;
  --surface: #fffdf8;
  --surface-2: #ece7da;
  --text: #23211d;
  --text-dim: #6b6760;
  --border: #d8d1c4;
}
/* Compact enough that host, user and pass fit a one-row card at the smallest row height. */
.cred-body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 12px; display: flex; flex-direction: column; gap: 2px; }
.cred-row { display: flex; align-items: center; gap: 8px; min-height: 17px; }
.cred-lab { flex: none; width: 30px; font-size: 10px; color: var(--text-dim); font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.cred-host-text, .cred-user-text, .cred-dots, .cred-nosaved {
  flex: 1; min-width: 0; font-size: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cred-host-text, .cred-user-text, .cred-dots { cursor: text; }
.cred-dots { font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.cred-nosaved { color: var(--text-dim); cursor: text; }
.cred-mini {
  flex: none; background: none; border: none; color: var(--text-dim);
  cursor: pointer; font-size: 12px; padding: 0 5px; text-decoration: none;
  visibility: hidden;
}
.cred-row:hover .cred-mini, .cred-row:focus-within .cred-mini, .cred-mini:focus-visible { visibility: visible; }
.cred-mini:hover { color: var(--text); }
a.cred-mini:hover { color: var(--accent); }

/* ── music (Spotify player card) ── */
/* Framed /embed/ player filling the card body. Always-dark like the other
   media-ish bands + ☀/◐ light variant; the iframe itself is Spotify-drawn
   (untouched by themes). CSP frame-src https: already covers it. */
.card-music {
  color-scheme: dark;
  --danger: var(--danger-dark);
  --bg: #141412;
  --surface: #1c1c1a;
  --surface-2: #2a2a28;
  --text: #f5f3ef;
  --text-dim: #9a958e;
  --border: #3a3a38;
}
.card-music-light {
  color-scheme: light;
  --danger: var(--danger-light);
  --bg: #f4f1ea;
  --surface: #fffdf8;
  --surface-2: #ece7da;
  --text: #23211d;
  --text-dim: #6b6760;
  --border: #d8d1c4;
}
.music-body { flex: 1; min-height: 0; display: flex; }
.music-frame { flex: 1; width: 100%; min-height: 152px; border: 0; }
.music-empty { margin: auto; color: var(--text-dim); font-size: 12px; }

/* ── media (image / provider video / provider audio card) ── */
/* Click-to-play facade → live provider player filling the body. Frames and
   thumbnails are provider-drawn (untouched by themes). Same kraft/paper
   body law as music; CSP frame-src https: covers the players, img-src https:
   the YouTube thumbnails. */
.card-media {
  color-scheme: dark;
  --danger: var(--danger-dark);
  --bg: #141412;
  --surface: #1c1c1a;
  --surface-2: #2a2a28;
  --text: #f5f3ef;
  --text-dim: #9a958e;
  --border: #3a3a38;
}
.card-media-light {
  color-scheme: light;
  --danger: var(--danger-light);
  --bg: #f4f1ea;
  --surface: #fffdf8;
  --surface-2: #ece7da;
  --text: #23211d;
  --text-dim: #6b6760;
  --border: #d8d1c4;
}
.media-body {
  flex: 1; min-height: 0; position: relative; overflow: hidden; display: flex;
  /* Size container: the play affordance + fallback scale with the BODY
     (user report 2026-09-30 — a 56px play circle crowded a 2x1 card's
     103px body while 3x2 looked right). cqh units follow the body height. */
  container-type: size;
}
.media-facade {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  padding: 0; border: 0; background: var(--surface-2);
  color: var(--text); cursor: pointer;
}
.media-thumb {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; pointer-events: none;
}
.media-play {
  position: relative; display: flex; align-items: center; justify-content: center;
  width: min(56px, 39cqh); height: min(56px, 39cqh); border-radius: 50%;
  background: rgba(0, 0, 0, 0.66); color: #fff;
  font-size: min(22px, 15cqh); line-height: 1; padding-left: min(4px, 2cqh);
}
.media-facade:hover .media-play,
.media-facade:focus-visible .media-play { background: rgba(0, 0, 0, 0.82); }
.media-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.media-img-wrap { position: absolute; inset: 0; }
.media-img { width: 100%; height: 100%; object-fit: contain; }
.media-img.cover { object-fit: cover; }
.media-fallback {
  margin: auto; display: flex; flex-direction: column;
  gap: min(8px, 4cqh);
  align-items: center; text-align: center; padding: min(12px, 8cqh);
  color: var(--text-dim); font-size: min(12px, 11.5cqh);
}
.media-fallback .media-icon { font-size: min(26px, 18cqh); }
/* Narrow media bodies (2x1): the head keeps the title readable — the type
   badge never expands over it and actions go compact. */
.card-media { container-type: inline-size; }
@container (max-inline-size: 280px) {
  .card-head { gap: 6px; padding: 0 8px; }
  .card:hover .card-head .card-badge,
  .card:focus-within .card-head .card-badge {
    max-width: 0; opacity: 0; padding: 1px 0; border-width: 0; margin-right: -8px;
  }
  .card-action { width: 22px; height: 22px; font-size: 11px; }
}

/* ── rss feed card (port of the v0.3 card; vars honor the theme toggle) ── */
/* Pin both card tones so the header toggle works on either board tone. */
.card-rss {
  color-scheme: dark;
  --danger: var(--danger-dark);
  --bg: #141412;
  --surface: #1c1c1a;
  --surface-2: #2a2a28;
  --text: #f5f3ef;
  --text-dim: #9a958e;
  --border: #3a3a38;
}
.card-rss-light {
  color-scheme: light;
  --danger: var(--danger-light);
  --bg: #f4f1ea;
  --surface: #fffdf8;
  --surface-2: #ece7da;
  --text: #23211d;
  --text-dim: #6b6760;
  --border: #d8d1c4;
}
.rss-body { flex: 1; overflow-y: auto; padding: 4px 6px 6px; display: flex; flex-direction: column; gap: 2px; min-height: 0; }
.rss-item {
  display: flex; flex-direction: row; align-items: flex-start; gap: 8px;
  padding: 5px 8px; border-radius: 8px; text-decoration: none; color: inherit;
}
.rss-item:hover { background: var(--surface-2); }
.rss-item.is-unread { background: color-mix(in srgb, var(--text) 5%, transparent); }
.rss-dot {
  width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; margin-top: 5px;
  background: transparent; visibility: hidden; /* read rows keep the space, no shift */
}
.rss-item.is-unread .rss-dot { background: var(--accent); visibility: visible; }
.rss-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.rss-item-title {
  color: var(--text-dim); font-size: 13px; line-height: 1.35;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rss-item.is-unread .rss-item-title { color: var(--text); font-weight: 600; }
.rss-item-summary {
  color: var(--text-dim); font-size: 11px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.rss-item-meta {
  color: var(--text-dim); font-size: 10px; flex-shrink: 0; margin-top: 2px;
  font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.rss-loading, .rss-empty {
  color: var(--text-dim); font-size: 11px; padding: 10px 8px;
  font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ── calendar card (month grid + agenda; vars honor the theme toggle) ── */
.card-calendar-light {
  color-scheme: light;
  --danger: var(--danger-light);
  --bg: #f4f1ea;
  --surface: #fffdf8;
  --surface-2: #ece7da;
  --text: #23211d;
  --text-dim: #6b6760;
  --border: #d8d1c4;
}
.cal-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 6px; padding: 6px 8px 8px; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-month { flex: 1; text-align: center; font-size: 13px; font-weight: 600; }
.cal-nav-btn {
  font: inherit; font-size: 13px; line-height: 1; cursor: pointer;
  width: 22px; height: 22px; padding: 0;
  background: var(--surface-2); color: var(--text-dim);
  border: 1px solid var(--border); border-radius: 6px;
}
.cal-nav-btn:hover { color: var(--text); border-color: var(--accent); }
.cal-warning { color: var(--danger); font-size: 11px; line-height: 1.4; }
.cal-list { max-height: 34%; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.cal-list-empty, .cal-loading, .cal-empty {
  color: var(--text-dim); font-size: 11px; padding: 8px 6px;
  font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.cal-item { display: flex; gap: 10px; padding: 4px 6px; border-radius: 6px; }
.cal-item:hover { background: var(--surface-2); }
.cal-when { flex: 0 0 62px; text-align: right; }
.cal-when-day { font-size: 11px; font-weight: 600; line-height: 1.3; }
.cal-when-time { font-size: 10px; color: var(--text-dim); font-family: 'Geist Mono', ui-monospace, monospace; }
.cal-item-main { flex: 1; min-width: 0; }
.cal-item-title {
  font-size: 12px; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.cal-item-loc { font-size: 10px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: 1fr; gap: 2px; }
.cal-dow {
  font-size: 9px; text-transform: uppercase; letter-spacing: 0.4px;
  color: var(--text-dim); text-align: center;
  font-family: 'Geist Mono', ui-monospace, monospace;
}
.cal-day { border-radius: 6px; padding: 2px 4px; font-size: 10px; overflow: hidden; }
.cal-day.blank { background: none; }
.cal-day.today, .cal-day.has-ev { background: var(--accent); color: var(--on-accent); font-weight: 600; }

/* calendar edit form: event manager */
.cal-form { display: flex; flex-direction: column; gap: 12px; }
.cal-add-row { display: grid; grid-template-columns: 1.8fr 1.5fr 1fr 1.4fr; gap: 6px; }
.cal-add-row > input { min-width: 0; }
.cal-events { display: flex; flex-direction: column; gap: 4px; }
.cal-manage-row {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); border-radius: 8px;
  padding: 5px 8px; background: var(--surface-2);
}
.cal-manage-date {
  flex: none; font-size: 10px; color: var(--text-dim);
  font-family: 'Geist Mono', ui-monospace, monospace;
}
.cal-manage-title { flex: 1; min-width: 0; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-manage-loc { flex: none; max-width: 120px; font-size: 10px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-manage-del { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 12px; padding: 2px 4px; }

/* ── terminals (P22, WS pty gateway) ── */
/* Dark card by default; the ☀/◐ head toggle themes the body and emulator
   together via .card-terminal-light. Secrets never render — only the
   ● saved presence flag. */
.card-terminal {
  color-scheme: dark;
  --danger: var(--danger-dark);
  --bg: #141412;
  --surface: #1c1c1a;
  --surface-2: #2a2a28;
  --text: #f5f3ef;
  --text-dim: #9a958e;
  --border: #3a3a38;
}
.card-terminal-light {
  color-scheme: light;
  --danger: var(--danger-light);
  --bg: #f4f1ea;
  --surface: #fffdf8;
  --surface-2: #ece7da;
  --text: #23211d;
  --text-dim: #6b6760;
  --border: #d8d1c4;
}
.term-body {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column; gap: 6px;
  padding: 8px 12px; overflow-y: auto;
  background: var(--bg); color: var(--text);
}
.term-hostline {
  font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.term-hostline strong { font-weight: 600; }
.term-port { opacity: 0.6; }
.term-saved {
  font-size: 10px; color: var(--text-dim); background: var(--surface-2);
  padding: 1px 6px; border-radius: 999px; border: 1px solid var(--border);
  margin-left: 6px; white-space: nowrap;
}
.term-connect-btn {
  font: inherit; font-size: 12px; color: var(--text); text-align: left;
  background: none; border: 1px dashed var(--border); border-radius: 8px;
  padding: 7px 10px; cursor: pointer;
}
.term-connect-btn:hover { border-color: var(--accent); border-style: solid; }
.term-hint { font-size: 10px; color: var(--text-dim); }
/* The live viewport shares the body background; xterm themes only its ink. */
.term-live { flex: 1; min-height: 100px; background: transparent; overflow: hidden; }
.term-live .xterm { height: 100%; padding: 4px; }
.term-keys { display: none; flex: none; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.term-keys button {
  flex: none; min-width: 36px; padding: 7px 8px;
  font: 12px 'Geist Mono', ui-monospace, Menlo, Consolas, monospace; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
}
.term-keys button.is-on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.term-inline-status {
  font-size: 11px; color: var(--text-dim);
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 8px;
}
.term-inline-status.is-error { color: #ffb4b4; border-color: #7a2a2a; background: #2a1a1a; }
.term-inline-prompt { display: flex; flex-direction: column; gap: 8px; }
.term-inline-prompt input[type="password"],
.term-inline-prompt textarea {
  width: 100%; min-width: 0; box-sizing: border-box;
  font: inherit; font-size: 12px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px;
}
.term-inline-prompt textarea {
  font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px; line-height: 1.4; resize: vertical;
}
.term-inline-prompt [data-role="termPwRow"] { display: flex; gap: 6px; }
.term-inline-prompt [data-role="termPwRow"] input { flex: 1; }
.term-inline-prompt .btn-primary {
  font: inherit; font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--accent); color: var(--on-accent);
  border: 1px solid transparent; border-radius: 8px; padding: 8px 12px;
  cursor: pointer;
}
.term-caption {
  font-size: 10px; color: var(--text-dim);
  font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.term-mode {
  align-self: flex-start; font-size: 10px; color: var(--text-dim);
  font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: none; border: none; cursor: pointer; padding: 2px 0;
  text-decoration: underline; text-underline-offset: 2px;
}
.form-check { display: flex; flex-direction: row !important; align-items: center; gap: 8px; }
.form-check input { width: auto; }
/* terminal disconnect reads as a word, not an icon (still hover-revealed) */
.card-head [data-term="disc"] { width: auto; padding: 0 8px; font-size: 11px; }
/* terminal login-method tabs: password XOR key, one pane at a time */
.term-auth-tabs { display: flex; gap: 6px; }
.term-auth-tabs button {
  font: inherit; font-size: 12px; cursor: pointer;
  background: var(--surface-2); color: var(--text-dim);
  border: 1px solid var(--border); border-radius: 8px; padding: 5px 14px;
}
.term-auth-tabs button.active { color: var(--text); border-color: var(--accent); }
/* passphrase without a key is disabled (nothing to unlock) */
.form-grid input:disabled, .form-grid textarea:disabled { opacity: 0.45; }

/* ── server card — the remote load tile (P52 port; 2x1 default) ── */
/* Three meter rows (cpu/ram/disk) + head status dot. The body is an
   INDEPENDENTLY themed surface (like note/table/terminal): explicit dark
   AND light palettes, so the ☀/◐ head toggle flips the card in any board
   tone — a tone-following body made "dark" a no-op on light boards.
   Meter fill is the accent ink, thresholds live on the dot only
   (monochrome rows, no alarm colors mid-board). */
.card-server {
  color-scheme: dark;
  --danger: var(--danger-dark);
  --bg: #141412;
  --surface: #1c1c1a;
  --surface-2: #2a2a28;
  --text: #f5f3ef;
  --text-dim: #9a958e;
  --border: #3a3a38;
}
.card-server-light {
  color-scheme: light;
  --danger: var(--danger-light);
  --bg: #f4f1ea;
  --surface: #fffdf8;
  --surface-2: #ece7da;
  --text: #23211d;
  --text-dim: #6b6760;
  --border: #d8d1c4;
}
.srv-body {
  flex: 1; min-height: 0; overflow: hidden;
  display: flex; flex-direction: column; justify-content: safe center; gap: 3px;
  padding: 4px 12px 6px;
}
.srv-row { display: flex; align-items: center; gap: 8px; min-height: 16px; }
.srv-lab {
  flex: 0 0 64px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-dim); white-space: nowrap; overflow: hidden;
}
.srv-labsub {
  display: inline-block; margin-left: 5px; text-transform: none; letter-spacing: 0;
  font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 9px; opacity: 0.85;
}
.srv-val {
  flex: 0 0 44px; text-align: right;
  font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; font-weight: 600;
}
.srv-na { color: var(--text-dim); font-weight: 400; }
.srv-bar {
  flex: 1; min-width: 24px; height: 4px; border-radius: 2px; overflow: hidden;
  background: var(--surface-2);
}
.srv-bar > i { display: block; height: 100%; background: var(--accent); }
.srv-loading, .srv-empty, .srv-err {
  color: var(--text-dim); font-size: 11px; padding: 10px 8px;
  font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.srv-err { color: var(--danger); line-height: 1.45; }
.srv-body .srv-empty { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 8px; padding: 4px 2px; line-height: 1.3; }
.srv-setup {
  font: inherit; font-weight: 700; cursor: pointer; padding: 2px 8px;
  background: var(--accent); color: var(--on-accent); border: 1px solid var(--accent); border-radius: 6px;
}

/* files — read-only SFTP browser (shares the terminal's offline/login look) */
.files-body:has(.files-tree) { padding: 0; gap: 0; overflow: hidden; }
.card-files .term-body { background: none; }
.card-files .term-inline-status.is-error { color: var(--danger); background: none; border-color: var(--danger); }
.files-bar { display: flex; align-items: center; gap: 2px; padding: 4px 6px; border-bottom: 1px solid var(--border); }
.files-crumbs { flex: 1; min-width: 0; display: flex; align-items: center; overflow-x: auto; scrollbar-width: none; white-space: nowrap;
  font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; }
.files-crumb, .files-tool { font: inherit; background: none; border: none; color: var(--text-dim); cursor: pointer; padding: 2px 4px; border-radius: 6px; flex-shrink: 0; }
.files-crumb:last-child { color: var(--text); font-weight: 600; }
.files-crumb:hover, .files-tool:hover { color: var(--text); background: var(--surface-2); }
.files-tool { font-size: 13px; }
.files-sep { color: var(--text-dim); opacity: 0.6; }
.files-tree { flex: 1; overflow: auto; padding: 4px; display: flex; flex-direction: column; gap: 1px; min-height: 0; }
.files-row { display: flex; align-items: center; gap: 6px; width: 100%; padding: 3px 8px; border: none; border-radius: 6px;
  background: none; color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.files-row:hover, .files-row:focus-visible { background: var(--surface-2); }
.files-row.is-hidden { opacity: 0.6; }
.files-row.is-getting { color: var(--accent); }
.files-caret { width: 10px; flex-shrink: 0; color: var(--text-dim); font-size: 10px; }
.files-icon { flex-shrink: 0; font-size: 12px; }
.files-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.files-size { color: var(--text-dim); font-size: 10px; flex-shrink: 0; font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.files-note { color: var(--text-dim); font-size: 11px; padding: 3px 8px; }
.files-note.is-error { color: var(--danger); }
.files-foot { padding: 4px 10px 6px; border-top: 1px solid var(--border); color: var(--text-dim); font-size: 11px; }

/* Scrolling card bodies: a soft shadow at the edge that has more content.
   The `local` covers scroll with the text and hide the shadow at each end. */
.note-body, .check-list, .rss-body, .files-tree, .cred-body {
  background:
    linear-gradient(var(--surface) 30%, transparent) top / 100% 24px no-repeat local,
    linear-gradient(transparent, var(--surface) 70%) bottom / 100% 24px no-repeat local,
    linear-gradient(rgba(0, 0, 0, .22), transparent) top / 100% 10px no-repeat scroll,
    linear-gradient(transparent, rgba(0, 0, 0, .22)) bottom / 100% 10px no-repeat scroll;
}
