:root {
  --bg: #0a0e17;
  --card: #121a2e;
  --gold: #d4af37;
  --text: #e8eefc;
  --muted: #8b97b3;
  --border: rgba(212, 175, 55, 0.22);
  --danger: #f43f5e;
  --ok: #34d399;
  --field: #0d1424;
  --side: #0d1322;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: "Segoe UI", system-ui, sans-serif; }
button, input, select, textarea { font: inherit; }
a { color: var(--gold); text-decoration: none; }
.page { max-width: 1180px; margin: 0 auto; padding: 0 20px 64px; }
.topnav { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.topnav .links { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.topnav .links a { color: var(--muted); font-size: 14px; }
.topnav .links a:hover { color: var(--gold); }
.hero { padding: 56px 0 28px; }
.kicker { letter-spacing: .18em; text-transform: uppercase; color: var(--gold); font-size: 11px; font-weight: 700; }
.brand-kicker { display: flex; align-items: center; gap: 8px; letter-spacing: .12em; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; object-fit: cover; }
.side-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  padding: 8px 4px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 16px;
  letter-spacing: .08em;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
}
.side-brand .brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  flex: 0 0 auto;
  box-shadow: 0 0 0 1px var(--border);
}
h1 { font-size: 42px; margin: 10px 0; letter-spacing: .04em; }
h2 { margin: 6px 0 16px; }
h3 { margin: 22px 0 10px; }
.sub { color: var(--muted); max-width: 640px; line-height: 1.5; }
.row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
.btn { border: 0; border-radius: 12px; padding: 11px 16px; cursor: pointer; font-weight: 700; }
.btn-gold { background: var(--gold); color: #1a1403; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 28px; }
.section { padding: 36px 0 8px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 16px; }
.muted { color: var(--muted); font-size: 13px; }
.price { font-size: 28px; color: var(--gold); margin: 10px 0; }
.app { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.side { border-right: 1px solid var(--border); padding: 18px 12px; background: var(--side); }
.side a, .side button.link { display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--muted); padding: 10px 12px; border-radius: 10px; cursor: pointer; }
.side a.active, .side button.link.active, .side a:hover, .side button.link:hover { background: rgba(212,175,55,.12); color: var(--gold); }
.main { padding: 20px 24px 40px; }
.kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.kpi .card b { font-size: 22px; color: var(--gold); display: block; margin-top: 6px; }
.field { width: 100%; background: var(--field); border: 1px solid var(--border); color: var(--text); border-radius: 10px; padding: 10px 12px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { border-bottom: 1px solid var(--border); padding: 8px 6px; text-align: left; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover { background: rgba(212,175,55,.08); }
.pos { display: grid; grid-template-columns: 1.2fr .8fr; gap: 14px; align-items: stretch; min-height: calc(100vh - 200px); }
.cart-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.qty { display: flex; align-items: center; gap: 6px; }
.qty button { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--border); background: var(--field); color: var(--text); cursor: pointer; }
.err { color: var(--danger); }
.ok { color: var(--ok); }
.auth { max-width: 420px; margin: 8vh auto; }
.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.badge-off { opacity: .55; }
.modal { position: fixed; inset: 0; background: rgba(4,8,16,.72); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 40; }
.modal.hidden { display: none; }
.receipt { width: 360px; background: #fff; color: #111; border-radius: 8px; padding: 20px; font-family: ui-monospace, Consolas, monospace; }
.receipt h3 { margin: 0 0 8px; text-align: center; }
.receipt .line { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.receipt hr { border: 0; border-top: 1px dashed #999; }
.modal-actions { display: flex; gap: 8px; margin-top: 14px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .pos { grid-template-columns: 1fr; min-height: 0; }
  .pos-drop { flex: none; min-height: 220px; max-height: min(50vh, 420px); }
  .side { display: flex; gap: 6px; overflow: auto; }
  h1 { font-size: 32px; }
}
.kpi-card { display: flex; flex-direction: column; gap: 8px; }
.kpi-head { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.kpi-ico { width: 18px; height: 18px; color: var(--gold); flex: 0 0 auto; }
.rank-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.rank-row:last-child { border-bottom: 0; }
.rank-row b { margin-left: auto; color: var(--gold); }
.rank { width: 22px; height: 22px; border-radius: 999px; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: rgba(212,175,55,.14); color: var(--gold); }
.rank-row.warn { color: #fecaca; }
.rank-row.warn b { color: var(--danger); }

select.field, select.field option {
  color-scheme: dark;
  background: var(--field);
  color: var(--text);
}
select.field.need-customer {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px rgba(244, 63, 94, 0.25);
}
.pos-search {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}
.pos-drop {
  margin-top: 8px;
  flex: 1 1 auto;
  min-height: 280px;
  overflow: auto;
  background: var(--field);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
}
.pos-drop-item {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 2px 12px;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
}
.pos-drop-item b { color: var(--gold); grid-column: 2; grid-row: 1; }
.pos-drop-item .muted { grid-column: 1; }
.pos-drop-item:hover, .pos-drop-item:focus {
  background: rgba(212, 175, 55, 0.14);
  color: var(--text);
}
.qaytim { margin: 10px 0 0; font-weight: 700; }

.stock-low { color: #ef4444; font-weight: 700; }
.confirm-box { width: min(420px, 92vw); }
.confirm-box h3 { margin-top: 0; }

.table th.num, .table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table tfoot td { border-bottom: 0; padding-top: 12px; color: var(--gold); }
.stock-draft { margin-top: 16px; }
.empty-warn {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px;
  border: 1px dashed rgba(244, 63, 94, 0.45);
  border-radius: 14px;
  background: rgba(244, 63, 94, 0.08);
}
.empty-warn b { color: #fecaca; display: block; }
.empty-warn-ico {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: rgba(244, 63, 94, 0.2);
  color: #fecaca;
  font-weight: 800;
}
.btn-x {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--field);
  color: var(--text);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}
.btn-x:hover { border-color: var(--danger); color: var(--danger); background: rgba(244, 63, 94, 0.12); }
#in-form-err { margin: 10px 0 0; }

.sales-filters { margin-bottom: 12px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--border); background: transparent; color: var(--muted); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-weight: 600; }
.chip.active, .chip:hover { border-color: var(--gold); color: var(--gold); background: rgba(212,175,55,.12); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.ico-eye { width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px; }
.pager { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.badge-back { color: var(--danger); border-color: rgba(244,63,94,.4); }
.sale-box { width: min(560px, 94vw); max-height: 86vh; overflow: auto; }

.link-chek { background: none; border: 0; padding: 0; color: var(--gold); cursor: pointer; font-weight: 700; text-decoration: underline; }
.link-chek:hover { color: #fff; }

.pw-wrap { position: relative; }
.pw-wrap .field { padding-right: 44px; }
.pw-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.pw-toggle.on { color: var(--gold); }
.pw-toggle .ico-eye { margin: 0; }

.set-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 0; }
.set-span-2 { grid-column: 1 / -1; }
.set-field { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 600; }
@media (max-width: 800px) {
  .set-grid { grid-template-columns: 1fr; }
}

.plans {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 28px;
}
.plan { position: relative; padding: 20px 18px 18px; min-height: 100%; }
.plan-name { font-weight: 800; letter-spacing: .08em; }
.plan-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #04140c;
  background: #39ff88;
  border-radius: 999px;
  padding: 4px 8px;
  box-shadow: 0 0 16px rgba(57, 255, 136, .55);
}
.plan-hit {
  border-color: rgba(57, 255, 136, .7);
  box-shadow: 0 0 0 1px rgba(57, 255, 136, .35), 0 0 28px rgba(57, 255, 136, .12);
}
.plan-enterprise { border-color: rgba(57, 255, 136, .45); }
.plan-tiers { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 8px; }
.plan-tiers li {
  background: var(--field);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}
.plan-tiers b { display: block; color: var(--text); font-size: 14px; }
.plan-tiers span { display: block; margin-top: 4px; color: #39ff88; font-size: 12px; font-weight: 700; }
@media (min-width: 768px) {
  .plans { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1100px) {
  .plans { grid-template-columns: repeat(4, 1fr); }
}

.his-kpi { margin: 16px 0; }
.his-in b { color: #39ff88 !important; }
.his-out b { color: var(--gold) !important; }
.his-stock b { color: #7dd3fc !important; }
.his-chart-card { height: 320px; padding: 16px; margin-bottom: 16px; }
.his-table-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 8px 0 12px; flex-wrap: wrap; }
.btn-excel {
  background: #39ff88;
  color: #04140c;
  font-weight: 800;
  box-shadow: 0 0 18px rgba(57,255,136,.35);
}
.btn-excel:hover { filter: brightness(1.05); }
@media (max-width: 800px) {
  .his-kpi { grid-template-columns: 1fr; }
}

.set-sub { margin: 28px 0 12px; }
.bill-wrap { display: grid; gap: 14px; margin: 8px 0 8px; }
.bill-card {
  background: #161b22;
  border: 1px solid rgba(57,255,136,.28);
  box-shadow: 0 0 28px rgba(57,255,136,.08);
}
.bill-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.bill-head h3 { margin: 6px 0 0; }
.bill-status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
}
.bill-status.on {
  color: #04140c;
  background: #39ff88;
  box-shadow: 0 0 16px rgba(57,255,136,.45);
}
.bill-status.off { color: #fff; background: #6b7280; }
.bill-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}
.bill-kpi {
  background: #0f141b;
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 12px;
  padding: 12px;
  min-width: 0;
}
.bill-kpi span { display: block; color: var(--muted); font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.bill-kpi b { display: block; font-size: 18px; color: var(--text); word-break: break-word; }
.bill-id { color: #39ff88 !important; letter-spacing: .06em; font-variant-numeric: tabular-nums; }
.bill-hint {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  background: rgba(57,255,136,.06);
  border: 1px dashed rgba(57,255,136,.28);
  border-radius: 12px;
  padding: 12px 14px;
}
.bill-hint b { color: #39ff88; }
.bill-table-card { background: #161b22; }
.bill-table-head { margin-bottom: 10px; }
.table-scroll { overflow-x: auto; }
.pay-st { font-weight: 800; font-size: 12px; letter-spacing: .04em; }
.pay-paid { color: #39ff88; }
.pay-due { color: var(--gold); }
.offer-link {
  display: inline-block;
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.offer-link:hover { color: #39ff88; }
@media (max-width: 900px) {
  .bill-kpis { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .bill-kpis { grid-template-columns: 1fr; }
}

.td-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.cennik-dialog {
  width: min(440px, 94vw);
  background: #161b22;
  border: 1px solid rgba(57,255,136,.28);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 0 28px rgba(57,255,136,.08);
}
.cennik-preview-wrap {
  display: flex;
  justify-content: center;
  margin: 14px 0;
  padding: 16px;
  background: #0f141b;
  border-radius: 12px;
}
.cennik-label {
  width: 58mm;
  height: 30mm;
  background: #fff;
  color: #111;
  border: 1px solid #ddd;
  border-radius: 2px;
  padding: 1.6mm 2mm 1.2mm;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
  overflow: hidden;
  font-family: Arial, Helvetica, sans-serif;
}
.cennik-shop {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-align: center;
  color: #111;
  line-height: 1.1;
}
.cennik-name {
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  line-height: 1.15;
  max-height: 8.4mm;
  overflow: hidden;
  color: #000;
}
.cennik-barcode, .cennik-barcode-ph {
  width: 52mm;
  max-height: 11mm;
}
.cennik-barcode-ph {
  font-size: 9px;
  letter-spacing: .2em;
  text-align: center;
  font-family: ui-monospace, Consolas, monospace;
}
.cennik-price {
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  color: #000;
  line-height: 1;
}
.cennik-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}
.cennik-sheet {
  position: absolute;
  left: -9999px;
  top: 0;
}
@media print {
  body * { visibility: hidden; }
  body:not(.printing-cennik) .receipt,
  body:not(.printing-cennik) .receipt * { visibility: visible; }
  body.printing-cennik .cennik-sheet,
  body.printing-cennik .cennik-sheet * { visibility: visible; }
  .receipt { position: absolute; left: 0; top: 0; box-shadow: none; }
  body.printing-cennik .cennik-sheet {
    position: absolute;
    left: 0;
    top: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 2mm;
    background: #fff;
  }
  body.printing-cennik .cennik-label {
    border: 0;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .modal-actions { display: none !important; }
}

.impersonate-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--gold);
  color: #1a1403;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  grid-column: 1 / -1;
}
.app:has(.impersonate-bar) { grid-template-rows: auto 1fr; }
.plat { max-width: 1180px; margin: 0 auto; padding: 18px 20px 64px; }
.plat-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.plat-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 16px; }
.plat-kpi { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; }
.plat-kpi b { display: block; font-size: 20px; color: var(--gold); margin-top: 4px; line-height: 1.25; }
.plat-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 12px; align-items: center; }
.plat-st { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); letter-spacing: .04em; }
.plat-st-TRIAL { color: #93c5fd; border-color: rgba(147,197,253,.35); }
.plat-st-ACTIVE { color: var(--ok); border-color: rgba(52,211,153,.35); }
.plat-st-PAST_DUE { color: #fbbf24; border-color: rgba(251,191,36,.35); }
.plat-st-SUSPENDED { color: var(--danger); border-color: rgba(244,63,94,.35); }
.plat-detail-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 14px; }
.plat-login .brand-kicker { margin-bottom: 8px; }
@media (max-width: 900px) {
  .plat-toolbar .field { width: 100%; }
}



html.theme-day {
  color-scheme: light;
  --bg: #f3efe6;
  --card: #ffffff;
  --gold: #9a7210;
  --text: #1b2433;
  --muted: #5a6578;
  --border: rgba(154, 114, 16, 0.28);
  --danger: #c81e3a;
  --ok: #0b8f63;
  --field: #ffffff;
  --side: #efe8d8;
}
html.theme-day body { background: var(--bg); color: var(--text); }
html.theme-day .btn-ghost { color: var(--text); }
html.theme-day select.field option { background: #fff; color: var(--text); }
html.theme-day .plat-st-TRIAL { color: #1d4ed8; border-color: rgba(29,78,216,.35); }
html.theme-day .table th, html.theme-day .table td { border-color: var(--border); }
html.theme-day .btn-gold { color: #1a1403; }
html.theme-day .modal { background: rgba(40, 32, 16, .45); }
.theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.theme-ico {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: var(--gold);
}

/* FINEX AI Assistant */
.ai-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 16px;
  background: var(--gold);
  color: #1a1403;
  font-weight: 800;
  letter-spacing: .06em;
  cursor: pointer;
}
.ai-panel {
  position: fixed;
  right: 20px;
  bottom: 84px;
  z-index: 50;
  width: min(320px, calc(100vw - 24px));
  height: min(416px, calc(100vh - 120px));
  min-width: 280px;
  min-height: 300px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ai-panel[hidden] {
  display: none !important;
}
.ai-resize {
  position: absolute;
  top: 0;
  left: 0;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: nwse-resize;
  z-index: 2;
}
.ai-resize::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 7px;
  height: 7px;
  border-top: 2px solid var(--muted);
  border-left: 2px solid var(--muted);
}
.ai-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
  padding: 12px 12px 8px;
  border-bottom: 1px solid var(--border);
}
.ai-head-actions { display: flex; gap: 6px; }
.ai-status { padding: 6px 12px; font-size: 12px; }
.ai-log {
  flex: 1;
  overflow: auto;
  padding: 8px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ai-msg {
  max-width: 92%;
  padding: 8px 10px;
  border-radius: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  line-height: 1.45;
}
.ai-msg-user {
  align-self: flex-end;
  background: rgba(212,175,55,.16);
  color: var(--text);
}
.ai-msg-bot {
  align-self: flex-start;
  background: var(--field);
  border: 1px solid var(--border);
}
.ai-pending { color: var(--muted); font-style: italic; }
.ai-form { padding: 10px 12px 12px; border-top: 1px solid var(--border); }
.ai-form-row { display: flex; gap: 8px; margin-top: 8px; }
.ai-form-row .btn {
  flex: 1;
  padding: 8px 11px;
  font-size: 12px;
  border-radius: 8px;
  line-height: 1.2;
}
.ai-err { padding: 0 12px; margin: 0; }
@media (max-width: 640px) {
  .ai-panel { right: 12px; left: 12px; width: auto; min-width: 0; bottom: 76px; }
  .ai-fab { right: 12px; bottom: 12px; }
  .ai-resize { display: none; }
}
