:root {
  --bg: #edf3fb;
  --bg-2: #f8fbff;
  --surface: #ffffff;
  --surface-soft: #f5f8fc;
  --surface-tint: #eef4ff;
  --text: #15223d;
  --muted: #64748b;
  --border: #d7e1ef;
  --primary: #1f6feb;
  --primary-dark: #1959bd;
  --primary-soft: #eaf2ff;
  --success: #1f9d63;
  --success-soft: #e7f7ef;
  --warning: #d79c17;
  --warning-soft: #fcf5de;
  --danger: #e45757;
  --danger-soft: #fdebec;
  --info: #8aa3c8;
  --shadow-sm: 0 12px 30px rgba(16, 37, 74, 0.06);
  --shadow-md: 0 20px 55px rgba(16, 37, 74, 0.1);
  --radius-xl: 30px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --sidebar: 250px;
  --page-width: 1440px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(31, 111, 235, 0.07), transparent 30%),
    linear-gradient(180deg, #f3f7fd 0%, var(--bg) 100%);
  color: var(--text);
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }

.demo-shell {
  width: min(calc(100% - 24px), var(--page-width));
  margin: 24px auto;
  background: rgba(255,255,255,0.74);
  border: 1px solid rgba(215,225,239,0.9);
  border-radius: 36px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.demo-layout {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  min-height: calc(100vh - 48px);
}

.sidebar {
  padding: 28px 22px;
  background: linear-gradient(180deg, #eef3fd 0%, #edf3fb 100%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.sidebar-brand {
  display: grid;
  gap: 18px;
}

.sidebar-brand img {
  width: 190px;
  height: auto;
}

.sidebar-nav {
  display: grid;
  gap: 10px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 16px;
  border-radius: 18px;
  color: #50617f;
  font-weight: 600;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.sidebar-link:hover,
.sidebar-link:focus-visible {
  background: rgba(255,255,255,0.75);
  color: var(--text);
}

.sidebar-link.active {
  background: #ffffff;
  color: var(--primary);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.nav-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #b7c7df;
}

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

.site-card,
.card,
.zone-card,
.metric-box,
.alert-card,
.integration-card,
.task-card,
.timeline-entry,
.detail-card,
.kpi-card,
.empty-state,
.panel {
  background: rgba(255,255,255,0.86);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.site-card {
  margin-top: auto;
  padding: 20px;
  display: grid;
  gap: 10px;
  background: linear-gradient(180deg, rgba(255,255,255,0.92) 0%, rgba(244,249,255,0.9) 100%);
}

.site-card .label,
.mini-label,
.card-eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.site-card strong {
  font-size: 1.6rem;
  line-height: 1.05;
}

.site-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.content {
  padding: 28px;
  display: grid;
  gap: 20px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.page-title {
  margin: 0;
  font-size: clamp(2.2rem, 4vw, 3.35rem);
  letter-spacing: -0.04em;
  line-height: 0.95;
}

.page-subtitle {
  margin: 10px 0 0;
  color: #607396;
  font-size: 1.18rem;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.badge,
.status-chip,
.small-pill,
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.92);
  color: #52627f;
  font-size: 0.92rem;
  font-weight: 700;
}

.badge-dot,
.status-dot,
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.badge-dot.live { background: var(--success); }
.badge-dot.sim { background: var(--primary); }
.badge-dot.warn { background: var(--warning); }

.header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  max-width: 560px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-weight: 700;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  box-shadow: var(--shadow-sm);
}

.btn:hover,
.btn:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 16px 38px rgba(16, 37, 74, 0.12);
}

.btn.primary {
  color: #fff;
  background: linear-gradient(180deg, #3f8bf6 0%, var(--primary) 100%);
  border-color: transparent;
}

.btn.secondary { background: var(--primary-soft); color: var(--primary-dark); }
.btn.ghost { background: rgba(255,255,255,0.72); }
.btn.warning { background: var(--warning-soft); color: #9a6a00; }
.btn.danger { background: var(--danger-soft); color: #b83345; }
.btn.success { background: var(--success-soft); color: #117847; }
.btn.small { min-height: 38px; padding: 0 12px; font-size: 0.9rem; border-radius: 12px; }
.btn[disabled] { opacity: 0.55; cursor: default; transform: none; }

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 18px;
}

.toolbar-group { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

select,
input[type="search"] {
  min-height: 46px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.filter-chip { cursor: pointer; user-select: none; }
.filter-chip.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
  border-color: rgba(31,111,235,0.25);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.kpi-card {
  padding: 20px;
  display: grid;
  gap: 12px;
}

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

.kpi-card h3,
.panel h3,
.section-title,
.zone-card h3,
.detail-card h3,
.integration-card h3,
.task-card h3,
.alert-card h3,
.timeline-entry h3 {
  margin: 0;
  font-size: 0.92rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.kpi-value {
  font-size: clamp(2.1rem, 4vw, 3rem);
  line-height: 0.95;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.kpi-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.kpi-foot .small-pill {
  font-size: 0.88rem;
  padding: 7px 12px;
}

.small-pill.positive { background: var(--success-soft); color: #117847; }
.small-pill.negative { background: var(--danger-soft); color: #b83345; }
.small-pill.info { background: #eef4f8; color: #4d6682; }
.small-pill.warning { background: var(--warning-soft); color: #9a6a00; }

.kpi-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--surface-tint);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: var(--primary);
}

.kpi-icon.success { background: var(--success-soft); color: var(--success); }
.kpi-icon.warning { background: var(--warning-soft); color: var(--warning); }
.kpi-icon.danger { background: var(--danger-soft); color: var(--danger); }
.kpi-icon.info { background: #eef4f8; color: var(--info); }

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(320px, 0.92fr);
  gap: 18px;
  align-items: start;
}

.panel {
  padding: 22px;
  display: grid;
  gap: 16px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.panel-header p,
.panel-subtitle,
.muted,
.helper {
  margin: 0;
  color: var(--muted);
}

.legend-row,
.metrics-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #40506b;
  font-weight: 700;
}

.legend-dot.stable { background: var(--success); }
.legend-dot.watch { background: var(--warning); }
.legend-dot.critical { background: var(--danger); }
.legend-dot.info { background: var(--primary); }

.zone-map {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.zone-card {
  position: relative;
  padding: 16px;
  min-height: 132px;
  display: grid;
  gap: 8px;
  align-content: start;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  cursor: pointer;
}

.zone-card:hover,
.zone-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.zone-card.selected {
  border-color: rgba(31, 111, 235, 0.45);
  box-shadow: 0 0 0 3px rgba(31,111,235,0.12);
}

.zone-card.stable { background: linear-gradient(180deg, #effaf5 0%, #e9f7ef 100%); }
.zone-card.watch { background: linear-gradient(180deg, #fff9e8 0%, #fcf5de 100%); }
.zone-card.critical { background: linear-gradient(180deg, #fff0f1 0%, #fdebec 100%); }
.zone-card.idle { background: linear-gradient(180deg, #f7f9fd 0%, #f1f4fa 100%); }

.zone-card .zone-name {
  font-size: 1.95rem;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.zone-card .zone-status {
  font-weight: 700;
  color: #485b78;
}

.zone-card .zone-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  color: #5a6d8d;
  font-size: 0.92rem;
}

.zone-card .risk-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  min-width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(255,255,255,0.9);
  font-size: 0.88rem;
  font-weight: 800;
}

.zone-card .signal-cluster {
  display: flex;
  gap: 6px;
  align-items: center;
}

.signal-cluster span {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  opacity: 0.95;
}

.signal-cluster span:nth-child(1) { background: #6fd7a5; }
.signal-cluster span:nth-child(2) { background: #2ba266; }
.signal-cluster span:nth-child(3) { background: rgba(31,111,235,0.18); border: 1px dashed rgba(31,111,235,0.5); }

.side-stack {
  display: grid;
  gap: 16px;
}

.priority-panel {
  background: linear-gradient(180deg, #eef8f4 0%, #edf7f1 100%);
}

.priority-title {
  color: #2c9164;
  font-weight: 800;
  font-size: 1.1rem;
}

.priority-zone {
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 0.95;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.priority-issue {
  font-size: 1.2rem;
  font-weight: 700;
}

.priority-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.priority-grid .metric-box {
  padding: 14px;
  display: grid;
  gap: 6px;
}

.metric-box strong {
  font-size: 1.25rem;
  line-height: 1;
}

.recommendation-list,
.event-list,
.detail-list,
.integration-list,
.signal-list {
  display: grid;
  gap: 10px;
}

.recommendation-list li,
.signal-list li {
  color: #4f6180;
}

.recommendation-list { margin: 0; padding-left: 20px; }

.trend-chart,
.sparkline,
.history-chart {
  width: 100%;
  min-height: 170px;
  border-radius: 18px;
  background: linear-gradient(180deg, #f8fbff 0%, #f2f6fd 100%);
  border: 1px solid #e4ebf5;
  padding: 14px;
}

.trend-chart svg,
.sparkline svg,
.history-chart svg { width: 100%; height: 100%; display: block; }

.link-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.link-row a {
  color: var(--primary);
  font-weight: 800;
}

.summary-grid,
.metrics-grid,
.zone-detail-grid,
.integration-grid,
.task-board,
.alert-grid,
.stats-grid {
  display: grid;
  gap: 16px;
}

.summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metrics-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.zone-detail-grid { grid-template-columns: minmax(0, 1.18fr) minmax(340px, 0.82fr); }
.integration-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.alert-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.metric-box,
.detail-card,
.alert-card,
.integration-card,
.task-card,
.timeline-entry {
  padding: 18px;
  display: grid;
  gap: 12px;
}

.metric-box .value {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.metric-box .trend {
  font-weight: 700;
  color: #4d6682;
  font-size: 0.95rem;
}

.metric-box.good .value { color: var(--success); }
.metric-box.warn .value { color: var(--warning); }
.metric-box.bad .value { color: var(--danger); }
.metric-box.info .value { color: var(--primary); }

.zone-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.zone-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 700;
}

.zone-status-chip.stable { background: var(--success-soft); color: #117847; }
.zone-status-chip.watch { background: var(--warning-soft); color: #9a6a00; }
.zone-status-chip.critical { background: var(--danger-soft); color: #b83345; }

.meter {
  display: grid;
  gap: 8px;
}

.meter-label-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-weight: 700;
  color: #4a5d7c;
}

.meter-bar {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: #edf2f8;
  overflow: hidden;
  border: 1px solid #e1e8f2;
}

.meter-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4d93f4 0%, var(--primary) 100%);
}

.meter-fill.success { background: linear-gradient(90deg, #52c48a 0%, var(--success) 100%); }
.meter-fill.warning { background: linear-gradient(90deg, #f0c760 0%, var(--warning) 100%); }
.meter-fill.danger { background: linear-gradient(90deg, #f08a8a 0%, var(--danger) 100%); }

.table-list,
.timeline-list,
.task-list,
.integration-list,
.alert-list {
  display: grid;
  gap: 12px;
}

.alert-card,
.integration-card,
.task-card,
.timeline-entry {
  position: relative;
}

.card-top-row {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.severity-pill,
.integration-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 800;
}

.severity-low,
.integration-status.connected { background: var(--success-soft); color: #117847; }
.severity-medium,
.integration-status.delayed { background: var(--warning-soft); color: #9a6a00; }
.severity-high,
.severity-critical,
.integration-status.degraded,
.integration-status.disconnected { background: var(--danger-soft); color: #b83345; }
.integration-status.degraded { background: #eef4f8; color: #4d6682; }

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: #5b6d8c;
  font-size: 0.92rem;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.timeline-entry::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 24px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 4px var(--bg);
}

.timeline-wrap {
  padding-left: 20px;
  border-left: 2px dashed #d9e4f2;
  display: grid;
  gap: 16px;
}

.empty-state {
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

.mobile-topnav {
  display: none;
  gap: 10px;
  overflow: auto;
  padding-bottom: 4px;
}

.mobile-topnav .sidebar-link {
  min-width: max-content;
  padding: 12px 14px;
}

.footer-note {
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 1200px) {
  .overview-grid,
  .zone-detail-grid,
  .integration-grid,
  .alert-grid,
  .summary-grid,
  .metrics-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .demo-layout { grid-template-columns: 1fr; }
  .sidebar {
    display: none;
  }
  .mobile-topnav {
    display: flex;
  }
}

@media (max-width: 860px) {
  .content { padding: 18px; }
  .demo-shell { width: min(calc(100% - 12px), var(--page-width)); margin: 8px auto; border-radius: 24px; }
  .topbar { flex-direction: column; }
  .header-actions { justify-content: flex-start; }
  .kpi-grid { grid-template-columns: 1fr; }
  .zone-map { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .task-board,
  .integration-grid,
  .alert-grid,
  .metrics-grid,
  .summary-grid,
  .stats-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .zone-map { grid-template-columns: 1fr; }
  .page-title { font-size: 2rem; }
  .page-subtitle { font-size: 1rem; }
  .btn { width: 100%; }
  .header-actions, .toolbar-group { width: 100%; }
}


.sidebar-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.demo-lang-switcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.92);
  border-radius: 999px;
}
.lang-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 700;
  color: #607396;
}
.lang-chip.active {
  background: var(--primary);
  color: #fff;
}
.lang-chip a {
  color: inherit;
}
.site-return-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--primary-dark);
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}
.header-stack {
  display: grid;
  gap: 12px;
  justify-items: end;
}
.header-utility-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}
@media (max-width: 1100px) {
  .header-stack { justify-items: stretch; width: 100%; }
  .header-utility-row { justify-content: flex-start; }
}
@media (max-width: 820px) {
  .sidebar-top-row { align-items: center; }
  .site-return-link { width: fit-content; }
}
