/* Сімейні події. Лише телефон; на компʼютері та сама колонка по центру.
   Образ: календар на дверцятах холодильника. Події - корінці квитків з перфорацією,
   хотілки - мазок маркера-виділювача, картки - як справжні пластикові. */

:root {
  --paper: #EEF1F4;
  --card: #FFFFFF;
  --card-2: #F6F8FA;
  --ink: #17212B;
  --ink-2: #4F5B67;
  --ink-3: #7F8A95;
  --line: #D8DEE4;
  --line-2: #E7EBEF;
  --marker: #E3F35B;
  --marker-deep: #B9CC1E;
  --marker-ink: #17212B;
  --alert: #D9452F;
  --alert-bg: #FCE8E4;
  --soon: #B76E00;
  --soon-bg: #FFF2D6;
  --ok: #1A8F5E;
  --family: #0E8C7E;
  --focus: #2F6FDB;
  --shadow: 0 1px 2px rgba(23, 33, 43, .06), 0 6px 18px rgba(23, 33, 43, .06);
  --r: 14px;
  --display: 'Unbounded', 'Arial Black', system-ui, sans-serif;
  --body: 'Commissioner', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --hand: 'Caveat', 'Segoe Print', cursive;
  --col: 520px;
  --tabs-h: 64px;
  --mk-img: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 40' preserveAspectRatio='none'%3E%3Cpath d='M2 11C30 7 70 9 110 8s70-3 88 0l-1 25c-30 3-80 1-120 2S18 36 3 34z' fill='%23E3F35B'/%3E%3Cpath d='M2 11c40-3 120-2 196-3' stroke='%23D4E640' stroke-width='3' fill='none' opacity='.6'/%3E%3C/svg%3E");
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #10161C;
    --card: #19212A;
    --card-2: #1F2832;
    --ink: #ECF1F5;
    --ink-2: #A8B3BE;
    --ink-3: #7C8893;
    --line: #2C3742;
    --line-2: #24303A;
    --marker: #D6EA3A;
    --marker-deep: #A9BC10;
    --alert: #FF7A63;
    --alert-bg: #3A1F1B;
    --soon: #F2B54A;
    --soon-bg: #3A2D12;
    --family: #2BB7A6;
    --focus: #7FA8FF;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
    --mk-img: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 40' preserveAspectRatio='none'%3E%3Cpath d='M2 11C30 7 70 9 110 8s70-3 88 0l-1 25c-30 3-80 1-120 2S18 36 3 34z' fill='%23C9DE2C'/%3E%3C/svg%3E");
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.42 var(--body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
body.has-sheet { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.ic { width: 22px; height: 22px; flex: none; }
.muted { color: var(--ink-2); }
.small { font-size: 13.5px; }
.row { display: flex; align-items: center; }
.gap { gap: 10px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- колонка ---------- */

.app {
  max-width: var(--col);
  margin: 0 auto;
  min-height: 100dvh;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) 16px calc(var(--tabs-h) + env(safe-area-inset-bottom, 0px) + 28px);
}
body[data-screen='ticket'] .app { padding: 0; max-width: none; }
@media (min-width: 700px) {
  body { background: var(--line-2); }
  .app { background: var(--paper); box-shadow: 0 0 0 1px var(--line); }
}

/* ---------- шапка екрана ---------- */

.head {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 0 -16px 6px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 10px;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 60px;
}
.head h1 {
  margin: 0;
  font: 600 22px/1.15 var(--display);
  letter-spacing: -.01em;
  flex: 1;
  min-width: 0;
}
.head .sub { display: block; font: 500 13.5px/1.3 var(--body); color: var(--ink-2); margin-top: 3px; letter-spacing: 0; }
.head-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 0;
  background: var(--card);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
  flex: none;
}
.head-btn.plain { background: transparent; box-shadow: none; }
.head-me { border: 0; padding: 0; background: none; flex: none; }

/* ---------- аватарки ---------- */

.av {
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--pc);
  color: #fff;
  font: 600 13px/1 var(--display);
  flex: none;
  box-shadow: 0 0 0 2px var(--card);
}
.av-sm { width: 22px; height: 22px; font-size: 10px; }
.av-md { width: 32px; height: 32px; }
.av-lg { width: 44px; height: 44px; font-size: 17px; }
.av-xl { width: 56px; height: 56px; font-size: 22px; }
.who { display: inline-flex; }
.who .av + .av { margin-left: -6px; }
.who-all { display: inline-flex; align-items: center; gap: 5px; color: var(--family); font-size: 13px; font-weight: 600; }
.who-all .ic { width: 18px; height: 18px; }

/* ---------- маркер-виділювач (хотілки) ---------- */

.mk {
  background: var(--mk-img) 0 58% / 100% .82em no-repeat;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  padding: 0 .16em;
  margin: 0 -.16em;
  color: var(--marker-ink);
}
@media (prefers-color-scheme: dark) { .mk { color: #10161C; } }
.hand { font: 600 1.25em/1 var(--hand); }

/* ---------- секції ---------- */

.sec { margin: 22px 0 10px; display: flex; align-items: baseline; gap: 8px; }
.sec h2 { margin: 0; font: 600 13px/1.2 var(--display); letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); }
.sec .sec-n { font-size: 13px; color: var(--ink-3); }
.sec a { margin-left: auto; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.list { display: grid; gap: 10px; }

/* ---------- корінець квитка ---------- */

.stub {
  --cut: 68px;
  position: relative;
  display: flex;
  min-height: 84px;
  background: var(--card);
  border-radius: var(--r);
  -webkit-mask:
    radial-gradient(circle 7px at var(--cut) 0, transparent 97%, #000) top / 100% 51% no-repeat,
    radial-gradient(circle 7px at var(--cut) 100%, transparent 97%, #000) bottom / 100% 51% no-repeat;
  mask:
    radial-gradient(circle 7px at var(--cut) 0, transparent 97%, #000) top / 100% 51% no-repeat,
    radial-gradient(circle 7px at var(--cut) 100%, transparent 97%, #000) bottom / 100% 51% no-repeat;
  transition: transform .12s ease;
}
.stub:active { transform: scale(.985); }
.stub::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 5px;
  background: var(--stripe);
}
.stub-date {
  width: var(--cut);
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 0 10px 5px;
  border-right: 2px dashed var(--line);
  text-align: center;
}
.stub-date b { font: 700 26px/1 var(--display); letter-spacing: -.02em; }
.stub-date span { font: 600 12px/1.2 var(--body); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); margin-top: 3px; }
.stub-date i { font: 600 11px/1.2 var(--body); font-style: normal; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin-bottom: 3px; }
.stub-date-none b { font-size: 22px; color: var(--marker-deep); }
.stub-date-none span { font: 600 17px/1 var(--hand); text-transform: none; letter-spacing: 0; color: var(--ink-2); }
.stub-body { flex: 1; min-width: 0; padding: 11px 14px 11px 14px; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.stub-title { font: 600 16.5px/1.28 var(--body); display: flex; gap: 7px; align-items: baseline; }
.stub-title > span:nth-child(2) { min-width: 0; overflow-wrap: anywhere; }
.stub-cat { flex: none; font-size: 15px; }
.stub-years { margin-left: auto; flex: none; font: 600 12px/1 var(--display); background: var(--card-2); border-radius: 99px; padding: 5px 8px; color: var(--ink-2); }
.stub-meta { font-size: 14px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stub-foot { display: flex; align-items: center; gap: 8px; min-height: 22px; flex-wrap: wrap; }
.tix, .votes, .rel {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 13px; font-weight: 600; color: var(--ink-2);
}
.tix .ic, .votes .ic { width: 17px; height: 17px; }
.rel { margin-left: auto; color: var(--ink-3); font-weight: 500; }
.stub-wish .stub-date { border-right-color: var(--marker-deep); }
.stub.is-done { opacity: .55; }
.vis { display: inline-flex; align-items: center; gap: 3px; font-size: 12.5px; font-weight: 600; color: var(--ink-3); }
.vis .ic { width: 15px; height: 15px; }
.vis-gift { color: #B24A7A; }
@media (prefers-color-scheme: dark) { .vis-gift { color: #F08DB8; } }

/* ---------- потрібна увага ---------- */

.att { background: var(--card); border-radius: var(--r); padding: 4px 0; box-shadow: var(--shadow); }
.att a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; min-height: 56px; }
.att a + a { border-top: 1px solid var(--line-2); }
.att-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; font-size: 18px; background: var(--soon-bg); }
.att-ic.urgent { background: var(--alert-bg); }
.att-ic.wish { background: var(--mk-img) center / 90% 70% no-repeat, var(--card-2); }
.att-t { font-weight: 600; line-height: 1.25; }
.att-s { font-size: 13.5px; color: var(--ink-2); }
.att-s.urgent { color: var(--alert); font-weight: 600; }
.att .ic { color: var(--ink-3); width: 18px; height: 18px; margin-left: auto; }

/* ---------- хотілки «колись» стрічкою ---------- */

.hscroll { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; padding: 2px 16px 8px; scrollbar-width: none; }
.hscroll::-webkit-scrollbar { display: none; }
.wishchip {
  scroll-snap-align: start;
  flex: none;
  max-width: 230px;
  background: var(--card);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.wishchip .t { font-weight: 600; line-height: 1.3; }

/* ---------- кнопки ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 12px;
  border: 0;
  font-weight: 600;
  font-size: 16px;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow);
  text-align: center;
  transition: transform .1s ease, filter .1s ease;
}
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-ink { background: var(--ink); color: var(--paper); box-shadow: none; }
.btn-marker { background: var(--marker); color: var(--marker-ink); box-shadow: none; }
.btn-danger { background: var(--alert); color: #fff; box-shadow: none; }
.btn-ghost { background: transparent; box-shadow: none; color: var(--ink-2); }
.btn-wide { width: 100%; }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: 14.5px; border-radius: 10px; }
.btn .ic { width: 20px; height: 20px; }
.linkbtn { border: 0; background: none; padding: 8px 0; font-weight: 600; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; min-height: 44px; }

/* ---------- нижнє меню ---------- */

.tabs {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--col);
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: end;
  height: calc(var(--tabs-h) + env(safe-area-inset-bottom, 0px));
  padding: 0 6px env(safe-area-inset-bottom, 0px);
  background: var(--card);
  border-top: 1px solid var(--line);
}
.tabs a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  height: var(--tabs-h);
  font-size: 11.5px; font-weight: 600;
  color: var(--ink-3);
}
.tabs svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabs a.on { color: var(--ink); }
.tabs a.on svg { stroke-width: 2.3; }
.tabs a[data-tab='wish'].on svg { fill: var(--marker); }
.tabs .tab-add { justify-content: flex-start; }
.tabs .tab-add svg {
  width: 58px; height: 58px;
  padding: 15px;
  margin-top: -18px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  stroke-width: 2.6;
  box-shadow: 0 6px 16px rgba(23, 33, 43, .28), 0 0 0 5px var(--paper);
}
body.has-sheet .tabs { visibility: hidden; }

/* ---------- нижня панель ---------- */

.sheet-wrap { position: fixed; inset: 0; z-index: 60; }
.sheet-bg { position: absolute; inset: 0; background: rgba(10, 16, 22, .42); opacity: 0; transition: opacity .22s ease; }
.sheet {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 100%;
  max-width: var(--col);
  max-height: 92dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--paper);
  border-radius: 22px 22px 0 0;
  padding: 8px 16px calc(env(safe-area-inset-bottom, 0px) + 20px);
  transform: translate(-50%, 100%);
  transition: transform .26s cubic-bezier(.2, .8, .2, 1);
}
.sheet-wrap.on .sheet-bg { opacity: 1; }
.sheet-wrap.on .sheet { transform: translate(-50%, 0); }
.sheet-grip { width: 42px; height: 5px; border-radius: 9px; background: var(--line); margin: 4px auto 10px; }
.sheet-title { font: 600 18px/1.25 var(--display); margin: 4px 0 14px; }
.sheet-ask .ask-text { font-size: 18px; font-weight: 600; margin: 6px 0 18px; }
.sheet-ask .row { margin-top: 8px; }
.sheet-ask .btn { flex: 1; }

/* ---------- тост ---------- */

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom, 0px) + 14px);
  transform: translate(-50%, 20px);
  width: calc(100% - 32px);
  max-width: calc(var(--col) - 32px);
  z-index: 80;
  background: var(--ink);
  color: var(--paper);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex; align-items: center; gap: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
#toast.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#toast span { flex: 1; }
#toast button { border: 0; background: var(--marker); color: var(--marker-ink); font-weight: 700; border-radius: 9px; padding: 8px 12px; min-height: 40px; }

/* ---------- порожньо, завантаження, без звʼязку ---------- */

.empty { text-align: center; padding: 34px 18px; }
.empty-title { font: 600 18px/1.3 var(--display); margin: 0 0 8px; }
.empty-text { color: var(--ink-2); margin: 0 auto 18px; max-width: 34ch; }
.boot { min-height: 70dvh; display: grid; place-items: center; }
.boot-dot { width: 46px; height: 46px; border-radius: 50%; background: var(--marker); animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { from { transform: scale(.7); opacity: .5; } to { transform: scale(1); opacity: 1; } }
body.is-offline .head::after {
  content: 'без інтернету';
  position: absolute; right: 70px; top: calc(env(safe-area-inset-top, 0px) + 4px);
  font-size: 11px; font-weight: 700; color: var(--soon); background: var(--soon-bg); padding: 2px 7px; border-radius: 99px;
}

/* ---------- календар ---------- */

.cal-head { display: flex; align-items: center; gap: 6px; margin: 4px 0 10px; }
.cal-head h2 { flex: 1; margin: 0; font: 600 19px/1.2 var(--display); text-transform: capitalize; }
.cal-filter { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 12px; padding: 0 16px 2px; scrollbar-width: none; }
.cal-filter::-webkit-scrollbar { display: none; }
.cal-grid { background: var(--card); border-radius: var(--r); padding: 8px 6px 10px; touch-action: pan-y; user-select: none; }
.cal-dow, .cal-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-dow span { text-align: center; font-size: 11.5px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; padding: 4px 0 8px; }
.cal-dow span:nth-child(n+6) { color: var(--alert); opacity: .8; }
.cal-day {
  position: relative;
  min-height: 56px;
  border: 0;
  background: none;
  padding: 4px 1px 6px;
  border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.cal-day.out { opacity: .35; }
.cal-day .n { font: 600 15px/1 var(--display); width: 32px; height: 28px; display: grid; place-items: center; border-radius: 9px; }
.cal-day.today .n { background: var(--ink); color: var(--paper); }
.cal-day.picked { background: var(--card-2); box-shadow: inset 0 0 0 2px var(--ink); }
.cal-day.wish .n { background: var(--mk-img) center 60% / 100% 70% no-repeat; color: var(--marker-ink); }
.cal-day.today.wish .n { background: var(--ink); color: var(--paper); box-shadow: 0 0 0 3px var(--marker); }
.cal-day.expiry::after {
  content: '';
  position: absolute; top: 3px; right: 3px;
  border: 6px solid transparent;
  border-top-color: var(--alert); border-right-color: var(--alert);
  border-radius: 0 6px 0 0;
}
.cal-bars { display: flex; flex-direction: column; gap: 2px; width: 82%; }
.cal-bars i { display: block; height: 4px; border-radius: 3px; background: var(--c); }
.cal-bars i.wish { background: repeating-linear-gradient(90deg, var(--marker-deep) 0 4px, transparent 4px 7px); }
.cal-more { font-size: 10px; font-weight: 700; color: var(--ink-3); line-height: 1; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 12px 2px 0; font-size: 13px; color: var(--ink-2); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend .lg-bar { width: 16px; height: 4px; border-radius: 3px; background: var(--c); }
.cal-legend .lg-mk { width: 18px; height: 12px; background: var(--mk-img) center / 100% 100% no-repeat; }
.cal-legend .lg-exp { width: 0; height: 0; border: 5px solid transparent; border-top-color: var(--alert); border-right-color: var(--alert); }
.day-head { display: flex; align-items: baseline; gap: 8px; margin: 22px 0 10px; }
.day-head h2 { margin: 0; font: 600 17px/1.2 var(--display); }
.day-head .muted { font-size: 14px; }
.day-head .linkbtn { margin-left: auto; padding: 0; min-height: 36px; }

/* ---------- фішки, перемикачі ---------- */

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 99px;
  border: 1.5px solid var(--line);
  background: var(--card);
  font-size: 14.5px; font-weight: 600;
  white-space: nowrap;
  flex: none;
}
.chip .av { box-shadow: none; }
.chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip.on-p { background: color-mix(in srgb, var(--pc) 16%, var(--card)); border-color: var(--pc); color: var(--ink); }
.chip.on-mk { background: var(--marker); border-color: var(--marker-deep); color: var(--marker-ink); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.hscroll { flex-wrap: nowrap; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--line-2); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: none; min-height: 40px; border-radius: 9px; font-weight: 600; font-size: 14.5px; color: var(--ink-2); padding: 0 6px; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.seg-kind button.on[data-v='wish'] { background: var(--marker); color: var(--marker-ink); }

/* ---------- форма ---------- */

.form { display: grid; gap: 18px; padding-bottom: 90px; }
.fld { display: grid; gap: 7px; }
.fld > label, .fld-l { font-size: 13.5px; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.inp, .sel, .ta {
  width: 100%;
  min-height: 50px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--card);
  padding: 12px 14px;
  font-size: 16px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.inp:focus, .sel:focus, .ta:focus { border-color: var(--ink); }
.sel { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237F8A95' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 20px; padding-right: 42px; }
.ta { min-height: 96px; resize: vertical; line-height: 1.45; }
.inp-title { font: 600 20px/1.25 var(--body); min-height: 58px; }
.inp[type='date'], .inp[type='time'] { min-width: 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.three { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.ai-mark { color: var(--ink-3); font-weight: 600; font-size: 12px; display: inline-flex; align-items: center; gap: 3px; }
.ai-mark .ic { width: 14px; height: 14px; color: #8C9A10; }
.unsure .inp, .unsure .sel { border-color: #E2B13C; background: color-mix(in srgb, #FFD66B 14%, var(--card)); }
.unsure-tag { font-size: 12px; font-weight: 700; color: #A06D00; background: #FFF0C8; border-radius: 6px; padding: 2px 6px; }
@media (prefers-color-scheme: dark) { .unsure-tag { color: #F2C14F; background: #3B2F12; } }
.box { background: var(--card); border-radius: var(--r); padding: 14px; display: grid; gap: 14px; }
.box-h { display: flex; align-items: center; gap: 8px; font: 600 14px/1.2 var(--display); letter-spacing: .01em; }
.box-h .ic { width: 19px; height: 19px; color: var(--ink-2); }
.more-toggle { justify-self: start; }
.save-bar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--col);
  z-index: 45;
  padding: 12px 16px calc(env(safe-area-inset-bottom, 0px) + 12px);
  background: linear-gradient(transparent, var(--paper) 30%);
  display: flex; gap: 10px;
}
.save-bar .btn { flex: 1; min-height: 54px; font-size: 17px; }
body[data-screen='form'] .tabs { display: none; }
body[data-screen='form'] .app { padding-bottom: 120px; }

/* вкладення у формі */
.atts { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.att-tile {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  background: var(--card-2) center / cover no-repeat;
  border: 1.5px solid var(--line);
  overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 0;
  text-align: left;
}
.att-tile .lab {
  font-size: 11.5px; font-weight: 700;
  background: rgba(23, 33, 43, .78); color: #fff;
  padding: 4px 7px;
  display: flex; align-items: center; gap: 4px;
}
.att-tile .lab .ic { width: 13px; height: 13px; }
.att-tile .fname { padding: 8px; font-size: 12px; word-break: break-word; flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 6px; color: var(--ink-2); }
.att-tile .prog { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--marker-deep); transition: width .2s; }
.att-tile.err { border-color: var(--alert); }
.att-add { border-style: dashed; display: grid; place-items: center; align-content: center; gap: 4px; font-size: 13px; font-weight: 600; color: var(--ink-2); padding: 6px; text-align: center; }
.att-add .ic { width: 24px; height: 24px; }
.linkrow { display: flex; gap: 8px; align-items: center; }
.linkrow .inp { flex: 1; min-width: 0; }
.x-btn { width: 44px; height: 44px; border: 0; background: none; color: var(--ink-3); display: grid; place-items: center; flex: none; }

/* ---------- запис ---------- */

.hero { background: var(--card); border-radius: 18px; padding: 18px 16px 16px; position: relative; overflow: hidden; }
.hero::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--stripe); }
.hero-cat { font-size: 13.5px; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.hero h1 { font: 600 24px/1.22 var(--display); margin: 8px 0 12px; letter-spacing: -.01em; overflow-wrap: anywhere; }
.hero-when { display: flex; align-items: flex-start; gap: 12px; }
.hero-when .big { font: 600 17px/1.3 var(--body); }
.hero-when .rel { margin: 0; display: block; font-size: 14px; color: var(--ink-2); font-weight: 500; }
.hero-cal {
  flex: none;
  width: 54px;
  border-radius: 10px;
  overflow: hidden;
  text-align: center;
  background: var(--card-2);
  border: 1.5px solid var(--line);
}
.hero-cal i { display: block; font: 700 10.5px/1 var(--body); font-style: normal; text-transform: uppercase; letter-spacing: .06em; background: var(--alert); color: #fff; padding: 4px 0; }
.hero-cal b { display: block; font: 700 22px/1 var(--display); padding: 6px 0 7px; }
.hero-people { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.hero-people .pp { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; }

.blk { margin-top: 14px; background: var(--card); border-radius: var(--r); overflow: hidden; }
.blk-h { padding: 14px 16px 4px; font: 600 13px/1.2 var(--display); letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.blk-h .linkbtn { margin-left: auto; text-transform: none; letter-spacing: 0; font: 600 14px var(--body); min-height: 36px; padding: 0; }
.kv > a, .kv > div.kv-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 54px; }
.kv > * + * { border-top: 1px solid var(--line-2); }
.kv .ic { color: var(--ink-2); }
.kv .k { font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.kv .v { overflow-wrap: anywhere; }
.kv .go { margin-left: auto; width: 18px; height: 18px; color: var(--ink-3); }
.notes { padding: 6px 16px 16px; white-space: pre-wrap; overflow-wrap: anywhere; }

.tk-row { display: flex; gap: 10px; overflow-x: auto; padding: 10px 16px 16px; scrollbar-width: none; }
.tk-row::-webkit-scrollbar { display: none; }
.tk-card {
  flex: none;
  width: 156px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--card-2);
  overflow: hidden;
  text-align: left;
  padding: 0;
  display: flex; flex-direction: column;
}
.tk-card .tk-img { height: 92px; background: #fff center / cover no-repeat; border-bottom: 2px dashed var(--line); display: grid; place-items: center; }
.tk-card .tk-img svg { width: 70px; height: 70px; }
.tk-card .tk-t { padding: 8px 10px 10px; font-size: 13px; line-height: 1.3; }
.tk-card .tk-t b { display: block; font-size: 14px; }
.big-tickets { margin-top: 14px; }

.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 10px 12px 12px; }
.gallery button { aspect-ratio: 1; border: 0; padding: 0; border-radius: 8px; background: var(--card-2) center / cover no-repeat; }
.files a { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 56px; }
.files a + a { border-top: 1px solid var(--line-2); }
.files .fi { width: 38px; height: 46px; border-radius: 6px; background: var(--card-2); display: grid; place-items: center; font: 700 10px/1 var(--display); color: var(--ink-2); flex: none; border: 1.5px solid var(--line); }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.actions .btn { min-height: 52px; font-size: 15px; padding: 0 10px; }
.actions .btn-wide { grid-column: 1 / -1; }
.byline { margin: 18px 4px 0; font-size: 13px; color: var(--ink-3); text-align: center; }
.wish-bar { display: flex; gap: 10px; margin-top: 14px; }
.wish-bar .btn { flex: 1; min-height: 52px; }
.wish-who { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); margin-top: 12px; }

/* ---------- гаманець ---------- */

.wallet { display: grid; gap: 14px; }
.gcard {
  position: relative;
  display: flex; flex-direction: column;
  aspect-ratio: 1.586;
  max-height: 230px;
  border-radius: 18px;
  padding: 16px 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--g1), var(--g2));
  overflow: hidden;
  isolation: isolate;
  box-shadow: 0 10px 24px -14px rgba(23, 33, 43, .55);
  transition: transform .12s ease;
}
.gcard:active { transform: scale(.985); }
.gcard::after {
  content: '';
  position: absolute; right: -30%; top: -60%;
  width: 90%; height: 160%;
  border-radius: 50%;
  background: rgba(255, 255, 255, .09);
  z-index: -1;
}
.gc-gift { --g1: #C2366B; --g2: #7E2A8C; }
.gc-voucher { --g1: #E26A2C; --g2: #B23B33; }
.gc-subscription { --g1: #2F6FDB; --g2: #263C9E; }
.gc-loyalty { --g1: #1F8F7E; --g2: #155A6E; }
.gc-insurance { --g1: #4B5A6A; --g2: #26323E; }
.gc-document { --g1: #3D4F63; --g2: #1E2A36; }
.gc-other { --g1: #6B5BD6; --g2: #3E3393; }
.gc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; opacity: .92; }
.gc-owner .av { box-shadow: 0 0 0 2px rgba(255, 255, 255, .7); }
.gc-name { font: 600 21px/1.2 var(--display); margin-top: auto; overflow-wrap: anywhere; letter-spacing: -.01em; }
.gc-issuer { font-size: 14px; opacity: .85; margin-top: 2px; }
.gc-bottom { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; margin-top: 10px; }
.gc-money { font: 700 20px/1 var(--display); }
.gc-valid { font-size: 13px; font-weight: 600; background: rgba(0, 0, 0, .22); padding: 5px 9px; border-radius: 99px; }
.gcard.is-soon .gc-valid { background: #FFE6A6; color: #6B4300; }
.gcard.is-urgent .gc-valid, .gcard.is-expired .gc-valid { background: #fff; color: var(--alert); }
.gcard.is-done, .gcard.is-expired { filter: grayscale(.8); opacity: .75; }
.gc-vis { position: absolute; top: 44px; left: 18px; }
.gc-vis .vis { color: rgba(255, 255, 255, .85); }
.gcard-big { max-height: none; }
.codebox { background: var(--card); border-radius: var(--r); margin-top: 14px; padding: 16px; display: grid; gap: 12px; justify-items: center; text-align: center; }
.codebox .code { font: 600 22px/1.3 var(--display); letter-spacing: .04em; word-break: break-all; }
.codebox .qr { width: 210px; max-width: 70%; background: #fff; padding: 8px; border-radius: 10px; }
.codebox .qr svg, .codebox .qr img { width: 100%; height: auto; display: block; }
.codebox .pin { font-size: 15px; color: var(--ink-2); }

/* ---------- квиток на весь екран ---------- */

.tk-full {
  position: fixed; inset: 0; z-index: 90;
  background: #fff; color: #111;
  display: flex; flex-direction: column;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 0 calc(env(safe-area-inset-bottom, 0px) + 14px);
  color-scheme: light;
}
.tk-top { display: flex; align-items: center; gap: 10px; padding: 0 12px; }
.tk-top .head-btn { background: #F1F3F5; box-shadow: none; color: #111; }
.tk-top .t { flex: 1; min-width: 0; font: 600 15px/1.25 var(--display); }
.tk-top .t span { display: block; font: 500 13px/1.3 var(--body); color: #555; }
.tk-track { flex: 1; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.tk-track::-webkit-scrollbar { display: none; }
.tk-slide { flex: none; width: 100%; scroll-snap-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 14px 20px; }
.tk-code { width: min(82vw, 380px); }
.tk-code svg, .tk-code img { width: 100%; height: auto; display: block; image-rendering: pixelated; }
.tk-img { max-width: 100%; max-height: 62dvh; object-fit: contain; }
.tk-holder { font: 600 22px/1.2 var(--display); text-align: center; }
.tk-seat { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; }
.tk-seat div { text-align: center; }
.tk-seat small { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: #666; font-weight: 700; }
.tk-seat b { font: 700 22px/1.2 var(--display); }
.tk-codetext { font: 500 14px/1.3 ui-monospace, Menlo, Consolas, monospace; color: #444; word-break: break-all; text-align: center; max-width: 90%; }
.tk-dots { display: flex; justify-content: center; gap: 7px; padding: 8px 0; }
.tk-dots i { width: 8px; height: 8px; border-radius: 50%; background: #CCD2D8; }
.tk-dots i.on { background: #111; }
.tk-foot { text-align: center; font-size: 13px; color: #666; padding: 0 20px; }
.tk-foot button { border: 0; background: none; font-weight: 600; color: #333; text-decoration: underline; min-height: 44px; }

/* ---------- додавання ---------- */

.add-hero {
  display: flex; flex-direction: column; gap: 10px; align-items: flex-start;
  width: 100%;
  border: 0;
  text-align: left;
  background: var(--ink);
  color: var(--paper);
  border-radius: 20px;
  padding: 20px 18px;
  position: relative;
  overflow: hidden;
}
.add-hero .ic { width: 30px; height: 30px; color: var(--marker); }
.add-hero b { font: 600 20px/1.2 var(--display); }
.add-hero span { opacity: .8; font-size: 14.5px; }
.add-hero::after {
  content: '';
  position: absolute; right: -24px; bottom: -18px;
  width: 140px; height: 50px;
  background: var(--mk-img) center / 100% 100% no-repeat;
  transform: rotate(-12deg);
  opacity: .9;
}
.add-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.add-tile {
  border: 0;
  background: var(--card);
  border-radius: 16px;
  padding: 14px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-weight: 600; font-size: 14px;
  min-height: 92px;
  justify-content: center;
}
.add-tile .e { font-size: 24px; }
.add-tile.wish .t { background: var(--mk-img) 0 60% / 100% 80% no-repeat; padding: 0 4px; }
.add-text { margin-top: 12px; width: 100%; }
.add-tip { margin: 16px 2px 0; font-size: 13.5px; color: var(--ink-2); }

/* читання скріну ШІ */
.scan { display: grid; gap: 16px; justify-items: center; padding: 10px 0 20px; }
.scan-pics { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.scan-pic {
  position: relative;
  width: 132px; aspect-ratio: 9 / 16;
  border-radius: 14px;
  background: var(--card) center top / cover no-repeat;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.scan-pic.pdf { display: grid; place-items: center; font: 700 18px/1 var(--display); color: var(--ink-2); aspect-ratio: 3 / 4; }
.scan-pic::after {
  content: '';
  position: absolute; left: -10%; right: -10%;
  height: 26%;
  top: -26%;
  background: var(--mk-img) center / 100% 100% no-repeat;
  opacity: .75;
  mix-blend-mode: multiply;
  animation: sweep 1.6s ease-in-out infinite;
}
@keyframes sweep { 0% { top: -26%; } 100% { top: 100%; } }
.scan-say { font: 600 17px/1.3 var(--display); text-align: center; }
.scan-sub { color: var(--ink-2); text-align: center; font-size: 14px; margin-top: -8px; }
.found { display: grid; gap: 10px; }
.found-item { display: flex; gap: 12px; align-items: center; background: var(--card); border-radius: var(--r); padding: 12px 14px; }
.found-item.saved { opacity: .55; }
.found-item .t { font-weight: 600; }
.found-item .s { font-size: 13.5px; color: var(--ink-2); }

/* ---------- родина ---------- */

.people { display: grid; gap: 10px; }
.person { background: var(--card); border-radius: var(--r); padding: 14px; display: grid; gap: 12px; }
.person-top { display: flex; align-items: center; gap: 12px; }
.person-top .nm { font-weight: 700; font-size: 17px; }
.person-top .rl { font-size: 13px; color: var(--ink-3); }
.colors { display: flex; gap: 8px; flex-wrap: wrap; }
.colors button { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--pc); box-shadow: 0 0 0 2px var(--card); }
.colors button.on { box-shadow: 0 0 0 2px var(--card), 0 0 0 4.5px var(--pc); }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; color: var(--ink-2); font-size: 14.5px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; }
.status.ok { color: var(--ok); }
.status.off { color: var(--ink-3); }
.status .ic { width: 17px; height: 17px; }

/* ---------- вхід ---------- */

.start { min-height: 88dvh; display: flex; flex-direction: column; justify-content: center; gap: 18px; padding: 20px 6px; }
.start h1 { font: 700 30px/1.15 var(--display); margin: 0; letter-spacing: -.02em; }
.start h1 .mk { padding: 0 .1em; }
.start p { margin: 0; color: var(--ink-2); font-size: 16.5px; }
.start-stubs { display: grid; gap: 10px; margin: 6px 0 4px; pointer-events: none; }

/* ---------- лайтбокс ---------- */

.lightbox { position: fixed; inset: 0; z-index: 95; background: rgba(5, 8, 12, .94); display: flex; flex-direction: column; color: #fff; }
.lightbox .lb-top { display: flex; justify-content: space-between; align-items: center; padding: calc(env(safe-area-inset-top, 0px) + 8px) 10px 8px; gap: 8px; }
.lightbox .lb-top .head-btn { background: rgba(255, 255, 255, .14); color: #fff; box-shadow: none; }
.lightbox .lb-img { flex: 1; display: grid; place-items: center; overflow: auto; padding: 8px; touch-action: pinch-zoom; }
.lightbox img { max-height: 100%; object-fit: contain; }

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

/* рядок-кнопка в блоці відомостей (скопіювати номер замовлення) */
.kv .kv-btn { all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 54px; cursor: pointer; }
.kv .kv-btn:focus-visible { outline: 2.5px solid var(--focus); outline-offset: -3px; }
.kv > * + .kv-btn { border-top: 1px solid var(--line-2); }

/* хотілка в списку з кнопкою «я теж»: кнопка в правому нижньому куті корінця */
.wish-item { position: relative; }
.wish-act { position: absolute; right: 10px; bottom: 9px; }
.stub.has-vote .stub-foot { padding-right: 116px; min-height: 36px; }
.wish-act .chip { min-height: 36px; font-size: 13.5px; padding: 0 12px; }
.wish-act .chip .ic { width: 16px; height: 16px; }
