:root {
  --bg: #f7f3ea;
  --surface: #ffffff;
  --surface-2: #efe9dc;
  --ink: #1d2a24;
  --muted: #5f6b63;
  --line: #e0d8c6;
  --brand: #1f4d3a;
  --brand-ink: #ffffff;
  --accent: #c8642f;
  --accent-soft: #f6e2d4;
  --danger: #b3261e;
  --shadow: 0 8px 30px rgba(29, 42, 36, .12);
  --radius: 14px;

  --c-music: #7b4bb3;
  --c-market: #d08a12;
  --c-wellness: #2f8f74;
  --c-workshop: #2f6fb3;
  --c-community: #c8642f;
  --c-food: #b84a3a;
  --c-sports: #4f8a2b;
  --c-kids: #d0477d;
  --c-art: #8a5a2b;
  --c-other: #6b7280;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121815;
    --surface: #1b2420;
    --surface-2: #232e29;
    --ink: #eef2ee;
    --muted: #a3b0a8;
    --line: #2f3b35;
    --brand: #7fc3a2;
    --brand-ink: #10241b;
    --accent: #f0915e;
    --accent-soft: #3a2a20;
    --danger: #ff8a80;
    --shadow: 0 8px 30px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}
h1, h2, h3 { font-family: Fraunces, Georgia, serif; line-height: 1.2; margin: 0; }
a { color: var(--brand); }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand > span { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-family: Fraunces, Georgia, serif; font-weight: 700; font-size: 1.25rem; line-height: 1.1; }
.brand-tag { font-size: .75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.top-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.lang-switch { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--surface); flex-shrink: 0; }
.lang-switch button { border: 0; background: none; padding: 6px 11px; font-weight: 600; font-size: .8rem; cursor: pointer; color: var(--muted); }
.lang-switch button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); }
.sheet-head .lang-switch { margin-left: auto; }
.me-btn { width: 36px; height: 36px; color: var(--brand); }
.me-btn.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

/* ---------- toolbar ---------- */
.toolbar { max-width: 960px; margin: 0 auto; padding: 12px 16px 4px; display: grid; gap: 10px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border-radius: 12px; padding: 4px; }
.tabs button { border: 0; background: none; padding: 9px; border-radius: 9px; font-weight: 600; cursor: pointer; color: var(--muted); }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.search, .selects select {
  width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 16px; min-width: 0;
}
.search { padding-left: 38px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%23889' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='8' cy='8' r='6'/%3E%3Cpath d='m13 13 4 4'/%3E%3C/svg%3E") no-repeat 12px center; }
.selects { display: flex; gap: 8px; }
.selects select { flex: 1; }
.active-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.near { gap: 4px; padding-block: 2px; }
.chip.near select { background: transparent; border: 0; color: inherit; font: inherit; font-weight: 600; padding: 4px 0; }
.chip.near select option { color: #1d2a24; }
.chip.near button { background: none; border: 0; color: inherit; cursor: pointer; padding: 4px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin: 0 -16px; padding-inline: 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 6px 12px; font-size: .875rem; cursor: pointer; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip.free[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c-other); }
.c-music { --c: var(--c-music); } .c-market { --c: var(--c-market); } .c-wellness { --c: var(--c-wellness); }
.c-workshop { --c: var(--c-workshop); } .c-community { --c: var(--c-community); } .c-food { --c: var(--c-food); }
.c-sports { --c: var(--c-sports); } .c-kids { --c: var(--c-kids); } .c-art { --c: var(--c-art); } .c-other { --c: var(--c-other); }
.dot[class*="c-"] { background: var(--c); }

/* ---------- main ---------- */
main { max-width: 960px; margin: 0 auto; padding: 0 16px; }
.empty { text-align: center; color: var(--muted); padding: 40px 12px; }
.day-head { font-size: 1.1rem; margin: 22px 0 10px; }
.cards { display: grid; gap: 10px; }
@media (min-width: 720px) { .agenda .cards { grid-template-columns: 1fr 1fr; } }

.card {
  display: grid; grid-template-columns: 84px 1fr; gap: 12px; text-align: left; width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; cursor: pointer; transition: transform .12s, box-shadow .12s;
}
.card:hover { box-shadow: var(--shadow); }
.card:active { transform: scale(.99); }
.card-time { font-weight: 600; font-size: .85rem; color: var(--accent); line-height: 1.35; }
.card-km { display: block; margin-top: 4px; color: var(--muted); font-weight: 500; font-size: .8rem; }
.card-main { display: grid; gap: 3px; min-width: 0; }
.card-title { font-weight: 600; font-size: 1.02rem; line-height: 1.3; }
.card-meta { color: var(--muted); font-size: .875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.tag {
  font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--c, var(--muted)) 15%, transparent); color: var(--c, var(--muted));
}
.tag.price { --c: var(--ink); }
.tag.price.free { --c: var(--brand); }
.tag.reg { --c: var(--accent); }
.tag.family { --c: var(--c-kids); }
.tag.elang { --c: var(--muted); }
.empty .btn { margin-top: 10px; }
.ev-more { display: grid; gap: 4px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.link-btn { background: none; border: 0; padding: 6px 0; text-align: left; color: var(--brand); font-weight: 600; cursor: pointer; }
.more { display: block; margin: 20px auto 0; }

/* ---------- month ---------- */
.month { padding-top: 6px; }
.month-head { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 10px; }
.month-head h2 { font-size: 1.3rem; }
.weekdays, .grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.weekdays span { text-align: center; font-size: .75rem; font-weight: 600; color: var(--muted); padding: 4px 0; text-transform: uppercase; }
.day {
  aspect-ratio: 1 / 1.05; border: 1px solid transparent; background: var(--surface); border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: 6px 2px 4px;
  cursor: pointer; min-width: 0;
}
.day .num { font-weight: 600; font-size: .95rem; }
.day .dots { display: flex; gap: 3px; margin-top: auto; min-height: 8px; align-items: center; }
.day .dots .dot { width: 6px; height: 6px; }
.day .dots b { font-size: .65rem; line-height: 1; color: var(--muted); }
.day.out { background: transparent; color: var(--muted); opacity: .55; }
.day.past .num { color: var(--muted); }
.day.today .num { color: var(--accent); }
.day.today { border-color: var(--accent); }
.day.sel { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); opacity: 1; }
.day.sel .num { color: var(--brand-ink); }
.day.sel .dots b { color: var(--brand-ink); }
@media (min-width: 720px) {
  .day { aspect-ratio: 1.4 / 1; }
}
.day-list { margin-top: 6px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink);
  padding: 10px 16px; border-radius: 12px; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn.alt { background: var(--surface); color: var(--brand); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.big { width: 100%; padding: 14px 18px; font-size: 1.05rem; }
.btn:disabled { opacity: .6; cursor: wait; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface);
  font-size: 1.2rem; cursor: pointer; display: inline-grid; place-items: center; flex-shrink: 0;
}

.chat-box {
  display: flex; align-items: center; gap: 14px; justify-content: space-between;
  margin-top: 28px; padding: 14px 16px; border-radius: var(--radius);
  background: color-mix(in srgb, #25d366 12%, var(--surface)); border: 1px solid color-mix(in srgb, #25d366 35%, var(--line));
}
.chat-box p { margin: 2px 0 0; font-size: .875rem; color: var(--muted); }
.btn.wa { background: #1fa855; border-color: #1fa855; color: #fff; flex-shrink: 0; }

.support-box {
  display: flex; align-items: center; gap: 14px; justify-content: space-between;
  margin-top: 12px; padding: 14px 16px; border-radius: var(--radius);
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
}
.support-box p { margin: 0; font-size: .9rem; }
.btn.support { background: var(--accent); border-color: var(--accent); color: #fff; flex-shrink: 0; }
.support-options { display: grid; gap: 10px; margin: 16px 0; }
.support-option {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 12px;
  padding: 14px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink);
}
.support-option strong { grid-column: 1; }
.support-option .muted { grid-column: 1; }
.support-option .go, .support-option .btn { grid-column: 2; grid-row: 1 / span 2; }
.support-option .go { font-size: 1.4rem; color: var(--accent); }
a.support-option:hover { border-color: var(--accent); }
.thanks { text-align: center; }
.link-btn.center { text-align: center; justify-self: center; color: var(--accent); }

.fab {
  position: fixed; z-index: 6; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom));
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent); color: #fff; border: 0; border-radius: 999px;
  padding: 14px 20px; font-weight: 700; box-shadow: var(--shadow); cursor: pointer;
}
.fab span[aria-hidden] { font-size: 1.3rem; line-height: 1; }

.foot { max-width: 960px; margin: 40px auto 0; padding: 20px 16px; border-top: 1px solid var(--line); font-size: .9rem; }
.foot p { margin: 0 0 6px; }

/* ---------- dialogs (bottom sheets on mobile) ---------- */
dialog.sheet {
  border: 0; padding: 0; background: var(--surface); color: var(--ink);
  width: 100%; max-width: 640px; max-height: 92vh; margin: auto auto 0;
  border-radius: 20px 20px 0 0; box-shadow: var(--shadow); overflow: auto;
  overscroll-behavior: contain;
}
dialog.sheet > div, dialog.sheet > form { padding: 18px 16px calc(24px + env(safe-area-inset-bottom)); }
dialog.sheet.tall { height: 92vh; }
dialog.center { margin: auto; border-radius: 20px; max-width: 420px; width: calc(100% - 32px); }
dialog::backdrop { background: rgba(10, 20, 15, .5); }
dialog[open] { animation: up .22s ease-out; }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }
@media (min-width: 720px) {
  dialog.sheet { margin: auto; border-radius: 20px; }
  dialog.sheet.tall { height: auto; max-height: 90vh; }
}

.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.sheet-head h2 { font-size: 1.35rem; }

.ev-title { font-size: 1.6rem; margin: 4px 0 14px; }
.ev-facts { display: grid; gap: 10px; padding: 12px; background: var(--surface-2); border-radius: var(--radius); }
.ev-facts p { margin: 2px 0 0; font-size: .875rem; }
.ev-desc { margin: 16px 0; overflow-wrap: anywhere; }
.lang-note { font-size: .875rem; color: var(--muted); margin: 12px 0 0; }
.ev-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.ev-actions > :first-child:nth-last-child(odd) { grid-column: 1 / -1; }

.lang-pick { text-align: center; display: grid; gap: 12px; justify-items: center; }
.lang-pick h2 { font-size: 1.35rem; margin: 4px 0 8px; }
.lang-pick h2 .muted { font-size: 1.05rem; font-weight: 600; }
.lang-pick .btn { width: 100%; }

.done { text-align: center; display: grid; gap: 10px; }
.done-icon { width: 56px; height: 56px; margin: 0 auto; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-size: 1.6rem; }
.done h2 { font-size: 1.3rem; }
.done p { margin: 0; }
.manage-link { width: 100%; padding: 10px; border-radius: 10px; border: 1px dashed var(--accent); background: var(--accent-soft); color: var(--ink); font-size: .85rem; }

/* ---------- form ---------- */
fieldset { border: 0; padding: 0; margin: 18px 0 0; display: grid; gap: 12px; }
legend { font-family: Fraunces, Georgia, serif; font-weight: 700; font-size: 1.05rem; margin-bottom: 8px; padding: 0; }
.field { display: grid; gap: 4px; }
.label { font-weight: 600; font-size: .9rem; }
.label em { font-weight: 400; color: var(--muted); font-style: normal; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--ink); font: inherit; font-size: 16px; /* 16px stops iOS zoom */
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: transparent; }
.field textarea { resize: vertical; }
.hint { font-size: .8rem; color: var(--muted); margin: 0; }
.err { font-size: .8rem; color: var(--danger); }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--danger); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg label { flex: 1; min-width: 90px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { text-align: center; padding: 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-weight: 500; background: var(--bg); }
.seg label:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand); font-weight: 600; }
.seg label:has(input:focus-visible) { outline: 2px solid var(--brand); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }
details.alt { border: 1px dashed var(--line); border-radius: 12px; padding: 10px 12px; }
details.alt[open] { display: grid; gap: 12px; }
details.alt summary { cursor: pointer; font-weight: 600; color: var(--brand); }
.pin-map { height: 240px; border-radius: 12px; border: 1px solid var(--line); overflow: hidden; z-index: 0; background: var(--surface-2); }
.pin-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pin-actions .btn { padding: 8px 12px; font-size: .875rem; }
.icon-btn.star { color: var(--accent); font-size: 1.25rem; }
.icon-btn.star.on { background: var(--accent-soft); border-color: var(--accent); }
.card-star { color: var(--accent); }
.tag.new { --c: var(--accent); vertical-align: 2px; }
.add-cal { display: grid; gap: 8px; margin-top: 14px; padding: 12px; border-radius: var(--radius); background: var(--surface-2); }
.add-cal .label { font-weight: 600; font-size: .9rem; }
.add-cal-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.add-cal-btns .btn { padding: 9px 6px; font-size: .85rem; background: var(--surface); }
.more-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.more-row .link-btn { min-width: 0; }
.follow { flex-shrink: 0; border: 1px solid var(--brand); color: var(--brand); background: transparent; border-radius: 999px; padding: 5px 12px; font-weight: 600; font-size: .8rem; cursor: pointer; }
.follow.on, .chip.follow.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.chip.follow { color: var(--brand); border-color: var(--brand); }
.chip-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.me-sec { padding: 16px 0; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.me-sec:first-of-type { border-top: 0; padding-top: 4px; }
.me-sec h3 { font-size: 1.05rem; }
.me-sec h4 { margin: 6px 0 0; font-size: .95rem; }
.me-sec p { margin: 0; }
.link-btn.grow { flex: 1; display: grid; gap: 2px; min-width: 0; color: var(--ink); }
.feed-buttons { display: grid; gap: 8px; }
.link-btn.report { color: var(--muted); font-weight: 500; font-size: .85rem; margin-top: 6px; }
.about-event { margin: 0 0 4px; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); font-weight: 600; font-size: .9rem; }
.foot-links { margin-top: 10px; line-height: 2; }
.import-box { border: 1.5px dashed var(--accent); border-radius: var(--radius); padding: 12px 14px; margin: 14px 0 4px; background: var(--accent-soft); display: grid; gap: 10px; }
.import-box summary { cursor: pointer; font-weight: 700; color: var(--ink); }
.import-box[open] summary { margin-bottom: 2px; }
.imp-tabs { gap: 6px; }
.imp-tabs button { flex: 1; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 8px 6px; font-weight: 600; font-size: .85rem; cursor: pointer; }
.imp-tabs button.on { border-color: var(--brand); color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, var(--surface)); }
.imp-input { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; font-size: 16px; }
.imp-status { margin: 0; font-size: .9rem; font-weight: 600; color: var(--brand); }
.imp-status:empty { display: none; }
.import-done { padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--brand) 12%, var(--surface)); font-weight: 600; }
.check.agree { margin-top: 18px; align-items: flex-start; }
.check.agree span { line-height: 1.4; }
.check.agree.invalid { color: var(--danger); }
ol.rules { padding-left: 20px; display: grid; gap: 10px; }
.staging-banner { background: #b3261e; color: #fff; text-align: center; font-weight: 700; font-size: .8rem; padding: 4px 8px; letter-spacing: .04em; }
.repeat-box { display: grid; gap: 12px; }
.inline-row { display: flex; align-items: center; gap: 10px; }
.field select.small-select { width: auto; min-width: 72px; }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.days label { position: relative; }
.days input { position: absolute; opacity: 0; pointer-events: none; }
.days span {
  display: grid; place-items: center; height: 40px; border: 1px solid var(--line); border-radius: 10px;
  font-size: .8rem; font-weight: 600; text-transform: capitalize; cursor: pointer; background: var(--bg);
}
.days input:checked + span { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.days input:focus-visible + span { outline: 2px solid var(--brand); }
.repeat-summary { margin: 0; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); font-size: .875rem; font-weight: 500; }
.posting-as { margin: 0; font-size: .9rem; }
.link-btn.inline { display: inline; padding: 0; font: inherit; font-weight: 600; }
.signin { display: grid; gap: 12px; }
.my-list { display: grid; gap: 8px; margin: 12px 0 16px; }
.my-ev { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.my-ev > div:first-child { display: grid; gap: 4px; min-width: 0; justify-items: start; }
.my-ev.is-past { opacity: .6; }
.my-ev-actions { display: flex; gap: 6px; flex-shrink: 0; }
.my-ev-actions .btn { padding: 8px 12px; }
.tag.status-published { --c: var(--brand); }
.tag.status-pending, .tag.status-unconfirmed { --c: var(--accent); }
.tag.status-hidden, .tag.status-past { --c: var(--muted); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
#turnstile { margin-top: 16px; }
.form-error { color: var(--danger); font-weight: 600; min-height: 1.2em; margin: 14px 0 6px; }
.form-actions { display: grid; gap: 10px; }

.toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); z-index: 100;
  transform: translate(-50%, 20px); opacity: 0; transition: .2s;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-weight: 600; font-size: .9rem;
  pointer-events: none; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
