/* دُنگ: mobile-first, RTL. Colours come only from the theme tokens below (list: server/themes.js). */

@font-face { font-family: "Vazirmatn"; src: url("/fonts/Vazirmatn-FD-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("/fonts/Vazirmatn-FD-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

/* ============ Theme tokens ============
   Each theme sets the required tokens (--bg … --fab). The block below resets every optional one, on :root and on
   any [data-theme] element, so a theme never inherits another theme's extras (a preview card can carry data-theme). */
:root, [data-theme] {
  --radius: 16px;
  /* type scale (H11): the one place to resize text; nothing below 12px */
  --fs-body: 15px; --fs-h1: 1.15rem; --fs-h2: .95rem; --fs-hero: 1.2rem; --fs-hero-num: 1.3rem; --fs-big-num: 1.6rem; --fs-muted: .85rem; --fs-small: .8rem;
  --spec: 0; --bar-line: var(--line); --bar-filter: blur(18px) saturate(1.5);
  --surface: var(--card); --field: var(--card); --field-border: var(--card-border);
  --ink: var(--primary); --btn: var(--primary); --on-btn: var(--on-primary);
  --tab-shadow: 0 2px 8px -3px #0003;
  --fab-ink: #fff; --fab-glow: var(--primary); --fab-border: transparent;
  --nav: var(--bg-solid); --nav-on: var(--ink); /* --ink: the readable primary, ≥ 4.5:1 on --bg-solid in every theme (peach, lavender fail with --primary) */
  --toast: #14202be6; --toast-link: #8ee6da; --ico-amt: 16%;
  --danger-soft: color-mix(in srgb, var(--neg) 9%, transparent);
  --dash: color-mix(in srgb, var(--text) 24%, transparent);
  --placeholder: color-mix(in srgb, var(--text) 38%, transparent); /* clearly lighter than a real value (and than --muted) */
  --c1: transparent; --c2: transparent; --c3: transparent; --c4: transparent; --blob-o: 0; --blob-blur: 50px;
  --blob-shape: 50%; --blob-anim: float;
  --pattern: none; --ps: 56px; --pattern-o: 0; --pattern-show: none; --blob-show: block; --grain-o: 0; --grain-blend: multiply; --spot-o: 0; --scrim: transparent;
  color-scheme: light;
}
/* 1. Teal (default) */
:root:not([data-theme]), [data-theme="teal"] {
  --bg: #f3f6f6; --bg-solid: #f3f6f6; --text: #13202a; --muted: #5b6875; --line: #e3e9ea;
  --card: #fff; --card-border: #e3e9ea; --card-shadow: 0 1px 2px #14202b0d, 0 12px 26px -16px #14202b40;
  --bar: #f3f6f6bf; --primary: #0f766e; --on-primary: #fff; --soft: #e2f2ef; --pos: #0f766e; --neg: #c2334d;
  --tab-track: #e5ebeb; --tab-on: #fff; --fab: #0f766e;
  --c1: #9fe1d5; --c2: #cdeee8; --c3: #fde3b3; --c4: #bfe6f0; --blob-o: .5; --blob-blur: 60px;
  --pattern: radial-gradient(#0f766e2e 1px, transparent 1.6px); --ps: 18px; --pattern-o: .9; --pattern-show: block;
}
/* 2. Aurora night */
[data-theme="aurora"] {
  --bg: #061217; --bg-solid: #061217; --text: #e9f6f3; --muted: #93aeaa; --line: #ffffff17;
  --card: #ffffff0d; --card-solid: color-mix(in srgb, #fff 5%, #061217); --card-border: #ffffff1f;
  --card-shadow: 0 14px 30px -14px #000c; --spec: .45;
  --bar: #06121766; --primary: #2dd4bf; --on-primary: #03221e; --soft: #2dd4bf24; --pos: #5eead4; --neg: #fb7185;
  --field: #ffffff0d; --field-border: #ffffff26;
  --tab-track: #ffffff0d; --tab-on: #ffffff21; --tab-shadow: none; --fab: linear-gradient(135deg, #2dd4bf, #818cf8); --fab-ink: #03221e; --fab-glow: #2dd4bfaa;
  --toast: #ffffff1f; --ico-amt: 26%;
  --c1: #0d9488; --c2: #7c3aed; --c3: #0891b2; --c4: #16a34a; --blob-o: .6; --blob-blur: 55px; --grain-o: .12; --grain-blend: overlay;
  --blob-shape: 40% 60% 55% 45%; --blob-anim: aurora;
  color-scheme: dark;
}
/* 3. Peach & coral */
[data-theme="peach"] {
  --bg: #fff3ea; --bg-solid: #fff3ea; --text: #3b2721; --muted: color-mix(in srgb, #8b6b60 85%, #3b2721); --line: #78463220;
  --card: #ffffff8c; --card-solid: color-mix(in srgb, #fff 55%, #fff3ea); --card-border: #ffffffd9;
  --card-shadow: 0 14px 30px -18px #b45a3c66; --spec: .7;
  --bar: #fff3ea80; --bar-line: #ffffff99; --primary: #ec6a4f; --on-primary: #fff; --soft: #ffe1d6;
  --pos: color-mix(in srgb, #23936e 75%, #3b2721); --neg: color-mix(in srgb, #d6404d 75%, #3b2721);
  --ink: color-mix(in srgb, #ec6a4f 55%, #3b2721); --btn: color-mix(in srgb, #ec6a4f 70%, #3b2721);
  --field: #ffffffb3; --field-border: #78463233;
  --tab-track: #ffffff73; --tab-on: #fff; --fab: linear-gradient(135deg, #ff8a65, #ff6f91); --fab-glow: #ff7d8c; --fab-ink: #3b2721;
  --toast: #3b2721e0; --toast-link: #ffc2a8;
  --c1: #ffc2a1; --c2: #ffb3c6; --c3: #ffe39a; --c4: #ffd2bd; --blob-o: .85; --blob-blur: 48px; --grain-o: .05;
}
/* 4. Saffron & pistachio */
[data-theme="saffron"] {
  --bg: #fbf5e9; --bg-solid: #fbf5e9; --text: #2e2516; --muted: color-mix(in srgb, #7d6f58 88%, #2e2516); --line: #ecdfc6;
  --card: #fffcf5; --card-border: #efe3ca; --card-shadow: 0 1px 0 #efe3ca, 0 14px 26px -18px #78501466;
  --bar: #fbf5e9d9; --primary: #4d7c35; --on-primary: #fff; --soft: #e8f0da; --pos: #4d7c35; --neg: #b5442f;
  --ink: color-mix(in srgb, #4d7c35 85%, #2e2516);
  --field-border: #e3d3b3;
  --tab-track: #f1e6cf; --tab-on: #fffcf5; --fab: #4d7c35; --toast: #2e2516e6; --toast-link: #f3c36b;
  --c1: #f7d79a; --c2: #dbe9c3; --c3: #f5c9a0; --blob-o: .55; --blob-blur: 60px;
  --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cg fill='none' stroke='%23b07d2a' stroke-width='1'%3E%3Cpath d='M32 8l7 17 17 7-17 7-7 17-7-17-17-7 17-7z'/%3E%3Crect x='21' y='21' width='22' height='22' transform='rotate(45 32 32)'/%3E%3Cpath d='M0 0l8 8M64 0l-8 8M0 64l8-8M64 64l-8-8'/%3E%3C/g%3E%3C/svg%3E");
  --ps: 64px; --pattern-o: .16; --pattern-show: block;
}
/* 5. Lavender & mint */
[data-theme="lavender"] {
  --bg: #f4f1ff; --bg-solid: #f4f1ff; --text: #29243f; --muted: color-mix(in srgb, #6e6790 85%, #29243f); --line: #503ca01a;
  --card: #ffffff80; --card-solid: color-mix(in srgb, #fff 50%, #f4f1ff); --card-border: #ffffffe6;
  --card-shadow: 0 16px 34px -20px #5a46c866, inset 0 1px 0 #fff; --spec: 1;
  --bar: #f4f1ff73; --bar-line: #ffffffb3; --primary: #7457f5; --on-primary: #fff; --soft: #ebe5ff;
  --pos: color-mix(in srgb, #149174 70%, #29243f); --neg: color-mix(in srgb, #dd4169 72%, #29243f);
  --ink: color-mix(in srgb, #7457f5 82%, #29243f);
  --field: #ffffffb3; --field-border: #503ca033;
  --tab-track: #ffffff66; --tab-on: #ffffffe6; --fab: linear-gradient(135deg, #8b6cff, #46c9a5); --fab-glow: #8b6cff;
  --toast: #29243fd9; --toast-link: #b9f3df;
  --c1: #c7b5ff; --c2: #a6ecd5; --c3: #ffc6dc; --c4: #ffdfb5; --blob-o: .9; --blob-blur: 44px; --grain-o: .04;
}
/* 6. Pomegranate */
[data-theme="pomegranate"] {
  --bg: #fbf2ee; --bg-solid: #fbf2ee; --text: #2a1317; --muted: #806064; --line: #f0dcd6;
  --card: #fffaf8; --card-border: #f1dfd9; --card-shadow: 0 16px 30px -22px #6e142859;
  --bar: #fbf2eed9; --primary: #a5203c; --on-primary: #fff; --soft: #fbe2e6; --pos: #2c7a58; --neg: #c0392b;
  --field-border: #e8cdc5;
  --tab-track: #f3e2dd; --tab-on: #fffaf8; --fab: #a5203c; --toast: #2a1317e6; --toast-link: #f2c26b;
  --c1: #f7c6cf; --c2: #f9dcbf; --c3: #f3d0d6; --blob-o: .6; --blob-blur: 70px; --grain-o: .07;
}
/* 7. Paper & ink */
[data-theme="paper"] {
  --bg: #f4efe6; --bg-solid: #f4efe6; --text: #1e1a15; --muted: #6f665a; --line: #e3dbcd;
  --card: #fffdf8; --card-border: #e4dbcc; --card-shadow: 0 1px 0 #e4dbcc;
  --bar: #f4efe6f2; --primary: #1e1a15; --on-primary: #fbf6ec; --soft: #e9e1d2; --pos: #3b7457; --neg: color-mix(in srgb, #c4553b 80%, #1e1a15);
  --field-border: #d9cfbd;
  --tab-track: #e9e1d2; --tab-on: #fffdf8; --tab-shadow: 0 1px 0 #d9cfbd; --fab: #c4553b; --fab-glow: #c4553b; --toast: #1e1a15; --toast-link: #e9b75a;
  --grain-o: .12; --blob-show: none;
}
/* 8. Liquid glass on vivid teal. The scrim (its own deep teal) keeps white text readable over the light end. */
[data-theme="liquid"] {
  --bg: linear-gradient(165deg, #0b6b64 0%, #10a395 38%, #2fb5e6 72%, #9fe9cf 100%); --bg-solid: #0b6b64;
  --text: #fff; --muted: #ffffffeb; --line: #ffffff33;
  --card: linear-gradient(160deg, #ffffff24, #ffffff05); --card-solid: color-mix(in srgb, #fff 12%, #0b6b64); --card-border: #ffffff59;
  --spec: 1;
  --card-shadow: 0 20px 40px -22px #002a2a99, inset 0 1px 0 #ffffffa6, inset 0 -1px 0 #ffffff26;
  --bar: #0b6b6466; --bar-line: #ffffff33; --primary: #fff; --on-primary: #0b6b64; --soft: color-mix(in srgb, #0b6b64 80%, transparent); --pos: #e3fff6; --neg: #fff5f7;
  --field: #0b6b64b3; --field-border: #ffffff59;
  --tab-track: #ffffff1f; --tab-on: #0b6b64; --fab: linear-gradient(160deg, #ffffff66, #ffffff1f); --fab-border: #ffffff80; --fab-glow: #003c3c; --toast: #0b6b64cc;
  --toast-link: #c9fff0; --ico-amt: 30%;
  --c1: #5eead4; --c2: #38bdf8; --c3: #fde68a; --c4: #c4b5fd; --blob-o: .85; --blob-blur: 40px; --spot-o: 1; --scrim: #0b6b64d9;
  color-scheme: dark;
}
/* 9–11. Gold themes (themes.js `gold: true`; the plan decides who may keep one). */
[data-theme="goldnight"] {
  --bg: #0e0b06; --bg-solid: #0e0b06; --text: #f6efde; --muted: #b9ab8c; --line: #ffffff17;
  --card: #ffffff0d; --card-solid: color-mix(in srgb, #fff 6%, #0e0b06); --card-border: #e0b44c33;
  --card-shadow: 0 14px 30px -14px #000c; --spec: .35;
  --bar: #0e0b0670; --primary: #e0b44c; --on-primary: #1b1405; --soft: #e0b44c24; --pos: #ecc977; --neg: #fb9484;
  --field: #ffffff0d; --field-border: #e0b44c40;
  --tab-track: #ffffff0d; --tab-on: #e0b44c2e; --tab-shadow: none; --fab: linear-gradient(135deg, #f0cd75, #b98a2a); --fab-ink: #1b1405; --fab-glow: #e0b44caa;
  --toast: #ffffff1f; --ico-amt: 26%;
  --c1: #7a5a1e; --c2: #3b2a0c; --c3: #8a6a28; --c4: #4a3510; --blob-o: .55; --blob-blur: 55px; --grain-o: .12; --grain-blend: overlay;
  --blob-shape: 40% 60% 55% 45%; --blob-anim: aurora;
  color-scheme: dark;
}
[data-theme="turquoise"] {
  --bg: #eef6f4; --bg-solid: #eef6f4; --text: #12231f; --muted: #536864; --line: #d8e6e2;
  --card: #fffffff2; --card-border: #c8a24a66; --card-shadow: 0 1px 0 #c8a24a40, 0 14px 26px -18px #0f766e59;
  --bar: #eef6f4d9; --bar-line: #c8a24a55; --primary: #0f766e; --on-primary: #fff; --soft: #dcefe9; --pos: #0f766e; --neg: #b02a45;
  --field-border: #b9d3cd;
  --tab-track: #dbebe7; --tab-on: #fff; --fab: linear-gradient(135deg, #0f766e, #0c5f59); --fab-border: #c8a24a; --fab-glow: #0f766e;
  --toast: #12231fe6; --toast-link: #e9cf8a;
  --c1: #b5e3da; --c2: #f0e1b0; --c3: #cdeee8; --blob-o: .5; --blob-blur: 60px;
  --pattern: radial-gradient(#c8a24a40 1px, transparent 1.6px); --ps: 18px; --pattern-o: .9; --pattern-show: block;
}
[data-theme="amber"] {
  --bg: #fbf0d9; --bg-solid: #fbf0d9; --text: #2b1c07; --muted: #6a5532; --line: #ead9b4;
  --card: #fffaf0; --card-border: #ecdcb8; --card-shadow: 0 1px 0 #ecdcb8, 0 14px 26px -18px #8a5a1466;
  --bar: #fbf0d9d9; --primary: #8a5a14; --on-primary: #fff; --soft: #f6e2b5; --pos: #2f6b3a; --neg: #a8321f;
  --field-border: #e0cb9d;
  --tab-track: #f2e2bd; --tab-on: #fffaf0; --fab: linear-gradient(135deg, #e9a23b, #c4731a); --fab-ink: #2b1c07; --fab-glow: #e9a23b; --toast: #2b1c07e6; --toast-link: #f3c36b;
  --c1: #f8d58f; --c2: #f5c9a0; --c3: #fbe6b0; --blob-o: .6; --blob-blur: 58px; --grain-o: .05;
}
/* 12. Mint night (free, dark; pair of teal, turquoise, lavender): soft slate night, pastel mint and lilac. */
[data-theme="nightmint"] {
  --bg: radial-gradient(120% 80% at 85% 0%, #1e2a3c 0%, #161c2a 55%, #12161f 100%); --bg-solid: #161c2a;
  --text: #e9eef7; --muted: #a3afc2; --line: #ffffff14;
  --card: #ffffff0c; --card-solid: color-mix(in srgb, #fff 6%, #161c2a); --card-border: #ffffff1c;
  --card-shadow: 0 14px 30px -16px #0009; --spec: .4;
  --bar: #161c2a80; --primary: #9be3cb; --on-primary: #0f2a22; --soft: #9be3cb1f; --pos: #9be3cb; --neg: #ffaab6;
  --ink: #a8e8d3; --field: #ffffff0d; --field-border: #ffffff26;
  --tab-track: #ffffff0d; --tab-on: #ffffff1f; --tab-shadow: none;
  --fab: linear-gradient(135deg, #a8ecd6, #b9adf2); --fab-ink: #14202b; --fab-glow: #9be3cb99;
  --toast: #2a3448f0; --toast-link: #9be3cb; --ico-amt: 22%;
  --c1: #3d8f7c; --c2: #5d50a8; --c3: #2f6690; --c4: #8a5f9e; --blob-o: .5; --blob-blur: 60px; --grain-o: .07; --grain-blend: overlay;
  --pattern: radial-gradient(#ffffff1f 1px, transparent 1.4px); --ps: 26px; --pattern-o: .5; --pattern-show: block;
  color-scheme: dark;
}
/* 13. Peach dusk (free, dark; pair of peach, saffron, pomegranate, paper, amber): warm plum, pastel peach and rose. */
[data-theme="dusk"] {
  --bg: radial-gradient(130% 80% at 15% 0%, #3a2238 0%, #221828 55%, #1a1320 100%); --bg-solid: #221828;
  --text: #f7ebee; --muted: #c2abb3; --line: #ffffff14;
  --card: #ffffff0c; --card-solid: color-mix(in srgb, #fff 6%, #221828); --card-border: #ffd6c81f;
  --card-shadow: 0 14px 30px -16px #000a; --spec: .4;
  --bar: #22182880; --primary: #ffb8a0; --on-primary: #3a1a12; --soft: #ffb8a01f; --pos: #a6e3c4; --neg: #ffa3b4;
  --ink: #ffc2ad; --field: #ffffff0d; --field-border: #ffffff26;
  --tab-track: #ffffff0d; --tab-on: #ffffff1f; --tab-shadow: none;
  --fab: linear-gradient(135deg, #ffc4a8, #f3a6c4); --fab-ink: #3a1a12; --fab-glow: #ffb8a099;
  --toast: #3a2a36f0; --toast-link: #ffc2ad; --ico-amt: 22%;
  --c1: #b05a7a; --c2: #b8704e; --c3: #6a52a8; --c4: #c27a8e; --blob-o: .55; --blob-blur: 62px; --grain-o: .08; --grain-blend: overlay;
  color-scheme: dark;
}
/* 14. Pearl & gold (gold, light; pair of the gold dark themes): ivory and champagne, fine gold lines, deep warm ink. */
[data-theme="pearl"] {
  --bg: linear-gradient(170deg, #fdfaf3 0%, #f8f1e2 55%, #f3e9d6 100%); --bg-solid: #fbf7ef;
  --text: #1f1a12; --muted: #6b604e; --line: #e6dcc6;
  --card: linear-gradient(165deg, #ffffff, #fffaf0); --card-solid: #fffcf6; --card-border: #d4b46a73;
  --card-shadow: 0 1px 0 #ffffff, 0 16px 32px -20px #8a641880; --spec: .9;
  --bar: #fbf7efcc; --bar-line: #d4b46a66; --primary: #946b1e; --on-primary: #fff; --soft: #f5ead0; --pos: #2f6e4a; --neg: #a8322f;
  --ink: #7d5a14; --btn: #85601a; --on-btn: #fffaf0;
  --field: #fffdf8; --field-border: #dccb9f;
  --tab-track: #f2e8d2; --tab-on: #fffdf8; --tab-shadow: 0 1px 0 #d4b46a66, 0 2px 8px -3px #8a641833;
  --fab: linear-gradient(135deg, #e3c06a, #b8892e 55%, #8f6a1f); --fab-ink: #1f1a12; --fab-border: #fff3cf; --fab-glow: #d4a63c;
  --toast: #1f1a12eb; --toast-link: #f0d48a;
  --c1: #f3dfa8; --c2: #f4d9cf; --c3: #ebe5f5; --c4: #fbecc0; --blob-o: .7; --blob-blur: 58px; --grain-o: .04;
  --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Cpath d='M20 2l18 18-18 18L2 20z' fill='none' stroke='%23b8892e' stroke-width='.7'/%3E%3C/svg%3E");
  --ps: 40px; --pattern-o: .12; --pattern-show: block;
  --gold: #b8892e;
}
/* 15. Lapis & gold (gold, dark; pair of emerald): deep lapis, bright polished gold, crisp white text: the richest dark. */
[data-theme="royal"] {
  --bg: radial-gradient(120% 80% at 80% 0%, #1b2f7a 0%, #0c1748 50%, #070d2e 100%); --bg-solid: #0c1748;
  --text: #fff; --muted: #c4cdf0; --line: #ffffff1f;
  --card: #ffffff12; --card-solid: color-mix(in srgb, #fff 8%, #0c1748); --card-border: #f5c84c55;
  --card-shadow: 0 16px 32px -16px #000b, inset 0 1px 0 #ffffff1f; --spec: .5;
  --bar: #0c174880; --bar-line: #f5c84c40; --primary: #f5c84c; --on-primary: #1a1203; --soft: #f5c84c26; --pos: #7ef0b8; --neg: #ff9aa8;
  --field: #ffffff12; --field-border: #f5c84c4d;
  --tab-track: #ffffff12; --tab-on: #f5c84c33; --tab-shadow: none;
  --fab: linear-gradient(135deg, #ffe08a, #f5b82e 55%, #d1901a); --fab-ink: #1a1203; --fab-border: #fff1c2; --fab-glow: #f5c84caa;
  --toast: #1b2a66f0; --toast-link: #ffd970; --ico-amt: 26%;
  --c1: #2f4fd8; --c2: #b8892e; --c3: #6a3fd0; --c4: #1a8fd6; --blob-o: .45; --blob-blur: 60px; --grain-o: .08; --grain-blend: overlay;
  --pattern: radial-gradient(#ffffff40 1px, transparent 1.4px); --ps: 30px; --pattern-o: .5; --pattern-show: block;
  --gold: #f5c84c;
  color-scheme: dark;
}
/* 16. Emerald & gold (gold, light; pair of royal): bright clear white-green, deep emerald ink, gold frames: the crispest light. */
[data-theme="emerald"] {
  --bg: linear-gradient(170deg, #f4fbf7 0%, #e8f7ef 55%, #fdf6e3 100%); --bg-solid: #f4fbf7;
  --text: #06231a; --muted: #3c5a4f; --line: #cfe8dc;
  --card: #fff; --card-solid: #fff; --card-border: #0b8a5a40; --card-shadow: 0 1px 0 #d9b44a55, 0 16px 30px -18px #06603f66; --spec: .6;
  --bar: #f4fbf7d9; --bar-line: #d9b44a66; --primary: #04774c; --on-primary: #fff; --soft: #d6f2e4; --pos: #04774c; --neg: #b3203f;
  --ink: #036b44; --field: #fff; --field-border: #b5dcc9;
  --tab-track: #dcf0e5; --tab-on: #fff;
  --fab: linear-gradient(135deg, #0aa86b, #04774c); --fab-border: #e9c45a; --fab-glow: #0aa86b;
  --toast: #06231aeb; --toast-link: #f2d27a;
  --c1: #7fe0b3; --c2: #f7dc8a; --c3: #a8e6ff; --c4: #c9f2dc; --blob-o: .6; --blob-blur: 58px; --grain-o: .03;
  --pattern: radial-gradient(#d9b44a66 1px, transparent 1.6px); --ps: 20px; --pattern-o: .9; --pattern-show: block;
}
/* --gold: a theme-tuned gold for the plan cards' frames and washes; marks of gold use --gold-metal below. */
:root, [data-theme] { --gold: #c8962e; }
[data-theme="goldnight"], [data-theme="aurora"], [data-theme="liquid"], [data-theme="nightmint"], [data-theme="dusk"] { --gold: #e6bd5a; }
[data-theme="pearl"] { --gold: #b8892e; }
[data-theme="royal"] { --gold: #f5c84c; }
/* «گروه»/«رویداد» before a place's name in a title: small and quiet, so it says what the name is without mixing with it. */
.kind { font-size: .7em; font-weight: 400; color: var(--muted); margin-inline-end: .1rem; }
/* New event: where it will be made (the chosen chip's line), above «ساختن». */
.where-note { display: flex; align-items: flex-start; gap: .4rem; margin: 0; padding: .55rem .75rem; border-radius: 12px; background: var(--soft); color: var(--ink); font-size: var(--fs-small); }
.where-note[hidden] { display: none; }
.where-note .ic { flex: none; margin-top: .2rem; }
.founder-tag { display: inline-block; padding: .1rem .55rem; border-radius: 99px; font-size: var(--fs-small); font-weight: 700; color: var(--ink); background: var(--soft); box-shadow: inset 0 0 0 1px var(--gold); }
.gold-line { color: var(--muted); font-size: var(--fs-muted); }
.gold-receipt { margin: .25rem .25rem 0; font-size: var(--fs-muted); }
/* Polished gold (G1): one metal, the same on every theme. The badge «✦» shines now and then
   (a light streak; app.js staggers each badge's start), the ring and group mark wear the same metal. */
:root { --gold-metal: linear-gradient(135deg, #f7e08e 0%, #d4a23c 32%, #fff1bf 50%, #b8862a 68%, #8a5f14 100%); }
.gbadge { display: inline-block; font-weight: 700; line-height: 1; color: transparent; -webkit-background-clip: text; background-clip: text;
  background-image: linear-gradient(105deg, transparent 38%, #fffbe8 50%, transparent 62%), var(--gold-metal);
  background-size: 300% 100%, 100% 100%; background-position: 120% 0, 0 0; background-repeat: no-repeat;
  filter: drop-shadow(0 0 .4px #6b4a0e); animation: gshine 7s ease-in-out infinite; }
.gbadge.big { font-size: 2rem; }
@keyframes gshine { 0%, 82% { background-position: 120% 0, 0 0; } 100% { background-position: -20% 0, 0 0; } }
.gring { border: 2px solid transparent; padding: 0; background: var(--gold-metal) border-box; }
/* A gold group's round photo, where its ✦ mark shows (G1). */
.gphoto { width: 1.6rem; height: 1.6rem; border-radius: 50%; object-fit: cover; vertical-align: middle; }
h1 .gphoto, h1 .gmark { width: 2rem; height: 2rem; }
.gmark { display: inline-flex; align-items: center; justify-content: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; vertical-align: middle;
  border: 1.5px solid transparent; background: linear-gradient(var(--bg-solid) 0 0) padding-box, var(--gold-metal) border-box; color: #c9962f; }
.gmark .ic { width: .9rem; height: .9rem; }
/* Someone's own category (G3): its icon in a thin polished-gold frame, wherever it shows. */
.ucat { display: inline-flex; align-items: center; justify-content: center; min-width: 1.6em; min-height: 1.6em; border-radius: 50%;
  border: 1.5px solid transparent; background: linear-gradient(var(--bg-solid) 0 0) padding-box, var(--gold-metal) border-box; }
/* A free user's locked control (pattern B): dimmed, the badge stays bright; a tap shows the soft message. */
.gold-off { color: color-mix(in srgb, var(--text) 50%, transparent) !important; }
.gold-off > .ic { opacity: .5; }
.btn.gold-off { background: var(--soft); box-shadow: none; }
/* A locked fold or form: one card row with its icon, name and the badge at the end. */
.gold-row { display: flex; align-items: center; gap: .5rem; min-height: 44px; text-decoration: none; }
.gold-row > span:not(.gbadge) { flex: 1; }
.gold-note, .gold-offer > p:first-child { margin: 0; }
.gold-btn, .gold-msg .btn { flex: none; color: #2b1d03 !important; background: var(--gold-metal) !important; border: 0; }
/* Theme picker: the gold part starts after one small mark. */
.tpart { flex: none; align-self: center; display: flex; flex-direction: column; align-items: center; gap: .3rem; width: 3rem; color: var(--muted); font-size: var(--fs-small); }
.tpart .gbadge { font-size: 1.6rem; }
.info-rows a .gbadge { margin-inline-start: .35rem; }
.gold-msg { transform: translateY(160%); opacity: 0; visibility: hidden; transition: transform .3s ease, opacity .3s, visibility 0s .3s; padding: .5rem .5rem .5rem 1rem; }
.gold-msg.on { transform: none; opacity: 1; visibility: visible; transition: transform .3s ease, opacity .3s; }
@media (prefers-reduced-motion: reduce) { .gbadge { animation: none; } .gold-msg, .gold-msg.on { transition: none; } }
/* G0 preview page only. */
.gprev { margin-top: 1rem; padding: 1rem; border-radius: var(--radius); background: var(--bg-solid); color: var(--text); }
.gprev h3 { margin: 1rem 0 .25rem; font-size: var(--fs-small); color: var(--muted); }
.cprev { margin-top: 1rem; padding-top: .75rem; border-top: 1px solid var(--line); }
.cprev h3 { margin: 0; font-size: var(--fs-h2); color: var(--text); }
.cpair { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin: .5rem 0; }
@media (max-width: 420px) { .cpair { grid-template-columns: 1fr; } }
.gmarks { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.gtile { display: inline-flex; flex-direction: column; gap: .4rem; border: 0; padding: 0; background: none; color: var(--text); font: inherit; cursor: pointer; }
.gtile-screen { display: block; width: 9rem; padding: .75rem; border-radius: 18px; background: var(--bg-solid); color: var(--text); }
.gtile-screen .card { display: block; padding: .5rem; font-size: var(--fs-small); }

/* No backdrop-filter (old WebView): glass becomes the same colour, solid. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root, [data-theme] { --surface: var(--card-solid, var(--card)); --bar: var(--bg-solid); }
  [data-theme="aurora"], [data-theme="liquid"] { --toast: var(--card-solid); }
}

/* ============ Base ============ */
* { box-sizing: border-box; }
html { overflow-x: clip; -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; background: var(--bg-solid); }
/* body stays transparent: an opaque body is painted over the z-index:-1 .bgfx, so no theme background would show. */
body { overflow-x: clip; margin: 0; color: var(--text); font: var(--fs-body)/1.7 "Vazirmatn", system-ui, sans-serif; min-height: 100vh; }
a { color: var(--ink); text-decoration: none; }
h1 { font-size: var(--fs-h1); margin: 0 0 .75rem; }
h2 { font-size: var(--fs-h2); margin: 0 0 .5rem; }
p { margin: 0 0 .5rem; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.js .nojs { display: none; }
@media (display-mode: standalone) { body { overscroll-behavior-y: contain; } }

/* ============ Background layer (one fixed .bgfx in layout.js) ============ */
.bgfx { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; background: var(--bg); }
.bgfx i { position: absolute; border-radius: var(--blob-shape); filter: blur(var(--blob-blur)); opacity: calc(var(--blob-o) * .7); animation: var(--blob-anim) 24s ease-in-out infinite alternate; will-change: transform; }
.bgfx .b1 { width: 300px; height: 300px; background: var(--c1); top: -90px; right: -90px; }
.bgfx .b2 { width: 280px; height: 280px; background: var(--c2); top: 250px; left: -140px; animation-duration: 31s; animation-delay: -7s; }
.bgfx .b3 { width: 320px; height: 320px; background: var(--c3); bottom: -120px; right: -60px; animation-duration: 37s; animation-delay: -15s; }
.bgfx .b4 { width: 170px; height: 170px; background: var(--c4); top: 140px; right: 40px; animation-duration: 21s; animation-delay: -3s; }
@keyframes float { 0% { transform: translate(0, 0) scale(1) rotate(0); } 50% { transform: translate(50px, 70px) scale(1.18) rotate(20deg); } 100% { transform: translate(-40px, 30px) scale(.88) rotate(-10deg); } }
@keyframes aurora { 0% { transform: translate(0, 0) scale(1.1, .7) rotate(-20deg); } 50% { transform: translate(60px, 90px) scale(1.4, .6) rotate(15deg); } 100% { transform: translate(-50px, 40px) scale(1, .9) rotate(-35deg); } }
.bgfx .pattern { position: absolute; inset: -80px; background-image: var(--pattern); background-size: var(--ps) var(--ps); opacity: var(--pattern-o); animation: drift 40s linear infinite; }
@keyframes drift { to { transform: translate(var(--ps), var(--ps)); } }
.bgfx .grain { position: absolute; inset: 0; opacity: var(--grain-o); mix-blend-mode: var(--grain-blend);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
.bgfx::after { content: ""; position: absolute; inset: 0; background: var(--scrim); }
.bgfx .spot { position: absolute; inset: 0; z-index: 1; opacity: var(--spot-o); background: radial-gradient(260px circle at 50% 30%, #ffffff55, transparent 70%); }
/* Layers a theme doesn't use are removed, so they cost nothing (no animation off screen). Tokens, not
   [data-theme] .bgfx selectors, so a nested preview never takes the page theme's choice. */
.bgfx i { display: var(--blob-show); }
.bgfx .pattern { display: var(--pattern-show); }
@media (prefers-reduced-motion: reduce) { .bgfx *, .entry { animation: none !important; } }

/* ============ Glass: one recipe, driven by the tokens ============
   No backdrop-filter on cards: they scroll over the fixed background, so a blur is redone every frame (the main
   lag on phones). The blobs behind are blurred already; only the sticky top bar and toasts keep a blur. */
.card, .entry, .list a, .pill {
  position: relative; background: var(--surface); border: 1px solid var(--card-border); box-shadow: var(--card-shadow);
}
.card::before, .entry::before, .list a::before, .pill::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: var(--spec);
  background: linear-gradient(160deg, #ffffffb3 0%, #ffffff00 32%, #ffffff00 70%, #ffffff33 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; padding: 1px;
}

/* ============ Shell ============ */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; position: sticky; top: 0; z-index: 10;
  padding: calc(.75rem + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) .75rem max(16px, env(safe-area-inset-left));
  background: var(--bar); border-bottom: 1px solid var(--bar-line); -webkit-backdrop-filter: var(--bar-filter); backdrop-filter: var(--bar-filter); }
.brand { font-weight: 700; font-size: 1.2rem; color: var(--text); min-height: 44px; display: inline-flex; align-items: center; }
.me { display: inline-flex; align-items: center; color: var(--text); background: var(--soft); padding: 0 .8rem; line-height: 44px; border-radius: 999px; font-size: .9rem; max-width: 50%; min-width: 0; white-space: nowrap; }
/* The name truncates inside, so the link itself never clips (its .has-dot badge sits outside the corner). */
.me .nm { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.bar-end { display: inline-flex; align-items: center; gap: .4rem; min-width: 0; max-width: 65%; }
.bar-end .me { max-width: none; }
/* Inner pages: a 3-column grid. Start: the return arrow (× on a sheet) + the destination's name, which wraps onto a
   hidden second line when it does not fit (so narrow screens show the arrow alone). Middle: the page's title, centered,
   one line. End: its actions. */
.bar.inner { display: grid; grid-template-columns: minmax(44px, 1fr) minmax(0, auto) minmax(max-content, 1fr); gap: .35rem; }
.back { display: flex; flex-wrap: wrap; align-items: center; height: 44px; overflow: hidden; justify-self: start; min-width: 44px; max-width: 100%;
  margin-inline-start: -10px; border-radius: 999px; color: var(--text); }
.back .ic { width: 24px; height: 24px; margin: 10px; }
.back-to { height: 44px; line-height: 44px; margin-inline-start: -6px; padding-inline-end: .5rem; font-size: .85rem; color: var(--muted); white-space: nowrap; }
.bar-title { min-width: 0; font-size: .95rem; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar.inner .bar-title { text-align: center; }
.bar.inner .bar-end { justify-self: end; max-width: none; }
.bar-end form { display: contents; }
.bell { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 999px; background: var(--soft); font-size: 1.1rem; flex: none; }
.bell b { position: absolute; top: 2px; inset-inline-end: 0; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px; background: var(--neg); color: #fff; font-size: .75rem; line-height: 18px; text-align: center; }
.wrap { max-width: 560px; margin: 0 auto; padding: 20px max(16px, env(safe-area-inset-right)) calc(48px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.ic { width: 1.25em; height: 1.25em; vertical-align: -0.2em; flex: none; }

/* ============ Bottom bar: «خانه» · «+» · «خرج‌های من» (every logged-in page but the sheet) ============
   Opaque, no blur (it sits over scrolling content). The page's last row clears it: 64px + safe area + 16px. */
.nav { position: fixed; z-index: 20; bottom: 0; left: 0; right: 0; height: calc(64px + env(safe-area-inset-bottom)); padding: 0 max(16px, env(safe-area-inset-left)) env(safe-area-inset-bottom);
  display: flex; justify-content: center; align-items: stretch; background: var(--nav); border-top: 1px solid var(--line); }
.nav a { position: relative; flex: 0 1 180px; min-width: 44px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); font-size: .75rem; line-height: 1.2; text-decoration: none; }
.nav a .ic { width: 24px; height: 24px; }
.nav a[aria-current] { color: var(--nav-on); font-weight: 700; }
.nav .dot { position: absolute; top: 10px; inset-inline-start: calc(50% + 8px); width: 9px; height: 9px; border-radius: 50%; background: var(--neg); }
.nav .nav-add { flex: none; align-self: flex-start; width: 56px; height: 56px; margin: -12px 12px 0; border-radius: 50%; background: var(--fab); color: var(--fab-ink);
  border: 1px solid var(--fab-border); box-shadow: 0 10px 22px -10px var(--fab-glow); }
.nav .nav-add .ic { width: 28px; height: 28px; }
body:has(.nav) .wrap { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
/* While typing, the keyboard needs the room (enhancement only). */
body:has(input:not([type=checkbox], [type=radio], [type=file], [type=hidden]):focus, textarea:focus) .nav { display: none; }
/* Toasts and undo bars sit above the bar, never on it. */
body:has(.nav) .undo.float { bottom: calc(76px + env(safe-area-inset-bottom)); }

/* ============ Layout helpers ============ */
.card { border-radius: 22px; padding: 20px; }
.stack { display: flex; flex-direction: column; gap: .75rem; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 1rem; }
.center { text-align: center; margin-top: 1.5rem; }
.muted { color: var(--muted); font-size: var(--fs-muted); }
.section { margin-top: 2rem; }
.card + .card, .card + .section, .section + .card { margin-top: 1.25rem; }
.event-banner { display: flex; align-items: center; gap: .4rem; min-height: 44px; padding: 12px 20px; color: inherit; text-decoration: none; }
.event-banner .go { margin-inline-start: auto; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.inline { display: flex; gap: .5rem; }
.inline input { flex: 1; min-width: 0; }
.inline .btn { flex: none; }
.or { text-align: center; margin: .25rem 0; }
.small { font-size: var(--fs-small); }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.plain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.links a { display: flex; align-items: center; min-height: 44px; }
@media (max-width: 360px) { .two { grid-template-columns: 1fr; } }

/* ============ Forms ============ */
label { display: flex; flex-direction: column; gap: .35rem; font-weight: 700; }
label .muted { font-weight: 400; }
legend { font-weight: 700; padding: 0; margin-bottom: .25rem; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: .75rem; }
input, select, textarea { font: inherit; width: 100%; padding: .62rem .85rem; border: 1px solid var(--field-border); border-radius: 12px; background: var(--field); color: var(--text); }
select, textarea { padding: .65rem .8rem; }
select option { background: var(--bg-solid); color: var(--text); }
/* Empty fields look empty: placeholders, a select still on its empty choice («همه»، «بدون رویداد»), an empty date. */
input::placeholder, textarea::placeholder { color: var(--placeholder); opacity: 1; }
select:has(> option[value=""]:checked) { color: var(--placeholder); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--ink); outline-offset: 1px; border-color: transparent; }
input:disabled, select:disabled, textarea:disabled { opacity: .7; }
input[dir="ltr"] { text-align: left; }
/* A Persian hint in an empty date field (H15: «خالی یعنی هنوز تمام نشده») reads right to left and fits a half-width field. */
input[data-jdate]:placeholder-shown { direction: rtl; text-align: right; }
input[data-jdate]::placeholder { font-size: .85em; }
input.otp { font-size: 1.8rem; letter-spacing: .6em; text-align: center; padding-inline-start: .6em; }
textarea { margin-top: .5rem; resize: vertical; }

/* ============ Buttons ============ */
.btn { font: inherit; font-weight: 700; border: 0; border-radius: 13px; padding: .6rem 1.1rem; background: var(--btn); color: var(--on-btn); cursor: pointer; min-height: 44px; box-shadow: 0 8px 16px -12px var(--btn); }
.btn:hover { filter: brightness(1.06); }
.btn.wide { display: block; width: 100%; text-align: center; min-height: 46px; }
.btn.ghost { background: var(--soft); color: var(--ink); box-shadow: none; }
.btn.line { background: none; border: 1px solid var(--field-border); color: var(--ink); text-decoration: none; display: flex; align-items: center; justify-content: center; }
.btn.ghost.danger { background: var(--danger-soft); color: var(--neg); }
.btn.small { padding: .4rem .9rem; font-size: .9rem; min-height: 40px; }
.link { font: inherit; background: none; border: 0; padding: 0; color: var(--ink); cursor: pointer; min-height: 44px; }
.link.danger { color: var(--neg); }
.muted-on { opacity: .8; font-weight: 400; font-size: .9rem; }

/* ============ Messages ============ */
.alert { background: var(--danger-soft); color: var(--neg); border-radius: 12px; padding: .6rem .9rem; }
.notice { background: var(--soft); color: var(--ink); border-radius: 12px; padding: .6rem .9rem; }
.undo { display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: var(--toast); color: #fff; border-radius: 18px; padding: .3rem .4rem .3rem 1rem;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 12px 30px -14px #000a; }
.undo .link { color: var(--toast-link); font-weight: 700; padding: 0 .75rem; }

/* ============ Lists, chips, empty states ============ */
.login { margin-top: 8vh; }
.empty { text-align: center; padding: 2.5rem 1rem; }
.empty .big { font-size: 2.5rem; margin: 0; }
.empty.small { padding: 1.25rem 1rem; border: 1px dashed var(--dash); border-radius: var(--radius); }
.feed .zero { display: flex; align-items: center; gap: .6rem; color: var(--ink); font-size: .85rem; font-weight: 700; margin: .25rem 0; }
.feed .zero::before, .feed .zero::after { content: ""; flex: 1; border-top: 1px dashed var(--ink); opacity: .5; }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.list a { display: block; border-radius: 20px; padding: 1rem; color: var(--text); font-weight: 700; }
.list a.notice-row { display: flex; align-items: flex-start; gap: .75rem; font-weight: 400; }
.notice-row .grow { flex: 1; display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.notice-row.unread .msg { font-weight: 700; }
.notice-row.unread .emoji { position: relative; }
.notice-row.unread .emoji::after { content: ""; position: absolute; top: -2px; inset-inline-end: -4px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.notice-row:not(.unread) { opacity: .75; }
.title-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.title-row h1, .title-row h2 { margin: 0; }
.pill { border-radius: 14px; padding: .5rem 1rem; font-size: .9rem; min-height: 44px; display: inline-flex; align-items: center; color: var(--text); }
/* Icon-only actions (✏️ edit): the icon is the label, aria-label/title name it; 44px tap target. */
.pill.icon { min-width: 44px; padding: .5rem; justify-content: center; font-size: 1.05rem; }
.icon-btn { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; font-size: 1.05rem; }
.list a.icon-btn { display: inline-flex; padding: 0; border-radius: 14px; flex: none; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { background: var(--surface); border: 1px solid var(--card-border); border-radius: 999px; padding: .3rem .85rem; font-size: .93rem; }
/* Chips and ticks look 38px tall; an invisible 3px band above and below keeps the 44px tap target. */
:is(.chip, .check, .opt) { position: relative; }
:is(a.chip, label.chip, button.chip, .check, .opt)::after { content: ""; position: absolute; inset: -3px 0; }
.chips.scroll { padding-block: 3px; }
.chip.pair { background: var(--soft); border-color: transparent; }
a.chip { display: inline-flex; align-items: center; gap: .25rem; min-height: 38px; color: var(--text); }
.chip.on { background: var(--soft); border-color: var(--ink); font-weight: 700; }
/* Radio chips (`/e/new` «با کی؟»): the chosen one looks like .chip.on. */
label.chip.pick { display: inline-flex; align-items: center; min-height: 38px; cursor: pointer; }
.chip.pick input { position: absolute; opacity: 0; pointer-events: none; }
.chip.pick:has(input:checked) { background: var(--soft); border-color: var(--ink); font-weight: 700; }
.chip.pick:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 2px; }
.grow { flex: 1; }
/* A red dot: «look here, something new». Rows, the profile link, any element. */
.has-dot { position: relative; }
.has-dot::after { content: ''; position: absolute; top: .55rem; inset-inline-end: .5rem; width: 10px; height: 10px; border-radius: 999px; background: var(--neg); box-shadow: 0 0 0 2px var(--bg, #fff); pointer-events: none; }
/* Badge on the round profile pill: fully round, just outside its top corner, ringed in the bar's colour. */
.me.has-dot::after { top: -3px; inset-inline-end: -3px; box-shadow: 0 0 0 2px var(--bg-solid); }
.info-rows a.has-dot { padding-inline-end: 1.6rem; }
.badge { font-size: .8rem; background: var(--soft); color: var(--ink); border-radius: 999px; padding: .1rem .5rem; white-space: nowrap; flex: none; }
.badge.flag { color: var(--neg); background: var(--danger-soft); margin-inline-start: .35rem; font-weight: 400; }
/* One line that never wraps: a name cut with «…» and a badge that stays whole («جاری»). */
.one { display: flex; align-items: center; gap: .4rem; min-width: 0; }
.one > strong, .cut { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cut { display: block; }
h2.cut { font-size: var(--fs-h1); margin: 0 0 .75rem; }
.event-banner > strong { flex: none; }
.event-banner > .muted { min-width: 0; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
.units { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.unit { display: flex; align-items: center; justify-content: space-between; gap: .5rem; border: 1px solid var(--line); border-radius: 12px; padding: .25rem .75rem; }
.unit-names { display: flex; flex-direction: column; flex: 1; }
.member { color: var(--text); font-weight: 700; padding: .5rem 0; min-height: 44px; }
.member .muted { font-weight: 400; font-size: .85rem; }
a.member, span.member { display: flex; align-items: center; gap: .5rem; text-decoration: none; }
a.member > .ic { color: var(--muted); flex: none; }
/* Members page: the wizard and the link field open under their buttons (:target, no JS needed). */
.member-actions { margin-block: .75rem; }
.member-actions .btn { white-space: nowrap; }
.unit.invite { align-items: flex-start; padding-block: .5rem; }
.unit.invite summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; }
.notice.fade { opacity: 0; transition: opacity .6s; }
.member-actions .btn { justify-content: center; }
.fold-target:not(:target):not(.is-open) { display: none; }
.invite input { font-size: .85rem; color: var(--muted); }

/* ============ Ticks and options ============ */
.checks { display: flex; flex-wrap: wrap; gap: .5rem; }
.check, .opt, .radio { flex-direction: row; align-items: center; gap: .4rem; font-weight: 400; min-height: 38px; cursor: pointer; }
.radio { min-height: 44px; }
.check, .opt { border: 1px solid var(--field-border); border-radius: 999px; padding: .4rem .9rem; background: var(--field); }
.opt { padding: .35rem .85rem; }
.check input, .opt input, .radio input { width: 1.1rem; height: 1.1rem; flex: none; accent-color: var(--ink); }
.check:has(input:checked), .opt:has(input:checked) { background: var(--soft); border-color: var(--ink); }
.merge .opt { border-radius: 14px; }
.merge .opt.off { opacity: .55; cursor: not-allowed; }
.radio { gap: .5rem; }

/* ============ Expense sheet ============ */
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--tab-track); border-radius: 16px; padding: 4px; margin-bottom: 1rem; }
.tabs a { text-align: center; padding: .55rem; border-radius: 12px; color: color-mix(in srgb, var(--muted) 70%, var(--text)); min-height: 44px; }
.tabs a[aria-current] { background: var(--tab-on); color: var(--text); font-weight: 700; box-shadow: var(--tab-shadow); }
.amount input { font-size: 1.55rem; line-height: 1.4; font-weight: 700; text-align: center; padding: .55rem; }
/* «تومان» inside the amount field's end. */
.unit-field { position: relative; display: block; }
.unit-field input { width: 100%; padding-inline: 4.5rem; }
.unit-field .unit { position: absolute; inset-inline-end: 1rem; top: 50%; transform: translateY(-50%); font-weight: 400; pointer-events: none; border: 0; padding: 0; }
.words { min-height: 1.3em; line-height: 1.3; text-align: center; margin-top: -.45rem; }
/* The sheet's parts (amount, «بابت», «برای کجا؟», «کی پول داد؟», «شیوه‌ی تقسیم», «جزئیات») sit well apart so each reads
   as its own block; a part's own words and errors stay close to it. */
.sheet > fieldset, .sheet .shared-only { gap: 1.5rem; }
.sheet > fieldset > .words { margin-top: -1.2rem; }
.sheet > fieldset > .alert, .sheet .shared-only > .alert { margin-top: -1rem; }
.opts { display: flex; flex-wrap: wrap; gap: .4rem; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: .25rem; }
.seg .opt { justify-content: center; border-radius: 10px; padding: .35rem .4rem; }
.seg .opt input { position: absolute; opacity: 0; }
.faq-row { display: flex; align-items: center; gap: .4rem; }
.faq-row .grow { flex: 1; min-width: 0; color: var(--text); font-weight: 700; }
.seg a.opt { color: var(--text); }
.seg a.opt.on { background: var(--soft); border-color: var(--ink); font-weight: 700; }
.seg.two { grid-template-columns: repeat(2, 1fr); }
.seg.three { grid-template-columns: repeat(3, 1fr); }
.seg.four { grid-template-columns: repeat(4, 1fr); }
.thread { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.thread li { align-self: flex-start; max-width: 90%; background: var(--surface); border: 1px solid var(--card-border); border-radius: 16px; padding: .6rem .9rem; }
.thread li.us { align-self: flex-end; background: var(--soft); border-color: transparent; }
.thread p { margin: .25rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.thread img { display: block; max-width: 100%; max-height: 16rem; margin-top: .5rem; border-radius: 12px; }
.shares { display: flex; flex-wrap: wrap; gap: .4rem; }
.share-row { display: contents; }
.calc { font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: end; }
.w, .x, .calc, .help-w, .help-x, .multi { display: none; }
/* «بیرون از گروه»'s sentence only while that tick is on. */
.split:not(:has([name=share][value=out]:checked)) .help-out { display: none; }
.split:has([value=weights]:checked) .shares, .split:has([value=exact]:checked) .shares { flex-direction: column; flex-wrap: nowrap; }
/* «به نسبت» / «مبلغ دقیق»: every row is the same three columns (name · toman · box), so the boxes line up and stay
   inside the screen whatever the name or the number; a long name ends with «…». */
.split:has([value=weights]:checked) .share-row, .split:has([value=exact]:checked) .share-row { display: grid; grid-template-columns: minmax(0, 1fr) 5rem auto; align-items: center; gap: .35rem; }
.split:has([value=weights]:checked) .share-row .opt, .split:has([value=exact]:checked) .share-row .opt { min-width: 0; border-radius: 12px; }
.split:has([value=weights]:checked) .share-row .opt > span, .split:has([value=exact]:checked) .share-row .opt > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.split:has([value=weights]:checked) .calc { display: block; }
.split:has([value=weights]:checked) .w { display: flex; align-items: center; gap: .2rem; }
.w .step { width: 40px; flex: none; }
.split:has([value=weights]:checked) .help-w, .split:has([value=exact]:checked) .help-x { display: block; }
.split:has([value=exact]:checked) .x { display: block; }
.split:has([value=exact]:checked) .calc { display: block; }
/* Two or more payers ticked (app.js sets .on): an amount under each ticked one; «باقی‌مانده» only on an empty one. */
.multi.on { display: flex; }
.multi .amt-row { gap: .5rem; }
.multi .amt-row > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.multi .amt-row input { width: 7.5rem; flex: none; }
.multi .amt-row .chip { flex: none; min-height: 38px; white-space: nowrap; }
.amt-row:has(input:not(:placeholder-shown)) [data-fill] { visibility: hidden; }
/* «کی پول داد؟»: one scrollable row of radio chips. «شیوه‌ی تقسیم: …»: a heading stating the split, the rest always open. */
:is(.payer, .family-payer) { gap: .4rem; }
:is(.payer, .family-payer) .chip { flex: none; white-space: nowrap; }
.split-head { padding: 0; font-weight: 700; margin-bottom: .1rem; }
.split-head .muted { font-weight: 400; }
.w input { width: 2.9rem; min-width: 0; flex: none; box-sizing: border-box; text-align: center; padding: .5rem .1rem; }
.x input { width: 7.5rem; box-sizing: border-box; text-align: center; }
/* «مبلغ دقیق»'s receipt extras (tax, service, tip) and discount, only in that mode. */
.xtras { display: none; gap: .6rem; padding-top: .6rem; border-top: 1px dashed var(--card-border); }
.split:has([value=exact]:checked) .xtras { display: flex; }
.split:has([name=for_fund]:checked) .xtras { display: none; }
.xtras-head { margin: 0; font-weight: 700; font-size: .95rem; }
.xtra-row { display: flex; align-items: flex-end; gap: .6rem; font-weight: 400; }
.xtra-row[hidden] { display: none; }
.xtra-row .sign { flex: none; width: 1.5rem; height: 44px; display: grid; place-items: center; border-radius: 50%; background: var(--soft); font-weight: 700; }
.xtra-row .cap { display: block; font-size: .8rem; color: var(--muted); margin-bottom: .15rem; }
/* The title is a light underlined field, the amount a boxed one with «تومان»: two different kinds of input at a glance. */
.xtra-name { flex: 1; min-width: 0; }
.xtra-name input { width: 100%; background: transparent; border: 0; border-bottom: 1.5px dashed var(--field-border); border-radius: 0; padding-inline: .2rem; box-shadow: none; }
.xtra-amt { flex: none; width: 9.5rem; }
.xtra-amt .unit-field input { padding-inline: .6rem 3.4rem; text-align: center; }
.xtra-amt .unit-field .unit { inset-inline-end: .7rem; font-size: .85rem; }
.seg.mini { display: inline-flex; gap: .25rem; }
.seg.mini .opt { padding: .3rem .7rem; min-height: 36px; font-size: .85rem; }
.off-pct, .xtras:has([name=xoff_unit][value=pct]:checked) .off-toman { display: none; }
.xtras:has([name=xoff_unit][value=pct]:checked) .off-pct { display: block; }
.xtras [data-xtra-add] { align-self: flex-start; margin-inline-start: 2.1rem; }
.xtras [data-xtra-add][hidden] { display: none; }
.xtras [data-bill]:empty { display: none; }
/* The receipt page: «۲۵۰٬۰۰۰ + ۲۵٬۰۰۰» before a part's final amount, and the receipt's line under «تقسیم». */
.r-base { margin-inline-end: .4rem; font-weight: 400; }
.r-bill { margin: 0 0 .3rem; }
.r-edit { margin-inline-start: auto; }
/* In «مبلغ دقیق» the amount reads «مبلغ پرداختی نهایی»: what was paid after discount and tax. */
.paid-word { display: none; }
form:has([name=mode][value=exact]:checked):not(:has([name=for_fund]:checked)) .paid-word { display: inline; }
.step { font: inherit; font-weight: 700; width: 44px; height: 44px; border: 1px solid var(--field-border); border-radius: 12px; background: var(--field); color: var(--text); cursor: pointer; }
.amt-row { display: flex; flex-direction: row; align-items: center; justify-content: space-between; font-weight: 400; }
.amt-row input { width: 9rem; text-align: center; }
.treat { align-self: flex-start; }
/* The sheet's top: whose + where. «فقط خودم» hides payer, shares and «مهمون من». */
.where-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.where-row > label { flex: 1 1 10rem; }
.sheet:has([name=personal][value="1"]:checked) :is(.shared-only, .treat) { display: none; }
/* «برای کجا؟» of a new cost: a fold (closed inside a scope) with one scrollable chip row, and the group's events under it. */
.scope summary { cursor: pointer; min-height: 44px; display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .5rem; font-weight: 700; }
.scope summary .muted { font-weight: 400; }
.scope .change { margin-inline-start: auto; color: var(--ink); }
.scope[open] .change { display: none; }
.scope .chips { margin-top: .5rem; }
.scope .chip { flex: none; white-space: nowrap; }
button.chip { font: inherit; font-size: .93rem; color: var(--text); min-height: 38px; cursor: pointer; }
/* A long list's «… دیگر» dropdown (H16) sits in the chip row and looks like a chip. */
select.chip.more { width: auto; flex: none; min-height: 38px; max-width: 14rem; padding: .3rem .85rem; border-radius: 999px; border: 1px solid var(--card-border); background: var(--surface); }
/* Once one of its items is picked it looks like a chosen chip (its arrow stays: it still opens). */
select.chip.more:has(option:checked:not([value=""])) { background: var(--soft); border-color: var(--ink); font-weight: 700; color: var(--text); }
/* The sheet's «ثبت» stays in reach at the bottom, on an opaque strip; toasts sit above it. */
.sticky-cta { position: sticky; bottom: 0; z-index: 5; background: transparent; padding: .6rem 0 calc(.6rem + env(safe-area-inset-bottom)); }
/* Receipt (UX plan §4.3): a read-only entry, no form controls. */
.receipt { display: grid; gap: .35rem; }
.receipt .r-head { display: flex; align-items: center; gap: .6rem; }
.receipt .hero { margin-top: .4rem; }
.receipt .r-sub { margin: 0 0 .5rem; }
/* My share: the one framed block of the receipt (U5). */
.receipt .r-mine { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .7rem .9rem; border-radius: var(--radius); background: var(--soft); color: var(--primary); font-weight: 700; margin: .25rem 0 .5rem; }
.receipt .r-split { margin: 0; }
.receipt .r-split > summary { display: flex; align-items: center; justify-content: space-between; gap: .75rem; min-height: 44px; cursor: pointer; list-style: none; border-bottom: 1px solid var(--line); }
.receipt .r-split > summary::-webkit-details-marker { display: none; }
.receipt .r-split > summary > span:first-child::after { content: ' ›'; color: var(--muted); }
.receipt .r-split[open] > summary > span:first-child::after { content: ' ⌄'; }
.faces.sm { margin: 0; flex: none; }
.faces.sm .face { width: 26px; height: 26px; font-size: .75rem; }
.faces.sm .face + .face { margin-inline-start: -3px; }
.faces.sm .face.me { box-shadow: 0 0 0 2px var(--primary); }
.receipt .r-meta .r-row { border-bottom: 0; padding: .2rem 0; }
.receipt .r-cat { width: 44px; height: 44px; border-radius: 50%; background: var(--soft); display: grid; place-items: center; font-size: 1.3rem; flex: none; }
.receipt h3 { font-size: .9rem; margin: .6rem 0 .1rem; color: var(--muted); }
.receipt .r-row { display: flex; justify-content: space-between; gap: 1rem; padding: .35rem 0; border-bottom: 1px solid var(--line); }
.receipt .r-row.mine { font-weight: 700; color: var(--primary); }
.receipt .r-meta { margin-top: 1rem; padding-top: .5rem; border-top: 1px solid var(--line); }
.receipt .r-photo img { max-width: 100%; border-radius: 12px; }
.receipt .r-foot { margin: .5rem 0 0; }
.sheet-page .undo.float { bottom: calc(84px + env(safe-area-inset-bottom)); }
/* «👪 خانواده» (outside groups): one wallet, so only «کی پول داد؟»; no shares, no trip. */
.sheet:has([name=personal][value="family"]:checked) :is(.shared-only, .treat, label:has(> [name=event])) { display: none; }
.sheet:not(:has([name=personal][value="family"]:checked)) :is(.family-payer, .family-for) { display: none; }
/* «فقط خودم» outside groups: the same parts as a group's sheet, preset (J4). */
.sheet:not(:has([name=personal][value="1"]:checked)) :is(.me-payer, .me-for) { display: none; }
.for-line { margin: 0; min-height: 44px; display: flex; align-items: center; gap: .35rem; font-weight: 700; border: 1px dashed var(--field-border); border-radius: 12px; padding: .45rem .9rem; }
.for-line .muted { font-weight: 400; }
/* «برای کجا؟»: three labelled rows (me/home, events, groups), one choice in all. */
.scope-rows { display: flex; flex-direction: column; gap: .45rem; margin-top: .25rem; }
.scope-line { align-items: center; }
.scope-rows .chips { margin-top: 0; }
/* Labels in one column; the unlabelled first row («خودم» · «خانواده») starts where the others' chips start. */
.scope-name { flex: none; width: 4.4rem; font-size: .85rem; }
.scope-line:not(:has(.scope-name)) { padding-inline-start: calc(4.4rem + .5rem); }
/* Three sets (me/home · groups and events · others): while one holds the choice the others fade a little, still tappable. */
.scope-set { display: flex; flex-direction: column; gap: .45rem; transition: opacity .15s; }
.scope-rows > .scope-set { border-top: 1px solid var(--line); padding-top: calc(.45rem + 3px); }
/* «برای کجا؟» (P2): only the rows of the chosen kind («گروه یا رویداد» / «افراد»); «خودم» / «خانواده» have none. */
.scope-rows [data-sk] { display: none; }
.scope-rows:has([name=sk][value=place]:checked) [data-sk=place], .scope-rows:has([name=sk][value=people]:checked) [data-sk=people] { display: flex; }
/* «بین چه کسانی؟»: the group's people out of the list wait in the add field's dropdown. */
.share-row[data-out] { display: none; }
/* A group switch: its events row keeps the label and shows a small spinner until the new sheet is in. */
.scope-line.loading > :not(.scope-name) { display: none; }
.scope-line.loading::after { content: ""; width: 1.25rem; height: 1.25rem; margin: .55rem .4rem; border: 2px solid var(--line); border-top-color: var(--ink); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.new-person { display: flex; gap: .5rem; align-items: center; }
.new-person input { flex: 1; min-width: 0; }
.new-person .btn { flex: none; min-height: 44px; }
/* «افزودن نفر» (views/picker.js): the add field + its dropdown; without JS only the name + mobile row shows. */
.picker [data-picked]:empty { display: none; }
.combo { position: relative; display: flex; gap: .5rem; }
.combo input { flex: 1; min-width: 0; min-height: 44px; }
.combo .drop { position: absolute; inset-inline: 0; top: calc(100% + .35rem); z-index: 6; margin: 0; padding: .35rem; list-style: none; max-height: 50vh; overflow-y: auto;
  border-radius: 14px; background: var(--bg-solid); border: 1px solid var(--card-border); box-shadow: var(--card-shadow); }
.drop button { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: .5rem; min-height: 44px; padding: .4rem .7rem;
  border: 0; border-radius: 10px; background: none; color: inherit; font: inherit; text-align: start; cursor: pointer; }
.drop button:hover, .drop button:focus-visible { background: var(--soft); }
.drop .add { color: var(--ink); font-weight: 700; }
.drop .sec { padding: .35rem .7rem 0; }
html:not(.js) .combo, html:not(.js) [data-row-ok] { display: none; }
html.js .picker [data-rows]:not(.open) { display: none; }
@media (prefers-reduced-motion: reduce) { .scope-set { transition: none; } }
.more summary { cursor: pointer; min-height: 44px; display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .5rem; border: 1px dashed var(--field-border); border-radius: 12px; padding: .45rem .9rem; }
.more[open] summary { margin-bottom: .75rem; }
.add-person summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--ink); font-weight: 700; }
/* Every fold shows it opens: a small chevron at the end of its summary that turns over when open (flex summaries lose
   the browser's own marker). */
:is(.more, .add-person, .qa, .unit.invite details, .prow .fold) > summary::after { content: ""; flex: none; width: .45rem; height: .45rem; margin-inline-start: auto; margin-inline-end: .2rem;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-.15rem) rotate(45deg); opacity: .6; transition: transform .15s; }
:is(.more, .add-person, .qa, .unit.invite details, .prow .fold)[open] > summary::after { transform: translateY(.1rem) rotate(-135deg); }
@media (prefers-reduced-motion: reduce) { :is(.more, .add-person, .qa, .unit.invite details, .prow .fold) > summary::after { transition: none; } }
.event-chip { display: inline-flex; flex-direction: row; align-items: center; gap: .35rem; min-height: 44px; cursor: pointer; align-self: flex-start; white-space: nowrap; }
.event-chip input { position: absolute; opacity: 0; pointer-events: none; }
/* «بابت» + the category chip at the field's end; the chip opens the grid right under the field. */
.title-field { position: relative; display: flex; flex-direction: column; }
.title-field input[name=title] { padding-inline-end: 3.5rem; }
.catpick > summary.cat-chip { position: absolute; inset-inline-end: .25rem; top: calc(1lh + .35rem + 3px); width: 44px; height: 44px; display: grid; place-items: center; list-style: none; cursor: pointer; border-radius: 10px; background: var(--soft); font-size: 1.3rem; }
.catpick > summary.cat-chip::-webkit-details-marker { display: none; }
.cat-chip .cat-none, .cat-chip.none .cat-now { display: none; }
.catpick > summary.cat-chip.none { width: auto; padding: 0 .6rem; font-size: .85rem; color: var(--muted); }
.cat-chip.none .cat-none { display: flex; align-items: center; gap: .3rem; }
.title-field:has(.cat-chip.none) input[name=title] { padding-inline-end: 5.5rem; }
.catpick > summary.cat-chip:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.catpick[open] .cats { margin-top: .6rem; }
/* Category picker: emoji tiles; «خودکار» first, then trip ones once a trip is chosen. */
.cats { border: 0; padding: 0; margin: 0; min-width: 0; }
.cats legend { font-weight: 700; margin-bottom: .4rem; padding: 0; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(5.2rem, 1fr)); gap: .4rem; }
.cat-grid .opt { position: relative; flex-direction: column; justify-content: center; gap: .1rem; border-radius: 12px; padding: .45rem .25rem; text-align: center; font-size: .85rem; line-height: 1.3; }
.cat-grid .opt input { position: absolute; opacity: 0; pointer-events: none; }
.cat-grid .opt:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 2px; }
.cat-emoji { font-size: 1.4rem; line-height: 1.2; }
.sheet:has(select[name=event] option:checked:not([value=""]), input[name=event]:checked:not([value=""])) .cat-grid .trip { order: -1; }
.cat-grid .opt:has([data-auto]) { order: -2; }
.event-chip:has(input:not(:checked)) { background: var(--surface); border-color: var(--card-border); font-weight: 400; text-decoration: line-through; }

/* ============ Feed ============ */
.day { font-size: .9rem; color: var(--muted); margin: 1rem 4px .4rem; }
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.entry { display: flex; align-items: center; gap: .7rem; border-radius: 20px; padding: .65rem .75rem; color: var(--text); min-height: 56px; animation: rise .5s both; }
.feed li:nth-child(2) .entry { animation-delay: .06s; }
.feed li:nth-child(3) .entry { animation-delay: .12s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.entry.treat { border-style: dashed; }
.entry.pending { border-style: dashed; }
.entry .ico { width: 44px; height: 44px; flex: none; border-radius: 15px; display: grid; place-items: center; font-size: 1.3rem; background: color-mix(in srgb, var(--tint, var(--primary)) var(--ico-amt), transparent); }
.what, .how { display: flex; flex-direction: column; line-height: 1.45; min-width: 0; }
.what { flex: 1; }
.what strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.how { text-align: left; align-items: flex-end; white-space: nowrap; }
.what .muted, .how .muted { font-size: var(--fs-small); }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .5rem; }
.filters select { flex: 1 1 8.5rem; width: auto; min-width: 0; min-height: 44px; border-radius: 999px; padding: .45rem .9rem; font-size: .92rem; text-overflow: ellipsis; }
.filters select.on { background: var(--soft); border-color: var(--ink); font-weight: 700; }
.filters .pick { position: relative; flex: 1 1 8.5rem; min-width: 0; }
.filters .pick summary { list-style: none; cursor: pointer; display: flex; align-items: center; min-height: 44px; padding: .45rem .9rem; border: 1px solid var(--field-border); border-radius: 999px; background: var(--field); font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.filters .pick summary::-webkit-details-marker { display: none; }
.filters .pick.on summary { background: var(--soft); border-color: var(--ink); font-weight: 700; }
#feed-body { transition: opacity .15s; }
#feed-body.loading { opacity: .5; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.chips.scroll a.chip { white-space: nowrap; }
/* The question before a delete (app.js: form[data-confirm]). */
dialog.ask { border: 1px solid var(--card-border); border-radius: var(--radius); padding: 1.25rem; width: min(22rem, 90vw); background: var(--bg-solid); color: var(--text); box-shadow: var(--card-shadow); }
dialog.ask::backdrop { background: #14202b59; }
dialog.ask p { margin: 0 0 1rem; line-height: 1.8; }
dialog.ask .ask-extra { margin-bottom: 1rem; }
/* The amount sheet of «گرفتم» / «پرداخت کردم» (H7): a page without JS, a bottom sheet with it (app.js a[data-sheet]). */
dialog.bsheet { margin: auto auto 0; width: min(32rem, 100vw); max-width: 100vw; border: 1px solid var(--card-border); border-radius: var(--radius) var(--radius) 0 0; padding: 1rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom)); background: var(--bg-solid); color: var(--text); box-shadow: var(--card-shadow); }
dialog.bsheet::backdrop { background: #14202b59; }
.bsheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.bsheet-head .pill.icon { min-width: 44px; min-height: 44px; font-size: 1.4rem; }
.settle-sheet .debt { margin: 0; }
.settle-sheet .amt-row { display: flex; gap: .5rem; align-items: center; }
.settle-sheet .amt-row input { flex: 1; min-width: 0; font-size: 1.3rem; }
.settle-sheet .amt-row .chip { flex: none; min-height: 38px; white-space: nowrap; }
.settle-sheet .words { margin: 0; min-height: 1.2em; }
.settle-sheet .live { margin: 0; min-height: 1.6em; }
.icons { display: flex; gap: .5rem; }
.btn.danger { background: var(--neg); color: #fff; }
.pill.icon.danger { color: var(--neg); }

/* ============ Balances, settle up, periods ============ */
.my { font-weight: 700; font-size: .95rem; margin: 0; }
.balances h3 { margin: .5rem 0 0; font-size: .92rem; }
.bal-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; min-height: 48px; padding: .4rem .75rem; border: 1px solid var(--line); border-radius: 14px; color: var(--text); }
a.bal-row::after { content: '›'; color: var(--muted); margin-inline-start: .25rem; }
.bal-row .who { flex: 1; min-width: 0; }
.bal { display: flex; flex-direction: column; align-items: flex-end; font-weight: 700; white-space: nowrap; }
.bal .muted { font-weight: 400; }
.plan { border: 1px solid var(--line); border-radius: 14px; padding: .6rem .75rem; display: flex; flex-direction: column; gap: .5rem; }
.plan p { margin: 0; display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
/* Plan row: «از ← به» · amount · my button (· bell) on one line; card line; the fold «چرا؟». */
.prow { border: 1px solid var(--line); border-radius: 14px; padding: .4rem .75rem; display: flex; flex-direction: column; gap: .4rem; }
.prow-top { display: flex; align-items: center; gap: .5rem; min-height: 44px; }
.prow-top .who { flex: 1; min-width: 0; }
.prow-top .amt { white-space: nowrap; }
/* Money adds (V1): «+ ثبت پرداخت» / «+ هزینه» wear the bar's «+» colour, everywhere the same. */
.btn.money { background: var(--fab); color: var(--fab-ink); box-shadow: 0 8px 16px -12px var(--fab); display: inline-flex; align-items: center; justify-content: center; gap: .35rem; }
.btn.money .ic { width: 1.15em; height: 1.15em; }
/* Every other «add» (event, group, fund, «قرار», person, member, chat …): one calm framed look with «+»; money adds stay .btn.money (V2). */
.btn.add { background: none; border: 1.5px dashed var(--dash); color: var(--ink); box-shadow: none; display: inline-flex; align-items: center; justify-content: center; gap: .35rem; text-decoration: none; }
.btn.add.wide { display: flex; }
.btn.add .ic { width: 1.15em; height: 1.15em; }
.add-fold > summary { list-style: none; cursor: pointer; }
.add-fold > summary::-webkit-details-marker { display: none; }
.add-fold[open] > summary { margin-bottom: .6rem; }
/* A person's contact line (V1): icon, number, copy, call. */
.contact { display: flex; align-items: center; gap: .5rem; padding: .35rem .75rem; border: 1px solid var(--line); border-radius: 14px; margin: 0; }
.contact > .ic { color: var(--muted); flex: none; }
/* Mine stands out (V1, every mixed list): my row gets a light tint, a stronger frame and a little weight; the others' stay plain text. */
.mine-row { border-color: color-mix(in srgb, var(--ink) 40%, var(--line)); background: color-mix(in srgb, var(--ink) 7%, transparent); }
.mine-row :is(.who, .amt, .bal) { font-weight: 600; }
.mine-row .who .small { font-weight: 400; }
.prow-top form { flex: none; }
/* H6: my rows open in place; the closed row is one line (+ the claim line). */
.pcard > summary { list-style: none; cursor: pointer; display: flex; flex-direction: column; }
.pcard > summary::-webkit-details-marker { display: none; }
.pcard > summary .ic { flex: none; color: var(--muted); transition: transform .15s; }
.pcard[open] > summary .ic { transform: rotate(180deg); }
.prow .claim { padding-bottom: .4rem; margin-top: -.3rem; }
.prow-body { padding-bottom: .5rem; }
.prow-body .row-btns { align-items: center; }
.prow .fold summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; }
.prow .fold p { margin: 0 0 .5rem; }
.prow a.pair { display: inline-flex; align-items: center; min-height: 44px; }
@media (prefers-reduced-motion: reduce) { .pcard > summary .ic { transition: none; } }
.plans { display: flex; flex-direction: column; gap: .5rem; }
.plan .amt { font-weight: 700; white-space: nowrap; }
.cardno { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; background: var(--soft); border-radius: 10px; padding: .4rem .6rem; }
.cardno span { font-family: ui-monospace, monospace; letter-spacing: .03em; }
.ask p { margin: 0 0 .5rem; }
.row-btns { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.row-btns .btn { width: 100%; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; list-style: none; padding: 0; margin: 1rem 0 0; }
.stats li { display: flex; flex-direction: column; align-items: center; gap: .15rem; margin: 0; text-align: center; }
.stats strong { font-size: 1.25rem; }
.cast-text { white-space: pre-line; }
.pay-form { display: flex; gap: .5rem; }
.pay-form input { flex: 1; min-width: 0; }
.pay-form .btn { flex: none; }
.wait { display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-height: 44px; }
.wait .link { min-height: 44px; padding: 0 .75rem; }
/* A pending payment (V4): payment icon · words · «منتظر تأیید» badge · «لغو». */
.wait > .ic { flex: none; color: var(--muted); }
.wait .w-txt { flex: 1; min-width: 0; }
.wait .badge { flex: none; }
/* Event rows of a group's events list (until phase 10 moves them to .srow). */
.list .home-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.home-row .who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .15rem; }
.home-row .who .small { font-weight: 400; }
/* Home dashboard: hero, sections of scope rows (.srow), add rows, new-user starters. */
.hero { font-size: var(--fs-hero); font-weight: 700; margin: 0; line-height: 1.5; }
/* The home hero as the door to «حساب با دوستان» (H10): the sentence, then a row of faces + «همه ›». */
.hero-door { display: block; color: inherit; text-decoration: none; min-height: 44px; }
.faces { display: flex; align-items: center; margin-top: .4rem; }
/* Opaque: --soft is see-through in the glass themes, and overlapping faces then showed each other's rings. */
.face { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; overflow: hidden; background: linear-gradient(var(--soft), var(--soft)), var(--bg-solid); color: var(--ink); font-weight: 700; font-size: .78rem; line-height: 1; white-space: nowrap; padding: 0; box-shadow: 0 0 0 2px var(--line); border: 2px solid var(--card); }
.face + .face { margin-inline-start: -8px; }
.face.pos { box-shadow: 0 0 0 2px var(--pos); }
.face.neg { box-shadow: 0 0 0 2px var(--neg); }
.face img { width: 100%; height: 100%; object-fit: cover; }
.faces .muted { margin-inline-start: .6rem; }
.home-sec { margin-top: 1.25rem; }
.home-sec h2 { font-size: .85rem; font-weight: 700; color: var(--muted); margin: 0 0 .5rem; }
.srow { display: flex; align-items: center; gap: .6rem; min-height: 52px; padding: .5rem .75rem; border: 1px solid var(--line); border-radius: 14px; color: var(--text); background: var(--card); }
.srow .who { flex: 1; min-width: 0; }
.srow .who > strong.cut, .srow .who > .small { display: block; }
.srow .end.two, .srow .end > .two { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.4; }
.srow .end.two .small, .srow .end .two .small { font-weight: 400; }
.srow .end > .two { line-height: 1.2; } /* fits the row's own height */
.srow .who .small { font-weight: 400; }
.srow .end { font-weight: 700; white-space: nowrap; }
.srow .end .muted { font-weight: 400; }
.srow .ic:last-child { color: var(--muted); }
.srow > .ic:first-child:not(:last-child) { color: var(--ink); } /* the row's own icon carries the theme colour */
.more-row { display: flex; justify-content: center; }
.more-row .link { font-weight: 700; padding: 0 1rem; }
.srow.add { border-style: dashed; border-color: var(--dash); background: none; color: var(--ink); font-weight: 700; }
.with-after { display: flex; align-items: center; gap: .5rem; }
.with-after .srow { flex: 1; min-width: 0; }
.badge.warn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 .75rem; color: var(--neg); background: var(--danger-soft); white-space: nowrap; }
.hello { margin: .5rem 0 1rem; }
.hello p { margin: 0; }
.starter { display: flex; align-items: center; gap: .75rem; min-height: 64px; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: 16px; color: var(--text); background: var(--card); font-weight: 700; }
.starter .who { flex: 1; }
.starter .circle { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; background: var(--soft); color: var(--ink); flex: none; }
.starter .circle .ic { width: 1.4rem; height: 1.4rem; }
.starter > .ic { color: var(--muted); }
.close-box { background: var(--soft); border-radius: 12px; padding: .75rem; display: flex; flex-direction: column; gap: .5rem; }
.close-box p { margin: 0; }
.totals li { display: flex; justify-content: space-between; gap: .75rem; border-bottom: 1px solid var(--line); padding: .35rem 0; }

/* ============ Profile pictures and receipt photos ============ */
.plink { color: inherit; text-decoration: none; }
.av { width: 1.6rem; height: 1.6rem; border-radius: 50%; object-fit: cover; vertical-align: middle; margin-inline-end: .35rem; }
.photo { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-top: .5rem; }
.photo img { max-width: 7rem; max-height: 7rem; border-radius: 12px; border: 1px solid var(--line); object-fit: cover; display: block; }
.photo .btn { flex-direction: row; min-height: 44px; display: inline-flex; align-items: center; }
html:not(.js) .photo .btn, fieldset:disabled .photo .btn, fieldset:disabled .photo .check { display: none; }

/* ============ Jalali date fields (jdate.js) ============ */
.jdate { position: relative; display: block; }
.jdate input { padding-right: 2.9rem; }
.jdate button { position: absolute; top: 50%; right: .25rem; transform: translateY(-50%); border: 0; background: none; font-size: 1.2rem; width: 44px; height: 44px; cursor: pointer; }
.cal { border: 1px solid var(--card-border); border-radius: var(--radius); padding: .75rem; background: var(--card-solid, var(--card)); color: var(--text); width: min(20rem, 92vw); }
dialog.cal { box-shadow: var(--card-shadow); background: var(--bg-solid); }
dialog.cal::backdrop { background: #14202b59; }
.cal-head, .cal-foot { display: flex; justify-content: space-between; align-items: center; }
.cal-head button { font: inherit; font-size: 1.4rem; border: 0; background: none; width: 44px; height: 44px; cursor: pointer; color: var(--ink); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; margin: .25rem 0 .5rem; }
.cal-grid button { font: inherit; border: 0; background: none; border-radius: 50%; aspect-ratio: 1; cursor: pointer; color: var(--text); }
.cal-grid .today { color: var(--ink); font-weight: 700; box-shadow: inset 0 0 0 1px var(--ink); }
.cal-grid .on { background: var(--btn); color: var(--on-btn); }

/* ============ Theme picker (/profile/theme) ============ */
.dots { flex: none; vertical-align: middle; }
.theme-row { display: flex; align-items: center; gap: .6rem; min-height: 56px; padding: .75rem 1rem; color: var(--text); font-weight: 700; }
.theme-row > span:first-child { flex: 1; }
.theme-row .muted { font-weight: 400; }
.theme-row .tnow { display: inline-flex; align-items: center; gap: .6rem; }
html[data-scheme="dark"] .tnow[data-on="light"], html:not([data-scheme="dark"]) .tnow[data-on="dark"] { display: none; }
/* ›, not ‹: the chevron is a mirrored character, so in RTL text › shows pointing left (forward). */
.theme-row::after { content: '›'; color: var(--muted); }
#look .seg { margin-top: .25rem; }
/* Profile/about rows to the info pages (help, support, terms, privacy) */
.info-rows { display: flex; flex-direction: column; padding: .25rem 0; margin-top: .75rem; }
.info-rows a { display: flex; align-items: center; min-height: 52px; padding: 0 1rem; color: var(--text); font-weight: 700; }
.info-rows a + a { border-top: 1px solid var(--card-border); }
.info-rows a::after { content: '›'; margin-inline-start: auto; color: var(--muted); }
.info-rows a.danger { color: var(--neg); }
.info-rows [data-state], .info-rows a > .muted { margin-inline-start: auto; font-weight: 400; }
.info-rows a:has([data-state], > .muted)::after { margin-inline-start: .5rem; }
/* Public text pages (privacy, terms, help, about) */
.info h2 { font-size: var(--fs-h2); margin: 1.5rem 0 .5rem; }
.info ul { padding-inline-start: 1.2rem; display: flex; flex-direction: column; gap: .5rem; }
.info .card h2 { margin: 0; }
.card.qa { padding: .5rem 1rem; }
.qa summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 700; }
.qa p { margin: .5rem 0 0; }
/* Logged-out landing («/»). */
.landing .hero { text-align: center; padding: 1rem 0 1.25rem; }
.landing .hero img { display: block; margin: 0 auto .5rem; border-radius: 18px; }
.landing .hero h1 { font-size: 2rem; margin: 0 0 .4rem; color: var(--ink); }
.landing .hero p { margin: 0 auto; max-width: 30ch; font-size: 1.05rem; }
.perks { list-style: none; padding: 0; margin: 0 0 1.25rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .75rem; }
.perks .card { padding: 16px; margin: 0; }
.perks .emoji { font-size: 1.6rem; line-height: 1; }
.perks h2 { font-size: 1rem; margin: .5rem 0 .25rem; }
.perks p { margin: 0; }
.btn.big { font-size: 1.15rem; min-height: 56px; }
.foot-links a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 .35rem; }
.tcarousel::-webkit-scrollbar { display: none; }
/* Each slide: its name and colours on top, the preview below; one row, so they always scroll together. */
.tchip { display: flex; align-items: center; justify-content: center; gap: .4rem; min-height: 32px; white-space: nowrap; font-size: .92rem; color: var(--muted); }
.tslide:has(.tpick[aria-checked="true"]) .tchip { color: var(--text); font-weight: 700; }
/* --k scales a real-size (390×760) screen down; app.js sets it so a slide is ~72% of the carousel, the next one peeks in. */
.tcarousel { --k: .62; display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  margin: .5rem -16px 0; padding: 10px calc(50% + 16px - 195px * var(--k)) 8px; }
.tslide { flex: none; position: relative; width: calc(390px * var(--k)); scroll-snap-align: center; display: flex; flex-direction: column; gap: .5rem;
  content-visibility: auto; contain-intrinsic-size: calc(390px * var(--k)) calc(760px * var(--k) + 180px); } /* off-screen slides are not painted */
.tpick { position: absolute; inset: -6px; z-index: 2; border: 0; padding: 0; background: none; border-radius: 30px; cursor: pointer; }
.tpick:focus-visible { outline: 2px solid var(--ink); outline-offset: 0; }
.tframe { position: relative; height: calc(760px * var(--k)); border-radius: 24px; overflow: hidden; transition: transform .15s, box-shadow .2s;
  box-shadow: 0 0 0 1px var(--line), 0 18px 36px -22px #0009; }
.tpick[aria-checked="true"] ~ .tframe { box-shadow: 0 0 0 3px var(--ink), 0 18px 36px -22px #0009; }
.tpick:active ~ .tframe { transform: scale(.98); }
/* transform makes the screen the box of its fixed .bgfx, so they stay inside the mini phone. */
.tscreen { position: absolute; top: 0; right: 0; width: 390px; height: 760px; overflow: hidden; transform: scale(var(--k)); transform-origin: top right;
  background: var(--bg-solid); color: var(--text); pointer-events: none; user-select: none; }
.tscreen .entry { animation: none; }
/* Previews stay cheap on weak phones: still backgrounds, no blur, each mini phone painted on its own. */
.tframe { contain: strict; }
.tscreen .bgfx * { animation: none !important; }
.tscreen * { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
.tscreen .bgfx i { will-change: auto; } /* 30+ blurred layers would be re-blurred on every carousel frame */
.tinfo { display: flex; flex-direction: column; align-items: center; gap: .15rem; text-align: center; }
.tinfo > .muted { font-size: .85rem; line-height: 1.5; min-height: 3em; }
.tinfo .tstate { min-height: 44px; display: inline-flex; align-items: center; } /* both states one height: no jump on pick */
.tstate.on { color: var(--ink); font-weight: 700; }
.tpick[aria-checked="true"] ~ .tinfo .off, .tpick[aria-checked="false"] ~ .tinfo .on { display: none; }
.undo.float { position: fixed; z-index: 50; left: max(16px, calc(50% - 264px)); right: max(16px, calc(50% - 264px)); bottom: calc(20px + env(safe-area-inset-bottom)); }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .25s; }

/* ============ ⋯ menu (a <details> dropdown, works without JS) ============ */
.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; font-size: 1.2rem; min-width: 44px; justify-content: center; }
.menu summary::-webkit-details-marker { display: none; }
/* Opaque like the calendar: the glass --surface let the feed show through the items. */
.menu-list { position: absolute; inset-inline-end: 0; top: calc(100% + .35rem); z-index: 5; min-width: 12rem; padding: .35rem; border-radius: 14px; display: grid; background: var(--bg-solid); }
.menu-list a, .menu-list button { display: flex; align-items: center; gap: .5rem; width: 100%; min-height: 44px; padding: 0 .9rem; border: 0; border-radius: 10px; background: none; font: inherit; color: var(--text); text-decoration: none; cursor: pointer; }
.menu-list a:hover, .menu-list button:hover { background: var(--line); }
.menu-list button.danger { color: var(--neg); }
.menu-list form { margin: 0; }
/* «خروجی» in a ⋯: a nested fold with «اکسل» · «PDF» side by side; «بایگانی» with a balance: muted, with the reason. */
.menu-list details.sub > summary { display: flex; align-items: center; gap: .5rem; min-height: 44px; padding: 0 .9rem; border-radius: 10px; list-style: none; cursor: pointer; }
.menu-list details.sub > summary::-webkit-details-marker { display: none; }
.menu-list details.sub > summary:hover { background: var(--line); }
.sub-pick { display: flex; gap: .35rem; padding: 0 .5rem .35rem; }
.sub-pick a { justify-content: center; background: var(--soft); }
.menu-list .off { display: flex; align-items: center; gap: .5rem; margin: 0; min-height: 44px; padding: .35rem .9rem; color: var(--muted); }
.menu-list .off small { display: block; font-size: .75rem; }
.menu-note { margin: 0; padding: .5rem .9rem; font-size: .9rem; color: var(--muted); border-top: 1px solid var(--line); }
.menu-note span { display: flex; align-items: center; gap: .5rem; margin-bottom: .25rem; }
.menu-note a { display: inline; padding: 0; min-height: 0; color: var(--ink); }
/* Page tabs (UX plan §4.3): places of one scope, links of equal width under the bar; not .tabs/.seg (choices in a form). */
.ptabs { display: flex; margin: -.25rem 0 1rem; border-bottom: 1px solid var(--line); }
/* Five tabs fit a 360px phone (328px of content) with no sideways scroll: each takes its text's width plus a share of the rest. */
.ptabs a { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 .3rem; font-size: var(--fs-muted); color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
/* The breadcrumb (U1): one small quiet line under the bar; long names cut with «…», the current page plain. */
.crumbs { display: flex; align-items: center; gap: .3rem; margin: -.5rem 0 1rem; padding-bottom: .5rem; border-bottom: 1px solid color-mix(in srgb, var(--text) 10%, transparent); font-size: var(--fs-small); color: var(--muted); white-space: nowrap; overflow: hidden; }
.crumbs a, .crumbs span[aria-current] { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.crumbs a { color: var(--muted); text-decoration: none; flex: 0 1 auto; }
.crumbs a:first-child { flex-shrink: 0; }
.crumbs span[aria-current] { color: var(--text); flex: 0 1 auto; }
.crumbs .sep { flex-shrink: 0; }
.ptabs a[aria-current] { color: var(--ink); border-bottom-color: var(--ink); font-weight: 700; }
/* Group feed: «هزینه‌ها» with the «فیلتر» fold at its end; chips (active filters or funds) under it. */
.feed-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .5rem; }
.feed-head h2 { margin: 0; }
.feed-tools { display: flex; align-items: center; gap: .5rem; }
.feed-tools > .pill { white-space: nowrap; text-decoration: none; }
/* The event header (V2): one read-only box: dates and state, then the two figures side by side, mine stronger. */
.ev-sum { border: 1px solid var(--card-border); border-radius: var(--radius); padding: .6rem .9rem; margin-bottom: .9rem; display: grid; gap: .35rem; }
.ev-sum p { margin: 0; }
.ev-sum .ic { width: 1em; height: 1em; vertical-align: -.12em; }
.ev-figs { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin: 0; }
.ev-figs dt { font-size: var(--fs-small); color: var(--muted); }
.ev-figs dd { margin: 0; }
.ev-figs .mine dd { font-weight: 700; }
/* An event's search with its «فیلتر» beside it, like the group feed. */
.ev-tools { display: flex; align-items: flex-start; gap: .5rem; }
.ev-tools .search { flex: 1; min-width: 0; }
/* The group's «خرج‌ها» tab: one line → «حساب‌ها» (H8). */
.status-line { display: flex; align-items: center; gap: .5rem; min-height: 44px; padding: .6rem .9rem; color: inherit; text-decoration: none; font-weight: 600; }
.status-line.pos { color: var(--pos); }
.status-line.neg { color: var(--neg); }
.status-line.ask { font-weight: 400; }
.status-line .go { margin-inline-start: auto; color: var(--muted); }
.filter { position: relative; }
.filter summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: .35rem; min-height: 44px; }
.filter summary::-webkit-details-marker { display: none; }
.filter .filters { position: absolute; inset-inline-end: 0; top: calc(100% + .35rem); z-index: 5; width: min(20rem, 90vw); flex-direction: column; flex-wrap: nowrap; padding: .75rem; background: var(--bg-solid); }
.filter .filters select { flex: none; width: 100%; }
.filter .checks { border: 0; padding: 0; margin: 0; max-height: 40vh; overflow-y: auto; }
.fchips { display: flex; gap: .5rem; overflow-x: auto; margin-bottom: .5rem; }
.fchips:empty { display: none; }
.fchips .chip { flex: none; white-space: nowrap; text-decoration: none; }

/* ============ Android app (html.in-app, set by app.js «Native shell») ============ */
.in-app { overscroll-behavior-y: none; }
.in-app .web-only { display: none !important; }
html:not(.in-app) .app-only { display: none !important; }
.ptr { position: fixed; top: calc(4px + env(safe-area-inset-top)); left: 50%; z-index: 20; width: 40px; height: 40px; margin-left: -20px; border-radius: 50%;
  background: var(--bg-solid); box-shadow: var(--card-shadow); display: grid; place-items: center; transform: translateY(-56px); opacity: 0; pointer-events: none; }
.ptr i { width: 20px; height: 20px; border: 3px solid var(--line); border-top-color: var(--primary); border-radius: 50%; }
.ptr.go i { animation: ptr-spin .8s linear infinite; }
@keyframes ptr-spin { to { transform: rotate(1turn); } }
.net-off { position: fixed; z-index: 31; top: 0; left: 0; right: 0; padding: calc(.5rem + env(safe-area-inset-top)) 1rem .5rem; text-align: center; font-size: .9rem; background: var(--toast); color: #fff; }
.app-block { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 1.5rem; background: var(--bg-solid); }

/* Old WebView without color-mix(): plain colours where teal uses it (app.js keeps such a phone on teal). */
@supports not (color: color-mix(in srgb, red 50%, blue)) {
  :root { --danger-soft: #c2334d17; --dash: #13202a3d; }
  .tabs a { color: var(--muted); }
  .entry .ico { background: var(--soft); }
}

/* ============ Page rhythm ============
   Last in the file on purpose: blocks directly in <main> sit 1rem apart, beating the `margin: 0` resets of .list,
   .plain, p … above (the earlier zero-specificity version lost to them, so cards touched). Sections keep 1.5rem. */
.wrap > * + * { margin-top: 1rem; }
.wrap > .sr + * { margin-top: 0; }
.wrap > :is(.section, .center) { margin-top: 1.5rem; }
.wrap > :is(.section, .center):first-child { margin-top: 0; }

/* Update notice: the text, then two real buttons (update = primary, «بعداً» = outlined), never inline links. */
.upd-note { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem .75rem; }
.upd-note .acts { display: flex; gap: .5rem; margin-inline-start: auto; }
.upd-note .btn.ghost { background: transparent; border: 1px solid var(--field-border); }

/* «گزارش خرج‌ها»: category bars (tokens only), the width is --w; tap → that category's costs. */
.filters .dates { display: flex; gap: .5rem; flex: 1 1 100%; }
.filters .dates input { flex: 1; min-width: 0; min-height: 44px; }
.hints { margin: 1rem 0; }
.hints li { background: var(--soft); border-radius: 12px; padding: .6rem .9rem; }
.hints a { color: inherit; text-decoration: none; display: block; }
.home-hint { margin: .35rem 0 0; font-size: .9em; }
.bars { gap: .4rem; }
.cat-bar { position: relative; display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-height: 48px; padding: .5rem .8rem; border-radius: 14px; color: var(--text); background: var(--surface); border: 1px solid var(--card-border); overflow: hidden; isolation: isolate; }
.cat-bar::before { content: ""; position: absolute; inset: 0 0 0 auto; width: var(--w); background: var(--soft); z-index: -1; }
.cat-bar.on { border-color: var(--ink); font-weight: 700; }
.cat-bar .amt { white-space: nowrap; font-size: .92rem; }
.cat-bar.near::before { background: color-mix(in srgb, var(--neg) 18%, transparent); }
.cat-bar.over::before { background: var(--danger-soft); }
.top-titles li { display: flex; align-items: baseline; gap: .4rem; }
.top-titles strong { margin-inline-start: auto; }

/* Event page «افراد»: each row's «رفت / برگشت» opens a small fold with the date; the «؟» hint beside a heading. */
.presence { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.presence { padding: .55rem .25rem; border-bottom: 1px solid var(--card-border); scroll-margin-top: 6rem; }
.presence:last-child { border-bottom: 0; }
.list:has(> .presence) { gap: 0; }
/* Name and days on one line («مریم · از ۲ تا ۵ آبان»), the days cut with … when long; the action at the end. */
.presence > .who { flex: 1; min-width: 0; display: flex; align-items: center; gap: .4rem; white-space: nowrap; }
.presence > .who > a { display: inline; padding: 0; border-radius: 0; flex: none; max-width: 55%; overflow: hidden; text-overflow: ellipsis; }
.presence > .who > .muted { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.presence.away > .who > a { color: var(--muted); }
.presence form:not(.row) { margin: 0; }
/* Just added or moved: the row flashes so the change is seen. */
.presence:target { animation: flash 2s ease-out; border-radius: 12px; }
@keyframes flash { from { background: var(--soft); } to { background: transparent; } }
.presence .move summary, .hint summary { list-style: none; cursor: pointer; }
.presence .move summary::-webkit-details-marker, .hint summary::-webkit-details-marker { display: none; }
.presence .move[open] { flex-basis: 100%; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; }
.presence .move form { flex-basis: 100%; flex-wrap: nowrap; }
.presence .move input { flex: 1; min-width: 0; min-height: 44px; }
.hint summary { min-width: 44px; min-height: 44px; justify-content: center; }
.hint[open] { flex-basis: 100%; }

/* «خرج‌های من» tabs: the month hero of «خرج‌ها», the month switcher of «گزارش», category bars with their «سقف» fold. */
.hero-line { margin: 0 0 .75rem; font-size: .95rem; }
.hero-row { margin-top: 0; }
.hero-row .hero-line { flex: 1; margin: 0 0 .75rem; }
.hero-line strong { font-size: var(--fs-hero-num); }
.report-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .75rem; }
.month-nav { display: inline-flex; align-items: center; gap: .5rem; }
.month-nav .pill { min-width: 44px; min-height: 44px; justify-content: center; }
.month-nav .off { opacity: .35; }
.budget-row { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; }
.budget-row .cat-bar { flex: 1; min-width: 0; }
.cap summary { min-height: 44px; min-width: 44px; justify-content: center; white-space: nowrap; }
.cap[open] { flex-basis: 100%; }
.cap form, .cap-new form { margin-top: .5rem; }
.cap-new { margin-top: .5rem; }
/* «برای صندوق …» (F2): the whole amount goes to the fund, so the per-person split is hidden. */
.split:has([name=for_fund]:checked) :is(.seg, .shares, .add-person, .help-w, .help-x, .help-out, [data-left=share], [data-trip]) { display: none; }

/* «مشاور مالی» (/advisor, AI3, F2): bubbles from the top, the composer fixed to the bottom edge like a messenger
   (above the bottom bar; public/js/advisor.js lifts it over the keyboard and pads the chat by its height). */
.ai-msgs { display: grid; gap: .6rem; margin: 0 0 1rem; }
.ai-msg { max-width: 88%; padding: .6rem .9rem; border-radius: 16px; background: var(--surface); border: 1px solid var(--card-border); }
.ai-msg p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-msg.me { justify-self: start; background: var(--soft); border-color: transparent; }
.ai-msg.ai { justify-self: end; }
.ai-msg .chip.small { display: inline-block; margin-block: .35rem 0; padding: .2rem .7rem; font-size: .85rem; }
button.chip { min-height: 38px; font: inherit; font-size: .93rem; color: var(--text); cursor: pointer; }
.ai-start .chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.ai-chat { padding-bottom: 5rem; }
/* Full width with inner padding (K6): no strip of the chat showing at the sides while typing. */
.ai-foot { position: fixed; z-index: 15; left: 0; right: 0; bottom: env(safe-area-inset-bottom); padding: .5rem max(16px, calc(50% - 264px)); background: var(--bg-solid); }
body:has(.nav) .ai-foot { bottom: calc(64px + env(safe-area-inset-bottom)); }
/* A focused field hides .nav (see above), so the composer sits right on the keyboard, not 64px above it. */
body:has(.nav):has(input:not([type=checkbox], [type=radio], [type=file], [type=hidden]):focus, textarea:focus) .ai-foot { bottom: env(safe-area-inset-bottom); }
.ai-foot [data-offline], .ai-foot [data-left] { margin: 0 0 .3rem; }
.ai-foot [data-left]:empty { display: none; }
.ai-foot [data-mic-fix] { color: var(--primary); font-weight: 700; min-height: 44px; padding: 0 .4rem; }
.ai-row { display: flex; align-items: flex-end; gap: .4rem; }
.ai-field { position: relative; flex: 1; min-width: 0; }
.ai-field textarea { display: block; box-sizing: border-box; margin: 0; resize: none; line-height: 24px; height: 44px; min-height: 44px; max-height: 170px; overflow-y: auto; padding-block: 9px; padding-inline-end: 3.1rem; }
.ic:has(use[href*="#i-robot"]) { color: var(--ink); }
.ai-send { position: absolute; inset-inline-end: 4px; bottom: 4px; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; opacity: .35; transition: opacity .15s, background .15s; }
.ai-field textarea:not(:placeholder-shown) + .ai-send { opacity: 1; background: var(--btn); color: var(--on-btn); }
.ai-send:disabled { opacity: .35; cursor: default; }
.ai-terms { margin: 0; padding-inline-start: 1.2rem; display: grid; gap: .35rem; }
.ai-mic { min-height: 44px; gap: .25rem; cursor: pointer; }
.ai-mic.on { color: var(--neg); border-color: var(--neg); }
.ai-mic [data-mic-time] { font-size: .85rem; font-variant-numeric: tabular-nums; }
.ai-mic.busy, .ai-mic.busy:disabled { color: var(--primary); border-color: var(--primary); opacity: 1; cursor: default; }
.ai-mic.busy svg { display: none; }
.ai-mic.busy::before { content: ''; width: 18px; height: 18px; flex: none; border-radius: 50%; border: 2px solid var(--primary); border-top-color: transparent; animation: ptr-spin .8s linear infinite; }
@media (prefers-reduced-motion: reduce) { .ai-mic.busy::before { animation: none; border-top-color: var(--primary); opacity: .6; } }
.ai-compose [data-attached] { margin: 0 0 .4rem; }
.ai-compose [data-attached] .chip { display: inline-flex; align-items: center; gap: .3rem; }
.ai-compose [data-attached] button { min-width: 32px; min-height: 32px; }
.ai-rate { display: flex; gap: .25rem; margin-top: .3rem; }
.ai-rate .icon-btn { background: none; border: 1px solid transparent; border-radius: 12px; cursor: pointer; opacity: .55; }
.ai-rate .icon-btn.on { opacity: 1; border-color: var(--card-border); background: var(--soft); }
.ai-why { margin-top: .5rem; }
.ai-why .chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.ai-why .chip[aria-pressed="true"] { background: var(--soft); border-color: var(--ink); font-weight: 700; }
.pre-wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.menu.up .menu-list { top: auto; bottom: calc(100% + .35rem); inset-inline-end: auto; inset-inline-start: 0; }

.geekware-card { text-align: center; margin-top: 1rem; }
.geekware-card.small { font-size: .85rem; opacity: .9; }
.geekware-card a { font-weight: 700; display: inline-flex; align-items: center; min-height: 44px; justify-content: center; }

/* Feed search (M1): one field above the feed, the look of the filter pill. */
.search { position: relative; margin: 0 0 .5rem; }
.search .ic { position: absolute; inset-inline-start: .8rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { min-height: 44px; padding-inline-start: 2.4rem; border-radius: 14px; }

/* «در صف ارسال» (I2): costs saved with no internet, waiting to be sent */
.queue summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; }
.queue ul { list-style: none; margin: .25rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.queue li { display: flex; align-items: center; gap: .5rem; }
.queue li .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.queue .pill { min-height: 44px; }

/* «ثبت هوشمند» small sheet (A3) */
.smart-box[hidden] { display: none; }
.smart-box .row { display: flex; gap: .5rem; flex-wrap: wrap; }
.smart-box .ai-mic { margin-inline-start: auto; }
.smart-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: .25rem; }
.smart-lines .skipped span { color: var(--neg); }
.smart-lines .done span { color: var(--pos); }
.smart-ask { font-weight: 600; }
.spinner { display: inline-block; width: 1em; height: 1em; vertical-align: -.15em; border: 2px solid var(--card-border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.smart-reply { display: flex; gap: .5rem; }
.smart-reply input { flex: 1; min-width: 0; }
[data-smart-open] { align-self: flex-start; min-height: 44px; }

/* Plans page (P1): every plan has a head (medal + title + one line) and a big price; the gold plans wear the gold
   token (frame, warm wash, gold medal, ticks, active period and buy button), the founders' card a dark gold one. */
.plan-head { display: flex; align-items: center; gap: .75rem; }
.plan-head h2 { margin: 0; }
.plan-head p { margin: .15rem 0 0; }
.medal { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 2.75rem; height: 2.75rem; border-radius: 50%; color: var(--ink); background: var(--soft); }
.medal .ic { width: 1.35rem; height: 1.35rem; }
.medal .gbadge { font-size: 1.35rem; background: none; color: inherit; animation: none; filter: none; } /* on the gold medal the ✦ is plain white (V4) */
.plan .price { display: block; margin: 0; color: var(--muted); }
.plan .price strong { font-size: 1.6rem; font-weight: 800; color: var(--text); }
.plan > form > .btn, .plan > form > a.btn, .plan > form > span.btn { display: block; width: 100%; text-align: center; }
.plan .stepper strong { min-width: 1.5rem; text-align: center; font-size: 1.15rem; }
.plan.loading { opacity: .6; transition: opacity .15s; }
.plan-gold { --gold-ink: color-mix(in srgb, var(--gold) 62%, var(--text)); border-color: color-mix(in srgb, var(--gold) 55%, var(--card-border));
  background: linear-gradient(170deg, color-mix(in srgb, var(--gold) 15%, var(--surface)) 0, var(--surface) 12rem); }
.plan-gold .medal { color: #fff; background: linear-gradient(140deg, #f5d98a, var(--gold) 55%, #9a6c15); box-shadow: 0 6px 14px -7px var(--gold); }
.plan-gold li > .ic { color: var(--gold); }
.plan-gold .price strong { color: var(--gold-ink); }
.plan-gold .seg a.opt.on { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 18%, transparent); color: var(--text); }
.plan-gold .btn:not(.ghost) { background: linear-gradient(140deg, #f5d98a, var(--gold) 60%, #a77a1d); color: #2b1d03; box-shadow: 0 10px 20px -12px var(--gold); }
.plan-tag { position: absolute; top: -.7rem; inset-inline-end: 1.25rem; padding: .15rem .7rem; border-radius: 99px; font-size: var(--fs-small); font-weight: 700; color: #2b1d03; background: linear-gradient(140deg, #f5d98a, var(--gold)); }
.plan-founder { color: #f7eed6; border-color: var(--gold); background: radial-gradient(120% 90% at 100% 0, #5a4313 0, #221a0b 55%, #15110a 100%); }
.plan-founder .muted, .plan-founder .price, .plan-founder p { color: #d8c79c; }
.plan-founder .price strong { color: #f5d98a; }
.seats { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 6px; border: 0; border-radius: 99px; background: #ffffff1f; overflow: hidden; }
.seats::-webkit-progress-bar { background: #ffffff1f; }
.seats::-webkit-progress-value { border-radius: 99px; background: linear-gradient(90deg, #f5d98a, var(--gold)); }
.seats::-moz-progress-bar { border-radius: 99px; background: linear-gradient(90deg, #f5d98a, var(--gold)); }
.event-banner.plan-gold > .ic { color: var(--gold); }

/* Photo viewer (app.js viewPhoto): the photo fits the screen; zoom and pan are a transform, edges spring back. */
dialog.pview { position: fixed; inset: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: #000e; display: grid; place-items: center; overflow: hidden; touch-action: none; overscroll-behavior: contain; }
dialog.pview::backdrop { background: #000c; }
dialog.pview img { max-width: 100vw; max-height: 100dvh; object-fit: contain; user-select: none; -webkit-user-drag: none; transform-origin: center; will-change: transform; }
dialog.pview img.snap { transition: transform .28s cubic-bezier(.2, .9, .3, 1.15); }
dialog.pview button { position: fixed; top: calc(12px + env(safe-area-inset-top)); left: max(12px, env(safe-area-inset-left)); background: #fff2; color: #fff; border: 0; font-size: 1.4rem; }
@media (prefers-reduced-motion: reduce) { dialog.pview img.snap { transition: none; } }

/* Form errors (app.js «Form errors»): the wrong field gets the error colour; its message sits right under it. */
[aria-invalid="true"]:is(input, select, textarea) { border-color: var(--neg); box-shadow: 0 0 0 3px var(--danger-soft); }
.alert[data-client] { margin-top: .4rem; }
.gap-ok { align-self: flex-start; }
.alert:focus { outline: none; }
dialog.ask .steps { margin: 0 0 1rem; padding-inline-start: 1.2rem; line-height: 1.9; }

/* Admin «اعطای پلن»: the number field means days, or «پرسش» for AI credit (the chosen radio decides). */
.n-ask { display: none; }
form:has([name=kind][value=ai]:checked) .n-ask { display: revert; }
form:has([name=kind][value=ai]:checked) .n-days { display: none; }

/* ============ «شکل لیست‌ها: چرخ» (html[data-list=wheel]; app.js marks long lists ul.wheel and their rows li.focus / li.near) ============
   Rows are written on the page, not cards. Three sizes only: every row a little smaller and softer, the two next to the
   focus half a step up, the focused one the biggest in full light, its own colours. A soft spring between steps. The
   hairline sits on the <li>; only the row's content scales, around the middle of what is written (origin from app.js). */
html[data-list="wheel"] #main { overflow-x: clip; }
html[data-list="wheel"] #main ul.wheel { gap: 0; }
html[data-list="wheel"] #main ul.wheel > li { border-bottom: 1px solid color-mix(in srgb, var(--text) 8%, transparent); }
html[data-list="wheel"] #main ul.wheel > li:last-child { border-bottom: 0; }
html[data-list="wheel"] #main ul.wheel > li > :is(a, div) {
  background: none; border: 0; box-shadow: none; border-radius: 0; animation: none;
  padding-block: .9rem; padding-inline: 6px; min-height: 64px;
}
html[data-list="wheel"] #main ul.wheel > li > * {
  transform: scale(.97); opacity: .64;
  transition: transform .42s cubic-bezier(.3, 1.35, .5, 1), opacity .35s ease-out;
}
html[data-list="wheel"] #main ul.wheel > li.near > * { transform: scale(1.02); opacity: .86; }
html[data-list="wheel"] #main ul.wheel > li.focus > * { transform: scale(1.065); opacity: 1; }
html[data-list="wheel"] #main ul.wheel > li > :is(a, div)::before { display: none; }
html[data-list="wheel"] #main ul.wheel .entry .ico { border-radius: 50%; width: 42px; height: 42px; }

/* A short amount («۸٫۲ میلیون», U5): a tap swaps in the exact one (app.js `data-exact`). */
.amt-short { cursor: pointer; white-space: nowrap; }

/* Profile head (pages.js meHead): the round photo with a camera badge opens its menu; the name, mobile and plan below. */
.me-head { display: grid; justify-items: center; gap: .3rem; padding-top: 1.4rem; text-align: center; }
.me-pic summary { padding: 0; min-width: 0; position: relative; display: block; border-radius: 50%; }
.me-pic summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.me-av { width: 104px; height: 104px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--soft); color: var(--ink);
  font-size: 2.6rem; font-weight: 700; box-shadow: 0 0 0 3px var(--card), 0 0 0 5px var(--line); }
.me-av img { width: 100%; height: 100%; object-fit: cover; grid-area: 1 / 1; }
.me-av img:not([hidden]) + .ini { display: none; }
.me-cam { position: absolute; bottom: 2px; inset-inline-end: 2px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary); color: var(--on-primary); box-shadow: 0 0 0 3px var(--card); }
.me-cam svg { width: 18px; height: 18px; }
.me-pic .menu-list { inset-inline-end: auto; left: 50%; transform: translateX(-50%); top: calc(100% + .5rem); text-align: start; }
.me-pic .menu-list label { display: flex; align-items: center; gap: .5rem; min-height: 44px; padding: 0 .9rem; border-radius: 10px; cursor: pointer; }
.me-pic .menu-list label:hover { background: var(--line); }
.me-head .alert { margin: .3rem 0 0; }
.me-name { margin: .5rem 0 0; font-size: 1.35rem; }
.me-head > p.muted { margin: 0; }
.plan-pill { display: inline-flex; align-items: center; gap: .3rem; margin-top: .4rem; min-height: 36px; padding: 0 .9rem; border-radius: 99px;
  background: var(--soft); color: var(--ink); text-decoration: none; font-size: .9rem; }
.plan-pill.gold { background: color-mix(in srgb, var(--gold) 16%, transparent); }
html:not(.js) .me-pic .menu-list label { display: none; }

/* Crop frame (app.js cropPhoto): the photo under a square window, the outside dimmed; dashed square + circle guides. */
dialog.crop { position: fixed; inset: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; border: 0; color: #fff;
  background: #000; display: grid; grid-template-rows: auto 1fr auto auto auto; gap: .8rem; overflow: hidden; overscroll-behavior: contain;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)); }
dialog.crop::backdrop { background: #000; }
.crop-title { margin: 0; text-align: center; font-size: .95rem; opacity: .85; }
.crop-area { display: grid; place-items: center; min-height: 0; touch-action: none; cursor: grab; }
.crop-stage { position: relative; }
.crop-stage canvas { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; user-select: none; -webkit-user-drag: none; will-change: transform; }
.crop-frame { position: absolute; inset: 0; pointer-events: none; border: 2px dashed #fffd; box-shadow: 0 0 0 100vmax #000a; }
.crop-frame i { position: absolute; inset: 0; border-radius: 50%; border: 2px dashed #fffd;
  background: radial-gradient(circle closest-side, transparent 99%, #0004 100%); }
.crop-key { display: flex; justify-content: center; gap: 1.4rem; margin: 0; font-size: .85rem; opacity: .85; }
.crop-key span { display: inline-flex; align-items: center; gap: .4rem; }
.crop-key i { width: 16px; height: 16px; border: 2px dashed #fff; }
.crop-key .k-circle { border-radius: 50%; }
.crop-zoom { width: min(100%, 420px); justify-self: center; accent-color: var(--primary); }
.crop-btns { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; width: min(100%, 420px); justify-self: center; }
.crop-btns .btn.ghost { background: #fff2; color: #fff; }
.crop-title, .crop-key, .crop-zoom, .crop-btns { position: relative; z-index: 1; } /* above the frame's dimming */
