:root {
  --bg: #e9eef2; --surface: #fff; --ink: #16202b; --muted: #5b6b7a; --line: #c9d3dc;
  --accent: #2f4bff; --on-accent: #fff; --warn: #ffb020; --warn-ink: #3a2600; --danger: #c4332b;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141a; --surface: #172029; --ink: #e8eef3; --muted: #8fa0b0; --line: #2b3946;
    --accent: #8196ff; --on-accent: #0f141a; --warn: #ffc24d; --warn-ink: #2a1b00; --danger: #ff7a70;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 "Avenir Next", "Segoe UI", system-ui, sans-serif; }
h1, h2 { margin: 0; line-height: 1.15; letter-spacing: -0.02em; }
h1 { font-size: 2rem; font-weight: 700; }
h2 { font-size: 1.25rem; margin-bottom: 16px; }
.muted { color: var(--muted); margin: 4px 0 0; }
.err { color: var(--danger); min-height: 1.4em; margin: 8px 0; font-size: .9rem; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 36px 20px 80px; }
.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.end { margin-top: 8px; }
.grow { flex: 1; }

.btn { font: inherit; font-weight: 600; border: 1px solid transparent; border-radius: 10px; padding: 9px 16px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--line); }
.btn.small { padding: 6px 12px; font-size: .9rem; background: var(--accent); color: var(--on-accent); }
.btn:hover { filter: brightness(1.08); }
.link { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 8px 0; margin-top: 4px; }
.icon-btn { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 10px; width: 34px; height: 34px; cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover { color: var(--ink); }
svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

input, select { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; width: 100%; margin-top: 4px; }
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 12px; }

.tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 24px; }
.tools input { max-width: 260px; margin: 0; background: var(--surface); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font: inherit; font-size: .9rem; background: transparent; color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 5px 14px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 18px; }

/* карточка-«билет» с перфорацией */
.card { --c: var(--accent); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: inset 6px 0 0 var(--c); display: flex; flex-direction: column; }
.card-top { padding: 18px 18px 16px 24px; display: flex; gap: 12px; align-items: center; }
.ava { position: relative; flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; font-size: 1.15rem; background: color-mix(in srgb, var(--c) 20%, var(--surface)); overflow: hidden; }
.ava img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: var(--surface); padding: 8px; border-radius: 12px; }
.name { font-weight: 650; font-size: 1.05rem; overflow-wrap: anywhere; }
.price { color: var(--muted); font-variant-numeric: tabular-nums; }
.perf { position: relative; height: 0; border-top: 2px dashed var(--line); margin: 0 16px; }
.perf::before, .perf::after { content: ""; position: absolute; top: -10px; width: 20px; height: 20px; border-radius: 50%; background: var(--bg); border: 1px solid var(--line); }
.perf::before { left: -27px; clip-path: inset(0 0 0 50%); }
.perf::after { right: -27px; clip-path: inset(0 50% 0 0); }
.card-bot { padding: 14px 14px 14px 24px; display: flex; align-items: center; gap: 8px; justify-content: space-between; min-height: 62px; }
.when { font-size: .9rem; min-width: 0; }
.when b { display: block; font-variant-numeric: tabular-nums; }
.when span { color: var(--muted); font-size: .82rem; }
.soon b { background: var(--warn); color: var(--warn-ink); display: inline-block; padding: 1px 8px; border-radius: 6px; }
.tag { color: var(--muted); font-size: .8rem; padding: 0 24px 12px; margin-top: -4px; }
.btns { display: flex; gap: 6px; flex: none; }

.empty { text-align: center; padding: 64px 16px; color: var(--muted); }
.empty .btn { margin-top: 8px; }

.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.panel { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px; }
.panel h1 { margin-bottom: 4px; }
.panel .muted { margin-bottom: 20px; }
.panel .btn { width: 100%; justify-content: center; }

dialog { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); width: min(520px, calc(100vw - 24px)); padding: 24px; }
dialog::backdrop { background: rgb(8 12 18 / .55); }
.trio { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 10px; }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .trio, .duo { grid-template-columns: 1fr; } h1 { font-size: 1.6rem; } }
