/* LISTOKRATIA — личный кабинет. Нуар, слоновая кость и один багровый знак.
   Без фреймворков и без внешних запросов: шрифты свои, скрипт один — cabinet.js.
   Всегда тёмный, каким бы ни был клиент Telegram вокруг. */

@font-face { font-family: "Playfair Display"; font-style: normal; font-weight: 400 900; font-display: swap; src: url("/fonts/playfair-cyrillic.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Playfair Display"; font-style: normal; font-weight: 400 900; font-display: swap; src: url("/fonts/playfair-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Playfair Display"; font-style: italic; font-weight: 400 900; font-display: swap; src: url("/fonts/playfair-italic-cyrillic.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("/fonts/inter-cyrillic.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("/fonts/inter-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  color-scheme: dark;
  --bg: #08080a;
  --bg-2: #0d0d10;
  --bg-3: #121216;
  --ink: #efe9df;
  --muted: #96908a;
  --gold: #c9a96a;
  --crimson: #c0122e;
  --ok: #8fbf9a;
  --line: rgba(201, 169, 106, .22);
  --line-soft: rgba(239, 233, 223, .08);
  --serif: "Playfair Display", "Times New Roman", Georgia, serif;
  --sans: "Inter", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --pad: 20px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100svh;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.6 var(--sans);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body::before {                       /* нуарная виньетка */
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(120% 60% at 80% -10%, rgba(201, 169, 106, .10), transparent 60%),
    radial-gradient(80% 50% at 0% 100%, rgba(192, 18, 46, .07), transparent 60%),
    radial-gradient(140% 100% at 50% 50%, transparent 45%, rgba(0, 0, 0, .5) 100%);
}
.frame { position: relative; z-index: 1; max-width: 560px; margin: 0 auto; padding: 0 var(--pad) calc(40px + env(safe-area-inset-bottom, 0px)); }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
p, h1, h2, h3 { margin: 0; }
h1, h2, h3 { font-weight: 700; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
::selection { background: var(--crimson); color: #fff; }
:focus-visible { outline: 1px solid var(--gold); outline-offset: 3px; }

/* ---------- шапка ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: calc(18px + env(safe-area-inset-top, 0px)) 0 18px; border-bottom: 1px solid var(--line-soft); }
.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand__mark { width: 26px; color: var(--ink); }
.brand__word { font: 500 11px/1 var(--sans); letter-spacing: .46em; text-transform: uppercase; padding-left: .1em; }
.top__where { font: 400 14px/1 var(--serif); font-style: italic; color: var(--gold); white-space: nowrap; }

/* ---------- текст ---------- */
.eyebrow { font: 500 11px/1.4 var(--sans); letter-spacing: .34em; text-transform: uppercase; color: var(--gold); }
.h1 { margin-top: 18px; font: 700 clamp(34px, 9vw, 46px)/1.04 var(--serif); letter-spacing: -.02em; }
.h1 em { font-style: italic; font-weight: 400; }
.h1 .dot { color: var(--crimson); font-style: normal; }
.h2 { font: 700 22px/1.2 var(--serif); }
.lead { margin-top: 16px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; line-height: 1.55; }
.serif-i { font-family: var(--serif); font-style: italic; }

/* ---------- кнопки ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 50px; padding: 14px 22px; border-radius: 999px; font: 500 12px/1.2 var(--sans); letter-spacing: .2em; text-transform: uppercase; text-align: center; border: 1px solid transparent; transition: transform .3s var(--ease), background .3s var(--ease), color .3s var(--ease), border-color .3s var(--ease), opacity .3s var(--ease); }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn[disabled] { opacity: .45; cursor: default; transform: none; }
.btn--solid { background: var(--ink); color: var(--bg); }
.btn--solid:hover { background: #fff; }
.btn--ghost { border-color: var(--line); color: var(--ink); }
.btn--ghost:hover { border-color: var(--gold); }
.btn--red { border-color: rgba(192, 18, 46, .5); color: #f0a4b0; }
.btn--red:hover { border-color: var(--crimson); }
.btn--text { min-height: 40px; width: auto; padding: 12px 0; color: var(--muted); letter-spacing: .16em; }
.btn--text:hover { color: var(--ink); transform: none; }
.stack { display: grid; gap: 10px; }
.stack--loose { display: grid; gap: 18px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 0; min-width: 0; }
.card__actions .row > *, .section .row > * { flex: 1 1 175px; }   /* на узком экране кнопки встают в столбец, а не ломают слова */

/* ---------- секции ---------- */
.view { padding-bottom: 24px; }
.section { padding: 26px 0; border-bottom: 1px solid var(--line-soft); }
.section:last-child { border-bottom: 0; }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section__count { font: 400 15px/1 var(--serif); font-style: italic; color: var(--muted); }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.list li { padding-left: 22px; position: relative; }
.list li::before { content: ""; position: absolute; left: 0; top: .72em; width: 6px; height: 6px; border-radius: 50%; background: var(--crimson); }

/* ---------- член ---------- */
.member { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 0; }
.member__name { font: 700 20px/1.25 var(--serif); overflow-wrap: anywhere; }
.member__no { font: 500 11px/1.5 var(--sans); letter-spacing: .26em; text-transform: uppercase; color: var(--muted); }
.tag { display: inline-flex; align-items: center; gap: 7px; font: 500 10px/1 var(--sans); letter-spacing: .22em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag--on { color: var(--ok); }
.tag--off { color: var(--muted); }
.tag--soon { color: var(--gold); }
.card__head .tag { white-space: normal; text-align: right; max-width: 58%; }   /* длинный статус переносится, а не вылезает за карточку */

/* ---------- карточка места ---------- */
.card { position: relative; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(150deg, var(--bg-3), var(--bg-2) 60%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04); }
.card + .card { margin-top: 12px; }
.card--dim { border-color: var(--line-soft); }
.card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.card__no { font: 500 11px/1.4 var(--sans); letter-spacing: .3em; text-transform: uppercase; color: var(--gold); }
.card__title { margin-top: 8px; font: 700 24px/1.15 var(--serif); }
.card__meta { margin-top: 6px; color: var(--muted); font-size: 14px; }
.card__note { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-soft); font-size: 13px; line-height: 1.55; color: var(--muted); }
.card__note b { color: var(--ink); font-weight: 500; }
.card__actions { margin-top: 16px; }
.price { font: 400 34px/1 var(--serif); font-variant-numeric: lining-nums; }
.price small { font: 400 14px/1 var(--sans); color: var(--muted); letter-spacing: .04em; }

/* ---------- выбор устройства ---------- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { position: relative; padding: 16px 14px; min-height: 76px; border: 1px solid var(--line-soft); border-radius: 14px; text-align: left; background: var(--bg-2); transition: border-color .3s var(--ease), background .3s var(--ease), transform .3s var(--ease); }
.tile:hover { border-color: var(--line); transform: translateY(-1px); }
.tile[aria-pressed="true"] { border-color: var(--gold); background: var(--bg-3); }
.tile[aria-pressed="true"]::after { content: ""; position: absolute; right: 14px; bottom: 14px; width: 7px; height: 7px; border-radius: 50%; background: var(--crimson); }
.tile__name { font: 700 16px/1.25 var(--serif); }
.tile__hint { margin-top: 4px; font-size: 12px; color: var(--muted); }
.kv { display: grid; gap: 8px; margin: 0; }
.kv > div { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; }
.kv .sum { font: 700 20px/1 var(--serif); color: var(--ink); }

/* ---------- ключ ---------- */
.keybox { position: relative; margin-top: 12px; padding: 14px 14px 14px 16px; border: 1px solid var(--line-soft); border-radius: 12px; background: var(--bg); font: 400 12px/1.55 ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: var(--muted); word-break: break-all; user-select: all; -webkit-user-select: all; }
.keybox--on { color: var(--ink); }
/* поле, которое копируется нажатием */
.keybox--copy { cursor: pointer; transition: border-color .2s ease, background-color .2s ease; }
.keybox--copy:hover { border-color: var(--gold); }
.keybox--copy:active { background: var(--bg-2); }
.keybox--copy:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.keybox.is-copied { border-color: var(--gold); }
.keyhint { margin-top: 8px; }
/* инструкция: картинка шагов, приложения с официальными страницами */
.howpic { display: block; width: 100%; height: auto; border: 1px solid var(--line-soft); border-radius: 12px; }
.apps { display: grid; gap: 8px; margin-top: 10px; }
.app { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); text-decoration: none; transition: border-color .2s ease; }
.app:hover { border-color: var(--gold); }
.app__name { font: 500 14px/1.3 var(--sans); }
.app__where { font-size: 12px; line-height: 1.4; color: var(--muted); letter-spacing: .06em; }
.qr { width: 208px; max-width: 100%; margin: 16px auto 0; border-radius: 12px; }
.steps { counter-reset: n; list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.steps li { counter-increment: n; padding-left: 34px; position: relative; }
.steps li::before { content: counter(n); position: absolute; left: 0; top: 1px; width: 22px; height: 22px; border: 1px solid var(--line); border-radius: 50%; font: 400 12px/20px var(--serif); font-style: italic; color: var(--gold); text-align: center; }
/* шаги инструкции — крупнее: они читаются с телефона */
.steps--big { gap: 18px; }
.steps--big li { padding-left: 44px; }
.steps--big li::before { width: 30px; height: 30px; font: italic 500 16px/28px var(--serif); border-color: rgba(201, 169, 106, .45); }

/* ---------- платёжная строка, поле ---------- */
.log { display: grid; }
.log > div { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-soft); font-size: 14px; }
.log > div:first-child { border-top: 0; }
.log__what { min-width: 0; }
.log__when { color: var(--muted); font-size: 12px; letter-spacing: .04em; }
.log__state { white-space: nowrap; color: var(--muted); }
.log__state--paid { color: var(--ok); }
.field { width: 100%; padding: 14px 16px; border: 1px solid var(--line-soft); border-radius: 12px; background: var(--bg); color: var(--ink); font: 400 14px/1.4 ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.field::placeholder { color: #5d5853; font-family: var(--sans); }
.field:focus { outline: none; border-color: var(--gold); }

/* ---------- нижняя панель ---------- */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .62); opacity: 0; transition: opacity .3s var(--ease); }
.scrim.is-on { opacity: 1; }
.sheet { position: fixed; z-index: 50; left: 0; right: 0; bottom: 0; max-height: 92svh; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px var(--pad) calc(24px + env(safe-area-inset-bottom, 0px)); background: var(--bg-2); border-top: 1px solid var(--line); border-radius: 20px 20px 0 0; box-shadow: 0 -30px 70px -30px rgba(0, 0, 0, .95); transform: translateY(102%); transition: transform .38s var(--ease); visibility: hidden; }
.sheet.is-on { transform: none; visibility: visible; }
.sheet__grip { width: 40px; height: 3px; margin: 0 auto 18px; border-radius: 2px; background: var(--line); }
.sheet__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 6px; }
.sheet__body { margin-top: 18px; }
.sheet .section { padding: 20px 0; }
.sheet .section:first-child { padding-top: 6px; }
@media (min-width: 720px) {
  .sheet { left: 50%; right: auto; width: 540px; bottom: 6vh; border: 1px solid var(--line); border-radius: 20px; transform: translate(-50%, 24px); opacity: 0; transition: transform .38s var(--ease), opacity .3s var(--ease), visibility .38s; }
  .sheet.is-on { transform: translate(-50%, 0); opacity: 1; }
}

/* ---------- уведомление, загрузка, ошибка ---------- */
.toast { position: fixed; z-index: 60; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); max-width: min(92vw, 460px); padding: 12px 20px; border-radius: 999px; background: var(--ink); color: var(--bg); font: 500 13px/1.4 var(--sans); opacity: 0; pointer-events: none; transition: opacity .3s var(--ease), transform .3s var(--ease); text-align: center; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast--bad { background: var(--crimson); color: #fff; }
.note { margin-top: 14px; padding: 14px 16px; border-left: 2px solid var(--crimson); background: var(--bg-2); font-size: 14px; line-height: 1.6; color: var(--muted); border-radius: 0 12px 12px 0; }
.note b { color: var(--ink); font-weight: 500; }
.spin { display: inline-block; width: 14px; height: 14px; border: 1.5px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: turn .8s linear infinite; vertical-align: -2px; margin-right: 10px; }
.wait { padding: 34px 0 8px; text-align: center; }
.wait .pulse { width: 10px; height: 10px; margin: 0 auto 18px; border-radius: 50%; background: var(--crimson); animation: pulse 1.6s ease-in-out infinite; }
@keyframes turn { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { transform: scale(.6); opacity: .5; } }

.foot { padding: 26px 0 6px; color: var(--muted); font-size: 12px; letter-spacing: .06em; text-align: center; }
.foot a { padding: 10px 0; border-bottom: 1px solid transparent; transition: border-color .3s var(--ease); }
.foot a:hover { border-color: var(--gold); }
.mt { margin-top: 14px; }
.gold { color: var(--gold); font-size: 15px; }
details summary { cursor: pointer; min-height: 44px; padding: 10px 0; margin: -10px 0; }   /* палец попадает, картинка та же */
details summary::-webkit-details-marker { display: none; }
details summary::after { content: " +"; color: var(--crimson); font: 400 18px/1 var(--serif); }
details[open] summary::after { content: " −"; }
.log__state--off { color: var(--muted); }

/* ---------- стол канцелярии (admin.js) ---------- */
.desklink { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; margin-top: 16px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 16px; text-align: left; background: linear-gradient(150deg, var(--bg-3), var(--bg-2) 60%); transition: border-color .3s var(--ease); }
.desklink:hover { border-color: var(--gold); }
.desklink__title { display: block; margin-top: 6px; font: 700 17px/1.3 var(--serif); }
.desklink__arrow { flex: none; font: 400 24px/1 var(--serif); color: var(--gold); }
.desk__head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 22px 0 14px; }
.desk__head .h2 { margin-top: 6px; }
.tabs { display: flex; gap: 4px; margin: 0 0 18px; padding: 4px; border: 1px solid var(--line-soft); border-radius: 999px; background: var(--bg-2); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 1 0 auto; min-width: 0; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; padding: 10px 8px; border-radius: 999px; font: 500 11px/1.2 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); text-align: center; white-space: nowrap; transition: color .3s var(--ease), background .3s var(--ease); }
.tab[aria-selected="true"] { background: var(--ink); color: var(--bg); }
@media (max-width: 350px) { .tab { padding: 10px 6px; font-size: 10px; letter-spacing: .03em; } }   /* на самом узком экране все четыре вкладки остаются видны */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { padding: 14px 16px; border: 1px solid var(--line-soft); border-radius: 14px; background: var(--bg-2); }
.stat__value { display: block; font: 700 28px/1.05 var(--serif); font-variant-numeric: lining-nums; }
.stat__value--s { font-size: 22px; line-height: 1.3; }
.stat__label { display: block; margin-top: 6px; font-size: 12px; line-height: 1.4; color: var(--muted); }
@media (min-width: 480px) { .stats { grid-template-columns: repeat(3, 1fr); } }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 84px; margin-top: 14px; }
.bars__col { flex: 1 1 0; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.bars__bar { min-height: 2px; border-radius: 4px 4px 0 0; background: var(--line); }
.bars__bar--gold { background: var(--gold); }
.bars__labels { display: flex; gap: 8px; margin-top: 8px; }
.bars__pick { flex: 1 1 0; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; padding: 6px 0; border-radius: 8px; font: 400 11px/1.4 var(--sans); letter-spacing: .04em; color: var(--muted); text-align: center; transition: color .3s var(--ease); }
.bars__pick[aria-pressed="true"] { color: var(--gold); }
/* показания счётчика против лимита тарифа (стол канцелярии: серверы) */
.meter { height: 6px; margin-top: 12px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.meter__fill { height: 100%; border-radius: 999px; background: var(--gold); transition: width .6s var(--ease); }
.meter__fill--high { background: var(--crimson); }
.item { padding: 14px 16px; border: 1px solid var(--line-soft); border-radius: 14px; background: var(--bg-2); }
.item + .item { margin-top: 8px; }
.item--tappable { width: 100%; text-align: left; transition: border-color .3s var(--ease); }
.item--tappable:hover { border-color: var(--line); }
.item__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.item__title { font: 700 18px/1.25 var(--serif); overflow-wrap: anywhere; }
.item__meta { margin-top: 4px; font-size: 13px; line-height: 1.5; color: var(--muted); overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 8px 12px; border: 1px solid var(--line-soft); border-radius: 999px; font: 500 12px/1.2 var(--sans); letter-spacing: .04em; color: var(--muted); transition: border-color .3s var(--ease), color .3s var(--ease); }
.chip[aria-pressed="true"] { border-color: var(--gold); color: var(--ink); }
.acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.mini { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; font: 500 11px/1.2 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--ink); transition: border-color .3s var(--ease); }
.mini:hover { border-color: var(--gold); }
.mini--red { border-color: rgba(192, 18, 46, .55); color: #f0a4b0; }
.mini--red:hover { border-color: var(--crimson); }
.mini[disabled] { opacity: .45; }
.stepper { display: inline-flex; align-items: center; gap: 14px; }
.stepper__btn { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 999px; font: 400 24px/1 var(--serif); color: var(--ink); }
.stepper__btn[disabled] { opacity: .35; }
.stepper__value { min-width: 36px; text-align: center; font: 700 24px/1 var(--serif); font-variant-numeric: lining-nums; }
/* число можно вписать руками (сколько приглашений выписать): поле без рамки, с чертой снизу */
input.stepper__value { width: 92px; padding: 4px 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; color: var(--ink); -moz-appearance: textfield; appearance: textfield; }
input.stepper__value::-webkit-outer-spin-button, input.stepper__value::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input.stepper__value:focus { border-bottom-color: var(--gold); outline: none; }
.mono { font: 400 14px/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .04em; overflow-wrap: anywhere; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; font-size: 13px; color: var(--muted); }
.kv dd .muted { font-size: 12px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
