/* ---------- Base ---------- */
:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --border: #e1e5ea;
  --border-strong: #c9d0d8;
  --text: #1c2430;
  --text-muted: #65717f;
  --text-faint: #98a2ae;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #e8efff;
  --up: #15803d;
  --up-bg: #dcfce7;
  --down: #b91c1c;
  --down-bg: #fee2e2;
  --pending: #6b7280;
  --pending-bg: #e5e7eb;
  --paused: #92400e;
  --paused-bg: #fef3c7;
  --danger: #b91c1c;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body.no-scroll { overflow: hidden; }

/* Each top-level screen fills the viewport column so the footer stays at the bottom. */
.screen { display: flex; flex-direction: column; flex: 1; min-height: 100vh; }
.screen-center { align-items: center; justify-content: center; padding: 24px 16px; }

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 17px; }
h2 { font-size: 15px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }

p { margin: 0; }
small { font-weight: 400; color: var(--text-muted); }

.hidden { display: none !important; }
.muted { color: var(--text-muted); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- Top bar ---------- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--up);
  box-shadow: 0 0 0 4px var(--up-bg);
}
.summary { display: flex; gap: 6px; flex: 1; flex-wrap: wrap; }
.stat {
  display: flex; flex-direction: column; align-items: center;
  min-width: 64px; padding: 4px 10px;
  border-radius: var(--radius);
  background: var(--bg);
}
.stat-value { font-size: 18px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.stat-up .stat-value { color: var(--up); }
.stat-down .stat-value { color: var(--down); }
.stat-pending .stat-value { color: var(--pending); }
.stat-paused .stat-value { color: var(--paused); }
.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.refresh-note { font-size: 12px; color: var(--text-faint); white-space: nowrap; }

/* Organization + user controls in the top bar */
.org-area { display: flex; align-items: center; gap: 8px; min-width: 0; }
.org-sep { color: var(--border-strong); font-size: 18px; line-height: 1; }
.org-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.org-switcher {
  font: inherit; font-size: 13px; font-weight: 600;
  padding: 6px 28px 6px 9px; min-height: 32px; max-width: 260px;
  border: 1px solid var(--border-strong); border-radius: 6px;
  background: var(--surface) url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%2365717f' stroke-width='1.5' d='M2.5 4.5l3.5 3.5 3.5-3.5'/%3E%3C/svg%3E") no-repeat right 8px center;
  color: var(--text); cursor: pointer; appearance: none; -webkit-appearance: none;
}
.org-switcher:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.org-switcher:disabled { opacity: 0.6; cursor: wait; }
.topbar-divider { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.btn-user { display: inline-flex; align-items: center; gap: 7px; padding-left: 6px; }
.user-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent);
  font-size: 10px; font-weight: 700; letter-spacing: 0.02em;
}
.user-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }

/* ---------- Layout ---------- */
.content {
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}
.footer {
  max-width: 1280px; width: 100%; margin: 0 auto;
  padding: 12px 20px 24px;
  font-size: 12px; color: var(--text-faint);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

/* ---------- Buttons ---------- */
.btn {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}
.btn:hover { background: var(--bg); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-sm { padding: 5px 9px; font-size: 12px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-danger { color: var(--danger); border-color: #f3c2c2; }
.btn-danger:hover { background: var(--down-bg); }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: #991b1b; }
.btn-block { width: 100%; padding: 10px 12px; font-size: 14px; }
.link-btn {
  font: inherit; font-size: 13px; color: var(--accent);
  background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}
.link-btn:hover { color: var(--accent-hover); }
.link-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.link-btn:disabled { opacity: 0.55; cursor: default; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  line-height: 1.5;
  white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-up { background: var(--up-bg); color: var(--up); }
.badge-down { background: var(--down-bg); color: var(--down); }
.badge-pending { background: var(--pending-bg); color: var(--pending); }
.badge-paused { background: var(--paused-bg); color: var(--paused); }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
.monitors { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.monitors th, .monitors td { padding: 9px 12px; text-align: left; vertical-align: middle; }
.monitors thead th {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.monitors tbody tr.row { cursor: pointer; border-top: 1px solid var(--border); }
.monitors tbody tr.row:first-child { border-top: 0; }
.monitors tbody tr.row:hover { background: #fafbfc; }
.monitors tbody tr.row.expanded { background: var(--accent-soft); }
.monitors tbody tr.row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.col-num, .monitors td.num { text-align: right; white-space: nowrap; }
.col-time { white-space: nowrap; }
.col-actions { width: 1%; }

.mon-name { font-weight: 600; }
.mon-type {
  display: inline-block; margin-left: 6px;
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); background: var(--bg);
  padding: 1px 5px; border-radius: 4px; vertical-align: middle;
}
.mon-target {
  font-family: var(--mono); font-size: 12px; color: var(--text-muted);
  max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mon-sub { display: block; font-size: 11.5px; color: var(--text-faint); margin-top: 1px; }
.uptime-good { color: var(--up); }
.uptime-warn { color: var(--paused); }
.uptime-bad { color: var(--down); }
.uptime-none { color: var(--text-faint); }

.actions { display: flex; gap: 4px; justify-content: flex-end; align-items: center; flex-wrap: nowrap; }

/* Inline delete confirmation */
.confirm {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text);
  padding: 2px 4px 2px 8px;
  border: 1px solid #f3c2c2;
  background: var(--down-bg);
  border-radius: 6px;
}

/* ---------- Detail panel ---------- */
tr.detail td { padding: 0; border-top: 0; background: #fafbfc; }
.detail-inner {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 16px;
  padding: 14px 16px 18px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.detail-block { min-width: 0; }
.detail-block h3 { margin-bottom: 8px; display: flex; justify-content: space-between; align-items: baseline; }
.detail-block h3 span { font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 12px; }
.detail-table { width: 100%; border-collapse: collapse; font-size: 12.5px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; }
.detail-table th, .detail-table td { padding: 5px 8px; text-align: left; vertical-align: top; border-top: 1px solid var(--border); }
.detail-table thead th { border-top: 0; font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.detail-table td.num { text-align: right; white-space: nowrap; }
.detail-table td.err { color: var(--down); word-break: break-word; }
.detail-table td.ok { color: var(--text-faint); }
.detail-empty { font-size: 12.5px; color: var(--text-faint); padding: 8px 0; }
.detail-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; display: flex; gap: 14px; flex-wrap: wrap; }
.detail-meta code { font-family: var(--mono); font-size: 11.5px; background: var(--surface); border: 1px solid var(--border); padding: 0 4px; border-radius: 4px; }
.detail-scroll { max-height: 320px; overflow: auto; border-radius: 6px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot-up { background: var(--up); }
.dot-down { background: var(--down); }

/* ---------- Form ---------- */
.form-card form { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px 14px;
}
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field-label { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.field input, .field select {
  font: inherit;
  font-size: 13.5px;
  padding: 7px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  width: 100%;
  min-height: 34px;
}
.field input:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.field input[aria-invalid="true"] { border-color: var(--danger); }
fieldset.type-fields { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px 12px; margin: 0; }
fieldset legend { font-size: 12px; font-weight: 600; color: var(--text-muted); padding: 0 4px; }
.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.form-error { color: var(--danger); font-size: 13px; min-height: 1.2em; flex: 1; }
.form-error:empty { min-height: 0; }
.form-success { color: var(--up); font-size: 13px; }
.form-actions-end { justify-content: flex-end; }
.form-grid-tight { gap: 8px 10px; grid-template-columns: minmax(0, 1fr) 140px; }
.field-grow { min-width: 0; }
.field input[readonly] { background: var(--bg); color: var(--text-muted); }
.stack-form { display: flex; flex-direction: column; gap: 12px; }
.inline-form { display: flex; flex-direction: column; gap: 10px; }
.inline-select {
  font: inherit; font-size: 12.5px; padding: 4px 24px 4px 7px; min-height: 28px;
  border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); color: var(--text);
}
.inline-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
.inline-select:disabled { opacity: 0.6; }
.inline-error { color: var(--danger); font-size: 12px; margin-top: 4px; }

.banner { margin: 10px 16px 0; padding: 8px 12px; border-radius: 6px; font-size: 13px; }
.banner-error { background: var(--down-bg); color: var(--down); border: 1px solid #f3c2c2; }
.banner-info { background: var(--accent-soft); color: var(--accent-hover); border: 1px solid #c7d7fe; }
.empty { padding: 28px 16px; text-align: center; color: var(--text-muted); }

/* ---------- Auth screen ---------- */
.auth-wrap { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 14px; }
.brand-lg { justify-content: center; margin-bottom: 4px; }
.brand-lg h1 { font-size: 20px; }
.auth-wrap .banner { margin: 0; }
.auth-card { display: flex; flex-direction: column; }
.auth-head { padding: 16px 20px 0; display: flex; flex-direction: column; gap: 2px; }
.auth-head h2 { font-size: 17px; }
.auth-status { padding: 14px 20px 18px; }
.auth-form { padding: 16px 20px 18px; display: flex; flex-direction: column; gap: 12px; }
.auth-hint { font-size: 12.5px; text-align: center; margin-top: 2px; }
.tabs { display: flex; border-bottom: 1px solid var(--border); }
.tab {
  font: inherit; font-size: 13.5px; font-weight: 500;
  flex: 1; padding: 12px 10px; background: none; border: 0; border-bottom: 2px solid transparent;
  margin-bottom: -1px; color: var(--text-muted); cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ---------- Slide-over panels ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(16, 24, 40, 0.35); z-index: 20; }
.slide-over {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 21;
  width: min(560px, 100%);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 24px rgba(16, 24, 40, 0.12);
  display: flex; flex-direction: column;
  outline: none;
}
.slide-over-sm { width: min(420px, 100%); }
.slide-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 18px; border-bottom: 1px solid var(--border); flex: none;
}
.slide-body { padding: 16px 18px 24px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 22px; }
.slide-body .banner { margin: 0; }
.panel-section { display: flex; flex-direction: column; gap: 10px; }
.panel-section h3 { display: flex; justify-content: space-between; align-items: baseline; }
.panel-section h3 .muted { font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 12px; }
.panel-org { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-org-name { font-size: 16px; font-weight: 600; word-break: break-word; }
.panel-note { font-size: 12.5px; }
.panel-actions { margin-top: 4px; }

/* Members table */
.members { width: 100%; border-collapse: collapse; }
.members th, .members td { padding: 8px 8px; text-align: left; vertical-align: middle; border-top: 1px solid var(--border); }
.members thead th {
  border-top: 0; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); white-space: nowrap;
}
.members td.cell-actions { width: 1%; }
.members tr.is-self td { background: #fafbfc; }
.member-name { display: block; font-weight: 600; }
.member-email { display: block; font-size: 12px; color: var(--text-muted); word-break: break-all; }
.you-tag {
  display: inline-block; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--accent); background: var(--accent-soft); padding: 1px 5px; border-radius: 4px; vertical-align: middle; margin-left: 2px;
}
.role-pill {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--pending-bg); color: var(--pending);
}
.role-owner { background: var(--paused-bg); color: var(--paused); }
.role-admin { background: var(--accent-soft); color: var(--accent); }

/* Invite link + pending invites */
.copy-box { display: flex; gap: 6px; align-items: center; }
.copy-box input {
  font: inherit; font-family: var(--mono); font-size: 12px;
  flex: 1; min-width: 0; padding: 6px 8px; min-height: 32px;
  border: 1px solid var(--border-strong); border-radius: 6px; background: var(--bg); color: var(--text);
}
.copy-box input:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
.invite-result { background: var(--up-bg); border: 1px solid #bbf7d0; border-radius: 6px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.invite-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.invite-item { border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.invite-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.invite-meta .member-name { display: inline; margin-right: auto; word-break: break-all; }
.invite-meta .muted { font-size: 12px; }

/* API keys */
.key-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.key-item { border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.key-item.is-revoked { background: var(--bg); }
.key-item.is-revoked .member-name { color: var(--text-muted); text-decoration: line-through; }
.key-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.key-meta .member-name { display: inline; margin-right: auto; word-break: break-all; }
.key-sub { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); }
.key-prefix {
  font-family: var(--mono); font-size: 11.5px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); padding: 1px 5px; border-radius: 4px;
}
.key-item.is-revoked .key-prefix { color: var(--text-muted); }
.key-revoked-badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--down-bg); color: var(--down);
}
.key-result {
  background: var(--paused-bg); border: 1px solid #fde68a; border-radius: 6px;
  padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; font-size: 13px;
}
.key-result p { color: var(--paused); }
.panel-note code { font-family: var(--mono); font-size: 11.5px; background: var(--bg); border: 1px solid var(--border); padding: 0 4px; border-radius: 4px; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .monitors > thead > tr > th:nth-child(9), .monitors > tbody > tr.row > td:nth-child(9) { display: none; }
  .mon-target { max-width: 200px; }
}

@media (max-width: 820px) {
  .detail-inner { grid-template-columns: 1fr; }
  /* Card layout: scoped to the outer table's own cells so the nested
     detail tables keep their tabular layout. */
  .monitors > thead { display: none; }
  .monitors, .monitors > tbody, .monitors > tbody > tr, .monitors > tbody > tr > td { display: block; }
  .monitors > tbody > tr.row { padding: 10px 14px 12px; }
  .monitors > tbody > tr.row > td { padding: 2px 0; border: 0; }
  .monitors > tbody > tr.row > td[data-label]::before {
    content: attr(data-label);
    display: inline-block; width: 86px;
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted);
  }
  .monitors > tbody > tr.row > td.num { text-align: left; }
  .monitors > tbody > tr.row > td.cell-status { margin-bottom: 4px; }
  .monitors > tbody > tr.row > td.cell-name { font-size: 15px; margin-bottom: 2px; }
  .monitors > tbody > tr.row > td.cell-actions { margin-top: 8px; }
  .actions { justify-content: flex-start; flex-wrap: wrap; }
  .mon-target { max-width: 100%; white-space: normal; word-break: break-all; }
  .monitors > tbody > tr.detail > td { padding: 0; }
  .detail-inner { padding: 12px 14px 16px; }
  .monitors > tbody > tr.row > td:nth-child(9) { display: block; }
}

@media (max-width: 700px) {
  .members thead { display: none; }
  .members, .members tbody, .members tr, .members td { display: block; }
  .members tr { border-top: 1px solid var(--border); padding: 8px 0 10px; }
  .members td { border: 0; padding: 3px 0; }
  .members td[data-label]::before {
    content: attr(data-label); display: inline-block; width: 64px;
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted);
  }
  .members td[data-label="Name"]::before { display: none; }
  .members td.cell-actions { width: auto; padding-top: 6px; }
  .members .actions { justify-content: flex-start; flex-wrap: wrap; }
  .form-grid-tight { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .topbar-inner { gap: 10px; padding: 10px 14px; }
  .org-area { flex: 1; min-width: 0; }
  .org-name, .org-switcher { max-width: 100%; }
  .topbar-actions { width: 100%; margin-left: 0; flex-wrap: wrap; order: 4; }
  .topbar-divider { display: none; }
  .user-name { max-width: 90px; }
  .summary { order: 3; width: 100%; }
  .stat { flex: 1; min-width: 0; padding: 4px 6px; }
  .stat-value { font-size: 16px; }
  .topbar-actions { margin-left: auto; }
  .refresh-note { display: none; }
  .content, .footer { padding: 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .card-head { padding: 10px 14px; }
  .screen-center { padding: 16px 10px; }
  .auth-form, .auth-head, .auth-status { padding-left: 14px; padding-right: 14px; }
  .slide-body { padding: 14px 14px 20px; }
  .slide-head { padding: 10px 14px; }
}

@media (max-width: 400px) {
  .brand h1 { font-size: 15px; }
  .summary { gap: 4px; min-width: 0; }
  .stat { padding: 4px 3px; overflow: hidden; }
  .stat-label { font-size: 10px; letter-spacing: 0.03em; }
  .btn { padding: 8px 9px; }
  .copy-box { flex-wrap: wrap; }
  .copy-box input { flex-basis: 100%; }
  .confirm { flex-wrap: wrap; }
}
