/* R&J Pack — brand pink #d4507f and green #4f8f22, Poppins. Mobile first. */
:root {
  --pink: #d4507f; --pink-soft: #fce6ee; --pink-ink: #a8345f; --pink-solid: #d4507f; --green-solid: #4f8f22;
  --green: #4f8f22; --green-soft: #eaf4e0; --green-ink: #3b6d19;
  --amber: #c98a12; --red: #c8392f;
  --bg: #f6f5f1; --card: #ffffff; --ink: #23262e; --muted: #6b7080; --line: #e4e5df; --row: #ffffff;
  --shadow: 0 1px 2px rgb(0 0 0 / .05), 0 4px 14px rgb(0 0 0 / .05);
  --f: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --pink: #eb6b99; --pink-soft: #3a1d29; --pink-ink: #f59bbb; --pink-solid: #cf4878; --green-solid: #4a8a1f;
    --green: #8ccc4f; --green-soft: #22301a; --green-ink: #a9dc78;
    --bg: #131519; --card: #1d2026; --ink: #e8e9ee; --muted: #a0a5b3; --line: #30343e; --row: #1d2026;
    --shadow: 0 1px 2px rgb(0 0 0 / .4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --pink: #eb6b99; --pink-soft: #3a1d29; --pink-ink: #f59bbb; --pink-solid: #cf4878; --green-solid: #4a8a1f;
  --green: #8ccc4f; --green-soft: #22301a; --green-ink: #a9dc78;
  --bg: #131519; --card: #1d2026; --ink: #e8e9ee; --muted: #a0a5b3; --line: #30343e; --row: #1d2026;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 var(--f); min-height: 100dvh; overscroll-behavior-y: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h2 { font-size: 17px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
#app { max-width: 640px; margin: 0 auto; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }

/* ----- top bar ----- */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 12px 10px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-size: 20px; flex: 1; }
.brand b { font-weight: 700; color: var(--pink); }
.top-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; font-size: 17px; }
.top-title b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent; display: grid; place-items: center; flex: none; }
.icon-btn:active { background: var(--line); }
.sync { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); padding: 5px 10px; border-radius: 99px; background: var(--card); border: 1px solid var(--line); white-space: nowrap; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; }
.sync i { width: 8px; height: 8px; border-radius: 50%; background: #9aa0aa; flex: none; }
.sync[data-c="green"] i { background: var(--green-solid); }
.sync[data-c="amber"] i { background: var(--amber); animation: pulse 1.2s infinite; }
.sync[data-c="red"] i { background: var(--red); }
.sync[data-c="red"] { color: var(--red); }
@keyframes pulse { 50% { opacity: .35; } }

/* ----- buttons ----- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--card); padding: 10px 16px; border-radius: 12px; font-weight: 500; min-height: 44px; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--pink-solid); color: #fff; border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); }
.btn.big { padding: 16px 20px; font-size: 18px; font-weight: 600; flex: 1; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.btn-row .btn { flex: 1; }
.link { background: none; border: 0; color: var(--pink); font-weight: 600; padding: 0 4px; text-decoration: underline; }
:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }

/* ----- home ----- */
.home { padding: 8px 16px 24px; }
.hello { font-size: 22px; font-weight: 600; margin: 10px 0 14px; }
.sec-head { display: flex; align-items: center; justify-content: space-between; margin: 22px 0 10px; }
.card { display: block; background: var(--card); border-radius: 18px; padding: 14px 16px; box-shadow: var(--shadow); border: 1px solid var(--line); margin-bottom: 10px; }
.card:active { transform: scale(.99); }
.card-top { display: flex; align-items: center; gap: 12px; }
.card .emoji { font-size: 28px; line-height: 1; }
.card-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.card-title b { font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-title small { color: var(--muted); font-size: 13px; }
.card .pct { font-weight: 700; color: var(--green); font-size: 18px; }
.trip.soon { border-color: var(--pink); }
.bar { height: 8px; border-radius: 99px; background: var(--green-soft); margin: 12px 0 10px; overflow: hidden; }
.bar b { display: block; height: 100%; background: var(--green-solid); border-radius: 99px; transition: width .3s; }
.chips-row { display: flex; gap: 6px; flex-wrap: wrap; }
.mini { font-size: 12px; padding: 3px 9px; border-radius: 99px; background: var(--bg); color: var(--muted); }
.mini.day { background: #fff4d6; color: #8a5a00; }
.mini.buy { background: var(--pink-soft); color: var(--pink-ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mini.day { background: #3a2f12; color: #f1c869; } }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.card.tpl { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.card.tpl b { font-weight: 600; font-size: 14px; line-height: 1.3; }
.card.tpl small { color: var(--muted); }
.banner { display: flex; flex-direction: column; gap: 2px; background: var(--pink-solid); color: #fff; border-radius: 18px; padding: 14px 16px; margin-bottom: 8px; box-shadow: var(--shadow); }
.banner span { opacity: .9; font-size: 14px; }
.past summary { cursor: pointer; color: var(--muted); padding: 10px 0; font-weight: 500; }
.empty { text-align: center; padding: 28px 16px; background: var(--card); border-radius: 18px; border: 1px dashed var(--line); margin: 12px 0; }
.empty p { margin: 4px 0; }
.empty .big { font-size: 40px; }
.empty.done { border-style: solid; border-color: var(--green); background: var(--green-soft); }

/* ----- list ----- */
.list { padding: 0 0 24px; }
.hero { display: flex; align-items: center; gap: 16px; padding: 16px; }
.ring { width: 84px; height: 84px; flex: none; }
.ring-bg { fill: none; stroke: var(--green-soft); stroke-width: 9; }
.ring-fg { fill: none; stroke: var(--green); stroke-width: 9; stroke-linecap: round; transition: stroke-dashoffset .4s; }
.ring text { font: 700 17px var(--f); fill: var(--ink); }
.hero-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hero-txt b { font-size: 18px; font-weight: 600; }
.hero-txt > span { color: var(--muted); font-size: 14px; }
.people-prog { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.pp { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; padding: 2px 9px 2px 2px; border-radius: 99px; background: var(--card); border: 1px solid var(--line); }
.pp i { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 11px; font-weight: 700; color: #fff; background: var(--muted); }
.tpl-note { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; width: 100%; }

.tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 0 12px; position: sticky; top: calc(61px + env(safe-area-inset-top)); z-index: 5; background: var(--bg); padding-bottom: 8px; padding-top: 4px; }
.tab { border: 1px solid var(--line); background: var(--card); border-radius: 14px; padding: 8px 4px 6px; display: flex; flex-direction: column; align-items: center; gap: 1px; position: relative; min-height: 60px; }
.tab-ic { font-size: 18px; line-height: 1.1; }
.tab-l { font-size: 11.5px; font-weight: 500; white-space: nowrap; }
.tab-n { position: absolute; top: -6px; right: -4px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 99px; background: var(--pink-solid); color: #fff; font-size: 12px; font-weight: 600; display: grid; place-items: center; }
.tab-n:empty, .tab:not(.on) .tab-n[data-z] { display: none; }
.tab.on { background: var(--pink-solid); border-color: var(--pink); color: #fff; }
.tab.on .tab-n { background: #fff; color: var(--pink); }

.filters { display: flex; flex-direction: column; gap: 8px; padding: 4px 12px 8px; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { border: 1px solid var(--line); background: var(--card); padding: 6px 14px; border-radius: 99px; font-size: 14px; font-weight: 500; white-space: nowrap; min-height: 36px; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip.who-green.on { background: var(--green-solid); border-color: var(--green); color: #fff; }
.chip.who-pink.on { background: var(--pink-solid); border-color: var(--pink); color: #fff; }
.tools { display: flex; gap: 8px; }
.tool { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--muted); font-size: 13px; padding: 4px 6px; border-radius: 8px; }
.tool .ico { width: 16px; height: 16px; }
.tool.on { color: var(--pink); }

.group { margin: 4px 12px 12px; }
.g-head { width: 100%; display: flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 10px 4px 6px; font-weight: 600; font-size: 15px; text-align: left; }
.g-head span:first-child { flex: 1; }
.g-n { color: var(--muted); font-weight: 500; font-size: 13px; }
.g-head .ico { width: 18px; height: 18px; color: var(--muted); transition: transform .2s; }
.g-head.closed .ico { transform: rotate(-90deg); }
.group ul { list-style: none; margin: 0; padding: 0; background: var(--row); border-radius: 16px; border: 1px solid var(--line); overflow: hidden; }
.row { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 10px; min-height: 56px; border-top: 1px solid var(--line); user-select: none; -webkit-user-select: none; }
.row:first-child { border-top: 0; }
.chk { width: 34px; height: 34px; flex: none; border-radius: 50%; border: 2px solid #c3c6cc; background: transparent; display: grid; place-items: center; color: transparent; transition: background .15s, border-color .15s; }
.chk .ico { width: 20px; height: 20px; stroke-width: 3; }
.row.done .chk { background: var(--green-solid); border-color: var(--green); color: #fff; animation: pop .25s; }
@keyframes pop { 40% { transform: scale(1.15); } }
.txt { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 6px 0; cursor: pointer; }
.nm { font-size: 15.5px; overflow-wrap: anywhere; }
.meta { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.row.done .nm { text-decoration: line-through; color: var(--muted); }
.row.done { background: color-mix(in srgb, var(--green-soft) 45%, transparent); }
.dot-when { width: 26px; text-align: center; color: var(--muted); flex: none; }
.avatar { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; flex: none; background: var(--muted); }
.edit { width: 40px; height: 40px; border: 0; background: transparent; color: var(--muted); border-radius: 10px; display: grid; place-items: center; flex: none; }
.edit .ico { width: 18px; height: 18px; }
.edit:active { background: var(--line); }

.who-green .avatar, .avatar.who-green, .pp.who-green i, .who-toggle.who-green { background: var(--green-solid); }
.avatar.who-pink, .pp.who-pink i, .who-toggle.who-pink { background: var(--pink-solid); }
.avatar.who-shared, .pp.who-shared i, .who-toggle.who-shared { background: #8a7bd1; }

/* ----- add bar ----- */
.addbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; gap: 8px; align-items: center; max-width: 640px; margin: 0 auto;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
.addbar input { flex: 1; min-width: 0; height: 48px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); padding: 0 14px; font-size: 16px; }
.addbar input:focus { outline: none; border-color: var(--pink); }
.who-toggle { width: 44px; height: 44px; border-radius: 50%; border: 0; color: #fff; font-weight: 700; font-size: 16px; flex: none; }
.add-go { width: 48px; height: 48px; border-radius: 14px; border: 0; background: var(--pink-solid); color: #fff; display: grid; place-items: center; flex: none; }
.add-go .ico { width: 24px; height: 24px; stroke-width: 2.5; }

/* ----- sheets ----- */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; }
.scrim { position: absolute; inset: 0; background: rgb(0 0 0 / .35); opacity: 0; transition: opacity .2s; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-width: 640px; margin: 0 auto; max-height: 92dvh; overflow-y: auto; background: var(--card);
  border-radius: 22px 22px 0 0; padding: 8px 18px calc(18px + env(safe-area-inset-bottom)); transform: translateY(100%); transition: transform .22s ease-out; }
.sheet-wrap.open .scrim { opacity: 1; }
.sheet-wrap.open .sheet { transform: none; }
.grab { width: 40px; height: 5px; border-radius: 9px; background: var(--line); margin: 4px auto 12px; }
.sheet h2 { margin-bottom: 12px; }
.editor { display: flex; flex-direction: column; gap: 14px; }
.title-in { font-size: 20px; font-weight: 600; border: 0; border-bottom: 2px solid var(--line); background: transparent; padding: 6px 0; }
.title-in:focus { outline: none; border-color: var(--pink); }
.ed-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ed-block { display: flex; flex-direction: column; gap: 6px; }
.ed-block > span, .ed-row > span, .field > span { font-size: 13px; color: var(--muted); font-weight: 500; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.field input, .field select, .ed-block select, .ed-block textarea { width: 100%; border: 1px solid var(--line); background: var(--bg); border-radius: 12px; padding: 11px 12px; font-size: 16px; }
.ed-block textarea { resize: vertical; }
.stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.stepper button { width: 44px; height: 44px; border: 0; background: var(--bg); font-size: 20px; }
.stepper input { width: 56px; height: 44px; border: 0; text-align: center; font-size: 17px; font-weight: 600; background: transparent; }
.seg { display: flex; background: var(--bg); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 10px 6px; border-radius: 9px; font-weight: 500; font-size: 14px; min-height: 42px; }
.seg button.on { background: var(--card); box-shadow: var(--shadow); color: var(--ink); }
.seg button.on.who-green { background: var(--green-solid); color: #fff; }
.seg button.on.who-pink { background: var(--pink-solid); color: #fff; }
.seg button.on.who-shared { background: #8a7bd1; color: #fff; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch i { width: 44px; height: 26px; border-radius: 99px; background: var(--line); position: relative; transition: background .2s; flex: none; }
.switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgb(0 0 0 / .2); }
.switch input:checked + i { background: var(--pink-solid); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 2px solid var(--pink); outline-offset: 2px; }
.emoji-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.emoji-pick label { cursor: pointer; }
.emoji-pick input { position: absolute; opacity: 0; }
.emoji-pick span { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line); font-size: 22px; background: var(--bg); }
.emoji-pick input:checked + span { border: 2px solid var(--pink); background: var(--pink-soft); }
.checks { display: flex; flex-direction: column; gap: 6px; }
.check { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--pink); flex: none; }
.check small { color: var(--muted); margin-left: 4px; }
.menu { display: flex; flex-direction: column; gap: 4px; }
.menu button { display: flex; align-items: center; gap: 12px; border: 0; background: transparent; padding: 14px 8px; border-radius: 12px; font-size: 16px; text-align: left; }
.menu button small { color: var(--muted); margin-left: auto; }
.menu button:active { background: var(--bg); }
.menu button.danger { color: var(--red); }

/* ----- toast ----- */
#toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); z-index: 60; background: var(--ink); color: var(--bg);
  padding: 12px 14px 12px 16px; border-radius: 14px; display: flex; align-items: center; gap: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; max-width: calc(100% - 32px); box-shadow: 0 6px 24px rgb(0 0 0 / .25); }
#toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#toast button { background: none; border: 0; color: var(--pink); font-weight: 700; padding: 4px; }
#toast .link { color: var(--pink); }

/* ----- welcome + settings ----- */
.welcome { padding: calc(40px + env(safe-area-inset-top)) 20px 40px; display: flex; flex-direction: column; gap: 14px; text-align: center; }
.welcome h1 { font-size: 30px; font-weight: 700; color: var(--pink); }
.welcome h2 { margin-top: 16px; }
.welcome .field { text-align: left; margin-top: 10px; }
.logo-big { display: flex; justify-content: center; }
.who-pick { display: flex; gap: 12px; }
.who-pick .who-green { background: var(--green-solid); color: #fff; border: 0; }
.who-pick .who-pink { background: var(--pink-solid); color: #fff; border: 0; }
.ok-note { color: var(--green); font-weight: 500; }
.settings { padding: 12px 16px 40px; display: flex; flex-direction: column; gap: 12px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px; }
.panel h2 { margin-bottom: 10px; }
.panel p { margin: 8px 0 0; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.swatch.who-green { background: var(--green-solid); }
.swatch.who-pink { background: var(--pink-solid); }

@media (min-width: 560px) {
  .tab-l { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ----- QR + iPhone hint ----- */
.qr-sheet { display: flex; flex-direction: column; align-items: center; text-align: left; }
.qr-box { width: min(78vw, 300px); aspect-ratio: 1; background: #fff; border-radius: 16px; padding: 10px; margin: 4px 0 12px; }
.qr-box svg { width: 100%; height: 100%; display: block; }
.qr-steps { align-self: stretch; padding-left: 20px; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.qr-sheet .btn-row { align-self: stretch; }
.hint { display: flex; flex-direction: column; gap: 4px; background: var(--green-soft); border: 1px solid var(--green); border-radius: 16px; padding: 12px 14px; margin-bottom: 12px; font-size: 14px; }
.hint .ico { width: 16px; height: 16px; vertical-align: -3px; color: #2f7bf5; }
.hint .link { align-self: flex-start; color: var(--green-ink); padding: 0; }
