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

:root {
  --background: #F6F8F6;
  --surface: #ffffff;
  --text-primary: #17261F;
  --text-muted: #5B6B63;
  --border: #DCE3DE;
  --accent: #3cb54a;
  --danger: #FE0600;
  --danger-bg: #FEE4E2;
  --success: #1F7A35;
  --warning-bg: #FFE14D;
  --warning-text: #3D3000;
  --utility-electric: #06b6d4;
  --utility-gas: #f59e0b;
  --utility-water: #1b3a5c;
  --motion-micro-dur: 180ms;
  --motion-micro-ease: cubic-bezier(.4,0,.2,1);
  --motion-standard-dur: 320ms;
  --motion-standard-ease: cubic-bezier(.34,1.56,.64,1);
  --motion-transition-dur: 450ms;
  --motion-transition-ease: cubic-bezier(.16,1,.3,1);
}

.cdm-period-btn { border:1px solid var(--border); background:var(--surface); color:var(--text-muted); font-family:inherit; font-size:10px; font-weight:600; padding:3px 8px; border-radius:99px; cursor:pointer; }
.cdm-period-btn.active { background:var(--accent); color:#fff; border-color:var(--accent); }

.history-popup.history-inline { width:100%; max-width:100%; margin:12px 0 24px; box-shadow:0 1px 3px rgba(34,48,31,.15); border:1px solid var(--border); }
.hall-card.history-active { border-color:var(--accent); box-shadow:0 0 0 2px rgba(60,181,74,.25); }

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--background);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

.wordmark {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 20px;
  color: var(--text-primary);
}

h1, h2, h3 {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 12px 0;
}
h1 { font-size: 28px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 16px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 500;
  transition: color 150ms ease-out;
}
.nav-link:hover { color: var(--text-primary); }

.section { margin-bottom: 32px; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(34,48,31,.08);
  text-decoration: none;
  color: var(--text-primary);
  transition: box-shadow 150ms ease-out;
  display: block;
}
.card:hover { box-shadow: 0 2px 6px rgba(34,48,31,.14); }

.card-title { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.card-meta { font-size: 12px; color: var(--text-muted); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 500;
  background: var(--warning-bg);
  color: var(--warning-text);
}
.badge-success { background: #E3F2E5; color: var(--success); }

.hall-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 16px;
}
.hall-card h3 { margin-bottom: 12px; }

.metric-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.metric-row:last-child { border-bottom: none; }
.metric-label { color: var(--text-muted); }
.metric-value { font-weight: 600; font-variant-numeric: tabular-nums; }
.metric-value.stale { color: var(--danger); }

.bento-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: minmax(70px, auto);
  gap: 10px;
}
.bento-large {
  grid-column: span 2;
  grid-row: span 3;
  border-left: 4px solid var(--danger);
  border-radius: 0 12px 12px 0;
}
.bento-small {
  grid-column: span 1;
  border-left: 4px solid var(--accent);
  border-radius: 0 12px 12px 0;
  padding: 12px;
}
.bento-small h3 {
  font-size: 14px;
  margin-bottom: 6px;
}
.bento-expand {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  transition: background 150ms ease-out;
}
.bento-expand:hover {
  background: var(--background);
}
.metric-row-compact {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 2px 0;
}

.bento-detail-link {
  display: block;
  margin-top: 12px;
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
}
.bento-detail-link:hover {
  text-decoration: underline;
}

.metric-group {
  margin-top: 10px;
}
.metric-group:first-of-type {
  margin-top: 0;
}
.metric-group-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.source-note {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

.empty-state {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.iso-view { display: block; }
.accordion-view { display: none; }
@media (max-width: 768px) {
  .iso-view { display: none; }
  .accordion-view { display: block; }
}

.iso-wrap {
  position: relative;
  max-width: 900px;
}
.iso-img {
  width: 100%;
  display: block;
  border-radius: 12px;
}
.hotspot {
  position: absolute;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: rgba(60, 181, 74, 0.15);
  cursor: pointer;
  transition: background 150ms ease-out;
}
.hotspot:hover {
  background: rgba(60, 181, 74, 0.3);
}
.hs-silo { left: 10%; top: 15%; width: 18%; height: 40%; }
.hs-interior { left: 34%; top: 42%; width: 26%; height: 26%; }
.hs-fans { left: 66%; top: 25%; width: 18%; height: 22%; }
.hs-heat { left: 44%; top: 62%; width: 16%; height: 12%; }
.hs-meteo { left: 55%; top: 6%; width: 8%; height: 8%; }

.iso-card {
  position: absolute;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  width: 170px;
  box-sizing: border-box;
  box-shadow: 0 4px 14px rgba(26,36,33,.12);
}
.iso-card-title {
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin-bottom: 8px;
}
.iso-card-hero {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 2px;
}
.iso-card-hero-value {
  font-family: 'Fraunces', serif;
  font-size: 26px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1;
}
.iso-card-hero-unit {
  font-size: 13px;
  color: var(--text-muted);
}
.iso-card-hero-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.iso-card .metric-row-compact {
  padding: 3px 0;
  font-size: 12px;
}
.iso-card-furaj { left: 4%; top: 4%; }
.iso-card-climat { left: 36%; top: 42%; }
.iso-card-termoreglare { left: 62%; top: 50%; }
.iso-card-meteo { left: 76%; top: 4%; }

.iso-panel {
  display: none;
  position: absolute;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 12px;
  min-width: 200px;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
  z-index: 10;
}
.iso-panel-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 6px;
}

.acc-item {
  border: 1px solid var(--border);
  border-radius: 11px;
  margin-bottom: 8px;
  overflow: hidden;
}
.acc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--surface);
  cursor: pointer;
  font-weight: 600;
}
.acc-chevron {
  transition: transform 150ms ease-out;
}
.acc-item.open .acc-chevron {
  transform: rotate(180deg);
}
.acc-body {
  display: none;
  padding: 0 16px 12px 16px;
}
.acc-item.open .acc-body {
  display: block;
}

.iso-card-productie { left: 4%; top: 62%; }

.iso-card-min {
  position: absolute;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  min-width: 110px;
  box-shadow: 0 4px 14px rgba(26,36,33,.12);
  cursor: pointer;
}
.iso-card-min-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin-bottom: 4px;
}
.iso-card-min-value {
  font-family: 'Fraunces', serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1;
}
.iso-card-min-unit {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
}
.iso-spark { margin-top: 4px; }

.iso-tooltip {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 10px 14px;
  min-width: 220px;
  box-shadow: 0 4px 14px rgba(26,36,33,.14);
  z-index: 20;
}
.iso-card-min:hover .iso-tooltip {
  display: block;
}
.iso-tooltip-row {
  cursor: pointer;
  border-radius: 6px;
  padding: 3px 4px;
}
.iso-tooltip-row:hover {
  background: var(--background);
}

.history-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26,36,33,.35);
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.history-popup {
  background: var(--surface);
  border-radius: 12px;
  padding: 28px 32px;
  width: 900px;
  max-width: 92vw;
  max-height: 88vh;
  overflow-y: auto;
  box-sizing: border-box;
}
.history-range-switch {
  flex-wrap: wrap;
}
@media (max-width: 700px) {
  .history-popup {
    width: 96vw;
    padding: 18px 16px;
  }
}
.history-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 12px;
}
.history-close {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 20px;
  line-height: 1;
}
.history-range-switch {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.range-btn, .multi-range-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-muted);
}
.range-btn.active, .multi-range-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.history-loading {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}
.history-range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.history-time-axis {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  font-family: 'JetBrains Mono', monospace;
}

.history-hover-label {
  position: absolute;
  top: -8px;
  background: var(--text-primary);
  color: #fff;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  pointer-events: none;
  white-space: nowrap;
}
#history-chart, #multi-history-chart {
  position: relative;
}
#multi-history-chart {
  overflow-x: hidden;
}
#multi-hist-hover-label {
  white-space: normal;
  padding: 6px 9px;
}

.iso-value-error {
  color: var(--danger) !important;
}
.iso-error-note {
  font-size: 10px;
  color: var(--danger);
  margin-top: 2px;
}

.brand-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.brand-logo {
  height: 64px;
  width: auto;
}

.nav-centered {
  justify-content: center;
}
.wordmark-small {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-muted);
}

.card-company {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.type-badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 5px;
}
.type-badge-poultry {
  color: var(--success);
  background: #E3F2E5;
}
.type-badge-pig {
  color: var(--warning-text);
  background: var(--warning-bg);
}

.card-disabled {
  opacity: 0.45;
  filter: grayscale(0.6);
  cursor: default;
  pointer-events: none;
}

body.bg-index, body.bg-farm {
  position: relative;
  background-size: cover;
  background-position: center top;
  background-attachment: fixed;
}
body.bg-index {
  background-image: url('/static/img/index_bg2.jpg');
}
body.bg-farm {
  background-image: url('/static/img/farm_bg.jpg');
}

body.bg-farm h1,
body.bg-farm .card-meta,
body.bg-farm h2,
body.bg-farm h3:not(.iso-card-title):not(.iso-card-min-title):not(.card-title) {
  display: block;
  width: fit-content;
  background: rgba(246,248,246,0.92);
  padding: 4px 10px;
  border-radius: 6px;
}
body.bg-farm .nav-link {
  background: rgba(246,248,246,0.92);
  padding: 4px 10px;
  border-radius: 6px;
  display: block;
  width: fit-content;
}

body.bg-index .hall-card,
body.bg-index .card,
body.bg-farm .hall-card,
body.bg-farm .card,
body.bg-farm .bento-large,
body.bg-farm .bento-small,
body.bg-farm .util-card,
body.bg-farm .iso-card-min {
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

@media (max-width: 768px) {
  .bento-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .bento-large {
    grid-column: span 2;
  }
}
@media (max-width: 480px) {
  .bento-grid {
    grid-template-columns: 1fr;
  }
  .bento-large {
    grid-column: span 1;
  }
}

.history-completeness {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}
.history-completeness-warn {
  color: var(--warning-text);
  font-weight: 600;
}

.correction-box {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.correction-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  font-family: inherit;
}
.correction-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  margin-bottom: 8px;
}
.correction-submit {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.correction-error {
  color: var(--danger);
  font-size: 12px;
  margin-top: 6px;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.status-dot-ok { background: var(--success); }
.status-dot-warning { background: var(--warning-text); }
.status-dot-critical { background: var(--danger); }
.status-dot-never { background: var(--text-muted); }

.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
}
.filter-control {
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--surface);
  box-sizing: border-box;
}
.filter-search {
  min-width: 220px;
}
.filter-chip {
  height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--surface);
  cursor: pointer;
  box-sizing: border-box;
}
.filter-chip input {
  margin: 0;
}

.history-view-switch {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.view-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 11px;
  cursor: pointer;
  color: var(--text-muted);
  font-family: inherit;
}
.view-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.comparison-legend {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}
.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}
.heatmap-label {
  font-size: 9px;
  fill: var(--text-muted);
  font-family: inherit;
}

.granularity-switch {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.granularity-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 11px;
  cursor: pointer;
  color: var(--text-muted);
  font-family: inherit;
}
.granularity-btn.active {
  background: var(--text-primary);
  color: #fff;
  border-color: var(--text-primary);
}

.flock-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  margin-top: 20px;
  margin-bottom: 16px;
  max-width: 420px;
}
.flock-card-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
  color: var(--accent);
}
.flock-card-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 3px 0;
  color: var(--text-muted);
}
.flock-card-value {
  color: var(--text-primary);
  font-weight: 600;
}

.flock-card-source {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-style: italic;
}

.flock-compare-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 13px;
}
.flock-compare-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  font-weight: 600;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}
.flock-compare-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}
.flock-compare-table tr:last-child td {
  border-bottom: none;
}

.util-card-large {
  grid-column: 1 / -1;
  padding: 24px 28px;
}
.metric-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.metric-column {
  display: flex;
  flex-direction: column;
}
.metric-cell {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.metric-cell:hover {
  background: var(--surface-hover, rgba(0,0,0,0.02));
}
@media (max-width: 700px) {
  .metric-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 420px) {
  .metric-grid {
    grid-template-columns: 1fr;
  }
}

.metric-group {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.metric-group-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 8px;
}
.metric-group-title-clickable {
  cursor: pointer;
}
.metric-group-title-clickable:hover {
  text-decoration: underline;
}
.metric-group-expand {
  font-size: 9px;
  opacity: 0.55;
  margin-left: 4px;
  font-weight: 400;
  letter-spacing: normal;
}

.totals-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 12px 0 16px;
  padding: 12px;
  background: var(--surface);
  border-radius: 10px;
  border: 1px solid var(--border);
}
.totals-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.totals-value {
  font-size: 16px;
  font-weight: 700;
}
@media (max-width: 480px) {
  .totals-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.card-utility-icons {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.utility-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  opacity: 0.75;
}

.utility-icon-flip {
  transform: scaleY(-1);
}

body.bg-abator-nou {
  background-image: url('/static/img/abatornou.webp');
}

body.bg-babeni {
  background-image: url('/static/img/babeni2.jpg');
}

/* ============================================================
   Navigare în cascadă — index (linii de business → platformă → facilități)
   Extensie peste tokens/patterns existente, fără paletă nouă.
   ============================================================ */

.line-nav { margin-bottom: 8px; }

.breadcrumb-trail {
  display: none;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.crumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: opacity 150ms ease-out;
}
.crumb:hover { opacity: 0.88; }
.crumb-sep { color: var(--text-muted); font-size: 13px; }
.crumb-reset {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.line-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 8px;
}
@media (max-width: 768px) { .line-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .line-grid { grid-template-columns: 1fr; } }

.line-card {
  position: relative;
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px 18px;
  cursor: pointer;
  text-align: center;
  box-shadow: 0 1px 3px rgba(34,48,31,.08);
  transition: transform 220ms ease-out, box-shadow 220ms ease-out, border-color 220ms ease-out, padding 220ms ease-out;
  opacity: 0;
  transform: translateY(14px);
  animation: line-card-in 420ms ease-out forwards;
}
.line-card:nth-child(1) { animation-delay: 40ms; }
.line-card:nth-child(2) { animation-delay: 100ms; }
.line-card:nth-child(3) { animation-delay: 160ms; }
.line-card:nth-child(4) { animation-delay: 220ms; }

@keyframes line-card-in {
  to { opacity: 1; transform: translateY(0); }
}

.line-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 10px 28px rgba(34,48,31,.16);
  border-color: var(--accent);
}
.line-card.active {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(60,181,74,.22);
}
.line-card-icon {
  width: 100%;
  height: 60px;
  margin: 0 0 14px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  transition: height 220ms ease-out, margin 220ms ease-out, filter 220ms ease-out, transform 220ms ease-out;
}
.line-card-icon img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  display: block;
}
.line-card:hover .line-card-icon,
.line-card.active .line-card-icon {
  filter: brightness(0) saturate(100%) invert(56%) sepia(35%) saturate(1000%) hue-rotate(80deg) brightness(95%);
  transform: scale(1.06);
}
.line-card-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.line-card-count { font-size: 12px; color: var(--text-muted); transition: opacity 150ms ease-out; }

.line-nav.drilled .line-grid { display: none; }

.platform-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  margin: 0;
  transition: max-height 320ms ease-out, opacity 260ms ease-out, margin 320ms ease-out;
}
.platform-row.open {
  max-height: 220px;
  opacity: 1;
  margin: 0 0 20px;
}
.platform-card {
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 16px;
  cursor: pointer;
  transition: box-shadow 150ms ease-out, transform 150ms ease-out, border-color 150ms ease-out;
}
.platform-card:hover {
  box-shadow: 0 2px 6px rgba(34,48,31,.14);
  transform: translateY(-2px);
}
.platform-card.active {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(60,181,74,.18);
}
.platform-card-title { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.platform-card-count { font-size: 12px; color: var(--text-muted); }

.facility-panel {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 380ms ease-out, opacity 320ms ease-out;
}
.facility-panel.open {
  max-height: 3000px;
  opacity: 1;
  margin-bottom: 24px;
}

@media (prefers-reduced-motion: reduce) {
  .line-card,
  .platform-row,
  .facility-panel,
  .platform-card,
  .crumb {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* Popup istoric - previne "sarituri" de layout la reincarcare grafic */
#history-chart, #multi-history-chart {
  min-height: 210px;
  transition: opacity 150ms ease-out;
}
#history-chart.loading, #multi-history-chart.loading {
  opacity: 0.4;
}


.history-popup.fullscreen {
  width: 96vw;
  max-width: 96vw;
  height: 92vh;
  max-height: 92vh;
}

.badge-muted { background: #EEF5F0; color: var(--text-muted); }

.iso-card-iluminat { left: 40%; top: 4%; }
