:root {
  color-scheme: dark;
  font-family: system-ui, -apple-system, sans-serif;
  color: #e7efed;
  background: #101716;
  line-height: 1.5;
  --surface: #182321;
  --border: #344640;
  --muted: #a6bab3;
  --accent: #81dfbc;
}
* { box-sizing: border-box; }
body { margin: 0; }
main {
  max-width: 1160px;
  margin: auto;
  padding: 32px max(24px, env(safe-area-inset-right)) 32px max(24px, env(safe-area-inset-left));
}
h1 { font-size: clamp(24px, 3vw, 32px); letter-spacing: -.04em; margin: 10px 0; line-height: 1.2; }
h2 { font-size: 19px; margin: 0 0 10px; }
p { overflow-wrap: anywhere; }
.eyebrow { font-size: 12px; letter-spacing: .13em; color: var(--accent); }
.muted, small, footer { color: var(--muted); font-size: 13px; }
label { display: block; font-size: 14px; margin: 16px 0; min-width: 0; }
input, select {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 11px;
  border: 1px solid #526b61;
  border-radius: 8px;
  margin-top: 5px;
  font: inherit;
  font-size: 16px;
  color: #e7efed;
  background: #101b18;
}
button {
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--accent);
  color: #102b20;
  padding: 11px 18px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}
button:disabled { background: #354940; color: #a6bab3; cursor: default; }
button:not(:disabled):hover { filter: brightness(1.1); }
:focus-visible { outline: 3px solid #9abfff; outline-offset: 3px; }
.secondary { background: #283b33; color: #d6e9e0; border-color: #526b61; }
[role=alert] { color: #ffb0a5; }
header, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
header > div, .section-heading > div { min-width: 0; }
header button { flex-shrink: 0; }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 24px 0 12px; }
.cards article { background: var(--surface); padding: 24px; border-radius: 14px; border: 1px solid var(--border); }
.cards span, .cards small { display: block; }
.cards strong { font-size: clamp(28px, 4vw, 36px); font-weight: 650; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.cards .pack { background: #203e32; border-color: #49735e; }
.cards .pack strong { color: var(--accent); }
.summary { display: flex; flex-wrap: wrap; gap: 12px 24px; font-size: 13px; color: var(--muted); margin: 20px 0; }
.summary span { overflow-wrap: anywhere; }
.panel { min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 24px; margin: 20px 0; }
.chart { position: relative; min-width: 0; height: 280px; }
.pack-chart { height: 200px; margin-top: 24px; }
.period { flex: 0 0 140px; margin: 0; }
.columns { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 20px; }
.columns .panel { margin: 0; }
fieldset { border: 0; padding: 0; min-inline-size: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 20px 0; }
legend { font-size: 13px; font-weight: 600; padding: 0 0 8px; }
fieldset label { margin: 4px 0; }
table { border-collapse: collapse; width: 100%; font-size: 13px; text-align: left; }
th, td { padding: 12px 8px; border-bottom: 1px solid var(--border); vertical-align: top; overflow-wrap: anywhere; }
th { color: var(--muted); font-weight: 500; }
td:first-child { min-width: 130px; }
.table-scroll { overflow-x: auto; }
footer { margin: 24px 0; padding-bottom: env(safe-area-inset-bottom); overflow-wrap: anywhere; }
#settings-result { display: block; margin-top: 10px; overflow-wrap: anywhere; }
.login main { max-width: 420px; margin: 9vh auto; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: 0 16px 60px #0004; }
.login button { width: 100%; }
@media (max-width: 1000px) {
  .columns { grid-template-columns: minmax(0, 1fr); }
  .cards article { padding: 18px; }
}
@media (max-width: 700px) {
  main { padding: 20px max(16px, env(safe-area-inset-right)) 20px max(16px, env(safe-area-inset-left)); }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .cards article { padding: 16px; }
  .panel { padding: 18px; }
  .section-heading { align-items: stretch; flex-direction: column; gap: 8px; }
  .period { flex-basis: auto; }
  .chart { height: 250px; }
  .pack-chart { height: 210px; }
  header { gap: 12px; align-items: flex-start; }
  header button { margin-top: 10px; padding-inline: 14px; }
  .login main { margin: 24px 16px; max-width: none; }
}
@media (max-width: 480px) {
  fieldset { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  fieldset label:last-child { grid-column: 1 / -1; }
  #settings button, #wake { width: 100%; }
  .login main { padding: 24px; }
}
