:root {
  color-scheme: dark;
  --bg: #060709;
  --bg-soft: #0d1116;
  --panel: rgba(11, 14, 19, 0.84);
  --panel-strong: rgba(14, 18, 24, 0.92);
  --line: rgba(199, 156, 107, 0.2);
  --line-soft: rgba(255, 255, 255, 0.08);
  --text: #f7f3ec;
  --muted: #aab4c0;
  --brand: #c79c6b;
  --brand-strong: #dfb27e;
  --brand-soft: rgba(199, 156, 107, 0.14);
  --cyan: #6beef8;
  --cyan-soft: rgba(107, 238, 248, 0.12);
  --navy: #1c3947;
  --ok: #30d17d;
  --warn: #f7b955;
  --danger: #ff6d78;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.42);
  font-family: "Heebo", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  position: relative;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  z-index: -2;
  background:
    linear-gradient(180deg, rgba(4, 6, 8, 0.72) 0%, rgba(4, 6, 8, 0.92) 52%, rgba(4, 6, 8, 0.98) 100%),
    url('/assets/brand/Carga_domestica_evinka.jpg') center top / cover no-repeat;
  opacity: 0.22;
}

body::after {
  z-index: -1;
  background:
    radial-gradient(circle at top left, rgba(107, 238, 248, 0.14), transparent 26%),
    radial-gradient(circle at top right, rgba(199, 156, 107, 0.16), transparent 24%),
    linear-gradient(180deg, rgba(28, 57, 71, 0.15), transparent 24%);
}

img { max-width: 100%; }

a { color: inherit; }

h1, h2 { margin: 0; }

.app-shell {
  max-width: 1600px;
  margin: 0 auto;
  padding: 32px 28px 48px;
}

.card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(17, 22, 29, 0.88), rgba(10, 13, 18, 0.92));
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.card::after {
  content: "";
  position: absolute;
  inset: 1px 1px auto 1px;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.12), transparent 30%, rgba(107, 238, 248, 0.12) 70%, transparent);
  pointer-events: none;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  gap: 28px;
  align-items: end;
  padding: 34px;
  margin-bottom: 22px;
  background:
    linear-gradient(110deg, rgba(7, 10, 14, 0.92) 0%, rgba(7, 10, 14, 0.8) 45%, rgba(7, 10, 14, 0.56) 100%),
    linear-gradient(180deg, rgba(28, 57, 71, 0.24), rgba(0, 0, 0, 0.08)),
    url('/assets/brand/Carga_rapida_evinka.jpg') center center / cover no-repeat;
}

.hero-copy,
.hero-actions,
.login-brand,
.login-form,
.login-error {
  position: relative;
  z-index: 1;
}

.hero-mark {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 110px;
  opacity: 0.14;
  filter: brightness(3.2) saturate(0.9);
}

.brand-logo {
  display: block;
  width: min(240px, 52vw);
  height: auto;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--brand-strong);
}

h1 {
  font-size: clamp(2.2rem, 3vw, 3.3rem);
  line-height: 0.98;
  max-width: 14ch;
}

.subtitle,
.panel-head p,
.meta-label,
.summary-trend,
.muted,
.alert-sub,
.empty,
.empty-box,
.incident-detail,
.station-meta,
.connector-meta,
.login-form label span {
  color: var(--muted);
}

.subtitle {
  margin: 12px 0 0;
  max-width: 56ch;
  font-size: 1.02rem;
  line-height: 1.5;
}

.hero-chips,
.hero-actions,
.toolbar,
.alert-meta,
.station-title,
.connector-head,
.alert-top,
.incident-head,
.meta-status {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-chips {
  margin-top: 22px;
}

.hero-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(107, 238, 248, 0.16);
  background: rgba(255, 255, 255, 0.05);
  color: #dfeaf3;
  font-size: 0.92rem;
  line-height: 1;
}

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

.meta-status {
  align-items: center;
  justify-content: flex-end;
}

.button,
.input {
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  background: rgba(8, 11, 15, 0.78);
  color: var(--text);
  padding: 13px 16px;
  font: inherit;
}

.input::placeholder { color: #83909f; }

.button {
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.button:hover {
  transform: translateY(-1px);
  border-color: rgba(107, 238, 248, 0.3);
}

.button.primary {
  border-color: transparent;
  color: #17110b;
  background: linear-gradient(180deg, var(--brand-strong), #b88656);
  box-shadow: 0 12px 28px rgba(199, 156, 107, 0.26);
}

.button.primary:hover {
  border-color: transparent;
  filter: brightness(1.03);
}

.button.ghost {
  background: rgba(107, 238, 248, 0.08);
  border-color: rgba(107, 238, 248, 0.16);
}

.button.subtle {
  background: rgba(255, 255, 255, 0.05);
}

@media (prefers-reduced-motion: reduce) {
  .button,
  .pulse {
    transition: none;
    animation: none;
  }
}

.meta-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  padding: 20px 22px;
  margin-bottom: 24px;
}

.meta-bar > div {
  padding: 8px 10px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.meta-bar strong {
  display: block;
  margin-top: 4px;
  font-size: 1.02rem;
}

.pulse {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(48, 209, 125, 0.42);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(48, 209, 125, 0.42); }
  70% { box-shadow: 0 0 0 14px rgba(48, 209, 125, 0); }
  100% { box-shadow: 0 0 0 0 rgba(48, 209, 125, 0); }
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.summary-card {
  min-height: 128px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(20, 25, 33, 0.88), rgba(11, 14, 18, 0.9));
}

.summary-label {
  color: #d3dbe5;
  font-size: 0.98rem;
}

.summary-value {
  font-size: clamp(2rem, 4vw, 2.7rem);
  line-height: 1;
}

.summary-card.status-totalStations,
.summary-card.status-totalConnectors {
  border-color: rgba(107, 238, 248, 0.22);
}

.summary-card.status-available { border-color: rgba(48, 209, 125, 0.26); }
.summary-card.status-offline { border-color: rgba(170, 180, 192, 0.22); }
.summary-card.status-charging { border-color: rgba(107, 238, 248, 0.28); }
.summary-card.status-preparing { border-color: rgba(247, 185, 85, 0.26); }
.summary-card.status-faulted { border-color: rgba(255, 109, 120, 0.28); }

.incident-grid,
.panel-grid {
  display: grid;
  gap: 24px;
}

.incident-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 24px;
}

.panel-grid {
  grid-template-columns: minmax(0, 1.65fr) minmax(360px, 0.85fr);
}

.panel-stack { display: grid; gap: 24px; }

.panel {
  padding: 20px;
  background: linear-gradient(180deg, rgba(15, 20, 26, 0.88), rgba(9, 12, 16, 0.9));
}

.panel-wide { min-width: 0; }

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-head.compact { align-items: center; }

.panel-head p {
  margin: 8px 0 0;
  max-width: 52ch;
}

.incident-panel.critical { border-color: rgba(255, 109, 120, 0.22); }
.incident-panel.warning { border-color: rgba(247, 185, 85, 0.22); }

.incident-list,
.alerts-list,
.connector-list,
.insights,
.incident-alert-list {
  display: grid;
  gap: 12px;
}

.incident-item,
.alert-item,
.connector-item,
.insight-row {
  padding: 14px 16px;
  border-radius: 20px;
  background: rgba(7, 10, 14, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.incident-critical,
.alert-item.high { border-color: rgba(255, 109, 120, 0.28); }
.incident-warning,
.alert-item.medium { border-color: rgba(247, 185, 85, 0.25); }

.incident-head,
.alert-top,
.connector-head {
  align-items: center;
  justify-content: space-between;
}

.incident-alert-row {
  display: grid;
  gap: 4px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.incident-alert-row:first-child {
  padding-top: 0;
  border-top: 0;
}

.input {
  min-width: 220px;
  outline: none;
}

.input:focus {
  border-color: rgba(107, 238, 248, 0.28);
  box-shadow: 0 0 0 3px rgba(107, 238, 248, 0.08);
}

.select { min-width: 180px; }

.table-wrap {
  overflow: auto;
  border-radius: 22px;
  border: 1px solid rgba(199, 156, 107, 0.14);
  background: rgba(5, 7, 10, 0.5);
}

.table-wrap table {
  width: 100%;
  min-width: 1050px;
  border-collapse: collapse;
}

thead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(19, 29, 38, 0.98), rgba(9, 12, 16, 0.98));
}

th,
td {
  padding: 16px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: top;
}

th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #d1ad81;
}

tr:hover td { background: rgba(107, 238, 248, 0.035); }

.station-title { align-items: center; }
.station-meta { margin-top: 6px; font-size: 0.92rem; }
.connector-meta { margin-top: 8px; font-size: 0.9rem; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
}

.badge.status-available { color: #63e39b; background: rgba(48, 209, 125, 0.1); }
.badge.status-offline { color: #d3dbe5; background: rgba(170, 180, 192, 0.1); }
.badge.status-charging { color: #74f2fb; background: rgba(107, 238, 248, 0.1); }
.badge.status-preparing { color: #f7c265; background: rgba(247, 185, 85, 0.12); }
.badge.status-faulted { color: #ff9099; background: rgba(255, 109, 120, 0.12); }
.badge.status-suspended,
.badge.status-finishing,
.badge.status-reserved,
.badge.status-unavailable { color: #c8abff; background: rgba(139, 92, 246, 0.12); }
.badge.status-unknown { color: #aab4c0; background: rgba(170, 180, 192, 0.1); }
.badge.heartbeat-fresh { color: #63e39b; background: rgba(48, 209, 125, 0.1); }
.badge.heartbeat-recent { color: #f7c265; background: rgba(247, 185, 85, 0.12); }
.badge.heartbeat-stale { color: #ff9099; background: rgba(255, 109, 120, 0.12); }

.counter {
  min-width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--text);
  font-weight: 800;
}

.insight-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.insight-label { color: var(--muted); }
.insight-value { font-weight: 800; }

.empty,
.empty-box {
  text-align: center;
  padding: 28px !important;
}

.login-body {
  display: grid;
  place-items: center;
  padding: 18px;
}

.login-body::before {
  opacity: 0.34;
  background:
    linear-gradient(180deg, rgba(4, 6, 8, 0.72) 0%, rgba(4, 6, 8, 0.9) 60%, rgba(4, 6, 8, 0.96) 100%),
    url('/assets/brand/Carga-comercial-2-e1700493164677.jpg') center center / cover no-repeat;
}

.login-shell {
  width: min(100%, 520px);
  padding: 32px 8px;
}

.login-card {
  padding: 30px;
  border-color: rgba(199, 156, 107, 0.24);
  background:
    linear-gradient(180deg, rgba(10, 13, 18, 0.9), rgba(8, 11, 15, 0.94)),
    url('/assets/brand/Carga-comercial-2-e1700493164677.jpg') center center / cover no-repeat;
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(140deg, rgba(28, 57, 71, 0.18), transparent 45%);
  pointer-events: none;
}

.login-mark {
  width: 120px;
  opacity: 0.16;
}

.login-brand {
  margin-bottom: 14px;
}

.login-logo {
  width: min(230px, 60vw);
  margin-bottom: 14px;
}

.login-brand h1 {
  margin-top: 6px;
  line-height: 1.02;
  max-width: 12ch;
  text-wrap: balance;
}

.login-brand .subtitle {
  max-width: 34ch;
  color: #b7c4d0;
}

.login-form {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.login-form label {
  display: grid;
  gap: 7px;
}

.login-form .input {
  min-width: 0;
  width: 100%;
  height: 50px;
  background: rgba(7, 10, 14, 0.82);
}

.login-button {
  width: 100%;
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.login-error {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 109, 120, 0.35);
  background: rgba(255, 109, 120, 0.08);
  color: #ffc8cd;
  line-height: 1.35;
}

.login-error[hidden] { display: none; }

@media (max-width: 1280px) {
  .summary-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .panel-grid,
  .incident-grid { grid-template-columns: 1fr; }
  .meta-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .app-shell { padding: 18px 16px 32px; }
  .hero,
  .panel-head,
  .meta-bar,
  .hero-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .hero {
    gap: 18px;
    padding: 24px 20px;
    margin-bottom: 16px;
  }

  .hero-actions { gap: 10px; }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
  }

  .incident-grid,
  .meta-bar { margin-bottom: 18px; }

  .toolbar { width: 100%; }

  .input,
  .select,
  .button { width: 100%; }

  .panel { padding: 16px; }
  .panel-stack { gap: 18px; }
  .table-wrap table { min-width: 920px; }
  .meta-status { justify-content: flex-start; }
  .counter { min-width: 34px; height: 34px; }
  .hero-mark { width: 84px; }
}

@media (max-width: 640px) {
  .incident-head { flex-direction: column; align-items: flex-start; }
  .meta-bar,
  .summary-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .app-shell { padding: 14px 12px 28px; }
  .brand-logo { width: min(200px, 68vw); }
  .login-shell { padding: 18px 4px; }
  .login-card { padding: 24px 22px; border-radius: 24px; }
  .login-brand h1,
  .login-brand .subtitle,
  h1 { max-width: none; }
}
