/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Apple Design Tokens ──────────────────────────────────── */
:root {
  color-scheme: light;
  /* Backgrounds */
  --bg:            #f5f5f7;
  --bg-elevated:   #ffffff;
  --bg-secondary:  rgba(118,118,128,.12);
  --bg-tertiary:   rgba(118,118,128,.08);

  /* Text */
  --text-primary:   #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary:  #6e6e73;
  --text-caption:   #646469;

  /* Separators */
  --separator:      rgba(60,60,67,.12);
  --separator-soft: rgba(60,60,67,.06);

  /* Accent */
  --blue:      #0066cc;
  --blue-solid:#0066cc;
  --on-blue-solid:#ffffff;
  --blue-dark: #005bb5;
  --blue-bg:   rgba(0,113,227,.08);
  --blue-text: #005eb8;

  /* Brand — reserved for identity, not financial status or primary actions */
  --brand:      #6d28d9;
  --brand-soft: rgba(109,40,217,.12);

  /* Semantic */
  --green:     #1d7138;
  --green-solid:#1d7138;
  --on-green-solid:#ffffff;
  --green-bg:  rgba(52,199,89,.10);
  --green-text:#176d2f;
  --red:       #c1272d;
  --red-solid: #c1272d;
  --on-red-solid:#ffffff;
  --red-bg:    rgba(255,59,48,.10);
  --red-text:  #b42318;
  --orange:    #9a5600;
  --orange-solid:#9a5600;
  --on-orange-solid:#ffffff;
  --orange-text:#8a4b00;

  /* Shape */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius:    14px;
  --radius-lg: 20px;

  /* Shadow */
  --shadow-sm: none;
  --shadow:    none;
  --shadow-lg: 0 2px 8px rgba(0,0,0,.06), 0 16px 40px rgba(0,0,0,.10), 0 0 0 1px rgba(0,0,0,.03);

  /* Transitions */
  --ease: cubic-bezier(.25,.46,.45,.94);
  --duration: 200ms;

  /* Mobile viewport */
  --mobile-bottom-nav-height: calc(62px + env(safe-area-inset-bottom));
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg:            #141416;
  --bg-elevated:   #202023;
  --bg-secondary:  rgba(255,255,255,.07);
  --bg-tertiary:   rgba(255,255,255,.045);
  --text-primary:   #e2e2e7;
  --text-secondary: #a4a4aa;
  --text-tertiary:  #8c8c93;
  --text-caption:   #9c9ca3;
  --separator:      rgba(235,235,245,.09);
  --separator-soft: rgba(235,235,245,.045);
  --blue:      #6fa8dc;
  --blue-solid:#78a9d4;
  --on-blue-solid:#111820;
  --blue-dark: #83b4de;
  --blue-bg:   rgba(111,168,220,.13);
  --blue-text: #7eb0da;
  --brand:      #c5a6df;
  --brand-soft: rgba(197,166,223,.13);
  --green:     #76b98b;
  --green-solid:#70b184;
  --on-green-solid:#0e1811;
  --green-bg:  rgba(128,184,142,.13);
  --green-text:#8ac098;
  --red:       #df6f76;
  --red-solid: #d26770;
  --on-red-solid:#1e0d10;
  --red-bg:    rgba(217,130,130,.13);
  --red-text:  #df9292;
  --orange:    #d3a46e;
  --orange-solid:#c79b64;
  --on-orange-solid:#1b130b;
  --orange-text:#d9ac78;
  --shadow-sm: none;
  --shadow:    none;
  --shadow-lg: 0 2px 8px rgba(0,0,0,.36), 0 20px 50px rgba(0,0,0,.42), 0 0 0 1px rgba(255,255,255,.05);
}

/* ── Base ─────────────────────────────────────────────────── */
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.47059;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern" 1;
  overflow-x: hidden;
}

/* ── Shell ────────────────────────────────────────────────── */
.app-frame { min-height: 100vh; }
.app-shell { display: flex; flex-direction: column; min-height: 100vh; }
.app-content {
  min-width: 0;
  position: relative;
  opacity: 1;
  transition: opacity 160ms var(--ease), transform 160ms var(--ease);
}
.app-content.app-content-refreshing::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 130;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--blue), transparent);
  opacity: .72;
  transform-origin: left center;
  animation: appRefreshLine 1.1s var(--ease) infinite;
  pointer-events: none;
}
.app-content.app-content-entering {
  opacity: 0;
  transform: translateY(8px);
}
.app-frame.app-frame-loading-slow {
  cursor: progress;
}
.app-frame.app-frame-loading-slow .app-content {
  opacity: .94;
}
.app-route-skeleton {
  display: grid;
  gap: 16px;
  animation: appSkeletonIn 120ms var(--ease);
}
.app-route-skeleton-head {
  display: grid;
  gap: 8px;
}
.app-route-skeleton-title,
.app-route-skeleton-line,
.app-route-skeleton-pill,
.app-route-skeleton-card,
.app-route-skeleton-row {
  position: relative;
  overflow: hidden;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
}
.app-route-skeleton-title::after,
.app-route-skeleton-line::after,
.app-route-skeleton-pill::after,
.app-route-skeleton-card::after,
.app-route-skeleton-row::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.42), transparent);
  transform: translateX(-100%);
  animation: appSkeletonShimmer 1.2s ease-in-out infinite;
}
.app-route-skeleton-title {
  width: min(260px, 70vw);
  height: 34px;
  border-radius: 12px;
}
.app-route-skeleton-line {
  width: min(360px, 84vw);
  height: 16px;
}
.app-route-skeleton-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.app-route-skeleton-pill {
  height: 46px;
  border-radius: 16px;
}
.app-route-skeleton-card {
  min-height: 148px;
  border: 1px solid var(--separator-soft);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
}
.app-route-skeleton-list {
  display: grid;
  gap: 8px;
  padding: 4px 0;
}
.app-route-skeleton-row {
  height: 64px;
  border-radius: 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--separator-soft);
}
.app-refresh-status {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: calc(var(--mobile-bottom-nav-height) + 18px);
  z-index: 140;
  max-width: min(360px, calc(100vw - 28px));
  padding: 10px 13px;
  border: 1px solid var(--separator-soft);
  border-radius: 999px;
  color: var(--text-primary);
  background: color-mix(in srgb, var(--bg-elevated) 86%, transparent);
  box-shadow: var(--shadow-md);
  font-size: .8125rem;
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
}
@keyframes appRefreshLine {
  0% { transform: scaleX(.08) translateX(-20%); }
  55% { transform: scaleX(.78) translateX(55%); }
  100% { transform: scaleX(.08) translateX(125%); }
}
@keyframes appSkeletonIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@keyframes appSkeletonShimmer {
  100% { transform: translateX(100%); }
}
@media (prefers-reduced-motion: reduce) {
  .app-content {
    transition: none;
  }
  .app-content.app-content-entering {
    opacity: 1;
    transform: none;
  }
  .app-frame.app-frame-loading-slow .app-content {
    opacity: 1;
  }
  .app-route-skeleton,
  .app-route-skeleton-title::after,
  .app-route-skeleton-line::after,
  .app-route-skeleton-pill::after,
  .app-route-skeleton-card::after,
  .app-route-skeleton-row::after,
  .app-content.app-content-refreshing::after {
    animation: none;
  }
}

/* ── Header — frosted glass ───────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 24px;
  background: rgba(255,255,255,.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--separator);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: .9375rem;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--text-primary);
  text-decoration: none;
}
.brand-mark {
  width: 25px;
  height: 25px;
  display: block;
  object-fit: contain;
  flex: 0 0 auto;
}
.brand-word { color: var(--brand); line-height: 1; }

.mobile-menu-btn {
  display: none;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--separator);
  border-radius: 999px;
  background: rgba(255,255,255,.74);
  color: var(--text-primary);
  font: inherit;
  font-size: .8125rem;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.menu-icon {
  width: 15px;
  height: 10px;
  display: inline-flex;
  flex-direction: column;
  justify-content: space-between;
}
.menu-icon span {
  height: 1.5px;
  border-radius: 99px;
  background: currentColor;
  transform-origin: center;
  transition: transform var(--duration) var(--ease),
              opacity var(--duration) var(--ease);
}
.mobile-menu-btn[aria-expanded="true"] .menu-icon span:first-child {
  transform: translateY(4.25px) rotate(45deg);
}
.mobile-menu-btn[aria-expanded="true"] .menu-icon span:last-child {
  transform: translateY(-4.25px) rotate(-45deg);
}

.mobile-bottom-nav,
.mobile-primary-fab,
.mobile-nav-backdrop,
.mobile-side-drawer {
  display: none;
}

.mobile-nav-backdrop {
  border: 0;
  padding: 0;
  background: transparent;
}

.app-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: calc(100vw - 96px);
  overflow: visible;
}
.app-nav a,
.app-nav .nav-btn,
.app-nav summary {
  font-size: .8125rem;
  font-weight: 400;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 5px 10px;
  border-radius: var(--radius-xs);
  transition: background var(--duration) var(--ease),
              color var(--duration) var(--ease);
  cursor: pointer;
  white-space: nowrap;
}
.app-nav a:hover,
.app-nav .nav-btn:hover,
.app-nav summary:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}
.app-nav a.current,
.app-nav .nav-menu.current > summary {
  color: var(--text-primary);
  font-weight: 500;
  background: var(--bg-secondary);
}
.app-nav .nav-menu {
  position: relative;
  flex: 0 0 auto;
}
.app-nav .nav-menu summary {
  display: flex;
  align-items: center;
  gap: 7px;
  list-style: none;
  user-select: none;
}
.app-nav .nav-menu summary::-webkit-details-marker { display: none; }
.nav-workspace-name {
  display: block;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-chevron {
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform var(--duration) var(--ease);
}
.nav-menu[open] > summary .nav-chevron {
  transform: translateY(1px) rotate(225deg);
}
.nav-popover {
  position: absolute;
  z-index: 110;
  top: calc(100% + 8px);
  left: 0;
  width: 196px;
  display: none;
  padding: 6px;
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(60,60,67,.14);
  border-radius: var(--radius);
  box-shadow: 0 12px 36px rgba(0,0,0,.14);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
}
.nav-popover::before {
  content: "";
  position: absolute;
  right: 0;
  bottom: 100%;
  left: 0;
  height: 10px;
}
.nav-popover-right {
  right: 0;
  left: auto;
  width: 220px;
}
.nav-menu[open] > .nav-popover { display: grid; }
@media (hover: hover) and (min-width: 641px) {
  .nav-menu:hover > .nav-popover,
  .nav-menu:focus-within > .nav-popover { display: grid; }
}
.app-nav .nav-popover a,
.app-nav .nav-menu-action {
  display: flex;
  width: 100%;
  min-height: 36px;
  align-items: center;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  font-size: .8125rem;
  text-align: left;
}
.app-nav .nav-popover a.current {
  color: var(--blue);
  background: var(--blue-bg);
}
.nav-popover-divider {
  height: 1px;
  margin: 5px 4px;
  background: var(--separator-soft);
}
.app-nav form { display: contents; }
.app-nav .nav-btn {
  background: none;
  border: none;
  font-family: inherit;
  line-height: 1.47059;
}
.app-nav .nav-popover form { display: block; }
.app-nav .nav-menu-action {
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  cursor: pointer;
}
.app-nav .nav-menu-action:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
}
.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;
}
.language-menu {
  position: relative;
  margin-left: 4px;
}
.language-menu > .language-menu-toggle {
  min-width: 56px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--separator);
  border-radius: var(--radius-xs);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
.language-menu > .language-menu-toggle svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
}
.language-menu-code {
  font-size: .75rem;
  font-weight: 650;
  letter-spacing: 0;
}
.language-popover {
  position: absolute;
  z-index: 150;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  width: 168px;
  gap: 2px;
  padding: 6px;
  border: 1px solid rgba(60,60,67,.14);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.94);
  box-shadow: 0 14px 38px rgba(0,0,0,.16);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
}
.language-popover[hidden] { display: none; }
.app-nav .language-option-form { display: block; }
.language-option {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: .8125rem;
  text-align: left;
  cursor: pointer;
}
.language-option:hover,
.language-option.current {
  color: var(--text-primary);
  background: var(--bg-secondary);
}
.language-option.current::after {
  content: "✓";
  color: var(--blue);
  font-weight: 700;
}
.theme-toggle {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
  padding: 4px 9px;
  border: 1px solid var(--separator);
  border-radius: var(--radius-xs);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font: inherit;
  font-size: .8125rem;
  cursor: pointer;
}
.theme-toggle:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
}
.theme-toggle svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
}
.theme-toggle .theme-label-dark,
html[data-theme="dark"] .theme-toggle .theme-label-light,
.theme-toggle .theme-icon-dark,
html[data-theme="dark"] .theme-toggle .theme-icon-light {
  display: none;
}
html[data-theme="dark"] .theme-toggle .theme-label-dark,
html[data-theme="dark"] .theme-toggle .theme-icon-dark {
  display: inline;
}

/* ── Main ─────────────────────────────────────────────────── */
.app-main {
  flex: 1;
  padding: 36px 24px 60px;
  max-width: 1080px;
  margin: 0 auto;
  width: 100%;
}

/* ── Page title ───────────────────────────────────────────── */
.page-title { margin-bottom: 24px; }
.page-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.page-title h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1.14;
  color: var(--text-primary);
}
.page-title p {
  margin-top: 4px;
  font-size: .875rem;
  color: var(--text-secondary);
}
.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.mobile-only { display: none !important; }

/* ── Section label ────────────────────────────────────────── */
.section-label {
  font-size: .6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

/* ── Card ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-elevated);
  border-radius: var(--radius);
  box-shadow: none;
  overflow: hidden;
}
.card-pad { padding: 20px 24px; }

/* ── Stat row ─────────────────────────────────────────────── */
.stats { display: flex; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.stat {
  flex: 1;
  min-width: 140px;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  box-shadow: none;
  padding: 18px 20px;
}
.stat-label {
  font-size: .6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}
.stat-value {
  font-size: 1.625rem;
  font-weight: 700;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.stat-value.g { color: var(--green); }
.stat-value.r { color: var(--red); }

/* ── Table ────────────────────────────────────────────────── */
.table-card {
  background: var(--bg-elevated);
  border-radius: var(--radius);
  box-shadow: none;
  overflow: hidden;
}
.table-scroll {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-gutter: stable;
}
.table-scroll table {
  min-width: 760px;
}
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead tr { border-bottom: 1px solid var(--separator); }
thead th {
  padding: 11px 16px;
  text-align: left;
  font-size: .6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-tertiary);
  white-space: nowrap;
  background: var(--bg-elevated);
}
tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--separator-soft);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--duration) var(--ease); }
tbody tr:hover td { background: var(--bg-tertiary); }

.td-date { color: var(--text-secondary); font-size: .8125rem; white-space: nowrap; }
.td-cat  { font-weight: 500; }
.td-desc { color: var(--text-tertiary); font-size: .8125rem; }
.td-amt  { font-variant-numeric: tabular-nums; font-weight: 600; letter-spacing: -.01em; }
.td-amt.g { color: var(--green); }
.td-amt.r { color: var(--red); }

.empty-state { text-align: center; padding: 64px 24px; color: var(--text-tertiary); font-size: .875rem; }

/* ── Badge / pill ─────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .02em;
}
.pill-green { background: var(--green-bg); color: var(--green-text); }
.pill-red   { background: var(--red-bg);   color: var(--red-text); }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 19px;
  border-radius: 999px;
  font-size: .875rem;
  font-weight: 400;
  cursor: pointer;
  border: none;
  text-decoration: none;
  font-family: inherit;
  transition: filter var(--duration) var(--ease),
              box-shadow var(--duration) var(--ease);
  line-height: 1.47059;
  white-space: nowrap;
}

.btn-primary {
  background: var(--blue-solid);
  color: var(--on-blue-solid);
  box-shadow: none;
}
.btn-primary:hover { filter: brightness(1.08); }

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
}
.btn-secondary:hover { background: rgba(118,118,128,.18); }

.btn-ghost {
  background: transparent;
  color: var(--blue);
}
.btn-ghost:hover { background: var(--blue-bg); }

.btn-danger {
  background: var(--red-bg);
  color: var(--red);
}
.btn-danger:hover { filter: brightness(.96); }

.btn-sm { min-height: 34px; padding: 5px 13px; font-size: .8125rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; font-weight: 500; }

/* ── Input ────────────────────────────────────────────────── */
.input {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: .9375rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-secondary);
  outline: none;
  transition: border-color var(--duration) var(--ease),
              box-shadow var(--duration) var(--ease);
  -webkit-appearance: none;
}
.input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3.5px rgba(0,113,227,.18);
}
.input::placeholder { color: var(--text-tertiary); }
.domain-input {
  display: flex;
  align-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  overflow: hidden;
  transition: border-color var(--duration) var(--ease),
              box-shadow var(--duration) var(--ease);
}
.domain-input:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3.5px rgba(0,113,227,.18);
}
.domain-input .input {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  min-width: 0;
}
.domain-input .input:focus {
  box-shadow: none;
}
.domain-suffix {
  flex: 0 0 auto;
  padding: 0 14px 0 4px;
  color: var(--text-secondary);
  font-size: .9375rem;
  white-space: nowrap;
}
.password-field-shell {
  position: relative;
  display: block;
}
.password-field-shell input {
  padding-right: 44px !important;
}
.password-toggle {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--duration) var(--ease),
              color var(--duration) var(--ease);
}
.password-toggle:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}
.password-toggle-icon {
  position: relative;
  width: 16px;
  height: 10px;
  border: 1.5px solid currentColor;
  border-radius: 50% / 62%;
}
.password-toggle-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  transform: translate(-50%, -50%);
}
.password-toggle[aria-pressed="true"] .password-toggle-icon::before {
  content: "";
  position: absolute;
  left: -2px;
  top: 4px;
  width: 20px;
  height: 1.5px;
  border-radius: 99px;
  background: currentColor;
  transform: rotate(-35deg);
}
.password-rules {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 12px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--separator-soft);
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
}
.password-rule {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-secondary);
  font-size: .8125rem;
  line-height: 1.25;
}
.password-rule::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-tertiary);
  flex: 0 0 auto;
}
.password-rule.valid {
  color: var(--green);
}
.password-rule.valid::before {
  background: var(--green);
}
.password-rule.invalid[data-password-match="true"] {
  color: var(--red);
}
.password-rule.invalid[data-password-match="true"]::before {
  background: var(--red);
}
.select-wrap {
  position: relative;
}
.select-wrap .input {
  cursor: pointer;
  padding-right: 34px;
}
.select-wrap::after {
  content: "";
  position: absolute;
  right: 13px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 1.5px solid var(--text-secondary);
  border-bottom: 1.5px solid var(--text-secondary);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}
.field-label {
  display: block;
  font-size: .8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

/* ── Mono ─────────────────────────────────────────────────── */
.mono-block {
  font-family: "SF Mono", ui-monospace, "Cascadia Code", "Fira Code", monospace;
  font-size: .8125rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  word-break: break-all;
  color: var(--text-primary);
  line-height: 1.6;
}

/* ── Status indicator ─────────────────────────────────────── */
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.5} }
.status-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: .8125rem;
  font-weight: 500;
  color: var(--green);
}
.status-live::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 2.5px rgba(52,199,89,.2);
  animation: pulse 2.5s ease-in-out infinite;
  flex-shrink: 0;
}

/* ── Alert ────────────────────────────────────────────────── */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  margin-bottom: 16px;
}
  .alert-error { background: var(--red-bg); color: var(--red-text); }
  input[aria-invalid="true"],
  select[aria-invalid="true"],
  textarea[aria-invalid="true"] {
border-color: var(--red) !important;
box-shadow: 0 0 0 3px var(--red-bg) !important;
  }
.alert a {
  margin-left: 6px;
  color: inherit;
  font-weight: 600;
}

/* ── Divider ──────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--separator); margin: 20px 0; }

/* ── Shared drawer shell ─────────────────────────────────── */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  justify-content: flex-end;
  align-items: stretch;
  isolation: isolate;
}
.drawer[hidden] { display: none !important; }
.drawer-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(0,0,0,.25);
  animation: bdFade 180ms var(--ease);
}
@keyframes bdFade { from { opacity: 0; } to { opacity: 1; } }
.drawer-panel {
  position: relative;
  width: 380px;
  max-width: 100vw;
  background: var(--bg-elevated);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: panelSlide 220ms var(--ease);
  transform: translate3d(0, var(--drawer-drag-y, 0px), 0);
  will-change: transform;
  z-index: 1;
}
.drawer.drawer-dragging .drawer-panel,
.drawer.drawer-settling .drawer-panel,
.drawer.drawer-dismissing .drawer-panel {
  animation: none !important;
}
.drawer.drawer-dragging .drawer-panel {
  transition: none !important;
}
.drawer.drawer-settling .drawer-panel {
  transition: transform 180ms var(--ease) !important;
}
.drawer.drawer-dismissing .drawer-panel {
  transform: translate3d(0, 105%, 0) !important;
  transition: transform 180ms var(--ease) !important;
}
.drawer.drawer-dragging .drawer-backdrop {
  animation: none !important;
  opacity: var(--drawer-backdrop-opacity, 1);
}
@media (prefers-reduced-motion: reduce) {
  .drawer.drawer-settling .drawer-panel,
  .drawer.drawer-dismissing .drawer-panel {
    transition: none !important;
  }
}
@keyframes panelSlide { from { transform: translateX(100%); } to { transform: translateX(0); } }
.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--separator);
  flex-shrink: 0;
}
.drawer-title {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -.02em;
}
.drawer-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: .875rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--duration) var(--ease);
}
.drawer-close:hover { background: rgba(118,118,128,.22); }
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.drawer-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--separator);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.drawer-footer-right { display: flex; gap: 8px; }

/* ── Mobile data cards ───────────────────────────────────── */
.mobile-card-list {
  display: none;
}
.ledger-card {
  background: var(--bg-elevated);
  border: 1px solid var(--separator-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 14px;
}
.ledger-card-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}
.ledger-card-title {
  font-size: .9375rem;
  font-weight: 650;
  overflow-wrap: anywhere;
}
.ledger-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 5px;
  color: var(--text-tertiary);
  font-size: .75rem;
}
.ledger-card-amount {
  font-size: 1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
}
.ledger-card-amount.g { color: var(--green); }
.ledger-card-amount.r { color: var(--red); }
.ledger-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}
.ledger-card-actions .btn,
.ledger-card-actions button {
  min-height: 36px;
}
.tx-mobile-list {
  gap: 0;
}
.tx-mobile-item {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 11px;
  padding: 14px 18px;
  border: 0;
  border-top: 1px solid var(--separator-soft);
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.tx-mobile-item:first-child {
  border-top: 0;
}
.tx-mobile-item:active {
  background: var(--bg-tertiary);
}
.tx-mobile-glyph {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: .875rem;
  font-weight: 700;
  line-height: 1;
}
.tx-mobile-item.expense .tx-mobile-glyph {
  background: var(--red-bg);
  color: var(--red);
}
.tx-mobile-item.income .tx-mobile-glyph {
  background: var(--green-bg);
  color: var(--green);
}
.tx-mobile-item.transfer .tx-mobile-glyph {
  background: var(--blue-bg);
  color: var(--blue);
}
.tx-mobile-item.voided {
  opacity: .58;
}
.tx-mobile-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.tx-mobile-title {
  overflow: hidden;
  color: var(--text-primary);
  font-size: .9375rem;
  font-weight: 650;
  line-height: 1.22;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tx-mobile-meta {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 0;
  overflow: hidden;
  color: var(--text-tertiary);
  font-size: .75rem;
  line-height: 1.2;
  white-space: nowrap;
}
.tx-mobile-meta span {
  flex: 0 0 auto;
  min-width: auto;
  white-space: nowrap;
}
.tx-mobile-meta .tx-mobile-account {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tx-mobile-meta span + span::before {
  content: "\00a0\00b7\00a0";
  color: var(--text-tertiary);
}
.tx-mobile-note {
  min-width: 0;
  overflow: hidden;
  color: var(--text-tertiary);
  font-size: .75rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tx-mobile-amount {
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tx-mobile-amount.g { color: var(--green); }
.tx-mobile-amount.r { color: var(--red); }
.tx-mobile-chevron {
  width: 8px;
  height: 8px;
  border-right: 1.5px solid var(--text-tertiary);
  border-bottom: 1.5px solid var(--text-tertiary);
  transform: rotate(-45deg);
}

@keyframes mobilePanelSlide {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@media (max-width: 640px) {
  .app-header {
    height: 56px;
    min-height: 56px;
    padding: 0 12px;
    gap: 8px;
    isolation: isolate;
  }
  .brand {
    position: relative;
    z-index: 2;
    flex: 0 0 auto;
  }
  .mobile-menu-btn {
    position: relative;
    z-index: 2;
    display: inline-flex;
    background: rgba(255,255,255,.92);
    border-color: rgba(60,60,67,.16);
  }
  .app-nav {
    display: none;
  }
  .app-header.inline-menu-open .app-nav {
    position: absolute;
    z-index: 140;
    top: calc(100% + 8px);
    right: 12px;
    display: flex;
    width: min(292px, calc(100vw - 24px));
    max-width: none;
    max-height: calc(100dvh - 78px);
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 8px;
    overflow: auto;
    border: 1px solid rgba(60,60,67,.14);
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    box-shadow: 0 20px 54px rgba(0,0,0,.22);
    backdrop-filter: saturate(180%) blur(28px);
    -webkit-backdrop-filter: saturate(180%) blur(28px);
  }
  .app-header.inline-menu-open .app-nav > a,
  .app-header.inline-menu-open .app-nav > .nav-btn,
  .app-header.inline-menu-open .theme-toggle,
  .app-header.inline-menu-open .language-menu > .language-menu-toggle {
    width: 100%;
    min-height: 44px;
    justify-content: flex-start;
    margin: 0;
    padding: 10px 12px;
  }
  .app-header.inline-menu-open .app-nav > a,
  .app-header.inline-menu-open .app-nav > .nav-btn {
    display: flex;
    align-items: center;
  }
  .app-header.inline-menu-open .language-menu {
    width: 100%;
    margin: 0;
  }
  .app-header.inline-menu-open .language-popover {
    position: static;
    width: 100%;
    margin-top: 4px;
    box-shadow: none;
  }
  .brand,
  .mobile-menu-btn,
  .app-content .input,
  .app-content .btn,
  .password-toggle {
    min-height: 44px;
  }
  .password-toggle {
    width: 44px;
    height: 44px;
    right: 0;
  }
  .sso-card a,
  .signup-request-card a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  .mobile-nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 118;
    display: block;
    background: rgba(28,28,30,.18);
    opacity: 0;
    pointer-events: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    transition: opacity var(--duration) var(--ease);
    touch-action: none;
  }
  .mobile-nav-backdrop[hidden] {
    display: none;
  }
  .mobile-side-drawer {
    position: fixed;
    top: max(7px, env(safe-area-inset-top));
    right: 7px;
    bottom: max(7px, env(safe-area-inset-bottom));
    z-index: 130;
    display: flex;
    width: min(calc(100vw - 18px), 382px);
    max-width: 382px;
    flex-direction: column;
    isolation: isolate;
    background:
      linear-gradient(135deg, rgba(255,255,255,.86), rgba(255,255,255,.50) 44%, rgba(245,248,255,.60)),
      rgba(245,245,247,.58);
    border: 1px solid rgba(255,255,255,.52);
    border-radius: 30px;
    box-shadow:
      0 26px 70px rgba(0,0,0,.24),
      0 6px 22px rgba(0,113,227,.08),
      0 0 0 1px rgba(60,60,67,.10),
      inset 0 1px 0 rgba(255,255,255,.88),
      inset 0 -1px 0 rgba(60,60,67,.08);
    backdrop-filter: blur(34px) saturate(190%) brightness(1.04);
    -webkit-backdrop-filter: blur(34px) saturate(190%) brightness(1.04);
    transform: translateX(102%);
    transition: transform 260ms cubic-bezier(.2,.8,.2,1);
    overflow: hidden;
  }
  .mobile-side-drawer::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    background:
      radial-gradient(circle at 12% 0%, rgba(255,255,255,.95), transparent 24%),
      radial-gradient(circle at 88% 16%, rgba(0,113,227,.12), transparent 32%),
      linear-gradient(180deg, rgba(255,255,255,.38), rgba(255,255,255,.06) 42%, rgba(255,255,255,.28));
    pointer-events: none;
  }
  .mobile-side-drawer::after {
    content: "";
    position: absolute;
    top: 8px;
    right: 16px;
    left: 16px;
    height: 1px;
    border-radius: 999px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.88), transparent);
    pointer-events: none;
  }
  .mobile-side-drawer[hidden] {
    display: none;
  }
  body.mobile-nav-open .mobile-nav-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
  body.mobile-nav-open .mobile-side-drawer {
    transform: translateX(0);
  }
  .mobile-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: calc(14px + env(safe-area-inset-top)) 14px 12px;
    background:
      linear-gradient(180deg, rgba(255,255,255,.68), rgba(255,255,255,.24));
    backdrop-filter: blur(26px) saturate(180%);
    -webkit-backdrop-filter: blur(26px) saturate(180%);
    border-bottom: 1px solid rgba(255,255,255,.36);
  }
  .mobile-drawer-identity {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
  }
  .mobile-drawer-avatar {
    position: relative;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    border-radius: 12px;
    background: #1d1d1f;
    box-shadow:
      0 7px 18px rgba(0,0,0,.20),
      0 0 0 1px rgba(255,255,255,.18) inset,
      inset 0 1px 0 rgba(255,255,255,.20);
  }
  .mobile-drawer-avatar::before {
    content: "";
    position: absolute;
    left: 12px;
    top: 9px;
    width: 12px;
    height: 17px;
    border-left: 2px solid #fff;
    border-right: 2px solid #fff;
    transform: skewX(18deg);
  }
  .mobile-drawer-avatar::after {
    content: "";
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--blue);
  }
  .mobile-drawer-heading {
    min-width: 0;
  }
  .mobile-drawer-title {
    min-width: 0;
    font-size: 1.0625rem;
    font-weight: 700;
    letter-spacing: 0;
  }
  .mobile-drawer-workspace {
    margin-top: 0;
    color: var(--text-secondary);
    font-size: .8125rem;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mobile-drawer-close {
    display: inline-flex;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: rgba(255,255,255,.42);
    color: var(--text-secondary);
    box-shadow:
      0 1px 2px rgba(0,0,0,.06),
      inset 0 1px 0 rgba(255,255,255,.62),
      inset 0 -1px 0 rgba(60,60,67,.08);
    backdrop-filter: blur(18px) saturate(180%);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    font: inherit;
    font-size: 1.45rem;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-drawer-close:active {
    background: rgba(118,118,128,.20);
  }
  .mobile-drawer-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 14px 10px calc(18px + env(safe-area-inset-bottom));
    -webkit-overflow-scrolling: touch;
  }
  .mobile-drawer-section {
    margin: 0 0 16px;
    padding: 0;
  }
  .mobile-drawer-section:last-child {
    margin-bottom: 0;
  }
  .mobile-drawer-section-title {
    padding: 0 14px 7px;
    color: var(--text-tertiary);
    font-size: .75rem;
    font-weight: 650;
    letter-spacing: 0;
    text-transform: uppercase;
  }
  .mobile-drawer-list {
    overflow: hidden;
    background:
      linear-gradient(180deg, rgba(255,255,255,.74), rgba(255,255,255,.46)),
      rgba(255,255,255,.46);
    border: 1px solid rgba(255,255,255,.48);
    border-radius: 19px;
    box-shadow:
      0 8px 24px rgba(0,0,0,.07),
      0 0 0 1px rgba(60,60,67,.06),
      inset 0 1px 0 rgba(255,255,255,.72);
    backdrop-filter: blur(22px) saturate(175%);
    -webkit-backdrop-filter: blur(22px) saturate(175%);
  }
  .mobile-drawer-link {
    display: grid;
    min-height: 52px;
    width: 100%;
    grid-template-columns: 32px minmax(0, 1fr) 10px;
    align-items: center;
    column-gap: 12px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    font-size: 1rem;
    font-weight: 560;
    text-align: left;
    text-decoration: none;
    padding: 0 12px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-drawer-list .mobile-drawer-link + .mobile-drawer-link {
    border-top: 1px solid rgba(60,60,67,.10);
  }
  .mobile-drawer-link-icon {
    display: inline-flex;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    background: rgba(255,255,255,.42);
    color: var(--text-secondary);
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,.62),
      inset 0 -1px 0 rgba(60,60,67,.06);
  }
  .mobile-drawer-link-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
  }
  .mobile-drawer-link-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mobile-drawer-link:hover {
    background: rgba(118,118,128,.08);
  }
  .mobile-drawer-link:active {
    background: rgba(118,118,128,.12);
  }
  .mobile-drawer-link.current {
    color: var(--blue);
    background: linear-gradient(90deg, rgba(0,113,227,.15), rgba(0,113,227,.06));
    font-weight: 680;
  }
  .mobile-drawer-link.current .mobile-drawer-link-icon {
    background: var(--blue-solid);
    color: var(--on-blue-solid);
    box-shadow: none;
  }
  .mobile-drawer-link::after {
    content: "";
    width: 8px;
    height: 8px;
    border-top: 1.5px solid currentColor;
    border-right: 1.5px solid currentColor;
    transform: rotate(45deg);
    opacity: .32;
    flex: 0 0 auto;
  }
  .mobile-drawer-link.current::after {
    opacity: .9;
  }
  .mobile-drawer-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    padding: 0 2px;
    border-top: 0;
    background: transparent;
  }
  .mobile-language-switch {
    display: flex;
    width: 100%;
    min-width: 0;
    flex: 0 0 auto;
    align-items: center;
    gap: 7px;
    padding: 5px;
    border: 1px solid rgba(255,255,255,.50);
    border-radius: 18px;
    background:
      linear-gradient(180deg, rgba(255,255,255,.78), rgba(255,255,255,.46)),
      rgba(255,255,255,.46);
    box-shadow:
      0 8px 24px rgba(0,0,0,.08),
      inset 0 1px 0 rgba(255,255,255,.74),
      inset 0 -1px 0 rgba(60,60,67,.06);
    backdrop-filter: blur(22px) saturate(180%);
    -webkit-backdrop-filter: blur(22px) saturate(180%);
  }
  .mobile-language-icon {
    display: inline-flex;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(255,255,255,.42);
    color: var(--text-secondary);
  }
  .mobile-language-icon svg {
    width: 17px;
    height: 17px;
    stroke: currentColor;
  }
  .mobile-language-options {
    display: grid;
    min-width: 0;
    flex: 1 1 auto;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
  }
  .mobile-language-option {
    display: inline-flex;
    min-width: 0;
    height: 30px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: .8125rem;
    font-weight: 680;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-language-option.current {
    background: var(--blue-solid);
    color: var(--on-blue-solid);
    box-shadow: none;
  }
  .mobile-language-option:not(.current):hover,
  .mobile-language-option:not(.current):focus-visible {
    background: rgba(118,118,128,.10);
  }
  .mobile-theme-switch {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
    padding: 5px;
    border: 1px solid rgba(255,255,255,.50);
    border-radius: 18px;
    background:
      linear-gradient(180deg, rgba(255,255,255,.78), rgba(255,255,255,.46)),
      rgba(255,255,255,.46);
    box-shadow:
      0 8px 24px rgba(0,0,0,.08),
      inset 0 1px 0 rgba(255,255,255,.74),
      inset 0 -1px 0 rgba(60,60,67,.06);
    backdrop-filter: blur(22px) saturate(180%);
    -webkit-backdrop-filter: blur(22px) saturate(180%);
  }
  .mobile-theme-option {
    display: inline-flex;
    min-height: 34px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 0;
    border-radius: 13px;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: .8125rem;
    font-weight: 680;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-theme-option svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
  }
  .mobile-theme-option.current {
    background: var(--blue-solid);
    color: var(--on-blue-solid);
    box-shadow: none;
  }
  .mobile-logout-form {
    width: 100%;
    flex: 0 0 auto;
  }
  .mobile-drawer-logout {
    display: inline-flex;
    width: 100%;
    min-width: 0;
    height: 42px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255,255,255,.52);
    border-radius: 16px;
    background:
      linear-gradient(180deg, rgba(255,255,255,.78), rgba(255,255,255,.48)),
      rgba(255,255,255,.46);
    color: var(--red);
    font: inherit;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow:
      0 8px 24px rgba(0,0,0,.08),
      inset 0 1px 0 rgba(255,255,255,.74),
      inset 0 -1px 0 rgba(60,60,67,.06);
    backdrop-filter: blur(22px) saturate(180%);
    -webkit-backdrop-filter: blur(22px) saturate(180%);
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-drawer-logout:active {
    background: rgba(255,59,48,.08);
  }

  body:has(.mobile-bottom-nav) .app-shell {
    position: relative;
  }
  .app-main {
    padding: 20px 12px 44px;
  }
  body:has(.mobile-bottom-nav) .app-main {
    padding-bottom: calc(var(--mobile-bottom-nav-height) + 22px);
  }
  body:has(.mobile-primary-fab.is-visible) .app-main {
    padding-bottom: calc(var(--mobile-bottom-nav-height) + 76px);
  }

  .page-title { margin-bottom: 18px; }
  .page-title-row {
    align-items: stretch;
    gap: 12px;
  }
  .page-title h1 {
    font-size: 1.5rem;
    line-height: 1.18;
  }
  .page-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(116px, 1fr));
  }
  .page-actions .btn {
    width: 100%;
  }
  .desktop-only { display: none !important; }
  .mobile-only { display: block !important; }

  .stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
  }
  .stat {
    min-width: 0;
    padding: 14px;
  }
  .stat-label {
    font-size: .625rem;
    line-height: 1.25;
  }
  .stat-value {
    font-size: 1.375rem;
    line-height: 1.08;
  }

  .card-pad { padding: 16px; }
  thead th { padding: 11px 12px; }
  tbody td { padding: 12px; }
  .empty-state { padding: 40px 16px; }

  .mobile-card-list {
    display: grid;
    gap: 10px;
  }
  .mobile-bottom-nav {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 112;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0;
    height: var(--mobile-bottom-nav-height);
    padding: 7px max(8px, env(safe-area-inset-right)) calc(7px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    background:
      linear-gradient(180deg, rgba(255,255,255,.94), rgba(255,255,255,.82)),
      rgba(255,255,255,.78);
    border: 0;
    border-top: 1px solid rgba(60,60,67,.16);
    border-radius: 22px 22px 0 0;
    box-shadow:
      0 -10px 30px rgba(0,0,0,.10),
      inset 0 1px 0 rgba(255,255,255,.74);
    pointer-events: auto;
    isolation: isolate;
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
  }
  .mobile-bottom-nav a,
  .mobile-bottom-nav button {
    min-width: 0;
    min-height: 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: 0;
    position: relative;
    border-radius: 16px;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: .68rem;
    font-weight: 600;
    text-decoration: none;
    line-height: 1.1;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-bottom-nav a.current,
  .mobile-bottom-nav button.current {
    color: var(--blue);
  }
  .mobile-bottom-nav a.current::before,
  .mobile-bottom-nav button.current::before {
    content: "";
    position: absolute;
    inset: 4px 8px;
    border-radius: 16px;
    background: rgba(0,122,255,.10);
    pointer-events: none;
  }
  .mobile-bottom-nav-icon {
    display: inline-flex;
    width: 18px;
    height: 18px;
    line-height: 1;
  }
  .mobile-bottom-nav-icon svg {
    display: block;
    width: 18px;
    height: 18px;
    stroke: currentColor;
  }
  .mobile-primary-fab {
    position: fixed;
    top: auto;
    right: max(16px, env(safe-area-inset-right));
    bottom: calc(var(--mobile-bottom-nav-height) + 16px);
    z-index: 113;
    display: none;
    width: 58px;
    height: 58px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: var(--blue-solid);
    color: var(--on-blue-solid);
    box-shadow: 0 8px 20px rgba(0,0,0,.16);
    font: inherit;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-primary-fab.is-visible {
    display: inline-flex;
  }
  .mobile-primary-fab:active {
    filter: brightness(.94);
  }
  .mobile-primary-fab svg {
    width: 28px;
    height: 28px;
    stroke: currentColor;
  }

  .drawer {
    align-items: flex-end !important;
    box-sizing: border-box;
    display: flex !important;
    justify-content: center !important;
    padding: max(8px, env(safe-area-inset-top)) 0 0 !important;
  }
  .drawer {
    position: fixed !important;
    inset: 0 !important;
    z-index: 240 !important;
  }
  .drawer-backdrop {
    z-index: 0 !important;
    background: rgba(28,28,30,.28) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    touch-action: none;
  }
  .drawer-panel {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    min-height: 0;
    overflow: hidden !important;
    border-radius: 30px 30px 0 0 !important;
    background: var(--bg-elevated) !important;
    animation: mobilePanelSlide 240ms var(--ease) !important;
    z-index: 1 !important;
    touch-action: pan-y;
  }
  @supports (-webkit-touch-callout: none) {
    .mobile-bottom-nav {
      top: calc(100dvh - var(--mobile-bottom-nav-height));
      bottom: auto;
    }
    .mobile-primary-fab {
      top: calc(100dvh - var(--mobile-bottom-nav-height) - 74px);
      bottom: auto;
    }
  }
  .drawer-panel::before {
    content: "";
    position: absolute;
    top: 10px;
    left: 50%;
    z-index: 1;
    width: 44px;
    height: 5px;
    border-radius: 999px;
    background: rgba(60,60,67,.16);
    transform: translateX(-50%);
  }
  .drawer-panel > form {
    min-height: 0;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    max-height: none;
  }
  .drawer-panel > #drawer-content {
    min-height: 0;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
  }
  .drawer-panel > #drawer-content > form {
    min-height: 0;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
  }
  .drawer-header {
    display: grid !important;
    grid-template-columns: 48px minmax(0, 1fr) 48px;
    align-items: center;
    min-height: 76px;
    padding: 32px 22px 12px !important;
    border-bottom: 0 !important;
    gap: 8px;
    cursor: grab;
    touch-action: none;
    user-select: none;
  }
  .drawer.drawer-dragging .drawer-header {
    cursor: grabbing;
  }
  .drawer-title {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
    min-width: 0;
    overflow: hidden;
    font-size: 1.0625rem !important;
    line-height: 1.2 !important;
    font-weight: 700 !important;
    letter-spacing: 0 !important;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .drawer-close {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    position: relative;
    width: 42px !important;
    height: 42px !important;
    flex: 0 0 auto;
    background: rgba(118,118,128,.12) !important;
    color: var(--text-secondary) !important;
    font-size: 0 !important;
  }
  .drawer-close::before,
  .drawer-close::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 17px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
  }
  .drawer-close::before { transform: translate(-50%, -50%) rotate(45deg); }
  .drawer-close::after { transform: translate(-50%, -50%) rotate(-45deg); }
  .drawer-header .drawer-nav-confirm {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    position: relative;
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    min-height: 42px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    background: var(--blue-bg) !important;
    color: var(--blue) !important;
    box-shadow: none !important;
    font-size: 0 !important;
    line-height: 1 !important;
  }
  .drawer-header .drawer-nav-confirm::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 48%;
    width: 12px;
    height: 20px;
    border-right: 3px solid currentColor;
    border-bottom: 3px solid currentColor;
    border-radius: 1px;
    transform: translate(-50%, -54%) rotate(40deg);
  }
  .drawer-header .drawer-nav-confirm:disabled {
    color: var(--text-tertiary) !important;
    background: rgba(118,118,128,.10) !important;
    opacity: 1;
  }
  .drawer-header .drawer-nav-confirm.btn-danger {
    color: var(--red) !important;
    background: var(--red-bg) !important;
  }
  .drawer-body {
    flex: 1 1 auto !important;
    min-height: 0;
    max-height: none !important;
    overflow-y: auto !important;
    padding: 8px 22px 18px !important;
    gap: 10px !important;
    overscroll-behavior: contain;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
  }
  .drawer-body > div:not([hidden]):not(.alert):not(:has(.seg-ctrl)):not(:has(.btn)):not(:has(textarea.input)):is(:has(> .field-label + .input), :has(> .field-label + .select-wrap)) {
    display: grid;
    grid-template-columns: minmax(108px, .9fr) minmax(128px, 1.1fr);
    align-items: center;
    gap: 12px;
    min-height: 58px;
    padding: 0 16px;
    border: 1px solid var(--separator-soft);
    border-radius: 18px;
    background: rgba(255,255,255,.96);
    overflow: hidden;
  }
  .drawer-body > div:not([hidden]):not(.alert):not(:has(.seg-ctrl)):not(:has(.btn)):not(:has(textarea.input)):is(:has(> .field-label + .input), :has(> .field-label + .select-wrap)) > .field-label {
    margin: 0;
    color: var(--text-secondary);
    font-size: .98rem;
    font-weight: 400;
    line-height: 1.25;
    overflow-wrap: anywhere;
  }
  .drawer-body > div:not([hidden]):not(.alert):not(:has(.seg-ctrl)):not(:has(.btn)):not(:has(textarea.input)):is(:has(> .field-label + .input), :has(> .field-label + .select-wrap)) > :is(.input, .select-wrap) {
    min-width: 0;
  }
  .drawer-body > div:not([hidden]):not(.alert):not(:has(.seg-ctrl)):not(:has(.btn)):not(:has(textarea.input)):is(:has(> .field-label + .input), :has(> .field-label + .select-wrap)) > .input,
  .drawer-body > div:not([hidden]):not(.alert):not(:has(.seg-ctrl)):not(:has(.btn)):not(:has(textarea.input)):is(:has(> .field-label + .input), :has(> .field-label + .select-wrap)) > .select-wrap .input {
    min-height: 56px;
    padding: 12px 0;
    border: 0 !important;
    border-radius: 0 !important;
    background-color: transparent !important;
    box-shadow: none !important;
    text-align: right;
    font-size: 1rem;
    -webkit-appearance: none;
    appearance: none;
  }
  .drawer-body > div:not([hidden]):not(.alert):not(:has(.seg-ctrl)):not(:has(.btn)):not(:has(textarea.input)):is(:has(> .field-label + .input), :has(> .field-label + .select-wrap)) > :is(select.input, .select-wrap select.input) {
    padding-right: 22px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='m6 8 4 4 4-4' stroke='%236e6e73' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right center;
    background-size: 18px 18px;
  }
  .drawer-body > div:not([hidden]):not(.alert):not(:has(.seg-ctrl)):not(:has(.btn)):not(:has(textarea.input)):is(:has(> .field-label + .input), :has(> .field-label + .select-wrap)) > .select-wrap::after {
    right: 0;
  }
  .drawer-body > div:not([hidden]):not(.alert):not(:has(.seg-ctrl)):not(:has(.btn)):not(:has(textarea.input)):is(:has(> .field-label + .input), :has(> .field-label + .select-wrap)) > .select-wrap + .input {
    grid-column: 1 / -1;
    min-height: 46px;
    margin-top: 0 !important;
    border-top: 1px solid var(--separator-soft) !important;
    text-align: left;
  }
  .drawer-body > div:not([hidden]):not(.alert):not(:has(.seg-ctrl)):not(:has(.btn)):not(:has(textarea.input)):is(:has(> .field-label + .input), :has(> .field-label + .select-wrap)) > :is(.input, .select-wrap .input)::placeholder {
    color: var(--text-tertiary);
  }
  .drawer-body > div:not([hidden]):not(.alert):has(> .field-label + textarea.input) {
    display: block;
    padding: 14px 16px;
    border: 1px solid var(--separator-soft);
    border-radius: 18px;
    background: rgba(255,255,255,.96);
  }
  .drawer-body > div:not([hidden]):not(.alert):has(> .field-label + textarea.input) > .field-label {
    margin-bottom: 10px;
    color: var(--text-secondary);
    font-size: .98rem;
    font-weight: 500;
  }
  .drawer-body textarea.input {
    min-height: 104px;
    padding: 0;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    font-size: 1rem;
    line-height: 1.35;
    resize: vertical;
  }
  .drawer-footer {
    display: grid !important;
    grid-template-columns: 1fr;
    padding: 12px 22px calc(12px + env(safe-area-inset-bottom)) !important;
    border-top: 1px solid var(--separator-soft) !important;
    background: rgba(255,255,255,.94) !important;
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    align-items: stretch !important;
    gap: 10px !important;
  }
  .drawer-footer > div {
    min-width: 0;
  }
  .drawer-footer > div:empty {
    display: none;
  }
  .drawer-footer.drawer-footer-mobile-empty,
  .drawer-footer .drawer-nav-promoted-cancel {
    display: none !important;
  }
  .drawer-footer > div:first-child:not(.drawer-footer-right) {
    width: 100%;
  }
  .drawer-footer-right {
    width: 100%;
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 10px !important;
  }
  .drawer-footer .btn {
    width: 100%;
    min-height: 52px;
    border-radius: 16px;
    font-size: 1rem;
  }
  .domain-input {
    align-items: stretch;
    flex-direction: column;
  }
  .domain-suffix {
    padding: 0 14px 12px;
  }
  .password-rules {
    grid-template-columns: 1fr;
  }
  .seg-opt span {
    padding: 7px 8px;
  }
}

html[data-theme="dark"] .app-header {
  background: rgba(28,28,30,.72);
  border-bottom-color: rgba(235,235,245,.12);
}
html[data-theme="dark"] .nav-popover {
  background: rgba(28,28,30,.88);
  border-color: rgba(235,235,245,.14);
  box-shadow: 0 18px 42px rgba(0,0,0,.45);
}
@media (max-width: 640px) {
  html[data-theme="dark"] .app-header.inline-menu-open .app-nav {
    background: var(--bg-elevated);
    border-color: rgba(235,235,245,.14);
    box-shadow: 0 20px 54px rgba(0,0,0,.48);
  }
}
html[data-theme="dark"] .language-menu > .language-menu-toggle,
html[data-theme="dark"] .language-popover,
html[data-theme="dark"] .theme-toggle,
html[data-theme="dark"] .input,
html[data-theme="dark"] .select-wrap .input,
html[data-theme="dark"] .card,
html[data-theme="dark"] .table-card,
html[data-theme="dark"] .stat,
html[data-theme="dark"] .empty-state {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--separator);
}
html[data-theme="dark"] .mobile-menu-btn,
html[data-theme="dark"] .mobile-bottom-nav,
html[data-theme="dark"] .mobile-side-drawer,
html[data-theme="dark"] .mobile-drawer-head,
html[data-theme="dark"] .mobile-drawer-list,
html[data-theme="dark"] .mobile-language-switch,
html[data-theme="dark"] .mobile-theme-switch,
html[data-theme="dark"] .mobile-drawer-logout {
  background:
    linear-gradient(180deg, rgba(44,44,46,.88), rgba(28,28,30,.74)),
    rgba(28,28,30,.70);
  border-color: rgba(235,235,245,.14);
  box-shadow:
    0 10px 30px rgba(0,0,0,.38),
    inset 0 1px 0 rgba(255,255,255,.10);
}
html[data-theme="dark"] .mobile-side-drawer {
  background:
    radial-gradient(circle at 82% 0%, rgba(10,132,255,.16), transparent 42%),
    linear-gradient(145deg, rgba(44,44,46,.88), rgba(20,20,22,.78));
}
html[data-theme="dark"] .mobile-nav-backdrop {
  background:
    radial-gradient(circle at 80% 12%, rgba(10,132,255,.12), transparent 34%),
    linear-gradient(145deg, rgba(0,0,0,.34), rgba(0,0,0,.18));
}
html[data-theme="dark"] .mobile-language-icon,
html[data-theme="dark"] .mobile-drawer-link-icon,
html[data-theme="dark"] .mobile-drawer-close {
  background: rgba(120,120,128,.22);
  color: var(--text-secondary);
}
html[data-theme="dark"] .drawer-panel,
html[data-theme="dark"] .drawer-footer {
  background: rgba(28,28,30,.96) !important;
  border-color: rgba(235,235,245,.12) !important;
}
html[data-theme="dark"] .drawer-body > div:not([hidden]):not(.alert):has(> .field-label + textarea.input),
html[data-theme="dark"] .drawer-body > div:not([hidden]):not(.alert):not(:has(.seg-ctrl)):not(:has(.btn)):not(:has(textarea.input)):is(:has(> .field-label + .input), :has(> .field-label + .select-wrap)) {
  background: rgba(44,44,46,.72);
  border-color: rgba(235,235,245,.10);
}

@media (max-width: 360px) {
  .app-main { padding-left: 10px; padding-right: 10px; }
  .stats { grid-template-columns: 1fr; }
  .drawer-footer-right { grid-template-columns: 1fr; }
}
