:root {
  --pri: #0f3d33; --pri2: #165244; --gold: #c9a45c; --bg: #f4f1ea; --card: #fff; --text: #1d2420; --muted: #6c746f;
  --line: #e4ded2; --red: #c4453a; --green: #2f8a5b; --r: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
[hidden] { display: none !important; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body { font: 15px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); }
main { max-width: 640px; margin: 0 auto; padding: 14px 14px calc(110px + var(--safe-b)); }

.top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px;
  background: var(--pri); color: #fff; padding: max(10px, env(safe-area-inset-top)) 10px 10px; min-height: 56px;
}
.top h1 { flex: 1; font-size: 17px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 6px; }
.ic { width: 40px; height: 40px; border: 0; border-radius: 10px; background: rgba(255,255,255,.1); color: #fff; font-size: 22px; cursor: pointer; }
.back { font-size: 30px; line-height: 1; }

.card { background: var(--card); border-radius: var(--r); padding: 16px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.card h3 { margin: 0 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; cursor: pointer;
  font: 600 15px inherit; font-family: inherit; padding: 13px 18px; border-radius: 12px; background: var(--pri); color: #fff; text-decoration: none;
}
.btn.sec { background: #ece7dc; color: var(--text); }
.btn.danger { background: #fbe9e7; color: var(--red); }
.btn.sm { padding: 8px 12px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > .btn { flex: 1; }

.fab {
  position: fixed; right: 18px; bottom: calc(20px + var(--safe-b)); z-index: 9; width: 58px; height: 58px; border-radius: 50%;
  border: 0; background: var(--gold); color: #fff; font-size: 30px; box-shadow: 0 8px 22px rgba(0,0,0,.25); cursor: pointer;
}

/* список */
.inv { display: flex; gap: 12px; align-items: center; text-decoration: none; color: inherit; }
.inv-cover { width: 64px; height: 64px; border-radius: 12px; background: linear-gradient(135deg, var(--pri), var(--pri2)) center/cover; flex: none; display: grid; place-items: center; color: var(--gold); font-size: 22px; }
.inv-body { flex: 1; min-width: 0; }
.inv-name { font-weight: 600; font-size: 16px; }
.inv-meta { color: var(--muted); font-size: 13px; }
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: #e6f2ec; color: var(--green); }
.badge.off { background: #f1ede6; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 50px 20px; }

/* вкладки */
.tabs { display: flex; gap: 6px; overflow-x: auto; margin: 0 -14px 12px; padding: 0 14px; scrollbar-width: none; position: sticky; top: 56px; z-index: 5; background: var(--bg); padding-top: 4px; padding-bottom: 8px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; border: 0; background: #e9e3d7; color: var(--text); font: 600 14px inherit; font-family: inherit; padding: 9px 14px; border-radius: 99px; cursor: pointer; }
.tabs button.on { background: var(--pri); color: #fff; }

/* форма */
label.f { display: block; margin-bottom: 14px; }
label.f > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
label.f small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
input, textarea, select {
  width: 100%; font: 16px inherit; font-family: inherit; color: var(--text); background: #faf8f4;
  border: 1px solid var(--line); border-radius: 11px; padding: 12px; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--pri); background: #fff; }
textarea { resize: vertical; min-height: 110px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0 12px; }
.switch input { appearance: none; -webkit-appearance: none; width: 50px; height: 30px; border-radius: 99px; background: #d9d3c7; position: relative; padding: 0; border: 0; flex: none; cursor: pointer; transition: .2s; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked { background: var(--green); }
.switch input:checked::after { left: 23px; }
.langtabs { display: flex; gap: 4px; background: #ece7dc; border-radius: 10px; padding: 3px; margin-bottom: 14px; }
.langtabs button { flex: 1; border: 0; background: none; padding: 8px; border-radius: 8px; font: 600 13px inherit; font-family: inherit; cursor: pointer; color: var(--muted); }
.langtabs button.on { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

.themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.themes label { cursor: pointer; }
.themes input { position: absolute; opacity: 0; width: 0; }
.themes span { display: block; border-radius: 12px; padding: 22px 6px 8px; text-align: center; font-size: 12px; font-weight: 600; border: 2px solid transparent; }
.themes input:checked + span { border-color: var(--gold); box-shadow: 0 0 0 2px #fff inset; }
.t-emerald { background: #0f3d33; color: #f1dca4; }
.t-burgundy { background: #4a1424; color: #f3dfae; }
.t-sand { background: #f5eee2; color: #9a7438; border-color: var(--line) !important; }
.themes input:checked + .t-sand { border-color: var(--gold) !important; }

.savebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 8; padding: 10px 14px calc(10px + var(--safe-b)); background: rgba(244,241,234,.92); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-top: 1px solid var(--line); }
.savebar .btn { max-width: 612px; margin: 0 auto; display: flex; width: 100%; }

/* ссылка */
.linkbox { display: flex; gap: 8px; align-items: center; background: #faf8f4; border: 1px dashed var(--line); border-radius: 11px; padding: 10px 12px; font-size: 14px; word-break: break-all; margin-bottom: 10px; }

/* фото */
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ph { position: relative; aspect-ratio: 3/4; border-radius: 10px; overflow: hidden; background: #eee center/cover; }
.ph .n { position: absolute; top: 6px; left: 6px; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 99px; }
.ph .acts { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; padding: 5px; background: linear-gradient(transparent, rgba(0,0,0,.6)); }
.ph .acts button { width: 30px; height: 30px; border: 0; border-radius: 8px; background: rgba(255,255,255,.9); font-size: 15px; cursor: pointer; padding: 0; }
.ph .acts button.del { color: var(--red); }
.upl { aspect-ratio: 3/4; border-radius: 10px; border: 2px dashed var(--line); display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 13px; cursor: pointer; background: #faf8f4; }
.upl b { display: block; font-size: 28px; color: var(--gold); }
audio { width: 100%; margin-bottom: 10px; }
.progress { height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; margin-top: 10px; }
.progress i { display: block; height: 100%; width: 0; background: var(--gold); transition: width .2s; }

/* гости */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.stat { background: var(--card); border-radius: var(--r); padding: 14px 8px; text-align: center; }
.stat b { display: block; font-size: 26px; line-height: 1.1; }
.stat span { font-size: 12px; color: var(--muted); }
.stat.g b { color: var(--green); } .stat.r b { color: var(--red); }
.filter { display: flex; gap: 6px; margin-bottom: 10px; }
.filter button { flex: 1; border: 1px solid var(--line); background: #fff; padding: 8px; border-radius: 10px; font: 600 13px inherit; font-family: inherit; cursor: pointer; }
.filter button.on { background: var(--pri); color: #fff; border-color: var(--pri); }
.guest { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.guest:last-child { border-bottom: 0; }
.guest .dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--green); }
.guest .dot.no { background: var(--red); }
.guest .gb { flex: 1; min-width: 0; }
.guest .gn { font-weight: 600; }
.guest .gm { font-size: 12px; color: var(--muted); }
.guest .gw { font-size: 14px; margin-top: 4px; white-space: pre-line; background: #faf8f4; border-radius: 8px; padding: 6px 9px; }
.guest .x { border: 0; background: none; color: var(--muted); font-size: 18px; cursor: pointer; align-self: flex-start; }

/* логин */
.login { max-width: 360px; margin: 12vh auto 0; text-align: center; }
.login .logo { font-size: 44px; }
.login h2 { margin: 6px 0 20px; }
.err { color: var(--red); font-size: 14px; margin: 8px 0 0; }

.toast { position: fixed; left: 50%; bottom: calc(86px + var(--safe-b)); transform: translateX(-50%) translateY(20px); background: #1d2420; color: #fff; padding: 11px 18px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; z-index: 30; max-width: 90vw; }
.toast.on { opacity: 1; transform: translateX(-50%); }
