/* SEAO-HUB Design System - Tokyo Night Trading Terminal */
/* Version 1.1 - Fixed table layout */

/* ============================================================================
   Color Palette
   ========================================================================= */
:root {
  /* Base layers (depth separation) */
  --bg-base: #1a1b26;
  --bg-panel: #24283b;
  --bg-card: #1f2335;
  --bg-hover: #2d3149;

  /* Text hierarchy */
  --text-primary: #c0caf5;
  --text-secondary: #9aa5ce;
  --text-muted: #565f89;
  --text-inverse: #1a1b26;

  /* Accent (use sparingly) */
  --accent-primary: #7aa2f7;
  --accent-glow: rgba(122, 162, 247, 0.25);

  /* Semantic colors (finance terminal standard) */
  --success: #00d26a;
  --warning: #e0af68;
  --error: #f7768e;
  --info: #7dcfff;

  /* Borders and dividers */
  --border-subtle: #414868;
  --border-strong: #565f89;

  /* Spacing scale */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;

  /* Font stacks */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

  /* Transitions */
  --transition-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================================
   Base Styles
   ========================================================================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

h1 {
  font-size: 24px;
  margin-bottom: var(--space-md);
}

h2 {
  font-size: 18px;
  margin-bottom: var(--space-sm);
}

h3 {
  font-size: 16px;
  margin-bottom: var(--space-sm);
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--info);
}

/* ============================================================================
   Layout
   ========================================================================= */
.container {
  max-width: 100%;
  /* Allow full width on large screens */
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.header {
  height: 64px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  padding: 0 var(--space-lg);
}

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

.main-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: var(--space-lg);
  padding-top: var(--space-lg);
  min-height: calc(100vh - 64px);
}

.sidebar {
  position: sticky;
  top: var(--space-lg);
  height: fit-content;
}

.content {
  min-width: 0;
  /* Prevent overflow */
}

/* ============================================================================
   Cards
   ========================================================================= */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: var(--space-md);
  transition: border-color var(--transition-fast);
}

.card:hover {
  border-color: var(--border-strong);
}

.card-elevated {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.card-header {
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border-subtle);
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

/* ============================================================================
   Tables - Smart Auto Layout
   ========================================================================= */

/* Table container - scrolls internally with sticky header */
.table-container {
  width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  /* Height calcul: viewport - header (~60px) - filters (~100px) - stats (~80px) - margins (~80px) */
  max-height: calc(100vh - 320px);
  min-height: 400px;
  margin: 0;
  -webkit-overflow-scrolling: touch;
  /* Add border to show scroll context */
  border-radius: 4px;
}



.table-premium {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  /* FIXED layout = essentiel pour permettre le redimensionnement manuel */
  table-layout: fixed;
  /* Min-width garantit que les colonnes ne disparaissent jamais */
  /* Calcul: fixes (~610px) + flexibles (7 × 50px min = 350px) = ~960px, arrondi à 1200px pour confort */
  min-width: 1200px;
}

.table-premium thead {
  background: var(--bg-panel);
  position: sticky;
  top: 0;
  z-index: 10;
}

.table-premium th {
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
  /* Resize horizontal activé par table-layout: fixed + overflow */
  resize: horizontal;
  overflow: hidden;
  /* Sticky header shadow when scrolled */
  background: var(--bg-panel);
}

/* Sortable column headers */
.table-premium th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s ease;
}

.table-premium th.sortable:hover {
  color: var(--text-primary);
}

.table-premium td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Highlight row on hover */
.tender-row:hover td {
  background-color: var(--bg-hover);
}

/* --- COLONNES FIXES (Largeurs en Pixels pour stabilité) --- */

/* Dates */
.col-date {
  width: 95px;
  max-width: 95px;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 12px;
}

/* Catégorie */
.col-cat {
  width: 50px;
  max-width: 50px;
  text-align: center;
  white-space: nowrap;
}

/* Référence - FLEXIBLE */
.col-ref {
  width: 7%;
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.col-ref a {
  color: #3b82f6;
  text-decoration: underline;
}

/* Résultat */
.col-result {
  width: 150px;
  max-width: 150px;
  white-space: nowrap;
  font-family: var(--font-mono);
  text-align: right;
}

.table-premium th.col-result {
  text-align: right;
  font-family: inherit;
  width: 150px;
}

/* Écart (%) */
.col-ecart {
  width: 75px;
  max-width: 75px;
  text-align: right;
  white-space: nowrap;
  font-family: var(--font-mono);
}

.table-premium th.col-ecart {
  text-align: right;
  font-family: inherit;
  width: 75px;
  max-width: 75px;
}

/* Position / Soumissions (#) */
.col-rank {
  width: 50px;
  max-width: 50px;
  font-family: var(--font-mono);
  text-align: center;
  white-space: nowrap;
}

.table-premium th.col-rank {
  text-align: center;
  font-family: inherit;
  width: 50px;
  max-width: 50px;
}

/* Suivi */
.col-follow {
  width: 50px;
  max-width: 50px;
  text-align: center;
  white-space: nowrap;
}

th.col-follow {
  text-align: left;
}

/* Nombre de soumissions (# dans company profile) */
.col-bids {
  width: 50px;
  max-width: 50px;
  font-family: var(--font-mono);
  text-align: center;
  white-space: nowrap;
}

/* Montant soumis (company profile) - même style que col-result */
.col-amount {
  width: 150px;
  max-width: 150px;
  white-space: nowrap;
  font-family: var(--font-mono);
  text-align: right;
}


/* --- COLONNES FLEXIBLES (Pourcentages, total ~85% du restant) --- */
/* Note: En table-layout: fixed, les % s'appliquent sur la largeur totale de la table */

/* Titre - 30% */
.col-title {
  width: 30%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Sortable column headers */
.table-premium th.sortable {
  cursor: pointer;
  user-select: none;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.table-premium th.sortable:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Sort indicator */
.table-premium th .sort-icon {
  margin-left: 4px;
  font-size: 10px;
  opacity: 0.3;
  transition: opacity var(--transition-fast);
}

.table-premium th.sortable:hover .sort-icon {
  opacity: 0.6;
}

.table-premium th.sort-active .sort-icon {
  opacity: 1;
  color: var(--accent-primary);
}

/* Sticky header scroll shadow */
.table-premium thead.scrolled th {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.table-premium td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.table-premium tbody tr {
  transition: background var(--transition-fast);
}

.table-premium tbody tr:hover {
  background: var(--bg-hover);
  cursor: pointer;
}


/* Gagnant - 15% */
.col-winner {
  width: 15%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Organisme - 15% */
.col-org {
  width: 15%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #bb9af7;
  /* Tokyo Night purple */
}

.col-org a {
  color: #bb9af7 !important;
}

/* Statut - 5% */
.col-status {
  width: 8%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Région - 8% */
.col-region {
  width: 8%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Type - 8% */
.col-type {
  width: 8%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================================
   Status Colors
   ========================================================================= */
.status-text {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 6px;
  border-radius: 3px;
  display: inline-block;
  line-height: 1.2;
  border: 0.5px solid currentColor;
  background: transparent;
  white-space: nowrap;
}

.status-published {
  color: #c0caf5;
  /* Tokyo Night white */
}

.status-awaiting-results {
  color: #9d7cd8;
  /* Tokyo Night purple */
}

.status-awaiting-conclusion {
  color: #7dcfff;
  /* Tokyo Night cyan */
}

.status-concluded {
  color: #00d26a;
  /* Stock market green */
}

.status-completed {
  color: #565f89;
  /* Muted gray */
}

.status-other {
  color: #ff9e64;
  /* Tokyo Night Orange */
}

.status-available {
  color: rgba(255, 180, 128, 0.6);
  /* Pale orange */
}

.status-cancelled {
  color: #f7768e;
  /* Tokyo Night red */
}

/* Winner row */
.table-premium tr.winner td {
  color: var(--success);
  font-weight: 500;
}

/* ============================================================================
   Badges
   ========================================================================= */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.badge-success {
  background: var(--success);
  color: var(--text-inverse);
}

.badge-warning {
  background: var(--warning);
  color: var(--text-inverse);
}

.badge-warning-light {
  background: rgba(255, 158, 100, 0.25);
  color: #ffb380;
  border: 1px solid rgba(255, 158, 100, 0.4);
}

.badge-error {
  background: var(--error);
  color: var(--text-inverse);
}

.badge-neutral {
  background: var(--bg-panel);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

/* ============================================================================
   Filter Pills
   ========================================================================= */
.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.filter-pill {
  padding: 6px 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-pill:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.filter-pill.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: var(--text-inverse);
  box-shadow: 0 0 12px var(--accent-glow);
}

/* ============================================================================
   Search Input
   ========================================================================= */
.search-container {
  position: relative;
  margin-bottom: var(--space-md);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-sans);
  transition: all var(--transition-base);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-input::placeholder {
  color: var(--text-muted);
}

/* ============================================================================
   Filter Bar - Responsive Layout
   ========================================================================= */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: flex-end;
}

.filter-bar .filter-item {
  display: flex;
  flex-direction: column;
  min-width: 0;
  /* Allow shrinking */
}

.filter-bar .filter-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

/* Search field - flexible, takes remaining space */
.filter-bar .filter-search {
  flex: 1 1 200px;
  min-width: 150px;
  max-width: 400px;
}

/* Date field selector */
.filter-bar .filter-date-field {
  flex: 0 0 auto;
  min-width: 100px;
}

/* Date inputs */
.filter-bar .filter-date {
  flex: 0 0 auto;
  min-width: 130px;
}

/* Multi-select dropdowns */
.filter-bar .filter-dropdown {
  flex: 1 1 150px;
  min-width: 140px;
  max-width: 250px;
  position: relative;
}

/* Filter ordering: Category before Status */
.filter-bar .category-filter-container {
  order: 10;
}

.filter-bar .status-filter-container {
  order: 11;
}

.filter-bar .region-filter-container {
  order: 12;
}

.filter-bar .folder-filter-container {
  order: 13;
}

.filter-bar .type-filter-container {
  order: 14;
}

.filter-bar .filter-actions {
  order: 99;
}

/* Action buttons */
.filter-bar .filter-actions {
  display: flex;
  gap: var(--space-xs);
  flex: 0 0 auto;
  align-items: center;
}

/* Follow toggle pill */
.follow-filter-toggle {
  height: 38px;
  padding: 0 14px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  user-select: none;
}

.follow-filter-toggle:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.follow-filter-toggle.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
  box-shadow: 0 0 12px var(--accent-glow);
}

.filter-bar .filter-btn-primary {
  height: 38px;
  padding: 0 20px;
  background: var(--accent-primary);
  border: none;
  border-radius: 6px;
  color: white;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.filter-bar .filter-btn-primary:hover {
  background: #6b93e0;
  transform: translateY(-1px);
}

.filter-bar .filter-btn-secondary {
  height: 38px;
  padding: 0 16px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  white-space: nowrap;
}

.filter-bar .filter-btn-secondary:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

/* Dropdown button styling */
.filter-bar .filter-dropdown-btn {
  padding-left: 12px;
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

/* Responsive breakpoints */
@media (max-width: 1400px) {
  .filter-bar .filter-search {
    flex: 1 1 180px;
    max-width: 300px;
  }

  .filter-bar .filter-dropdown {
    flex: 1 1 140px;
    max-width: 200px;
  }
}

@media (max-width: 1100px) {
  .filter-bar {
    gap: var(--space-xs);
  }

  .filter-bar .filter-search {
    flex: 1 1 100%;
    max-width: none;
    order: -1;
    /* Search always first */
  }

  .filter-bar .filter-dropdown {
    flex: 1 1 calc(50% - var(--space-xs));
    max-width: none;
  }
}

@media (max-width: 768px) {

  .filter-bar .filter-date-field,
  .filter-bar .filter-date {
    flex: 1 1 calc(33% - var(--space-xs));
    min-width: 100px;
  }

  .filter-bar .filter-dropdown {
    flex: 1 1 100%;
  }

  .filter-bar .filter-actions {
    flex: 1 1 100%;
    justify-content: stretch;
  }

  .filter-bar .filter-btn-primary,
  .filter-bar .filter-btn-secondary {
    flex: 1;
    justify-content: center;
  }
}

/* ============================================================================
   Stats Bar v3 - Clean Market Ticker Style
   ========================================================================= */
.stats-ticker-grid {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  width: 100%;
  /* No outer border - avoids "container in container" look */
  background: transparent;
  border: none;
  border-radius: 0;
  margin-top: var(--space-sm);
  margin-bottom: var(--space-sm);
  overflow-x: auto;
  gap: 0;
}

/* Scrollbar styling for the ticker */
.stats-ticker-grid::-webkit-scrollbar {
  height: 4px;
}

.stats-ticker-grid::-webkit-scrollbar-track {
  background: transparent;
}

.stats-ticker-grid::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 2px;
}

.ticker-card {
  flex: 0 0 auto;
  min-width: 155px;
  background: transparent;
  padding: 8px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  /* Separator line - subtle divider */
  border-right: 1px solid var(--border-subtle);
  border-radius: 0;
  border-top: none;
  border-bottom: none;
  border-left: none;
}

.ticker-card:first-child {
  /* Same padding as other cards for uniformity */
  padding-left: 20px;
  /* Add left border like other cards for uniformity */
  border-left: 1px solid var(--border-subtle);
}

.ticker-card:last-child {
  border-right: none;
}

/* Subtle hover effect */
.ticker-card:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* Clickable KPI filter cards */
.kpi-filter-card {
  transition: all 0.2s ease;
}

.kpi-filter-card:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-1px);
}

.kpi-filter-card.active {
  border-radius: 6px;
  box-shadow: inset 0 0 0 2px var(--kpi-color, var(--accent-primary)), 0 4px 12px rgba(0, 0, 0, 0.3);
  background: rgba(255, 255, 255, 0.03);
}

.ticker-label {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 2px;
  white-space: nowrap;
}

.ticker-value-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: nowrap;
  overflow: visible;
  /* Prevent clipping */
}

.ticker-value {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.ticker-trend {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 4px;
  border-radius: 2px;
  white-space: nowrap;
}

.ticker-trend.up {
  color: var(--success);
  background: rgba(158, 206, 106, 0.15);
}

.ticker-trend.down {
  color: var(--error);
  background: rgba(247, 118, 142, 0.15);
}

.ticker-sub {
  font-size: 9px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

/* Hot List Special Style */
.measure-danger-glow {
  border-color: rgba(247, 118, 142, 0.4);
  background: linear-gradient(to bottom right, var(--bg-card), rgba(247, 118, 142, 0.05));
}

.measure-danger-glow .ticker-value {
  text-shadow: 0 0 10px rgba(247, 118, 142, 0.3);
}

.text-danger {
  color: var(--error) !important;
}

/* Loading skeleton for stats */
.stats-skeleton {
  height: 80px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

/* Sync Indicator - Compact metric pushed to far right of stats bar */
.sync-indicator {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  cursor: default;
  white-space: nowrap;
  opacity: 0.55;
  transition: opacity 0.2s ease;
}

.sync-indicator:hover {
  opacity: 0.85;
}

.sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
  animation: pulse 3s ease-in-out infinite;
}

.sync-label {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.sync-time {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}

/* ============================================================================
   Charts Grid - Responsive 5-column layout for company profile charts
   ========================================================================= */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}

.chart-item {
  min-width: 0;
  /* Allow shrinking */
}

.chart-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-container {
  height: 140px;
  position: relative;
  overflow: hidden;
}

.chart-legend {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  justify-content: center;
  font-size: 9px;
  color: var(--text-muted);
}

/* Responsive: 3 columns on medium screens */
@media (max-width: 1400px) {
  .charts-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }

  .chart-container {
    height: 120px;
  }
}

/* Responsive: 2 columns on smaller screens */
@media (max-width: 900px) {
  .charts-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .chart-container {
    height: 100px;
  }
}

/* Responsive: 1 column on mobile */
@media (max-width: 600px) {
  .charts-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .chart-container {
    height: 120px;
  }
}

/* ============================================================================
   Loading States
   ========================================================================= */
.htmx-indicator {
  display: none;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  color: var(--text-secondary);
  font-size: 13px;
}

.htmx-request .htmx-indicator {
  display: flex;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-subtle);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ============================================================================
   Utility Classes
   ========================================================================= */
.text-muted {
  color: var(--text-muted);
}

.text-secondary {
  color: var(--text-secondary);
}

.text-success {
  color: var(--success);
}

.text-warning {
  color: var(--warning);
}

.text-error {
  color: var(--error);
}

.mt-sm {
  margin-top: var(--space-sm);
}

.mt-md {
  margin-top: var(--space-md);
}

.mt-lg {
  margin-top: var(--space-lg);
}

.mb-sm {
  margin-bottom: var(--space-sm);
}

.mb-md {
  margin-bottom: var(--space-md);
}

.mb-lg {
  margin-bottom: var(--space-lg);
}

/* ============================================================================
   Responsive
   ========================================================================= */
@media (max-width: 1024px) {
  .main-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .table-premium {
    font-size: 12px;
  }

  .table-premium th,
  .table-premium td {
    padding: 8px 12px;
  }
}

/* ============================================================================
   Mon Hub - Navigation Pill
   ========================================================================= */
.nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition-fast);
  position: relative;
}

.nav-pill:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.nav-pill.active {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: rgba(122, 162, 247, 0.1);
}

.notification-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  background: var(--error);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  border-radius: 8px;
}

/* ============================================================================
   Mon Hub - Folder Menu
   ========================================================================= */
.folder-menu {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: center;
}

.folder-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.folder-tab:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
  background: var(--bg-hover);
}

.folder-tab.active {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: rgba(122, 162, 247, 0.1);
}

.folder-tab .folder-icon {
  font-size: 14px;
}

.folder-tab .folder-count {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-panel);
  padding: 2px 6px;
  border-radius: 10px;
}

.folder-group {
  /* Note: This is for the folder menu tabs, not the filter dropdown */
  /* The filter dropdown uses .folder-group but needs block layout */
  display: block;
}

.folder-children {
  display: flex;
  gap: var(--space-xs);
  margin-left: var(--space-xs);
}

.folder-child {
  padding: 4px 10px;
  font-size: 12px;
}

.folder-add {
  border-style: dashed;
}

.folder-add:hover {
  border-style: solid;
}

/* ============================================================================
   Mon Hub - Follow Checkbox
   ========================================================================= */
.col-follow {
  width: 50px;
  text-align: center;
}

/* Archived row - strikethrough on data cells only, not action columns */
tr.archived td:not(.col-follow):not(.col-folder):not(.col-share):not(.col-notes) {
  text-decoration: line-through;
}

/* Disable folder/share/notes controls in archived rows - must reactivate first */
tr.archived .folder-dropdown,
tr.archived .team-share-btn,
tr.archived .notes-btn {
  pointer-events: none;
  opacity: 0.3;
}

.follow-checkbox {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.follow-checkbox input {
  display: none;
}

.follow-icon {
  font-size: 18px;
  color: var(--text-muted);
  transition: color var(--transition-fast), transform var(--transition-fast);
}

.follow-checkbox:hover .follow-icon {
  color: var(--warning);
  transform: scale(1.1);
}

.follow-checkbox input:checked+.follow-icon {
  color: var(--warning);
}

/* ============================================================================
   Mon Hub - Folder Select Dropdown
   ========================================================================= */
.col-folder {
  width: 120px;
}

.folder-select {
  width: 100%;
  padding: 4px 24px 4px 8px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 12px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--transition-fast);
  /* Dark theme for dropdown */
  color-scheme: dark;
  /* Custom arrow */
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23787c99' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
}

.folder-select:hover {
  border-color: var(--border-strong);
  background-color: var(--bg-hover);
}

.folder-select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(122, 162, 247, 0.2);
}

/* Dark theme for dropdown options */
.folder-select option {
  background: #1a1b26;
  color: #c0caf5;
  padding: 8px 12px;
}

.folder-select option:hover,
.folder-select option:focus,
.folder-select option:checked {
  background: #292e42;
  color: #7aa2f7;
}

.folder-select optgroup {
  background: #1a1b26;
  color: #565f89;
  font-weight: 600;
  font-style: normal;
}

/* Custom Folder Dropdown (Tokyo Night themed) */
.folder-dropdown {
  position: relative;
  display: inline-block;
  width: 100%;
}

/* Allow dropdowns to overflow outside table cells */
.table-premium td.col-folder,
.table-premium td.col-shared,
.table-premium td.col-notes {
  overflow: visible;
}

.folder-dropdown-btn {
  width: 100%;
  padding: 4px 24px 4px 8px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 12px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
}

.folder-dropdown-btn::after {
  content: '';
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--text-muted);
  transition: transform var(--transition-fast);
}

.folder-dropdown.open .folder-dropdown-btn::after {
  transform: translateY(-50%) rotate(180deg);
}

.folder-dropdown-btn:hover {
  border-color: var(--border-strong);
  background: var(--bg-hover);
}

.folder-dropdown.open .folder-dropdown-btn {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(122, 162, 247, 0.2);
}

.folder-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 160px;
  max-height: 240px;
  overflow-y: auto;
  background: #1a1b26;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: none;
}

.folder-dropdown.open .folder-dropdown-menu {
  display: block;
}

.folder-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: #c0caf5;
  font-size: 12px;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.folder-dropdown-item:first-child {
  border-radius: 5px 5px 0 0;
}

.folder-dropdown-item:last-child {
  border-radius: 0 0 5px 5px;
}

.folder-dropdown-item:hover,
.folder-dropdown-item:focus {
  background: #292e42;
  outline: none;
}

.folder-dropdown-item.selected {
  background: rgba(122, 162, 247, 0.15);
  color: #7aa2f7;
}

.folder-dropdown-item.selected::before {
  content: '✓';
  margin-right: 4px;
  font-size: 10px;
}

.folder-dropdown-item.child {
  padding-left: 24px;
  color: #a9b1d6;
  font-size: 11px;
}

.folder-dropdown-item.child::before {
  content: '└';
  color: #565f89;
  margin-right: 4px;
}

.folder-dropdown-item.child.selected::before {
  content: '✓';
  color: #7aa2f7;
}

/* ============================================================================
   Mon Hub - Modal
   ========================================================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: var(--space-lg);
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

/* Form elements for modal */
.form-group {
  margin-bottom: var(--space-md);
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.form-group input[type="text"],
.form-group select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-sans);
}

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

/* Color picker */
.color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.color-option {
  cursor: pointer;
}

.color-option input {
  display: none;
}

.color-swatch {
  display: block;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: all var(--transition-fast);
}

.color-option:hover .color-swatch {
  transform: scale(1.1);
}

.color-option input:checked+.color-swatch {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--accent-primary);
}

/* Icon picker */
.icon-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.icon-option {
  cursor: pointer;
}

.icon-option input {
  display: none;
}

.icon-display {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: 18px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  transition: all var(--transition-fast);
}

.icon-option:hover .icon-display {
  border-color: var(--border-strong);
  background: var(--bg-hover);
}

.icon-option input:checked+.icon-display {
  border-color: var(--accent-primary);
  background: rgba(122, 162, 247, 0.1);
}

/* Buttons */
.btn {
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
}

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

.btn-primary:hover {
  background: #6890e0;
}

.btn-secondary {
  background: var(--bg-panel);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ============================================================================
   Team Hub Styles
   ========================================================================= */

/* Duplicate shared tenders indicator */
.shared-duplicate {
  border-left: 3px solid #bb9af7 !important;
  background: rgba(187, 154, 247, 0.03);
}

.shared-duplicate:hover {
  background: rgba(187, 154, 247, 0.08) !important;
}

/* Duplicate badge */
.duplicate-badge {
  font-size: 10px;
  margin-left: 4px;
  opacity: 0.8;
}

/* Contributor column */
.col-contributor {
  white-space: nowrap;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Share checkbox */
.share-checkbox {
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: var(--accent-primary);
}

.share-checkbox:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Notes column */
.col-notes {
  width: 60px;
  text-align: center;
  white-space: nowrap;
}

.notes-btn {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.notes-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.notes-btn.has-unread {
  background: rgba(247, 118, 142, 0.25);
  border-color: var(--error);
  color: #ff6b8a;
  font-weight: 600;
  animation: pulse-unread 2s ease-in-out infinite;
}

@keyframes pulse-unread {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(247, 118, 142, 0.4);
  }

  50% {
    box-shadow: 0 0 8px 2px rgba(247, 118, 142, 0.3);
  }
}

/* Notes dropdown */
.notes-dropdown {
  position: absolute;
  right: 0;
  top: 100%;
  width: 350px;
  max-height: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  overflow: hidden;
}

.notes-dropdown-content {
  display: flex;
  flex-direction: column;
  max-height: 400px;
}

.notes-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
}

.notes-list {
  flex: 1;
  overflow-y: auto;
  max-height: 280px;
}

.note-item {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.note-item:last-child {
  border-bottom: none;
}

.note-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  font-size: 11px;
}

.note-author {
  font-weight: 600;
  color: var(--accent-primary);
}

.note-time {
  color: var(--text-muted);
}

.note-content {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.4;
}

.notes-input {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-panel);
}

.notes-input input {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 13px;
}

.notes-input input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.notes-input button {
  padding: 8px 16px;
  background: var(--accent-primary);
  border: none;
  border-radius: 4px;
  color: white;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.notes-input button:hover {
  background: #6890e0;
}

/* Shared column */
.col-shared {
  width: 60px;
  text-align: center;
}

/* Team Share Dropdown (multi-team) */
.team-share-dropdown {
  position: relative;
  display: inline-block;
}

.team-share-btn {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  min-width: 32px;
}

.team-share-btn:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.team-share-count {
  font-family: var(--font-mono);
}

.team-share-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 100;
  min-width: 160px;
  padding: 8px 0;
}

.team-share-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
  transition: background var(--transition-fast);
  white-space: nowrap;
}

.team-share-item:hover {
  background: var(--bg-hover);
}

.team-share-item input[type="checkbox"] {
  accent-color: var(--accent-primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
}