/* ==========================================================================
   ClimaX Weather AI Platform - Dark Theme Design System
   Ported from AgroClimaX Design Kit
   ========================================================================== */

/* --------------------------------------------------------------------------
   Google Fonts - Inter (300-700)
   -------------------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* --------------------------------------------------------------------------
   CSS Custom Properties (Design Tokens)
   -------------------------------------------------------------------------- */
:root {
  --header-height: 110px;
  --header-current-height: var(--header-height);
  --bg: #0f1117;
  --surface: #1a1d2e;
  --surface2: #242740;
  --border: #2e3150;
  --text: #e2e8f0;
  --text-muted: #a0aabf;  /* H5.11: darkened from #8892a4 for AAA contrast on --surface */
  --accent: #4a90d9;
  --verde: #2ecc71;
  --amarillo: #f1c40f;
  --naranja: #e67e22;
  --rojo: #e74c3c;

  /* Sidebar dimensions */
  --sidebar-width-collapsed: 68px;
  --sidebar-width-expanded: 280px;
  --sidebar-current-width: var(--sidebar-width-collapsed);

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 28px;
  --space-8: 32px;

  /* Border radius */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.22s ease;
  --transition-slow: 0.35s ease;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);

  /* Z-index scale */
  --z-sidebar: 1000;
  --z-header: 1100;
  --z-dropdown: 1200;
  --z-modal: 1300;
  --z-tooltip: 1400;
}

/* --------------------------------------------------------------------------
   1. Reset & Base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

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

a:hover {
  color: #5da0e8;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul, ol {
  list-style: none;
}

input, button, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  outline: none;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}

h1 { font-size: 1.4rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
h4 { font-size: 0.92rem; }

p {
  margin-bottom: 0.5rem;
  color: var(--text);
}

::selection {
  background-color: var(--accent);
  color: #ffffff;
}

/* --------------------------------------------------------------------------
   2. Header
   -------------------------------------------------------------------------- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-header);
  background-color: var(--surface);
  height: var(--header-current-height);
  min-height: 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px 0 calc(var(--sidebar-width-collapsed) + 16px);
  transition: height var(--transition-base), padding var(--transition-base),
              opacity var(--transition-base), border-color var(--transition-base);
  overflow: visible;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo img:first-child {
  height: 72px;
  width: auto;
}

.header-logo img:nth-child(2) {
  height: 58px;
  width: auto;
}

.header-logo .logo-text {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.header-logo .logo-text span {
  color: var(--accent);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-right .badge-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-right .user-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-right .user-controls .user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--surface2);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

.header-right .user-controls .user-avatar:hover {
  border-color: var(--accent);
}

.header-right .user-controls .user-name {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
}

.header-right .user-controls .user-role {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.header-notification {
  position: relative;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-md);
  transition: background-color var(--transition-fast);
}

.header-notification:hover {
  background-color: var(--surface2);
}

.header-notification .notification-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--rojo);
}

/* Header collapsed state */
body.header-collapsed .header {
  height: 0;
  padding: 0;
  border-bottom-color: transparent;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}

body.header-collapsed .main-content {
  padding-top: 24px;
}

body.header-collapsed .sidebar {
  top: 0;
}

/* --------------------------------------------------------------------------
   2b. Header gear dropdown menu
   -------------------------------------------------------------------------- */
.header-menu-wrapper {
  position: relative;
}

.header-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface2);
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast),
              border-color var(--transition-fast);
}

.header-menu-btn:hover,
.header-menu-btn.open {
  background-color: rgba(74, 144, 217, 0.12);
  color: var(--accent);
  border-color: var(--accent);
}

.header-menu-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
}

.header-menu-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 260px;
  max-height: 70vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  z-index: calc(var(--z-header) + 10);
  padding: 8px 0;
}

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

.hm-section {
  padding: 4px 0;
}

.hm-section + .hm-section {
  border-top: 1px solid var(--border);
}

.hm-section-title {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 8px 16px 4px;
}

.hm-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.hm-item:hover {
  background-color: rgba(74, 144, 217, 0.08);
  color: var(--text);
}

.hm-item.active {
  color: var(--accent);
}

.hm-item svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   3. Sidebar
   -------------------------------------------------------------------------- */
.sidebar {
  position: fixed;
  top: var(--header-current-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width-collapsed);
  background-color: var(--surface);
  border-right: 1px solid var(--border);
  z-index: var(--z-sidebar);
  overflow-x: hidden;
  overflow-y: hidden;
  transition: width var(--transition-base);
  display: flex;
  flex-direction: column;
  padding: 4px 0;
}

.sidebar:hover,
.sidebar.expanded {
  width: var(--sidebar-width-expanded);
}

.sidebar:hover .nav-item .nav-label,
.sidebar.expanded .nav-item .nav-label {
  opacity: 1;
  visibility: visible;
}

.sidebar:hover .nav-section-title,
.sidebar.expanded .nav-section-title {
  opacity: 1;
  visibility: visible;
  height: auto;
  padding: 10px 20px 6px;
}

.sidebar .nav-section {
  margin-bottom: 2px;
  transition: margin-bottom var(--transition-base);
}

.sidebar:hover .nav-section,
.sidebar.expanded .nav-section {
  margin-bottom: 8px;
}

.sidebar .nav-section-title {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0 20px;
  height: 0;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  overflow: hidden;
  transition: opacity var(--transition-base), visibility var(--transition-base),
              height var(--transition-base), padding var(--transition-base);
}

.sidebar .nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 20px;
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast),
              padding var(--transition-base);
  border-left: 3px solid transparent;
  position: relative;
}

.sidebar:hover .nav-item,
.sidebar.expanded .nav-item {
  padding: 10px 20px;
}

.sidebar .nav-item:hover {
  background-color: rgba(74, 144, 217, 0.08);
  color: var(--text);
}

.sidebar .nav-item.active {
  border-left-color: var(--accent);
  color: var(--accent);
  background-color: rgba(74, 144, 217, 0.06);
}

.sidebar .nav-item .nav-icon {
  width: 20px;
  height: 20px;
  min-width: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.sidebar .nav-item .nav-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
}

.sidebar .nav-item > svg {
  width: 20px;
  height: 20px;
  min-width: 20px;
  stroke: currentColor;
  fill: none;
}

.sidebar .nav-item .nav-label {
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-base), visibility var(--transition-base);
}

.sidebar .nav-item .nav-badge {
  margin-left: auto;
  background-color: var(--accent);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  opacity: 0;
  transition: opacity var(--transition-base);
}

.sidebar:hover .nav-item .nav-badge,
.sidebar.expanded .nav-item .nav-badge {
  opacity: 1;
}

/* Sidebar overflow indicator — shows when items are clipped */
.sidebar-overflow {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 20px;
  cursor: pointer;
  color: var(--text-muted);
  transition: background-color var(--transition-fast), color var(--transition-fast);
  border-top: 1px solid var(--border);
  margin-top: auto;
  flex-shrink: 0;
}

.sidebar-overflow:hover {
  background-color: rgba(74, 144, 217, 0.08);
  color: var(--accent);
}

.sidebar-overflow svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
}

.sidebar-overflow .overflow-label {
  opacity: 0;
  visibility: hidden;
  margin-left: 14px;
  font-size: 0.8rem;
  white-space: nowrap;
  transition: opacity var(--transition-base), visibility var(--transition-base);
}

.sidebar:hover .sidebar-overflow .overflow-label,
.sidebar.expanded .sidebar-overflow .overflow-label {
  opacity: 1;
  visibility: visible;
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}

.sidebar-footer .sidebar-version {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-base), visibility var(--transition-base);
}

.sidebar:hover .sidebar-footer .sidebar-version,
.sidebar.expanded .sidebar-footer .sidebar-version {
  opacity: 1;
  visibility: visible;
}

/* --------------------------------------------------------------------------
   4. Main Content
   -------------------------------------------------------------------------- */
.main-content {
  margin-left: var(--sidebar-width-collapsed);
  flex: 1;
  padding: calc(var(--header-current-height) + 24px) 24px 24px 24px;
  transition: margin-left var(--transition-base);
  min-height: 100vh;
}

.content-wrapper {
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* --------------------------------------------------------------------------
   5. Hero Section
   -------------------------------------------------------------------------- */
.hero {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px 32px;
  margin-bottom: 24px;
}

.hero h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.hero .hero-description {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 680px;
}

.hero .hero-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
}

.hero .hero-meta {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 14px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.hero .hero-meta .meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hero .hero-meta .meta-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--verde);
}

/* --------------------------------------------------------------------------
   6. Cards
   -------------------------------------------------------------------------- */
.card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 18px 20px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(74, 144, 217, 0.1);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
}

.card-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-lg);
  background-color: rgba(74, 144, 217, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 1rem;
}

.card-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}

.card-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

.card-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  margin-top: 8px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.card-trend.up {
  color: var(--verde);
  background-color: rgba(46, 204, 113, 0.1);
}

.card-trend.down {
  color: var(--rojo);
  background-color: rgba(231, 76, 60, 0.1);
}

.card-trend.neutral {
  color: var(--amarillo);
  background-color: rgba(241, 196, 15, 0.1);
}

.card-body {
  margin-top: 12px;
}

.card-footer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   7. KPI Grid
   -------------------------------------------------------------------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 18px 20px;
  transition: border-color var(--transition-fast);
}

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

.kpi-card .kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.kpi-card .kpi-title {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi-card .kpi-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent);
}

.kpi-card .kpi-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.kpi-card .kpi-change {
  font-size: 0.72rem;
  font-weight: 600;
  margin-top: 6px;
}

.kpi-card .kpi-change.positive {
  color: var(--verde);
}

.kpi-card .kpi-change.negative {
  color: var(--rojo);
}

/* --------------------------------------------------------------------------
   8. Tables
   -------------------------------------------------------------------------- */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background-color: var(--surface);
  margin-bottom: 24px;
}

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

.data-table thead {
  background-color: var(--surface2);
}

.data-table thead th {
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 10px 14px;
  text-align: left;
  white-space: nowrap;
  border: none;
}

.data-table thead th:first-child {
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

.data-table thead th:last-child {
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

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

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

.data-table tbody td {
  padding: 10px 14px;
  font-size: 0.84rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tbody td:first-child {
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

.data-table tbody td:last-child {
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

.data-table .table-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.data-table .row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.data-table .sort-indicator {
  display: inline-flex;
  margin-left: 4px;
  opacity: 0.5;
}

.data-table .sort-indicator.active {
  opacity: 1;
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   9. Badges / Status
   -------------------------------------------------------------------------- */
.badge {
  display: inline-block;
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.6;
  white-space: nowrap;
}

.badge-production {
  background-color: rgba(46, 204, 113, 0.15);
  color: var(--verde);
}

.badge-research {
  background-color: rgba(74, 144, 217, 0.15);
  color: var(--accent);
}

.badge-legal-review {
  background-color: rgba(241, 196, 15, 0.15);
  color: var(--amarillo);
}

.badge-deprecated {
  background-color: rgba(231, 76, 60, 0.15);
  color: var(--rojo);
}

.badge-blocked {
  background-color: rgba(231, 76, 60, 0.15);
  color: var(--rojo);
}

.badge-draft {
  background-color: rgba(136, 146, 164, 0.15);
  color: var(--text-muted);
}

.badge-active {
  background-color: rgba(46, 204, 113, 0.15);
  color: var(--verde);
}

.badge-warning {
  background-color: rgba(230, 126, 34, 0.15);
  color: var(--naranja);
}

.badge-info {
  background-color: rgba(74, 144, 217, 0.15);
  color: var(--accent);
}

.badge-sm {
  font-size: 0.65rem;
  padding: 1px 6px;
}

.badge-lg {
  font-size: 0.8rem;
  padding: 4px 12px;
}

/* --------------------------------------------------------------------------
   10. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius-md);
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.8rem;
  padding: 6px 14px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color var(--transition-fast),
              border-color var(--transition-fast),
              color var(--transition-fast),
              box-shadow var(--transition-fast);
  white-space: nowrap;
  line-height: 1.5;
  text-decoration: none;
}

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

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

.btn-primary:hover {
  background-color: #3a7ec7;
  border-color: #3a7ec7;
}

.btn-primary:active {
  background-color: #2f6db5;
}

.btn-outline {
  background-color: transparent;
  color: var(--accent);
  border-color: var(--accent);
}

.btn-outline:hover {
  background-color: rgba(74, 144, 217, 0.1);
  color: #5da0e8;
  border-color: #5da0e8;
}

.btn-outline:active {
  background-color: rgba(74, 144, 217, 0.18);
}

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

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

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

.btn-danger:hover {
  background-color: #c0392b;
  border-color: #c0392b;
}

.btn-success {
  background-color: var(--verde);
  color: #ffffff;
  border-color: var(--verde);
}

.btn-success:hover {
  background-color: #27ae60;
  border-color: #27ae60;
}

.btn-sm {
  font-size: 0.72rem;
  padding: 4px 10px;
}

.btn-lg {
  font-size: 0.88rem;
  padding: 10px 22px;
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius-md);
}

.btn-group {
  display: inline-flex;
  gap: 0;
}

.btn-group .btn {
  border-radius: 0;
}

.btn-group .btn:first-child {
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.btn-group .btn:last-child {
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.btn-group .btn + .btn {
  margin-left: -1px;
}

/* --------------------------------------------------------------------------
   11. Pipeline Flow
   -------------------------------------------------------------------------- */
.pipeline-flow {
  display: flex;
  gap: 0;
  align-items: center;
  overflow-x: auto;
  padding: 16px 0;
}

.pipeline-step {
  background-color: var(--surface);
  border: 1px solid var(--border);
  padding: 12px 20px;
  position: relative;
  min-width: 140px;
  text-align: center;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
  flex-shrink: 0;
}

.pipeline-step:first-child {
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

.pipeline-step:last-child {
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

.pipeline-step::after {
  content: '';
  position: absolute;
  top: 50%;
  right: -10px;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 10px solid var(--border);
  z-index: 1;
}

.pipeline-step:last-child::after {
  display: none;
}

.pipeline-step.active {
  border-top: 2px solid var(--accent);
  background-color: rgba(74, 144, 217, 0.04);
}

.pipeline-step.active::after {
  border-left-color: var(--accent);
}

.pipeline-step.completed {
  border-top: 2px solid var(--verde);
  background-color: rgba(46, 204, 113, 0.04);
}

.pipeline-step .step-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.pipeline-step .step-sublabel {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.pipeline-step .step-count {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  margin-top: 4px;
}

/* --------------------------------------------------------------------------
   12. Alert / Status States
   -------------------------------------------------------------------------- */
.status-normal {
  color: var(--verde);
}

.status-vigilancia {
  color: var(--amarillo);
}

.status-alerta {
  color: var(--naranja);
}

.status-emergencia {
  color: var(--rojo);
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 500;
}

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

.status-indicator.status-normal .status-dot {
  background-color: var(--verde);
  box-shadow: 0 0 6px rgba(46, 204, 113, 0.4);
}

.status-indicator.status-vigilancia .status-dot {
  background-color: var(--amarillo);
  box-shadow: 0 0 6px rgba(241, 196, 15, 0.4);
}

.status-indicator.status-alerta .status-dot {
  background-color: var(--naranja);
  box-shadow: 0 0 6px rgba(230, 126, 34, 0.4);
}

.status-indicator.status-emergencia .status-dot {
  background-color: var(--rojo);
  box-shadow: 0 0 6px rgba(231, 76, 60, 0.4);
}

/* Pulsing animation for emergency status */
.status-indicator.status-emergencia .status-dot {
  animation: pulse-emergency 1.5s ease-in-out infinite;
}

@keyframes pulse-emergency {
  0%, 100% { box-shadow: 0 0 6px rgba(231, 76, 60, 0.4); }
  50% { box-shadow: 0 0 14px rgba(231, 76, 60, 0.7); }
}

/* Alert banners */
.alert {
  padding: 12px 18px;
  border-radius: var(--radius-lg);
  font-size: 0.84rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}

.alert-success {
  background-color: rgba(46, 204, 113, 0.1);
  border: 1px solid rgba(46, 204, 113, 0.25);
  color: var(--verde);
}

.alert-warning {
  background-color: rgba(241, 196, 15, 0.1);
  border: 1px solid rgba(241, 196, 15, 0.25);
  color: var(--amarillo);
}

.alert-danger {
  background-color: rgba(231, 76, 60, 0.1);
  border: 1px solid rgba(231, 76, 60, 0.25);
  color: var(--rojo);
}

.alert-info {
  background-color: rgba(74, 144, 217, 0.1);
  border: 1px solid rgba(74, 144, 217, 0.25);
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   13. Code Blocks
   -------------------------------------------------------------------------- */
.code-block {
  background-color: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.82rem;
  line-height: 1.65;
  overflow-x: auto;
  color: var(--accent);
  tab-size: 2;
}

.code-block code {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

.code-block .code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.code-block .code-header .code-language {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
}

.code-block .code-header .code-copy {
  font-size: 0.7rem;
  color: var(--text-muted);
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: color var(--transition-fast);
}

.code-block .code-header .code-copy:hover {
  color: var(--accent);
}

.code-inline {
  background-color: var(--surface2);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.82rem;
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   14. Section Headers
   -------------------------------------------------------------------------- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.section-header .section-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-header .section-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.section-divider {
  height: 1px;
  background-color: var(--border);
  margin: 24px 0;
}

/* --------------------------------------------------------------------------
   15. Footer
   -------------------------------------------------------------------------- */
.footer {
  background-color: var(--surface);
  border-top: 1px solid var(--border);
  padding: 20px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: auto;
}

.footer a {
  color: var(--accent);
}

.footer a:hover {
  color: #5da0e8;
}

.footer-inner {
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
}

.footer-brand {
  font-size: 0.82rem;
  color: var(--text);
}

.footer-brand strong {
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.footer-by {
  color: var(--text-muted);
  margin-left: 8px;
  padding-left: 8px;
  border-left: 1px solid var(--border);
}

.footer-sources {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.footer-label {
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--text-muted);
  opacity: 0.65;
  margin-right: 8px;
}

.footer-disclaimer {
  max-width: 720px;
  font-size: 0.68rem;
  line-height: 1.55;
  color: var(--text-muted);
  opacity: 0.82;
}

.footer-copy {
  font-size: 0.68rem;
  color: var(--text-muted);
  opacity: 0.6;
}

.footer .footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 2px;
}

.footer .footer-links a {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.footer .footer-links a:hover {
  color: var(--text);
}

/* --------------------------------------------------------------------------
   16. Responsive Breakpoints
   -------------------------------------------------------------------------- */
/* Mobile hamburger — opens the agro sidebar as a slide-in drawer.
 * Below 900px the sidebar is display:none; main.js appends .sidebar-hamburger
 * and toggles .sidebar.visible. Both need styling (previously missing → nav was
 * unreachable on phones). */
.sidebar-hamburger {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 1350;
  width: 42px;
  height: 42px;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
  box-shadow: var(--shadow-sm);
}
.sidebar-hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}

@media (max-width: 900px) {
  .sidebar {
    display: none;
  }

  .sidebar-hamburger { display: flex; }

  /* Drawer: override the mobile display:none, keep the flex layout. Content
   * visibility (section titles + labels) comes from the .expanded class, which
   * main.js toggles together with .visible. */
  .sidebar.visible {
    display: flex;
    top: 0;
    width: var(--sidebar-width-expanded);
    z-index: 1340;
    overflow-y: auto;
    padding-top: 64px;
    box-shadow: var(--shadow-lg);
  }

  .header {
    left: 0;
    padding: 0 16px;
  }

  .main-content {
    margin-left: 0;
    padding: calc(var(--header-current-height) + 16px) 16px 16px 16px;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .card {
    width: 100%;
  }

  .hero {
    padding: 20px;
  }

  .hero h1 {
    font-size: 1.2rem;
  }

  .header {
    padding: 0 16px;
    height: auto;
    min-height: 60px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .header-logo img:first-child {
    height: 48px;
  }

  .header-logo img:nth-child(2) {
    height: 38px;
  }

  .pipeline-flow {
    flex-wrap: wrap;
    gap: 8px;
  }

  .pipeline-step {
    border-radius: var(--radius-lg) !important;
    min-width: 100%;
  }

  .pipeline-step::after {
    display: none;
  }

  .data-table {
    font-size: 0.78rem;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .footer .footer-links {
    flex-wrap: wrap;
  }
}

@media (max-width: 600px) {
  .header-right .user-controls .user-name,
  .header-right .user-controls .user-role {
    display: none;
  }

  .hero .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero .hero-meta {
    flex-wrap: wrap;
    gap: 10px;
  }

  .btn-group {
    flex-direction: column;
  }

  .btn-group .btn {
    border-radius: var(--radius-md);
  }
}

/* --------------------------------------------------------------------------
   17. Custom Scrollbar
   -------------------------------------------------------------------------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--surface2);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #3d4268;
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--surface2);
}

/* --------------------------------------------------------------------------
   18. Utility Classes
   -------------------------------------------------------------------------- */

/* Text colors */
.text-accent  { color: var(--accent) !important; }
.text-muted   { color: var(--text-muted) !important; }
.text-verde   { color: var(--verde) !important; }
.text-amarillo { color: var(--amarillo) !important; }
.text-naranja { color: var(--naranja) !important; }
.text-rojo    { color: var(--rojo) !important; }
.text-white   { color: #ffffff !important; }

/* Margin top */
.mt-1 { margin-top: 4px !important; }
.mt-2 { margin-top: 8px !important; }
.mt-3 { margin-top: 16px !important; }
.mt-4 { margin-top: 24px !important; }

/* Margin bottom */
.mb-1 { margin-bottom: 4px !important; }
.mb-2 { margin-bottom: 8px !important; }
.mb-3 { margin-bottom: 16px !important; }
.mb-4 { margin-bottom: 24px !important; }

/* Flex utilities */
.flex {
  display: flex !important;
}

.flex-between {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
}

.flex-center {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.flex-col {
  display: flex !important;
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap !important;
}

.items-center {
  align-items: center !important;
}

.justify-end {
  justify-content: flex-end !important;
}

/* Gap utilities */
.gap-1 { gap: 4px !important; }
.gap-2 { gap: 8px !important; }
.gap-3 { gap: 16px !important; }
.gap-4 { gap: 24px !important; }

/* Display */
.hidden       { display: none !important; }
.block        { display: block !important; }
.inline-block { display: inline-block !important; }
.inline-flex  { display: inline-flex !important; }

/* Width */
.w-full { width: 100% !important; }
.w-auto { width: auto !important; }

/* Text alignment */
.text-left   { text-align: left !important; }
.text-center { text-align: center !important; }
.text-right  { text-align: right !important; }

/* Overflow */
.overflow-hidden { overflow: hidden !important; }
.overflow-auto   { overflow: auto !important; }

/* Positioning */
.relative { position: relative !important; }
.absolute { position: absolute !important; }

/* Cursor */
.cursor-pointer { cursor: pointer !important; }

/* --------------------------------------------------------------------------
   Additional Components: Form Inputs
   -------------------------------------------------------------------------- */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 8px 12px;
  background-color: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 0.84rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.2);
}

.form-input::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

.form-select {
  width: 100%;
  padding: 8px 12px;
  background-color: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 0.84rem;
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238892a4' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  transition: border-color var(--transition-fast);
}

.form-select:focus {
  border-color: var(--accent);
}

.form-textarea {
  width: 100%;
  padding: 10px 12px;
  background-color: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 0.84rem;
  resize: vertical;
  min-height: 80px;
  transition: border-color var(--transition-fast);
}

.form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.2);
}

.form-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-error {
  font-size: 0.72rem;
  color: var(--rojo);
  margin-top: 4px;
}

.form-input.error {
  border-color: var(--rojo);
}

/* --------------------------------------------------------------------------
   Additional Components: Tabs
   -------------------------------------------------------------------------- */
.tabs {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  gap: 0;
}

.tab-item {
  padding: 10px 18px;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color var(--transition-fast), border-color var(--transition-fast);
  white-space: nowrap;
}

.tab-item:hover {
  color: var(--text);
}

.tab-item.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* --------------------------------------------------------------------------
   Additional Components: Tooltips
   -------------------------------------------------------------------------- */
.tooltip-wrapper {
  position: relative;
  display: inline-flex;
}

.tooltip-wrapper .tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--surface2);
  color: var(--text);
  font-size: 0.72rem;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast);
  z-index: var(--z-tooltip);
  border: 1px solid var(--border);
}

.tooltip-wrapper .tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--surface2);
}

.tooltip-wrapper:hover .tooltip {
  opacity: 1;
}

/* --------------------------------------------------------------------------
   Additional Components: Modal / Dialog
   -------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 1rem;
  font-weight: 700;
}

.modal-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

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

.modal-body {
  padding: 22px;
}

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* --------------------------------------------------------------------------
   Additional Components: Loading / Skeleton
   -------------------------------------------------------------------------- */
.skeleton {
  background: linear-gradient(90deg, var(--surface2) 25%, var(--border) 50%, var(--surface2) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  width: 100%;
}

.skeleton-text.short {
  width: 60%;
}

.skeleton-card {
  height: 120px;
  border-radius: var(--radius-xl);
}

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

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

/* --------------------------------------------------------------------------
   Additional Components: Dropdown Menu
   -------------------------------------------------------------------------- */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 180px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  z-index: var(--z-dropdown);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity var(--transition-fast),
              visibility var(--transition-fast),
              transform var(--transition-fast);
  padding: 4px 0;
}

.dropdown.open .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  font-size: 0.82rem;
  color: var(--text);
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.dropdown-item:hover {
  background-color: var(--surface2);
}

.dropdown-item .dropdown-icon {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.dropdown-divider {
  height: 1px;
  background-color: var(--border);
  margin: 4px 0;
}

/* --------------------------------------------------------------------------
   Additional Components: Progress Bar
   -------------------------------------------------------------------------- */
.progress-bar {
  width: 100%;
  height: 6px;
  background-color: var(--surface2);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar .progress-fill {
  height: 100%;
  border-radius: 3px;
  background-color: var(--accent);
  transition: width var(--transition-slow);
}

.progress-bar .progress-fill.success {
  background-color: var(--verde);
}

.progress-bar .progress-fill.warning {
  background-color: var(--amarillo);
}

.progress-bar .progress-fill.danger {
  background-color: var(--rojo);
}

/* --------------------------------------------------------------------------
   Additional Components: Tag / Chip
   -------------------------------------------------------------------------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 500;
  background-color: var(--surface2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.tag .tag-remove {
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.6rem;
  transition: background-color var(--transition-fast);
}

.tag .tag-remove:hover {
  background-color: rgba(231, 76, 60, 0.2);
  color: var(--rojo);
}

/* --------------------------------------------------------------------------
   Additional Components: Empty State
   -------------------------------------------------------------------------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
}

.empty-state .empty-icon {
  font-size: 2.5rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state .empty-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.empty-state .empty-description {
  font-size: 0.84rem;
  color: var(--text-muted);
  max-width: 400px;
  margin-bottom: 20px;
}

/* H5.7: Error-state with optional retry CTA */
.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: var(--rojo);
}
.error-state .error-icon {
  font-size: 2.5rem;
  margin-bottom: 16px;
  opacity: 0.7;
}
.error-state .error-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.error-state .error-description {
  font-size: 0.84rem;
  color: var(--text-muted);
  max-width: 400px;
  margin-bottom: 20px;
}
.error-state .error-retry {
  background: var(--accent);
  color: #fff;
  border: 0;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background var(--transition-fast);
}
.error-state .error-retry:hover {
  background: var(--accent-hover, var(--verde));
}

/* --------------------------------------------------------------------------
   Additional Components: Breadcrumb
   -------------------------------------------------------------------------- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  margin-bottom: 16px;
}

.breadcrumb-item {
  color: var(--text-muted);
}

.breadcrumb-item a {
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.breadcrumb-item a:hover {
  color: var(--accent);
}

.breadcrumb-separator {
  color: var(--border);
  font-size: 0.7rem;
}

.breadcrumb-item.active {
  color: var(--text);
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   Animation Keyframes
   -------------------------------------------------------------------------- */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.animate-fade-in {
  animation: fadeIn 0.3s ease forwards;
}

.animate-fade-in-up {
  animation: fadeInUp 0.35s ease forwards;
}

.animate-slide-in-left {
  animation: slideInLeft 0.3s ease forwards;
}

/* --------------------------------------------------------------------------
   Print Styles
   -------------------------------------------------------------------------- */
@media print {
  .sidebar,
  .header,
  .footer {
    display: none !important;
  }

  .main-content {
    margin-left: 0 !important;
    padding: 0 !important;
  }

  body {
    background-color: #fff;
    color: #000;
  }

  .card,
  .hero,
  .table-container {
    border-color: #ccc;
    box-shadow: none;
  }
}

/* --------------------------------------------------------------------------
   Leaflet map stacking context
   Contains all map-related z-indices so sidebar/header always stay on top
   -------------------------------------------------------------------------- */
.leaflet-container,
.map-container,
#stations-map,
#forecast-map {
  isolation: isolate;
}

.leaflet-pane,
.leaflet-top,
.leaflet-bottom {
  z-index: auto !important;
}

.leaflet-tile-pane { z-index: 200; }
.leaflet-overlay-pane { z-index: 400; }
.leaflet-shadow-pane { z-index: 500; }
.leaflet-marker-pane { z-index: 600; }
.leaflet-tooltip-pane { z-index: 650; }
.leaflet-popup-pane { z-index: 700; }
.leaflet-map-pane { z-index: 400; }

/* H5.6: Global keyboard focus ring */
:root {
  --focus-ring: 2px solid #7aa8ff;
  --focus-offset: 2px;
}
:focus:not(:focus-visible) { outline: none; }
:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
  border-radius: inherit;
}
@media (forced-colors: active) {
  :focus-visible { outline: 3px solid CanvasText; }
}

/* H5.11: Respect OS "reduce motion" preference (WCAG 2.3.3). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* H5.11: sr-only utility for chevrons, icon-only buttons, severity signals. */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
