/* ==========================================================================
   Cadence — Components
   Naming: BEM  .block / .block__element / .block--modifier / .is-state
   Adding a component: put its styles here and document it on a components/*.html page.
   ========================================================================== */

/* ---------- Button ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px;
  border: 1px solid transparent; border-radius: var(--radius-md);
  font-size: var(--text-sm); font-weight: var(--weight-semibold);
  white-space: nowrap;
  transition: background var(--duration-fast), border-color var(--duration-fast), color var(--duration-fast), transform var(--duration-fast);
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.is-disabled { opacity: .45; pointer-events: none; }
.btn:hover { text-decoration: none; }

.btn--primary { background: var(--color-primary); color: var(--color-on-primary); }
.btn--primary:hover { background: var(--color-primary-hover); }
.btn--secondary { background: var(--color-surface); border-color: var(--color-border); color: var(--color-text); box-shadow: var(--shadow-xs); }
.btn--secondary:hover { background: var(--color-surface-hover); border-color: var(--color-border-strong); }
.btn--ghost { background: transparent; color: var(--color-text-2); }
.btn--ghost:hover { background: var(--color-surface-hover); color: var(--color-text); }
.btn--soft { background: var(--color-primary-soft); color: var(--color-primary-text); }
.btn--soft:hover { background: var(--color-primary-soft-2); }
.btn--danger { background: var(--color-danger); color: #fff; }
.btn--danger:hover { filter: brightness(.92); }

.btn--sm { height: 28px; padding: 0 10px; font-size: var(--text-xs); border-radius: var(--radius-sm); }
.btn--lg { height: 42px; padding: 0 20px; font-size: var(--text-md); }
.btn--icon { width: 34px; padding: 0; }
.btn--icon.btn--sm { width: 28px; }

.kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 5px;
  border: 1px solid var(--color-border); border-bottom-width: 2px; border-radius: var(--radius-xs);
  background: var(--color-surface);
  font-family: var(--font-mono); font-size: 10px; color: var(--color-text-3);
}

/* ---------- Input ---------- */
.input, .select, .textarea {
  width: 100%; height: 34px; padding: 0 12px;
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  background: var(--color-surface);
  font-size: var(--text-sm);
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}
.textarea { height: auto; min-height: 88px; padding: 10px 12px; resize: vertical; line-height: var(--leading-normal); }
.input::placeholder, .textarea::placeholder { color: var(--color-text-3); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--color-border-strong); }
.input:focus, .select:focus, .textarea:focus { outline: 0; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-focus-ring); }
.input.is-invalid { border-color: var(--color-danger); }

.input-group { position: relative; display: flex; align-items: center; }
.input-group > .icon { position: absolute; left: 10px; color: var(--color-text-3); pointer-events: none; }
.input-group > .input { padding-left: 32px; }
.input-group > .kbd { position: absolute; right: 8px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--color-text-2); }
.field__hint { font-size: var(--text-xs); color: var(--color-text-3); }
.field__error { font-size: var(--text-xs); color: var(--color-danger-text); }

.checkbox { width: 16px; height: 16px; accent-color: var(--color-primary); cursor: pointer; }

/* Task check circle: click to complete */
.task-check {
  display: grid; place-items: center;
  width: 18px; height: 18px; flex-shrink: 0;
  border: 1.5px solid var(--color-border-strong); border-radius: 50%;
  background: var(--color-surface); color: transparent;
  padding: 0;
  transition: all var(--duration-fast);
}
.task-check:hover { border-color: var(--color-success); color: var(--color-success); }
.task-check.is-done { background: var(--color-success); border-color: var(--color-success); color: #fff; }
.task-check .icon { width: 11px; height: 11px; stroke-width: 3; }

/* Switch */
.switch { position: relative; display: inline-block; width: 34px; height: 20px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--color-border-strong); transition: background var(--duration-base); cursor: pointer; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform var(--duration-base) var(--ease-standard); }
.switch input:checked + span { background: var(--color-primary); }
.switch input:checked + span::after { transform: translateX(14px); }
.switch input:focus-visible + span { outline: 2px solid var(--color-focus-ring); outline-offset: 2px; }

/* ---------- Segmented control / Tabs ---------- */
/* Segmented control (v0.4): raised toggle, white active item on a sunken track */
.segmented {
  display: inline-flex; padding: 3px; gap: 2px;
  max-width: 100%; overflow-x: auto; scrollbar-width: none;   /* scrolls inside itself on narrow screens */
  background: var(--color-surface-sunken); border-radius: var(--radius-full);
}
.segmented::-webkit-scrollbar { display: none; }
.segmented__item { flex-shrink: 0; }
.segmented__item {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 14px;
  border: 0; border-radius: var(--radius-full); background: none;
  font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--color-text-2);
  transition: background var(--duration-fast), color var(--duration-fast);
}
.segmented__item:hover { color: var(--color-text); text-decoration: none; }
.segmented__item.is-active, .segmented__item[aria-selected="true"] { background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-sm); }

/* Icon tabs (v0.4): round icon buttons for categories, paired with the segmented toggle */
.icon-tabs { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.icon-tabs__item { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%; background: var(--color-surface-sunken); color: var(--color-text-2); cursor: pointer; transition: background var(--duration-fast), color var(--duration-fast), box-shadow var(--duration-fast); }
.icon-tabs__item:hover { color: var(--color-text); }
.icon-tabs__item.is-active, .icon-tabs__item[aria-pressed="true"] { background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-md); }

/* Step tabs (v0.4): numbered steps over a hairline; done + current in the primary color */
.step-tabs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); font-size: var(--text-xs); }
.step-tabs__item { position: relative; display: flex; gap: 6px; align-items: baseline; min-width: 0; padding: 0 8px 16px 0; border: 0; background: none; color: var(--color-text-3); font: inherit; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.step-tabs__item b { font-weight: var(--weight-semibold); }
.step-tabs__item::after { content: ""; position: absolute; left: 0; right: 0; bottom: 5px; height: 1px; background: var(--color-border-strong); }
.step-tabs__item::before { content: ""; position: absolute; left: 0; bottom: 3px; z-index: 1; width: 5px; height: 5px; border-radius: 50%; background: var(--color-border-strong); }
.step-tabs__item.is-done, .step-tabs__item[aria-current="step"] { color: var(--color-text); }
.step-tabs__item.is-done b, .step-tabs__item[aria-current="step"] b { color: var(--color-primary-text); }
.step-tabs__item.is-done::after, .step-tabs__item[aria-current="step"]::after { bottom: 4px; height: 3px; border-radius: 3px; background: var(--color-primary); }
.step-tabs__item[aria-current="step"]::after { right: 45%; }
.step-tabs__item.is-done::before, .step-tabs__item[aria-current="step"]::before { background: var(--color-primary); }

.tabs { display: flex; gap: var(--space-5); border-bottom: 1px solid var(--color-border-subtle); }
.tabs__item {
  position: relative; padding: 10px 0;
  border: 0; background: none;
  font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--color-text-2);
}
.tabs__item:hover { color: var(--color-text); text-decoration: none; }
.tabs__item.is-active { color: var(--color-text); font-weight: var(--weight-semibold); }
.tabs__item.is-active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--color-primary); }

/* ---------- Badge / Tag / Status ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px;
  border-radius: var(--radius-full);
  font-size: var(--text-2xs); font-weight: var(--weight-semibold);
  background: var(--color-surface-sunken); color: var(--color-text-2);
  white-space: nowrap;
}
.badge--primary { background: var(--color-primary-soft); color: var(--color-primary-text); }
.badge--success { background: var(--color-success-soft); color: var(--color-success-text); }
.badge--warning { background: var(--color-warning-soft); color: var(--color-warning-text); }
.badge--danger  { background: var(--color-danger-soft);  color: var(--color-danger-text); }
.badge--info    { background: var(--color-info-soft);    color: var(--color-info-text); }
.badge--accent  { background: var(--color-primary);      color: var(--color-on-primary); }

/* Verdict chip (v0.4): dot + one word that judges a comparison or review */
.verdict { --verdict: var(--role-operational); display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 10px 0 9px; border-radius: var(--radius-md); background: var(--color-surface); box-shadow: inset 0 0 0 1px var(--color-border); color: var(--color-text); font-size: var(--text-xs); font-weight: var(--weight-medium); white-space: nowrap; }
.verdict::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--verdict); box-shadow: 0 0 0 3px color-mix(in srgb, var(--verdict) 25%, transparent); }
.verdict--pending { --verdict: var(--ink-400); }
.verdict--risk { --verdict: var(--role-attention); }
.verdict--blocked { --verdict: var(--role-critical); }

/* Eyebrow (v0.4): dot + short label + hairline rule above a section intro */
.eyebrow { --eyebrow-dot: var(--color-accent); display: flex; align-items: flex-start; gap: var(--space-2); padding-bottom: 10px; border-bottom: 1px solid var(--color-border); font-size: var(--text-xs); line-height: 1.35; color: var(--color-text-2); }
.eyebrow::before { content: ""; flex: none; width: 5px; height: 5px; margin-top: .45em; border-radius: 50%; background: var(--eyebrow-dot); }

/* Tag: soft tinted pill (v0.3). Set --tag-color to a project color. */
.tag {
  --tag-color: var(--color-text-3);
  display: inline-flex; align-items: center;
  height: 22px; padding: 0 9px;
  border-radius: var(--radius-full);
  font-size: var(--text-2xs); font-weight: var(--weight-semibold);
  color: color-mix(in srgb, var(--tag-color) 55%, var(--color-text));   /* ≥4.6:1 for every project color */
  background: color-mix(in srgb, var(--tag-color) 14%, transparent);
  white-space: nowrap;
}
.tag__dot { display: none; }   /* kept for backwards-compatible markup */

/* Status: circle icon + text, color from --status-* */
.status { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--color-text-2); white-space: nowrap; }
.status__icon {
  width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0;
  border: 1.5px solid var(--s-color);
}
.status--backlog  { --s-color: var(--status-backlog); }
.status--backlog .status__icon { border-style: dashed; }
.status--todo     { --s-color: var(--status-todo); }
.status--progress { --s-color: var(--status-progress); }
.status--progress .status__icon { background: conic-gradient(var(--s-color) 0 50%, transparent 50%); }
.status--review   { --s-color: var(--status-review); }
.status--review .status__icon { background: conic-gradient(var(--s-color) 0 75%, transparent 75%); }
.status--done     { --s-color: var(--status-done); }
.status--done .status__icon { background: var(--s-color); box-shadow: inset 0 0 0 2px var(--color-surface); }
.status--blocked  { --s-color: var(--status-blocked); }
.status--blocked .status__icon { background: var(--s-color); }

/* Priority: three-bar signal */
.priority { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.priority i { width: 3px; border-radius: 1px; background: var(--color-border-strong); }
.priority i:nth-child(1) { height: 5px; }
.priority i:nth-child(2) { height: 8px; }
.priority i:nth-child(3) { height: 12px; }
.priority--low i:nth-child(1) { background: var(--priority-low); }
.priority--medium i:nth-child(-n+2) { background: var(--priority-medium); }
.priority--high i { background: var(--priority-high); }
.priority--urgent { align-items: center; justify-content: center; width: 14px; height: 14px; border-radius: 3px; background: var(--priority-urgent); color: #fff; font-size: 10px; font-weight: 800; }
.priority--urgent i { display: none; }
.priority--urgent::after { content: "!"; }

/* ---------- Avatar ---------- */
.avatar {
  display: inline-grid; place-items: center;
  width: 24px; height: 24px; flex-shrink: 0;
  border-radius: 50%;
  background: var(--av, var(--color-brand)); color: #fff;
  font-size: 10px; font-weight: var(--weight-bold);
  overflow: hidden;
}
.avatar--sm { width: 20px; height: 20px; font-size: 9px; }
.avatar--lg { width: 32px; height: 32px; font-size: 12px; }
.avatar--xl { width: 48px; height: 48px; font-size: 16px; }
.avatar-group { display: inline-flex; }
.avatar-group .avatar { box-shadow: 0 0 0 2px var(--color-surface); }
.avatar-group .avatar + .avatar { margin-left: -6px; }

/* ---------- Card / Panel ---------- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}
.card--pad { padding: var(--space-5); }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--color-border-subtle); }
.card__body { padding: var(--space-4) var(--space-5); }
/* Hero (v0.4): stacked goal card. The one "current beat" of a screen; never more than one per view.
   Markup: .goal-stack > .goal-stack__back (next goal) + .card.card--hero (current goal) */
.goal-stack { position: relative; padding-top: 34px; }
.goal-stack__back { position: absolute; left: 14px; right: 14px; top: 0; height: 60px; padding: 10px 16px; border-radius: var(--radius-xl); background: var(--color-primary); color: var(--color-on-primary); font-size: var(--text-xs); font-weight: var(--weight-semibold); }
.card--hero { position: relative; border-color: transparent; border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); }

/* Quad tiles (v0.4): 2×2 grid of tightly spaced stat tiles with a round ↗ action. Replaces flat tiles. */
.quad { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.quad__tile { position: relative; display: grid; align-content: space-between; gap: 22px; min-height: 116px; padding: var(--space-3); border-radius: var(--radius-sm); background: var(--color-surface-2); color: var(--color-text); }
.quad__tile--brand { background: var(--blue-100); color: var(--ink-900); }
.quad__tile--dark { background: var(--ink-900); color: #FFFFFF; }
:root[data-theme="dark"] .quad__tile--dark { background: var(--blue-900); }
.quad__tile--light { background: var(--color-surface); box-shadow: inset 0 0 0 1px var(--color-border); }
.quad__label { max-width: 70%; font-size: var(--text-xs); line-height: 1.25; }
.quad__value { font-family: var(--font-display); font-size: 30px; font-weight: var(--weight-numeral); line-height: 1; letter-spacing: var(--tracking-display); font-variant-numeric: tabular-nums; }
.quad__value sup { margin-left: 2px; font-size: .4em; vertical-align: top; letter-spacing: 0; }
.quad__value small { font-size: .42em; letter-spacing: 0; color: color-mix(in srgb, currentColor 75%, transparent); }
.quad__go { position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center; background: var(--color-surface); color: var(--color-text); cursor: pointer; }
.quad__tile--light .quad__go { background: var(--color-surface-2); }
.quad__tile--brand .quad__go { background: #FFFFFF; color: var(--ink-900); }
.quad__tile--dark .quad__go { background: #FFFFFF; color: var(--ink-900); }
.quad__go svg { width: 14px; height: 14px; }
/* E · Hairline: no container, a top rule and oversized light numerals */
.card--hairline { background: none; border: 0; border-top: 1px solid var(--color-text); border-radius: 0; box-shadow: none; }
.card--hairline.card--pad { padding: var(--space-3) 0 0; }
.card__arrow { position: absolute; top: var(--space-4); right: var(--space-4); width: 16px; height: 16px; color: currentColor; opacity: .55; }
.card--hairline .card__arrow { top: var(--space-3); right: 0; }
.card:has(> .card__arrow) { position: relative; }
.card--interactive { transition: box-shadow var(--duration-base), border-color var(--duration-base), transform var(--duration-base); cursor: pointer; }
.card--interactive:hover { border-color: var(--color-border); box-shadow: var(--shadow-md); }

/* Stat card */
.stat { display: flex; flex-direction: column; gap: var(--space-2); }
.stat__value { font-family: var(--font-display); font-size: var(--text-4xl); font-weight: var(--weight-numeral); letter-spacing: var(--tracking-display); font-variant-numeric: tabular-nums; line-height: 1; }
.stat__delta { font-size: var(--text-xs); font-weight: var(--weight-semibold); }
.stat__delta.is-up { color: var(--color-success-text); }
.stat__delta.is-down { color: var(--color-danger-text); }

/* ---------- Progress ---------- */
.progress { height: 6px; border-radius: 999px; background: var(--color-surface-sunken); overflow: hidden; }
.progress__bar { height: 100%; border-radius: inherit; background: var(--bar, var(--color-primary)); transition: width var(--duration-slow) var(--ease-standard); }

.ring { --p: 60; --size: 40px; width: var(--size); height: var(--size); border-radius: 50%;
  background: conic-gradient(var(--ring-color, var(--color-primary)) calc(var(--p) * 1%), var(--color-surface-sunken) 0);
  display: grid; place-items: center; }
.ring::after { content: ""; width: calc(var(--size) - 8px); height: calc(var(--size) - 8px); border-radius: 50%; background: var(--color-surface); grid-area: 1 / 1; }
.ring > span { grid-area: 1 / 1; z-index: 1; font-size: 10px; font-weight: var(--weight-semibold); }

/* ---------- Task row (list view & dashboard) ---------- */
.task-row {
  display: flex; align-items: center; gap: var(--space-3);
  min-height: 42px; padding: 0 var(--space-4);
  border-bottom: 1px solid var(--color-border-subtle);
  font-size: var(--text-sm);
  transition: background var(--duration-fast);
}
.task-row:hover { background: var(--color-surface-hover); }
.task-row:last-child { border-bottom: 0; }
.task-row__id { font-family: var(--font-mono); font-size: var(--text-2xs); color: var(--color-text-3); width: 64px; flex-shrink: 0; }
.task-row__title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-row.is-done .task-row__title { color: var(--color-text-3); text-decoration: line-through; }
.task-row__meta { display: flex; align-items: center; gap: var(--space-3); flex-shrink: 0; }
@media (max-width: 520px) {
  .task-row { flex-wrap: wrap; row-gap: 4px; padding-top: var(--space-2); padding-bottom: var(--space-2); }
  .task-row__id { display: none; }
  .task-row__title { flex-basis: calc(100% - 30px); }
  .task-row__meta { width: 100%; padding-left: 30px; }
}
.due { font-size: var(--text-xs); color: var(--color-text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.due.is-overdue { color: var(--color-danger-text); font-weight: var(--weight-semibold); }
.due.is-soon { color: var(--color-warning-text); font-weight: var(--weight-semibold); }

/* ---------- Table ---------- */
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table th {
  position: sticky; top: 0;
  height: 36px; padding: 0 var(--space-3);
  background: var(--color-surface-2);
  border-bottom: 1px solid var(--color-border);
  text-align: left; font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--color-text-3);
  white-space: nowrap;
}
.table td { height: 44px; padding: 0 var(--space-3); border-bottom: 1px solid var(--color-border-subtle); }
.table tbody tr:hover td { background: var(--color-surface-hover); }
.table .group-row td { height: 38px; background: var(--color-surface-2); font-weight: var(--weight-semibold); font-size: var(--text-xs); }

/* ---------- Kanban board ---------- */
.board {
  display: flex; gap: var(--space-3); align-items: flex-start;
  flex: 1; overflow-x: auto;
  padding: var(--space-4) var(--space-6) var(--space-6);
}
.board__column {
  display: flex; flex-direction: column;
  flex: 0 0 var(--board-column-width);
  max-height: calc(100vh - 180px);
  background: var(--color-surface-2);
  border-radius: var(--radius-lg);
}
.board__column-head { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-3) var(--space-3) var(--space-2); }
.board__column-count { font-size: var(--text-xs); color: var(--color-text-3); font-variant-numeric: tabular-nums; }
.board__list { display: flex; flex-direction: column; gap: var(--space-2); padding: 0 var(--space-2) var(--space-2); min-height: 48px; overflow-y: auto; }
.board__list.is-drop-target { background: var(--color-primary-soft); border-radius: var(--radius-md); outline: 1.5px dashed var(--color-primary); outline-offset: -2px; }
.board__add { margin: 0 var(--space-2) var(--space-2); justify-content: flex-start; color: var(--color-text-3); }

.task-card {
  display: flex; flex-direction: column; gap: var(--space-2);
  padding: var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  cursor: grab;
  transition: box-shadow var(--duration-fast), border-color var(--duration-fast);
}
.task-card:hover { border-color: var(--color-border); box-shadow: var(--shadow-sm); }
.task-card.is-dragging { opacity: .5; transform: rotate(1.5deg); cursor: grabbing; }
.task-card__top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.task-card__title { font-size: var(--text-sm); font-weight: var(--weight-medium); line-height: 1.4; }
.task-card__tags { display: flex; flex-wrap: wrap; gap: 4px; }
.task-card__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.task-card__meta { display: flex; align-items: center; gap: var(--space-3); font-size: var(--text-xs); color: var(--color-text-3); }
.task-card__meta span { display: inline-flex; align-items: center; gap: 3px; }

/* ---------- Activity feed ---------- */
.activity { display: flex; gap: var(--space-3); padding: var(--space-3) 0; font-size: var(--text-sm); }
.activity + .activity { border-top: 1px solid var(--color-border-subtle); }
.activity b { font-weight: var(--weight-semibold); }

/* ---------- Split counters (v0.3): "needs attention" + "done" in one row ---------- */
.counter-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: 6px 6px 6px var(--space-4); border-radius: var(--radius-full); background: var(--color-surface-2); font-size: var(--text-sm); }
.counter-row + .counter-row { margin-top: var(--space-2); }
.counter-group { display: inline-flex; gap: 6px; }
.counter { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 10px; border-radius: var(--radius-full); font-size: var(--text-xs); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }
.counter--alert { background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-xs); }
.counter--alert::before { content: "!"; color: var(--color-warning-text); font-weight: 800; }
.counter--ok { color: var(--color-text-2); border: 1px solid var(--color-border); }
.counter--ok::before { content: "✓"; color: var(--color-success-text); }

/* ---------- Avatar picker (v0.4): assign / share ---------- */
.avatar-picker { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.avatar-picker__item { display: grid; justify-items: center; gap: 5px; padding: 0; border: 0; background: none; font-size: var(--text-2xs); color: var(--color-text-2); cursor: pointer; }
.avatar-picker__face { position: relative; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--av, var(--color-brand)); color: #FFFFFF; font-size: 13px; font-weight: var(--weight-semibold); }
.avatar-picker__item--add .avatar-picker__face { background: var(--color-surface); color: var(--color-text); box-shadow: inset 0 0 0 1px var(--color-border); }
.avatar-picker__item[aria-pressed="true"] { color: var(--color-text); }
.avatar-picker__item[aria-pressed="true"] .avatar-picker__face::after { content: "✓"; position: absolute; right: -4px; top: -4px; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; background: var(--color-primary); color: var(--color-on-primary); font-size: 9px; box-shadow: 0 0 0 2px var(--color-surface); }

/* ---------- Action dock (v0.4): floating glass group of panel actions; first action is primary ---------- */
.action-dock { display: inline-flex; gap: 4px; padding: 4px; border-radius: var(--radius-full); background: color-mix(in srgb, var(--ink-950) 84%, transparent); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08), var(--shadow-lg); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.action-dock button { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border: 0; border-radius: var(--radius-full); background: transparent; color: #D5DADD; font-size: var(--text-xs); font-weight: var(--weight-semibold); white-space: nowrap; cursor: pointer; }
.action-dock button:hover { background: rgba(255, 255, 255, .1); color: #FFFFFF; }
.action-dock button:first-child { background: #FFFFFF; color: var(--ink-900); }

/* ---------- Bead scale (v0.4): 0–100 in steps of 10, grouped into zones; radiogroup ----------
   Markup: <div class="beads" data-beads data-value="80" data-zones="0-30:Poor|40-50:OK|60-100:Good" aria-label="…"></div>
   scripts/cadence.js renders the beads and handles click + arrow keys. */
.beads { position: relative; width: 100%; padding-top: 50px; }
.beads__zones { display: flex; gap: 4px; }
.beads__zone { flex: var(--n) 1 0; display: flex; gap: 3px; min-width: 0; padding: 4px; border-radius: var(--radius-full); background: var(--color-surface-2); }
.beads__zone:nth-child(1) { background: var(--color-danger-soft); }
.beads__zone:nth-child(3) { background: var(--color-success-soft); }
.beads__bead { flex: 1 1 0; min-width: 0; max-width: 40px; aspect-ratio: 1; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--color-surface) 70%, transparent); color: var(--color-text); font-size: var(--text-2xs); font-variant-numeric: tabular-nums; cursor: pointer; }
.beads__bead[aria-checked="true"] { background: var(--color-primary); color: var(--color-on-primary); font-weight: var(--weight-semibold); }
.beads__call { position: absolute; top: 0; left: 0; transform: translateX(-50%); display: grid; justify-items: center; padding: 5px 10px; border-radius: var(--radius-md); background: var(--color-primary); color: var(--color-on-primary); font-size: var(--text-2xs); line-height: 1.1; white-space: nowrap; transition: left var(--duration-base) var(--ease-standard); }
.beads__call b { font-size: 15px; font-weight: var(--weight-semibold); }
.beads__call::after { content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 5px solid transparent; border-top-color: var(--color-primary); border-bottom: 0; }
.beads__names { display: flex; gap: 4px; margin-top: 6px; font-size: var(--text-2xs); color: var(--color-text-2); }
.beads__names span { flex: var(--n) 1 0; text-align: center; }

/* ---------- Pill roadmap (v0.4): items as pills placed over phase columns ----------
   Place items with inline grid-row / grid-column; --c tints the icon. */
.roadmap { --phases: 5; display: grid; grid-template-columns: repeat(var(--phases), minmax(0, 1fr)); row-gap: var(--space-2); font-size: var(--text-2xs); color: var(--color-text-2); background: repeating-linear-gradient(90deg, var(--color-border) 0 1px, transparent 1px calc(100% / var(--phases))); }
.roadmap__phase { padding: 0 0 6px 6px; }
.roadmap__item { display: flex; align-items: center; gap: 6px; min-width: 0; height: 30px; margin-right: 6px; padding: 0 3px; border-radius: var(--radius-full); background: var(--color-surface); color: var(--color-text); box-shadow: inset 0 0 0 1px var(--color-border-subtle); font-size: var(--text-xs); white-space: nowrap; }
.roadmap__icon { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--c, var(--blue-100)); color: var(--ink-900); }
.roadmap__icon svg { width: 12px; height: 12px; }
.roadmap__label { overflow: hidden; text-overflow: ellipsis; }
.roadmap__count { flex: none; margin-left: auto; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; box-shadow: inset 0 0 0 1px var(--color-border); color: var(--color-text-2); font-size: var(--text-2xs); }

/* ---------- Peak bars (v0.4): rounded bars with an accent top edge; the maximum is hatched ---------- */
.peak-bars { display: flex; align-items: flex-end; gap: var(--space-2); height: 150px; }
.peak-bars__bar { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; height: 100%; text-align: center; font-size: var(--text-xs); font-variant-numeric: tabular-nums; color: var(--color-text); }
.peak-bars__fill { display: flex; align-items: flex-end; justify-content: center; height: var(--h); padding-bottom: 6px; border-radius: 10px 10px 6px 6px; background: var(--color-surface-2); border-top: 2px solid var(--color-accent); color: var(--color-text-2); font-size: var(--text-2xs); }
.peak-bars__bar.is-peak .peak-bars__fill { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--color-text) 16%, transparent) 0 2px, transparent 2px 6px); border-top-color: var(--color-text); color: var(--color-text); }

/* ---------- Empty state ---------- */
.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--space-3);
  padding: var(--space-12) var(--space-6);
  color: var(--color-text-2);
}
.empty__art {
  display: grid; place-items: center;
  width: 64px; height: 64px; border-radius: var(--radius-xl);
  background: var(--color-primary-soft); color: var(--color-primary);
}
.empty__art .icon { width: 28px; height: 28px; }
.empty h3 { font-size: var(--text-lg); }
.empty p { max-width: 360px; font-size: var(--text-sm); color: var(--color-text-3); }

/* ---------- Menu / Dropdown ---------- */
.menu {
  min-width: 200px; padding: var(--space-1);
  background: var(--color-surface);
  border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.menu__item {
  display: flex; align-items: center; gap: var(--space-2); width: 100%;
  height: 32px; padding: 0 var(--space-2);
  border: 0; border-radius: var(--radius-sm); background: none;
  font-size: var(--text-sm); text-align: left; color: var(--color-text);
}
.menu__item:hover, .menu__item.is-focused { background: var(--color-surface-hover); }
.menu__item .kbd { margin-left: auto; }
.menu__item--danger { color: var(--color-danger-text); }
.menu__sep { height: 1px; margin: var(--space-1) 0; background: var(--color-border-subtle); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: var(--z-modal);
  display: grid; place-items: start center; padding: 12vh var(--space-4) var(--space-4);
  background: var(--color-overlay);
  animation: fade-in var(--duration-base) var(--ease-standard);
}
.modal-backdrop[hidden] { display: none; }
.modal {
  width: min(560px, 100%);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  animation: pop-in var(--duration-slow) var(--ease-emphasis);
}
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: var(--space-4) var(--space-5); }
.modal__body { display: flex; flex-direction: column; gap: var(--space-4); padding: 0 var(--space-5) var(--space-5); }
.modal__foot { display: flex; justify-content: flex-end; align-items: center; gap: var(--space-2); padding: var(--space-3) var(--space-5); border-top: 1px solid var(--color-border-subtle); }

/* ---------- Toast ---------- */
.toast-region { position: fixed; bottom: var(--space-6); left: 50%; transform: translateX(-50%); z-index: var(--z-toast); display: flex; flex-direction: column; gap: var(--space-2); align-items: center; }
.toast {
  display: flex; align-items: center; gap: var(--space-3);
  padding: 10px 12px 10px 14px;
  background: var(--ink-900); color: #fff;
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  animation: toast-in var(--duration-slow) var(--ease-emphasis);
}
:root[data-theme="dark"] .toast { background: #2A3236; }
.toast .icon { color: var(--blue-300); }
.toast button { border: 0; background: none; color: var(--blue-300); font-weight: var(--weight-semibold); font-size: var(--text-sm); }

/* ---------- Tooltip (pure CSS, via data-tip attribute) ---------- */
[data-tip] { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  padding: 4px 8px; border-radius: var(--radius-sm);
  background: var(--ink-900); color: #fff;
  font-size: var(--text-2xs); font-weight: var(--weight-medium); white-space: nowrap;
  pointer-events: none; z-index: var(--z-dropdown);
}

/* ---------- Loading skeleton ---------- */
.skeleton { border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--color-surface-sunken) 25%, var(--color-surface-2) 50%, var(--color-surface-sunken) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }

@keyframes fade-in  { from { opacity: 0; } }
@keyframes pop-in   { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }
@keyframes shimmer  { to { background-position: -200% 0; } }
