/* Taskly — Triage, Mind Map, AI Ledger and Pulse.
 * Uses the tokens from styles.css, so light and dark both follow the app.
 */

:root {
  --lab-topic: #7c5cff;
  --lab-task: #f08a24;
  --lab-related: #19a7a0;
  --lab-heat-1: color-mix(in srgb, var(--accent) 22%, var(--surface-3));
  --lab-heat-2: color-mix(in srgb, var(--accent) 48%, var(--surface-3));
  --lab-heat-3: color-mix(in srgb, var(--accent) 74%, var(--surface-3));
  --lab-heat-4: var(--accent);
}

/* ---------------------------------------------------------------- Triage */

.triage { max-width: 680px; margin: 0 auto; }
.triage-progress { display: grid; gap: 6px; margin-bottom: 18px; }
.triage-bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.triage-bar span {
  display: block; height: 100%; width: 0; border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #35b7f4); transition: width 320ms ease;
}
.triage-stage { position: relative; min-height: 260px; }
.triage-card {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 26px 28px; box-shadow: var(--shadow);
  touch-action: pan-y; user-select: none; will-change: transform;
  transition: transform 260ms cubic-bezier(.2, .8, .2, 1), opacity 260ms ease;
}
.triage-card.dragging { transition: none; cursor: grabbing; }
.triage-card.enter { animation: triage-in 280ms cubic-bezier(.2, .8, .2, 1); }
@keyframes triage-in { from { opacity: 0; transform: translateY(14px) scale(0.98); } }
.triage-card.out-keep { transform: translateX(120%) rotate(8deg); opacity: 0; }
.triage-card.out-later { transform: translateX(-120%) rotate(-8deg); opacity: 0; }
.triage-card.out-task { transform: translateY(-70%) scale(0.92); opacity: 0; }
.triage-card::after {
  content: attr(data-hint); position: absolute; top: 18px; right: 20px; padding: 3px 10px;
  border-radius: 999px; font-size: 0.78rem; font-weight: 600; opacity: 0; transition: opacity 120ms ease;
  background: var(--accent-soft); color: var(--text);
}
.triage-card[data-hint]:not([data-hint=""])::after { opacity: 1; }
.triage-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px; color: var(--muted); font-size: 0.8rem; }
.triage-meta .pill { margin-left: 0; }
.triage-card h2 { font-size: 1.3rem; line-height: 1.3; margin-bottom: 10px; overflow-wrap: anywhere; }
.triage-text {
  color: var(--text-2); font-size: 0.95rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere;
  max-height: 190px; overflow: auto; margin-bottom: 16px; user-select: text;
}
.triage-suggest {
  display: grid; gap: 8px; padding: 14px 16px; border-radius: var(--radius);
  background: var(--ice); border: 1px solid var(--border);
}
.triage-suggest-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.82rem; color: var(--muted); }
.triage-suggest-head strong { color: var(--text); }
.triage-suggest-head .pill { margin-left: 0; }
.triage-suggest p { font-size: 0.84rem; color: var(--muted); }
.triage-task { display: grid; gap: 4px; }
.triage-task label { font-size: 0.78rem; font-weight: 600; color: var(--text-2); }
.triage-task input { width: 100%; user-select: text; }

.triage-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.triage-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px;
  font-size: 0.95rem; font-weight: 600; border-radius: 12px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong);
}
.triage-btn:hover { background: var(--surface-3); }
.triage-btn.keep { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.triage-btn.keep:hover { background: var(--accent-hover); }
.triage-btn kbd { opacity: 0.8; }
.triage-btn.keep kbd { background: rgba(255, 255, 255, 0.2); color: #fff; border-color: transparent; }
.triage-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; }
.triage-foot select { min-height: 30px; padding: 2px 6px; font-size: 0.82rem; }

.triage-done {
  display: grid; place-items: center; gap: 10px; text-align: center; padding: 56px 24px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
}
.triage-done .ring {
  width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ok-soft); color: var(--ok); animation: pop 420ms cubic-bezier(.2, 1.4, .4, 1);
}
.triage-done .ring svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
@keyframes pop { from { transform: scale(0.4); opacity: 0; } }
.triage-done h2 { font-size: 1.35rem; }
.triage-done p { color: var(--muted); max-width: 42ch; }

/* -------------------------------------------------------------- Mind Map */

body[data-page="mindmap"] .wrap { max-width: 1480px; }
.map-shell { display: grid; gap: 12px; }
.map-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.map-search {
  display: flex; align-items: center; gap: 8px; flex: 1 1 240px; max-width: 360px; padding: 0 10px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
}
.map-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.map-search .icon { color: var(--slate); flex: none; }
.map-search input { border: 0; background: transparent; box-shadow: none; outline: none; padding: 8px 0; width: 100%; min-width: 0; }
.map-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 0.86rem; color: var(--text-2); cursor: pointer; }
.map-count { margin-left: auto; }
.map-body { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 12px; align-items: stretch; }
.map-canvas-wrap {
  position: relative; height: min(68vh, 720px); min-height: 420px; overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--radius);
  background:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--text) 9%, transparent) 1px, transparent 0) 0 0 / 22px 22px,
    var(--surface);
}
#mapCanvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
#mapCanvas.grabbing { cursor: grabbing; }
#mapCanvas.pointing { cursor: pointer; }
.map-empty { position: absolute; inset: 24px; background: var(--surface); }
.map-empty span { max-width: 44ch; }
.map-legend {
  position: absolute; left: 12px; bottom: 12px; display: flex; flex-wrap: wrap; gap: 4px 14px; list-style: none;
  padding: 6px 12px; border-radius: 999px; font-size: 0.76rem; color: var(--text-2);
  background: color-mix(in srgb, var(--surface) 88%, transparent); border: 1px solid var(--border);
  backdrop-filter: blur(6px);
}
.map-legend li { display: inline-flex; align-items: center; gap: 6px; }
.map-legend .lg { display: inline-block; flex: none; width: 10px; height: 10px; padding: 0; border-radius: 50%; }
.map-legend .lg.topic { background: var(--lab-topic); }
.map-legend .lg.item { background: var(--accent); }
.map-legend .lg.task { background: var(--lab-task); border-radius: 3px; }
.map-legend .lg-line { display: inline-block; flex: none; width: 16px; height: 0; border-top: 2px dashed var(--lab-related); }
.map-detail { margin: 0; padding: 18px; overflow: auto; max-height: min(68vh, 720px); }
.map-detail h3 { font-size: 1.02rem; line-height: 1.35; margin: 6px 0 8px; overflow-wrap: anywhere; }
.map-detail .kind { font-size: 0.74rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.map-detail .preview { color: var(--text-2); font-size: 0.88rem; line-height: 1.55; margin-bottom: 12px; overflow-wrap: anywhere; }
.map-detail .pill { margin-left: 0; margin-right: 4px; }
.map-detail h4 { font-size: 0.8rem; color: var(--muted); font-weight: 600; margin: 14px 0 6px; }
.map-links { list-style: none; display: grid; gap: 6px; }
.map-links button {
  display: grid; gap: 2px; width: 100%; justify-items: start; justify-content: stretch; text-align: left;
  white-space: normal; overflow-wrap: anywhere; line-height: 1.35; padding: 8px 10px; min-height: 0;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-weight: 500; font-size: 0.86rem;
}
.map-links button:hover { background: var(--surface-3); border-color: var(--border-strong); }
.map-links small { color: var(--muted); font-weight: 400; font-size: 0.78rem; }
.map-links li.has-unlink { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: stretch; }
.map-links .map-unlink {
  display: inline-flex; align-items: center; justify-content: center; width: auto; padding: 4px 8px;
  font-size: 0.74rem; font-weight: 600; color: var(--muted); background: transparent; border-style: dashed;
}
.map-links .map-unlink:hover { color: var(--danger); border-color: var(--danger); background: var(--surface-2); }

/* Acting from the map: details header, actions, the notice with Undo. */
.map-detail-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.map-close {
  display: inline-grid; place-items: center; width: 30px; height: 30px; min-height: 0; padding: 0; flex: none;
  border-radius: 50%; background: transparent; color: var(--muted); border: 1px solid transparent;
}
.map-close:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.map-close svg { width: 16px; height: 16px; }
.map-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 6px; }
.map-field { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--muted); }
.map-field select { padding: 5px 8px; min-height: 0; font-size: 0.84rem; max-width: 170px; }
.map-tip { font-size: 0.78rem; margin: 6px 0 0; }
.map-notice {
  position: absolute; top: 12px; left: 50%; translate: -50% 0; z-index: 2; max-width: calc(100% - 24px);
  display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; border-radius: 999px;
  font-size: 0.86rem; font-weight: 500; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); box-shadow: 0 10px 28px rgba(18, 24, 66, 0.16);
  animation: map-notice-in 260ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.map-notice span { overflow-wrap: anywhere; }
.map-notice button { flex: none; }
@keyframes map-notice-in { from { opacity: 0; translate: -50% -8px; } }

/* 3D view and the time slider. */
.map-3d[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }
.map-canvas-wrap.is-3d {
  background:
    radial-gradient(ellipse at 50% 45%, color-mix(in srgb, var(--accent) 12%, var(--surface)) 0%, var(--surface) 72%);
}
.map-timeline { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.map-play { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.map-play svg { width: 14px; height: 14px; }
.map-play[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.map-time { flex: 1 1 220px; display: flex; min-width: 0; }
.map-time input { width: 100%; accent-color: var(--accent); padding: 0; min-height: 0; border: 0; background: transparent; box-shadow: none; }
.map-time-label { font-size: 0.84rem; color: var(--text-2); font-variant-numeric: tabular-nums; min-width: 12ch; }

/* ------------------------------------------------------------- AI Ledger */

.ledger-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.ledger-head button { flex: none; display: inline-flex; align-items: center; gap: 6px; }
.gauges { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.gauge {
  display: flex; align-items: center; gap: 14px; padding: 16px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2);
}
.gauge svg { width: 68px; height: 68px; flex: none; transform: rotate(-90deg); }
.gauge circle { fill: none; stroke-width: 7; }
.gauge .track { stroke: var(--surface-3); }
.gauge .value { stroke: var(--ok-fill); stroke-linecap: round; transition: stroke-dashoffset 700ms cubic-bezier(.2, .8, .2, 1); }
.gauge[data-level="mid"] .value { stroke: var(--warn-fill); }
.gauge[data-level="low"] .value { stroke: var(--danger-fill); }
.gauge[data-level="none"] .value { stroke: transparent; }
.gauge-figure { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.gauge-label { font-size: 0.86rem; font-weight: 600; }
.gauge-note { font-size: 0.78rem; color: var(--muted); }
#ledgerBasis { margin-top: 12px; }

.unstable { list-style: none; display: grid; gap: 8px; }
.unstable li {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--warn-soft);
}
.unstable li span:first-child { overflow-wrap: anywhere; font-weight: 500; }
.unstable .pill { margin: 0; flex: none; background: var(--surface); color: var(--warn); }

.ledger { list-style: none; position: relative; display: grid; gap: 2px; }
.ledger::before { content: ""; position: absolute; left: 13px; top: 8px; bottom: 8px; width: 2px; background: var(--border); }
.ledger li { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 10px 0; }
.ledger .mark {
  position: relative; z-index: 1; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); border: 2px solid var(--border-strong); color: var(--slate); font-size: 0.8rem; font-weight: 700;
}
.ledger li[data-kind="changed"] .mark { border-color: var(--warn-fill); color: var(--warn); background: var(--warn-soft); }
.ledger li[data-state="undone"] .mark { border-color: var(--ok-fill); color: var(--ok); background: var(--ok-soft); }
.ledger li[data-state="held"] .mark { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-soft); }
.ledger .what { font-size: 0.93rem; line-height: 1.5; overflow-wrap: anywhere; }
.ledger .what b { font-weight: 600; }
.ledger del { color: var(--muted); text-decoration-thickness: 1px; }
.ledger ins { text-decoration: none; font-weight: 600; background: color-mix(in srgb, var(--warn-fill) 26%, transparent); padding: 0 4px; border-radius: 4px; }
.ledger .why { font-size: 0.82rem; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.ledger .meta { font-size: 0.76rem; color: var(--muted); margin-top: 4px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ledger .meta .pill { margin: 0; }
.ledger li > button { align-self: center; }

/* ----------------------------------------------------------------- Pulse */

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.kpi strong { display: block; font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi span { font-size: 0.82rem; color: var(--muted); }
.kpi[data-tone="alert"] strong { color: var(--danger); }
.kpi[data-tone="good"] strong { color: var(--ok); }
.heat-scroll { overflow-x: auto; padding-bottom: 4px; }
.heat { display: grid; grid-template-rows: repeat(7, 16px); grid-auto-flow: column; grid-auto-columns: 16px; gap: 4px; width: max-content; }
.heat span, .heat-key span { border-radius: 4px; background: var(--surface-3); }
.heat span[data-l="1"], .heat-key span[data-l="1"] { background: var(--lab-heat-1); }
.heat span[data-l="2"], .heat-key span[data-l="2"] { background: var(--lab-heat-2); }
.heat span[data-l="3"], .heat-key span[data-l="3"] { background: var(--lab-heat-3); }
.heat span[data-l="4"], .heat-key span[data-l="4"] { background: var(--lab-heat-4); }
.heat span.blank { background: transparent; }
.heat span.today { outline: 2px solid var(--text); outline-offset: 1px; }
.heat-key { display: flex; align-items: center; gap: 4px; margin-top: 10px; }
.heat-key span { width: 12px; height: 12px; display: inline-block; }
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 34%) minmax(0, 1fr) 2.5em; gap: 10px; align-items: center; font-size: 0.88rem; }
.bar-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .track { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar-row .fill { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width 500ms ease; }
.bar-row .n { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
#speakDay[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }

/* ------------------------------------------------------------ responsive */

@media (max-width: 900px) {
  .map-body { grid-template-columns: minmax(0, 1fr); }
  .map-detail { max-height: none; }
  .map-canvas-wrap { height: 56vh; min-height: 340px; }
  .gauges { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .triage-card { padding: 20px 18px; }
  .triage-actions { gap: 8px; }
  .triage-btn kbd { display: none; }
  .ledger li { grid-template-columns: 28px minmax(0, 1fr); }
  .ledger li > button { grid-column: 2; justify-self: start; }
  .map-count { margin-left: 0; width: 100%; }
}
/* Phones: the details of what you tapped slide up as a sheet over the map, above the bottom bar. */
@media (max-width: 640px) {
  .map-detail.has-pick {
    position: fixed; left: 8px; right: 8px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 29;
    max-height: min(52vh, 460px); overflow: auto; border-radius: 18px;
    box-shadow: 0 -8px 40px rgba(18, 24, 66, 0.22); animation: map-sheet-up 280ms cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  .map-canvas-wrap { height: 62vh; }
  .map-time-label { min-width: 0; width: 100%; }
  .map-notice { border-radius: 14px; }
  body[data-page="mindmap"]:has(.map-detail.has-pick) button.nova-fab { display: none; }  /* it would cover the sheet's buttons */
}
@keyframes map-sheet-up { from { opacity: 0; transform: translateY(24px); } }
@media (prefers-reduced-motion: reduce) {
  .triage-card, .triage-bar span, .gauge .value, .bar-row .fill { transition: none; }
  .triage-card.enter, .triage-done .ring { animation: none; }
  .map-notice, .map-detail.has-pick { animation: none; }
}

/* ----------------------------------------------------------- Commitments */

.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; align-items: start; }
.person { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.person[data-alert="true"] { border-color: color-mix(in srgb, var(--danger-fill) 55%, var(--border)); }
.person-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-weight: 700; font-size: 1rem; color: #fff; background: hsl(var(--h, 215) 55% 46%);
}
.person-head h3 { font-size: 1rem; line-height: 1.2; overflow-wrap: anywhere; }
.person-head p { font-size: 0.8rem; color: var(--muted); }
.person-head p b { color: var(--danger); font-weight: 600; }
.commits { list-style: none; display: grid; gap: 8px; }
.commit { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; padding: 10px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); }
.commit input[type="checkbox"] { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); cursor: pointer; }
.commit-text { font-size: 0.9rem; line-height: 1.45; overflow-wrap: anywhere; }
.commit[data-status="done"] .commit-text { color: var(--muted); text-decoration: line-through; }
.commit-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; font-size: 0.76rem; color: var(--muted); }
.commit-meta .pill { margin: 0; }
.commit-meta .pill[data-dir="i_owe"] { background: var(--accent-soft); color: var(--text); }
.commit-meta .pill[data-dir="waiting_on"] { background: color-mix(in srgb, var(--lab-topic) 18%, transparent); color: var(--text); }
.commit-meta .pill[data-overdue="true"] { background: var(--danger-soft); color: var(--danger); }
.commit-meta button { margin-left: auto; font-size: 0.76rem; min-height: 0; padding: 0; }
.commit-note { margin-top: 16px; max-width: 70ch; }

/* ---------------------------------------------------------- Time Machine */

.tm-control { background: linear-gradient(160deg, var(--ice), var(--surface) 70%); }
.tm-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.tm-kicker { font-size: 0.76rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent-strong); }
.tm-head h2 { font-size: 1.6rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.tm-steps { display: flex; gap: 8px; flex-wrap: wrap; }
.tm-spark { display: flex; align-items: flex-end; gap: 1px; height: 44px; margin: 0 9px; }
.tm-spark span { flex: 1 1 0; min-width: 1px; border-radius: 2px 2px 0 0; background: color-mix(in srgb, var(--accent) 30%, var(--surface-3)); }
.tm-spark span.on { background: var(--accent); }
.tm-spark span.future { opacity: 0.35; }
#tmSlider { width: 100%; margin: 6px 0 2px; accent-color: var(--accent); cursor: pointer; }
.tm-range { display: flex; justify-content: space-between; }
body[data-tm="past"] #panel-timemachine .kpi { border-style: dashed; }
.tm-list { list-style: none; display: grid; gap: 8px; }
.tm-list li { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); font-size: 0.9rem; }
.tm-list li > span:first-child { overflow-wrap: anywhere; min-width: 0; }
.tm-list .pill { margin: 0; flex: none; }
.tm-list .then-now { display: block; font-size: 0.78rem; color: var(--muted); margin-top: 2px; }
.tm-list li.none { border-style: dashed; background: transparent; color: var(--muted); justify-content: center; }

/* -------------------------------------------------------- Talk to Taskly */

.talk-open { position: relative; }
@media (prefers-reduced-motion: reduce) {
}

/* ----------------------------------------------------------- AI Activity */

.ai-setup { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.ai-mode { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.ai-mode strong { display: block; font-size: 0.9rem; }
.ai-mode span { font-size: 0.8rem; color: var(--muted); overflow-wrap: anywhere; }
.ai-dot { width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; flex: none; background: var(--border-strong); }
.ai-mode[data-on="true"] .ai-dot { background: var(--ok-fill); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok-fill) 22%, transparent); }
.ai-flow { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; counter-reset: step; }
.ai-flow li { position: relative; padding: 14px 14px 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); counter-increment: step; }
.ai-flow li::before { content: counter(step); display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; margin-bottom: 8px; font-size: 0.76rem; font-weight: 700; background: var(--accent); color: #fff; }
.ai-flow li:not(:last-child)::after { content: "›"; position: absolute; right: -9px; top: 50%; transform: translateY(-50%); z-index: 1; color: var(--slate); font-size: 1.1rem; background: var(--surface); border-radius: 50%; width: 10px; text-align: center; }
.ai-flow strong { display: block; font-size: 0.88rem; line-height: 1.3; margin-bottom: 3px; }
.ai-flow span { font-size: 0.79rem; color: var(--muted); line-height: 1.4; display: block; }
.ai-flow-note { margin-top: 12px; }
.ai-table-wrap { overflow-x: auto; }
.ai-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; min-width: 640px; }
.ai-table th { text-align: left; font-size: 0.74rem; font-weight: 600; color: var(--muted); padding: 6px 10px; border-bottom: 1px solid var(--border-strong); white-space: nowrap; }
.ai-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.ai-table td span:not(.pill) { display: block; font-size: 0.76rem; color: var(--muted); }
.ai-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ai-table .pill { margin: 0; }
.ai-table tr[data-status="error"] td { background: color-mix(in srgb, var(--danger-soft) 55%, transparent); }
@media (max-width: 900px) {
  .ai-flow { grid-template-columns: minmax(0, 1fr); }
  .ai-flow li:not(:last-child)::after { content: none; }
}

/* ================================================================ Memory */
.person-head .person-about { color: var(--accent-strong); font-weight: 600; text-transform: capitalize; }
.mem-teach { margin-bottom: 16px; }
.mem-label { display: block; font-weight: 600; margin-bottom: 8px; }
.mem-form .inline-form input { flex: 1; min-width: 0; }
.mem-form .ask-examples { margin-top: 10px; }
.mem-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.mem-card-head h2, .mem-group-head h2 { font-size: 1rem; }
.mem-suggest { margin-bottom: 16px; border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); background: linear-gradient(180deg, var(--accent-soft), var(--surface) 70%); }
.mem-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; align-items: start; }
.mem-group { padding: 16px 18px; }
.mem-group-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.mem-count { margin-left: auto; font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.mem-kind-icon { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; flex: none; background: var(--accent-soft); color: var(--accent-strong); }
.mem-kind-icon .icon { width: 16px; height: 16px; }
.mem-kind-icon[data-kind="place"] { background: var(--ok-soft); color: var(--ok); }
.mem-kind-icon[data-kind="habit"] { background: var(--warn-soft); color: var(--warn); }
.mem-kind-icon[data-kind="preference"] { background: var(--danger-soft); color: var(--danger); }
.mem-kind-icon[data-kind="other"] { background: var(--surface-3, var(--ice)); color: var(--muted); }
.mem-list { list-style: none; margin: 0; padding: 0; }
.mem-fact { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.mem-fact:first-child { border-top: 0; }
.mem-body { flex: 1; min-width: 0; }
.mem-sentence { font-weight: 500; overflow-wrap: anywhere; }
.mem-meta { font-size: 0.76rem; color: var(--muted); margin-top: 2px; }
.mem-quote { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mem-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.mem-actions .link-button { font-size: 0.8rem; min-height: 0; padding: 2px 0; }
.mem-actions .mem-forget { color: var(--danger); }
.mem-actions button.small .icon { width: 14px; height: 14px; margin-right: 4px; vertical-align: -2px; }
.mem-empty { padding: 4px 0 6px; }
.mem-edit { display: grid; gap: 8px; width: 100%; }
.mem-edit label { display: grid; gap: 4px; font-size: 0.78rem; color: var(--muted); }
.mem-noticed h3 { font-size: 0.95rem; margin-top: 14px; }
.mem-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; margin-top: 8px; }
.mem-who { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.mem-who label { display: block; font-size: 0.85rem; margin-bottom: 6px; }
.mem-who label span { color: var(--muted); font-size: 0.78rem; }
.mem-who-row { display: flex; gap: 6px; align-items: center; }
.mem-who-row input { flex: 1; min-width: 0; }
.mem-note { display: flex; gap: 8px; align-items: flex-start; margin-top: 16px; }
.mem-note .icon { width: 15px; height: 15px; flex: none; margin-top: 2px; }
@media (max-width: 640px) {
  .mem-fact { flex-wrap: wrap; }
  .mem-fact.suggestion .mem-actions { width: 100%; padding-left: 42px; }
  .mem-groups { grid-template-columns: 1fr; }
}

/* ============================================================== Organize */
.org-mode { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 0.82rem; color: var(--muted); }
.org-mode .ai-dot { margin-top: 0; }
.org-mode[data-on="true"] .ai-dot { background: var(--ok-fill, #22a06b); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok-fill, #22a06b) 18%, transparent); }
.org-hero-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.org-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.org-head h2 { display: flex; align-items: center; gap: 8px; }

.org-suggestions { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.org-sug { display: grid; gap: 6px; padding: 14px; border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--border)); border-radius: var(--radius-sm); background: var(--surface); }
.org-sug-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.org-sug-top strong { font-size: 1rem; }
.org-sug .pill[data-src="ai"] { background: var(--accent-soft); color: var(--accent-strong); }
.org-sug-why { font-size: 0.8rem; color: var(--muted); }
.org-sug ul { margin: 0; padding-left: 16px; font-size: 0.8rem; color: var(--text-2); display: grid; gap: 2px; }
.org-sug ul li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-sug-actions { display: flex; gap: 6px; margin-top: 4px; }

.org-review-list { list-style: none; margin: 0; padding: 0; }
.org-rev { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.org-rev:first-child { border-top: 0; }
.org-rev-body { flex: 1; min-width: 0; }
.org-rev-title { font-weight: 500; overflow-wrap: anywhere; }
.org-rev-why { font-size: 0.8rem; color: var(--muted); margin-top: 2px; }
.org-rev-why .why { font-style: italic; }
.conf { display: inline-block; padding: 1px 8px; margin-right: 4px; border-radius: 999px; font-size: 0.72rem; font-weight: 600; font-style: normal; }
.conf[data-conf="low"] { background: var(--danger-soft); color: var(--danger); }
.conf[data-conf="medium"] { background: var(--warn-soft); color: var(--warn); }
.conf[data-conf="high"] { background: var(--ok-soft); color: var(--ok); }
.org-rev-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.org-rev-actions select { width: auto; min-width: 130px; padding: 5px 8px; font-size: 0.82rem; }

.org-topics { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; align-items: start; }
.org-topic {
  display: grid; gap: 6px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  transition: border-color var(--ease), box-shadow var(--ease), transform var(--ease);
}
.org-topic.is-project { border-top: 3px solid var(--accent); }
.org-topic.over { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); transform: translateY(-2px); }
body.org-dragging .org-topic:not(.over) { border-style: dashed; }
.org-topic header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.org-topic h3 { font-size: 0.98rem; overflow-wrap: anywhere; }
.org-count { min-width: 26px; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); font-size: 0.78rem; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.org-stats { font-size: 0.76rem; color: var(--muted); }
.org-stats b { color: var(--danger); font-weight: 600; }
.org-summary { font-size: 0.82rem; color: var(--text-2); line-height: 1.4; }
.ai-tag { display: inline-block; margin-right: 6px; padding: 0 6px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-strong); font-size: 0.66rem; font-weight: 700; vertical-align: 1px; }
.org-notes { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 4px; }
.org-notes li[data-note] {
  padding: 6px 9px; border-radius: 8px; background: var(--surface-2); font-size: 0.8rem; cursor: grab;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 1px solid transparent;
}
.org-notes li[data-note]:hover { border-color: var(--border-strong); }
.org-notes li.dragging { opacity: 0.45; }
.org-notes .pin { margin-left: 6px; color: var(--accent); font-weight: 700; }
.org-notes .more, .org-notes .empty-drop { font-size: 0.78rem; color: var(--muted); padding: 2px 4px; }
.org-notes .empty-drop { padding: 10px; border: 1px dashed var(--border-strong); border-radius: 8px; text-align: center; }
.org-topic footer { margin-top: 2px; }
.org-topic footer .link-button { font-size: 0.8rem; padding: 0; min-height: 0; }

.org-proj { display: grid; gap: 4px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); }
.org-goal { font-size: 0.82rem; font-weight: 600; }
.org-bar { height: 6px; border-radius: 999px; background: var(--border); overflow: hidden; }
.org-bar span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width 500ms ease; }
.org-proj[data-status="done"] .org-bar span { background: var(--ok-fill, #22a06b); }
.org-proj[data-status="at_risk"] .org-bar span { background: var(--warn-fill, #f2b32b); }
.org-proj[data-status="overdue"] .org-bar span { background: var(--danger-fill, #e5484d); }
.org-proj-meta { font-size: 0.74rem; color: var(--muted); }
.org-status { font-weight: 700; color: var(--text); }
.org-proj[data-status="overdue"] .org-status { color: var(--danger); }
.org-proj[data-status="at_risk"] .org-status { color: var(--warn); }
.org-proj[data-status="done"] .org-status { color: var(--ok); }
.org-proj-form { display: grid; gap: 6px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); }
.org-proj-form label { display: grid; gap: 3px; font-size: 0.74rem; }
.org-proj-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.org-rule-form { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; align-items: end; margin-bottom: 12px; }
.org-rule-form label:first-child { grid-column: 1 / -1; }
.org-rule-form label { display: grid; gap: 4px; font-size: 0.74rem; }
.org-rule-list { list-style: none; margin: 0; padding: 0; }
.org-rule { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 0.86rem; }
.org-rule:first-child { border-top: 0; }
.org-rule.off { opacity: 0.55; }
.org-rule-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.danger-link { color: var(--danger) !important; }

.org-days { display: flex; gap: 6px; margin-bottom: 10px; }
.org-days [aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.org-stale-line { font-size: 0.9rem; margin-bottom: 6px; }
.org-mini-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 4px; font-size: 0.82rem; }
.org-mini-list li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-archived { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 0.86rem; }

@media (max-width: 760px) {
  .org-rule-form { grid-template-columns: 1fr 1fr; }
  .org-rev { flex-wrap: wrap; }
  .org-rev-actions { width: 100%; }
  .org-head { flex-wrap: wrap; }
}

/* ======================================================= Organized inbox */
.oi-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.oi-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.oi-search { position: relative; display: flex; align-items: center; }
.oi-search .icon { position: absolute; left: 11px; width: 16px; height: 16px; color: var(--slate); pointer-events: none; }
.oi-search input { width: 240px; padding-left: 34px; }
.oi-tabs [role="tab"] { gap: 6px; }
.oi-n { min-width: 18px; padding: 0 6px; border-radius: 999px; font-size: 0.72rem; font-weight: 700;
  background: color-mix(in srgb, var(--text) 8%, transparent); font-variant-numeric: tabular-nums; }
.oi-n:empty { display: none; }
.oi-empty { padding: 18px 4px; }

.oi-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--border-strong); }
.oi-dot[data-level="urgent"] { background: var(--p-urgent, #E5484D); }
.oi-dot[data-level="high"] { background: var(--p-high, #F47234); }
.oi-dot[data-level="medium"] { background: var(--p-medium, #2C58DD); }
.oi-dot[data-level="low"] { background: var(--p-low, #34D0CF); }

/* By topic: bucket cards fill the width */
.oi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; align-items: start; }
.oi-bucket { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.oi-bucket header, .oi-col header { display: flex; align-items: center; gap: 8px; }
.oi-bucket h3, .oi-col h3 { font-size: 0.95rem; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.oi-count { min-width: 26px; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); font-size: 0.76rem; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.oi-bar { display: flex; height: 5px; border-radius: 999px; overflow: hidden; background: var(--surface-2); gap: 2px; }
.oi-bar i { display: block; height: 100%; }
.oi-bar i[data-level="high"] { background: var(--p-high, #F47234); }
.oi-bar i[data-level="medium"] { background: var(--p-medium, #2C58DD); }
.oi-bar i[data-level="low"] { background: var(--p-low, #34D0CF); }
.oi-bucket ul, .oi-col ul, .oi-todos { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.oi-bucket li, .oi-todos li { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 8px; font-size: 0.84rem; min-width: 0; }
.oi-bucket li span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oi-bucket li:hover, .oi-todos li:hover { background: var(--surface-2); }
.oi-more { justify-self: start; font-size: 0.8rem; min-height: 0; padding: 2px 0; }

/* To-dos */
.oi-levels { display: inline-flex; margin-bottom: 10px; }
.oi-levels .filter-pill { display: inline-flex; align-items: center; gap: 6px; }
.oi-todos { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); column-gap: 16px; }
.oi-task { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oi-when { flex: none; font-size: 0.72rem; color: var(--muted); padding: 1px 8px; border-radius: 999px; background: var(--surface-2); }

/* By priority: three columns side by side */
.oi-columns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: start; }
.oi-col { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.oi-col ul { display: flex; flex-direction: column; gap: 4px; max-height: 460px; overflow-y: auto; padding-right: 2px; }
.oi-col li { flex: none; }
.oi-col li { padding: 7px 9px; border-radius: 8px; background: var(--surface); font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oi-col li.muted { background: none; }

/* All topics: one compact row of chips beside the add box */
.topics-strip .topic-add { flex: 0 1 420px; margin: 0; }
.topics-strip .topic-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.topics-strip .topic { display: inline-flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; border-radius: 999px; }
.topics-strip .topic strong { display: inline; font-size: 0.85rem; }
.topic-n { min-width: 22px; padding: 0 7px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 0.74rem; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }

@media (max-width: 900px) {
  .oi-columns { grid-template-columns: 1fr; }
  .oi-todos { grid-template-columns: 1fr; }
  .oi-search input { width: 100%; }
  .oi-tools, .oi-search { width: 100%; }
  .topics-strip .topic-add { flex-basis: 100%; }
}

/* Organize: one Topics section with the add box in its header */
.org-topics-card .topic-add { flex: 0 1 380px; margin: 0; }
@media (max-width: 760px) { .org-topics-card .topic-add { flex-basis: 100%; } }

/* Possible duplicates and related notes */
.org-related-list { list-style: none; margin: 0; padding: 0; }
.org-rel { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 10px 0; border-top: 1px solid var(--border); }
.org-rel:first-child { border-top: 0; }
.org-rel-kind { justify-self: start; padding: 2px 10px; border-radius: 999px; font-size: 0.74rem; font-weight: 700; background: var(--surface-2); color: var(--text-2); }
.org-rel-kind[data-kind="duplicate"] { background: var(--danger-soft); color: var(--danger); }
.org-rel-kind[data-kind="near_duplicate"] { background: var(--warn-soft); color: var(--warn); }
.org-rel-pair { display: grid; gap: 4px; min-width: 0; }
.org-rel-pair p { font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-rel-n { display: inline-block; min-width: 46px; margin-right: 6px; color: var(--muted); font-size: 0.74rem; font-variant-numeric: tabular-nums; }
.org-rel-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 760px) {
  .org-rel { grid-template-columns: 1fr; gap: 6px; }
  .org-rel-actions { justify-content: flex-start; }
}

/* ================================================================= Slack */
.inbox-actions { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 10px; }
.slack-dialog { width: min(760px, calc(100vw - 24px)); max-height: calc(100vh - 40px); padding: 22px 24px; border: 1px solid var(--border);
  border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: 0 30px 80px rgba(8, 12, 30, 0.3); }
.slack-dialog::backdrop { background: rgba(8, 12, 30, 0.45); }
.slack-close-row { position: absolute; top: 12px; right: 12px; }
.slack-dialog h2 { display: flex; align-items: center; gap: 8px; font-size: 1.2rem; margin-right: 40px; }
.slack-step { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); display: grid; gap: 8px; }
.slack-step h3 { display: flex; align-items: center; gap: 8px; font-size: 0.98rem; }
.step-n { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--accent-text); font-size: 0.75rem; }
.slack-convs { max-height: 220px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 10px; }
.slack-group-name { margin: 6px 0 2px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.slack-conv { display: flex; align-items: center; gap: 8px; padding: 4px 2px; font-size: 0.88rem; color: var(--text); cursor: pointer; }
.slack-dates { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.slack-dates label, .slack-filters label { display: grid; gap: 4px; font-size: 0.78rem; }
.slack-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.slack-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
.slack-check { display: flex !important; align-items: center; gap: 8px; grid-column: 1 / -1; font-size: 0.86rem !important; }
.slack-preview-row { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.slack-select-row { display: flex; gap: 14px; }
.slack-select-row .link-button { padding: 0; min-height: 0; font-size: 0.82rem; }
.slack-results { list-style: none; margin: 0; padding: 0; max-height: 340px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.slack-msg { border-top: 1px solid var(--border); }
.slack-msg:first-child { border-top: 0; }
.slack-msg label { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; cursor: pointer; color: var(--text); font-size: 0.86rem; }
.slack-msg input { margin-top: 3px; }
.slack-msg.done { opacity: 0.55; }
.slack-msg-body { display: grid; gap: 2px; min-width: 0; }
.slack-msg-meta { font-size: 0.74rem; color: var(--muted); }
.slack-msg-text { white-space: pre-line; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.slack-import-row { display: flex; justify-content: flex-end; }
@media (max-width: 640px) {
  .slack-dialog { padding: 18px 16px; }
  .slack-filters { grid-template-columns: 1fr; }
}

/* ================================================= Organize: topic cards v2 */
.org-topic-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 14px; }
.org-topic-tools .oi-search input { width: 260px; }
.org-sort { display: inline-flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--muted); }
.org-sort select { width: auto; padding: 7px 10px; font-size: 0.85rem; }
.org-topics { gap: 14px; }
.org-topic { gap: 10px; padding: 16px; border-radius: 16px; transition: border-color var(--ease), box-shadow var(--ease), transform var(--ease); }
.org-topic:hover { box-shadow: 0 6px 20px rgba(23, 26, 43, 0.07); }
.org-topic header.org-topic-head { display: flex; align-items: center; justify-content: flex-start; gap: 12px; }
.org-topic-icon { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 11px; font-weight: 800; font-size: 1rem;
  color: hsl(var(--h) 55% 38%); background: hsl(var(--h) 75% 94%); }
.org-topic-title { flex: 1; min-width: 0; }
.org-topic-title h3 { font-size: 1rem; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-topic-title p { margin: 2px 0 0; font-size: 0.76rem; color: var(--muted); }
.org-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.org-chip { padding: 2px 9px; border-radius: 999px; font-size: 0.74rem; font-weight: 600; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.org-chip.alert { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.org-chip.ok { background: var(--conn-ok-bg, #E3F5EC); color: var(--conn-ok, #157347); border-color: transparent; }
.org-chip.quiet { color: var(--muted); }
.org-summary { font-size: 0.82rem; line-height: 1.45; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.org-notes { margin: 0; gap: 2px; }
.org-notes.scroll { max-height: 260px; overflow-y: auto; padding-right: 2px; }
.org-notes li[data-note] { display: flex; align-items: center; gap: 6px; margin: 0; padding: 5px 6px 5px 2px; line-height: 1.35; background: transparent; border: 1px solid transparent; border-radius: 8px; white-space: normal; }
.org-notes li[data-note]:hover { background: var(--surface-2); border-color: var(--border); }
.org-notes li[data-note] .txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.82rem; }
.org-notes .grip { flex: none; width: 10px; color: var(--muted); font-size: 0.7rem; letter-spacing: -2px; cursor: grab; opacity: 0.35; transition: opacity var(--ease); }
.org-notes li[data-note]:hover .grip { opacity: 1; color: hsl(var(--h) 55% 45%); }
.org-topic-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 8px; border-top: 1px solid var(--border); }
.org-topic-foot .link-button { font-size: 0.8rem; padding: 2px 0; min-height: 0; }
.org-proj-link { color: var(--muted) !important; }
.org-proj-link:hover { color: var(--accent-strong) !important; }
.org-empty-topics { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border); }
.org-empty-chip { padding: 5px 12px; border-radius: 999px; border: 1px dashed var(--border-strong); font-size: 0.8rem; color: var(--text-2); }
.org-empty-chip.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }
:root[data-theme="dark"] .org-topic-icon { color: hsl(var(--h) 80% 78%); background: hsl(var(--h) 45% 22%); }
@media (max-width: 760px) { .org-topic-tools .oi-search, .org-topic-tools .oi-search input { width: 100%; } }
