/* Palette mirrors AppTheme in the Battery Sync app (UI/DesignSystem.swift). */
:root {
  --background: #f2f2f7;
  --surface: #ffffff;
  --elevated: #ffffff;
  --line: #e1e1e6;
  --divider: #e6e6ea;
  --accent: #0a5fcc;
  --link: #0a5fcc;
  --text: #1c1c1e;
  --muted: #5f5f64;
  --secondary: #4f4f55;
  --warning: #d93a2e;
  --destructive: #b32318;
  --recent: #1f7a3d;
  --recent-tint: #e7f1e9;
  --charging: #2e9e55;
  --healthy-tint: #eaf1fb;
  --healthy-border: #c9dcf5;
  --danger-tint: #fcedeb;
  --stale-tint: #e3e3e8;
  --icon-tile: #f2f2f4;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.04);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #000000;
    --surface: #1c1c1e;
    --elevated: #2c2c2e;
    --line: #38383b;
    --divider: #38383a;
    --accent: #0a6cdb;
    --link: #5aa9ff;
    --text: #f2f2f7;
    --muted: #aeaeb2;
    --secondary: #bcbcc2;
    --warning: #ff453a;
    --destructive: #ff6961;
    --recent: #4cd97b;
    --recent-tint: #12301c;
    --charging: #30d158;
    --healthy-tint: #14263d;
    --healthy-border: #2a3a52;
    --danger-tint: #2e1614;
    --stale-tint: #3a3a3c;
    --icon-tile: #2c2c2e;
    --shadow: none;
  }
  .hero .app-icon, .brand img { box-shadow: 0 0 0 1px var(--line); }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font: 17px/1.55 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

strong { font-weight: 600; }

.wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 20px 16px 56px;
}

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 36px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 600;
}
.brand:hover { text-decoration: none; }
.brand img { width: 30px; height: 30px; border-radius: 7px; }

.navlink { font-size: 15px; font-weight: 500; }

/* Hero */
.hero { margin-bottom: 28px; }

.hero .app-icon {
  width: 76px;
  height: 76px;
  border-radius: 18px;
  display: block;
  margin-bottom: 18px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

h1 {
  font-size: 34px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}

.lede {
  color: var(--secondary);
  margin: 12px 0 0;
}

.meta { color: var(--muted); font-size: 15px; margin: 0; }

.badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: var(--recent-tint);
  color: var(--recent);
}
.badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.badge.blue { background: var(--healthy-tint); color: var(--link); }

/* Grouped sections, like GlacierSection */
section { margin-top: 30px; }

.section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 8px;
  padding: 0 16px;
}

.card {
  background: var(--surface);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card > p { margin: 0; padding: 14px 16px; }
.card > p + p { padding-top: 0; }

.footnote {
  font-size: 13px;
  color: var(--muted);
  margin: 8px 0 0;
  padding: 0 16px;
}

.row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 16px;
  position: relative;
}

.row + .row::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 64px;
  height: 1px;
  background: var(--divider);
}

.row-body { min-width: 0; flex: 1; }

.row-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  margin: 2px 0 2px;
}

.row-detail {
  font-size: 15px;
  line-height: 1.5;
  color: var(--muted);
  margin: 0;
}

.row.danger .row-title { color: var(--destructive); }

/* Icon tiles, like DeviceIcon */
.tile {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--icon-tile);
  color: var(--text);
}
.tile svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tile.blue { background: var(--healthy-tint); color: var(--link); }
.tile.green { background: var(--recent-tint); color: var(--recent); }
.tile.red { background: var(--danger-tint); color: var(--destructive); }
.tile.gray { background: var(--stale-tint); color: var(--secondary); }

/* Summary hero card */
.summary {
  background: var(--surface);
  border: 1px solid var(--healthy-border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.summary .row + .row::before { background: var(--divider); }

/* Device preview on the home page, like the Devices list */
.devices .row { align-items: center; }
.device-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.device-name { font-size: 15px; font-weight: 600; }
.device-pct { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.device-pct.low { color: var(--warning); }
.device-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
.bar {
  height: 6px;
  border-radius: 3px;
  background: var(--line);
  margin-top: 6px;
  overflow: hidden;
}
.bar span { display: block; height: 100%; border-radius: 3px; background: var(--charging); }
.bar span.low { background: var(--warning); }

.cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 22px;
  padding: 10px 18px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
}
.cta:hover { text-decoration: none; filter: brightness(1.06); }

footer {
  margin-top: 48px;
  padding: 0 16px;
  color: var(--muted);
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  justify-content: space-between;
}

@media (max-width: 480px) {
  h1 { font-size: 30px; }
  .hero .app-icon { width: 64px; height: 64px; border-radius: 15px; }
}
