:root {
  color: #17302c;
  background: #edf3f1;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #17302c;
  --muted: #64736f;
  --line: #d7e2df;
  --surface: #ffffff;
  --surface-soft: #f6f9f8;
  --brand: #173a34;
  --brand-hover: #0e2c27;
  --free: #16785f;
  --free-soft: #e5f5ef;
  --order: #b85b20;
  --order-soft: #fff0e5;
  --other: #6455a4;
  --other-soft: #f0edfb;
  --danger: #9b2c2c;
  --danger-soft: #fff1f1;
  --shadow: 0 18px 48px rgba(23, 58, 52, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: #edf3f1;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  padding: 24px 16px 40px;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 100% 0%, rgba(40, 113, 96, 0.12), transparent 32rem),
    #edf3f1;
  font-size: 1rem;
  line-height: 1.45;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  touch-action: manipulation;
}

.app-shell {
  width: min(100%, 960px);
  margin: 0 auto;
  padding: 20px;
  overflow: hidden;
  border: 1px solid rgba(215, 226, 223, 0.9);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.app-header,
.section-heading,
.data-time,
.refresh-button {
  display: flex;
  align-items: center;
}

.app-header {
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.eyebrow,
.section-kicker {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.server-name {
  margin: 0;
  color: var(--ink);
  font-size: 1.125rem;
  font-weight: 760;
}

.intro {
  padding: 26px 0 24px;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 720px;
  margin: 4px 0 10px;
  color: var(--ink);
  font-size: clamp(2rem, 6vw, 3.6rem);
  line-height: 1.02;
  letter-spacing: -0.045em;
}

h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.25rem, 3vw, 1.55rem);
  line-height: 1.18;
  letter-spacing: -0.02em;
}

.loading-panel,
.error-panel {
  margin-bottom: 20px;
  padding: 20px;
  border-radius: 18px;
}

.loading-panel {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  background: var(--surface-soft);
}

.loading-panel[hidden] {
  display: none;
}

.loading-panel p,
.error-panel p {
  margin: 0;
}

.loading-indicator {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border: 2px solid #bfd3cd;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .loading-indicator {
    animation: none;
  }
}

.error-panel {
  border: 1px solid #f1caca;
  color: var(--danger);
  background: var(--danger-soft);
}

.error-title {
  margin-bottom: 5px !important;
  font-weight: 780;
}

.summary-section,
.groups-section {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
}

.section-heading {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.section-heading--groups {
  margin-bottom: 16px;
}

.total-block {
  min-width: 84px;
  padding: 10px 14px;
  border-radius: 16px;
  text-align: right;
  color: #ffffff;
  background: var(--brand);
}

.total-block span {
  display: block;
  font-size: 0.8125rem;
  font-weight: 650;
}

.total-block strong {
  display: block;
  font-size: 2rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

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

.stat-card {
  min-width: 0;
  padding: 16px;
  border-radius: 18px;
}

.stat-card--free {
  color: var(--free);
  background: var(--free-soft);
}

.stat-card--order {
  color: var(--order);
  background: var(--order-soft);
}

.stat-card--other {
  color: var(--other);
  background: var(--other-soft);
}

.stat-label {
  display: block;
  min-height: 2.5em;
  font-size: 0.875rem;
  font-weight: 720;
  line-height: 1.25;
}

.stat-value {
  display: block;
  margin-top: 12px;
  font-size: clamp(2rem, 8vw, 3.4rem);
  font-weight: 820;
  line-height: 0.95;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.groups-section {
  margin-top: 14px;
  background: var(--surface-soft);
}

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

.group-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
}

.group-title {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 780;
}

.group-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.875rem;
}

.group-total strong {
  color: var(--ink);
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
}

.group-counts {
  display: grid;
  gap: 7px;
  margin: 0;
}

.group-counts div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.group-counts dt,
.group-counts dd {
  margin: 0;
}

.group-counts dt {
  min-width: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.group-counts dd {
  flex: 0 0 auto;
  color: var(--ink);
  font-weight: 760;
  font-variant-numeric: tabular-nums;
}

.data-time {
  gap: 14px;
  margin-top: 14px;
  padding: 18px 20px;
  border-radius: 18px;
  color: #d9e9e5;
  background: var(--brand);
}

.data-time-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  font-size: 1.4rem;
}

.data-time h2 {
  margin-bottom: 3px;
  color: #ffffff;
  font-size: 0.875rem;
  letter-spacing: 0;
}

.data-time time {
  display: block;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 760;
}

.data-time p {
  margin: 2px 0 0;
  font-size: 0.8125rem;
}

.actions {
  padding-top: 18px;
}

.refresh-button {
  width: 100%;
  min-height: 52px;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: 16px;
  color: #ffffff;
  background: var(--brand);
  font-weight: 780;
  cursor: pointer;
  transition: background-color 150ms ease, transform 150ms ease;
}

.refresh-button:hover:not(:disabled) {
  background: var(--brand-hover);
}

.refresh-button:active:not(:disabled) {
  transform: translateY(1px);
}

.refresh-button:focus-visible {
  outline: 3px solid rgba(23, 120, 95, 0.32);
  outline-offset: 3px;
}

.refresh-button:disabled {
  opacity: 0.68;
  cursor: wait;
}

.refresh-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.source-status {
  min-height: 1.35em;
  margin: 9px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: 0.8125rem;
}

.weather-section {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface-soft);
}

.weather-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.weather-heading h2 {
  flex: 0 0 auto;
}

.weather-time {
  min-width: 0;
  color: var(--muted);
  text-align: right;
  font-size: 0.8125rem;
}

.weather-time span,
.weather-time time,
.weather-time small {
  display: block;
}

.weather-time time {
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 720;
}

.weather-time small {
  font-size: 0.75rem;
}

.weather-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.weather-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas:
    "icon city temperature"
    "icon feels feels";
  align-items: center;
  gap: 2px 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
}

.weather-icon {
  grid-area: icon;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: #245d80;
  background: #e7f2f7;
  font-size: 1.5rem;
}

.weather-city {
  grid-area: city;
  min-width: 0;
  margin: 0;
  color: var(--ink);
  font-size: 0.9375rem;
  font-weight: 780;
  overflow-wrap: anywhere;
}

.weather-temperature {
  grid-area: temperature;
  color: var(--ink);
  font-size: 1.65rem;
  font-weight: 820;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.weather-feels {
  grid-area: feels;
  margin: 0;
  color: var(--muted);
  font-size: 0.8125rem;
}

.weather-loading,
.weather-error {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.weather-error {
  color: var(--danger);
}

.noscript-message {
  max-width: 960px;
  margin: 18px auto;
  padding: 16px;
  border-radius: 14px;
  color: var(--danger);
  background: var(--danger-soft);
}

@media (max-width: 680px) {
  body {
    padding: 0;
    background: var(--surface);
  }

  .app-shell {
    min-height: 100vh;
    padding: 18px 16px 28px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .intro {
    padding: 26px 0 20px;
  }

  .summary-section,
  .groups-section,
  .weather-section {
    padding: 16px;
    border-radius: 18px;
  }

  .stat-card {
    padding: 13px 10px;
  }

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

@media (max-width: 360px) {
  .section-heading {
    align-items: flex-start;
  }

  .weather-heading {
    display: block;
  }

  .weather-time {
    margin-top: 5px;
    text-align: left;
  }

  .total-block {
    min-width: 72px;
    padding-inline: 11px;
  }

  .stat-grid {
    gap: 6px;
  }

  .stat-card {
    padding-inline: 8px;
  }

  .stat-label {
    font-size: 0.8125rem;
  }
}
