/* ==========================================================================
   VERA by SBS — components.css
   Reusable components. Screens compose these classes; they never restyle them.
   ========================================================================== */

/* ===== Brand ============================================================== */
.brand-logo { display: block; height: 26px; width: auto; max-width: 100%; flex-shrink: 0; }
.brand-logo--lg { height: 48px; }
.brand-logo--xl { height: 60px; }
.brand-logo--mark { display: none; height: 25px; }
.brand-home { display: flex; align-items: center; gap: var(--space-2); min-width: 0; color: inherit; }
.brand-home:hover { text-decoration: none; }
.sbs-badge { display: inline-flex; vertical-align: middle; margin-right: var(--space-2); padding: 3px 6px; background: #fff; border-radius: var(--radius-sm); }
.sbs-badge img { height: 18px; width: auto; }
.brand-product { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand-product__name { font-size: var(--text-lg); font-weight: var(--weight-bold); color: var(--color-heading); letter-spacing: -0.02em; }
.brand-product__by { font-size: var(--text-xs); color: var(--color-text-muted); font-weight: var(--weight-medium); }
.brand-lockup { display: flex; align-items: center; gap: var(--space-3); }
.brand-plate { display: inline-flex; align-self: flex-start; padding: var(--space-3) var(--space-4); background: #fff; border-radius: var(--radius-lg); }

/* ===== Icons ============================================================= */
.icon { width: var(--icon-size); height: var(--icon-size); flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon--sm { width: var(--icon-size-sm); height: var(--icon-size-sm); }
.icon--lg { width: 24px; height: 24px; }

/* ===== Buttons ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: var(--control-h);
  padding: 0 var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
  user-select: none;
}
.btn:hover { text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; pointer-events: none; }
.btn--primary { background: var(--color-primary); color: #fff; box-shadow: var(--shadow-xs); }
.btn--primary:hover { background: var(--color-primary-hover); color: #fff; }
.btn--primary:active { background: var(--color-primary-active); }
.btn--secondary { background: var(--color-surface); color: var(--color-text); border-color: var(--color-border-strong); box-shadow: var(--shadow-xs); }
.btn--secondary:hover { background: var(--gray-50); border-color: var(--gray-300); color: var(--color-text); }
.btn--ghost { color: var(--color-text-secondary); }
.btn--ghost:hover { background: var(--gray-100); color: var(--color-text); }
.btn--danger { background: var(--color-danger); color: #fff; }
.btn--danger:hover { background: var(--red-700); color: #fff; }
.btn--danger-ghost { color: var(--color-danger); }
.btn--danger-ghost:hover { background: var(--red-50); color: var(--red-700); }
.btn--sm { height: var(--control-h-sm); padding: 0 var(--space-3); font-size: var(--text-sm); gap: var(--space-1); }
.btn--lg { height: var(--control-h-lg); padding: 0 var(--space-5); }
.btn--block { width: 100%; }
.btn--icon { width: var(--control-h); padding: 0; }
.btn--icon.btn--sm { width: var(--control-h-sm); }
.btn.is-loading { position: relative; color: transparent; pointer-events: none; }
.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 16px; height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn--secondary.is-loading::after, .btn--ghost.is-loading::after { border-color: var(--gray-300); border-top-color: var(--color-primary); }
.btn-group { display: inline-flex; }
.btn-group > .btn:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; }
.btn-group > .btn:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }

/* Segmented control (view switchers, zoom) */
.segmented { display: inline-flex; padding: 3px; background: var(--gray-100); border-radius: var(--radius-md); gap: 2px; }
.segmented__item {
  height: calc(var(--control-h) - 6px);
  padding: 0 var(--space-3);
  border-radius: calc(var(--radius-md) - 2px);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.segmented__item:hover { color: var(--color-text); }
.segmented__item[aria-pressed="true"], .segmented__item[aria-selected="true"] { background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-xs); }

/* ===== Form controls ====================================================== */
.input, .select, .textarea {
  display: block;
  width: 100%;
  height: var(--control-h);
  padding: 0 var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  color: var(--color-text);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--gray-300); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--color-focus); box-shadow: var(--shadow-focus); outline: none; }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--gray-50); color: var(--color-text-muted); cursor: not-allowed; }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--color-danger); }
.input--sm, .select--sm { height: var(--control-h-sm); font-size: var(--text-sm); padding: 0 var(--space-2); }
.select {
  appearance: none;
  padding-right: var(--space-8);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236b7686' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.textarea { height: auto; min-height: 96px; padding: var(--space-2) var(--space-3); line-height: var(--leading-normal); }
.input--title { height: auto; padding: var(--space-2); border-color: transparent; font-size: var(--text-lg); font-weight: var(--weight-semibold); color: var(--color-heading); }
.input--title:hover { border-color: var(--color-border); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field__label { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--gray-700); }
.field__label .req { color: var(--color-danger); margin-left: 2px; }
.field__hint { font-size: var(--text-xs); color: var(--color-text-muted); }
.field__error { font-size: var(--text-xs); color: var(--color-danger); font-weight: var(--weight-medium); }
.field--inline { flex-direction: row; align-items: center; gap: var(--space-2); }
.form { display: flex; flex-direction: column; gap: var(--space-4); }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.form-row--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-actions { display: flex; justify-content: flex-end; gap: var(--space-2); flex-wrap: wrap; }
.form-error { padding: var(--space-3); background: var(--red-50); border: 1px solid var(--red-100); border-radius: var(--radius-md); color: var(--red-700); font-size: var(--text-sm); }
.check { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--text-base); cursor: pointer; }
details.advanced > summary { cursor: pointer; font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--color-primary); list-style: none; }
details.advanced > summary::-webkit-details-marker { display: none; }
details.advanced[open] > summary { margin-bottom: var(--space-3); }

/* ===== Search ============================================================== */
.search { position: relative; display: flex; align-items: center; }
.search .icon { position: absolute; left: 10px; color: var(--gray-400); pointer-events: none; }
.search .input { padding-left: 34px; background: var(--gray-50); }
.search .input:focus { background: var(--color-surface); }

/* ===== Cards =============================================================== */
.card {
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  min-width: 0;
}
.card__header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-4) var(--space-5) 0; }
.card__title { font-size: var(--text-md); font-weight: var(--weight-semibold); color: var(--color-heading); }
.card__subtitle { font-size: var(--text-sm); color: var(--color-text-muted); }
.card__body { padding: var(--space-4) var(--space-5) var(--space-5); display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; }
.card__body--flush { padding: var(--space-3) 0 0; }
.card__footer { padding: var(--space-3) var(--space-5); border-top: 1px solid var(--color-border); display: flex; justify-content: flex-end; gap: var(--space-2); }
.card--interactive { transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease); cursor: pointer; }
.card--interactive:hover { border-color: var(--gray-300); box-shadow: var(--shadow-sm); }

/* Stat */
.stat { padding: var(--space-4) var(--space-5); gap: var(--space-1); }
.stat__label { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--color-text-secondary); font-weight: var(--weight-medium); }
.stat__value { font-size: var(--text-2xl); font-weight: var(--weight-semibold); color: var(--color-heading); letter-spacing: -0.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat__meta { font-size: var(--text-xs); color: var(--color-text-muted); }
.stat__icon { display: inline-flex; padding: 6px; border-radius: var(--radius-md); background: var(--primary-50); color: var(--color-primary); }
.stat__icon--danger { background: var(--red-50); color: var(--color-danger); }
.stat__icon--warning { background: var(--amber-50); color: var(--color-warning); }
.stat__icon--success { background: var(--green-50); color: var(--color-success); }
.stat__icon--violet { background: var(--violet-50); color: var(--violet-500); }

/* ===== Tables ============================================================== */
.table-wrap { position: relative; width: 100%; overflow-x: auto; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); }
.table { width: 100%; font-size: var(--text-sm); }
.table th {
  position: sticky;
  top: 0;
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface-muted);
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.table td { padding: var(--space-3); border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr.is-clickable { cursor: pointer; }
.table tbody tr.is-clickable:hover td { background: var(--gray-25); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .nowrap { white-space: nowrap; }
.table-sort { display: inline-flex; align-items: center; gap: 4px; color: inherit; font: inherit; text-transform: inherit; letter-spacing: inherit; }
.table-sort[aria-sort="ascending"]::after { content: "▲"; font-size: 8px; }
.table-sort[aria-sort="descending"]::after { content: "▼"; font-size: 8px; }
.cell-title { font-weight: var(--weight-medium); color: var(--color-text); }
.cell-sub { font-size: var(--text-xs); color: var(--color-text-muted); }

/* ===== Badges, status, priority, labels ===================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  white-space: nowrap;
  background: var(--gray-100);
  color: var(--gray-700);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.85; }
.badge--plain::before { display: none; }
.badge--neutral { background: var(--gray-100); color: var(--gray-600); }
.badge--info { background: var(--primary-50); color: var(--primary-600); }
.badge--success { background: var(--green-50); color: var(--green-700); }
.badge--warning { background: var(--amber-50); color: var(--amber-700); }
.badge--danger { background: var(--red-50); color: var(--red-700); }
.badge--violet { background: var(--violet-50); color: var(--violet-700); }
.badge--teal { background: var(--teal-50); color: var(--teal-600); }
.badge--outline { background: transparent; border: 1px solid var(--color-border-strong); }

/* Task status */
.status[data-status="todo"] { background: var(--gray-100); color: var(--gray-600); }
.status[data-status="in_progress"] { background: var(--primary-50); color: var(--primary-600); }
.status[data-status="blocked"] { background: var(--red-50); color: var(--red-700); }
.status[data-status="in_review"] { background: var(--violet-50); color: var(--violet-700); }
.status[data-status="done"] { background: var(--green-50); color: var(--green-700); }
/* Project status */
.status[data-status="planned"] { background: var(--gray-100); color: var(--gray-600); }
.status[data-status="active"] { background: var(--primary-50); color: var(--primary-600); }
.status[data-status="on_hold"] { background: var(--amber-50); color: var(--amber-700); }
.status[data-status="completed"] { background: var(--green-50); color: var(--green-700); }
.status[data-status="cancelled"] { background: var(--gray-100); color: var(--gray-500); text-decoration: line-through; }
/* Milestone / risk / sprint / release states */
.status[data-status="open"] { background: var(--primary-50); color: var(--primary-600); }
.status[data-status="mitigating"], .status[data-status="proposed"], .status[data-status="in_progress_release"] { background: var(--amber-50); color: var(--amber-700); }
.status[data-status="resolved"], .status[data-status="approved"], .status[data-status="implemented"], .status[data-status="released"] { background: var(--green-50); color: var(--green-700); }
.status[data-status="closed"], .status[data-status="rejected"] { background: var(--gray-100); color: var(--gray-500); }
.status[data-status="overdue"] { background: var(--red-50); color: var(--red-700); }
.status[data-status="pending"] { background: var(--amber-50); color: var(--amber-700); }

.priority { display: inline-flex; align-items: center; gap: 5px; font-size: var(--text-sm); color: var(--color-text-secondary); white-space: nowrap; }
.priority__bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.priority__bars span { width: 3px; border-radius: 1px; background: var(--gray-200); }
.priority__bars span:nth-child(1) { height: 5px; }
.priority__bars span:nth-child(2) { height: 8px; }
.priority__bars span:nth-child(3) { height: 12px; }
.priority[data-priority="low"] .priority__bars span:nth-child(-n+1) { background: var(--gray-400); }
.priority[data-priority="medium"] .priority__bars span:nth-child(-n+2) { background: var(--primary-500); }
.priority[data-priority="high"] .priority__bars span:nth-child(-n+3) { background: var(--amber-600); }
.priority[data-priority="urgent"] .priority__bars span { background: var(--red-600); }
.priority[data-priority="urgent"] { color: var(--red-700); font-weight: var(--weight-medium); }

.severity { font-size: var(--text-xs); font-weight: var(--weight-semibold); text-transform: uppercase; letter-spacing: 0.04em; }
.severity[data-severity="minor"], .severity[data-severity="low"] { color: var(--gray-500); }
.severity[data-severity="major"], .severity[data-severity="medium"] { color: var(--amber-700); }
.severity[data-severity="critical"], .severity[data-severity="high"] { color: var(--red-600); }
.severity[data-severity="blocker"] { color: var(--red-700); }

.label { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: var(--radius-sm); font-size: var(--text-xs); font-weight: var(--weight-medium); background: var(--gray-100); color: var(--gray-700); }
.label[data-color="blue"] { background: var(--primary-50); color: var(--primary-600); }
.label[data-color="violet"] { background: var(--violet-50); color: var(--violet-700); }
.label[data-color="green"] { background: var(--green-50); color: var(--green-700); }
.label[data-color="amber"] { background: var(--amber-50); color: var(--amber-700); }
.label[data-color="red"] { background: var(--red-50); color: var(--red-700); }
.label[data-color="teal"] { background: var(--teal-50); color: var(--teal-600); }
.label[data-color="pink"] { background: var(--pink-50); color: var(--pink-600); }

.type-chip { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--color-text-secondary); text-transform: uppercase; letter-spacing: 0.04em; }
.type-chip[data-type="epic"] { color: var(--violet-500); }
.type-chip[data-type="feature"] { color: var(--teal-600); }
.type-chip[data-type="story"] { color: var(--green-600); }
.type-chip[data-type="bug"] { color: var(--red-600); }
.task-key { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-text-muted); white-space: nowrap; }
.due { font-size: var(--text-sm); color: var(--color-text-secondary); white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.due.is-overdue { color: var(--red-700); font-weight: var(--weight-medium); }
.due.is-soon { color: var(--amber-700); }
.meta { font-size: var(--text-xs); color: var(--color-text-muted); }
.muted { color: var(--color-text-muted); }
.text-secondary { color: var(--color-text-secondary); }
.text-danger { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ===== Navigation items ===================================================== */
.nav__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: 36px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  font-weight: var(--weight-medium);
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.nav__item:hover { background: var(--gray-50); color: var(--color-text); text-decoration: none; }
.nav__item[aria-current="page"] { background: var(--primary-50); color: var(--primary-700); }
.nav__item[aria-current="page"] .icon { color: var(--color-primary); }
.nav__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav__badge { min-width: 20px; height: 18px; padding: 0 6px; border-radius: var(--radius-pill); background: var(--color-primary); color: #fff; font-size: 11px; font-weight: var(--weight-semibold); display: inline-flex; align-items: center; justify-content: center; }

.org-switcher {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  text-align: left;
  transition: background-color var(--dur-fast) var(--ease);
}
.org-switcher:hover { background: var(--gray-50); }
.org-switcher__mark { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: var(--radius-sm); background: var(--brand-navy); color: #fff; font-size: var(--text-xs); font-weight: var(--weight-bold); flex-shrink: 0; }
.org-switcher__text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.org-switcher__name { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--color-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-switcher__role { font-size: var(--text-xs); color: var(--color-text-muted); }

.icon-btn-badge { position: relative; }
.icon-btn-badge__count { position: absolute; top: 3px; right: 3px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: var(--radius-pill); background: var(--color-danger); color: #fff; font-size: 10px; font-weight: var(--weight-bold); display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--color-surface); box-sizing: content-box; }

.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: var(--text-sm); color: var(--color-text-muted); flex-wrap: wrap; }
.breadcrumb a { color: var(--color-text-secondary); }

/* ===== Tabs ================================================================= */
.tabs { position: relative; display: flex; gap: var(--space-1); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 40px;
  padding: 0 var(--space-3);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.tab:hover { color: var(--color-text); text-decoration: none; }
.tab[aria-current="page"], .tab[aria-selected="true"] { color: var(--primary-700); border-bottom-color: var(--color-primary); }
.tabs--boxed { gap: var(--space-2); border-bottom: 1px solid var(--color-border); }

/* ===== Dropdown menus ======================================================== */
.menu-anchor { position: relative; display: inline-flex; }
.menu {
  position: absolute;
  z-index: var(--z-dropdown);
  min-width: 200px;
  max-height: 360px;
  overflow-y: auto;
  padding: var(--space-1);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: pop-in var(--dur) var(--ease);
}
.menu--right { right: 0; }
.menu--up { bottom: calc(100% + 6px); }
.menu:not(.menu--up) { top: calc(100% + 6px); }
.menu__item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  color: var(--color-text);
  text-align: left;
}
.menu__item:hover, .menu__item:focus-visible { background: var(--gray-50); text-decoration: none; outline: none; }
.menu__item--danger { color: var(--color-danger); }
.menu__item[aria-checked="true"]::after { content: "✓"; margin-left: auto; color: var(--color-primary); }
.menu__sep { height: 1px; margin: var(--space-1) 0; background: var(--color-border); }
.menu__header { padding: var(--space-2) var(--space-3); font-size: var(--text-xs); color: var(--color-text-muted); }

/* ===== Modals & drawers ====================================================== */
.overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  background: rgba(13, 26, 46, 0.42);
  animation: fade-in var(--dur) var(--ease);
}
.modal {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - var(--space-12));
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  animation: pop-in var(--dur) var(--ease);
}
.modal--sm { max-width: 420px; }
.modal--lg { max-width: 760px; }
.modal__header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); padding: var(--space-5) var(--space-6) 0; }
.modal__title { font-size: var(--text-lg); }
.modal__body { padding: var(--space-4) var(--space-6); overflow-y: auto; display: flex; flex-direction: column; gap: var(--space-4); }
.modal__footer { display: flex; justify-content: flex-end; gap: var(--space-2); padding: var(--space-3) var(--space-6) var(--space-5); flex-wrap: wrap; }

.overlay--drawer { justify-content: flex-end; align-items: stretch; padding: 0; z-index: var(--z-drawer); }
.drawer {
  display: flex;
  flex-direction: column;
  width: min(var(--drawer-w), 100%);
  height: 100%;
  background: var(--color-surface);
  box-shadow: var(--shadow-lg);
  animation: slide-in var(--dur-slow) var(--ease);
}
.drawer--wide { width: min(760px, 100%); }
.drawer__header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-5); border-bottom: 1px solid var(--color-border); min-height: 56px; }
.drawer__body { flex: 1; overflow-y: auto; padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-5); }
.drawer__footer { padding: var(--space-3) var(--space-5); border-top: 1px solid var(--color-border); display: flex; justify-content: flex-end; gap: var(--space-2); }

/* ===== Tooltip (CSS-only, for supplementary text) ============================== */
[data-tooltip] { position: relative; }
[data-tooltip]:hover::after, [data-tooltip]:focus-visible::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-dropdown);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: var(--gray-900);
  color: #fff;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  white-space: nowrap;
  pointer-events: none;
}

/* ===== Toasts ================================================================ */
.toast-region { position: fixed; z-index: var(--z-toast); right: var(--space-5); bottom: var(--space-5); display: flex; flex-direction: column; gap: var(--space-2); width: min(380px, calc(100vw - var(--space-8))); }
.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--gray-900);
  color: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-base);
  animation: pop-in var(--dur) var(--ease);
}
.toast__icon { margin-top: 2px; }
.toast--success .toast__icon { color: #6fd39d; }
.toast--error .toast__icon { color: #ff8f88; }
.toast--warning .toast__icon { color: #ffc861; }
.toast__body { flex: 1; min-width: 0; }
.toast__action { color: #9cc4ff; font-weight: var(--weight-semibold); }

/* ===== Avatars ================================================================ */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--primary-100);
  color: var(--primary-700);
  font-size: 11px;
  font-weight: var(--weight-semibold);
  overflow: hidden;
  user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--xs { width: 20px; height: 20px; font-size: 9px; }
.avatar--sm { width: 24px; height: 24px; font-size: 10px; }
.avatar--lg { width: 40px; height: 40px; font-size: 14px; }
.avatar--xl { width: 64px; height: 64px; font-size: 22px; }
.avatar[data-tone="1"] { background: var(--violet-100); color: var(--violet-700); }
.avatar[data-tone="2"] { background: var(--green-100); color: var(--green-700); }
.avatar[data-tone="3"] { background: var(--amber-100); color: var(--amber-700); }
.avatar[data-tone="4"] { background: var(--teal-50); color: var(--teal-600); }
.avatar--empty { background: transparent; border: 1px dashed var(--gray-300); color: var(--gray-400); }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { border: 2px solid var(--color-surface); box-sizing: content-box; }
.avatar-stack .avatar + .avatar { margin-left: -8px; }
.person { display: inline-flex; align-items: center; gap: var(--space-2); min-width: 0; }
.person__name { font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== Progress ================================================================ */
.progress { position: relative; height: 6px; background: var(--gray-100); border-radius: var(--radius-pill); overflow: hidden; min-width: 60px; }
.progress__bar { height: 100%; background: var(--color-primary); border-radius: inherit; transition: width var(--dur-slow) var(--ease); }
.progress--success .progress__bar { background: var(--color-success); }
.progress--warning .progress__bar { background: var(--amber-600); }
.progress--danger .progress__bar { background: var(--color-danger); }
.progress-inline { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--text-xs); color: var(--color-text-secondary); font-variant-numeric: tabular-nums; }
.progress-inline .progress { flex: 1; }

/* ===== Filters & chips ========================================================= */
.filter-bar { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.filter-bar .select, .filter-bar .input { width: auto; min-width: 140px; }
.filter-bar .search { min-width: 220px; flex: 1; max-width: 320px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  background: var(--color-surface);
}
.chip[aria-pressed="true"] { background: var(--primary-50); border-color: var(--primary-200); color: var(--primary-700); }
.chip__remove { display: inline-flex; color: inherit; }

/* ===== Pagination ============================================================== */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) 0; font-size: var(--text-sm); color: var(--color-text-secondary); flex-wrap: wrap; }
.pagination__controls { display: flex; gap: var(--space-2); }

/* ===== Empty, loading, error states ============================================== */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-10) var(--space-6);
  text-align: center;
  color: var(--color-text-secondary);
}
.empty__icon { display: inline-flex; padding: var(--space-3); border-radius: var(--radius-lg); background: var(--gray-100); color: var(--gray-500); }
.empty__title { font-size: var(--text-md); font-weight: var(--weight-semibold); color: var(--color-heading); }
.empty__text { max-width: 420px; font-size: var(--text-base); }
.empty--compact { padding: var(--space-6) var(--space-4); }
.empty__logo { height: 56px; width: auto; }

.spinner { width: 22px; height: 22px; border: 2px solid var(--gray-200); border-top-color: var(--color-primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
.spinner--lg { width: 36px; height: 36px; border-width: 3px; }
.loading { display: flex; align-items: center; justify-content: center; gap: var(--space-3); padding: var(--space-10); color: var(--color-text-muted); }
.skeleton { background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-50) 50%, var(--gray-100) 75%); background-size: 200% 100%; border-radius: var(--radius-sm); animation: shimmer 1.4s ease-in-out infinite; }
.skeleton--line { height: 12px; }
.skeleton--card { height: 96px; border-radius: var(--radius-lg); }

.splash { position: fixed; inset: 0; z-index: var(--z-toast); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-5); background: var(--color-surface); }
.splash__status { font-size: var(--text-sm); color: var(--color-text-muted); }

.callout { display: flex; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); border: 1px solid var(--color-border); background: var(--gray-25); font-size: var(--text-sm); color: var(--color-text-secondary); }
.callout--info { background: var(--primary-50); border-color: var(--primary-100); color: var(--primary-700); }
.callout--warning { background: var(--amber-50); border-color: var(--amber-100); color: var(--amber-700); }
.callout--danger { background: var(--red-50); border-color: var(--red-100); color: var(--red-700); }
.callout--success { background: var(--green-50); border-color: var(--green-100); color: var(--green-700); }
.callout .icon { margin-top: 1px; }

/* ===== Lists: tasks, projects, activity, comments ================================== */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-5); border-top: 1px solid var(--gray-100); min-width: 0; }
.list-item:first-child { border-top: 0; }
.list-item--clickable { cursor: pointer; transition: background-color var(--dur-fast) var(--ease); }
.list-item--clickable:hover { background: var(--gray-25); }
.list-item__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }

.task-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  border-top: 1px solid var(--gray-100);
  min-height: 46px;
}
.task-row:first-child { border-top: 0; }
.task-row:hover { background: var(--gray-25); }
.task-row__title { display: flex; align-items: center; gap: var(--space-2); min-width: 0; cursor: pointer; }
.task-row__title-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: var(--weight-medium); }
.task-row.is-done .task-row__title-text { color: var(--color-text-muted); text-decoration: line-through; }
.task-check { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border: 1.5px solid var(--gray-300); border-radius: 50%; color: transparent; transition: all var(--dur-fast) var(--ease); }
.task-check:hover { border-color: var(--color-success); color: var(--color-success); }
.task-check[aria-checked="true"] { background: var(--color-success); border-color: var(--color-success); color: #fff; }
.tree-indent { display: inline-block; flex-shrink: 0; }

.project-card { padding: var(--space-5); gap: var(--space-4); }
.project-card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.project-card__key { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 40px; padding: 0 var(--space-2); border-radius: var(--radius-md); background: var(--primary-50); color: var(--primary-700); font-size: var(--text-xs); font-weight: var(--weight-bold); letter-spacing: 0.02em; }
.project-card__key[data-type="software"] { background: var(--violet-50); color: var(--violet-700); }
.project-card__key[data-type="construction"] { background: var(--amber-50); color: var(--amber-700); }
.project-card__key[data-type="manufacturing"] { background: var(--teal-50); color: var(--teal-600); }
.project-card__key[data-type="marketing"] { background: var(--pink-50); color: var(--pink-600); }
.project-card__name { font-size: var(--text-md); font-weight: var(--weight-semibold); color: var(--color-heading); }
.project-card__footer { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); font-size: var(--text-sm); color: var(--color-text-secondary); }

.activity { display: flex; gap: var(--space-3); padding: var(--space-3) 0; }
.activity + .activity { border-top: 1px solid var(--gray-100); }
.activity__body { flex: 1; min-width: 0; font-size: var(--text-sm); }
.activity__changes { margin-top: 4px; display: flex; flex-direction: column; gap: 2px; font-size: var(--text-xs); color: var(--color-text-secondary); }
.activity__time { font-size: var(--text-xs); color: var(--color-text-muted); white-space: nowrap; }

.comment { display: flex; gap: var(--space-3); }
.comment__bubble { flex: 1; min-width: 0; padding: var(--space-3); background: var(--gray-50); border-radius: var(--radius-lg); }
.comment__head { display: flex; align-items: baseline; gap: var(--space-2); margin-bottom: 4px; }
.comment__body { white-space: pre-wrap; word-break: break-word; font-size: var(--text-base); }
.mention { color: var(--primary-700); background: var(--primary-50); border-radius: 4px; padding: 0 3px; font-weight: var(--weight-medium); }

.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--space-2) var(--space-4); font-size: var(--text-sm); }
.kv dt { color: var(--color-text-muted); }
.kv dd { color: var(--color-text); min-width: 0; }

.notification { display: flex; gap: var(--space-3); padding: var(--space-3) var(--space-5); border-top: 1px solid var(--gray-100); cursor: pointer; }
.notification:hover { background: var(--gray-25); }
.notification.is-unread { background: var(--primary-50); }
.notification.is-unread .notification__title { font-weight: var(--weight-semibold); }
.notification__dot { width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: transparent; flex-shrink: 0; }
.notification.is-unread .notification__dot { background: var(--color-primary); }

.file-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-top: 1px solid var(--gray-100); }
.file-row:first-child { border-top: 0; }
.file-icon { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: var(--radius-md); background: var(--gray-100); color: var(--gray-600); font-size: 9px; font-weight: var(--weight-bold); text-transform: uppercase; flex-shrink: 0; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); padding: var(--space-6); border: 1.5px dashed var(--gray-300); border-radius: var(--radius-lg); color: var(--color-text-secondary); text-align: center; transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease); }
.dropzone.is-over { background: var(--primary-50); border-color: var(--color-primary); }
.upload-item { display: flex; flex-direction: column; gap: 4px; font-size: var(--text-sm); }

/* ===== Kanban cards ================================================================ */
.kcard {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  position: relative;
  cursor: grab;
  touch-action: manipulation;
  transition: box-shadow var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.kcard:hover { border-color: var(--gray-300); box-shadow: var(--shadow-sm); }
.kcard__title { font-weight: var(--weight-medium); color: var(--color-text); line-height: 1.35; word-break: break-word; }
.kcard__meta { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.kcard__labels { display: flex; flex-wrap: wrap; gap: 4px; }
.kcard.is-dragging { opacity: 0.4; }
.kcard.is-saving { opacity: 0.7; }
.kcard-ghost { position: fixed; z-index: var(--z-toast); pointer-events: none; transform: rotate(2deg); box-shadow: var(--shadow-lg); cursor: grabbing; }
.kdrop-indicator { height: 3px; border-radius: 2px; background: var(--color-primary); }
.board__column.is-over { background: var(--primary-50); outline: 2px dashed var(--primary-200); outline-offset: -2px; }
.board__count { font-size: var(--text-xs); color: var(--color-text-muted); font-weight: var(--weight-semibold); background: var(--color-surface); padding: 1px 7px; border-radius: var(--radius-pill); }
.board__column-title { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--gray-700); flex: 1; }
.board__add { justify-content: flex-start; color: var(--color-text-muted); }

/* ===== Gantt chart pieces ============================================================ */
.gantt-controls { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.gantt-controls .select, .toolbar .select, .toolbar .input, .cluster > .select, .cluster > .input { width: auto; max-width: 100%; }
.gantt__head-cols, .gantt__cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px 72px;
  gap: var(--space-2);
  padding: 0 var(--space-3);
  min-width: 0;
}
.gantt__head-cols { padding-bottom: var(--space-2); font-size: var(--text-xs); font-weight: var(--weight-semibold); text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-text-secondary); }
.gantt__name { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: var(--text-sm); }
.gantt__name-btn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; color: var(--color-text); font-weight: var(--weight-medium); min-width: 0; }
.gantt__name-btn:hover { color: var(--color-primary); }
.gantt__name-btn.is-summary { font-weight: var(--weight-semibold); }
.gantt__toggle { display: inline-flex; color: var(--gray-500); width: 16px; flex-shrink: 0; }
.gantt__date { font-size: var(--text-xs); color: var(--color-text-secondary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.gantt__row.is-selected .gantt__cell-table, .gantt__row.is-selected .gantt__cell-track { background: var(--primary-50); }
.gantt__row:hover .gantt__cell-track { background: var(--gray-25); }

.gantt-scale__top, .gantt-scale__bottom { position: absolute; left: 0; height: 26px; display: flex; }
.gantt-scale__top { top: 0; border-bottom: 1px solid var(--color-border); }
.gantt-scale__bottom { top: 26px; }
.gantt-scale__cell { position: absolute; top: 0; height: 100%; display: flex; align-items: center; padding: 0 6px; font-size: var(--text-xs); color: var(--color-text-secondary); border-left: 1px solid var(--color-border); white-space: nowrap; overflow: hidden; }
.gantt-scale__top .gantt-scale__cell { font-weight: var(--weight-semibold); color: var(--gray-700); }
.gantt-scale__cell.is-weekend { background: var(--gray-50); }
.gantt-scale__cell.is-today { color: var(--color-danger); font-weight: var(--weight-bold); }
.gantt__grid-line { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--gray-100); }
.gantt__weekend { position: absolute; top: 0; bottom: 0; background: rgba(238, 241, 245, 0.55); }
.gantt__today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--color-danger); opacity: 0.75; z-index: 2; }
.gantt__today-label { position: absolute; top: 2px; transform: translateX(-50%); padding: 0 5px; border-radius: 4px; background: var(--color-danger); color: #fff; font-size: 10px; font-weight: var(--weight-bold); z-index: 6; }

.gantt-bar {
  position: absolute;
  top: 8px;
  height: 20px;
  display: flex;
  align-items: center;
  border-radius: 5px;
  background: var(--primary-200);
  color: var(--primary-700);
  font-size: 11px;
  font-weight: var(--weight-semibold);
  cursor: pointer;
  z-index: 2;
  touch-action: pan-x pan-y;
  user-select: none;
  box-shadow: inset 0 0 0 1px rgba(23, 80, 159, 0.25);
}
.gantt-bar:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.gantt-bar__progress { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px 0 0 5px; background: var(--color-primary); opacity: 0.9; }
.gantt-bar__label { position: relative; padding: 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--primary-700); }
.gantt-bar.is-filled .gantt-bar__label { color: #fff; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2); }
.gantt-bar[data-status="done"] .gantt-bar__label { color: #fff; }
.gantt-bar[data-status="blocked"]:not(.is-filled) .gantt-bar__label { color: var(--red-700); }
.gantt-bar__outside { position: absolute; left: calc(100% + 8px); white-space: nowrap; font-size: 11px; font-weight: var(--weight-medium); color: var(--color-text-secondary); pointer-events: none; }
.gantt-bar__handle { position: absolute; top: 0; bottom: 0; width: 8px; cursor: ew-resize; z-index: 3; }
.gantt-bar__handle--start { left: -2px; }
.gantt-bar__handle--end { right: -2px; }
.gantt-bar__link { position: absolute; right: -14px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; background: var(--color-surface); border: 2px solid var(--color-primary); cursor: crosshair; opacity: 0; z-index: 4; transition: opacity var(--dur-fast) var(--ease); }
.gantt-bar:hover .gantt-bar__link, .gantt-bar:focus-within .gantt-bar__link { opacity: 1; }
.gantt-bar[data-status="done"] { background: var(--green-100); box-shadow: inset 0 0 0 1px rgba(30, 138, 82, 0.3); }
.gantt-bar[data-status="done"] .gantt-bar__progress { background: var(--color-success); }
.gantt-bar[data-status="blocked"] { background: var(--red-100); box-shadow: inset 0 0 0 1px rgba(197, 54, 47, 0.35); }
.gantt-bar[data-status="blocked"] .gantt-bar__progress { background: var(--color-danger); }
.gantt-bar.is-critical { box-shadow: inset 0 0 0 2px var(--red-600); }
.gantt-bar.is-conflict { background-image: repeating-linear-gradient(45deg, transparent 0 6px, rgba(197, 54, 47, 0.18) 6px 9px); }
.gantt-bar--summary { top: 12px; height: 10px; border-radius: 2px; background: var(--gray-700); box-shadow: none; }
.gantt-bar--summary::before, .gantt-bar--summary::after { content: ""; position: absolute; bottom: -5px; border: 5px solid transparent; border-top-color: var(--gray-700); }
.gantt-bar--summary::before { left: -5px; border-left-color: var(--gray-700); border-right: 0; }
.gantt-bar--summary::after { right: -5px; border-right-color: var(--gray-700); border-left: 0; }
.gantt-bar--summary .gantt-bar__progress { background: var(--brand-teal); opacity: 1; border-radius: 2px; }
.gantt-bar.is-dragging { opacity: 0.85; z-index: 5; box-shadow: var(--shadow-md); }
.gantt-baseline { position: absolute; top: 29px; height: 4px; border-radius: 2px; background: var(--gray-400); opacity: 0.7; z-index: 1; }
.gantt-milestone { position: absolute; top: 10px; width: 16px; height: 16px; margin-left: -8px; transform: rotate(45deg); background: var(--violet-500); border: 2px solid var(--color-surface); box-shadow: 0 0 0 1px var(--violet-500); cursor: pointer; z-index: 2; }
.gantt-milestone.is-done { background: var(--color-success); box-shadow: 0 0 0 1px var(--color-success); }
.gantt-milestone.is-overdue { background: var(--color-danger); box-shadow: 0 0 0 1px var(--color-danger); }
.gantt-undated { position: absolute; top: 9px; left: 8px; font-size: 11px; color: var(--color-text-muted); font-style: italic; white-space: nowrap; }
.gantt-link { fill: none; stroke: var(--gray-400); stroke-width: 1.5; }
.gantt-link.is-critical { stroke: var(--red-600); }
.gantt-link.is-violated { stroke: var(--amber-600); stroke-dasharray: 4 3; }
.gantt-link-arrow { fill: var(--gray-400); }
.gantt-link-draft { fill: none; stroke: var(--color-primary); stroke-width: 2; stroke-dasharray: 5 4; }
.gantt-drag-tip { position: fixed; z-index: var(--z-toast); padding: 4px 8px; border-radius: var(--radius-sm); background: var(--gray-900); color: #fff; font-size: var(--text-xs); font-weight: var(--weight-medium); pointer-events: none; white-space: nowrap; }
.legend { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; font-size: var(--text-xs); color: var(--color-text-secondary); }
.legend__item { display: inline-flex; align-items: center; gap: 6px; }
.legend__swatch { width: 18px; height: 10px; border-radius: 3px; background: var(--primary-200); }
.legend__swatch--progress { background: linear-gradient(90deg, var(--color-primary) 50%, var(--primary-200) 50%); }
.legend__swatch--critical { background: var(--primary-200); box-shadow: inset 0 0 0 2px var(--red-600); }
.legend__swatch--summary { height: 6px; background: var(--gray-700); }
.legend__swatch--baseline { height: 4px; background: var(--gray-400); }
.legend__swatch--milestone { width: 10px; height: 10px; transform: rotate(45deg); background: var(--violet-500); }
.legend__swatch--today { width: 2px; height: 14px; background: var(--color-danger); }
.legend__swatch--conflict { background-image: repeating-linear-gradient(45deg, var(--primary-200) 0 4px, rgba(197, 54, 47, 0.4) 4px 6px); }

/* ===== Calendar items ================================================================ */
.calendar__weekday { padding: var(--space-2); font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--color-text-secondary); text-transform: uppercase; letter-spacing: 0.04em; text-align: center; }
.calendar__day { min-height: 116px; padding: 6px; border-right: 1px solid var(--gray-100); border-bottom: 1px solid var(--gray-100); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.calendar__day:nth-child(7n) { border-right: 0; }
.calendar__day.is-outside { background: var(--gray-25); }
.calendar__day.is-outside .calendar__date { color: var(--gray-400); }
.calendar__day.is-weekend { background: var(--gray-25); }
.calendar__date { align-self: flex-start; display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px; padding: 0 4px; border-radius: var(--radius-pill); font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--gray-700); }
.calendar__day.is-today .calendar__date { background: var(--color-primary); color: #fff; }
.cal-item { display: flex; align-items: center; gap: 4px; width: 100%; padding: 2px 6px; border-radius: 4px; background: var(--primary-50); color: var(--primary-700); font-size: 11px; font-weight: var(--weight-medium); text-align: left; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cal-item:hover { filter: brightness(0.97); }
.cal-item[data-kind="milestone"] { background: var(--violet-50); color: var(--violet-700); }
.cal-item[data-kind="project"] { background: var(--teal-50); color: var(--teal-600); }
.cal-item[data-status="done"] { background: var(--green-50); color: var(--green-700); text-decoration: line-through; }
.cal-item.is-overdue { background: var(--red-50); color: var(--red-700); }
.cal-more { font-size: 11px; color: var(--color-text-secondary); text-align: left; padding: 0 6px; }
.agenda-day { border-top: 1px solid var(--color-border); padding: var(--space-3) var(--space-4); }

/* ===== Charts ======================================================================= */
.chart { width: 100%; height: auto; max-height: 260px; overflow: visible; }
.chart--donut { width: 132px; height: 132px; flex-shrink: 0; }
.chart text { font-family: var(--font-sans); font-size: 11px; fill: var(--color-text-muted); }
.chart .axis line, .chart .grid-line { stroke: var(--gray-150); }
.chart .bar { fill: var(--primary-500); }
.chart .bar--muted { fill: var(--primary-200); }
.chart .line { fill: none; stroke: var(--color-primary); stroke-width: 2; }
.chart .line--ideal { stroke: var(--gray-400); stroke-dasharray: 4 4; stroke-width: 1.5; }
.chart .dot { fill: var(--color-surface); stroke: var(--color-primary); stroke-width: 2; }
.chart-legend { display: flex; flex-direction: column; gap: var(--space-2); font-size: var(--text-sm); }
.chart-legend__row { display: flex; align-items: center; gap: var(--space-2); }
.chart-legend__swatch { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.chart-legend__value { margin-left: auto; font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }
.dist-bar { display: flex; height: 10px; border-radius: var(--radius-pill); overflow: hidden; background: var(--gray-100); }
.dist-bar span { height: 100%; }

/* Risk matrix */
.risk-matrix { display: grid; grid-template-columns: 28px repeat(5, minmax(0, 1fr)); gap: 3px; font-size: var(--text-xs); }
.risk-matrix__cell { display: flex; align-items: center; justify-content: center; aspect-ratio: 1.6; border-radius: 4px; font-weight: var(--weight-semibold); color: var(--gray-700); }
.risk-matrix__cell[data-level="low"] { background: var(--green-50); }
.risk-matrix__cell[data-level="medium"] { background: var(--amber-50); }
.risk-matrix__cell[data-level="high"] { background: var(--red-50); }
.risk-matrix__cell[data-level="critical"] { background: var(--red-100); color: var(--red-700); }
.risk-matrix__axis { display: flex; align-items: center; justify-content: center; color: var(--color-text-muted); }

/* Workload bar */
.load-bar { position: relative; height: 8px; border-radius: var(--radius-pill); background: var(--gray-100); overflow: hidden; }
.load-bar__fill { height: 100%; background: var(--color-primary); border-radius: inherit; }
.load-bar__fill.is-over { background: var(--color-danger); }
.load-bar__fill.is-high { background: var(--amber-600); }

/* Sprint and backlog */
.backlog-section { overflow: hidden; }
.backlog-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-4); border-top: 1px solid var(--gray-100); min-height: 44px; background: var(--color-surface); }
.backlog-row:first-child { border-top: 0; }
.backlog-row__grip { color: var(--gray-400); cursor: grab; display: inline-flex; touch-action: none; }
.backlog-row__main { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.backlog-row__side { display: flex; align-items: center; gap: var(--space-3); }
.backlog-row.is-drop-before { box-shadow: inset 0 2px 0 var(--color-primary); }
.backlog-row.is-dragging { opacity: 0.4; }
.points { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 20px; padding: 0 6px; border-radius: var(--radius-pill); background: var(--gray-100); font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--gray-700); font-variant-numeric: tabular-nums; }

/* Mobile tab bar items */
.tabbar__item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: 100%; font-size: 11px; font-weight: var(--weight-medium); color: var(--color-text-muted); }
.tabbar__item[aria-current="page"] { color: var(--color-primary); }
.tabbar__item:hover { text-decoration: none; }

/* ===== Animations ====================================================================== */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(4px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
