/* PussySplit – stil */
:root {
  --bg: #fff6f1;
  --bg-2: #ffe9e1;
  --surface: #ffffff;
  --surface-2: #fff3ee;
  --text: #1e1225;
  --muted: #7a6a82;
  --line: #f1dcd5;
  --accent: #ff2e7e;
  --accent-2: #7c3aed;
  --accent-soft: #ffe0ec;
  --accent-ink: #ffffff;
  --pos: #0b9a6a;
  --pos-soft: #dcf7ec;
  --neg: #e0364a;
  --neg-soft: #ffe3e6;
  --shadow: 0 1px 2px rgba(60, 10, 40, .05), 0 12px 32px -16px rgba(90, 20, 60, .28);
  --shadow-lg: 0 30px 80px -20px rgba(70, 10, 50, .45);
  --r: 20px;
  --r-sm: 12px;
  --font: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Bricolage Grotesque', 'DM Sans', system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #110b17; --bg-2: #1b1024; --surface: #1b1423; --surface-2: #241a2e; --text: #f7eff9; --muted: #a897b2;
    --line: #33263e; --accent: #ff4f93; --accent-2: #a78bfa; --accent-soft: #3a1830; --pos: #3ddc97; --pos-soft: #10342a;
    --neg: #ff6b7d; --neg-soft: #3b1720; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px -16px rgba(0, 0, 0, .7);
    --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, .8); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #110b17; --bg-2: #1b1024; --surface: #1b1423; --surface-2: #241a2e; --text: #f7eff9; --muted: #a897b2;
  --line: #33263e; --accent: #ff4f93; --accent-2: #a78bfa; --accent-soft: #3a1830; --pos: #3ddc97; --pos-soft: #10342a;
  --neg: #ff6b7d; --neg-soft: #3b1720; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px -16px rgba(0, 0, 0, .7);
  --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, .8); color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); color: var(--text); background: var(--bg);
  background-image: radial-gradient(900px 500px at 100% -10%, var(--accent-soft), transparent 60%), radial-gradient(700px 500px at -10% 10%, color-mix(in srgb, var(--accent-2) 14%, transparent), transparent 60%);
  background-attachment: fixed; min-height: 100vh; line-height: 1.45; font-size: 16px;
}
body.modal-open { overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); }
h1, h2, h3, h4 { font-family: var(--display); letter-spacing: -.02em; margin: 0; line-height: 1.1; }
small { font-size: .8rem; }
.muted { color: var(--muted); }
.pos { color: var(--pos); } .neg { color: var(--neg); }
.center { text-align: center; }
.sm-txt { font-size: .85rem; }
.grow { flex: 1; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

/* logo */
.logo { width: 30px; height: 30px; color: var(--accent); flex: none; }
.logo-eye { fill: var(--bg); } .logo-split { stroke: var(--bg); }

/* topbar */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px;
  padding: 12px max(16px, env(safe-area-inset-left)); padding-top: max(12px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); font-family: var(--display); font-weight: 700; font-size: 1.25rem; letter-spacing: -.03em; }
.brand b { color: var(--accent); font-weight: 800; }
.tb-group { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding-left: 14px; border-left: 1px solid var(--line); }
.tb-group h1 { font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.av-stack { display: flex; flex: none; }
.av-stack .av { margin-left: -8px; box-shadow: 0 0 0 2px var(--bg); }
.av-stack .av:first-child { margin-left: 0; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--surface);
  padding: 10px 16px; border-radius: 999px; font-weight: 600; cursor: pointer; text-decoration: none; color: var(--text);
  transition: transform .12s ease, background .15s, box-shadow .15s, border-color .15s; white-space: nowrap; font-size: .95rem;
}
.btn:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.btn:active { transform: scale(.96); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 20px -10px var(--accent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.big { padding: 14px 22px; font-size: 1.05rem; }
.btn.full { width: 100%; }
.btn.sm { padding: 7px 12px; font-size: .85rem; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.danger { color: var(--neg); }
.btn.light { background: rgba(255, 255, 255, .95); color: #1e1225; border-color: transparent; }
.btn.swish { background: #fff; color: #1e1225; border-color: var(--line); }
.btn.swish::before { content: ''; width: 14px; height: 14px; border-radius: 50%; background: conic-gradient(#e9474f, #f6a43c, #6ac36a, #3ea3db, #e9474f); }
.btn:disabled { opacity: .6; pointer-events: none; }
.icon-btn { border: 0; background: transparent; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; font-size: 1rem; color: var(--muted); flex: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.link { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.light-link { color: rgba(255, 255, 255, .9); }
.share-btn { flex: none; }

/* avatars */
.av {
  --h: 330; width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  background: hsl(var(--h) 85% 88%); color: hsl(var(--h) 60% 28%); font-weight: 700; font-size: .9rem; font-family: var(--display);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .av { background: hsl(var(--h) 45% 30%); color: hsl(var(--h) 90% 88%); } }
:root[data-theme="dark"] .av { background: hsl(var(--h) 45% 30%); color: hsl(var(--h) 90% 88%); }
.av.sm { width: 26px; height: 26px; font-size: .72rem; }
.av.xs { width: 18px; height: 18px; font-size: .6rem; vertical-align: -4px; }
.av.more { background: var(--surface-2); color: var(--muted); }

/* layout */
.wrap { max-width: 760px; margin: 0 auto; padding: 18px 16px 120px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card h3 { font-size: 1.15rem; margin-bottom: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h3 { margin: 0; }
.hint { background: var(--surface-2); border-radius: var(--r-sm); padding: 10px 12px; font-size: .88rem; color: var(--muted); margin: 12px 0 0; }
.boot { display: grid; place-items: center; min-height: 50vh; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* home */
.home { max-width: 1120px; margin: 0 auto; padding: 24px 16px 60px; }
.hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; padding: 32px 0 48px; }
.eyebrow { display: inline-block; font-size: .8rem; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 6px 12px; border-radius: 999px; letter-spacing: .01em; }
.hero h1 { font-size: clamp(2.4rem, 5.2vw, 4.2rem); font-weight: 800; letter-spacing: -.045em; margin: 16px 0 14px; line-height: .98; }
.hero h1 em { font-style: normal; background: linear-gradient(100deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { font-size: 1.12rem; color: var(--muted); max-width: 34em; margin: 0 0 26px; }
.hero-art { position: relative; max-width: 500px; margin: -8px 0 18px -12px; }
.hero-glow { position: absolute; inset: 12% 10% 18%; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--accent) 38%, transparent), transparent 70%); filter: blur(36px); z-index: 0; animation: pulse 6s ease-in-out infinite; }
.art { display: block; }
.art img { display: block; width: 100%; height: auto; }
.hero-img { position: relative; z-index: 1; }
.hero-img img { filter: drop-shadow(0 26px 34px rgba(190, 20, 90, .28)); animation: float 6s ease-in-out infinite; transform-origin: 50% 80%; }
.demo-row { position: absolute; z-index: 2; display: flex; align-items: center; gap: 7px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border: 1px solid var(--line); padding: 8px 12px 8px 8px; border-radius: 14px; box-shadow: var(--shadow); font-size: .86rem; white-space: nowrap; animation: float 5s ease-in-out infinite; }
.demo-row .av { width: 24px; height: 24px; font-size: .7rem; }
.demo-row b { margin-left: 6px; font-family: var(--display); }
.demo-row .arrow { color: var(--muted); }
.demo-row.done b { color: var(--pos); }
.demo-row.d1 { left: -22px; top: 63%; animation-delay: -1.8s; }
.demo-row.d2 { right: -26px; top: 13%; animation-delay: -3.4s; }
@keyframes pulse { 50% { opacity: .65; transform: scale(1.06); } }
.empty-art { width: 210px; margin: 0 auto 6px; }
.good-art { width: 190px; margin: 0 auto 4px; animation: bob 3s ease-in-out infinite; }
.share-art { width: 170px; margin: -4px auto 10px; }
@keyframes float { 50% { transform: translateY(-4px); } }
.create { padding: 26px; box-shadow: var(--shadow-lg); position: relative; }
.create::before { content: ''; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; background: linear-gradient(140deg, var(--accent), transparent 40%, transparent 60%, var(--accent-2)); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; }
.create h2 { font-size: 1.5rem; margin-bottom: 18px; }
.create .btn.big { width: 100%; margin-top: 6px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-width: 0; }
.field > span { font-weight: 600; font-size: .88rem; }
.field small { color: var(--muted); }
input, select {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2);
  outline: none; transition: border-color .15s, background .15s, box-shadow .15s; font-size: 1rem; min-width: 0;
}
input:focus, select:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
input[type=search] { -webkit-appearance: none; appearance: none; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.chips-input { display: flex; flex-wrap: wrap; gap: 6px; padding: 7px; border: 1.5px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); }
.chips-input:focus-within { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
.chips-input input { flex: 1; min-width: 140px; border: 0; background: transparent; padding: 6px; box-shadow: none !important; }
.chip-add { flex: none; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: .85rem; padding: 7px 12px; border-radius: 999px; cursor: pointer; margin-left: auto; }
.chip-add:active { transform: scale(.95); }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--accent-soft); color: var(--accent); font-weight: 600; padding: 5px 6px 5px 12px; border-radius: 999px; font-size: .9rem; animation: pop .2s ease; }
.chip button { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 1.1rem; line-height: 1; width: 22px; height: 22px; border-radius: 50%; }
.chip button:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }
@keyframes pop { from { transform: scale(.7); opacity: 0; } }

.recent { margin: 8px 0 40px; }
.recent h3 { font-size: 1.1rem; margin-bottom: 12px; }
.recent-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.recent-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; text-decoration: none; color: var(--text); transition: transform .15s, box-shadow .15s; }
.recent-item:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.recent-item span:nth-child(2) { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.recent-item b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-item small { color: var(--muted); }
.ri-logo { width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); display: grid; place-items: center; flex: none; }
.ri-logo .logo { width: 24px; height: 24px; }
.ri-logo .logo-eye { fill: var(--accent-soft); } .ri-logo .logo-split { stroke: var(--accent-soft); }
.chev { color: var(--muted); font-size: 1.4rem; }

.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; transition: transform .2s; }
.feature:hover { transform: translateY(-3px) rotate(-.4deg); }
.f-ico { font-size: 1.6rem; display: block; margin-bottom: 10px; }
.feature h4 { font-size: 1.08rem; margin-bottom: 6px; }
.feature p { margin: 0; color: var(--muted); font-size: .93rem; }
.foot { text-align: center; color: var(--muted); padding: 30px 16px 40px; font-size: .88rem; }

/* me card */
.me-card {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 22px 24px; border-radius: 24px; margin-bottom: 16px; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(125deg, #3b1b5c, #7c3aed 55%, #ff2e7e); box-shadow: var(--shadow-lg);
}
.me-card::after { content: ''; position: absolute; width: 240px; height: 240px; right: -60px; top: -90px; border-radius: 50%; background: rgba(255, 255, 255, .12); pointer-events: none; }
.me-card.pos { background: linear-gradient(125deg, #064e3b, #0b9a6a 55%, #34d399); }
.me-card.neg { background: linear-gradient(125deg, #4c0519, #e0364a 55%, #ff7a59); }
.me-card.zero { background: linear-gradient(125deg, #3b1b5c, #7c3aed 55%, #ff2e7e); }
.me-main { position: relative; z-index: 1; min-width: 0; }
.me-card .label { font-size: .92rem; opacity: .9; font-weight: 500; }
.me-card .big { font-family: var(--display); font-weight: 800; font-size: clamp(2.2rem, 7vw, 3.2rem); letter-spacing: -.04em; line-height: 1.05; margin: 4px 0 6px; font-variant-numeric: tabular-nums; }
.me-card small { opacity: .85; font-size: .88rem; }
.me-side { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; position: relative; z-index: 1; }

/* who */
.who { border: 2px dashed color-mix(in srgb, var(--accent) 45%, var(--line)); }
.who-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 14px; }
.who-head h3 { margin-bottom: 4px; }
.who-head p { margin: 0; color: var(--muted); font-size: .93rem; }
.wave { font-size: 2rem; animation: wave 2s ease-in-out infinite; transform-origin: 70% 70%; display: inline-block; }
@keyframes wave { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(16deg); } 20%, 40% { transform: rotate(-8deg); } }
.who .link { margin-top: 12px; color: var(--muted); font-weight: 500; font-size: .88rem; }
.inline-form { display: flex; gap: 8px; margin-top: 12px; }
.inline-form input { flex: 1; }

/* pills */
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 6px 14px 6px 6px; border: 1.5px solid var(--line); background: var(--surface); border-radius: 999px; cursor: pointer; font-weight: 600; font-size: .92rem; transition: all .15s; }
.pill.cat { padding: 7px 13px; }
.pill:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.pill.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pill:active { transform: scale(.95); }

/* tabs */
.tabs { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--line); padding: 5px; border-radius: 999px; margin-bottom: 16px; position: sticky; top: 62px; z-index: 10; box-shadow: var(--shadow); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 1; border: 0; background: transparent; padding: 10px 12px; border-radius: 999px; cursor: pointer; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; transition: background .2s, color .2s; font-size: .93rem; }
.tab:hover { color: var(--text); }
.tab.on { background: var(--text); color: var(--bg); }
.badge { background: var(--accent-soft); color: var(--accent); font-size: .72rem; padding: 1px 7px; border-radius: 999px; font-weight: 700; }
.tab.on .badge { background: var(--accent); color: #fff; }
.tab-body { animation: fadeUp .25s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } }

/* quick add */
.quick { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 999px; padding: 6px 6px 6px 16px; box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s; }
.quick:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
.quick input { border: 0; background: transparent; padding: 8px 4px; box-shadow: none !important; }
.quick input:focus, .chips-input input:focus, .stepper input:focus { outline: none; background: transparent; }
.quick-ico { font-size: 1.1rem; }
.quick-hint { font-size: .86rem; padding: 0 18px; max-height: 0; overflow: hidden; opacity: 0; transition: all .2s ease; }
.quick-hint.on { max-height: 80px; opacity: 1; padding: 10px 18px 0; }
.search { margin: 16px 0 6px; }
.search input { border-radius: 999px; padding-left: 40px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%23998' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-4-4'/%3E%3C/svg%3E") no-repeat 14px center; }

/* expense list */
.exp-list { display: flex; flex-direction: column; }
.day { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 18px 6px 8px; }
.exp {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line);
  padding: 12px 14px; border-radius: 16px; cursor: pointer; margin-bottom: 8px; transition: transform .12s, box-shadow .15s, border-color .15s;
}
.exp:hover { transform: translateY(-1px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }
.exp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.exp-main b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exp-main small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exp-amt { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; font-variant-numeric: tabular-nums; }
.exp-amt b { font-family: var(--display); font-size: 1.05rem; }
.cat-ico { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 1.3rem; flex: none; background: var(--c, var(--surface-2)); }
.cat-mat { --c: #ffe6cc; } .cat-dryck { --c: #fff2b8; } .cat-handla { --c: #d9f3e6; } .cat-boende { --c: #e3e6ff; } .cat-resa { --c: #d6efff; } .cat-noje { --c: #ffdcef; } .cat-ovrigt { --c: #ece6f0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cat-ico { background: color-mix(in srgb, var(--c) 18%, var(--surface-2)); } }
:root[data-theme="dark"] .cat-ico { background: color-mix(in srgb, var(--c) 18%, var(--surface-2)); }

/* empty */
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty h3, .empty h2 { color: var(--text); margin-bottom: 6px; }
.empty p { margin: 0 0 18px; }
.empty.small { padding: 20px; }
.empty-ico { font-size: 3rem; margin-bottom: 10px; animation: bob 3s ease-in-out infinite; display: inline-block; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-6deg); } }
.big-empty { padding-top: 15vh; }

/* settle */
.transfers { display: flex; flex-direction: column; gap: 10px; }
.tr { display: grid; grid-template-columns: 1fr auto auto; grid-template-areas: "who amt act"; align-items: center; gap: 10px 12px; padding: 14px; border-radius: 16px; background: var(--surface-2); border: 1.5px solid transparent; animation: fadeUp .3s ease both; }
.tr.mine-out { border-color: color-mix(in srgb, var(--neg) 40%, transparent); background: var(--neg-soft); }
.tr.mine-in { border-color: color-mix(in srgb, var(--pos) 40%, transparent); background: var(--pos-soft); }
.tr-who { grid-area: who; display: flex; align-items: center; gap: 10px; min-width: 0; }
.tr-txt { display: flex; flex-direction: column; min-width: 0; font-size: .92rem; }
.tr-txt > b { font-size: 1rem; }
.tr-txt span { color: var(--muted); }
.tr-txt span b { color: var(--text); }
.tr-amt { grid-area: amt; font-family: var(--display); font-weight: 800; font-size: 1.4rem; align-self: center; font-variant-numeric: tabular-nums; }
.tr-act { grid-area: act; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.all-good { text-align: center; padding: 20px; }
.all-good h3 { color: var(--pos); }
.all-good p { color: var(--muted); margin: 4px 0 0; }

.bal-list { display: flex; flex-direction: column; gap: 4px; }
.bal-row { display: grid; grid-template-columns: minmax(0, 1.2fr) 2fr 120px; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; }
.bal-row.is-me { background: var(--surface-2); }
.bal-name { display: flex; align-items: center; gap: 8px; font-weight: 600; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.bal-bar { position: relative; height: 10px; background: var(--surface-2); border-radius: 999px; }
.bal-row.is-me .bal-bar { background: var(--bg); }
.bal-bar::after { content: ''; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 2px; background: var(--line); }
.bal-bar i { position: absolute; top: 0; bottom: 0; border-radius: 999px; transition: width .4s ease, left .4s ease; }
.bal-bar i.pos { background: var(--pos); } .bal-bar i.neg { background: var(--neg); }
.bal-amt { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; min-width: 84px; }

.pay-list { display: flex; flex-direction: column; gap: 6px; }
.pay { display: flex; align-items: center; gap: 12px; padding: 10px 6px 10px 10px; border-radius: 12px; }
.pay:hover { background: var(--surface-2); }
.pay-check { width: 28px; height: 28px; border-radius: 50%; background: var(--pos-soft); color: var(--pos); display: grid; place-items: center; font-weight: 800; flex: none; }
.pay-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pay-main small { color: var(--muted); }
.pay-amt { font-variant-numeric: tabular-nums; }

/* stats */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpi span { font-size: .78rem; color: var(--muted); font-weight: 600; }
.kpi b { font-family: var(--display); font-size: 1.35rem; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbars, .pbars { display: flex; flex-direction: column; gap: 12px; }
.hbar, .pbar { display: grid; grid-template-columns: 130px 1fr auto; gap: 12px; align-items: center; }
.hb-l, .pb-l { font-weight: 600; font-size: .92rem; display: flex; align-items: center; gap: 8px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb-t { height: 14px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.hb-t i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); animation: grow .6s ease both; transform-origin: left; }
@keyframes grow { from { transform: scaleX(0); } }
.hb-v, .pb-v { font-variant-numeric: tabular-nums; font-weight: 700; text-align: right; font-size: .92rem; min-width: 90px; }
.hb-v small { color: var(--muted); font-weight: 500; }
.pb-t { display: flex; flex-direction: column; gap: 4px; }
.pb-t i { display: block; height: 8px; border-radius: 999px; animation: grow .6s ease both; transform-origin: left; min-width: 2px; }
.pb-t i.paid, .lg.paid { background: var(--accent); }
.pb-t i.used, .lg.used { background: var(--accent-2); opacity: .55; }
.pb-v { display: flex; flex-direction: column; }
.pb-v small { color: var(--muted); font-weight: 500; }
.legend { font-size: .8rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.lg { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-left: 6px; }
.vbars { display: flex; align-items: flex-end; gap: 8px; height: 180px; padding-top: 20px; }
.vbar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; min-width: 0; position: relative; }
.vbar i { width: 100%; max-width: 44px; border-radius: 10px 10px 4px 4px; background: linear-gradient(180deg, var(--accent), var(--accent-2)); animation: growY .6s ease both; transform-origin: bottom; }
@keyframes growY { from { transform: scaleY(0); } }
.vb-l { font-size: .7rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.vb-v { font-size: .68rem; font-weight: 700; opacity: 0; transition: opacity .15s; white-space: nowrap; position: absolute; top: -4px; }
.vbar:hover .vb-v { opacity: 1; }
.log { list-style: none; margin: 0; padding: 0; }
.log li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.log li:last-child { border-bottom: 0; }
.log small { color: var(--muted); white-space: nowrap; }

/* group tab */
.members { display: flex; flex-direction: column; gap: 8px; }
.mem { display: grid; grid-template-columns: auto 1.2fr 1fr auto; gap: 8px; align-items: center; padding: 6px; border-radius: 14px; }
.mem.is-me { background: var(--surface-2); }
.mem input { padding: 9px 12px; }
.tools { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tool { display: flex; align-items: center; gap: 10px; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; text-align: left; font-weight: 600; font-size: .92rem; transition: transform .12s, border-color .15s; }
.tool:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); transform: translateY(-1px); }
.tool span { font-size: 1.2rem; }

/* fab */
.fab {
  position: fixed; right: max(20px, env(safe-area-inset-right)); bottom: max(22px, env(safe-area-inset-bottom)); z-index: 30;
  width: 64px; height: 64px; border-radius: 22px; border: 0; cursor: pointer; color: #fff; font-size: 2.2rem; font-weight: 300;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 16px 34px -10px var(--accent); transition: transform .2s cubic-bezier(.3, 1.6, .5, 1);
  display: grid; place-items: center;
}
.fab span { line-height: 1; margin-top: -4px; }
.fab:hover { transform: scale(1.07) rotate(90deg); }
.fab:active { transform: scale(.94); }

/* modal */
#modal-root { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
#modal-root:empty { display: none; }
.backdrop { position: absolute; inset: 0; background: rgba(20, 6, 24, .45); backdrop-filter: blur(3px); opacity: 0; transition: opacity .2s; pointer-events: auto; }
.sheet {
  position: absolute; left: 50%; top: 50%; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px);
  transform: translate(-50%, -46%) scale(.97); opacity: 0; transition: transform .25s cubic-bezier(.2, .9, .3, 1.1), opacity .2s;
  background: var(--surface); border-radius: 26px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; pointer-events: auto; border: 1px solid var(--line);
}
#modal-root.open .backdrop { opacity: 1; }
#modal-root.open .sheet { transform: translate(-50%, -50%); opacity: 1; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 6px; }
.sheet-head h2 { font-size: 1.4rem; }
.sheet-body { padding: 10px 20px; overflow-y: auto; overscroll-behavior: contain; }
.sheet-foot { display: flex; gap: 8px; align-items: center; padding: 14px 20px 18px; border-top: 1px solid var(--line); }
.calc { min-height: 1.2em; transition: color .15s; }
.calc.on { color: var(--accent); font-weight: 700; }
.calc.bad { color: var(--neg); }
.seg { display: flex; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 9px 8px; border-radius: 9px; cursor: pointer; font-weight: 600; color: var(--muted); transition: all .15s; font-size: .92rem; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.split-tools { display: flex; gap: 14px; margin: 10px 2px 4px; font-size: .85rem; flex-wrap: wrap; }
.split-tools .link { font-weight: 500; }
.split-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.split-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); text-align: left; }
.split-row.toggle { cursor: pointer; transition: all .15s; opacity: .55; }
.split-row.toggle.on { opacity: 1; border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); background: color-mix(in srgb, var(--accent-soft) 50%, var(--surface)); }
.sr-name { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-share { color: var(--muted); font-size: .88rem; font-variant-numeric: tabular-nums; }
.check { width: 24px; height: 24px; border-radius: 8px; border: 1.5px solid var(--line); display: grid; place-items: center; color: transparent; font-weight: 800; font-size: .8rem; transition: all .15s; }
.split-row.on .check { background: var(--accent); border-color: var(--accent); color: #fff; }
.stepper { display: flex; align-items: center; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; }
.stepper button { border: 0; background: var(--surface-2); width: 32px; height: 34px; cursor: pointer; font-size: 1.1rem; }
.stepper input { width: 48px; border: 0; border-radius: 0; text-align: center; padding: 6px 2px; background: var(--surface); box-shadow: none !important; }
.ex-in { width: 120px; flex: none; text-align: right; padding: 8px 10px; }
.split-foot { font-size: .88rem; padding: 10px 4px 0; color: var(--muted); }
.split-foot b { color: var(--text); }
.err { color: var(--neg); font-weight: 600; font-size: .92rem; min-height: 1.2em; }
.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

.share-body p { margin-top: 0; }
.link-box { display: flex; gap: 8px; margin-bottom: 12px; }
.link-box input { font-size: .9rem; color: var(--muted); }
.qr { display: grid; place-items: center; margin: 16px auto 6px; width: 200px; height: 200px; background: #fff; border-radius: 18px; padding: 10px; border: 1px solid var(--line); }
.qr svg { width: 100%; height: 100%; }

/* toasts */
#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(460px, calc(100vw - 32px)); }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: 14px; box-shadow: var(--shadow-lg); font-weight: 500; font-size: .93rem; transform: translateY(20px) scale(.95); opacity: 0; transition: all .25s cubic-bezier(.2, .9, .3, 1.2); max-width: 100%; }
.toast.in { transform: none; opacity: 1; }
.toast.ok::before { content: '✓'; font-weight: 800; color: var(--pos); }
.toast.error { background: var(--neg); color: #fff; }
.toast-btn { margin-left: auto; border: 0; background: transparent; color: var(--accent); font-weight: 700; cursor: pointer; padding: 2px 4px; white-space: nowrap; }

/* confetti */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 90; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 9px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translate(var(--dx), 110vh) rotate(var(--r)); } }

/* responsive */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 28px; padding-top: 12px; }
  .hero-art { max-width: 360px; margin: -6px auto 14px; }
  .demo-row.d1 { left: -6px; }
  .demo-row.d2 { right: -6px; top: 0; }
  .features { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .hide-sm { display: none; }
  .features { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .tools { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .tabs { top: 58px; }
  .hbar, .pbar { grid-template-columns: 96px 1fr auto; gap: 8px; }
  .hb-v, .pb-v { min-width: 0; }
  .bal-row { grid-template-columns: minmax(0, 1fr) 1fr 96px; gap: 8px; }
  .bal-amt { min-width: 0; }
  .mem { grid-template-columns: auto 1fr auto; }
  .mem input[data-field=swish] { grid-column: 2 / 3; grid-row: 2; }
  .me-card { padding: 18px; }
  .me-side { align-items: flex-start; flex-direction: row-reverse; width: 100%; justify-content: space-between; align-items: center; }
  .sheet { left: 0; right: 0; top: auto; bottom: 0; width: 100%; max-height: 92vh; max-height: 92dvh; border-radius: 26px 26px 0 0; transform: translateY(30px); }
  #modal-root.open .sheet { transform: none; }
  .sheet-foot { padding-bottom: max(18px, env(safe-area-inset-bottom)); }
  .row2 { grid-template-columns: 1fr; gap: 0; }
  .sheet .row2 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tr { grid-template-columns: 1fr auto; grid-template-areas: "who amt" "act act"; }
  .tr-act .btn { flex: 1; }
  .tab { flex: 1 1 auto; min-width: 0; padding: 9px 6px; font-size: .84rem; gap: 4px; }
  .badge { padding: 0 5px; font-size: .68rem; }
  #toasts { bottom: 100px; }
  .quick { padding-left: 12px; }
  .quick .btn { padding: 8px 12px; }
  .topbar { gap: 10px; }
  .topbar:has(.tb-group) .brand span { display: none; }
  .tb-group { padding-left: 10px; }
  .av-stack { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
