/* ==========================================================================
   RMTT Power-On console — Apple-inspired, mobile-first
   System type stack, hairline-bordered translucent cards, pill controls,
   iOS system colours, bottom tab bar on phones / segmented nav on desktop.
   ========================================================================== */

:root {
  --bg: #f5f5f7;
  --bg-elev: rgba(255, 255, 255, 0.72);
  --card: #ffffff;
  --card-2: #fbfbfd;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #a1a1a6;
  --line: rgba(0, 0, 0, 0.08);
  --line-2: rgba(0, 0, 0, 0.045);
  --accent: #0071e3;
  --accent-press: #0077ed;
  --accent-soft: rgba(0, 113, 227, 0.1);
  --green: #34c759;
  --orange: #ff9f0a;
  --red: #ff3b30;
  --gray: #8e8e93;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 12px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.16), 0 2px 8px rgba(0, 0, 0, 0.06);
  --radius: 18px;
  --radius-sm: 12px;
  --pad: 16px;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-elev: rgba(28, 28, 30, 0.72);
    --card: #1c1c1e;
    --card-2: #242426;
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --text-3: #6e6e73;
    --line: rgba(255, 255, 255, 0.12);
    --line-2: rgba(255, 255, 255, 0.07);
    --accent: #0a84ff;
    --accent-press: #409cff;
    --accent-soft: rgba(10, 132, 255, 0.18);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.6);
  }
}

* { box-sizing: border-box; }

/* Component rules like .app { display: flex } beat the UA's [hidden] rule, so
   a screen that is meant to be gated off would still render. Keep the
   attribute authoritative. */
[hidden] { display: none !important; }

/* Second line of defence: the console shell is unrenderable until the session
   is authenticated, so no component rule can leak it to an anonymous visitor. */
body:not(.authed) .app { display: none !important; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

button, input, select { font: inherit; color: inherit; letter-spacing: inherit; }
code, kbd, .input-mono, .code, .logs { font-family: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.025em; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------------------------------------------------------------- 认证页 */

.auth {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 28px 18px calc(28px + env(safe-area-inset-bottom));
  background:
    radial-gradient(60% 55% at 12% 0%, rgba(0, 113, 227, 0.13), transparent 60%),
    radial-gradient(50% 50% at 100% 10%, rgba(155, 68, 240, 0.1), transparent 60%),
    var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 30px 24px 26px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: rise 0.5s var(--ease) both;
}

@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(0.985); } }

.auth-mark {
  width: 60px; height: 60px; margin: 0 auto 14px;
  display: grid; place-items: center;
  border-radius: 18px; color: #fff;
  background: linear-gradient(160deg, #4aa3ff, var(--accent));
  box-shadow: 0 8px 22px rgba(0, 113, 227, 0.35);
}
.auth-title { font-size: 26px; }
.auth-sub { color: var(--text-2); font-size: 14px; margin: 6px 0 20px; }
.auth-card .field { text-align: left; }
.auth-hint { margin-top: 14px; font-size: 12.5px; color: var(--text-3); }
.auth-foot { margin-top: 22px; font-size: 12px; color: var(--text-3); }

/* ---------------------------------------------------------------- 控件 */

.btn {
  appearance: none; border: 1px solid transparent; cursor: pointer;
  border-radius: 980px; padding: 9px 17px; font-size: 14.5px; font-weight: 600;
  background: var(--card-2); color: var(--text);
  transition: transform 0.18s var(--ease), background 0.18s, box-shadow 0.18s, opacity 0.18s;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.btn:active { transform: scale(0.965); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 4px 14px rgba(0, 113, 227, 0.28); }
.btn-primary:hover { background: var(--accent-press); }
.btn-quiet { background: transparent; border-color: var(--line); color: var(--accent); }
.btn-quiet:hover { background: var(--accent-soft); }
.btn-ghost { background: var(--line-2); }
.btn-danger { background: transparent; border-color: transparent; color: var(--red); }
.btn-block { width: 100%; justify-content: center; padding: 12px 18px; font-size: 16px; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }
.btn.is-busy { pointer-events: none; opacity: 0.8; }
.btn .plus { font-size: 17px; line-height: 1; margin-top: -2px; }

.segmented {
  display: inline-flex; padding: 2.5px; gap: 2px;
  background: var(--line-2); border-radius: 10px; border: 1px solid var(--line-2);
}
.segmented-item {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  padding: 6px 14px; border-radius: 8px; font-size: 13.5px; font-weight: 600;
  color: var(--text-2); transition: color 0.2s, background 0.2s, box-shadow 0.2s;
}
.segmented-item.is-on { background: var(--card); color: var(--text); box-shadow: var(--shadow-sm); }
.auth-tabs { margin-bottom: 20px; }

.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.field-help { display: block; margin-top: 6px; font-size: 12px; color: var(--text-3); line-height: 1.4; }
.input, .select {
  width: 100%; padding: 11px 13px; font-size: 15px;
  background: var(--card-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
.input:focus, .select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3.5px var(--accent-soft); background: var(--card);
}
.input-mono { letter-spacing: 0.04em; text-transform: uppercase; }
.select { appearance: none; padding-right: 32px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.select-block { width: 100%; }
.form-error {
  margin: 0 0 12px; padding: 10px 12px; font-size: 13.5px; text-align: left;
  color: var(--red); background: rgba(255, 59, 48, 0.1); border-radius: 10px;
}

.check { display: flex; align-items: center; gap: 9px; font-size: 14px; color: var(--text); margin: 4px 0 14px; cursor: pointer; }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check-box {
  width: 22px; height: 22px; flex: 0 0 auto; border-radius: 7px;
  border: 1.5px solid var(--line); background: var(--card-2); position: relative;
  transition: background 0.18s, border-color 0.18s;
}
.check input:checked + .check-box { background: var(--green); border-color: var(--green); }
.check input:checked + .check-box::after {
  content: ""; position: absolute; left: 7.5px; top: 3.5px; width: 5px; height: 10px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(43deg);
}

.switch-wrap { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; user-select: none; }
.switch-wrap input { position: absolute; opacity: 0; pointer-events: none; }
.switch-ui { width: 42px; height: 25px; border-radius: 999px; background: var(--line); position: relative; transition: background 0.22s var(--ease); }
.switch-ui::after { content: ""; position: absolute; top: 2.5px; left: 2.5px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform 0.22s var(--ease); }
.switch-wrap input:checked + .switch-ui { background: var(--green); }
.switch-wrap input:checked + .switch-ui::after { transform: translateX(17px); }
.switch-text { font-size: 13.5px; color: var(--text-2); }

.icon-btn {
  appearance: none; border: 0; cursor: pointer; width: 30px; height: 30px;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--line-2); color: var(--text-2); transition: background 0.18s, color 0.18s, transform 0.18s var(--ease);
}
.icon-btn:hover { background: var(--line); color: var(--text); }
.icon-btn:active { transform: scale(0.9); }

/* ---------------------------------------------------------------- 应用骨架 */

.app { min-height: 100dvh; display: flex; flex-direction: column; }

.nav {
  position: sticky; top: 0; z-index: 30;
  background: var(--bg-elev);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line-2);
}
.nav-inner {
  max-width: 1080px; margin: 0 auto; padding: 10px 14px;
  display: flex; align-items: center; gap: 10px;
  padding-top: max(10px, env(safe-area-inset-top));
}
.brand { display: flex; align-items: center; gap: 8px; margin-right: auto; }
.brand-mark { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; color: #fff; background: linear-gradient(160deg, #4aa3ff, var(--accent)); }
.brand-text { font-weight: 700; font-size: 16px; letter-spacing: -0.02em; }
.segmented-nav { display: none; }
.nav-right { display: flex; align-items: center; gap: 10px; }
.conn { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.avatar {
  appearance: none; border: 0; cursor: pointer; width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(160deg, #8e8e93, #6e6e73); color: #fff; font-size: 12.5px; font-weight: 700;
  text-transform: uppercase; display: grid; place-items: center;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gray); display: inline-block; }
.dot-live { background: var(--green); box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.18); animation: pulse 2.4s var(--ease) infinite; }
.dot-off { background: var(--gray); }
.dot-warn { background: var(--orange); box-shadow: 0 0 0 3px rgba(255, 159, 10, 0.18); }
.dot-bad { background: var(--red); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.main { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 18px 14px calc(84px + env(safe-area-inset-bottom)); }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 22px; }
.stat {
  background: var(--card); border: 1px solid var(--line-2); border-radius: var(--radius);
  padding: 14px 15px; box-shadow: var(--shadow-sm);
}
.stat-label { display: block; font-size: 12px; color: var(--text-2); font-weight: 600; }
.stat-value { display: block; font-size: 26px; font-weight: 700; letter-spacing: -0.03em; margin-top: 2px; font-variant-numeric: tabular-nums; }

.view { display: none; animation: fade 0.28s var(--ease) both; }
.view.is-on { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }

.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.section-title { font-size: 22px; }
.section-sub { font-size: 15px; margin: 24px 0 10px; color: var(--text-2); font-weight: 600; }
.section-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.section-actions .select { width: auto; padding-block: 8px; }

/* ---------------------------------------------------------------- 设备卡片 */

.grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 620px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .grid { grid-template-columns: repeat(3, 1fr); } }

.card {
  background: var(--card); border: 1px solid var(--line-2); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 12px;
  transition: box-shadow 0.25s var(--ease), transform 0.25s var(--ease), border-color 0.25s;
}
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.card-top { display: flex; align-items: flex-start; gap: 10px; }
.card-title { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; word-break: break-word; }
.card-sub { font-size: 12.5px; color: var(--text-3); margin-top: 2px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-icon { width: 38px; height: 38px; flex: 0 0 auto; border-radius: 11px; display: grid; place-items: center; background: var(--line-2); color: var(--text-2); }
.card-icon.on { background: rgba(52, 199, 89, 0.14); color: var(--green); }
.card-icon.off { background: var(--line-2); color: var(--text-3); }
.card-metrics { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.metric { display: flex; flex-direction: column; gap: 1px; }
.metric b { font-size: 14px; color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.card-foot { display: flex; align-items: center; gap: 8px; margin-top: auto; }
.card-foot .btn-primary { flex: 1; justify-content: center; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; background: var(--line-2); color: var(--text-2); white-space: nowrap;
}
.chip-ok { background: rgba(52, 199, 89, 0.14); color: #248a3d; }
.chip-warn { background: rgba(255, 159, 10, 0.16); color: #b25000; }
.chip-bad { background: rgba(255, 59, 48, 0.13); color: #d70015; }
.chip-mono { font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; letter-spacing: 0.02em; }
@media (prefers-color-scheme: dark) {
  .chip-ok { color: #6ee08a; } .chip-warn { color: #ffcf8a; } .chip-bad { color: #ff8a80; }
}

/* ---------------------------------------------------------------- 网关列表 */

.gw-list { display: flex; flex-direction: column; gap: 12px; }
.gw { background: var(--card); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 15px 16px; box-shadow: var(--shadow-sm); }
.gw-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.gw-name { font-size: 16.5px; font-weight: 700; letter-spacing: -0.02em; }
.gw-body { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 12px; }
.gw-foot { display: flex; align-items: center; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.gw-foot .spacer { margin-left: auto; }
.spark { width: 108px; height: 30px; border-radius: 8px; background: var(--line-2); }

/* ---------------------------------------------------------------- 日志 */

.logs-wrap { background: var(--card); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.logs {
  max-height: min(58dvh, 520px); overflow: auto; padding: 12px 14px;
  font-size: 12.5px; line-height: 1.65; -webkit-overflow-scrolling: touch;
}
.logs-hint { color: var(--text-3); font-size: 13px; font-family: inherit; }
.log-line { display: flex; gap: 9px; padding: 2.5px 0; border-bottom: 1px solid var(--line-2); align-items: baseline; }
.log-line:last-child { border-bottom: 0; }
.log-time { color: var(--text-3); flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.log-lvl { flex: 0 0 auto; width: 15px; text-align: center; border-radius: 5px; font-weight: 700; font-size: 11px; }
.lvl-I { color: var(--accent); } .lvl-D { color: var(--text-3); }
.lvl-W { color: var(--orange); } .lvl-E { color: var(--red); }
.log-src { color: var(--text-2); flex: 0 0 auto; }
.log-msg { word-break: break-word; flex: 1; }

.feed { display: flex; flex-direction: column; gap: 8px; }
.feed-item {
  display: flex; gap: 10px; align-items: center; background: var(--card);
  border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 10px 13px; font-size: 13.5px;
}
.feed-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; background: var(--gray); }
.feed-dot.ok { background: var(--green); } .feed-dot.bad { background: var(--red); }
.feed-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.feed-meta { color: var(--text-3); font-size: 12px; white-space: nowrap; }

/* ---------------------------------------------------------------- 空状态 */

.empty { text-align: center; padding: 34px 18px 40px; background: var(--card); border: 1px dashed var(--line); border-radius: 22px; }
.empty-art { width: 54px; height: 40px; margin: 0 auto 14px; border: 2.5px solid var(--text-3); border-radius: 7px; position: relative; opacity: 0.5; }
.empty-art::after { content: ""; position: absolute; bottom: -11px; left: 50%; transform: translateX(-50%); width: 26px; height: 2.5px; background: var(--text-3); border-radius: 2px; }
.empty-art-gw { width: 44px; height: 44px; border-radius: 50%; }
.empty-art-gw::after { bottom: auto; top: -14px; left: 50%; width: 2.5px; height: 12px; transform: translateX(-50%); }
.empty-title { font-size: 17px; font-weight: 700; }
.empty-text { color: var(--text-2); font-size: 13.5px; margin: 6px auto 16px; max-width: 340px; }

/* ---------------------------------------------------------------- 弹层 */

.backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.4); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade 0.25s var(--ease) both; }

.sheet {
  position: fixed; z-index: 50; margin: auto; width: min(520px, calc(100vw - 24px));
  max-height: min(88dvh, 760px); padding: 0; overflow: hidden;
  background: var(--card); color: var(--text);
  border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-lg);
}
.sheet::backdrop { display: none; }
.sheet[open] { animation: sheet-in 0.34s var(--ease) both; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(26px) scale(0.97); } }

.sheet-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 16px 16px 12px 20px; border-bottom: 1px solid var(--line-2);
  position: sticky; top: 0; background: var(--bg-elev);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); z-index: 1;
}
.sheet-title { font-size: 17px; }
.sheet-body { padding: 18px 20px 6px; overflow: auto; }
.sheet-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line-2); background: var(--card-2); }
.sheet-foot .btn { min-width: 92px; justify-content: center; }

/* 手机上表现为底部抽屉 */
@media (max-width: 679px) {
  .sheet { top: auto; inset-inline: 0; bottom: 0; width: 100%; max-height: 92dvh;
    border-radius: 22px 22px 0 0; border-inline: 0; border-bottom: 0; margin: 0; }
  .sheet[open] { animation: drawer-in 0.36s var(--ease) both; }
  .sheet-head::before {
    content: ""; position: absolute; top: 7px; left: 50%; transform: translateX(-50%);
    width: 38px; height: 4px; border-radius: 3px; background: var(--line);
  }
}
@keyframes drawer-in { from { transform: translateY(100%); } }

.kv { display: grid; grid-template-columns: 96px 1fr; gap: 7px 12px; font-size: 13.5px; margin-bottom: 16px; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; }
.lede { font-size: 14px; color: var(--text-2); margin-bottom: 12px; }
.kbd { background: var(--line-2); border-radius: 6px; padding: 1.5px 6px; font-size: 12.5px; }
.code {
  background: var(--card-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 14px; font-size: 12.5px; line-height: 1.7; overflow: auto; white-space: pre; margin: 0 0 12px;
}
.guide ol { padding-left: 20px; margin: 0 0 12px; display: flex; flex-direction: column; gap: 9px; font-size: 14px; color: var(--text-2); }
.guide li { line-height: 1.6; }
.more { border: 1px solid var(--line-2); border-radius: 14px; padding: 4px 14px; margin: 4px 0 14px; background: var(--card-2); }
.more summary { cursor: pointer; padding: 9px 0; font-size: 14px; font-weight: 600; color: var(--accent); list-style: none; }
.more summary::-webkit-details-marker { display: none; }
.more summary::after { content: "⌄"; float: right; transition: transform 0.2s var(--ease); }
.more[open] summary::after { transform: rotate(180deg); }
.more-grid { display: grid; grid-template-columns: 1fr; gap: 0 12px; padding-top: 6px; }
@media (min-width: 480px) { .more-grid { grid-template-columns: 1fr 1fr; } }

.flex1 { flex: 1; min-width: 0; }
.spacer { margin-left: auto; }

/* ------------------------------------------------------------- access key */

.keybar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line-2); border-radius: var(--radius);
  padding: 12px 14px; box-shadow: var(--shadow-sm); margin-bottom: 14px;
}
.keybar-label { font-size: 12px; font-weight: 650; color: var(--text-2); letter-spacing: 0.02em; }
.keybar-value {
  flex: 1; min-width: 0; font-size: 12.5px; padding: 6px 10px; border-radius: 9px;
  background: var(--card-2); border: 1px solid var(--line-2); overflow-wrap: anywhere;
}
.btn-mini { padding: 6px 12px; font-size: 13px; }

/* ---------------------------------------------------------------- Toast */

.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(460px, calc(100vw - 24px)); }
@media (min-width: 680px) { .toasts { bottom: calc(28px + env(safe-area-inset-bottom)); } }
.toast {
  pointer-events: auto; max-width: 100%;
  background: rgba(40, 40, 44, 0.86); color: #fff; -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  border-radius: 14px; padding: 11px 15px; font-size: 14px; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 9px; animation: toast-in 0.3s var(--ease) both;
}
@media (prefers-color-scheme: dark) { .toast { background: rgba(236, 236, 240, 0.92); color: #111; } }
.toast-leave { animation: toast-out 0.24s var(--ease) both; }
.toast-ok { border-left: 3px solid var(--green); }
.toast-bad { border-left: 3px solid var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(0.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(0.97); } }

/* ---------------------------------------------------------------- 底部标签栏 */

.tabbar {
  position: fixed; bottom: 0; inset-inline: 0; z-index: 35;
  display: flex; justify-content: space-around;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: var(--bg-elev);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line-2);
}
.tabbar-item {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 4px 14px; border-radius: 12px; font-size: 11px; font-weight: 600; color: var(--text-3);
  transition: color 0.2s;
}
.tabbar-item.is-on { color: var(--accent); }
.tabbar-item:active { transform: scale(0.94); }

@media (min-width: 680px) {
  .tabbar { display: none; }
  .segmented-nav { display: inline-flex; }
  .main { padding-bottom: calc(36px + env(safe-area-inset-bottom)); }
  .toasts { bottom: calc(28px + env(safe-area-inset-bottom)); }
}
@media (min-width: 1024px) { .brand-text { font-size: 17px; } .section-title { font-size: 26px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; transition-duration: 0.001s !important; }
}
