/* Teleekspert Card Vault. Styl: achromatic ledger (taste-skill, seed 1262737454).
   Twarz: kamienne tło sklepu (#f4f3f1) zamiast #f8f8f8; jedyny odcień (#1d5fbf) na ocenie w płycie karty i na ofercie.
   Siatka: sidebar 240 + canvas z marginesem 40 po bokach; panel = pełna szerokość canvas, jeden odstęp 12. */
:root {
  --ground: #f4f3f1;
  --surface: #ffffff;
  --raised: #eeeeee;
  --active: #e7e5e1;
  --border: #e6e6e6;
  --rule: #f0f0f0;
  --control: #d4d4d4;
  --text: #0a0a0a;
  --muted: #6b6b6b;
  --primary: #141414;
  --primary-ink: #ffffff;
  --hue: #1d5fbf;
  --hue-bg: #e8f0fb;
  --pill-warning-bg: #fffbeb; --pill-warning-ink: #92400e;
  --pill-neutral-bg: #eeeeee; --pill-neutral-ink: #3d3d3d;
  --negative: #c4242a;
  --radius-card: 8px;
  --radius-control: 6px;
  --gap: 12px;
  --pad: 24px;
  --side: 240px;
  --font: "Geist", Inter, system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--text); font: 400 14px/1.5 var(--font); }
a { color: inherit; text-underline-offset: 3px; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--hue); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }
.ink { color: var(--text); }
.id { font-family: var(--mono); font-size: 13px; }

/* ---------- shell: open plane ---------- */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 24px 12px 20px; border-right: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; text-decoration: none; }
.brand .mark { width: 20px; height: 27px; color: var(--text); flex: none; }
.brand b { display: block; font-size: 15px; font-weight: 700; line-height: 1.2; }
.brand small { display: block; font-size: 12px; color: var(--muted); }
.net { display: flex; align-items: center; gap: 8px; margin: 18px 8px 0; font-size: 12px; color: var(--muted); }
.net .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--hue); }
.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 28px; }
.nav a { display: flex; align-items: center; justify-content: space-between; height: 32px; padding: 0 10px; border-radius: var(--radius-control); text-decoration: none; color: #3d3d3d; }
.nav a:hover { background: var(--active); }
.nav a.on { background: var(--active); color: var(--text); font-weight: 500; }
.count { min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--text); color: #fff; font-size: 12px; text-align: center; font-variant-numeric: tabular-nums; }
.side-foot { margin-top: auto; display: grid; gap: 10px; }
.acct { display: grid; gap: 2px; padding: 10px; border-radius: var(--radius-card); background: var(--surface); border: 1px solid var(--border); }
.acct .bal { font-variant-numeric: tabular-nums; color: var(--muted); }
.acct .bal b { color: var(--text); }
.fine { margin: 0 8px; font-size: 12px; color: var(--muted); }
.phonebar { display: none; }

/* ---------- canvas ---------- */
.canvas { padding: 32px 40px 64px; min-width: 0; outline: none; }
#view { display: grid; gap: var(--gap); max-width: 1180px; }
.title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 12px; }
h1 { margin: 0; font-size: 24px; line-height: 1.25; font-weight: 700; letter-spacing: -0.01em; }
h2 { margin: 0; font-size: 16px; font-weight: 500; }
.lede { margin: 6px 0 0; max-width: 70ch; font-size: 15px; }
.crumb { margin: 0 0 4px; color: var(--muted); font-size: 13px; }
.crumb a { color: var(--muted); }
.error { margin: 0; padding: 12px 16px; border-radius: var(--radius-card); background: #ffedea; color: #831c1e; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--surface); text-decoration: none; font-weight: 500; white-space: nowrap; cursor: pointer; transition: background .12s, transform .08s; }
.btn:hover { background: var(--raised); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { background: #333; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.wide { width: 100%; }
input { height: 36px; width: 96px; padding: 0 10px; border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--surface); font-variant-numeric: tabular-nums; text-align: right; }

.pill { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.pill.sale { background: var(--hue-bg); color: var(--hue); }
.pill.neutral { background: var(--pill-neutral-bg); color: var(--pill-neutral-ink); }
.pill.warning { background: var(--pill-warning-bg); color: var(--pill-warning-ink); }

/* ---------- panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 20px var(--pad) 22px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.panel-head .muted, .panel-head a { font-size: 13px; }
.empty { margin: 8px 0 0; color: var(--muted); }
.prose p { margin: 0 0 10px; max-width: 72ch; font-size: 15px; }
.prose p:last-child { margin: 0; }

/* tabela kart */
.cards { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.cards th { padding: 0 12px 10px 0; text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); border-bottom: 1px solid var(--border); }
.cards td { padding: 12px 12px 12px 0; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.cards tr:last-child td { border-bottom: 0; }
.cards tbody tr:hover td { background: #fbfaf8; }
.cards .num { text-align: right; white-space: nowrap; }
.cards .num b { font-size: 16px; }
.cards .num small { color: var(--muted); font-size: 12px; }
.cards .act { width: 1%; text-align: right; padding-right: 0; }
.card-cell { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.card-cell b { display: block; font-weight: 500; font-size: 15px; }
.card-cell small { display: block; color: var(--muted); font-size: 13px; }
.card-cell:hover b { text-decoration: underline; }

/* ---------- płyta z kartą (slab), element własny tego sklepu ---------- */
.slab { --w: 52px; margin: 0; width: var(--w); flex: none; aspect-ratio: 52 / 84; display: grid; grid-template-rows: 22% 1fr; padding: 3px; gap: 3px; border-radius: 5px; background: #dcdad5; }
.slab-label { display: flex; align-items: center; justify-content: center; padding: 0 4px; border-radius: 2px; background: #fff; overflow: hidden; }
.slab-grader { font-size: 8px; font-weight: 700; line-height: 1; }
.slab-grade { font-size: 11px; font-weight: 700; line-height: 1; color: var(--hue); }
.slab-name, .slab-cert { display: none; }
.slab-window { position: relative; border-radius: 2px; background: #c9c6bf; overflow: hidden; display: grid; place-items: center; padding: 8%; }
.slab-window img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card-face { width: 100%; height: 100%; display: grid; grid-template-rows: auto 1fr auto; gap: 4%; padding: 7%; border-radius: 3px; background: #efe7d2; border: 2px solid #d9c690; }
.cf-name { min-height: 3px; background: #d9c690; font-weight: 700; line-height: 1.1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cf-art { background: #d4cbb4; border-radius: 1px; }
.cf-meta { min-height: 2px; width: 60%; background: #d9c690; line-height: 1.1; color: #57503f; overflow: hidden; white-space: nowrap; }
.slab.raw .slab-grader { font-weight: 500; color: var(--muted); }

.slab.big { --w: 100%; max-width: 340px; padding: 10px; gap: 10px; border-radius: 14px; grid-template-rows: auto 1fr; }
.slab.big .slab-label { justify-content: stretch; display: grid; grid-template-columns: 1fr auto; grid-template-areas: "g n" "c n"; align-items: center; row-gap: 2px; padding: 12px 14px; border-radius: 6px; }
.slab.big .slab-grader { grid-area: g; font-size: 15px; }
.slab.big .slab-grade { grid-area: n; font-size: 40px; letter-spacing: -0.02em; }
.slab.big .slab-name { display: none; }
.slab.big .slab-cert { grid-area: c; display: block; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.slab.big .slab-window { border-radius: 6px; padding: 9%; }
.slab.big .card-face { border-width: 6px; border-radius: 10px; padding: 7%; }
.slab.big .cf-name, .slab.big .cf-meta { background: none; width: auto; }
.slab.big .cf-name { font-size: 17px; }
.slab.big .cf-meta { font-size: 12px; }
.slab.big .cf-art { border-radius: 3px; }

/* ---------- karta: szczegóły ---------- */
.detail { display: grid; grid-template-columns: minmax(240px, 340px) 1fr; gap: 40px; align-items: start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 28px; }
.detail-body h1 { font-size: 28px; }
.price-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin: 20px 0 24px; }
.price { font-size: 16px; font-variant-numeric: tabular-nums; }
.price b { font-size: 30px; letter-spacing: -0.01em; }
.facts { display: grid; grid-template-columns: 1fr 1fr; margin: 0; border-top: 1px solid var(--border); }
.facts div { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

/* ---------- moje karty ---------- */
.mine { list-style: none; margin: 0; padding: 0; }
.mine li { display: grid; grid-template-columns: minmax(240px, 1fr) 150px auto; align-items: center; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.mine li:last-child { border-bottom: 0; }
.mine-act { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.list-form { display: flex; align-items: center; gap: 8px; }
.list-form label { display: flex; align-items: center; gap: 6px; color: var(--muted); }

/* ---------- jak to działa ---------- */
.steps { margin: 0; padding-left: 20px; display: grid; gap: 10px; max-width: 80ch; font-size: 15px; }
.steps b { font-weight: 500; }

/* ---------- wybór portfela ---------- */
.dialog-back { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; background: rgba(10,10,10,.35); }
.dialog-back[hidden] { display: none; }
.dialog { width: min(420px, 100%); background: var(--surface); border-radius: 12px; padding: 20px; box-shadow: 0 12px 40px rgba(0,0,0,.2); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.wallet-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.wallet-opt { display: flex; align-items: center; gap: 12px; width: 100%; height: 52px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); font-weight: 500; font-size: 15px; cursor: pointer; text-align: left; }
.wallet-opt:hover { background: var(--raised); }
.wallet-opt img { border-radius: 6px; }
.wallet-ph { width: 28px; height: 28px; border-radius: 6px; background: var(--raised); }
.wallet-none { padding: 12px; border-radius: var(--radius-card); background: var(--raised); }
.dialog .fine { margin: 0; }
.acct-top { display: flex; align-items: center; justify-content: space-between; }
.wname { font-size: 12px; color: var(--muted); }
.link { border: 0; background: none; padding: 0; font-size: 13px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

.dialog.wide { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; }
.cn-steps { margin: 0 0 12px; padding-left: 20px; display: grid; gap: 6px; }
.cn-steps .id { word-break: break-all; }
.cn-frame { display: block; width: 100%; height: 420px; border: 0; margin-bottom: 10px; }
.cn-hint { margin: -12px 0 20px; font-size: 13px; color: var(--muted); }
.cn-link { text-align: left; font-size: 12px; }
#cn-body .error { margin-bottom: 12px; }

.skeleton { height: 56px; margin: 8px 0; border-radius: 6px; background: var(--raised); }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: 420px; padding: 12px 16px; border-radius: var(--radius-card); background: var(--text); color: #fff; font-size: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.18); z-index: 20; }
.toast.bad { background: #831c1e; }

/* ---------- telefon ---------- */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .phonebar { display: flex; position: sticky; top: 0; z-index: 10; height: 48px; align-items: center; justify-content: space-between; padding: 0 16px; background: var(--ground); border-bottom: 1px solid var(--border); }
  .side { display: none; position: fixed; inset: 48px 0 0; height: auto; z-index: 15; background: var(--ground); border-right: 0; }
  body.menu-open .side { display: flex; }
  .canvas { padding: 20px 16px 48px; }
  .title-row { flex-direction: column; align-items: flex-start; }
  .panel { padding: 16px; }
  .cards thead { display: none; }
  .cards, .cards tbody, .cards tr, .cards td { display: block; }
  .cards tr { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
  .cards td { padding: 0; border: 0; }
  .cards td:nth-child(1) { grid-column: 1 / -1; }
  .cards td:nth-child(2), .cards td:nth-child(3) { display: none; }
  .cards .num { text-align: left; }
  .cards .act { width: auto; grid-column: 2; grid-row: 2 / span 2; align-self: center; }
  .detail { grid-template-columns: 1fr; gap: 24px; padding: 16px; }
  .slab.big { max-width: 220px; }
  .facts { grid-template-columns: 1fr; }
  .facts div { grid-template-columns: 130px 1fr; }
  .mine li { grid-template-columns: 1fr; }
  .mine-act { justify-content: flex-start; }
  .toast { left: 16px; right: 16px; bottom: 16px; }
}
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } }
