*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: clip; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--p-ground); color: var(--p-ink); font: 400 16px/1.45 var(--p-face); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, ul, ol, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }
h1, h2, .big, .num { font-family: var(--p-display); font-weight: var(--p-display-w); }
h1 { font-size: clamp(1.6rem, 1.3rem + 1.2vw, 2rem); line-height: 1.15; text-wrap: balance; }
h2 { font-size: 1.1rem; line-height: 1.25; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
svg.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--p-accent); outline-offset: 2px; }

/* Shell */
.shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100dvh; }
.side { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 2px; padding: 20px 14px; background: var(--p-side); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 20px; font-family: var(--p-display); font-weight: var(--p-display-w); text-decoration: none; }
.brand img { width: 32px; height: 32px; border-radius: 10px; object-fit: cover; }
.nav { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; color: var(--p-muted); font-weight: 600; text-decoration: none; transition: color .15s, background .15s; }
.nav:hover { color: var(--p-ink); }
.nav { position: relative; z-index: 1; transition: color .2s ease-out; }
.nav[aria-current="page"] { color: var(--p-ink); }
.nav-pill { position: absolute; left: 0; top: 0; border-radius: 12px; background: var(--p-raise); opacity: 0; pointer-events: none; transition: translate .42s cubic-bezier(.3, 1.3, .5, 1), width .3s ease-out, height .3s ease-out, opacity .2s; }
.nav[aria-current="page"] svg { color: var(--p-accent); }
.nav .short { display: none; }
.out { display: flex; align-items: center; gap: 12px; margin-top: auto; padding: 11px 12px; border: 0; border-radius: 12px; background: none; color: var(--p-muted); font-weight: 600; cursor: pointer; }
.out:hover { color: var(--p-ink); }
main { width: 100%; max-width: 1040px; margin: 0 auto; padding: 32px clamp(16px, 3vw, 40px) 64px; min-width: 0; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.head p { color: var(--p-muted); margin-top: 4px; }
.head img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }

/* Grid and cards */
.grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.card { position: relative; display: block; padding: 20px; border-radius: 22px; background: var(--p-panel); box-shadow: inset 0 0 0 1px var(--p-line); min-width: 0; text-decoration: none; }
a.card { transition: transform .15s ease-out; }
a.card:hover { transform: translateY(-2px); }
.card .go { position: absolute; right: 18px; top: 20px; color: var(--p-muted); }
.card > h2 { margin-bottom: 10px; }
.label { font-size: 14px; font-weight: 600; color: var(--p-muted); }
.muted { color: var(--p-muted); }
.small { font-size: 14px; }
.stack > * + * { margin-top: 12px; }
.big { font-size: 56px; line-height: 1; }
.num { font-size: 30px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.num small { font-family: var(--p-face); font-size: 15px; font-weight: 600; color: var(--p-muted); }
.tag { display: inline-flex; align-items: center; padding: 3px 11px; border-radius: 999px; background: var(--p-raise); font-size: 13px; font-weight: 600; white-space: nowrap; }
.tag.good { background: var(--p-accent-soft); color: var(--p-accent-ink); }
.tag.bad { background: var(--p-bad-soft); color: var(--p-bad); }
.bar { height: 8px; border-radius: 4px; background: var(--p-raise); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 4px; background: var(--p-accent); transform-origin: 0 50%; }

/* Subscription ticket */
.ticket { padding: 0; overflow: hidden; }
.ticket .top { padding: 22px 22px 18px; }
.t-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.t-head b { display: block; font-family: var(--p-display); font-weight: var(--p-display-w); font-size: 1.15rem; line-height: 1.2; }
.days { display: flex; align-items: flex-end; gap: 12px; margin-top: 20px; }
.days .big { padding: 6px 14px; border-radius: 16px; background: var(--p-accent); color: var(--p-on-accent); font-variant-numeric: tabular-nums; }
.days.off .big { background: var(--p-bad); color: var(--p-on-bad); }
.days span { padding-bottom: 6px; font-weight: 600; color: var(--p-muted); }
.pips { display: flex; gap: 3px; margin-top: 18px; }
.pips i { flex: 1; height: 10px; border-radius: 3px; background: var(--p-raise); }
.pips i.on { background: var(--p-accent); }
.t-meta { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; font-size: 13px; font-weight: 600; color: var(--p-muted); }
.t-stats { display: flex; flex-wrap: wrap; gap: 8px 28px; margin-top: 16px; }
.t-stats b { display: block; font-variant-numeric: tabular-nums; }
.t-stats span { font-size: 13px; color: var(--p-muted); }
.tear { position: relative; height: 0; border-top: 2px dashed var(--p-line-strong); }
.tear::before, .tear::after { content: ""; position: absolute; top: -10px; width: 18px; height: 18px; border-radius: 50%; background: var(--p-ground); box-shadow: inset 0 0 0 1px var(--p-line); }
.tear::before { left: -9px; } .tear::after { right: -9px; }
.ticket .bottom { padding: 18px 22px 22px; }

/* Buttons and fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 22px; border: 0; border-radius: 16px; background: var(--p-accent); color: var(--p-on-accent); font-weight: 700; text-decoration: none; cursor: pointer; transition: transform .12s ease-out, filter .12s; }
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .5; cursor: default; }
.btn.wide { width: 100%; }
.btn.ghost { background: var(--p-raise); color: var(--p-ink); box-shadow: inset 0 0 0 1px var(--p-line); }
.btn.danger { background: var(--p-bad); color: var(--p-on-bad); }
.btn.tg { background: var(--p-tg); color: #fff; }
.btn.sm { min-height: 40px; padding: 0 14px; border-radius: 12px; font-size: 14px; }
.field { display: block; margin-bottom: 12px; }
.field span { display: block; margin-bottom: 4px; font-size: 14px; color: var(--p-muted); }
input, textarea, select { width: 100%; min-height: 52px; padding: 12px 16px; border: 0; border-radius: 16px; background: var(--p-panel); box-shadow: inset 0 0 0 1px var(--p-line); font-size: 16px; }
input::placeholder { color: var(--p-muted); }
textarea { min-height: 140px; resize: vertical; }
.linkbtn { border: 0; padding: 0; background: none; color: var(--p-accent-ink); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--p-raise); }
.seg button { padding: 8px 16px; border: 0; border-radius: 999px; background: none; color: var(--p-muted); font-weight: 600; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--p-ink); color: var(--p-ground); }

/* Login */
.login { display: grid; place-items: center; min-height: 100dvh; padding: 24px 16px; }
.login-in { width: min(100%, 460px); }
.login-in .logo { width: 72px; height: 72px; border-radius: 22px; object-fit: cover; }
.login-in h1 { margin-top: 20px; font-size: clamp(2rem, 1.6rem + 1.6vw, 2.5rem); }
.login-in .sub { margin: 6px 0 26px; color: var(--p-muted); font-size: 1.1rem; text-wrap: pretty; }
.center { text-align: center; }
.hint { margin-top: 10px; font-size: 15px; color: var(--p-muted); text-align: center; text-wrap: pretty; }
.or { display: flex; align-items: center; gap: 14px; margin: 22px 0 16px; font-size: 14px; font-weight: 600; color: var(--p-muted); }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--p-line); }
.login-in input { margin-bottom: 10px; }
.login-in .btn + .btn { margin-top: 10px; }
.legal { margin-top: 22px; font-size: 14px; color: var(--p-muted); text-align: center; text-wrap: pretty; }
.err { margin-top: 8px; color: var(--p-bad); font-size: 14px; font-weight: 600; }

/* Device slots */
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.slot { display: flex; flex-direction: column; justify-content: center; gap: 4px; min-height: 112px; padding: 12px; border-radius: 16px; background: var(--p-raise); }
.slot b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot.free { align-items: center; background: none; box-shadow: inset 0 0 0 2px var(--p-line); color: var(--p-muted); text-align: center; text-decoration: none; }
.slot .btn { margin-top: 4px; }
.seats { display: flex; gap: 6px; margin-top: 12px; }
.seats i { flex: 1; height: 8px; border-radius: 4px; background: var(--p-raise); }
.seats i.on { background: var(--p-accent); }

/* Plans */
.plan { display: flex; align-items: center; gap: 14px; padding: 16px; margin-bottom: 10px; border-radius: 18px; box-shadow: inset 0 0 0 1px var(--p-line); cursor: pointer; transition: background .15s; }
.plan:last-child { margin-bottom: 0; }
.plan input { position: absolute; opacity: 0; width: 1px; min-height: 0; padding: 0; }
.plan .dot { flex: none; width: 24px; height: 24px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--p-line-strong); }
.plan b { font-family: var(--p-display); font-weight: var(--p-display-w); }
.plan .r { margin-left: auto; text-align: right; font-variant-numeric: tabular-nums; }
.plan:has(input:checked) { background: var(--p-accent-soft); box-shadow: inset 0 0 0 2px var(--p-accent); }
.plan:has(input:checked) .dot { background: var(--p-accent); box-shadow: inset 0 0 0 6px var(--p-accent), inset 0 0 0 12px var(--p-on-accent); }
.plan:has(input:focus-visible) { outline: 2px solid var(--p-accent); outline-offset: 2px; }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 8px 0; font-variant-numeric: tabular-nums; }
.paybar { display: flex; align-items: center; justify-content: space-between; gap: 14px; }

/* Lists */
.list { padding: 6px; }
.item { display: flex; align-items: center; gap: 14px; width: 100%; padding: 13px 12px; border: 0; border-radius: 14px; background: none; text-align: left; text-decoration: none; cursor: pointer; }
.item:hover { background: var(--p-raise); }
.item .ic { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--p-raise); }
.item b { display: block; font-weight: 600; }
.item span span { font-size: 14px; color: var(--p-muted); }
.item > svg { margin-left: auto; color: var(--p-muted); }
.item.bad b { color: var(--p-bad); }
.topic { display: flex; flex-direction: column; gap: 14px; min-height: 104px; padding: 16px; border: 0; border-radius: 18px; background: var(--p-panel); box-shadow: inset 0 0 0 1px var(--p-line); text-align: left; font-weight: 700; cursor: pointer; }
.topic svg { color: var(--p-accent-ink); }
details { border-radius: 16px; background: var(--p-panel); box-shadow: inset 0 0 0 1px var(--p-line); margin-bottom: 8px; }
summary { display: flex; justify-content: space-between; gap: 12px; padding: 15px 16px; font-weight: 700; cursor: pointer; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "›"; color: var(--p-muted); transition: transform .15s; }
details[open] summary::after { transform: rotate(90deg); }
details p { padding: 0 16px 16px; color: var(--p-muted); text-wrap: pretty; }

.link { padding: 12px 14px; border-radius: 14px; background: var(--p-raise); overflow-wrap: anywhere; font-size: 14px; }
.qr { width: 220px; max-width: 100%; margin: 0 auto; padding: 14px; border-radius: 18px; background: #FFFFFF; }
.qr svg { display: block; width: 100%; height: auto; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 32px 20px; text-align: center; }
.empty .ic { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: var(--p-raise); color: var(--p-accent-ink); }
.empty .btn { margin-top: 8px; }
table { width: 100%; border-collapse: collapse; }
th { padding: 8px; text-align: left; font-size: 14px; font-weight: 600; color: var(--p-muted); white-space: nowrap; }
td { padding: 10px 8px; border-top: 1px solid var(--p-line); vertical-align: middle; }
td.r, th.r { text-align: right; white-space: nowrap; }
td .tag { white-space: nowrap; }
.scroll { overflow-x: auto; }
/* Grid used by the admin pages */
.a-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; }
.c12 { grid-column: span 12; } .c6 { grid-column: span 6; } .c3 { grid-column: span 3; }

dialog { width: min(92vw, 420px); padding: 22px; border: 0; border-radius: 22px; background: var(--p-panel); color: var(--p-ink); box-shadow: 0 20px 60px rgb(0 0 0 / .4); }
dialog::backdrop { background: var(--p-scrim); }
dialog menu { display: flex; gap: 8px; justify-content: flex-end; margin: 16px 0 0; padding: 0; }
.toast { position: fixed; z-index: 30; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translateX(-50%); padding: 10px 16px; border-radius: 12px; background: var(--p-ink); color: var(--p-ground); font-weight: 600; white-space: nowrap; }

@media (max-width: 860px) {
  .shell { display: block; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .side { position: fixed; z-index: 20; inset: auto 0 0; height: auto; flex-direction: row; gap: 0; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); box-shadow: inset 0 1px 0 var(--p-line); }
  #page { padding-bottom: 104px; }
  .side .brand, .side .out, .nav.more { display: none; }
  .nav { flex: 1 1 0; min-width: 0; flex-direction: column; gap: 3px; padding: 6px 0; font-size: 11px; line-height: 1.2; white-space: nowrap; }
  main { padding: 20px 16px 32px; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .big { font-size: 48px; }
  .paybar { position: fixed; z-index: 15; left: 8px; right: 8px; bottom: calc(68px + env(safe-area-inset-bottom)); border-radius: 18px; box-shadow: inset 0 0 0 1px var(--p-line), 0 10px 30px rgb(0 0 0 / .3); }
  .plans-page { padding-bottom: 96px; }
  .c6 { grid-column: span 12; }
  .c3 { grid-column: span 6; }
  .hide-s { display: none; }
}
@media (prefers-reduced-motion: reduce) { .btn, a.card, .nav, .plan, summary::after { transition: none; } }

.tg .out { display: none; }

#total { font-variant-numeric: tabular-nums; }
#page { display: grid; align-items: start; overflow-x: clip; }
.pg { grid-area: 1 / 1; min-width: 0; }
.pg.wait { visibility: hidden; pointer-events: none; }
.pms { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 10px; }
.pm { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px 10px; border: 0; border-radius: 16px; background: var(--p-raise); color: var(--p-ink); font: 600 13px/1.2 var(--p-face); cursor: pointer; box-shadow: inset 0 0 0 2px transparent; transition: box-shadow .18s ease-out, transform .15s ease-out; }
.pm:active { transform: scale(.96); }
.pm[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--p-accent); }
.pm.off { opacity: .45; cursor: default; }
.pm img { width: 30px; height: 30px; border-radius: 9px; }
@media (max-width: 860px) {
  .side { left: 50%; right: auto; bottom: calc(12px + env(safe-area-inset-bottom) + var(--tg-safe-bottom, 0px)); width: min(340px, calc(100% - 32px)); padding: 6px; border: 0; border-radius: 999px; background: color-mix(in srgb, var(--p-panel) 58%, transparent); -webkit-backdrop-filter: blur(18px) saturate(170%); backdrop-filter: blur(18px) saturate(170%); box-shadow: inset 0 1px 0 rgb(255 255 255 / .22), inset 0 -1px 0 rgb(255 255 255 / .08), 0 14px 34px rgb(0 0 0 / .35); transform: translateX(-50%); }
  .nav { height: 52px; justify-content: center; padding: 0; }
  .nav > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .nav svg { width: 24px; height: 24px; }
  .nav[aria-current="page"], .nav[aria-current="page"] svg { color: var(--p-accent); }
  .nav-pill { border-radius: 50%; background: color-mix(in srgb, var(--p-accent) 16%, transparent); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--p-accent) 55%, transparent), 0 0 20px color-mix(in srgb, var(--p-accent) 45%, transparent); }
  #page { padding-bottom: calc(112px + var(--tg-safe-bottom, 0px)); }
}
.tg, .tg body { overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
.tg #page { padding-top: calc(12px + var(--tg-content-top, 0px)); }
.tg .side .out, .tg .side .brand { display: none; }
.tg .nav:focus-visible { outline: none; }

.head.mine { position: relative; justify-content: flex-start; min-height: 112px; padding-right: 116px; margin-bottom: 10px; }
.mascot-box { position: absolute; right: 0; bottom: -16px; width: 112px; height: 140px; pointer-events: none; }
.mascot-box img { display: block; width: 100%; height: 100%; }
.whose { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-weight: 600; color: var(--p-muted); }
.whose img { border-radius: 50%; }
.head.mine + * { position: relative; z-index: 1; }
.head.mine img.avatar, .head.mine > img:not(.mascot) { display: none; }
.c-all { grid-column: 1 / -1; }
.row-h { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 96px; margin: 14px 0 10px; }
.bars i { flex: 1 1 0; min-width: 0; height: 100%; border-radius: 4px 4px 0 0; background: var(--p-accent); transform-origin: bottom; }
.share { display: flex; flex-wrap: wrap; gap: 8px; }
.share a { flex: 1 1 auto; text-align: center; }
.steps { display: grid; gap: 8px; padding-left: 20px; list-style: decimal; }
.amount { display: flex; align-items: baseline; justify-content: center; gap: 8px; margin: 16px 0 4px; }
.amount input { width: 5ch; border: 0; outline: 0; background: none; color: inherit; font: inherit; font-size: 2rem; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.amount span { color: var(--p-muted); font-weight: 600; }
.shares { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.sh { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border-radius: 16px; background: var(--p-raise); color: inherit; font-size: 13px; font-weight: 600; text-decoration: none; transition: transform .15s ease-out; }
.sh:active { transform: scale(.97); }
.sh span { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; }
.sh svg { width: 22px; height: 22px; }
