/* ==========================================================================
   Components — reusable pieces used across pages. Each block is
   self-contained and themed entirely through tokens, so it works in light
   and dark without overrides.

   Contents
     Buttons · Form controls · Cards · Badges, counts, chips · Avatars
     Progress · Tabs · Segmented control · Dropdown menus · Dialogs
     Search palette · Toast · Alerts · Empty states · Tables · Skeleton
   ========================================================================== */

/* ---- Buttons ---------------------------------------------------------------
   <button class="btn btn--primary">            main action (one per view)
   <button class="btn btn--secondary">          everything else
   <button class="btn btn--ghost">              low-emphasis / toolbars
   <button class="btn btn--danger">             destructive confirmation
   Sizes: btn--sm, btn--lg.  Shape: btn--icon (square), btn--block (full width). */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  flex: none;
  min-height: var(--control-md);
  padding: 0 var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  user-select: none;
  transition: background var(--duration-fast) var(--ease),
              border-color var(--duration-fast) var(--ease),
              color var(--duration-fast) var(--ease),
              box-shadow var(--duration-fast) var(--ease);
}
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn:disabled,
.btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }

.btn--primary { background: var(--primary); color: var(--text-on-primary); }
.btn--primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn--primary:active:not(:disabled) { background: var(--primary-active); }

.btn--secondary {
  border-color: var(--border);
  background: var(--bg-surface);
  box-shadow: var(--shadow-xs);
}
.btn--secondary:hover:not(:disabled) { border-color: var(--border-strong); background: var(--bg-raised); }
.btn--secondary:active:not(:disabled) { background: var(--bg-hover); }

.btn--ghost { color: var(--text-secondary); }
.btn--ghost:hover:not(:disabled) { background: var(--bg-hover); color: var(--text); }
.btn--ghost:active:not(:disabled) { background: var(--bg-active); }

.btn--danger { background: var(--danger); color: var(--text-on-danger); }
.btn--danger:hover:not(:disabled) { background: var(--danger-hover); }
.btn--danger:focus-visible { box-shadow: var(--focus-ring-danger); }

.btn--danger-ghost:hover:not(:disabled) { background: var(--danger-soft); color: var(--danger-text); }

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

/* A request is in flight: show a spinner, block double submits. */
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading > * { visibility: hidden; }
.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 1rem;
  height: 1rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  color: var(--text-secondary);
  animation: spin 0.7s linear infinite;
}
.btn--primary.is-loading::after { color: var(--text-on-primary); }
.btn--danger.is-loading::after { color: var(--text-on-danger); }
@keyframes spin { to { transform: rotate(360deg); } }

/* Comfortable touch targets on phones and tablets. */
@media (pointer: coarse) {
  .btn { min-height: 2.75rem; }
  .btn--sm { min-height: 2.25rem; }
  .btn--icon { width: 2.75rem; }
  .btn--icon.btn--sm { width: 2.25rem; }
}

/* ---- Form controls ---------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 0.375rem; min-width: 0; }
.field__label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}
.field__required { color: var(--danger-text); }
.field__hint { color: var(--text-muted); font-size: var(--text-xs); line-height: var(--leading-snug); }

.input,
.select,
.textarea {
  width: 100%;
  min-width: 0;
  min-height: var(--control-md);
  padding: 0 var(--space-3);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-md);
  background-color: var(--bg-surface);
  color: var(--text);
  font-size: var(--text-base);
  line-height: var(--leading-snug);
  transition: border-color var(--duration-fast) var(--ease), box-shadow var(--duration-fast) var(--ease);
}
.input:hover,
.select:hover,
.textarea:hover { border-color: var(--border-strong); }
.input:focus,
.select:focus,
.textarea:focus,
.input:focus-visible,
.select:focus-visible,
.textarea:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}
.input:disabled,
.select:disabled,
.textarea:disabled { opacity: 0.6; background-color: var(--bg-sunken); }

.textarea {
  min-height: 5.5rem;
  padding-block: var(--space-2);
  line-height: var(--leading-normal);
  resize: vertical;
}

.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.25rem;
  background-image: var(--chevron);
  background-repeat: no-repeat;
  background-position: right 0.625rem center;
  background-size: 1rem;
  cursor: pointer;
  text-overflow: ellipsis;
}
/* Native option lists follow the theme. */
.select option,
.select optgroup { background: var(--bg-raised); color: var(--text); }

/* Date inputs: let the picker icon follow the theme. */
[data-theme="dark"] .input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.8); }

/* Phones zoom the page when a focused control is under 16px. Stop that. */
@media (pointer: coarse) {
  .input, .select, .textarea { min-height: 2.75rem; font-size: 1rem; }
}

/* An input with a leading icon. */
.input-group { position: relative; display: flex; align-items: center; min-width: 0; }
.input-group > .icon {
  position: absolute;
  left: var(--space-3);
  color: var(--text-muted);
  pointer-events: none;
}
.input-group > .input { padding-left: 2.25rem; }
.input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }

.checkbox {
  display: inline-flex;
  align-items: flex-start;
  gap: var(--space-2);
  cursor: pointer;
}
.checkbox input {
  flex: none;
  width: 1rem;
  height: 1rem;
  margin-top: 0.2rem;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Responsive field grids: as many equal columns as comfortably fit. */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  gap: var(--space-4);
}
.form-grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); }
.form-grid--4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr)); }

.form-section { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-5); }
.form-section__header { display: flex; flex-direction: column; gap: var(--space-1); }
@container page (min-width: 40rem) {
  .form-section { padding: var(--space-6); }
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}
.form-actions__hint { color: var(--text-muted); font-size: var(--text-sm); }
@container page (max-width: 34rem) {
  .form-actions > .btn { flex: 1 1 auto; }
  .form-actions__hint { flex-basis: 100%; }
}

/* ---- Cards ------------------------------------------------------------------- */
.card {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  box-shadow: var(--shadow-xs);
}
.card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
}
.card__title { font-size: var(--text-md); letter-spacing: -0.006em; }
.card__subtitle { margin-top: 2px; color: var(--text-muted); font-size: var(--text-sm); }
.card__meta { color: var(--text-muted); font-size: var(--text-xs); white-space: nowrap; }

/* ---- Badges ------------------------------------------------------------------
   A small status label.  <span class="badge badge--success">Done</span>
   Colour by meaning (badge--neutral|primary|accent|success|warning|danger|info)
   or by category (badge--tone with a tone-* class). */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  flex: none;
  max-width: 100%;
  height: 1.375rem;
  padding: 0 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg-sunken);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  line-height: 1;
  white-space: nowrap;
}
.badge--sm { height: 1.2rem; padding: 0 0.4rem; font-size: 0.6875rem; }
.badge--neutral { /* the default look */ }
.badge--primary { border-color: var(--primary-border); background: var(--primary-soft); color: var(--primary-text); }
.badge--accent  { border-color: var(--accent-border);  background: var(--accent-soft);  color: var(--accent-text); }
.badge--success { border-color: var(--success-border); background: var(--success-soft); color: var(--success-text); }
.badge--warning { border-color: var(--warning-border); background: var(--warning-soft); color: var(--warning-text); }
.badge--danger  { border-color: var(--danger-border);  background: var(--danger-soft);  color: var(--danger-text); }
.badge--info    { border-color: var(--info-border);    background: var(--info-soft);    color: var(--info-text); }
.badge--tone    { border-color: var(--tone-border);    background: var(--tone-bg);      color: var(--tone-fg); }

/* A number in a pill: tab counts, unread totals. */
.count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.375rem;
  border-radius: var(--radius-full);
  background: var(--bg-active);
  color: var(--text-secondary);
  font-size: 0.6875rem;
  font-weight: var(--weight-semibold);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.count--accent { background: var(--accent); color: var(--text-on-accent); }
.count--lg { min-width: 1.75rem; height: 1.75rem; padding: 0 0.5rem; font-size: var(--text-sm); }

/* A small pill that is itself a link. With a tone-* class it gains a
   coloured dot (the pill itself stays neutral, so a row of them is calm). */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  flex: none;
  height: 1.625rem;
  padding: 0 0.625rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  white-space: nowrap;
  transition: border-color var(--duration-fast) var(--ease), color var(--duration-fast) var(--ease),
              background var(--duration-fast) var(--ease);
}
.chip:hover { border-color: var(--border-strong); background: var(--bg-hover); color: var(--text); }
.chip[class*="tone-"]::before {
  content: "";
  flex: none;
  width: 0.4375rem;
  height: 0.4375rem;
  border-radius: 50%;
  background: var(--tone-solid);
}
.chip .icon { color: var(--text-muted); }
.chip__count {
  color: var(--text);
  font-weight: var(--weight-semibold);
  font-variant-numeric: tabular-nums;
}

/* ---- Avatars ------------------------------------------------------------------ */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--tone-solid, var(--slate-solid));
  color: var(--text-on-solid);
  font-size: 0.75rem;
  font-weight: var(--weight-semibold);
  line-height: 1;
  user-select: none;
}
.avatar--sm { width: 1.5rem; height: 1.5rem; font-size: 0.625rem; }
.avatar--lg { width: 2.5rem; height: 2.5rem; font-size: var(--text-md); }
.avatar-stack { display: inline-flex; padding-left: 0.375rem; }
.avatar-stack .avatar { margin-left: -0.375rem; box-shadow: 0 0 0 2px var(--bg-canvas); }

/* ---- Progress ----------------------------------------------------------------- */
.progress {
  width: 100%;
  height: 0.5rem;
  border-radius: var(--radius-full);
  background: var(--bg-active);
  overflow: hidden;
}
.progress--sm { height: 0.3125rem; }
.progress__bar {
  height: 100%;
  min-width: 0;
  border-radius: inherit;
  background: var(--primary);
  transition: width var(--duration-slow) var(--ease), background var(--duration) var(--ease);
}
.progress--tone .progress__bar { background: var(--tone-solid); }
.progress.is-done .progress__bar { background: var(--success); }

/* ---- Tabs -----------------------------------------------------------------------
   Underlined tabs. The strip scrolls sideways on narrow screens instead of
   wrapping or overflowing the page. */
.tabs {
  display: flex;
  gap: var(--space-1);
  min-width: 0;
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  flex: none;
  height: 2.5rem;
  padding: 0 var(--space-3);
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  white-space: nowrap;
  transition: color var(--duration-fast) var(--ease);
}
.tab::after {
  content: "";
  position: absolute;
  inset: auto var(--space-3) -1px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: transparent;
  transition: background var(--duration-fast) var(--ease);
}
.tab:hover { color: var(--text); }
.tab:hover::after { background: var(--border-strong); }
.tab.is-active { color: var(--text); font-weight: var(--weight-semibold); }
.tab.is-active::after { background: var(--primary); }
.tab.is-active .count { background: var(--primary-soft); color: var(--primary-text); }
.tab:focus-visible { outline-offset: -3px; border-radius: var(--radius-sm); }

/* ---- Segmented control ---------------------------------------------------------
   A compact set of mutually exclusive options (filters, view switch). */
.segmented {
  display: inline-flex;
  flex: none;
  max-width: 100%;
  padding: 2px;
  border-radius: var(--radius-md);
  background: var(--bg-active);
  overflow-x: auto;
  scrollbar-width: none;
}
.segmented::-webkit-scrollbar { display: none; }
.segmented__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  flex: none;
  min-height: calc(var(--control-md) - 4px);
  padding: 0 var(--space-3);
  border: 0;
  border-radius: calc(var(--radius-md) - 2px);
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  white-space: nowrap;
  transition: background var(--duration-fast) var(--ease), color var(--duration-fast) var(--ease);
}
.segmented__item:hover { color: var(--text); }
.segmented__item.is-active,
.segmented__item[aria-pressed="true"] {
  background: var(--bg-surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}
[data-theme="dark"] .segmented__item.is-active,
[data-theme="dark"] .segmented__item[aria-pressed="true"] { background: var(--bg-raised); box-shadow: 0 0 0 1px var(--border); }
.segmented--sm .segmented__item { min-height: calc(var(--control-sm) - 4px); padding: 0 0.625rem; font-size: var(--text-xs); }
@media (pointer: coarse) {
  .segmented__item,
  .segmented--sm .segmented__item { min-height: 2.25rem; }
}

/* ---- Dropdown menus --------------------------------------------------------------
   <div class="dropdown" data-dropdown>
     <button data-dropdown-trigger>…</button>
     <div class="menu dropdown__panel">…</div>
   </div>
   shell.js toggles `.is-open`. */
.dropdown { position: relative; display: inline-flex; }
.dropdown__panel {
  position: absolute;
  top: calc(100% + 0.375rem);
  right: 0;
  z-index: var(--z-dropdown);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px) scale(0.98);
  transform-origin: top right;
  transition: opacity var(--duration-fast) var(--ease), transform var(--duration-fast) var(--ease),
              visibility 0s var(--duration-fast);
}
.dropdown.is-open > .dropdown__panel {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity var(--duration-fast) var(--ease), transform var(--duration-fast) var(--ease), visibility 0s;
}

.menu {
  display: flex;
  flex-direction: column;
  min-width: 13rem;
  max-width: min(22rem, calc(100vw - 2rem));
  padding: var(--space-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-raised);
  box-shadow: var(--shadow-lg);
}
.menu form { display: contents; }
.menu__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: var(--control-md);
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-size: var(--text-sm);
  text-align: left;
  white-space: nowrap;
  transition: background var(--duration-fast) var(--ease);
}
.menu__item .icon { color: var(--text-muted); }
.menu__item:hover,
.menu__item:focus-visible { outline: none; background: var(--bg-hover); }
.menu__item--danger,
.menu__item--danger .icon { color: var(--danger-text); }
.menu__item--danger:hover,
.menu__item--danger:focus-visible { background: var(--danger-soft); }
.menu__separator { height: 1px; margin: var(--space-1) calc(var(--space-1) * -1); background: var(--border-subtle); }
@media (pointer: coarse) { .menu__item { min-height: 2.75rem; } }

.menu__identity {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  margin-bottom: var(--space-1);
  border-bottom: 1px solid var(--border-subtle);
}
.menu__identity-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.menu__identity-name { font-weight: var(--weight-semibold); }
.menu__identity-email {
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-muted);
  font-size: var(--text-xs);
}

/* A wider menu holding richer content (the notifications preview). */
.menu--panel { width: 22rem; padding: 0; overflow: hidden; }
.menu__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
}
.menu__title { font-weight: var(--weight-semibold); }
.menu__footer {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-subtle);
  color: var(--primary-text);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  text-align: center;
  transition: background var(--duration-fast) var(--ease);
}
.menu__footer:hover { background: var(--bg-hover); }
/* On phones the panel spans the screen instead of hanging off its button. */
@media (max-width: 479.98px) {
  .menu--panel {
    position: fixed;
    top: calc(var(--topbar-height) + 0.25rem);
    right: var(--space-3);
    left: var(--space-3);
    width: auto;
    max-width: none;
  }
}

.notice-list { max-height: min(24rem, 60vh); overflow-y: auto; }
.notice {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  transition: background var(--duration-fast) var(--ease);
}
.notice:hover,
.notice:focus-visible { outline: none; background: var(--bg-hover); }
.notice__dot {
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  margin-top: 0.4rem;
  border-radius: 50%;
  background: var(--accent);
}
.notice__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notice__title { font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.notice__text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
}
.notice__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-top: 2px;
  color: var(--text-muted);
  font-size: var(--text-xs);
}

/* ---- Dialogs ------------------------------------------------------------------------
   <div class="modal" id="…" aria-hidden="true">
     <div class="modal__backdrop" data-modal-close></div>
     <div class="modal__dialog">…</div>
   </div>
   shell.js toggles `.is-open`. On phones a dialog becomes a bottom sheet. */
.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}
.modal.is-open { display: flex; }
.modal--top { align-items: flex-start; padding-top: min(14vh, 8rem); }
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: var(--bg-backdrop);
  animation: fade-in var(--duration) var(--ease);
}
.modal__dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  width: 100%;
  max-width: 32rem;
  max-height: calc(100dvh - 2rem);
  padding: var(--space-6);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--bg-raised);
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
  animation: dialog-in var(--duration) var(--ease);
}
.modal__dialog--sm { max-width: 26rem; }
.modal__header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.modal__title { font-size: var(--text-lg); }
.modal__text { color: var(--text-secondary); }
.modal__hint { color: var(--text-muted); font-size: var(--text-xs); }
.modal__actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-2); }
@keyframes fade-in { from { opacity: 0; } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }

@media (max-width: 639.98px) {
  .modal { align-items: flex-end; padding: 0; }
  .modal--top { align-items: flex-start; padding: 0; }
  .modal__dialog {
    max-width: none;
    max-height: 92dvh;
    padding-bottom: max(var(--space-6), env(safe-area-inset-bottom));
    border-width: 1px 0 0;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    animation-name: sheet-in;
  }
  .modal__actions { flex-direction: column-reverse; }
  .modal__actions .btn { width: 100%; }
}
@keyframes sheet-in { from { transform: translateY(100%); } }

.shortcut-list { display: flex; flex-direction: column; }
.shortcut-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-2) 0;
  border-top: 1px solid var(--border-subtle);
}
.shortcut-list > div:first-child { border-top: 0; }
.shortcut-list dt { color: var(--text-secondary); }
.shortcut-list dd { display: flex; gap: var(--space-1); }

/* ---- Search palette --------------------------------------------------------------- */
.palette {
  gap: 0;
  max-width: 38rem;
  padding: 0;
  overflow: hidden;
}
.palette__search {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-muted);
}
.palette__input {
  flex: 1;
  min-width: 0;
  height: 3.25rem;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: var(--text-md);
}
.palette__input:focus { outline: none; }
.palette__results {
  min-height: 6rem;
  max-height: min(24rem, 50dvh);
  padding: var(--space-2);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.palette__group {
  padding: var(--space-2) var(--space-2) var(--space-1);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
}
.palette__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 2.5rem;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-md);
}
.palette__item.is-active { background: var(--bg-active); }
/* The name keeps its natural width (up to 70%); the hint gets what is left
   and truncates. */
.palette__item-main {
  flex: 0 1 auto;
  max-width: 70%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: var(--weight-medium);
}
.palette__item-hint {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: var(--text-sm);
  text-align: right;
}
.palette__item .icon { color: var(--text-muted); }
.palette__footer {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-2) var(--space-4);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-sunken);
  color: var(--text-muted);
  font-size: var(--text-xs);
}
.palette__footer span { display: inline-flex; align-items: center; gap: var(--space-1); }
@media (max-width: 639.98px) {
  /* Full-height sheet from the top, results fill the screen. */
  .modal--top .palette { max-height: 100dvh; height: 100dvh; border: 0; border-radius: 0; animation-name: fade-in; }
  .palette__results { flex: 1; max-height: none; }
  .palette__footer { display: none; }
  /* Two lines per result: name, then owner and address. */
  .palette__item { flex-direction: column; align-items: stretch; gap: 0; padding-block: var(--space-2); }
  .palette__item-main { max-width: none; }
  .palette__item-hint { flex: none; text-align: left; }
  .palette__item-hint:empty { display: none; }
}

/* ---- Toast ---------------------------------------------------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: max(var(--space-4), env(safe-area-inset-bottom));
  z-index: var(--z-toast);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  max-width: calc(100vw - 2rem);
  padding: var(--space-2) var(--space-4) var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg-raised);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, 0.75rem);
  transition: opacity var(--duration) var(--ease), transform var(--duration) var(--ease),
              visibility 0s var(--duration);
}
.toast.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  transition: opacity var(--duration) var(--ease), transform var(--duration) var(--ease), visibility 0s;
}
.toast__icon--ok { color: var(--success); }
.toast__icon--error { display: none; color: var(--danger); }
.toast.is-error .toast__icon--ok { display: none; }
.toast.is-error .toast__icon--error { display: block; }

.scroll-top {
  position: fixed;
  right: max(var(--space-4), env(safe-area-inset-right));
  bottom: max(var(--space-4), env(safe-area-inset-bottom));
  z-index: var(--z-sticky);
  border-radius: 50%;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(0.5rem);
  transition: opacity var(--duration) var(--ease), transform var(--duration) var(--ease),
              visibility 0s var(--duration);
}
.scroll-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity var(--duration) var(--ease), transform var(--duration) var(--ease), visibility 0s;
}

/* ---- Alerts ---------------------------------------------------------------------------- */
.alert {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--alert-border, var(--border));
  border-radius: var(--radius-lg);
  background: var(--alert-bg, var(--bg-surface));
  color: var(--text);
  font-size: var(--text-sm);
}
.alert__icon { flex: none; margin-top: 1px; color: var(--alert-fg, var(--text-muted)); }
.alert__body { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.alert__title { font-weight: var(--weight-semibold); }
.alert__detail { color: var(--text-secondary); font-size: var(--text-xs); overflow-wrap: anywhere; }
.alert--info    { --alert-bg: var(--info-soft);    --alert-border: var(--info-border);    --alert-fg: var(--info-text); }
.alert--success { --alert-bg: var(--success-soft); --alert-border: var(--success-border); --alert-fg: var(--success-text); }
.alert--warning { --alert-bg: var(--warning-soft); --alert-border: var(--warning-border); --alert-fg: var(--warning-text); }
.alert--danger  { --alert-bg: var(--danger-soft);  --alert-border: var(--danger-border);  --alert-fg: var(--danger-text); }

/* ---- Empty states ------------------------------------------------------------------------ */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-12) var(--space-6);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
}
.empty__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  margin-bottom: var(--space-1);
  border-radius: 50%;
  background: var(--bg-active);
  color: var(--text-muted);
}
.empty__eyebrow { color: var(--text-muted); font-size: var(--text-sm); }
.empty__title { font-size: var(--text-md); font-weight: var(--weight-semibold); }
h1.empty__title { font-size: var(--text-2xl); }
.empty__text { max-width: 28rem; color: var(--text-secondary); }
.empty__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); margin-top: var(--space-3); }
.empty--compact { padding: var(--space-8) var(--space-4); border: 0; }
.empty--page { padding-block: var(--space-16); border: 0; }

/* ---- Tables ------------------------------------------------------------------------------
   Wrap every table in .table-wrap so wide tables scroll inside their own box.
   .table--stack turns rows into labelled cards on phones (cells need
   data-label). */
.table-wrap {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  box-shadow: var(--shadow-xs);
  overflow-x: auto;
}
.table { width: 100%; font-size: var(--text-sm); }
.table th,
.table td { padding: var(--space-3) var(--space-4); text-align: left; vertical-align: middle; }
.table thead th {
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-sunken);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  white-space: nowrap;
}
.table tbody tr + tr > * { border-top: 1px solid var(--border-subtle); }
.table tbody th { font-weight: var(--weight-semibold); }
.table tbody tr:hover > * { background: var(--bg-hover); }
.table .table__num { text-align: right; }

@container page (max-width: 40rem) {
  .table--stack thead { display: none; }
  .table--stack,
  .table--stack tbody,
  .table--stack tr { display: block; }
  .table--stack tr { padding: var(--space-3) var(--space-4); }
  .table--stack tr + tr { border-top: 1px solid var(--border-subtle); }
  .table--stack tbody tr + tr > * { border-top: 0; }
  .table--stack tbody tr:hover > * { background: transparent; }
  .table--stack th,
  .table--stack td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-4);
    padding: 0.2rem 0;
    text-align: right;
  }
  .table--stack tbody th { margin-bottom: var(--space-1); font-size: var(--text-base); text-align: left; }
  .table--stack td::before {
    content: attr(data-label);
    flex: none;
    color: var(--text-muted);
    font-size: var(--text-xs);
    text-align: left;
  }
}

/* ---- Skeleton ------------------------------------------------------------------------------ */
.skeleton {
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--bg-active) 25%, var(--bg-hover) 50%, var(--bg-active) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---- Collapsible card (<details>) ---------------------------------------------------------- */
.collapsible__summary {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.collapsible__summary::-webkit-details-marker { display: none; }
.collapsible__summary:focus-visible { outline-offset: -2px; border-radius: var(--radius-lg); }
.collapsible__title { flex: none; font-size: var(--text-md); font-weight: var(--weight-semibold); }
.collapsible__meta {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: var(--text-sm);
}
.collapsible__caret { flex: none; color: var(--text-muted); transition: transform var(--duration) var(--ease); }
.collapsible[open] > .collapsible__summary .collapsible__caret { transform: rotate(180deg); }
.collapsible__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: 0 var(--space-5) var(--space-5);
}
.collapsible__subheading {
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
}
.save-state { color: var(--text-muted); font-size: var(--text-xs); font-weight: var(--weight-regular); }
.save-state.is-error { color: var(--danger-text); }

/* ---------------------------------------------------------------------------
   QoL: copy-to-clipboard buttons, live-date countdown, next-open-task button
   --------------------------------------------------------------------------- */

/* An input with an inline copy button (see core.js [data-copy-target]). */
.input-copy { position: relative; display: block; }
.input-copy .input { padding-right: 2.3rem; }
.copy-btn {
  position: absolute;
  top: 50%;
  right: 0.3rem;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 120ms ease, background 120ms ease;
}
.copy-btn:hover { color: var(--text); background: var(--bg-hover); }
.copy-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.copy-btn.is-copied { color: var(--success); }

/* Live-date countdown badge. JS (core.js formatCountdowns) fills the text and
   sets data-tone; it stays hidden until then so no date math flashes on load. */
.countdown {
  display: inline-flex;
  align-items: center;
  flex: none;
  height: 1.375rem;
  padding: 0 0.5rem;
  border: 1px solid var(--info-border);
  border-radius: var(--radius-full);
  background: var(--info-soft);
  color: var(--info-text);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  line-height: 1;
  white-space: nowrap;
}
.countdown[data-tone="soon"] { border-color: var(--warning-border); background: var(--warning-soft); color: var(--warning-text); }
.countdown[data-tone="due"]  { border-color: var(--accent-border);  background: var(--accent-soft);  color: var(--accent-text); }
.countdown[data-tone="over"] { border-color: var(--danger-border);  background: var(--danger-soft);  color: var(--danger-text); }
.countdown--card { align-self: flex-start; }

/* "Next open task" button sits to the right of the task filter. */
.property-nav__next { margin-left: auto; }
@media (max-width: 767.98px) {
  .property-nav__next { margin-left: 0; }
  .property-nav__next span { display: none; }   /* icon-only on phones to save the row */
}

/* Toast action button (e.g. "Undo"). The toast itself is click-through
   (pointer-events: none), so the button must re-enable pointer events. */
.toast__action {
  pointer-events: auto;
  padding: 0.15rem 0.55rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: var(--weight-medium);
  cursor: pointer;
  white-space: nowrap;
}
.toast__action:hover { background: var(--bg-hover); }
.toast__action:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

/* Quick task search bar on the property page. */
.task-search { position: relative; margin: 0 0 var(--space-4); }
.task-search__icon {
  position: absolute;
  top: 50%;
  left: 0.6rem;
  transform: translateY(-50%);
  display: inline-flex;
  color: var(--text-muted);
  pointer-events: none;
}
.task-search__input { padding-left: 2rem; }

/* ---------------------------------------------------------------------------
   QoL: inline owner reassignment, bulk-select actions, cross-property My tasks
   --------------------------------------------------------------------------- */

/* Inline owner picker on a task row — looks like the old owner badge but is a
   <select> that reassigns the task on this property only. Coloured by the
   current owner's tone (tone-* sets the --tone-* variables). */
.owner-form { display: inline-flex; }
.owner-select {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  max-width: 7rem;
  height: 1.5rem;
  padding: 0 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg-raised);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  line-height: 1;
  cursor: pointer;
  text-overflow: ellipsis;
  transition: border-color var(--duration-fast) var(--ease), background var(--duration-fast) var(--ease);
}
.owner-select[class*="tone-"] {
  border-color: var(--tone-border);
  background: var(--tone-bg);
  color: var(--tone-fg);
}
.owner-select:hover { border-color: var(--border-strong); }
.owner-select:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
/* A reassignment away from the template owner is marked with a leading dot. */
.owner-select.is-reassigned { font-style: italic; }

/* Bulk select: a checkbox takes the drag handle's place in "Select" mode, so
   the row's grid column count never changes (the drag heuristic relies on it). */
.task-row__select { display: none; align-items: center; justify-content: center; width: 1.25rem; height: 1.75rem; }
.is-selecting .task-row__select { display: inline-flex; }
.is-selecting .task-row__handle { display: none; }
.task-select { width: 1.05rem; height: 1.05rem; cursor: pointer; accent-color: var(--primary); }

.property-nav__bulk span { margin-left: 0.15rem; }
.property-nav__bulk[aria-pressed="true"] { background: var(--tone-bg, var(--bg-hover)); color: var(--primary-text); }
@media (max-width: 767.98px) { .property-nav__bulk span { display: none; } }

/* The floating bulk action bar (property.html overlays block). */
.bulk-bar {
  position: fixed;
  left: 50%;
  bottom: var(--space-5);
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  max-width: calc(100vw - 2rem);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg-raised);
  box-shadow: var(--shadow-lg);
}
.bulk-bar[hidden] { display: none; }
.bulk-bar__count { font-size: var(--text-sm); color: var(--text-secondary); white-space: nowrap; }
.bulk-bar__count strong { color: var(--text); }
.bulk-bar__apply { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--space-2); }
.bulk-bar__apply > * { flex: none; }
.bulk-bar__apply .select { width: auto; }
.bulk-bar__apply .input[type="date"] { width: 9.5rem; }
.select--sm { height: 2rem; min-height: 2rem; padding-top: 0; padding-bottom: 0; font-size: var(--text-sm); }
/* Three pickers + Apply don't fit a single pill on tablets and phones: let
   the bar span the screen and wrap onto two rows. */
@media (max-width: 1100px) {
  .bulk-bar {
    left: var(--space-3);
    right: var(--space-3);
    transform: none;
    max-width: none;
    flex-wrap: wrap;
    justify-content: center;
    row-gap: var(--space-2);
    border-radius: var(--radius-lg);
  }
  /* Count · Select all · ✕ on the first row, the pickers on the second. */
  .bulk-bar__apply { order: 1; flex-basis: 100%; }
}

/* Cross-property "My tasks" page. */
.mytasks { display: grid; gap: var(--space-4); }
.mytask-group__meta { display: flex; align-items: center; gap: var(--space-2); }

/* My tasks quick filters: a wrapping row of chips with counts. */
.task-filters { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: calc(-1 * var(--space-1)) 0 var(--space-4); }
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--control-sm);
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  text-decoration: none;
  transition: border-color var(--duration-fast) var(--ease), background var(--duration-fast) var(--ease);
}
.filter-chip:hover { border-color: var(--border-strong); color: var(--text); }
.filter-chip.is-active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-text); font-weight: var(--weight-semibold); }
.filter-chip.is-empty { opacity: 0.6; }
.filter-chip__count { font-size: var(--text-xs); font-variant-numeric: tabular-nums; color: var(--text-muted); }
.filter-chip.is-active .filter-chip__count { color: inherit; }
@media (pointer: coarse) { .filter-chip { min-height: 2.25rem; } }

/* A task row in a cross-property list (My tasks, Due dates) with quick
   controls: partials/work_task.html. Link on the left, controls on the right;
   the controls drop onto their own line when the list is narrow. */
.work-area { container: work / inline-size; }
.work-hint { margin: calc(-1 * var(--space-2)) 0 var(--space-4); color: var(--text-muted); font-size: var(--text-sm); }
.work-list { display: grid; gap: var(--space-1); padding: 0 var(--space-4) var(--space-4); }
.work-task {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  transition: border-color var(--duration-fast) var(--ease), background var(--duration-fast) var(--ease);
}
.work-task:hover { border-color: var(--border); background: var(--bg-hover); }
.work-task.is-overdue { box-shadow: inset 2px 0 0 var(--danger); }
.work-task__link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1 1 18rem;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
.work-task__link:hover .work-task__label { text-decoration: underline; text-underline-offset: 2px; }
.work-task__link .due-task__when { flex: none; width: 4.5rem; }
.work-task__phase { flex: none; }
.work-task__main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.work-task__label { overflow-wrap: anywhere; }
.work-task__label .task-chip { margin-left: var(--space-1); vertical-align: middle; }
.work-task__sub { color: var(--text-muted); font-size: var(--text-xs); overflow-wrap: anywhere; }
.work-task__controls { display: flex; flex: none; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-left: auto; }
.work-task__due.input { width: 9.25rem; min-height: var(--control-sm); height: var(--control-sm); font-size: var(--text-xs); }
.work-task.htmx-request { opacity: 0.7; }
@container work (max-width: 640px) {
  .work-task__controls { width: 100%; margin-left: 0; }
  .work-task__status, .work-task__owner { flex: 1 1 7rem; }
  .work-task__due.input { flex: 1 1 8rem; width: auto; }
  .work-task__link .due-task__when { width: 3.75rem; }
}

/* Small helpers used by the details panel and the history / due pages. */
.btn--xs { min-height: 1.5rem; padding: 0 var(--space-2); font-size: var(--text-xs); gap: 0.25rem; }
.btn--icon.btn--xs { width: 1.5rem; padding: 0; }
.input--sm { height: var(--control-sm); min-height: var(--control-sm); padding-top: 0; padding-bottom: 0; font-size: var(--text-sm); }
.count--danger { background: var(--danger); color: var(--text-on-accent); }
.text-danger { color: var(--danger-text); }
.text-warning { color: var(--warning-text); }

/* ---- Property history page ---- */
.history-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3); margin-bottom: var(--space-4); }
.history-filters__field { display: flex; flex-direction: column; gap: var(--space-1); }
.history { display: grid; gap: var(--space-4); }
.history-day { padding: var(--space-4) var(--space-5); }
.history-day__title { margin-bottom: var(--space-3); color: var(--text-secondary); font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.history-list { display: flex; flex-direction: column; }
.history-event {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-top: 1px solid var(--border-subtle);
}
.history-event:first-child { border-top: 0; padding-top: 0; }
.history-event__dot { width: 0.5rem; height: 0.5rem; margin-top: 0.55rem; border-radius: 50%; background: var(--primary); }
.history-event__dot.timeline__item--mention { background: var(--warning); }
.history-event__dot.timeline__item--field   { background: var(--info); }
.history-event__dot.timeline__item--email   { background: var(--success); }
.history-event__dot.timeline__item--due     { background: var(--accent); }
.history-event__dot.timeline__item--danger  { background: var(--danger); }
.history-event__text { font-size: var(--text-sm); line-height: var(--leading-snug); overflow-wrap: anywhere; }
.history-event__meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-top: 2px; color: var(--text-muted); font-size: var(--text-xs); }
.history-event.is-reverted .history-event__text { color: var(--text-muted); text-decoration: line-through; text-decoration-color: var(--border-strong); }
.history-event__undo { display: inline-flex; }
.history-pager { display: flex; align-items: center; justify-content: center; gap: var(--space-3); margin-top: var(--space-5); }
.history-pager__page { color: var(--text-muted); font-size: var(--text-sm); }
@media (max-width: 560px) {
  .history-day { padding: var(--space-3) var(--space-4); }
  .history-event { grid-template-columns: auto minmax(0, 1fr) auto; }
  .history-event__dot { display: none; }
  .history-event__undo span { display: none; }
}

/* ---- Due dates page ---- */
.due-filter { margin-bottom: var(--space-4); max-width: 100%; }
.due-sections { display: grid; gap: var(--space-4); }
.due-task__when { font-size: var(--text-xs); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; color: var(--text-secondary); }
.due-task__when.is-overdue { color: var(--danger-text); }
.due-task__when.is-today, .due-task__when.is-soon { color: var(--warning-text); }

/* ---- Team workload page ---- */
.workload { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); gap: var(--space-4); }
.workload-card { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4) var(--space-5); }
.workload-card.is-me { border-color: var(--primary-border); }
.workload-card__head { display: flex; align-items: center; gap: var(--space-3); }
.workload-card__who { flex: 1; min-width: 0; }
.workload-card__name { font-size: var(--text-md); }
.workload-card__sub { color: var(--text-muted); font-size: var(--text-xs); }
.workload-card__total { font-size: var(--text-2xl); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; line-height: 1; }
.workload-bar { height: 0.625rem; border-radius: var(--radius-full); background: var(--bg-sunken); overflow: hidden; }
.workload-bar__fill { display: flex; height: 100%; min-width: 0; }
.workload-bar__seg { display: block; height: 100%; flex-basis: 0; }
.workload-bar__seg.is-stuck, .workload-legend .is-stuck { background: var(--danger); }
.workload-bar__seg.is-inprogress, .workload-legend .is-inprogress { background: var(--warning); }
.workload-bar__seg.is-todo, .workload-legend .is-todo { background: var(--primary); }
.workload-legend { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); margin-top: calc(-1 * var(--space-2)); color: var(--text-muted); font-size: var(--text-xs); }
.workload-legend span { display: inline-flex; align-items: center; gap: 0.3rem; }
.workload-legend i { width: 0.5rem; height: 0.5rem; border-radius: 2px; }
.workload-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); }
.workload-stat { display: flex; flex-direction: column; padding: var(--space-2); border-radius: var(--radius-md); background: var(--bg-sunken); }
.workload-stat__value { font-size: var(--text-lg); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }
.workload-stat__label { color: var(--text-muted); font-size: var(--text-xs); }
.workload-top__title { margin-bottom: var(--space-1); color: var(--text-secondary); font-size: var(--text-xs); font-weight: var(--weight-semibold); }
.workload-top__list { display: grid; gap: var(--space-1); font-size: var(--text-sm); }
.workload-top__list li { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); min-width: 0; }
.workload-card__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: auto; }
.workload-card__note { margin-top: auto; color: var(--text-muted); font-size: var(--text-xs); }

