/* Warikan Redesign — design tokens (glass) */
:root {
  color-scheme: light;
  --bg: #eaf3f0;
  --bg-2: #e1ece8;
  --bg-3: #f0e4dc;
  --surface: rgba(255, 255, 255, 0.62);
  --surface-2: rgba(255, 255, 255, 0.42);
  --surface-3: rgba(255, 255, 255, 0.78);
  --glass-strong: rgba(255, 255, 255, 0.92);
  --ink: #14213d;
  --ink-2: #3a4651;
  --muted: #5f6f7a;
  --line: rgba(20, 33, 61, 0.12);
  --line-2: rgba(20, 33, 61, 0.2);

  --brand: #0f766e;
  --brand-2: #2dd4bf;
  --brand-rgb: 15, 118, 110;
  --brand-soft: rgba(15, 118, 110, 0.1);
  --brand-soft-2: rgba(15, 118, 110, 0.18);

  --accent: #c2410c;
  --accent-soft: rgba(194, 65, 12, 0.1);

  --ok: #059669;
  --ok-soft: rgba(5, 150, 105, 0.12);
  --danger: #e11d48;
  --danger-rgb: 225, 29, 72;
  --danger-soft: rgba(225, 29, 72, 0.1);

  --gradient-1: rgba(20, 184, 166, 0.22);
  --gradient-2: rgba(244, 114, 89, 0.16);
  --gradient-3: rgba(59, 130, 246, 0.12);
  --inner-glow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  --glass-border: 1px solid rgba(255, 255, 255, 0.7);
  --topbar-border: rgba(255, 255, 255, 0.45);
  --control-shadow: inset 0 1px 0 rgba(255,255,255,0.4), 0 4px 12px rgba(15,23,42,0.04);
  --control-focus-inset: inset 0 1px 0 rgba(255,255,255,0.5);
  --node-shadow: drop-shadow(0 8px 14px rgba(15, 23, 42, 0.18));
  --dock-sheen-opacity: 0.7;

  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --shadow-1: 0 4px 14px rgba(15, 23, 42, 0.06);
  --shadow-2: 0 14px 34px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(15, 23, 42, 0.05);
  --shadow-3: 0 24px 70px rgba(15, 23, 42, 0.16), 0 8px 22px rgba(15, 23, 42, 0.08);

  --topbar-bg-top: rgba(234, 243, 240, 0.84);
  --topbar-bg-bottom: rgba(234, 243, 240, 0.58);

  --motion-fast: 120ms;
  --motion-base: 180ms;
  --motion-page: 260ms;
  --motion-data: 420ms;
  --ease-standard: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-emphasized: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", sans-serif;
  --font-display: "Instrument Serif", "Times New Roman", serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #08111f;
  --bg-2: #0e1c2d;
  --bg-3: #1a1430;
  --surface: rgba(16, 31, 51, 0.68);
  --surface-2: rgba(255, 255, 255, 0.06);
  --surface-3: rgba(32, 50, 76, 0.85);
  --glass-strong: rgba(32, 50, 76, 0.95);
  --ink: #f7fafc;
  --ink-2: #d8dee5;
  --muted: #a8b7c7;
  --line: rgba(198, 213, 230, 0.16);
  --line-2: rgba(198, 213, 230, 0.26);

  --brand: #2dd4bf;
  --brand-2: #5eead4;
  --brand-rgb: 45, 212, 191;
  --brand-soft: rgba(45, 212, 191, 0.14);
  --brand-soft-2: rgba(45, 212, 191, 0.24);

  --accent: #fb7185;
  --accent-soft: rgba(251, 113, 133, 0.14);

  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.14);
  --danger: #f87171;
  --danger-rgb: 248, 113, 113;
  --danger-soft: rgba(248, 113, 113, 0.14);

  --gradient-1: rgba(45, 212, 191, 0.16);
  --gradient-2: rgba(251, 113, 133, 0.1);
  --gradient-3: rgba(96, 165, 250, 0.1);
  --inner-glow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  --glass-border: 1px solid rgba(198, 213, 230, 0.18);
  --topbar-border: rgba(198, 213, 230, 0.12);
  --control-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 8px 18px rgba(0,0,0,0.22);
  --control-focus-inset: inset 0 1px 0 rgba(255,255,255,0.12);
  --node-shadow: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.42));
  --dock-sheen-opacity: 0.35;

  --shadow-1: 0 4px 14px rgba(0, 0, 0, 0.3);
  --shadow-2: 0 14px 34px rgba(0, 0, 0, 0.45);
  --shadow-3: 0 30px 80px rgba(0, 0, 0, 0.6);

  --topbar-bg-top: rgba(8, 17, 31, 0.90);
  --topbar-bg-bottom: rgba(8, 17, 31, 0.68);
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    color-scheme: dark;
    --bg: #08111f;
    --bg-2: #0e1c2d;
    --bg-3: #1a1430;
    --surface: rgba(16, 31, 51, 0.68);
    --surface-2: rgba(255, 255, 255, 0.06);
    --surface-3: rgba(32, 50, 76, 0.85);
    --glass-strong: rgba(32, 50, 76, 0.95);
    --ink: #f7fafc;
    --ink-2: #d8dee5;
    --muted: #a8b7c7;
    --line: rgba(198, 213, 230, 0.16);
    --line-2: rgba(198, 213, 230, 0.26);
    --brand: #2dd4bf;
    --brand-2: #5eead4;
    --brand-rgb: 45, 212, 191;
    --brand-soft: rgba(45, 212, 191, 0.14);
    --brand-soft-2: rgba(45, 212, 191, 0.24);
    --accent: #fb7185;
    --accent-soft: rgba(251, 113, 133, 0.14);
    --ok: #34d399;
    --ok-soft: rgba(52, 211, 153, 0.14);
    --danger: #f87171;
    --danger-rgb: 248, 113, 113;
    --danger-soft: rgba(248, 113, 113, 0.14);
    --gradient-1: rgba(45, 212, 191, 0.16);
    --gradient-2: rgba(251, 113, 133, 0.1);
    --gradient-3: rgba(96, 165, 250, 0.1);
    --inner-glow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    --glass-border: 1px solid rgba(198, 213, 230, 0.18);
    --topbar-border: rgba(198, 213, 230, 0.12);
    --control-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 8px 18px rgba(0,0,0,0.22);
    --control-focus-inset: inset 0 1px 0 rgba(255,255,255,0.12);
    --node-shadow: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.42));
    --dock-sheen-opacity: 0.35;
    --shadow-1: 0 4px 14px rgba(0, 0, 0, 0.3);
    --shadow-2: 0 14px 34px rgba(0, 0, 0, 0.45);
    --shadow-3: 0 30px 80px rgba(0, 0, 0, 0.6);
    --topbar-bg-top: rgba(8, 17, 31, 0.90);
    --topbar-bg-bottom: rgba(8, 17, 31, 0.68);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow: hidden; height: 100%; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
#root { height: 100%; }

body {
  background:
    radial-gradient(circle at 12% 18%, var(--gradient-1), transparent 42%),
    radial-gradient(circle at 88% 8%, var(--gradient-2), transparent 38%),
    radial-gradient(circle at 78% 92%, var(--gradient-3), transparent 44%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
  touch-action: manipulation;
}
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1;
  background:
    linear-gradient(120deg, transparent 0 22%, rgba(var(--brand-rgb), 0.05) 22% 36%, transparent 36% 100%);
  pointer-events: none;
  animation: glassFlow 22s ease-in-out infinite alternate;
}
@keyframes glassFlow {
  from { transform: translate3d(-2%, -1%, 0) scale(1); }
  to   { transform: translate3d(2%, 1%, 0) scale(1.04); }
}

body.modal-open { overflow: hidden; }

/* Seal safe-area gaps so no raw background shows at screen edges */
body::after {
  content: "";
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: env(safe-area-inset-bottom);
  background: var(--bg);
  z-index: -1;
  pointer-events: none;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
  margin: 0;
  border: 0;
  background: transparent;
  touch-action: manipulation;
}

button { cursor: pointer; }

input::placeholder, textarea::placeholder { color: var(--muted); }

/* Layout shell */
.shell {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
}

.app {
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: calc(14px + env(safe-area-inset-top)) 0 14px;
  background: linear-gradient(180deg, var(--topbar-bg-top), var(--topbar-bg-bottom));
  backdrop-filter: blur(32px) saturate(1.8);
  -webkit-backdrop-filter: blur(32px) saturate(1.8);
  border-bottom: 1px solid var(--topbar-border);
  box-shadow: 0 1px 0 var(--line), 0 4px 24px rgba(15, 23, 42, 0.06);
}

.topbar-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1;
  box-shadow: 0 10px 24px rgba(var(--brand-rgb), 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  flex-shrink: 0;
}
.brand-mark.sm {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 15px;
  box-shadow: 0 4px 10px rgba(var(--brand-rgb), 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text .eyebrow {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.brand-text h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 22px;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.top-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }

.detail-titlebar,
.detail-title {
  display: flex;
  align-items: center;
  min-width: 0;
}
.detail-titlebar {
  flex: 1 1 auto;
  gap: 4px;
}
.detail-title {
  gap: 8px;
}
.detail-title-text {
  min-width: 0;
}
.detail-title-text form {
  min-width: 0;
  max-width: min(48vw, 520px);
}
.detail-title-text .input {
  width: 100%;
}

.group-nav-btn {
  background: transparent;
  border: none;
  padding: 6px 8px 6px 4px;
  cursor: pointer;
  text-align: left;
  border-radius: var(--radius-sm);
  transition: background 120ms;
}
.group-nav-btn:hover { background: var(--surface-2); }

.group-name-btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 2px;
  min-width: 0;
  max-width: min(48vw, 520px);
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
  border-radius: var(--radius-sm);
  transition: opacity 120ms;
}
.group-name-btn span {
  min-width: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
  text-align: left;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.group-name-btn:hover { opacity: 0.7; }

/* Group selector */
.group-select {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  transition: background 120ms;
}
.group-select:hover { background: var(--surface-2); }
.group-select .grp-dot {
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; color: #fff;
  font-size: 11px; font-weight: 600;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--surface);
  border: var(--glass-border);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: var(--inner-glow), var(--shadow-1);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  transition: background var(--motion-base), transform var(--motion-fast), box-shadow var(--motion-base), border-color var(--motion-base);
}
.btn:hover { background: var(--glass-strong); box-shadow: var(--inner-glow), var(--shadow-2); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary {
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  border-color: rgba(var(--brand-rgb), 0.4);
  color: #fff;
  box-shadow: 0 12px 28px rgba(var(--brand-rgb), 0.34), var(--inner-glow);
}
.btn.primary:hover {
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand-2) 92%, white), var(--brand));
  box-shadow: 0 16px 36px rgba(var(--brand-rgb), 0.4), var(--inner-glow);
}
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
.btn.ghost:hover { background: var(--surface-2); box-shadow: var(--inner-glow); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.icon { width: 38px; padding: 0; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.lg { height: 46px; padding: 0 18px; font-size: 15px; }
.btn.wide { width: 100%; }
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn:disabled { opacity: 0.5; pointer-events: none; }

/* Workspace */
.workspace {
  padding: 16px 0 80px;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  min-height: 0;
}
.screen-view {
  animation: screenIn 220ms var(--ease-emphasized);
  transform-origin: center top;
}
.panel-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 28px 0 16px;
}
.panel-head > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}
.panel-head > div:last-child:not(:first-child) {
  flex: 0 0 auto;
}
.panel-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 32px;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.panel-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.section-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
}

/* Cards */
.card {
  background: linear-gradient(150deg, var(--surface), rgba(var(--brand-rgb), 0.04));
  border: var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--inner-glow), var(--shadow-1);
  backdrop-filter: blur(24px) saturate(1.5);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
}

/* Metrics */
.metrics {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}
.metric {
  background: linear-gradient(160deg, var(--surface), rgba(var(--brand-rgb), 0.04));
  border: var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--inner-glow), var(--shadow-1);
  backdrop-filter: blur(24px) saturate(1.5);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  transition: transform var(--motion-base), box-shadow var(--motion-base), border-color var(--motion-base);
}
.metric.is-clickable { cursor: pointer; }
.metric.is-clickable:hover { transform: translateY(-2px); box-shadow: var(--inner-glow), var(--shadow-2); border-color: rgba(var(--brand-rgb), 0.3); }
.metric.is-clickable .label svg { transition: transform 150ms; }
.metric.is-clickable:hover .label svg { transform: translateX(2px); }
.metric .label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.metric .value {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 36px;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.metric .value.sm { font-size: 28px; }
.metric.feature {
  background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 70%, var(--accent)));
  border-color: rgba(var(--brand-rgb), 0.4);
  color: #fff;
  box-shadow: 0 10px 28px rgba(var(--brand-rgb), 0.24), var(--inner-glow);
}
.metric.feature .label { color: rgba(255,255,255,0.7); }
.metric.feature .value { color: #fff; }
.metric .sub {
  font-size: 12px;
  color: var(--muted);
}
.metric.feature .sub { color: rgba(255,255,255,0.7); }
.metric .sub.pending-sub { color: var(--warning, #d97706); }
.metric.feature .sub.pending-sub { color: rgba(255, 220, 140, 0.9); }

/* 4-column metrics variant */
.metrics-4 {
  grid-template-columns: 2fr 1fr 1fr 1fr;
}
@media (max-width: 639px) {
  .metrics-4 {
    grid-template-columns: 1fr 1fr;
  }
  .metrics-4 .metric.feature {
    grid-column: 1 / -1;
  }
  .metrics-4 .metric:last-child {
    grid-column: 1 / -1;
  }
}

/* Metric name value (truncated person name) */
.metric-name-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 20px !important;
}

/* Settled banner */
.settled-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  margin-bottom: 20px;
  background: linear-gradient(135deg, var(--ok-soft), rgba(5, 150, 105, 0.04));
  border: 1.5px solid var(--ok);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.1);
}
.settled-banner-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--ok);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
}
.settled-banner-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ok);
}
.settled-banner-desc {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

/* Balance bars */
.balance-bar-track {
  height: 3px;
  background: var(--line);
  border-radius: 2px;
  margin-top: 5px;
  overflow: hidden;
}
.balance-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width var(--motion-data) var(--ease-emphasized);
}
.balance-bar-fill.pos { background: var(--ok); }
.balance-bar-fill.neg { background: var(--danger); }
.balance-bar-fill.zero { background: var(--line-2); }

/* Category breakdown in summary */
.category-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
}
.category-row + .category-row { border-top: 1px solid var(--line); }
.cat-icon {
  width: 28px; height: 28px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.cat-icon svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cat-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  min-width: 68px;
}
.cat-bar-track {
  flex: 1;
  height: 5px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
}
.cat-bar-fill {
  height: 100%;
  background: var(--brand);
  border-radius: 3px;
  transition: width 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.cat-amount {
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--ink-2);
  white-space: nowrap;
  min-width: 60px;
  text-align: right;
}

/* Recent activity rows in summary */
.recent-row { border-bottom: 1px solid var(--line); }
.recent-row:last-child { border-bottom: none; }
.recent-row-button {
  width: 100%;
  text-align: left;
  transition: background 140ms;
}
.recent-row-button:hover { background: var(--surface-2); }
.recent-row-button:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px rgba(var(--brand-rgb), 0.45);
}

/* Two column */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Balance row */
.balance-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: linear-gradient(150deg, var(--surface), rgba(var(--brand-rgb), 0.04));
  border: var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--inner-glow), var(--shadow-1);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
}
.balance-row + .balance-row { margin-top: 8px; }
.balance-row--me {
  border-color: rgba(var(--brand-rgb), 0.35);
  background: linear-gradient(150deg, var(--surface), rgba(var(--brand-rgb), 0.1));
}
.you-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(var(--brand-rgb), 0.12);
  border: 1px solid rgba(var(--brand-rgb), 0.25);
  border-radius: 4px;
  padding: 1px 5px;
  line-height: 1.5;
  flex-shrink: 0;
}
.balance-row.motion-balance-cue {
  animation: balancePulse 760ms var(--ease-emphasized);
}
.balance-row .name { font-weight: 500; font-size: 14px; }
.balance-row .amount {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.amount.pos { color: var(--ok); }
.amount.neg { color: var(--danger); }
.amount.zero { color: var(--muted); }

/* Avatar */
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-sans);
  flex-shrink: 0;
  letter-spacing: 0.02em;
}
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }

/* Settle-up suggestion row */
.settle-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: linear-gradient(150deg, var(--surface), rgba(var(--brand-rgb), 0.04));
  border: var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--inner-glow), var(--shadow-1);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
}
.settle-row + .settle-row { margin-top: 8px; }
.settle-row.motion-flow-cue {
  animation: flowPulse 720ms var(--ease-emphasized);
}
.settle-flow {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.settle-flow .arrow {
  width: 14px;
  height: 14px;
  color: var(--muted);
  flex-shrink: 0;
}
.settle-flow .who { font-weight: 500; font-size: 14px; }
.settle-amt {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  margin-right: 8px;
}

/* Empty */
.empty {
  padding: 32px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  background: var(--surface-2);
  border: 1px dashed var(--line-2);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* Onboarding / guided setup cards */
.onboarding-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 24px;
  margin-bottom: 24px;
  background: var(--surface-2);
  border: 1.5px dashed var(--brand);
  border-radius: var(--radius-lg);
  gap: 8px;
}
.onboarding-card--secondary {
  border-color: var(--line-2);
}
.onboarding-icon { font-size: 36px; line-height: 1; margin-bottom: 4px; }
.onboarding-title { font-size: 16px; font-weight: 700; color: var(--ink); }
.onboarding-desc { font-size: 13px; color: var(--muted); max-width: 320px; margin-bottom: 8px; }

.onboarding-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  margin-top: 20px;
  background: var(--surface-2);
  border: 1.5px solid var(--brand);
  border-radius: var(--radius-lg);
}
.onboarding-cta-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.onboarding-cta-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Activity / cost list */
.cost-list { display: flex; flex-direction: column; gap: 8px; }
.cost-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: linear-gradient(150deg, var(--surface), rgba(var(--brand-rgb), 0.04));
  border: var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--inner-glow), var(--shadow-1);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  transition: transform var(--motion-base), box-shadow var(--motion-base);
}
.cost-row:hover { transform: translateY(-1px); box-shadow: var(--inner-glow), var(--shadow-2); }
.cost-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.cost-icon svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cost-body { min-width: 0; }
.cost-title { font-weight: 500; font-size: 14px; line-height: 1.3; }
.cost-meta { font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.cost-end { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.cost-amt {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.cost-date { font-size: 11px; color: var(--muted); }

/* Cost type colors */
.tt-food      { background: #fef3e8; color: #c2410c; }
.tt-groceries { background: #e7f5ea; color: #15803d; }
.tt-transport { background: #e6effb; color: #1d4ed8; }
.tt-lodging   { background: #efe8fb; color: #7c3aed; }
.tt-home      { background: #e6f1ee; color: #1e6f63; }
.tt-leisure   { background: #fbe6f5; color: #a21caf; }
.tt-health    { background: #fbe9e7; color: #b42318; }
.tt-work      { background: #eef0ee; color: #475569; }
.tt-other     { background: var(--surface-3); color: var(--muted); }
.tt-settle    { background: var(--brand-soft); color: var(--brand); }

[data-theme="dark"] .tt-food      { background: #3a2a20; color: #fb923c; }
[data-theme="dark"] .tt-groceries { background: #1f3a28; color: #5fcf86; }
[data-theme="dark"] .tt-transport { background: #1f2c44; color: #7aa9f5; }
[data-theme="dark"] .tt-lodging   { background: #2c1f44; color: #b794f4; }
[data-theme="dark"] .tt-home      { background: #1f3833; color: #4dbfb0; }
[data-theme="dark"] .tt-leisure   { background: #3a1f33; color: #e88dde; }
[data-theme="dark"] .tt-health    { background: #3a1f1d; color: #f87171; }
[data-theme="dark"] .tt-work      { background: #2a3138; color: #94a3b8; }
[data-theme="dark"] .tt-settle    { background: #1f3833; color: #6dd5c5; }

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] .tt-food      { background: #3a2a20; color: #fb923c; }
  :root[data-theme="system"] .tt-groceries { background: #1f3a28; color: #5fcf86; }
  :root[data-theme="system"] .tt-transport { background: #1f2c44; color: #7aa9f5; }
  :root[data-theme="system"] .tt-lodging   { background: #2c1f44; color: #b794f4; }
  :root[data-theme="system"] .tt-home      { background: #1f3833; color: #4dbfb0; }
  :root[data-theme="system"] .tt-leisure   { background: #3a1f33; color: #e88dde; }
  :root[data-theme="system"] .tt-health    { background: #3a1f1d; color: #f87171; }
  :root[data-theme="system"] .tt-work      { background: #2a3138; color: #94a3b8; }
  :root[data-theme="system"] .tt-settle    { background: #1f3833; color: #6dd5c5; }
}

/* Inputs */
.input, .select, .textarea {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  background: var(--surface-3);
  border: var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 14px;
  box-shadow: var(--control-shadow);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  transition: border-color var(--motion-base), box-shadow var(--motion-base), background var(--motion-base);
}
.textarea { height: auto; padding: 10px 12px; min-height: 80px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: rgba(var(--brand-rgb), 0.5);
  background: var(--glass-strong);
  box-shadow: 0 0 0 4px var(--brand-soft), var(--control-focus-inset);
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* Inline form (people) */
.inline-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 12px;
}

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 19, 22, 0.32);
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: calc(60px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
  overflow-y: auto;
  overflow-x: hidden;
  animation: fadeIn 160ms ease;
}
[data-theme="dark"] .modal-backdrop { background: rgba(0,0,0,0.6); }
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] .modal-backdrop { background: rgba(0,0,0,0.6); }
}
.modal {
  width: min(640px, 100%);
  background: linear-gradient(165deg, var(--glass-strong), color-mix(in srgb, var(--glass-strong) 92%, var(--brand-2)));
  border: var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-3), var(--inner-glow);
  backdrop-filter: blur(40px) saturate(1.8);
  -webkit-backdrop-filter: blur(40px) saturate(1.8);
  padding: 24px;
  animation: modalIn 200ms ease;
}
.modal.sm { width: min(440px, 100%); }
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  margin-bottom: 20px;
}
.modal-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 26px;
  letter-spacing: -0.01em;
}
.modal-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.modal-head-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }

.receipt-ocr input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.receipt-ocr--head { display: contents; }
.receipt-ocr-trigger {
  color: var(--muted);
}
.receipt-ocr-trigger:hover {
  color: var(--ink);
}
.expense-form-grid {
  grid-template-columns: minmax(160px, 0.8fr) minmax(0, 1fr) minmax(150px, 0.8fr);
  align-items: end;
}
.expense-form-grid .full {
  grid-column: span 2;
}
.expense-amount-field .input {
  height: 48px;
  font-family: var(--font-mono);
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}
.ocr-review-warning {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: -4px 0 14px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--warning, #d97706) 45%, transparent);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--warning, #d97706) 12%, transparent);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
}
.ocr-raw-text {
  min-height: 120px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.45;
}

/* Segmented control */
.seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 2px;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.seg-item {
  height: 30px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}
.seg-item.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}

/* Contributions list */
.contrib-list { display: flex; flex-direction: column; gap: 8px; }
.contrib-row {
  display: grid;
  grid-template-columns: auto 1fr 130px;
  align-items: center;
  gap: 10px;
}
.contrib-row .input { height: 36px; text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.contrib-row .name { font-size: 14px; font-weight: 500; }
.contrib-row .contrib-input { display: flex; align-items: center; gap: 6px; min-width: 0; }
.contrib-row .contrib-input .input { flex: 1; min-width: 0; }
.contrib-row .row-quick { flex-shrink: 0; height: 36px; padding: 0 8px; font-size: 12px; color: var(--muted); }

.split-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 6px;
}
.split-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  transition: border-color var(--motion-fast), background var(--motion-fast), color var(--motion-fast), transform var(--motion-fast);
}
.split-chip:hover { border-color: var(--line-2); }
.split-chip.is-on {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
}
.split-chip .check {
  width: 16px; height: 16px;
  border-radius: 4px;
  border: 1.5px solid var(--line-2);
  display: grid; place-items: center;
}
.split-chip.is-on .check {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.split-chip .check svg { width: 11px; height: 11px; stroke: currentColor; fill: none; stroke-width: 3; }

/* Split amount inputs */
.split-amount-row {
  display: grid;
  grid-template-columns: auto 1fr 130px;
  align-items: center;
  gap: 10px;
}

.status-line {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  background: var(--surface-2);
  color: var(--muted);
}
.status-line.is-ok { color: var(--ok); background: var(--ok-soft); }
.status-line.is-warn { color: var(--accent); background: var(--accent-soft); }

.box {
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-top: 16px;
}
.box .field-label { margin-bottom: 10px; }
.box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.box-header .seg { flex: 1; min-width: 160px; }

.modal-foot {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.qr-link-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
}
.qr-link-url {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  background: var(--surface-3);
  border: var(--glass-border);
  border-radius: 8px;
  padding: 8px 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Share modal options */
.share-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius);
  border: 1.5px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: border-color var(--motion-base), background var(--motion-base), transform var(--motion-fast);
}
.share-option:hover:not(:disabled) {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 8%, transparent);
  transform: translateY(-1px);
}
.share-option--disabled {
  opacity: 0.5;
  cursor: default;
}
.share-option-label {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  margin-bottom: 2px;
}
.share-option-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

/* Sync badge on group list cards */
.sync-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--ok-soft);
  color: var(--ok);
  flex-shrink: 0;
}

/* Pending expense badge */
.pending-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  vertical-align: middle;
}

/* Toggle "ninguém pagou" no modal de despesa */
.pending-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
  margin-bottom: 12px;
  user-select: none;
  background: transparent;
  border: none;
  padding: 0;
}
.pending-toggle .check {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1.5px solid var(--line-2);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: background var(--motion-fast), border-color var(--motion-fast), color var(--motion-fast);
}
.pending-toggle.is-on .check {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.pending-toggle .check svg { width: 11px; height: 11px; stroke: currentColor; fill: none; stroke-width: 3; }

/* Dropdown menu */
.dropdown { position: relative; }
.dropdown-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: linear-gradient(180deg, var(--glass-strong), color-mix(in srgb, var(--glass-strong) 92%, var(--brand-2)));
  border: var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-3), var(--inner-glow);
  backdrop-filter: blur(28px) saturate(1.5);
  -webkit-backdrop-filter: blur(28px) saturate(1.5);
  padding: 6px;
  min-width: 260px;
  max-height: calc(100vh - 180px - env(safe-area-inset-bottom));
  max-height: calc(100dvh - 180px - env(safe-area-inset-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
  z-index: 130;
  transform-origin: top right;
  animation: dropdownIn var(--motion-base) var(--ease-spring) both;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  text-align: left;
}
.menu-item:hover { background: var(--surface-2); }
.menu-item svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }
.menu-item.danger { color: var(--danger); }
.menu-divider { height: 1px; background: var(--line); margin: 6px 4px; }
.menu-section {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 8px 10px 4px;
  font-weight: 600;
}

/* Settings toggle row */
.setting-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 120ms;
}
.setting-toggle-row:hover { background: var(--surface-2); }
.setting-toggle-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.setting-toggle-label { font-size: 13px; font-weight: 500; color: var(--ink); }
.setting-toggle-desc { font-size: 11px; color: var(--muted); line-height: 1.4; }

.toggle-switch {
  position: relative;
  flex-shrink: 0;
  width: 38px;
  height: 22px;
  cursor: pointer;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--line-2);
  transition: background var(--motion-base);
}
.toggle-switch input:checked + .toggle-track { background: var(--brand); }
.toggle-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.22);
  transition: transform var(--motion-base) var(--ease-spring);
}
.toggle-switch input:checked + .toggle-track::after { transform: translateX(16px); }

/* Toast */
.toast {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--ink);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-3);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: opacity var(--motion-base), transform var(--motion-base);
}
.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.toast-action {
  color: var(--brand-2);
  font-weight: 700;
  font-size: 13px;
}
/* Dark mode toast has a light background (--ink flips to near-white); use dark teal for contrast (~4.7:1) */
:root[data-theme="dark"] .toast-action { color: #0f766e; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] .toast-action { color: #0f766e; }
}

/* Liquid-glass floating dock */
.dock {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  max-width: calc(100vw - 32px);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,0.32), rgba(255,255,255,0.18));
  border: 1px solid rgba(255,255,255,0.55);
  box-shadow:
    0 24px 60px rgba(15, 23, 42, 0.18),
    0 8px 22px rgba(15, 23, 42, 0.10),
    inset 0 1px 0 rgba(255,255,255,0.85),
    inset 0 -1px 0 rgba(255,255,255,0.25);
  backdrop-filter: blur(28px) saturate(1.8);
  -webkit-backdrop-filter: blur(28px) saturate(1.8);
}
:root[data-theme="dark"] .dock {
  background: linear-gradient(180deg, rgba(32,50,76,0.55), rgba(16,31,51,0.42));
  border-color: rgba(198,213,230,0.22);
  box-shadow:
    0 30px 80px rgba(0,0,0,0.55),
    0 10px 26px rgba(0,0,0,0.35),
    inset 0 1px 0 rgba(255,255,255,0.10),
    inset 0 -1px 0 rgba(255,255,255,0.04);
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] .dock {
    background: linear-gradient(180deg, rgba(32,50,76,0.55), rgba(16,31,51,0.42));
    border-color: rgba(198,213,230,0.22);
    box-shadow:
      0 30px 80px rgba(0,0,0,0.55),
      0 10px 26px rgba(0,0,0,0.35),
      inset 0 1px 0 rgba(255,255,255,0.10),
      inset 0 -1px 0 rgba(255,255,255,0.04);
  }
}
.dock::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(120% 70% at 30% 0%, rgba(255,255,255,0.45), transparent 60%);
  mix-blend-mode: overlay;
  opacity: var(--dock-sheen-opacity);
}
.dock-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 4px;
}
.dock-tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: color var(--motion-base), background 220ms, padding 220ms, transform var(--motion-fast);
}
.dock-tab svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; flex-shrink: 0; }
.dock-tab .tab-label {
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  opacity: 0;
  transition: max-width var(--motion-page) var(--ease-emphasized), opacity var(--motion-base), margin-left 220ms;
}
.dock-tab:hover { color: var(--ink); }
.dock-tab:active { transform: translateY(1px) scale(0.98); }
.dock-tab.is-active {
  color: var(--brand);
  background: linear-gradient(180deg, rgba(255,255,255,0.7), rgba(255,255,255,0.4));
  box-shadow:
    0 4px 14px rgba(15, 23, 42, 0.10),
    inset 0 1px 0 rgba(255,255,255,0.95);
}
:root[data-theme="dark"] .dock-tab.is-active {
  background: linear-gradient(180deg, rgba(45,212,191,0.22), rgba(45,212,191,0.08));
  box-shadow: 0 4px 14px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.12);
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] .dock-tab.is-active {
    background: linear-gradient(180deg, rgba(45,212,191,0.22), rgba(45,212,191,0.08));
    box-shadow: 0 4px 14px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.12);
  }
}
.dock-tab.is-active .tab-label {
  max-width: 160px;
  opacity: 1;
  margin-left: 2px;
}
@media (max-width: 430px) {
  .dock-tab { padding: 0 10px; }
  .dock-tab.is-active .tab-label { max-width: 100px; }
}

/* Dark mode: bright teal bg elements — switch text/icon to dark for WCAG contrast (~10:1) */
:root[data-theme="dark"] .btn.primary,
:root[data-theme="dark"] .fab-menu-item.primary,
:root[data-theme="dark"] .metric.feature,
:root[data-theme="dark"] .metric.feature .label,
:root[data-theme="dark"] .metric.feature .value,
:root[data-theme="dark"] .metric.feature .sub,
:root[data-theme="dark"] .brand-mark,
:root[data-theme="dark"] .dock-fab {
  color: #08111f;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] .btn.primary,
  :root[data-theme="system"] .fab-menu-item.primary,
  :root[data-theme="system"] .metric.feature,
  :root[data-theme="system"] .metric.feature .label,
  :root[data-theme="system"] .metric.feature .value,
  :root[data-theme="system"] .metric.feature .sub,
  :root[data-theme="system"] .brand-mark,
  :root[data-theme="system"] .dock-fab {
    color: #08111f;
  }
}
.dock-divider {
  width: 1px;
  height: 26px;
  background: linear-gradient(180deg, transparent, rgba(20,33,61,0.18), transparent);
  margin: 0 2px;
}
:root[data-theme="dark"] .dock-divider {
  background: linear-gradient(180deg, transparent, rgba(255,255,255,0.18), transparent);
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] .dock-divider {
    background: linear-gradient(180deg, transparent, rgba(255,255,255,0.18), transparent);
  }
}
.fab-wrap {
  position: relative;
}
.fab-wrap.is-open::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: radial-gradient(circle at calc(50% + 150px) calc(100% - 112px), rgba(var(--brand-rgb), 0.12), transparent 26%);
  pointer-events: none;
  animation: fadeIn var(--motion-base) ease both;
}
.fab-menu {
  position: absolute;
  bottom: calc(100% + 12px);
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  z-index: 200;
}
.fab-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 24px;
  border: var(--glass-border);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  white-space: nowrap;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 4px 16px rgba(0,0,0,0.13), 0 1px 4px rgba(0,0,0,0.07);
  transition: transform var(--motion-fast), box-shadow var(--motion-fast);
}
.fab-menu-item:nth-child(1) { animation: fab-item-in var(--motion-base) 40ms var(--ease-spring) both; }
.fab-menu-item:nth-child(2) { animation: fab-item-in var(--motion-base) 0ms var(--ease-spring) both; }
.fab-menu-item:hover:not(:disabled) {
  transform: scale(1.03);
  box-shadow: 0 6px 20px rgba(0,0,0,0.17), 0 1px 4px rgba(0,0,0,0.09);
}
.fab-menu-item.primary {
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  color: #fff;
  border: none;
  box-shadow: 0 6px 20px rgba(var(--brand-rgb), 0.4), inset 0 1px 0 rgba(255,255,255,0.3);
}
.fab-menu-item.primary:hover:not(:disabled) {
  box-shadow: 0 8px 24px rgba(var(--brand-rgb), 0.5), inset 0 1px 0 rgba(255,255,255,0.3);
}
.fab-menu-item:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
@keyframes fab-item-in {
  from { opacity: 0; transform: translateY(10px) scale(0.88); }
  to   { opacity: 1; transform: none; }
}
.dock-fab {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  color: #fff;
  cursor: pointer;
  box-shadow:
    0 10px 24px rgba(var(--brand-rgb), 0.45),
    inset 0 1px 0 rgba(255,255,255,0.5);
  transition: transform 220ms var(--ease-spring), box-shadow var(--motion-base);
}
.dock-fab:hover {
  transform: scale(1.06) rotate(90deg);
  box-shadow: 0 14px 32px rgba(var(--brand-rgb), 0.55), inset 0 1px 0 rgba(255,255,255,0.5);
}
.dock-fab.is-open {
  transform: rotate(45deg);
}
.dock-fab.is-open:hover {
  transform: scale(1.06) rotate(45deg);
  box-shadow: 0 14px 32px rgba(var(--brand-rgb), 0.55), inset 0 1px 0 rgba(255,255,255,0.5);
}
.dock-fab svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2.4; stroke-linecap: round; }

/* Activity filters */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.filter-pills {
  display: flex;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.filter-pill {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 13px;
  border-radius: 15px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--motion-fast), color var(--motion-fast), background var(--motion-fast), transform var(--motion-fast);
}
.filter-pill:hover { border-color: var(--line-2); color: var(--ink); }
.filter-pill:active { transform: scale(0.98); }
.filter-pill.is-active {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
  font-weight: 600;
}
.filter-person-select {
  height: 30px;
  font-size: 13px;
  padding: 0 28px 0 10px;
  flex-shrink: 0;
  width: clamp(140px, 28vw, 220px);
  max-width: 100%;
}
.filter-clear {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.filter-clear:hover {
  color: var(--ink);
}
.filter-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 7px 12px;
  margin-bottom: 8px;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  font-size: 13px;
  color: var(--brand);
}
.filter-summary span:last-child {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-weight: 600;
  font-family: var(--font-mono);
  white-space: nowrap;
}
.filter-summary-label {
  font-family: var(--font);
  font-weight: 500;
  opacity: 0.8;
}

/* Search bar */
.filter-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  margin-bottom: 8px;
  background: var(--surface-3);
  border: var(--glass-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--control-shadow);
}
.filter-search-bar svg { color: var(--muted); flex-shrink: 0; }
.filter-search-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  color: var(--ink);
  min-width: 0;
}
.filter-search-input::placeholder { color: var(--muted); }

@media (max-width: 520px) {
  .filter-bar {
    align-items: stretch;
  }
  .filter-pills {
    flex-basis: 100%;
  }
  .filter-pill {
    flex: 1;
    justify-content: center;
    padding: 0 8px;
  }
  .filter-person-select {
    flex: 1;
    width: auto;
  }
  .filter-summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }
}

/* Footer credit */
.dock-credit {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  padding: 8px 16px calc(96px + env(safe-area-inset-bottom));
  margin-top: 24px;
  letter-spacing: 0.01em;
}

/* Debt graph */
.debt-graph {
  position: relative;
  overflow: hidden;
  background: linear-gradient(150deg, var(--surface), rgba(var(--brand-rgb), 0.05));
  border: var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--inner-glow), var(--shadow-1);
  backdrop-filter: blur(24px) saturate(1.5);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  height: 380px;
}
.debt-graph-svg {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}
.debt-graph-svg:active { cursor: grabbing; }
.debt-node { cursor: move; }
.debt-node circle {
  filter: var(--node-shadow);
  transform-origin: center;
  transition: filter var(--motion-base), opacity var(--motion-base);
  animation: nodePop 420ms var(--ease-spring) both;
}
.debt-node:hover circle {
  filter: var(--node-shadow) drop-shadow(0 0 10px rgba(var(--brand-rgb), 0.34));
}
.debt-link {
  animation: debtLinkIn 620ms var(--ease-emphasized) both;
}
.debt-amount-label {
  animation: amountLabelIn 520ms 90ms var(--ease-spring) both;
}
.debt-graph-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: flex;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--glass-strong);
  box-shadow: var(--shadow-1);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
}
.graph-control {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-xs);
  color: var(--ink);
  background: transparent;
  touch-action: manipulation;
}
.graph-control:hover { background: var(--brand-soft); color: var(--brand); }
.graph-control:active { transform: translateY(1px); }
.graph-control svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Activity feed (list-in-card usage) */
.swipe-card {
  overflow: hidden;
}

.swipe-item {
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.swipe-item:last-child { border-bottom: none; }

.swipe-content {
  display: flex;
  align-items: stretch;
  will-change: transform;
}

.swipe-row-inner {
  flex: 0 0 100%;
  min-width: 0;
}

.swipe-actions {
  display: flex;
  flex-shrink: 0;
}

.swipe-bg-btn {
  width: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 0;
  cursor: pointer;
  color: #fff;
  flex-shrink: 0;
}
.swipe-bg-btn.swipe-edit { background: var(--brand); }
.swipe-bg-btn.swipe-delete { background: var(--danger); }

.motion-row-cue {
  position: relative;
  animation: rowCue 900ms var(--ease-emphasized) both;
}
.motion-row-cue::after {
  content: "";
  position: absolute;
  inset: 6px 8px;
  border-radius: var(--radius);
  border: 1px solid rgba(var(--brand-rgb), 0.28);
  pointer-events: none;
  animation: rowCueRing 900ms var(--ease-emphasized) both;
}

.row-hover-actions { display: none; }

@media (hover: hover) {
  .swipe-actions { display: none; }
  .row-hover-actions {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s;
  }
  .swipe-item:hover .row-hover-actions { opacity: 1; }
}

@keyframes swipe-hint {
  0%   { transform: translateX(0); }
  20%  { transform: translateX(-72px); }
  60%  { transform: translateX(-72px); }
  100% { transform: translateX(0); }
}
.swipe-hint-anim { animation: swipe-hint 1.4s var(--ease-standard); }

/* Date groups in activity list */
.date-groups {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.date-separator {
  padding: 0 4px 6px;
}
.date-separator span {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.activity-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
}
.activity-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: grid; place-items: center; flex-shrink: 0;
}
.activity-icon svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.activity-body { flex: 1; min-width: 0; }
.activity-title { font-weight: 500; font-size: 14px; }
.activity-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.activity-meta .who { font-weight: 500; color: var(--ink-2); }
.activity-end { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }

/* Avatar stack */
.avatar-stack { display: inline-flex; align-items: center; }
.avatar-stack .avatar { border: 2px solid var(--surface); margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }
.avatar-stack .more {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 2px solid var(--surface);
  margin-left: -8px;
  display: grid; place-items: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
}

/* Sample data banner */
.sample-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 16px;
  background: var(--brand-soft);
  border: 1px solid var(--brand-soft-2);
  border-radius: var(--radius);
  color: var(--brand);
  font-size: 13px;
}

/* Animations */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes screenIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.995);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@keyframes rowCue {
  0%   { background-color: color-mix(in srgb, var(--brand) 16%, transparent); }
  45%  { background-color: color-mix(in srgb, var(--brand) 10%, transparent); }
  100% { background-color: transparent; }
}
@keyframes rowCueRing {
  0%   { opacity: 0; transform: scale(0.985); }
  24%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.012); }
}
@keyframes balancePulse {
  0%   { transform: translateY(0); box-shadow: var(--inner-glow), var(--shadow-1); }
  35%  { transform: translateY(-2px); box-shadow: var(--inner-glow), var(--shadow-2), 0 0 0 1px rgba(var(--brand-rgb), 0.15); }
  100% { transform: translateY(0); box-shadow: var(--inner-glow), var(--shadow-1); }
}
@keyframes flowPulse {
  0%   { transform: translateX(0); border-color: color-mix(in srgb, var(--brand) 34%, transparent); }
  42%  { transform: translateX(3px); border-color: color-mix(in srgb, var(--brand) 46%, transparent); }
  100% { transform: translateX(0); border-color: var(--line); }
}
@keyframes nodePop {
  from { opacity: 0; transform: scale(0.88); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes debtLinkIn {
  from { opacity: 0; stroke-dashoffset: 16; }
  to   { opacity: 0.75; stroke-dashoffset: 0; }
}
@keyframes amountLabelIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* View-level slide transitions (groups list ↔ group detail) */
@keyframes slideFromRight {
  from { opacity: 0; transform: translateX(28px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideFromLeft {
  from { opacity: 0; transform: translateX(-28px); }
  to   { opacity: 1; transform: translateX(0); }
}
.view-enter-forward { animation: slideFromRight var(--motion-page) var(--ease-standard) both; }
.view-enter-back    { animation: slideFromLeft  var(--motion-page) var(--ease-standard) both; }

/* Directional tab transitions */
@keyframes tabFromRight {
  from { opacity: 0; transform: translateX(10px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes tabFromLeft {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: translateX(0); }
}
.screen-view.tab-from-right { animation: tabFromRight 200ms var(--ease-standard); }
.screen-view.tab-from-left  { animation: tabFromLeft  200ms var(--ease-standard); }

/* Modal exit animations */
@keyframes modalOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(16px) scale(0.97); }
}
@keyframes backdropOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}
.modal.is-closing          { animation: modalOut    180ms cubic-bezier(0.4, 0, 1, 0.6) forwards; }
.modal-backdrop.is-closing { animation: backdropOut 180ms ease forwards; pointer-events: none; }

/* Dropdown entrance */
@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}

/* Group list card stagger */
@keyframes cardEnter {
  from { opacity: 0; transform: translateX(-6px); }
  to   { opacity: 1; transform: none; }
}
.groups-list-card .swipe-item              { animation: cardEnter 220ms var(--ease-standard) both; }
.groups-list-card .swipe-item:nth-child(1) { animation-delay: 0ms;   }
.groups-list-card .swipe-item:nth-child(2) { animation-delay: 50ms;  }
.groups-list-card .swipe-item:nth-child(3) { animation-delay: 100ms; }
.groups-list-card .swipe-item:nth-child(4) { animation-delay: 150ms; }
.groups-list-card .swipe-item:nth-child(5) { animation-delay: 200ms; }
.groups-list-card .swipe-item:nth-child(n+6){ animation-delay: 240ms; }

/* Utility */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* Responsive */
@media (max-width: 760px) {
  .shell { padding: 0 16px; }
  .topbar { padding: calc(12px + env(safe-area-inset-top)) 0 12px; }
  .workspace { padding-top: 12px; }
  .group-name-btn,
  .detail-title-text form { max-width: 42vw; }
  .panel-head h2 { font-size: 26px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metric.feature { grid-column: 1 / -1; }
  .two-col { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .expense-form-grid { grid-template-columns: 1fr; }
  .expense-form-grid .full { grid-column: 1 / -1; }
  .input, .select { font-size: 16px; }
  .modal-backdrop { padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)); }
  .group-select { display: none; }
}

@media (max-width: 480px) {
  .panel-head { flex-direction: column; align-items: stretch; }
  .panel-head > div:last-child { display: flex; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
  .screen-view,
  .view-enter-forward, .view-enter-back,
  .modal.is-closing, .modal-backdrop.is-closing,
  .screen-view.tab-from-right, .screen-view.tab-from-left,
  .groups-list-card .swipe-item,
  .motion-row-cue,
  .motion-row-cue::after,
  .motion-balance-cue,
  .motion-flow-cue,
  .debt-node circle,
  .debt-link,
  .debt-amount-label,
  .fab-wrap.is-open::before {
    animation: none !important;
    transform: none !important;
  }
}

/* PWA standalone: no browser toolbar, so dock sits closer to the bottom */
@media (display-mode: standalone) {
  .dock {
    bottom: calc(8px + env(safe-area-inset-bottom));
  }
  .toast {
    bottom: calc(68px + env(safe-area-inset-bottom));
  }
  .dock-credit {
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
  }
}

/* ============ Groups list ============ */
.group-card-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

/* Empty groups state */
.groups-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  text-align: center;
}

.groups-empty h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--ink);
}

.groups-empty p {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 24px;
}

/* Settlement amount slider */
.settle-slider-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.settle-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: var(--line-2);
  outline: none;
  cursor: pointer;
  accent-color: var(--brand);
}

.settle-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--brand);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(var(--brand-rgb), 0.4);
  transition: transform 0.1s;
}

.settle-slider::-webkit-slider-thumb:active {
  transform: scale(1.2);
}

.settle-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: var(--brand);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(var(--brand-rgb), 0.4);
}

.settle-slider-max {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* landscape block overlay */
#landscape-block {
  display: none;
}

@media (max-width: 1024px) and (orientation: landscape) {
  #landscape-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--surface);
    color: var(--ink);
  }

  #landscape-block p {
    font-size: 15px;
    font-weight: 500;
    color: var(--muted);
    margin: 0;
  }
}

/* danger menu item */
.menu-item.danger {
  color: var(--danger);
}
.menu-item.danger:hover {
  background: var(--danger-soft);
}

/* ============ iOS Install Banner ============ */
.ios-banner {
  position: fixed;
  bottom: calc(16px + env(safe-area-inset-bottom));
  left: 16px;
  right: 16px;
  z-index: 900;
  background: var(--glass-strong);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  padding: 14px 12px 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.ios-banner-body {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.ios-banner-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 20px;
  box-shadow: 0 4px 10px rgba(var(--brand-rgb), 0.3);
}
.ios-banner-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.ios-banner-text strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}
.ios-banner-text span {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
}
.ios-share-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  vertical-align: middle;
  color: var(--brand);
}
.ios-banner-close {
  flex-shrink: 0;
  align-self: flex-start;
}
.ios-banner-arrow {
  position: absolute;
  bottom: -9px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 9px;
  background: var(--glass-strong);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}
