:root {
  color-scheme: light;
  --bg: #f7efe3;
  --bg-grad: radial-gradient(1200px 600px at 90% -10%, #ffe2c2 0%, transparent 60%),
             radial-gradient(900px 500px at -10% 20%, #e4f3c9 0%, transparent 55%);
  --surface: #fffaf2;
  --surface-2: #f3e8d8;
  --line: #e7d8c3;
  --text: #2e2119;
  --text-2: #6b5645;
  --muted: #967e69;
  --brown: #a8703f;
  --brown-deep: #6d4424;
  --lime: #a6d13b;
  --lime-deep: #4f7d12;
  --coral: #e0484f;
  --shadow: 0 1px 2px rgba(80, 50, 20, .06), 0 8px 28px rgba(80, 50, 20, .08);
  --radius: 22px;
  --p-must: #e0484f;
  --p-want: #c77a1c;
  --p-maybe: #8a7a6a;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #17120e;
    --bg-grad: radial-gradient(1200px 600px at 90% -10%, #3a2616 0%, transparent 60%),
               radial-gradient(900px 500px at -10% 20%, #1f2b12 0%, transparent 55%);
    --surface: #241c16;
    --surface-2: #2f251d;
    --line: #3d3027;
    --text: #f6ece1;
    --text-2: #d2bfac;
    --muted: #a38f7c;
    --brown: #d59a62;
    --brown-deep: #f0c28f;
    --lime: #b5e04d;
    --lime-deep: #b5e04d;
    --coral: #ff6b70;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .35);
    --p-must: #ff6b70;
    --p-want: #f0a347;
    --p-maybe: #a38f7c;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #17120e;
  --bg-grad: radial-gradient(1200px 600px at 90% -10%, #3a2616 0%, transparent 60%),
             radial-gradient(900px 500px at -10% 20%, #1f2b12 0%, transparent 55%);
  --surface: #241c16;
  --surface-2: #2f251d;
  --line: #3d3027;
  --text: #f6ece1;
  --text-2: #d2bfac;
  --muted: #a38f7c;
  --brown: #d59a62;
  --brown-deep: #f0c28f;
  --lime: #b5e04d;
  --lime-deep: #b5e04d;
  --coral: #ff6b70;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .35);
  --p-must: #ff6b70;
  --p-want: #f0a347;
  --p-maybe: #a38f7c;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Rubik', system-ui, sans-serif;
  background: var(--bg-grad), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.5;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
img { max-width: 100%; }
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -.01em; }
.muted { color: var(--muted); margin: 0; font-size: .92rem; }

/* ---------- buttons & inputs ---------- */
.btn {
  font: inherit; font-weight: 600; cursor: pointer;
  border: 0; border-radius: 999px; padding: .6rem 1.2rem;
  transition: transform .15s, box-shadow .15s, background .15s;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--brown-deep); color: var(--surface); box-shadow: 0 4px 14px rgba(109, 68, 36, .3); }
.btn.primary:hover { transform: translateY(-1px); }
.btn.ghost { background: var(--surface-2); color: var(--text); }
.btn.danger { background: var(--coral); color: #fff; }
.btn.icon { width: 42px; height: 42px; padding: 0; font-size: 1.2rem; }

input, select, textarea { font: inherit; color: inherit; }
.toolbar input, .toolbar select, .login-card input {
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 14px;
  padding: .55rem .9rem; outline: none; min-width: 0;
}
.toolbar input:focus, .toolbar select:focus, .login-card input:focus { border-color: var(--brown); }

/* ---------- login / loading ---------- */
.login, .loading { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card {
  width: min(400px, 100%); background: var(--surface); border-radius: 28px; box-shadow: var(--shadow);
  padding: 2rem 1.6rem; display: grid; gap: .9rem; text-align: center;
}
.login-stickers { display: flex; justify-content: center; gap: .5rem; margin-top: -4.5rem; }
.login-stickers img { width: 130px; height: 130px; object-fit: contain; }
.login-card h1 { font-size: 2rem; color: var(--brown-deep); }
.login-error { display: flex; align-items: center; gap: .6rem; color: var(--coral); font-weight: 600; justify-content: center; }
.login-error img { width: 56px; }
.loading { gap: .5rem; align-content: center; color: var(--text-2); font-weight: 500; }
.loading img { width: 180px; animation: bob 1.4s ease-in-out infinite; }
.sticker { filter: drop-shadow(0 6px 10px rgba(80, 50, 20, .18)); }
.tilt-l { transform: rotate(-8deg); }
.tilt-r { transform: rotate(7deg); }
@keyframes bob { 50% { transform: translateY(-8px) rotate(-2deg); } }

/* ---------- layout ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: .7rem max(16px, calc((100vw - 1600px) / 2));
  backdrop-filter: blur(14px); background: color-mix(in srgb, var(--bg) 75%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 800; font-size: 1.25rem; color: var(--brown-deep); }
.brand img { width: 40px; height: 40px; object-fit: contain; }
.brand b { color: var(--lime-deep); font-weight: 800; }
.wrap { max-width: 1600px; margin: 0 auto; padding: 1.2rem 16px 3rem; display: grid; gap: 1.4rem; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.6rem 1.8rem; min-width: 0; }

/* ---------- hero ---------- */
.hero {
  position: relative; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 1rem;
  background: linear-gradient(135deg, #b77b45 0%, #8a5429 100%);
  color: #fff8ee; border-radius: 32px; padding: 2.2rem 2.4rem; overflow: hidden; box-shadow: var(--shadow);
}
.hero::after {
  content: ""; position: absolute; inset: auto -80px -120px auto; width: 340px; height: 340px;
  background: radial-gradient(circle, rgba(166, 209, 59, .45), transparent 70%);
}
.hero h1 { font-size: clamp(1.8rem, 4vw, 3rem); font-weight: 800; margin: .4rem 0 .6rem; }
.hero p { margin: 0 0 1.4rem; opacity: .9; max-width: 46ch; }
.eyebrow { display: inline-block; background: rgba(255, 255, 255, .16); padding: .25rem .8rem; border-radius: 999px; font-size: .85rem; font-weight: 600; }
.hero-img { width: 260px; position: relative; z-index: 1; filter: drop-shadow(0 12px 24px rgba(0, 0, 0, .25)); transform: rotate(-3deg); }

.progress { max-width: 560px; }
.progress-track { position: relative; height: 14px; background: rgba(255, 255, 255, .18); border-radius: 999px; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--lime), #d8f27f); border-radius: 999px; transition: width .8s cubic-bezier(.2, .8, .2, 1); }
.progress-kart {
  position: absolute; top: 50%; right: 0; width: 64px; height: 64px; object-fit: cover; object-position: 50% 45%;
  border-radius: 50%; border: 3px solid #fff8ee; transform: translate(50%, -50%);
  transition: right .8s cubic-bezier(.2, .8, .2, 1); box-shadow: 0 4px 12px rgba(0, 0, 0, .25);
}
.progress-label { margin-top: 1.4rem; font-weight: 600; font-size: .95rem; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.kpi {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1rem 1.1rem; display: flex; align-items: center; gap: .8rem; min-width: 0;
  transition: transform .2s;
}
.kpi:hover { transform: translateY(-3px); }
.kpi:hover img { transform: rotate(-6deg) scale(1.08); }
.kpi img { width: 78px; height: 78px; object-fit: contain; flex: none; transition: transform .25s; }
.kpi > div { display: grid; min-width: 0; }
.kpi-label { font-size: .85rem; color: var(--text-2); font-weight: 500; }
.kpi strong { font-size: 1.2rem; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.kpi small { color: var(--muted); font-size: .8rem; }

/* ---------- section heads ---------- */
.section-head { display: flex; align-items: center; gap: .9rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.section-head > img { width: 64px; height: 64px; object-fit: contain; }
.section-head > div { flex: 1; min-width: 160px; }
.section-head h2 { font-size: 1.5rem; }

.switch { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; font-size: .9rem; font-weight: 500; user-select: none; }
.switch input { position: absolute; opacity: 0; }
.switch span { width: 42px; height: 24px; background: var(--line); border-radius: 999px; position: relative; transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + span { background: var(--lime-deep); }
.switch input:checked + span::after { transform: translateX(-18px); }
.switch input:focus-visible + span { outline: 2px solid var(--brown); outline-offset: 2px; }

/* ---------- charts ---------- */
.charts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 1.4rem; }
.charts figure { margin: 0; background: var(--surface-2); border-radius: 18px; padding: 1rem; min-width: 0; }
.charts figcaption { font-weight: 600; color: var(--text-2); font-size: .92rem; margin-bottom: .6rem; }
.chart-box { position: relative; height: 320px; }

/* ---------- table ---------- */
.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.toolbar input { flex: 1 1 200px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .92rem; min-width: 1180px; table-layout: fixed; }
/* fixed column widths; name column takes the rest */
thead th:nth-child(1), thead th:nth-child(15) { width: 40px; }
thead th:nth-child(3) { width: 110px; }
thead th:nth-child(4) { width: 90px; }
thead th:nth-child(5) { width: 130px; }
thead th:nth-child(6), thead th:nth-child(7) { width: 70px; }
thead th:nth-child(8) { width: 76px; }
thead th:nth-child(9) { width: 50px; }
thead th:nth-child(10), thead th:nth-child(11) { width: 76px; }
thead th:nth-child(12) { width: 66px; }
thead th:nth-child(13) { width: 84px; }
thead th:nth-child(14) { width: 90px; }
.cell, .dd, .links, .cat-wrap, .cell-name, .cell-notes, .cell[data-f="room"], [data-menu="owner"] { min-width: 0; }
.cell.num { width: 100%; }
.pill { max-width: 100%; }
th {
  text-align: right; font-weight: 600; color: var(--text-2); font-size: .8rem; padding: .6rem .45rem;
  border-bottom: 1.5px solid var(--line); white-space: nowrap; position: sticky; top: 0; background: var(--surface);
}
th[data-sort] { cursor: pointer; }
th[data-sort]:hover { color: var(--brown); }
th.sorted::after { content: " ▾"; }
th.sorted.asc::after { content: " ▴"; }
td { padding: .4rem .35rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
tr.bought td:not(.c-check):not(.c-del) { opacity: .5; }
tr.bought .cell-name { text-decoration: line-through; }
tr.flash { animation: flash 1.2s; }
@keyframes flash { from { background: color-mix(in srgb, var(--lime) 40%, transparent); } }
.num { text-align: left; }
tfoot td { font-weight: 700; border-bottom: 0; padding-top: .8rem; color: var(--text-2); }

.cell {
  width: 100%; background: transparent; border: 1.5px solid transparent; border-radius: 10px;
  padding: .35rem .5rem; outline: none; transition: border-color .15s, background .15s;
}
.cell:hover { background: var(--surface-2); }
.cell:focus { border-color: var(--brown); background: var(--surface); }
.dd { font: inherit; color: inherit; cursor: pointer; text-align: right; display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; width: 100%; overflow: hidden; }
.dd::after { content: ""; margin-inline-start: auto; width: 6px; height: 6px; border: solid var(--muted); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg) translateY(-2px); opacity: 0; transition: opacity .15s; }
.dd:hover::after, .dd:focus::after { opacity: 1; }

.cell-name { font-weight: 600; }
.cell.num { direction: ltr; text-align: left; font-variant-numeric: tabular-nums; }

.cell-notes { color: var(--text-2); }

.name-wrap { display: flex; align-items: center; gap: .4rem; }
.cat-avatar { width: 36px; height: 36px; border-radius: 12px; object-fit: cover; flex: none; background: var(--surface-2); border: 2.5px solid var(--cat, var(--line)); }
.cat-dot { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 3px; background: var(--cat); }
.cat-wrap { display: flex; align-items: center; }

.pill { font: inherit; border: 0; cursor: pointer; border-radius: 999px; font-weight: 600; font-size: .82rem; padding: .35rem .8rem; min-width: 64px; text-align: center; transition: transform .12s, box-shadow .12s; }
.pill:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0, 0, 0, .12); }
.pill.p-חובה { color: var(--p-must); background: color-mix(in srgb, var(--p-must) 12%, transparent); }
.pill.p-רוצה { color: var(--p-want); background: color-mix(in srgb, var(--p-want) 14%, transparent); }
.pill.p-אולי { color: var(--p-maybe); background: color-mix(in srgb, var(--p-maybe) 14%, transparent); }
.pill.s-לחפש { color: var(--text-2); background: var(--surface-2); }
.pill.s-נבחר { color: var(--p-want); background: color-mix(in srgb, var(--p-want) 14%, transparent); }
.pill.s-נקנה { color: var(--lime-deep); background: color-mix(in srgb, var(--lime) 22%, transparent); }

.check { appearance: none; width: 24px; height: 24px; border: 2px solid var(--line); border-radius: 8px; cursor: pointer; display: grid; place-items: center; margin: 0 auto; transition: all .15s; }
.check:checked { background: var(--lime-deep); border-color: var(--lime-deep); }
.check:checked::after { content: "✓"; color: var(--surface); font-weight: 800; font-size: .9rem; }

.links { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: .2rem; background: var(--surface-2); border-radius: 999px;
  padding: .15rem .3rem .15rem .6rem; font-size: .78rem; max-width: 150px;
}
.chip a { color: var(--brown); text-decoration: none; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; }
.chip a:hover { text-decoration: underline; }
.chip button, .add-link, .del {
  border: 0; background: none; cursor: pointer; color: var(--muted); font: inherit; border-radius: 999px; line-height: 1;
}
.chip button { padding: .1rem .3rem; }
.chip button:hover, .del:hover { color: var(--coral); }
.add-link { border: 1.5px dashed var(--line); padding: .2rem .55rem; font-size: .78rem; }
.add-link:hover { border-color: var(--brown); color: var(--brown); }
.del { font-size: 1.1rem; padding: .3rem .5rem; }

.empty { text-align: center; padding: 2rem; color: var(--text-2); }
.empty img { width: 180px; }

/* ---------- capy wall ---------- */
.wall-section { text-align: center; padding: 2rem 0 3rem; }
.wall-section h2 { font-size: 1.6rem; color: var(--brown-deep); }
.wall { overflow: hidden; margin-top: 1.2rem; mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.wall-track { display: flex; gap: 1rem; width: max-content; animation: marquee 140s linear infinite; padding: 1rem 0; }
.wall:hover .wall-track { animation-play-state: paused; }
.wall-track img {
  height: 150px; width: 150px; object-fit: contain; flex: none;
  filter: drop-shadow(0 6px 10px rgba(80, 50, 20, .15)); transition: transform .25s;
}
.wall-track img:nth-child(odd) { transform: rotate(-4deg); }
.wall-track img:nth-child(even) { transform: rotate(4deg) translateY(10px); }
.wall-track img:hover { transform: scale(1.35) rotate(0); z-index: 1; }
@keyframes marquee { to { transform: translateX(50%); } }
.credit { color: var(--muted); font-size: .85rem; margin-top: 1.5rem; }

/* ---------- dialog & toast ---------- */
.dlg { border: 0; border-radius: 26px; padding: 1.6rem; background: var(--surface); color: var(--text); box-shadow: var(--shadow); text-align: center; width: min(360px, calc(100vw - 32px)); }
.dlg::backdrop { background: rgba(30, 20, 10, .45); backdrop-filter: blur(3px); }
.dlg img { width: 150px; margin-top: -.5rem; }
.dlg h3 { margin: .3rem 0; }
.dlg-actions { display: flex; gap: .6rem; justify-content: center; margin-top: 1rem; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 50;
  display: flex; align-items: center; gap: .7rem; background: var(--text); color: var(--bg);
  padding: .5rem 1.2rem .5rem .6rem; border-radius: 999px; box-shadow: var(--shadow); font-weight: 600;
  animation: pop .35s cubic-bezier(.2, 1.4, .4, 1); max-width: calc(100vw - 32px);
}
.toast img { width: 52px; height: 52px; object-fit: contain; }
@keyframes pop { from { transform: translate(-50%, 30px) scale(.9); opacity: 0; } }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .charts { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; padding: 1.6rem 1.3rem; text-align: center; }
  .hero-img { order: -1; width: 170px; margin: -.5rem auto 0; }
  .hero p, .progress { margin-inline: auto; }
  .kpis { grid-template-columns: 1fr; }
  .card { padding: 1.1rem; }
  .chart-box { height: 280px; }

  /* table → compact list; tap chevron to expand a row for full editing */
  .table-scroll { overflow: visible; }
  table { min-width: 0; table-layout: auto; }
  thead { display: none; }
  tbody tr {
    display: grid; grid-template-columns: 28px minmax(0, 1fr) minmax(0, 1fr) auto;
    align-items: center; gap: .2rem .5rem; padding: .6rem .1rem; border-bottom: 1px solid var(--line);
  }
  tbody tr:hover { background: none; }
  tbody td { border: 0; padding: 0; min-width: 0; display: none; }
  td.c-check { display: block; grid-column: 1; grid-row: 1 / span 2; align-self: start; padding-top: .25rem; }
  td.c-name { display: block; grid-column: 2 / 4; grid-row: 1 / span 2; }
  td.c-status { display: block; grid-column: 4; grid-row: 1; justify-self: end; }
  td.c-prio { display: block; grid-column: 4; grid-row: 2; justify-self: end; }
  .pill { font-size: .75rem; padding: .25rem .65rem; min-width: 56px; }
  .check { width: 22px; height: 22px; }
  .cat-avatar { width: 28px; height: 28px; border-radius: 9px; }
  .cell-name { padding: .1rem .4rem; font-size: .95rem; }
  td .m-more { display: grid; }
  td .m-sum { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .78rem; color: var(--muted); padding: 0 .45rem; }
  .m-sum b { color: var(--text-2); font-weight: 600; }
  tr.bought .m-sum { text-decoration: line-through; }

  tr.open { background: var(--surface-2); border-radius: 16px; border-bottom-color: transparent; margin: .35rem 0; padding: .7rem .5rem; row-gap: .5rem; }
  tr.open td { display: block; }
  tr.open td.c-status::before, tr.open td.c-prio::before { content: none !important; }
  tr.open td[data-label]::before { content: attr(data-label); display: block; font-size: .72rem; color: var(--muted); font-weight: 500; margin-bottom: .1rem; }
  tr.open td:nth-child(3), tr.open td:nth-child(6), tr.open td:nth-child(8), tr.open td:nth-child(12) { grid-column: 2; }
  tr.open td:nth-child(4), tr.open td:nth-child(7), tr.open td:nth-child(9), tr.open td:nth-child(13) { grid-column: 3; }
  tr.open td.c-links, tr.open td.c-notes { grid-column: 2 / 4; }
  tr.open td.c-del { grid-column: 4; align-self: end; justify-self: end; }
  tr.open .cell, tr.open .add-link { background: var(--surface); }
  .cell.num, .cell.qty { width: 100%; text-align: right; direction: rtl; }
  .num { text-align: right; }
  tfoot tr { display: flex; justify-content: space-between; }
  tfoot td:empty, tfoot td[colspan="7"] { display: none; }
}

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

/* ---------- actual price ---------- */
.cell.actual { font-weight: 700; color: var(--lime-deep); border: 1.5px dashed var(--line); }
.cell.actual:placeholder-shown { font-weight: 400; }
tr.priced td:has(> [data-f="price_min"]), tr.priced td:has(> [data-f="price_max"]) { opacity: .4; text-decoration: line-through; }

/* ---------- dropdown menu ---------- */
.menu {
  position: fixed; z-index: 60; display: grid; gap: .25rem; min-width: 140px; padding: .4rem;
  background: var(--surface-2); border: 1px solid color-mix(in srgb, var(--muted) 45%, transparent); border-radius: 16px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .28); animation: menu-in .14s ease-out;
}
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.menu button { font: inherit; text-align: right; }
.menu .opt {
  display: flex; align-items: center; gap: .5rem; border: 0; background: none; color: var(--text);
  padding: .45rem .7rem; border-radius: 10px; cursor: pointer; white-space: nowrap;
}
.menu .opt:hover, .menu .opt:focus-visible { background: var(--line); outline: none; }
.menu .pill { text-align: center; }
.menu .pill:focus-visible { outline: 2px solid var(--brown); outline-offset: 1px; }
.menu .current { box-shadow: inset 0 0 0 1.5px currentColor; }
.menu .opt.current { box-shadow: none; background: var(--line); font-weight: 600; }

/* toolbar selects: custom arrow + themed options */
.toolbar select {
  appearance: none; cursor: pointer; padding-left: 2.2rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: 1rem 55%, calc(1rem + 5px) 55%; background-size: 5px 5px; background-repeat: no-repeat;
}
.toolbar select option { background: var(--surface); color: var(--text); }

/* number inputs: no spinners, qty centered */
.cell[type="number"] { -moz-appearance: textfield; }
.cell[type="number"]::-webkit-inner-spin-button, .cell[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.cell.qty { text-align: center; }

/* mobile-only bits (hidden on desktop) */
.m-sum { display: none; }
.m-more { display: none; place-items: center; flex: none; width: 30px; height: 30px; border: 0; border-radius: 50%; background: none; cursor: pointer; color: var(--muted); }
.m-more::before { content: ""; width: 7px; height: 7px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-2px, -2px); transition: transform .2s; }
tr.open .m-more::before { transform: rotate(-135deg); }
.m-more:hover { background: var(--surface-2); }

/* wrapping name/notes: textarea that grows with its content */
textarea.grow { flex: 1 1 0; width: auto; min-width: 0; resize: none; overflow: hidden; display: block; line-height: 1.35; field-sizing: content; min-height: 0; }
.name-wrap { align-items: center; }
/* mid-size screens: tighter cells so the name column keeps room */
@media (max-width: 1300px) and (min-width: 721px) {
  table { font-size: .86rem; min-width: 1080px; }
  .card { padding: 1.4rem 1.2rem; }
  .cat-avatar { width: 28px; height: 28px; border-radius: 9px; }
}

/* ---------- budget + settle ---------- */
.duo { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1rem; }
.duo .section-head { margin-bottom: .9rem; }
.budget-input {
  display: inline-flex; align-items: center; gap: .3rem; background: var(--surface-2); border-radius: 14px;
  padding: .3rem .8rem; font-weight: 700; color: var(--text-2); border: 1.5px solid transparent;
}
.budget-input:focus-within { border-color: var(--brown); }
.budget-input input {
  width: 110px; border: 0; background: none; outline: none; font-weight: 700; font-size: 1.1rem;
  direction: ltr; text-align: left; font-variant-numeric: tabular-nums; -moz-appearance: textfield;
}
.budget-input input::-webkit-inner-spin-button { -webkit-appearance: none; }
.meter { position: relative; height: 26px; margin-top: .4rem; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.meter > div { position: absolute; top: 0; bottom: 0; right: 0; transition: width .6s cubic-bezier(.2, .8, .2, 1), right .6s cubic-bezier(.2, .8, .2, 1); }
.meter-planned { background: color-mix(in srgb, var(--brown) 55%, transparent); }
.meter-band {
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--brown) 40%, transparent) 0 6px, color-mix(in srgb, var(--brown) 15%, transparent) 6px 12px);
}
.meter-fill { background: var(--lime-deep); box-shadow: -2px 0 0 var(--surface); }
.meter-band { box-shadow: inset -2px 0 0 var(--surface); }
.meter-legend b { color: var(--text); font-weight: 700; margin-inline-start: .25rem; font-variant-numeric: tabular-nums; }
.meter-mark { width: 3px; background: var(--coral); transform: translateX(50%); }
.meter-legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin-top: .7rem; font-size: .8rem; color: var(--text-2); }
.meter-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; vertical-align: -1px; margin-inline-end: .35rem; }
.lg-fill { background: var(--lime-deep); }
.lg-planned { background: color-mix(in srgb, var(--brown) 45%, transparent); }
.lg-band { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--brown) 40%, transparent) 0 3px, color-mix(in srgb, var(--brown) 15%, transparent) 3px 6px); }
.lg-mark { background: var(--coral); width: 4px !important; }
.settle-row { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.settle-row > div { background: var(--surface-2); border-radius: 14px; padding: .6rem .9rem; display: grid; }
.settle-row strong { font-size: 1.25rem; font-weight: 800; }
.settle-result { margin: .9rem 0 .2rem; font-size: 1.15rem; font-weight: 800; color: var(--brown-deep); }
.small { font-size: .8rem; }

/* ---------- toolbar "buy now" ---------- */
.btn.now { background: var(--surface); border: 1.5px solid var(--line); color: var(--text); font-weight: 600; }
.btn.now[aria-pressed="true"] { background: var(--lime-deep); border-color: var(--lime-deep); color: var(--surface); }

/* ---------- links: price chip, search ---------- */
.chip-price {
  border: 0; font: inherit; font-size: .74rem; font-weight: 700; cursor: pointer; white-space: nowrap;
  background: color-mix(in srgb, var(--lime) 25%, transparent); color: var(--lime-deep); border-radius: 999px; padding: .05rem .45rem;
}
.chip-price:hover { background: var(--lime-deep); color: var(--surface); }
.chip { max-width: 100%; min-width: 0; }
.chip a { min-width: 0; }
.links { flex-wrap: wrap; }

/* ---------- item photo ---------- */
.avatar-btn { border: 0; padding: 0; background: none; cursor: pointer; flex: none; border-radius: 12px; display: grid; }
.avatar-btn:hover .cat-avatar { transform: scale(1.08); }
.cat-avatar { transition: transform .15s; }
.cat-avatar.has-img { background: #fff; }
.img-dlg { padding: .6rem; width: auto; max-width: min(92vw, 900px); cursor: zoom-out; }
.img-dlg img { display: block; width: auto; max-width: 100%; max-height: 85vh; margin: 0; border-radius: 18px; }
a.opt { text-decoration: none; }

@media (max-width: 1000px) { .duo { grid-template-columns: 1fr; } }
@media (max-width: 720px) {
  .budget-input input { width: 90px; }
  .settle-row strong { font-size: 1.05rem; }
}

/* ---------- move-date countdown (hero) ---------- */
.countdown {
  display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin-top: 1.1rem; max-width: 560px;
  background: rgba(255, 255, 255, .13); border-radius: 18px; padding: .55rem .8rem;
}
.countdown img { width: 46px; height: 46px; object-fit: cover; border-radius: 12px; flex: none; }
.cd-main { display: grid; flex: 1; min-width: 180px; }
.cd-main strong { font-size: 1.15rem; font-weight: 800; }
.cd-main span { font-size: .85rem; opacity: .9; }
.cd-date { display: grid; font-size: .72rem; font-weight: 600; opacity: .95; gap: .1rem; }
.cd-date input {
  font: inherit; font-size: .9rem; font-weight: 600; color: #fff8ee; background: rgba(0, 0, 0, .18);
  border: 1.5px solid rgba(255, 255, 255, .25); border-radius: 10px; padding: .25rem .5rem; color-scheme: dark;
}
.cd-date input:focus { outline: none; border-color: #fff8ee; }

/* ---------- budget by category ---------- */
.cb-head { font-size: .85rem; font-weight: 600; color: var(--text-2); margin: 1.2rem 0 .5rem; }
.cat-break { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.cat-break li { display: grid; grid-template-columns: 120px 1fr auto 44px; align-items: center; gap: .6rem; font-size: .85rem; }
.cb-name { display: flex; align-items: center; gap: .4rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cb-bar { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.cb-bar i { display: block; height: 100%; background: var(--cat); border-radius: 999px; transition: width .6s; }
.cb-val { color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: .8rem; }
.cb-pct { font-weight: 700; text-align: left; font-variant-numeric: tabular-nums; }

/* ---------- split cell ---------- */
.dd.split { display: grid; gap: 0; line-height: 1.2; white-space: normal; }
.dd.split small { color: var(--muted); font-size: .72rem; }
.dd.split::after { display: none; }
.menu .add-cat { color: var(--lime-deep); font-weight: 600; border-top: 1px solid var(--line); border-radius: 0 0 10px 10px; }

@media (max-width: 720px) {
  .countdown { text-align: right; margin-inline: auto; }
  .cat-break li { grid-template-columns: 96px 1fr 38px; }
  .cb-val { display: none; }
}

/* ---------- manage categories ---------- */
.cat-dlg { width: min(460px, calc(100vw - 32px)); text-align: right; }
.cat-dlg > img { display: block; width: 110px; margin: -.4rem auto .2rem; }
.cat-dlg h3 { text-align: center; }
.cat-dlg > p { text-align: center; margin-bottom: .8rem; }
.cat-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; max-height: 50vh; overflow-y: auto; }
.cat-list li { display: grid; grid-template-columns: 34px 1fr auto auto; align-items: center; gap: .5rem; padding: .25rem .3rem; border-radius: 12px; }
.cat-list li:hover { background: var(--surface-2); }
.cat-list img { width: 34px; height: 34px; object-fit: cover; border-radius: 10px; border: 2.5px solid var(--cat); }
.cat-list .cell { font-weight: 600; }
.cat-list .del:disabled { opacity: .3; cursor: not-allowed; }
.cat-add { display: flex; gap: .5rem; margin-top: .8rem; }
.cat-add .cell { background: var(--surface-2); flex: 1; }
.menu-title { margin: .2rem .5rem .3rem; font-size: .8rem; color: var(--muted); font-weight: 600; }
.menu .danger-opt { color: var(--coral); font-weight: 600; }

/* ---------- tabs + identity ---------- */
.stack { display: grid; gap: 1.4rem; min-width: 0; }
.tabs { display: flex; gap: .25rem; background: var(--surface-2); padding: .25rem; border-radius: 999px; }
.tabs button {
  font: inherit; font-weight: 600; font-size: .9rem; border: 0; cursor: pointer; color: var(--text-2);
  background: none; padding: .45rem 1rem; border-radius: 999px; white-space: nowrap; transition: background .15s, color .15s;
}
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.top-actions { display: flex; gap: .4rem; align-items: center; }
.btn.who { padding: .5rem .9rem; font-size: .88rem; }
.who-dlg { text-align: center; }
.who-pick { display: flex; gap: .8rem; justify-content: center; margin-top: 1rem; }
.who-pick button {
  font: inherit; font-weight: 700; font-size: 1.05rem; cursor: pointer; border: 2px solid var(--line); background: var(--surface-2);
  color: var(--text); border-radius: 20px; padding: .8rem 1rem .6rem; display: grid; gap: .3rem; justify-items: center; transition: border-color .15s, transform .15s;
}
.who-pick button:hover { border-color: var(--lime-deep); transform: translateY(-2px); }
.who-pick img { width: 110px; height: 110px; object-fit: contain; }

/* ---------- votes ---------- */
.name-sub { display: flex; align-items: center; gap: .4rem; padding-inline-start: .45rem; min-height: 0; }
.votes { display: inline-flex; gap: .15rem; }
.vote {
  font: inherit; font-size: .72rem; line-height: 1; border: 1px solid transparent; background: none; cursor: pointer;
  border-radius: 999px; padding: .15rem .35rem; display: inline-flex; align-items: center; gap: .1rem;
  opacity: .35; filter: grayscale(1); transition: opacity .15s, filter .15s, background .15s;
}
tr:hover .vote, .bcard:hover .vote, .cmp-card .vote, .vote.has, .vote:focus-visible { opacity: 1; filter: none; }
.vote.has { background: var(--surface-2); }
.vote.on { border-color: var(--lime-deep); }
.vote b { font-size: .68rem; font-weight: 800; color: var(--text-2); }

/* ---------- compare ---------- */
.chip.chosen { box-shadow: inset 0 0 0 1.5px var(--lime-deep); }
.chip.chosen a::before { content: "★ "; color: var(--lime-deep); }
.cmp-dlg { width: min(960px, calc(100vw - 32px)); text-align: right; }
.cmp-dlg h3, .cmp-dlg > p { text-align: center; }
.cmp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .8rem; margin-top: 1rem; max-height: 65vh; overflow-y: auto; padding: .2rem; }
.cmp-card { background: var(--surface-2); border-radius: 18px; overflow: hidden; display: grid; grid-template-rows: auto auto 1fr auto; border: 2px solid transparent; }
.cmp-card.chosen { border-color: var(--lime-deep); }
.cmp-img { aspect-ratio: 1; background: #fff; display: grid; place-items: center; }
.cmp-img img { width: 100%; height: 100%; object-fit: contain; }
.cmp-img img.placeholder { width: 60%; height: 60%; opacity: .8; }
.cmp-card h4 { margin: .6rem .7rem .2rem; font-size: .88rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cmp-meta { display: flex; justify-content: space-between; align-items: baseline; gap: .4rem; padding: 0 .7rem; font-size: .8rem; }
.cmp-meta strong { font-size: 1.05rem; color: var(--lime-deep); }
.cmp-meta a { color: var(--muted); text-decoration: none; direction: ltr; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-actions { display: flex; align-items: center; gap: .4rem; padding: .6rem .7rem .7rem; flex-wrap: wrap; }
.btn.sm { padding: .35rem .8rem; font-size: .8rem; }
.chosen-badge { font-weight: 700; color: var(--lime-deep); font-size: .85rem; margin-inline-start: auto; }
.cmp-actions .btn.primary { margin-inline-start: auto; }

/* ---------- vision board ---------- */
.board-view { display: grid; gap: 1.2rem; min-width: 0; }
.board-view.dragging .board-grid { outline: 3px dashed var(--lime-deep); outline-offset: 8px; border-radius: 18px; }
.composer-row { display: flex; gap: .5rem; align-items: flex-end; }
.composer-row textarea { flex: 1; background: var(--surface-2); font-size: 1rem; padding: .6rem .9rem; border-radius: 14px; min-height: 44px; max-height: 160px; overflow-y: auto; }
.tag-row { display: flex; flex-wrap: wrap; gap: .35rem; margin: .8rem 0 .5rem; }
.tag-row:empty { display: none; }
.tag-row.filters { margin: 0; }
.tag-chip {
  font: inherit; font-size: .8rem; font-weight: 500; cursor: pointer; border: 1.5px solid var(--line); background: var(--surface);
  color: var(--text-2); border-radius: 999px; padding: .25rem .7rem; transition: all .15s;
}
.tag-chip:hover { border-color: var(--brown); }
.tag-chip.on { background: var(--brown-deep); border-color: var(--brown-deep); color: var(--surface); }

.board-grid { columns: 290px; column-gap: 1rem; }
.bcard {
  break-inside: avoid; margin-bottom: 1rem; background: var(--surface); border-radius: 20px; overflow: hidden;
  box-shadow: var(--shadow); display: flex; flex-direction: column; transition: transform .2s;
}
.bcard:hover { transform: translateY(-2px); }
.emb { display: block; width: 100%; border: 0; background: #fff; }
.emb-wide { aspect-ratio: 16 / 9; }
.emb-tall { aspect-ratio: 9 / 16; }
.emb-ig { height: 540px; }
.emb-tt { height: 580px; }
.emb-pin { height: 520px; }
.card-img { display: block; width: 100%; height: auto; background: #fff; }
.card-img.zoomable { cursor: zoom-in; }
.card-note {
  margin: 0; padding: 1.3rem 1.2rem .6rem; font-size: 1.05rem; font-weight: 500; line-height: 1.5; white-space: pre-wrap;
  background: color-mix(in srgb, var(--lime) 18%, var(--surface));
}
.k-note { background: color-mix(in srgb, var(--lime) 18%, var(--surface)); }
.bcard-body { padding: .7rem .9rem .6rem; display: grid; gap: .4rem; }
.bcard-body h4 { margin: 0; font-size: .92rem; line-height: 1.35; }
.bcard-body h4 a { color: var(--text); text-decoration: none; }
.bcard-body h4 a:hover { color: var(--brown); text-decoration: underline; }
.bcard-meta { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; font-size: .74rem; }
.bcard-meta .kind { color: var(--muted); font-weight: 600; margin-inline-end: .2rem; }
.tag { background: var(--surface-2); color: var(--text-2); border-radius: 999px; padding: .1rem .5rem; }
.bcard-actions { display: flex; align-items: center; gap: .2rem; }
.bcard-actions .spacer { flex: 1; }
.icon-btn { border: 0; background: none; cursor: pointer; font-size: .95rem; padding: .3rem .4rem; border-radius: 10px; opacity: .6; transition: opacity .15s, background .15s; }
.icon-btn:hover { opacity: 1; background: var(--surface-2); }

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: .5rem; }
  .tabs { order: 3; width: 100%; justify-content: center; }
  .tabs button { flex: 1; }
  .brand span { font-size: 1.05rem; }
  .composer-row { flex-wrap: wrap; }
  .composer-row textarea { flex-basis: 100%; }
  .composer-row .btn { flex: 1; }
  .board-grid { columns: 1; }
  .tag-row { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: .2rem; }
  .tag-chip { flex: none; }
  .bcard { margin-bottom: .6rem; border-radius: 16px; }
  .emb-ig { height: 460px; }
  .emb-tt { height: 520px; }
  .name-sub { padding: 0 .4rem; }
}
