:root {
  --bg: #f4f7f8;
  --card: #ffffff;
  --text: #1d2733;
  --muted: #66727f;
  --line: #e2e8ec;
  --accent: #17bebb;
  --accent-dark: #0f8f8d;
  --warn: #e4572e;
  --ok: #2e8b57;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #11161c; --card: #1a222b; --text: #e8eef2; --muted: #93a1ad; --line: #2a3540; }
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
.hidden { display: none !important; }
h1 { font-size: 1.5rem; margin: 0 0 .5rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.card.narrow { max-width: 420px; margin: 12vh auto 0; }
.screen { padding: 16px; }
input, textarea, select { width: 100%; font: inherit; color: inherit; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-top: 4px; }
input.ghost { background: transparent; border: 0; font-weight: 700; font-size: 1.1rem; padding: 4px; margin: 0; }
label { display: block; margin: 12px 0 0; font-size: .9rem; color: var(--muted); }
label input, label textarea, label select { color: var(--text); }
button { font: inherit; border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 10px; padding: 10px 14px; cursor: pointer; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover { background: var(--accent-dark); }
button.big { padding: 14px 18px; font-size: 1.05rem; flex: 1; }
button:disabled { opacity: .6; cursor: wait; }
.row { display: flex; gap: 8px; align-items: flex-end; margin-top: 12px; }
.row > input { flex: 1; }
.row.two > label { flex: 1; }
.hint { color: var(--muted); font-size: .9rem; margin: 0 0 8px; }
.error { color: var(--warn); min-height: 1em; margin: 8px 0 0; }
.saved { color: var(--ok); font-size: .85rem; margin: 8px 0 0; opacity: 0; transition: opacity .3s; }
.saved.show { opacity: 1; }

header { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
header .title { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; font-size: 1.2rem; }
.me { border-radius: 999px; padding: 6px 12px; font-weight: 600; white-space: nowrap; }
nav { display: flex; gap: 4px; padding: 8px 12px; overflow-x: auto; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 53px; z-index: 4; }
nav button { border: 0; background: transparent; white-space: nowrap; color: var(--muted); }
nav button.active { background: var(--bg); color: var(--text); font-weight: 600; }
main { max-width: 760px; margin: 0 auto; padding: 14px 16px 60px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border-radius: 999px; padding: 7px 13px; font-size: .95rem; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chips.big .chip { font-size: 1.05rem; padding: 10px 16px; }

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.person { display: flex; align-items: center; gap: 4px; font-weight: 600; }
.progress-grid { display: grid; grid-template-columns: 1fr repeat(3, auto); gap: 6px 14px; align-items: center; font-size: .92rem; }
.progress-grid .h { color: var(--muted); font-size: .8rem; }

.wishgroup { margin-bottom: 10px; }
.wishgroup .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.tag { background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: .85rem; }
.tag.top { border-color: var(--accent); }
.notes { color: var(--muted); font-size: .9rem; margin: 4px 0 0; white-space: pre-wrap; }

.range { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.range input { margin: 0; flex: 1; min-width: 0; padding: 10px 6px; }
.range span { font-size: .85rem; color: var(--muted); }
.range button { padding: 8px 12px; }

.window { padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--ok) 14%, transparent); margin-bottom: 8px; }
.window.short { background: color-mix(in srgb, var(--muted) 14%, transparent); }
.warn { padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--warn) 14%, transparent); margin-bottom: 8px; }

.timeline { margin-top: 12px; font-size: .8rem; }
.tl-row { display: grid; grid-template-columns: 80px 1fr; align-items: center; gap: 8px; margin: 4px 0; }
.tl-track { position: relative; height: 18px; background: var(--bg); border-radius: 6px; overflow: hidden; }
.tl-bar { position: absolute; top: 0; bottom: 0; border-radius: 4px; opacity: .85; }
.tl-months { display: grid; grid-template-columns: 80px 1fr; gap: 8px; color: var(--muted); }
.tl-months div:last-child { display: flex; justify-content: space-between; }

.bbar { display: grid; grid-template-columns: 80px 1fr; gap: 8px; align-items: center; margin: 6px 0; font-size: .85rem; }
.bbar .track { position: relative; height: 18px; background: var(--bg); border-radius: 6px; }
.bbar .fill { position: absolute; top: 0; bottom: 0; border-radius: 6px; opacity: .85; }
.bbar .common { position: absolute; top: -3px; bottom: -3px; border: 2px dashed var(--ok); border-radius: 6px; }

.offer { overflow: hidden; padding: 0; }
.offer .head { padding: 16px; display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.offer .emoji { font-size: 2rem; line-height: 1; }
.offer h3 { margin: 0; font-size: 1.2rem; }
.offer .country { color: var(--muted); font-size: .9rem; }
.offer .price { text-align: right; white-space: nowrap; }
.offer .price strong { font-size: 1.3rem; display: block; }
.offer .price span { color: var(--muted); font-size: .8rem; }
.offer .body { padding: 0 16px 12px; }
.offer .dates { font-weight: 600; }
.offer ul { margin: 8px 0; padding-left: 18px; color: var(--muted); font-size: .9rem; }
.offer .links { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px 16px; border-top: 1px solid var(--line); }
.offer .links a { flex: 1 1 160px; text-align: center; text-decoration: none; background: var(--accent); color: #fff; padding: 10px 12px; border-radius: 10px; font-weight: 600; font-size: .92rem; }
.offer .links a.secondary { background: var(--bg); color: var(--text); border: 1px solid var(--line); }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 10; }

@media (max-width: 480px) {
  .row.two { flex-direction: column; align-items: stretch; }
  .progress-grid { font-size: .85rem; gap: 6px 8px; }
  .tl-row, .tl-months, .bbar { grid-template-columns: 60px 1fr; }
}
