:root {
  --bg-start: #f8fafc;
  --bg-end: #eff6ff;
  --card: rgba(255, 255, 255, 0.94);
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --primary: #0f172a;
  --primary-2: #1d4ed8;
  --soft: #eff6ff;
  --accent: #dbeafe;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --success: #16a34a;
  --shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
  --radius: 22px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: linear-gradient(180deg, var(--bg-start) 0%, var(--bg-end) 100%);
  color: var(--text);
  font-family: "Manrope", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
body { padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom) 0; }
button, input, textarea, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.app-shell { width: 100%; }
.app {
  max-width: 560px;
  min-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.screen {
  display: none;
  padding: 20px 16px 28px;
  animation: fade-in 0.22s ease;
}
.screen.active { display: block; }

@keyframes fade-in {
  from { opacity: 0.35; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero {
  min-height: calc(100dvh - 48px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
  padding-top: 28px;
  text-align: center;
}

.home-hero-copy {
  justify-items: center;
}

.home-logo {
  width: min(100%, 340px);
  height: auto;
  display: block;
  filter: drop-shadow(0 14px 28px rgba(15, 23, 42, 0.18));
}

.home-copy {
  max-width: 340px;
}

.home-copy p {
  text-align: center;
}

h1, h2, h3 { margin: 0; line-height: 1.06; }
h1 { font-size: clamp(36px, 10vw, 52px); letter-spacing: -0.03em; }
h2 { font-size: 28px; letter-spacing: -0.03em; }
h3 { font-size: 17px; }
p { margin: 0; color: var(--muted); line-height: 1.5; }


.stack-sm, .stack-md, .stack-lg { display: grid; }
.stack-sm { gap: 10px; }
.stack-md { gap: 14px; }
.stack-lg { gap: 18px; }

.card {
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}
.card.tight { padding: 14px; }

.nav-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.subtitle {
  margin-top: 6px;
  font-size: 14px;
  color: var(--muted);
}

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.progress {
  height: 8px;
  flex: 1;
  border-radius: 999px;
  overflow: hidden;
  background: var(--accent);
}
.progress > div {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
}

label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="file"],
input[type="search"],
textarea {
  width: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  color: var(--text);
  font-size: 16px;
  outline: none;
}
textarea {
  min-height: 120px;
  resize: vertical;
}
input:focus, textarea:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

.money-wrap {
  position: relative;
}
.money-wrap > span {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-weight: 700;
}
.money-wrap input { padding-left: 34px; }

.btn {
  appearance: none;
  border: none;
  border-radius: 20px;
  min-height: 52px;
  padding: 16px 18px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: 0.18s ease;
}
.btn:active { transform: scale(0.99); }
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #1e293b);
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.18);
}
.btn-secondary {
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
}
.btn-soft {
  color: var(--primary-2);
  background: var(--soft);
}
.btn-danger {
  color: var(--danger);
  background: var(--danger-soft);
}
.btn-compact {
  min-height: 44px;
  padding: 10px 14px;
  font-size: 14px;
}

.btn-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}
.btn-row.one { grid-template-columns: 1fr; }

.btn-large-action {
  min-height: 56px;
  font-size: 16px;
}

.btn-row.items-actions {
  grid-template-columns: 1fr;
  gap: 12px;
}

.btn-row-inline {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 0;
}

.choice-row,
.radio-row,
.toggle-grid,
.top-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.option,
.radio-pill,
.toggle-btn {
  width: 100%;
  min-height: 58px;
  padding: 14px 12px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  text-align: left;
}
.option { cursor: pointer; }
.option strong, .radio-pill span { display: block; font-size: 14px; }
.option small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}
.option.active,
.toggle-btn.active,
.radio-pill.active {
  border-color: var(--primary);
  background: linear-gradient(135deg, var(--primary), #1e293b);
  color: #fff;
}
.option.active small { color: rgba(255,255,255,0.78); }
.toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
}
.radio-pill {
  display: block;
  cursor: pointer;
}
.radio-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.helper,
.empty {
  padding: 14px;
  border-radius: 18px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  border: 1px dashed var(--line);
}
.empty { text-align: center; }
.tiny {
  font-size: 12px;
  color: var(--muted);
}
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: #eff6ff;
  color: var(--primary-2);
  font-size: 12px;
  font-weight: 800;
}

.accordion {
  display: grid;
  gap: 12px;
}
.acc-item {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  overflow: hidden;
}
.acc-head {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  cursor: pointer;
}
.acc-summary { min-width: 0; }
.acc-title {
  font-weight: 800;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.acc-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}
.acc-body {
  display: none;
  padding: 0 14px 14px;
  border-top: 1px solid #f1f5f9;
}
.acc-item.open .acc-body { display: block; }

.summary-line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
}
.summary-line:last-child { border-bottom: none; }
.summary-line strong { line-height: 1.3; }
.summary-line.total {
  font-weight: 800;
  color: var(--text);
}
.person-ticket { display: grid; gap: 10px; }
.history-card { display: grid; gap: 14px; }
.history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}
.footer-space { height: 18px; }
.helper-detail { margin-top: 6px; }
.details-content { margin-top: 12px; }
.summary-detail { display: block; margin-top: 3px; font-size: 13px; line-height: 1.4; }

:focus-visible {
  outline: 3px solid rgba(59, 130, 246, 0.45);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}


.loading {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--text);
}
.spinner {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid #cbd5e1;
  border-top-color: var(--primary-2);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

pre {
  margin: 10px 0 0;
  padding: 12px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
  overflow: auto;
}

details summary {
  cursor: pointer;
  color: var(--primary-2);
  font-weight: 700;
}

@media (max-width: 430px) {
  .screen { padding-left: 14px; padding-right: 14px; }
}

/* Receipt OCR */
.ocr-good {
  border-color: rgba(16, 185, 129, 0.25);
  background: rgba(236, 253, 245, 0.9);
}
.ocr-warning-list {
  margin: 8px 0 0;
  padding-left: 18px;
  color: #475569;
  font-size: 13px;
  line-height: 1.45;
}
.ocr-warning-list li + li { margin-top: 4px; }

select {
  width: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  color: var(--text);
  font-size: 16px;
  outline: none;
}
select:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}
.percent-wrap { position: relative; }
.percent-wrap input { padding-right: 42px; }
.percent-wrap > span {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-weight: 800;
}
button:disabled { opacity: 0.65; cursor: wait; }


/* Product enhancements */
.btn-ghost {
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
}
.ticket-head,
.split-heading,
.history-month-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.btn-share { min-height: 46px; padding: 12px 14px; font-size: 14px; }
.split-adjust-btn,
.mini-action {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--primary-2);
  border-radius: 14px;
  padding: 10px 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.split-adjust-btn { width: 100%; min-height: 44px; }
.mini-action { min-height: 44px; }
.custom-split-card {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--soft);
}
.custom-share-list { display: grid; gap: 10px; margin-top: 14px; }
.custom-share-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 700;
}
.compact-percent input { padding: 11px 38px 11px 12px; border-radius: 14px; }
.split-total {
  margin-top: 12px;
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}
.split-total.valid { color: var(--success); }
.split-total.invalid { color: var(--danger); }
.favorite-groups { display: grid; gap: 10px; }
.favorite-grid { display: grid; gap: 8px; }
.favorite-group-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 8px;
}
.favorite-group-btn,
.favorite-delete {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 16px;
  cursor: pointer;
}
.favorite-group-btn {
  min-height: 52px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
}
.favorite-group-btn span { color: var(--muted); font-size: 13px; }
.favorite-delete { font-size: 22px; color: var(--danger); }
.save-group-details {
  padding: 12px 14px;
  border: 1px dashed var(--line);
  border-radius: 18px;
}
.device-storage-note { margin-bottom: 14px; }
.history-dashboard {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.metric-card {
  min-width: 0;
  padding: 12px 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
  text-align: center;
}
.metric-card span,
.metric-card small { display: block; color: var(--muted); font-size: 12px; line-height: 1.35; }
.metric-card strong { display: block; margin: 5px 0 3px; font-size: 16px; line-height: 1.15; overflow-wrap: anywhere; }
.history-tools { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(120px, .8fr); gap: 8px; margin-bottom: 16px; }
.history-tools input,
.history-tools select { padding: 12px; border-radius: 16px; font-size: 14px; }
.history-month { display: grid; gap: 10px; }
.history-month + .history-month { margin-top: 10px; }
.history-month-head { padding: 4px 2px; align-items: center; }
.history-month-head > span { font-weight: 800; }

html[data-theme="dark"] {
  --bg-start: #07131b;
  --bg-end: #0b1722;
  --card: rgba(15, 27, 39, 0.96);
  --text: #eef7f6;
  --muted: #9db0bd;
  --line: #2a3b49;
  --primary: #0f766e;
  --primary-2: #2dd4bf;
  --soft: #0d2630;
  --accent: #16333d;
  --danger: #fca5a5;
  --danger-soft: #3b1820;
  --success: #34d399;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
}
html[data-theme="dark"] body { background: linear-gradient(180deg, var(--bg-start) 0%, var(--bg-end) 100%); }
html[data-theme="dark"] input[type="text"],
html[data-theme="dark"] input[type="email"],
html[data-theme="dark"] input[type="password"],
html[data-theme="dark"] input[type="number"],
html[data-theme="dark"] input[type="file"],
html[data-theme="dark"] input[type="search"],
html[data-theme="dark"] textarea,
html[data-theme="dark"] select,
html[data-theme="dark"] .btn-secondary,
html[data-theme="dark"] .option,
html[data-theme="dark"] .radio-pill,
html[data-theme="dark"] .toggle-btn,
html[data-theme="dark"] .acc-item,
html[data-theme="dark"] .favorite-group-btn,
html[data-theme="dark"] .favorite-delete {
  background: #101f2c;
  color: var(--text);
  border-color: var(--line);
}
html[data-theme="dark"] label { color: #cbdbe3; }
html[data-theme="dark"] .helper,
html[data-theme="dark"] .empty,
html[data-theme="dark"] pre { background: #0b1a25; }
html[data-theme="dark"] .acc-body,
html[data-theme="dark"] .summary-line { border-color: #1d303d; }
html[data-theme="dark"] .pill { background: #12303b; color: #5eead4; }
html[data-theme="dark"] .option.active,
html[data-theme="dark"] .toggle-btn.active,
html[data-theme="dark"] .radio-pill.active {
  background: linear-gradient(135deg, #0f766e, #115e59);
  border-color: #2dd4bf;
}
html[data-theme="dark"] .btn-primary { background: linear-gradient(135deg, #0f766e, #115e59); }
html[data-theme="dark"] .custom-split-card { background: #0b2028; }

@media (max-width: 390px) {
  .device-storage-note { margin-bottom: 14px; }
.history-dashboard { grid-template-columns: 1fr; }
  .metric-card { text-align: left; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 10px; }
  .metric-card small { grid-column: 1 / -1; }
  .history-tools { grid-template-columns: 1fr; }
}


.connection-helper {
  border-style: solid;
  border-color: #f59e0b;
  background: #fffbeb;
  color: #78350f;
}
.connection-helper strong { color: #78350f; }
.connection-helper .connection-copy { margin-top: 5px; line-height: 1.45; }
.connection-helper .btn { margin-top: 12px; width: 100%; }
html[data-theme="dark"] .connection-helper {
  border-color: #b45309;
  background: #2a1c0a;
  color: #fde68a;
}
html[data-theme="dark"] .connection-helper strong { color: #fef3c7; }

/* Commercial account / plan layer */
.auth-tabs,
.test-plan-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.test-plan-buttons {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 12px;
}
.account-plans { margin-top: 18px; }
.plan-grid { display: grid; gap: 10px; }
.plan-card {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--card);
}
.plan-card.active { border-color: var(--primary-2); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary-2) 18%, transparent); }
.plan-card-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.plan-card-head span { color: var(--primary-2); font-size: 13px; font-weight: 800; }
.plan-card ul { margin: 10px 0 0; padding-left: 20px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.plan-current { display: inline-flex; margin-top: 10px; padding: 6px 10px; border-radius: 999px; background: var(--soft); color: var(--primary-2); font-size: 13px; font-weight: 800; }
.account-identity { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.plan-badge { display: inline-flex; padding: 8px 12px; border-radius: 999px; background: var(--primary); color: #fff; font-size: 13px; font-weight: 800; }
.usage-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; font-size: 13px; }
.usage-head span { color: var(--muted); text-align: right; }
.usage-bar { height: 10px; margin-top: 8px; border-radius: 999px; background: var(--accent); overflow: hidden; }
.usage-bar > div { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--primary-2)); }
.error-helper { border-color: rgba(220,38,38,.28); background: var(--danger-soft); color: var(--danger); }
.locked-option { opacity: .72; }
.field-note { margin: -3px 0 8px; }

html[data-theme="dark"] .plan-card { background: #101f2c; }
@media (max-width: 360px) {
  .test-plan-buttons { grid-template-columns: 1fr; }
  .account-identity, .usage-head { align-items: flex-start; flex-direction: column; }
  .usage-head span { text-align: left; }
}


/* Account and favorite-group management */
.account-section { margin-top: 14px; }
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.muted-badge { background: var(--muted); }
.account-subsection {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.favorite-manager-list { display: grid; gap: 8px; }
.favorite-manager-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
}
.favorite-manager-row > div:first-child { min-width: 0; }
.favorite-manager-row .tiny { margin-top: 4px; overflow-wrap: anywhere; }
.favorite-manager-actions { display: flex; gap: 6px; }
.danger-mini { color: var(--danger); background: var(--danger-soft); }
.compact-empty { padding: 14px; }
.dev-controls summary { color: var(--muted); }
.text-action {
  appearance: none;
  border: 0;
  padding: 8px 4px;
  margin: -8px -4px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  background: transparent;
  color: var(--primary-2);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
.locked-split-btn { border-style: dashed; }
html[data-theme="dark"] .favorite-manager-row { background: #101f2c; }

@media (max-width: 430px) {
  .favorite-manager-row { grid-template-columns: 1fr; }
  .favorite-manager-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


/* Home account/settings control */
#home { position: relative; }
.home-settings-btn {
  position: relative;
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--primary-2);
  background: color-mix(in srgb, var(--card) 94%, transparent);
  box-shadow: var(--shadow);
  cursor: pointer;
  backdrop-filter: blur(14px);
}
.home-settings-btn svg { width: 23px; height: 23px; }
.home-settings-btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary-2) 30%, transparent); outline-offset: 2px; }
.account-status-dot {
  position: absolute;
  right: 7px;
  bottom: 7px;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--muted);
  border: 2px solid var(--card);
}
.home-settings-btn[data-signed-in="true"] .account-status-dot { background: var(--success); }
.home-settings-btn[data-plan="PLUS"] .account-status-dot { background: #2563eb; }
.home-settings-btn[data-plan="PRO"] .account-status-dot { background: #7c3aed; }

.nav-head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

/* Upgrade decision modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(8px);
}
.modal-backdrop[hidden] { display: none; }
.upgrade-modal {
  width: min(100%, 430px);
  padding: 22px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
  text-align: center;
}
.upgrade-modal-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--soft);
  color: var(--primary-2);
  font-size: 23px;
  font-weight: 800;
}
.upgrade-modal p { margin-top: 10px; }
.upgrade-modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
body.modal-open { overflow: hidden; }
html[data-theme="dark"] .home-settings-btn { background: rgba(16,31,44,.94); border-color: #1d404a; }
html[data-theme="dark"] .account-status-dot { border-color: #101f2c; }
html[data-theme="dark"] .upgrade-modal { background: #101f2c; }
@media (max-width: 360px) {
  .upgrade-modal-actions { grid-template-columns: 1fr; }
}

/* Account identity + dark-mode logo treatment */
.home-account-cluster {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  max-width: calc(100% - 32px);
}
.home-account-name {
  max-width: min(42vw, 180px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--card) 94%, transparent);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  backdrop-filter: blur(14px);
}
.home-logo-wrap {
  position: relative;
  width: min(100%, 340px);
  margin-inline: auto;
}
.home-logo-wrap .home-logo { width: 100%; }
.dark-fork-overlay {
  display: none;
  position: absolute;
  left: 15.2%;
  top: 24.0%;
  width: 11.0%;
  height: 43%;
  transform: rotate(8deg);
  transform-origin: 50% 65%;
  pointer-events: none;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.25));
}
.dark-fork-overlay .fork-outline { stroke: #0b1722; stroke-width: 9; }
.dark-fork-overlay .fork-light { stroke: #fff; stroke-width: 5.5; }
html[data-theme="dark"] .dark-fork-overlay { display: block; }
html[data-theme="dark"] .home-account-name {
  background: rgba(16,31,44,.94);
  border-color: #1d404a;
}
@media (max-width: 360px) {
  .home-account-name { max-width: 38vw; padding-inline: 9px; font-size: 12px; }
}
.account-signout-section { margin-bottom: 8px; }
.account-signout-section .btn-danger { width: 100%; }

/* Phase 1.5 Public Beta */
.beta-badge-row { display: flex; justify-content: center; }
.beta-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 6px 11px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary-2) 10%, var(--card));
  border: 1px solid color-mix(in srgb, var(--primary-2) 22%, var(--line));
  color: var(--primary-2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.beta-privacy-note { max-width: 350px; margin-inline: auto; opacity: .92; }
.beta-account-banner {
  border-color: color-mix(in srgb, var(--primary-2) 28%, var(--line));
  background: color-mix(in srgb, var(--soft) 72%, var(--card));
}
.beta-account-banner strong { color: var(--primary-2); }
.beta-plan-note { margin-top: 10px; }
.beta-interest-button { width: 100%; margin-top: 10px; }
.beta-insights-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.beta-metric {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
}
.beta-metric .tiny { margin-bottom: 3px; }
.beta-metric strong { font-size: 19px; }
.beta-insights-list { display: grid; gap: 8px; }
.beta-insights-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.beta-insights-row:last-child { border-bottom: 0; }
.beta-insights-row span:last-child { font-weight: 800; text-align: right; }
.beta-usage-summary {
  padding: 12px;
  border-radius: 16px;
  background: var(--soft);
  color: var(--text);
}
.feedback-modal { text-align: left; }
.feedback-modal > h3,
.feedback-modal > p,
.feedback-modal > .upgrade-modal-icon { text-align: center; }
.feedback-rating-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin: 18px 0 14px;
}
.feedback-rating {
  min-height: 48px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}
.feedback-rating[aria-pressed="true"] {
  color: #fff;
  border-color: var(--primary);
  background: var(--primary);
}
.feedback-comment-label { margin-top: 4px; }
#betaFeedbackComments { min-height: 96px; }
html[data-theme="dark"] .beta-badge { background: rgba(37,99,235,.16); border-color: #274e6b; color: #93c5fd; }
html[data-theme="dark"] .beta-account-banner { background: rgba(30,64,175,.12); border-color: #274e6b; }
html[data-theme="dark"] .beta-metric,
html[data-theme="dark"] .feedback-rating { background: #101f2c; }
html[data-theme="dark"] .beta-usage-summary { background: rgba(37,99,235,.13); }
@media (max-width: 360px) {
  .beta-insights-grid,
  .feedback-rating-grid { grid-template-columns: 1fr; }
}
.home-privacy-link {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 36px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.privacy-home-btn { text-decoration: none; }
.privacy-card h3 { margin-bottom: 7px; }
.privacy-card ul { margin: 0; padding-left: 20px; color: var(--muted); line-height: 1.6; }
.privacy-card li + li { margin-top: 4px; }
