/* HotelFix — mobile-first; desktop (≥960px) dla kierowników */
:root {
  --ink: #16384a;          /* petrol — kolor zaplecza hotelu */
  --ink-2: #245066;
  --paper: #f3f6f7;
  --card: #ffffff;
  --line: #d7e0e4;
  --text: #1b2a33;
  --muted: #5b707c;
  --focus: #2b8fd6;
  --urgent: #c2352b;
  --high: #d0801a;
  --normal: #2f6f9e;
  --low: #8b9ba5;
  --done: #2c7a4b;
  --radius: 10px;
  --nav-h: 64px;
  --font: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
}
*, *::before, *::after { box-sizing: inherit; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font: 16px/1.5 var(--font); color: var(--text); background: var(--paper);
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 16px);
}
body.guest { padding-bottom: 0; }
h1, h2 { line-height: 1.2; margin: 0; }
h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; font-weight: 600; }
a { color: var(--ink-2); }
.muted { color: var(--muted); }
small { font-size: .82rem; }
.ico { width: 1.15em; height: 1.15em; vertical-align: -.2em; flex: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------- górny pasek ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: var(--ink); color: #fff;
}
.brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.05rem; }
.brand-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: #fff; color: var(--ink); }
.brand-mark.big { width: 52px; height: 52px; border-radius: 14px; background: var(--ink); color: #fff; }
.brand-mark.big .ico { width: 28px; height: 28px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.whoami { display: none; font-size: .9rem; }
.whoami small { opacity: .7; margin-left: 4px; }
.langs { display: flex; gap: 2px; background: rgba(255,255,255,.12); border-radius: 8px; padding: 2px; }
.langs a { color: #fff; text-decoration: none; font-size: .78rem; font-weight: 600; padding: 4px 8px; border-radius: 6px; opacity: .75; }
.langs a.on { background: #fff; color: var(--ink); opacity: 1; }
.langs-login { justify-content: center; background: var(--line); margin: 24px auto 0; width: max-content; }
.langs-login a { color: var(--ink); }

/* ---------- nawigacja: dół na telefonie ---------- */
.mainnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around; align-items: stretch;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--card); border-top: 1px solid var(--line);
}
.mainnav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: .72rem; font-weight: 500; min-width: 0;
}
.mainnav a .ico { width: 22px; height: 22px; }
.mainnav a.on { color: var(--ink); font-weight: 700; }
.mainnav .nav-report { color: #fff; }
.mainnav .nav-report .ico {
  width: 46px; height: 46px; padding: 11px; margin-top: -22px; border-radius: 50%;
  background: var(--urgent); box-shadow: 0 4px 12px rgba(194,53,43,.35); border: 3px solid var(--card);
}
.mainnav .nav-report span { color: var(--urgent); font-weight: 700; }

/* ---------- treść ---------- */
.content { max-width: 1240px; margin: 0 auto; padding: 16px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 14px; }
.lead { margin: -6px 0 16px; max-width: 70ch; }
.flash { padding: 12px 14px; border-radius: var(--radius); margin: 0 0 14px; font-weight: 500; }
.flash-ok { background: #e3f2e8; color: #1d5a35; }
.flash-err { background: #fbe6e4; color: #8c231b; }

/* ---------- przyciski i formularze ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 16px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font: 600 .95rem var(--font); text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--ink-2); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--ink-2); }
.btn-done { background: var(--done); border-color: var(--done); color: #fff; }
.btn-block { width: 100%; }
.btn-lg { min-height: 54px; font-size: 1.05rem; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .85rem; }
.btn.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.linkbtn { background: none; border: 0; padding: 8px 4px; color: var(--muted); font: 500 .9rem var(--font); text-decoration: underline; cursor: pointer; }
.linkbtn.danger { color: var(--urgent); }

.stack { display: flex; flex-direction: column; gap: 16px; }
.form-narrow { max-width: 560px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .92rem; }
label.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 500; }
label.check input { width: 22px; height: 22px; }
input, select, textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); color: var(--text); font: 400 16px var(--font); /* 16px = brak auto-zoomu na iOS */
}
textarea { resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px rgba(43,143,214,.2); }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; font-size: .92rem; margin-bottom: 8px; padding: 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card-form { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 24px; }

/* kafelki wyboru */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; font-weight: 500; }
.chip input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; min-height: 0; }
.chip span { display: block; padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); }
.chip input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.chips-prio .chip-urgent input:checked + span { background: var(--urgent); border-color: var(--urgent); }
.chips-prio .chip-high input:checked + span { background: var(--high); border-color: var(--high); }
.chips-prio .chip-low input:checked + span { background: var(--low); border-color: var(--low); }

/* zdjęcia — najważniejszy element formularza zgłoszenia */
.photo-drop { position: relative; display: block; cursor: pointer; }
.photo-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; min-height: 0; height: 100%; }
.photo-drop-inner {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center;
  min-height: 150px; padding: 18px; border: 2px dashed #9fb3bd; border-radius: 14px; background: #e9f0f3; color: var(--ink);
}
.photo-drop-inner .ico { width: 40px; height: 40px; }
.photo-drop-inner small { color: var(--muted); font-weight: 400; }
.photo-drop.small .photo-drop-inner { min-height: 84px; flex-direction: row; gap: 10px; }
.photo-drop.small .ico { width: 26px; height: 26px; }
.photo-drop input:focus-visible + .photo-drop-inner { outline: 3px solid var(--focus); outline-offset: 2px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumbs:empty { display: none; }
.thumbs img { width: 76px; height: 76px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }

/* ---------- zakładki i filtry ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px 14px; padding: 0 16px; scrollbar-width: none; }
.tabs a {
  flex: none; padding: 9px 14px; border-radius: 999px; text-decoration: none; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); font-weight: 600; font-size: .9rem; white-space: nowrap;
}
.tabs a.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: #e3eaee; color: var(--ink); font-size: .75rem; text-align: center; }
.tabs a.on .count { background: rgba(255,255,255,.2); color: #fff; }
.count-warn { background: var(--urgent) !important; color: #fff !important; }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.filters input[type=search] { grid-column: 1 / -1; }

/* ---------- lista zgłoszeń ---------- */
.tlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tlist-head { display: none; }
.tcard { background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--normal); border-radius: var(--radius); }
.tcard > a {
  display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; padding: 12px 14px;
  grid-template-areas: "id title status" "loc loc when" "who who who";
  color: inherit; text-decoration: none;
}
.prio-edge-urgent { border-left-color: var(--urgent); }
.prio-edge-high { border-left-color: var(--high); }
.prio-edge-low { border-left-color: var(--low); }
.t-id { grid-area: id; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.t-title { grid-area: title; font-weight: 600; min-width: 0; }
.t-cat { display: block; font-weight: 400; color: var(--muted); }
.t-status { grid-area: status; }
.t-loc { grid-area: loc; display: flex; align-items: center; gap: 4px; font-weight: 600; color: var(--ink); }
.t-when { grid-area: when; color: var(--muted); font-size: .85rem; text-align: right; }
.t-who { grid-area: who; font-size: .85rem; color: var(--muted); }
.overdue { color: var(--urgent) !important; font-weight: 600; }
.tag-rec, .tag-photo { display: inline-flex; align-items: center; gap: 2px; margin-left: 6px; color: var(--muted); font-size: .8rem; font-weight: 500; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: .76rem; font-weight: 600; white-space: nowrap; }
.st-new { background: #fde8d7; color: #8a4a0f; }
.st-assigned { background: #e2ecf5; color: #1f4f78; }
.st-in_progress { background: #dcecf2; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink-2); }
.st-done { background: #e1f1e6; color: #1d5a35; }
.st-cancelled { background: #eceff1; color: #5b6770; }
.st-rec { background: #ece8f5; color: #4a3b78; }
.prio { font-weight: 600; font-size: .8rem; }
.prio-urgent { color: var(--urgent); }
.prio-high { color: var(--high); }
.prio-normal { color: var(--normal); }
.prio-low { color: var(--low); }

.empty { text-align: center; padding: 48px 16px; background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty p { margin: 0 0 16px; color: var(--muted); }

/* ---------- szczegóły zgłoszenia ---------- */
.backlink { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 10px; text-decoration: none; font-weight: 500; }
.ticket { background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--normal); border-radius: var(--radius); padding: 16px; }
.ticket-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.ticket-loc { display: flex; align-items: center; gap: 6px; margin: 8px 0 0; }
.ticket-desc { white-space: normal; margin: 14px 0 0; max-width: 70ch; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-top: 14px; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0 0; }
.facts dt { font-size: .8rem; color: var(--muted); }
.facts dd { margin: 0; font-weight: 500; }
.resolution { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.resolution p { margin: 6px 0 0; }
.actions { display: flex; flex-direction: column; gap: 12px; margin: 16px 0; }
.panel > summary { list-style: none; }
.panel > summary::-webkit-details-marker { display: none; }
.panel[open] > summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.panel > form { background: var(--card); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); padding: 14px; }
.inline-form { display: flex; align-items: flex-end; gap: 8px; }
.inline-form label { flex: 1; }
.quiet-actions { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.history { margin-top: 24px; }
.timeline { list-style: none; margin: 10px 0 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 14px 10px; }
.timeline li::before { content: ""; position: absolute; left: -21px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--card); border: 2px solid var(--ink-2); }
.timeline time { font-size: .8rem; color: var(--muted); }
.timeline p { margin: 2px 0 0; }
.log-note { display: block; margin-top: 4px; padding: 8px 10px; background: var(--paper); border-radius: 8px; }

/* ---------- zadania cykliczne ---------- */
.rlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rcard { display: grid; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.rcard.is-off { opacity: .6; }
.r-main { display: flex; flex-direction: column; gap: 2px; }
.r-every { display: inline-flex; align-items: center; gap: 4px; font-size: .88rem; color: #4a3b78; font-weight: 500; }
.r-dates { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .9rem; }
.r-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* ---------- raporty ---------- */
.range { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-bottom: 18px; }
.range label { flex: 1 1 140px; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; }
.kpi b { font-size: 1.7rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi span { font-weight: 600; font-size: .88rem; margin-top: 4px; }
.kpi small { color: var(--muted); }
.kpi-warn b { color: var(--high); }
.kpi-bad { border-color: #efb8b3; }
.charts { display: grid; gap: 12px; margin-bottom: 18px; }
.chart { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.chart figcaption { font-weight: 600; margin-bottom: 8px; }
.chart-box { position: relative; height: 240px; }
.tables { display: grid; gap: 12px; }
.table-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.table-card h2 { margin-bottom: 8px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: .8rem; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.is-off td { color: var(--muted); }

/* ---------- logowanie ---------- */
.login { max-width: 400px; margin: 8vh auto 0; padding: 0 4px; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.login h1 { font-size: 1.8rem; }

/* ---------- tablet ---------- */
@media (min-width: 640px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .filters { grid-template-columns: 2fr 1fr 1fr 1fr; }
  .filters input[type=search] { grid-column: auto; }
  .facts { grid-template-columns: repeat(4, 1fr); }
  .rcard { grid-template-columns: 1fr auto; }
  .r-actions { grid-column: 1 / -1; }
}

/* ---------- desktop: panel kierownika ---------- */
@media (min-width: 960px) {
  body { padding-bottom: 0; padding-left: 220px; }
  body.guest { padding-left: 0; }
  .whoami { display: block; }
  .topbar { margin-left: -220px; padding-left: 20px; }
  .mainnav {
    top: 0; bottom: 0; left: 0; right: auto; width: 220px; height: auto; z-index: 25;
    flex-direction: column; justify-content: flex-start; gap: 2px;
    padding: 70px 12px 16px; border-top: 0; border-right: 1px solid var(--line);
  }
  .mainnav a { flex: none; flex-direction: row; justify-content: flex-start; gap: 10px; padding: 10px 12px; border-radius: 8px; font-size: .95rem; }
  .mainnav a.on { background: #e6eef1; }
  .mainnav .nav-report { color: var(--card); background: var(--urgent); margin: 6px 0 10px; }
  .mainnav .nav-report .ico { width: 22px; height: 22px; padding: 0; margin: 0; border: 0; box-shadow: none; background: none; }
  .mainnav .nav-report span { color: #fff; }
  .mainnav .nav-out { margin-top: auto; }
  .content { padding: 24px 32px; }
  h1 { font-size: 1.75rem; }

  .tlist { gap: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
  .tlist-head, .tcard > a {
    display: grid; grid-template-columns: 64px minmax(0, 2.2fr) minmax(0, 1.1fr) 130px 160px 130px; gap: 12px; align-items: center;
    grid-template-areas: none; padding: 11px 16px;
  }
  .tlist-head { font-size: .78rem; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); background: var(--paper); }
  .tcard { border: 0; border-left: 4px solid var(--normal); border-radius: 0; border-bottom: 1px solid var(--line); }
  .tcard:last-child { border-bottom: 0; }
  .tcard > a > * { grid-area: auto; }
  .tcard > a:hover { background: #f7fafb; }
  .t-when { text-align: left; }
  .t-who { font-size: .92rem; color: var(--text); }
  .prio-edge-urgent { border-left-color: var(--urgent); }
  .prio-edge-high { border-left-color: var(--high); }
  .prio-edge-low { border-left-color: var(--low); }

  .kpis { grid-template-columns: repeat(6, 1fr); }
  .charts { grid-template-columns: 1fr 1fr; }
  .chart-wide { grid-column: 1 / -1; }
  .chart-box { height: 280px; }
  .tables { grid-template-columns: 1.2fr 1fr 0.8fr; align-items: start; }
  .presets { width: auto; margin-right: 12px; }
  .range label { flex: 0 0 170px; }

  .ticket, .actions, .history { max-width: 860px; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
