/* ==========================================================================
   TIP CALC GROUPS — LOOK AND FEEL for groups, friends and account
   Uses the same colour names ("tokens") as the main page, so light and
   dark mode work automatically.
   ========================================================================== */

/* Room at the bottom for the tab bar */
body.has-tabs { padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }

/* ---------- Tab bar (bottom on phones, left side on wide screens) ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; justify-content: space-around; gap: 2px;
  background: var(--card); border-top: 1px solid var(--line);
  padding: 6px max(8px, env(safe-area-inset-left, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-right, 0px));
}
.tabbar button {
  flex: 1; min-width: 0; max-width: 96px; border: 0; background: none; color: var(--muted); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 0;
  font: 600 11px var(--font); border-radius: 10px;
}
.tabbar button svg { width: 24px; height: 24px; }
.tabbar button[aria-current="page"] { color: var(--accent); }
.tabbar .dot-badge { position: absolute; }
.tabbar.hide { display: none; }

/* ---------- Common pieces ---------- */
.g-head { display: flex; flex-direction: column; gap: 4px; }
.g-head h2 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.g-head p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
/* Buttons keep their height in these screens (the main page's buttons stretch to fill rows) */
#screen-g .pill, #screen-account .pill { flex: none; }
#screen-g .g-actions .pill, #screen-account .g-actions .pill { flex: 1 1 0; }
#screen-g .g-2 > .pill, #screen-account .g-2 > .pill { flex: 0 0 96px; }
.g-row .main .badge { display: inline-block; }
body.has-tabs .toast { bottom: calc(92px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 1000px) { body.has-tabs .toast { bottom: 24px; } }
/* Full-width buttons in a screen keep their height */
.pane > .pill, .pane > .pill.big { flex: none; }
.g-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.g-actions .pill { flex: 1 1 0; min-width: 96px; height: 44px; font-size: 14px; }
.g-row {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 0;
  border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--fg);
  font: inherit; text-align: left; cursor: pointer;
}
.g-row:last-child { border-bottom: 0; }
.g-row .ico { width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); display: grid; place-items: center; font-size: 19px; flex: none; }
.g-row .ico.pay { background: var(--good-soft); }
.g-row .ico.person { border-radius: 50%; color: var(--accent); font-weight: 700; font-size: 15px; }
.g-row .main { flex: 1; min-width: 0; line-height: 1.35; }
.g-row .main b { display: block; font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-row .main span { display: block; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-row .side { text-align: right; font-size: 13px; line-height: 1.35; white-space: nowrap; }
.g-row .side b { display: block; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.g-row.deleted .main b { text-decoration: line-through; color: var(--muted); }
.g-row.selected { background: var(--accent-soft); margin: 0 -14px; padding-left: 14px; padding-right: 14px; width: calc(100% + 28px); }
.owe { color: var(--bad); }
.owed { color: var(--good); }
.even { color: var(--muted); }
.month { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; margin: 6px 0 -8px; }

.balance-card { border-radius: 16px; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.balance-card .big { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.balance-card.owe { background: var(--bad-soft); border-color: transparent; }
.balance-card.owed { background: var(--good-soft); border-color: transparent; }
.balance-card small { font-size: 13px; color: var(--muted); }

.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); margin-left: 6px; vertical-align: 1px; }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.plain { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }

/* Form pieces */
.g-in, .g-sel, .g-area {
  width: 100%; min-width: 0; height: 46px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--card); color: var(--fg); font: 500 16px var(--font); padding: 0 12px;
}
.g-area { height: auto; min-height: 76px; padding: 10px 12px; resize: vertical; line-height: 1.45; }
.g-in.money { font-weight: 600; font-size: 20px; font-variant-numeric: tabular-nums; }
.g-in:focus, .g-sel:focus, .g-area:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.g-2 { display: flex; gap: 8px; }
.g-2 > * { flex: 1; min-width: 0; }
.g-2 > .narrow { flex: 0 0 110px; }
.g-2 > .tiny { flex: 0 0 64px; text-align: center; }
.amt-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px; gap: 8px; align-items: center; min-height: 44px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.amt-row:last-child { border-bottom: 0; }
.amt-row input { height: 40px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); color: var(--fg); font: 600 16px var(--font); padding: 0 8px; text-align: right; width: 100%; }
.amt-row .who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.amt-row .calc { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.explain { background: var(--accent-soft); color: var(--fg); border-radius: var(--r); padding: 10px 12px; font-size: 14px; line-height: 1.5; }
.explain b { color: var(--accent); }
.err { background: var(--bad-soft); color: var(--bad); border-radius: var(--r); padding: 10px 12px; font-size: 14px; line-height: 1.45; }
.time-card { display: flex; flex-direction: column; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; font-size: 14px; }
.time-card .r-line .v { font-size: 15px; }

/* Friends to pick from (narrows as you type) */
.pick-list { max-height: 232px; overflow-y: auto; margin-top: 8px; }
.todo-list .item { align-items: flex-start; }
.todo-list .item small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }

/* Comments */
.comment { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; line-height: 1.45; }
.comment:last-child { border-bottom: 0; }
.comment .by { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; margin-bottom: 2px; }
.comment .tools { display: flex; gap: 12px; }
.comment .gone { color: var(--muted); font-style: italic; }

/* History lines */
.hist { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; line-height: 1.45; }
.hist:last-child { border-bottom: 0; }
.hist small { display: block; color: var(--muted); font-size: 12px; }

/* Lock screen */
.lock { position: fixed; inset: 0; z-index: 100; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px; }
.lock h1 { margin: 0; font-size: 22px; }
.lock .dots { display: flex; gap: 14px; }
.lock .dots span { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--accent); }
.lock .dots span.on { background: var(--accent); }
.keypad { display: grid; grid-template-columns: repeat(3, 72px); gap: 14px; }
.keypad button { width: 72px; height: 72px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--fg); font: 600 26px var(--font); cursor: pointer; }
.keypad button.txt { font-size: 14px; border: 0; background: none; color: var(--accent); }

/* Pop-up panel built by the groups screens */
.g-sheet .sheet { max-height: 86vh; overflow-y: auto; }

/* ---------- Website layout: wide screens get a side bar and 2 panes ---------- */
@media (min-width: 1000px) {
  body.has-tabs { padding-bottom: 32px; padding-left: 236px; }
  .tabbar { top: 0; right: auto; width: 210px; flex-direction: column; justify-content: flex-start; gap: 4px;
            border-top: 0; border-right: 1px solid var(--line); padding: 20px 12px; }
  /* 0.7.5b: the name at the top of the side bar is a real element now, so it can carry the Beta tag */
  .tabbar .tab-brand { display: flex; align-items: center; font: 700 20px var(--font); color: var(--fg); padding: 4px 12px 14px; }
  .tabbar button { flex: none; max-width: none; flex-direction: row; gap: 12px; padding: 11px 12px; font-size: 15px; justify-content: flex-start; }
  .tabbar button[aria-current="page"] { background: var(--accent-soft); }
  .tabbar.hide { display: flex; }
  body.has-tabs .app { max-width: 1100px; margin: 0; }
  body.has-tabs .app > .screen { max-width: 520px; }
  body.has-tabs .app > #screen-g { max-width: none; }
  .panes { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 28px; align-items: start; }
  .panes > .pane { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
  .panes > .pane.detail { max-width: 640px; }
  .pane.list .back-only { display: none; }
}
@media (max-width: 999.98px) {
  .panes > .pane.list.hidden-phone { display: none; }
  .panes > .pane { display: flex; flex-direction: column; gap: 16px; }
  .wide-only { display: none !important; }
}
/* Friends list box (0.6.5): fold-open headers and the people inside a family */
.g-row.fold { padding: 12px 14px; background: var(--accent-soft); }
.g-row .chev { width: 14px; color: var(--accent); flex: none; }
.fold-in .g-row.fold { padding-left: 28px; background: none; }
#fr-list .g-row { padding-left: 14px; padding-right: 14px; }
#fr-list .fold-body { padding-left: 14px; }
#fr-list .g-row.selected { margin: 0; width: 100%; }
/* 0.6.6: count on the Friends tab, and the "In the app" tag */
.tabbar button { position: relative; }
.tab-badge { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; box-sizing: border-box; }
@media (min-width: 1000px) { .tab-badge { position: static; margin-left: auto; } }
.badge.good { background: var(--good-soft); color: var(--good); }

/* "Update ready" bar (shown when a new version has been saved on the phone) */
#update-bar { position: fixed; top: max(8px, env(safe-area-inset-top, 0px)); left: 8px; right: 8px; z-index: 70; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-radius: 14px; background: #2456c4; color: #fff; font-size: 14px; box-shadow: 0 4px 16px rgba(0,0,0,.25); }
#update-bar button { font: inherit; font-weight: 600; padding: 7px 14px; border-radius: 16px; border: 0; background: #fff; color: #2456c4; white-space: nowrap; }

/* ---- 0.7.0: balances by family, recurring, export, import, tags ---- */
.seg { display: flex; gap: 8px; }
.seg > .pill { flex: 1; }
.fam-unit { background: var(--card, #fff); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin-bottom: 8px; }
.fam-unit .g-row { border: 0; width: 100%; }
.fam-members { padding: 2px 14px 10px; border-top: 1px solid var(--line); }
.strip { display: flex; gap: 8px; flex-wrap: wrap; }
.strip .pill { flex: 1 1 auto; min-height: 44px; }
.rule-card { background: var(--card, #fff); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; text-align: left; }
.rule-card .top { display: flex; gap: 10px; align-items: flex-start; }
.rule-card .top .main { flex: 1; min-width: 0; }
.rule-card .sub { color: var(--muted); font-size: 13px; }
.rule-card .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips button { min-height: 44px; padding: 0 16px; border-radius: 22px; border: 1px solid var(--line); background: transparent; color: inherit; font: inherit; font-weight: 600; }
.chips button[aria-pressed="true"] { background: var(--accent, #2456c4); border-color: var(--accent, #2456c4); color: var(--on-accent, #fff); }
.chips button:disabled { opacity: .5; }
.okbox { background: rgba(23,97,58,.12); color: #17613a; border-radius: 14px; padding: 14px 16px; }
.tag-chip { min-height: 44px; padding: 0 12px; border-radius: 18px; border: 1px solid var(--line); background: transparent; color: inherit; font: inherit; font-weight: 600; font-size: 13px; }
.tag-chip[aria-pressed="true"] { background: var(--accent, #2456c4); border-color: var(--accent, #2456c4); color: var(--on-accent, #fff); }
.tag-chip.dashed { border-style: dashed; color: var(--muted); }

/* ---------- Beta tag ----------
   0.8.0: no tag after screen titles any more. "BETA" sits across the bottom of your account icon (top right),
   and "Beta" shows next to the version in Account & Settings. Both disappear when BETA=0 is set in Portainer ("no-beta"). */
.tabbar .tab-brand { display: none; }
@media (min-width: 1000px) { .tabbar .tab-brand { display: flex; } }
:root.no-beta .tk-beta, :root.no-beta .beta-badge { display: none !important; }

/* ---------- 0.7.5b: show / hide button inside password boxes (app/pwtoggle.js) ---------- */
.pw-wrap { position: relative; display: block; width: 100%; }
.pw-wrap > input { width: 100%; padding-right: 48px; box-sizing: border-box; }
/* 0.8.1b: Microsoft Edge adds its own "reveal password" eye; hide it so only our one eye shows. */
.pw-wrap input::-ms-reveal, .pw-wrap input::-ms-clear { display: none; }
.pw-eye { position: absolute; top: 50%; right: 2px; transform: translateY(-50%); width: 44px; height: 44px; display: flex;
  align-items: center; justify-content: center; border: 0; background: none; color: var(--muted, #888); cursor: pointer; border-radius: 10px; padding: 0; }
.pw-eye:hover, .pw-eye[aria-pressed="true"] { color: var(--accent); }
.pw-eye:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; }

/* ==========================================================================
   0.8.0 — THE NEW LAYOUT (app/v080.js)
   ========================================================================== */
/* Top bar of each tab's first screen: title, then Search and your account icon */
.bar.top { flex-wrap: nowrap; }
.bar.top .left { min-width: 0; flex: 1; }
.bar.top h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-icons { display: flex; align-items: center; gap: 6px; flex: none; margin-left: auto; }
.tk-ic { color: var(--fg); }
.tk-me { position: relative; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--accent-soft); color: var(--accent);
  font: 700 14px var(--font); cursor: pointer; display: grid; place-items: center; flex: none; margin-bottom: 6px; }
.tk-beta { position: absolute; left: 50%; bottom: -7px; transform: translateX(-50%); font-style: normal; font: 800 8.5px/1 var(--font); letter-spacing: .06em;
  padding: 3px 5px; border-radius: 999px; background: #f2b632; color: #3d2a00; box-shadow: 0 0 0 2px var(--bg); pointer-events: none; }
/* Sticky top bars, and the big title shrinks once you scroll */
body.has-tabs .app > .screen > .bar, body.has-tabs #screen-g .pane > .bar:first-child {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; background: var(--bg); padding-block: 6px; transition: padding .15s; }
body.has-tabs::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); background: var(--bg); z-index: 31; }
body.has-tabs .bar h1 { transition: font-size .15s; }
body.tk-scrolled.has-tabs .app > .screen > .bar h1, body.tk-scrolled.has-tabs #screen-g .pane > .bar:first-child h1 { font-size: 18px; }
body.tk-scrolled.has-tabs .app > .screen > .bar, body.tk-scrolled.has-tabs #screen-g .pane > .bar:first-child { box-shadow: 0 1px 0 var(--line); }
/* Circles: Groups | Friends & Families */
.circ-seg { display: flex; background: var(--line); border-radius: 12px; padding: 3px; gap: 0; }
.circ-seg button { flex: 1; min-height: 40px; border: 0; background: none; color: var(--fg); font: 600 14px var(--font); border-radius: 9px; cursor: pointer; padding: 0 6px; }
.circ-seg button[aria-pressed="true"] { background: var(--card); box-shadow: 0 1px 3px rgba(0,0,0,.14); }
/* Tab bar: hides while you scroll down (phones), "Show tabs" brings it back */
.tabbar { transition: transform .25s ease; }
@media (max-width: 999.98px) { body.tk-bar-hidden .tabbar { transform: translateY(115%); } }
.tk-peek { position: fixed; left: 50%; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 41; border: 0;
  border-radius: 999px; padding: 6px 14px; background: var(--card); color: var(--muted); font: 600 12px var(--font); box-shadow: 0 0 0 1px var(--line), 0 4px 12px rgba(0,0,0,.12); cursor: pointer; }
/* The floating + button */
.tk-fab { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(86px + env(safe-area-inset-bottom, 0px)); z-index: 45; width: 58px; height: 58px;
  border-radius: 50%; border: 0; background: var(--accent); color: var(--on-accent, #fff); display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,.28); transition: bottom .25s ease; }
.tk-fab svg { width: 28px; height: 28px; }
body.tk-bar-hidden .tk-fab { bottom: calc(44px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 1000px) { .tk-fab { bottom: 28px; right: 28px; } }
body.has-tabs { padding-bottom: calc(150px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 1000px) { body.has-tabs { padding-bottom: 100px; } }
/* The + panel ("Start something") */
.tk-sheet-title { font-weight: 700; font-size: 17px; margin: 0 0 4px; }
.tk-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tk-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-height: 84px; padding: 14px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--bg); color: var(--fg); font: 600 15px var(--font); text-align: left; cursor: pointer; }
.tk-tile svg { width: 26px; height: 26px; color: var(--accent); }
.tk-tile.main { grid-column: 1 / -1; flex-direction: row; align-items: center; min-height: 56px; background: var(--accent); border-color: var(--accent); color: var(--on-accent, #fff); }
.tk-tile.main svg { color: inherit; }
/* Undo bar (instead of "Are you sure?") */
.tk-undo { position: fixed; left: max(12px, env(safe-area-inset-left, 0px)); right: 90px; bottom: calc(92px + env(safe-area-inset-bottom, 0px)); z-index: 65;
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; border-radius: 14px; background: var(--fg); color: var(--bg); font-size: 14px; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.tk-undo .msg { flex: 1; min-width: 0; }
.tk-undo button { border: 0; background: none; color: inherit; font: 700 15px var(--font); padding: 8px 10px; text-decoration: underline; cursor: pointer; }
body.tk-bar-hidden .tk-undo { bottom: calc(48px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 1000px) { .tk-undo { left: 250px; right: auto; width: 440px; bottom: 28px; } }
/* Offline bar */
.tk-offline { position: fixed; top: env(safe-area-inset-top, 0px); left: 0; right: 0; z-index: 66; background: var(--warn-soft); color: var(--warn);
  font: 700 13px var(--font); text-align: center; padding: 6px 12px; }
body.tk-offline-on { padding-top: 40px; }
body.tk-offline-on .app > .screen > .bar, body.tk-offline-on #screen-g .pane > .bar:first-child { top: calc(30px + env(safe-area-inset-top, 0px)); }
/* Search (everything) */
.tk-search { position: fixed; inset: 0; z-index: 80; background: var(--bg); overflow-y: auto;
  padding: calc(10px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 40px max(16px, env(safe-area-inset-left, 0px)); }
.tk-search-top { display: flex; gap: 8px; align-items: center; max-width: 640px; margin: 0 auto 12px; position: sticky; top: 0; background: var(--bg); padding: 4px 0; }
.tk-search-top .search { flex: 1; margin: 0; }
.tk-search-res { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px; }
body.tk-searching { overflow: hidden; }
.tk-pull { position: fixed; top: calc(10px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); z-index: 50; opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 6px; background: var(--card); color: var(--fg); border-radius: 999px; padding: 8px 14px; font: 600 13px var(--font); box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.tk-pull svg { width: 16px; height: 16px; }
.tk-pullhint { margin: -10px 0 -8px; text-align: center; color: var(--muted); font-size: 12px; }
@media (min-width: 1000px) { .tk-pullhint { display: none; } }
/* Home */
.tk-hero { background: var(--accent); color: var(--on-accent, #fff); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.tk-hero small { opacity: .88; font-size: 13px; line-height: 1.5; }
.tk-hero .big { font-size: 26px; font-weight: 700; line-height: 1.2; }
.tk-attns { display: flex; flex-direction: column; gap: 8px; }
.tk-attn { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--warn-soft); cursor: pointer; }
.tk-attn .ico { width: 38px; height: 38px; border-radius: 50%; background: var(--card); display: grid; place-items: center; flex: none; font-weight: 700; color: var(--accent); }
.tk-attn .main { flex: 1; min-width: 0; line-height: 1.35; }
.tk-attn .main b { display: block; font-size: 15px; }
.tk-attn .main span { display: block; font-size: 13px; color: var(--fg); opacity: .75; }
.pill.tk-mini, #screen-g .pill.tk-mini { flex: none; width: auto; height: 36px; min-height: 36px; padding: 0 14px; font-size: 13px; }
.tk-row { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); }
.tk-row:last-child { border-bottom: 0; }
.tk-row .g-row { border-bottom: 0; flex: 1; min-width: 0; }
.tk-sec { display: flex; justify-content: space-between; align-items: baseline; }
.tk-sec .link-btn { font-size: 14px; text-transform: none; letter-spacing: 0; }
.tk-up { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.tk-up button { flex: none; width: 150px; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; color: var(--fg); font: inherit; cursor: pointer; }
.tk-up .d { display: block; color: var(--accent); font-size: 12px; font-weight: 700; }
.tk-up b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-up small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-chips { flex-wrap: nowrap; overflow-x: auto; }
.tk-chips button { flex: none; }
/* Swipe rows: the actions sit behind the row */
.group > .sw-wrap { margin: 0 -14px; }
.sw-wrap { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.sw-wrap:last-child { border-bottom: 0; }
.sw-wrap > .g-row { position: relative; z-index: 1; border-bottom: 0; background: var(--card); padding-left: 14px; padding-right: 14px; transition: transform .2s ease; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.sw-wrap.openR > .g-row { transform: translateX(calc(-80px * var(--nr, 0))); }
.sw-wrap.openL > .g-row { transform: translateX(calc(80px * var(--nl, 0))); }
.sw-acts { position: absolute; top: 0; bottom: 0; display: flex; }
.sw-acts.l { left: 0; } .sw-acts.r { right: 0; }
.sw-b { width: 80px; border: 0; background: #2456c4; color: #fff; font: 700 13px var(--font); cursor: pointer; padding: 0 4px; }
.sw-b.g { background: #1d7448; } .sw-b.w { background: #8f5a00; } .sw-b.del { background: #b0281f; }
/* Group picture */
.emo-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.emo-pick button { width: 46px; height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-size: 22px; cursor: pointer; }
.emo-pick button[aria-pressed="true"] { border: 2px solid var(--accent); background: var(--accent-soft); }
/* Welcome tour */
.tk-tour { position: fixed; inset: 0; z-index: 90; background: rgba(10,16,24,.55); display: flex; align-items: center; justify-content: center; padding: 20px; }
.tk-tcard { position: relative; width: 100%; max-width: 380px; background: var(--card); color: var(--fg); border-radius: 20px; padding: 26px 20px 16px; text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.tk-tcard .tk-tx { position: absolute; top: 8px; right: 8px; font-size: 18px; }
.tk-tcard .ti { width: 64px; height: 64px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin: 0 auto 12px; }
.tk-tcard .ti svg { width: 30px; height: 30px; }
.tk-tcard h2 { margin: 0 0 8px; font-size: 20px; }
.tk-tcard p { margin: 0 0 14px; color: var(--muted); line-height: 1.5; }
.tk-tcard .dots { display: flex; justify-content: center; gap: 6px; margin-bottom: 14px; }
.tk-tcard .dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.tk-tcard .dots i.on { width: 20px; border-radius: 999px; background: var(--accent); }
.tk-back { margin-left: -10px; color: var(--fg); }
/* ---------- Account & Settings (0.8.0): your card at the top, then sections that fold open ---------- */
.acc-card { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r, 14px); padding: 12px 14px; }
.acc-av { width: 46px; height: 46px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; flex: none; }
.acc-who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.acc-who b { font-size: 17px; }
.acc-who small { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.folds { display: flex; flex-direction: column; gap: 10px; }
details.fold { background: var(--card); border: 1px solid var(--line); border-radius: var(--r, 14px); }
details.fold > summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 48px; cursor: pointer; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold .fi { width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
details.fold .fi svg { width: 20px; height: 20px; }
details.fold .ft { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
details.fold .ft b { font-size: 16px; }
details.fold .ft small { color: var(--muted); font-size: 13px; }
details.fold .chev { width: 18px; height: 18px; color: var(--muted); transition: transform .2s; flex: none; }
details.fold .chev svg { width: 18px; height: 18px; }
details.fold[open] .chev { transform: rotate(90deg); }
details.fold .fold-body { border-top: 1px solid var(--line); padding: 14px; display: flex; flex-direction: column; gap: 16px; }
details.fold .fold-body > .fold-slot:empty { display: none; }
.fold-slot { display: flex; flex-direction: column; gap: 16px; }
.tk-sizes button { font-weight: 700; }
/* rows that can be swiped reach the box's edges, so the box clips them to its rounded corners */
.group:has(> .sw-wrap) { overflow: hidden; }
