:root {
  color-scheme: dark;
  --bg: #06101d;
  --bg-deep: #030914;
  --panel: rgba(13, 27, 45, 0.86);
  --panel-soft: rgba(15, 31, 51, 0.72);
  --line: rgba(151, 175, 211, 0.16);
  --text: #f7f8fb;
  --muted: #aab5c7;
  --orange: #ff7a00;
  --orange-2: #ffb14a;
  --green: #43dc67;
  --blue: #36a8ff;
  --purple: #b77cff;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 122, 0, 0.13), transparent 26%),
    radial-gradient(circle at 75% 16%, rgba(30, 221, 115, 0.11), transparent 22%),
    linear-gradient(135deg, var(--bg-deep), var(--bg) 46%, #081420);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr);
  min-height: 100vh;
  overflow-x: hidden;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(10, 23, 39, 0.92), rgba(5, 14, 27, 0.95));
}

.brand {
  display: grid;
  place-items: center;
  height: 110px;
  border: 1px solid rgba(151, 175, 211, 0.24);
  border-radius: 14px;
  background: radial-gradient(circle, rgba(255, 112, 0, 0.22), rgba(255, 112, 0, 0.02) 58%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.brand span {
  font-size: 54px;
  filter: drop-shadow(0 0 20px rgba(255, 96, 0, 0.75));
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  min-height: 70px;
  color: var(--muted);
  border: 0;
  border-radius: 10px;
  background: transparent;
  display: grid;
  place-items: center;
  gap: 4px;
}

.nav-item span {
  font-size: 22px;
}

.nav-item small {
  font-size: 13px;
}

.nav-item.active {
  color: var(--orange-2);
  border: 1px solid var(--orange);
  background: linear-gradient(135deg, rgba(255, 122, 0, 0.19), rgba(255, 122, 0, 0.05));
  box-shadow: 0 0 24px rgba(255, 122, 0, 0.2);
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 8px;
}

.mode-toggle,
.info-btn {
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(16, 32, 52, 0.72);
  color: var(--muted);
  padding: 10px 12px;
}

.mode-toggle {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  font-size: 13px;
}

.mode-toggle input {
  width: 40px;
  height: 22px;
  accent-color: var(--orange);
}

.info-btn {
  text-align: left;
}

.dashboard {
  width: 100%;
  max-width: 1780px;
  padding: 22px 28px 14px 34px;
  display: grid;
  gap: 12px;
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 3vw, 34px);
  line-height: 1.05;
  letter-spacing: 0;
}

.topbar p,
.panel-title p,
.panel-header span {
  color: var(--muted);
}

.topbar p {
  margin-top: 8px;
  font-size: 14px;
}

.weather-card {
  min-width: 265px;
  min-height: 64px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(12, 24, 42, 0.72);
}

.weather-icon {
  font-size: 28px;
}

.weather-card strong,
.weather-card span {
  display: block;
}

.clock {
  text-align: right;
}

.clock strong {
  font-size: 21px;
}

.weather-card span {
  color: var(--muted);
  font-size: 13px;
}

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

.metric-card,
.panel,
.action-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.metric-card {
  min-height: 146px;
  padding: 20px 22px;
  display: grid;
  grid-template-columns: 78px 1fr;
  align-items: center;
  gap: 17px;
}

.metric-icon {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-size: 38px;
}

.metric-card.hot {
  background: linear-gradient(135deg, rgba(83, 39, 23, 0.86), rgba(12, 22, 35, 0.86));
}

.metric-card.hot .metric-icon {
  background: radial-gradient(circle, rgba(255, 119, 0, 0.55), rgba(111, 49, 0, 0.72));
}

.metric-card.blue .metric-icon {
  color: #91caff;
  background: radial-gradient(circle, rgba(32, 143, 255, 0.36), rgba(14, 64, 130, 0.55));
}

.metric-card.green {
  background: linear-gradient(135deg, rgba(15, 67, 48, 0.82), rgba(12, 27, 38, 0.86));
}

.metric-card.green .metric-icon {
  color: #72ef89;
  background: radial-gradient(circle, rgba(42, 210, 83, 0.35), rgba(14, 82, 40, 0.56));
}

.metric-card.purple .metric-icon {
  background: radial-gradient(circle, rgba(178, 105, 255, 0.42), rgba(64, 36, 116, 0.58));
}

.metric-card span {
  font-size: 15px;
}

.metric-card strong {
  display: block;
  margin-top: 6px;
  font-size: 38px;
  line-height: 1;
}

.metric-card p {
  margin-top: 6px;
  font-size: 17px;
}

.metric-card em {
  display: block;
  margin-top: 16px;
  color: var(--orange-2);
  font-style: normal;
}

.inline-action {
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font-weight: 700;
}

.metric-card.blue em {
  color: var(--blue);
}

.metric-card.green em {
  color: var(--green);
}

.metric-card.purple em {
  color: var(--purple);
}

.actions-grid {
  display: grid;
  grid-template-columns: minmax(0, 45%) minmax(0, 1fr);
  gap: 12px;
}

.action-card {
  min-height: 196px;
  padding: 20px 22px;
}

.ignition {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 18px;
  border-color: rgba(255, 122, 0, 0.48);
  background:
    linear-gradient(135deg, rgba(91, 35, 18, 0.72), rgba(15, 24, 35, 0.88)),
    var(--panel);
}

.refill {
  border-color: rgba(67, 220, 103, 0.33);
  background: linear-gradient(135deg, rgba(16, 74, 38, 0.72), rgba(8, 27, 34, 0.88));
}

.stove-art {
  position: relative;
  min-height: 156px;
  border-radius: 12px;
  background:
    linear-gradient(90deg, rgba(255, 122, 0, 0.09), transparent 45%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 24px),
    #12151b;
  overflow: hidden;
}

.stove-art::before {
  content: "";
  position: absolute;
  inset: 24px 36px 18px;
  border-radius: 18px 18px 8px 8px;
  background: linear-gradient(#232832, #090b10);
  box-shadow: 0 22px 36px rgba(0, 0, 0, 0.52);
}

.stove-window {
  position: absolute;
  inset: 45px 52px 46px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 122, 0, 0.22);
  border-radius: 8px;
  background: radial-gradient(circle at center 70%, rgba(255, 114, 0, 0.5), rgba(8, 10, 14, 0.92) 62%);
}

.flame {
  font-size: 58px;
  animation: flicker 1.35s infinite alternate ease-in-out;
}

@keyframes flicker {
  from {
    transform: scale(0.94) translateY(4px);
    filter: drop-shadow(0 0 12px rgba(255, 104, 0, 0.76));
  }
  to {
    transform: scale(1.08) translateY(-3px);
    filter: drop-shadow(0 0 28px rgba(255, 104, 0, 0.96));
  }
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-title > span {
  font-size: 33px;
  filter: drop-shadow(0 0 14px currentColor);
}

.panel-title h2 {
  font-size: 26px;
  line-height: 1.1;
}

.panel-title.orange {
  color: var(--orange-2);
}

.green-title {
  color: var(--green);
}

.button-row {
  display: grid;
  gap: 14px;
}

.wood-picker {
  display: grid;
  grid-template-columns: auto repeat(3, minmax(62px, 1fr));
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  color: var(--muted);
}

.wood-type {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.wood-type.active {
  border-color: var(--orange);
  background: rgba(255, 122, 0, 0.24);
}

.button-row.three {
  grid-template-columns: repeat(3, 1fr);
}

.button-row.six {
  grid-template-columns: repeat(3, 1fr);
}

.wood-btn {
  min-height: 54px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  font-size: 26px;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.wood-btn:hover {
  transform: translateY(-1px);
}

.wood-btn span {
  display: block;
  margin-top: 5px;
  font-size: 16px;
  font-weight: 500;
}

.ignite-btn.selected,
.ignite-btn:hover {
  border-color: var(--orange);
  background: linear-gradient(180deg, rgba(255, 130, 0, 0.82), rgba(180, 62, 0, 0.82));
}

.refill-btn {
  background: linear-gradient(180deg, rgba(32, 121, 57, 0.72), rgba(16, 74, 39, 0.82));
  border-color: rgba(89, 236, 122, 0.35);
}

.refill-btn:hover {
  border-color: rgba(108, 255, 137, 0.9);
  background: linear-gradient(180deg, rgba(50, 154, 78, 0.88), rgba(20, 93, 45, 0.9));
}

.lower-grid {
  display: grid;
  grid-template-columns: minmax(0, 33%) minmax(0, 31%) minmax(0, 1fr);
  gap: 14px;
}

.panel {
  padding: 16px 18px;
  min-height: 300px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 30px;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.panel-header h2 {
  font-size: 20px;
}

.panel-header button,
.range-tabs button,
.details-btn {
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.panel-header button {
  padding: 8px 12px;
  font-size: 13px;
}

.history-list {
  position: relative;
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.history-list::before {
  content: "";
  position: absolute;
  top: 16px;
  bottom: 10px;
  left: 98px;
  width: 2px;
  background: rgba(112, 255, 144, 0.17);
}

.history-item {
  position: relative;
  display: grid;
  grid-template-columns: 62px 40px 1fr 40px;
  gap: 10px;
  align-items: center;
  min-height: 48px;
}

.history-time strong,
.history-time span {
  display: block;
}

.history-time span {
  color: var(--muted);
}

.history-dot {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  z-index: 1;
}

.history-dot.orange {
  background: rgba(255, 112, 0, 0.18);
  border: 1px solid rgba(255, 112, 0, 0.5);
}

.history-dot.green {
  background: rgba(61, 219, 96, 0.18);
  border: 1px solid rgba(61, 219, 96, 0.5);
}

.history-text {
  padding: 9px 12px;
  border: 1px solid rgba(151, 175, 211, 0.1);
  border-radius: 8px;
  background: rgba(9, 22, 38, 0.58);
}

.history-text strong {
  color: var(--orange);
}

.history-text.green strong {
  color: var(--green);
}

.history-text span {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}

.edit-btn {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.entry-dialog {
  width: min(440px, calc(100vw - 24px));
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  background: #0b1828;
  box-shadow: var(--shadow);
}

.entry-dialog::backdrop {
  background: rgba(0, 0, 0, 0.62);
}

.entry-form {
  display: grid;
  gap: 12px;
}

.entry-form h2 {
  font-size: 22px;
}

.entry-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.entry-form input,
.entry-form select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  padding: 8px 10px;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 6px;
}

.dialog-actions button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}

.dialog-actions .danger-btn {
  border-color: rgba(255, 88, 88, 0.6);
  color: #ff9a9a;
}

.dialog-actions .save-btn {
  border-color: rgba(67, 220, 103, 0.55);
  background: rgba(33, 133, 62, 0.45);
}

.chart-head strong {
  color: var(--orange);
}

.bar-chart {
  height: 218px;
  margin: 20px 0 12px;
  padding: 0 4px 0 26px;
  display: grid;
  grid-template-columns: repeat(30, 1fr);
  align-items: end;
  gap: 7px;
  border-bottom: 1px solid rgba(151, 175, 211, 0.25);
  background:
    linear-gradient(to top, transparent 24%, rgba(151, 175, 211, 0.14) 25%, transparent 26%),
    linear-gradient(to top, transparent 49%, rgba(151, 175, 211, 0.14) 50%, transparent 51%),
    linear-gradient(to top, transparent 74%, rgba(151, 175, 211, 0.14) 75%, transparent 76%);
}

.bar {
  min-width: 7px;
  border-radius: 5px 5px 0 0;
  background: linear-gradient(180deg, #ff9a2b, #e65300);
  box-shadow: 0 0 13px rgba(255, 112, 0, 0.33);
}

.range-tabs {
  display: grid;
  grid-template-columns: auto repeat(3, 1fr);
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid rgba(151, 175, 211, 0.12);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.12);
}

.range-tabs span {
  color: var(--muted);
  font-size: 13px;
}

.range-tabs button {
  min-height: 34px;
}

.range-tabs button.active {
  border-color: var(--orange);
  background: rgba(255, 122, 0, 0.24);
}

.donut-wrap {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 28px;
  align-items: center;
  min-height: 230px;
}

.donut {
  width: 172px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--orange) 0 72%, #35c453 72% 90%, #218dff 90% 100%);
  box-shadow: 0 0 30px rgba(255, 122, 0, 0.18);
}

.donut::before {
  content: "";
  position: absolute;
}

.donut > div {
  width: 104px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  text-align: center;
  border-radius: 50%;
  background: #0a1727;
}

.donut strong,
.donut span {
  display: block;
}

.donut strong {
  align-self: end;
  font-size: 25px;
}

.donut span {
  align-self: start;
  color: var(--muted);
  font-size: 14px;
}

.legend {
  display: grid;
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.legend li {
  display: grid;
  grid-template-columns: 18px 1fr 52px 90px;
  align-items: center;
  gap: 10px;
}

.legend i {
  width: 16px;
  aspect-ratio: 1;
  border-radius: 50%;
}

.legend i.beech {
  background: var(--orange);
}

.legend i.oak {
  background: #35c453;
}

.legend i.birch {
  background: #218dff;
}

.legend span {
  color: var(--muted);
  font-size: 13px;
}

.details-btn {
  width: 100%;
  min-height: 48px;
}

footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 48px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 14px 14px 0 0;
  background: rgba(10, 22, 36, 0.62);
}

body.light {
  color-scheme: light;
  --bg: #f1f5f9;
  --bg-deep: #dbe7f4;
  --panel: rgba(255, 255, 255, 0.86);
  --panel-soft: rgba(255, 255, 255, 0.76);
  --line: rgba(46, 62, 82, 0.18);
  --text: #101827;
  --muted: #516070;
  --shadow: 0 24px 70px rgba(38, 55, 77, 0.16);
}

body.light .sidebar {
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(224, 234, 245, 0.96));
}

body.light .donut > div {
  background: #f7fafc;
}

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

  .wood-types {
    grid-column: 1 / -1;
  }

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

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 10px;
  }

  .brand {
    display: none;
  }

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

  .nav-item {
    min-height: 56px;
  }

  .sidebar-footer {
    display: none;
  }

  .dashboard {
    padding: 16px 12px;
  }

  .topbar {
    display: grid;
  }

  .weather-card {
    min-width: 0;
    width: 100%;
  }

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

  .metric-card {
    min-height: 136px;
    grid-template-columns: 76px 1fr;
    padding: 18px;
  }

  .metric-icon {
    width: 72px;
    height: 72px;
    font-size: 36px;
  }

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

  .stove-art {
    min-height: 140px;
  }

  .button-row.three,
  .button-row.six {
    grid-template-columns: repeat(2, 1fr);
  }

  .wood-picker {
    grid-template-columns: 1fr;
  }

  .donut-wrap {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .legend {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .nav-item small {
    display: none;
  }

  .metric-card strong {
    font-size: 34px;
  }

  .history-list::before {
    left: 74px;
  }

  .history-item {
    grid-template-columns: 52px 36px 1fr;
  }

  .edit-btn {
    display: none;
  }

  .legend li {
    grid-template-columns: 18px 1fr 46px;
  }

  .legend span {
    display: none;
  }
}
