/* DECOR — wygląd panelu handlowca (ekran). Wygląd PDF jest w offer.css. */
:root {
  --burgundy: #5E181B;
  --burgundy-dark: #3F0F12;
  --burgundy-soft: #F3E9E7;
  --cream: #FCFAF6;
  --sand: #EFEDE8;
  --ink: #1E1616;
  --muted: #6F6765;
  --line: #E4DEDA;
  --ok: #2F6B3A;
  --warn: #9A5B00;
  --radius: 14px;
  --font: 'Host Grotesk', 'Segoe UI', Arial, sans-serif;
  --font-display: 'Bricolage Grotesque', 'Host Grotesk', 'Segoe UI', Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--sand); color: var(--ink); font: 15px/1.5 var(--font); }
[hidden] { display: none !important; }

/* Pasek górny */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 10px 24px; background: var(--cream); border-bottom: 1px solid var(--line); }
.topbar__logo { height: 34px; }
.topbar__title { font: 700 18px var(--font-display); color: var(--burgundy); }
.topbar__actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* Układ */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; max-width: 1280px; margin: 0 auto; padding: 24px; }
.form { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; padding: 16px; }
  .summary { position: static !important; }
  .topbar { position: static; padding: 10px 16px; flex-wrap: wrap; }
  .topbar__actions { margin-left: 0; }
}

.card { background: var(--cream); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.card__title { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font: 700 18px var(--font-display); color: var(--ink); }
.step { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--burgundy); color: #fff; font: 600 13px var(--font); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.field small { font-weight: 400; }
input, select, textarea { width: 100%; font: 15px var(--font); color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; }
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--burgundy); outline-offset: 0; border-color: transparent; }
.hint { margin-top: 8px; font-size: 13px; color: var(--muted); }

.input-suffix { position: relative; }
.input-suffix input { padding-right: 40px; }
.input-suffix span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; }

/* Przyciski */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 999px; font: 600 14px var(--font); cursor: pointer; border: 1px solid transparent; text-decoration: none; white-space: nowrap; }
.btn--primary { background: var(--burgundy); color: #fff; }
.btn--primary:hover { background: var(--burgundy-dark); }
.btn--ghost { background: transparent; color: var(--burgundy); border-color: var(--burgundy); }
.btn--ghost:hover { background: var(--burgundy-soft); }
.btn--block { width: 100%; margin-top: 8px; }
.btn--icon { padding: 4px 10px; border: none; background: none; color: var(--muted); font-size: 18px; cursor: pointer; }
.btn--icon:hover { color: var(--burgundy); }

/* Chipsy (cele klienta) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-weight: 500; font-size: 14px; cursor: pointer; }
.chip input { display: none; }
.chip:has(input:checked) { background: var(--burgundy); color: #fff; border-color: var(--burgundy); }

/* Pakiety */
.packages { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 760px) { .packages { grid-template-columns: 1fr 1fr; } }
.pkg { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 14px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; text-align: left; font: inherit; color: inherit; }
.pkg:hover { border-color: var(--burgundy); }
.pkg[aria-checked="true"] { border-color: var(--burgundy); background: var(--burgundy); color: #fff; }
.pkg__name { font: 700 17px var(--font-display); }
.pkg__price { font-size: 14px; font-weight: 600; }
.pkg__time { font-size: 12px; opacity: .75; }

.calc { display: flex; align-items: flex-end; gap: 16px; margin-top: 16px; flex-wrap: wrap; }
.field--area { width: 180px; margin: 0; }
.calc__result { flex: 1; min-width: 240px; padding: 10px 14px; border-radius: 10px; background: var(--burgundy-soft); color: var(--burgundy); font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.calc__result strong { font: 700 20px var(--font-display); margin-left: auto; padding-left: 12px; white-space: nowrap; }
.calc__result.is-muted { background: #F4F1EE; color: var(--muted); font-weight: 500; }

.manual { margin-top: 14px; padding: 14px; border: 1px dashed var(--warn); border-radius: 12px; background: #FFF8EC; }
.manual__info { color: var(--warn); font-weight: 600; font-size: 14px; margin-bottom: 10px; }

/* Galerie */
.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tab { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font: 600 13px var(--font); color: var(--muted); cursor: pointer; }
.tab[aria-selected="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.tab .count { display: inline-block; min-width: 18px; margin-left: 4px; padding: 0 5px; border-radius: 9px; background: var(--burgundy); color: #fff; font-size: 11px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.thumb { position: relative; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; border: 3px solid transparent; padding: 0; cursor: pointer; background: var(--sand); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb[aria-pressed="true"] { border-color: var(--burgundy); }
.thumb__badge { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%; background: rgba(255,255,255,.85); border: 1.5px solid var(--muted); display: grid; place-items: center; font: 700 12px var(--font); color: #fff; }
.thumb[aria-pressed="true"] .thumb__badge { background: var(--burgundy); border-color: #fff; }
.empty { padding: 18px; border-radius: 10px; background: #F4F1EE; color: var(--muted); font-size: 14px; grid-column: 1 / -1; }
.empty code { background: #fff; padding: 1px 5px; border-radius: 4px; }

/* Handlowiec */
.contact-preview { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; background: #fff; border: 1px solid var(--line); font-size: 14px; }
.avatar { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; background: var(--burgundy); color: #fff; display: grid; place-items: center; font: 700 18px var(--font-display); flex: none; }
.contact-preview__name { font-weight: 700; }
.contact-preview__meta { color: var(--muted); font-size: 13px; }

/* Opcje dodatkowe */
.extras-add { display: flex; gap: 8px; margin-bottom: 10px; }
.extras-add select { flex: 1; }
.extras { width: 100%; border-collapse: collapse; font-size: 14px; }
.extras th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.extras td { padding: 5px 4px; vertical-align: middle; }
.extras td:nth-child(2) input { width: 70px; }
.extras td:nth-child(3) input { width: 64px; }
.extras td:nth-child(4) input { width: 120px; }
.extras td:nth-child(5) { font-weight: 600; white-space: nowrap; text-align: right; }
.extras tbody:empty::after { content: 'Brak opcji dodatkowych.'; display: block; padding: 10px 6px; color: var(--muted); }
@media (max-width: 640px) {
  .extras thead { display: none; }
  .extras tr { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .extras td:first-child { grid-column: 1 / -1; }
  .extras td input { width: 100% !important; }
}

/* Podsumowanie */
.summary { position: sticky; top: 76px; align-self: start; }
.summary__box { background: var(--burgundy); color: #fff; border-radius: var(--radius); padding: 20px; }
.summary__label { font: 700 16px var(--font-display); margin-bottom: 12px; }
.summary__rows div { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px solid rgba(255,255,255,.15); font-size: 14px; }
.summary__rows span:first-child { opacity: .8; }
.summary__total { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 0 6px; }
.summary__total strong { font: 800 26px var(--font-display); }
.summary__warnings { list-style: none; padding: 0; margin: 4px 0 10px; font-size: 13px; }
.summary__warnings li { padding: 6px 10px; margin-top: 6px; border-radius: 8px; background: rgba(255,255,255,.12); }
.summary .btn--primary { background: #fff; color: var(--burgundy); }
.summary .btn--primary:hover { background: var(--burgundy-soft); }
.summary .btn--ghost { color: #fff; border-color: rgba(255,255,255,.5); }
.summary .btn--ghost:hover { background: rgba(255,255,255,.1); }
.summary .hint { color: rgba(255,255,255,.7); }

/* Podgląd */
.preview { position: fixed; inset: 0; z-index: 50; background: #2A2424; display: flex; flex-direction: column; }
.preview__bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 20px; background: var(--cream); }
.preview__scroll { flex: 1; overflow: auto; padding: 24px 16px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 100; background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; }

/* Harmonogram płatności */
.payments td:nth-child(1) input { width: 100%; }
.payments td:nth-child(2) input { width: 70px; }
.payments td:nth-child(3) input { width: 100%; min-width: 150px; }
.payments td:nth-child(4) { font-weight: 600; white-space: nowrap; text-align: right; }
.payments tbody:empty::after { content: 'Brak etapów płatności — harmonogram nie trafi do oferty.'; }
.payments-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.payments-sum { margin-left: auto; font-weight: 600; font-size: 14px; padding: 4px 12px; border-radius: 999px; background: #E6F0E7; color: var(--ok); }
.payments-sum.is-bad { background: #FFF1DD; color: var(--warn); }
@media (max-width: 640px) {
  .payments tr { grid-template-columns: 1fr 1fr; }
  .payments td:nth-child(3) { grid-column: 1 / -1; }
}

/* Opcje dodatkowe — szacunkowe, poza kwotą umowy */
.card__tag { font: 600 12px var(--font); color: var(--warn); background: #FFF1DD; padding: 2px 10px; border-radius: 999px; }
.summary__extras { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; margin: 4px 0 8px; padding: 8px 10px; border: 1px dashed rgba(255,255,255,.4); border-radius: 8px; font-size: 13px; }
.summary__extras span { opacity: .85; }
.summary__extras strong { white-space: nowrap; font-size: 15px; }

/* Zakres dla projektu indywidualnego */
.custom-scope td:nth-child(1) { width: 32%; }
.custom-scope td:nth-child(1) input { width: 100%; font-weight: 600; }
.custom-scope td:nth-child(2) input { width: 100%; }
.custom-scope td:nth-child(3) { width: 40px; }
@media (max-width: 640px) { .custom-scope tr { grid-template-columns: 1fr auto; } .custom-scope td:nth-child(2) { grid-column: 1 / -1; grid-row: 2; } .custom-scope td:first-child { grid-column: 1; } }

.summary__warnings li.is-required { background: #fff; color: var(--burgundy); font-weight: 600; }
.btn.is-disabled { opacity: .55; }

/* ---------- Logowanie (login.html) i sesja ---------- */
.auth-pending body { visibility: hidden; }
.userbox { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.userbox__email { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login { width: 100%; max-width: 380px; background: var(--cream); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px 28px; }
.login__logo { height: 40px; display: block; margin-bottom: 18px; }
.login__title { margin: 0 0 6px; font: 700 24px var(--font-display); color: var(--burgundy); }
.login__lead { margin: 0 0 20px; color: var(--muted); font-size: 14px; }
.login__form label { display: block; margin: 12px 0 4px; font-weight: 600; font-size: 14px; }
.login__form .btn--primary { margin-top: 20px; }
.login__form .btn:disabled { opacity: .6; cursor: wait; }
.login__msg { margin: 16px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--burgundy-soft); font-size: 14px; }
.login__msg.is-error { background: #fff; color: var(--burgundy); border: 1px solid var(--burgundy); font-weight: 600; }
.load-status { margin: 16px 24px 0; padding: 10px 14px; border-radius: 10px; background: var(--burgundy-soft); font-size: 14px; }
.load-status.is-error { background: #fff; color: var(--burgundy); border: 1px solid var(--burgundy); font-weight: 600; }

/* ---------- Ustawienia kierownika (admin.html) ---------- */
.a-wrap { max-width: 880px; margin: 0 auto; padding: 24px 16px 48px; display: flex; flex-direction: column; gap: 18px; }
.a-intro { margin: 0; color: var(--muted); font-size: 14px; }
.a-sub { font: 400 13px var(--font); color: var(--muted); }
.a-prices { display: flex; flex-direction: column; gap: 10px; }
.a-price { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.a-price:last-child { border-bottom: 0; }
.a-price__name { font-weight: 600; }
.a-price__input { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.a-price__input input { width: 120px; text-align: right; }
.a-price__manual { color: var(--muted); font-size: 14px; }
.a-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.a-stages { display: flex; flex-direction: column; gap: 8px; }
.a-stage { display: grid; grid-template-columns: 1.4fr 110px 1.4fr auto; gap: 8px; align-items: center; }
.a-stage__pct { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.a-stage__pct input { text-align: right; }
.a-stages__foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.a-sum { font-weight: 600; color: var(--ok); }
.a-sum.is-bad { color: var(--burgundy); }
.a-save { position: sticky; bottom: 0; background: var(--sand); padding: 12px 0; display: flex; flex-direction: column; gap: 10px; }
.a-save__buttons { display: flex; justify-content: flex-end; gap: 8px; }
.a-errors { margin: 0; padding: 10px 12px 10px 28px; border: 1px solid var(--burgundy); border-radius: 10px; background: #fff; color: var(--burgundy); font-weight: 600; font-size: 14px; }
.a-msg { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--burgundy-soft); font-size: 14px; }
.a-msg.is-error { background: #fff; color: var(--burgundy); border: 1px solid var(--burgundy); font-weight: 600; }
@media (max-width: 640px) {
  .a-grid { grid-template-columns: 1fr; }
  .a-stage { grid-template-columns: 1fr 110px auto; }
  .a-stage input[data-f="due"] { grid-column: 1 / -1; grid-row: 2; }
}

/* ---------- Handlowcy (admin-team.html) ---------- */
.t-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.t-head .card__title { margin: 0; }
.t-form { margin: 16px 0; padding: 16px; border: 1px solid var(--burgundy); border-radius: var(--radius); background: #fff; display: flex; flex-direction: column; gap: 12px; }
.t-form__title { margin: 0; font: 700 16px var(--font-display); color: var(--burgundy); }
.t-form__body { display: grid; grid-template-columns: 150px 1fr; gap: 16px; align-items: start; }
.t-photo { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.t-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex: none; display: inline-flex; align-items: center; justify-content: center; background: var(--burgundy-soft); color: var(--burgundy); font-weight: 700; }
.t-avatar--lg { width: 110px; height: 110px; font-size: 32px; }
.btn--link { border: 0; background: none; color: var(--burgundy); text-decoration: underline; cursor: pointer; font: 500 13px var(--font); }
.t-list { display: flex; flex-direction: column; margin-top: 12px; }
.t-item { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.t-item:last-child { border-bottom: 0; }
.t-item.is-off { opacity: .6; }
.t-item__info { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 14px; color: var(--muted); }
.t-item__info strong { color: var(--ink); font-size: 15px; }
.t-item__actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.t-badge { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: var(--line); color: var(--muted); font-size: 12px; font-weight: 600; }
.t-accounts { width: 100%; border-collapse: collapse; font-size: 14px; }
.t-accounts th { text-align: left; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.t-accounts td { padding: 8px; border-bottom: 1px solid var(--line); }
.t-accounts select { max-width: 280px; }
@media (max-width: 640px) {
  .t-form__body { grid-template-columns: 1fr; }
  .t-item { flex-wrap: wrap; }
  .t-item__actions { width: 100%; justify-content: flex-start; }
}
.t-scroll { overflow-x: auto; }

/* ---------- Galerie (admin-galleries.html) ---------- */
.g-wrap { max-width: 1200px; }
.g-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.g-select { min-width: 280px; flex: 1; max-width: 460px; margin: 0; }
.g-count { margin: 12px 0 0; color: var(--muted); font-size: 14px; }
.g-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; margin-top: 14px; }
.g-tile { margin: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; display: flex; flex-direction: column; }
.g-tile.is-off .g-tile__img img { opacity: .35; filter: grayscale(1); }
.g-tile__img { position: relative; aspect-ratio: 4 / 3; background: var(--sand); }
.g-tile__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.g-tile__no { position: absolute; top: 6px; left: 6px; min-width: 24px; padding: 1px 7px; border-radius: 999px; background: rgba(30,22,22,.75); color: #fff; font-size: 12px; font-weight: 700; text-align: center; }
.g-tile__off { position: absolute; top: 6px; right: 6px; padding: 1px 8px; border-radius: 999px; background: var(--burgundy); color: #fff; font-size: 12px; font-weight: 600; }
.g-tile__bar { display: flex; align-items: center; gap: 4px; padding: 6px; flex-wrap: wrap; }
.g-tile__bar select { flex: 1; min-width: 0; padding: 5px 6px; font-size: 13px; }
.g-tile__bar .btn--icon:disabled { opacity: .3; cursor: default; }
.g-tile__toggle { padding: 4px 10px; font-size: 13px; }
#shortage { margin-top: 10px; }

/* ---------- Zapis w bazie i „Moje oferty” (index.html) ---------- */
.save-status { margin: 10px 0 0; font-size: 13px; color: rgba(255,255,255,.8); }
.save-status.is-ok { color: #cfe8d3; }
.save-status.is-error { padding: 8px 10px; border-radius: 8px; background: #fff; color: var(--burgundy); font-weight: 600; }
.offers-modal { position: fixed; inset: 0; z-index: 60; background: rgba(30,22,22,.55); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.offers-modal__box { width: 100%; max-width: 1100px; background: var(--cream); border-radius: var(--radius); padding: 20px 22px; }
.offers-modal__head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.offers-modal__head h2 { margin: 0; font: 700 20px var(--font-display); color: var(--burgundy); }
.offers-modal__head input { flex: 1; min-width: 200px; }
.offers-table { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 8px; }
.offers-table th { text-align: left; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.offers-table td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.offers-table .num { text-align: right; white-space: nowrap; }
.offers-table small { color: var(--muted); }
.offers-table tr.is-current td { background: var(--burgundy-soft); }
.offers-table__actions { white-space: nowrap; text-align: right; }
.offers-table__actions .btn { padding: 5px 12px; font-size: 13px; margin-left: 4px; }

/* ---------- Link dla klienta (index.html) ---------- */
.share-box { max-width: 820px; display: flex; flex-direction: column; gap: 12px; }
.share-box > .btn { align-self: flex-start; }
.share-new { display: flex; gap: 8px; }
.share-new input { flex: 1; font-family: monospace; font-size: 13px; }
.share-sub { margin: 8px 0 0; font: 700 15px var(--font-display); color: var(--ink); }
.link-state { font-weight: 600; }
.link-state.is-active { color: var(--ok); }
.link-state.is-off { color: var(--muted); }
.goal-add { display: flex; gap: 8px; margin-top: 10px; }
.goal-add input { flex: 1; min-width: 0; }

/* Wysłana oferta: formularz zablokowany, zmiany tylko w kopii (js/app.js applyLock) */
.lock-banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 1232px; margin: 16px auto 0; padding: 14px 18px; border-radius: 12px; background: var(--burgundy-soft); border: 1px solid var(--burgundy); font-size: 14px; line-height: 1.5; }
.lock-banner .btn { flex: none; }
@media (max-width: 900px) { .lock-banner { flex-direction: column; align-items: stretch; margin: 16px; } }
.form.is-locked { opacity: .55; pointer-events: none; user-select: none; }
