/* Cards & Editorial Surfaces */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-lg);
  min-width: 0;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-hairline);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--color-text);
}

.card-body {
  padding: var(--space-4);
}

/* Editorial Hero Telemetry Band */
.hero-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  padding: var(--space-2) 0 var(--space-4);
  align-items: center;
}

@media (min-width: 768px) {
  .hero-band {
    grid-template-columns: 200px minmax(0, 1fr);
    gap: var(--space-8);
    padding: var(--space-2) 0;
  }
}

.hero-metric-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-1);
  border: 0;
  border-bottom: 1px solid var(--color-hairline);
  background: transparent;
  padding: var(--space-1) 0 var(--space-4);
  text-align: left;
  transition: transform 0.2s var(--ease-out-expo), opacity 0.2s ease;
}

@media (min-width: 768px) {
  .hero-metric-btn {
    border-bottom: 0;
    border-right: 1px solid var(--color-hairline);
    padding: var(--space-1) var(--space-6) var(--space-1) 0;
  }
}

.hero-metric-btn:hover {
  transform: translateY(-2px);
}

.hero-eyebrow {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-muted);
}

.hero-number {
  font-size: 52px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}

@media (min-width: 768px) {
  .hero-number {
    font-size: 62px;
  }
}

.hero-caption {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.hero-caption svg {
  width: 13px;
  height: 13px;
  color: var(--color-text-muted);
  transition: transform 0.2s var(--ease-out-expo), color 0.2s ease;
}

.hero-metric-btn:hover .hero-caption svg {
  transform: translateX(3px);
  color: var(--color-text);
}

/* 3-Segment Glowing SLA Bar Panel */
.sla-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.sla-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
}

.sla-header-main {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-2);
  font-size: 14px;
}

.sla-bar-percent {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-success);
  font-variant-numeric: tabular-nums;
}

.sla-header-sub {
  font-size: 13px;
  color: var(--color-text-muted);
}

.sla-segments-wrap {
  position: relative;
  padding: 4px;
  border-radius: 14px;
  background: #F5F6F9;
  border: 1px solid var(--color-hairline);
}

.sla-segments-glow {
  position: absolute;
  inset: 8px 16px -8px 16px;
  border-radius: 16px;
  background: linear-gradient(90deg, rgba(52, 211, 153, 0.45) 0%, rgba(251, 191, 36, 0.42) 60%, rgba(248, 113, 113, 0.48) 100%);
  filter: blur(14px);
  opacity: 0.45;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.sla-segments-wrap:hover .sla-segments-glow {
  opacity: 0.72;
}

.sla-segments {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: stretch;
  gap: 4px;
  height: 32px;
  width: 100%;
}

.sla-seg {
  border: 0;
  padding: 0 var(--space-2);
  border-radius: 10px;
  min-width: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transform-origin: left center;
  animation: barGrowX 0.65s var(--ease-out-expo) both;
  transition: transform 0.2s var(--ease-spring), filter 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
  white-space: nowrap;
}

.sla-seg:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65), 0 4px 12px rgba(17, 19, 21, 0.08);
}

.sla-seg--ok {
  background: linear-gradient(135deg, #34D399 0%, #6EE7B7 100%);
  color: #064E3B;
}

.sla-seg--soon {
  background: linear-gradient(135deg, #FBBF24 0%, #FDE047 100%);
  color: #78350F;
}

.sla-seg--overdue {
  background: linear-gradient(135deg, #F87171 0%, #FCA5A5 100%);
  color: #7F1D1D;
}

.sla-seg--empty {
  width: 100%;
  background: linear-gradient(135deg, #A7F3D0 0%, #6EE7B7 100%);
  color: #065F46;
}

.sla-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
}

.sla-legend-items {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-3);
}

.sla-legend-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  margin-left: -8px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  font-size: 12px;
  color: var(--color-text-secondary);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.sla-legend-btn:hover {
  background: var(--color-surface-subtle);
  color: var(--color-text);
}

.sla-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sla-legend-dot--ok { background: #10B981; box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.16); }
.sla-legend-dot--soon { background: #F59E0B; box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.16); }
.sla-legend-dot--overdue { background: #EF4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.16); }

.sla-legend-count {
  font-weight: 600;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}

.sla-legend-total {
  font-size: 12px;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

/* 3-Column Hairline KPI Strip */
.kpi-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  border-top: 1px solid var(--color-hairline);
  border-bottom: 1px solid var(--color-hairline);
}

@media (min-width: 768px) {
  .kpi-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.kpi-strip-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-2);
  border: 0;
  border-bottom: 1px solid var(--color-hairline);
  background: transparent;
  text-align: left;
  width: 100%;
  transition: background-color 0.2s ease, transform 0.2s var(--ease-out-expo);
}

.kpi-strip-item:last-child {
  border-bottom: 0;
}

@media (min-width: 768px) {
  .kpi-strip-item {
    padding: var(--space-6) var(--space-6);
    border-bottom: 0;
    border-right: 1px solid var(--color-hairline);
  }

  .kpi-strip-item:first-child {
    padding-left: var(--space-2);
  }

  .kpi-strip-item:last-child {
    border-right: 0;
    padding-right: var(--space-2);
  }
}

.kpi-strip-item:hover {
  background: var(--color-surface-subtle);
}

.kpi-strip-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.kpi-strip-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  width: 100%;
}

.kpi-strip-value-group {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.kpi-dir-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  color: #FFFFFF;
  flex-shrink: 0;
  transition: transform 0.2s var(--ease-spring);
}

.kpi-strip-item:hover .kpi-dir-badge {
  transform: scale(1.1);
}

.kpi-dir-badge svg {
  width: 14px;
  height: 14px;
}

.kpi-dir-badge--danger {
  background: #DC4C4C;
}

.kpi-dir-badge--success {
  background: #22A06B;
}

.kpi-dir-badge--amber {
  background: #D97706;
}

.kpi-strip-number {
  font-size: 28px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.025em;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}

.kpi-strip-delta {
  font-size: 12px;
  font-weight: 500;
}

/* Legacy KPI Grid (kept responsive if needed) */
.kpi-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-lg);
  text-align: left;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s var(--ease-out-expo);
}

.kpi-card:hover {
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

/* Editorial Section Blocks (No Heavy Box Borders) */
.editorial-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

.editorial-panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.editorial-panel-title-group {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-3);
}

.editorial-panel-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--color-text);
}

.editorial-panel-meta {
  font-size: 13px;
  color: var(--color-text-muted);
}

.editorial-panel-meta strong {
  color: var(--color-text);
  font-weight: 600;
}

.editorial-divider-top {
  border-top: 1px solid var(--color-hairline);
  padding-top: var(--space-6);
}

/* Segmented Obsidian Pill Toggle */
.segmented-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-hairline);
  background: var(--color-surface);
  gap: 2px;
}

.segmented-pill-btn {
  border: 0;
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  min-height: 30px;
  font-size: 12px;
  font-weight: 500;
  background: transparent;
  color: var(--color-text-secondary);
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.segmented-pill-btn:hover {
  color: var(--color-text);
}

.segmented-pill-btn[aria-pressed="true"] {
  background: var(--color-primary);
  color: #FFFFFF;
  box-shadow: var(--shadow-xs);
}

/* Editorial Rows (Reference Top Learners style) */
.editorial-list {
  display: flex;
  flex-direction: column;
}

.editorial-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-2);
  border: 0;
  border-bottom: 1px solid var(--color-hairline);
  border-radius: var(--radius-md);
  background: transparent;
  width: 100%;
  text-align: left;
  transition: background-color 0.18s ease, transform 0.18s var(--ease-out-expo);
}

.editorial-row:last-child {
  border-bottom: 0;
}

.editorial-row:hover {
  background: var(--color-surface-subtle);
  transform: translateX(2px);
}

.editorial-row.is-overdue {
  background: linear-gradient(90deg, rgba(254, 242, 242, 0.55) 0%, transparent 45%);
}

.editorial-row.is-overdue:hover {
  background: #FEF2F2;
}

.editorial-row-identity {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1 1 220px;
  min-width: 0;
}

.entity-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}

.entity-avatar--indigo { background: #EEF2FF; color: #3730A3; }
.entity-avatar--emerald { background: #ECFDF5; color: #065F46; }
.entity-avatar--amber { background: #FFFBEB; color: #92400E; }
.entity-avatar--rose { background: #FFF1F2; color: #9F1239; }
.entity-avatar--sky { background: #F0F9FF; color: #075985; }
.entity-avatar--violet { background: #F5F3FF; color: #5B21B6; }

.editorial-row-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.editorial-row-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editorial-row-sub {
  font-size: 12px;
  color: var(--color-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editorial-row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.editorial-date-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--color-text-secondary);
  white-space: nowrap;
}

.editorial-date-chip svg {
  width: 14px;
  height: 14px;
  color: var(--color-text-muted);
}

/* Signal Pill Badge (Beginner/Intermediate/Expert aesthetic) */
.pill-signal {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 8px;
  background: var(--color-surface-subtle);
  border: 1px solid var(--color-hairline);
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
}

.pill-signal--danger {
  background: var(--color-danger-soft);
  border-color: var(--color-danger-border);
  color: var(--color-danger);
}

.pill-signal--warning {
  background: var(--color-warning-soft);
  border-color: var(--color-warning-border);
  color: var(--color-warning);
}

.pill-signal--success {
  background: var(--color-success-soft);
  border-color: var(--color-success-border);
  color: var(--color-success);
}

/* Circular SVG Progress Ring */
.ring-metric {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 72px;
}

.progress-ring {
  width: 28px;
  height: 28px;
  transform: rotate(-90deg);
  flex-shrink: 0;
}

.progress-ring-track {
  fill: none;
  stroke: var(--color-ring-track);
  stroke-width: 3;
}

.progress-ring-fill {
  fill: none;
  stroke: var(--color-ring);
  stroke-width: 3;
  stroke-linecap: round;
  animation: ringDraw 0.75s var(--ease-out-expo) both;
}

.progress-ring-fill--danger {
  stroke: #F87171;
}

.progress-ring-fill--success {
  stroke: #34D399;
}

.ring-metric-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}

/* 6-Petal Luminous Radial Visualization */
.petal-chart-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2) 0;
}

.petal-stage {
  position: relative;
  width: min(320px, 100%);
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.petal-node {
  position: absolute;
  left: calc(50% + var(--tx, 0px));
  top: calc(50% + var(--ty, 0px));
  width: 112px;
  height: 112px;
  margin-left: -56px;
  margin-top: -56px;
  border-radius: 30px;
  border: 1px solid rgba(229, 231, 235, 0.85);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(17, 19, 21, 0.04);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: var(--space-2);
  text-align: center;
  transition: transform 0.28s var(--ease-spring), box-shadow 0.25s ease, border-color 0.2s ease;
  animation: petalBloom 0.55s var(--ease-out-expo) both;
  animation-delay: calc(var(--stagger, 0) * 60ms);
  overflow: hidden;
}

.petal-node::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0.45;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.petal-node--good::before {
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 85%), rgba(74, 222, 128, 0.55) 0%, rgba(134, 239, 172, 0.16) 52%, transparent 78%);
}

.petal-node--mid::before {
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 85%), rgba(251, 191, 36, 0.55) 0%, rgba(253, 224, 71, 0.16) 52%, transparent 78%);
}

.petal-node--low::before {
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 85%), rgba(248, 113, 113, 0.58) 0%, rgba(252, 165, 165, 0.16) 52%, transparent 78%);
}

.petal-node:hover {
  z-index: 6;
  transform: scale(1.06);
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-md);
}

.petal-node:hover::before {
  opacity: 0.72;
}

.petal-pct {
  position: relative;
  z-index: 1;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.15;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}

.petal-name {
  position: relative;
  z-index: 1;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--color-text-secondary);
  max-width: 94px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.petal-count {
  position: relative;
  z-index: 1;
  font-size: 10px;
  color: var(--color-text-muted);
}

.petal-center {
  position: relative;
  z-index: 5;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 1px solid var(--color-hairline);
  box-shadow: 0 6px 20px rgba(17, 19, 21, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
}

.petal-center svg {
  width: 18px;
  height: 18px;
}

@media (max-width: 400px) {
  .petal-stage {
    width: 280px;
  }

  .petal-node {
    left: calc(50% + var(--tx, 0px) * 0.84);
    top: calc(50% + var(--ty, 0px) * 0.84);
    width: 94px;
    height: 94px;
    margin-left: -47px;
    margin-top: -47px;
    border-radius: 24px;
  }

  .petal-node:hover {
    transform: scale(1.05);
  }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 38px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.16s var(--ease-spring), box-shadow 0.2s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.btn-primary {
  background: var(--color-primary);
  color: #FFFFFF;
  box-shadow: var(--shadow-xs);
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  box-shadow: 0 6px 16px rgba(17, 19, 21, 0.16);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn-secondary:hover {
  background: var(--color-surface-subtle);
  border-color: var(--color-border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
}

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

.btn-circle {
  width: 38px;
  height: 38px;
  min-width: 38px;
  padding: 0;
  border-radius: 50%;
  background: var(--color-surface-subtle);
  color: var(--color-text-secondary);
  border: 1px solid transparent;
}

.btn-circle:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
}

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

.btn-danger:hover {
  background: var(--color-danger-hover);
}

.btn-danger-outline {
  background: var(--color-surface);
  color: var(--color-danger);
  border-color: var(--color-danger-border);
}

.btn-danger-outline:hover {
  background: var(--color-danger-soft);
}

.btn-active-filter {
  background: var(--color-danger-soft);
  color: var(--color-danger);
  border-color: var(--color-danger-border);
  font-weight: 600;
}

.btn-sm {
  min-height: 32px;
  padding: 0 var(--space-3);
  font-size: 12px;
}

.btn-icon {
  min-width: 36px;
  padding: 0;
  position: relative;
}

.btn-link {
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--color-text);
  font-weight: 600;
  text-align: left;
  display: inline;
  text-decoration: underline;
  text-decoration-color: var(--color-border-strong);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s ease, color 0.15s ease;
}

.btn-link:hover {
  color: var(--color-primary);
  text-decoration-color: var(--color-primary);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 3px var(--space-2);
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  white-space: nowrap;
}

.badge-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--color-neutral-soft);
  color: var(--color-text-secondary);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.badge-new {
  background: var(--color-info-soft);
  color: var(--color-info);
  border-color: var(--color-info-border);
}

.badge-assigned {
  background: var(--color-purple-soft);
  color: var(--color-purple);
  border-color: var(--color-purple-border);
}

.badge-progress {
  background: var(--color-warning-soft);
  color: var(--color-warning);
  border-color: var(--color-warning-border);
}

.badge-review {
  background: #EEF2FF;
  color: #3730A3;
  border-color: #C7D2FE;
}

.badge-done {
  background: var(--color-success-soft);
  color: var(--color-success);
  border-color: var(--color-success-border);
}

.badge-cancelled {
  background: var(--color-neutral-soft);
  color: var(--color-text-secondary);
  border-color: var(--color-neutral-border);
}

.badge-danger {
  background: var(--color-danger-soft);
  color: var(--color-danger);
  border-color: var(--color-danger-border);
}

.badge-warning {
  background: var(--color-warning-soft);
  color: var(--color-warning);
  border-color: var(--color-warning-border);
}

.badge-success {
  background: var(--color-success-soft);
  color: var(--color-success);
  border-color: var(--color-success-border);
}

.badge-neutral {
  background: var(--color-surface-subtle);
  color: var(--color-text-secondary);
  border-color: var(--color-hairline);
}

/* Notification Bell Badge */
.notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  background: var(--color-danger);
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  border: 1.5px solid #FFFFFF;
}

/* Inputs & Form Controls */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

.field-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

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

.input-control,
.textarea-control {
  width: 100%;
  min-height: 38px;
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: 14px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

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

.input-control:hover,
.textarea-control:hover {
  border-color: var(--color-border-strong);
}

.input-control:focus,
.textarea-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(17, 19, 21, 0.08);
}

.input-control[aria-invalid="true"],
.textarea-control[aria-invalid="true"],
.custom-select-trigger[aria-invalid="true"] {
  border-color: var(--color-danger);
}

.field-error {
  font-size: 12px;
  color: var(--color-danger);
  min-height: 16px;
}

.field-hint {
  font-size: 12px;
  color: var(--color-text-muted);
}

/* Search Input with Icon */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
}

.search-box-icon {
  position: absolute;
  left: var(--space-3);
  color: var(--color-text-muted);
  pointer-events: none;
  display: flex;
}

.search-box-icon svg {
  width: 16px;
  height: 16px;
}

.search-box .input-control {
  padding-left: 36px;
  border-radius: var(--radius-pill);
}

/* Filter Bar */
.filter-bar {
  background: var(--color-surface);
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.filter-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-2);
}

.filter-actions-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.filter-actions-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

@media (min-width: 640px) {
  .filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
  }
}

@media (min-width: 1024px) {
  .filter-bar {
    padding: var(--space-4);
  }

  .filter-grid {
    grid-template-columns: 1.5fr repeat(4, minmax(0, 1fr));
    align-items: end;
  }
}

/* Custom Select */
.custom-select {
  position: relative;
  width: 100%;
  min-width: 0;
}

.custom-select-trigger {
  width: 100%;
  min-height: 38px;
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  text-align: left;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.custom-select-trigger:hover {
  border-color: var(--color-border-strong);
}

.custom-select-trigger[aria-expanded="true"] {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(17, 19, 21, 0.08);
}

.custom-select-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
  min-width: 0;
}

.custom-select-value.is-placeholder {
  color: var(--color-text-muted);
}

.custom-select-chevron {
  width: 16px;
  height: 16px;
  color: var(--color-text-muted);
  flex-shrink: 0;
  transition: transform 0.2s var(--ease-out-expo);
}

.custom-select-trigger[aria-expanded="true"] .custom-select-chevron {
  transform: rotate(180deg);
}

.custom-select-menu {
  position: fixed;
  z-index: var(--z-select-menu);
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-1);
  max-height: 260px;
  overflow-y: auto;
  margin: 0;
  animation: dropdownReveal 0.18s var(--ease-out-expo) both;
}

.custom-select-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  min-height: 36px;
  transition: background-color 0.12s ease;
}

.custom-select-option svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: var(--color-primary);
}

.custom-select-option.is-active {
  background: var(--color-surface-subtle);
}

.custom-select-option[aria-selected="true"] {
  background: var(--color-surface-hover);
  color: var(--color-text);
  font-weight: 600;
}

.custom-select-option-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.custom-select-option-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-option-meta {
  font-size: 11px;
  font-weight: 400;
  color: var(--color-text-muted);
}

/* Editorial Data Table (Desktop) */
.table-container {
  background: var(--color-surface);
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.data-table th {
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-hairline);
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.data-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-hairline);
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr {
  transition: background-color 0.15s ease;
}

.data-table tbody tr:hover {
  background: var(--color-surface-subtle);
}

.data-table tbody tr.is-overdue {
  background: #FFF9F9;
}

.data-table tbody tr.is-overdue:hover {
  background: #FEF2F2;
}

/* Mobile Cards */
.entity-card {
  background: var(--color-surface);
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.entity-card.is-overdue {
  border-color: var(--color-danger-border);
  background: #FFFBFB;
}

.entity-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
}

.entity-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.35;
}

.entity-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  font-size: 12px;
  color: var(--color-text-secondary);
}

.entity-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-hairline);
}

/* Workload Bars (used in Staff mobile cards & detail) */
.workload-bar-track {
  width: 100%;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--color-neutral-soft);
  overflow: hidden;
}

.workload-bar-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--color-ring);
  transition: width 0.35s var(--ease-out-expo);
}

.workload-bar-fill.is-high {
  background: var(--color-warning);
}

.workload-bar-fill.is-critical {
  background: var(--color-danger);
}

/* Urgent List (used in Building & Staff detail modals) */
.urgent-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.urgent-item {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3);
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  text-align: left;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.urgent-item:hover {
  border-color: var(--color-border-strong);
  background: var(--color-surface-subtle);
}

.urgent-item.is-overdue {
  border-left: 3px solid var(--color-danger);
}

.urgent-item-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(17, 19, 21, 0.42);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2);
  animation: backdropFadeIn 0.2s ease both;
}

.modal-dialog {
  width: min(760px, calc(100vw - 16px));
  max-height: calc(100vh - 24px);
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--color-hairline);
  animation: modalSpringIn 0.28s var(--ease-out-expo) both;
}

.modal-dialog--sm {
  width: min(480px, calc(100vw - 16px));
}

.modal-dialog--lg {
  width: min(920px, calc(100vw - 16px));
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--color-hairline);
}

.modal-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.35;
}

.modal-subtitle {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.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;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-top: 1px solid var(--color-hairline);
  background: var(--color-surface-subtle);
}

@media (max-width: 639px) {
  .modal-header,
  .modal-body,
  .modal-footer {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }
}

/* Banners / Alerts */
.alert-banner {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 13px;
}

.alert-banner svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.alert-banner--danger {
  background: var(--color-danger-soft);
  border-color: var(--color-danger-border);
  color: var(--color-danger);
}

.alert-banner--warning {
  background: var(--color-warning-soft);
  border-color: var(--color-warning-border);
  color: var(--color-warning);
}

.alert-banner--info {
  background: var(--color-info-soft);
  border-color: var(--color-info-border);
  color: var(--color-info);
}

/* Detail Metadata Grid */
.meta-dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--color-surface-subtle);
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-md);
}

.meta-dl dt {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-muted);
}

.meta-dl dd {
  margin-top: 2px;
  font-size: 13px;
  color: var(--color-text);
  word-break: break-word;
}

/* Comments & Audit Log */
.comment-list,
.timeline-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.comment-item {
  padding: var(--space-3);
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-md);
  background: var(--color-surface-subtle);
}

.comment-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: 12px;
  margin-bottom: var(--space-1);
}

.timeline-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-2) var(--space-3);
  border-left: 2px solid var(--color-border-strong);
  background: var(--color-surface-subtle);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 12px;
}

/* Notification Popover */
.notif-wrapper {
  position: relative;
}

.notif-popover {
  position: fixed;
  top: calc(var(--topbar-height) + var(--space-1));
  right: var(--space-2);
  width: min(380px, calc(100vw - 16px));
  max-height: min(500px, calc(100vh - 80px));
  z-index: var(--z-popover);
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(14px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: dropdownReveal 0.2s var(--ease-out-expo) both;
}

.notif-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-3);
  border-bottom: 1px solid var(--color-hairline);
}

.notif-popover-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.notif-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3);
  border-bottom: 1px solid var(--color-hairline);
  background: var(--color-surface);
  transition: background-color 0.15s ease;
}

.notif-item.is-unread {
  background: var(--color-surface-subtle);
}

.notif-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: 11px;
}

.notif-item-btn {
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
}

.notif-item-btn:hover .notif-item-title {
  text-decoration: underline;
}

.notif-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
}

.notif-item-text {
  font-size: 12px;
  color: var(--color-text-secondary);
}

/* Switch Controls */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.switch-btn {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: var(--radius-pill);
  border: 0;
  background: var(--color-border-strong);
  transition: background-color 0.2s ease;
  flex-shrink: 0;
  padding: 0;
}

.switch-btn[aria-checked="true"] {
  background: var(--color-primary);
}

.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease-spring);
}

.switch-btn[aria-checked="true"] .switch-thumb {
  transform: translateX(20px);
}

/* Radio Cards */
.radio-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.radio-card:has(input:checked) {
  border-color: var(--color-primary);
  background: var(--color-surface-subtle);
}

/* Empty State */
.empty-state {
  background: var(--color-surface-subtle);
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-lg);
  padding: var(--space-8) var(--space-4);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}

.empty-state-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
}

.empty-state-desc {
  font-size: 13px;
  color: var(--color-text-secondary);
  max-width: 420px;
}

/* Toast Notifications */
.toast-stack {
  position: fixed;
  right: var(--space-3);
  bottom: calc(var(--bottom-nav-height) + var(--space-3));
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: min(360px, calc(100vw - 24px));
  pointer-events: none;
}

@media (min-width: 1024px) {
  .toast-stack {
    bottom: var(--space-4);
    right: var(--space-4);
  }
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: #FFFFFF;
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  animation: toastSlideIn 0.25s var(--ease-out-expo) both;
}

.toast--success {
  background: #065F46;
}

.toast--error {
  background: #991B1B;
}

.toast-close {
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  padding: 0;
  display: inline-flex;
  align-items: center;
}

/* Utility Rows */
.row-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.stack-sm {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.stack-md {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Mobile touch targets (>= 44x44 px) — placed last to win cascade */
@media (max-width: 767px) {
  .btn,
  .btn-sm,
  .custom-select-trigger,
  .input-control,
  .switch-row {
    min-height: 44px;
  }

  .btn-icon,
  .btn-circle {
    min-width: 44px;
    min-height: 44px;
  }
}
