
  .cal-container { max-width: 1240px; }
  /* ukryte pola wyboru (zamiast nich widać przyciski, kolory, przełączniki) – małe i przypięte do swojej etykiety, żeby nie poszerzały strony */
  #tool-calendar .cal-lay, #tool-calendar .cal-seg label, #tool-calendar .cal-swatches label, #tool-calendar .cal-tog { position: relative; }
  #tool-calendar .cal-lay input, #tool-calendar .cal-seg input, #tool-calendar .cal-swatches input, #tool-calendar .cal-tog input { position: absolute; left: 0; top: 0; width: 1px; height: 1px; min-width: 0; margin: 0; padding: 0; opacity: 0; pointer-events: none; }
  /* lewa kolumna i formularz „znikają” z układu, więc na telefonie podgląd może stanąć zaraz po wyborze układu */
  .cal-work { display: grid; grid-template-columns: minmax(0, 430px) minmax(0, 1fr); column-gap: 30px; align-items: start; }
  .cal-left, .cal-form { display: contents; }
  .cal-work > *, .cal-form > * { min-width: 0; grid-column: 1; }
  .cal-work > .cal-right { grid-column: 2; grid-row: 1 / span 6; }
  @media (max-width: 980px) {
    .cal-work { grid-template-columns: minmax(0, 1fr); }
    .cal-work > .cal-right { grid-column: 1; grid-row: auto; order: 2; margin: 0 0 16px; }
    .cal-head { order: 0; } .cal-form > .cal-group:first-child { order: 1; } .cal-form > * { order: 3; }
  }
  .cal-head { text-align: left; margin-left: 0; }
  .cal-head h1 { margin-bottom: 6px; }
  .cal-head p { margin-left: 0; }
  .cal-group { padding-bottom: 14px; }
  .cal-group [hidden], .cal-group[hidden] { display: none !important; }
  .cal-layouts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .cal-lay { position: relative; display: grid; grid-template-columns: 52px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 10px 11px; border: 1.5px solid var(--border); border-radius: 12px; cursor: pointer; transition: border-color .15s, background .15s; }
  .cal-lay:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
  .cal-lay input { position: absolute; opacity: 0; pointer-events: none; }
  .cal-lay:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 11%, transparent); }
  .cal-lay:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
  .cal-lay-art { grid-row: 1 / 3; width: 52px; height: 38px; }
  .cal-lay-art rect { fill: color-mix(in srgb, var(--text) 22%, transparent); }
  .cal-lay-art .a { fill: var(--accent); } .cal-lay-art .h { fill: #E0525E; } .cal-lay-art .g { fill: #34B37A; }
  .cal-lay:has(input:checked) .cal-lay-art rect:not(.a):not(.h):not(.g) { fill: color-mix(in srgb, var(--accent) 45%, transparent); }
  .cal-lay-t { font-weight: 700; font-size: .92rem; line-height: 1.2; }
  .cal-lay-s { color: var(--muted); font-size: .78rem; line-height: 1.25; }
  @media (max-width: 560px) { .cal-lay { grid-template-columns: minmax(0, 1fr); align-content: start; row-gap: 2px; } .cal-lay-art { grid-row: auto; margin-bottom: 6px; } }
  .cal-lbl { font-size: .85rem; color: var(--muted); }
  .cal-seg { display: flex; padding: 3px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
  .cal-seg label { flex: 1 1 0; min-width: 0; cursor: pointer; }
  .cal-seg input { position: absolute; opacity: 0; pointer-events: none; }
  .cal-seg span { display: block; padding: 7px 6px; border-radius: 7px; text-align: center; font-size: .86rem; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: background .15s, color .15s; }
  .cal-seg input:checked + span { background: var(--card); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.18); }
  .cal-seg input:focus-visible + span { outline: 2px solid var(--accent); }
  .cal-swatches { display: flex; gap: 9px; align-items: center; min-height: 38px; }
  .cal-swatches label { cursor: pointer; }
  .cal-swatches input { position: absolute; opacity: 0; pointer-events: none; }
  .cal-swatches span { display: block; width: 26px; height: 26px; border-radius: 50%; background: var(--sw); box-shadow: 0 0 0 2px var(--card), 0 0 0 3px transparent; transition: box-shadow .15s, transform .15s; }
  .cal-swatches label:hover span { transform: scale(1.08); }
  .cal-swatches input:checked + span { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--text); }
  .cal-swatches input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 4px; }
  .cal-sw-custom span { --cc: #E8590C; background: radial-gradient(circle, var(--cc) 0 42%, #fff 44% 50%, transparent 52%), conic-gradient(#ff3b30, #ff9500, #ffcc00, #34c759, #00c7be, #007aff, #5856d6, #af52de, #ff2d55, #ff3b30); }
  #tool-calendar .cal-sw-custom #calCustomColor { position: absolute; left: 0; top: 0; width: 26px; height: 26px; min-width: 0; margin: 0; padding: 0; border: 0; opacity: 0; pointer-events: auto; cursor: pointer; }
  .cal-togs { display: grid; gap: 2px; }
  .cal-tog { display: flex; align-items: center; gap: 11px; padding: 7px 2px; cursor: pointer; font-size: .92rem; }
  .cal-tog input { position: absolute; opacity: 0; pointer-events: none; }
  .cal-sw { flex: 0 0 auto; position: relative; width: 36px; height: 21px; border-radius: 99px; background: color-mix(in srgb, var(--text) 22%, transparent); transition: background .15s; }
  .cal-sw::after { content: ""; position: absolute; top: 2.5px; left: 2.5px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .18s; }
  .cal-tog input:checked + .cal-sw { background: #3563F0; }
  .cal-tog input:checked + .cal-sw::after { transform: translateX(15px); }
  .cal-tog input:focus-visible + .cal-sw { outline: 2px solid var(--accent); outline-offset: 2px; }
  .cal-hint { margin: 0 0 10px; }
  .cal-photogrid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 7px; margin-bottom: 12px; }
  @media (max-width: 520px) { .cal-photogrid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
  .cal-slot { position: relative; }
  #tool-calendar .cal-slot-pick { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; min-width: 0; height: auto; aspect-ratio: 1; margin: 0; padding: 0; border: 1.5px dashed color-mix(in srgb, var(--text) 25%, transparent); border-radius: 10px; background: color-mix(in srgb, var(--text) 4%, transparent); color: var(--muted); cursor: pointer; overflow: hidden; position: relative; font: inherit; box-shadow: none; transform: none; }
  #tool-calendar .cal-slot-pick:hover { border-color: var(--accent); color: var(--text); background: color-mix(in srgb, var(--accent) 10%, transparent); }
  .cal-slot.has .cal-slot-pick { border-style: solid; }
  .cal-slot-pick img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
  .cal-plus { font-size: 1.2rem; line-height: 1; }
  .cal-slot-m { position: relative; margin-top: 2px; font-size: .64rem; font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 3px; }
  .cal-slot.has .cal-slot-m { position: absolute; left: 0; right: 0; bottom: 0; margin: 0; padding: 2px 3px; background: rgba(0,0,0,.55); color: #fff; }
  #tool-calendar .cal-slot-x { min-width: 0; margin: 0; position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: #2B2F37; color: #fff; font-size: .85rem; line-height: 20px; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
  .cal-right { position: sticky; top: 86px; }
  @media (max-width: 980px) { .cal-right { position: static; } }
  .cal-stage { display: flex; justify-content: center; padding: 18px; border-radius: 16px; background: color-mix(in srgb, var(--text) 6%, transparent); }
  .cal-paper { width: 100%; max-width: min(100%, calc((100vh - 250px) * var(--ar, 1.414))); outline: none; }
  @media (max-width: 980px) { .cal-paper { max-width: 100%; } }
  @media (max-width: 980px) { .cal-paper { max-height: none; } }
  .cal-paper { position: relative; overflow: hidden; border-radius: 3px; box-shadow: 0 8px 30px rgba(0,0,0,.28); background: #fff; cursor: zoom-in; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
  .cal-paper.zoomed { cursor: grab; touch-action: none; }
  .cal-paper.zoomed:active { cursor: grabbing; }
  .cal-paper svg { display: block; width: 100%; height: 100%; background: #fff; }
  .cal-paper:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
  .cal-zoom { display: flex; align-items: center; gap: 4px; margin-right: 6px; }
  #tool-calendar .cal-zoom button { min-width: 38px; padding: 7px 0; font-size: 1.1rem; line-height: 1; }
  #tool-calendar .cal-zoom #calZoomFit { min-width: 62px; font-size: .86rem; font-weight: 600; font-variant-numeric: tabular-nums; }
  .cal-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; margin-top: 14px; }
  .cal-pager { display: flex; align-items: center; gap: 8px; margin-right: 6px; }
  .cal-pager[hidden] { display: none; }
  .cal-pager button { min-width: 38px; padding: 7px 0; font-size: 1.1rem; }
  .cal-pager span { min-width: 92px; text-align: center; font-weight: 600; font-size: .9rem; color: var(--muted); }
  #calmsg { min-height: 1.4em; margin-top: 10px; text-align: center; font-weight: 600; }
  .cal-evlist { display: grid; gap: 6px; margin: 0 0 12px; }
  .cal-ev { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); font-size: .9rem; min-width: 0; }
  .cal-ev-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; }
  .cal-ev-d { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
  .cal-ev-t { flex: 1 1 auto; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #tool-calendar .cal-ev-x { flex: none; min-width: 0; width: 26px; height: 26px; margin: 0; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 1.1rem; line-height: 1; cursor: pointer; box-shadow: none; }
  #tool-calendar .cal-ev-x:hover { background: color-mix(in srgb, var(--text) 10%, transparent); color: var(--text); }
  .cal-ev-empty { margin: 0; color: var(--muted); font-size: .88rem; }
  .cal-evadd { align-items: end; }
  .cal-evbtn { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
  .cal-evmsg { color: var(--error, #d92d20); font-size: .86rem; font-weight: 600; }
  .cal-lw { margin-top: 18px; padding: 16px 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--card); }
  .cal-lw[hidden] { display: none; }
  .cal-lw-h { margin: 0 0 10px; font-size: 1.05rem; }
  .cal-lw-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
  .cal-lw-list li { display: grid; gap: 1px; padding: 8px 10px 8px 12px; border-left: 3px solid #D22F3C; border-radius: 6px; background: color-mix(in srgb, var(--text) 4%, transparent); font-size: .9rem; }
  .cal-lw-list li.paid { border-left-color: #E8590C; }
  .cal-lw-list em { font-style: normal; color: #E8590C; font-weight: 600; }
  .cal-lw-list small { color: var(--muted); font-size: .8rem; }
  .cal-months { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin: 22px 0 0; }
  .cal-months-l { margin-right: 4px; color: var(--muted); font-size: .9rem; }
  .cal-months a { padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--card); color: var(--text); font-size: .86rem; font-weight: 600; text-decoration: none; }
  .cal-months a:hover, .cal-months a[aria-current="page"] { border-color: var(--accent); }
  .cal-months a[aria-current="page"] { background: color-mix(in srgb, var(--accent) 12%, var(--card)); }
  .cal-months-lw { border-color: color-mix(in srgb, #E8590C 55%, var(--border)) !important; }
  #calmsg.ok { color: var(--ok, #1a7f4b); } #calmsg.error { color: var(--error, #d92d20); }
