/* ── Sidebar navigation ───────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--color-nav-bg);
  border-right: none;
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform var(--transition-base);

  /* 3D panel depth — layered shadows cascade off the right edge */
  box-shadow:
    1px  0  0   rgba(255,255,255,0.04),    /* paper-thin edge highlight */
    3px  0  6px  rgba(0,0,0,0.18),
    8px  0  18px rgba(0,0,0,0.14),
    18px 0  36px rgba(0,0,0,0.09),
    32px 0  56px rgba(0,0,0,0.05);
}

/* Left edge — subtle primary glow suggests a light source from the left */
.sidebar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(
    180deg,
    var(--color-primary) 0%,
    rgba(82,183,136,0.25) 40%,
    transparent 80%
  );
  pointer-events: none;
  z-index: 2;
}

/* Right edge — curved-surface highlight simulates the panel edge catching light */
.sidebar::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 20px;
  background: linear-gradient(
    to right,
    transparent 0%,
    rgba(255,255,255,0.012) 35%,
    rgba(255,255,255,0.028) 65%,
    rgba(255,255,255,0.042) 82%,
    rgba(255,255,255,0.022) 93%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 1;
}

.sidebar__header {
  padding: var(--space-lg) var(--space-md) var(--space-md);
  flex-shrink: 0;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-xs);
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--color-text);
  text-decoration: none;
  letter-spacing: -0.03em;
}
.sidebar__brand:hover { text-decoration: none; opacity: 0.85; }
.sidebar__brand span  { color: var(--color-primary-light); }

.sidebar__brand-icon {
  width: 36px;
  height: 36px;
  background: var(--color-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.sidebar__nav {
  flex: 1;
  padding: var(--space-sm) var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.sidebar__section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar__section-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-nav-section);
  padding: 0 var(--space-sm);
  margin-bottom: var(--space-xs);
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.6rem var(--space-sm);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-nav-text);
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast),
              transform var(--transition-fast);
  position: relative;
}

.sidebar__link:hover {
  background: var(--color-nav-hover-bg);
  color: var(--color-nav-active);
  text-decoration: none;
  transform: translateX(2px);
}

.sidebar__link.active {
  background: var(--color-nav-active-bg);
  color: var(--color-nav-active);
  font-weight: 600;
  transform: translateX(2px);
}

.sidebar__link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 18%;
  bottom: 18%;
  width: 3px;
  background: var(--color-nav-active);
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 8px var(--color-nav-active);
}

.sidebar__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.75;
}

.sidebar__link.active .sidebar__icon,
.sidebar__link:hover .sidebar__icon { opacity: 1; }

.sidebar__link--logout { margin-top: auto; }
.sidebar__link--logout:hover { color: var(--color-danger); background: #FEF2F2; }

.sidebar__footer {
  padding: var(--space-md);
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
  background: linear-gradient(0deg, rgba(0,0,0,0.12) 0%, transparent 100%);
}

.sidebar__user {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.sidebar__avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar__username {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Hamburger toggle — hidden on desktop */
.sidebar__toggle {
  display: none;
  position: fixed;
  top: var(--space-md);
  left: var(--space-md);
  z-index: 300;
  width: 40px;
  height: 40px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0;
}

.sidebar__toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.sidebar__toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.sidebar__toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.sidebar__toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile overlay */
.sidebar__overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 190;
  opacity: 0;
  transition: opacity var(--transition-base);
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: 0.55rem 1.375rem;
  font-family: var(--font-base);
  font-size: 0.9rem;
  font-weight: 600;
  border: 1.5px solid transparent;
  border-radius: var(--radius-pill);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition-fast), border-color var(--transition-fast),
              box-shadow var(--transition-fast), transform var(--transition-fast);
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.btn:hover  { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }

.btn--primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.btn--primary:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); }

.btn--accent {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  border-color: var(--color-primary-light);
}
.btn--accent:hover { background: var(--color-accent-hover); border-color: var(--color-accent-hover); }

.btn--danger {
  background: var(--color-danger);
  color: #fff;
  border-color: var(--color-danger);
}

.btn--ghost {
  background: transparent;
  border-color: var(--color-border);
  color: var(--color-text);
}
.btn--ghost:hover { background: var(--color-surface-hover); border-color: var(--color-text-muted); }

.btn--sm {
  padding: 0.3rem 0.875rem;
  font-size: 0.8125rem;
}

.btn--block { width: 100%; }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: var(--space-md); }

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
  color: var(--color-text);
}

.form-label .required { color: var(--color-danger); margin-left: 2px; }

.form-control {
  display: block;
  width: 100%;
  padding: 0.6rem 1rem;
  font-family: var(--font-base);
  font-size: 0.9375rem;
  color: var(--color-text);
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-border-focus) 12%, transparent);
}

.form-control::placeholder { color: var(--color-text-muted); }

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236B7280' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

textarea.form-control { resize: vertical; min-height: 100px; }

.form-hint {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-top: var(--space-xs);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

@media (max-width: 480px) {
  .form-row { grid-template-columns: 1fr; }
}

/* ── Alerts ───────────────────────────────────────────────────────────────── */
.alert {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  margin-bottom: var(--space-md);
  border-left: 4px solid transparent;
}

.alert--error   { background: #FEF2F2; border-color: var(--color-danger);  color: #7f1d1d; }
.alert--success { background: #F0FDF4; border-color: var(--color-success); color: #14532d; }
.alert--warning { background: #FFFBEB; border-color: var(--color-warning); color: #78350f; }
.alert--info    { background: #F0FDF4; border-color: var(--color-primary); color: #1B4332; }

/* ── Card ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card--featured {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.card--featured .card__body * { color: #fff; }

.card__header {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card__body { padding: var(--space-lg); }

/* ── Page header ──────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.page-header h1 { margin: 0; }

.page-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* ── Badge ────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.2rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge--inbox     { background: #F3F4F6; color: #374151; }
.badge--next      { background: #DBEAFE; color: #1e40af; }
.badge--active    { background: #D1FAE5; color: #065f46; }
.badge--waiting   { background: #FEF3C7; color: #92400e; }
.badge--scheduled { background: #EDE9FE; color: #5b21b6; }
.badge--shelved   { background: #F3F4F6; color: #6b7280; }
.badge--done      { background: #D1FAE5; color: #065f46; }
.badge--cancelled { background: #FEE2E2; color: #991b1b; }

.badge--low      { background: #D1FAE5; color: #065f46; }
.badge--medium   { background: #DBEAFE; color: #1e40af; }
.badge--high     { background: #FEF3C7; color: #92400e; }
.badge--critical { background: #FEE2E2; color: #991b1b; }

/* ── Stat cards ───────────────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.stat-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  transition: box-shadow var(--transition-fast), transform var(--transition-fast);
}

.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.stat-card--featured {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.stat-card--featured .stat-card__value,
.stat-card--featured .stat-card__label { color: #fff; }

.stat-card--danger  { border-color: #FCA5A5; background: #FFF5F5; }
.stat-card--warning { border-color: #FCD34D; background: #FFFBEB; }
.stat-card--success { border-color: #86EFAC; background: #F0FDF4; }

.stat-card__value {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
  color: var(--color-text);
  display: flex;
  align-items: baseline;
  gap: var(--space-xs);
}

.stat-card--danger  .stat-card__value { color: var(--color-danger); }
.stat-card--warning .stat-card__value { color: var(--color-warning); }
.stat-card--success .stat-card__value { color: var(--color-success); }

.stat-card__label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-card__sub {
  font-size: 0.75rem;
  color: var(--color-primary-light);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: var(--space-xs);
}

.stat-card--featured .stat-card__sub { color: rgba(255,255,255,0.75); }

.trend         { font-size: 1rem; font-weight: 700; }
.trend--up     { color: var(--color-success); }
.trend--down   { color: var(--color-danger); }
.trend--flat   { color: var(--color-text-muted); }

/* ── Task list ────────────────────────────────────────────────────────────── */
.task-tabs {
  display: flex;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
}

.task-tab {
  padding: 0.35rem 1rem;
  border-radius: var(--radius-pill);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-muted);
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.task-tab:hover      { color: var(--color-primary); border-color: var(--color-primary); text-decoration: none; }
.task-tab--active    { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

.filter-bar {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
}

.filter-bar__search { flex: 1; min-width: 180px; }
.filter-bar__select { width: auto; }

.task-list { display: flex; flex-direction: column; gap: var(--space-xs); }

.task-group__heading {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  padding: var(--space-sm) 0 var(--space-xs);
  margin-top: var(--space-sm);
}

.task-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  transition: box-shadow var(--transition-fast), transform var(--transition-fast);
}

.task-row:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.task-row__priority {
  width: 4px;
  min-height: 40px;
  border-radius: 4px;
  flex-shrink: 0;
  align-self: stretch;
}

.priority--low      { background: var(--color-success); }
.priority--medium   { background: var(--color-primary-light); }
.priority--high     { background: var(--color-warning); }
.priority--critical { background: var(--color-danger); }

.task-row__body { flex: 1; min-width: 0; }

.task-row__title {
  font-weight: 500;
  color: var(--color-text);
  text-decoration: none;
  display: block;
  word-break: break-word;
}

.task-row__title:hover          { color: var(--color-primary); text-decoration: none; }
.task-row__title--done          { text-decoration: line-through; color: var(--color-text-muted); }

.task-row__detail {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-row__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-xs);
  align-items: center;
}

.task-row__due             { font-size: 0.8rem; color: var(--color-text-muted); }
.task-row__due--overdue    { color: var(--color-danger); font-weight: 600; }

.task-row__actions {
  display: flex;
  gap: var(--space-xs);
  flex-shrink: 0;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.task-row:hover .task-row__actions { opacity: 1; }

/* ── Task detail ──────────────────────────────────────────────────────────── */
.task-meta-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-xs) var(--space-md);
}

.task-meta-list dt { font-size: 0.8125rem; font-weight: 600; color: var(--color-text-muted); padding-top: 2px; }
.task-meta-list dd { font-size: 0.9rem; }

/* ── Empty state ──────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--space-2xl) var(--space-md);
  color: var(--color-text-muted);
}

.empty-state__icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  display: block;
  opacity: 0.4;
}

.empty-state p { font-size: 1.125rem; margin-bottom: var(--space-lg); }

/* ── Chat ─────────────────────────────────────────────────────────────────── */
.chat-layout {
  display: flex;
  flex-direction: row;
  gap: var(--space-md);
  height: calc(100vh - 3rem);
  max-height: 860px;
}

.chat-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ── Chat reference panel ─────────────────────────────────────────────────── */
.chat-ref-panel {
  width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-left: 1px solid transparent;
  transition: width 220ms ease;
  flex-shrink: 0;
}

.chat-ref-panel--open {
  width: 280px;
  border-left-color: var(--color-border);
  padding-left: var(--space-md);
}

.chat-ref-panel__header {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) 0 var(--space-sm);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.chat-ref-panel__title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-muted);
}

.chat-ref-panel__count {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  flex: 1;
}

.chat-ref-panel__close {
  background: none;
  border: none;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 0 2px;
  margin-left: auto;
}

.chat-ref-panel__close:hover { color: var(--color-text); }

.chat-ref-panel__search {
  padding: var(--space-sm) 0 var(--space-xs);
  flex-shrink: 0;
}

.ref-search-input {
  width: 100%;
  padding: 5px 10px;
  font-size: 0.8rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-text);
  outline: none;
}

.ref-search-input:focus { border-color: var(--color-border-focus); }

.chat-ref-panel__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding-bottom: var(--space-sm);
  flex-shrink: 0;
}

.ref-filter {
  padding: 3px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: none;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.ref-filter:hover   { background: var(--color-surface); color: var(--color-text); }
.ref-filter--active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }

.chat-ref-panel__list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-ref-panel__footer {
  font-size: 0.65rem;
  color: var(--color-text-muted);
  padding-top: var(--space-xs);
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
  text-align: center;
}

.ref-task-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.ref-task-row:hover         { background: var(--color-surface); border-color: var(--color-border); }
.ref-task-row--inserted     { background: color-mix(in srgb, var(--color-success) 12%, transparent) !important; border-color: var(--color-success) !important; }

.ref-task__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}

.ref-task__body   { flex: 1; min-width: 0; }

.ref-task__top {
  display: flex;
  align-items: baseline;
  gap: 5px;
  margin-bottom: 2px;
}

.ref-task__id {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.ref-task__title {
  font-size: 0.8rem;
  color: var(--color-text);
  line-height: 1.3;
  word-break: break-word;
}

.ref-task__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.ref-task__area {
  font-size: 0.65rem;
  color: var(--color-text-muted);
}

.ref-task__project {
  font-size: 0.65rem;
  color: var(--color-text-muted);
}

.ref-task__badge {
  font-size: 0.58rem !important;
  padding: 1px 5px !important;
}

.ref-task-empty {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  padding: var(--space-lg) 0;
  text-align: center;
}

.chat-ref-toggle-btn { flex-shrink: 0; padding: 0.4rem 0.65rem; }
.btn--active         { background: var(--color-primary) !important; color: #fff !important; border-color: var(--color-primary) !important; }

/* Mobile backdrop */
.chat-ref-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 199;
}

/* Backdrop only on mobile — on desktop the panel slides in beside the chat */
@media (max-width: 640px) {
  .chat-ref-backdrop--visible { display: block; }
}

/* Mobile: panel slides up as a sheet */
@media (max-width: 640px) {
  .chat-layout { position: relative; }

  .chat-ref-panel {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    width: 100% !important;
    max-height: 0;
    height: auto;
    border-left: none;
    border-top: 2px solid var(--color-border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    background: var(--color-surface, var(--color-bg));
    z-index: 200;
    padding: 0 var(--space-md);
    overflow: hidden;
    transition: max-height 280ms ease, padding 280ms ease;
  }

  .chat-ref-panel--open {
    max-height: 65vh;
    padding: var(--space-md);
    overflow-y: auto;
  }
}

.chat-window {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  scroll-behavior: smooth;
}

.chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  text-align: center;
  padding: var(--space-2xl) var(--space-md);
  gap: var(--space-lg);
}

/* Greeting block */
.chat-welcome__time {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-primary);
  margin-bottom: var(--space-xs);
}

.chat-welcome__name {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--color-text);
  margin: 0 0 var(--space-xs);
}

.chat-welcome__sub {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin: 0;
}

/* Daily stat chips */
.chat-daily-stats {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  justify-content: center;
}

.chat-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--color-border);
  background: var(--color-bg);
  cursor: pointer;
  min-width: 80px;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.chat-stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.chat-stat__num {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
}

.chat-stat__label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}

.chat-stat--danger  { border-color: #FCA5A5; background: #FFF5F5; }
.chat-stat--danger  .chat-stat__num { color: var(--color-danger); }
.chat-stat--warn    { border-color: #FCD34D; background: #FFFBEB; }
.chat-stat--warn    .chat-stat__num { color: var(--color-warning); }
.chat-stat--primary .chat-stat__num { color: var(--color-primary); }
.chat-stat--ok      .chat-stat__num { color: var(--color-text-muted); }

.chat-welcome__divider {
  width: 40px;
  height: 2px;
  background: var(--color-border);
  border-radius: 2px;
}

.chat-welcome__prompt {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin: 0;
}

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  justify-content: center;
  margin-top: var(--space-lg);
}

.suggestion-chip {
  padding: 0.4rem 1rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-bg);
  font-size: 0.875rem;
  color: var(--color-primary);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.suggestion-chip:hover { background: var(--color-nav-active-bg); border-color: var(--color-primary); }

/* Message bubbles */
.chat-msg {
  display: flex;
  align-items: flex-end;
  gap: var(--space-sm);
  max-width: 100%;
}

.chat-msg--user      { flex-direction: row-reverse; }
.chat-msg--assistant { flex-direction: row; }

.chat-msg__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-msg__avatar--user { background: var(--color-primary-mid); }

.chat-msg__bubble {
  max-width: 72%;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-lg);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

.chat-msg--user .chat-msg__bubble {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  border-bottom-right-radius: var(--radius-sm);
}

.chat-msg--assistant .chat-msg__bubble {
  border-bottom-left-radius: var(--radius-sm);
}

.chat-msg__text { line-height: 1.5; word-break: break-word; }

.chat-msg__time {
  font-size: 0.7rem;
  opacity: 0.55;
  margin-top: var(--space-xs);
  text-align: right;
}

/* Typing indicator */
.chat-typing .chat-msg__bubble {
  display: flex;
  align-items: center;
  gap: 4px;
}

.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-text-muted);
  animation: typing-bounce 1.2s infinite ease-in-out;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40%           { transform: translateY(-6px); opacity: 1; }
}

/* Task cards inside chat */
.chat-task-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: var(--space-sm);
  max-height: 320px;
  overflow-y: auto;
}

.chat-task-card {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0.3rem 0.6rem;
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  flex-wrap: wrap;
}

.chat-task-card__title       { color: var(--color-primary); font-weight: 500; }
.chat-task-card__title:hover { text-decoration: underline; }
.chat-task-empty             { font-size: 0.875rem; color: var(--color-text-muted); margin-top: var(--space-sm); }

/* Input bar */
.chat-input-bar {
  border-top: 1px solid var(--color-border);
  padding: var(--space-md) 0 0;
  background: var(--color-surface);
}

.chat-input-form {
  display: flex;
  gap: var(--space-sm);
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  padding: 0.6rem 1rem;
  font-family: var(--font-base);
  font-size: 0.9375rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  resize: none;
  line-height: 1.5;
  max-height: 160px;
  overflow-y: auto;
  background: var(--color-bg);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  color: var(--color-text);
}

.chat-input:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-border-focus) 12%, transparent);
}

.chat-send-btn { flex-shrink: 0; }

.chat-hint { font-size: 0.75rem; color: var(--color-text-muted); margin-top: var(--space-xs); }

.chat-hint kbd {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 3px;
  padding: 1px 4px;
  font-size: 0.7rem;
}

/* ── Workload unestimated warning ────────────────────────────────────────── */
.wl-unest-warn {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-lg);
  background: color-mix(in srgb, var(--color-warning) 10%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--color-warning) 30%, transparent);
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.wl-unest-warn__link {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ── Workload buckets ─────────────────────────────────────────────────────── */
.wl-buckets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
}

.wl-bucket {
  padding: var(--space-md);
  border-radius: var(--radius-md);
  border-top: 3px solid transparent;
  background: var(--color-surface-raised, var(--color-surface));
  border-left: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  transition: box-shadow var(--transition-fast), transform var(--transition-fast);
}

.wl-bucket:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.wl-bucket--flight  { border-top-color: var(--color-primary); }
.wl-bucket--queued  { border-top-color: var(--color-warning); }
.wl-bucket--blocked { border-top-color: var(--color-border); }
.wl-bucket--done    { border-top-color: var(--color-success); }

.wl-bucket__label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-xs);
}

.wl-bucket__weeks {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--color-text);
  margin-bottom: 2px;
}

.wl-bucket__weeks--na { color: var(--color-text-muted); }
.wl-bucket--done  .wl-bucket__weeks { color: var(--color-success); }
.wl-bucket--flight .wl-bucket__weeks { color: var(--color-primary); }

.wl-bucket__count {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-sm);
}

.wl-bucket__statuses {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-xs);
}

.wl-status {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  display: flex;
  justify-content: space-between;
}

.wl-status strong {
  color: var(--color-text);
  font-weight: 600;
}

.wl-status--muted { font-style: italic; }

@media (max-width: 640px) {
  .wl-buckets { grid-template-columns: repeat(2, 1fr); }
}

/* ── Workload modal ───────────────────────────────────────────────────────── */
.wl-modal {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wl-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.wl-modal__box {
  position: relative;
  z-index: 1;
  background: var(--color-card, var(--color-surface));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: min(720px, 95vw);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.wl-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.wl-modal__close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 0 4px;
}

.wl-modal__close:hover { color: var(--color-text); }

.wl-modal__body {
  overflow-y: auto;
  flex: 1;
}

.wl-modal__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.wl-modal__table th {
  text-align: left;
  padding: var(--space-sm) var(--space-md);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  background: var(--color-card, var(--color-surface));
}

.wl-modal__row {
  cursor: pointer;
  border-bottom: 1px solid var(--color-border);
  transition: background var(--transition-fast);
}

.wl-modal__row:hover { background: var(--color-surface); }
.wl-modal__row:last-child { border-bottom: none; }

.wl-modal__table td {
  padding: var(--space-sm) var(--space-md);
  vertical-align: middle;
}

/* ── Project card grid ────────────────────────────────────────────────────── */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-lg);
}

.project-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  border-top: 4px solid var(--accent, var(--color-primary));
  background: var(--color-bg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-fast), transform var(--transition-fast);
  overflow: hidden;
}

.project-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.project-card__inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding: var(--space-lg);
  text-decoration: none;
  color: inherit;
  height: 100%;
}

.project-card__inner:hover { text-decoration: none; }

.project-card__header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
}

.project-card__avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--accent, var(--color-primary));
  color: #fff;
  font-size: 1.1rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}

.project-card__meta   { flex: 1; min-width: 0; }

.project-card__title {
  font-size: 0.975rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.3;
  margin-bottom: 4px;
  word-break: break-word;
}

.project-card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.project-card__edit {
  flex-shrink: 0;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.project-card:hover .project-card__edit { opacity: 1; }

.project-card__detail {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin: 0;
  flex: 1;
}

.project-card__stats { margin-top: auto; }

.project-card__progress-wrap {
  height: 6px;
  background: var(--color-border);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: var(--space-xs);
}

.project-card__progress-bar {
  height: 100%;
  background: var(--accent, var(--color-primary));
  border-radius: var(--radius-pill);
  transition: width 0.5s ease;
  min-width: 2px;
}

.project-card__numbers {
  display: flex;
  gap: var(--space-md);
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.project-card__numbers strong { color: var(--color-text); }

.project-card__pct {
  margin-left: auto;
  font-weight: 700;
  color: var(--accent, var(--color-primary));
}

.project-card__no-tasks {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-style: italic;
  margin: 0;
}

.project-card__no-tasks a { color: var(--color-primary); }

.project-card__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-sm);
  margin-top: calc(-1 * var(--space-xs));
}

.project-card__last { color: var(--color-text-muted); }

/* ── Velocity chart ───────────────────────────────────────────────────────── */
.velocity-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 80px;
  padding-bottom: var(--space-sm);
}

.vel-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  position: relative;
  gap: 2px;
}

.vel-bar__count { font-size: 0.65rem; font-weight: 600; color: var(--color-text-muted); min-height: 14px; }

.vel-bar {
  width: 100%;
  background: var(--color-primary-light);
  border-radius: 4px 4px 0 0;
  opacity: 0.75;
  transition: opacity var(--transition-fast);
  min-height: 4px;
}

.vel-bar:hover    { opacity: 1; }
.vel-bar--today   { background: var(--color-primary); opacity: 1; }

.vel-bar__label { font-size: 0.65rem; color: var(--color-text-muted); white-space: nowrap; }

/* ── Two-column insight grid ──────────────────────────────────────────────── */
.insight-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
  align-items: start;
}

.insight-task-list { display: flex; flex-direction: column; }

.insight-task-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-lg);
  border-bottom: 1px solid var(--color-border);
  transition: background var(--transition-fast);
}

.insight-task-row:last-child { border-bottom: none; }
.insight-task-row:hover      { background: var(--color-surface-hover); }

.insight-task__priority { width: 4px; height: 32px; border-radius: 4px; flex-shrink: 0; }
.insight-task__body     { flex: 1; min-width: 0; }

.insight-task__title {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text);
  text-decoration: none;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.insight-task__title:hover       { color: var(--color-primary); }
.insight-task__title--done       { text-decoration: line-through; color: var(--color-text-muted); }

.insight-task__meta {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
  flex-wrap: wrap;
  margin-top: 1px;
}

.insight-task__due             { font-size: 0.75rem; color: var(--color-text-muted); }
.insight-task__due--overdue    { color: var(--color-danger); font-weight: 600; }

.insight-task__edit {
  opacity: 0;
  flex-shrink: 0;
  transition: opacity var(--transition-fast);
  padding: 2px 8px;
  font-size: 0.8rem;
}

.insight-task-row:hover .insight-task__edit { opacity: 1; }

.insight-day-heading {
  padding: var(--space-xs) var(--space-lg);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

/* Area breakdown */
.area-breakdown { display: flex; flex-direction: column; gap: var(--space-sm); }

.area-row {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  align-items: center;
  gap: var(--space-md);
}

.area-row__name {
  font-weight: 500;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.area-row__bar-wrap { height: 8px; background: var(--color-surface); border-radius: var(--radius-pill); overflow: hidden; }

.area-row__bar {
  height: 100%;
  background: var(--color-primary-light);
  border-radius: var(--radius-pill);
  transition: width 0.6s ease;
}

.area-row__stats { font-size: 0.8125rem; white-space: nowrap; color: var(--color-text-muted); }

/* ── Admin ────────────────────────────────────────────────────────────────── */
.admin-quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.admin-link-card {
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  text-align: center;
  text-decoration: none;
  transition: box-shadow var(--transition-base), border-color var(--transition-base), transform var(--transition-fast);
  display: block;
}

.admin-link-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary);
  text-decoration: none;
  transform: translateY(-2px);
}

.admin-link-card--alert { border-color: #FCD34D; background: #FFFBEB; }

.admin-link-card__icon  { font-size: 2rem; margin-bottom: var(--space-xs); }
.admin-link-card__label { font-weight: 600; color: var(--color-text); }
.admin-link-card__count { font-size: 0.8125rem; color: var(--color-text-muted); margin-top: 2px; }

/* Admin data table */
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }

.admin-table th {
  text-align: left;
  padding: var(--space-sm) var(--space-md);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  border-bottom: 2px solid var(--color-border);
  white-space: nowrap;
}

.admin-table td {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.admin-table tbody tr:hover         { background: var(--color-surface-hover); }
.admin-table tbody tr:last-child td { border-bottom: none; }
.row--inactive                      { opacity: 0.5; }

/* Review queue */
.review-row {
  display: flex;
  gap: var(--space-md);
  align-items: flex-start;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--color-border);
  transition: background var(--transition-fast);
}

.review-row:last-child { border-bottom: none; }
.review-row:hover      { background: var(--color-surface-hover); }

.review-row__priority {
  width: 4px;
  min-height: 60px;
  border-radius: 4px;
  flex-shrink: 0;
  align-self: stretch;
}

.review-row__body   { flex: 1; min-width: 0; }

.review-row__title {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  margin: var(--space-xs) 0;
  text-decoration: none;
}

.review-row__title:hover { color: var(--color-primary); }

.review-row__detail {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin: var(--space-xs) 0;
  white-space: pre-wrap;
}

.review-row__raw {
  font-size: 0.8125rem;
  background: var(--color-surface);
  border-left: 3px solid var(--color-border);
  padding: var(--space-xs) var(--space-sm);
  margin-top: var(--space-xs);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.review-row__flags {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
  margin-top: var(--space-sm);
}

.review-flag {
  font-size: 0.75rem;
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FCD34D;
  border-radius: var(--radius-pill);
  padding: 2px 8px;
}

.review-row__actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  flex-shrink: 0;
}

/* ── Theme picker (admin settings) ───────────────────────────────────────── */
.theme-picker {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-top: var(--space-sm);
}

.theme-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  cursor: pointer;
}

.theme-swatch input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }

.theme-swatch__preview {
  width: 72px;
  height: 48px;
  border-radius: var(--radius-md);
  border: 2px solid var(--color-border);
  overflow: hidden;
  display: grid;
  grid-template-rows: 12px 1fr;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.theme-swatch__nav  { background: var(--swatch-nav, #1B4332); }
.theme-swatch__body { background: var(--swatch-bg, #ffffff); }

.theme-swatch input:checked + .theme-swatch__preview,
.theme-swatch__preview:hover {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 20%, transparent);
}

.theme-swatch__label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: capitalize;
}

.theme-swatch input:checked ~ .theme-swatch__label { color: var(--color-primary); }

.theme-swatch[data-theme="light"]  .theme-swatch__preview { --swatch-nav: #1B4332; --swatch-bg: #FFFFFF; }
.theme-swatch[data-theme="dark"]   .theme-swatch__preview { --swatch-nav: #111D16; --swatch-bg: #0F1D14; }
.theme-swatch[data-theme="ocean"]  .theme-swatch__preview { --swatch-nav: #0C4A6E; --swatch-bg: #F0F9FF; }
.theme-swatch[data-theme="forest"] .theme-swatch__preview { --swatch-nav: #052E16; --swatch-bg: #F0FDF4; }
.theme-swatch[data-theme="sunset"] .theme-swatch__preview { --swatch-nav: #431407; --swatch-bg: #FFF7ED; }
.theme-swatch[data-theme="mono"]   .theme-swatch__preview { --swatch-nav: #111827; --swatch-bg: #F9FAFB; }

/* ── CSV Import ───────────────────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl) var(--space-lg);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition-base), background var(--transition-base);
  position: relative;
}

.drop-zone:hover,
.drop-zone--over     { border-color: var(--color-primary); background: var(--color-nav-active-bg); }
.drop-zone--has-file { border-color: var(--color-success); background: var(--color-surface); }

.drop-zone__icon { font-size: 2.5rem; margin-bottom: var(--space-sm); }

.drop-zone__text {
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-xs);
}

.drop-zone__sub  { font-size: 0.875rem; color: var(--color-text-muted); }

.drop-zone__input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.file-info {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
}

.form-control--sm { padding: 0.3rem 0.6rem; font-size: 0.875rem; min-width: 240px; }

.preview-values { display: flex; flex-direction: column; gap: 2px; }

.preview-chip {
  display: inline-block;
  font-size: 0.75rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 1px 6px;
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-chip--empty { color: var(--color-text-muted); }

/* ── Shared helpers ───────────────────────────────────────────────────────── */
.text-danger  { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.ml-sm        { margin-left: var(--space-sm); }
.d-inline     { display: inline; }

/* ── Responsive breakpoints ───────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Sidebar goes off-screen, toggle button appears */
  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
  }

  .sidebar.is-open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .sidebar__overlay.is-open {
    display: block;
    opacity: 1;
  }

  .sidebar__toggle {
    display: flex;
  }

  /* Task rows: always show actions */
  .task-row__actions { opacity: 1; }

  /* Insight/admin grids go single column */
  .insight-grid           { grid-template-columns: 1fr; }
  .stat-grid              { grid-template-columns: repeat(2, 1fr); }
  .area-row               { grid-template-columns: 1fr; gap: var(--space-xs); }
  .area-row__bar-wrap     { height: 6px; }
  .admin-quick-links      { grid-template-columns: 1fr 1fr; }
  .review-row             { flex-wrap: wrap; }
  .review-row__actions    { flex-direction: row; }

  /* Inline grid overrides */
  div[style*="grid-template-columns:2fr 1fr"]    { grid-template-columns: 1fr !important; }
  div[style*="grid-template-columns:1fr 340px"]  { grid-template-columns: 1fr !important; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .task-tabs { gap: 4px; }
  .task-tab  { padding: 0.3rem 0.75rem; font-size: 0.8125rem; }
}
