/* Liste — stil „Nativ”: aspect de aplicație iOS, temă luminoasă/întunecată după setarea telefonului */

/* Paleta „Calde”: crem, salvie, piersică — pastel, cu text închis în aceeași nuanță */
:root {
  --bg: #f6f2ec;          /* fundalul paginii */
  --card: #fffdfa;        /* carduri, liste */
  --fill: #ece6dd;        /* câmpuri, selector, pastile */
  --text: #15120f;
  --muted: #6b6359;
  --line: #e6dfd4;
  --accent: #4d7560;      /* salvie */
  --accent-text: #ffffff;
  --danger: #c46a5c;      /* teracotă */
  --warn: #a8762f;
  --ok: #7fae8c;          /* swipe „cumpărat” */
  --neutral: #a49b90;     /* swipe încă neconfirmat, butonul Editează */
  --toast-accent: #a9d1b5;
  --shadow: 0 8px 28px rgb(40 30 20 / .08);
  --radius: 16px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0c0a; --card: #1b1916; --fill: #2a2622; --text: #fbf8f3; --muted: #b5ab9f;
    --line: #35302a; --accent: #9cc3aa; --accent-text: #14231a; --danger: #e09486; --warn: #e0b06a;
    --ok: #6f9f7c; --neutral: #6e665d; --toast-accent: #3f6b52; --shadow: 0 8px 28px rgb(0 0 0 / .5);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; touch-action: manipulation; }  /* fără zoom la dublu-tap: tap-urile rapide nu se mai pierd */
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Inter, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
main, .top { max-width: 640px; margin: 0 auto; padding: 0 16px; }
main { padding-bottom: 120px; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ic { flex: none; }

/* --- antet ---------------------------------------------------------------------- */
/* Antetul (titlu + taburi) rămâne fix sus, opac, în culoarea paginii. Pe iOS 26, un element fix/sticky lipit de
   marginea de sus face ca zona barei de stare să ia culoarea lui, în locul efectului de estompare peste conținut. */
.top {
  position: sticky; top: 0; z-index: 15; background: var(--bg);
  padding-top: max(12px, calc(env(safe-area-inset-top) + 6px)); padding-bottom: 10px;
}
.top .segmented { margin-bottom: 0; }
.top.scrolled { box-shadow: 0 .5px 0 var(--line); }  /* linia fină apare doar când lista trece pe sub antet */
html { scroll-padding-top: 130px; }
.top-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none;
         font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.logo { color: var(--text); flex: none; }
.top-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.round, .pill {
  height: 36px; min-width: 36px; border: 0; border-radius: 18px; background: var(--fill); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; padding: 0 12px; font-size: 14px; font-weight: 500;
}
.round { padding: 0; }
.round.on { background: var(--accent); color: var(--accent-text); }
.round:disabled { cursor: default; }
.avatar { font-weight: 700; text-transform: uppercase; }
details.menu.user > summary.avatar { width: 36px; height: 36px; margin: 0; border-radius: 18px; background: var(--fill);
  color: var(--text); display: grid; place-content: center; font-size: 15px; }
.menu-note { margin: 4px 10px 6px; font-size: 13px; color: var(--muted); }

.segmented { display: flex; padding: 2px; border-radius: 10px; background: var(--fill); margin-bottom: 12px; }
.segmented a {
  flex: 1; text-align: center; padding: 6px 4px; border-radius: 8px; font-size: 14px; font-weight: 500;
  color: var(--text); text-decoration: none; opacity: .8;
}
.segmented a:focus { outline: none; }
.segmented a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.segmented a.active { background: var(--card); opacity: 1; font-weight: 600; box-shadow: 0 1px 4px rgb(40 30 20 / .08); }

/* --- căutare, filtre ------------------------------------------------------------ */
.search {
  display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px;
  border-radius: 10px; background: var(--fill); color: var(--muted);
}
.search input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.search-clear {
  flex: none; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; font-size: 11px; line-height: 20px;
  background: color-mix(in srgb, var(--muted) 45%, transparent); color: var(--card); cursor: pointer;
}
.search-clear[hidden] { display: none; }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 16px; color: var(--text); }

.filters { margin-top: 12px; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.chips::-webkit-scrollbar { display: none; }
/* pe calculator (mouse), toate tagurile la vedere, pe mai multe rânduri */
@media (hover: hover) and (pointer: fine) {
  .chips { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
}
.chip {
  flex: none; display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border-radius: 15px;
  background: var(--card); font-size: 13px; font-weight: 500; cursor: pointer; user-select: none;
}
.chip input { display: none; }
.chip .n { margin-left: 5px; opacity: .55; font-variant-numeric: tabular-nums; }
.chip:has(input:checked) { background: var(--text); color: var(--bg); }

.section-head {
  display: flex; justify-content: space-between; align-items: center; margin: 16px 4px 6px;
  font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
}
details.menu.sort-menu > summary {
  width: auto; height: 30px; margin: 0; padding: 0 8px; gap: 5px; display: inline-flex; align-items: center;
  color: var(--accent); font-size: 14px; font-weight: 500; text-transform: none; letter-spacing: 0;
}
details.menu.sort-menu > summary .ic { width: 15px; height: 15px; }
.sort-menu .menu-list { min-width: 230px; text-transform: none; letter-spacing: 0; font-weight: 400; }
.sort-menu .menu-list .ic { visibility: hidden; color: var(--accent); }
.sort-menu .menu-list button.selected { font-weight: 600; }
.sort-menu .menu-list button.selected .ic { visibility: visible; }

/* --- adăugare / editare ----------------------------------------------------------- */
button.add { display: block; width: 100%; margin-top: 12px; border: 0; text-align: left; background: var(--card); border-radius: var(--radius);
  font-size: inherit; }
button.add::before { content: "+"; display: inline-block; width: 18px; font-size: 20px; line-height: 1; }
details.add { margin-top: 12px; background: var(--card); border-radius: var(--radius); }
button.add, details.add > summary {
  list-style: none; padding: 12px 14px; color: var(--accent); font-weight: 600; cursor: pointer;
}
details.add > summary::before { content: "+"; display: inline-block; width: 18px; font-size: 20px; line-height: 1; }
details.add > summary::-webkit-details-marker { display: none; }
details.add[open] > summary { border-bottom: 1px solid var(--line); }
details.add .item-form { padding: 12px 14px 14px; }

.item-form { display: grid; gap: 10px; }
.item-form input:not([type=checkbox]), .item-form select, .item-form textarea,
.login input {
  width: 100%; padding: 10px 12px; border: 0; border-radius: 10px; background: var(--fill); font-size: 16px; outline: none;
}
.item-form textarea { resize: vertical; }
.form-row { display: flex; flex-wrap: wrap; gap: 10px 16px; }
.form-row label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.form-row input, .form-row select { width: auto !important; }
.form-actions { display: flex; gap: 8px; }
.form-actions button, .login button {
  height: 44px; padding: 0 18px; border: 0; border-radius: 12px; background: var(--accent); color: var(--accent-text);
  font-weight: 600;
}
.form-actions button.secondary { background: var(--fill); color: var(--text); }
.history { margin: 0; color: var(--muted); font-size: 13px; }

/* --- lista ------------------------------------------------------------------------ */
.rows { list-style: none; margin: 0; padding: 0; background: var(--card); border-radius: var(--radius); box-shadow: 0 1px 2px rgb(40 30 20 / .04); }
.row { position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 12px 6px 12px 14px; }
.row + .row { border-top: 1px solid var(--line); }
.row.editing { display: block; padding: 14px; }
.row.done .title, .row.done .price { text-decoration: line-through; color: var(--muted); }
.row.done .row-meta { opacity: .6; }

.check {
  appearance: none; -webkit-appearance: none; flex: none; width: 24px; height: 24px; margin: 0; border-radius: 12px;
  border: 2px solid #c7c7cc; background: var(--card); cursor: pointer; display: grid; place-content: center;
  transition: background .12s, border-color .12s;
}
.check::after {
  content: ""; width: 10px; height: 6px; margin-top: -2px; border: solid var(--accent-text);
  border-width: 0 0 2.5px 2.5px; transform: rotate(-45deg) scale(0); transition: transform .12s;
}
.check:checked { background: var(--accent); border-color: var(--accent); }
.check:checked::after { transform: rotate(-45deg) scale(1); }
.check:disabled { opacity: .35; }
.check:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.row-main { flex: 1; min-width: 0; }
.row-main > * + * { margin-top: 5px; }
.row-main > .row-price + * { margin-top: 0; }
/* rândurile de sub preț curg în jurul lui și se lățesc imediat ce trec de el */
.row-main > .row-meta { display: block; line-height: 24px; }
.row-main > .row-meta > * { display: inline-flex; vertical-align: middle; margin-right: 8px; }
.row-main > .row-meta > :last-child { margin-right: 0; }
.row-main > .row-meta + .row-meta { margin-top: 2px; }
.row-top { display: flex; align-items: baseline; gap: 10px; }
.title {
  min-width: 0; font-weight: 500; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
.row.done .title { -webkit-line-clamp: 1; line-clamp: 1; }
.row.grocery .title { display: block; }
.row-price { float: right; margin: 1px 0 4px 10px !important; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.row.done .row-main { display: flex; align-items: baseline; gap: 8px; }
.row.done .row-main > * { margin: 0 !important; }
.row.done .row-price { order: 3; float: none; }
.row.done .row-main .title { flex: 1; }
.row.done .by { flex: none; font-size: 12px; color: var(--muted); }
.row-main > .note { margin: 0; font-size: 13px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.title a { color: inherit; text-decoration: none; }
.title a .ic { width: 14px; height: 14px; margin-left: 3px; vertical-align: -1px; color: var(--accent); }
/* magazinul apare doar la intrările cu link: albastru, cu ↗, deschide pagina produsului */
.shop-link { display: inline-flex; align-items: center; gap: 1px; color: var(--accent); text-decoration: none; font-weight: 500; }
.shop-link .ic { width: 12px; height: 12px; }
.track { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.track input { width: 14px; height: 14px; margin: 0; accent-color: var(--accent); }
.track.on { color: var(--accent); }
.track:has(input:disabled) { opacity: .5; cursor: default; }
.price {
  flex: none; border: 0; background: none; padding: 0; font-weight: 600; font-variant-numeric: tabular-nums;
  white-space: nowrap; color: var(--text);
}
.price-input {
  flex: none; width: 96px; padding: 2px 8px; border: 0; border-radius: 8px; background: var(--fill);
  font-size: 16px; font-weight: 600; text-align: right; outline: 2px solid var(--accent);
}
.row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 13px; color: var(--muted); }
.note { margin: 2px 0 0; font-size: 14px; color: var(--muted); white-space: pre-line; overflow-wrap: anywhere; }

.prio {
  border: 0; padding: 1px 6px; border-radius: 5px; font-size: 11px; font-weight: 700; line-height: 1.5;
  background: var(--fill); color: var(--text);
}
.prio.p1 { background: color-mix(in srgb, var(--danger) 18%, var(--card)); color: color-mix(in srgb, var(--danger) 85%, var(--text)); }
.prio.p3 { background: none; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.due { display: inline-flex; align-items: center; gap: 3px; }
.due .ic { width: 13px; height: 13px; }
.due.soon { color: var(--warn); font-weight: 600; }
.due.overdue { color: var(--danger); font-weight: 600; }
.warn { color: var(--danger); font-weight: 500; }
.changed, .by, .fx { font-size: 12px; }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); }

/* --- meniul ⋯ ----------------------------------------------------------------- */
details.menu { position: relative; flex: none; }
details.menu > summary {
  list-style: none; width: 36px; height: 30px; margin-top: -4px; border-radius: 8px;
  display: grid; place-content: center; color: var(--muted); cursor: pointer;
}
details.menu > summary::-webkit-details-marker { display: none; }
details.menu[open] > summary { background: var(--fill); }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 220px; padding: 6px;
  border-radius: 12px; background: var(--card); box-shadow: var(--shadow), 0 0 0 1px var(--line);
}
.menu-list button {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px; border: 0; border-radius: 8px;
  background: none; text-align: left; font-size: 15px; color: var(--text);
}
.menu-list button:hover { background: var(--fill); }
.menu-list button.danger { color: var(--danger); }
.menu-list form { margin: 0; }
.menu-list a.menu-link { display: block; padding: 10px; border-radius: 8px; color: var(--text); text-decoration: none; font-size: 15px; }
.menu-list a.menu-link:hover { background: var(--fill); }

/* --- totaluri --------------------------------------------------------------------- */
.totals {
  position: fixed; z-index: 10; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom));
  max-width: 616px; margin: 0 auto; padding: 10px 16px; border-radius: 16px;
  background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow); display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.tot-main, .tot-side { display: flex; flex-direction: column; gap: 1px; }
.tot-side { align-items: flex-end; text-align: right; }
.tot-label { font-size: 12px; color: var(--muted); }
.tot-value { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tot-sub { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bulk { font-size: 12px; color: var(--muted); }
button.link { border: 0; background: none; padding: 2px 0; color: var(--accent); font-size: inherit; }

/* --- taguri: culori --------------------------------------------------------------- */
.tag, .chip, .swatch { --c: #aaa49b; }
.tc-gray { --c: #aaa49b; }   .tc-red { --c: #dc8f86; }    .tc-orange { --c: #e3a476; }
.tc-yellow { --c: #d8b45f; } .tc-green { --c: #8fb69a; }  .tc-teal { --c: #80b8b1; }
.tc-blue { --c: #8ca9d2; }   .tc-purple { --c: #ac9cd2; } .tc-pink { --c: #d99db6; }
.tc-brown { --c: #b8957a; }
.tag {
  padding: 0 7px; border-radius: 6px; font-weight: 500; line-height: 1.6;
  background: color-mix(in srgb, var(--c) 24%, var(--card)); color: color-mix(in srgb, var(--c) 45%, var(--text));
}
.chip[class*=tc-]:has(input:checked) { background: color-mix(in srgb, var(--c) 45%, var(--card)); color: color-mix(in srgb, var(--c) 40%, var(--text)); }

/* --- sugestii taguri -------------------------------------------------------------- */
.suggest-wrap { position: relative; display: block; }
.suggest {
  position: absolute; z-index: 30; top: 100%; left: 0; right: 0; max-height: 240px; overflow-y: auto;
  margin: 4px 0 0; padding: 4px; list-style: none; background: var(--card); border-radius: 10px;
  box-shadow: var(--shadow), 0 0 0 1px var(--line);
}
.suggest li { padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 15px; }
.suggest li.active { background: var(--fill); }
.suggest .new { color: var(--muted); }

/* --- pagina de taguri --------------------------------------------------------------- */
.tag-new { display: flex; gap: 8px; }
.tag-new input { flex: 1; min-width: 0; padding: 10px 12px; border: 0; border-radius: 10px; background: var(--fill); font-size: 16px; outline: none; }
.tag-new button { padding: 0 16px; border: 0; border-radius: 10px; background: var(--accent); color: var(--accent-text); font-weight: 600; }
.tag-list { list-style: none; margin: 0; padding: 0; background: var(--card); border-radius: var(--radius); }
.tag-list > li + li { border-top: 1px solid var(--line); }
.tag-row > summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; }
.tag-row > summary::-webkit-details-marker { display: none; }
.tag-row .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.tag-name { flex: 1; font-weight: 500; }
.tag-row .count { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.tag-row .chev { color: var(--muted); transition: transform .15s; }
.tag-row[open] .chev { transform: rotate(90deg); }
.tag-edit { display: grid; gap: 12px; padding: 0 14px 14px 36px; }
.tag-field-label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.tag-field-label input { padding: 8px 10px; border: 0; border-radius: 8px; background: var(--fill); font-size: 16px; color: var(--text); outline: none; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 20px; height: 20px; border-radius: 50%; background: var(--c); cursor: pointer; outline-offset: 2px; }
.swatch input { display: none; }
.swatch:has(input:checked) { outline: 2px solid var(--c); }
.hint { margin: 0; color: var(--muted); font-size: 12px; }
.danger-link { justify-self: start; border: 0; background: none; padding: 0; color: var(--danger); font-size: 14px; }

/* --- login ------------------------------------------------------------------------ */
.login { max-width: 360px; padding-top: 18vh; }
.login .brand { display: flex; justify-content: center; margin: 0 0 20px; font-size: 30px; }
.login .logo { width: 34px; height: 34px; }
.login .item-form { background: var(--card); padding: 16px; border-radius: var(--radius); }
.login-error { margin: 0; color: var(--danger); font-size: 14px; }

/* --- performanță: comutarea taburilor și listele lungi --------------------------------- */
/* panourile ascunse își păstrează aranjarea calculată, deci reapar fără să fie recalculate */
@supports (content-visibility: hidden) {
  .panel[hidden] { display: block; content-visibility: hidden; }
}
/* rândul cu meniul ⋯ deschis sau în editare stă deasupra barei de total */
.rows > .row:has(details[open]), .rows > .row.editing { z-index: 11; }

/* --- produs deschis din notificare ------------------------------------------- */
.row.flash { animation: flash 2.5s ease-out; }
@keyframes flash { 0%, 40% { background: color-mix(in srgb, var(--accent) 14%, var(--card)); } 100% { background: var(--card); } }
.toast {
  position: fixed; z-index: 20; left: 50%; transform: translateX(-50%);
  bottom: calc(max(12px, env(safe-area-inset-bottom)) + 120px);
  display: flex; align-items: center; gap: 4px; padding: 4px 4px 4px 16px; border-radius: 22px;
  background: var(--text); color: var(--bg); box-shadow: 0 6px 24px rgb(0 0 0 / .25); max-width: calc(100% - 32px);
}
.toast a { color: inherit; font-weight: 600; text-decoration: none; padding: 8px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toast button { border: 0; background: transparent; color: inherit; font-size: 22px; line-height: 1; width: 36px; height: 36px; opacity: .7; }

/* --- rezolvate: secțiune pliată la finalul listei ------------------------------ */
.done-section { margin-top: 16px; }
.done-section > summary {
  list-style: none; display: flex; align-items: center; gap: 8px; padding: 12px 14px; cursor: pointer;
  border-radius: var(--radius); background: var(--card); color: var(--muted); font-weight: 600; font-size: 15px;
}
.done-section > summary::-webkit-details-marker { display: none; }
.done-section > summary .spent { margin-left: auto; font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; }
.done-section > summary > .ic:last-child { transition: transform .2s; }
.done-section > summary > span:nth-of-type(1) { flex: none; }
.done-section > summary > .ic:last-child { margin-left: 4px; }
.done-section:not(:has(.spent:not([hidden]))) > summary > .ic:last-child { margin-left: auto; }
.done-section[open] > summary { border-radius: var(--radius) var(--radius) 0 0; border-bottom: 1px solid var(--line); }
.done-section[open] > summary > .ic:last-child { transform: rotate(180deg); }
.done-section[open] .rows { border-radius: 0 0 var(--radius) var(--radius); }
.done-note { margin: 10px 14px 0; font-size: 12px; color: var(--muted); }
.toast .undo { font-weight: 700; color: var(--toast-accent); font-size: 15px; width: auto; padding: 0 12px; opacity: 1; }
.toast .msg { padding: 8px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --- swipe pe rânduri: dreapta = cumpărat/făcut, stânga = acțiuni --------------- */
.rows > .row { touch-action: pan-y; }
.row.swiping { user-select: none; -webkit-user-select: none; }
.row.swiping, .row.swipe-open { overflow: clip; }
.rows > .row:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.rows > .row:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.rows > .row:only-child { border-radius: var(--radius); }
.row.swiping > :not(.swipe-under), .row.swipe-open > :not(.swipe-under) {
  transform: translateX(var(--dx, 0px)); transition: var(--swipe-transition, none);
}
.swipe-under {
  position: absolute; inset: 0; z-index: 3; display: flex; align-items: stretch; overflow: hidden;
  clip-path: var(--clip); transition: var(--swipe-transition, none); color: #fff; font-weight: 600; font-size: 15px;
}
.swipe-under.right { background: var(--neutral); justify-content: flex-start; }
.swipe-under.right.armed { background: var(--ok); }
.swipe-under.right.undo.armed { background: var(--accent); }
.swipe-under .swipe-label { display: flex; align-items: center; gap: 8px; padding: 0 20px; white-space: nowrap; }
.swipe-under.left { justify-content: flex-end; background: var(--fill); }
.swipe-under.left button {
  border: 0; color: #fff; font: inherit; font-size: 13px; font-weight: 600; width: 76px; flex: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.swipe-under.left .b-check { background: var(--accent); }
.swipe-under.left .b-edit { background: var(--neutral); }
.swipe-under.left .b-delete { background: var(--danger); }
.swipe-under.left.armed button { display: none; }
.swipe-under.left.armed .first { display: flex; flex: 1; align-items: flex-end; padding-right: 24px; }

/* --- cumpărături zilnice ----------------------------------------------------------- */
.grocery-add { display: flex; gap: 8px; margin-bottom: 14px; }
.grocery-add input {
  flex: 1; min-width: 0; padding: 12px 14px; border: 0; border-radius: var(--radius); background: var(--card);
  font-size: 17px; outline: none; box-shadow: 0 1px 2px rgb(0 0 0 / .04);
}
.grocery-add button {
  width: 48px; border: 0; border-radius: var(--radius); background: var(--accent); color: var(--accent-text);
  font-size: 26px; line-height: 1; font-weight: 400;
}
.row.grocery { align-items: center; padding-top: 14px; padding-bottom: 14px; }
.row.grocery .title { flex: 1; font-size: 17px; }
.row.grocery .by { font-size: 12px; color: var(--muted); padding-right: 8px; }
.gcheck {
  flex: none; width: 24px; height: 24px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--muted) 55%, transparent);
  background: none; padding: 0;
}
.gcheck:active { background: color-mix(in srgb, var(--accent) 25%, transparent); }
.recent { margin-top: 20px; }
.recent-head { display: flex; justify-content: space-between; align-items: baseline; }
.recent-edit { border: 0; background: none; color: var(--accent); font-size: 14px; padding: 0 4px 8px; cursor: pointer; }
.recent-edit .on, .recent-editing .recent-edit .off { display: none; }
.recent-editing .recent-edit .on { display: inline; font-weight: 600; }
.recent-chips .chip .x { display: none; margin-left: 6px; font-size: 16px; line-height: 1; opacity: .6; }
.recent-editing .recent-chips .chip .x { display: inline; }
.recent h3 { margin: 0 4px 8px; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.recent-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.recent-chips .chip { border: 0; color: var(--text); }

.row.grocery .grip {
  flex: none; display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; margin: -6px -4px -6px 0;
  color: color-mix(in srgb, var(--muted) 70%, transparent); touch-action: none; cursor: grab;
}
.drag-ghost { opacity: .35; }
.drag-fallback { background: var(--card); box-shadow: 0 10px 30px rgb(40 30 20 / .18); border-radius: 12px; opacity: 1 !important; }

/* --- preț: tendință, ieftinite, istoric; punct „nou” ------------------------------- */
.trend { font-size: 12px; font-weight: 700; padding: 0 6px; border-radius: 6px; line-height: 1.6; }
.trend.down { color: color-mix(in srgb, var(--ok) 55%, var(--text)); background: color-mix(in srgb, var(--ok) 22%, var(--card)); }
.trend.up { color: color-mix(in srgb, var(--danger) 80%, var(--text)); background: color-mix(in srgb, var(--danger) 14%, var(--card)); }
.chip.cheap:has(input:checked) { background: color-mix(in srgb, var(--ok) 40%, var(--card)); }
.new-dot { display: inline-block; width: 8px; height: 8px; margin: 0 6px 1px 0; border-radius: 50%; background: var(--accent); vertical-align: middle; }
.price-chart { margin: 0; color: var(--accent); }
.price-chart figcaption { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.price-chart svg { display: block; width: 100%; height: 64px; background: color-mix(in srgb, var(--accent) 6%, var(--card)); border-radius: 10px; }
.chart-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; font-size: 11px; color: var(--muted); }

/* --- stare verificări (meniul de cont) ---------------------------------------------- */
summary.avatar.has-dot { position: relative; }
summary.avatar.has-dot::after { content: ""; position: absolute; top: 0; right: 0; width: 10px; height: 10px;
  border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px var(--bg); }
.status-link { display: flex !important; justify-content: space-between; align-items: center; gap: 8px; }
.count { min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--fill); color: var(--muted);
  font-size: 12px; font-weight: 600; line-height: 20px; text-align: center; }
.count.new { background: var(--danger); color: #fff; }
.brand.back span { font-size: 18px; }
.status .muted { color: var(--muted); }
.health { list-style: none; margin: 0 0 18px; padding: 6px 14px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.health li { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 15px; }
.health li + li { border-top: .5px solid var(--line); }
.health .muted { margin-left: auto; font-size: 13px; text-align: right; }
.health .light { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); flex: none; }
.health .bad .light { background: var(--danger); }
.status .empty { text-align: center; color: var(--muted); padding: 24px 0; }
.p-group h2 { display: flex; align-items: center; gap: 8px; margin: 22px 4px 2px; font-size: 13px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.status .hint { margin: 0 4px 8px; font-size: 13px; }
details.problem { background: var(--card); border-radius: 12px; margin-bottom: 8px; padding: 10px 14px; box-shadow: var(--shadow); }
details.problem > summary { list-style: none; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
details.problem > summary::-webkit-details-marker { display: none; }
.p-title { font-weight: 600; }
.p-meta { font-size: 13px; color: var(--muted); }
.p-msg { margin: 10px 0; font: 13px/1.4 ui-monospace, Menlo, monospace; color: var(--muted); word-break: break-word; }
.p-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.p-actions form { margin: 0; }
.p-actions .pill { text-decoration: none; font-size: 13px; height: 32px; }
details.p-section { margin-top: 22px; }
details.p-section > summary { cursor: pointer; padding: 6px 4px; font-size: 13px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); }
.p-list { margin: 4px 0; padding: 6px 14px; list-style: none; background: var(--card); border-radius: 12px; }
.p-list li { padding: 7px 0; font-size: 14px; }
.p-list li + li { border-top: .5px solid var(--line); }
.row-price .fx { color: var(--muted); }

/* pe telefon: mai puțin spațiu pe orizontală, ca să încapă mai mult text */
@media (max-width: 520px) {
  main, .top { padding-left: 8px; padding-right: 8px; }
  .chips { margin: 0 -8px; padding: 0 8px; }
  .row { gap: 8px; padding: 11px 0 11px 10px; }
  details.menu > summary { width: 28px; }
  .rows .check { width: 22px; height: 22px; }
}

/* --- idei de cadouri ------------------------------------------------------------- */
.gift-events { margin-bottom: 10px; }
.gift-events .chip { border: 0; color: var(--text); }
.gift-events .chip.on { background: var(--text); color: var(--bg); }
.gift-events .add-chip { color: var(--accent); }
.event-new { margin-bottom: 12px; padding: 12px 14px; background: var(--card); border-radius: var(--radius); }
.event-edit > summary { list-style: none; display: flex; align-items: baseline; gap: 6px; padding: 6px 4px; cursor: pointer; font-size: 17px; }
.event-edit > summary::-webkit-details-marker { display: none; }
.event-edit > summary .muted { margin-left: auto; color: var(--accent); font-size: 14px; }
.event-edit .item-form { padding: 12px 14px; background: var(--card); border-radius: var(--radius); }
.section-head .reveal { text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 14px; }
.claim { padding: 0 7px; border-radius: 6px; font-weight: 600; font-size: 12px; line-height: 1.7;
  background: color-mix(in srgb, var(--ok) 22%, var(--card)); color: color-mix(in srgb, var(--ok) 50%, var(--text)); }
.claim.some { background: color-mix(in srgb, var(--warn) 20%, var(--card)); color: color-mix(in srgb, var(--warn) 70%, var(--text)); }
.claim.full { background: var(--fill); color: var(--muted); }
.claim.mine { background: var(--accent); color: var(--accent-text); }
.gift-msg { margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; font-size: 14px;
  background: color-mix(in srgb, var(--danger) 14%, var(--card)); color: color-mix(in srgb, var(--danger) 80%, var(--text)); }
.gifts .guests { margin-top: 24px; }
.row.guest { align-items: center; }
.row.guest .row-meta { display: flex; flex-direction: column; align-items: flex-start; gap: 0; }
.row.guest-add { padding-right: 14px; }
.row.guest-add form { flex: 1; min-width: 0; }
.event-new[hidden] { display: none; }
.pill.share { flex: none; color: var(--accent); }
.pill.primary { background: var(--accent); color: var(--accent-text); font-weight: 600; }
.pill:disabled { opacity: .45; cursor: default; }

/* pagina invitaților */
.guest-page { padding-top: max(24px, env(safe-area-inset-top)); }
.guest-page > .brand { display: flex; margin: 0 0 12px; font-size: 22px; }
.guest-hello { margin: 0 4px 8px; color: var(--muted); font-size: 15px; }
.guest-page .row.gift { padding-right: 14px; }
.guest-section + .guest-section { margin-top: 18px; }
.guest-section .mine-count { text-transform: none; letter-spacing: 0; font-weight: 500; }
.claim-actions { display: flex; align-items: center; gap: 10px; margin-top: 10px !important; }
.row.gift.taken .title { color: var(--muted); }
.row.gift.mine { background: color-mix(in srgb, var(--accent) 7%, var(--card)); }

/* --- trage în jos ca să reîncarci (aplicația de pe ecranul de start) ------------------ */
.ptr {
  position: fixed; left: 50%; z-index: 14; width: 36px; height: 36px; border-radius: 18px; opacity: 0;
  display: grid; place-content: center; pointer-events: none; color: var(--muted);
  background: var(--card); box-shadow: var(--shadow), 0 0 0 1px var(--line); transform: translateX(-50%);
}
.ptr svg { transition: transform .15s; }
.ptr.armed { color: var(--accent); }
.ptr.armed svg { transform: rotate(180deg); }
.ptr.busy svg { animation: ptr-spin .8s linear infinite; }
.ptr .spin, .ptr.busy .arrow { display: none; }
.ptr.busy .spin { display: inline; }
@keyframes ptr-spin { to { transform: rotate(360deg); } }

/* bifa 🎁 din Achiziții: produsul e în lista de cadouri activă */
.gift-toggle { display: inline-flex; align-items: center; gap: 1px; margin-top: 2px; padding: 3px 7px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); opacity: .55; cursor: pointer; }
.gift-toggle svg { width: 17px; height: 17px; }
.gift-toggle svg + svg { width: 13px; height: 13px; }
.gift-toggle.on { opacity: 1; color: var(--accent-text); background: var(--accent); }
.gift-hint { display: flex; align-items: center; gap: 6px; margin: 0 4px 12px; color: var(--muted); font-size: 13px; }
.gift-hint .ic { width: 15px; height: 15px; flex: none; }
.row.gift .empty .ic, .gifts .empty .ic { width: 15px; height: 15px; vertical-align: -2px; }
.gifts-chip .ic { width: 15px; height: 15px; margin-right: 4px; vertical-align: -2px; }

/* „12 din 40 · filtrat ✕”: ✕ scoate toate filtrele (căutarea rămâne) */
.clear-filters {
  border: 0; background: color-mix(in srgb, var(--muted) 18%, transparent); color: var(--text);
  width: 22px; height: 22px; border-radius: 50%; margin-left: 4px; padding: 0; font-size: 12px; line-height: 22px;
  vertical-align: 1px; cursor: pointer;
}

/* --- foaia de jos (adăugare / editare) ------------------------------------------------ */
html.sheet-open, html.sheet-open body { overflow: hidden; }
.sheet { position: fixed; inset: 0; z-index: 100; }
.sheet-backdrop {
  position: absolute; inset: 0; background: rgb(30 22 14 / .28);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); opacity: 0; transition: opacity .25s ease;
}
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 640px;
  max-height: calc(100dvh - max(env(safe-area-inset-top), 12px) - 28px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg); border-radius: 14px 14px 0 0; box-shadow: 0 -8px 30px rgb(40 30 20 / .18);
  padding: 0 16px calc(16px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform .25s ease;
}
.sheet.shown .sheet-backdrop { opacity: 1; }
.sheet.shown .sheet-panel { transform: translateY(0); }
.sheet-bar {
  position: sticky; top: 0; z-index: 2; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  margin: 0 -16px; padding: 18px 16px 10px; background: var(--bg); touch-action: none;
  border-bottom: 1px solid var(--line);
}
.sheet-bar strong { font-size: 16px; }
.sheet-bar .link { border: 0; background: none; padding: 6px 0; font-size: 16px; color: var(--accent); justify-self: start; }
.sheet-bar .link.strong { font-weight: 600; justify-self: end; }
.sheet-grab { position: absolute; top: 6px; left: 50%; width: 36px; height: 5px; margin-left: -18px; border-radius: 3px; background: var(--line); }
/* pe ecran mare (web): fereastră centrată, nu foaie de jos */
@media (min-width: 700px) and (hover: hover) {
  .sheet:not([hidden]) { display: flex; align-items: center; justify-content: center; padding: 24px; }
  .sheet-panel {
    position: relative; left: auto; right: auto; bottom: auto; width: 100%; margin: 0;
    max-height: calc(100dvh - 48px); border-radius: 14px; padding-bottom: 16px;
    box-shadow: 0 12px 40px rgb(40 30 20 / .22);
    opacity: 0; transform: translateY(12px) scale(.98); transition: transform .2s ease, opacity .2s ease;
  }
  .sheet.shown .sheet-panel { opacity: 1; transform: none; }
  .sheet-grab { display: none; }
  .sheet-bar { padding-top: 12px; }
}
.sheet-form { gap: 12px; }
.sheet-form > .history { margin-top: 2px; }
.sheet-form input:not([type=checkbox]), .sheet-form select, .sheet-form textarea { background: var(--card); }

/* Stare verificări → Viteză */
table.perf { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
table.perf th, table.perf td { padding: 6px 8px; text-align: right; white-space: nowrap; }
table.perf th:first-child, table.perf td:first-child { text-align: left; }
table.perf th { font-weight: 600; color: var(--muted); }
table.perf tr + tr td { border-top: .5px solid var(--line); }
table.perf tr.bad td { color: var(--danger); }
.perf-h { font-size: 13px; margin: 16px 4px 6px; }

/* --- lucru local: modificările apar imediat, serverul le primește în fundal ----------- */
/* filtrele și căutarea ascund rânduri cu `hidden`; altfel display: flex de pe .row l-ar anula */
.row[hidden], .rows > .empty[hidden], .done-section[hidden], .clear-filters[hidden], .spent[hidden], .tot-label[hidden] { display: none !important; }
.row.pending { opacity: .55; }
.row.pending .title { font-weight: 500; }
/* rândul marcat cumpărat/făcut în telefon arată ca unul rezolvat până vine varianta de la server */
.row.done .note, .row.done .row-meta, .row.done .trend, .row.done .fx, .row.done .gift-toggle { display: none; }
/* punct lângă „Bifă” cât timp mai sunt modificări de trimis (apare doar dacă durează) */
.brand { position: relative; }
html.syncing .brand::after {
  content: ""; position: absolute; right: -12px; top: 50%; width: 7px; height: 7px; margin-top: -4px;
  border-radius: 50%; background: var(--muted); animation: syncing 1s ease-in-out infinite alternate;
}
@keyframes syncing { from { opacity: .25; } to { opacity: .9; } }
.claim.pending { animation: syncing 1s ease-in-out infinite alternate; }  /* pagina invitaților: așteaptă confirmarea */
