/* «Пророчица» — тёмный кабинет. Ни одного цвета вне токенов. Тема одна, тёмная, по решению владельца. */
:root {
  --bg: #14121a;
  --bg-2: #1b1824;
  --bg-3: #241f30;
  --bg-4: #2c2639;
  --line: #2f2a3d;
  --line-2: #3f384f;
  --ink: #ece4d3;
  --ink-2: #bcb19c;
  --ink-3: #9c927f;          /* 4.6:1 на --bg-2 */
  --gold: #c9a45c;
  --gold-2: #e2c27a;
  --gold-dim: rgba(201, 164, 92, .16);
  --gold-ring: rgba(201, 164, 92, .28);
  --parch: #e7d9b8;
  --violet: #8b74c9;
  --violet-2: #c3b4ee;
  --violet-dim: rgba(139, 116, 201, .18);
  --ok: #8fc79a;
  --danger: #e08a8a;
  --danger-dim: rgba(201, 106, 106, .14);
  --wands: #d4844a;
  --cups: #6f9bd0;
  --swords: #a7b0c4;
  --pentacles: #8db378;
  --major: #c9a45c;
  --serif: "Cormorant Garamond", "Georgia", "Times New Roman", serif;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 12px;
  --r-lg: 18px;
  --shadow: 0 12px 34px rgba(6, 4, 12, .45);
  --shadow-sm: 0 4px 14px rgba(6, 4, 12, .35);
  --sidebar: 236px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in: cubic-bezier(.7, 0, .84, 0);
  --t-fast: 150ms;
  --t: 220ms;
  --t-slow: 380ms;
  --z-sticky: 20; --z-tabbar: 40; --z-modal: 50; --z-toast: 60;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  touch-action: manipulation;
}
a { color: var(--gold-2); text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.12; margin: 0; letter-spacing: -.005em; }
h1 { font-size: 36px; }
h2 { font-size: 27px; }
h3 { font-size: 21px; }
p { margin: 0 0 .8em; }
small, .muted { color: var(--ink-2); }
.dim { color: var(--ink-3); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: var(--gold-dim); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; padding: 8px 12px; background: var(--gold); color: #1c150a; border-radius: 8px; font-weight: 700; }
.skip:focus { left: 8px; }
svg.ic { width: 20px; height: 20px; flex: none; display: inline-block; vertical-align: -4px; }
svg.ic.sm { width: 16px; height: 16px; vertical-align: -3px; }
svg.ic.lg { width: 28px; height: 28px; }

/* --- каркас --- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100dvh; }
.app.no-chrome { grid-template-columns: 1fr; }
.app.no-chrome .main { padding: 0; max-width: none; }
.sidebar {
  position: sticky; top: 0; height: 100dvh; padding: 22px 14px calc(16px + var(--safe-b));
  background: var(--bg-2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 22px;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); padding: 4px 8px; border-radius: 10px; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: url(/img/icon.svg) center/cover; box-shadow: 0 0 0 1px var(--line-2); flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text b { font-family: var(--serif); font-size: 22px; font-weight: 600; }
.brand-text small { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a, .tabbar a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; min-height: 44px; border-radius: 10px;
  color: var(--ink-2); font-weight: 500; transition: background var(--t-fast), color var(--t-fast);
}
.nav a:hover { background: var(--bg-3); color: var(--ink); }
.nav a.active { background: var(--gold-dim); color: var(--gold-2); }
.nav a.nav-primary { margin: 6px 0 10px; background: var(--gold); color: #1c150a; font-weight: 700; }
.nav a.nav-primary:hover { background: var(--gold-2); }
.nav a.nav-primary:active { transform: translateY(1px); }
.sidebar-foot { margin-top: auto; font-size: 13px; color: var(--ink-2); }
.sidebar-foot .plan { display: inline-block; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line-2); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); }
.sidebar-foot .plan.pro { border-color: var(--gold); color: var(--gold-2); }
.main { min-width: 0; padding: 28px 36px calc(36px + var(--safe-b)); max-width: 1180px; width: 100%; outline: none; }
.main.view-anim { animation: view-in var(--t-slow) var(--ease-out) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } }
.tabbar { display: none; }

/* --- общие элементы --- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .sub { color: var(--ink-2); margin-top: 4px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; min-height: 44px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg-3);
  color: var(--ink); font-weight: 600; cursor: pointer; white-space: nowrap; line-height: 1.2;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}
.btn:hover { background: var(--bg-4); border-color: var(--ink-3); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn.primary { background: var(--gold); border-color: var(--gold); color: #1c150a; }
.btn.primary:hover { background: var(--gold-2); border-color: var(--gold-2); box-shadow: 0 6px 18px rgba(201,164,92,.25); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--bg-3); color: var(--ink); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-dim); border-color: var(--danger); }
.btn.sm { padding: 6px 11px; min-height: 36px; font-size: 13px; border-radius: 8px; }
.btn.icon { padding: 0; width: 44px; }
.btn.icon.sm { width: 36px; }
.btn.lg { padding: 14px 22px; min-height: 52px; font-size: 16px; }
.btn.block { width: 100%; }
.btn .spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.field .err { display: none; font-size: 12.5px; color: var(--danger); }
.field.invalid .input { border-color: var(--danger); }
.field.invalid .err { display: block; }
.input, textarea.input, select.input {
  width: 100%; padding: 11px 13px; min-height: 46px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg);
  color: var(--ink); outline: none; transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input::placeholder { color: var(--ink-3); }
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-ring); }
.input:focus-visible { outline: none; }
textarea.input { min-height: 110px; resize: vertical; line-height: 1.55; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 48px; }
.pw-wrap .pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; display: grid; place-items: center; border: 0; background: none; color: var(--ink-3); border-radius: 8px; }
.pw-wrap .pw-toggle:hover { color: var(--ink); background: var(--bg-3); }
.hint { font-size: 12.5px; color: var(--ink-3); }
.card-box { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; }
.card-box + .card-box { margin-top: 16px; }
.card-box h3 { margin-bottom: 12px; }
.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.tile {
  display: block; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px;
  color: var(--ink); transition: border-color var(--t-fast), transform var(--t), box-shadow var(--t); cursor: pointer;
}
.tile:hover { border-color: var(--gold); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.tile:active { transform: scale(.985); }
.tile h3 { margin-bottom: 4px; }
.tile .meta { font-size: 13px; color: var(--ink-2); }
.tile.locked { opacity: .65; }
.tile.locked h3 .pro-tag { font: 700 10px var(--sans); letter-spacing: .08em; color: var(--gold-2); vertical-align: middle; border: 1px solid var(--gold); border-radius: 99px; padding: 2px 7px; margin-left: 8px; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; background: var(--bg-3); border: 1px solid var(--line-2); font-size: 12px; color: var(--ink-2); }
.list { display: flex; flex-direction: column; gap: 8px; }
.list-item {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px; min-height: 56px; border-radius: var(--r); background: var(--bg-2);
  border: 1px solid var(--line); color: var(--ink); cursor: pointer; transition: border-color var(--t-fast), background var(--t-fast);
}
.list-item:hover { border-color: var(--line-2); background: var(--bg-3); }
.list-item:active { background: var(--bg-4); }
.list-item .t { font-weight: 600; }
.list-item .s { font-size: 13px; color: var(--ink-2); }
.list-item .chev { color: var(--ink-3); margin-left: auto; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--violet-dim); color: var(--violet-2); font-family: var(--serif); font-size: 19px; font-weight: 600; flex: none; }
.empty { text-align: center; padding: 44px 20px; color: var(--ink-2); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .ic { width: 40px; height: 40px; color: var(--ink-3); }
.empty b { color: var(--ink); font-family: var(--serif); font-size: 20px; font-weight: 600; }
.empty p { max-width: 36ch; margin: 0; font-size: 14px; }
.sep { height: 1px; background: var(--line); margin: 18px 0; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 10px 14px; min-height: 44px; color: var(--ink-2); font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; transition: color var(--t-fast), border-color var(--t-fast); }
.tabs button.active { color: var(--gold-2); border-bottom-color: var(--gold); }
.search { position: relative; }
.search .input { padding-left: 40px; }
.search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 6px 12px; min-height: 36px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--ink-2); cursor: pointer; font-size: 13px; font-weight: 600; transition: border-color var(--t-fast), color var(--t-fast), background var(--t-fast); }
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip.active { border-color: var(--gold); color: var(--gold-2); background: var(--gold-dim); }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; min-height: 44px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch i { width: 40px; height: 24px; border-radius: 99px; background: var(--line-2); position: relative; transition: background var(--t-fast); flex: none; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--ink); transition: transform var(--t) var(--ease-out); }
.switch input:checked + i { background: var(--gold); }
.switch input:checked + i::after { transform: translateX(16px); }
.switch input:focus-visible + i { outline: 2px solid var(--gold); outline-offset: 2px; }
.steps { display: flex; gap: 6px; margin-bottom: 20px; }
.steps span { flex: 1; height: 3px; border-radius: 99px; background: var(--line); transition: background var(--t); }
.steps span.done { background: var(--gold); }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); background: var(--gold-dim); border: 1px solid var(--gold); color: var(--gold-2); font-size: 14px; }
.notice .ic { flex: none; margin-top: 1px; }
.notice.violet { background: var(--violet-dim); border-color: var(--violet); color: var(--violet-2); }
.notice.danger { background: var(--danger-dim); border-color: var(--danger); color: var(--danger); }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat b { font-family: var(--serif); font-size: 30px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12.5px; color: var(--ink-2); }
.pre { white-space: pre-wrap; line-height: 1.6; }

/* --- скелетоны --- */
.sk { position: relative; overflow: hidden; background: var(--bg-3); border-radius: 8px; }
.sk::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.05), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.sk-line { height: 14px; margin-bottom: 10px; }
.sk-title { height: 30px; width: 40%; margin-bottom: 18px; }
.sk-box { height: 120px; border-radius: var(--r-lg); margin-bottom: 14px; }

/* --- карта --- */
.tcard {
  position: relative; aspect-ratio: 5 / 8.6; border-radius: 8px; overflow: hidden;
  background: linear-gradient(160deg, #2a2438, #171420); border: 1px solid var(--line-2);
  box-shadow: 0 4px 14px rgba(0,0,0,.35); transition: transform var(--t-slow) var(--ease-out);
  user-select: none; container-type: inline-size;
}
.tcard img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.tcard.reversed { transform: rotate(180deg); }
.tcard .face { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 8% 7%; text-align: center; }
.tcard .face .num { font-family: var(--serif); font-size: clamp(11px, 2.6cqw, 16px); color: var(--ink-2); letter-spacing: .1em; }
.tcard .face .sym { font-size: clamp(28px, 30cqw, 84px); line-height: 1; }
.tcard .face .nm { font-family: var(--serif); font-size: clamp(11px, 11cqw, 20px); font-weight: 600; line-height: 1.1; color: var(--ink); }
.tcard.s-major .sym { color: var(--major); }
.tcard.s-wands .sym { color: var(--wands); }
.tcard.s-cups .sym { color: var(--cups); }
.tcard.s-swords .sym { color: var(--swords); }
.tcard.s-pentacles .sym { color: var(--pentacles); }
.tcard.back { background: radial-gradient(circle at 50% 50%, #2c2540 0, #1a1626 70%); }
.tcard.back::before { content: ""; position: absolute; inset: 7%; border: 1px solid var(--gold); border-radius: 5px; opacity: .7; }
.tcard.back::after { content: ""; position: absolute; inset: 30%; background: url(/img/icon.svg) center/contain no-repeat; opacity: .55; }
.tcard.empty-slot { background: transparent; border: 1px dashed var(--line-2); box-shadow: none; }
.tcard.empty-slot::after { content: attr(data-n); position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-3); font-family: var(--serif); font-size: 30cqw; }
/* переворот при открытии: причинно-следственное движение «касание → карта открывается» */
.flip { perspective: 900px; }
.flip .tcard { backface-visibility: hidden; }
.flip.reveal .tcard { animation: flip-in var(--t-slow) var(--ease-out) both; }
@keyframes flip-in { from { transform: rotateY(90deg); opacity: .4; } }
.flip.reveal .tcard.reversed { animation-name: flip-in-rev; }
@keyframes flip-in-rev { from { transform: rotate(180deg) rotateY(90deg); opacity: .4; } to { transform: rotate(180deg); } }

/* --- стол расклада --- */
.table {
  position: relative; width: 100%; aspect-ratio: 16 / 10; border-radius: var(--r-lg);
  background: radial-gradient(ellipse at 50% 40%, #1f1a2b 0, #14121a 75%); border: 1px solid var(--line);
  overflow: hidden;
}
.table .slot { position: absolute; width: 14%; transform: translate(-50%, -50%); cursor: pointer; }
.table .slot.rot { transform: translate(-50%, -50%) rotate(90deg); }
.table .slot .lbl {
  position: absolute; left: 50%; top: 100%; transform: translateX(-50%); margin-top: 6px; white-space: nowrap;
  font-size: 11px; color: var(--ink-2); background: rgba(20,18,26,.85); padding: 2px 7px; border-radius: 99px; max-width: 160%; overflow: hidden; text-overflow: ellipsis;
}
.table .slot.rot .lbl { transform: translateX(-50%) rotate(-90deg); transform-origin: top center; left: 190%; top: 35%; }
.table .slot.active .tcard { outline: 2px solid var(--gold); outline-offset: 2px; }
.table.tall { aspect-ratio: 4 / 5; max-width: 600px; margin-inline: auto; }
.table.tall.compact { max-width: 720px; }
.table.tall .slot { width: 20%; }
.table.tall.compact .slot { width: 12%; }
.table.short { aspect-ratio: 16 / 6.5; }
.table.short .slot { width: 15%; }
.table.compact .slot { width: 12%; }

/* --- расклад: карточки позиций --- */
.pos-list { display: flex; flex-direction: column; gap: 10px; }
.pos-item { display: grid; grid-template-columns: 58px 1fr auto; gap: 14px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg-2); }
.pos-item .tcard { width: 58px; }
.pos-item .pt { font-weight: 600; }
.pos-item .pc { font-size: 13.5px; color: var(--ink-2); }
.pos-item .pc b { color: var(--ink); }

/* --- модалки --- */
.modal-back { position: fixed; inset: 0; background: rgba(8,6,12,.62); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; z-index: var(--z-modal); animation: fade var(--t) both; }
.modal-back.closing { animation: fade-out var(--t-fast) var(--ease-in) both; }
@keyframes fade { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
.modal { width: 100%; max-width: 560px; max-height: calc(100dvh - 32px); overflow: auto; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: 22px; box-shadow: var(--shadow); animation: pop var(--t-slow) var(--ease-out) both; }
@keyframes pop { from { transform: translateY(14px) scale(.97); opacity: 0; } }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.toast-root { position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: var(--z-toast); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 10px; background: var(--bg-3); border: 1px solid var(--line-2); box-shadow: var(--shadow); font-size: 14px; animation: up var(--t) var(--ease-out); max-width: 90vw; transition: opacity var(--t-fast); }
.toast.err { border-color: var(--danger); color: var(--danger); }
.toast.ok { border-color: var(--ok); }
.toast.ok .ic { color: var(--ok); }
@keyframes up { from { transform: translateY(10px); opacity: 0; } }

/* --- выбор карты (пикер) --- */
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; max-height: 52vh; overflow: auto; padding: 2px; }
.picker-grid .pk { cursor: pointer; text-align: center; font-size: 11px; color: var(--ink-2); line-height: 1.2; border-radius: 8px; padding: 2px; transition: transform var(--t-fast); }
.picker-grid .pk:hover { transform: translateY(-2px); }
.picker-grid .pk:hover .tcard { outline: 2px solid var(--gold); }
.picker-grid .pk.used { opacity: .3; pointer-events: none; }
.picker-grid .pk span { display: block; margin-top: 4px; }

/* --- справочник --- */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 14px; }
.cards-grid a { color: var(--ink); text-align: center; font-size: 13px; border-radius: 8px; transition: transform var(--t) var(--ease-out); }
.cards-grid a span { display: block; margin-top: 6px; }
.cards-grid a:hover { transform: translateY(-3px); }
.cards-grid a:hover .tcard { outline: 2px solid var(--gold); }
.card-page { display: grid; grid-template-columns: 260px 1fr; gap: 28px; align-items: start; }
.card-page .tcard { width: 100%; }
.meaning h4 { font-family: var(--sans); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--gold-2); margin: 18px 0 6px; }
.meaning p { color: var(--ink); max-width: 68ch; }
.kw { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 4px; }
.kw span { font-size: 12px; padding: 3px 9px; border-radius: 99px; background: var(--bg-3); border: 1px solid var(--line-2); color: var(--ink-2); }

/* --- конструктор --- */
.builder { display: grid; grid-template-columns: 1fr 320px; gap: 18px; align-items: start; }
.builder .table .slot { cursor: grab; }
.builder .table .slot:active { cursor: grabbing; }
.builder .table .slot.sel .tcard { outline: 2px solid var(--gold); outline-offset: 2px; }
.pos-editor { display: flex; flex-direction: column; gap: 8px; max-height: 520px; overflow: auto; }
.pos-editor .pe { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-2); cursor: pointer; }
.pos-editor .pe.sel { border-color: var(--gold); }
.pos-editor .pe .n { font-family: var(--serif); font-size: 18px; color: var(--gold-2); text-align: center; }
.pos-editor .pe input { border: 0; background: transparent; padding: 6px; min-height: 36px; border-radius: 6px; width: 100%; }
.pos-editor .pe input:focus { background: var(--bg); outline: 1px solid var(--line-2); }

/* --- экспорт-превью --- */
.export-preview { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: 8px; min-height: 200px; }
.export-preview canvas { width: 100%; height: auto; display: block; border-radius: 6px; }

/* --- авторизация --- */
.auth-wrap { min-height: 100dvh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-art { position: relative; overflow: hidden; background: var(--bg-2); border-right: 1px solid var(--line); }
.auth-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 22%; opacity: .6; filter: saturate(.8); }
.auth-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20,18,26,.15) 0%, rgba(20,18,26,.35) 55%, rgba(20,18,26,.97) 100%); }
.auth-art .cap { position: absolute; left: 40px; right: 40px; bottom: 40px; z-index: 1; }
.auth-art .cap h2 { font-size: 34px; margin-bottom: 8px; max-width: 16ch; }
.auth-art .cap p { color: var(--ink-2); max-width: 44ch; margin: 0; }
.auth-side { display: grid; place-items: center; padding: 28px 20px; background: radial-gradient(ellipse at 50% 0%, #241f30 0, var(--bg) 60%); }
.auth { width: 100%; max-width: 420px; animation: view-in var(--t-slow) var(--ease-out) both; }
.auth .brand { justify-content: flex-start; margin-bottom: 26px; padding: 0; }
.auth h1 { font-size: 42px; margin-bottom: 6px; }
.auth .sub { margin-bottom: 24px; }
.auth form { animation: fade var(--t) both; }
.auth .foot { margin-top: 22px; font-size: 14px; }

/* --- стол (главная) --- */
.dash { display: grid; grid-template-columns: 1fr 340px; gap: 18px; align-items: start; }
.day-card { display: grid; grid-template-columns: 120px 1fr; gap: 18px; align-items: center; }
.day-card .tcard { width: 120px; }
.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); gap: 10px; }
.quick a { display: flex; flex-direction: column; gap: 4px; padding: 14px; min-height: 44px; border-radius: var(--r); background: var(--bg-3); border: 1px solid var(--line); color: var(--ink); transition: border-color var(--t-fast), transform var(--t) var(--ease-out); }
.quick a:hover { border-color: var(--gold); transform: translateY(-2px); }
.quick a b { font-family: var(--serif); font-size: 18px; }
.quick a span { font-size: 12px; color: var(--ink-2); }

/* --- печать --- */
@media print {
  body { background: #fff; color: #111; }
  .sidebar, .tabbar, .no-print, .toast-root { display: none !important; }
  .app { display: block; }
  .main { padding: 0; max-width: none; }
  .card-box { border-color: #ddd; background: #fff; }
}

/* --- мобильная --- */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 18px 16px calc(96px + var(--safe-b)); }
  html { scroll-padding-bottom: calc(96px + var(--safe-b)); }
  .input, textarea.input, select.input { font-size: 16px; }   /* iOS не зумит поля */
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0;
    background: rgba(27,24,36,.96); backdrop-filter: blur(10px); border-top: 1px solid var(--line);
    padding: 6px 6px calc(6px + var(--safe-b)); z-index: var(--z-tabbar);
  }
  .tabbar a { flex-direction: column; gap: 3px; padding: 6px 2px; min-height: 52px; font-size: 11px; border-radius: 10px; }
  .tabbar a .ic { width: 22px; height: 22px; }
  .tabbar a.active { color: var(--gold-2); }
  .tabbar a.tab-primary .ic { background: var(--gold); color: #1c150a; border-radius: 50%; width: 44px; height: 44px; padding: 10px; margin-top: -20px; box-shadow: 0 6px 16px rgba(201,164,92,.35); }
  h1 { font-size: 29px; }
  .dash, .builder, .card-page { grid-template-columns: 1fr; }
  .card-page .tcard { width: 180px; margin: 0 auto; }
  .table { aspect-ratio: 4 / 5; }
  .table .slot { width: 22%; }
  .table.short { aspect-ratio: 16 / 10; }
  .table.short .slot { width: 26%; }
  .table.tall .slot { width: 22%; }
  .table.tall.compact .slot { width: 14%; }
  .modal { padding: 18px; }
  .kv { grid-template-columns: 110px 1fr; }
  .pos-item { grid-template-columns: 48px 1fr; }
  .pos-item .tcard { width: 48px; }
  .pos-item > a.btn { display: none; }
  .day-card { grid-template-columns: 96px 1fr; }
  .day-card .tcard { width: 96px; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-art { min-height: 34dvh; border-right: 0; border-bottom: 1px solid var(--line); }
  .auth-art .cap { left: 20px; right: 20px; bottom: 20px; }
  .auth-art .cap h2 { font-size: 26px; }
  .auth-art .cap p { font-size: 14px; }
  .auth h1 { font-size: 34px; }
}

/* --- пониженная анимация --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .tcard { transition: none; }
}
