:root {
  --akcent: #a8456b;
  --akcent-ciemny: #8a3356;
  --akcent-jasny: #f6e7ee;
  --tlo: #f7f5f6;
  --karta: #ffffff;
  --tekst: #2e2a2c;
  --szary: #8c8488;
  --linia: #e3dde0;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: var(--tekst); background: var(--tlo); font-size: 14px; }
button { font: inherit; cursor: pointer; border: 1px solid var(--linia); background: #fff; color: var(--tekst); border-radius: 8px; padding: 7px 12px; }
button:hover { border-color: var(--akcent); color: var(--akcent); }
input, textarea, select { font: inherit; border: 1px solid var(--linia); border-radius: 8px; padding: 8px 10px; width: 100%; background: #fff; color: var(--tekst); }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--akcent-jasny); border-color: var(--akcent); }

/* Logowanie */
body.logowanie { display: grid; place-items: center; background: linear-gradient(135deg, #a8456b, #6d2a47); padding: 16px; }
.karta-logowania { background: #fff; padding: 32px; border-radius: 16px; width: 100%; max-width: 360px; display: grid; gap: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.karta-logowania .logo { color: var(--akcent); font-size: 26px; }
.karta-logowania p { margin: 0; color: var(--szary); }
.karta-logowania button { background: var(--akcent); color: #fff; border: 0; padding: 11px; font-weight: 600; }
.blad { color: #c0392b; }
.logo { font-family: Georgia, "Times New Roman", serif; font-style: italic; font-weight: 700; font-size: 22px; }

/* Góra */
.gora { display: flex; align-items: center; gap: 16px; padding: 10px 16px; background: var(--akcent); color: #fff; flex-wrap: wrap; }
.gora button { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.3); color: #fff; }
.gora button:hover { background: rgba(255,255,255,.25); color: #fff; border-color: #fff; }
.dodaj-stoly { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.etykieta { opacity: .8; }
.prawa { margin-left: auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.wyloguj { color: #fff; opacity: .8; }
#status-zapisu { font-size: 12px; opacity: .8; min-width: 70px; }

/* Układ */
body:not(.logowanie) { display: flex; flex-direction: column; }
.uklad { display: grid; grid-template-columns: 1fr 320px; flex: 1; min-height: 0; }
.plotno-obszar { position: relative; overflow: hidden; background: #fff; touch-action: none; }
#plotno { width: 100%; height: 100%; display: block; user-select: none; -webkit-user-select: none; }
.zoom { position: absolute; right: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 4px; }
.zoom button { width: 36px; height: 36px; padding: 0; font-size: 18px; box-shadow: 0 2px 6px rgba(0,0,0,.1); }
.podpowiedz { position: absolute; left: 12px; bottom: 12px; right: 70px; color: var(--szary); font-size: 12px; pointer-events: none; }

.panel { background: var(--karta); border-left: 1px solid var(--linia); overflow-y: auto; }
.sekcja { padding: 14px 16px; border-bottom: 1px solid var(--linia); display: grid; gap: 8px; }
.sekcja h3 { margin: 0; font-size: 15px; display: flex; justify-content: space-between; align-items: baseline; }
.sekcja h3 small { color: var(--szary); font-weight: 400; }
.pelny { width: 100%; }
.mala { font-size: 12px; color: var(--szary); margin: 0; }
.wiersz { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pole { display: grid; gap: 4px; }
.pole > span { font-size: 12px; color: var(--szary); }
.licznik { display: grid; grid-template-columns: 34px 1fr 34px; align-items: center; text-align: center; }
.licznik button { padding: 5px 0; }
.licznik b { font-size: 15px; }
.przyciski { display: flex; gap: 6px; flex-wrap: wrap; }
.przyciski button { flex: 1; }
.usun { color: #c0392b; }
.usun:hover { border-color: #c0392b; color: #c0392b; }
.pusty-panel { color: var(--szary); padding: 14px 16px; border-bottom: 1px solid var(--linia); }
.suwak { display: grid; grid-template-columns: 1fr 64px; gap: 8px; align-items: center; }
.suwak input[type=range] { padding: 0; border: 0; accent-color: var(--akcent); }
.suwak input[type=number] { padding: 5px 6px; }

#lista-gosci { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
#lista-gosci li { display: grid; grid-template-columns: 1fr auto auto; gap: 6px; align-items: center; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
#lista-gosci li:hover { background: var(--tlo); }
#lista-gosci li.wybrany { background: var(--akcent-jasny); outline: 1px solid var(--akcent); }
#lista-gosci li .gdzie { font-size: 11px; color: var(--szary); }
#lista-gosci li .gdzie.wolny { color: var(--akcent); }
#lista-gosci li .x { border: 0; padding: 0 4px; color: var(--szary); background: none; }
.filtry label { display: flex; gap: 6px; align-items: center; color: var(--szary); font-size: 13px; }
.filtry input { width: auto; }

/* SVG */
.stol-cialo { fill: #fff; stroke: #9a9296; stroke-width: 2; cursor: move; }
.stol.zaznaczony .stol-cialo { stroke: var(--akcent); stroke-width: 3; fill: #fdf7fa; }
.stol-nazwa { font-size: 16px; fill: var(--tekst); pointer-events: none; text-anchor: middle; dominant-baseline: central; font-weight: 600; }
.stol-podpis { font-size: 11px; fill: var(--szary); pointer-events: none; text-anchor: middle; dominant-baseline: central; }
.miejsce circle { fill: #fff; stroke: #b9b1b5; stroke-width: 1.5; cursor: pointer; }
.miejsce:hover circle { stroke: var(--akcent); stroke-width: 2.5; }
.miejsce.zajete circle { fill: var(--akcent-jasny); stroke: var(--akcent); }
.miejsce.cel circle { stroke: var(--akcent); stroke-width: 4; }
.miejsce .inicjaly { font-size: 13px; font-weight: 600; fill: var(--akcent-ciemny); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.miejsce .numer { font-size: 11px; fill: #c4bcc0; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.imie { font-size: 12px; fill: var(--tekst); pointer-events: none; dominant-baseline: central; }
.uchwyt { fill: var(--akcent); stroke: #fff; stroke-width: 2; cursor: nwse-resize; }
.duch { opacity: .7; pointer-events: none; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(40,20,30,.4); display: grid; place-items: center; padding: 16px; z-index: 10; }
.modal-karta { background: #fff; border-radius: 14px; padding: 20px; width: 100%; max-width: 400px; display: grid; gap: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-karta h3 { margin: 0; }
.modal-przyciski { display: grid; grid-template-columns: auto 1fr auto auto; gap: 8px; }
#modal-zapisz { background: var(--akcent); color: #fff; border-color: var(--akcent); }
.drugorzedny { color: var(--szary); }

.druk-lista { display: none; }

@media (max-width: 800px) {
  .uklad { grid-template-columns: 1fr; grid-template-rows: 65vh auto; flex: none; }
  body:not(.logowanie) { display: block; height: auto; }
  .panel { border-left: 0; border-top: 1px solid var(--linia); }
  .podpowiedz { display: none; }
  .etykieta { display: none; }
}

@media print {
  @page { size: A4 landscape; margin: 10mm; }
  .gora, .panel, .zoom, .podpowiedz { display: none !important; }
  .uklad { display: block; height: auto; }
  .plotno-obszar { height: 180mm; }
  .uchwyt { display: none; }
  .druk-lista { display: block; page-break-before: always; columns: 3; font-size: 11px; }
  .druk-lista h4 { margin: 8px 0 2px; break-after: avoid; }
  .druk-lista ol { margin: 0; padding-left: 18px; break-inside: avoid; }
}
