/* «Съёмка под ключ» — looks like part of Telegram: its theme colours, grouped lists, its buttons. */

:root {
  --fb-bg: #EFEFF4;
  --fb-section: #FFFFFF;
  --fb-text: #000000;
  --fb-hint: #6D6D72;
  --fb-link: #1F6FB2;
  --fb-button: #1F6FB2;
  --fb-button-text: #FFFFFF;
  --fb-danger: #D12F25;
  --fb-sep: rgba(60, 60, 67, 0.2);
  --good: #1E7A35;
  --warn: #9A5300;

  --bg: var(--tg-theme-secondary-bg-color, var(--fb-bg));
  --section: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, var(--fb-section)));
  --text: var(--tg-theme-text-color, var(--fb-text));
  --hint: var(--tg-theme-hint-color, var(--fb-hint));
  --subtitle: var(--tg-theme-subtitle-text-color, var(--hint));
  --header: var(--tg-theme-section-header-text-color, var(--hint));
  --link: var(--tg-theme-link-color, var(--fb-link));
  --accent: var(--tg-theme-button-color, var(--fb-button));
  --accent-text: var(--tg-theme-button-text-color, var(--fb-button-text));
  --danger: var(--tg-theme-destructive-text-color, var(--fb-danger));
  --sep: var(--tg-theme-section-separator-color, var(--fb-sep));
  --soft: color-mix(in srgb, var(--hint) 14%, transparent);
  --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
  --radius: 12px;
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-content-safe-area-inset-bottom, 0px));
  /* In full screen Telegram draws its Close / ⋯ buttons over the page: keep content below them. */
  --safe-top: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px));
}

@media (prefers-color-scheme: dark) {
  :root:not(.light) {
    --fb-bg: #000000; --fb-section: #1C1C1E; --fb-text: #FFFFFF; --fb-hint: #98989F;
    --fb-link: #5AA9F0; --fb-button: #3E88D8; --fb-sep: rgba(84, 84, 88, 0.6);
    --fb-danger: #FF6961; --good: #4CD964; --warn: #FFB340;
  }
}
:root.dark { --fb-danger: #FF6961; --good: #4CD964; --warn: #FFB340; }

/* A theme picked in the app overrides Telegram's. */
:root.force-light {
  --bg: #EFEFF4; --section: #FFFFFF; --text: #000000; --hint: #6D6D72; --subtitle: #6D6D72; --header: #6D6D72;
  --link: #1F6FB2; --accent: #1F6FB2; --accent-text: #FFFFFF; --danger: #D12F25; --sep: rgba(60, 60, 67, 0.2);
  --good: #1E7A35; --warn: #9A5300; color-scheme: light;
}
:root.force-dark {
  --bg: #000000; --section: #1C1C1E; --text: #FFFFFF; --hint: #98989F; --subtitle: #98989F; --header: #8D8E93;
  --link: #5AA9F0; --accent: #3E88D8; --accent-text: #FFFFFF; --danger: #FF6961; --sep: rgba(84, 84, 88, 0.6);
  --good: #4CD964; --warn: #FFB340; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 17px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", Roboto, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  /* Long words, addresses and links wrap instead of running past the edge. */
  overflow-wrap: break-word;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--link); text-decoration: none; }
img { display: block; max-width: 100%; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------------------------------------------------------- page */
.page {
  max-width: 640px; margin: 0 auto;
  padding: calc(16px + var(--safe-top)) 16px calc(24px + var(--safe-bottom));
  display: flex; flex-direction: column; gap: 22px;
}
.page.with-tabs { padding-bottom: calc(88px + var(--safe-bottom)); }
.page.with-bar { padding-bottom: calc(96px + var(--safe-bottom)); }
.head { display: flex; flex-direction: column; gap: 4px; padding: 4px 4px 0; }
.kicker { font-size: 13px; color: var(--hint); }
.title { margin: 0; font-size: 26px; line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; }
.lead { margin: 0; font-size: 15px; line-height: 1.4; color: var(--subtitle); }
.boot { min-height: 70vh; display: flex; align-items: center; justify-content: center; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--soft); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- grouped lists */
.sec { display: flex; flex-direction: column; gap: 6px; }
.sec-title { padding: 0 16px; font-size: 13px; line-height: 1.3; text-transform: uppercase; color: var(--header); }
.sec-note { padding: 0 16px; font-size: 13px; line-height: 1.4; color: var(--hint); }
.list { background: var(--section); border-radius: var(--radius); overflow: hidden; }
.list > * { position: relative; }
.list > * + *::before { content: ""; position: absolute; left: 16px; right: 0; top: 0; height: 1px; background: var(--sep); pointer-events: none; }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 48px; padding: 10px 14px 10px 16px;
  background: none; border: 0; text-align: left; color: var(--text);
}
button.row:active, a.row:active { background: var(--soft); }
.row .main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.row .t { font-size: 17px; line-height: 1.3; }
.row .s { font-size: 14px; line-height: 1.35; color: var(--subtitle); }
.row .v { flex: 0 1 auto; max-width: 50%; text-align: right; font-size: 15px; color: var(--hint); }
.nw, .pill { white-space: nowrap; }
.link-text, .title, .name { overflow-wrap: anywhere; }
.row .chev { flex: none; color: var(--hint); opacity: .7; }
.row.top { align-items: flex-start; }
.row.link .t, .row.accent .t { color: var(--link); }
.row.danger .t { color: var(--danger); }
.row .ico {
  flex: none; width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--accent-text);
}
.row .ico.gray { background: var(--hint); }
.row .ico.good { background: var(--good); }
.row .ico.warn { background: var(--warn); }

/* fields inside a list */
.f { display: flex; flex-direction: column; gap: 3px; padding: 10px 16px; }
.f-l { font-size: 13px; color: var(--hint); }
.f-i { width: 100%; min-width: 0; border: 0; padding: 0; background: none; font-size: 17px; line-height: 1.35; color: var(--text); }
.f-i::placeholder { color: var(--hint); opacity: .8; }
textarea.f-i { resize: none; min-height: 24px; overflow: hidden; }
select.f-i { -webkit-appearance: none; appearance: none; }
.f.inline { flex-direction: row; align-items: center; gap: 12px; min-height: 48px; }
.f.inline .f-l { flex: 1 1 auto; min-width: 0; font-size: 17px; color: var(--text); }
.f.inline .f-i { flex: 0 1 45%; text-align: right; color: var(--hint); }
.f.inline select.f-i { text-align-last: right; }

.check { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; font-size: 15px; line-height: 1.4; }
.check input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--accent); }
.switch { position: relative; flex: none; width: 51px; height: 31px; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 16px; background: var(--soft); transition: background .2s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + span { background: var(--good); }
.switch input:checked + span::after { transform: translateX(20px); }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  min-height: 50px; padding: 12px 16px; border: 0; border-radius: var(--radius);
  background: var(--accent); color: var(--accent-text); font-size: 17px; font-weight: 600; line-height: 1.25; text-align: center;
}
.btn.plain { background: var(--section); color: var(--link); font-weight: 400; }
.btn.danger { background: var(--section); color: var(--danger); font-weight: 400; }
.btn.small { min-height: 44px; padding: 10px 12px; font-size: 15px; }
.btn[aria-disabled="true"] { opacity: .5; }
.btns2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.textbtn { border: 0; background: none; padding: 10px 4px; min-height: 44px; color: var(--link); font-size: 15px; }
.textbtn.danger { color: var(--danger); }
.center { text-align: center; }

/* fallback for the Telegram main button (outside Telegram / very old clients) */
.mbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 8px 16px calc(12px + var(--safe-bottom)); background: var(--bg);
  border-top: 1px solid var(--sep);
}
.mbar .btn { max-width: 608px; margin: 0 auto; }

/* ---------------------------------------------------------------- chips, pills, cards */
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.chips.days { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.chip {
  min-height: 44px; padding: 8px 6px; border: 0; border-radius: 10px;
  background: var(--section); color: var(--text); font-size: 15px; font-weight: 500; line-height: 1.2;
}
.chip-box .chip { background: var(--bg); }
.chip[aria-pressed="true"], .chip-box .chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }
.chip.add { background: none; box-shadow: inset 0 0 0 1px var(--sep); color: var(--link); }
.chip-box { background: var(--section); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.pill { flex: none; display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: 13px; font-weight: 600; line-height: 1.3; background: var(--soft); color: var(--hint); }
.pill.good { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.pill.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.pill.accent { background: var(--accent-soft); color: var(--link); }
.card { background: var(--section); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.callout { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; line-height: 1.4; }
.callout svg { flex: none; margin-top: 1px; }
.muted { color: var(--hint); }
.small { font-size: 15px; line-height: 1.4; }
.tiny { font-size: 13px; line-height: 1.4; }
.link-text { color: var(--link); font-size: 17px; line-height: 1.35; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { padding: 5px 10px; border-radius: 999px; background: var(--section); font-size: 13px; line-height: 1.3; color: var(--subtitle); }
.empty { padding: 20px 16px; text-align: center; color: var(--hint); font-size: 15px; line-height: 1.4; }

/* ---------------------------------------------------------------- photographer header */
.hero { display: flex; align-items: center; gap: 14px; padding: 4px; }
.avatar {
  flex: none; width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--accent-text); font-size: 24px; font-weight: 600;
}
.hero .name { margin: 0; font-size: 22px; line-height: 1.2; font-weight: 700; }

/* ---------------------------------------------------------------- calendar */
.cal { background: var(--section); border-radius: var(--radius); padding: 10px 10px 12px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 0 6px; }
.cal-head .month { font-size: 17px; font-weight: 600; text-align: center; }
.icon-btn { width: 44px; height: 44px; border: 0; border-radius: 10px; background: none; color: var(--link); display: flex; align-items: center; justify-content: center; }
.icon-btn:disabled { color: var(--hint); opacity: .35; cursor: default; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; text-align: center; }
.cal-grid .wd { font-size: 12px; color: var(--hint); padding: 4px 0; }
.day { height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 16px; border: 0; padding: 0; }
.day.off { color: var(--hint); opacity: .45; }
.day.free { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.day.free[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }

/* ---------------------------------------------------------------- owner */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 6px 8px calc(6px + var(--safe-bottom)); background: var(--section); border-top: 1px solid var(--sep);
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 48px; padding: 4px 2px; border: 0; background: none; color: var(--hint); font-size: 11px; line-height: 1.2; }
.tab[aria-current="page"] { color: var(--link); }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.stat { background: var(--section); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.stat b { font-size: 26px; line-height: 1.1; font-weight: 700; }
.stat span { font-size: 13px; line-height: 1.3; color: var(--hint); }
.when { flex: none; width: 52px; display: flex; flex-direction: column; align-items: flex-start; font-size: 17px; font-weight: 600; line-height: 1.2; }
.when small { font-size: 12px; font-weight: 500; color: var(--hint); }
.steps { display: flex; flex-direction: column; padding: 6px 16px; }
.step { display: flex; gap: 12px; align-items: stretch; }
.step .rail { flex: none; width: 20px; display: flex; flex-direction: column; align-items: center; }
.step .dot { flex: none; width: 20px; height: 20px; margin-top: 10px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--sep); display: flex; align-items: center; justify-content: center; color: #fff; }
.step .line { flex: 1; width: 2px; background: var(--sep); margin-top: 2px; }
.step:last-child .line { display: none; }
.step .txt { padding: 10px 0; font-size: 15px; line-height: 1.35; color: var(--hint); }
.step.done .dot { background: var(--good); box-shadow: none; }
.step.done .txt { color: var(--text); }
.step.now .dot { box-shadow: inset 0 0 0 2px var(--accent); }
.step.now .txt { color: var(--text); font-weight: 600; }
.contract { white-space: pre-wrap; font-size: 14px; line-height: 1.5; color: var(--subtitle); }
.contract.clamp { max-height: 9.2em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }
.code-input { font-size: 28px; letter-spacing: .5em; text-align: center; font-variant-numeric: tabular-nums; }
.done-mark { width: 64px; height: 64px; border-radius: 50%; background: var(--good); color: #fff; display: flex; align-items: center; justify-content: center; }

/* ---------------------------------------------------------------- gallery */
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.tile-wrap { position: relative; }
.tile { position: relative; display: block; width: 100%; aspect-ratio: 1; padding: 0; border: 0; border-radius: 6px; overflow: hidden; background: var(--soft); }
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile .mark { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; background: rgba(0,0,0,.25); display: flex; align-items: center; justify-content: center; }
.tile[aria-pressed="true"] .mark { background: var(--accent); }
.tile[aria-pressed="true"] { box-shadow: inset 0 0 0 3px var(--accent); }
.tile .note { position: absolute; left: 6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px var(--accent); }
.zoom { position: absolute; left: 6px; bottom: 6px; width: 34px; height: 34px; border: 0; border-radius: 8px; background: rgba(0,0,0,.45); color: #fff; display: flex; align-items: center; justify-content: center; }
.admin-tile { position: relative; aspect-ratio: 1; border-radius: 6px; overflow: hidden; background: var(--soft); }
.admin-tile img { width: 100%; height: 100%; object-fit: cover; }
.admin-tile.picked { box-shadow: inset 0 0 0 3px var(--good); }
.admin-tile .del { position: absolute; right: 4px; top: 4px; width: 34px; height: 34px; border: 0; border-radius: 8px; background: rgba(0,0,0,.5); color: #fff; display: flex; align-items: center; justify-content: center; }
.progress { height: 6px; border-radius: 3px; background: var(--soft); overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); border-radius: 3px; transition: width .2s; }
.progress.over > div { background: var(--warn); }
.seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; padding: 2px; border-radius: 9px; background: var(--soft); }
.seg button { min-height: 36px; border: 0; border-radius: 7px; background: none; font-size: 14px; line-height: 1.2; color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--section); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.12); }

.viewer { position: fixed; inset: 0; z-index: 40; background: #000; color: #fff; display: flex; flex-direction: column; }
.viewer .top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: calc(8px + var(--safe-top)) 8px 8px 16px; font-size: 14px; }
.viewer .top .icon-btn { color: #fff; }
.viewer .img-wrap { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.viewer .img-wrap img { max-height: 100%; object-fit: contain; }
.viewer .nav { position: absolute; top: 0; bottom: 0; width: 35%; border: 0; background: none; }
.viewer .nav.prev { left: 0; } .viewer .nav.next { right: 0; }
.viewer .bottom { padding: 12px 16px calc(16px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 10px; }
.viewer .bottom input { width: 100%; min-height: 46px; border: 0; border-radius: 10px; padding: 10px 12px; background: #1C1C1E; color: #fff; font-size: 16px; }
.viewer .btn.plain { background: #1C1C1E; color: #fff; }

/* ---------------------------------------------------------------- help */
.search { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; border-radius: 10px; background: var(--soft); color: var(--hint); }
.search input { flex: 1; min-width: 0; border: 0; background: none; padding: 8px 0; font-size: 17px; color: var(--text); }
.topic-body { padding: 0 16px 14px; font-size: 15px; line-height: 1.5; color: var(--subtitle); white-space: pre-line; }

#toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(24px + var(--safe-bottom)); z-index: 60;
  max-width: 560px; margin: 0 auto; padding: 12px 16px; border-radius: 12px;
  background: rgba(30, 30, 32, .94); color: #fff; font-size: 15px; line-height: 1.35; text-align: center;
  opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; pointer-events: none;
}
#toast.show { opacity: 1; transform: none; }

.seg.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.seg-row { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px; }
.seg-row .lbl { font-size: 15px; color: var(--hint); }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 14px; font-size: 13px; }
.footer-links .textbtn { font-size: 13px; padding: 6px 2px; min-height: 32px; }
.version { text-align: center; font-size: 13px; color: var(--hint); }

.paygrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.paymethod {
  display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 12px 14px; border: 0; border-radius: var(--radius);
  background: var(--section); color: var(--text); font-size: 16px; font-weight: 600; line-height: 1.25; text-align: left;
  box-shadow: inset 0 0 0 1px var(--sep);
}
.paymethod svg { flex: none; color: var(--link); }
.paymethod[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--accent); }
