:root {
  --bg: #eef1f7;
  --panel: rgba(255, 255, 255, 0.62);
  --panel-solid: rgba(255, 255, 255, 0.86);
  --sidebar: rgba(22, 24, 30, 0.78);
  --text: #1c1c1e;
  --muted: #8e8e93;
  --line: rgba(60, 60, 67, 0.12);
  --blue: #007aff;
  --blue-soft: rgba(0, 122, 255, 0.12);
  --green: #34c759;
  --red: #ff3b30;
  --shadow: 0 10px 28px rgba(15, 23, 42, 0.08), 0 1px 0 rgba(255, 255, 255, 0.55) inset;
  --radius: 22px;
  --glass: blur(28px) saturate(190%);
  --hairline: 1px solid rgba(255, 255, 255, 0.55);
  --stroke: 1px solid rgba(255, 255, 255, 0.42);
}

* { box-sizing: border-box; }
html, body { height: auto; min-height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "PingFang SC", "Helvetica Neue", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 0%, rgba(0, 122, 255, 0.16), transparent 32%),
    radial-gradient(circle at 90% 8%, rgba(175, 82, 222, 0.12), transparent 28%),
    radial-gradient(circle at 50% 100%, rgba(52, 199, 89, 0.08), transparent 34%),
    linear-gradient(180deg, #e8eefc 0%, #f2f2f7 42%, #ebeff7 100%);
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}

button, input, select, textarea { font: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible,
a:focus-visible, [role="button"]:focus-visible {
  outline: 3px solid rgba(0, 122, 255, 0.22);
  outline-offset: 2px;
}

.shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100dvh;
  align-content: start;
}

.sidebar {
  background: var(--sidebar);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  color: #f5f5f7;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  top: 0;
  height: 100dvh;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.2px;
  padding: 8px 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.side-brand-copy { display: grid; gap: 2px; }
.side-brand-title { color: #fff; font-size: 15px; font-weight: 750; }
.side-brand-sub { color: rgba(235, 235, 245, 0.48); font-size: 11px; font-weight: 500; }

.logo {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: linear-gradient(145deg, #0a84ff, #5e5ce6);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(10, 132, 255, 0.28);
}
.logo.sm { width: 30px; height: 30px; font-size: 14px; border-radius: 10px; }

nav { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(235, 235, 245, 0.72);
  text-decoration: none;
  padding: 12px 14px;
  border-radius: 16px;
  transition: .18s ease;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.nav-item.active {
  background: rgba(10, 132, 255, 0.24);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(10, 132, 255, 0.28);
}
.nav-ico { width: 18px; text-align: center; opacity: .9; }
.side-foot {
  font-size: 12px;
  color: rgba(235, 235, 245, 0.42);
  padding: 8px;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  align-self: start;
  width: 100%;
}

.topbar {
  background: rgba(242, 242, 247, 0.55);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  border-bottom: 1px solid rgba(255, 255, 255, 0.45);
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 5;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.4) inset;
}

.top-left, .top-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.page-title {
  font-size: 28px;
  font-weight: 760;
  letter-spacing: -0.03em;
}
.page-sub { display: none !important; }

.user-name { font-size: 13px; font-weight: 650; }
.user-mail { display: none !important; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.62);
  border: var(--stroke);
  border-radius: 999px;
  padding: 6px 12px 6px 6px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  cursor: pointer;
}
.user-chip:hover { border-color: rgba(0, 122, 255, 0.28); }
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(145deg, #0a84ff, #5e5ce6);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 700;
  overflow: hidden;
  flex: 0 0 auto;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.avatar.xl {
  width: 88px;
  height: 88px;
  font-size: 34px;
  border-radius: 24px;
}
.logout {
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  margin-left: 4px;
}
.logout:hover { color: var(--red); }

.rainbow-hello {
  font-family: "Segoe Print", "Comic Sans MS", "Bradley Hand", "Apple Chancery", "Snell Roundhand", cursive;
  font-size: 44px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.05;
  transform: rotate(-2deg);
  text-shadow: 1px 2px 0 rgba(0, 0, 0, 0.04);
}
.rainbow-hello span { display: inline-block; transform: rotate(var(--r, 0deg)); }
.rainbow-hello .h0 { color: #ff3b30; --r: -6deg; }
.rainbow-hello .h1 { color: #ff9f0a; --r: 4deg; }
.rainbow-hello .h2 { color: #30d158; --r: -3deg; }
.rainbow-hello .h3 { color: #0a84ff; --r: 5deg; }
.rainbow-hello .h4 { color: #bf5af2; --r: -4deg; }

.hello-mini {
  font-weight: 780;
  background: linear-gradient(90deg, #ff3b30, #ff9f0a, #30d158, #0a84ff, #bf5af2);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.view { display: none; padding: 12px 14px 18px; }
.view.active { display: block; }

.stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  max-width: 1180px;
}

.service-card,
.panel,
.login-card {
  background: var(--panel);
  border: var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
}
.service-card {
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.48)),
    rgba(255, 255, 255, 0.42);
}
.service-card.glass {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.48)),
    rgba(255, 255, 255, 0.42);
}

.service-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.node {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
}
.node-copy { min-width: 0; }
.node-ico {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(0, 122, 255, 0.20), rgba(0, 122, 255, 0.10));
  color: #007aff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 18px;
  border: 1px solid rgba(0, 122, 255, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}
.node-name {
  font-size: 20px;
  font-weight: 740;
  letter-spacing: -0.02em;
}
.node-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  flex-wrap: wrap;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 650;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.55);
}
.status-pill.ok {
  color: #1f8a44;
  background: rgba(52, 199, 89, 0.12);
  border-color: rgba(52, 199, 89, 0.18);
}
.status-pill.err {
  color: #c41f17;
  background: rgba(255, 59, 48, 0.10);
  border-color: rgba(255, 59, 48, 0.16);
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 5px;
}
.dot.ok { background: var(--green); box-shadow: 0 0 0 3px rgba(52, 199, 89, .15); }
.dot.err { background: var(--red); box-shadow: 0 0 0 3px rgba(255, 59, 48, .12); }

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.metrics {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.metrics.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.metric {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 18px;
  padding: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}
.metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.metric .label {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
  font-weight: 650;
}
.metric .value {
  font-size: 28px;
  font-weight: 760;
  letter-spacing: -0.03em;
  word-break: break-all;
}
.metric .sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}
.metric.clickable {
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: .15s ease;
  font: inherit;
  color: inherit;
}
.metric.clickable.inbox,
.metric.clickable.junk {
  background: linear-gradient(180deg, rgba(0, 122, 255, 0.18), rgba(0, 122, 255, 0.08));
  border: 1px solid rgba(0, 122, 255, 0.28);
  color: #0b4f9c;
  box-shadow: 0 8px 18px rgba(0, 122, 255, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}
.metric.clickable.inbox .label,
.metric.clickable.junk .label,
.metric.clickable.inbox .sub,
.metric.clickable.junk .sub {
  color: rgba(11, 79, 156, 0.72);
}
.metric.clickable.inbox .value,
.metric.clickable.junk .value {
  color: #007aff;
}
.metric.clickable:hover {
  transform: translateY(-1px);
  filter: brightness(1.02);
}
.metric.clickable.inbox:hover,
.metric.clickable.junk:hover {
  border-color: rgba(0, 122, 255, 0.42);
  background: linear-gradient(180deg, rgba(0, 122, 255, 0.24), rgba(0, 122, 255, 0.12));
  box-shadow: 0 10px 22px rgba(0, 122, 255, 0.16);
}

.read-actions {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.btn {
  border: 1px solid rgba(60, 60, 67, 0.12);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  border-radius: 999px;
  padding: 9px 15px;
  cursor: pointer;
  transition: .15s ease;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
  font-weight: 650;
}
.btn:hover { background: rgba(255, 255, 255, 0.95); }
.btn.primary {
  background: linear-gradient(180deg, #1a86ff, #007aff);
  border-color: transparent;
  color: white;
  box-shadow: 0 8px 18px rgba(0, 122, 255, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger {
  color: var(--red);
  border-color: rgba(255, 59, 48, 0.2);
  background: rgba(255, 59, 48, 0.08);
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  box-shadow: none;
}
.btn.full { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.icon-btn {
  width: 36px;
  min-height: 36px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  font-size: 18px;
}

.panel { overflow: hidden; max-width: 1180px; }
.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.28);
}
.filters, .pager { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filters select, .login-form input, .form-grid input, .form-grid select, .form-grid textarea,
.avatar-editor-form input {
  border: 1px solid rgba(60, 60, 67, 0.12);
  border-radius: 14px;
  padding: 11px 12px;
  background: rgba(255, 255, 255, 0.78);
  outline: none;
  min-height: 42px;
}
.filters select:focus, .login-form input:focus, .form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus,
.avatar-editor-form input:focus {
  border-color: rgba(0, 122, 255, 0.45);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.12);
}

.mail-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  min-height: 0;
}
.mail-list {
  border-right: 1px solid var(--line);
  overflow: auto;
  max-height: min(70vh, 720px);
  background: rgba(255, 255, 255, 0.22);
}
.mail-item {
  padding: 13px 14px;
  border-bottom: 1px solid rgba(60, 60, 67, 0.08);
  cursor: pointer;
}
.mail-item:hover { background: rgba(0, 122, 255, 0.05); }
.mail-item.active { background: rgba(0, 122, 255, 0.10); }
.mail-item .subject {
  font-weight: 650;
  font-size: 14px;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mail-item .from, .mail-item .date {
  color: var(--muted);
  font-size: 12px;
}
.mail-item.unread .subject { color: #0f172a; }
.mail-item.unread .subject::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blue);
  margin-right: 6px;
  vertical-align: middle;
}

.mail-read {
  padding: 14px;
  overflow: auto;
  max-height: min(70vh, 720px);
  background: rgba(255, 255, 255, 0.38);
}
.mail-read .empty, .empty {
  color: var(--muted);
  padding: 12px 8px;
  text-align: center;
}

.loading-box {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 14px 8px;
  min-height: 56px;
}
.loading-text {
  color: var(--muted);
  font-size: 13px;
}
.ios-spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2.5px solid rgba(0, 122, 255, 0.18);
  border-top-color: #007aff;
  animation: ios-spin .7s linear infinite;
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.05);
}
.soft-loading { margin-bottom: 8px; }
.soft-loading .loading-box {
  min-height: 56px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(0, 122, 255, 0.12);
  border-radius: 16px;
}
@keyframes ios-spin {
  to { transform: rotate(360deg); }
}
.read-subject {
  font-size: 24px;
  font-weight: 760;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}
.read-meta {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.read-body {
  white-space: pre-wrap;
  line-height: 1.65;
  font-size: 14px;
}
.read-body.html {
  white-space: normal;
  border: 1px solid rgba(60, 60, 67, 0.08);
  border-radius: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.7);
}

.compose-panel { padding: 18px; }
.panel-title {
  font-size: 18px;
  font-weight: 720;
  margin-bottom: 14px;
  letter-spacing: -0.02em;
}
.form-grid {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 12px 12px;
  align-items: start;
}
.form-grid label {
  color: var(--muted);
  padding-top: 10px;
  font-size: 13px;
}
.form-grid textarea { resize: vertical; min-height: 220px; }
.compose-actions {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  align-items: center;
}
.status-text { color: var(--muted); font-size: 13px; }
.status-text.ok { color: var(--green); }
.status-text.err { color: var(--red); }

.settings-grid {
  display: grid;
  gap: 14px;
  max-width: 900px;
}
.avatar-editor {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.avatar-editor-form {
  flex: 1;
  min-width: 240px;
  display: grid;
  gap: 8px;
}
.avatar-editor-form label {
  color: var(--muted);
  font-size: 13px;
}
.hint {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 14px;
  line-height: 1.5;
}
.notification-summary {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.45);
  color: var(--muted);
  font-size: 12px;
}
.notification-summary.ok {
  border-color: rgba(52, 199, 89, 0.22);
  background: rgba(52, 199, 89, 0.10);
  color: #1f8a44;
}
.notification-summary.warn {
  border-color: rgba(255, 159, 10, 0.24);
  background: rgba(255, 159, 10, 0.10);
  color: #9a5b00;
}
.switch-row {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 0 !important;
  color: var(--text) !important;
  cursor: pointer;
}
.switch-row input {
  width: 18px;
  height: 18px;
  min-height: 0;
  accent-color: var(--blue);
}
.notification-actions { flex-wrap: wrap; }
.mail-account-settings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.mail-account-group {
  min-width: 0;
  display: grid;
  gap: 7px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fafbfc;
}
.mail-account-title { margin-bottom: 3px; font-size: 15px; font-weight: 700; }
.mail-account-group label { color: var(--muted); font-size: 12px; font-weight: 600; }
.mail-account-group input {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  border: 1px solid #d6dbe2;
  border-radius: 6px;
  padding: 9px 11px;
  background: #fff;
  outline: none;
}
.mail-account-group input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(23,105,224,.12); }
.mail-account-group .btn { width: max-content; margin-top: 5px; white-space: nowrap; }
.mailpass-status { display: block; width: 100%; margin-top: 12px; line-height: 1.5; overflow-wrap: anywhere; }

/* Login */
.login-body {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at top right, rgba(0, 122, 255, .16), transparent 30%),
    radial-gradient(circle at 10% 80%, rgba(175, 82, 222, .10), transparent 28%),
    linear-gradient(180deg, #e9eef8, #f2f2f7 40%);
  padding: 20px;
}
.login-shell {
  width: 100%;
  min-height: calc(100dvh - 40px);
  display: grid;
  place-items: center;
}
.login-card {
  width: min(420px, 100%);
  padding: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.58)),
    rgba(255, 255, 255, 0.48);
}
.brand-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}
.brand-title { font-size: 22px; font-weight: 780; letter-spacing: -0.02em; margin: 0; }
.brand-sub { color: var(--muted); font-size: 13px; margin: 2px 0 0; }
.login-form { display: grid; gap: 10px; }
.field-group { display: grid; gap: 6px; }
.login-form label { font-size: 13px; color: var(--muted); margin: 0; }
.alert {
  background: rgba(255, 59, 48, 0.08);
  color: #c41f17;
  border: 1px solid rgba(255, 59, 48, 0.18);
  border-radius: 14px;
  padding: 10px 12px;
  margin-bottom: 10px;
  font-size: 13px;
}
.login-foot {
  margin-top: 16px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.tabs { display: none; }
.mobile-tabbar { display: none; }

.err-text {
  color: #ff3b30 !important;
  line-height: 1.3;
  word-break: break-word;
}
.service-error {
  max-width: 260px;
  margin-top: 7px;
  color: var(--red);
  font-size: 12px;
  line-height: 1.35;
}

@media (max-width: 980px) {
  html, body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }
  body {
    background:
      radial-gradient(circle at 12% 0%, rgba(0, 122, 255, 0.14), transparent 34%),
      radial-gradient(circle at 88% 8%, rgba(175, 82, 222, 0.10), transparent 30%),
      #f2f2f7;
  }
  .shell {
    grid-template-columns: 1fr;
    min-height: 100dvh;
    height: auto;
    max-height: none;
    align-content: start;
  }
  .sidebar { display: none; }
  .main {
    min-height: 0;
    height: auto;
    display: flex;
    flex-direction: column;
    overflow: visible;
    width: 100%;
  }
  .topbar {
    padding: 8px 10px;
    flex: 0 0 auto;
    background: rgba(242, 242, 247, 0.68);
  }
  .view {
    display: none;
    padding: 8px 10px;
    min-height: 0;
    overflow: visible;
  }
  .view.active {
    display: block;
    padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px));
  }
  #view-services.active { overflow: visible; }
  #account-cards.stack {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 8px;
    min-height: calc(100dvh - 150px - env(safe-area-inset-bottom, 0px));
  }
  #view-services .service-card {
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 12px;
  }
  #view-services .service-top { gap: 8px; }
  #view-services .metrics {
    flex: 1 1 auto;
    margin-top: 10px;
    align-items: stretch;
  }
  #view-services .metric.clickable {
    min-height: 96px;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  #view-inbox.active .panel,
  #view-compose.active .panel,
  #view-settings.active .settings-grid {
    min-height: 0;
  }
  #view-inbox.active .panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  #view-inbox .mail-layout {
    min-height: 0;
    grid-template-columns: 1fr;
  }
  #view-inbox .mail-list {
    max-height: 38dvh;
    min-height: 140px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  #view-inbox .mail-read {
    max-height: none;
    min-height: 0;
    overflow: auto;
    padding: 10px;
  }
  .service-card { padding: 10px; }
  .stack { gap: 8px; grid-template-columns: 1fr; }
  .service-top { gap: 10px; }
  .actions { gap: 6px; }
  .btn { padding: 8px 12px; }
  .metrics {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
  }
  .metrics.two { grid-template-columns: 1fr 1fr; }
  .metric { padding: 10px; }
  .metric .value { font-size: 24px; }
  .node-ico { width: 40px; height: 40px; border-radius: 12px; font-size: 15px; }
  .node-name { font-size: 17px; }
  .panel-head { padding: 8px 10px; }
  .compose-panel { padding: 10px; }
  .form-grid { grid-template-columns: 1fr; gap: 8px; }
  .form-grid label { padding-top: 0; }
  .form-grid textarea { min-height: 140px; }
  .settings-grid { gap: 8px; }
  .empty { padding: 10px 6px; }
  .loading-box { min-height: 48px; padding: 10px 6px; }
  .soft-loading { margin-bottom: 6px; }
  .soft-loading .loading-box { min-height: 44px; padding: 8px; }
  .page-title { font-size: 24px; }
  .rainbow-hello { font-size: 34px; }

  .mobile-tabbar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    height: calc(58px + env(safe-area-inset-bottom, 0px));
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(28px) saturate(190%);
    -webkit-backdrop-filter: blur(28px) saturate(190%);
    border-top: 1px solid rgba(255, 255, 255, 0.55);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.65);
  }
  .tab-item {
    border: 0;
    background: transparent;
    color: #8e8e93;
    display: grid;
    place-items: center;
    gap: 2px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 14px;
    padding: 4px 2px;
  }
  .tab-item .tab-ico {
    font-size: 16px;
    line-height: 1;
  }
  .tab-item.active {
    color: #007aff;
    background: rgba(0, 122, 255, 0.10);
  }
}

@media (max-width: 560px) {
  .top-left { min-width: 0; }
  .top-right { flex: 0 0 auto; gap: 6px; }
  .user-chip { padding-right: 7px; }
  .user-chip > div:nth-child(2) { display: none; }
  .logout { border-left: 0; white-space: nowrap; }
  .service-top {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }
  .node { width: 100%; align-items: flex-start; }
  .node-copy { flex: 1 1 auto; }
  .service-error { max-width: none; }
  .actions { width: 100%; gap: 8px; }
  .actions .btn {
    flex: 1 1 0;
    min-width: 0;
    min-height: 36px;
    padding: 7px 10px;
    white-space: nowrap;
  }
  .metrics, .metrics.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { min-width: 0; padding: 11px; }
  .metric-head { white-space: nowrap; }
  .metric .value { font-size: 25px; }
  .compose-panel { padding: 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .mail-account-settings { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .mail-account-group { padding: 12px; }
  .mail-account-group .btn { width: 100%; }
  .mailpass-status { margin-top: 10px; }
  .login-body { padding: 16px; }
  .login-shell { min-height: calc(100dvh - 32px); }
  .login-card { padding: 22px; }
}
