/* =============================================================================
   INSIGHT EDITORIAL DARK — Components
   Ohio School Insight
   =============================================================================
   All reusable UI component classes: navigation, buttons, cards, search,
   badges, data tables, star ratings, metric bars, tooltips, and skeletons.
   Import after tokens.css and base.css.
   ============================================================================= */


/* =============================================================================
   NAVIGATION
   ============================================================================= */

/* -----------------------------------------------------------------------------
   Top Nav Link
   ----------------------------------------------------------------------------- */

.nav-link {
  font-size: var(--text-sm);        /* 11px */
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);  /* 0.2em */
  color: rgba(218, 226, 253, 0.7);  /* on-surface at 70% opacity */
  text-decoration: none;
  padding-bottom: 4px;
  border-bottom: 2px solid transparent;
  transition:
    color var(--duration-standard) var(--ease-editorial),
    border-color var(--duration-standard) var(--ease-editorial);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.nav-link:hover {
  color: var(--primary);
  border-bottom-color: rgba(60, 221, 199, 0.3);
}

.nav-link:visited {
  color: rgba(218, 226, 253, 0.7);
}

.nav-link.active {
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
  padding-bottom: 4px;
}

/* Sidebar nav link variant */
.nav-link-sidebar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  color: var(--on-surface-variant);
  text-decoration: none;
  transition:
    background-color var(--duration-fast) var(--ease-editorial),
    color var(--duration-fast) var(--ease-editorial);
}

.nav-link-sidebar:hover {
  background-color: var(--surface-container);
  color: var(--on-surface);
}

.nav-link-sidebar.active {
  background-color: var(--primary-container);
  color: var(--primary);
}

/* Sidebar nav icon */
.nav-link-sidebar .nav-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  opacity: 0.8;
}

.nav-link-sidebar.active .nav-icon {
  opacity: 1;
}


/* -----------------------------------------------------------------------------
   Mobile Bottom Nav Item
   ----------------------------------------------------------------------------- */

.mobile-nav-item,
.mobile-nav-item:visited {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-size: 0.625rem;   /* 10px */
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  color: var(--on-surface-variant);
  text-decoration: none;
  min-width: 64px;
  transition:
    color var(--duration-fast) var(--ease-editorial);
}

.mobile-nav-item .mobile-nav-icon {
  font-size: 1.375rem;
  line-height: 1;
  transition: transform var(--duration-fast) var(--ease-spring);
}

.mobile-nav-item:hover {
  color: var(--on-surface);
}

.mobile-nav-item.active {
  color: var(--primary);
}

.mobile-nav-item.active .mobile-nav-icon {
  transform: translateY(-2px);
}


/* =============================================================================
   BUTTONS
   ============================================================================= */

/* Base button foundation — shared properties */
.btn-base {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-size: var(--text-sm);        /* 11px */
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  padding: 10px 24px;
  border-radius: var(--radius-sm);  /* 2px — sharp editorial corners */
  border: none;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
  transition:
    background-color var(--duration-fast) var(--ease-editorial),
    color var(--duration-fast) var(--ease-editorial),
    box-shadow var(--duration-fast) var(--ease-editorial),
    opacity var(--duration-fast) var(--ease-editorial),
    transform var(--duration-instant) var(--ease-editorial);
}

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

.btn-base:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}


/* -----------------------------------------------------------------------------
   Primary Button — Teal gradient
   ----------------------------------------------------------------------------- */

.btn-primary {
  /* Inherit base font/spacing from btn-base if used together,
     or standalone with all properties included */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);

  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--on-primary-container) 100%
  );
  color: var(--on-primary);

  font-size: var(--text-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;

  transition:
    filter var(--duration-fast) var(--ease-editorial),
    box-shadow var(--duration-fast) var(--ease-editorial),
    transform var(--duration-instant) var(--ease-editorial);
}

.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: var(--glow-primary-soft);
}

.btn-primary:active {
  transform: scale(0.98);
  filter: brightness(0.95);
}

.btn-primary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}


/* -----------------------------------------------------------------------------
   Secondary Button — Raised surface
   ----------------------------------------------------------------------------- */

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);

  background-color: var(--surface-container-highest);
  color: var(--primary);

  font-size: var(--text-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;

  transition:
    background-color var(--duration-fast) var(--ease-editorial),
    color var(--duration-fast) var(--ease-editorial),
    transform var(--duration-instant) var(--ease-editorial);
}

.btn-secondary:hover {
  background-color: var(--surface-bright);
  color: var(--primary-fixed);
}

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

.btn-secondary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.btn-secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}


/* -----------------------------------------------------------------------------
   Ghost Button — Outlined, transparent background
   ----------------------------------------------------------------------------- */

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);

  background-color: transparent;
  color: var(--primary);
  border: 1px solid rgba(60, 221, 199, 0.2);

  font-size: var(--text-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  padding: 9px 24px;   /* 1px less to compensate for border */
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;

  transition:
    background-color var(--duration-fast) var(--ease-editorial),
    border-color var(--duration-fast) var(--ease-editorial),
    color var(--duration-fast) var(--ease-editorial),
    transform var(--duration-instant) var(--ease-editorial);
}

.btn-ghost:hover {
  background-color: rgba(60, 221, 199, 0.1);
  border-color: rgba(60, 221, 199, 0.5);
}

.btn-ghost:active {
  transform: scale(0.98);
  background-color: rgba(60, 221, 199, 0.15);
}

.btn-ghost:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.btn-ghost:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}


/* -----------------------------------------------------------------------------
   Tertiary Button — Text-only
   ----------------------------------------------------------------------------- */

.btn-tertiary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);

  background: none;
  color: var(--primary);
  border: none;

  font-size: var(--text-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  padding: 10px 8px;  /* Minimal horizontal padding for text-only */
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
  position: relative;

  transition:
    color var(--duration-fast) var(--ease-editorial),
    transform var(--duration-instant) var(--ease-editorial);
}

/* Underline appears only on hover */
.btn-tertiary::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 8px;
  right: 8px;
  height: 1px;
  background: var(--primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--duration-fast) var(--ease-editorial);
}

.btn-tertiary:hover {
  color: var(--primary-fixed);
}

.btn-tertiary:hover::after {
  transform: scaleX(1);
}

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

.btn-tertiary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.btn-tertiary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}


/* Button size variants */
.btn-sm {
  font-size: 0.625rem;
  padding: 6px 16px;
  letter-spacing: var(--tracking-widest);
}

.btn-lg {
  font-size: var(--text-base);
  padding: 14px 32px;
  letter-spacing: var(--tracking-wide);
}

/* Icon-only button */
.btn-icon {
  padding: 10px;
  border-radius: var(--radius-md);
  min-width: 40px;
  min-height: 40px;
}


/* =============================================================================
   CARDS
   ============================================================================= */

/* -----------------------------------------------------------------------------
   Base Card — No border, no shadow, tonal background
   ----------------------------------------------------------------------------- */

.card {
  background-color: var(--surface-container-low);
  padding: var(--space-8);           /* 2rem */
  border-radius: var(--radius-md);   /* 4px */
  /* No borders, no box-shadow — sections differentiated tonally */
}

/* Card header pattern */
.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.card-title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--on-surface);
  line-height: var(--leading-tight);
  margin: 0;
}

.card-subtitle {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  color: var(--on-surface-variant);
  margin-top: var(--space-1);
}


/* -----------------------------------------------------------------------------
   Elevated Card — Raised further from background
   ----------------------------------------------------------------------------- */

.card-elevated {
  background-color: var(--surface-container-highest);
  padding: var(--space-8);
  border-radius: var(--radius-md);
}


/* -----------------------------------------------------------------------------
   Interactive Card — Hoverable, pointer cursor
   ----------------------------------------------------------------------------- */

.card-interactive {
  background-color: var(--surface-container-low);
  padding: var(--space-8);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition:
    background-color var(--duration-standard) var(--ease-editorial),
    transform var(--duration-fast) var(--ease-editorial);
}

.card-interactive:hover {
  background-color: var(--surface-container);
}

.card-interactive:active {
  transform: scale(0.995);
}

/* Keyboard focus for interactive cards */
.card-interactive:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}


/* -----------------------------------------------------------------------------
   CTA Card — Subtle teal border, decorative gradient orb
   ----------------------------------------------------------------------------- */

.card-cta {
  background-color: var(--surface-container);
  padding: var(--space-8);
  border-radius: var(--radius-md);
  border: 1px solid rgba(60, 221, 199, 0.1);
  position: relative;
  overflow: hidden;
}

/* Decorative gradient orb in top-right corner */
.card-cta::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 160px;
  height: 160px;
  background: radial-gradient(
    circle at center,
    rgba(60, 221, 199, 0.12) 0%,
    rgba(60, 221, 199, 0.04) 50%,
    transparent 70%
  );
  pointer-events: none;
}

/* Glassmorphism card — for floating panels */
.card-glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  padding: var(--space-6);
  border-radius: var(--radius-lg);
}


/* =============================================================================
   SEARCH
   ============================================================================= */

/* -----------------------------------------------------------------------------
   Search Input
   ----------------------------------------------------------------------------- */

.search-input {
  width: 100%;
  background-color: var(--surface-container-lowest);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--on-surface);
  font-size: var(--text-base);
  font-family: var(--font-ui);
  padding: var(--space-3) var(--space-4);
  line-height: var(--leading-normal);

  transition:
    box-shadow var(--duration-fast) var(--ease-editorial);
}

.search-input::placeholder {
  color: rgba(198, 198, 205, 0.5);  /* on-surface-variant at 50% */
}

.search-input:focus {
  outline: none;
  box-shadow: 0 0 0 1px var(--primary);
}

/* Search wrapper with icon */
.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-wrapper .search-icon {
  position: absolute;
  left: var(--space-3);
  color: var(--on-surface-variant);
  font-size: 1.125rem;
  pointer-events: none;
  opacity: 0.6;
}

.search-wrapper .search-input {
  padding-left: 2.5rem;  /* Make room for icon */
}

.search-wrapper .search-clear {
  position: absolute;
  right: var(--space-3);
  color: var(--on-surface-variant);
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease-editorial);
  padding: 4px;
  border-radius: var(--radius-sm);
}

.search-wrapper:has(.search-input:not(:placeholder-shown)) .search-clear {
  opacity: 0.6;
}

.search-wrapper .search-clear:hover {
  opacity: 1;
  color: var(--on-surface);
}


/* -----------------------------------------------------------------------------
   Search Dropdown
   ----------------------------------------------------------------------------- */

.search-dropdown {
  position: absolute;
  top: calc(100% + var(--space-1));
  left: 0;
  right: 0;
  z-index: var(--z-dropdown);

  background-color: var(--surface-container-high);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-ambient);
  overflow: hidden;

  /* Fade in on appearance */
  animation: fadeSlideUp var(--duration-fast) var(--ease-decelerate) forwards;
}

.search-dropdown a {
  display: block;
  padding: 12px 16px;
  color: var(--on-surface);
  text-decoration: none;
  font-size: var(--text-base);
  transition:
    background-color var(--duration-fast) var(--ease-editorial);
  border-bottom: 1px solid rgba(69, 70, 77, 0.2);
}

.search-dropdown a:last-child {
  border-bottom: none;
}

.search-dropdown a:hover {
  background-color: var(--surface-container);
}

.search-dropdown a.active {
  background-color: var(--surface-container-high);
  color: var(--primary);
}

/* Dropdown section label */
.search-dropdown-label {
  padding: 8px 16px 4px;
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  color: var(--on-surface-variant);
  pointer-events: none;
}

/* Highlight matching text in results */
.search-dropdown mark {
  background: rgba(60, 221, 199, 0.25);
  color: var(--primary);
  border-radius: 1px;
}

/* "No results" state */
.search-dropdown-empty {
  padding: var(--space-6) var(--space-4);
  text-align: center;
  color: var(--on-surface-variant);
  font-size: var(--text-sm);
}


/* =============================================================================
   BADGES & TAGS
   ============================================================================= */

/* -----------------------------------------------------------------------------
   Badge — Teal tonal chip
   ----------------------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  background: rgba(60, 221, 199, 0.2);  /* primary at 20% */
  color: var(--primary);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;   /* 12px */
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* Badge variants */
.badge-gold {
  background: rgba(255, 198, 64, 0.2);
  color: var(--secondary);
}

.badge-error {
  background: rgba(255, 180, 171, 0.2);
  color: var(--error);
}

.badge-neutral {
  background: var(--surface-container-highest);
  color: var(--on-surface-variant);
}


/* -----------------------------------------------------------------------------
   Tag — Gold, uppercase label
   ----------------------------------------------------------------------------- */

.tag {
  display: inline-flex;
  align-items: center;
  background-color: var(--secondary);
  color: var(--on-secondary);
  padding: 4px 12px;
  font-size: 0.625rem;      /* 10px */
  font-weight: 700;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  border-radius: var(--radius-sm);
  line-height: 1.6;
  white-space: nowrap;
}

/* Outlined tag variant */
.tag-outline {
  background: transparent;
  color: var(--secondary);
  border: 1px solid rgba(255, 198, 64, 0.4);
  padding: 3px 11px;  /* -1px for border */
}


/* -----------------------------------------------------------------------------
   Status Label — Primary filled, notification-style
   ----------------------------------------------------------------------------- */

.status-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  background-color: var(--primary);
  color: var(--on-primary);
  font-size: 0.625rem;   /* 10px */
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  line-height: 1.6;
  white-space: nowrap;
}

.status-label-secondary {
  background-color: var(--secondary);
  color: var(--on-secondary);
}

.status-label-error {
  background-color: var(--error-container);
  color: var(--on-error-container);
}

/* Dot indicator before label text */
.status-label .status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: currentColor;
  opacity: 0.7;
  flex-shrink: 0;
}


/* =============================================================================
   DATA TABLE
   ============================================================================= */

.data-table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
}

/* Table header */
.data-table th {
  font-size: var(--text-sm);    /* 11px */
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  color: var(--on-surface-variant);

  /* Tonal bottom separator — no hard border aesthetic */
  border-bottom: 1px solid rgba(69, 70, 77, 0.2);
  padding: 16px 12px;
  text-align: left;

  /* Prevent header text wrapping */
  white-space: nowrap;
}

/* Sortable header */
.data-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color var(--duration-fast) var(--ease-editorial);
}

.data-table th.sortable:hover {
  color: var(--on-surface);
}

.data-table th.sorted-asc,
.data-table th.sorted-desc {
  color: var(--primary);
}

/* Sort indicator */
.data-table .sort-icon {
  display: inline-block;
  margin-left: var(--space-1);
  opacity: 0.5;
  font-size: 0.875rem;
  vertical-align: middle;
}

.data-table th.sorted-asc .sort-icon,
.data-table th.sorted-desc .sort-icon {
  opacity: 1;
  color: var(--primary);
}

/* Table cells */
.data-table td {
  padding: 24px 16px;  /* Generous vertical padding for readability */
  color: var(--on-surface);
  font-size: var(--text-base);
  vertical-align: middle;
}

/* Tonal row striping — every other row, NO borders between rows */
.data-table tr:nth-child(even) td {
  background-color: var(--surface-container-low);
}

/* Row hover — lifts to bright surface */
.data-table tr:hover td {
  background-color: var(--surface-bright);
  transition: background-color var(--duration-fast) var(--ease-editorial);
}

/* District name — editorial serif treatment */
.data-table .district-name {
  font-family: var(--font-editorial);
  font-style: italic;
  font-size: var(--text-lg);   /* 1.125rem / 18px */
  color: var(--on-surface);
  transition: color var(--duration-fast) var(--ease-editorial);
}

/* District name on hover — accent color */
.data-table tr:hover .district-name {
  color: var(--primary);
}

/* Numeric data cells — monospaced alignment */
.data-table .data-cell-numeric {
  font-variant-numeric: tabular-nums;
  text-align: right;
  font-size: var(--text-base);
}

/* Rank / position column */
.data-table .data-cell-rank {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--on-surface-variant);
  text-align: center;
  min-width: 3rem;
}

/* Delta/change indicator */
.data-table .delta-positive {
  color: var(--primary);
}

.data-table .delta-negative {
  color: var(--error);
}

/* Sticky first column for wide tables */
.data-table .col-sticky {
  position: sticky;
  left: 0;
  background-color: var(--background);
  z-index: var(--z-raised);
}

.data-table tr:nth-child(even) .col-sticky {
  background-color: var(--surface-container-low);
}

.data-table tr:hover .col-sticky {
  background-color: var(--surface-bright);
}

/* Table scroll wrapper for responsive overflow */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
}


/* =============================================================================
   STAR RATINGS
   ============================================================================= */

.star-rating {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  /* Prevent wrap */
  white-space: nowrap;
}

/* Filled star — gold */
.star-rating .star-filled {
  color: var(--secondary);  /* #ffc640 */
  font-size: 1.125rem;
  line-height: 1;
  /* Material Symbols filled variant */
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* Empty star — muted */
.star-rating .star-empty {
  color: var(--outline-variant);  /* #45464d */
  font-size: 1.125rem;
  line-height: 1;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* Rating label */
.star-rating .rating-value {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--on-surface-variant);
  margin-left: var(--space-2);
}

/* Large star rating variant */
.star-rating-lg .star-filled,
.star-rating-lg .star-empty {
  font-size: 1.5rem;
}


/* =============================================================================
   PROGRESS / METRIC BARS
   ============================================================================= */

/* Track */
.metric-bar {
  background-color: var(--surface-container-highest);
  height: 6px;
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

/* Fill — primary teal */
.metric-bar-fill {
  background-color: var(--primary);
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 600ms var(--ease-editorial);
}

/* Secondary fill — gold */
.metric-bar-fill-secondary {
  background-color: var(--secondary);
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 600ms var(--ease-editorial);
}

/* Gradient fill variant */
.metric-bar-fill-gradient {
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-fixed) 100%);
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 600ms var(--ease-editorial);
}

/* Labeled bar */
.metric-bar-labeled {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.metric-bar-labeled .metric-bar {
  flex: 1;
}

.metric-bar-labeled .metric-bar-value {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--on-surface);
  min-width: 3rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Tall bar variant for vertical charts */
.metric-bar-tall {
  height: 12px;
}

/* Stacked bar — multiple fills */
.metric-bar-stacked {
  display: flex;
  height: 6px;
  border-radius: var(--radius-full);
  overflow: hidden;
}

.metric-bar-stacked .segment {
  height: 100%;
  transition: flex var(--duration-slow) var(--ease-editorial);
}


/* =============================================================================
   TOOLTIP
   ============================================================================= */

.tooltip {
  background-color: var(--surface-container-high);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-ambient);
  color: var(--on-surface);
  font-size: 0.8125rem;   /* 13px */
  font-family: var(--font-ui);
  line-height: var(--leading-normal);

  position: absolute;
  z-index: var(--z-tooltip, 50);
  pointer-events: none;

  /* Prevent tooltip from extending beyond viewport */
  max-width: 240px;
  word-wrap: break-word;

  /* Transition for JS-driven show/hide */
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity var(--duration-fast) var(--ease-editorial),
    transform var(--duration-fast) var(--ease-editorial);
}

.tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Tooltip label */
.tooltip .tooltip-label {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--on-surface-variant);
  margin-bottom: var(--space-1);
}

/* Tooltip value */
.tooltip .tooltip-value {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--primary);
}

/* Arrow */
.tooltip::after {
  content: '';
  position: absolute;
  width: 6px;
  height: 6px;
  background: var(--surface-container-high);
  transform: rotate(45deg);
}

/* Arrow positions */
.tooltip.arrow-down::after {
  bottom: -3px;
  left: 50%;
  translate: -50% 0;
}

.tooltip.arrow-up::after {
  top: -3px;
  left: 50%;
  translate: -50% 0;
}


/* =============================================================================
   SKELETON LOADING
   ============================================================================= */

/* Base skeleton — shimmer animation defined in animations.css */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-container) 25%,
    var(--surface-container-high) 50%,
    var(--surface-container) 75%
  );
  background-size: 200% 100%;
  border-radius: var(--radius-sm);
  /* animation: shimmer 1.5s ease-in-out infinite; */
  /* Animation declared in animations.css to avoid duplication */
}

/* Inline text skeleton */
.skeleton-text {
  height: 1em;
  margin-bottom: var(--space-2);
  border-radius: var(--radius-sm);
}

/* Width presets for text skeletons */
.skeleton-text-full   { width: 100%; }
.skeleton-text-3_4    { width: 75%; }
.skeleton-text-2_3    { width: 66.666%; }
.skeleton-text-half   { width: 50%; }
.skeleton-text-third  { width: 33.333%; }

/* Heading skeleton */
.skeleton-heading {
  height: 2rem;
  margin-bottom: var(--space-4);
  border-radius: var(--radius-sm);
}

/* Circle / avatar skeleton */
.skeleton-circle {
  border-radius: var(--radius-full) !important;
  flex-shrink: 0;
}

/* Preset circle sizes */
.skeleton-circle-sm  { width: 32px;  height: 32px; }
.skeleton-circle-md  { width: 48px;  height: 48px; }
.skeleton-circle-lg  { width: 64px;  height: 64px; }

/* Rectangle block (charts, images) */
.skeleton-block {
  width: 100%;
  border-radius: var(--radius-md);
}

/* Card skeleton */
.skeleton-card {
  background-color: var(--surface-container-low);
  padding: var(--space-8);
  border-radius: var(--radius-md);
}

/* Table row skeleton */
.skeleton-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-bottom: 1px solid rgba(69, 70, 77, 0.1);
}


/* =============================================================================
   STAT CARD
   Common pattern: metric number + label + optional delta
   ============================================================================= */

.stat-card {
  background-color: var(--surface-container-low);
  padding: var(--space-6);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
}

.stat-card-overline {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  color: var(--on-surface-variant);
  margin-bottom: var(--space-2);
}

.stat-card-value {
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--on-surface);
  line-height: var(--leading-tight);
  font-variant-numeric: tabular-nums;
  margin-bottom: var(--space-1);
}

.stat-card-label {
  font-size: var(--text-base);
  color: var(--on-surface-variant);
}

.stat-card-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: var(--text-sm);
  font-weight: 700;
  margin-top: var(--space-2);
}

.stat-card-delta.positive {
  color: var(--primary);
}

.stat-card-delta.negative {
  color: var(--error);
}

/* Decorative accent line at top */
.stat-card-accent {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary) 0%, transparent 80%);
}


/* =============================================================================
   FORM CONTROLS (component-level)
   ============================================================================= */

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

.form-input {
  background-color: var(--surface-container-low);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-sm);
  color: var(--on-surface);
  font-size: var(--text-base);
  font-family: var(--font-ui);
  padding: var(--space-3) var(--space-4);
  line-height: var(--leading-normal);
  transition:
    border-color var(--duration-fast) var(--ease-editorial),
    box-shadow var(--duration-fast) var(--ease-editorial);
}

.form-input::placeholder {
  color: rgba(198, 198, 205, 0.5);
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(60, 221, 199, 0.15);
}

.form-select {
  background-color: var(--surface-container-low);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-sm);
  color: var(--on-surface);
  font-size: var(--text-base);
  font-family: var(--font-ui);
  padding: var(--space-3) var(--space-8) var(--space-3) var(--space-4);
  line-height: var(--leading-normal);
  cursor: pointer;
  /* Custom chevron */
  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='%23909097' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color var(--duration-fast) var(--ease-editorial);
}

.form-select:focus {
  outline: none;
  border-color: var(--primary);
}


/* =============================================================================
   CHIP / FILTER PILL
   ============================================================================= */

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  background-color: var(--surface-container-highest);
  color: var(--on-surface-variant);
  border: 1px solid transparent;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  cursor: pointer;
  white-space: nowrap;
  transition:
    background-color var(--duration-fast) var(--ease-editorial),
    color var(--duration-fast) var(--ease-editorial),
    border-color var(--duration-fast) var(--ease-editorial);
}

.chip:hover {
  background-color: var(--surface-bright);
  color: var(--on-surface);
}

.chip.active {
  background-color: var(--primary-container);
  color: var(--primary);
  border-color: rgba(60, 221, 199, 0.3);
}

.chip .chip-remove {
  font-size: 0.875rem;
  opacity: 0.6;
  margin-left: 2px;
  line-height: 1;
}


/* =============================================================================
   DIVIDERS (component-level)
   ============================================================================= */

/* Label divider */
.divider-label {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  color: var(--on-surface-variant);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
}

.divider-label::before,
.divider-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--outline-variant);
  opacity: 0.3;
}


/* =============================================================================
   ACCORDION / DISCLOSURE
   ============================================================================= */

.accordion-item {
  border-bottom: 1px solid rgba(69, 70, 77, 0.2);
}

.accordion-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--space-4) 0;
  background: none;
  border: none;
  color: var(--on-surface);
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: color var(--duration-fast) var(--ease-editorial);
}

.accordion-trigger:hover {
  color: var(--primary);
}

.accordion-trigger .accordion-icon {
  font-size: 1.25rem;
  color: var(--on-surface-variant);
  transition: transform var(--duration-standard) var(--ease-editorial);
  flex-shrink: 0;
}

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

.accordion-content {
  overflow: hidden;
  max-height: 0;
  transition: max-height var(--duration-standard) var(--ease-editorial);
}

.accordion-content-inner {
  padding: 0 0 var(--space-4);
  color: var(--on-surface-variant);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
}


/* =============================================================================
   SEGMENTED RATING BAR
   Row of filled/empty rectangular segments used in report card ratings.
   ============================================================================= */

.segmented-bar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: 100%;
}

.segmented-bar__segment {
  display: block;
  flex: 1;
  height: 8px;
  border-radius: 2px;
  transition: background-color 300ms var(--ease-editorial, ease);
}
