/* Kalkulator ofert Grupa PV – interfejs.
   Kolory Grupy PV (granat marki, aluminium, chłodny papier, bursztyn słońca) w dwóch motywach: ciemnym i jasnym.
   Jedyny ozdobnik: „światło słońca” na polecanym wariancie. Reszta spokojna. */

:root, :root[data-theme="light"] {
  color-scheme: light;
  --brand: #1F3864; --brand-2: #2E5597; --cell: #2A4C80; --alu: #C5CEDA; --sun: #E9A23B;
  --bg: #E9EEF4; --glow-1: rgba(46, 85, 151, .10); --glow-2: rgba(233, 162, 59, .10);
  --card: #FFFFFF; --card-2: #F3F6FA; --field: #FFFFFF; --hover: #F5F8FB;
  --line: #E1E7EF; --line-2: #CBD5E1;
  --text: #1B2A41; --muted: #5C6B80; --faint: #8592A6; --title: var(--brand);
  --accent: #E9A23B; --accent-ink: #1B2A41; --accent-text: #93590A; --accent-soft: rgba(233, 162, 59, .14); --accent-line: rgba(233, 162, 59, .55);
  --link: #2E5597;
  --ok: #1D7A4E; --ok-soft: #E3F3EA; --ok-line: rgba(29, 122, 78, .35);
  --err: #B42318; --err-soft: #FDECEA; --err-line: rgba(180, 35, 24, .35);
  --warn: #8A5A00; --warn-soft: #FFF3D6; --warn-line: rgba(138, 90, 0, .3);
  --info-soft: #EAF0F8;
  --side: var(--brand); --side-text: #FFFFFF; --side-muted: rgba(255, 255, 255, .64); --side-hover: rgba(255, 255, 255, .08); --side-on: rgba(255, 255, 255, .15); --side-line: rgba(255, 255, 255, .12);
  --seg-bg: #EDF1F6; --seg-on: #FFFFFF; --seg-on-text: var(--brand); --seg-shadow: 0 1px 3px rgba(16, 32, 64, .14);
  --price-head: #FCF1DE; --price-cell: #FFFBF2; --sale-head: #E3F3EA; --sale-cell: #F3FAF6;
  --shadow: 0 1px 2px rgba(16, 32, 64, .05), 0 10px 28px -18px rgba(16, 32, 64, .22);
  --sunlight: rgba(233, 162, 59, .22);
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235C6B80' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0A1220; --glow-1: rgba(31, 56, 100, .55); --glow-2: rgba(233, 162, 59, .07);
  --card: #0F1B2D; --card-2: #15233A; --field: #0B1626; --hover: #132139;
  --line: rgba(197, 206, 218, .09); --line-2: rgba(197, 206, 218, .17);
  --text: #E6ECF5; --muted: #93A1B8; --faint: #6C7B93; --title: #F3F6FB;
  --accent: #E9A23B; --accent-ink: #14213A; --accent-text: #F2B654; --accent-soft: rgba(233, 162, 59, .13); --accent-line: rgba(233, 162, 59, .45);
  --link: #8FB3F0;
  --ok: #4CC28F; --ok-soft: rgba(76, 194, 143, .12); --ok-line: rgba(76, 194, 143, .35);
  --err: #F27A6E; --err-soft: rgba(242, 122, 110, .12); --err-line: rgba(242, 122, 110, .38);
  --warn: #F2B654; --warn-soft: rgba(242, 182, 84, .11); --warn-line: rgba(242, 182, 84, .32);
  --info-soft: rgba(143, 179, 240, .09);
  --side: #0E192B; --side-text: #E6ECF5; --side-muted: #8F9DB4; --side-hover: rgba(197, 206, 218, .06); --side-on: var(--brand); --side-line: rgba(197, 206, 218, .08);
  --seg-bg: #0B1626; --seg-on: var(--brand); --seg-on-text: #FFFFFF; --seg-shadow: 0 1px 2px rgba(0, 0, 0, .35);
  --price-head: rgba(233, 162, 59, .13); --price-cell: rgba(233, 162, 59, .06); --sale-head: rgba(76, 194, 143, .13); --sale-cell: rgba(76, 194, 143, .06);
  --shadow: inset 0 1px 0 rgba(255, 255, 255, .03), 0 24px 44px -30px rgba(0, 0, 0, .7);
  --sunlight: rgba(233, 162, 59, .26);
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2393A1B8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--text); font: 14.5px/1.5 Archivo, "Segoe UI", Roboto, Arial, sans-serif; font-variant-numeric: tabular-nums;
  background: radial-gradient(1100px 680px at -5% -10%, var(--glow-1), transparent 62%), radial-gradient(900px 620px at 105% 110%, var(--glow-2), transparent 60%), var(--bg);
  background-attachment: fixed; min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--link); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ic { width: 18px; height: 18px; flex: none; }

/* ---------- Powłoka ---------- */
.app { display: grid; grid-template-columns: 268px minmax(0, 1fr); gap: 14px; padding: 12px; min-height: 100vh; }
.app.bare { display: block; padding: 0; }
.side {
  position: sticky; top: 12px; height: calc(100vh - 24px); display: flex; flex-direction: column; gap: 4px;
  background: var(--side); color: var(--side-text); border: 1px solid var(--side-line); border-radius: 22px; padding: 14px 12px; overflow-y: auto;
}
.side-brand { display: flex; align-items: center; gap: 11px; padding: 4px 6px 14px; min-width: 0; }
.side-brand .mk { width: 40px; height: 40px; flex: none; }
.side-brand img { max-height: 40px; max-width: 112px; border-radius: 9px; background: #fff; padding: 4px 6px; }
.side-brand > span { min-width: 0; }
.side-brand > span > b { display: block; font-size: 15.5px; font-weight: 700; letter-spacing: -.005em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-brand > span > span { display: block; font-size: 12px; color: var(--side-muted); white-space: nowrap; }
.side-new {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 11px 14px; border-radius: 14px;
  border: 1px solid var(--side-line); background: rgba(255, 255, 255, .05); color: var(--side-text); font-weight: 650; cursor: pointer;
}
.side-new:hover { background: var(--side-hover); }
.side-new .ic { color: var(--accent); }
.side-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.side-nav .grp { font-size: 12.5px; color: var(--side-muted); padding: 16px 12px 6px; }
.side-nav button {
  display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none; color: var(--side-muted);
  padding: 9px 12px; border-radius: 12px; cursor: pointer; font-weight: 550; text-align: left; font-size: 14px;
}
.side-nav button:hover { background: var(--side-hover); color: var(--side-text); }
.side-nav button.on { background: var(--side-on); color: var(--side-text); font-weight: 650; }
.side-nav button.on .ic { color: var(--accent); }
.side-foot { margin-top: auto; padding: 14px 10px 2px; font-size: 12px; color: var(--side-muted); }
.scrim { position: fixed; inset: 0; background: rgba(4, 9, 18, .55); z-index: 55; }

.shell { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 2px 6px 6px; }
.burger { display: none; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer; place-items: center; }
.crumb { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.crumb .ic { width: 16px; height: 16px; }
.crumb .sep { width: 14px; height: 14px; opacity: .6; }
.crumb b { color: var(--text); font-weight: 650; overflow: hidden; text-overflow: ellipsis; }
.top-r { display: flex; align-items: center; gap: 10px; }
.theme { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); }
.theme button { width: 34px; height: 30px; border: 0; border-radius: 999px; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.theme button.on { background: var(--card-2); color: var(--accent); box-shadow: var(--seg-shadow); }
.who { position: relative; }
.who-btn { display: flex; align-items: center; gap: 10px; padding: 4px 12px 4px 4px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); cursor: pointer; color: var(--text); text-align: left; }
.who-btn:hover { border-color: var(--line-2); }
.who-btn b { display: block; font-size: 13px; line-height: 1.25; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-btn small { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.25; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.av { width: 34px; height: 34px; border-radius: 999px; display: grid; place-items: center; font-weight: 700; font-size: 12.5px; background: var(--brand); color: #fff; flex: none; letter-spacing: .02em; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: var(--card); border: 1px solid var(--line-2); border-radius: 16px; padding: 6px; box-shadow: 0 24px 50px -24px rgba(0, 0, 0, .55); z-index: 30; }
.menu .mh { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; font-size: 12.5px; color: var(--muted); }
.menu .mh b { display: block; color: var(--text); font-size: 13.5px; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 9px 10px; border-radius: 10px; cursor: pointer; color: var(--text); text-align: left; }
.menu button:hover { background: var(--hover); }
.menu button .ic { color: var(--muted); }

main { padding: 4px 6px 56px; width: 100%; max-width: 1640px; margin: 0 auto; }
.app.bare main { max-width: none; padding: 0 16px; }
.loading { padding: 56px; text-align: center; color: var(--muted); }

/* ---------- Typografia stron ---------- */
.ph { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 4px 0 18px; }
h2.page { margin: 6px 0 6px; font-size: 28px; line-height: 1.15; font-weight: 650; letter-spacing: -.012em; color: var(--title); }
.ph h2.page { margin-top: 0; }
.sub { color: var(--muted); font-size: 14px; margin: 0 0 18px; max-width: 92ch; }
.ph .sub { margin: 0; }
.sub b { color: var(--text); font-weight: 650; }
.hint { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; }
.small { font-size: 12px; color: var(--muted); word-break: break-word; }
.faint { color: var(--faint); font-weight: 400; }
.status { font-size: 13px; color: var(--muted); }
.r { text-align: right !important; white-space: nowrap; }
.sub-h { margin: 18px 0 10px; font-size: 13px; font-weight: 650; color: var(--muted); }

/* ---------- Karty i układ ---------- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 16px; }
.panel h3 { margin: 18px 0 10px; font-size: 15.5px; font-weight: 650; color: var(--title); }
.panel h3:first-child { margin-top: 0; }
.layout { display: grid; grid-template-columns: minmax(300px, 420px) 1fr; gap: 18px; align-items: start; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 14px; }
.full { grid-column: 1 / -1; }
.bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 16px 0; flex-wrap: wrap; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row > .grow { flex: 1; }

/* ---------- Pola formularzy ---------- */
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.inp, label.f input, label.f select, label.f textarea {
  border: 1px solid var(--line-2); border-radius: 12px; padding: 9px 12px; background: var(--field); color: var(--text);
  font-size: 14px; min-width: 0; width: 100%; transition: border-color .15s, box-shadow .15s;
}
select.inp, label.f select { appearance: none; -webkit-appearance: none; background-image: var(--chev); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; padding-right: 34px; }
.inp:focus, label.f input:focus, label.f select:focus, label.f textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: var(--faint); }
.chk { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; }
.chk input, .switch input { accent-color: var(--accent); width: 16px; height: 16px; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; font-weight: 600; }
input.tg {
  appearance: none; -webkit-appearance: none; width: 38px; height: 22px; border-radius: 999px; background: var(--line-2); position: relative;
  cursor: pointer; flex: none; margin: 0; transition: background .15s; border: 0;
}
input.tg::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 999px; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
input.tg:checked { background: var(--accent); }
input.tg:checked::after { transform: translateX(16px); }
input.tg:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- Przyciski ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  padding: 9px 18px; border-radius: 999px; cursor: pointer; font-weight: 650; white-space: nowrap; text-decoration: none; line-height: 1.3; transition: filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.07); }
.btn .ic { width: 17px; height: 17px; }
.btn.ghost { background: var(--card-2); color: var(--text); border-color: var(--line-2); }
.btn.ghost:hover { background: var(--hover); filter: none; }
.btn.danger { background: transparent; color: var(--err); border-color: var(--err-line); }
.btn.danger:hover { background: var(--err-soft); filter: none; }
.btn.sm { padding: 5px 12px; font-size: 12.5px; font-weight: 600; gap: 6px; }
.btn.sm .ic { width: 15px; height: 15px; }
.btn.sm:not(.ghost):not(.danger) { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-line); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }

/* ---------- Segmenty, zakładki, kafelki ---------- */
.pills, .seg2, .subtabs { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 14px; background: var(--seg-bg); border: 1px solid var(--line); }
.pills button, .seg2 button, .subtabs button {
  border: 0; background: none; color: var(--muted); border-radius: 10px; padding: 7px 13px; cursor: pointer; font-size: 13.5px; font-weight: 600; white-space: nowrap;
}
.pills button:hover, .seg2 button:hover, .subtabs button:hover { color: var(--text); }
.pills button.on, .seg2 button.on, .subtabs button.on { background: var(--seg-on); color: var(--seg-on-text); box-shadow: var(--seg-shadow); }
.seg2 { display: flex; width: 100%; }
.seg2 button { flex: 1; }
.subtabs { margin-bottom: 16px; }

/* ---------- Komunikaty, znaczniki ---------- */
.msgs { display: flex; flex-direction: column; gap: 6px; }
.msg { border-radius: 12px; padding: 9px 12px; font-size: 13px; border: 1px solid transparent; }
.msg.err { background: var(--err-soft); color: var(--err); border-color: var(--err-line); }
.msg.warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.msg.info { background: var(--info-soft); color: var(--text); border-color: var(--line); }
.msg.ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted); white-space: nowrap; }
.tag .ic { width: 13px; height: 13px; }
.tag.hyb { border-color: var(--ok-line); color: var(--ok); }
.tag.smp { border-color: var(--err-line); color: var(--err); }
.tag.warnt { border-color: var(--warn-line); color: var(--warn); background: var(--warn-soft); }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: sp .8s linear infinite; vertical-align: -2px; }
@keyframes sp { to { transform: rotate(360deg); } }

/* ---------- Tabele ---------- */
.tbl-wrap { overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
table.list { border-collapse: collapse; width: 100%; font-size: 13.5px; }
table.list th { text-align: left; padding: 13px 14px; font-weight: 550; font-size: 12.5px; color: var(--muted); white-space: nowrap; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1; background: var(--card); }
table.list td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list tr:hover td { background: var(--hover); }
table.list td .inp { padding: 6px 10px; border-radius: 10px; font-size: 13px; }
table.list td select.inp { min-width: 132px; }
.link-cell { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 4px; }
table.items { width: 100%; border-collapse: collapse; font-size: 13px; }
table.items td, table.items th { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
table.items th { color: var(--muted); font-weight: 550; font-size: 12.5px; }
table.items tr:last-child td { border-bottom: 0; }
table.items .inp { padding: 6px 9px; border-radius: 9px; font-size: 13px; }

/* ---------- Edytor cen ---------- */
.grid-wrap { overflow: auto; max-height: calc(100vh - 280px); background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
table.grid { border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
table.grid th { position: sticky; top: 0; z-index: 2; background: var(--card-2); color: var(--muted); padding: 10px 8px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line-2); font-weight: 600; }
table.grid th.price { background: var(--price-head); color: var(--accent-text); }
table.grid th.sale { background: var(--sale-head); color: var(--ok); }
table.grid td { border-bottom: 1px solid var(--line); padding: 3px 4px; background: var(--card); }
table.grid td.idc, table.grid th.idc { position: sticky; left: 0; z-index: 1; border-right: 1px solid var(--line); }
table.grid th.idc { z-index: 3; }
table.grid input, table.grid select { border: 1px solid transparent; background-color: transparent; padding: 5px 7px; width: 100%; min-width: 64px; font-size: 12.5px; border-radius: 8px; color: var(--text); }
table.grid input:hover, table.grid select:hover { border-color: var(--line-2); }
table.grid input:focus, table.grid select:focus { border-color: var(--accent); background-color: var(--field); outline: none; }
table.grid select { min-width: 132px; appearance: none; -webkit-appearance: none; background-image: var(--chev); background-repeat: no-repeat; background-position: right 6px center; background-size: 14px; padding-right: 24px; }
table.grid td.price input { background-color: var(--price-cell); font-weight: 650; }
table.grid td.sale input { background-color: var(--sale-cell); font-weight: 650; }
table.grid td.calc { background: var(--card-2); text-align: right; padding: 4px 10px; white-space: nowrap; min-width: 78px; font-variant-numeric: tabular-nums; }
table.grid td.calc.auto { color: var(--faint); font-style: italic; }
table.grid td.calc.neg { color: var(--err); font-weight: 700; background: var(--err-soft); }
table.grid td.dirty input, table.grid td.dirty select { border-color: var(--accent); background-color: var(--accent-soft); }
table.grid tr.del td { background: var(--err-soft); }
table.grid tr.del input { text-decoration: line-through; color: var(--err); }
table.grid tr.new td { background: var(--ok-soft); }
table.grid td.act { white-space: nowrap; padding: 3px 8px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: var(--muted); margin: 0 0 4px; }
.legend .key { display: inline-block; padding: 1px 8px; border-radius: 6px; font-weight: 650; margin-right: 6px; }
.legend .key.price { background: var(--price-head); color: var(--accent-text); }
.legend .key.sale { background: var(--sale-head); color: var(--ok); }
.legend .key.calc { background: var(--card-2); color: var(--muted); }

/* ---------- Cennik ---------- */
.cn + .cn { margin-top: 20px; }
.cn h3 { margin: 0 0 10px; font-size: 15px; font-weight: 650; color: var(--title); display: flex; align-items: center; gap: 8px; }
.cn h3 .cnt { font-size: 11.5px; font-weight: 600; color: var(--muted); border: 1px solid var(--line-2); border-radius: 999px; padding: 1px 8px; }
table.cennik { table-layout: fixed; }
table.cennik th:nth-child(1) { width: 38%; } table.cennik th:nth-child(2) { width: 36%; }
table.cennik th:nth-child(3) { width: 10%; } table.cennik th:nth-child(4) { width: 16%; }
table.cennik td:nth-child(2) { color: var(--muted); }
table.cennik td:last-child b { white-space: nowrap; }
table.cennik .u { color: var(--muted); font-size: 12px; }

/* ---------- Statystyki, ustawienia, drobne ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; margin-bottom: 14px; }
.stats > div { padding: 14px 16px; border-right: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.stats > div:last-child { border-right: 0; }
.stats b { display: block; font-size: 24px; font-weight: 300; color: var(--title); letter-spacing: -.01em; margin-bottom: 2px; }
.set-group + .set-group { margin-top: 22px; }
.set-row { display: grid; grid-template-columns: 1fr minmax(160px, 280px); gap: 14px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.set-row .k { font-size: 11.5px; color: var(--faint); margin-top: 2px; }
.set-row.changed .inp { border-color: var(--accent); background: var(--accent-soft); }
.secret { font-size: 26px; font-weight: 700; letter-spacing: .06em; text-align: center; padding: 16px; border-radius: 14px; background: var(--card-2); border: 1px dashed var(--accent-line); color: var(--title); margin: 12px 0; }
.copy { display: flex; gap: 6px; align-items: center; }
.copy .inp { flex: 1; }
.logo-prev { max-height: 52px; max-width: 220px; background: #fff; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line); }
.box { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 13px; background: var(--card-2); }
.box .t { font-weight: 650; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.owner { background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 12px; padding: 9px 12px; font-size: 12.5px; }
.owner .t { color: var(--accent-text); font-weight: 700; font-size: 12px; }
details > summary { cursor: pointer; font-size: 13px; color: var(--link); font-weight: 600; }

/* ---------- Logowanie ---------- */
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 0; gap: 18px; }
.auth-brand { display: flex; align-items: center; gap: 12px; color: var(--text); }
.auth-brand .mk { width: 44px; height: 44px; }
.auth-brand > span > b { display: block; font-size: 18px; font-weight: 700; color: var(--title); }
.auth-brand > span > span { display: block; font-size: 12.5px; color: var(--muted); }
.center-box { width: 100%; max-width: 460px; }
.center-box h1 { margin: 0 0 6px; font-size: 24px; font-weight: 650; color: var(--title); letter-spacing: -.01em; }

/* ---------- Okna, toast ---------- */
.modal { position: fixed; inset: 0; background: rgba(4, 9, 18, .6); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 70; padding: 16px; }
.modal .dlg { background: var(--card); color: var(--text); border: 1px solid var(--line-2); border-radius: 22px; max-width: 640px; width: 100%; padding: 24px; max-height: 92vh; overflow: auto; box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .6); }
.modal h2 { margin: 0 0 14px; font-size: 21px; font-weight: 650; color: var(--title); letter-spacing: -.01em; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #14213A; color: #fff; padding: 11px 18px; border-radius: 999px; font-size: 13.5px; z-index: 80; box-shadow: 0 14px 34px -12px rgba(0, 0, 0, .55); border: 1px solid rgba(255, 255, 255, .08); max-width: calc(100vw - 32px); }

/* ======================= Kalkulator ======================= */
.kalk { display: grid; grid-template-columns: minmax(330px, 404px) minmax(0, 1fr); gap: 18px; align-items: start; }
.cfg { padding: 4px 20px 14px; }
.step { padding: 16px 0; border-bottom: 1px solid var(--line); }
.step-h { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.step-n {
  width: 24px; height: 24px; border-radius: 999px; display: grid; place-items: center; flex: none;
  font-size: 12px; font-weight: 700; color: var(--accent-text); background: var(--accent-soft); border: 1px solid var(--accent-line);
}
.cfg .step-h h3 { margin: 0; font-size: 15px; }
.lbl { display: block; font-size: 12.5px; color: var(--muted); font-weight: 500; margin: 14px 0 6px; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 12px 11px; border-radius: 14px; min-width: 0;
  border: 1px solid var(--line-2); background: var(--field); color: var(--text); cursor: pointer; text-align: left; transition: border-color .15s, background .15s;
}
.tile:hover { border-color: var(--accent-line); }
.tile .ic { width: 28px; height: 28px; color: var(--muted); }
.tile .tt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tile .tt b { font-size: 13.5px; font-weight: 650; line-height: 1.25; }
.tile .tt span { font-size: 11.5px; color: var(--muted); line-height: 1.3; }
.tile.on { border-color: var(--accent); background: var(--accent-soft); }
.tile.on .ic { color: var(--accent); }
.num-in { display: flex; align-items: baseline; gap: 8px; border: 1px solid var(--line-2); border-radius: 14px; background: var(--field); padding: 4px 14px; transition: border-color .15s, box-shadow .15s; }
.num-in:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.num-in input { border: 0; background: none; outline: none; font-size: 30px; font-weight: 300; letter-spacing: -.01em; width: 100%; min-width: 0; color: var(--title); padding: 4px 0; }
.num-in .u { font-size: 14px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.num-in.sm input { font-size: 19px; font-weight: 400; padding: 5px 0; }
.opt { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; cursor: pointer; }
.opt > span b { display: block; font-size: 13.5px; font-weight: 600; }
.opt > span span { display: block; font-size: 12px; color: var(--muted); }
.opt-more { margin: 4px 0 8px 50px; }
details.more { padding: 14px 0 2px; }
details.more > summary { list-style: none; display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; font-weight: 650; padding: 2px 0; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary .ic { transition: transform .15s; color: var(--muted); }
details.more[open] > summary .ic { transform: rotate(90deg); }
details.more > summary .aside { margin-left: auto; font-size: 12px; font-weight: 500; color: var(--faint); }
.more-b { padding-top: 12px; }

.res { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
/* przyklejone tylko wtedy, gdy wyniki mieszczą się na ekranie (klasę ustawia fitRes) */
.res.stick { position: sticky; top: 12px; }
.board { padding: 0; overflow: hidden; }
.board-top { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.board-top .bt-l { min-width: 0; flex: 1 1 260px; }
.board-top .bt-l .status { display: block; }
.board-top h3 { margin: 0 !important; }
.board-top .status { display: block; margin-top: 2px; }
.bgrid { display: grid; grid-template-columns: minmax(118px, 156px) repeat(3, minmax(0, 1fr)); position: relative; }
.bc { grid-column: var(--c); grid-row: var(--r); padding: 9px 14px; position: relative; z-index: 1; min-width: 0; border-top: 1px solid var(--line); }
.bl { color: var(--muted); font-size: 13px; }
.bv { font-size: 13.5px; font-weight: 600; color: var(--text); border-left: 1px solid var(--line); overflow-wrap: anywhere; }
.bv .val { min-width: 0; }
.bv small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.bv small.bad { color: var(--err); font-weight: 600; }
.bgp { grid-column: 1 / -1; grid-row: var(--r); padding: 16px 14px 6px; font-size: 12px; color: var(--faint); font-weight: 650; border-top: 1px solid var(--line); position: relative; z-index: 1; }
.bh { border-top: 0; padding: 16px 14px 14px; }
.bv.bh, .bh { border-left: 1px solid var(--line); }
.bl.bh { border-left: 0; }
.vname { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 650; font-size: 15.5px; color: var(--title); }
.vprice { font-size: 34px; font-weight: 300; letter-spacing: -.02em; color: var(--title); line-height: 1.1; margin: 10px 0 4px; white-space: nowrap; }
.vprice small { font-size: 15px; font-weight: 500; color: var(--muted); margin-left: 5px; letter-spacing: 0; }
.vprice.none { color: var(--faint); }
.vsub { font-size: 12px; color: var(--muted); }
.vctl { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.inoff { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); cursor: pointer; font-weight: 600; }
.rec { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line-2); background: none; color: var(--muted); border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 600; cursor: pointer; }
.rec .ic { width: 14px; height: 14px; }
.rec:hover { color: var(--accent-text); border-color: var(--accent-line); }
.rec.on { cursor: default; color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.rec.on .ic { fill: currentColor; }
.magc { display: flex; align-items: flex-start; gap: 10px; }
.mini { display: inline-flex; align-items: center; gap: 6px; }
.mini input { width: 68px; text-align: right; padding: 5px 9px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--field); color: var(--text); font-weight: 600; }
.mini input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.mini span { color: var(--muted); font-weight: 500; }
.berr { border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.bfoot { padding: 12px 14px 14px; }
.bfoot .row { gap: 6px; }
.glow {
  grid-column: var(--c); grid-row: 1 / -1; z-index: 0; pointer-events: none;
  background: radial-gradient(130% 42% at 50% 0%, var(--sunlight), transparent 72%), linear-gradient(180deg, var(--accent-soft), transparent 46%);
  box-shadow: inset 1px 0 0 var(--accent-line), inset -1px 0 0 var(--accent-line);
  animation: rise .45s ease-out;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.det-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.det-h h3 { margin: 0 !important; }
.det-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 14px; }
.det-sec { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: var(--card-2); font-size: 13px; }
.det-sec h4 { margin: 0 0 8px; font-size: 12.5px; color: var(--muted); font-weight: 650; }
.det-sec p { margin: 0 0 8px; }
.det-sec p:last-child { margin-bottom: 0; }
.det-sec label.f + label.f { margin-top: 10px; }
.det-items { border: 1px solid var(--line); border-radius: 14px; overflow: auto; }
.actbar { display: none; }
.vpick { display: flex; flex-direction: column; gap: 8px; }
.vp { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 14px; background: var(--field); }
.vp > span { flex: 1; min-width: 0; }
.vp b { display: block; font-size: 14px; }
.vp small { display: block; color: var(--muted); font-size: 12px; }
.vp .recpick { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.vp .recpick input { accent-color: var(--accent); }

/* ---------- Ruch ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Szerokości ---------- */
@media (max-width: 1240px) {
  .kalk { grid-template-columns: 1fr; }
  .res.stick { position: static; }
}
@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
}
@media (max-width: 1024px) {
  .app { display: block; padding: 0; }
  .side { position: fixed; left: 10px; top: 10px; bottom: 10px; height: auto; width: 276px; z-index: 60; transform: translateX(-112%); transition: transform .22s ease; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .6); }
  .app.nav-open .side { transform: none; }
  .burger { display: grid; }
  .top { padding: 10px 12px 6px; }
  main { padding: 4px 12px 96px; }
}
@media (max-width: 860px) {
  .bgrid { grid-template-columns: 1fr; }
  .bc { grid-column: 1; grid-row: auto; order: var(--o); border-left: 0 !important; }
  .bl, .bgp, .glow { display: none; }
  .bv { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; text-align: right; }
  .bv::before { content: attr(data-l); color: var(--muted); font-weight: 400; font-size: 13px; text-align: left; flex: none; max-width: 46%; }
  .bv .val { text-align: right; }
  .bh { border-top: 8px solid var(--bg); text-align: left; }
  .bh.recv { box-shadow: inset 4px 0 0 var(--accent); background: linear-gradient(180deg, var(--accent-soft), transparent); }
  .bfoot { justify-content: flex-end; }
  .bfoot::before { content: none; }
  .berr { order: var(--o); }
  .actbar {
    display: flex; position: fixed; left: 10px; right: 10px; bottom: 10px; z-index: 50; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 10px 10px 16px; border-radius: 18px; background: var(--card); border: 1px solid var(--line-2); box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .6);
  }
  .actbar .status { font-size: 12.5px; }
}
@media (max-width: 640px) {
  .who-btn .who-t { display: none; }
  .who-btn { padding: 3px; }
  .crumb .grp, .crumb .s1 { display: none; }
  h2.page { font-size: 24px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: 1fr; }
  .tile { flex-direction: row; align-items: center; }
  .tile .ic { width: 24px; height: 24px; }
  .set-row { grid-template-columns: 1fr; }
  table.cennik { table-layout: auto; }
  table.cennik th:nth-child(3), table.cennik td:nth-child(3) { display: none; }
  .panel { padding: 16px; border-radius: 16px; }
  .cfg { padding: 2px 16px 12px; }
}

/* ---------- Oferty: filtry i lista ---------- */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px; margin-bottom: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.search { position: relative; flex: 1 1 260px; display: flex; align-items: center; }
.search .ic { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.search .inp { padding-left: 38px; }
.fsel { display: inline-flex; align-items: center; gap: 8px; padding: 0 4px 0 12px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--field); font-size: 13px; color: var(--muted); }
.fsel select.inp { border: 0; box-shadow: none; padding-left: 2px; background-color: transparent; font-weight: 650; min-width: 150px; }
.filters .status { margin-left: auto; padding-right: 8px; }
.lnk { border: 0; background: none; padding: 0; color: var(--text); font-weight: 650; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 4px; cursor: pointer; font-size: inherit; }
.lnk:hover { text-decoration-color: var(--accent); }
table.list td small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; margin-top: 2px; }
table.list td b { font-weight: 650; }
.exp { width: 32px; height: 32px; border-radius: 10px; border: 1px solid transparent; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.exp:hover { border-color: var(--line-2); color: var(--text); }
.exp .ic { transition: transform .15s; }
.exp[aria-expanded="true"] .ic { transform: rotate(180deg); }
table.list tr.xrow td { background: var(--card-2); padding: 12px 14px 14px; }
table.list tr.xrow:hover td { background: var(--card-2); }
.xacts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.xacts .small { margin-left: auto; }
select.st { font-weight: 650; }
select.st-wait { color: var(--warn); } select.st-sent { color: var(--link); } select.st-ok { color: var(--ok); } select.st-no { color: var(--err); }
table.list td.r small { white-space: normal; }
table.list td.tdc { min-width: 150px; }

/* ---------- Prowizja handlowca i podpowiedź do zużycia ---------- */
.pv { display: inline-flex; align-items: center; gap: 6px; }
.pv input { width: 78px; text-align: right; padding: 5px 9px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--field); color: var(--text); font-weight: 600; }
.pv input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pv-sw { display: inline-flex; padding: 2px; gap: 2px; border-radius: 9px; background: var(--seg-bg); border: 1px solid var(--line); }
.pv-sw button { border: 0; background: none; color: var(--muted); padding: 3px 8px; border-radius: 7px; font-weight: 650; font-size: 12px; cursor: pointer; }
.pv-sw button.on { background: var(--seg-on); color: var(--seg-on-text); box-shadow: var(--seg-shadow); }
.sug { margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: var(--accent-soft); border: 1px solid var(--accent-line); }
.sug-h { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 650; color: var(--accent-text); margin-bottom: 8px; }
.sug-h .ic { width: 16px; height: 16px; }
.sug-b { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 10px; }
.sug-b b { display: block; font-size: 22px; font-weight: 400; color: var(--title); letter-spacing: -.01em; line-height: 1.2; }
.sug-b small { display: block; font-size: 12px; color: var(--muted); }
.sug .row { gap: 6px; }
