:root {
  color-scheme: dark;
  --bg: #071015;
  --bg-soft: #0b151c;
  --sidebar: #0d1821;
  --panel: #14202a;
  --panel-2: #182631;
  --panel-3: #1d2d38;
  --line: rgba(255, 255, 255, 0.075);
  --line-strong: rgba(255, 255, 255, 0.13);
  --text: #f4f7fb;
  --muted: #a8b5c0;
  --muted-2: #748592;
  --blue: #2682ff;
  --blue-soft: rgba(38, 130, 255, 0.2);
  --green: #2bc96f;
  --yellow: #ffd33d;
  --purple: #9b5cff;
  --red: #ff5f56;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.22);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 24% 14%, rgba(38, 130, 255, 0.11), transparent 26rem),
    linear-gradient(135deg, #071015 0%, #0c161d 48%, #081017 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
p,
dl,
dd {
  margin: 0;
}

button,
select {
  font: inherit;
}

.dashboard-shell {
  width: 100%;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-width: 0;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 26px;
  padding: 24px 18px;
  background: linear-gradient(180deg, rgba(13, 24, 33, 0.96), rgba(10, 18, 25, 0.94));
  border-right: 1px solid var(--line);
  overflow: hidden;
}

.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(38, 130, 255, 0.55);
  border-radius: 8px;
  color: #8fc0ff;
  background: rgba(38, 130, 255, 0.16);
  font-weight: 800;
}

.brand strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.18rem;
}

.brand span:last-child,
.system-card span,
.system-card dt,
.footnote,
.eyebrow {
  color: var(--muted);
}

.brand span:last-child {
  display: block;
  margin-top: 2px;
  font-size: 0.9rem;
}

.nav-list {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 8px;
}

.nav-list a {
  min-width: 0;
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 8px;
  color: #d9e2ea;
  font-size: 0.96rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-list a.active {
  background: linear-gradient(135deg, #2369db, #1e55bb);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09);
}

.system-card {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.025));
  box-shadow: var(--shadow);
}

.status-dot {
  width: 12px;
  height: 12px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 18px rgba(43, 201, 111, 0.42);
}

.system-card strong {
  display: block;
  font-size: 0.94rem;
}

.system-card span {
  display: block;
  margin-top: 3px;
  font-size: 0.85rem;
}

.system-card dl {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.system-card div,
.system-card dl div {
  min-width: 0;
}

.system-card dd {
  margin-top: 2px;
  overflow: hidden;
  color: var(--text);
  font-size: 0.86rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-main {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 24px;
}

.topbar {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.eyebrow {
  margin-bottom: 4px;
  font-size: 0.9rem;
}

h1 {
  font-size: 1.55rem;
  line-height: 1.1;
  letter-spacing: 0;
}

h2 {
  font-size: 1.08rem;
  letter-spacing: 0;
}

h3 {
  margin-top: 16px;
  margin-bottom: 10px;
  color: #e8eef5;
  font-size: 0.92rem;
  font-weight: 650;
}

.topbar-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.date-chip,
.icon-button,
.mode-select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.date-chip {
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: #e4ebf2;
  white-space: nowrap;
}

.icon-button {
  width: 40px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.icon-button:hover {
  border-color: rgba(38, 130, 255, 0.5);
  background: rgba(38, 130, 255, 0.14);
}

.mode-select {
  width: 104px;
  padding: 0 12px;
}

.metric-strip,
.content-grid,
.lower-grid,
.status-grid {
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 14px;
}

.metric-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 14px;
}

.content-grid {
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.05fr);
  align-items: stretch;
  margin-bottom: 14px;
}

.lower-grid {
  grid-template-columns: minmax(0, 0.86fr) minmax(0, 0.86fr) minmax(0, 1.05fr);
  margin-bottom: 14px;
}

.metric-card,
.panel,
.status-grid div {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025)),
    var(--panel);
  box-shadow: var(--shadow);
}

.metric-card {
  min-height: 168px;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 8px;
  padding: 18px 20px 16px;
}

.metric-heading,
.panel-header {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.metric-heading {
  justify-content: flex-start;
  color: #e6edf5;
}

.metric-heading > span:last-child,
.panel-header span,
.metric-card > span,
.phase-stat small,
.summary-tile small,
.price-card small,
.status-grid span,
.legend-list dt {
  color: var(--muted);
}

.metric-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 800;
}

.accent-yellow .metric-icon {
  color: #1a1c0b;
  background: var(--yellow);
}

.accent-blue .metric-icon {
  color: #061426;
  background: #3aa0ff;
}

.accent-green .metric-icon {
  color: #041409;
  background: var(--green);
}

.accent-red .metric-icon {
  color: #210807;
  background: var(--red);
}

.metric-card strong {
  min-width: 0;
  display: block;
  overflow-wrap: anywhere;
  color: #fff;
  font-size: clamp(1.55rem, 2.3vw, 2.1rem);
  font-weight: 760;
  letter-spacing: 0;
}

.panel {
  padding: 18px;
}

.panel-header {
  margin-bottom: 16px;
}

.phase-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.phase-stat {
  min-width: 0;
  position: relative;
  padding-left: 22px;
}

.phase-stat::before {
  position: absolute;
  top: 7px;
  left: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  content: "";
}

.phase-l1::before {
  background: var(--yellow);
}

.phase-l2::before {
  background: var(--green);
}

.phase-l3::before {
  background: var(--purple);
}

.phase-stat span,
.phase-stat strong,
.phase-stat small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phase-stat strong {
  margin-top: 8px;
  font-size: 1.75rem;
  font-weight: 720;
}

.phase-stat small {
  margin-top: 4px;
  font-size: 0.9rem;
}

.consumption-grid,
.price-cards {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.consumption-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.summary-tile,
.price-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.02));
}

.summary-tile {
  min-height: 244px;
  display: grid;
  grid-template-rows: auto auto minmax(54px, 1fr) auto auto;
  gap: 10px;
  padding: 18px;
}

.summary-tile span,
.price-card span {
  color: #ecf2f8;
}

.summary-tile strong {
  overflow-wrap: anywhere;
  font-size: clamp(1.65rem, 2.6vw, 2.2rem);
  letter-spacing: 0;
}

.summary-tile b,
.price-card strong {
  overflow-wrap: anywhere;
  font-size: 1.55rem;
  font-weight: 680;
}

.bar-strip {
  min-width: 0;
  height: 58px;
  display: flex;
  align-items: end;
  gap: 4px;
  overflow: hidden;
}

.bar-strip i {
  display: block;
  flex: 1 1 4px;
  min-width: 3px;
  max-width: 12px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, #2e8bff, #1f58c7);
}

.chart-frame,
.mini-chart-frame,
.donut-frame {
  position: relative;
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.chart-frame {
  height: 238px;
}

.chart-frame.large {
  height: 250px;
}

.price-chart-frame {
  height: 146px;
}

.mini-chart-frame {
  height: 42px;
}

.donut-frame {
  height: 188px;
  max-width: 210px;
}

canvas {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
}

.cost-layout {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(150px, 0.95fr) minmax(0, 1.05fr);
  gap: 16px;
  align-items: center;
}

.legend-list {
  min-width: 0;
  display: grid;
  gap: 12px;
}

.legend-list div {
  min-width: 0;
  position: relative;
  padding-left: 18px;
}

.legend-list div::before {
  position: absolute;
  top: 6px;
  left: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  content: "";
}

.legend-list div:nth-child(1)::before {
  background: var(--blue);
}

.legend-list div:nth-child(2)::before {
  background: var(--green);
}

.legend-list div:nth-child(3)::before {
  background: var(--yellow);
}

.legend-list dd {
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.price-cards {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.price-card {
  display: grid;
  gap: 8px;
  padding: 16px;
}

.price-card small {
  color: #3aa0ff;
}

.status-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.status-grid div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 12px 14px;
}

.status-grid strong,
.status-grid span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.footnote {
  margin-top: 14px;
  font-size: 0.9rem;
}

@media (max-width: 1180px) {
  .metric-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .content-grid,
  .lower-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .dashboard-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: static;
    height: auto;
    grid-template-rows: auto auto;
    padding: 16px;
  }

  .nav-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .system-card {
    display: none;
  }

  .dashboard-main {
    padding: 18px 16px 24px;
  }
}

@media (max-width: 680px) {
  .topbar,
  .topbar-actions {
    align-items: stretch;
  }

  .topbar {
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .date-chip {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .metric-strip,
  .phase-metrics,
  .consumption-grid,
  .price-cards,
  .status-grid,
  .cost-layout {
    grid-template-columns: 1fr;
  }

  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-card {
    min-height: 146px;
  }

  .chart-frame,
  .chart-frame.large {
    height: 220px;
  }

  .donut-frame {
    max-width: none;
  }
}
