/* System zgłoszeń wejść na sieć oświetlenia – style */
:root {
  --navy: #1c2b3a;
  --navy-2: #26394c;
  --amber: #f2a900;
  --amber-soft: #fff4d6;
  --ink: #1d232a;
  --muted: #66717d;
  --line: #d9dee4;
  --bg: #f3f5f7;
  --card: #ffffff;
  --blue: #1f5fa8;
  --green: #1d7a46;
  --green-soft: #e3f4ea;
  --red: #b3261e;
  --red-soft: #fbe7e5;
  --orange: #b85c00;
  --orange-soft: #fff0df;
  --gray-soft: #eceff2;
  --radius: 10px;
  --tap: 46px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--blue); }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; line-height: 1.25; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
code { background: var(--gray-soft); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.warn-text { color: var(--orange); font-weight: 600; }
.center { text-align: center; }
.print-only { display: none; }

/* ---------- Pasek górny ---------- */
.topbar {
  background: var(--navy); color: #fff; display: flex; align-items: center; flex-wrap: wrap;
  padding: 0 16px; min-height: 58px; gap: 8px; border-bottom: 3px solid var(--amber);
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; padding: 10px 0; margin-right: 16px; }
.brand span { font-size: 1rem; }
.mainnav { display: flex; align-items: center; flex: 1; gap: 2px; flex-wrap: wrap; }
.mainnav a, .mainnav .linklike {
  color: #d5dde6; text-decoration: none; padding: 8px 12px; border-radius: 6px; font-size: .95rem;
  min-height: 40px; display: inline-flex; align-items: center;
}
.mainnav a:hover, .mainnav .linklike:hover { background: var(--navy-2); color: #fff; }
.mainnav a.active { background: var(--navy-2); color: #fff; box-shadow: inset 0 -3px 0 var(--amber); }
.nav-sep { width: 1px; height: 24px; background: #3e5266; margin: 0 6px; }
.nav-spacer { flex: 1; }
.nav-user { font-weight: 600; }
.linklike { background: none; border: 0; font: inherit; cursor: pointer; }
.menu-toggle { display: none; margin-left: auto; background: none; border: 1px solid #4a5f74; color: #fff; font-size: 1.3rem; border-radius: 6px; width: 46px; height: 40px; }
form.inline { display: inline; }

/* ---------- Układ ---------- */
.container { max-width: 1180px; margin: 0 auto; padding: 20px 16px 40px; }
.footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 16px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.back { display: inline-block; margin-bottom: 4px; text-decoration: none; font-size: .9rem; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.card.narrow { max-width: 460px; margin: 32px auto; }
.card.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 16px; }
.align-start { align-items: start; }
.stack { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }

/* ---------- Formularze ---------- */
label, .label { display: block; font-weight: 600; font-size: .95rem; margin-bottom: 14px; }
label .muted { font-weight: 400; }
input[type=text], input[type=tel], input[type=email], input[type=password], input[type=search],
input[type=date], input[type=datetime-local], input[type=number], select, textarea {
  display: block; width: 100%; margin-top: 5px; min-height: var(--tap); padding: 10px 12px;
  font: inherit; font-weight: 400; color: var(--ink); background: #fff;
  border: 1px solid #b9c2cc; border-radius: 8px;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(242,169,0,.45); border-color: var(--amber); }
input[type=file] { display: block; margin-top: 6px; font: inherit; max-width: 100%; }
fieldset { border: 0; border-top: 1px solid var(--line); margin: 0 0 8px; padding: 14px 0 0; }
fieldset:first-of-type { border-top: 0; padding-top: 0; }
legend { font-weight: 700; font-size: 1.05rem; padding: 0 8px 0 0; color: var(--navy); }
.has-error input, .has-error select, .has-error textarea { border-color: var(--red); background: #fffafa; }
.field-error { color: var(--red); font-weight: 500; font-size: .875rem; margin-top: 4px; }
.switch { display: flex; align-items: flex-start; gap: 10px; font-weight: 500; cursor: pointer; padding: 8px 0; }
.switch input { width: 24px; height: 24px; flex: 0 0 24px; margin: 0; accent-color: var(--navy); }
.choice-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 6px 0 16px; }
.choice { margin: 0; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  display: flex; align-items: center; justify-content: center; text-align: center; min-height: 56px; padding: 8px;
  border: 2px solid #b9c2cc; border-radius: 8px; font-weight: 600; background: #fff; line-height: 1.25;
}
.choice input:checked + span { border-color: var(--navy); background: var(--navy); color: #fff; }
.choice input:focus-visible + span { outline: 3px solid rgba(242,169,0,.6); }
.quick-hours { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: -6px 0 14px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 10px 0; }
.inline-form input, .inline-form select { width: auto; flex: 1 1 220px; margin-top: 0; }

/* ---------- Przyciski ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tap);
  padding: 10px 18px; border: 1px solid #b9c2cc; border-radius: 8px; background: #fff; color: var(--ink);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; line-height: 1.2;
}
.btn:hover { background: #f4f6f8; }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-success:hover { background: #16653a; }
.btn-warn { background: var(--amber); border-color: #d99800; color: #241a00; }
.btn-danger { background: #fff; border-color: var(--red); color: var(--red); }
.btn-large { min-height: 56px; font-size: 1.05rem; padding: 12px 26px; }
.btn-small { min-height: 36px; padding: 6px 12px; font-size: .875rem; }
.btn-block { width: 100%; }

/* ---------- Komunikaty ---------- */
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; }
.flash-ok { background: var(--green-soft); border-color: #a9d8bb; color: #12502e; }
.flash-err { background: var(--red-soft); border-color: #eab3ae; color: #7c1a14; }
.flash-warn { background: var(--orange-soft); border-color: #f1c58f; color: #6b3600; }
.flash-volt { background: var(--amber-soft); border-color: var(--amber); color: #4a3500; font-weight: 600; }
.conflict-box { background: var(--amber-soft); border: 2px solid var(--amber); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 16px; }
.conflict-box h2 { color: #6b4b00; }
.conflict-box ul { margin: 0 0 8px; padding-left: 20px; }
.conflict-box li { margin-bottom: 6px; }
.notice { background: #eef4fb; border: 1px solid #c4d8ef; border-radius: 8px; padding: 14px 16px; margin-bottom: 16px; }
.status-card.is-sub { border-left: 5px solid var(--amber); }

/* ---------- Statusy ---------- */
.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: 3px 8px; border-radius: 99px; vertical-align: middle; letter-spacing: .01em; white-space: nowrap; }
.badge-zaplanowane { background: #e4edf8; color: #1b4d87; }
.badge-w_toku { background: var(--green-soft); color: #12502e; }
.badge-przekroczone { background: var(--red-soft); color: var(--red); }
.badge-zakonczone { background: var(--gray-soft); color: #46515c; }
.badge-anulowane { background: var(--gray-soft); color: #6b747d; text-decoration: line-through; }
.badge-volt { background: var(--amber); color: #241a00; }
h1 .badge { font-size: .85rem; }

/* ---------- Zakładki, filtry, tabela ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 12px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tabs a {
  padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; white-space: nowrap;
  border-bottom: 3px solid transparent; margin-bottom: -2px;
}
.tabs a.active { color: var(--navy); border-bottom-color: var(--amber); }
.tabs .count { background: var(--gray-soft); color: var(--ink); border-radius: 99px; padding: 1px 8px; font-size: .8rem; margin-left: 4px; }
.tabs a.active .count { background: var(--navy); color: #fff; }
.filters { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; }
.filters summary { padding: 12px 16px; cursor: pointer; font-weight: 600; }
.filter-grid { display: grid; grid-template-columns: 2fr 1.3fr 1.3fr 1fr 1fr; gap: 0 12px; padding: 0 16px 6px; align-items: end; }
.filter-buttons { display: flex; gap: 8px; margin-bottom: 14px; grid-column: 1 / -1; }
.list-tools { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.list-tools span:last-child { display: flex; gap: 6px; }

.table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 16px; }
.table th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #f8f9fb; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr.inactive td { opacity: .55; }
.reports tbody tr { cursor: pointer; }
.reports tbody tr:hover td { background: #fafbfc; }
.reports tr.row-przekroczone td:first-child { box-shadow: inset 4px 0 0 var(--red); }
.reports tr.row-w_toku td:first-child { box-shadow: inset 4px 0 0 var(--green); }
.reports tr.row-zaplanowane td:first-child { box-shadow: inset 4px 0 0 #6d9bd1; }
.reports .num { font-weight: 700; text-decoration: none; }
.pager { display: flex; gap: 4px; flex-wrap: wrap; }
.pager a { min-width: 40px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 6px; background: #fff; text-decoration: none; }
.pager a.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---------- Szczegóły ---------- */
.details { display: grid; grid-template-columns: 220px 1fr; gap: 0; margin: 0; }
.details dt { color: var(--muted); padding: 8px 12px 8px 0; border-bottom: 1px solid #eef0f3; }
.details dd { margin: 0; padding: 8px 0; border-bottom: 1px solid #eef0f3; }
.action-card { border: 2px solid var(--green); }
.sub-actions { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 8px; }
.sub-actions details, .card > details { padding: 6px 0; }
.sub-actions summary, .card > details summary { cursor: pointer; color: var(--blue); font-weight: 600; padding: 6px 0; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.gallery a { display: block; text-decoration: none; color: var(--muted); font-size: .8rem; }
.gallery img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--gray-soft); display: block; margin-bottom: 3px; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.thumbs img { width: 88px; height: 66px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.history { list-style: none; padding: 0; margin: 0; font-size: .92rem; }
.history li { padding: 5px 0; border-bottom: 1px dashed #e4e7eb; }
.login-card h1 { margin-bottom: 0; }

/* ---------- Widok do druku (pojedyncze zgłoszenie) ---------- */
.print-page { background: #e9ecef; }
.print-toolbar { display: flex; gap: 8px; justify-content: center; padding: 14px; }
.sheet { background: #fff; max-width: 210mm; margin: 0 auto 30px; padding: 16mm 16mm 12mm; box-shadow: 0 2px 12px rgba(0,0,0,.12); font-size: 11pt; }
.sheet-head { display: flex; justify-content: space-between; gap: 16px; border-bottom: 2px solid #000; padding-bottom: 8px; margin-bottom: 14px; }
.sheet-head h1 { font-size: 16pt; margin: 2px 0 0; }
.sheet-org { font-size: 9pt; color: #444; text-transform: uppercase; letter-spacing: .05em; }
.sheet-num { text-align: right; font-size: 11pt; }
.sheet-num b { font-size: 14pt; }
.sheet-table { width: 100%; border-collapse: collapse; }
.sheet-table th, .sheet-table td { border: 1px solid #555; padding: 6px 8px; text-align: left; vertical-align: top; }
.sheet-table th { width: 34%; background: #f1f1f1; font-weight: 600; }
.signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; margin: 46px 0 20px; }
.signatures div { border-top: 1px dotted #000; padding-top: 4px; font-size: 9pt; text-align: center; }
.sheet-h2 { font-size: 12pt; margin: 16px 0 8px; }
.sheet-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sheet-photos figure { margin: 0; break-inside: avoid; }
.sheet-photos img { width: 100%; max-height: 80mm; object-fit: contain; border: 1px solid #ccc; }
.sheet-photos figcaption { font-size: 8pt; color: #444; }
.sheet-foot { margin-top: 14px; font-size: 8pt; color: #666; text-align: right; }

/* ---------- Tablet / telefon ---------- */
@media (max-width: 900px) {
  .filter-grid { grid-template-columns: 1fr 1fr; }
  .filter-grid label:first-of-type { grid-column: 1 / -1; }
  .choice-grid { grid-template-columns: 1fr 1fr; }
  .menu-toggle { display: block; }
  .mainnav { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; padding-bottom: 10px; }
  .mainnav.open { display: flex; }
  .mainnav a, .mainnav .linklike { min-height: var(--tap); width: 100%; }
  .nav-sep { width: 100%; height: 1px; margin: 6px 0; }
  .brand span { font-size: .95rem; }
}
@media (max-width: 720px) {
  .container { padding: 14px 10px 30px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .card { padding: 14px; }
  h1 { font-size: 1.35rem; }
  .details { grid-template-columns: 1fr; }
  .details dt { border-bottom: 0; padding-bottom: 0; font-size: .85rem; }
  /* tabela -> karty */
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table { border: 0; background: none; }
  .table tr { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; padding: 6px 0; }
  .table td { border: 0; padding: 5px 14px; }
  .table td[data-label]::before { content: attr(data-label); display: block; font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
  .reports td:first-child::before { display: none; }
  .reports tr.row-przekroczone { border-left: 5px solid var(--red); }
  .reports tr.row-w_toku { border-left: 5px solid var(--green); }
  .reports tr.row-zaplanowane { border-left: 5px solid #6d9bd1; }
  .reports td:first-child { box-shadow: none !important; }
  .form-actions .btn { flex: 1 1 100%; }
  .sheet { padding: 8mm; }
}

/* ---------- Drukowanie ---------- */
@media print {
  @page { size: A4; margin: 12mm; }
  body, .print-page { background: #fff; font-size: 10pt; }
  .topbar, .footer, .no-print, .flash, .menu-toggle { display: none !important; }
  .print-only { display: block; }
  .container { max-width: none; padding: 0; }
  .card { border: 0; padding: 0; }
  .sheet { box-shadow: none; margin: 0; padding: 0; max-width: none; }
  .table { border: 1px solid #999; display: table; }
  .table thead { display: table-header-group; }
  .table tr { display: table-row; border: 0; padding: 0; }
  .table td, .table th { display: table-cell; border: 1px solid #999; padding: 4px 6px; font-size: 9pt; }
  .table td::before { display: none !important; }
  .table tr { break-inside: avoid; }
  a { color: #000; text-decoration: none; }
  .badge { border: 1px solid #999; background: none !important; color: #000 !important; }
}
