/*
 * Chortke Mini App — Apple-inspired design system.
 *
 * Tokens follow the iOS system palette (light / dark), surfaces use
 * translucent "glass" materials, lists are inset-grouped with hairline
 * separators, and every tap target is at least 44px. All icons are inline
 * SVG (see ICONS in app.js); the UI uses no emoji.
 */

/* ----------------------------------------------------------------- fonts */

/*
 * Self-hosted (no Google Fonts): loads reliably in Iran and keeps the CSP tight.
 * One family, two faces split by unicode-range: Latin from Inter (closest open
 * relative of SF Pro), Persian from Shabnam (regular, medium, bold; 600+ use
 * bold). The Persian faces are declared last so they win for shared characters such as the ZWNJ half-space.
 * To switch to a licensed brand font, replace the Persian file and keep the family name.
 */
@font-face {
  font-family: "Chortke Sans";
  src: url("fonts/inter-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Chortke Sans";
  src: url("fonts/shabnam.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

@font-face {
  font-family: "Chortke Sans";
  src: url("fonts/shabnam-medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

@font-face {
  font-family: "Chortke Sans";
  src: url("fonts/shabnam-bold.woff2") format("woff2");
  font-weight: 600 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

/* ---------------------------------------------------------------- tokens */

/*
 * Palette: one brand blue, green/red only for money (owed to you / you owe), and eight
 * harmonised hues of similar lightness and saturation for categories and icons. Hues are
 * shown as soft tints (coloured symbol on a 14–22% wash), never as loud solid blocks, so no
 * single colour (like a bright yellow) jumps out. Neutrals are slightly cool.
 */
:root {
  color-scheme: dark;

  /* Surfaces */
  --bg: #0b0d12;
  --sheet: #12151c;
  --card: #161a22;
  --card-raised: #1d222c;
  --fill: rgba(148, 163, 184, 0.16);
  --fill2: rgba(148, 163, 184, 0.1);
  --separator: rgba(148, 163, 184, 0.16);
  --glass: rgba(18, 21, 28, 0.74);
  --glass-edge: rgba(255, 255, 255, 0.08);
  --glass-shine: rgba(255, 255, 255, 0.05);

  /* Labels */
  --text: #f3f5f9;
  --text2: rgba(226, 232, 240, 0.64);
  --text3: rgba(226, 232, 240, 0.34);

  /* Brand and meaning. --accent is for text/icons on dark surfaces; --accent-fill is the
     deeper shade behind white text (buttons), so both pass WCAG contrast. */
  --accent: #7b96ff;
  --accent-fill: #4260f0;
  --on-accent: #ffffff;
  --green: #32d583;
  --green-text: #47cd89;
  --red: #f97066;
  --red-text: #fd8a80;
  --amber: #fdb022;

  /* Harmonised hues (categories, icons, charts) */
  --hue-blue: #7b96ff;
  --hue-indigo: #8098f9;
  --hue-violet: #a48afb;
  --hue-teal: #2ed3b7;
  --hue-green: #32d583;
  --hue-rose: #fd6f8e;
  --hue-coral: #f38744;
  --hue-amber: #f5b14a;
  --hue-slate: #98a2b3;
  --tint-mix: 20%;

  /* Legacy names mapped onto the palette */
  --orange: var(--hue-coral);
  --yellow: var(--hue-amber);
  --indigo: var(--hue-indigo);
  --teal: var(--hue-teal);
  --pink: var(--hue-rose);
  --brown: var(--hue-amber);
  --gray: var(--hue-slate);

  /* Washes */
  --accent-glow: color-mix(in srgb, var(--accent) 18%, transparent);
  --green-dim: color-mix(in srgb, var(--green) 16%, transparent);
  --red-dim: color-mix(in srgb, var(--red) 16%, transparent);
  --gold: var(--hue-coral);
  --gold-dim: color-mix(in srgb, var(--hue-coral) 16%, transparent);
  --blue: var(--accent);
  --blue-dim: var(--accent-glow);

  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
  --shadow-float: 0 16px 40px -8px rgba(0, 0, 0, 0.6);
  --sheet-overlay: rgba(4, 6, 10, 0.6);
  --wheel-stroke: rgba(11, 13, 18, 0.9);

  --r-xl: 26px;
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;

  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --font-fa: "Chortke Sans", -apple-system, BlinkMacSystemFont, "SF Pro Text", Tahoma, sans-serif;
  --font-en: "Chortke Sans", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  /* Letter-spacing breaks the joins of Persian script, so only Latin text is tightened. */
  --tracking-tight: 0;
  font-family: var(--font-fa);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6fa;
  --sheet: #f4f6fa;
  --card: #ffffff;
  --card-raised: #ffffff;
  --fill: rgba(15, 23, 42, 0.07);
  --fill2: rgba(15, 23, 42, 0.045);
  --separator: rgba(15, 23, 42, 0.09);
  --glass: rgba(255, 255, 255, 0.78);
  --glass-edge: rgba(255, 255, 255, 0.9);
  --glass-shine: rgba(255, 255, 255, 0.7);

  --text: #0b1220;
  --text2: rgba(15, 23, 42, 0.62);
  --text3: rgba(15, 23, 42, 0.34);

  --accent: #3a5bff;
  --accent-fill: #3a5bff;
  --green: #12b76a;
  --green-text: #067647;
  --red: #f04438;
  --red-text: #d92d20;
  --amber: #f79009;

  --hue-blue: #3a5bff;
  --hue-indigo: #4e5ba6;
  --hue-violet: #7a5af8;
  --hue-teal: #0e9384;
  --hue-green: #079455;
  --hue-rose: #e31b54;
  --hue-coral: #e0612b;
  --hue-amber: #b54708;
  --hue-slate: #475467;
  --tint-mix: 11%;

  --accent-glow: color-mix(in srgb, var(--accent) 11%, transparent);
  --green-dim: color-mix(in srgb, var(--green) 12%, transparent);
  --red-dim: color-mix(in srgb, var(--red) 10%, transparent);
  --gold-dim: color-mix(in srgb, var(--hue-coral) 11%, transparent);

  --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 16px -4px rgba(16, 24, 40, 0.07);
  --shadow-float: 0 12px 36px -6px rgba(16, 24, 40, 0.18);
  --sheet-overlay: rgba(15, 23, 42, 0.32);
  --wheel-stroke: rgba(255, 255, 255, 0.95);
}

:root[lang="en"] {
  --tracking-tight: -0.4px;
  font-family: var(--font-en);
}

/* ------------------------------------------------------------------ base */

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

input,
select {
  outline: none;
}

img {
  display: block;
}

.ico {
  display: block;
  width: 100%;
  height: 100%;
}

/* Chortke logo (brandLogo() in shared.js). The slot sets the size; the mark has its own frame,
   so slots have no tile background. Stops follow the brand tokens in both themes. */
.brand-logo {
  display: block;
  width: 100%;
  height: 100%;
}

.logo-from {
  stop-color: var(--accent-fill);
}

.logo-to {
  stop-color: var(--hue-violet);
}

.is-hidden {
  display: none !important;
}

.value-green {
  color: var(--green-text);
}

.value-red {
  color: var(--red-text);
}

.value-gold {
  color: var(--hue-coral);
}

/* Larger text zooms the whole page. Lengths set from the real screen (dvh, the keyboard
   inset) are divided by --zoom, or a sheet grows taller than the screen. */
:root {
  --zoom: 1;
}

:root.large-text {
  --zoom: 1.15;
}

:root.large-text body {
  zoom: var(--zoom);
}

button:focus-visible,
summary:focus-visible,
select:focus-visible,
.form-input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Glyph tile: a coloured symbol on a soft wash of the same hue (tinted icon style). */
.glyph {
  --tint: var(--hue-slate);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--tint) var(--tint-mix), transparent);
  color: var(--tint);
  padding: 9px;
}

.tint-blue { --tint: var(--hue-blue); }
.tint-indigo { --tint: var(--hue-indigo); }
.tint-violet,
.tint-yellow { --tint: var(--hue-violet); }
.tint-teal { --tint: var(--hue-teal); }
.tint-green { --tint: var(--hue-green); }
.tint-pink,
.tint-red { --tint: var(--hue-rose); }
.tint-orange { --tint: var(--hue-coral); }
.tint-amber,
.tint-brown { --tint: var(--hue-amber); }
.tint-gray { --tint: var(--hue-slate); }


/* Press feedback: a small scale + dim, like UIKit highlight states. */
.tile,
.setting-row,
.group-card,
.expense-item,
.rdt-row,
.member-chip,
.mpick,
.cat-btn,
.date-choice,
.trip-pill,
.hero-note,
.member-row,
.status-btn,
.submit-btn,
.btn-confirm,
.btn-cancel,
.copy-btn,
.settle-btn,
.nav-item,
.nav-add {
  transition: transform 160ms var(--ease), opacity 160ms ease, background-color 160ms ease;
}

.tile:active,
.setting-row:active,
.group-card:active,
.expense-item:active,
.rdt-row:active,
.member-chip:active,
.mpick:active,
.cat-btn:active,
.date-choice:active,
.trip-pill:active,
.hero-note:active,
.member-row:active,
.status-btn:active,
.submit-btn:active,
.btn-confirm:active,
.btn-cancel:active,
.copy-btn:active,
.settle-btn:active {
  opacity: 0.75;
  transform: scale(0.97);
}

/* --------------------------------------------------------------- screens */

.screen {
  display: none;
  min-height: 100dvh;
  flex-direction: column;
}

.screen.active {
  display: flex;
}

.app {
  min-height: 100dvh;
}

/* --------------------------------------------------------------- loading */

.loading-shell,
.center-card {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  width: calc(100% - 32px);
  max-width: 480px;
  min-height: 70dvh;
  margin: auto;
  padding: 28px 20px;
  text-align: center;
}

.loading-shell h1,
.center-card h1 {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: var(--tracking-tight);
}

.center-card p {
  max-width: 320px;
  color: var(--text2);
  font-size: 16px;
}

.empty-add-btn {
  width: 100%;
  max-width: 320px;
  margin-top: 18px;
}

.loading-slogan {
  color: var(--text2);
  font-size: 15px;
  font-weight: 600;
}

.loader {
  margin-bottom: 18px;
}

.loader.inline {
  width: 28px;
  height: 28px;
  margin: 24px auto;
  border: 3px solid var(--fill);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

.abacus-loader {
  display: grid;
  place-items: center;
  width: 108px;
  height: 108px;
  border-radius: 26px;
  background: var(--card);
  box-shadow: var(--shadow-float);
}

.abacus-frame {
  position: relative;
  display: grid;
  gap: 13px;
  width: 76px;
  padding: 18px 0;
  border-right: 3px solid var(--accent);
  border-left: 3px solid var(--green);
}

.abacus-frame::before,
.abacus-frame::after {
  position: absolute;
  right: -4px;
  left: -4px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), var(--accent));
  content: "";
}

.abacus-frame::before {
  top: 5px;
}

.abacus-frame::after {
  bottom: 5px;
}

.abacus-rail {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: var(--fill);
}

.abacus-rail span {
  position: absolute;
  top: 50%;
  right: var(--start);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: inset 0 2px 3px rgba(255, 255, 255, 0.35), 0 2px 6px rgba(0, 0, 0, 0.18);
  transform: translate(0, -50%);
  animation: beadSlide 1800ms cubic-bezier(0.2, 0.9, 0.25, 1) infinite;
}

.abacus-rail span:nth-child(1) { --start: 3px; --shift: 5px; animation-delay: 0ms; }
.abacus-rail span:nth-child(2) { --start: 20px; --shift: -5px; animation-delay: 150ms; }
.abacus-rail span:nth-child(3) { --start: 37px; --shift: 5px; animation-delay: 300ms; }
.abacus-rail span:nth-child(4) { --start: 54px; --shift: -5px; animation-delay: 450ms; }

.rail-1 span { background: var(--accent-fill); }
.rail-2 span { background: var(--hue-violet); animation-duration: 1900ms; }
.rail-3 span { background: var(--hue-teal); animation-duration: 2000ms; }

@keyframes beadSlide {
  0%, 9%, 20%, 100% { transform: translate(0, -50%); }
  4%, 7% { transform: translate(var(--shift), -50%); }
}

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

/* ---------------------------------------------------------- group picker */

.gp-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(18px + env(safe-area-inset-top)) 20px 6px;
}

.gp-logo {
  display: block;
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
}

.empty-logo {
  display: block;
  width: 72px;
  height: 72px;
  margin-bottom: 12px;
}

.gp-title {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: var(--tracking-tight);
  line-height: 1.2;
}

.gp-sub {
  color: var(--text2);
  font-size: 14px;
}

.gp-kicker {
  padding: 18px 20px 8px;
  color: var(--text2);
  font-size: 13px;
  font-weight: 600;
}

.gp-list {
  margin: 0 16px;
  overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--card);
  box-shadow: var(--shadow-card);
}

.group-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 72px;
  border: 0;
  background: transparent;
  padding: 12px 16px;
  text-align: start;
}

.group-card + .group-card::before {
  position: absolute;
  top: 0;
  inset-inline: 72px 0;
  height: 0.5px;
  background: var(--separator);
  content: "";
}

.group-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  overflow: hidden;
  border-radius: 12px;
  color: #fff;
  font-size: 16px;
  font-weight: 800;
}

.gi-green { background: linear-gradient(160deg, #3ccb9a, #0e9384); }
.gi-gold { background: linear-gradient(160deg, #ff9f6e, #e0612b); }
.gi-purple { background: linear-gradient(160deg, #a48afb, #6938ef); }
.gi-red { background: linear-gradient(160deg, #fd6f8e, #c01048); }
.group-icon.has-photo { background: var(--fill); }

.group-info {
  flex: 1;
  min-width: 0;
}

.group-name {
  overflow: hidden;
  font-size: 16px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  color: var(--text2);
  font-size: 13px;
}

.group-side {
  display: flex;
  align-items: center;
  gap: 8px;
}

.group-badge {
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.gb-green { background: var(--green-dim); color: var(--green-text); }
.gb-red { background: var(--red-dim); color: var(--red-text); }
.gb-gray { background: var(--fill2); color: var(--text2); }

.gp-footer {
  padding: 14px 24px 32px;
  color: var(--text2);
  font-size: 13px;
  text-align: center;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-inline-start: auto;
}

.theme-toggle,
.lang-toggle {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: var(--card);
  color: var(--accent);
  padding: 9px;
  box-shadow: var(--shadow-card);
}

.ping-dot {
  position: relative;
  display: inline-block;
  width: 8px;
  height: 8px;
}

.ping-dot::before,
.ping-dot::after {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--green);
  content: "";
}

.ping-dot::after {
  animation: ping 1.8s infinite;
}

@keyframes ping {
  to { opacity: 0; transform: scale(2.2); }
}

/* ------------------------------------------------------------ main shell */

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 0.5px solid var(--separator);
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(22px);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 640px;
  margin: 0 auto;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
}

.header-left {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.header-title {
  min-width: 0;
}

.group-name-header {
  overflow: hidden;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: var(--tracking-tight);
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-sub-header {
  overflow: hidden;
  color: var(--text2);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.back-btn {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--fill2);
  color: var(--accent);
  padding: 10px;
}

/* Same 40px slot as the back button; shown on top-level pages instead of it. */
.header-logo {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  padding: 4px;
}

/* «Back» points the way you came: to the right in Persian, to the left in English. */
[dir="ltr"] .back-btn .ico {
  transform: scaleX(-1);
}

.avatar-btn {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  overflow: hidden;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(160deg, var(--teal), var(--accent));
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}

.avatar-btn.has-photo {
  background: var(--fill);
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.content {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px calc(116px + env(safe-area-inset-bottom));
}

.page {
  display: none;
}

.page.active {
  display: contents;
}

/* ------------------------------------------------------ floating tab bar */

.bottom-nav {
  position: fixed;
  right: 12px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  left: 12px;
  z-index: 200;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: center;
  max-width: 560px;
  height: 68px;
  margin: 0 auto;
  border: 0.5px solid var(--glass-edge);
  border-radius: 34px;
  background: var(--glass);
  padding: 0 6px;
  box-shadow: var(--shadow-float), inset 0 1px 0 var(--glass-shine);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
}

.nav-item,
.nav-add {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 58px;
  border: 0;
  border-radius: 26px;
  background: transparent;
  color: var(--gray);
}

.nav-icon {
  width: 26px;
  height: 26px;
}

.nav-label {
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.nav-item.active {
  background: var(--fill2);
  color: var(--accent);
}

.nav-add {
  color: var(--accent);
}

.nav-add-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent-fill);
  color: var(--on-accent);
  padding: 8px;
  box-shadow: 0 6px 16px var(--accent-glow);
  transition: transform 160ms var(--ease);
}

.nav-add-icon .ico {
  stroke-width: 2.4;
}

.nav-add:active .nav-add-icon {
  transform: scale(0.92);
}

.nav-badge {
  position: absolute;
  top: 4px;
  inset-inline-end: calc(50% - 22px);
  min-width: 18px;
  height: 18px;
  border: 2px solid var(--card);
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  padding: 0 4px;
  font-size: 10px;
  font-weight: 800;
  line-height: 14px;
  text-align: center;
}

/* ------------------------------------------------------- section chrome */

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: -4px;
  padding: 0 4px;
}

.section-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: var(--tracking-tight);
}

.section-title.inner {
  margin-bottom: 10px;
  font-size: 17px;
}

.section-link {
  min-height: 36px;
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 4px 6px;
  font-size: 15px;
  font-weight: 600;
}

.subsection-title {
  margin: 6px 4px -6px;
  color: var(--text2);
  font-size: 13px;
  font-weight: 600;
}

.helper-text {
  padding: 0 4px;
  color: var(--text2);
  font-size: 14px;
  line-height: 1.7;
}

.badge {
  border-radius: 999px;
  padding: 3px 10px;
  background: var(--fill2);
  color: var(--text2);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-accent { background: var(--accent-glow); color: var(--accent); }
/* Counts are neutral information, so they use the brand wash, not a warning colour. */
.badge-gold { background: var(--accent-glow); color: var(--accent); }
.badge-red { background: var(--red-dim); color: var(--red-text); }
.badge-gray { background: var(--fill2); color: var(--text2); }

.card {
  border-radius: var(--r-lg);
  background: var(--card);
  padding: 16px;
  box-shadow: var(--shadow-card);
}

/* ---------------------------------------------------------------- hero */

/* The balance card: one glance answers "do I owe, or am I owed?". */
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: var(--r-xl);
  background:
    radial-gradient(120% 80% at 100% 0%, var(--hero-tint), transparent 62%),
    linear-gradient(180deg, var(--card-raised), var(--card));
  padding: 18px 18px 16px;
  box-shadow: var(--shadow-card), inset 0 0.5px 0 var(--glass-shine);
  --hero-tint: color-mix(in srgb, var(--green) 16%, transparent);
  --hero-ink: var(--green-text);
}

.status-debt { --hero-tint: color-mix(in srgb, var(--red) 16%, transparent); --hero-ink: var(--red-text); }
.status-even { --hero-tint: var(--accent-glow); --hero-ink: var(--accent); }

.hero-glow {
  position: absolute;
  z-index: -1;
  inset-inline-end: -40px;
  top: -60px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: var(--hero-tint);
  filter: blur(40px);
  opacity: 0.9;
}

/* The trip pill drops to its own line when it does not fit, so the title never breaks. */
.hero-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 10px;
  min-height: 32px;
}

.status-title {
  color: var(--text2);
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
}

.status-even .status-title {
  color: var(--text);
  font-size: 22px;
  font-weight: 800;
}

.hero-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.status-amount {
  margin-top: 8px;
  color: var(--hero-ink);
  font-size: 36px;
  font-weight: 800;
  letter-spacing: var(--tracking-tight);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.status-amount:empty {
  display: none;
}

.status-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: var(--hero-tint);
  color: var(--hero-ink);
  padding: 6px;
}

.status-icon .ico {
  stroke-width: 2.4;
}

.status-sub {
  margin-top: 6px;
  color: var(--text2);
  font-size: 15px;
  line-height: 1.7;
}

.status-rows {
  margin-top: 14px;
  overflow: hidden;
  border-radius: var(--r-md);
  background: var(--fill2);
}

.status-rows:empty {
  display: none;
}

.status-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 10px 12px;
}

.status-row + .status-row::before {
  position: absolute;
  top: 0;
  inset-inline: 12px 0;
  height: 0.5px;
  background: var(--separator);
  content: "";
}

.status-row-text {
  flex: 1;
  min-width: 0;
}

.status-row-name {
  overflow: hidden;
  font-size: 15px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-row-amount {
  color: var(--text2);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.status-btn {
  flex: 0 0 auto;
  min-width: 88px;
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  font-size: 15px;
  font-weight: 700;
}

.status-btn-primary {
  background: var(--accent-fill);
  color: var(--on-accent);
  box-shadow: 0 6px 16px var(--accent-glow);
}

.status-btn-ghost {
  background: var(--accent-glow);
  color: var(--accent);
}

.hero-more {
  display: block;
  width: 100%;
  min-height: 40px;
  margin-top: 8px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
}

.hero-note {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  margin-top: 12px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--accent-glow);
  padding: 8px 12px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-align: start;
}

.hero-note-icon {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  color: var(--accent);
}

.hero-note-text {
  flex: 1;
  min-width: 0;
}

.hero-note-action {
  flex: 0 0 auto;
  color: var(--accent);
  font-weight: 800;
}

/* Active trip: a small pill in the hero instead of its own row. */
.trip-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-height: 32px;
  border: 0;
  border-radius: 999px;
  background: var(--fill2);
  padding: 4px 6px 4px 12px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

[dir="rtl"] .trip-pill {
  padding: 4px 12px 4px 6px;
}

.trip-pill-icon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  color: var(--accent);
}

.trip-pill-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trip-pill-action {
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--accent-fill);
  padding: 2px 10px;
  color: var(--on-accent);
  font-size: 12px;
}

.trip-pill.inside {
  background: var(--accent-fill);
  color: var(--on-accent);
}

.trip-pill.inside .trip-pill-icon {
  color: #fff;
}

.trip-pill.inside .trip-pill-action {
  background: rgba(255, 255, 255, 0.24);
}

.group-total {
  padding: 0 4px;
  color: var(--text2);
  font-size: 14px;
}

.group-total:empty {
  display: none;
}

/* ---------------------------------------------------------------- promo */

/* Edge-to-edge carousel, one whole slide at a time: a peeking neighbour showed cut-off
   words, so the dots say there is more. The gap equals the side padding to keep the
   neighbours fully off screen. */
.promo {
  margin-inline: -16px;
}

.promo-track {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 16px;
  scrollbar-width: none;
  padding: 2px 16px 14px;
}

.promo-track::-webkit-scrollbar {
  display: none;
}

.promo-slide {
  position: relative;
  isolation: isolate;
  display: flex;
  flex: 0 0 100%;
  gap: 6px;
  min-width: 0;
  min-height: 178px;
  overflow: hidden;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  border-radius: var(--r-xl);
  background:
    radial-gradient(90% 120% at 0% 0%, color-mix(in srgb, var(--promo-c) 55%, transparent), transparent 55%),
    linear-gradient(140deg, var(--promo-a) 0%, var(--promo-b) 100%);
  color: #fff;
  padding: 16px;
  box-shadow:
    0 14px 30px -12px var(--promo-shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    inset 0 0 0 0.5px rgba(255, 255, 255, 0.12);
  transition: transform 180ms var(--ease);
}

.promo-slide.is-linked {
  cursor: pointer;
}

.promo-slide.is-linked:active {
  transform: scale(0.985);
}

/* Promo themes, shared by carousel slides and placement strips. "gold" is a warm sunset
   (coral to rose) rather than yellow, so every theme sits in the same palette. */
.promo-blue { --promo-a: #5b7bff; --promo-b: #2c46e0; --promo-c: #a9bbff; --promo-shadow: rgba(44, 70, 224, 0.38); }
.promo-green { --promo-a: #22c58b; --promo-b: #0b7f5c; --promo-c: #9df0cf; --promo-shadow: rgba(11, 127, 92, 0.34); }
.promo-gold { --promo-a: #ff8f5a; --promo-b: #e2445c; --promo-c: #ffc9a8; --promo-shadow: rgba(226, 68, 92, 0.34); }
.promo-purple { --promo-a: #9b7bff; --promo-b: #5a32e0; --promo-c: #d2c4ff; --promo-shadow: rgba(90, 50, 224, 0.36); }
.promo-red { --promo-a: #ff5f86; --promo-b: #c01048; --promo-c: #ffb8c9; --promo-shadow: rgba(192, 16, 72, 0.34); }
.promo-dark { --promo-a: #2a3142; --promo-b: #0c1018; --promo-c: #6f8bff; --promo-shadow: rgba(0, 0, 0, 0.45); }

/* Soft light blobs give the flat gradient some depth. */
.promo-decor {
  position: absolute;
  z-index: -1;
  inset: 0;
  background:
    radial-gradient(60% 70% at 100% 100%, rgba(255, 255, 255, 0.18), transparent 60%),
    radial-gradient(30% 40% at 18% 108%, rgba(0, 0, 0, 0.18), transparent 70%);
  pointer-events: none;
}

.promo-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.promo-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 11px;
  font-weight: 700;
}

.promo-ad {
  flex: 0 0 auto;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.22);
  padding: 1px 7px;
  color: #fff;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.promo-advertiser {
  min-width: 0;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.82);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.promo-title {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: var(--tracking-tight);
  line-height: 1.4;
  text-wrap: balance;
}

.promo-title > span:last-child {
  display: -webkit-box;
  min-width: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.promo-title-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  margin-top: 1px;
  border-radius: 9px;
  background: #fff;
  color: var(--promo-b);
  padding: 5px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.14);
}

.promo-lines {
  display: grid;
  gap: 7px;
  list-style: none;
}

.promo-line {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.94);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.45;
  text-align: start;
}

button.promo-line {
  min-height: 30px;
}

.promo-line-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  padding: 4px;
}

.promo-line-icon .ico {
  stroke-width: 2.2;
}

.promo-line-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

button.promo-line .promo-line-text {
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.4);
  text-underline-offset: 4px;
}

.promo-side {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.promo-art {
  display: grid;
  place-items: center;
  width: 76px;
  height: 80px;
}

/* Glassy, tilted, gently floating tile: the "3D" illustration. */
.promo-art-glyph {
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  border-radius: 22px;
  background:
    radial-gradient(90% 70% at 30% 15%, #fff, rgba(255, 255, 255, 0.82) 55%, rgba(255, 255, 255, 0.62));
  color: var(--promo-b);
  padding: 15px;
  box-shadow:
    0 18px 30px -8px rgba(0, 0, 0, 0.35),
    inset 0 -6px 12px rgba(0, 0, 0, 0.08),
    inset 0 2px 0 #fff;
  transform: perspective(260px) rotateY(-16deg) rotateX(10deg) rotate(-5deg);
  animation: promo-float 5s ease-in-out infinite;
}

.promo-art-glyph .ico {
  stroke-width: 1.7;
}

@keyframes promo-float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -5px; }
}

.promo-art-img {
  max-width: 80px;
  max-height: 80px;
  object-fit: contain;
  filter: drop-shadow(0 12px 16px rgba(0, 0, 0, 0.28));
}

.promo-cta {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 34px;
  border-radius: 999px;
  background: #fff;
  padding: 0 8px 0 14px;
  color: var(--promo-b);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.16);
}

[dir="rtl"] .promo-cta {
  padding: 0 14px 0 8px;
}

.promo-cta-icon {
  width: 16px;
  height: 16px;
}

.promo-cta-icon .ico {
  stroke-width: 2.6;
}

[dir="rtl"] .promo-cta-icon {
  transform: scaleX(-1);
}

/* Media promos: the uploaded image or video fills the card. */
.promo-media {
  flex-direction: column;
  justify-content: flex-end;
  /* Shown while the image or video loads. */
  background: linear-gradient(140deg, var(--promo-a), var(--promo-b));
}

.promo-media-el {
  position: absolute;
  z-index: -2;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.promo-media-shade {
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.32) 0%, transparent 32%, transparent 45%, rgba(0, 0, 0, 0.72) 100%);
}

.promo-media .promo-meta {
  position: absolute;
  top: 12px;
  inset-inline-start: 12px;
}

.promo-media-info {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.promo-media .promo-title {
  font-size: 17px;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
}

.promo-media .promo-cta {
  color: #111;
}

/* Dots double as a progress bar for the auto-advance. */
.promo-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: -4px;
}

.promo-dot {
  position: relative;
  width: 6px;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--fill);
  transition: width 260ms var(--ease);
}

.promo-dot.active {
  width: 24px;
  background: var(--fill);
}

.promo-dot.active::after {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--text2);
  content: "";
}

.promo.autoplay .promo-dot.active::after {
  transform-origin: right;
  animation: promo-progress var(--promo-ms, 6s) linear forwards;
}

[dir="ltr"] .promo.autoplay .promo-dot.active::after {
  transform-origin: left;
}

@keyframes promo-progress {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* Cheaper placements: a compact sponsored strip on the settle, expenses and more pages. */
.ad-strip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 76px;
  overflow: hidden;
  border-radius: var(--r-lg);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--promo-a) 14%, transparent), transparent 70%),
    var(--card);
  padding: 10px 12px;
  box-shadow: var(--shadow-card), inset 0 0 0 0.5px color-mix(in srgb, var(--promo-a) 22%, transparent);
  transition: transform 140ms var(--ease);
}

[dir="rtl"] .ad-strip {
  background:
    linear-gradient(270deg, color-mix(in srgb, var(--promo-a) 14%, transparent), transparent 70%),
    var(--card);
}

.ad-strip.is-linked {
  cursor: pointer;
}

.ad-strip.is-linked:active {
  transform: scale(0.98);
}


.ad-strip-thumb {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  overflow: hidden;
  border-radius: 14px;
  background: linear-gradient(140deg, var(--promo-a), var(--promo-b));
  box-shadow: 0 6px 14px -6px var(--promo-b);
}

.ad-strip-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ad-strip-glyph {
  width: 28px;
  height: 28px;
  color: #fff;
}

.ad-strip-text {
  display: grid;
  flex: 1;
  gap: 3px;
  min-width: 0;
}

.ad-strip-title {
  display: -webkit-box;
  overflow: hidden;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.ad-strip-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--text2);
  font-size: 12px;
}

.ad-strip-tag {
  flex: 0 0 auto;
  border-radius: 5px;
  background: var(--fill);
  padding: 0 6px;
  font-size: 11px;
  font-weight: 700;
}

.ad-strip-advertiser {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ad-strip.closing {
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 200ms ease, transform 200ms var(--ease);
}

.ad-strip-close {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  align-self: flex-start;
  /* 44px tap target (project rule) around a 16px cross; a near miss must not open the ad. */
  width: 44px;
  height: 44px;
  margin: -10px;
  margin-inline-start: -6px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text3);
  padding: 14px;
}

.ad-strip-cta {
  flex: 0 0 auto;
  border-radius: 999px;
  background: linear-gradient(140deg, var(--promo-a), var(--promo-b));
  padding: 7px 14px;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

/* ------------------------------------------------------------ members */

.members-list {
  overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--card);
  box-shadow: var(--shadow-card);
}

.member-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 62px;
  border: 0;
  background: transparent;
  padding: 10px 14px;
  text-align: start;
}

.member-row + .member-row::before {
  position: absolute;
  top: 0;
  inset-inline: 60px 0;
  height: 0.5px;
  background: var(--separator);
  content: "";
}

.member-row .av {
  width: 40px;
  height: 40px;
  font-size: 14px;
}

.member-row-info {
  flex: 1;
  min-width: 0;
}

.member-balance:not(.value-green):not(.value-red) {
  color: var(--text2);
}

.member-sub {
  overflow: hidden;
  color: var(--text2);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-balance {
  flex: 0 0 auto;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------- banners & rows */

/* Inset-grouped lists */
.expense-list,
#my-settlements,
#remind-list,
#other-settlements,
#trip-list {
  overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--card);
  box-shadow: var(--shadow-card);
}

.expense-item,
.trip-row,
.remind-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 68px;
  border: 0;
  background: transparent;
  padding: 10px 14px;
  text-align: start;
}

.expense-item + .expense-item::before,
.trip-row + .trip-row::before,
.remind-row + .remind-row::before,
.settle-card + .settle-card::before {
  position: absolute;
  top: 0;
  inset-inline: 66px 0;
  height: 0.5px;
  background: var(--separator);
  content: "";
}

.expense-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--gray);
  color: #fff;
  padding: 9px;
}

.expense-info {
  flex: 1;
  min-width: 0;
}

.expense-title {
  overflow: hidden;
  font-size: 15px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expense-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  color: var(--text2);
  font-size: 12px;
}

.dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text3);
}

.expense-right {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 46%;
  text-align: end;
}

.expense-amount {
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* «پرداخت:» stays whole; a long name is cut at its own end, whatever its script. */
.expense-payer {
  display: flex;
  justify-content: flex-end;
  gap: 0.3em;
  color: var(--text2);
  font-size: 12px;
  white-space: nowrap;
}

.expense-payer bdi {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  unicode-bidi: plaintext;
}

.receipt-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  border: 0;
  border-radius: 999px;
  background: var(--accent-glow);
  color: var(--accent);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
}

.receipt-btn .ico {
  width: 14px;
  height: 14px;
}

.slide-up {
  animation: slideUp 320ms var(--ease) both;
}

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

.empty {
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 26px 16px;
  color: var(--text2);
  text-align: center;
}

.empty-icon {
  width: 34px;
  height: 34px;
  color: var(--text3);
}

.empty-text,
.empty-state {
  color: var(--text2);
  font-size: 14px;
}

.empty-state {
  padding: 26px 16px;
  text-align: center;
}

/* --------------------------------------------------------------- members */

.members-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 4px;
  scrollbar-width: none;
}

.members-row::-webkit-scrollbar {
  display: none;
}

.members-row.wrap {
  flex-wrap: wrap;
  overflow: visible;
}

.member-chip {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  background: var(--card);
  padding: 6px 14px 6px 8px;
  font-size: 14px;
  text-align: start;
  box-shadow: var(--shadow-card);
}

[dir="rtl"] .member-chip {
  padding: 6px 8px 6px 14px;
}

.member-chip.selected {
  background: var(--accent-fill);
  color: var(--on-accent);
}

.member-name {
  font-weight: 600;
  line-height: 1.3;
}

.member-debt {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.member-chip.selected .member-debt {
  color: inherit;
}

/* Avatars */
.av,
.settle-av {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  overflow: hidden;
  border-radius: 50%;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.settle-av {
  width: 44px;
  height: 44px;
  font-size: 14px;
}

/* Avatars use the same harmonised hues, light-to-deep. */
.av1 { background: linear-gradient(160deg, #7b96ff, #3a5bff); }
.av2 { background: linear-gradient(160deg, #3ccb9a, #0e9384); }
.av3 { background: linear-gradient(160deg, #ff9f6e, #e0612b); }
.av4 { background: linear-gradient(160deg, #fd6f8e, #c01048); }
.av5 { background: linear-gradient(160deg, #a48afb, #6938ef); }

.av.has-photo,
.settle-av.has-photo {
  background: var(--fill);
}

/* ------------------------------------------------------------ trips page */

#trips-page-list {
  overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--card);
  box-shadow: var(--shadow-card);
}

.scope-chip {
  align-self: flex-start;
  min-height: 40px;
  border: 0;
  border-radius: 999px;
  background: var(--fill2);
  color: var(--text);
  padding: 0 16px;
  font-size: 14px;
  font-weight: 700;
}

.scope-chip.active {
  background: var(--accent-fill);
  color: var(--on-accent);
}

.trip-row.active {
  background: var(--accent-glow);
}

.trip-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.settle-btn,
.danger-mini {
  min-height: 36px;
  border: 0;
  border-radius: 999px;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.settle-btn {
  background: var(--accent-glow);
  color: var(--accent);
}

.danger-mini {
  background: var(--red-dim);
  color: var(--red-text);
}

/* ----------------------------------------------------------- settle page */

.settle-card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 14px;
}

.settle-card .settlement-action {
  grid-column: 1 / -1;
  min-height: 44px;
  background: var(--accent-fill);
  color: var(--on-accent);
  font-size: 15px;
}

.settle-person {
  display: grid;
  justify-items: center;
  gap: 4px;
  min-width: 0;
  text-align: center;
}

.settle-name {
  max-width: 100%;
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settle-middle {
  display: grid;
  justify-items: center;
  gap: 4px;
}

.settle-amt-badge {
  border-radius: 999px;
  background: var(--fill2);
  padding: 4px 12px;
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.settle-amt-badge-red {
  background: var(--red-dim);
  color: var(--red-text);
}

.arrow-line {
  position: relative;
  width: 64px;
  height: 2px;
  border-radius: 2px;
  background: var(--fill);
}

.arrow-line::after {
  position: absolute;
  top: -4px;
  inset-inline-end: -2px;
  width: 8px;
  height: 8px;
  border-top: 2px solid var(--fill);
  border-inline-end: 2px solid var(--fill);
  content: "";
  transform: rotate(45deg);
}

[dir="rtl"] .arrow-line::after {
  transform: rotate(-45deg);
}

.settle-caption {
  max-width: 120px;
  overflow: hidden;
  color: var(--text2);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-link {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
}

.item-main {
  flex: 1;
  min-width: 0;
}

.item-title {
  font-size: 15px;
  font-weight: 700;
}

.item-sub {
  color: var(--text2);
  font-size: 13px;
}

.others-box {
  display: grid;
  gap: 10px;
}

.others-box > summary {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin: 0;
  cursor: pointer;
  list-style: none;
}

.others-box > summary::-webkit-details-marker {
  display: none;
}

.others-box > summary::after,
.more-options > summary::after {
  width: 8px;
  height: 8px;
  margin-inline-start: 4px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  content: "";
  transform: translateY(-2px) rotate(45deg);
  transition: transform 200ms var(--ease);
}

.others-box[open] > summary::after,
.more-options[open] > summary::after {
  transform: translateY(2px) rotate(-135deg);
}

/* ------------------------------------------------------------- more page */

.tile-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 104px;
  border: 0;
  border-radius: var(--r-lg);
  background: var(--card);
  padding: 14px 6px;
  box-shadow: var(--shadow-card);
}

.tile-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  padding: 11px;
}

.tile-label {
  font-size: 14px;
  font-weight: 600;
}

.settings-list {
  overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--card);
  box-shadow: var(--shadow-card);
}

.setting-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 56px;
  border: 0;
  background: transparent;
  padding: 8px 16px;
  font-size: 16px;
  text-align: start;
}

.setting-row + .setting-row::before {
  position: absolute;
  top: 0;
  inset-inline: 62px 0;
  height: 0.5px;
  background: var(--separator);
  content: "";
}

.setting-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  padding: 6px;
}

.setting-label {
  flex: 1;
}

.setting-chevron {
  width: 18px;
  height: 18px;
  color: var(--text3);
}

[dir="rtl"] .setting-chevron {
  transform: scaleX(-1);
}

/* iOS switch */
.switch {
  position: relative;
  flex: 0 0 auto;
  width: 51px;
  height: 31px;
  border-radius: 999px;
  background: var(--fill);
  transition: background-color 220ms ease;
}

.switch::after {
  position: absolute;
  top: 2px;
  inset-inline-start: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 1px 1px rgba(0, 0, 0, 0.16);
  content: "";
  transition: inset-inline-start 220ms var(--ease);
}

.switch.on {
  background: var(--green);
}

.switch.on::after {
  inset-inline-start: 22px;
}

/* --------------------------------------------------------------- lottery */

.lottery-stage {
  display: grid;
  place-items: center;
  gap: 18px;
  border-radius: var(--r-xl);
  background: var(--card);
  padding: 32px 16px 20px;
  box-shadow: var(--shadow-card);
}

.wheel-frame {
  position: relative;
  display: grid;
  place-items: center;
  width: min(252px, 72vw);
  aspect-ratio: 1;
}

.wheel {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border: 8px solid var(--fill2);
  border-radius: 50%;
  background: var(--fill2);
  box-shadow: var(--shadow-float);
  transition: transform 6.2s cubic-bezier(0.08, 0.78, 0.06, 1);
  will-change: transform;
}

.wheel-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.wheel-segment {
  stroke: var(--wheel-stroke);
  stroke-linejoin: round;
  stroke-width: 3;
}

.wheel-segment.winner {
  filter: brightness(1.18);
}

.wheel-pointer {
  position: absolute;
  top: -18px;
  z-index: 4;
  width: 0;
  height: 0;
  border-right: 12px solid transparent;
  border-left: 12px solid transparent;
  border-top: 24px solid var(--text);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.wheel-core {
  position: absolute;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--card-raised);
  color: var(--text);
  font-size: 24px;
  font-weight: 800;
  box-shadow: var(--shadow-float);
}

.wheel-label {
  position: absolute;
  inset: calc(50% - 17px);
  z-index: 2;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  overflow: hidden;
  border: 1.5px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  backdrop-filter: blur(6px);
}

.wheel-label.winner {
  background: #fff;
  color: #000;
}

.wheel-label.has-photo {
  background: var(--fill);
  color: transparent;
}

.lottery-result {
  min-height: 26px;
  font-size: 17px;
  font-weight: 800;
  text-align: center;
}

/* Pick lists (participants, lottery) */
.member-pick-list {
  overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--card);
  box-shadow: var(--shadow-card);
}

.mpick {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 54px;
  border: 0;
  background: transparent;
  padding: 8px 14px;
  font-size: 16px;
  text-align: start;
}

.mpick + .mpick::before,
.split-input-row + .split-input-row::before {
  position: absolute;
  top: 0;
  inset-inline: 60px 0;
  height: 0.5px;
  background: var(--separator);
  content: "";
}

.mpick-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.check {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border: 1.5px solid var(--text3);
  border-radius: 50%;
  color: transparent;
  padding: 4px;
}

.mpick.sel .check {
  border-color: var(--accent);
  background: var(--accent-fill);
  color: #fff;
}

.check .ico {
  stroke-width: 3;
}

/* ---------------------------------------------------------------- report */

.balance-label {
  color: var(--text2);
  font-size: 13px;
  font-weight: 600;
}

.report-total {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 2px 0 14px;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: var(--tracking-tight);
  font-variant-numeric: tabular-nums;
}

.report-total span {
  color: var(--text2);
  font-size: 15px;
  font-weight: 600;
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.mini-grid div {
  display: grid;
  gap: 2px;
  border-radius: var(--r-md);
  background: var(--fill2);
  padding: 10px 12px;
}

.mini-grid span {
  color: var(--text2);
  font-size: 12px;
}

.mini-grid strong {
  font-size: 17px;
  font-weight: 800;
  white-space: nowrap;
}

.mini-grid strong small {
  color: var(--text2);
  font-size: 12px;
  font-weight: 700;
}

.chart-bar-wrap {
  display: grid;
  gap: 12px;
}

.chart-row {
  display: grid;
  grid-template-columns: minmax(0, 8rem) 1fr auto;
  align-items: center;
  gap: 10px;
}

.chart-label {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  font-size: 13px;
  white-space: nowrap;
}

.chart-label .glyph {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  padding: 4px;
}

.chart-bar-bg {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--fill2);
}

.chart-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 700ms var(--ease);
}

.bar-gold,
.bar-coral { background: var(--hue-coral); }
.bar-purple,
.bar-violet { background: var(--hue-violet); }
.bar-indigo { background: var(--hue-indigo); }
.bar-green { background: var(--hue-green); }
.bar-teal { background: var(--hue-teal); }
.bar-red,
.bar-rose { background: var(--hue-rose); }
.bar-blue { background: var(--hue-blue); }
.bar-amber { background: var(--hue-amber); }
.bar-slate { background: var(--hue-slate); }

/* Month-by-month chart on the report page: one series, one hue (accent); the selected month is
   full strength, the others recede. Columns are buttons, at least 44px wide and tall. */
.month-chart {
  display: flex;
  align-items: stretch;
  gap: 6px;
  padding-top: 4px;
}

.month-col {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 44px;
  min-height: 150px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  padding: 4px 0;
  color: var(--text2);
}

.month-col:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.month-val {
  margin-bottom: 4px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  visibility: hidden;
}

.month-col.is-selected .month-val {
  color: var(--text);
  visibility: visible;
}

.month-track {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  padding-top: 18px;
  border-bottom: 1px solid var(--separator);
}

.month-fill {
  width: 60%;
  max-width: 28px;
  border-radius: 4px 4px 0 0;
  background: color-mix(in srgb, var(--accent) 38%, transparent);
  transition: height 500ms var(--ease);
}

.month-col.is-selected .month-fill {
  background: var(--accent);
}

.month-name {
  font-size: 12px;
  white-space: nowrap;
}

.month-col.is-selected .month-name {
  color: var(--text);
  font-weight: 600;
}

.month-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0 8px;
  border-top: 1px solid var(--separator);
  padding-top: 12px;
  font-size: 14px;
}

.month-detail-head strong {
  font-variant-numeric: tabular-nums;
}

.chart-val {
  color: var(--text2);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.rdt-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  border: 0;
  background: transparent;
  padding: 8px 0;
  text-align: start;
}

.rdt-row + .rdt-row {
  border-top: 0.5px solid var(--separator);
}

.rdt-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--gray);
  color: #fff;
  padding: 7px;
}

.rdt-info {
  flex: 1;
  min-width: 0;
}

.rdt-name {
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rdt-meta {
  color: var(--text2);
  font-size: 12px;
}

.rdt-amount,
.lb-amount {
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* ----------------------------------------------------------- leaderboard */

.leaderboard-list {
  overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--card);
  box-shadow: var(--shadow-card);
}

.lb-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 10px 14px;
}

.lb-item + .lb-item {
  border-top: 0.5px solid var(--separator);
}

.lb-rank {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--fill2);
  color: var(--text2);
  font-size: 13px;
  font-weight: 800;
}

/* Medal discs instead of medal emoji */
/* Podium badges in palette colours: brand, slate, coral. */
.lb-rank.rank1 { background: linear-gradient(150deg, #7b96ff, #3a5bff); color: #fff; }
.lb-rank.rank2 { background: linear-gradient(150deg, #b9c2d0, #667085); color: #fff; }
.lb-rank.rank3 { background: linear-gradient(150deg, #ff9f6e, #e0612b); color: #fff; }

.lb-info {
  flex: 1;
  min-width: 0;
}

.lb-name {
  font-size: 15px;
  font-weight: 700;
}

.lb-sub {
  color: var(--text2);
  font-size: 12px;
}

/* ---------------------------------------------------------------- sheets */

.overlay {
  position: fixed;
  inset: 0 0 calc(var(--keyboard-inset, 0px) / var(--zoom));
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: var(--sheet-overlay);
  opacity: 0;
  pointer-events: none;
  transition: opacity 280ms ease;
}

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

.sheet {
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: calc(min(94dvh, calc(var(--visible-height, 100dvh) - 12px)) / var(--zoom));
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 28px 28px 0 0;
  background: var(--sheet);
  padding: 8px 18px calc(28px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.25);
  transform: translateY(100%);
  transition: transform 420ms var(--ease);
}

.overlay.open .sheet {
  transform: translateY(0);
}

/* Inside a dark sheet, grouped content sits one elevation level higher. */
:root:not([data-theme="light"]) .sheet {
  --card: #20252f;
  --fill2: rgba(148, 163, 184, 0.13);
}

.sheet-handle {
  width: 36px;
  height: 5px;
  margin: 0 auto 10px;
  border-radius: 999px;
  background: var(--fill);
}

.sheet-close {
  position: absolute;
  top: 14px;
  inset-inline-end: 14px;
  z-index: 2;
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  background: var(--fill2);
  color: var(--accent);
  padding: 0 14px;
  font-size: 15px;
  font-weight: 600;
}

.sheet-title {
  /* Clear of the "close" button in the corner, also for long titles. */
  margin: 14px 0 20px;
  padding-inline: 72px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: var(--tracking-tight);
  text-align: center;
}

/* ----------------------------------------------------------------- forms */

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  margin: 0 4px 8px;
  color: var(--text2);
  font-size: 14px;
  font-weight: 600;
}

.form-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.optional {
  color: var(--text3);
  font-size: 12px;
  font-weight: 500;
}

/* Split by receipt items */
.member-pick-list.is-items {
  overflow: visible;
  background: transparent;
  box-shadow: none;
}

.receipt-item {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
  border-radius: var(--r-lg);
  background: var(--card);
  box-shadow: var(--shadow-card);
  padding: 12px;
}

.receipt-item-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.receipt-item-head .form-input {
  min-height: 44px;
  background: var(--fill2);
  box-shadow: none;
  font-size: 15px;
}

.receipt-item-title {
  flex: 1 1 auto;
  min-width: 0;
}

.receipt-item-amount {
  flex: 0 0 116px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.receipt-item-remove {
  display: grid;
  flex: 0 0 44px;
  place-items: center;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text2);
}

.receipt-item-remove .ico {
  width: 18px;
  height: 18px;
}

.receipt-item-remove:disabled {
  opacity: 0.3;
}

.receipt-item-people {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.item-person {
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  background: var(--fill2);
  color: var(--text2);
  padding: 0 14px;
  font-size: 14px;
  font-weight: 600;
}

.item-person.active {
  background: var(--accent-fill);
  color: var(--on-accent);
}

.receipt-item-add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 48px;
  border: 1px dashed var(--separator);
  border-radius: var(--r-lg);
  background: transparent;
  color: var(--accent);
  font-size: 15px;
  font-weight: 600;
}

.receipt-item-add .ico {
  width: 18px;
  height: 18px;
}

.receipt-totals {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.receipt-sum {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  font-size: 15px;
}

.receipt-sum strong {
  font-variant-numeric: tabular-nums;
}

.link-btn {
  min-height: 32px;
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 0 4px;
  font-size: 14px;
  font-weight: 600;
}

.form-input {
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--card);
  padding: 0 16px;
  font-size: 16px;
  box-shadow: var(--shadow-card);
  transition: box-shadow 160ms ease;
}

.form-input:focus {
  box-shadow: 0 0 0 3px var(--accent-glow), var(--shadow-card);
}

.form-input::placeholder {
  color: var(--text3);
}

select.form-input {
  appearance: none;
}

.amt-wrap {
  position: relative;
}

.form-input.amount-inp {
  min-height: 72px;
  padding-inline: 80px 18px;
  direction: ltr;
  text-align: center;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: var(--tracking-tight);
  font-variant-numeric: tabular-nums;
}

.amt-cur {
  position: absolute;
  top: 50%;
  left: 18px;
  color: var(--text2);
  font-size: 15px;
  font-weight: 600;
  transform: translateY(-50%);
}

.amount-words {
  min-height: 24px;
  margin-top: 8px;
  color: var(--accent);
  font-size: 15px;
  font-weight: 700;
  text-align: center;
}

.cat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.cat-btn {
  display: grid;
  justify-items: center;
  gap: 6px;
  min-height: 84px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--card);
  padding: 12px 4px 10px;
  box-shadow: var(--shadow-card);
}

.cat-btn.sel {
  box-shadow: 0 0 0 2.5px var(--accent), var(--shadow-card);
}

.cat-emoji {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  padding: 8px;
}

.cat-label {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
}

/* iOS segmented control */
.split-tabs {
  display: flex;
  gap: 2px;
  border-radius: 10px;
  background: var(--fill);
  padding: 2px;
}

.split-tab {
  flex: 1;
  min-height: 44px;
  padding: 0 6px;
  white-space: nowrap;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
}

@media (max-width: 360px) {
  .split-tab {
    font-size: 13px;
  }
}

.split-tab.active {
  background: var(--card-raised);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 1px 1px rgba(0, 0, 0, 0.06);
}

:root:not([data-theme="light"]) .split-tab.active {
  background: #3a4150;
}

.scope-tab {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
}

.scope-tab svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
}

.scope-tab span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scope-tab.active {
  color: var(--accent);
}

.scope-note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  border-radius: var(--r-md);
  background: var(--fill2);
  padding: 12px 14px;
  color: var(--text2);
  font-size: 14px;
  line-height: 1.7;
}

.scope-note svg {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
}

.split-input-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 8px 14px;
}

.split-input-name {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  font-size: 15px;
}

.split-input-share {
  color: var(--text2);
  font-size: 12px;
  font-weight: 500;
}

.split-input-share:empty {
  display: none;
}

.split-total {
  margin-top: 8px;
  border-radius: var(--r-md);
  background: var(--fill2);
  padding: 10px 14px;
  color: var(--text2);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

.split-total.over {
  color: var(--red-text);
}

.split-total.ok {
  color: var(--green-text);
}

.split-value-input {
  width: clamp(104px, 34vw, 132px);
  min-height: 44px;
  background: var(--fill2);
  box-shadow: none;
  text-align: center;
}

.date-choice-grid {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.date-choice-grid::-webkit-scrollbar {
  display: none;
}

.date-choice {
  display: grid;
  flex: 0 0 auto;
  gap: 2px;
  min-width: 96px;
  min-height: 60px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--card);
  padding: 8px 12px;
  box-shadow: var(--shadow-card);
}

.date-choice strong {
  font-size: 14px;
}

.date-choice span {
  color: var(--text2);
  font-size: 12px;
}

.date-choice.active {
  background: var(--accent-fill);
  color: var(--on-accent);
}

.date-choice.active span {
  color: rgba(255, 255, 255, 0.8);
}

.receipt-upload {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  border: 1.5px dashed var(--fill);
  border-radius: var(--r-md);
  background: var(--card);
  padding: 8px 14px;
  color: var(--text2);
  cursor: pointer;
  font-size: 14px;
}

.receipt-upload input {
  display: none;
}

.receipt-pick {
  display: flex;
  align-items: center;
  gap: 8px;
}

.receipt-pick .receipt-upload {
  flex: 1 1 auto;
  min-width: 0;
}

.receipt-upload-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.receipt-upload.has-file {
  border-style: solid;
  border-color: var(--accent);
  color: var(--text);
  font-weight: 600;
}

.receipt-clear {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: var(--fill2);
  color: var(--text2);
  padding: 14px;
}

.receipt-hint {
  margin-top: 6px;
}

.receipt-upload-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-glow);
  color: var(--accent);
  padding: 7px;
}

.more-options {
  margin-bottom: 16px;
  border-radius: var(--r-lg);
  background: var(--fill2);
  padding: 0 14px;
}

.more-options[open] {
  padding-bottom: 4px;
}

.more-options > summary {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 52px;
  color: var(--accent);
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  list-style: none;
}

.more-options > summary::-webkit-details-marker {
  display: none;
}

.submit-bar {
  position: sticky;
  bottom: calc(-28px - env(safe-area-inset-bottom));
  margin: 0 -18px calc(-28px - env(safe-area-inset-bottom));
  border-top: 0.5px solid var(--separator);
  background: var(--glass);
  padding: 10px 18px calc(18px + env(safe-area-inset-bottom));
  backdrop-filter: saturate(180%) blur(22px);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
}

.split-summary {
  margin-bottom: 8px;
  color: var(--text2);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

.split-summary.ready {
  color: var(--green-text);
}

.submit-btn,
.btn-confirm {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--accent-fill);
  color: var(--on-accent);
  font-size: 17px;
  font-weight: 700;
}

.submit-btn-outline,
.btn-cancel {
  width: 100%;
  min-height: 52px;
  margin-top: 10px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--fill2);
  color: var(--accent);
  font-size: 17px;
  font-weight: 600;
}

.btn-cancel {
  margin-top: 0;
}

.confirm-row {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 10px;
  margin-top: 6px;
}

/* ------------------------------------------------- confirm / pay sheet */

.confirm-box {
  display: grid;
  justify-items: center;
  gap: 4px;
  margin-bottom: 18px;
  text-align: center;
}

.confirm-box .icon {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  margin-bottom: 4px;
  border-radius: 50%;
  background: var(--accent-glow);
  color: var(--accent);
  padding: 15px;
}

.confirm-box .title {
  color: var(--text2);
  font-size: 15px;
  font-weight: 600;
}

.confirm-box .amount {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: var(--tracking-tight);
  font-variant-numeric: tabular-nums;
}

.confirm-box .sub {
  color: var(--text2);
  font-size: 14px;
}

.pay-card {
  position: relative;
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  overflow: hidden;
  border-radius: var(--r-lg);
  background:
    radial-gradient(90% 120% at 100% 0%, rgba(255, 255, 255, 0.18), transparent 50%),
    linear-gradient(135deg, #3a5bff, #1b2a8f);
  color: #fff;
  padding: 18px;
  text-align: center;
  box-shadow: var(--shadow-float);
}

.pay-card-label {
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.pay-card-number {
  min-height: 44px;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  font: inherit;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 1.5px;
  font-variant-numeric: tabular-nums;
  text-align: start;
  cursor: pointer;
  -webkit-user-select: all;
  user-select: all;
}

.settle-part-toggle {
  min-height: 44px;
}

#settle-part-note.is-error {
  color: var(--red-text);
}

.pay-card-holder {
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
}

.pay-card-missing {
  background: var(--card);
  color: var(--text2);
  font-size: 15px;
  line-height: 1.8;
  box-shadow: var(--shadow-card);
}

.pay-card select.form-input {
  margin-top: 6px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  box-shadow: none;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  margin-top: 6px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
}

.copy-btn .ico {
  width: 20px;
  height: 20px;
}

.pay-steps {
  display: grid;
  gap: 6px;
  margin: 0 0 16px;
  padding-inline-start: 24px;
  color: var(--text2);
  font-size: 15px;
  line-height: 1.7;
}

.help-steps {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
  list-style: none;
}

.help-steps li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-radius: var(--r-lg);
  background: var(--card);
  padding: 14px;
  font-size: 16px;
  line-height: 1.7;
  box-shadow: var(--shadow-card);
}

.help-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent-fill);
  color: #fff;
  padding: 8px;
}

/* ---------------------------------------------------------- detail sheets */

.detail-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 14px 0 16px;
  /* Clear of the "close" button in the corner, also for long names. */
  padding-inline-end: 72px;
}

.detail-header > :last-child {
  min-width: 0;
}

.detail-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border-radius: 15px;
  background: var(--gray);
  color: #fff;
  padding: 12px;
}

.detail-title {
  font-size: 20px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.detail-meta {
  color: var(--text2);
  font-size: 13px;
}

.detail-amount {
  margin-bottom: 14px;
  font-size: 32px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.split-list,
.card-list {
  overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--card);
  box-shadow: var(--shadow-card);
}

.split-row,
.payment-card-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 10px 14px;
}

.split-row + .split-row,
.payment-card-row + .payment-card-row {
  border-top: 0.5px solid var(--separator);
}

.split-row-name {
  flex: 1;
  min-width: 0;
  font-size: 15px;
}

.split-row-sub {
  color: var(--text2);
  font-size: 12.5px;
}

.split-row-amt {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.split-row-status {
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
}

.profile-row {
  cursor: pointer;
}

.profile-row .split-row-amt {
  color: var(--accent);
}

.card-manager {
  margin-top: 18px;
}

.card-form {
  display: grid;
  gap: 8px;
  margin: 8px 0 12px;
}

.card-form .settle-btn {
  min-height: 48px;
  background: var(--accent-fill);
  color: var(--on-accent);
  font-size: 16px;
}

.payment-card-main {
  flex: 1;
  min-width: 0;
}

.payment-card-number {
  direction: ltr;
  font-size: 15px;
  font-weight: 700;
  text-align: start;
  font-variant-numeric: tabular-nums;
}

.payment-card-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
}

.payment-card-actions button {
  min-height: 44px;
}

/* Card digits read left to right in groups of four; the empty field keeps the Persian hint on the right. */
.card-number-input {
  font-variant-numeric: tabular-nums;
}

.card-number-input:placeholder-shown {
  direction: rtl;
}

.bot-msg-preview {
  border-radius: var(--r-lg);
  background: var(--card);
  padding: 14px;
  box-shadow: var(--shadow-card);
}

.bot-msg-label {
  margin-bottom: 6px;
  color: var(--text2);
  font-size: 13px;
}

.bot-msg-bubble {
  border-radius: 18px;
  background: var(--accent-fill);
  color: #fff;
  padding: 10px 14px;
  font-size: 15px;
  line-height: 1.7;
}

/* ----------------------------------------------------------------- toast */

/* Last-seen data on a slow connection (loadApp): a small note at the top, never in the way. */
.stale-pill {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top));
  left: 50%;
  z-index: 450;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  border: 0.5px solid var(--glass-edge);
  border-radius: 999px;
  background: var(--glass);
  color: var(--text2);
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.toast {
  position: fixed;
  right: 16px;
  bottom: calc(92px + env(safe-area-inset-bottom));
  left: 16px;
  z-index: 500;
  max-width: 520px;
  margin: 0 auto;
  border: 0.5px solid var(--glass-edge);
  border-radius: 18px;
  background: var(--glass);
  color: var(--text);
  padding: 14px 18px;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(0.98);
  transition: opacity 220ms ease, transform 320ms var(--ease);
  box-shadow: var(--shadow-float);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
}

.toast.show {
  opacity: 1;
  pointer-events: auto; /* tap to dismiss */
  transform: none;
}

.toast-green::before,
.toast-red::before {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-inline-end: 8px;
  border-radius: 50%;
  vertical-align: middle;
  content: "";
}

.toast-green::before { background: var(--green); }
.toast-red::before { background: var(--red); }

/* -------------------------------------------------------- edit / undo */

.btn-icon {
  display: inline-block;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
}

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

.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  border: 0;
  border-radius: 14px;
  background: var(--accent-glow);
  color: var(--accent);
  font-size: 16px;
  font-weight: 700;
}

.ghost-btn.danger {
  background: var(--red-dim);
  color: var(--red-text);
}

.ghost-btn .btn-icon {
  width: 20px;
  height: 20px;
}

.detail-note {
  margin-top: 10px;
  font-size: 12px;
  text-align: center;
}

.ghost-wide {
  width: 100%;
  min-height: 50px;
  margin-top: 14px;
  border: 0;
  border-radius: 14px;
  background: var(--accent-glow);
  color: var(--accent);
  font-size: 15px;
  font-weight: 700;
}

.ghost-wide.danger-wide {
  background: var(--red-dim);
  color: var(--red-text);
}

.hist-cancel {
  position: relative;
  min-height: 30px;
  margin-top: 2px;
  border: 0;
  border-radius: 999px;
  background: var(--fill2);
  padding: 2px 12px;
  color: var(--red-text);
  font-size: 12px;
  font-weight: 700;
}

/* Small to look at, 44px to tap. */
.hist-cancel::after {
  position: absolute;
  inset: -7px -6px;
  content: "";
}

.member-row.is-former {
  opacity: 0.6;
}

/* --------------------------------------------------------------- policy */

.policy-tabs {
  margin-bottom: 14px;
}

.policy-body {
  display: grid;
  gap: 12px;
}

.policy-section {
  border-radius: var(--r-lg);
  background: var(--card);
  padding: 14px 16px;
  box-shadow: var(--shadow-card);
}

.policy-section h3 {
  margin-bottom: 8px;
  font-size: 16px;
  font-weight: 800;
}

.policy-section ul {
  display: grid;
  gap: 6px;
  padding-inline-start: 18px;
  color: var(--text2);
  font-size: 14px;
  line-height: 1.8;
}

.policy-updated {
  margin-top: 12px;
  font-size: 12px;
  text-align: center;
}

/* ---------------------------------------------------------------- motion */

/* Pages slide up softly when they open; cards and rows give a small press response. */
.page.active > * {
  animation: page-in 320ms var(--ease) both;
}

.page.active > *:nth-child(2) { animation-delay: 40ms; }
.page.active > *:nth-child(3) { animation-delay: 80ms; }
.page.active > *:nth-child(4) { animation-delay: 120ms; }

@keyframes page-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 360px) {
  .nav-label { font-size: 10px; }
  .tile-grid { gap: 8px; }
  .promo-art { width: 66px; height: 66px; }
  .promo-art-glyph { width: 60px; height: 60px; padding: 14px; }
}

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

  .wheel {
    transition-duration: 6.2s !important;
  }
}

:root[lang="fa"] .pay-steps {
  list-style-type: persian;
}

.promo-lines li {
  min-width: 0;
}

/* Larger text exists for people who need to read every word: wrap, never truncate. */
:root.large-text .promo-line-text,
:root.large-text .status-row-name,
:root.large-text .expense-title,
:root.large-text .expense-payer,
:root.large-text .expense-payer bdi {
  overflow: visible;
  white-space: normal;
}

/* With larger text a row stacks, like iOS at accessibility sizes: the amount and the payer go
   under the title instead of squeezing it to one word per line. */
:root.large-text .expense-item {
  flex-wrap: wrap;
  row-gap: 4px;
}

:root.large-text .expense-right {
  flex: 1 1 100%;
  max-width: none;
  padding-inline-start: 56px;
  text-align: start;
}

:root.large-text .expense-payer {
  display: block;
}

/* ------------------------------------------------- search, activity, recurring */

.setting-text {
  display: grid;
  flex: 1;
  gap: 1px;
  min-width: 0;
}

.setting-sub {
  color: var(--text2);
  font-size: 12.5px;
}

.setting-row:disabled {
  opacity: 1;
}

.setting-row:disabled .switch,
.setting-row.is-locked .switch {
  opacity: 0.55;
}

.expense-item.is-tappable {
  cursor: pointer;
}

.expense-search {
  position: relative;
}

.expense-search .form-input {
  min-height: 44px;
  padding-inline-start: 42px;
}

.expense-search-icon {
  position: absolute;
  top: 50%;
  inset-inline-start: 14px;
  width: 18px;
  height: 18px;
  color: var(--text3);
  transform: translateY(-50%);
  pointer-events: none;
}

.filter-chips {
  display: flex;
  gap: 8px;
  margin-inline: -16px;
  overflow-x: auto;
  padding: 2px 16px 4px;
  scrollbar-width: none;
}

.filter-chips::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  flex: 0 0 auto;
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  background: var(--fill2);
  color: var(--text);
  padding: 0 14px;
  font-size: 14px;
  font-weight: 600;
}

.filter-chip.active {
  background: var(--accent-fill);
  color: #fff;
}

.filter-empty {
  padding: 18px 8px;
  color: var(--text2);
  text-align: center;
}

.activity-list {
  overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--card);
  box-shadow: var(--shadow-card);
}

.activity-list:empty {
  display: none;
}

.activity-row {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
}

.activity-row + .activity-row::before {
  position: absolute;
  top: 0;
  inset-inline: 58px 0;
  height: 0.5px;
  background: var(--separator);
  content: "";
}

.activity-row .glyph {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  padding: 7px;
}

.activity-text {
  display: grid;
  flex: 1;
  gap: 2px;
  min-width: 0;
  font-size: 15px;
  line-height: 1.55;
}

.activity-time {
  color: var(--text2);
  font-size: 12.5px;
}

.detail-history {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  border-radius: var(--r-md);
  background: var(--fill2);
  padding: 12px 14px;
  font-size: 13.5px;
}

.detail-receipt {
  margin-top: 14px;
}

.detail-receipt-photo,
.detail-receipt-file {
  display: flex;
  width: 100%;
  border: 0;
  border-radius: var(--r-md);
  background: var(--fill2);
  color: var(--text);
  font: inherit;
  text-align: start;
}

.detail-receipt-photo {
  position: relative;
  overflow: hidden;
  padding: 0;
}

.detail-receipt-photo img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
}

.detail-receipt-label {
  position: absolute;
  inset-block-end: 10px;
  inset-inline-start: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 700;
}

.detail-receipt-label .ico {
  width: 16px;
  height: 16px;
}

.detail-receipt-file {
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 8px 14px;
  font-size: 15px;
  font-weight: 600;
}

.detail-receipt-photo.is-broken {
  min-height: 56px;
  align-items: center;
  padding: 8px 14px;
  color: var(--text2);
  font-size: 14px;
}

.detail-history-title {
  color: var(--text2);
  font-size: 12.5px;
  font-weight: 700;
}

.recurring-stop {
  min-height: 36px;
  border: 0;
  border-radius: 999px;
  background: var(--fill2);
  color: var(--red-text);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 700;
}

.repeat-note {
  margin-top: 8px;
}

/* ------------------------------------------------------------ tinted icons */

/* Last in the file so it wins over each icon container's own defaults: every tinted
   container shows its symbol in the hue on a soft wash of the same hue. */
:is(.tint-blue, .tint-indigo, .tint-violet, .tint-yellow, .tint-teal, .tint-green, .tint-pink,
  .tint-red, .tint-orange, .tint-amber, .tint-brown, .tint-gray) {
  background: color-mix(in srgb, var(--tint) var(--tint-mix), transparent);
  color: var(--tint);
}

/* Split by items: tax or service and a discount, under the items. */
.receipt-extras {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.receipt-extra {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--text2);
  font-size: 13px;
  font-weight: 600;
}

.receipt-extra .form-input {
  min-height: 44px;
  font-size: 15px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Settle tab inside a trip: the whole group's account says less is owed. */
.trip-group-note {
  margin-bottom: 10px;
  border-radius: var(--r-md);
  background: var(--fill2);
  padding: 10px 14px;
}

/* ------------------------------------------------------- names in any script */

/* Names and titles people type can be Persian or English. Each one takes its own direction,
   so a long English name in the Persian app (or a Persian one in English) is cut at its end,
   not its start, and «@username» reads left to right. */
.group-name,
.group-name-header,
.expense-title,
.rdt-name,
.status-row-name,
.settle-name,
.mpick-name,
.member-name,
.member-sub,
.lb-name,
.detail-title {
  unicode-bidi: plaintext;
}

/* Lined up with the page, not with the name's own direction (Chrome aligns a plaintext
   paragraph by its own direction, even with match-parent). */
:root[dir="rtl"] :is(.group-name, .group-name-header, .expense-title, .rdt-name, .status-row-name, .mpick-name, .member-name, .member-sub, .lb-name, .detail-title) {
  text-align: right;
}

:root[dir="ltr"] :is(.group-name, .group-name-header, .expense-title, .rdt-name, .status-row-name, .mpick-name, .member-name, .member-sub, .lb-name, .detail-title) {
  text-align: left;
}

.settle-name {
  text-align: center;
}

/* A narrow picker (small phone, larger text): the balance badge goes under the group's name
   instead of squeezing it to a few letters. */
.gp-list {
  container-type: inline-size;
}

@container (max-width: 340px) {
  .group-card {
    flex-wrap: wrap;
    row-gap: 6px;
  }

  .group-side {
    width: 100%;
    padding-inline-start: 56px;
  }
}
