/* Anything marked hidden stays hidden, whatever display a component sets */
[hidden] { display: none !important; }

/* Ledger theme: light by default, dark via system setting or data-theme */
:root {
  color-scheme: light;
  --bg: #E6E2D8;
  --bg-card: #EEEAE1;
  --bg-input: #EEEAE1;
  --bg-elevated: #DCD7CB;
  --accent: #2E6B4D;
  --accent-hover: #26593F;
  --accent-subtle: #D5DFD2;
  --on-accent: #F1EEE6;
  --text: #33312C;
  --text-muted: #67625A;
  --text-dim: #6F6A61;
  --border: #D2CCBF;
  --track: #D6D0C4;
  --danger: #A23A26;
  --success: #2A6E4D;
  --warning: #9A6A12;
  --scrim: rgba(28, 27, 25, 0.35);
  --serif: 'Newsreader', Georgia, serif;
  --radius: 14px;
  --radius-sm: 10px;
  --pad: 16px;
  --space-xxs: 4px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.5rem;
  --text-hero: 2.25rem;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1C1B17;
  --bg-card: #24221D;
  --bg-input: #24221D;
  --bg-elevated: #2E2B25;
  --accent: #86C6A2;
  --accent-hover: #9AD2B3;
  --accent-subtle: #213028;
  --on-accent: #1C1B17;
  --text: #DCD6CA;
  --text-muted: #A0998C;
  --text-dim: #958E81;
  --border: #34312A;
  --track: #34312A;
  --danger: #E8917E;
  --success: #86C6A2;
  --warning: #E0B45E;
  --scrim: rgba(0, 0, 0, 0.55);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  scrollbar-width: none;
}

*::-webkit-scrollbar {
  display: none;
}

button, select, input, .nav-item, .action-toggle, .tx-row {
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
}

button:active, .action-toggle:active, .nav-item:active {
  transform: scale(0.97);
}

html, body {
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  touch-action: manipulation;
  background: var(--bg);
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
  line-height: 1.5;
}

/* ================================
   SCREENS
   ================================ */
.screen {
  display: none;
  height: 100%;
  flex-direction: column;
}

.screen.active {
  display: flex;
}

/* ================================
   LOGIN
   ================================ */
#screen-login {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

#screen-login::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: none;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.07;
  pointer-events: none;
  z-index: -1;
}

.login-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  max-width: 400px;
  margin: 0 auto;
  width: 100%;
  position: relative;
  z-index: 1;
}

.login-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
  margin-bottom: 1.25rem;
}

.login-title {
  margin-bottom: 0.25rem;
}

#auth-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Shared input styles */
.app-input,
#auth-form input {
  width: 100%;
  padding: 0.85rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: var(--text-base);
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.app-input::placeholder,
#auth-form input::placeholder {
  color: var(--text-dim);
}

/* Override browser autofill styling */
.app-input:-webkit-autofill,
#auth-form input:-webkit-autofill,
.app-input:-webkit-autofill:hover,
#auth-form input:-webkit-autofill:hover,
.app-input:-webkit-autofill:focus,
#auth-form input:-webkit-autofill:focus,
.app-input:-webkit-autofill:active,
#auth-form input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px var(--bg-input) inset;
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  transition: background-color 5000s ease-in-out 0s;
}

#auth-form input {
  -webkit-user-select: none;
  user-select: none;
}

#auth-form input:focus {
  -webkit-user-select: text;
  user-select: text;
}

.app-input:focus,
#auth-form input:focus {
  border-color: color-mix(in srgb, var(--text) 25%, transparent);
}

/* Normalize native date inputs so they match other app-inputs */
input.app-input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
  min-height: 0;
  text-align: left;
  font-family: inherit;
  font-size: var(--text-base);
  line-height: 1.3;
}

input.app-input[type="date"]::-webkit-date-and-time-value {
  text-align: left;
  font-family: inherit;
  font-size: var(--text-base);
  min-height: 0;
  margin: 0;
  padding: 0;
}

input.app-input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.8);
}

.btn-primary {
  width: 100%;
  padding: 0.9rem;
  border: none;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-primary:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.auth-error {
  width: 100%;
  padding: 0.75rem 1rem;
  background: color-mix(in srgb, var(--danger) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 20%, transparent);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: var(--text-base);
  margin-bottom: 1rem;
}

.auth-success {
  width: 100%;
  padding: 0.75rem 1rem;
  background: color-mix(in srgb, var(--success) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--success) 20%, transparent);
  border-radius: var(--radius-sm);
  color: var(--success);
  font-size: var(--text-base);
  margin-bottom: 1rem;
}

.login-subtitle {
  font-size: var(--text-base);
  margin-bottom: 1.5rem;
  text-align: center;
}

.btn-link {
  background: none;
  border: none;
  font-size: var(--text-sm);
  font-family: inherit;
  cursor: pointer;
  padding: 0.5rem 0;
  transition: color 0.15s;
  width: 100%;
  text-align: center;
}

.btn-link:hover {
  color: var(--text);
}

#screen-beta,
#screen-signup {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

#screen-beta::before,
#screen-signup::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: none;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.07;
  pointer-events: none;
  z-index: -1;
}

#beta-form,
#signup-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

#beta-form input,
#signup-form input {
  width: 100%;
  padding: 0.85rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: var(--text-base);
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

#beta-form input::placeholder,
#signup-form input::placeholder {
  color: var(--text-dim);
}

#beta-form input:focus,
#signup-form input:focus {
  border-color: color-mix(in srgb, var(--text) 25%, transparent);
}

#signup-form input:-webkit-autofill,
#beta-form input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px var(--bg-input) inset;
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  transition: background-color 5000s ease-in-out 0s;
}

/* ================================
   APP SHELL BG (grid behind content)
   ================================ */
#screen-app {
  position: relative;
  isolation: isolate;
}

#screen-app::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: none;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.045;
  pointer-events: none;
  z-index: -1;
}

/* ================================
   APP HEADER
   ================================ */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem var(--pad);
  padding-top: max(0.65rem, env(safe-area-inset-top));
  position: sticky;
  top: 0;
  z-index: 20;
}

.app-header::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 20px;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--bg) 62%, transparent), color-mix(in srgb, var(--bg) 0%, transparent));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  -webkit-mask-image: linear-gradient(to bottom, black, transparent);
  mask-image: linear-gradient(to bottom, black, transparent);
  pointer-events: none;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-card);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

.header-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex-shrink: 0;
  opacity: 1;
  display: block;
}

/* ================================
   TAB CONTENT
   ================================ */
.tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  contain: layout style;
  padding: 0.5rem var(--pad);
  padding-bottom: 5rem;
  animation: tabFadeIn 0.18s ease-out;
  min-width: 0;
}

.tab-content.active {
  display: block;
}

/* A quick fade only: sliding the page made the text look like it was shifting around */
@keyframes tabFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ================================
   SNAPSHOT — Hero Balance
   ================================ */

/* Net Cash — Robinhood hero number style */
.net-cash-card {
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.hero-stats {
  width: 100%;
}

.hero-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-family: inherit;
  cursor: pointer;
}

.hero-stat-value {
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.net-cash-card[hidden] {
  display: none;
}

.connect-cta {
  text-align: center;
  padding: 3rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.connect-cta::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: none;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.06;
  pointer-events: none;
  z-index: -1;
}

.connect-cta p {
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  font-size: var(--text-base);
  max-width: 55ch;
  margin-left: auto;
  margin-right: auto;
}

.connect-cta .btn-primary {
  width: auto;
  padding: 0.75rem 2rem;
  display: inline-block;
}

/* ================================
   ACCOUNT SECTIONS
   ================================ */
.account-section {
  margin-bottom: 1.5rem;
  min-width: 0;
}
/* Home uses the same single tab fade as Activity and Settings. Per-section
   entrance animations replayed every time the tab was shown, so they're gone. */

@keyframes staggerIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.account-section[hidden] {
  display: none;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
}

.section-header h2 {
  font-weight: 600;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
  font-size: var(--text-sm);
}

.section-total {
  font-size: var(--text-base);
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

/* Horizontal scroll */
.account-list {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.25rem;
}

.account-list::-webkit-scrollbar {
  display: none;
}

/* Account Card */
.account-card {
  flex: 0 0 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  scroll-snap-align: start;
  overflow: hidden;
  box-sizing: border-box;
  border: 1px solid var(--border);
}

.account-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.account-left {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  flex: 1;
}

.account-name {
  font-weight: 600;
  font-size: var(--text-base);
  line-height: 1.3;
  min-width: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  cursor: pointer;
}

.account-balance {
  text-align: right;
  flex-shrink: 0;
}

.account-balance .amount {
  font-weight: 700;
  font-size: var(--text-xl);
  letter-spacing: -0.02em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.account-balance .label {
  color: var(--text-dim);
  font-size: var(--text-xs);
  margin-top: 0.15rem;
}

.nickname-input {
  font-weight: 600;
  font-size: var(--text-base);
  line-height: 1.3;
  background: color-mix(in srgb, var(--text) 6%, transparent);
  border: 1px solid color-mix(in srgb, var(--text) 20%, transparent);
  border-radius: 6px;
  color: var(--text);
  padding: 0.2rem 0.4rem;
  outline: none;
  width: 100%;
  max-width: 200px;
  font-family: inherit;
}

/* Scroll dots */
.account-section .scroll-dots {
  display: flex;
  justify-content: center;
  gap: 0.3rem;
  margin-top: 0.5rem;
}

.account-section .scroll-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--text) 15%, transparent);
  transition: background 0.3s, transform 0.3s;
}

.account-section .scroll-dot.active {
  background: var(--accent);
  transform: scale(1.3);
}

/* ================================
   BOTTOM NAV
   ================================ */
.bottom-nav {
  display: flex;
  justify-content: center;
  padding: 0.6rem 1rem;
  padding-bottom: max(0.6rem, env(safe-area-inset-bottom));
  gap: 2rem;
  position: sticky;
  bottom: 0;
  z-index: 20;
}

.bottom-nav::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  height: 24px;
  background: linear-gradient(to top, color-mix(in srgb, var(--bg) 62%, transparent), color-mix(in srgb, var(--bg) 0%, transparent));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  -webkit-mask-image: linear-gradient(to top, black, transparent);
  mask-image: linear-gradient(to top, black, transparent);
  pointer-events: none;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.4rem 0.75rem;
  border: none;
  font-size: var(--text-xs);
  font-family: inherit;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
  border-radius: var(--radius-sm);
}

.nav-item svg {
  width: 22px;
  height: 22px;
}

/* ================================
   MODAL
   ================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 90;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.modal-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--bg-elevated);
  border-radius: 16px;
  padding: 1.5rem;
  width: 100%;
  max-width: 320px;
  transform: scale(0.92) translateY(16px);
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.visible .modal-card {
  transform: scale(1) translateY(0);
}

.modal-card h3 {
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: 1rem;
}

.modal-card .app-input {
  margin-bottom: 0.75rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
}

.card-crop-modal .modal-card.card-crop-card {
  max-width: 440px;
  padding: 1.25rem;
}

.card-crop-help {
  margin-bottom: 0.75rem;
}

.card-crop-image-wrap {
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  max-height: 55vh;
  margin-bottom: 1rem;
}

.card-crop-image-wrap img {
  display: block;
  max-width: 100%;
}

.card-refine-modal {
  overscroll-behavior: contain;
}

.card-refine-modal .modal-card.card-refine-card {
  max-width: 440px;
  padding: 1.25rem;
  touch-action: pan-y;
}

.card-refine-help {
  margin-bottom: 0.5rem;
}

.card-refine-hint {
  margin-bottom: 0.75rem;
  color: var(--text-muted);
  font-size: var(--text-xs);
  line-height: 1.45;
}

.card-refine-canvas-wrap {
  position: relative;
  background-color: var(--bg-card);
  background-image:
    linear-gradient(45deg, var(--bg-elevated) 25%, transparent 25%),
    linear-gradient(-45deg, var(--bg-elevated) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--bg-elevated) 75%),
    linear-gradient(-45deg, transparent 75%, var(--bg-elevated) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, 8px 0;
  border-radius: 12px;
  overflow: hidden;
  max-height: 45vh;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 160px;
}

.card-refine-canvas-wrap canvas {
  max-width: 100%;
  max-height: 45vh;
  display: block;
  touch-action: none;
  cursor: none;
}

.card-refine-tools {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.card-refine-tool {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.85rem;
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
}

.card-refine-tool.active {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}

.card-refine-mode {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.85rem;
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
}

.card-refine-mode.active {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.card-refine-apply-shape {
  margin-left: auto;
}

.card-refine-tool[hidden],
.card-refine-size[hidden],
.card-refine-apply-shape[hidden] {
  display: none;
}

.card-refine-size {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 150px;
  min-width: 0;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.card-refine-size input {
  flex: 1;
  min-width: 0;
  margin: 0;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.loading-overlay.visible {
  display: flex;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 2px solid color-mix(in srgb, var(--text) 10%, transparent);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 5rem;
  left: 50%;
  transform: translateX(-50%) translateY(1.5rem) scale(0.9);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 500;
  padding: 0.5rem 1.25rem;
  border-radius: 20px;
  border: 1px solid var(--border);
  z-index: 200;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ================================
   EMPTY STATE
   ================================ */

/* ================================
   SHARED UI
   ================================ */

.app-input {
  width: 100%;
  padding: 0.8rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: var(--text-base);
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.app-input:focus {
  border-color: color-mix(in srgb, var(--text) 25%, transparent);
}

.app-select {
  padding: 0.5rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: var(--text-base);
  font-family: inherit;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%236C7078' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

.btn-primary-sm {
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary-sm:hover {
  background: var(--accent-hover);
}

.btn-secondary-sm {
  padding: 0.4rem 0.85rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.btn-secondary-sm:hover {
  border-color: color-mix(in srgb, var(--text) 15%, transparent);
  color: var(--text);
}

/* ================================
   SETTINGS
   ================================ */

.settings-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 0;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.settings-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-card);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

/* Credit card liabilities */
.card-liabilities {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.liab-util-wrap {
  margin-bottom: 0.25rem;
}

.liab-util-bar {
  background: color-mix(in srgb, var(--text) 6%, transparent);
  overflow: hidden;
}

.liab-util-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s ease;
}

.liab-util-fill.util-low { background: var(--success); }
.liab-util-fill.util-mid { background: var(--warning); }
.liab-util-fill.util-high { background: var(--danger); }

.bonus-wrap {
  margin-top: 0.75rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
  font-family: inherit;
}

.bonus-header,
.bonus-amounts {
  font-size: var(--text-xs);
  color: var(--text-dim);
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  letter-spacing: normal;
}

.bonus-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.35rem;
  gap: 0.5rem;
}

.bonus-status {
  font-weight: 500;
}

.bonus-status.bonus-reached { color: var(--success); }
.bonus-status.bonus-urgent { color: var(--warning); }
.bonus-status.bonus-expired { color: var(--text-muted); }

.bonus-bar {
  height: 4px;
  background: color-mix(in srgb, var(--text) 6%, transparent);
  border-radius: 2px;
  overflow: hidden;
}

.bonus-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s ease, background-color 0.5s ease;
}

.bonus-amounts {
  margin-top: 0.35rem;
}

.bonus-modal-help {
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0 0 0.75rem;
}

.amount-bonus-trigger {
  cursor: pointer;
}

.liab-util-labels {
  display: flex;
  justify-content: space-between;
  color: var(--text-dim);
  gap: 0.5rem;
  overflow: hidden;
}

.liab-util-labels span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.override-label {
  display: block;
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.override-label + .app-input {
  margin-bottom: 0.6rem;
}

/* Card designs, settings list */
.card-designs-help {
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0 0 0.6rem;
}

.card-designs-help strong {
  color: var(--text);
  font-weight: 600;
}

.card-designs-help.warn {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem;
}

.card-designs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 0.5rem;
}

.card-design-tile {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-sm);
  background:
    linear-gradient(45deg, color-mix(in srgb, var(--text) 4%, transparent) 25%, transparent 25%, transparent 75%, color-mix(in srgb, var(--text) 4%, transparent) 75%) 0 0 / 12px 12px,
    linear-gradient(45deg, color-mix(in srgb, var(--text) 4%, transparent) 25%, transparent 25%, transparent 75%, color-mix(in srgb, var(--text) 4%, transparent) 75%) 6px 6px / 12px 12px,
    var(--bg-card);
  border: 1px solid var(--border);
  overflow: hidden;
}

.card-design-tile-img {
  position: absolute;
  inset: 0;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.card-design-delete {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: var(--scrim);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-designs-status {
  margin-top: 0.5rem;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.card-designs-status.error {
  color: var(--danger);
}

/* Card design picker in account edit modal */
#card-design-picker-section {
  margin-bottom: 0.6rem;
}

.card-design-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 0.4rem;
}

.card-design-option {
  position: relative;
  aspect-ratio: 16 / 10;
  background:
    linear-gradient(45deg, color-mix(in srgb, var(--text) 4%, transparent) 25%, transparent 25%, transparent 75%, color-mix(in srgb, var(--text) 4%, transparent) 75%) 0 0 / 10px 10px,
    linear-gradient(45deg, color-mix(in srgb, var(--text) 4%, transparent) 25%, transparent 25%, transparent 75%, color-mix(in srgb, var(--text) 4%, transparent) 75%) 5px 5px / 10px 10px,
    var(--bg-card);
  cursor: pointer;
  padding: 0;
  overflow: hidden;
}

.card-design-option.selected {
  border-color: var(--accent);
}

.card-design-option.in-use {
  opacity: 0.35;
  cursor: not-allowed;
}

.card-design-option.in-use::after {
  content: "In use";
  position: absolute;
  inset: auto 0 4px 0;
  text-align: center;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--text);
  text-transform: none;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
  pointer-events: none;
}

.card-design-option-img {
  position: absolute;
  inset: 0;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.card-design-option.none {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.card-design-picker-empty {
  grid-column: 1 / -1;
  font-size: var(--text-xs);
  color: var(--text-muted);
  padding: 0.5rem 0;
}

/* Account management in settings (horizontal carousel) */

.accounts-manage-list {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  gap: 0.5rem;
  padding-bottom: 0.25rem;
}

.accounts-manage-list::-webkit-scrollbar {
  display: none;
}

.settings-institution {
  flex: 0 0 100%;
  max-width: 100%;
  box-sizing: border-box;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
}

.settings-inst-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.settings-inst-logo {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center center;
  border-radius: 8px;
}

.settings-inst-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  flex: 1;
  min-width: 0;
}

.settings-inst-name {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-inst-detail {
  font-size: var(--text-sm);
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-disconnect-inst {
  background: none;
  border: 1px solid color-mix(in srgb, var(--danger) 20%, transparent);
  color: var(--danger);
  font-size: var(--text-sm);
  font-family: inherit;
  font-weight: 500;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, border-color 0.2s;
}

.btn-add-card-inst {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: var(--text-sm);
  font-family: inherit;
  font-weight: 500;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, border-color 0.2s;
}

.btn-add-card-inst:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-add-card-inst:disabled {
  opacity: 0.6;
  cursor: default;
}

.settings-inst-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: flex-end;
}

.settings-inst-actions .btn-add-card-inst,
.settings-inst-actions .btn-disconnect-inst {
  flex: 1;
  text-align: center;
}

/* ================================
   TRANSACTIONS TAB
   ================================ */
.tx-loading {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 4rem 1rem;
  color: var(--text-muted);
  font-size: var(--text-base);
}

.tx-loading.visible {
  display: flex;
}

/* Transaction utility row */

.btn-toggle-ignored {
  font-size: var(--text-sm);
  font-family: inherit;
  padding: 0.3rem 0.6rem;
  background: var(--bg-card);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}

.btn-toggle-ignored.active {
  background: var(--accent-subtle);
  color: var(--accent);
}

.tx-updated {
  flex: 1;
  font-size: var(--text-xs);
  color: var(--text-dim);
  text-align: center;
}

/* Transaction rows */
.tx-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0;
  animation: txFadeIn 0.2s ease-out both;
}

@keyframes txFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.tx-row:nth-child(n) {
  animation-delay: calc(var(--row-i, 0) * 0.02s);
}

/* ================================
   ACTION SHEET
   ================================ */
.action-sheet-overlay {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 95;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.action-sheet-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.action-sheet {
  background: var(--bg-elevated);
  padding: 1.25rem;
  padding-top: 1.5rem;
  width: 100%;
  max-width: 500px;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.action-sheet-overlay.visible .action-sheet {
  transform: translateY(0);
}

/* Drag handle indicator */
.action-sheet::before {
  content: '';
  display: block;
  margin: 0 auto 1rem;
}

.action-sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.action-sheet-title {
  font-weight: 600;
  font-size: var(--text-lg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.action-sheet-options {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.action-sheet-options[hidden] {
  display: none;
}

.action-toggle {
  flex: 1;
  min-width: calc(50% - 0.2rem);
  padding: 0.6rem 0.6rem;
  background: color-mix(in srgb, var(--text) 4%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: var(--text-base);
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.action-toggle.active {
  border-color: var(--accent);
  background: var(--accent-subtle);
  color: var(--text);
}

.action-sheet-cancel {
  width: 100%;
  padding: 0.75rem;
  background: color-mix(in srgb, var(--text) 4%, transparent);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: var(--text-base);
  font-family: inherit;
  cursor: pointer;
}

/* Sub-pickers */
.action-sheet-sub {
  margin-bottom: 0.75rem;
}

.sub-picker-back {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: none;
  border: none;
  color: var(--accent);
  font-size: var(--text-sm);
  font-family: inherit;
  font-weight: 500;
  padding: 0.25rem 0;
  margin-bottom: 0.5rem;
  cursor: pointer;
}

.sub-picker-back::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-left: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(45deg);
}

.edit-field {
  margin-bottom: 0.5rem;
}

.edit-field label {
  display: block;
  font-size: var(--text-sm);
  color: var(--text-dim);
  margin-bottom: 0.25rem;
}

.edit-field .app-input,
.edit-field .app-select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: var(--text-base);
  font-family: inherit;
  box-sizing: border-box;
  max-width: 100%;
}

.edit-field input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
}

.edit-field input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.8);
}

/* Add Transaction Form */
.add-tx-form {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.add-tx-amount-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.add-tx-currency {
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 500;
  flex-shrink: 0;
}

.add-tx-amount-row .app-input {
  flex: 1;
}

.add-tx-select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: var(--text-base);
  font-family: inherit;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}

.action-sub-title {
  font-size: var(--text-base);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.split-preview {
  margin-top: 0.25rem;
}

.recat-list {
  gap: 0.25rem;
}
/* ================================
   RECURRING TAB
   ================================ */

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

/* ============================================
   LEDGER REDESIGN (Nov 2026)
   ============================================ */
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; color: var(--text); font-variant-numeric: tabular-nums; }

/* Header: logo + greeting, no glass blur */
.app-header { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; border-bottom: 1px solid transparent; }
.app-header::after { display: none; }
.header-name { font-family: var(--serif); font-size: 1.25rem; font-weight: 500; color: var(--text); }

/* Home totals: one serif hero number, plain labels */
.net-cash-card { background: transparent; border: none; padding: 8px 4px 4px; box-shadow: none; }
.hero-stat { background: transparent; border: none; padding: 0; text-align: left; }
.hero-stat-label { font-size: 0.875rem; font-weight: 500; color: var(--text-muted); text-transform: none; letter-spacing: 0; }
.hero-stat-value { font-family: var(--serif); font-size: 2.6rem; font-weight: 500; letter-spacing: -0.02em; line-height: 1.05; }
.hero-stat-value.balance-positive, .hero-stat-value.balance-negative { color: var(--text); }

/* Account sections: hairline ledger lists instead of glowing cards */
.account-section h2 { font-family: 'Inter', sans-serif; font-size: 0.95rem; font-weight: 700; color: var(--text); text-transform: none; letter-spacing: 0; }
.section-header { border-bottom: 1px solid var(--text); padding-bottom: 8px; }
.balance-positive { color: var(--text); }
.balance-negative { color: var(--danger); }

/* Buttons */
.btn-primary { background: var(--accent); color: var(--on-accent); border-radius: 14px; font-size: 1.0625rem; box-shadow: none; }
.btn-primary:hover { background: var(--accent-hover); opacity: 1; }

/* Login: personal greeting, form card over a quiet banknote pattern */
#screen-login, #screen-beta, #screen-signup {
  background-color: var(--bg);
  background-image:
    repeating-radial-gradient(circle at 50% 120%, transparent 0 13px, color-mix(in srgb, var(--accent) 7%, transparent) 13px 14px),
    repeating-radial-gradient(circle at 0% 0%, transparent 0 21px, color-mix(in srgb, var(--accent) 7%, transparent) 21px 22px);
}
.login-title { font-family: var(--serif); font-weight: 500; font-size: 1.9rem; letter-spacing: -0.01em; }
.login-subtitle { color: var(--text-muted); }
.login-container form { background: var(--bg-card); border: 1px solid var(--border); border-radius: 18px; padding: 8px 20px 20px; }
.login-container input { background: transparent; border: none; border-bottom: 1px solid var(--border); border-radius: 0; min-height: 56px; padding: 0 2px; font-size: 1.0625rem; }
.login-container input:focus { border-bottom-color: var(--accent); box-shadow: none; outline: none; }
.login-container .btn-primary { margin-top: 18px; }
.btn-link { color: var(--accent); }

/* Bottom nav: three plain tabs */
.bottom-nav { background: color-mix(in srgb, var(--bg) 95%, transparent); border-top: 1px solid var(--border); backdrop-filter: none; -webkit-backdrop-filter: none; }
.bottom-nav::before { display: none; }
.nav-item { color: var(--text-muted); background: transparent; }
.nav-item.active { color: var(--accent); background: transparent; }

/* Appearance switch */
.hero-stat { align-items: flex-start; }
#btn-goto-beta { display: none; }
.nav-brand { display: none; }

/* Laptop: sidebar navigation, wider content */
@media (min-width: 900px) {
  #screen-app.active { display: grid; grid-template-columns: 220px minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .bottom-nav { grid-column: 1; grid-row: 1 / span 2; position: static; flex-direction: column; justify-content: flex-start; align-items: stretch; gap: 4px; height: auto; padding: 88px 14px 24px; border-top: none; border-right: 1px solid var(--border); background: var(--bg); }
  .nav-item { flex-direction: row; justify-content: flex-start; gap: 10px; min-height: 40px; padding: 0 12px; border-radius: 10px; font-size: 0.875rem; }
  .nav-item.active { background: var(--bg-elevated); color: var(--text); }
  .app-header { grid-column: 2; }
  .tab-content { grid-column: 2; max-width: 1080px; width: 100%; margin: 0 auto; padding-left: 40px; padding-right: 40px; box-sizing: border-box; }
  .hero-stat-value { font-size: 3.4rem; }
  .nav-brand { display: flex; align-items: center; gap: 10px; padding: 0 12px 28px; margin-top: -60px; font-family: var(--serif); font-size: 1.375rem; font-weight: 500; color: var(--text); }
  .header-logo { display: none; }
}

/* Sign-in screen (matches the approved mockup) */
#screen-login .signin { flex: 1; display: flex; flex-direction: column; min-height: 100%; }
.signin-main { flex: 1; display: flex; flex-direction: column; gap: 28px; padding: max(24px, env(safe-area-inset-top)) 24px 24px; width: 100%; max-width: 420px; margin: 0 auto; box-sizing: border-box; }
.signin-head { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.signin-logo { width: 37px; height: 48px; object-fit: contain; margin-bottom: 8px; }
#screen-login .login-title { margin: 0; font-size: 1.875rem; }
#screen-login .login-subtitle { margin: 0; font-size: 0.875rem; }
.signin-card { display: flex; flex-direction: column; background: var(--bg-card); border: 1px solid var(--border); border-radius: 18px; padding: 8px 20px 16px; }
.signin-field { display: flex; align-items: center; gap: 8px; min-height: 60px; border-bottom: 1px solid var(--border); }
.signin-field[hidden] { display: none; }
#screen-login .signin-field input { flex: 1; min-width: 0; min-height: 56px; border: none; border-radius: 0; background: transparent; padding: 0; margin: 0; color: var(--text); font: 400 1.0625rem 'Inter', sans-serif; box-shadow: none; outline: none; }
#screen-login .signin-field input:-webkit-autofill { -webkit-box-shadow: 0 0 0 1000px var(--bg-card) inset; -webkit-text-fill-color: var(--text); }
.signin-field:focus-within { border-bottom-color: var(--accent); }
.signin-remembered { flex: 1; font-size: 1.0625rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.signin-link { background: none; border: none; padding: 12px 0; color: var(--accent); font: 500 0.9375rem 'Inter', sans-serif; cursor: pointer; }
.signin-faceid { width: 44px; height: 44px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: none; border: none; color: var(--accent); cursor: pointer; }
#screen-login .signin-card .btn-primary { margin-top: 24px; min-height: 52px; padding: 0; }
.signin-forgot { align-self: center; margin-top: 6px; }
#screen-login .auth-error { margin: 12px 0 0; }
.signin-footer { border-top: 1px solid var(--border); background: var(--bg); padding: 16px 24px max(24px, env(safe-area-inset-bottom)); text-align: center; display: flex; flex-direction: column; gap: 6px; }
.signin-footer a { color: var(--accent); font-size: 0.8125rem; font-weight: 500; text-decoration: none; }
.signin-footer p { margin: 0; font-size: 0.75rem; color: var(--text-muted); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; min-height: 0 !important; }

/* Home: trend line and monthly spending (from the mockup) */
.home-trend-label { margin: 6px 0 0; font-size: 0.875rem; color: var(--text-muted); }
.home-trend-label strong { color: var(--success); font-weight: 600; }
.home-trend-label strong.down { color: var(--danger); }
.home-trend { display: block; width: 100%; height: 100%; }

/* Settings: grouped lists, nothing hidden behind collapsible headers */
.page-title { font-family: var(--serif); font-size: 2rem; font-weight: 500; margin: 8px 4px 16px; color: var(--text); }
.set-heading { margin: 24px 4px 8px; font-size: 0.8125rem; font-weight: 600; color: var(--text-muted); }
.set-group { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 10px 16px; box-sizing: border-box; width: 100%; border: none; border-top: 1px solid var(--border); background: transparent; color: var(--text); font: 400 0.9375rem 'Inter', sans-serif; text-align: left; text-decoration: none; cursor: pointer; }
.set-group > .set-row:first-child, .set-group > .accounts-manage-list:first-child + .set-row:empty { border-top: none; }
.set-row-stack { display: block; }
.set-row-text { display: flex; flex-direction: column; gap: 2px; }
.set-row-action { color: var(--accent); font-weight: 600; }
.set-hint { font-size: 0.8125rem; color: var(--text-muted); }
.set-label { font-size: 0.8125rem; font-weight: 500; color: var(--text-muted); }
.set-switch { appearance: none; -webkit-appearance: none; width: 46px; height: 28px; flex-shrink: 0; border-radius: 14px; background: var(--track); position: relative; cursor: pointer; transition: background 0.2s; }
.set-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 12px; background: #FFFFFF; box-shadow: 0 1px 2px rgba(0,0,0,0.2); transition: transform 0.2s; }
.set-switch:checked { background: var(--accent); }
.set-switch:checked::after { transform: translateX(18px); }
.no-anim .set-switch, .no-anim .set-switch::after { transition: none !important; }
.set-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.set-avatar-btn { display: flex; flex-direction: column; align-items: center; gap: 6px; background: none; border: none; padding: 0; color: var(--accent); font: 500 0.8125rem 'Inter', sans-serif; cursor: pointer; }
.set-avatar-btn .settings-avatar { width: 64px; height: 64px; border-radius: 50%; background-color: var(--bg-elevated); background-size: cover; background-position: center; }
.set-profile-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.set-name-row { display: flex; gap: 8px; }
.set-name-row .app-input { flex: 1; min-width: 0; }
.set-signout { display: block; width: 100%; margin: 28px 0 24px; min-height: 52px; border-radius: 14px; color: var(--danger); font: 600 1rem 'Inter', sans-serif; cursor: pointer; }

/* Banks: a plain vertical list instead of a swipe carousel */
#tab-settings .accounts-manage-list { display: block; overflow: visible; padding: 0; scroll-snap-type: none; }
#tab-settings .scroll-dots { display: none; }
#tab-settings .settings-institution { display: flex; align-items: center; gap: 12px; width: auto; min-width: 0; margin: 0; padding: 12px 16px; border: none; border-top: 1px solid var(--border); border-radius: 0; background: transparent; box-shadow: none; }
#tab-settings .settings-institution:first-child { border-top: none; }
#tab-settings .settings-inst-top { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; margin: 0; }
#tab-settings .settings-inst-logo { width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0; background-size: cover; background-color: var(--bg-elevated); }
#tab-settings .settings-inst-name { font-size: 0.9375rem; font-weight: 600; color: var(--text); }
#tab-settings .settings-inst-detail { font-size: 0.8125rem; color: var(--text-muted); }
#tab-settings .settings-inst-actions { display: flex; gap: 6px; flex-shrink: 0; margin: 0; }
#tab-settings .settings-inst-actions button { min-height: 34px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border); background: transparent; color: var(--text); font: 500 0.8125rem 'Inter', sans-serif; width: auto; }
#tab-settings .settings-inst-actions .btn-disconnect-inst { color: var(--danger); }
#tab-settings .accounts-manage-list > p { padding: 14px 16px; margin: 0; }
#tab-settings .settings-institution { flex-direction: row; justify-content: space-between; text-align: left; }
#tab-settings .settings-inst-top { justify-content: flex-start; }
#tab-settings .settings-inst-info { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; text-align: left; min-width: 0; }
#tab-settings .card-designs-grid:empty { display: none; }
#tab-settings { padding-bottom: 96px; }
#tab-settings .settings-inst-top { overflow: hidden; }
#tab-settings .settings-inst-info { flex: 1; overflow: hidden; }
#tab-settings .settings-inst-name, #tab-settings .settings-inst-detail { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Calmer sign-in: anchored to the top so the keyboard and Face ID sheet
   don't re-center it, and a soft fade between screens */
.signin-main { justify-content: flex-start; padding-top: max(clamp(48px, 13vh, 140px), env(safe-area-inset-top)); }
.screen.active { animation: screenIn 0.18s ease-out; }
@keyframes screenIn { from { opacity: 0; } to { opacity: 1; } }
.signin-card.is-busy input, .signin-card.is-busy .signin-faceid, .signin-card.is-busy .signin-link { opacity: 0.55; pointer-events: none; }
.signin-card .btn-primary:disabled { opacity: 0.85; cursor: default; }
#screen-login button:active { transform: none; }
@media (prefers-reduced-motion: reduce) { .screen.active { animation: none; } }

/* Update available bar */
.update-bar { position: fixed; left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 60; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 10px 10px 16px; border-radius: 14px; background: var(--text); color: var(--bg); font-size: 0.875rem; font-weight: 500; }
.update-bar[hidden] { display: none; }
.update-bar button { min-height: 36px; padding: 0 14px; border: none; border-radius: 10px; background: var(--accent); color: var(--on-accent); font: 600 0.875rem 'Inter', sans-serif; cursor: pointer; }
@media (min-width: 900px) { .update-bar { left: auto; right: 24px; bottom: 24px; width: 380px; } }

/* Lets the app notice browser autofill (Chrome/Safari fire this animation) */
@keyframes onAutoFill { from { opacity: 1; } to { opacity: 1; } }
#auth-password:-webkit-autofill { animation-name: onAutoFill; animation-duration: 0.01s; }

/* Lock screen: covers the app, one Face ID check to come back */
.lock-screen { position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px; text-align: center; background-color: var(--bg);
  background-image:
    repeating-radial-gradient(circle at 50% 120%, transparent 0 13px, color-mix(in srgb, var(--accent) 7%, transparent) 13px 14px),
    repeating-radial-gradient(circle at 0% 0%, transparent 0 21px, color-mix(in srgb, var(--accent) 7%, transparent) 21px 22px); }
.lock-screen[hidden] { display: none; }
.lock-screen .login-title { font-size: 1.75rem; margin: 6px 0 0; }
.lock-screen .login-subtitle { margin: 0 0 20px; }
.lock-unlock { max-width: 320px; min-height: 52px; }
.set-select { min-height: 36px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-card); color: var(--text); font: 500 0.875rem 'Inter', sans-serif; }

/* Keep hidden cards hidden (the reset form only shows from a reset link) */
.signin-card[hidden] { display: none !important; }

/* Account cards: don't stretch short cards to the tallest one */
.account-list { align-items: flex-start; }
.account-apy { font-size: 0.8125rem; color: var(--success); font-weight: 500; }
.account-flag { align-self: flex-start; margin-top: 2px; font-size: 0.6875rem; font-weight: 600; color: var(--text-muted); background: var(--bg-elevated); padding: 2px 6px; border-radius: 4px; }
@media (min-width: 900px) {
  .account-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; overflow: visible; }
  .account-card { flex: none; }
  .account-section .scroll-dots { display: none; }
}
/* Settings → Accounts */
.acct-eye { min-width: 52px; }
.set-empty { padding: 14px 16px; margin: 0; color: var(--text-muted); font-size: 0.875rem; }
#apy-field[hidden] { display: none; }

/* ============================================
   ACTIVITY (redesign)
   ============================================ */
.act-day-head { display: flex; justify-content: space-between; padding: 16px 2px 6px; font-size: 0.75rem; font-weight: 600; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.act-row { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 2px; border-bottom: 1px solid var(--border); cursor: pointer; background: transparent; animation: none; }
.act-row:hover { background: color-mix(in srgb, var(--text) 3%, transparent); }
.act-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 8px; }
.act-row.is-excluded { opacity: 0.5; }
.act-avatar { position: relative; width: 38px; height: 38px; border-radius: 19px; flex-shrink: 0; overflow: hidden; background: var(--bg-elevated); display: flex; align-items: center; justify-content: center; }
.act-avatar::before { content: attr(data-i); font-size: 0.875rem; font-weight: 700; color: var(--text-muted); }
.act-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #FFFFFF; }
.act-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.act-row-name { font-size: 0.9375rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-row-meta { display: flex; align-items: center; gap: 6px; font-size: 0.75rem; color: var(--text-muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.act-row-right { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex-shrink: 0; }
.act-row-amt { font-size: 0.9375rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.act-row-tags { display: flex; gap: 4px; }
.act-tag { font-size: 0.6875rem; font-weight: 600; padding: 2px 6px; border-radius: 4px; background: var(--bg-elevated); color: var(--text-muted); }
.act-empty-note { color: var(--text-muted); font-size: 0.875rem; padding: 18px 2px; margin: 0; }

/* Transaction sheet: icon tiles instead of a wall of buttons */
#tx-action-sheet .action-sheet-header { flex-direction: column; align-items: center; gap: 4px; text-align: center; padding-bottom: 8px; }
#tx-action-sheet .action-sheet-title { font-size: 1.0625rem; font-weight: 600; }
#tx-action-sheet .action-toggle { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 76px; border-radius: 14px; border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text); font: 600 0.8125rem 'Inter', sans-serif; }
#tx-action-sheet .action-toggle::before { content: ''; width: 22px; height: 22px; background: currentColor; -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat; }
#tx-action-sheet .action-toggle.active { background: var(--accent-subtle); color: var(--accent); border-color: transparent; }
#tx-action-sheet [data-toggle="split"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='3'/%3E%3Ccircle cx='17' cy='17' r='3'/%3E%3Cpath d='M20 4L4 20'/%3E%3C/svg%3E"); }
#tx-action-sheet [data-toggle="recategorized"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='M4 4h7l9 9-7 7-9-9z'/%3E%3Ccircle cx='8' cy='8' r='1.5'/%3E%3C/svg%3E"); }
#tx-action-sheet [data-toggle="edit"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='M4 20h4L19 9l-4-4L4 16z'/%3E%3C/svg%3E"); }
#tx-action-sheet [data-toggle="reimbursed"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 14l-5-5 5-5'/%3E%3Cpath d='M4 9h11a5 5 0 0 1 0 10h-3'/%3E%3C/svg%3E"); }
#tx-action-sheet [data-toggle="ignored"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='8'/%3E%3Cpath d='M6.5 6.5l11 11'/%3E%3C/svg%3E"); }
#tx-action-sheet .action-sheet-cancel { margin-top: 16px; }
@media (min-width: 900px) {
  .action-sheet-overlay .action-sheet { max-width: 460px; margin: 0 auto; border-radius: 20px; }
}

.account-card[data-id] { cursor: pointer; }

/* Manage account sheet */
.manage-card h3 { font-family: var(--serif); font-weight: 500; }
.manage-subtitle { color: var(--text-muted); }
.manage-group { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--bg); }
.manage-row { border-top: 1px solid var(--border); }
.manage-group .manage-row:first-child { border-top: none; }
.manage-card .modal-actions .btn-primary-sm { min-width: 96px; }

/* ============================================
   iOS-friendly sheets
   ============================================ */
/* Inputs at 16px+ so iOS doesn't zoom the page when you tap them */
input, select, textarea, .app-input { font-size: max(16px, 1rem); }

/* Manage account: wider card that scrolls inside itself on any screen */
#account-edit-modal .modal-card {
  max-width: 460px;
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--bg-card);
  padding: 20px 20px 0;
}
/* Cancel / Done stay pinned at the bottom of the sheet */
#account-edit-modal .modal-actions {
  position: sticky; bottom: 0; z-index: 1;
  margin: 16px -20px 0; padding: 12px 20px max(14px, env(safe-area-inset-bottom));
  background: var(--bg-card); border-top: 1px solid var(--border);
  display: flex; gap: 10px;
}
#account-edit-modal .modal-actions button { flex: 1; min-height: 48px; border-radius: 12px; font-size: 1rem; }
/* Card designs: one swipeable row instead of a tall grid */
#account-edit-modal .card-design-picker { display: flex; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; }
#account-edit-modal .card-design-option { scroll-snap-align: start; }
#account-edit-modal .set-hint { display: block; margin: 6px 0 10px; }

/* Phones: a real bottom sheet that rises from the bottom edge */
@media (max-width: 899px) {
  #account-edit-modal { align-items: flex-end; padding: 0; }
  #account-edit-modal .modal-card {
    max-width: none; width: 100%;
    max-height: calc(100dvh - max(44px, env(safe-area-inset-top)) - 8px);
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  }
  #account-edit-modal.visible .modal-card { transform: translateY(0); }
  #account-edit-modal .modal-card::before { content: ''; display: block; width: 36px; height: 5px; border-radius: 3px; background: var(--border); margin: -8px auto 12px; }
}

/* Home hero: one big Available number, Assets / Liabilities beside it */
.hero-stats { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.hero-side { display: flex; flex-direction: column; gap: 6px; padding-bottom: 6px; text-align: right; }
.hero-side-row { display: flex; flex-direction: column; align-items: flex-end; gap: 0; }
.hero-side .hero-stat-label { font-size: 0.75rem; }
.hero-side-value { font-family: var(--serif); font-size: 1.25rem; font-weight: 500; color: var(--text-muted); line-height: 1.15; }
.home-trend-label { text-align: left; }
/* Footer links on the sign-in screen: big enough to tap */
.signin-footer a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 6px; }

/* ===== Activity (simplified) ===== */
.act-row-meta i { width: 8px; height: 8px; border-radius: 4px; flex-shrink: 0; display: inline-block; }
.act-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.act-head .page-title { margin: 8px 0 8px; }
.act-head-actions { display: flex; gap: 4px; }
.act-icon-btn { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border: none; border-radius: 22px; background: transparent; color: var(--text); cursor: pointer; }
.act-icon-btn:hover, .act-icon-btn[aria-expanded="true"] { background: var(--bg-elevated); }
.act-search { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.act-search[hidden] { display: none; }
.act-search input { flex: 1; min-width: 0; min-height: 40px; padding: 0 14px; border: none; border-radius: 10px; background: var(--bg-elevated); outline: none; color: var(--text); font: 400 max(16px, 1rem) 'Inter', sans-serif; }
.act-filters { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.act-month { display: flex; align-items: center; margin-left: -12px; min-width: 0; }
.act-month-btn { width: 40px; height: 44px; border: none; background: transparent; color: var(--text-muted); font: 400 1.375rem 'Inter', sans-serif; cursor: pointer; border-radius: 10px; }
.act-month-btn:disabled { opacity: 0.25; cursor: default; }
.act-month-select { appearance: none; -webkit-appearance: none; border: none; background: transparent; color: var(--text); font: 600 1rem 'Inter', sans-serif; text-align: center; text-align-last: center; cursor: pointer; }
.act-acct { position: relative; display: flex; align-items: center; color: var(--text-muted); }
.act-acct select { appearance: none; -webkit-appearance: none; min-height: 36px; padding: 0 28px 0 12px; border: 1px solid var(--border); border-radius: 18px; background: transparent; color: var(--text); font: 500 0.8125rem 'Inter', sans-serif; cursor: pointer; }
.act-acct svg { position: absolute; right: 11px; pointer-events: none; }
.act-layout { display: flex; flex-direction: column; gap: 10px; }
.act-summary { display: flex; flex-direction: column; gap: 6px; }
.act-spent { display: flex; flex-direction: column; gap: 2px; }
.act-stat-label { font-size: 0.8125rem; color: var(--text-muted); }
.act-spent-value { font-family: var(--serif); font-size: 2.5rem; font-weight: 500; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.act-sub { display: flex; gap: 14px; font-size: 0.8125rem; color: var(--text-muted); }
.act-sub b { font-weight: 600; color: var(--text-muted); }
.act-list-foot { display: flex; flex-wrap: wrap; align-items: center; font-size: 0.75rem; color: var(--text-muted); }
.act-list-foot .signin-link { min-height: 36px; font-size: 0.8125rem; }
@media (min-width: 900px) {
  .act-filters { justify-content: flex-start; gap: 16px; }
  .act-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 40px; align-items: start; }
  .act-summary { position: sticky; top: 16px; padding: 20px; border: 1px solid var(--border); border-radius: 16px; background: var(--bg-card); }
}

/* Collapsible card details (credit card terms, investment holdings) */
.card-more > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 0.8125rem; color: var(--text-muted); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.card-more > summary::-webkit-details-marker { display: none; }
.card-more > summary svg { flex-shrink: 0; transition: transform 0.2s ease; }
.card-more[open] > summary svg { transform: rotate(180deg); }
.card-more-body { padding-bottom: 4px; }

/* Home chart: drag to scrub, range buttons */
.home-chart { position: relative; height: 96px; margin-top: 10px; touch-action: pan-y; cursor: crosshair; -webkit-user-select: none; user-select: none; }
.home-chart[hidden], .home-ranges[hidden] { display: none; }
.home-trend-dot { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--bg); pointer-events: none; }
.home-trend-date { color: var(--text); font-weight: 600; }
.home-ranges { display: flex; gap: 4px; margin-top: 10px; }
.home-ranges button { min-width: 44px; min-height: 36px; padding: 0 10px; border: none; border-radius: 18px; background: transparent; color: var(--text-muted); font: 600 0.8125rem 'Inter', sans-serif; cursor: pointer; }
.home-ranges button.on { background: var(--bg-elevated); color: var(--accent); }

/* ===== Account card (compact) ===== */
.account-card .account-top { align-items: center; }
.acct-badge { flex-shrink: 0; width: 48px; height: 48px; border-radius: 13px; background: #FFFFFF center / cover no-repeat; }
.acct-badge-logo { background-size: 72%; border: 1px solid var(--border); }
.acct-badge-art { width: 68px; height: 43px; /* real card proportions (1.586:1) */ }
.acct-badge-initial { display: flex; align-items: center; justify-content: center; background: var(--bg-elevated); color: var(--text-muted); font-weight: 700; font-size: 1rem; }
.account-card .account-name { -webkit-line-clamp: 1; font-size: 1rem; }
.account-sub { font-size: 0.8125rem; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-card .account-balance .amount { font-size: 1.25rem; }
.account-card .account-balance .label { font-size: 0.6875rem; }
/* credit: utilization */
.card-liabilities { border-top: none; margin-top: 14px; padding: 0; }
.liab-util-wrap { margin: 0; }
.liab-util-bar { height: 4px; border-radius: 2px; }
.liab-util-labels { margin-top: 6px; font-size: 0.75rem; }
/* collapsible summary */
.card-more > summary { min-height: 40px; margin-bottom: -6px; }
.card-more-sum { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.liab-due { color: var(--text); font-weight: 500; }
.liab-due.liab-soon { color: var(--warning); }
.liab-due.liab-urgent { color: var(--danger); }
.more-word { font-size: 0.75rem; color: var(--text-muted); }
.liab-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 10px 0 6px; }
.liab-tile { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; background: var(--bg-elevated); }
.liab-tile span { font-size: 0.6875rem; color: var(--text-muted); }
.liab-tile b { font-size: 0.9375rem; font-weight: 600; font-variant-numeric: tabular-nums; display: flex; align-items: baseline; gap: 6px; }
.liab-tile b small { font-size: 0.6875rem; font-weight: 400; color: var(--text-muted); }
.liab-tile.liab-urgent b { color: var(--danger); }
/* investments: holdings */
.hold-list { display: flex; flex-direction: column; padding: 6px 0 2px; }
.hold-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.hold-ticker { flex-shrink: 0; width: 40px; height: 40px; border-radius: 11px; background: var(--bg-elevated); display: flex; align-items: center; justify-content: center; font-size: 0.625rem; font-weight: 700; letter-spacing: 0.02em; color: var(--text); }
.hold-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hold-name { font-size: 0.875rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hold-meta { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hold-right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0; }
.hold-value { font-size: 0.875rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.hold-change { font-size: 0.75rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.hold-change.holding-up { color: var(--success); }
.hold-change.holding-down { color: var(--danger); }

/* In-app picker (replaces native select popups) */
.picker-wrap { position: relative; display: inline-flex; min-width: 0; max-width: 100%; }
.act-acct .picker-wrap, .edit-field .picker-wrap { display: flex; width: 100%; }
.picker-wrap select { pointer-events: none; }
.picker-hit { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: none; background: transparent; cursor: pointer; border-radius: inherit; -webkit-tap-highlight-color: transparent; }
.picker-hit:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 10px; }
.picker-overlay { z-index: 3000; }
.picker-sheet { padding: 1.25rem 0.75rem calc(1rem + env(safe-area-inset-bottom)); background: var(--bg-card); }
.picker-sheet .action-sheet-header { padding: 0 0.5rem; margin-bottom: 6px; }
.picker-list { display: flex; flex-direction: column; max-height: 60vh; overflow-y: auto; }
.picker-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 0 0.75rem; border: none; border-radius: 12px; background: transparent; color: var(--text); font: 500 1rem 'Inter', sans-serif; text-align: left; cursor: pointer; }
.picker-row:hover, .picker-row:focus-visible { background: var(--bg-elevated); outline: none; }
.picker-row.on { color: var(--accent); font-weight: 600; }
@media (min-width: 900px) {
  .picker-overlay { align-items: center; }
  .picker-sheet { max-width: 360px; border-radius: 16px; transform: scale(0.97); transition: transform 0.2s ease; }
  .picker-overlay.visible .picker-sheet { transform: none; }
  .picker-sheet::before { display: none; }
}

/* Add button: says what it does */
.act-add-btn { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 14px 0 10px; margin-left: 4px; border: 1px solid var(--border); border-radius: 18px; background: transparent; color: var(--text); font: 600 0.8125rem 'Inter', sans-serif; cursor: pointer; }
.act-head-actions { align-items: center; margin-right: 0; }

.set-row-text { min-width: 0; }
.set-row > .picker-wrap { flex: 0 0 auto; }
.account-apy { text-overflow: ellipsis; max-width: 100%; }
.act-list-foot { flex-direction: column; justify-content: center; text-align: center; gap: 2px; padding: 22px 0 12px; }
.act-list-foot .tx-updated { flex-basis: auto; }
.act-list-foot > div { display: flex; justify-content: center; gap: 20px; }

/* Transaction note */
.act-row-note { font-size: 0.75rem; color: var(--text-muted); font-style: italic; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* Account order: eye + drag handle */
.acct-order-group { position: relative; }
.acct-order-row { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 0 6px 0 4px; background: var(--bg-card); border-top: 1px solid var(--border); position: relative; transition: box-shadow 0.15s, background 0.15s; }
.acct-order-group .acct-order-row:first-child { border-top: none; }
.acct-order-row.is-hidden .acct-order-name > span:first-child { color: var(--text-muted); }
.acct-order-row.dragging { z-index: 2; background: var(--bg-elevated); box-shadow: 0 8px 24px rgba(0,0,0,0.25); border-radius: 10px; transition: none; }
.acct-order-name { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.acct-order-name > span:first-child { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-eye { flex-shrink: 0; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border: none; border-radius: 22px; background: transparent; color: var(--accent); cursor: pointer; }
.acct-order-row.is-hidden .acct-eye { color: var(--text-muted); }
.acct-handle { flex-shrink: 0; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); cursor: grab; touch-action: none; border-radius: 10px; }
.acct-handle:active { cursor: grabbing; }
.acct-handle:focus-visible { outline: 2px solid var(--accent); }
.acct-order-kind { padding: 12px 14px 4px; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); }

/* Card designs: compact disclosure */
.set-disclosure { border-top: 1px solid var(--border); }
.set-disclosure[hidden] { display: none; }
.set-disclosure > summary { list-style: none; cursor: pointer; }
.set-disclosure > summary::-webkit-details-marker { display: none; }
.set-disclosure-end { display: flex; align-items: center; gap: 8px; color: var(--text-muted); margin-left: auto; }
.set-disclosure-end svg { transition: transform 0.2s; }
.set-disclosure[open] .set-disclosure-end svg { transform: rotate(180deg); }
.set-disclosure .card-designs-grid { padding: 4px 14px 14px; }

/* Count in another month */
.acct-badge-art { background-color: transparent; background-size: contain; box-shadow: none; border-radius: 0; }
.act-month .picker-wrap { flex-shrink: 0; }
.act-month-select { width: auto; min-width: 0; padding: 6px 4px; }
/* Activity: account filter sized and right-aligned */
.act-sub { justify-content: space-between; align-items: center; min-height: 24px; }
.act-sub .signin-link { font-size: 0.8125rem; min-height: 32px; }
.act-filters { gap: 12px; }
.act-acct { flex: 0 0 auto; max-width: 44%; margin-left: auto; }
.act-acct .picker-wrap { width: 100%; }
.act-acct select { width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 900px) { .act-acct { width: 200px; margin-left: 0; } }
.hold-row + .hold-row { border-top: none; }
.hold-list { gap: 2px; }
.card-more { border-top: none; margin-top: 6px; }

/* In-app viewer for Privacy / Security / FAQ */
.info-panel { position: fixed; inset: 0; z-index: 2500; display: flex; flex-direction: column; background: var(--bg); transform: translateX(100%); transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1); }
.info-panel.open { transform: none; }
.info-panel[hidden] { display: none; }
.info-bar { display: flex; align-items: center; min-height: 52px; padding: env(safe-area-inset-top) 8px 0; border-bottom: 1px solid var(--border); background: var(--bg); }
.info-back { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; padding: 0 10px 0 4px; border: none; background: transparent; color: var(--accent); font: 500 1rem 'Inter', sans-serif; cursor: pointer; }
#info-frame { flex: 1; width: 100%; border: 0; background: var(--bg); opacity: 0; transition: opacity 0.15s; }
#info-frame.loaded { opacity: 1; }
/* Wider screens: a centered window over a dimmed page instead of a side drawer */
@media (min-width: 900px) {
  .info-panel { inset: 0; background: var(--scrim); align-items: center; justify-content: center; transform: none; opacity: 0; transition: opacity 0.2s ease; padding: 32px; }
  .info-panel.open { opacity: 1; }
  .info-panel .info-bar, .info-panel #info-frame { width: min(860px, 100%); }
  .info-panel .info-bar { border: 1px solid var(--border); border-bottom: none; border-radius: 16px 16px 0 0; padding-top: 0; }
  .info-panel #info-frame { flex: 0 1 auto; height: min(820px, calc(100vh - 116px)); border: 1px solid var(--border); border-top: 1px solid var(--border); border-radius: 0 0 16px 16px; box-shadow: 0 24px 60px rgba(0,0,0,0.3); }
}

/* Amount colors: out = red, in = green, pending = orange until it posts */
.act-row-amt.is-out { color: var(--text); }   /* the minus sign says it; red stays for real problems */
.act-row-amt.is-in { color: var(--success); }
.act-row-amt.is-pending { color: var(--pending); }
.act-tag-pending { background: color-mix(in srgb, var(--pending) 16%, transparent); color: var(--pending); }
/* Bottom sheets: never hide Cancel behind the home indicator */
.action-sheet { max-height: calc(100dvh - max(24px, env(safe-area-inset-top))); padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }
.action-sheet > .action-sheet-cancel { position: sticky; bottom: 0; z-index: 1; margin-top: 12px; color: var(--text); }

/* ===== Transaction sheet (compact) ===== */
.txs-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.txs-avatar { width: 44px; height: 44px; border-radius: 22px; }
.txs-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.txs-edit { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; min-height: 36px; padding: 0; border: none; background: transparent; color: var(--text); cursor: pointer; text-align: left; font: inherit; }
.txs-edit svg { flex-shrink: 0; color: var(--text-muted); }
.txs-edit:hover svg, .txs-edit:focus-visible svg { color: var(--accent); }
.txs-name { font-size: 1.0625rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.txs-sub { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.txs-sub:empty { display: none; }
.txs-input { width: 100%; min-height: 36px; padding: 0 10px; border: 1px solid var(--accent); border-radius: 10px; background: var(--bg-card); color: var(--text); font: 600 max(16px, 1rem) 'Inter', sans-serif; outline: none; }
.txs-amount { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; margin: 4px 0 14px 56px; }
.txs-amt { font-family: var(--serif); font-size: 2rem; font-weight: 500; line-height: 1.1; font-variant-numeric: tabular-nums; }
.txs-amt.is-out { color: var(--text); } .txs-amt.is-in { color: var(--success); } .txs-amt.is-pending { color: var(--pending); }
.txs-amt-edit { display: inline-flex; align-items: center; gap: 6px; font-family: var(--serif); font-size: 1.5rem; }
.txs-amt-edit .txs-input { width: 150px; font-size: 1.25rem; }
.txs-group { border-radius: 14px; background: var(--bg-card); border: 1px solid var(--border); overflow: hidden; }
.txs-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 6px 12px 6px 14px; border: none; border-top: 1px solid var(--border); border-radius: 0; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.txs-group > .txs-row:first-child { border-top: none; }
.txs-note { cursor: text; padding-top: 4px; padding-bottom: 4px; }
.txs-note textarea { width: 100%; min-height: 36px; border: none; background: transparent; color: var(--text); font: 400 max(16px, 1rem)/1.35 'Inter', sans-serif; resize: none; outline: none; }
.txs-seg { display: grid; grid-template-columns: 1fr 1fr; }
.txs-seg .action-toggle { padding: 0 12px; border-radius: 12px; font-size: 0.875rem; }
.txs-seg .action-toggle.active { background: var(--accent-subtle); color: var(--accent); border-color: transparent; }
.txs-links { display: flex; justify-content: center; gap: 20px; }
.txs-links .signin-link { min-height: 40px; font-size: 0.8125rem; }
.txs-danger { color: var(--danger) !important; }
.txs-links:not(:has(:not([hidden]))) { display: none; }
/* category picker */
.recat-new { display: flex; gap: 8px; margin-bottom: 10px; }
.recat-new .app-input { flex: 1; min-width: 0; }
.recat-new .btn-primary { flex: 0 0 auto; min-width: 72px; }
.recat-list { flex-direction: column; overflow-y: auto; }
#split-remove { display: block; margin: 8px auto 0; }
#split-remove[hidden] { display: none; }
.txs-edit[hidden], .txs-amt-edit[hidden], .txs-input[hidden] { display: none; }
.recat-new .btn-primary { width: auto; padding: 0 18px; min-height: 44px; }
.recat-new .app-input { min-height: 44px; }
/* Pending: clearly orange, not red */
:root { --pending: #A95E0C; }
:root[data-theme="dark"] { --pending: #EE9A45; }
/* Reimbursed / Ignore: compact pills with the icon beside the label */
.txs-seg .action-toggle { display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 8px; min-height: 44px; max-height: 48px; }
.txs-seg .action-toggle::before, .txs-seg .action-toggle svg { margin: 0; }
/* Split */
.split-total { font-weight: 400; color: var(--text-muted); font-size: 0.875rem; margin-left: 4px; }
.split-even { display: flex; align-items: center; gap: 6px; margin: 4px 0 12px; }
.split-even > span { font-size: 0.8125rem; color: var(--text-muted); margin-right: 4px; }
.split-even button { min-width: 44px; min-height: 40px; border: 1px solid var(--border); border-radius: 20px; background: transparent; color: var(--text); font: 600 0.875rem 'Inter', sans-serif; cursor: pointer; }
.split-even button.on { background: var(--accent-subtle); color: var(--accent); border-color: transparent; }
.split-even input { width: 56px; min-height: 40px; padding: 0 8px; border: 1px solid var(--border); border-radius: 20px; background: transparent; color: var(--text); font: 600 max(16px, 0.875rem) 'Inter', sans-serif; text-align: center; }
.split-amounts { display: grid; gap: 8px; }
.split-field { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 12px; background: var(--bg-card); border: 1px solid var(--border); cursor: text; }
.split-field > span:first-child { font-size: 0.75rem; color: var(--text-muted); }
.split-money { display: flex; align-items: center; gap: 2px; font: 600 1.125rem 'Inter', sans-serif; }
.split-money input { flex: 1; min-width: 0; border: none; background: transparent; color: var(--text); font: 600 max(16px, 1.125rem) 'Inter', sans-serif; outline: none; padding: 0; }
.split-field:focus-within { border-color: var(--accent); }
#split-save { width: 100%; min-height: 46px; margin-top: 10px; }
#tx-action-sheet .txs-seg .action-toggle { flex-direction: row; gap: 8px; padding: 0 12px; }
#tx-action-sheet .txs-seg .action-toggle::before { width: 18px; height: 18px; }
.split-amounts { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.split-field { min-width: 0; }
.split-money input { width: 100%; }
.action-sheet { overflow-x: hidden; }
.split-preview { text-align: left; font-size: 0.8125rem; color: var(--text-muted); margin: 10px 2px 0; }
/* Category picker: wrapping pills (no long list), edit mode to rename/delete */
.recat-head { display: flex; align-items: center; justify-content: space-between; }
.recat-head .action-sub-title { margin: 0; }
.recat-head .signin-link { min-height: 40px; font-size: 0.875rem; font-weight: 600; }
.recat-list { display: block; max-height: none; overflow: visible; border: none; background: transparent; border-radius: 0; }
.cat-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-pill { display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px; border: 1px solid var(--border); border-radius: 19px; background: var(--bg-card); color: var(--text); font: 500 0.875rem 'Inter', sans-serif; cursor: pointer; }
.cat-pill.on { background: var(--accent-subtle); color: var(--accent); border-color: transparent; font-weight: 600; }
.cat-pill.edit { padding: 0 0 0 4px; gap: 0; cursor: default; }
.cat-pill-name { min-height: 36px; padding: 0 6px 0 10px; border: none; background: transparent; color: var(--text); font: 500 0.875rem 'Inter', sans-serif; cursor: text; text-decoration: underline dotted var(--text-muted); text-underline-offset: 3px; }
.cat-pill-del { min-width: 36px; min-height: 36px; padding: 0 10px; border: none; border-left: 1px solid var(--border); border-radius: 0 19px 19px 0; background: transparent; color: var(--text-muted); font: 600 1rem 'Inter', sans-serif; cursor: pointer; }
.cat-pill-del.confirm { background: var(--danger); color: #fff; font-size: 0.8125rem; border-left-color: transparent; }
.cat-pill-input { width: 140px; min-height: 36px; padding: 0 10px; border: none; border-radius: 19px; background: transparent; color: var(--text); font: 500 max(16px, 0.875rem) 'Inter', sans-serif; outline: none; }
.cat-pill.edit:has(.cat-pill-input) { border-color: var(--accent); }
.cat-reset { display: block; width: 100%; min-height: 40px; margin-bottom: 10px; border: none; background: transparent; color: var(--text-muted); font: 500 0.8125rem 'Inter', sans-serif; text-align: left; cursor: pointer; padding: 0 2px; }
.cat-help { margin: 12px 2px 0; font-size: 0.75rem; color: var(--text-muted); }
.txs-adj { flex-shrink: 0; font: 600 0.6875rem 'Inter', sans-serif; padding: 2px 7px; border-radius: 6px; background: var(--accent-subtle); color: var(--accent); }
.txs-adj[hidden] { display: none; }
/* Split vs adjusted vs renamed tags */
.txs-adj.is-split, .act-tag-split { background: color-mix(in srgb, #5B7FD6 16%, transparent); color: #5B7FD6; }
:root[data-theme="dark"] .txs-adj.is-split, :root[data-theme="dark"] .act-tag-split { color: #8EA8EA; background: color-mix(in srgb, #8EA8EA 16%, transparent); }
.txs-adj.is-adjusted, .act-tag-adjusted { background: color-mix(in srgb, #A07FE0 16%, transparent); color: #A07FE0; }   /* purple: green is only for money in */
/* Logo picker */
.txs-avatar-btn { position: relative; flex-shrink: 0; padding: 0; border: none; background: transparent; cursor: pointer; border-radius: 50%; }
.txs-avatar-badge { position: absolute; right: -2px; bottom: -2px; width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--bg-elevated); color: var(--text-muted); box-shadow: 0 0 0 2px var(--bg-card); }
.logo-search { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; border-radius: 12px; background: var(--bg-card); border: 1px solid var(--border); color: var(--text-muted); margin-bottom: 10px; }
.logo-search:focus-within { border-color: var(--accent); }
.logo-search input { flex: 1; min-width: 0; border: none; background: transparent; color: var(--text); font: 400 max(16px, 1rem) 'Inter', sans-serif; outline: none; min-height: 42px; }
.logo-results { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; min-height: 120px; transition: opacity 0.15s; }
.logo-results.loading { opacity: 0.55; }
.logo-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px 10px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-card); color: var(--text); cursor: pointer; min-width: 0; font: inherit; }
.logo-tile.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.logo-img { position: relative; width: 44px; height: 44px; border-radius: 12px; overflow: hidden; background: var(--bg-elevated); display: flex; align-items: center; justify-content: center; }
.logo-img::before { content: attr(data-i); font-weight: 700; color: var(--text-muted); }
.logo-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #fff; }
.logo-name { font-size: 0.75rem; font-weight: 600; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo-domain { font-size: 0.625rem; color: var(--text-muted); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo-empty { grid-column: 1 / -1; margin: 18px 0; text-align: center; font-size: 0.8125rem; color: var(--text-muted); }
#logo-reset { display: block; margin: 10px auto 0; min-height: 40px; font-size: 0.8125rem; }
#logo-reset[hidden] { display: none; }
#split-to-adjusted { display: block; margin: 8px auto 0; min-height: 40px; font-size: 0.8125rem; }
#split-to-adjusted[hidden] { display: none; }
/* Accounts: each group folds behind a chevron */
.acct-order-sec + .acct-order-sec { border-top: 1px solid var(--border); }
.acct-order-sec > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 0 14px; cursor: pointer; }
.acct-order-sec > summary::-webkit-details-marker { display: none; }
.acct-order-count { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; text-transform: none; letter-spacing: 0; }
.acct-order-count svg { transition: transform 0.2s; }
.acct-order-sec[open] .acct-order-count svg { transform: rotate(180deg); }
.acct-order-sec[open] > .acct-order-group { border-top: 1px solid var(--border); }
/* From the founder */
.founder-head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 4px; }
.founder-mark { width: 44px; height: 44px; border-radius: 12px; background: var(--accent-subtle); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.founder-mark img { width: 18px; height: 24px; }
.founder-who { display: flex; flex-direction: column; gap: 1px; }
.founder-who b { font-family: var(--serif); font-size: 1.125rem; font-weight: 500; }
.founder-who span { font-size: 0.75rem; color: var(--text-muted); }
.founder-body { padding: 8px 16px 6px; }
.founder-body p { margin: 0 0 10px; font-size: 0.9375rem; line-height: 1.55; color: var(--text); }
.founder-body p:first-child { font-weight: 500; }
/* Bank connection alerts */
.bank-alerts { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 12px; }
.bank-alerts[hidden] { display: none; }
.bank-alert { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; border-radius: 14px; background: color-mix(in srgb, var(--danger) 10%, var(--bg-card)); border: 1px solid color-mix(in srgb, var(--danger) 30%, var(--border)); font-size: 0.875rem; }
.bank-alert.warn { background: color-mix(in srgb, var(--pending) 10%, var(--bg-card)); border-color: color-mix(in srgb, var(--pending) 30%, var(--border)); }
.bank-alert-dot { flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.bank-alert.warn .bank-alert-dot { background: var(--pending); }
.bank-alert-text { flex: 1; min-width: 0; line-height: 1.35; }
.bank-alert-btn, .btn-reconnect-inst { flex-shrink: 0; min-height: 36px; padding: 0 14px; border: none; border-radius: 18px; background: var(--accent); color: var(--on-accent); font: 600 0.8125rem 'Inter', sans-serif; cursor: pointer; }
.bank-alert-btn:disabled { opacity: 0.6; }
.settings-inst-alert { display: block; font-size: 0.75rem; font-weight: 600; color: var(--danger); margin-top: 2px; }
.settings-inst-alert.warn { color: var(--pending); }

/* Update required: full screen, follows your light/dark choice */
.update-screen { position: fixed; inset: 0; z-index: 5000; display: flex; align-items: center; justify-content: center; padding: max(24px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom)); background: var(--bg); animation: update-in 0.25s ease; }
.update-screen[hidden] { display: none; }
.update-card { width: 100%; max-width: 360px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; }
.update-mark { width: 36px; height: 48px; margin-bottom: 8px; }
.update-card h2 { margin: 0; font-family: var(--serif); font-weight: 500; font-size: 1.75rem; line-height: 1.2; color: var(--text); }
.update-card p { margin: 0 0 12px; font-size: 0.9375rem; line-height: 1.5; color: var(--text-muted); }
.update-card .btn-primary { width: 100%; min-height: 50px; font-size: 1rem; }
body.update-required { overflow: hidden; }
@keyframes update-in { from { opacity: 0; } to { opacity: 1; } }
/* Settings: "Home screen" intro */
.set-intro { display: flex; flex-direction: column; gap: 3px; padding: 14px 16px 12px; }
.set-intro b { font-size: 0.9375rem; font-weight: 600; }
.set-intro > span { font-size: 0.8125rem; color: var(--text-muted); line-height: 1.45; }
.set-intro-icon { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px; padding: 0 4px; border-radius: 6px; background: var(--bg-elevated); color: var(--text); font-weight: 700; }
#account-order-list + .set-row { border-top: 1px solid var(--border); }

/* Delete account */
.set-delete-link { display: block; margin: 10px auto 24px; min-height: 44px; padding: 0 16px; border: none; background: transparent; color: var(--danger); font: 500 0.875rem 'Inter', sans-serif; cursor: pointer; }
.delete-sheet { padding-top: 1.5rem; }
.delete-title { margin: 0 0 6px; font-family: var(--serif); font-weight: 500; font-size: 1.5rem; }
.delete-lead { margin: 0 0 6px; color: var(--text-muted); font-size: 0.9375rem; }
.delete-list { margin: 0 0 14px; padding-left: 1.1em; font-size: 0.875rem; line-height: 1.55; }
.delete-form { display: flex; flex-direction: column; gap: 10px; }
.delete-field { display: flex; flex-direction: column; gap: 4px; font-size: 0.8125rem; color: var(--text-muted); }
.delete-btn { min-height: 48px; border: none; border-radius: 12px; background: var(--danger); color: #fff; font: 600 1rem 'Inter', sans-serif; cursor: pointer; }
.delete-btn:disabled { opacity: 0.4; cursor: default; }
.delete-form .action-sheet-cancel { position: static; box-shadow: none; margin-top: 0; }
.info-back:focus { outline: none; }
.info-back:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 10px; }
.delete-phrase { color: var(--text); font-weight: 600; user-select: none; -webkit-user-select: none; }

/* APY line: rate and this month's estimate wrap onto two lines on narrow phones */
.account-apy { display: flex; flex-wrap: wrap; white-space: normal; overflow: visible; }
.account-apy > span { white-space: nowrap; }
.account-apy .apy-est { color: var(--text-muted); font-weight: 400; }

/* Footer under each reorder group: says how it's sorted, offers going back to balance order */
.acct-order-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 0 14px; border-top: 1px solid var(--border); font-size: 0.8125rem; color: var(--text-muted); }
.acct-order-reset { min-height: 44px; padding: 0 2px; background: none; border: 0; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; }

/* Your own logos: contained (not cropped), on the card colour so transparent PNGs look right */
.logo-img.mine img { object-fit: contain; background: transparent; }
.logo-upload .logo-img { color: var(--accent); border: 1px dashed var(--border); background: transparent; }
.logo-new { grid-template-columns: 56px 1fr; }
.logo-new[hidden] { display: none; }
.logo-new-field { display: flex; flex-direction: column; gap: 6px; font-size: 0.8125rem; color: var(--text-muted); min-width: 0; }
.logo-new-field input { min-height: 44px; padding: 0 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-card); color: var(--text); font: inherit; font-size: 1rem; }
.logo-new-actions { grid-column: 1 / -1; }
.logo-new-actions button { min-height: 44px; }
.mylogos { display: flex; flex-direction: column; padding: 0 14px 6px; }
.mylogo { display: flex; align-items: center; gap: 12px; min-height: 60px; border-top: 1px solid var(--border); }
.mylogo:first-child { border-top: none; }
.mylogo .logo-img { flex: none; width: 40px; height: 40px; border-radius: 10px; }
.mylogo-name { flex: 1; min-width: 0; min-height: 44px; padding: 0 8px; margin-left: -8px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--text); font: inherit; font-size: 1rem; }
.mylogo-name:focus { border-color: var(--border); background: var(--bg-card); outline: none; }
.mylogo-del { flex: none; min-height: 44px; padding: 0 4px; background: none; border: 0; color: var(--text-muted); font: inherit; font-size: 0.875rem; cursor: pointer; }
.mylogo-del.confirm { color: var(--danger); font-weight: 600; }

/* Feel like a native app: no text highlighting or long-press callouts on the UI.
   Fields you type in stay selectable so copy/paste still works. */
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, textarea, select, [contenteditable="true"] { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }

/* Upload framing: the circle is exactly what shows next to transactions */
.logo-new { display: flex; flex-direction: column; gap: 14px; padding: 4px 0; }
.logo-frame-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.logo-frame { position: relative; width: 180px; height: 180px; border-radius: 50%; overflow: hidden; touch-action: none; cursor: grab;
  background-color: var(--bg-elevated);
  background-image: linear-gradient(45deg, color-mix(in srgb, var(--text) 6%, transparent) 25%, transparent 25%, transparent 75%, color-mix(in srgb, var(--text) 6%, transparent) 75%),
    linear-gradient(45deg, color-mix(in srgb, var(--text) 6%, transparent) 25%, transparent 25%, transparent 75%, color-mix(in srgb, var(--text) 6%, transparent) 75%);
  background-size: 16px 16px; background-position: 0 0, 8px 8px;
  box-shadow: 0 0 0 1px var(--border); }
.logo-frame[style*="background"] { background-image: none; }
.logo-frame:active { cursor: grabbing; }
.logo-frame img { position: absolute; left: 50%; top: 50%; max-width: none; pointer-events: none; -webkit-user-drag: none; }
.logo-frame-hint { font-size: 0.75rem; color: var(--text-muted); }
.logo-frame-controls { display: flex; flex-direction: column; gap: 10px; }
.logo-zoom { display: flex; align-items: center; gap: 10px; color: var(--text-muted); }
.logo-zoom input { flex: 1; min-height: 44px; accent-color: var(--accent); }
.logo-bg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.logo-bg button { min-height: 40px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-card); color: var(--text); font: inherit; font-size: 0.8125rem; cursor: pointer; }
.logo-bg button[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; font-weight: 600; }
.logo-bg button[data-fit] { color: var(--text-muted); }
.logo-new-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
/* Your logos in the picker get a delete badge */
.logo-tile-wrap { position: relative; display: grid; min-width: 0; }
.logo-del { position: absolute; top: 4px; right: 4px; min-width: 28px; height: 28px; padding: 0 8px; display: flex; align-items: center; justify-content: center; border: 0; border-radius: 14px; background: var(--bg-elevated); color: var(--text-muted); font: inherit; font-size: 0.75rem; font-weight: 600; cursor: pointer; }
.logo-del::after { content: ''; position: absolute; inset: -8px; }
.logo-del.confirm { background: var(--danger); color: #fff; }

.logo-results[hidden], .logo-search[hidden] { display: none; }
/* While framing a new logo, the sheet's Done button would compete with Save */
.action-sheet:has(#logo-picker.framing) #action-sheet-cancel { display: none; }
.logo-new { align-items: stretch; } .logo-new > .logo-new-field, .logo-new > .logo-new-actions, .logo-new > .logo-frame-controls { width: 100%; align-self: stretch; }

/* Hidden amounts: eye next to the Available number brings them back */
.hero-value-row { display: flex; gap: 12px; }
.money-eye { flex: none; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--bg-elevated); color: var(--text-muted); cursor: pointer; }
.money-eye[hidden] { display: none; }
.hero-stat.pressing .hero-stat-value { opacity: 0.6; transition: opacity 0.5s; }
.money-hidden .hero-stat-value, .money-hidden .hero-side-value { letter-spacing: 0.04em; }

/* "In +$X" / "Spent $X" under the big number switches the Activity view */
.act-spent-value.is-in { color: var(--success); }
/* Asterisks sit high in the line, so line the eye up with them rather than the line box.
   0.37em = centre of the asterisks below the top of the number (measured), at the number's size. */
.hero-value-row { align-items: flex-start; }
.money-eye { width: 36px; height: 36px; font-size: 2.6rem; margin-top: calc(0.2em - 18px); }  /* 0.2em = centre of Newsreader's asterisks below the number's top */
.money-eye svg { width: 18px; height: 18px; }
/* Account filter sizes to its label (set in JS); this is just the fallback */
.act-acct { width: auto; min-width: 0; }
@media (min-width: 900px) { .act-acct { max-width: 280px; } }

/* Disconnect sheet: two clear choices */
.disc-options { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 12px; }
.disc-option { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; min-height: 44px; text-align: left; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-card); color: var(--text); font: inherit; cursor: pointer; }
.disc-option b { font-size: 1rem; font-weight: 600; }
.disc-option span { font-size: 0.8125rem; color: var(--text-muted); line-height: 1.45; }
.disc-option.danger b { color: var(--danger); }
.disc-option:disabled { opacity: 0.5; cursor: default; }
#disconnect-sheet .delete-btn, #purge-sheet .delete-btn { width: 100%; margin-bottom: 8px; }
/* Closed accounts in Settings */
.closed-row { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 14px; border-top: 1px solid var(--border); }
.closed-row .set-row-text { flex: 1; min-width: 0; }
.closed-del { flex: none; min-height: 44px; padding: 0 4px; border: 0; background: none; color: var(--danger); font: inherit; font-size: 0.875rem; font-weight: 600; cursor: pointer; }

/* Budget sheet: a bills table, like a notes-app list */
.budget-head { display: flex; justify-content: space-between; gap: 12px; }
.budget-help { margin: 4px 0 12px; font-size: 0.875rem; color: var(--text-muted); line-height: 1.45; }

/* Spent vs made, in one sentence */
.act-net { font-size: 0.875rem; color: var(--text-muted); }
.act-net b { font-weight: 600; }
.act-net b.good { color: var(--success); }
.act-net b.bad { color: var(--danger); }
/* Budget sheet sections */
.act-net b:not(.good):not(.bad) { color: var(--text); }

/* Home chart colour follows the change since the start of the range */
.home-chart { color: var(--success); }
.home-chart.is-down { color: var(--danger); }
.home-chart .home-trend-dot { background: currentColor; }
.home-trend-base { position: absolute; left: 0; right: 0; height: 0; border-top: 2px dotted color-mix(in srgb, var(--text-muted) 45%, transparent); pointer-events: none; }

/* Appearance: Adaptive explanation under the switch */
.theme-note { margin: 10px 2px 0; font-size: 0.8125rem; color: var(--text-muted); line-height: 1.45; }
.theme-note[hidden] { display: none; }
.theme-loc { display: inline-flex; align-items: center; min-height: 44px; padding: 0; border: none; background: none; color: var(--accent); font: inherit; font-weight: 500; cursor: pointer; text-align: left; }

/* Activity: when bank data was last pulled, beside "Spent" */
.act-spent-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.act-updated { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Settings > Notifications */
/* Minimum amount: a plain value on the right like iOS Settings, no box. "Any" when empty, "$25" when set */
.notif-min { display: inline-flex; align-items: baseline; justify-content: flex-end; gap: 1px; flex: 0 0 auto; color: var(--text); font-size: 1rem; font-variant-numeric: tabular-nums; }
.notif-min:has(.app-input:placeholder-shown) > span:first-child { display: none; }
#notif-group .notif-min .app-input { width: 3.5ch; max-width: 9ch; min-height: 0; height: auto; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; color: inherit; font: inherit; text-align: right; font-variant-numeric: tabular-nums; }
#notif-group .notif-min .app-input:focus { outline: none; box-shadow: none; background: transparent; }
#notif-group .notif-min .app-input::placeholder { color: var(--text-muted); opacity: 1; }
#notif-options[hidden], #notif-enable[hidden] { display: none; }
.notif-device { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 10px 16px; border-top: 1px solid var(--border); }
.notif-device .set-hint { display: block; }
.notif-device-actions { display: flex; gap: 14px; flex: 0 0 auto; }
.notif-device button { min-height: 44px; padding: 0 2px; border: none; background: none; font: 500 0.9375rem 'Inter', sans-serif; cursor: pointer; }
.notif-test { color: var(--accent); }
.notif-remove { color: var(--text-muted); }

/* ================================
   SETTINGS: compact list + pages
   ================================ */
.set-profile-card { display: flex; align-items: center; gap: 14px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; }
.set-profile-card .set-avatar-btn .settings-avatar { width: 52px; height: 52px; }
.set-profile-who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.set-profile-who b { font-size: 1.0625rem; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-profile-who .set-hint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-edit-profile { flex-shrink: 0; min-height: 36px; padding: 0 16px; border-radius: 18px; border: none; background: var(--accent-subtle); color: var(--accent); font: 600 0.875rem 'Inter', sans-serif; cursor: pointer; }
.set-profile-card + .set-nav-group { margin-top: 12px; }
.set-nav-group + .set-nav-group { margin-top: 12px; }
.set-email-val { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.set-nav { display: flex; align-items: center; width: 100%; padding: 8px 14px; box-sizing: border-box; border: none; border-top: 1px solid var(--border); background: transparent; color: var(--text); font: 400 0.9375rem 'Inter', sans-serif; text-align: left; text-decoration: none; cursor: pointer; }
.set-nav:first-child { border-top: none; }
.set-nav-icon { flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--accent-subtle); color: var(--accent); }
.set-nav-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.set-nav-text .set-hint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-nav-text .set-hint:empty { display: none; }
.set-nav-chev { flex-shrink: 0; color: var(--text-muted); }
.set-nav:active { background: var(--bg-elevated); }
#set-main .set-signout { margin-top: 20px; }
.set-page[hidden], #set-main[hidden] { display: none; }
.set-back { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; margin: 0 0 0 -8px; padding: 0 8px 0 0; border: none; background: none; color: var(--accent); font: 500 1rem 'Inter', sans-serif; cursor: pointer; }
.set-page .set-heading:first-of-type { margin-top: 4px; }
.set-page .set-group + .set-heading { margin-top: 20px; }

/* Logo / card art sit level with the account name, and never make the card taller */
.account-card .account-top { gap: 10px; }
.account-card .acct-badge { align-self: flex-start; margin-top: 2px; }
.account-card .acct-badge-art { margin-top: 3px; }
.account-apy { column-gap: 6px; }

/* Appearance: three small previews under the profile card */
.theme-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 12px 0 0; }
.theme-grid button { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 8px 8px 9px; border-radius: 14px; color: var(--text-muted); font: 500 0.8125rem 'Inter', sans-serif; cursor: pointer; }
.theme-grid button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.theme-prev { position: relative; display: flex; flex-direction: column; justify-content: center; gap: 5px; width: 100%; height: 40px; padding: 0 10px; box-sizing: border-box; border-radius: 8px; overflow: hidden; box-shadow: 0 0 0 1px color-mix(in srgb, var(--text) 10%, transparent) inset; }
.theme-prev i { display: block; height: 5px; border-radius: 3px; }
.theme-prev i:first-child { width: 62%; }
.theme-prev i:last-child { width: 38%; opacity: 0.6; }
.theme-prev-light { background: #E6E2D8; }
.theme-prev-light i { background: #3A3730; }
.theme-prev-dark { background: #1C1B17; }
.theme-prev-dark i { background: #DCD6CA; }
.theme-prev-adaptive { background: linear-gradient(135deg, #E6E2D8 50%, #1C1B17 50%); }
.theme-prev-adaptive i { background: #8E887B; }
#set-main .theme-note { margin: 8px 4px 0; font-size: 0.8125rem; color: var(--text-muted); line-height: 1.4; }
#set-main .theme-grid + .theme-note[hidden] + .set-nav-group, #set-main .theme-grid + .theme-note + .set-nav-group { margin-top: 16px; }

.set-intro + .set-row, .set-intro + .set-disclosure { border-top: none; }

.set-bullets { margin: 0; padding: 12px 16px 12px 32px; display: flex; flex-direction: column; gap: 5px; font-size: 0.8125rem; line-height: 1.4; color: var(--text-muted); }
.set-bullets li::marker { color: var(--accent); }
.set-bullets b { color: var(--text); font-weight: 600; font-size: inherit; }

/* Settings header: title (or back) in place of the photo and name */
.header-title, .header-back { display: none; }
.app-header.is-settings .header-user { display: none; }
.app-header.is-settings:not(.is-subpage) .header-title { display: block; margin: 0; font-family: var(--serif); font-size: 2rem; font-weight: 500; line-height: 40px; color: var(--text); }
.app-header.is-settings.is-subpage .header-back { display: inline-flex; min-height: 40px; margin: 0 0 0 -8px; }
#set-main { padding-top: 8px; }
.set-page-title { margin-top: 8px; }

/* Manual transaction: money out or in */
.add-tx-dir { display: flex; gap: 2px; padding: 3px; margin-bottom: 4px; border-radius: 10px; background: var(--bg-elevated); }
.add-tx-dir button { flex: 1; min-height: 36px; border: none; border-radius: 8px; background: transparent; color: var(--text-muted); font: 500 0.875rem 'Inter', sans-serif; cursor: pointer; }
.add-tx-dir button[aria-pressed="true"] { background: var(--accent-subtle); color: var(--accent); font-weight: 600; box-shadow: inset 0 0 0 1px var(--accent); }

/* Transactions your bank removed: set aside for you to review */
.txs-removed { margin: 4px 0 12px; padding: 12px 14px; border-radius: 12px; background: var(--bg-elevated); display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.txs-removed p { margin: 0; font-size: 0.8125rem; line-height: 1.45; color: var(--text-muted); }
.txs-removed b { color: var(--text); font-weight: 600; }

/* Two-step sign-in */
#mfa-code { text-align: center; letter-spacing: 0.3em; font-variant-numeric: tabular-nums; }
#btn-mfa-toggle { white-space: nowrap; }
.mfa-trust input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; }
.signin-links { display: flex; justify-content: center; align-items: center; gap: 8px; color: var(--text-muted); font-size: 0.8125rem; }
.signin-links a { min-height: 44px; display: inline-flex; align-items: center; padding: 0 6px; }

/* Budget table: net pay on top, one row per budget, what's left at the bottom. Compact, so the
   whole sheet fits on a phone screen without scrolling */
.budget-sheet { padding-top: 1.1rem; }
.budget-sheet .delete-title { margin-bottom: 0; }
/* Tinted chips, like highlighted text in a note */
.budget-add { display: flex; flex-direction: column; gap: 6px; }
.budget-add-row { display: flex; }
/* The select sits inside the in-app picker's wrapper, so size the wrapper, not the select */
.budget-add-row > .picker-wrap { flex: 0 0 38%; min-width: 0; }
.budget-add .app-select { width: 100%; min-width: 0; min-height: 44px; font-size: max(16px, 1rem); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.budget-add .app-input { width: 100%; min-height: 44px; padding: 0 12px; }
.budget-add-amt { flex: 1 1 auto; display: flex; align-items: center; gap: 4px; min-width: 0; min-height: 44px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-input); color: var(--text-muted); }
.budget-add-amt input { flex: 1; width: 100%; min-width: 0; border: 0; background: transparent; color: var(--text); font: inherit; font-size: max(16px, 1rem); outline: none; }
.budget-add .btn-primary { flex: 0 0 auto; width: auto; min-width: 60px; padding: 0 14px; }
.budget-add-avg { font-size: 0.75rem; color: var(--text-muted); }
.budget-add-avg:empty { display: none; }
.budget-head { align-items: center; }
.budget-copy { flex: none; min-height: 36px; padding: 0 12px; border-radius: 999px; color: var(--text); font: 600 0.8125rem 'Inter', sans-serif; white-space: nowrap; cursor: pointer; }
.budget-copy.confirm { border-color: var(--warning); color: var(--warning); }
.budget-copy:disabled { border-color: transparent; background: none; padding-right: 0; color: var(--text-muted); font-weight: 500; cursor: default; }

/* Billing page: which of your banks already pay for each kind of account */
.billing-yours { display: flex; flex-direction: column; gap: 6px; padding: 12px 16px 14px; border-top: 1px solid var(--border); font-size: 0.8125rem; line-height: 1.45; color: var(--text-muted); }
.billing-yours > b { font-size: 0.9375rem; font-weight: 600; color: var(--text); }
.billing-yours span b { color: var(--text); font-weight: 600; }

.budget-table { margin: 12px 0 16px; }

/* ==========================================================================
   Design refresh: sheets, popups and Settings share one look.
   Sheet = a calm surface; content sits in lighter grouped lists (no outlines),
   section labels are small caps, inputs are filled, buttons are flat.
   ========================================================================== */
:root { --sheet-bg: #E9E5DC; --group-bg: #F6F3EC; --hairline: color-mix(in srgb, var(--text) 10%, transparent); }
:root[data-theme="dark"] { --sheet-bg: #201E1A; --group-bg: #2B2924; }

/* Surfaces */
.action-sheet, .modal-card { background: var(--sheet-bg); border: none; box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.12); }
.action-sheet { border-radius: 24px 24px 0 0; padding-left: 16px; padding-right: 16px; }
.action-sheet::before { width: 40px; height: 5px; border-radius: 3px; margin-bottom: 14px; background: color-mix(in srgb, var(--text) 18%, transparent); }
.action-sheet > .action-sheet-cancel { box-shadow: 0 -14px 14px var(--sheet-bg); }
.delete-title, .manage-card h3 { font-size: 1.625rem; letter-spacing: -0.01em; }

/* Grouped lists (Settings, sheets, account popup, transaction sheet, budgets) */
.set-group, .manage-group, .txs-group, .bt-group, .set-profile-card, .txs-removed { background: var(--group-bg); border: none; border-radius: 16px; }
.set-row, .set-nav, .txs-row, .manage-row { border-top: none !important; position: relative; }
.set-group > * + .set-row::before, .set-group > * + .set-nav::before, .set-group > * + .set-disclosure::before,
.manage-group > * + .manage-row::before, .txs-group > * + .txs-row::before {
  content: ''; position: absolute; top: 0; left: 16px; right: 0; height: 1px; background: var(--hairline); pointer-events: none;
}
.set-nav-group > * + .set-nav::before { left: 58px; }
.set-group > * + .set-disclosure { position: relative; border-top: none; }
.set-intro { border-bottom: 1px solid var(--hairline); }
.set-nav, .set-row { padding-left: 16px; padding-right: 16px; }
.set-nav:active, .set-row:active, .txs-row:active { background: color-mix(in srgb, var(--text) 5%, transparent); }
.txs-row { min-height: 52px; padding-left: 16px; padding-right: 14px; }

/* Section labels above groups */
.sheet-sec, .override-label { display: block; margin: 18px 4px 6px; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted); }

/* Inputs: filled, no outline until focused */
.action-sheet .app-input, .modal-card .app-input, .action-sheet .app-select, .modal-card .app-select, .budget-add-amt, .set-group .app-input {
  min-height: 48px; border: 1.5px solid transparent; border-radius: 12px; background-color: var(--group-bg); font-size: max(16px, 1rem);
}
.action-sheet .app-input:focus, .modal-card .app-input:focus, .budget-add-amt:focus-within, .set-group .app-input:focus { border-color: var(--accent); }
.set-group .app-input { background-color: var(--sheet-bg); }

/* Buttons: flat, no outlines, same height */
.btn-primary, .btn-primary-sm { border-radius: 14px; box-shadow: none; background-image: none; font-weight: 600; }
.btn-primary-sm, .btn-secondary-sm { min-height: 48px; padding: 0 18px; font-size: 1rem; }
.btn-secondary-sm, .action-sheet-cancel { border: none; border-radius: 14px; background: var(--group-bg); color: var(--text); font-weight: 600; }
.action-sheet > .action-sheet-cancel { min-height: 52px; background: var(--group-bg); font-weight: 600; }
.modal-actions { gap: 10px; }
.modal-actions > button { flex: 1; }

/* Toggle pair on the transaction sheet (Reimbursed / Ignore) */
.txs-seg { gap: 10px; margin-top: 12px; }
#tx-action-sheet .txs-seg .action-toggle { min-height: 50px; max-height: none; border: none; border-radius: 14px; background: var(--group-bg); color: var(--text); font-weight: 600; font-size: 0.9375rem; }
#tx-action-sheet .txs-seg .action-toggle.active { background: var(--accent-subtle); color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
#tx-action-sheet .txs-seg .action-toggle svg { color: var(--text-muted); }
#tx-action-sheet .txs-seg .action-toggle.active svg { color: var(--accent); }
.txs-links { margin-top: 8px; }
.txs-note textarea { padding: 14px 0; }
.txs-note textarea::placeholder { color: var(--text-muted); }
.txs-amount { margin-bottom: 18px; }

/* Account popup: title left, inline fields in a group, card designs as a strip */
.manage-card h3 { text-align: left; margin: 0; }
.manage-subtitle { text-align: left; }
.manage-group { margin-bottom: 0; }
.manage-group + .manage-group { margin-top: 12px; }
.manage-field { cursor: text; }
.manage-field > span:first-child { flex: none; font-weight: 500; }
.manage-field input { flex: 1; min-width: 0; min-height: 44px; padding: 0; border: none; background: transparent; color: var(--text); font: 500 max(16px, 1rem) 'Inter', sans-serif; text-align: right; outline: none; }
.manage-field input::placeholder { color: var(--text-muted); opacity: 0.7; }
.manage-field[hidden] { display: none; }
.manage-suffix { flex: 1; display: flex; align-items: center; justify-content: flex-end; gap: 4px; min-width: 0; color: var(--text-muted); font-size: 0.9375rem; }
.manage-suffix input { flex: 0 1 7ch; -moz-appearance: textfield; }
.manage-suffix input::-webkit-inner-spin-button, .manage-suffix input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.card-design-option { border-radius: 12px; border: none; box-shadow: 0 0 0 1px var(--hairline); }
.card-design-option.none { background: var(--group-bg); }
.card-design-option.selected { box-shadow: 0 0 0 2.5px var(--accent); }
.manage-card .modal-actions { position: sticky; bottom: -1px; margin: 16px -1.5rem -1.5rem; padding: 12px 1.5rem calc(12px + env(safe-area-inset-bottom)); background: var(--sheet-bg); border-top: 1px solid var(--hairline); }

/* Settings page */
.set-profile-card { padding: 16px; }
.set-nav { min-height: 54px; gap: 14px; }
.set-nav-icon { width: 30px; height: 30px; border-radius: 8px; }
.theme-grid button { border: none; background: var(--group-bg); box-shadow: none; }
.theme-grid button[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--accent); }
.set-signout { border: none; background: var(--group-bg); }

/* Budgets sheet bits that sit on the sheet surface */
.budget-copy { border: none; background: var(--group-bg); }
.budget-add-row { gap: 8px; }
.budget-add .btn-primary { min-height: 48px; }
.budget-sheet > .action-sheet-cancel { margin-top: 18px; }

.act-legend { display: flex; width: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.act-legend::-webkit-scrollbar { display: none; }
.act-leg-page { flex: 0 0 100%; display: flex; flex-wrap: wrap; justify-content: center; align-content: flex-start; gap: 0 4px; padding: 0 4px; scroll-snap-align: start; }
.act-leg { display: inline-flex; align-items: center; gap: 7px; min-width: 0; min-height: 40px; border: none; border-radius: 20px; background: transparent; color: var(--text); font: 500 0.875rem 'Inter', sans-serif; text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: opacity 0.2s, background 0.2s; }
.act-leg > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-leg i { flex: none; width: 9px; height: 9px; border-radius: 50%; }
.act-leg.dim { opacity: 0.4; }
.act-legend .act-empty-note { width: 100%; text-align: center; }

/* Budgets sheet (option B): one big "left each month", pay inside the line under it, then a plain list */
.budget-sheet .budget-head { margin-bottom: 4px; }
.bt-hero { display: flex; flex-direction: column; align-items: center; padding: 10px 0 20px; text-align: center; }
.bt-hero small { font-size: 0.8125rem; color: var(--text-muted); }
.bt-hero b { font-family: var(--serif); font-size: 2.75rem; font-weight: 500; line-height: 1.1; letter-spacing: -0.02em; color: var(--success); font-variant-numeric: tabular-nums; margin: 2px 0 6px; }
.bt-hero b.bad { color: var(--danger); }
.bt-pay-line { display: inline; font-size: 0.875rem; color: var(--text-muted); cursor: text; }
.bt-pay-in { display: inline-flex; align-items: baseline; margin: 0 3px; color: var(--text); font-weight: 600; border-bottom: 1.5px dashed color-mix(in srgb, var(--text) 35%, transparent); }
.bt-pay-in input { width: 8ch; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; font-size: max(16px, 0.875rem); text-align: left; outline: none; }
@supports (field-sizing: content) { .bt-pay-in input { width: auto; min-width: 3ch; field-sizing: content; } }
.bt-pay-in:focus-within { border-bottom-color: var(--accent); border-bottom-style: solid; }
.bt-group { border-radius: 16px; background: var(--group-bg); overflow: hidden; }
.bt-row { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 0 8px 0 16px; border: none; background: transparent; color: var(--text); font: 500 0.9375rem 'Inter', sans-serif; text-align: left; }
.bt-row + .bt-row::before { content: ''; position: absolute; top: 0; left: 16px; right: 0; height: 1px; background: var(--hairline); }
.bt-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bt-chip { flex: none; display: inline-flex; align-items: center; gap: 1px; min-height: 40px; padding: 0 8px; border-radius: 10px; color: var(--text-muted); font-size: max(16px, 1rem); font-variant-numeric: tabular-nums; cursor: text; }
.bt-chip input { width: 7ch; padding: 0; border: 0; background: transparent; color: var(--text); font: inherit; font-weight: 600; text-align: right; outline: none; }
@supports (field-sizing: content) { .bt-chip input { width: auto; min-width: 2ch; field-sizing: content; } }
.bt-chip:focus-within { background: var(--sheet-bg); }
.bt-pay .bt-chip input { color: var(--success); }
.bt-add-open { color: var(--accent); font-weight: 600; cursor: pointer; }
.bt-foot { margin: 8px 4px 0; font-size: 0.75rem; color: var(--text-muted); }
.budget-sheet:not(.adding) .budget-add { display: none; }
.budget-sheet .budget-add { margin-top: 4px; }
.budget-sheet .budget-table { margin-bottom: 12px; }
/* Legend page dots: same look as the account carousels on Home (small round dots, active one in green) */
.act-leg-dots { display: flex; justify-content: center; gap: 0; margin-top: -6px; }
.act-leg-dots:empty { display: none; }
.act-leg-dots button { width: 16px; height: 22px; padding: 0; border: none; background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; -webkit-tap-highlight-color: transparent; }
.act-leg-dots button::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: color-mix(in srgb, var(--text) 20%, transparent); transition: background 0.3s, transform 0.3s; }
.act-leg-dots button.on::after { background: var(--accent); transform: scale(1.35); }
.act-leg { padding: 0 10px; }
/* Account popup: compact. Title + subtitle tight, one group of rows, small card-design strip */
.manage-card h3 { font-size: 1.375rem; line-height: 1.2; }
.manage-subtitle { margin: 2px 0 12px; font-size: 0.875rem; }
.manage-group .manage-row { min-height: 50px; padding-top: 4px; padding-bottom: 4px; }
.manage-field > span:first-child { display: flex; flex-direction: column; }
.manage-field > span:first-child small { font-size: 0.6875rem; font-weight: 400; color: var(--text-muted); }
.manage-field > span:first-child small[hidden] { display: none; }
.manage-toggle > span { font-weight: 500; }
#card-design-picker-section .sheet-sec { margin-top: 14px; }
#account-edit-modal .card-design-picker { gap: 8px; padding-bottom: 4px; }
#account-edit-modal .card-design-option { flex: 0 0 88px; height: 56px; border-radius: 9px; }
.manage-card .modal-actions { margin-top: 12px; padding-top: 10px; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }

/* Activity: day bars (tap a day to filter), range under them, names-only legend below */
.act-range { display: flex; gap: 2px; border-radius: 10px; }
.act-range button { padding: 0 10px; border: none; background: transparent; color: var(--text-muted); font: 600 0.75rem 'Inter', sans-serif; cursor: pointer; }
.act-bars { --vis: 7; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin-top: 10px; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.act-bars::-webkit-scrollbar { display: none; }
.act-bar { flex: 0 0 calc(100% / var(--vis)); scroll-snap-align: start; display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 0; border: none; background: transparent; color: var(--text-muted); cursor: pointer; font: inherit; -webkit-tap-highlight-color: transparent; }
.act-bar:disabled { cursor: default; opacity: 0.35; }
.act-bar-col { position: relative; display: flex; align-items: flex-end; justify-content: center; border-radius: 8px; }
.act-bar-fill { display: flex; flex-direction: column-reverse; width: 62%; max-width: 28px; border-radius: 5px; overflow: hidden; transition: opacity 0.15s; }
.act-bar-fill i { display: block; min-height: 1px; }
.act-bar-zero { width: 62%; max-width: 28px; height: 2px; border-radius: 1px; background: var(--track); }
.act-bar-label { display: flex; flex-direction: column; align-items: center; gap: 1px; min-height: 30px; font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.act-bar-label small { font-size: 0.625rem; opacity: 0.7; }
.act-bar.today .act-bar-label { color: var(--text); font-weight: 600; }
.act-bar.on .act-bar-label { color: var(--accent); font-weight: 700; }
.act-bars.dense .act-bar-fill { width: 70%; border-radius: 2px; }
.act-bars.dense .act-bar-label { min-height: 16px; font-size: 0.625rem; }
.act-bars.dense .act-bar-col { border-radius: 4px; }
@media (hover: hover) { .act-bar:not(:disabled):hover .act-bar-col { background: color-mix(in srgb, var(--text) 5%, transparent); } }
.act-range { justify-content: center; padding: 0; background: transparent; margin-top: 4px; }
.act-range button { min-width: 44px; min-height: 36px; border-radius: 18px; box-shadow: none; }
.act-range button.on { background: var(--bg-elevated); color: var(--accent); box-shadow: none; }
.act-bar-col { height: 88px; }
.act-bar.on .act-bar-col { background: transparent; }
.act-bar.dim .act-bar-fill { opacity: 1; }
.act-bar.dim .act-bar-fill i { background: color-mix(in srgb, var(--text) 16%, transparent) !important; }
.act-bar-fill i { transition: background-color 0.2s; }
@media (hover: hover) { .act-bar.on:hover .act-bar-col { background: transparent; } }
.act-legend { margin-top: 8px; }
.act-sub b.good { color: var(--success); }
.act-sub b.bad { color: var(--danger); }
/* Card-design strip: leave room for the green "selected" outline so it's never clipped at the edges */
#account-edit-modal .card-design-picker { padding: 4px 4px 8px; margin: 0 -4px; scroll-padding-inline: 4px; }
#account-edit-modal .card-design-option { overflow: visible; }
#account-edit-modal .card-design-option .card-design-option-img { border-radius: inherit; overflow: hidden; }
/* Legend: picking a name keeps everything in place; the others just grey out */
.act-leg.on { background: transparent; font-weight: 500; }
/* "the total you made": tap to see income */
.act-made-link { display: inline; min-height: 0; padding: 0; border: none; background: none; color: inherit; font: inherit; cursor: pointer; text-decoration: underline dashed var(--success); text-decoration-thickness: 1.5px; text-underline-offset: 4px; -webkit-tap-highlight-color: transparent; }
.act-made-link:active { opacity: 0.6; }

/* ==== Transaction popup, laid out like Robinhood's transaction page ==== */
#tx-action-sheet .action-sheet { max-height: 94vh; max-height: 94dvh; }
#tx-action-sheet .txs-pen { flex: none; color: var(--text-muted); opacity: 0.7; }
#tx-action-sheet .txs-edit { display: inline-flex; align-items: center; gap: 10px; padding: 0; border: none; background: none; color: var(--text); cursor: pointer; text-align: left; -webkit-tap-highlight-color: transparent; }
/* Big amount first */
#tx-action-sheet .txs-amount { display: flex; flex-direction: column; align-items: flex-start; text-align: left; }
#tx-action-sheet .txs-amt { font: 600 2.75rem/1.05 'Inter', sans-serif; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
#tx-action-sheet .txs-amt-edit { font: 600 2.25rem 'Inter', sans-serif; display: inline-flex; align-items: baseline; gap: 2px; }
#tx-action-sheet .txs-amt-edit input { width: 7ch; font: inherit; }
#tx-action-sheet .txs-sub { font-size: 0.8125rem; color: var(--text-muted); text-align: left; }
#tx-action-sheet .txs-sub:empty { display: none; }
/* Then the name, with a small logo */
#tx-action-sheet .txs-head { display: flex; align-items: center; }
#tx-action-sheet .txs-avatar-btn { flex: none; }
#tx-action-sheet .txs-title { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
#tx-action-sheet .txs-name { font: 500 1.625rem/1.15 'Inter', sans-serif; letter-spacing: -0.015em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 62vw; }
#tx-action-sheet .txs-adj { align-self: flex-start; }
/* Then the date and time */
.txs-when-row { display: flex; align-items: center; gap: 12px; margin: 6px 4px 0; }
.txs-when { position: relative; display: inline-flex; align-items: center; gap: 8px; color: var(--text-muted); cursor: pointer; }
.txs-when input[type="date"] { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.txs-when-sub { display: block; margin: 0 4px; color: var(--text-muted); opacity: 0.85; }
/* Details grid: two columns, label over value */
.txs-facts { display: grid; grid-template-columns: 1fr 1fr; }
.txs-fact { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; padding: 0; border: none; background: none; color: var(--text); text-align: left; font: inherit; cursor: default; }
button.txs-fact { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.txs-fact-label { color: var(--text-muted); }
.txs-fact-val { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; min-width: 0; }
.txs-fact-val > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.txs-fact-val i { flex: none; width: 8px; height: 8px; border-radius: 50%; }
/* The card it was on, with your card art */
.txs-card { display: flex; align-items: center; width: 100%; border: 1px solid var(--hairline); background: var(--group-bg); color: var(--text); text-align: left; font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.txs-card[hidden] { display: none; }
.txs-card-art { flex: none; display: flex; align-items: center; justify-content: center; border-radius: 6px; background: var(--sheet-bg) center/cover no-repeat; color: var(--text-muted); font-weight: 600; box-shadow: 0 0 0 1px var(--hairline); }
.txs-card-art.is-logo { background-size: 60%; background-color: #fff; }
.txs-card-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.txs-card-text > span:first-child { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.txs-card-mask { color: var(--text-muted); }
/* Map + address + website */
.txs-places { margin: 0 4px 14px; }
.txs-places[hidden] { display: none; }
.txs-place { display: flex; align-items: center; color: var(--text); text-decoration: none; }
.txs-place[hidden] { display: none; }
.txs-place svg { flex: none; color: var(--text-muted); }
#txs-site-text { color: var(--accent); }
#tx-action-sheet .txs-group { margin-top: 4px; }

/* ==== Account popup: name with a pencil, the card big and centered (like Robinhood) ==== */
.manage-name-row { display: flex; align-items: center; min-height: 40px; }
.manage-name-btn { display: inline-flex; align-items: center; gap: 10px; max-width: 100%; padding: 0; border: none; background: none; color: var(--text); font: 500 1.625rem/1.2 var(--serif); letter-spacing: -0.01em; text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.manage-name-btn > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.manage-name-btn svg { flex: none; color: var(--text-muted); opacity: 0.75; }
.manage-name-btn[hidden], .manage-name-input[hidden] { display: none; }
.manage-name-input { width: 100%; min-height: 44px; padding: 0 12px; border: 1.5px solid var(--accent); border-radius: 12px; background: var(--group-bg); color: var(--text); font: 500 max(16px, 1.375rem) var(--serif); outline: none; }
.manage-card .manage-subtitle { margin: 2px 0 18px; }
.manage-cardview { position: relative; width: 100%; }
.manage-cardface { position: relative; aspect-ratio: 1.586; border-radius: 16px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,.18), 0 0 0 1px var(--hairline); }
.manage-cardface:not(.has-art) { display: flex; flex-direction: column; padding: 18px 20px; background-image: linear-gradient(135deg, color-mix(in srgb, var(--text) 9%, var(--group-bg)), var(--group-bg) 60%, color-mix(in srgb, var(--text) 4%, var(--group-bg))); color: var(--text); }
.mcf-bank { font-size: 0.9375rem; font-weight: 600; letter-spacing: 0.01em; }
.mcf-name { margin-top: auto; font-size: 1.0625rem; font-weight: 500; }
.mcf-mask { margin-top: 2px; font-size: 0.875rem; color: var(--text-muted); letter-spacing: 0.08em; font-variant-numeric: tabular-nums; }
.manage-details[hidden] { display: none; }
.manage-details .manage-group { margin-top: 4px; }
/* Card art is cut out with a transparent background: show it as-is, no box behind it */
.txs-card-art.is-art { background-color: transparent; background-size: contain; box-shadow: none; border-radius: 0; }
.manage-cardface.has-art { background-color: transparent; background-size: contain; }
/* Divider only between rows that are actually shown */
.txs-place + .txs-place { border-top: none; }
.txs-place:not([hidden]) ~ .txs-place:not([hidden]) { border-top: 1px solid var(--hairline); }
/* Transaction popup, tighter so the map shows without scrolling */
#tx-action-sheet .txs-amount { margin: 0 4px 2px; gap: 2px; }
#tx-action-sheet .txs-amt { font-size: 2.25rem; }
#tx-action-sheet .txs-head { margin: 4px 4px 0; gap: 10px; }
#tx-action-sheet .txs-avatar { width: 32px; height: 32px; font-size: 0.875rem; }
#tx-action-sheet .txs-name { font-size: 1.375rem; }
.txs-when-row { margin-top: 2px; }
.txs-when { min-height: 28px; font-size: 0.9375rem; }
.txs-when-sub { font-size: 0.6875rem; }
.txs-facts { gap: 12px 16px; margin: 14px 4px 12px; }
.txs-fact { gap: 2px; }
.txs-fact-label { font-size: 0.75rem; }
.txs-fact-val { font-size: 0.9375rem; }
.txs-card { padding: 10px 14px 10px 10px; margin-bottom: 10px; border-radius: 14px; gap: 12px; }
.txs-card-art { width: 60px; height: 38px; }
.txs-card-text > span:first-child { font-size: 0.9375rem; }
.txs-card-mask { font-size: 0.8125rem; }
.txs-places { margin-bottom: 10px; }
.txs-place { min-height: 46px; font-size: 0.9375rem; gap: 14px; }
/* Account popup card: fills the width so its edges line up with the text; tap to flip */
.manage-cardview { max-width: none; margin: 0 0 6px; perspective: 1200px; }
.manage-cardface { display: block; width: 100%; padding: 0; border: none; background: none; cursor: pointer; transform-origin: center; -webkit-tap-highlight-color: transparent; }
.manage-cardface[hidden] { display: none; }
.manage-cardface.has-art { aspect-ratio: auto; border-radius: 0; box-shadow: none; overflow: visible; filter: none; background: none; }
.manage-cardface.has-art img { display: block; width: 100%; height: auto; filter: drop-shadow(0 10px 18px rgba(0,0,0,.2)); pointer-events: none; }
.manage-cardface:not(.has-art) { text-align: left; font: inherit; }
.mcf-mask { padding-bottom: 0; }
.manage-hint { margin: 8px 0 14px; text-align: center; font-size: 0.75rem; color: var(--text-muted); }
.manage-hint[hidden] { display: none; }
.flip-out { animation: card-flip-out 0.17s ease-in forwards; }
.flip-in { animation: card-flip-in 0.24s ease-out; }
@keyframes card-flip-out { to { transform: rotateY(90deg); opacity: 0.6; } }
@keyframes card-flip-in { from { transform: rotateY(-90deg); opacity: 0.6; } to { transform: none; opacity: 1; } }
.hint-tilt { animation: card-hint 0.9s ease-in-out 0.35s 1; }
@keyframes card-hint { 0%, 100% { transform: none; } 35% { transform: rotateY(-14deg); } 70% { transform: rotateY(6deg); } }
@media (prefers-reduced-motion: reduce) { .hint-tilt, .flip-out, .flip-in { animation: none; } }
/* Back of the card: a small card to flip back, then the details */
.manage-details { transform-origin: center; }
.manage-back-head { display: flex; align-items: center; gap: 12px; width: 100%; margin-bottom: 10px; padding: 10px 12px; border: none; border-radius: 14px; background: var(--group-bg); color: var(--text); text-align: left; font: inherit; cursor: pointer; }
.manage-back-thumb { flex: none; display: flex; align-items: center; justify-content: center; width: 54px; height: 34px; border-radius: 5px; background: var(--sheet-bg); color: var(--text-muted); font-weight: 600; box-shadow: 0 0 0 1px var(--hairline); }
.manage-back-thumb.has-art { background: none; box-shadow: none; }
.manage-back-thumb img { width: 100%; height: 100%; object-fit: contain; }
.manage-back-text { display: flex; flex-direction: column; }
.manage-back-text span { font-weight: 600; }
.manage-back-text small { font-size: 0.75rem; color: var(--text-muted); }

/* Set before the first paint when reopening with Face ID: lock screen up, sign-in page never shown */
html.boot-locked #lock-screen[hidden] { display: flex !important; }
html.boot-locked #screen-login { visibility: hidden; }

/* ---- Transaction popup: one Edit button, everything editable at once ---- */
#tx-action-sheet .action-sheet { position: relative; }
.txs-edit-toggle { position: absolute; top: 12px; right: 12px; z-index: 2; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 44px; height: 44px; padding: 0 12px; border: none; border-radius: 22px; background: transparent; color: var(--text-muted); font: 500 0.9375rem 'Inter', sans-serif; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.txs-edit-toggle span { display: none; }
.txs-edit-toggle.is-on svg { display: none; }
.txs-edit-toggle.is-on span { display: inline; color: var(--text); }
/* Viewing: nothing looks or acts editable */
#tx-action-sheet .action-sheet:not(.is-editing) .txs-pen,
#tx-action-sheet .action-sheet:not(.is-editing) .txs-avatar-badge { display: none; }
#tx-action-sheet .action-sheet:not(.is-editing) .txs-edit,
#tx-action-sheet .action-sheet:not(.is-editing) .txs-avatar-btn,
#tx-action-sheet .action-sheet:not(.is-editing) button.txs-fact,
#tx-action-sheet .action-sheet:not(.is-editing) .txs-when { pointer-events: none; cursor: default; }
#tx-action-sheet .action-sheet:not(.is-editing) #tx-date-reset { display: none; }
/* Editing: same layout as viewing. Everything you can change just gets a small grey pencil
   next to it; the amount and name are typed right where they show. */
#tx-action-sheet .is-editing .txs-pen { opacity: 1; color: var(--text-muted); cursor: pointer; }
#tx-action-sheet .is-editing .txs-input { min-width: 2ch; max-width: 100%; min-height: 0; padding: 0; border: none; border-radius: 0; background: transparent; color: var(--text); font: inherit; letter-spacing: inherit; outline: none; caret-color: var(--accent); }
#tx-action-sheet .is-editing .txs-amt-edit { display: inline-flex; align-items: center; gap: 0; max-width: 100%; font: 600 2.25rem/1.05 'Inter', sans-serif; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; color: var(--text); }
#tx-action-sheet .is-editing .txs-amt-edit .txs-pen { margin-left: 10px; }
#tx-action-sheet .txs-name-edit { display: inline-flex; align-items: center; gap: 10px; min-width: 0; max-width: 100%; font: 500 1.375rem/1.15 'Inter', sans-serif; letter-spacing: -0.015em; color: var(--text); }
#tx-action-sheet .txs-name-edit[hidden] { display: none; }
#tx-action-sheet .txs-name-edit .txs-pen { flex: none; }
#tx-action-sheet .is-editing .txs-seg { display: none; }
#tx-action-sheet .is-editing .txs-card { pointer-events: none; }
/* "Undo all my changes" only lives in edit mode, as a quiet red row under the note */
#tx-action-sheet .action-sheet:not(.is-editing) .action-option-clear { display: none !important; }
#tx-action-sheet .is-editing #btn-delete-tx { display: none !important; }
#tx-action-sheet .is-editing .txs-links { display: block; margin-top: 4px; }
#tx-action-sheet .is-editing .action-option-clear { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 48px; border-radius: 14px; background: var(--group-bg); color: var(--danger) !important; font: 500 1rem 'Inter', sans-serif; text-decoration: none; }
#tx-action-sheet .action-sheet-cancel.is-save { background: var(--accent); color: var(--on-accent); font-weight: 600; box-shadow: none; }
#tx-action-sheet .action-sheet { padding-top: 14px; }
#tx-action-sheet .txs-amount { padding-right: 56px; }
/* Unsaved-changes prompt */
.txs-confirm { position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(0, 0, 0, 0.45); }
.txs-confirm[hidden] { display: none !important; }
.txs-confirm-card { width: 100%; max-width: 300px; padding: 20px 16px 12px; border-radius: 18px; background: var(--sheet-bg); text-align: center; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35); }
.txs-confirm-title { margin: 0 0 6px; font-size: 1.0625rem; font-weight: 600; color: var(--text); }
.txs-confirm-text { margin: 0 0 16px; font-size: 0.875rem; color: var(--text-muted); }
.txs-confirm-btn { display: block; width: 100%; min-height: 44px; margin-top: 8px; border: none; border-radius: 12px; background: var(--group-bg); color: var(--text); font: 500 1rem 'Inter', sans-serif; cursor: pointer; }
.txs-confirm-btn.is-save { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.txs-confirm-btn.is-discard { color: var(--danger); }
.txs-confirm-btn.is-danger { background: var(--danger); color: #fff; font-weight: 600; }
#tx-action-sheet .txs-name-edit .txs-input { max-width: calc(100% - 26px); text-overflow: ellipsis; }

/* ---- Two-step sign-in: code entry and setup ---- */
.signin-mfa-title { margin: 0; font-family: var(--serif); font-size: 1.5rem; font-weight: 500; line-height: 1.2; color: var(--text); text-align: center; }
.signin-mfa-sub { margin: 0 0 6px; font-size: 0.875rem; color: var(--text-muted); text-align: center; }
/* Digits get a little room; the placeholder stays normal text (no "6 - d i g i t") */
.mfa-code-input, #mfa-code { text-align: center; font: 600 1.5rem 'Inter', sans-serif !important; letter-spacing: 0.32em !important; font-variant-numeric: tabular-nums; padding-left: 0.32em !important; }
.mfa-code-input::placeholder, #mfa-code::placeholder { font-size: 1rem; font-weight: 400; letter-spacing: normal; color: var(--text-muted); }
.mfa-trust { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; font-size: 0.9375rem; color: var(--text); cursor: pointer; }
.mfa-trust .set-switch { flex: none; width: 46px !important; height: 28px !important; min-height: 0 !important; margin: 0 !important; padding: 0 !important; border: none !important; border-radius: 14px !important; background: var(--track) !important; box-shadow: none !important; }
.mfa-trust .set-switch:checked { background: var(--accent) !important; }
.mfa-enroll { padding: 6px 16px 16px; display: flex; flex-direction: column; align-items: stretch; gap: 12px; border-top: 1px solid var(--hairline); }
.mfa-step { display: flex; align-items: center; gap: 10px; margin: 8px 0 0; font-size: 0.9375rem; font-weight: 500; line-height: 1.35; color: var(--text); }
.mfa-num { flex: none; width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); font-size: 0.8125rem; font-weight: 600; }
.mfa-add { display: flex; align-items: center; justify-content: center; min-height: 48px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); font-weight: 600; text-decoration: none; }
.mfa-or { margin: 2px 0 0; font-size: 0.8125rem; color: var(--text-muted); text-align: center; }
.mfa-qr { align-self: center; width: 156px; height: 156px; background: #fff; border-radius: 14px; padding: 10px; box-sizing: border-box; }
.mfa-key { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 52px; padding: 10px 14px; border: none; border-radius: 14px; background: var(--bg-input); color: var(--text); cursor: pointer; text-align: left; -webkit-tap-highlight-color: transparent; }
.mfa-key code { flex: 1; min-width: 0; font: 500 0.9375rem ui-monospace, 'SF Mono', Menlo, monospace; letter-spacing: 0.02em; word-break: break-all; user-select: all; -webkit-user-select: all; }
.mfa-key-copy { flex: none; display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-size: 0.875rem; font-weight: 600; }
.mfa-key.copied .mfa-key-copy { color: var(--success, var(--accent)); }
.mfa-enroll .mfa-code-input { min-height: 52px; }
.mfa-enroll .btn-primary { margin-top: 2px; }
.mfa-cancel { align-self: center; min-height: 44px; }

/* ---- Two-step: can't get your code? (sign-in) and backup codes (Settings) ---- */
.mfa-mode { display: flex; flex-direction: column; gap: 12px; }
.mfa-mode[hidden] { display: none !important; }
.mfa-help { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--hairline); }
.mfa-help-title { margin: 0 0 2px; font-size: 0.8125rem; color: var(--text-muted); text-align: center; }
.mfa-alt { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 48px; border: none; border-radius: 14px; background: var(--group-bg); color: var(--text); font: 500 0.9375rem 'Inter', sans-serif; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.mfa-alt svg { color: var(--accent); flex: none; }
.mfa-back { align-self: center; min-height: 44px; }
.btn-secondary-full { width: 100%; min-height: 48px; border: none; border-radius: 14px; background: var(--group-bg); color: var(--text); font: 600 1rem 'Inter', sans-serif; cursor: pointer; }
.mfa-backup-input { text-align: center; font: 600 1.375rem ui-monospace, 'SF Mono', Menlo, monospace !important; letter-spacing: 0.08em !important; text-transform: uppercase; }
.mfa-backup-input::placeholder { font: 400 1rem 'Inter', sans-serif; letter-spacing: normal; text-transform: none; color: var(--text-muted); }
/* Settings */
.mfa-backup { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px 16px; border-top: 1px solid var(--hairline); }
.mfa-backup-head { gap: 12px; }
.mfa-backup-note { margin: 0; font-size: 0.8125rem; line-height: 1.45; color: var(--text-muted); }
.mfa-backup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mfa-bcode { display: flex; align-items: center; justify-content: center; min-height: 40px; border-radius: 10px; background: var(--bg-input); color: var(--text); font: 500 0.9375rem ui-monospace, 'SF Mono', Menlo, monospace; letter-spacing: 0.04em; user-select: all; -webkit-user-select: all; }
.mfa-bcode.used { color: var(--text-muted); opacity: 0.45; text-decoration: line-through; user-select: none; -webkit-user-select: none; }
.mfa-backup-loading { grid-column: 1 / -1; margin: 6px 0; font-size: 0.8125rem; color: var(--text-muted); text-align: center; }
.mfa-backup-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mfa-backup-btn { min-height: 44px; border: none; border-radius: 12px; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); font: 600 0.875rem 'Inter', sans-serif; cursor: pointer; }

/* Red reminder after a recovery turned two-step off */
.mfa-warn { margin: 0 16px 14px; padding: 12px 14px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent); background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); font-size: 0.875rem; line-height: 1.45; }
.mfa-warn[hidden] { display: none !important; }
.mfa-warn p { margin: 0; }
.mfa-warn p + p { margin-top: 6px; }
.mfa-warn .mfa-warn-title { font-weight: 600; font-size: 0.9375rem; }

/* Backup codes: a tap-to-open row */
.mfa-backup-head { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 44px; padding: 0; border: none; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.mfa-backup-chev { color: var(--text-muted); transition: transform 0.2s ease; }
.mfa-backup-head[aria-expanded="true"] .mfa-backup-chev { transform: rotate(180deg); }
.mfa-backup-body { display: flex; flex-direction: column; gap: 10px; }
.mfa-backup-body[hidden] { display: none !important; }

/* Backup codes row matches the other Settings rows; three actions */
.mfa-backup-head .set-row-text { flex: 1; min-width: 0; }
.mfa-backup-head .mfa-backup-chev { flex: none; margin-left: 12px; }
.mfa-backup-head { margin: -4px 0; }
.mfa-backup-actions .mfa-backup-new { grid-column: 1 / -1; }
.mfa-backup-btn { padding: 0 10px; line-height: 1.2; }

/* The card row in a transaction is information only */
#tx-action-sheet .txs-card { cursor: default; pointer-events: none; -webkit-tap-highlight-color: transparent; }

/* Swipe a transaction: left = Ignore, right = Reimbursed */
.act-row.is-swiping { position: relative; z-index: 1; background: var(--bg); transition: none; will-change: transform; }
.swipe-back { position: absolute; left: 0; right: 0; z-index: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; border-radius: 0; background: var(--bg-elevated); color: var(--text-muted); transition: background 0.18s, color 0.18s; pointer-events: none; }
.swipe-act { display: inline-flex; align-items: center; gap: 8px; font-size: 0.875rem; font-weight: 600; opacity: 0; transition: transform 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.4); }
.swipe-back[data-side="reimb"] .swipe-ignore, .swipe-back[data-side="ignore"] .swipe-reimb { visibility: hidden; }
.swipe-back[data-side="reimb"] { background: color-mix(in srgb, var(--accent) 16%, var(--bg)); color: var(--accent); }
.swipe-back[data-side="ignore"] { background: color-mix(in srgb, var(--text-muted) 16%, var(--bg)); color: var(--text-muted); }
.swipe-back[data-side="reimb"].is-armed { background: var(--accent); color: var(--bg); }
.swipe-back[data-side="ignore"].is-armed { background: var(--text-muted); color: var(--bg); }
.swipe-back.is-armed .swipe-act { transform: scale(1.08); }

/* Cards in the bank's own colors (no card art yet) */
.acct-badge.acct-badge-bank { position: relative; width: 68px; height: 43px; border-radius: 6px; margin-top: 3px; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08); }
.acct-bank-logo { position: absolute; top: 6px; left: 6px; width: 16px; height: 16px; border-radius: 4px; background: #FFFFFF center / 82% no-repeat; }
.txs-card-art.is-bank { position: relative; background-size: auto; }
.txs-card-art.is-bank .acct-bank-logo { top: 5px; left: 5px; width: 14px; height: 14px; }

/* Pull to refresh on Home: the Alenjo logo in the top right grows as you pull, then pulses */
.header-logo.ptr-armed { filter: saturate(1.15); }
.header-logo.ptr-pulsing { animation: ptrPulse 1.1s ease-in-out infinite; }
@keyframes ptrPulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(0.86); opacity: 0.55; } }
@media (prefers-reduced-motion: reduce) { .header-logo.ptr-pulsing { animation: ptrFade 1.2s ease-in-out infinite; } @keyframes ptrFade { 50% { opacity: 0.4; } } }

/* Bank-color cards: last four on the small card; the big card in the account popup */
.acct-bank-mask { position: absolute; left: 7px; bottom: 6px; font-size: 8px; line-height: 1; font-weight: 600; letter-spacing: 0.04em; color: rgba(255,255,255,0.9); font-variant-numeric: tabular-nums; }
.manage-cardface.is-bank { background-image: none; color: #FFFFFF; }
.manage-cardface.is-bank .mcf-bank { display: flex; align-items: center; gap: 10px; }
.manage-cardface.is-bank .mcf-mask { color: rgba(255,255,255,0.85); }
.mcf-logo { width: 30px; height: 30px; flex-shrink: 0; border-radius: 8px; background: #FFFFFF center / 80% no-repeat; }
.manage-back-thumb { position: relative; }
.manage-back-thumb .acct-bank-logo { top: 50%; left: 50%; transform: translate(-50%, -50%); }

/* Request your share of a split on Venmo */
.txs-venmo { display: flex; align-items: center; gap: 12px; min-height: 52px; margin: 12px 0 0; padding: 0 16px; border-radius: 14px; background: var(--group-bg); color: var(--text); font-weight: 600; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.txs-venmo[hidden] { display: none; }
.txs-venmo:active { opacity: 0.7; }
.txs-venmo svg { margin-left: auto; color: var(--text-muted); }
.txs-venmo-mark { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 8px; background: #3D95CE; color: #FFFFFF; font-weight: 800; font-style: italic; font-size: 16px; }
#history-sheet .history-later { margin: 0 0 6px; font-size: 0.8125rem; text-align: center; }
.history-rec { margin-left: 8px; padding: 2px 8px; border-radius: 999px; background: var(--accent); color: var(--bg); font: 600 0.6875rem 'Inter', sans-serif; font-style: normal; vertical-align: 2px; }
.disc-option .history-warn { color: var(--danger); font-weight: 500; }
.disc-option.is-rec { border-color: var(--accent); }
