/* Auto Spa Kielce — panel */
:root {
  --navy: #0b1f33;
  --navy-2: #12304d;
  --navy-3: #1c4266;
  --accent: #00a6c8;
  --accent-2: #0077b6;
  --accent-soft: #e0f6fb;
  --bg: #f3f6fa;
  --card: #ffffff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-2: #cbd5e1;
  --danger: #e11d48;
  --ok: #16a34a;
  --warn: #f59e0b;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .06);
  --shadow-lg: 0 24px 70px rgba(2, 12, 27, .35);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --topbar-h: 64px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.45 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-2); }
img { max-width: 100%; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .4px; }
.pre { white-space: pre-wrap; margin: 0; }
.r { text-align: right; }
.grow { flex: 1; }
.spacer { flex: 1; }
.empty { padding: 24px; text-align: center; }
kbd { font: 600 11px var(--font); background: var(--bg); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; }

.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Przyciski ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid transparent;
  font: 600 14px var(--font); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, box-shadow .15s, transform .05s, color .15s; color: var(--ink); background: transparent; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn-primary { color: #fff; background: linear-gradient(135deg, #00b4d8, #0077b6); box-shadow: 0 4px 14px rgba(0, 150, 200, .35); }
.btn-primary:hover { box-shadow: 0 6px 20px rgba(0, 150, 200, .45); filter: brightness(1.05); }
.btn-soft { background: var(--accent-soft); color: #035c7d; }
.btn-soft:hover { background: #c9eef8; }
.btn-ghost { color: inherit; }
.btn-ghost:hover { background: rgba(100, 116, 139, .12); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-ghost { color: var(--danger); }
.btn-danger-ghost:hover { background: #ffe4e6; }
.btn-icon { width: 38px; padding: 0; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn-sm.btn-icon { width: 30px; }
.btn-lg { height: 46px; font-size: 15px; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent-2); font: 600 12px var(--font); cursor: pointer; margin-left: 6px; }
.link-btn:hover { text-decoration: underline; }

/* ---------- Formularze ---------- */
input, select, textarea { font: inherit; color: inherit; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; justify-content: space-between; }
.field input, .field select, .field textarea, .inline-form input[type=text], .inline-form input[type=number], .filter,
.tbl-edit input[type=text], .tbl-edit input[type=number], .cat-row input[type=text], .cat-row input[type=number], .svc-row input {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; outline: none; transition: border-color .15s, box-shadow .15s; }
.field textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent) !important; box-shadow: 0 0 0 3px rgba(0, 166, 200, .18); }
.invalid { border-color: var(--danger) !important; box-shadow: 0 0 0 3px rgba(225, 29, 72, .15) !important; }
.field-inline { flex-direction: row; align-items: center; gap: 8px; }
.field-inline select { width: auto; height: 34px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.two { display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
.row + .row, .field + .field, .row + .field, .field + .row { margin-top: 12px; }
.dt { display: flex; gap: 6px; }
.dt input[type=time] { width: 110px; flex: none; }
.form-error { color: var(--danger); font-weight: 600; font-size: 13px; margin-right: auto; }

.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; font-size: 13px; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .slider { width: 38px; height: 22px; border-radius: 99px; background: var(--line-2); position: relative; transition: background .2s; flex: none; }
.switch .slider::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .2s; }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::after { transform: translateX(16px); }
.switch input:focus-visible + .slider { box-shadow: 0 0 0 3px rgba(0, 166, 200, .3); }

/* ---------- Logowanie ---------- */
.login-page { background: radial-gradient(1200px 600px at 80% -10%, #0e4a6e 0%, transparent 60%), radial-gradient(900px 500px at -10% 110%, #08364f 0%, transparent 55%), var(--navy); }
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 400px; padding: 36px 32px 24px; border-radius: 20px; background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .08);
  backdrop-filter: blur(12px); box-shadow: var(--shadow-lg); color: #e2f4fb; }
.login-logo { display: block; margin: 0 auto 14px; width: 280px; height: auto; }
.login-sub { text-align: center; color: #8fb7cc; margin: 0 0 24px; }
.login-card .field span { color: #b8d9e8; }
.login-card .field input { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .14); color: #fff; height: 46px; }
.login-card .field { margin-bottom: 14px; }
.login-card .btn { margin-top: 8px; }
.login-foot { text-align: center; color: #5f8aa3; font-size: 12px; margin: 22px 0 0; letter-spacing: 1px; text-transform: uppercase; }
.error-code { text-align: center; font-size: 64px; margin: 10px 0 0; color: #5ee7ff; }
.alert { padding: 10px 12px; border-radius: 10px; margin-bottom: 16px; font-weight: 600; }
.alert-error { background: rgba(225, 29, 72, .15); color: #fecdd3; border: 1px solid rgba(225, 29, 72, .4); }

/* ---------- Pasek górny ---------- */
.app { display: flex; flex-direction: column; height: 100%; }
.topbar { height: var(--topbar-h); flex: none; display: flex; align-items: center; gap: 20px; padding: 0 18px; background: linear-gradient(90deg, var(--navy), var(--navy-2)); color: #e2f4fb; position: relative; z-index: 20;
  box-shadow: 0 2px 12px rgba(2, 12, 27, .25); }
.brand img { display: block; height: 40px; width: auto; }
.search { position: relative; flex: 1; max-width: 560px; margin: 0 auto; }
.search .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #8fb7cc; pointer-events: none; }
.search input { width: 100%; height: 40px; padding: 0 14px 0 40px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .12); background: rgba(255, 255, 255, .08); color: #fff; outline: none; transition: background .2s, border-color .2s; }
.search input::placeholder { color: #8fb7cc; }
.search input:focus { background: #fff; color: var(--ink); border-color: #fff; box-shadow: 0 0 0 4px rgba(0, 180, 216, .3); }
.search input:focus::placeholder { color: var(--muted); }
.search-results { position: absolute; top: calc(100% + 8px); left: 0; right: 0; background: #fff; color: var(--ink); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; max-height: 70vh; overflow: auto; }
.sr-empty { padding: 14px; color: var(--muted); text-align: center; }
.sr-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; cursor: pointer; }
.sr-item:hover, .sr-item.active { background: var(--accent-soft); }
.sr-dot { width: 8px; height: 34px; border-radius: 4px; flex: none; }
.sr-logo { width: 34px; height: 24px; object-fit: contain; flex: none; }
.sr-logo-empty { display: grid; place-items: center; background: var(--bg); border-radius: 6px; font-weight: 700; color: var(--muted); }
.sr-main { flex: 1; min-width: 0; }
.sr-title { font-weight: 700; display: flex; gap: 6px; align-items: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-actions { display: flex; gap: 4px; }

.topnav { display: flex; align-items: center; gap: 6px; }
.topnav .btn-ghost { color: #cfe8f3; }
.topnav .btn-ghost:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.logout { display: flex; align-items: center; gap: 4px; margin-left: 8px; padding-left: 12px; border-left: 1px solid rgba(255, 255, 255, .12); }
.who { font-size: 13px; color: #9fc4d6; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* tablica rejestracyjna (mini) */
.mini-plate { display: inline-flex; align-items: center; height: 24px; padding: 0 8px 0 18px; border: 1.5px solid #0f172a; border-radius: 4px; background: #fff linear-gradient(90deg, #1d4ed8 0 12px, transparent 12px);
  font: 700 12px/1 ui-monospace, Menlo, monospace; letter-spacing: 1px; color: #0f172a; white-space: nowrap; flex: none; }
.mini-plate.lg { height: 30px; font-size: 15px; padding-left: 22px; background: #fff linear-gradient(90deg, #1d4ed8 0 15px, transparent 15px); }

/* ---------- Układ kalendarza ---------- */
.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 260px 1fr; }
.sidebar { background: #fff; border-right: 1px solid var(--line); overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 22px; }
.side-block h3 { margin: 0 0 10px; font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); display: flex; justify-content: space-between; }
.side-link { font-size: 12px; text-decoration: none; display: inline-block; margin-top: 8px; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.legend-item { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; cursor: pointer; font-weight: 600; }
.legend-item:hover { background: var(--bg); }
.legend-item input { accent-color: var(--accent-2); }
.legend-item input:not(:checked) ~ * { opacity: .4; }
.swatch { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.agenda { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.agenda li.muted { font-size: 13px; padding: 4px 2px; }
.agenda-item { width: 100%; display: flex; gap: 8px; align-items: center; text-align: left; border: 0; background: var(--bg); border-left: 4px solid var(--c); border-radius: 8px; padding: 8px 10px; cursor: pointer; font: inherit; color: inherit; transition: background .15s; }
.agenda-item:hover { background: var(--accent-soft); }
.agenda-time { font-size: 11px; color: var(--muted); font-weight: 700; flex: none; width: 54px; }
.agenda-title { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.tips p { margin: 0 0 6px; font-size: 12px; color: var(--muted); }

.cal-wrap { min-width: 0; min-height: 0; padding: 16px 20px 18px; position: relative; }
.cal-wrap::after { content: ""; position: absolute; top: 0; left: 0; height: 3px; width: 0; background: linear-gradient(90deg, #00b4d8, #0077b6); transition: width .4s; }
.cal-wrap.is-loading::after { width: 70%; }
#calendar { height: 100%; background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 14px 16px 10px; }

/* FullCalendar — wygląd */
.fc { --fc-border-color: var(--line); --fc-today-bg-color: #effafd; --fc-page-bg-color: #fff; --fc-neutral-bg-color: #f8fafc;
  --fc-button-bg-color: #fff; --fc-button-border-color: var(--line-2); --fc-button-text-color: var(--ink-2);
  --fc-button-hover-bg-color: var(--bg); --fc-button-hover-border-color: var(--line-2);
  --fc-button-active-bg-color: var(--navy); --fc-button-active-border-color: var(--navy);
  --fc-event-border-color: transparent; --fc-highlight-color: rgba(0, 166, 200, .16); --fc-now-indicator-color: var(--danger);
  --fc-non-business-color: rgba(241, 245, 249, .6); font-size: 13px; }
.fc .fc-toolbar-title { font-size: 20px; font-weight: 800; text-transform: capitalize; letter-spacing: -.2px; }
.fc .fc-button { border-radius: 9px; font-weight: 600; text-transform: none; padding: 6px 12px; box-shadow: none !important; }
.fc .fc-button-primary:not(:disabled).fc-button-active { color: #fff; }
.fc .fc-button-group > .fc-button:not(:first-child) { margin-left: -1px; }
.fc .fc-today-button { margin-left: 8px !important; }
.fc .fc-col-header-cell-cushion { text-transform: uppercase; font-size: 11px; letter-spacing: .8px; color: var(--muted); padding: 8px 4px; text-decoration: none; }
.fc .fc-daygrid-day-number { font-weight: 700; color: var(--ink-2); text-decoration: none; padding: 6px 8px; }
.fc .fc-day-today .fc-daygrid-day-number { background: var(--accent-2); color: #fff; border-radius: 99px; min-width: 26px; text-align: center; margin: 4px; padding: 3px 7px; }
.fc .fc-daygrid-day:hover { background: #fafcfe; cursor: cell; }
.fc .fc-timegrid-slot:hover { background: #f4fbfd; cursor: cell; }
.fc-theme-standard .fc-scrollgrid { border-radius: 12px; overflow: hidden; }
.fc .fc-event { border-radius: 7px; padding: 0; cursor: pointer; transition: transform .12s, box-shadow .12s, opacity .4s; box-shadow: 0 1px 2px rgba(15, 23, 42, .15); }
.fc .fc-event:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(15, 23, 42, .2); }
.fc .fc-daygrid-event { margin-top: 2px; }
.fc .fc-daygrid-dot-event { background: var(--fc-event-bg-color); color: #fff; }
.fc .fc-daygrid-dot-event .fc-daygrid-event-dot { display: none; }
.ev { display: flex; align-items: center; gap: 5px; padding: 3px 6px; color: #fff; min-width: 0; overflow: hidden; font-weight: 600; line-height: 1.25; }
.fc-timegrid-event .ev { flex-wrap: wrap; align-items: flex-start; }
.ev-logo { width: 22px; height: 16px; object-fit: contain; background: rgba(255, 255, 255, .92); border-radius: 4px; padding: 1px; flex: none; }
.ev-time { font-weight: 800; opacity: .9; flex: none; }
.ev-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.fc-timegrid-event .ev-title { white-space: normal; }
.ev-flag { font-size: 11px; font-weight: 900; flex: none; }
.ev-meta { font-size: 10px; flex: none; opacity: .9; }
.ev-pulse { animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.fc .st-done { opacity: .6; }
.fc .st-done .ev-title { text-decoration: line-through; text-decoration-thickness: 1px; }
.fc .ev-leaving { opacity: 0; transform: scale(.9); }
.fc .fc-list-event .ev { color: var(--ink); }
.fc .fc-list-event:hover td { background: var(--accent-soft); }
.fc .fc-list-day-cushion { background: var(--bg); }
.fc .fc-highlight { border-radius: 6px; }
.fc .fc-more-link { font-weight: 700; color: var(--accent-2); }
.fc-event-mirror { opacity: .85; }

/* ---------- Okna dialogowe ---------- */
dialog.modal { border: 0; padding: 0; border-radius: 18px; box-shadow: var(--shadow-lg); width: min(680px, calc(100vw - 24px)); max-height: calc(100vh - 32px); background: var(--bg); color: var(--ink); overflow: hidden; }
dialog.modal[open] { display: flex; flex-direction: column; animation: pop .22s cubic-bezier(.2, .9, .3, 1.2); }
dialog.modal > form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
dialog::backdrop { background: rgba(6, 18, 32, .55); backdrop-filter: blur(3px); animation: fade .2s; }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98); } }
@keyframes fade { from { opacity: 0; } }
.modal-xl { width: min(1180px, calc(100vw - 24px)) !important; }
.modal-lg { width: min(860px, calc(100vw - 24px)) !important; }
.modal-sm { width: min(440px, calc(100vw - 24px)) !important; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 22px 14px; background: #fff; border-bottom: 1px solid var(--line); flex: none; }
.modal-head h2 { margin: 0; font-size: 19px; font-weight: 800; }
.modal-body { padding: 18px 22px; overflow-y: auto; flex: 1; min-height: 0; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 12px 22px; background: #fff; border-top: 1px solid var(--line); flex: none; flex-wrap: wrap; }

.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
fieldset.card { margin: 0 0 14px; min-width: 0; }
fieldset.card legend { float: left; width: 100%; padding: 0; margin: 0 0 12px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: var(--accent-2); }
fieldset.card legend + * { clear: both; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; align-items: start; }
.col { min-width: 0; }

.title-preview { display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; padding: 4px 12px 4px 4px; border-radius: 99px; background: var(--bg); font-weight: 700; font-size: 13px; max-width: 100%; }
.title-preview i { width: 18px; height: 18px; border-radius: 99px; background: var(--c); flex: none; }
.title-preview span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cat-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.cat-pill { --c: #64748b; display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px 0 10px; border-radius: 99px; border: 1.5px solid var(--line-2); background: #fff; font: 700 13px var(--font); cursor: pointer; color: var(--ink-2); text-decoration: none; transition: all .15s; }
.cat-pill i { width: 12px; height: 12px; border-radius: 50%; background: var(--c); }
.cat-pill:hover { border-color: var(--c); }
.cat-pill[aria-checked="true"] { background: var(--c); border-color: var(--c); color: #fff; box-shadow: 0 4px 14px color-mix(in srgb, var(--c) 45%, transparent); }
.cat-pill[aria-checked="true"] i { background: #fff; }
.cat-add { padding: 0 12px; font-size: 16px; color: var(--muted); border-style: dashed; }
.duration { font-size: 12px; margin-top: 8px; font-weight: 600; }

/* combobox */
.combo { position: relative; }
.combo-input { position: relative; }
.combo-input.has-logo input { padding-left: 46px; }
.combo-logo { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); width: 32px; height: 22px; object-fit: contain; pointer-events: none; }
.combo-list { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 40px rgba(15, 23, 42, .18); max-height: 280px; overflow-y: auto; padding: 4px; }
.combo-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; cursor: pointer; font-weight: 500; }
.combo-item img { width: 34px; height: 24px; object-fit: contain; flex: none; }
.combo-item .logo-ph { width: 34px; height: 24px; display: grid; place-items: center; background: var(--bg); border-radius: 6px; font-weight: 800; color: var(--muted); flex: none; }
.combo-item.active, .combo-item:hover { background: var(--accent-soft); }

/* tablica rejestracyjna w formularzu */
.plate { display: flex; align-items: stretch; height: 44px; border: 2px solid #0f172a; border-radius: 8px; overflow: hidden; background: #fff; }
.plate b { display: grid; place-items: end center; width: 26px; padding-bottom: 5px; background: #1d4ed8; color: #fff; font-size: 10px; flex: none;
  background-image: radial-gradient(circle at 50% 30%, #facc15 0 1.5px, transparent 2px); background-size: 100% 26px; background-repeat: no-repeat; }
.plate input { border: 0 !important; box-shadow: none !important; height: 100% !important; font: 800 20px/1 ui-monospace, Menlo, monospace !important; letter-spacing: 2px; text-transform: uppercase; padding: 0 10px !important; border-radius: 0 !important; }
.plate:focus-within { box-shadow: 0 0 0 3px rgba(0, 166, 200, .25); }

/* usługi w formularzu */
.svc-head, .svc-row { display: grid; grid-template-columns: 1fr 70px 100px 92px 30px; gap: 6px; align-items: center; }
.svc-head { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; padding: 0 2px 6px; }
.svc-head span:nth-child(n+2) { text-align: right; }
.svc-rows { display: grid; gap: 6px; }
.svc-row input { height: 36px; padding: 0 8px; }
.svc-row .svc-qty, .svc-row .svc-price { text-align: right; }
.svc-sum { text-align: right; font-weight: 700; font-size: 13px; white-space: nowrap; }
.svc-combo .combo-list { right: auto; min-width: 100%; width: max-content; max-width: 420px; }
.svc-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line-2); }
.svc-total { font-size: 15px; }
.svc-total strong { font-size: 19px; color: var(--accent-2); }

/* pliki */
.dropzone { border: 2px dashed var(--line-2); border-radius: 12px; padding: 14px; text-align: center; color: var(--muted); transition: all .15s; background: #fbfdff; }
.dropzone p { margin: 0 0 8px; font-size: 13px; }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: #035c7d; }
.dz-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin-top: 10px; }
.thumbs:empty { display: none; }
.thumb { position: relative; aspect-ratio: 4/3; border-radius: 10px; overflow: hidden; background: var(--bg); border: 0; padding: 0; cursor: pointer; box-shadow: 0 1px 3px rgba(15, 23, 42, .15); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.thumb:hover img { transform: scale(1.05); }
.thumb-del { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(15, 23, 42, .7); color: #fff; font-size: 11px; cursor: pointer; opacity: 0; transition: opacity .15s; }
.thumb:hover .thumb-del, .thumb:focus-within .thumb-del { opacity: 1; }
.progress { position: absolute; left: 0; bottom: 0; height: 3px; width: 0; background: var(--accent); transition: width .2s; }
.file .progress { position: absolute; }
.pending { outline: 2px dashed var(--line-2); outline-offset: -2px; }
.pending::after { content: "do wysłania"; position: absolute; left: 4px; bottom: 6px; font-size: 9px; background: rgba(15, 23, 42, .65); color: #fff; padding: 1px 5px; border-radius: 4px; }
.file.pending::after { content: none; }
.uploading { opacity: .75; }
.failed { outline: 2px solid var(--danger); }
.files { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.files:empty { display: none; }
.file { position: relative; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; }
.file-ico { font-size: 18px; }
.file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--ink); text-decoration: none; }
a.file-name:hover { color: var(--accent-2); text-decoration: underline; }

/* ---------- Podgląd wizyty ---------- */
.view-band { height: 6px; flex: none; }
.view-head { display: flex; gap: 14px; align-items: center; min-width: 0; }
.view-logo { width: 64px; height: 48px; object-fit: contain; background: var(--bg); border-radius: 12px; padding: 6px; flex: none; }
.view-cat { display: flex; gap: 6px; align-items: center; margin-bottom: 4px; }
.view-when { color: var(--muted); font-weight: 600; margin-top: 2px; text-transform: none; }
.cat-chip { --c: #64748b; display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 99px; background: color-mix(in srgb, var(--c) 14%, #fff); color: color-mix(in srgb, var(--c) 75%, #000); font-weight: 700; font-size: 12px; }
.cat-chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; background: var(--bg); color: var(--muted); }
.badge-planned { background: #e0f2fe; color: #0369a1; }
.badge-in_progress { background: #fef3c7; color: #b45309; }
.badge-done { background: #dcfce7; color: #15803d; }
.badge-cancelled { background: #ffe4e6; color: #be123c; }
.view-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
#viewBody > .card { margin-bottom: 14px; }
#viewBody h4 { margin: 0 0 10px; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--accent-2); }
.card-note { background: #fffbeb; border-color: #fde68a; }
.dl { display: grid; grid-template-columns: 100px 1fr; gap: 8px 12px; margin: 0; align-items: center; }
.dl dt { color: var(--muted); font-size: 12px; }
.dl dd { margin: 0; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.meta { margin: 4px 0 0; }
.status-switch { display: inline-flex; background: var(--bg); border-radius: 10px; padding: 3px; gap: 2px; }
.status-switch button { border: 0; background: transparent; padding: 7px 12px; border-radius: 8px; font: 600 13px var(--font); color: var(--muted); cursor: pointer; }
.status-switch button:hover:not(:disabled) { color: var(--ink); }
.status-switch button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(15, 23, 42, .15); }
.status-switch button.on[data-status=done] { color: var(--ok); }
.status-switch button.on[data-status=in_progress] { color: #b45309; }

.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tfoot td { border-bottom: 0; font-weight: 800; font-size: 15px; padding-top: 12px; }
.tbl tr:last-child td { border-bottom: 0; }
.result-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }

/* galeria */
dialog.lightbox { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; }
dialog.lightbox[open] { display: grid; place-items: center; }
dialog.lightbox::backdrop { background: rgba(2, 8, 16, .92); }
#lbImg { max-width: 92vw; max-height: 86vh; border-radius: 8px; box-shadow: 0 20px 60px rgba(0, 0, 0, .6); }
.lb-close, .lb-nav { position: fixed; border: 0; background: rgba(255, 255, 255, .1); color: #fff; border-radius: 50%; cursor: pointer; width: 48px; height: 48px; font-size: 22px; }
.lb-close:hover, .lb-nav:hover { background: rgba(255, 255, 255, .2); }
.lb-close { top: 18px; right: 18px; }
.lb-prev { left: 18px; top: 50%; font-size: 32px; }
.lb-next { right: 18px; top: 50%; font-size: 32px; }
.lb-caption { position: fixed; bottom: 16px; left: 0; right: 0; text-align: center; color: #cbd5e1; font-size: 13px; }

/* toasty */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 1000; pointer-events: none; align-items: center; }
.toast { padding: 11px 18px; border-radius: 12px; background: var(--navy); color: #fff; font-weight: 600; box-shadow: 0 10px 30px rgba(2, 12, 27, .35); opacity: 0; transform: translateY(12px); transition: all .25s; max-width: min(520px, 90vw); }
.toast.in { opacity: 1; transform: none; }
.toast-ok { border-left: 4px solid #22d3ee; }
.toast-error { background: #881337; border-left: 4px solid #fb7185; }

/* ---------- Ustawienia ---------- */
.settings { flex: 1; overflow-y: auto; padding: 24px; max-width: 1100px; width: 100%; margin: 0 auto; }
.tabs { display: flex; gap: 4px; margin-bottom: 20px; background: #fff; padding: 4px; border-radius: 12px; box-shadow: var(--shadow); width: fit-content; max-width: 100%; overflow-x: auto; }
.tabs a { padding: 9px 16px; border-radius: 9px; text-decoration: none; color: var(--muted); font-weight: 700; white-space: nowrap; }
.tabs a[aria-selected="true"] { background: var(--navy); color: #fff; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; font-size: 22px; }
.panel-head p { margin: 4px 0 0; }
.filter { max-width: 260px; }
.inline-form { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.inline-form input[type=text] { flex: 1; }
.color-in { width: 44px; height: 40px; padding: 2px; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; cursor: pointer; flex: none; }
.palette { display: flex; gap: 6px; margin: 0 0 18px; flex-wrap: wrap; }
.pal { width: 26px; height: 26px; border-radius: 8px; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line-2); cursor: pointer; }
.pal:hover { transform: scale(1.12); }
.sortable-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.cat-row { display: grid; grid-template-columns: 44px minmax(140px, 1fr) 76px minmax(160px, 1.2fr) 90px auto; gap: 10px; align-items: center; padding: 10px 12px; }
.cat-row .cat-chip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.archived { opacity: .55; }
.money-in { position: relative; display: flex; align-items: center; }
.money-in input { padding-right: 32px !important; text-align: right; }
.money-in span { position: absolute; right: 10px; color: var(--muted); font-size: 13px; pointer-events: none; }
.tbl-edit { padding: 6px; }
.tbl-edit td { padding: 6px; }
.tbl-edit input[type=text], .tbl-edit input[type=number] { height: 36px; }
.narrow { max-width: 440px; }
.narrow .row { margin-top: 14px; justify-content: flex-end; }

/* ---------- Responsywność ---------- */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topnav .btn span { display: none; }
  .topnav .btn { width: 40px; padding: 0; }
  .who { display: none; }
}
@media (max-width: 900px) {
  .form-grid, .view-grid { grid-template-columns: 1fr; }
  .cat-row { grid-template-columns: 44px 1fr 70px auto; }
  .cat-row .cat-chip, .cat-row > .muted { display: none; }
}
@media (max-width: 760px) {
  :root { --topbar-h: 58px; }
  .topbar { gap: 10px; padding: 0 10px; }
  .brand img { height: 30px; width: auto; }
  .search input { font-size: 16px; }
  .cal-wrap { padding: 8px; }
  #calendar { padding: 8px; border-radius: 12px; }
  .fc .fc-toolbar-title { font-size: 16px; }
  .fc .fc-toolbar.fc-header-toolbar { margin-bottom: 8px; }
  .row.two { grid-template-columns: 1fr; }
  dialog.modal { width: 100vw !important; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .modal-head, .modal-body, .modal-foot { padding-left: 14px; padding-right: 14px; }
  .svc-head { display: none; }
  .svc-row { grid-template-columns: 1fr 60px 86px 30px; }
  .svc-row .svc-sum { display: none; }
  .inline-form { flex-wrap: wrap; }
  .settings { padding: 14px; }
  .status-switch button { padding: 7px 8px; }
  .logout { margin-left: 0; padding-left: 6px; }
}
@media (max-width: 480px) {
  .brand { display: none; }
}

/* poprawki układu */
.row.two > .field, .row.two > .switch { margin-top: 0; }
.link-btn { line-height: 1; }
.tbl th.r, .tbl td.r { text-align: right; }
