/* =====================================================================
   Event Manager · Color Event – wygląd aplikacji
   ===================================================================== */

:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --ink: #1d1b22;
  --ink-2: #5b5866;
  --ink-3: #8f8c99;
  --line: #e7e4de;
  --accent: #e0345f;        /* główny kolor akcji */
  --accent-ink: #ffffff;
  --accent-soft: #fde8ee;
  --c-dep: #7c5cd6;
  --c-setup: #e98a15;
  --c-event: #e0345f;
  --c-teardown: #1f9e8f;
  --ok: #1f9e8f;
  --warn: #e98a15;
  --danger: #c62f3a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 16, 30, .05), 0 4px 16px rgba(20, 16, 30, .05);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; font-size: 15px; line-height: 1.45; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.muted { color: var(--ink-3); }
.mt { margin-top: 14px; display: block; }
.spacer { flex: 1; }
[hidden] { display: none !important; }

/* ---------- Górny pasek ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 24px;
  padding: 12px 28px;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-dots { display: inline-flex; gap: 3px; }
.brand-dots i { width: 9px; height: 9px; border-radius: 50%; display: block; }
.brand-dots i:nth-child(1) { background: var(--c-event); }
.brand-dots i:nth-child(2) { background: var(--c-setup); }
.brand-dots i:nth-child(3) { background: var(--c-teardown); }
.brand-name { font-weight: 700; letter-spacing: -.01em; font-size: 17px; }
.brand-sub { color: var(--ink-3); font-size: 14px; padding-left: 10px; border-left: 1px solid var(--line); }
.tabs { display: flex; gap: 4px; margin-left: auto; }
.tab {
  border: 0; background: none; padding: 8px 14px; border-radius: 10px;
  color: var(--ink-2); font-weight: 500; cursor: pointer;
}
.tab:hover { background: var(--bg); }
.tab.active { background: var(--ink); color: #fff; }

main { max-width: 1080px; margin: 0 auto; padding: 24px 28px 80px; }

/* ---------- Przyciski i pola ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface);
  padding: 9px 16px; border-radius: 10px; cursor: pointer; font-weight: 500;
  white-space: nowrap;
}
.btn:hover { border-color: #cfcbc3; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(.95); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: #fdecee; border-color: #f4c3c8; }
.btn.danger-ghost { border-color: transparent; color: var(--ink-3); }
.btn.danger-ghost:hover { color: var(--danger); background: #fdecee; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .6; cursor: progress; }
.icon-btn {
  border: 0; background: none; font-size: 26px; line-height: 1; cursor: pointer;
  color: var(--ink-3); width: 36px; height: 36px; border-radius: 8px;
}
.icon-btn:hover { background: var(--bg); color: var(--ink); }

input, select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card h2 { font-size: 18px; margin-bottom: 4px; }

/* ---------- Pasek narzędzi ---------- */
.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar input[type=search] { flex: 1; min-width: 200px; }
.segmented { display: inline-flex; background: #ebe8e2; padding: 3px; border-radius: 11px; }
.segmented button {
  border: 0; background: none; padding: 7px 12px; border-radius: 8px; cursor: pointer;
  color: var(--ink-2); font-weight: 500; font-size: 14px;
}
.segmented button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.count { color: var(--ink-3); font-weight: 400; margin-left: 2px; }

/* ---------- Lista eventów ---------- */
.event-list { display: flex; flex-direction: column; gap: 10px; }
.month {
  font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3);
  font-weight: 600; margin: 14px 0 2px;
}
.month:first-child { margin-top: 0; }
.ev-card {
  display: flex; gap: 18px; padding: 16px 18px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  cursor: pointer; transition: border-color .15s, transform .15s;
  border-left: 4px solid var(--line);
}
.ev-card:hover, .ev-card:focus-visible { border-color: #d4d0c8; transform: translateY(-1px); outline: none; }
.ev-card.now { border-left-color: var(--accent); }
.ev-card.soon { border-left-color: var(--warn); }
.ev-card.later { border-left-color: var(--line); }
.ev-card.past { opacity: .72; }
.ev-date {
  flex: 0 0 56px; display: flex; flex-direction: column; align-items: center;
  padding-top: 2px; line-height: 1.1;
}
.ev-date .d { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.ev-date .m { font-size: 13px; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.ev-date .w { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.ev-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.ev-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ev-top h4 { font-size: 16px; font-weight: 600; margin-right: 2px; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: #f0eee9; color: var(--ink-2); }
.status { font-size: 12px; padding: 2px 8px; border-radius: 99px; font-weight: 600; margin-left: auto; }
.status.now { background: var(--accent-soft); color: var(--accent); }
.status.soon { background: #fdf1e1; color: #b0640a; }
.status.later { background: #f0eee9; color: var(--ink-2); }
.status.past { background: #f0eee9; color: var(--ink-3); }
.ev-meta, .ev-foot { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--ink-2); font-size: 14px; align-items: center; }
.ev-meta span, .ev-foot > span { display: inline-flex; align-items: center; gap: 5px; }
.ic { width: 15px; height: 15px; flex: none; color: var(--ink-3); }
.ev-steps { display: flex; flex-wrap: wrap; gap: 6px; }
.step {
  font-size: 13px; padding: 3px 9px; border-radius: 7px; background: #f6f5f2; color: var(--ink-2);
  border-left: 3px solid;
}
.step b { font-weight: 600; color: var(--ink); margin-right: 2px; }
.step.s-dep { border-color: var(--c-dep); }
.step.s-setup { border-color: var(--c-setup); }
.step.s-event { border-color: var(--c-event); }
.step.s-teardown { border-color: var(--c-teardown); }
.crew { display: inline-flex; }
.avatar {
  width: 26px; height: 26px; border-radius: 50%; background: #2b2833; color: #fff;
  font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--surface); margin-left: -6px;
}
.avatar:first-child { margin-left: 0; }
.avatar:nth-child(3n+2) { background: var(--c-dep); }
.avatar:nth-child(3n+3) { background: var(--c-teardown); }

.empty, .loading {
  padding: 48px 20px; text-align: center; color: var(--ink-3);
  border: 1.5px dashed var(--line); border-radius: var(--radius);
}
.empty.error { color: var(--danger); }

/* ---------- Okna (dialog) ---------- */
.dialog {
  padding: 0; border: 0; border-radius: 18px; width: min(720px, calc(100vw - 24px));
  max-height: calc(100vh - 40px); box-shadow: 0 20px 60px rgba(20, 16, 30, .25);
  color: var(--ink);
}
.dialog.wide { width: min(820px, calc(100vw - 24px)); }
.dialog::backdrop { background: rgba(29, 27, 34, .45); }
.dialog[open], .dialog[open] > form, #detail-body { display: flex; flex-direction: column; }
.dialog > form, #detail-body { max-height: calc(100vh - 40px); }
.dialog-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 18px 22px; border-bottom: 1px solid var(--line);
}
.dialog-head h2 { font-size: 20px; }
.dialog-head .sub { display: flex; gap: 8px; margin-top: 6px; }
.dialog-head .sub .status { margin-left: 0; }
.dialog-scroll { overflow-y: auto; padding: 6px 22px 22px; flex: 1; min-height: 0; }
.dialog-foot {
  display: flex; align-items: center; gap: 10px; padding: 14px 22px;
  border-top: 1px solid var(--line); background: #fbfaf8;
}
.form-error { color: var(--danger); margin: 0 auto 0 0; font-size: 14px; }

fieldset { border: 0; padding: 0; margin: 18px 0 0; }
legend {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-3); margin-bottom: 10px; padding: 0;
}
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.grid label, fieldset > label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--ink-2); font-weight: 500; }
.grid .span-2 { grid-column: span 2; }
.toggle-wrap { justify-content: flex-start; }
.check { display: inline-flex; align-items: center; gap: 7px; height: 19px; cursor: pointer; }
.check input { width: auto; accent-color: var(--accent); }
.field-label { font-size: 13px; color: var(--ink-2); font-weight: 500; margin-bottom: 6px; }

.chip-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { cursor: pointer; }
.chip input { display: none; }
.chip span {
  position: relative; display: inline-block; padding: 7px 14px 7px 38px; border-radius: 10px;
  border: 1.5px dashed #cfcbc3; font-size: 14px; background: var(--surface); user-select: none;
  color: var(--ink-2);
}
.chip span::before {
  content: "+"; position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid #cfcbc3;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 600; line-height: 1; color: var(--ink-3); background: #fff;
}
.chip:hover span { border-color: var(--ink-2); color: var(--ink); }
.chip input:checked + span { background: var(--ink); color: #fff; border: 1.5px solid var(--ink); }
.chip input:checked + span::before { content: "✓"; background: #fff; border-color: #fff; color: var(--ink); font-size: 13px; }
.crew-hint { font-size: 12px; color: var(--ink-3); font-weight: 400; margin-left: 6px; }
.chip small { display: block; font-size: 11px; color: #b0640a; font-weight: 500; }
.chip.busy span { border-color: #f1c98f; background: #fdf6ec; }
.chip.busy input:checked + span { background: #b0640a; border-color: #b0640a; color: #fff; }
.chip.busy input:checked + span::before { color: #b0640a; }
.chip.busy input:checked + span small { color: #fff; }

/* ---------- Konflikty terminów ---------- */
.conflict-badge {
  font-size: 12px; padding: 2px 8px; border-radius: 99px; font-weight: 600;
  background: #fdf1e1; color: #b0640a;
}
.conflict-box {
  margin-top: 14px; padding: 10px 14px; border-radius: 10px; font-size: 14px;
  background: #fdf6ec; border: 1px solid #f1c98f; color: #7a4a0c;
}
.conflict-box ul { margin: 4px 0 0; padding-left: 18px; }
.field-hint { font-size: 12px; color: #b0640a; margin-top: 4px; min-height: 0; }

/* ---------- Załączniki ---------- */
.attach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.attach-grid:empty { display: none; }
.attach { position: relative; font-size: 12px; }
.attach-thumb {
  display: flex; align-items: center; justify-content: center; aspect-ratio: 4/3;
  border-radius: 10px; overflow: hidden; background: #f0eee9; border: 1px solid var(--line);
}
.attach-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-ic { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--ink-3); }
.file-ic .ic { width: 30px; height: 30px; }
.file-ic em { font-style: normal; font-weight: 700; font-size: 11px; }
.attach-name { margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.attach.pending .attach-thumb { border-style: dashed; border-color: var(--accent); }
.attach-del {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%;
  border: 0; background: rgba(29,27,34,.75); color: #fff; cursor: pointer; font-size: 15px; line-height: 1;
}
.attach-del:hover { background: var(--danger); }
.dropzone {
  margin-top: 10px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 18px; border: 1.5px dashed #d4d0c8; border-radius: 12px; cursor: pointer;
  font-size: 14px; color: var(--ink-2); text-align: center;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .muted { font-size: 12px; }

/* ---------- Szczegóły ---------- */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 28px; }
#detail-body section h3, .guidelines h3 {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-3); margin: 16px 0 8px;
}
dl { margin: 0; }
.dl-row { display: grid; grid-template-columns: 96px 1fr; gap: 10px; padding: 4px 0; font-size: 14px; }
.dl-row dt { color: var(--ink-3); }
.dl-row dd { margin: 0; }
.guidelines { border-top: 1px solid var(--line); margin-top: 14px; }
.pre { white-space: pre-wrap; background: #fbfaf8; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 14px; }

/* ---------- Ustawienia ---------- */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.dict-add { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 8px; margin: 14px 0; }
.dict-list { list-style: none; margin: 0; padding: 0; }
.dict-list li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.dict-name { flex: 1; }
.dict-list li.inactive .dict-name { color: var(--ink-3); text-decoration: line-through; }

.setup { max-width: 560px; margin: 40px auto; }
.setup ol { padding-left: 20px; }
code { background: #f0eee9; padding: 1px 6px; border-radius: 5px; font-size: 13px; }

/* ---------- Powiadomienia ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 100;
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,.2); font-size: 14px; max-width: 90vw;
}
.toast.error { background: var(--danger); }

/* ---------- Telefon / wąskie ekrany ---------- */
@media (max-width: 720px) {
  .topbar { padding: 10px 14px; gap: 10px; }
  .brand-sub { display: none; }
  main { padding: 16px 12px 60px; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; padding: 7px 6px; font-size: 13px; }
  .grid { grid-template-columns: 1fr 1fr; }
  .detail-grid, .settings-grid { grid-template-columns: 1fr; }
  .ev-card { gap: 12px; padding: 14px; }
  .ev-date { flex-basis: 40px; }
  .status { margin-left: 0; }
  .dict-add { grid-template-columns: 1fr 1fr; }
  .dict-add .btn { grid-column: span 2; justify-content: center; }
}

/* =====================================================================
   Kalendarz – wykres Gantta
   ===================================================================== */
.ph-departure { background: var(--c-dep); }
.ph-setup { background: var(--c-setup); }
.ph-event { background: var(--c-event); }
.ph-teardown { background: var(--c-teardown); }

.gantt-nav { display: inline-flex; gap: 4px; }
.gantt-nav .btn { padding: 8px 12px; }
.gantt-label { font-weight: 600; }
.legend { display: flex; gap: 14px; margin-left: auto; font-size: 13px; color: var(--ink-2); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }

.gantt-wrap {
  overflow-x: auto; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.gantt { --days: 14; min-width: calc(220px + var(--days) * 44px); }
.g-row {
  display: grid; grid-template-columns: 220px repeat(var(--days), minmax(0, 1fr));
  border-top: 1px solid var(--line); min-height: 56px;
}
.g-header { border-top: 0; min-height: 0; position: sticky; top: 0; background: var(--surface); }
.g-corner {
  padding: 10px 14px; font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--ink-3); display: flex; align-items: flex-end;
}
.g-head {
  display: flex; flex-direction: column; align-items: center; padding: 8px 0 6px;
  font-size: 12px; color: var(--ink-3); border-left: 1px solid var(--line); position: relative;
}
.g-head b { font-size: 16px; color: var(--ink); font-weight: 600; }
.g-head em { font-style: normal; font-size: 10px; line-height: 1.2; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.g-head.today b { background: var(--accent); color: #fff; border-radius: 99px; padding: 0 7px; }
.g-head.weekend, .g-cell.weekend { background: #faf9f6; }
.g-cell.today { background: #fff6f8; }

.g-name {
  padding: 8px 14px; display: flex; flex-direction: column; justify-content: center;
  cursor: pointer; min-width: 0; border-right: 1px solid var(--line);
}
.g-name b { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-name small { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-name:hover b { color: var(--accent); }
.g-warn { color: #b0640a; margin-right: 4px; }

.g-cell { border-left: 1px solid var(--line); display: flex; align-items: center; padding: 0; cursor: pointer; min-width: 0; }
.g-row:hover .g-cell, .g-row:hover .g-name { background-color: #f7f5f1; }
.g-bar { display: flex; width: 100%; height: 30px; gap: 1px; }
.g-bar span {
  flex: 1; display: flex; align-items: center; justify-content: center; color: #fff;
  font-size: 12px; font-weight: 600; overflow: hidden; white-space: nowrap; min-width: 0; gap: 4px;
}
.g-bar span small { font-weight: 500; opacity: .9; font-size: 11px; }
.g-bar.first { padding-left: 4px; }
.g-bar.last { padding-right: 4px; }
.g-bar.first span:first-child { border-radius: 7px 0 0 7px; }
.g-bar.last span:last-child { border-radius: 0 7px 7px 0; }
.g-gap { width: 100%; height: 3px; background: #d9d5cd; }
.g-empty { padding: 40px; text-align: center; color: var(--ink-3); border-top: 1px solid var(--line); }

@media (max-width: 720px) {
  .brand-name { white-space: nowrap; font-size: 15px; }
  .brand-logo { height: 28px; }
  .tab { padding: 7px 9px; font-size: 14px; }
  .gantt { min-width: calc(130px + var(--days) * 40px); }
  .g-row { grid-template-columns: 130px repeat(var(--days), minmax(0, 1fr)); }
  .g-name, .g-corner { padding: 8px 10px; }
  .legend { margin-left: 0; }
}

/* Kalendarz – wariant "Ekipa i auta" */
.g-section {
  padding: 10px 14px 6px; font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--ink-3); background: #fbfaf8; border-top: 1px solid var(--line);
}
.g-empty.small { padding: 14px; font-size: 13px; }
.r-row .g-name { cursor: default; }
.r-row .g-cell { flex-direction: column; justify-content: center; gap: 2px; overflow: visible; cursor: default; }
.r-block { position: relative; width: 100%; cursor: pointer; padding-top: 15px; }
.r-block .g-bar { height: 14px; }
.r-block .g-gap { margin: 5px 0 6px; }
.r-label {
  position: absolute; top: 0; left: 6px; z-index: 2; font-size: 11px; font-weight: 600;
  white-space: nowrap; color: var(--ink); pointer-events: none;
}
.clash .r-block { padding-top: 0; }
.clash .r-block .g-bar { height: 10px; }
.g-cell.clash { background: #fdecee !important; box-shadow: inset 0 0 0 2px #f2a7b0; }
.r-block:hover .g-bar span { filter: brightness(.9); }
.r-clash { font-size: 10px; font-weight: 700; color: var(--danger); white-space: nowrap; line-height: 1; }

/* =====================================================================
   Logowanie i role
   ===================================================================== */
body.role-crew .manager-only { display: none !important; }

.userbox { display: flex; align-items: center; gap: 10px; margin-left: 12px; padding-left: 16px; border-left: 1px solid var(--line); }
.user-name { font-weight: 500; font-size: 14px; white-space: nowrap; }
.role-pill { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; text-transform: uppercase; letter-spacing: .04em; }
.role-pill.manager { background: var(--accent-soft); color: var(--accent); }
.role-pill.crew { background: #e3f4f1; color: var(--c-teardown); }
.role-pill.pending { background: #f0eee9; color: var(--ink-3); }
.badge-count {
  display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px;
  padding: 0 5px; border-radius: 99px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700;
}

.auth-card { max-width: 400px; margin: 48px auto; padding: 28px; }
.auth-card h2 { font-size: 22px; }
.auth-card form { display: flex; flex-direction: column; gap: 12px; }
.auth-card label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.auth-card .form-error:empty, .auth-card .form-ok:empty { display: none; }
.form-ok { color: var(--ok); font-size: 14px; margin: 0; }
.btn.wide { width: 100%; justify-content: center; padding: 11px; }
.auth-switch { text-align: center; font-size: 14px; color: var(--ink-2); margin: 4px 0 0; }

.user-list { list-style: none; margin: 16px 0; padding: 0; }
.user-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.user-list .avatar { width: 34px; height: 34px; font-size: 12px; margin: 0; border: 0; }
.user-list select { width: 170px; flex: none; }
.user-list li.is-pending { background: #fffaf2; margin: 0 -22px; padding: 10px 22px; }
.small-note { font-size: 13px; }

/* Ekran w pracowni (pracownik ukryty) – większe elementy pod palec */
body.kiosk { font-size: 16px; }
body.kiosk .tab, body.kiosk .segmented button, body.kiosk .btn { padding: 12px 18px; font-size: 16px; }
body.kiosk .ev-card { padding: 20px 22px; }

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; }
  .userbox { margin-left: auto; padding-left: 0; border-left: 0; }
  .user-name { display: none; }
  .user-list select { width: 130px; }
}
.auth-card p { margin: 0; }

/* =====================================================================
   Pracownicy stali / dorywczy
   ===================================================================== */
.settings-grid { grid-template-columns: 1.35fr 1fr; }
.dict-add.four { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) 110px auto; }
.dict-group { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); padding: 14px 0 4px !important; }
.dict-list .emp-type { width: 110px; flex: none; padding: 5px 8px; font-size: 13px; }
.acc-link { font-size: 12px; color: var(--c-teardown); }
.acc-none { font-size: 12px; }

.crew-group { margin-bottom: 10px; }
.crew-group-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin-bottom: 6px; }
.chip-add { display: inline-flex; gap: 6px; align-items: center; }
.chip-add input { width: 200px; padding: 6px 10px; font-size: 14px; }

.mine-badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: #e3f4f1; color: var(--c-teardown); }
.r-row.me .g-name { box-shadow: inset 3px 0 0 var(--c-teardown); }

.user-list li { flex-wrap: wrap; }
.user-field { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--ink-3); font-weight: 600; }
.user-list .user-field select { width: 200px; }
.user-list .dict-name { min-width: 180px; }
@media (max-width: 720px) {
  .dict-add.four { grid-template-columns: 1fr 1fr; }
  .user-list .user-field select { width: 100%; }
  .user-field { flex: 1 1 140px; }
}

/* =====================================================================
   Zaproszenia
   ===================================================================== */
.invite-form {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: 8px;
  margin: 16px 0 6px; padding: 14px; background: #fbfaf8; border: 1px solid var(--line); border-radius: 12px;
}
.invite-title { grid-column: 1 / -1; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); }
.invite-form .form-error { grid-column: 1 / -1; margin: 0; }
.invite-form .form-error:empty { display: none; }
.invite-pill, .approve-pill { display: inline-block; margin-top: 4px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; }
.invite-pill { background: #eef0fb; color: #4b55a8; }
.approve-pill { background: #fdf1e1; color: #b0640a; }
[data-resend] { margin-top: 4px; }
@media (max-width: 720px) {
  .invite-form { grid-template-columns: 1fr; }
}

/* Okno potwierdzenia */
.dialog.confirm { width: min(460px, calc(100vw - 24px)); }
.confirm-body { padding: 22px 22px 8px; }
.confirm-body h2 { font-size: 19px; margin-bottom: 10px; }
.confirm-body p { margin: 0 0 12px; white-space: pre-wrap; color: var(--ink-2); font-size: 15px; }
.btn.danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-solid:hover { filter: brightness(.95); }

/* =====================================================================
   Ekipa i auta – jedna kolumna, przewijanie, edycja
   ===================================================================== */
.settings-stack { display: flex; flex-direction: column; gap: 18px; max-width: 860px; margin: 0 auto; }
.settings-stack .card { scroll-margin-top: 80px; } /* miejsce na górny pasek przy przewijaniu */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.settings-stack .dict-add.four { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) 130px auto; }
.settings-stack .dict-add { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto; }

.dict-name.editable {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  border: 0; background: none; padding: 6px 8px; margin: -6px 0 -6px -8px; border-radius: 8px;
  text-align: left; cursor: pointer; font: inherit; color: inherit;
}
.dict-name.editable:hover { background: var(--bg); }
.dict-name .edit-ic { color: var(--ink-3); font-size: 13px; opacity: 0; margin-left: 4px; }
.dict-name.editable:hover .edit-ic, .dict-name.editable:focus-visible .edit-ic { opacity: 1; }

.dict-list li.editing { background: #fbfaf8; margin: 0 -22px; padding: 10px 22px; }
.dict-edit { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto auto; gap: 8px; width: 100%; }
.dict-edit input { padding: 7px 10px; }

@media (max-width: 720px) {
  .settings-stack .dict-add.four, .settings-stack .dict-add { grid-template-columns: 1fr 1fr; }
  .dict-edit { grid-template-columns: 1fr 1fr; }
  .card-head { flex-wrap: wrap; }
}
@media (max-width: 720px) {
  .dict-list li { flex-wrap: wrap; }
  .dict-list li .dict-name.editable { flex: 1 1 100%; margin-bottom: 2px; }
  .dict-list .emp-type { flex: 1; width: auto; }
  .dict-list li.editing { margin: 0 -14px; padding: 10px 14px; }
}

/* =====================================================================
   Administrator
   ===================================================================== */
body:not(.role-admin) .admin-only { display: none !important; }
.role-pill.admin { background: #2b2833; color: #fff; }
.offer-pill { display: inline-block; margin-top: 4px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: #f1ecfb; color: #6a4bc4; }
.offer-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 16px; padding: 12px 16px; border-radius: 12px;
  background: #f1ecfb; border: 1px solid #d9cdf3; color: #4a3391; font-weight: 500;
}

/* Montaż: każdy dzień w osobnym wierszu */
.two-day-toggle { margin-bottom: 10px; font-size: 14px; color: var(--ink-2); font-weight: 500; }
.setup-row { grid-template-columns: repeat(3, 1fr); }
.setup-row + .setup-row { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
@media (max-width: 720px) { .setup-row { grid-template-columns: 1fr 1fr; } .setup-row label:first-child { grid-column: span 2; } }
fieldset > label.two-day-toggle { display: inline-flex; flex-direction: row; align-items: center; gap: 7px; height: auto; cursor: pointer; }
fieldset > label.two-day-toggle input { width: auto; margin: 0; accent-color: var(--accent); }
.user-list .del-user, .user-list .del-spacer { width: 96px; flex: none; align-self: flex-end; margin-bottom: 4px; }
@media (max-width: 720px) { .user-list .del-spacer { display: none; } .user-list .del-user { order: 10; } }

/* Logo firmy */
.brand-logo { height: 34px; width: auto; display: block; }
.brand { gap: 12px; }
.brand-name { letter-spacing: 0; }
.auth-logo { width: 64px; height: auto; margin: 0 auto 4px; display: block; }
.auth-card h2 { text-align: center; }
.auth-card form > .muted:first-of-type { text-align: center; }
@media (max-width: 720px) { .brand-logo { height: 28px; } }

/* Legenda kalendarza z literami (W / M / E / D) */
.legend i {
  width: 18px; height: 18px; border-radius: 5px; font-style: normal; color: #fff;
  font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
}

/* Telefon: logo + rola + Wyloguj w pierwszym wierszu, menu pod spodem */
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; row-gap: 8px; }
  .brand { order: 1; }
  .userbox { order: 2; margin-left: auto; padding-left: 0; border-left: 0; gap: 8px; }
  .tabs { order: 3; width: 100%; margin-left: 0; overflow-x: auto; flex-wrap: nowrap; }
  .tab { white-space: nowrap; flex: none; }
  .brand-sub { display: none; }
}

/* =====================================================================
   Wypożyczalnia – katalog (zakładka „Wypożyczalnia”)
   ===================================================================== */
.rental-filters { margin-bottom: 14px; }
.rental-filters select { width: auto; min-width: 170px; }
.rental-grid { display: flex; flex-direction: column; }
.r-group { display: flex; align-items: baseline; gap: 6px; }
.r-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 10px; }
.r-card {
  display: flex; gap: 14px; padding: 12px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); transition: border-color .15s, transform .15s;
}
.r-card:hover, .r-card:focus-visible { border-color: #d4d0c8; transform: translateY(-1px); outline: none; }
.r-card.past { opacity: .65; }
.r-thumb {
  flex: none; width: 92px; height: 92px; border-radius: 10px; overflow: hidden;
  background: #f0eee9; display: flex; align-items: center; justify-content: center;
}
.r-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.r-nophoto { font-size: 11px; color: var(--ink-3); text-align: center; padding: 6px; }
.r-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.r-top { display: flex; align-items: flex-start; gap: 8px; }
.r-top h4 { font-size: 15px; font-weight: 600; flex: 1; min-width: 0; }
.r-top .status { margin-left: 0; white-space: nowrap; }
.r-price { font-size: 14px; }
.r-meta { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 13px; color: var(--ink-2); }
.r-warn { font-size: 12px; color: #b0640a; background: #fdf6ec; border-radius: 6px; padding: 2px 7px; align-self: flex-start; }

/* formularz pozycji */
.grid .span-4 { grid-column: 1 / -1; }
.net-hint, .field-note { font-size: 12px; color: var(--ink-3); font-weight: 400; min-height: 16px; }
.price-example { font-size: 13px; color: var(--ink-2); margin: 10px 0 0; min-height: 18px; }
.small-note { font-size: 13px; margin: 10px 0 0; }
.photo-grid { margin-bottom: 10px; }
.attach.photo.main .attach-thumb { border: 2px solid var(--accent); }
.photo-badge {
  position: absolute; left: 6px; top: 6px; background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 99px;
}
.photo-make-main {
  margin-top: 5px; width: 100%; border: 1px solid var(--line); background: var(--surface);
  border-radius: 8px; font-size: 12px; padding: 3px 4px; cursor: pointer; color: var(--ink-2);
}
.photo-make-main:hover { border-color: var(--accent); color: var(--accent); }

/* skład zestawu */
.kit-picker { position: relative; }
.kit-results {
  position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px);
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 8px 30px rgba(20,16,30,.14); padding: 4px; max-height: 320px; overflow-y: auto;
}
.kit-res {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  border: 0; background: none; padding: 6px 8px; border-radius: 8px; cursor: pointer;
}
.kit-res:hover, .kit-res.first { background: var(--bg); }
.kit-res small, .kit-name small { display: block; font-size: 12px; color: var(--ink-3); }
.kit-none { padding: 8px 10px; font-size: 14px; }
.kit-th { flex: none; width: 40px; height: 40px; border-radius: 7px; overflow: hidden; background: #f0eee9; }
.kit-th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.kit-rows { list-style: none; margin: 10px 0 0; padding: 0; }
.kit-rows li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); }
.kit-rows li.warn .kit-name small { color: #b0640a; }
.kit-name { flex: 1; min-width: 0; }
.kit-qty { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.kit-qty input { width: 72px; }
.kit-empty { padding: 10px 0; }
.kit-summary { font-size: 13px; margin: 8px 0 0; }
.kit-summary b { color: var(--ink); }

/* ustawienia */
.rset-form .grid { grid-template-columns: repeat(2, 1fr); margin-top: 14px; }
.form-actions { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.form-actions .btn { margin-left: auto; }
.dict-list li.holiday { padding: 5px 0; font-size: 14px; }
#rclosed-add input[type=date] { min-width: 0; }

@media (max-width: 720px) {
  .rental-filters input[type=search] { flex: 1 1 100%; }
  .rental-filters select { flex: 1; min-width: 0; }
  .rental-filters .btn { flex: 1 1 100%; justify-content: center; }
  .r-cards { grid-template-columns: 1fr; }
  .r-thumb { width: 76px; height: 76px; }
  .rset-form .grid { grid-template-columns: 1fr; }
  .rset-form .grid .span-2 { grid-column: auto; }
  .kit-rows li { flex-wrap: wrap; }
  .kit-name { flex-basis: calc(100% - 50px); }
  .kit-qty { margin-left: 50px; }
  #rental-tabs button { font-size: 12.5px; padding: 7px 4px; }
}

/* Oznaczenie środowiska testowego (config.js → ENV_LABEL) */
body[data-env]::after {
  content: attr(data-env); position: fixed; z-index: 9999; left: 0; bottom: 0;
  background: #f59e0b; color: #1c1917; font: 700 11px/1 system-ui, sans-serif; letter-spacing: .12em;
  padding: 6px 12px; border-radius: 0 8px 0 0; pointer-events: none;
}
body[data-env] .topbar { border-top: 3px solid #f59e0b; }
