/* 房产管理系统 — fluid, viewport-adaptive UI.
 *
 * The whole system is anchored to the root font-size, which scales with the
 * viewport via clamp(). Every visual element (icons, avatars, FAB, badges,
 * radii, padding) is expressed in `em` / `rem`, so a smaller phone gets a
 * proportionally smaller UI without any media-query maintenance.
 */

:root {
  /* Root font scales smoothly from ~14px on a 320px-wide phone to ~17px on a
     420px+ phone. Everything else inherits from this. */
  font-size: clamp(14px, 4.2vw, 17px);

  --primary: #1A3C6E;
  --primary-soft: rgba(26, 60, 110, 0.15);
  --accent: #F5A623;
  --success: #34C759;
  --warning: #F5A623;
  --danger: #FF3B30;
  --overdue: #AF52DE;

  --bg-grouped: #F2F2F7;
  --bg-secondary-grouped: #FFFFFF;
  --text: #000000;
  --text-secondary: rgba(60, 60, 67, 0.6);
  --text-tertiary: rgba(60, 60, 67, 0.3);
  --separator: rgba(60, 60, 67, 0.15);

  --radius: 0.85em;
  --radius-sm: 0.7em;
  --shadow-card: 0 0.12em 0.36em rgba(0, 0, 0, 0.08);
  --shadow-card-soft: 0 0.06em 0.24em rgba(0, 0, 0, 0.06);
  --shadow-fab: 0 0.25em 0.6em rgba(26, 60, 110, 0.4);

  --tabbar-h: 4em;
  --topbar-h: 3.2em;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-grouped: #000000;
    --bg-secondary-grouped: #1C1C1E;
    --text: #FFFFFF;
    --text-secondary: rgba(235, 235, 245, 0.6);
    --text-tertiary: rgba(235, 235, 245, 0.3);
    --separator: rgba(84, 84, 88, 0.65);
    --primary-soft: rgba(255, 255, 255, 0.1);
    --shadow-card: 0 0.12em 0.36em rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg-grouped);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
               "Helvetica Neue", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}

body { min-height: 100vh; min-height: 100dvh; }

a { color: var(--primary); text-decoration: none; }
a:active { opacity: 0.6; }

h1, h2, h3, h4 { margin: 0 0 0.4em; line-height: 1.25; color: var(--text); }
h1 { font-size: 1.55rem; font-weight: 700; }
h2 { font-size: 1.2rem;  font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 600; }
h4 { font-size: 1rem;    font-weight: 600; }
p  { margin: 0 0 0.5em; }

/* SVG icons always size from font-size of their parent — never hardcoded.
   Any element that wants a bigger icon just bumps its own font-size. */
svg { width: 1em; height: 1em; flex-shrink: 0; }

/* ─── Accessibility ─── */
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--primary); color: white; padding: 0.5em 0.8em; border-radius: 0.4em;
}
.skip-link:focus { left: 0.8em; top: 0.8em; z-index: 9999; }

/* ─── Top bar ─── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg-secondary-grouped);
  border-bottom: 1px solid var(--separator);
  padding-top: env(safe-area-inset-top);
}
.topbar-inner {
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1em;
}
.topbar-title { font-size: 1.05rem; font-weight: 600; margin: 0; color: var(--text); }
.topbar-actions { display: flex; gap: 0.25em; align-items: center; }

.iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.25em; height: 2.25em;
  border-radius: 50%;
  background: transparent;
  color: var(--primary);
  border: 0; cursor: pointer;
  font-size: 1rem;
}
.iconbtn:active { background: rgba(0, 0, 0, 0.06); }
.iconbtn svg { font-size: 1.4em; }
.inline-form { display: inline; }

/* ─── Main content ─── */
.content {
  padding: 1em 1em calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 1.5em);
  max-width: 45rem;
  margin: 0 auto;
  background: var(--bg-grouped);
}

/* ─── Tab bar ─── */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--bg-secondary-grouped);
  border-top: 1px solid var(--separator);
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 50;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 0.4em 0.25em; min-height: var(--tabbar-h);
  color: var(--text-secondary);
  font-size: 0.68rem;
  gap: 0.2em;
}
.tab svg { font-size: 1.55em; }
.tab.is-active { color: var(--primary); }

/* ─── Card ─── */
.card {
  background: var(--bg-secondary-grouped);
  border-radius: var(--radius);
  padding: 1em;
  box-shadow: var(--shadow-card);
  margin-bottom: 0.85em;
}
.card-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.85em; }
.card-list > li { display: block; }
.card-list a { color: inherit; display: block; }

/* ─── Status badge ─── */
.badge {
  display: inline-block;
  font-size: 0.72rem; font-weight: 600;
  padding: 0.25em 0.6em; border-radius: 1.2em;
  border: 1px solid;
  white-space: nowrap;
  line-height: 1.2;
}
.badge-success { background: rgba(52, 199, 89, 0.15);   color: var(--success); border-color: rgba(52, 199, 89, 0.4); }
.badge-warning { background: rgba(245, 166, 35, 0.15);  color: var(--warning); border-color: rgba(245, 166, 35, 0.4); }
.badge-danger  { background: rgba(255, 59, 48, 0.15);   color: var(--danger);  border-color: rgba(255, 59, 48, 0.4); }
.badge-overdue { background: rgba(175, 82, 222, 0.15);  color: var(--overdue); border-color: rgba(175, 82, 222, 0.4); }

/* ─── Status banner ─── */
.status-banner {
  display: flex; align-items: center; justify-content: center; gap: 0.5em;
  color: white;
  font-size: 0.95rem; font-weight: 500;
  padding: 0.75em;
  border-radius: var(--radius-sm);
  margin-bottom: 0.85em;
}
.status-banner svg { font-size: 1.05em; }
.status-banner-success { background: var(--success); }
.status-banner-warning { background: var(--warning); }
.status-banner-danger  { background: var(--danger); }
.status-banner-overdue { background: var(--overdue); }

/* ─── Info pill ─── */
.info-pills {
  display: flex; flex-wrap: wrap; gap: 0.85em;
  align-items: center;
}
.info-pill {
  display: inline-flex; align-items: center; gap: 0.25em;
  font-size: 0.82rem;
  color: var(--text);
}
.info-pill svg { font-size: 1em; }
.info-pill-accent  { color: var(--accent); }
.info-pill-primary { color: var(--primary); }
.info-pill-muted   { color: var(--text-secondary); }
.info-pill .pill-text { color: var(--text); }

/* ─── Info row (detail pages) ─── */
.info-rows { display: grid; gap: 0; }
.info-row {
  display: grid;
  grid-template-columns: 1.4em 5em 1fr;
  gap: 0.75em;
  align-items: start;
  padding: 0.75em 0;
  font-size: 0.95rem;
}
.info-row + .info-row { border-top: 1px solid var(--separator); }
.info-row > svg { font-size: 1.05em; color: var(--primary); margin-top: 0.1em; }
.info-row-label { color: var(--text-secondary); }
.info-row-value { color: var(--text); word-break: break-word; }

.info-row-total .info-row-value strong {
  font-size: 1.1rem; font-weight: 700; color: var(--primary);
  font-feature-settings: "tnum";
}
.info-row-total > svg { color: var(--accent); }

/* ─── Tenant avatar ─── */
.tenant-card {
  display: flex; align-items: center; gap: 0.85em;
  padding: 0.85em;
  background: var(--bg-secondary-grouped);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card-soft);
}
.tenant-avatar {
  width: 3em; height: 3em; flex-shrink: 0;
  border-radius: 50%;
  background: var(--primary-soft);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
  font-size: 1rem;
  font-weight: 600;
}
.tenant-avatar > * { font-size: 1.2em; }
.tenant-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.25em; }
.tenant-name { font-size: 1rem; font-weight: 600; color: var(--text); }
.tenant-meta { font-size: 0.78rem; color: var(--text-secondary); display: flex; gap: 0.75em; flex-wrap: wrap; }
.tenant-meta-item { display: inline-flex; align-items: center; gap: 0.25em; }

/* ─── Forms ─── */
.form { display: grid; gap: 0.5em; }
.form label {
  font-size: 0.82rem; color: var(--text-secondary); margin-top: 0.35em; font-weight: 500;
}
.input, input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="search"],
input[type="tel"], textarea, select {
  width: 100%;
  font: inherit; font-size: 1rem;
  padding: 0.75em 0.85em;
  border-radius: 0.6em;
  border: 1px solid var(--separator);
  background: var(--bg-secondary-grouped);
  color: var(--text);
  -webkit-appearance: none; appearance: none;
}
.input:focus, textarea:focus, select:focus, input:focus {
  outline: 2px solid var(--primary);
  outline-offset: -1px;
  border-color: var(--primary);
}
textarea { resize: vertical; min-height: 5em; font-family: inherit; }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75em; }
@media (max-width: 24em) { .row { grid-template-columns: 1fr; } }

.checkbox {
  display: flex; align-items: center; gap: 0.5em;
  margin-top: 0.25em; color: var(--text);
}
.checkbox input { width: 1.1em; height: 1.1em; }

.form-error { color: var(--danger); font-size: 0.82rem; margin: 0.15em 0 0; }
.form-hint  { color: var(--text-secondary); font-size: 0.78rem; margin: 0; }

/* ─── Buttons ─── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  font: inherit; font-size: 1rem; font-weight: 600;
  padding: 0.8em 1.1em;
  border-radius: 0.75em;
  border: 0;
  cursor: pointer;
  text-align: center;
  user-select: none;
}
.btn svg { font-size: 1.1em; }
.btn-block { width: 100%; margin-top: 0.5em; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:active { background: #14305a; }
.btn-secondary {
  background: var(--bg-secondary-grouped);
  color: var(--primary);
  border: 1px solid var(--separator);
}
.btn-success { background: var(--success); color: white; }
.btn-success:active { background: #2ba24a; }
.btn-danger  { background: var(--danger);  color: white; }
.btn-danger:active { background: #cc2f26; }

.link {
  background: none; border: 0; padding: 0.3em 0.5em;
  color: var(--primary); font-weight: 500; cursor: pointer; font-size: 0.95rem;
  display: inline-flex; align-items: center; gap: 0.25em;
}
.link.danger { color: var(--danger); }

/* ─── Floating Action Button (FAB) ─── */
.fab {
  position: fixed;
  right: 1.2em;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 1em);
  width: 3.4em; height: 3.4em;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-fab);
  z-index: 40;
  border: 0; cursor: pointer;
  font-size: 1rem;
}
.fab:active { transform: scale(0.95); }
.fab svg { font-size: 1.55em; }

/* ─── Flash ─── */
.flash-area { margin-bottom: 0.75em; display: grid; gap: 0.5em; }
.flash {
  padding: 0.75em 0.85em; border-radius: var(--radius-sm);
  background: var(--bg-secondary-grouped); border: 1px solid var(--separator);
  font-size: 0.92rem;
}
.flash-success { border-color: var(--success); color: var(--success); }
.flash-danger  { border-color: var(--danger);  color: var(--danger); }
.flash-warning { border-color: var(--warning); color: var(--warning); }
.flash-info    { border-color: var(--primary); color: var(--primary); }

/* ─── Login screen ─── */
.page-auth { background: transparent; }
.page-auth .topbar, .page-auth .tabbar { display: none; }
.page-auth .content {
  padding: 0;
  max-width: none;
  min-height: 100vh; min-height: 100dvh;
  background: linear-gradient(135deg, var(--primary) 0%, rgba(26, 60, 110, 0.8) 100%);
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  color: white;
}
.auth-screen {
  width: 100%; max-width: 24rem;
  padding: 1.5em 2em calc(2em + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; gap: 2em;
  flex: 1; justify-content: space-between;
  padding-top: calc(env(safe-area-inset-top) + 3em);
}
.auth-brand {
  text-align: center; display: flex; flex-direction: column; align-items: center;
  gap: 0.85em; flex: 1; justify-content: center;
}
.auth-logo {
  width: 4.5em; height: 4.5em;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 1rem;
}
.auth-logo svg { font-size: 2.4em; fill: white; }
.auth-brand h1 { color: white; font-size: 1.55rem; font-weight: 700; margin: 0; }
.auth-sub { color: rgba(255,255,255,0.75); font-size: 0.92rem; margin: 0; }
.auth-form { width: 100%; }
.auth-form .input {
  background: rgba(255, 255, 255, 0.95);
  border-color: transparent;
  color: var(--text);
}
.auth-form .btn-primary {
  background: white; color: var(--primary);
  box-shadow: 0 0.25em 0.6em rgba(0, 0, 0, 0.15);
  padding: 0.85em 1.2em;
}
.auth-form .btn-primary:active { background: #f3f3f3; }
.auth-form label { color: rgba(255, 255, 255, 0.85); }
.auth-form .checkbox { color: rgba(255, 255, 255, 0.85); }
.auth-hint { color: rgba(255, 255, 255, 0.5); font-size: 0.75rem; text-align: center; margin: 0; }
.auth-form .form-error { color: #ffd0ce; }

/* ─── Dashboard stat cards ─── */
.stats-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.85em;
  margin-bottom: 1.2em;
}
.stat-card {
  background: var(--bg-secondary-grouped);
  border-radius: var(--radius);
  padding: 1em;
  box-shadow: var(--shadow-card);
  display: flex; flex-direction: column; gap: 0.6em;
  color: var(--text);
  min-height: 5em;
}
.stat-icon-row { display: flex; justify-content: flex-start; font-size: 1rem; }
.stat-icon svg { font-size: 1.65em; }
.stat-icon-primary { color: var(--primary); }
.stat-icon-warning { color: var(--warning); }
.stat-icon-accent  { color: var(--accent); }
.stat-icon-info    { color: #14B8A6; }
.stat-value { font-size: 1.3rem; font-weight: 700; line-height: 1.1; }
.stat-label { font-size: 0.78rem; color: var(--text-secondary); }

/* ─── Section header ─── */
.section { margin-bottom: 1.2em; }
.section-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 0.6em;
  padding: 0 0.25em;
}
.section-header h2, .section-header h3 { font-size: 1.05rem; margin: 0; font-weight: 600; }
.section-header .link { padding: 0.25em 0; }

/* ─── Search bar ─── */
.search-bar { margin-bottom: 0.75em; position: relative; }
.search-bar input {
  padding-left: 2.25em;
  background: rgba(118, 118, 128, 0.12);
  border: 0;
  border-radius: 0.6em;
  font-size: 0.95rem;
}
.search-bar::before {
  content: ""; position: absolute;
  left: 0.75em; top: 50%; transform: translateY(-50%);
  width: 1em; height: 1em;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2399999f' stroke-width='2' stroke-linecap='round'><circle cx='11' cy='11' r='8'/><path d='m21 21-4.35-4.35'/></svg>");
  background-repeat: no-repeat;
  background-size: contain;
}

/* ─── Reminder rows ─── */
.reminder-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.6em; }
.reminder-row {
  display: flex; align-items: center; gap: 0.85em;
  padding: 0.75em 0.85em;
  background: var(--bg-secondary-grouped);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card-soft);
  color: var(--text);
  font-size: 1rem;
}
.reminder-dot {
  width: 2.5em; height: 2.5em; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; flex-shrink: 0;
}
.reminder-dot svg { font-size: 1.05em; }
.reminder-dot.tint-success { background: rgba(52, 199, 89, 0.15);  color: var(--success); }
.reminder-dot.tint-warning { background: rgba(245, 166, 35, 0.15); color: var(--warning); }
.reminder-dot.tint-danger  { background: rgba(255, 59, 48, 0.15);  color: var(--danger); }
.reminder-dot.tint-overdue { background: rgba(175, 82, 222, 0.15); color: var(--overdue); }
.reminder-body { flex: 1; display: flex; flex-direction: column; gap: 0.2em; min-width: 0; }
.reminder-title { font-size: 0.94rem; font-weight: 500; color: var(--text); }
.reminder-sub   { font-size: 0.78rem; color: var(--text-secondary); }

/* ─── Property card ─── */
.property-card {
  display: block;
  background: var(--bg-secondary-grouped);
  border-radius: var(--radius);
  padding: 1em;
  box-shadow: var(--shadow-card);
  color: var(--text);
}
.property-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 0.6em;
}
.property-title {
  font-size: 1rem; font-weight: 600; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.property-divider {
  height: 1px; background: var(--separator);
  margin: 0.75em 0;
}
.property-next-due {
  margin-top: 0.6em;
  display: inline-flex; align-items: center; gap: 0.35em;
  font-size: 0.78rem; color: var(--text-secondary);
}
.property-next-due svg { font-size: 1em; color: var(--warning); }

/* ─── Empty state ─── */
.empty-state {
  background: transparent;
  padding: 3.5em 1.2em;
  text-align: center;
  color: var(--text-secondary);
  display: flex; flex-direction: column; align-items: center; gap: 0.85em;
  font-size: 1rem;
}
.empty-state .empty-icon {
  color: rgba(26, 60, 110, 0.4);
  font-size: 1rem;
}
.empty-state .empty-icon svg { font-size: 3em; }
.empty-state h3 { color: var(--text); }
.empty-state .btn { margin-top: 0.5em; }

/* ─── Undo banner (after rent record creation) ─── */
.undo-banner {
  display: flex; align-items: center; gap: 0.75em;
  background: rgba(52, 199, 89, 0.12);
  border: 1px solid rgba(52, 199, 89, 0.4);
  border-radius: var(--radius-sm);
  padding: 0.75em 0.9em;
  margin-bottom: 0.85em;
}
.undo-banner-text { flex: 1; font-size: 0.92rem; color: var(--text); }
.undo-banner-text strong { color: var(--success); font-weight: 700; }
.undo-banner-btn {
  display: inline-flex; align-items: center; gap: 0.3em;
  background: transparent;
  color: var(--danger);
  border: 0;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.35em 0.5em;
  cursor: pointer;
}
.undo-banner-btn:active { opacity: 0.6; }
.undo-banner-btn svg { font-size: 1em; }

/* ─── Map (Google Static Maps, proxied through server) ─── */
.map-image-wrap {
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  margin-bottom: 0.85em;
  background: var(--bg-secondary-grouped);
}
.map-image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 1;
  object-fit: cover;
  background: var(--bg-grouped);
}

/* ─── Map placeholder (when no coordinates set) ─── */
.map-placeholder {
  background: var(--bg-secondary-grouped);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  margin-bottom: 0.85em;
  padding: 1.5em 1em;
  text-align: center;
  color: var(--text-secondary);
  font-size: 1em;
}
.map-placeholder > svg { font-size: 2em; color: var(--primary); opacity: 0.5; }

/* ─── Rent history (single card, leading-inset dividers like iOS) ─── */
.rent-history-card { padding: 0; overflow: hidden; }
.rent-history-row {
  display: flex; align-items: center; gap: 0.75em;
  padding: 0.75em 1em;
}
.rent-history-check { color: var(--success); display: inline-flex; }
.rent-history-check svg { font-size: 1.1em; }
.rent-history-date { flex: 1; font-size: 0.95rem; color: var(--text); }
.rent-history-amount { font-size: 0.95rem; font-weight: 600; color: var(--success); }
.rent-history-divider {
  height: 1px; background: var(--separator);
  margin-left: 2.85em;  /* matches iOS .padding(.leading, 48) ≈ icon width + gap */
}
.rent-history-total {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.85em 1em;
  border-top: 1px solid var(--separator);
  background: var(--bg-grouped);
}
.rent-history-total-label {
  font-size: 0.92rem; font-weight: 600; color: var(--text-secondary);
}
.rent-history-total-amount {
  font-size: 1.05rem; font-weight: 700; color: var(--primary);
  font-feature-settings: "tnum";
}

/* ─── Empty card text (centered "暂无..." inside a card) ─── */
.empty-card-text {
  text-align: center;
  color: var(--text-secondary);
  padding: 1.5em 1em;
}

/* ─── Topbar dropdown menu (matches iOS ellipsis.circle Menu) ─── */
.menu-dropdown { position: relative; }
.menu-dropdown > summary {
  cursor: pointer;
  list-style: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.25em; height: 2.25em;
  border-radius: 50%;
  color: var(--primary);
}
.menu-dropdown > summary::-webkit-details-marker { display: none; }
.menu-dropdown > summary::marker { display: none; }
.menu-dropdown > summary:active { background: rgba(0, 0, 0, 0.06); }
.menu-dropdown > summary svg { font-size: 1.4em; }
.menu-content {
  position: absolute;
  top: calc(100% + 0.35em);
  right: 0;
  background: var(--bg-secondary-grouped);
  border-radius: 0.7em;
  box-shadow: 0 0.5em 1.2em rgba(0, 0, 0, 0.18);
  min-width: 12em;
  padding: 0.25em 0;
  z-index: 60;
  border: 1px solid var(--separator);
}
.menu-content a,
.menu-content button {
  display: flex; align-items: center; gap: 0.6em;
  padding: 0.7em 0.9em; width: 100%;
  text-align: left;
  background: transparent; border: 0;
  color: var(--text);
  font-size: 0.95rem; font-weight: 500;
  cursor: pointer;
}
.menu-content a:active, .menu-content button:active { background: rgba(0, 0, 0, 0.06); }
.menu-content .menu-item-danger, .menu-content .menu-item-danger svg { color: var(--danger); }
.menu-content svg { font-size: 1em; color: inherit; }
.menu-content form { width: 100%; }

/* ─── Collapsible ─── */
.collapsible {
  background: var(--bg-secondary-grouped);
  border: 1px solid var(--separator);
  border-radius: var(--radius-sm);
  padding: 0.75em;
  margin-top: 0.5em;
}
.collapsible summary { cursor: pointer; font-weight: 600; color: var(--primary); }

/* ─── Danger zone ─── */
.danger-zone { margin-top: 1.5em; }

/* ─── Notes ─── */
.notes h4 { font-size: 0.85rem; color: var(--text-secondary); margin: 0 0 0.25em; }

/* ─── Row actions ─── */
.row-actions { display: flex; align-items: center; gap: 0.25em; }
.muted { color: var(--text-secondary); font-size: 0.85rem; margin: 0; }

/* ─── Approval code ─── */
.approval-code-box {
  display: flex; flex-direction: column; align-items: center; gap: 0.35em;
  padding: 1.2em 0.75em;
  background: var(--primary-soft);
  border-radius: var(--radius);
  margin: 0.85em 0;
}
.approval-code-label { color: var(--text-secondary); font-size: 0.85rem; }
.approval-code { font-size: 2rem; font-weight: 800; letter-spacing: 0.4rem; color: var(--primary); }
.approval-code-meta { color: var(--text-secondary); font-size: 0.75rem; }

/* ─── Enable-notifications card ─── */
.enable-push-card { border-left: 0.25em solid var(--primary); }
.enable-push-card h3 { font-size: 1rem; margin-bottom: 0.25em; }
.enable-push-actions { display: flex; gap: 0.5em; margin-top: 0.6em; }
.enable-push-actions .btn { flex: 1; padding: 0.6em 0.75em; font-size: 0.95rem; }

/* ─── Diagnostic table ─── */
.diag-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.diag-table td { padding: 0.35em 0.25em; border-bottom: 1px solid var(--separator); vertical-align: top; }
.diag-table td:first-child { color: var(--text-secondary); width: 38%; }
.diag-table code { background: var(--bg-grouped); padding: 0.05em 0.25em; border-radius: 0.25em; }

/* ─── Install banner ─── */
.install-banner {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 100;
  padding: 1em;
  padding-bottom: calc(1em + env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: flex-end; justify-content: center;
}
.install-banner[hidden] { display: none; }
.install-card {
  background: var(--bg-secondary-grouped);
  border-radius: 1.1em;
  padding: 1.25em;
  max-width: 26rem; width: 100%;
  position: relative;
  box-shadow: 0 0.75em 2em rgba(0, 0, 0, 0.25);
}
.install-card h2 { font-size: 1.1rem; margin-bottom: 0.35em; }
.install-steps { padding-left: 1.25em; line-height: 1.55; font-size: 0.95rem; }
.install-steps strong { color: var(--primary); }
.install-close {
  position: absolute; top: 0.5em; right: 0.6em;
  background: transparent; border: 0;
  font-size: 1.6rem; line-height: 1;
  color: var(--text-secondary); cursor: pointer;
}
.install-actions { margin-top: 0.75em; text-align: right; }
