/* ResellOS — system komponentów (dark-first) */
/* Czcionki serwowane lokalnie (bez Google Fonts — żadne dane użytkownika nie trafiają do zewnętrznych serwerów). */
@font-face { font-family: "Geist"; src: url("../fonts/Geist-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("../fonts/GeistMono-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
:root {
  --bg: #0c0d0f;
  --bg-2: #111215;
  --surface: #16181c;
  --surface-2: #1c1f24;
  --surface-3: #23272d;
  --border: #262a30;
  --border-strong: #343941;
  --text: #eceef1;
  --text-2: #b4b9c2;
  --muted: #7d838e;
  --accent: #ff6b2c;
  --accent-2: #ff8a55;
  --accent-soft: rgba(255, 107, 44, .12);
  --accent-ink: #1a0b03;
  --pos: #3ddc84;
  --pos-soft: rgba(61, 220, 132, .12);
  --neg: #ff5d5d;
  --neg-soft: rgba(255, 93, 93, .12);
  --warn: #f5b83d;
  --warn-soft: rgba(245, 184, 61, .12);
  --info: #6aa7ff;
  --info-soft: rgba(106, 167, 255, .12);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 8px 24px rgba(0,0,0,.25);
  --font: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --sidebar: 248px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0; }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.show-sm { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 18px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-weight: 800; font-size: 15px;
  box-shadow: 0 0 0 1px rgba(255,255,255,.08) inset, 0 6px 18px rgba(255,107,44,.35);
}
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: -.02em; }
.brand-name span { color: var(--accent); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 14px 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500;
  transition: background .15s, color .15s;
}
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav a:hover { background: var(--surface); color: var(--text); }
.nav a.active { background: var(--surface-2); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.nav a.active svg { color: var(--accent); opacity: 1; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 14px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface-3); border: 1px solid var(--border-strong);
  display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none;
}
.user-chip .meta { min-width: 0; flex: 1; }
.user-chip .meta div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-pill { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 16px 32px;
  background: rgba(12,13,15,.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar .title { flex: 1; min-width: 0; }
.topbar .title p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.topbar .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.topbar .menu-btn { display: none; }
.content { padding: 28px 32px 60px; max-width: 1400px; width: 100%; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--text);
  font: 500 13px var(--font); cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
}
.btn:hover { background: var(--surface-3); border-color: #444a53; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); box-shadow: 0 6px 20px rgba(255,107,44,.25); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.btn-danger { background: transparent; color: var(--neg); border-color: rgba(255,93,93,.35); }
.btn-danger:hover { background: var(--neg-soft); border-color: var(--neg); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.icon-btn { width: 36px; padding: 0; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 0; }
.card-head p { color: var(--muted); font-size: 12px; margin-top: 2px; }
.card-body { padding: 16px 20px 20px; }
.card-link { font-size: 12px; color: var(--muted); transition: color .15s; }
.card-link:hover { color: var(--accent); }

.grid { display: grid; gap: 16px; }
.grid-kpi { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: 2fr 1fr; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.mt { margin-top: 16px; }
.mt-lg { margin-top: 28px; }

.kpi {
  padding: 16px 18px; position: relative; overflow: hidden;
  transition: border-color .2s, transform .2s;
}
.kpi:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.kpi-label { color: var(--muted); font-size: 12px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi-value { font-family: var(--mono); font-size: clamp(18px, 1.6vw, 22px); font-weight: 600; margin-top: 8px; letter-spacing: -.03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.kpi.accent::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: var(--accent);
}
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot.accent { background: var(--accent); }
.dot.pos { background: var(--pos); }

/* ---------- Segmented period filter ---------- */
.segmented {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  overflow-x: auto; max-width: 100%;
}
.segmented a {
  padding: 6px 12px; border-radius: 7px; font-size: 12px; font-weight: 500; color: var(--muted);
  white-space: nowrap; transition: background .15s, color .15s;
}
.segmented a:hover { color: var(--text); }
.segmented a.active { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 0 rgba(255,255,255,.04) inset; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .right { text-align: right; }
.table tr.clickable { cursor: pointer; }
.cell-product { display: flex; align-items: center; gap: 12px; min-width: 200px; }
.cell-product .name { font-weight: 500; }
.thumb {
  width: 40px; height: 40px; border-radius: 8px; object-fit: cover; flex: none;
  background: var(--surface-3); border: 1px solid var(--border);
  display: grid; place-items: center; color: var(--muted);
}
.thumb svg { width: 18px; height: 18px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
  background: var(--surface-3); color: var(--text-2);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.in_stock { background: var(--info-soft); color: var(--info); }
.badge.listed { background: var(--accent-soft); color: var(--accent); }
.badge.sold, .badge.completed { background: var(--pos-soft); color: var(--pos); }
.badge.returned { background: var(--warn-soft); color: var(--warn); }
.badge.plain::before { display: none; }

/* ---------- Lists ---------- */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .grow > div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item:hover .name { color: var(--accent); }
.rank { width: 22px; height: 22px; border-radius: 6px; background: var(--surface-3); display: grid; place-items: center; font-size: 11px; font-weight: 600; color: var(--muted); flex: none; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 500; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.field .error { font-size: 12px; color: var(--neg); }
.input, .field input[type=text], .field input[type=email], .field input[type=password], .field input[type=date],
.field input[type=number], .field select, .field textarea, .toolbar input, .toolbar select {
  width: 100%; height: 38px; padding: 0 12px;
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font: 14px var(--font); outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.field textarea { height: auto; min-height: 110px; padding: 10px 12px; resize: vertical; line-height: 1.55; }
.field input:focus, .field select:focus, .field textarea:focus, .toolbar input:focus, .toolbar select:focus, .input:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--bg);
}
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--neg); }
.field select, .toolbar select { appearance: none; padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%237d838e' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
input[type=date]::-webkit-calendar-picker-indicator { filter: invert(.7); }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.checkbox input { accent-color: var(--accent); width: 16px; height: 16px; }
.input-affix { position: relative; }
.input-affix input { padding-right: 40px !important; }
.input-affix span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 13px; pointer-events: none; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; flex-wrap: wrap; }

.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius);
  padding: 22px; text-align: center; color: var(--muted); cursor: pointer;
  background: var(--bg-2); transition: border-color .15s, background .15s;
  position: relative;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); color: var(--text-2); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone svg { width: 26px; height: 26px; margin: 0 auto 8px; color: var(--accent); }
.previews { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.previews img, .previews .existing { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.existing-wrap { position: relative; }
.existing-wrap form { position: absolute; top: 4px; right: 4px; }
.existing-wrap button { width: 24px; height: 24px; border-radius: 6px; border: 0; background: rgba(0,0,0,.7); color: #fff; cursor: pointer; display: grid; place-items: center; }
.existing-wrap button:hover { background: var(--neg); }

/* ---------- Toolbar (filters) ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .search { position: relative; flex: 1 1 260px; }
.toolbar .search input { padding-left: 36px; }
.toolbar .search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.toolbar select { width: auto; min-width: 150px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.chip {
  height: 28px; padding: 0 12px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); color: var(--text-2); font-size: 12px; font-weight: 500;
  transition: all .15s;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip .count { font-family: var(--mono); opacity: .7; }

/* ---------- Flash ---------- */
.flashes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.flash {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface);
  font-size: 13px; animation: slideIn .25s ease-out;
}
.flash::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--info); }
.flash.success::before { background: var(--pos); }
.flash.error { border-color: rgba(255,93,93,.35); }
.flash.error::before { background: var(--neg); }
.flash .close { margin-left: auto; background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 16px; }
@keyframes slideIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty > svg { width: 36px; height: 36px; margin: 0 auto 12px; color: var(--border-strong); }
.empty h3 { color: var(--text); margin-bottom: 6px; }
.empty .btn { margin-top: 16px; }
.empty-sm { padding: 24px 8px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- Product grid ---------- */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.p-card { overflow: hidden; transition: transform .2s, border-color .2s; display: flex; flex-direction: column; }
.p-card:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.p-card .img { aspect-ratio: 4 / 5; background: var(--surface-2); position: relative; overflow: hidden; }
.p-card .img img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.p-card:hover .img img { transform: scale(1.03); }
.p-card .img .ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--border-strong); }
.p-card .img .ph svg { width: 40px; height: 40px; }
.p-card .img .badge { position: absolute; top: 10px; left: 10px; background: rgba(12,13,15,.86); backdrop-filter: blur(6px); }
.p-card .info { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.p-card .info .name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-card .info .sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-card .prices { display: flex; justify-content: space-between; align-items: baseline; margin-top: auto; padding-top: 10px; }
.view-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.view-toggle button { background: transparent; border: 0; color: var(--muted); height: 36px; width: 38px; cursor: pointer; display: grid; place-items: center; }
.view-toggle button.active { background: var(--surface-3); color: var(--text); }
.view-toggle svg { width: 16px; height: 16px; }

/* ---------- Detail ---------- */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 24px; align-items: start; }
.gallery-main { aspect-ratio: 4 / 5; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); }
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.gallery-thumbs button { padding: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; width: 64px; height: 64px; cursor: pointer; background: none; }
.gallery-thumbs button.active { border-color: var(--accent); }
.gallery-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
.kv > div { padding: 12px 0; border-bottom: 1px solid var(--border); }
.kv dt { color: var(--muted); font-size: 12px; }
.kv dd { margin: 3px 0 0; font-weight: 500; }
.calc { display: flex; flex-direction: column; gap: 8px; }
.calc-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-2); }
.calc-row.total { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 4px; font-size: 16px; font-weight: 600; color: var(--text); }
.callout { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; color: var(--text-2); }
.callout.warn { background: var(--warn-soft); border-color: rgba(245,184,61,.3); color: var(--warn); }

/* ---------- Charts ---------- */
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 220px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 3px; border-radius: 2px; display: inline-block; }

.bar-row { display: grid; grid-template-columns: 110px 1fr auto; gap: 12px; align-items: center; padding: 7px 0; font-size: 13px; }
.bar-row .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.bar-track { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; background: var(--accent); transform-origin: left; animation: grow .6s ease-out; }
.bar-fill.neg { background: var(--neg); }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------- AI generator ---------- */
.ai-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 20px; align-items: start; }
.ai-preview { margin-top: 12px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); display: none; max-height: 360px; }
.ai-preview img { width: 100%; max-height: 360px; object-fit: contain; background: var(--bg-2); }
.result-field { margin-bottom: 16px; }
.result-field .head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.result-field label { font-size: 12px; font-weight: 500; color: var(--text-2); }
.result-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.meta-box { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; }
.meta-box .muted { font-size: 12px; }
.meta-box .v { font-weight: 600; margin-top: 4px; }
.kw-list { display: flex; flex-wrap: wrap; gap: 6px; }
.kw { padding: 4px 10px; border-radius: 999px; background: var(--surface-3); font-size: 12px; color: var(--text-2); }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(0,0,0,.25); border-top-color: currentColor; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.copied { color: var(--pos) !important; border-color: var(--pos) !important; }

/* ---------- Pricing ---------- */
.plans { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; max-width: 860px; }
.plan { padding: 24px; display: flex; flex-direction: column; gap: 14px; position: relative; }
.plan.current { border-color: var(--accent); }
.plan .price { font-family: var(--mono); font-size: 34px; font-weight: 600; letter-spacing: -.04em; }
.plan .price small { font-size: 13px; color: var(--muted); font-family: var(--font); letter-spacing: 0; }
.plan ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 9px; color: var(--text-2); }
.plan li { display: flex; gap: 8px; align-items: flex-start; }
.plan li svg { width: 16px; height: 16px; color: var(--pos); flex: none; margin-top: 2px; }
.plan .ribbon { position: absolute; top: 18px; right: 18px; }
.plan .btn { margin-top: auto; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side {
  background: radial-gradient(800px 400px at 0% 0%, rgba(255,107,44,.18), transparent 60%),
              radial-gradient(600px 400px at 100% 100%, rgba(255,107,44,.08), transparent 60%), var(--bg-2);
  border-right: 1px solid var(--border);
  padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
}
.auth-side h2 { font-size: 34px; line-height: 1.15; letter-spacing: -.03em; max-width: 460px; margin-top: 40px; }
.auth-side h2 em { font-style: normal; color: var(--accent); }
.auth-side .feat { display: flex; flex-direction: column; gap: 14px; margin-top: 28px; color: var(--text-2); }
.auth-side .feat div { display: flex; gap: 10px; align-items: center; }
.auth-side .feat svg { width: 18px; height: 18px; color: var(--accent); }
.auth-main { display: grid; place-items: center; padding: 32px 20px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { font-size: 24px; }
.auth-card .lead { color: var(--muted); margin: 6px 0 24px; }
.auth-card .stack { gap: 14px; }
.auth-foot { text-align: center; margin-top: 20px; color: var(--muted); font-size: 13px; }
.auth-foot a, .link { color: var(--accent); }
.auth-foot a:hover, .link:hover { text-decoration: underline; }

/* ---------- Pagination ---------- */
.pagination { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; color: var(--muted); font-size: 12px; }
.pagination .pages { display: flex; gap: 6px; }

/* ---------- Dialog ---------- */
dialog { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 0; width: min(440px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(0,0,0,.6); }
dialog::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(3px); }
dialog .card-body { padding: 22px; }

.error-page { min-height: 70vh; display: grid; place-items: center; text-align: center; }
.error-page .code { font-family: var(--mono); font-size: 64px; font-weight: 600; color: var(--accent); letter-spacing: -.05em; }

.overlay { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .grid-main, .detail-grid, .ai-grid { grid-template-columns: 1fr; }
  .plans { grid-template-columns: 1fr; max-width: 520px; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 50; left: 0; top: 0; width: 272px;
    transform: translateX(-100%); transition: transform .25s ease;
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .overlay { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.55); }
  .topbar .menu-btn { display: inline-flex; }
  .topbar { padding: 12px 16px; }
  .content { padding: 18px 16px 48px; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { display: none; }
}
@media (max-width: 640px) {
  .grid-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-3, .form-grid, .result-meta { grid-template-columns: 1fr; }
  .kpi-value { font-size: 18px; }
  .kv { grid-template-columns: 1fr; }
  .topbar .actions .btn span.lbl { display: none; }
  .hide-sm { display: none; }
  .show-sm { display: block; margin-top: 2px; white-space: nowrap; }
  .cell-product { min-width: 0; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .bar-row { grid-template-columns: 80px 1fr auto; }
  .chart-box { height: 220px; }
  h1 { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Plany / limity ---------- */
.nav a { white-space: nowrap; }
.nav-tag { margin-left: auto; display: inline-flex; color: var(--accent); }
.nav a .nav-tag svg { width: 13px; height: 13px; opacity: 1; color: var(--accent); }
.segmented a.locked { display: inline-flex; align-items: center; gap: 5px; opacity: .55; }
.segmented a.locked:hover { opacity: 1; color: var(--accent); }
.segmented a.locked svg { width: 12px; height: 12px; }
.usage-pill {
  font-family: var(--mono); font-size: 12px; padding: 0 10px; height: 30px; display: inline-flex; align-items: center;
  border-radius: 999px; border: 1px solid var(--border-strong); color: var(--text-2);
}
.usage-pill.full { border-color: var(--accent); color: var(--accent); }
.upgrade-banner {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin-bottom: 16px;
  border-radius: var(--radius); border: 1px solid rgba(255,107,44,.35);
  background: linear-gradient(90deg, var(--accent-soft), transparent 70%);
}
.upgrade-banner > div:first-child { width: 34px; height: 34px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.upgrade-banner svg { width: 18px; height: 18px; }
.upgrade-banner .grow { flex: 1; min-width: 0; }
.locked-hero { max-width: 620px; margin: 40px auto; text-align: center; padding: 40px 28px; }
.locked-hero .ico { width: 56px; height: 56px; margin: 0 auto 18px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.locked-hero .ico svg { width: 26px; height: 26px; }
.locked-hero h2 { font-size: 22px; }
.locked-hero ul { list-style: none; padding: 0; margin: 22px auto; display: inline-flex; flex-direction: column; gap: 10px; text-align: left; color: var(--text-2); }
.locked-hero li { display: flex; gap: 10px; align-items: center; }
.locked-hero li svg { width: 16px; height: 16px; color: var(--pos); }
.plan li.missing { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(125,131,142,.5); }
.plan li.missing svg { color: var(--muted); }
@media (max-width: 640px) { .upgrade-banner { flex-wrap: wrap; } }

/* ---------- Strony prawne ---------- */
.legal-links { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 0 10px 12px; font-size: 11px; }
.legal-links a { color: var(--muted); transition: color .15s; }
.legal-links a:hover { color: var(--text); }
.legal-wrap { max-width: 860px; margin: 0 auto; padding: 24px 16px 60px; }
.legal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.legal-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.legal-tabs a { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-2); font-size: 13px; font-weight: 500; }
.legal-tabs a.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.legal { padding: 36px 40px; line-height: 1.7; color: var(--text-2); }
.legal h1 { color: var(--text); font-size: 26px; margin-bottom: 10px; }
.legal h2 { color: var(--text); font-size: 16px; margin: 28px 0 10px; }
.legal .lead-text { font-size: 15px; color: var(--text-2); }
.legal p { margin: 0 0 10px; }
.legal ul, .legal ol { margin: 0 0 10px; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.legal strong { color: var(--text); }
.legal .table { margin: 6px 0 10px; }
.danger-zone { margin-top: 16px; border-color: rgba(255,93,93,.3); }
.danger-zone h2 { color: var(--neg); }
@media (max-width: 640px) { .legal { padding: 22px 18px; } .legal h1 { font-size: 21px; } }
