/* Stawa Hotel — panel recepcji.
   Narzędzie do pracy przy ladzie: gęsto, czytelnie, bez ozdobników.
   Akcent (--accent) ustawia app.js z koloru wybranego hotelu. */

:root {
  --ink: #10333F;
  --ink-2: #1A4553;
  --bg: #EEF2F3;
  --surface: #FFFFFF;
  --surface-2: #F5F8F9;
  --text: #13242B;
  --muted: #5A6A72;
  --faint: #93A1A7;
  --line: #DCE4E7;
  --accent: #0E7C86;
  --accent-soft: #0E7C861F;
  --ok: #12976B;
  --warn: #C27A06;
  --bad: #D93D3D;
  --radius: 14px;
  --font: 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
  /* Czat zawsze jak w komunikatorze: niebieski = recepcja, szary = gość
     (niezależnie od akcentu hotelu; spójnie z aplikacją gościa) */
  --chat-mine: #0084FF; --on-chat-mine: #FFFFFF;
  --chat-theirs: #E9E9EB; --on-chat-theirs: #13242B;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0A1215; --surface: #132026; --surface-2: #18262C; --text: #E6EEF0; --muted: #94A6AD;
    --faint: #5F7178; --line: #24353C; --ink: #0B1D24; --ink-2: #13303A; color-scheme: dark;
    --chat-theirs: #303030; --on-chat-theirs: #E6EEF0;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.45 var(--font); }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
.muted { color: var(--muted); }
.error { color: var(--bad); font-weight: 600; }
.num { font-variant-numeric: tabular-nums; }

/* ---- przyciski i pola ---- */
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 9px 14px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 1px; border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn.wide { width: 100%; justify-content: center; padding: 12px; }
.btn[disabled] { opacity: .5; cursor: default; }
label { display: grid; gap: 5px; font-size: 13px; font-weight: 700; color: var(--muted); }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; background: var(--surface); font-size: 15px; font-weight: 500; }
textarea { min-height: 84px; resize: vertical; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); font-weight: 600; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stack { display: grid; gap: 12px; }

/* pola wielojęzyczne */
.tri { display: grid; gap: 6px; }
.tri-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 700; color: var(--muted); }
.tri-tabs { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.tri-tabs button { border: 0; background: transparent; padding: 3px 9px; font-size: 12px; font-weight: 800; cursor: pointer; color: var(--muted); }
.tri-tabs button.on { background: var(--accent); color: #fff; }
.tri-tabs button.filled:not(.on) { color: var(--accent); }

/* ---- logowanie ---- */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px; background: linear-gradient(160deg, var(--ink), var(--ink-2)); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border-radius: 20px; padding: 28px; display: grid; gap: 14px; }
.login-card h1 { font-size: 24px; font-weight: 900; }
.login-logo { border-radius: 14px; }
.lang-switch { display: flex; gap: 6px; justify-content: center; }
.lang-switch button { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 800; cursor: pointer; color: var(--muted); }
.lang-switch button.on { border-color: var(--accent); color: var(--accent); }

/* ---- układ ---- */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100%; }
.side { background: var(--ink); color: #fff; display: flex; flex-direction: column; padding: 16px 12px; gap: 16px; position: sticky; top: 0; height: 100vh; }
.side-head { display: flex; gap: 10px; align-items: center; padding: 0 6px; }
.side-head img { border-radius: 10px; }
.brand { font-weight: 900; font-size: 15px; }
.side select { background: transparent; color: #fff; border: 0; padding: 0; font-weight: 600; font-size: 13px; opacity: .85; cursor: pointer; }
.side select option { color: #000; }
.nav { display: grid; gap: 2px; overflow-y: auto; }
.nav a { color: rgba(255,255,255,.78); text-decoration: none; padding: 9px 10px; border-radius: 10px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a.on { background: rgba(255,255,255,.12); color: #fff; }
.nav .badge { background: var(--accent); color: #fff; border-radius: 999px; font-size: 12px; font-weight: 800; padding: 1px 8px; }
.nav .sep { height: 1px; background: rgba(255,255,255,.1); margin: 8px 6px; }
.side-foot { margin-top: auto; display: grid; gap: 10px; padding: 0 6px; }
.side-foot .lang-switch { justify-content: flex-start; }
.side-foot .lang-switch button { border-color: rgba(255,255,255,.25); color: rgba(255,255,255,.7); }
.side-foot .lang-switch button.on { border-color: #fff; color: #fff; }
.side-foot .btn { color: rgba(255,255,255,.8); border-color: rgba(255,255,255,.25); justify-self: start; }
.me { font-size: 13px; opacity: .75; overflow: hidden; text-overflow: ellipsis; }
.main { min-width: 0; padding: 22px 28px 60px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; font-weight: 900; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- treść ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat b { display: block; font-size: 32px; font-weight: 900; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-weight: 600; font-size: 13px; }
.stat.hot b { color: var(--accent); }
.section-title { font-size: 17px; font-weight: 800; margin: 22px 0 10px; }
.list { display: grid; gap: 8px; }
.row { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; }
.row.attention { border-color: var(--accent); box-shadow: inset 4px 0 0 var(--accent); }
.row .room { font-size: 22px; font-weight: 900; min-width: 56px; text-align: center; font-variant-numeric: tabular-nums; }
.row .title { font-weight: 700; }
.row .meta { color: var(--muted); font-size: 13px; }
.row .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.empty { color: var(--muted); padding: 30px; text-align: center; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.pill { display: inline-flex; align-items: center; gap: 5px; border: 1px solid currentColor; border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 800; }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.s-pending { color: var(--warn); } .s-confirmed { color: var(--accent); } .s-done { color: var(--ok); }
.s-declined { color: var(--bad); } .s-cancelled { color: var(--faint); }
.code { font-size: 15px; font-weight: 900; letter-spacing: 2px; font-variant-numeric: tabular-nums; background: var(--surface-2); border: 1px solid var(--line); padding: 2px 8px; border-radius: 8px; }
.filters { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.filters button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px; font-weight: 700; font-size: 13px; cursor: pointer; }
.filters button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.panel + .panel { margin-top: 14px; }

/* czat */
.chat { display: grid; grid-template-columns: 280px 1fr; gap: 14px; height: calc(100vh - 140px); min-height: 420px; }
.chat-list { overflow-y: auto; display: grid; align-content: start; gap: 6px; }
.chat-item { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer; display: grid; gap: 2px; }
.chat-item.on { border-color: var(--accent); }
.chat-item.unread { box-shadow: inset 4px 0 0 var(--accent); }
.chat-item b { font-size: 15px; }
.chat-item small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); display: grid; grid-template-rows: auto 1fr auto; min-height: 0; }
.chat-box header { padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 800; }
.msgs { overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 72%; padding: 9px 13px; border-radius: 18px 18px 18px 6px; background: var(--chat-theirs); color: var(--on-chat-theirs); }
.msg.staff { align-self: flex-end; border-radius: 18px 18px 6px 18px; background: var(--chat-mine); color: var(--on-chat-mine); }
.msg small { display: block; opacity: .7; font-size: 11px; margin-top: 3px; }
.chat-form { display: grid; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.chat-compose { display: flex; gap: 8px; }
.chat-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface-2); border-radius: 999px; padding: 4px 12px; font-size: 13px; cursor: pointer; }
.chip:hover, .chip:focus-visible { border-color: var(--chat-mine); outline: none; }
.msg .tr { margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(127, 127, 127, .3); font-style: italic; }
.msg .link { background: none; border: 0; padding: 0; color: var(--chat-mine); font-size: 11px; font-weight: 700; cursor: pointer; }
.chat-form textarea { min-height: 44px; height: 44px; }

/* QR karta pobytu (do druku) */
.stay-card { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 6px 0; }
.stay-card .qr svg, .stay-card .qr img { width: 220px; height: 220px; }
.stay-card .big-code { font-size: 30px; font-weight: 900; letter-spacing: 4px; font-variant-numeric: tabular-nums; }

/* dialog i toast */
.dialog { border: 0; border-radius: 18px; padding: 0; width: min(560px, calc(100vw - 24px)); background: var(--surface); color: var(--text); }
.dialog::backdrop { background: rgba(8,20,25,.5); }
.dialog form { padding: 22px; display: grid; gap: 14px; max-height: calc(100vh - 40px); overflow-y: auto; }
.dialog h2 { font-size: 20px; font-weight: 900; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin: 4px 0 0; padding: 0; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 12px; font-weight: 700; z-index: 10; max-width: calc(100vw - 32px); }
.toast.bad { background: var(--bad); }

@media print {
  body * { visibility: hidden; }
  .dialog, .dialog * { visibility: visible; }
  .dialog { position: absolute; inset: 0; width: 100%; box-shadow: none; }
  .dialog-actions { display: none; }
}

@media (max-width: 860px) {
  /* minmax(0, 1fr): zwykłe 1fr rośnie do szerokości paska menu i cała strona
     przewijała się w bok — teraz przewija się tylko pasek menu */
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .side, .main { min-width: 0; }
  .side { position: static; height: auto; padding: 12px; gap: 10px; }
  .nav { grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; scrollbar-width: none; margin: 0 -12px; padding: 0 12px; }
  .nav::-webkit-scrollbar { display: none; }
  .cards { grid-template-columns: 1fr 1fr; gap: 10px; }
  .nav .sep { display: none; }
  .side-foot { flex-direction: row; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0; }
  .main { padding: 16px 16px 60px; }
  .row { grid-template-columns: auto 1fr; }
  .row .actions { grid-column: 1 / -1; justify-content: flex-start; }
  .chat { grid-template-columns: 1fr; height: auto; }
  .chat-list { max-height: 220px; }
  .chat-box { height: 70vh; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
}

/* zdjęcie w czacie */
.msg .chat-img { display: block; margin-bottom: 6px; }
.msg .chat-img img { max-width: 240px; max-height: 240px; border-radius: 12px; display: block; background: rgba(0,0,0,.06); min-width: 80px; min-height: 80px; object-fit: cover; }

/* pakiety Start / Pro / Premium */
.plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 12px; }
@media (max-width: 900px) { .plans { grid-template-columns: 1fr; } }
.plan { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.plan.on { border: 2px solid var(--accent); box-shadow: 0 8px 24px rgba(0,0,0,.08); }
.plan header b { font-size: 20px; margin-right: 8px; }
.plan ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.plan li.new { font-weight: 700; }
.plan li.soon { opacity: .6; }
.plan li small { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }

/* import przyjazdów */
.imp-map { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 8px; }
@media (max-width: 700px) { .imp-map { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.imp-map label { font-size: 12px; }
.imp-table { max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.imp-table table { width: 100%; border-collapse: collapse; font-size: 13px; }
.imp-table th, .imp-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.imp-table tr.bad td { color: var(--bad); }

/* trend ocen */
.trend { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; align-items: end; height: 150px; margin-top: 10px; }
.trend .tw { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 3px; font-size: 11px; }
.trend .tb { width: 70%; background: var(--accent); border-radius: 6px 6px 0 0; min-height: 2px; }
.trend .tb.low { background: var(--bad); }

/* czas reakcji przekroczony */
.row.late { border-color: var(--bad); box-shadow: inset 4px 0 0 var(--bad); }
.late-text { color: var(--bad); }

/* zgłoszenie obiektu */
.login-card.wide-card { max-width: 640px; }
.login .center { text-align: center; }
.apply-status p { margin: 0; }

/* grafik dnia */
.sched { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.sched-col { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.sched-col header { display: flex; flex-direction: column; gap: 2px; margin-bottom: 6px; }
.sched-slot { display: grid; grid-template-columns: 48px 1fr auto; gap: 8px; align-items: center; padding: 5px 6px; border-radius: 8px; font-size: 13px; }
.sched-slot .t { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--muted); }
.sched-slot.busy { background: var(--accent-soft); }
.sched-slot.busy .t { color: var(--text); }
.sched-slot.full { box-shadow: inset 3px 0 0 var(--warn); }
.sched-slot .cap { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* pole „miejsce na mapie” (mapPick.js) */
.mapfield { display: flex; flex-direction: column; gap: 8px; }
.mapfield-head { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 700; }
.mapfield-head .muted { font-weight: 400; font-variant-numeric: tabular-nums; }
.mapfield-search { display: flex; gap: 8px; }
.mapfield-search input { flex: 1; }
.mapfield-map { height: 260px; border-radius: 12px; border: 1px solid var(--line); overflow: hidden; cursor: crosshair; z-index: 0; }
.mapfield-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; }
.mapfield-pin span { display: block; width: 28px; height: 28px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: var(--accent); border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.4); }
@media (max-width: 520px) { .mapfield-map { height: 220px; } }
