:root {
  --bg: #f2f2f7;
  --bg-elevated: #ffffff;
  --fill: rgba(120, 120, 128, 0.1);
  --fill-strong: rgba(120, 120, 128, 0.18);
  --sep: rgba(60, 60, 67, 0.1);
  --label: #1c1c1e;
  --secondary: #8e8e93;
  --tertiary: #aeaeb2;
  --blue: #007aff;
  --blue-press: #0066d6;
  --blue-soft: rgba(0, 122, 255, 0.1);
  --green: #34c759;
  --green-soft: rgba(52, 199, 89, 0.14);
  --orange: #ff9500;
  --red: #ff3b30;
  --radius: 12px;
  --radius-sm: 8px;
  --side-w: 220px;
  --header-h: 52px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.03);
  --shadow-sheet: 0 10px 40px rgba(0, 0, 0, 0.18);
}

*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0; min-height: 100%;
  font: 13px/1.45 var(--font);
  color: var(--label);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input { font: inherit; color: inherit; }
button {
  appearance: none; border: 0; cursor: pointer;
  background: var(--blue); color: #fff;
  border-radius: var(--radius-sm);
  padding: 0.42rem 0.9rem;
  font-weight: 510;
  letter-spacing: -0.01em;
  transition: transform 100ms ease-out, background 120ms ease-out, opacity 120ms ease-out;
}
button:hover { background: var(--blue-press); }
button:active { transform: scale(0.97); }
button.secondary { background: var(--fill); color: var(--label); }
button.secondary:hover { background: var(--fill-strong); }
button.ghost {
  background: transparent; color: var(--blue);
  padding: 0.15rem 0.3rem; font-weight: 500; font-size: 0.92em;
}
button.ghost:hover { background: transparent; opacity: 0.75; }
button.danger { background: var(--red); }
button.danger:hover { filter: brightness(0.95); }
button:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
input {
  width: 100%;
  background: var(--bg);
  border: 0;
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem;
  color: var(--label);
}
input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.28);
  background: #fff;
}

/* —— Login —— */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(1200px 600px at 50% -10%, #ffffff 0%, transparent 55%),
    linear-gradient(180deg, #ececf1 0%, var(--bg) 45%, #e8e8ed 100%);
}
.login-card { width: min(360px, 100%); text-align: center; }
.login-card .login-logo {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  display: block;
  margin: 0 auto 0.85rem;
  box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 20px rgba(0, 90, 120, 0.12);
}
.login-card .brand {
  margin: 0 0 0.15rem; font-size: 2rem; font-weight: 700;
  letter-spacing: -0.045em; line-height: 1.1;
}
.login-card .sub {
  margin: 0 0 1.1rem; color: var(--secondary);
  font-size: 0.95rem; letter-spacing: -0.01em;
}
.seg {
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px;
  background: var(--fill); padding: 2px; border-radius: 9px; margin-bottom: 0.95rem;
}
.seg button {
  background: transparent; color: var(--label); border-radius: 7px;
  padding: 0.38rem 0.5rem; font-weight: 510;
}
.seg button.active {
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 1px rgba(0, 0, 0, 0.04);
}
.seg button:hover { background: transparent; }
.seg button.active:hover { background: #fff; }
.login-card .group {
  background: var(--bg-elevated); border-radius: var(--radius);
  overflow: hidden; text-align: left; margin-bottom: 0.85rem;
  box-shadow: var(--shadow-card);
}
.login-card .field {
  display: grid; grid-template-columns: 4.5rem 1fr; align-items: center;
  gap: 0.4rem; padding: 0.55rem 0.85rem; margin: 0;
  border-bottom: 0.5px solid var(--sep);
}
.login-card .field:last-of-type { border-bottom: 0; }
.login-card .field label { color: var(--label); font-size: 0.95rem; }
.login-card .field input {
  background: transparent; border: 0; border-radius: 0;
  padding: 0.35rem 0; box-shadow: none; text-align: right;
  -webkit-appearance: none; appearance: none;
}
.login-card .code-row {
  display: flex; align-items: center; gap: 0.35rem; min-width: 0;
}
.login-card .code-row input { flex: 1; min-width: 0; }
.login-card .code-row button.ghost {
  flex-shrink: 0; padding: 0.2rem 0.45rem; font-size: 0.78rem;
  color: var(--accent); white-space: nowrap;
}
.login-card .field input:focus { box-shadow: none; background: transparent; }
.login-card .field input::placeholder { color: var(--tertiary); text-align: right; }
.login-card .field input:-webkit-autofill,
.login-card .field input:-webkit-autofill:hover,
.login-card .field input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--label);
  -webkit-box-shadow: 0 0 0 1000px #fff inset;
  box-shadow: 0 0 0 1000px #fff inset;
  transition: background-color 99999s ease-out;
  caret-color: var(--label);
}
.login-card .error {
  color: var(--red); min-height: 1.1rem; font-size: 0.85rem;
  margin: 0 0 0.65rem; text-align: left;
}
.login-card .auth-alt {
  margin: -0.35rem 0 0.65rem; text-align: center;
}
.login-card .auth-alt .linkish {
  background: none; border: 0; padding: 0; margin: 0;
  color: var(--accent); font: 500 0.85rem/1.3 inherit; cursor: pointer;
}
.login-card .submit {
  width: 100%; padding: 0.65rem 1rem; font-size: 1rem; border-radius: var(--radius);
}

/* —— Shell: white sidebar + header —— */
.shell {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  min-height: 100vh;
  background: var(--bg);
}
.side {
  position: sticky; top: 0; height: 100vh;
  padding: 0.75rem 0.7rem 0.85rem;
  display: flex; flex-direction: column;
  background: #fff;
  border-right: 1px solid var(--sep);
  z-index: 5;
}
.side .logo {
  display: flex; align-items: center; gap: 0.55rem;
  font-weight: 700; font-size: 1.05rem; letter-spacing: -0.03em;
  padding: 0.45rem 0.55rem 1rem;
}
.side .logo-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(145deg, #0a84ff, #007aff);
  display: grid; place-items: center; color: #fff; flex-shrink: 0;
}
.side .logo-mark svg { width: 16px; height: 16px; }
.side .logo-mark-img {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  object-fit: cover; display: block;
}
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow: auto; }
.nav-sec {
  margin: 0.75rem 0.55rem 0.25rem;
  font-size: 0.68rem; font-weight: 600; color: var(--tertiary);
  letter-spacing: 0.04em;
}
.nav-sec:first-child { margin-top: 0.1rem; }
.nav button {
  width: 100%; text-align: left; background: transparent; color: #3a3a3c;
  border-radius: 8px; padding: 0.52rem 0.65rem;
  font-size: 0.9rem; font-weight: 500; letter-spacing: -0.01em;
  display: flex; align-items: center; gap: 0.55rem;
}
.nav button svg {
  width: 17px; height: 17px; flex-shrink: 0;
  stroke: currentColor; fill: none; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round; opacity: 0.72;
}
.nav button:hover { background: var(--fill); }
.nav button.active {
  background: var(--blue-soft); color: var(--blue); font-weight: 600;
}
.nav button.active svg { opacity: 1; }
.nav button.active:hover { background: rgba(0, 122, 255, 0.14); }
.side-foot {
  margin-top: auto; padding: 0.55rem 0.55rem 0.15rem;
  font-size: 0.72rem; color: var(--secondary); word-break: break-all; line-height: 1.35;
}
.side .logout {
  width: 100%; margin-top: 0.25rem; background: transparent;
  color: var(--secondary); font-weight: 500; text-align: left;
  padding: 0.45rem 0.65rem; border-radius: 8px;
  display: flex; align-items: center; gap: 0.55rem;
}
.side .logout svg {
  width: 16px; height: 16px; stroke: currentColor; fill: none;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.side .logout:hover { background: var(--fill); color: var(--label); }

.workspace {
  display: flex; flex-direction: column; min-width: 0; min-height: 100vh;
}
.header {
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 0 1.35rem;
  background: #fff; border-bottom: 1px solid var(--sep);
  position: sticky; top: 0; z-index: 4;
}
.crumbs {
  display: flex; align-items: center; gap: 0.35rem;
  color: var(--secondary); font-size: 0.82rem; flex-wrap: wrap;
}
.crumbs b { color: var(--label); font-weight: 600; }
.crumbs .sep { opacity: 0.45; }
.header-right {
  display: flex; align-items: center; gap: 0.65rem;
}
.header-user {
  display: flex; align-items: center; gap: 0.45rem;
  color: var(--label); font-weight: 510; font-size: 0.85rem;
}
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--blue); color: #fff;
  display: grid; place-items: center;
  font-size: 0.72rem; font-weight: 700; letter-spacing: -0.02em;
  flex-shrink: 0;
}
.avatar.lg { width: 48px; height: 48px; font-size: 1rem; }

.main {
  padding: 1.15rem 1.35rem 2rem;
  width: 100%; max-width: 1280px;
  animation: rise 280ms var(--ease) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .main { animation: none; }
  button:active { transform: none; }
}

.page-title {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 0.75rem; margin-bottom: 1rem; flex-wrap: wrap;
}
.page-title h1 {
  margin: 0; font-size: 1.35rem; font-weight: 700;
  letter-spacing: -0.035em; line-height: 1.2;
}
.page-title p {
  margin: 0.2rem 0 0; color: var(--secondary);
  font-size: 0.85rem;
}

/* —— Cards —— */
.card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid rgba(60, 60, 67, 0.06);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.card-h {
  display: flex; justify-content: space-between; align-items: center;
  gap: 0.5rem; flex-wrap: wrap;
  padding: 0.85rem 1rem 0.35rem;
}
.card-h h2 {
  margin: 0; font-size: 0.95rem; font-weight: 650;
  letter-spacing: -0.02em; color: var(--label);
}
.card-b { padding: 0.65rem 1rem 1rem; }
.panel {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid rgba(60, 60, 67, 0.06);
  box-shadow: var(--shadow-card);
  overflow: auto;
  width: 100%;
  margin-bottom: 0.85rem;
}
.panel-h {
  display: flex; justify-content: space-between; align-items: center;
  gap: 0.5rem; flex-wrap: wrap; padding: 0.85rem 1rem 0.45rem;
}
.panel-h h2 {
  margin: 0; font-size: 0.95rem; font-weight: 650;
  letter-spacing: -0.02em; color: var(--label);
}
.panel-b { padding: 0.65rem 1rem 1rem; }

/* —— Dashboard grid —— */
.dash-top {
  display: grid;
  grid-template-columns: 1.55fr 0.85fr;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}
.dash-mid {
  display: grid;
  grid-template-columns: 1.55fr 0.85fr;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}
.dash-bottom {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}

.user-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  padding: 1.15rem 1.2rem;
  align-items: start;
}
.user-meta .name {
  margin: 0; font-size: 1.05rem; font-weight: 650; letter-spacing: -0.02em;
}
.user-meta .id {
  margin: 0.2rem 0 0; color: var(--secondary); font-size: 0.8rem;
}
.user-meta .plan {
  margin: 0.55rem 0 0; font-size: 0.88rem;
}
.user-meta .plan a, .user-meta .plan button.ghost {
  font-size: 0.88rem; padding: 0;
}
.user-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 0.95rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--sep);
  grid-column: 1 / -1;
}
.user-stats .s {
  text-align: center;
}
.user-stats .s .v {
  font-size: 1.25rem; font-weight: 700; letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.user-stats .s .k {
  margin-top: 0.15rem; color: var(--secondary); font-size: 0.75rem;
}

.quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  padding: 0.35rem 0.85rem 0.95rem;
}
.quick-grid button {
  background: transparent; color: var(--label);
  text-align: left; padding: 0.55rem 0.45rem;
  border-radius: 8px; font-weight: 500; font-size: 0.88rem;
}
.quick-grid button:hover { background: var(--fill); color: var(--blue); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  padding: 0.25rem 0.35rem 0.65rem;
}
.stat-cell {
  padding: 0.75rem 0.85rem;
  border-right: 1px solid var(--sep);
  border-bottom: 1px solid var(--sep);
}
.stat-cell:nth-child(4n) { border-right: 0; }
.stat-cell:nth-child(n+5) { border-bottom: 0; }
.stat-cell .v {
  font-size: 1.35rem; font-weight: 700; letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums; line-height: 1.15;
}
.stat-cell .k {
  margin-top: 0.25rem; color: var(--secondary); font-size: 0.75rem;
}
.stat-cell .u {
  color: var(--tertiary); font-size: 0.78rem; font-weight: 500; margin-left: 0.15rem;
}

.tip-list { list-style: none; margin: 0; padding: 0.2rem 0 0.5rem; }
.tip-list li {
  display: flex; justify-content: space-between; gap: 0.75rem;
  padding: 0.55rem 1rem; border-bottom: 1px solid var(--sep);
  cursor: pointer; font-size: 0.85rem;
}
.tip-list li:last-child { border-bottom: 0; }
.tip-list li:hover { background: rgba(0, 122, 255, 0.04); }
.tip-list .t { color: var(--label); flex: 1; min-width: 0; }
.tip-list .d { color: var(--tertiary); font-size: 0.75rem; white-space: nowrap; }
.tip-empty {
  padding: 1.5rem 1rem; text-align: center; color: var(--secondary); font-size: 0.85rem;
}

table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left; padding: 0.62rem 1rem;
  border-bottom: 1px solid var(--sep);
  font-size: 0.86rem; vertical-align: middle;
}
th {
  color: var(--secondary); font-weight: 500; white-space: nowrap;
  font-size: 0.75rem; background: #fafafc;
  padding-top: 0.5rem; padding-bottom: 0.5rem;
}
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background 120ms ease-out; }
tbody tr:hover td { background: rgba(0, 0, 0, 0.015); }
td code, .mono {
  font-family: var(--mono); font-size: 0.8rem;
  letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
}

.badge {
  display: inline-flex; align-items: center;
  padding: 0.12rem 0.45rem;
  border-radius: 6px;
  font-size: 0.72rem; font-weight: 600;
  letter-spacing: -0.01em;
  background: var(--fill); color: var(--secondary);
}
.badge.online {
  background: var(--green-soft); color: #1f7a33;
}
.badge.warn {
  background: rgba(255, 149, 0, 0.14); color: #9a6700;
}

.toolbar {
  display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap;
  margin-bottom: 0.85rem;
}
.search {
  flex: 1; min-width: 160px; max-width: 280px;
  background: #fff; border: 1px solid var(--sep);
  border-radius: var(--radius-sm); padding: 0.5rem 0.75rem;
  box-shadow: none;
}
.search:focus { background: #fff; }

.loading {
  display: grid; place-items: center; min-height: 12rem;
  color: var(--secondary); font-size: 0.9rem; gap: 0.65rem;
}
.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--fill-strong);
  border-top-color: var(--blue);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty {
  padding: 2.4rem 1.2rem; color: var(--secondary); text-align: center; font-size: 0.9rem;
}
.empty-illu {
  width: 72px; height: 56px; margin: 0 auto 0.75rem;
  opacity: 0.55;
}
.empty .empty-t {
  margin: 0 0 0.25rem; color: var(--label); font-size: 0.95rem;
  font-weight: 600; letter-spacing: -0.02em;
}
.empty .empty-d { margin: 0 0 0.85rem; color: var(--secondary); font-size: 0.82rem; }
.empty .actions { justify-content: center; }

.modal-bg {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0, 0, 0, 0.32);
  display: grid; place-items: center; padding: 1rem;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  animation: fade 160ms ease-out both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: min(400px, 100%);
  background: rgba(255, 255, 255, 0.98);
  border-radius: 14px;
  padding: 1.1rem 1.15rem 1rem;
  box-shadow: var(--shadow-sheet);
  animation: sheet 280ms var(--ease) both;
}
@keyframes sheet {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: none; }
}
.modal h3 {
  margin: 0 0 0.35rem; font-size: 1.05rem; font-weight: 650;
  letter-spacing: -0.025em; text-align: center;
}
.modal .modal-sub {
  margin: 0 0 0.85rem; text-align: center;
  color: var(--secondary); font-size: 0.85rem;
}
.modal .row { margin-bottom: 0.6rem; }
.modal .row label {
  display: block; font-size: 0.78rem; color: var(--secondary); margin-bottom: 0.25rem;
}
.modal .btns { display: flex; gap: 0.5rem; margin-top: 1rem; }
.modal .btns button { flex: 1; padding: 0.55rem; border-radius: 10px; }

.inset {
  background: var(--bg); border-radius: var(--radius); overflow: hidden;
}
.inset .field {
  display: grid; grid-template-columns: 5.5rem 1fr; align-items: center;
  gap: 0.4rem; padding: 0.55rem 0.85rem; margin: 0;
  border-bottom: 0.5px solid var(--sep);
  background: #fff;
}
.inset .field:last-child { border-bottom: 0; }
.inset .field label { color: var(--label); font-size: 0.92rem; margin: 0; }
.inset .field input {
  background: transparent; border: 0; border-radius: 0;
  padding: 0.3rem 0; text-align: right; box-shadow: none;
}
.inset .field input:focus { box-shadow: none; background: transparent; }

.hint {
  color: var(--secondary);
  background: #fff;
  border: 1px solid rgba(60, 60, 67, 0.06);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.85rem;
  font-size: 0.88rem;
}
.hint.warn { color: #9a6700; background: rgba(255, 149, 0, 0.1); border-color: transparent; box-shadow: none; }
.hint.tip { cursor: pointer; }
.hint.tip:hover { opacity: 0.92; }

.field { display: grid; gap: 0.25rem; margin-bottom: 0.65rem; }
.field label { color: var(--secondary); font-size: 0.8rem; }
.error { color: var(--red); min-height: 1rem; font-size: 0.85rem; }
.muted { color: var(--secondary); font-size: 0.85rem; }
.actions { display: flex; gap: 0.35rem; flex-wrap: wrap; align-items: center; }
.pwd-box { max-width: 420px; }
.dl-row { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.dl-row a {
  display: inline-flex; align-items: center;
  padding: 0.5rem 0.95rem; border-radius: var(--radius-sm);
  background: var(--blue); color: #fff; text-decoration: none; font-weight: 510;
  transition: transform 100ms ease-out, background 120ms ease-out;
}
.dl-row a:hover { background: var(--blue-press); }
.dl-row a:active { transform: scale(0.97); }
.dl-row a.secondary { background: var(--fill); color: var(--label); }
.dl-row a.secondary:hover { background: var(--fill-strong); }

.prog { margin-bottom: 0.85rem; }
.prog-h {
  display: flex; justify-content: space-between;
  font-size: 0.8rem; color: var(--secondary); margin-bottom: 0.3rem;
}
.prog-bar {
  height: 6px; border-radius: 980px; background: var(--fill); overflow: hidden;
}
.prog-bar i {
  display: block; height: 100%; width: 0;
  background: var(--blue); border-radius: 980px;
  transition: width 320ms var(--ease);
}
.prog-bar.hot i { background: var(--orange); }
.prog-bar.full i { background: var(--red); }
.dns-row { display: flex; gap: 0.5rem; }
.dns-row input { flex: 1; background: var(--bg); }

.toast {
  position: fixed; left: 50%; bottom: 1.4rem; transform: translateX(-50%);
  background: rgba(30, 30, 32, 0.88); color: #fff;
  padding: 0.55rem 0.95rem; border-radius: 980px; z-index: 99;
  font-size: 0.82rem; font-weight: 500;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  animation: toast-in 220ms var(--ease) both;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(6px); }
  to { opacity: 1; transform: translateX(-50%); }
}

@media (max-width: 1100px) {
  .dash-top, .dash-mid { grid-template-columns: 1fr; }
  .dash-bottom { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-cell:nth-child(2n) { border-right: 0; }
  .stat-cell:nth-child(n+3) { border-bottom: 0; }
  .stat-cell:nth-child(-n+2) { border-bottom: 1px solid var(--sep); }
}
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -0.25rem;
  padding: 0 0.25rem;
}
.table-scroll table { min-width: 520px; }

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
    padding-bottom: calc(3.6rem + env(safe-area-inset-bottom, 0px));
  }
  .side {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: auto;
    z-index: 20;
    padding: 0.35rem 0.45rem calc(0.35rem + env(safe-area-inset-bottom, 0px));
    border-right: 0;
    border-top: 1px solid var(--sep);
    border-bottom: 0;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    flex-direction: row;
    align-items: center;
    gap: 0.25rem;
  }
  .side .logo, .side-foot, .side .logout, .nav-sec { display: none; }
  .nav {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 2px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    padding: 0.1rem 0;
  }
  .nav button {
    width: auto;
    flex: 0 0 auto;
    min-height: 44px;
    padding: 0.55rem 0.75rem;
    font-size: 0.82rem;
    white-space: nowrap;
  }
  .header {
    padding: 0 1rem;
    padding-top: env(safe-area-inset-top, 0px);
    min-height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
    height: auto;
  }
  .header-right .header-user span:not(.avatar) { display: none; }
  .main {
    padding: 1rem 1rem 1.5rem;
    max-width: none;
  }
  .login-wrap {
    padding: calc(1rem + env(safe-area-inset-top, 0px)) 1rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
    align-items: start;
    padding-top: max(2rem, env(safe-area-inset-top, 0px) + 1.25rem);
  }
  .login-card .field {
    grid-template-columns: 3.6rem 1fr;
    min-height: 48px;
  }
  .login-card .submit { min-height: 48px; }
  .seg button { min-height: 40px; }
  button, .quick-grid button { min-height: 44px; }
  button.ghost { min-height: 36px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-h, .card-b { padding-left: 0.85rem; padding-right: 0.85rem; }
  th, td { padding-left: 0.75rem; padding-right: 0.75rem; }
}

@media (max-width: 420px) {
  .stat-cell .v { font-size: 1.15rem; }
  .crumbs { font-size: 0.78rem; }
}
