/* Co-work shared components. Used by BOTH the expert portal and the owner panel, so a
 * button, a field, a card or a chip looks and behaves the same on either side.
 * Every value comes from ds/tokens.css; a colour literal here is a decision made outside it.
 *
 * The language: calm, airy, thin lines, light type, borders over shadows. Hover only
 * shifts to the muted background or darker text, never moves anything; buttons nudge
 * down 1px when pressed.
 *
 * Page-specific layouts stay with their page (index.html, admin.html, panel/, kanvas/).
 * A pattern that appears on two pages moves here instead of being copied.
 */

/* ── Base ─────────────────────────────────────────────────────────────── */
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: var(--leading-normal);
  color: var(--fg-default);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3 { font-family: var(--font-sans); font-weight: var(--weight-light); letter-spacing: var(--tracking-tight); }
::selection { background: var(--tone-blue-bg); color: var(--foreground); }
a { color: var(--fg-accent); text-underline-offset: 3px; }
a:hover { color: var(--foreground); }
code, kbd, pre { font-family: var(--font-mono); }

/* ONE focus treatment, keyboard only: a visible ring. */
:focus-visible { outline: none; box-shadow: var(--focus-ring); }
:focus:not(:focus-visible) { outline: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
/* Eyebrow: above heroes, in stat cards, above thread titles. */
.eyebrow, .t-overline {
  font-size: var(--text-2xs); font-weight: var(--weight-medium); line-height: 1.4;
  letter-spacing: var(--tracking-overline); text-transform: uppercase; color: var(--fg-subtle);
}
.t-muted { color: var(--fg-muted); }
.t-subtle { color: var(--fg-subtle); }
.t-num { font-variant-numeric: tabular-nums; }
/* lucide icons are drawn at stroke 1.5 throughout */
.icon { width: 16px; height: 16px; stroke-width: 1.5; flex-shrink: 0; }
.icon-sm { width: 14px; height: 14px; }

/* ── Buttons ──────────────────────────────────────────────────────────── */
/* Primary is dark (the one main action). Secondary actions are outline or ghost.
   A bare .btn is the outline button. In cards use .btn-sm, icon before the label. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--control-h-md); padding: 0 var(--space-4);
  background: var(--surface); color: var(--foreground);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  font-family: inherit; font-size: var(--text-sm); font-weight: var(--weight-medium);
  line-height: 1; white-space: nowrap; text-decoration: none; cursor: pointer;
  transition: background-color var(--duration-fast), border-color var(--duration-fast),
              color var(--duration-fast), transform var(--duration-fast);
}
.btn svg { width: 16px; height: 16px; stroke-width: 1.5; flex-shrink: 0; }
.btn:hover:not(:disabled) { background: var(--surface-muted); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn[aria-busy="true"] { cursor: progress; opacity: .7; }

.btn-primary { background: var(--accent-emphasis); color: var(--fg-on-accent); border-color: var(--accent-emphasis); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-secondary, .btn-outline { background: var(--surface); color: var(--foreground); border-color: var(--border); }

/* .btn-ghost kept its old name: it was the "supporting action" button. In this language
   that is the outline button; .btn-quiet is the borderless ghost. */
.btn-ghost { background: var(--surface); color: var(--foreground); border-color: var(--border); }
.btn-quiet { background: transparent; color: var(--fg-muted); border-color: transparent; }
.btn-quiet:hover:not(:disabled) { background: var(--surface-muted); color: var(--foreground); }

.btn-danger { background: transparent; color: var(--destructive); border-color: transparent; }
.btn-danger:hover:not(:disabled) { background: var(--surface-muted); }
.btn-danger-solid { background: var(--destructive); color: var(--fg-on-accent); border-color: var(--destructive); }
.btn-success { background: var(--accent-emphasis); color: var(--fg-on-accent); border-color: var(--accent-emphasis); }
.btn-success:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-sm { min-height: var(--control-h-sm); padding: 0 var(--space-3); font-size: var(--text-xs); }
.btn-lg { min-height: var(--control-h-lg); padding: 0 var(--space-5); font-size: var(--text-md); }
.btn-full { width: 100%; }
.btn-icon { width: var(--control-h-md); padding: 0; }
.btn-icon.btn-sm { width: var(--control-h-sm); }

/* ── Form controls ────────────────────────────────────────────────────── */
.form { display: flex; flex-direction: column; gap: var(--space-5); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-4); }
.form-label, .field label {
  display: block; margin-bottom: 6px;
  font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--foreground);
}
.form-hint { font-size: var(--text-xs); font-weight: var(--weight-regular); color: var(--fg-muted); line-height: var(--leading-normal); }
.form-actions { display: flex; justify-content: flex-end; gap: var(--space-2); flex-wrap: wrap; }

.form-input, .form-textarea, .form-select, .field input, .input {
  width: 100%; min-height: var(--control-h-md); padding: 7px var(--space-3);
  background: var(--surface); color: var(--foreground);
  border: 1px solid var(--border-control); border-radius: var(--radius-md);
  font: inherit; font-size: var(--text-md); line-height: var(--leading-normal);
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}
.form-input::placeholder, .form-textarea::placeholder, .field input::placeholder, .input::placeholder {
  color: var(--fg-subtle); opacity: 1;
}
.form-input:focus, .form-textarea:focus, .form-select:focus, .field input:focus, .input:focus,
.form-input:focus-visible, .form-textarea:focus-visible, .form-select:focus-visible,
.field input:focus-visible, .input:focus-visible {
  outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px var(--ring-soft);
}
.form-input:disabled, .form-textarea:disabled, .form-select:disabled, .field input:disabled, .input:disabled {
  background: var(--surface-muted); color: var(--fg-disabled); cursor: not-allowed;
}
.form-input[aria-invalid="true"], .input[aria-invalid="true"] { border-color: var(--destructive); }
.form-textarea { resize: vertical; min-height: 96px; line-height: var(--leading-relaxed); padding-block: var(--space-2); }
.form-select, select.input { cursor: pointer; }
.input-sm { min-height: var(--control-h-sm); padding: 4px var(--space-2); font-size: var(--text-sm); width: auto; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--foreground); width: 16px; height: 16px; }
.check { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--text-md); color: var(--foreground); cursor: pointer; }

/* ── Surfaces ─────────────────────────────────────────────────────────── */
/* Borders over shadows: a card is border border-border bg-surface rounded-2xl. */
.card, .card-flat, .panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--space-6);
}
.card.is-clickable { cursor: pointer; transition: background-color var(--duration-fast); }
.card.is-clickable:hover { background: var(--surface-muted); }
.card-warm { background: var(--surface-muted); border-radius: var(--radius-lg); padding: var(--space-6); }
.card-blue { background: var(--tone-blue-bg); border-radius: var(--radius-lg); padding: var(--space-6); color: var(--foreground); }
.card-title { font-size: var(--text-body-lg); font-weight: var(--weight-medium); line-height: 1.35; }
.divider { border: none; border-top: 1px solid var(--border-subtle); margin: var(--space-5) 0; }
.divider-blue { border-top-color: var(--tone-blue-bg); }
.shadow-soft { box-shadow: var(--shadow-soft); }

/* Hero: eyebrow, a light h1, one muted sentence; three soft blobs off the top right. */
.hero {
  position: relative; overflow: hidden; isolation: isolate;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft); padding: var(--space-9) var(--space-7);
}
.hero h1, .hero-title {
  font-size: var(--text-3xl); font-weight: var(--weight-light); letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight); color: var(--foreground); margin: var(--space-2) 0 0;
}
.hero p, .hero-sub { margin-top: var(--space-3); max-width: 32rem; color: var(--fg-muted); font-size: var(--text-body-lg); line-height: var(--leading-relaxed); }
.hero-blobs { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.hero-blobs span { position: absolute; filter: blur(40px); opacity: .75; border-radius: 48% 52% 60% 40%; }
.hero-blobs span:nth-child(1) { width: 220px; height: 180px; top: -70px; right: -40px; background: var(--tone-blue-bg); }
.hero-blobs span:nth-child(2) { width: 170px; height: 150px; top: -30px; right: 130px; background: var(--tone-lavender-bg); }
.hero-blobs span:nth-child(3) { width: 150px; height: 130px; top: 60px; right: -30px; background: var(--tone-green-bg); }
@media (min-width: 768px) {
  .hero { padding: var(--space-11) var(--space-10); }
  .hero h1, .hero-title { font-size: var(--text-4xl); }
}

/* ── Page structure ───────────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4);
  flex-wrap: wrap; margin: var(--space-4) 0 var(--space-7);
}
.page-header h1 {
  margin: 0; font-size: var(--text-3xl); font-weight: var(--weight-light);
  letter-spacing: var(--tracking-tight); line-height: var(--leading-tight); color: var(--foreground);
}
.page-header p { margin: var(--space-2) 0 0; font-size: var(--text-md); color: var(--fg-muted); max-width: 36rem; line-height: var(--leading-relaxed); }
.page-actions { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.section { margin-bottom: var(--space-9); }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3);
  margin-bottom: var(--space-4); flex-wrap: wrap;
}
.section-title {
  font-family: var(--font-sans); font-size: var(--text-lg); font-weight: var(--weight-light);
  letter-spacing: var(--tracking-tight); color: var(--foreground); line-height: 1.3;
}
.section-count, .view-all { font-size: var(--text-xs); color: var(--fg-muted); font-variant-numeric: tabular-nums; }
.view-all { text-decoration: none; }
.view-all:hover { color: var(--foreground); }

/* ── Stat cards ───────────────────────────────────────────────────────── */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-4); margin-bottom: var(--space-9); }
@media (min-width: 640px) { .stat-row.stat-row--three { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.stat-card, .tile {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: var(--space-5); min-width: 0; box-shadow: var(--shadow-soft);
}
.stat-card-label, .tile-label {
  font-size: var(--text-2xs); font-weight: var(--weight-medium); color: var(--fg-subtle);
  text-transform: uppercase; letter-spacing: var(--tracking-overline); margin-bottom: var(--space-4);
  padding-right: 40px;
}
.stat-card-value, .tile-value {
  font-size: var(--text-3xl); font-weight: var(--weight-light); line-height: 1.1;
  font-variant-numeric: tabular-nums; letter-spacing: var(--tracking-tight); color: var(--foreground);
}
.tile-value { font-size: var(--text-2xl); }
.stat-card-sub, .tile-sub { font-size: var(--text-xs); color: var(--fg-muted); margin-top: var(--space-2); }
/* The tinted 28px icon chip at the top right of a stat card. */
.stat-icon {
  position: absolute; top: var(--space-4); right: var(--space-4); width: 28px; height: 28px;
  border-radius: var(--radius-sm); display: inline-flex; align-items: center; justify-content: center;
  background: var(--tone-blue-bg); color: var(--tone-blue-ink);
}
.stat-icon svg { width: 14px; height: 14px; stroke-width: 1.5; }
.stat-icon.tone-green    { background: var(--tone-green-bg);    color: var(--tone-green-ink); }
.stat-icon.tone-lavender { background: var(--tone-lavender-bg); color: var(--tone-lavender-ink); }
.stat-icon.tone-yellow   { background: var(--tone-yellow-bg);   color: var(--tone-yellow-ink); }
.stat-icon.tone-peach    { background: var(--tone-peach-bg);    color: var(--tone-peach-ink); }
.stat-icon.tone-pink     { background: var(--tone-pink-bg);     color: var(--tone-pink-ink); }
.stat-card-primary .stat-card-value, .stat-card-success .stat-card-value { color: var(--foreground); }

/* ── List panel ───────────────────────────────────────────────────────── */
.list { list-style: none; margin: 0; padding: 0; }
.list > * + * { border-top: 1px solid var(--border-subtle); }
.list-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) 0; min-width: 0; }
.list-row-main { flex: 1; min-width: 0; }
.list-row-title { font-size: var(--text-md); color: var(--foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row-meta { font-size: var(--text-xs); color: var(--fg-muted); margin-top: 2px; }
.list-row.is-clickable { cursor: pointer; }
.list-row-arrow { width: 16px; height: 16px; stroke-width: 1.5; color: var(--fg-subtle); flex-shrink: 0; transition: color var(--duration-fast); }
.list-row.is-clickable:hover .list-row-arrow { color: var(--foreground); }

/* ── Status chips, tags ───────────────────────────────────────────────── */
/* rounded-full px-2.5 py-0.5 text-xs, a tone pair, and always a word. */
.badge, .chip-status {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px;
  border-radius: var(--radius-pill); font-size: var(--text-xs); font-weight: var(--weight-regular);
  line-height: 1.5; white-space: nowrap; background: var(--neutral-bg); color: var(--neutral-fg);
}
.badge svg { width: 14px; height: 14px; stroke-width: 1.5; }
.badge-info, .badge-new, .badge-expert       { background: var(--tone-blue-bg);     color: var(--tone-blue-ink); }
.badge-pending, .badge-warning, .badge-medium, .badge-declared { background: var(--tone-yellow-bg); color: var(--tone-yellow-ink); }
.badge-success, .badge-accepted, .badge-low, .badge-registry_verified { background: var(--tone-green-bg); color: var(--tone-green-ink); }
.badge-attention                              { background: var(--tone-peach-bg);    color: var(--tone-peach-ink); }
.badge-ai                                     { background: var(--tone-lavender-bg); color: var(--tone-lavender-ink); }
.badge-danger, .badge-rejected, .badge-high   { background: var(--tone-pink-bg);     color: var(--tone-pink-ink); }

.pill-group { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--space-2); }
.pill {
  display: inline-flex; align-items: center; padding: 2px 10px; border-radius: var(--radius-pill);
  background: var(--surface-muted); color: var(--foreground-muted); font-size: var(--text-xs);
}
.pill-empty { color: var(--fg-muted); font-size: var(--text-sm); }
.tag {
  display: inline-flex; align-items: center; padding: 1px var(--space-2); border-radius: var(--radius-pill);
  background: var(--surface-muted); font-size: var(--text-xs); color: var(--fg-muted); white-space: nowrap;
}
.count-badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px;
  padding: 0 6px; border-radius: var(--radius-pill); background: var(--tone-blue-bg);
  color: var(--tone-blue-ink); font-size: var(--text-xs); font-weight: var(--weight-medium); font-variant-numeric: tabular-nums;
}

/* ── Feedback ─────────────────────────────────────────────────────────── */
/* An error after an action is an inline line in destructive (shell.js gives it
   role="alert"). Success and info are quiet tinted lines. Hidden until a state class. */
.msg { display: none; font-size: var(--text-sm); line-height: var(--leading-normal); }
.msg.error   { display: block; color: var(--destructive); }
.msg.success { display: block; color: var(--tone-green-ink); background: var(--tone-green-bg); padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); }
.msg.info    { display: block; color: var(--tone-blue-ink);  background: var(--tone-blue-bg);  padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); }
.msg.warning { display: block; color: var(--tone-yellow-ink); background: var(--tone-yellow-bg); padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); }

.callout {
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); font-size: var(--text-md);
  line-height: var(--leading-relaxed); background: var(--tone-blue-bg); color: var(--foreground);
}
.callout-success { background: var(--tone-green-bg); }
.callout-warning { background: var(--tone-yellow-bg); }
.callout-attention { background: var(--tone-peach-bg); }
.callout-danger  { background: var(--tone-pink-bg); }
.callout-neutral { background: var(--surface-muted); }

/* ── Empty, error, loading ────────────────────────────────────────────── */
/* A centred dashed card with a 40px muted icon tile, a title and an optional line. */
.empty-state, .placeholder-state {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: var(--space-14) var(--space-6); color: var(--fg-muted);
  background: var(--surface-translucent); border: 1px dashed var(--border-strong); border-radius: var(--radius-lg);
}
.empty-state::before {
  content: ''; width: 40px; height: 40px; margin-bottom: var(--space-4); border-radius: var(--radius-md);
  background-color: var(--surface-muted);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%235f6a76' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='22 12 16 12 14 15 10 15 8 12 2 12'/%3E%3Cpath d='M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: center;
}
.empty-state h2, .placeholder-state h2, .empty-state-title {
  font-size: var(--text-body-lg); font-weight: var(--weight-medium); letter-spacing: 0;
  color: var(--foreground); margin: 0 0 var(--space-1);
}
.empty-state p, .placeholder-state p { font-size: var(--text-md); max-width: 40ch; margin: 0 auto; line-height: var(--leading-relaxed); }
.empty-state .btn, .placeholder-state .btn { margin-top: var(--space-4); }
.empty-inline { color: var(--fg-muted); font-size: var(--text-md); padding: var(--space-5) 0; }

/* Skeletons: shaped like the content, muted, same radius. No spinners. */
@keyframes ds-pulse { 50% { opacity: .55; } }
.skeleton { background: var(--surface-muted); border-radius: var(--radius-md); min-height: 1em; animation: ds-pulse 1.6s ease-in-out infinite; }
.skeleton-list { display: flex; flex-direction: column; gap: var(--space-3); }
.skeleton-list .skeleton { height: 56px; border-radius: var(--radius-lg); }

/* ── Tabs ─────────────────────────────────────────────────────────────── */
.seg {
  display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--radius-md);
  background: var(--surface-muted); max-width: 100%; overflow-x: auto;
}
.seg-item {
  flex: 1; min-height: 30px; padding: 0 var(--space-4); border: none; border-radius: var(--radius-sm);
  background: none; color: var(--fg-muted); font: inherit; font-size: var(--text-sm); cursor: pointer; white-space: nowrap;
  transition: background-color var(--duration-fast), color var(--duration-fast);
}
.seg-item:hover { color: var(--foreground); }
.seg-item.active, .seg-item[aria-selected="true"] { background: var(--surface); color: var(--foreground); font-weight: var(--weight-medium); }

.chips { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: var(--space-1); min-height: 30px; padding: 0 var(--space-3);
  border-radius: var(--radius-pill); border: 1px solid var(--border); background: var(--surface);
  color: var(--fg-muted); font: inherit; font-size: var(--text-sm); cursor: pointer; white-space: nowrap;
  transition: background-color var(--duration-fast), color var(--duration-fast);
}
.chip:hover { background: var(--surface-muted); color: var(--foreground); }
.chip.active, .chip[aria-pressed="true"], .chip[aria-selected="true"] {
  background: var(--surface-muted); border-color: var(--surface-muted); color: var(--foreground); font-weight: var(--weight-medium);
}

/* ── Tables ───────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: var(--text-md); }
.table th, .table td { text-align: left; vertical-align: top; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border-subtle); }
.table th {
  font-size: var(--text-2xs); font-weight: var(--weight-medium); color: var(--fg-subtle);
  text-transform: uppercase; letter-spacing: var(--tracking-overline); white-space: nowrap;
}
.table tbody tr:hover td { background: var(--bg-hover); }
.table tr:last-child td { border-bottom: none; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Dialogs ──────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: var(--z-modal);
  background: var(--bg-overlay); align-items: center; justify-content: center; padding: var(--space-6);
}
.modal-overlay.open { display: flex; }
.modal {
  width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--space-6); box-shadow: var(--shadow-lg);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-5); }
.modal-header h2, .modal-title { font-size: var(--text-lg); font-weight: var(--weight-light); letter-spacing: var(--tracking-tight); }
.modal-close {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 32px; height: 32px; border: none; border-radius: var(--radius-md);
  background: transparent; color: var(--fg-subtle); font-size: 20px; line-height: 1; cursor: pointer;
}
.modal-close:hover { background: var(--surface-muted); color: var(--foreground); }

/* ── Sidebar (both apps) ──────────────────────────────────────────────── */
/* Kept from the first design (owner, 2026-10-18): a dark container in the brand ink,
   the current page filled blue. The portal floats it; the owner panel runs it full height. */
.app-sidebar { background: var(--sidebar-bg); color: var(--inverse-fg); }
.app-sidebar .nav-section {
  font-size: var(--text-2xs); font-weight: var(--weight-medium); color: var(--inverse-fg-subtle);
  letter-spacing: var(--tracking-overline); text-transform: uppercase; padding: 0 var(--space-2); margin: var(--space-4) 0 var(--space-1);
}
.app-sidebar .nav-item {
  display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 10px;
  border-radius: var(--radius-sm); color: var(--inverse-fg-muted); cursor: pointer; user-select: none;
  font-size: var(--text-sm); font-weight: var(--weight-medium);
  transition: background-color var(--duration-fast), color var(--duration-fast);
}
.app-sidebar .nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.app-sidebar .nav-item:hover { background: var(--inverse-hover); color: var(--inverse-fg); }
/* Current page: filled blue, white, and aria-current for assistive tech. */
.app-sidebar .nav-item.active { background: var(--sidebar-active); color: var(--inverse-fg); }
.app-sidebar .nav-item:focus-visible { box-shadow: 0 0 0 2px var(--inverse-focus); }

/* The avatar: blue pair, size-8. */
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--tone-blue-bg); color: var(--tone-blue-ink); font-size: var(--text-xs); font-weight: var(--weight-medium);
  overflow: hidden; flex-shrink: 0;
}

/* ── The first-run guide (ds/guide.js, owner 2026-10-28) ──────────────────────
   The welcome modal reuses .modal; these are the coach mark, the info label, the
   toast, the sidebar's next-step dot, the arrival ring and the Home checklist. */
.guide-sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.guide-modal .modal-title { margin: 0 0 var(--space-4); }
.guide-modal-lines { margin: 0 0 var(--space-6); padding-left: var(--space-5); display: grid; gap: var(--space-2);
  font-size: var(--text-md); line-height: var(--leading-relaxed); color: var(--fg-default); }
.guide-modal-actions { display: flex; gap: var(--space-3); flex-wrap: wrap; justify-content: flex-end; }

.guide-coach {
  position: fixed; z-index: var(--z-popover); max-width: 300px; padding: var(--space-3) var(--space-4);
  background: var(--surface); color: var(--fg-default); border: 1px solid var(--border-accent);
  border-radius: var(--radius-md); box-shadow: var(--shadow-md);
  display: flex; flex-direction: column; align-items: flex-end; gap: var(--space-2);
}
.guide-coach::before {   /* the arrow, pointing at the control */
  content: ""; position: absolute; top: -6px; left: calc(var(--guide-arrow, 50%) - 6px);
  width: 10px; height: 10px; background: var(--surface); transform: rotate(45deg);
  border-left: 1px solid var(--border-accent); border-top: 1px solid var(--border-accent);
}
.guide-coach.is-above::before { top: auto; bottom: -6px; transform: rotate(225deg); }
.guide-coach-text { margin: 0; align-self: stretch; font-size: var(--text-sm); line-height: var(--leading-normal); }
/* a coach mark sits in the page next to its control, so a screen's own button rules
   (the case screen's `.kv-root button { color: inherit }`) must not reach its button */
.guide-coach .btn-primary { color: var(--fg-on-accent); }

.guide-info {
  display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-4);
  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4); border-radius: var(--radius-md);
  background: var(--info-bg); color: var(--info-fg); font-size: var(--text-sm); line-height: var(--leading-normal);
}
.guide-info-text { flex: 1; min-width: 0; }
.guide-info-close {
  flex-shrink: 0; width: 28px; height: 28px; border: none; border-radius: var(--radius-sm);
  background: transparent; color: inherit; font-size: 18px; line-height: 1; cursor: pointer;
}
.guide-info-close:hover { background: var(--surface-translucent); }

.guide-toast {
  position: fixed; z-index: var(--z-popover); right: var(--space-6); bottom: var(--space-6);
  display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4);
  background: var(--success-bg); color: var(--success-fg); border-radius: var(--radius-md); box-shadow: var(--shadow-md);
  font-size: var(--text-sm);
}
.guide-toast-link {
  border: none; background: transparent; color: inherit; font: inherit; font-weight: var(--weight-medium);
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 0;
}

.guide-dot {
  width: 8px; height: 8px; margin-left: auto; border-radius: 50%; flex-shrink: 0;
  background: var(--sidebar-dot); box-shadow: 0 0 0 0 var(--sidebar-dot);
  animation: guide-pulse 1.8s var(--ease-standard) infinite;
}
@keyframes guide-pulse { 0% { box-shadow: 0 0 0 0 var(--ring-soft); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .guide-dot { animation: none; } }

.guide-highlight { box-shadow: var(--focus-ring) !important; border-radius: var(--radius-md); }

.guide-checklist { margin-top: var(--space-5); }
.guide-checklist .section-head { gap: var(--space-3); }
.guide-progress { margin-left: auto; font-size: var(--text-sm); color: var(--fg-muted); font-variant-numeric: tabular-nums; }
.guide-bar { height: 6px; border-radius: var(--radius-pill); background: var(--viz-track); overflow: hidden; margin: var(--space-2) 0 var(--space-4); }
.guide-bar span { display: block; height: 100%; background: var(--success-solid); }
.guide-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.guide-step { display: flex; align-items: center; gap: var(--space-3); min-height: var(--control-h-md, 36px); font-size: var(--text-md); }
.guide-step-label { flex: 1; min-width: 0; }
.guide-tick {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--text-xs); background: var(--surface-muted); color: var(--fg-muted); font-variant-numeric: tabular-nums;
}
.guide-step.is-done .guide-tick { background: var(--success-bg); color: var(--success-fg); }
.guide-step.is-done .guide-step-label { color: var(--fg-muted); }
