/* Deye Hub phone app. Dark only (owner's choice). Colors: docs/mobile-app-plan.md §2. */
:root {
  --bg: #0E1113; --card: #171B1E; --card2: #0E1113; --line: #2A3036; --line2: #22282D;
  --text: #EEF1F3; --soft: #C9D1D6; --muted: #9BA5AD; --dim: #8E98A0;
  --green: #46C88A; --green-bg: #12261C; --green-line: #1F4A35; --green-tile: #183326; --green-text: #A9D9C0;
  --orange: #FF8F50; --orange-bg: #2A1A10; --orange-line: #5A3420; --orange-tile: #3A2416; --orange-text: #FFC7A6;
  --blue: #69B3FF; --amber: #F2C14E; --amber-bg: #2B2414; --amber-line: #5C4A1E;
  --red: #FF6B6B; --red-bg: #2A1214; --red-line: #6B2328;
  --ring: #263038;
  --tabbar: #12161A;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
}
.n { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
button { font: inherit; color: inherit; }
a { color: var(--blue); text-decoration: none; }
h1, h2, p { margin: 0; }

main {
  max-width: 520px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 16px) 16px calc(env(safe-area-inset-bottom) + 104px);
  display: flex; flex-direction: column; gap: 12px;
}
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 4px 8px; }
.head h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.sub.warn { color: var(--amber); }
.pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line); font-size: 13px; color: var(--soft); white-space: nowrap;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex: none; }
.dot.amber { background: var(--amber); } .dot.grey { background: #5A646C; } .dot.red { background: var(--red); }

.card { padding: 18px 20px; border-radius: 22px; background: var(--card); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 12px; }
.card h2 { font-size: 17px; font-weight: 700; }
.card.green { background: var(--green-bg); border-color: var(--green-line); }
.card.orange { background: var(--orange-bg); border-color: var(--orange-line); }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.row > :first-child { color: var(--soft); }
.row > :last-child { font-weight: 600; text-align: right; }
.rows > .row { padding: 10px 0; border-top: 1px solid var(--line2); }
.rows > .row:first-child { border-top: 0; }
.note { font-size: 13px; color: var(--muted); }
.label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }

.banner { padding: 16px 18px; border-radius: 22px; display: flex; gap: 14px; border: 1px solid; }
.banner.red { background: var(--red-bg); border-color: var(--red-line); }
.banner.amber { background: var(--amber-bg); border-color: var(--amber-line); }
.banner.grey { background: var(--card); border-color: #3A434A; }
.banner .ic { width: 40px; height: 40px; border-radius: 12px; flex: none; display: flex; align-items: center;
  justify-content: center; color: var(--bg); }
.banner.red .ic { background: var(--red); } .banner.amber .ic { background: var(--amber); }
.banner.grey .ic { background: var(--muted); }
.banner .t { font-weight: 700; font-size: 17px; }
.banner .b { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.banner p { font-size: 14px; color: #D5DBDF; }

.gridcard .top { display: flex; align-items: center; gap: 14px; }
.icon { width: 48px; height: 48px; border-radius: 15px; flex: none; display: flex; align-items: center;
  justify-content: center; color: var(--bg); background: var(--green); }
.card.orange .icon { background: var(--orange); } .card.grey .icon { background: #5A646C; }
.big { font-size: 30px; font-weight: 800; line-height: 1.1; }
.card.green .label, .card.green .note { color: var(--green-text); }
.card.orange .label, .card.orange .note { color: var(--orange-text); }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tiles.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tile { padding: 10px 12px; border-radius: 14px; background: var(--card2); min-width: 0; }
.card.green .tile { background: var(--green-tile); } .card.orange .tile { background: var(--orange-tile); }
.tile .k { font-size: 12px; color: var(--muted); }
.card.green .tile .k { color: var(--green-text); } .card.orange .tile .k { color: var(--orange-text); }
.tile .v { font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timer { font-size: 44px; font-weight: 800; line-height: 1; letter-spacing: -0.02em; }

.bat { display: flex; gap: 20px; align-items: center; }
.ringbox { position: relative; width: 128px; height: 128px; flex: none; }
.ringbox .c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; }
.ringbox .pct { font-size: 34px; font-weight: 800; line-height: 1; }
.ringbox .cap { font-size: 12px; color: var(--muted); margin-top: 4px; }
.bat .facts { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.bat .facts .v { font-size: 22px; font-weight: 700; }
.split { display: flex; justify-content: space-between; padding-top: 12px; border-top: 1px solid var(--line);
  font-size: 13px; color: var(--soft); gap: 8px; flex-wrap: wrap; }
.reserve { position: relative; height: 10px; border-radius: 999px; background: var(--ring); overflow: hidden; }
.reserve .fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--blue); border-radius: 999px; }
.reserve .cut { position: absolute; top: 0; bottom: 0; left: 0; background: #4A2B2B; }
.scale { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }

.flows { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.flow { padding: 14px 12px; border-radius: 18px; background: var(--card); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 6px; }
.flow .k { font-size: 12px; color: var(--muted); } .flow .v { font-size: 20px; font-weight: 700; }
.flow .u { font-size: 12px; color: var(--soft); }
.flow .u.green { color: var(--green); } .flow .u.blue { color: var(--blue); } .flow .u.orange { color: var(--orange); }

.linkrow { padding: 16px 20px; border-radius: 22px; background: var(--card); border: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; color: var(--text); }
.linkrow .ico { width: 44px; height: 44px; border-radius: 14px; background: var(--amber-bg); color: var(--amber);
  display: flex; align-items: center; justify-content: center; flex: none; }
.linkrow .txt { flex: 1; min-width: 0; } .linkrow .txt b { display: block; font-weight: 600; }
.linkrow .txt span { display: block; font-size: 13px; color: var(--muted); }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--line); }
.seg button { min-height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--soft);
  font-weight: 600; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.bar2 { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--ring); }
.bar2 .a { background: var(--blue); } .bar2 .b { background: var(--amber); }
.bars { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; align-items: end; height: 150px; }
.bars button { border: 0; background: transparent; padding: 0; height: 100%; display: flex; flex-direction: column;
  justify-content: flex-end; align-items: center; gap: 4px; cursor: pointer; min-width: 0; }
.bars .col { width: 100%; border-radius: 8px 8px 4px 4px; background: #2F5E47; min-height: 3px; }
.bars button[aria-pressed="true"] .col { background: var(--green); }
.bars .col.out { background: #7A4A2C; } .bars button[aria-pressed="true"] .col.out { background: var(--orange); }
.bars .val { font-size: 11px; color: var(--soft); } .bars .wd { font-size: 11px; color: var(--muted); }

.gauge { position: relative; padding-top: 22px; }
.gauge .track { display: flex; height: 14px; border-radius: 999px; overflow: hidden; }
.gauge .z-red { background: #5A2427; } .gauge .z-amber { background: #5C4A1E; } .gauge .z-green { background: #1F4A35; }
.gauge .mark { position: absolute; top: 14px; width: 4px; height: 30px; margin-left: -2px; border-radius: 2px;
  background: var(--text); }
.gauge .now { position: absolute; top: 0; transform: translateX(-50%); font-size: 12px; font-weight: 700; white-space: nowrap; }
.gauge .ticks { position: relative; height: 18px; margin-top: 6px; font-size: 11px; color: var(--muted); }
.gauge .ticks span { position: absolute; transform: translateX(-50%); }

.stepper { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stepper button { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: #22272B;
  font-size: 22px; cursor: pointer; }
.stepper .v { font-size: 28px; font-weight: 800; }
.btn { min-height: 48px; border: 0; border-radius: 14px; background: var(--green); color: var(--bg);
  font-size: 16px; font-weight: 700; cursor: pointer; padding: 0 16px; }
.btn.ghost { background: #22272B; color: var(--text); border: 1px solid var(--line); font-weight: 600; min-height: 44px; }
.btn.danger { background: transparent; color: #FF8A8A; border: 1px solid #5A2A2D; font-weight: 600; min-height: 44px; }
.btn.red { background: var(--red); }
.btn:disabled { opacity: 0.5; }
.pair2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.confirm { padding: 14px; border-radius: 14px; background: var(--card2); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 10px; }
.ok { font-size: 13px; color: var(--green-text); } .err { font-size: 13px; color: #FF8A8A; }

.list > div { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line2); }
.list > div:first-child { border-top: 0; }
.list .ico { width: 36px; height: 36px; border-radius: 11px; background: var(--orange-bg); color: var(--orange);
  display: flex; align-items: center; justify-content: center; flex: none; }
.list .ico.green { background: var(--green-bg); color: var(--green); }
.list .txt { flex: 1; min-width: 0; } .list .txt b { display: block; font-weight: 600; }
.list .txt span { display: block; font-size: 13px; color: var(--muted); }

.stack { display: flex; flex-direction: column; gap: 12px; }
.block { display: block; }
.stale { opacity: 0.55; filter: grayscale(1); }
.empty { padding: 40px 8px; text-align: center; color: var(--muted); }

nav.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; background: var(--tabbar); border-top: 1px solid #242A30;
  padding: 8px 6px calc(env(safe-area-inset-bottom) + 8px);
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
}
nav.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 48px; color: var(--dim); font-size: 11px; font-weight: 600; }
nav.tabs a[aria-current="page"] { color: var(--green); }

.pairing { max-width: 420px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 48px) 24px 40px;
  display: flex; flex-direction: column; gap: 16px; }
.pairing .logo { width: 72px; height: 72px; border-radius: 20px; background: var(--green-bg); color: var(--green);
  display: flex; align-items: center; justify-content: center; }
.pairing h1 { font-size: 28px; font-weight: 800; }
.pairing input { font: inherit; font-size: 30px; font-weight: 700; letter-spacing: 0.3em; text-align: center;
  padding: 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); color: var(--text); width: 100%; }
.pairing input:focus { outline: 2px solid var(--green); border-color: transparent; }
.hint { padding: 14px 16px; border-radius: 16px; background: var(--card); border: 1px solid var(--line);
  font-size: 14px; color: var(--soft); }

.switchrow { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line2); }
.switchrow:first-child { border-top: 0; }
.switchrow .txt { flex: 1; min-width: 0; } .switchrow .txt b { display: block; font-weight: 600; }
.switchrow .txt span { display: block; font-size: 13px; color: var(--muted); }
.switch { width: 52px; height: 32px; padding: 3px; border: 0; border-radius: 999px; cursor: pointer; display: flex;
  flex: none; background: #3A434A; justify-content: flex-start; }
.switch[aria-checked="true"] { background: var(--green); justify-content: flex-end; }
.switch span { width: 26px; height: 26px; border-radius: 50%; background: #FFFFFF; }
.switch:disabled { opacity: 0.5; }
