/* Panel salonu – czytelność przede wszystkim. */
@font-face { font-family: 'Endo Display'; src: url('/fonts/black.woff') format('woff'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Endo Sans'; src: url('/fonts/body-regular.woff') format('woff'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Endo Sans'; src: url('/fonts/body-bold.woff') format('woff'); font-weight: 700; font-display: swap; }

:root {
  --bg: #F1EFE8; --card: #FFFFFF; --paper: #E9E4D8; --line: #DAD6CB; --line-2: #C3C0B2;
  --ink: #0B231B; --ink-2: #23493B; --stone: #5C6B63; --brick: #9A3923; --brick-bg: #F6E3DB;
  --ok: #2F5D3A; --ok-bg: #E1ECDC; --warn: #8A5A00; --warn-bg: #FBEFD5; --info-bg: #E6ECF2;
  --display: 'Endo Display', 'Arial Narrow', sans-serif; --sans: 'Endo Sans', 'Helvetica Neue', Arial, sans-serif;
  --side: 232px; --ppm: 1.6px; /* pikseli na minutę w kalendarzu */
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 var(--sans); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--ink-2); outline-offset: 2px; }
h1, h2, h3 { margin: 0; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--stone); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--stone); } .small { font-size: 13px; } .nowrap { white-space: nowrap; } .right { text-align: right; }
.title { font: 700 30px/1 var(--display); text-transform: uppercase; letter-spacing: -.03em; }
.sub { font: 700 12px/1.2 var(--sans); text-transform: uppercase; letter-spacing: .14em; color: var(--stone); margin: 22px 0 10px; }

/* Układ */
.app { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #CFD9D3; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 18px 12px; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: #E9E4D8; text-decoration: none; }
.side-brand img { width: 40px; }
.side-brand b { font: 700 22px/1 var(--display); text-transform: uppercase; letter-spacing: .03em; display: block; }
.side-brand small { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #8FA399; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 4px; text-decoration: none; font-weight: 700; font-size: 14px; color: #BFCFC6; }
.nav a:hover { background: #16392D; color: #fff; }
.nav a[aria-current="page"] { background: #E9E4D8; color: var(--ink); }
.nav .cnt { margin-left: auto; background: var(--brick); color: #fff; border-radius: 10px; font-size: 11px; padding: 1px 7px; }
.side-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid #16392D; font-size: 13px; }
.side-foot b { color: #fff; display: block; }
.side-foot button { background: none; border: 0; color: #BFCFC6; padding: 6px 0; cursor: pointer; text-decoration: underline; }
.main { min-width: 0; padding: 22px 28px 40px; }
.topbar { display: none; }
.bottom-nav { display: none; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-bottom: 18px; }
.page-head .title { margin-right: auto; }
.mode-banner { background: var(--warn-bg); color: var(--warn); border-left: 4px solid var(--warn); padding: 8px 12px; font-size: 13px; margin-bottom: 14px; }
.mode-banner a { font-weight: 700; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
  .topbar { display: flex; position: sticky; top: 0; z-index: 30; background: var(--ink); color: #E9E4D8; align-items: center; gap: 10px; padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); }
  .topbar b { font: 700 20px/1 var(--display); text-transform: uppercase; letter-spacing: .03em; margin-right: auto; }
  .topbar img { width: 30px; }
  .main { padding: 14px 12px 96px; }
  .bottom-nav { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .bottom-nav a, .bottom-nav button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 0 10px; min-height: 58px; border: 0; background: none; text-decoration: none; font-size: 11.5px; font-weight: 700; color: var(--stone); }
  .bottom-nav [aria-current="page"] { color: var(--ink); box-shadow: inset 0 3px 0 var(--ink); }
  .bottom-nav .ico { font: 700 18px/1 var(--display); }
  .bottom-nav .add .ico { width: 30px; height: 30px; background: var(--ink); color: #fff; display: grid; place-items: center; transform: rotate(45deg); font-size: 0; }
  .bottom-nav .add .ico::after { content: '+'; transform: rotate(-45deg); font: 700 22px/1 var(--sans); }
  .title { font-size: 26px; }
  .topbar .btn { color: var(--ink); border-color: #E9E4D8; }
  .cal-filters .chips { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 4px; }
  .cal-filters .chip { flex: none; }
  .cal-tools .cal-date { width: 100%; order: -1; margin: 0 0 4px; }
}

/* Elementy */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 14px; border: 1.5px solid var(--ink); border-radius: 3px; background: var(--card); font-weight: 700; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--paper); }
.btn.primary { background: var(--ink); color: #fff; }
.btn.primary:hover { background: var(--brick); border-color: var(--brick); }
.btn.danger { border-color: var(--brick); color: var(--brick); }
.btn.danger:hover { background: var(--brick-bg); }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--paper); }
.btn.sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn.on { background: var(--ink); color: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.seg { display: inline-flex; border: 1.5px solid var(--ink); border-radius: 3px; overflow: hidden; }
.seg button { border: 0; background: var(--card); padding: 0 12px; min-height: 37px; font-weight: 700; font-size: 13px; cursor: pointer; }
.seg button + button { border-left: 1.5px solid var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 4px; padding: 16px; }
.card + .card { margin-top: 14px; }
.grid2 { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.stack > * + * { margin-top: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.spacer { flex: 1; }
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-weight: 700; font-size: 13px; margin-bottom: 5px; }
label.f > small, .help { display: block; color: var(--stone); font-size: 12.5px; margin-top: 4px; }
input[type=text], input[type=tel], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=search], input[type=url], select, textarea {
  width: 100%; min-height: 42px; padding: 8px 10px; border: 1.5px solid var(--line-2); border-radius: 3px; background: #fff; font-size: 15px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(20,19,17,.12); }
textarea { min-height: 80px; resize: vertical; }
.chk { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0; cursor: pointer; }
.chk input { width: 19px; height: 19px; margin-top: 1px; accent-color: var(--ink); flex: none; }
.fields { display: grid; gap: 0 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; padding: 2px 7px; border-radius: 3px; border: 1px solid currentColor; white-space: nowrap; letter-spacing: .01em; }
.st-scheduled { color: #6B4E00; } .st-confirmed { color: var(--ok); } .st-completed { color: var(--stone); } .st-cancelled { color: var(--brick); } .st-no_show { color: var(--brick); }
.badge.paid { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-bg); }
.alert { padding: 10px 12px; border-left: 4px solid var(--brick); background: var(--brick-bg); margin: 0 0 12px; font-size: 14px; }
.alert.ok { border-color: var(--ok); background: var(--ok-bg); }
.alert.warn { border-color: var(--warn); background: var(--warn-bg); color: #5C3D00; }
.alert.info { border-color: var(--ink-2); background: var(--info-bg); }
.empty { color: var(--stone); padding: 18px; text-align: center; border: 1.5px dashed var(--line); border-radius: 4px; }
table.t { width: 100%; border-collapse: collapse; background: var(--card); }
table.t th, table.t td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14px; }
table.t th { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--stone); background: var(--paper); }
table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: #FBF9F4; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 4px; }
.list { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 4px; }
.list > li { border-bottom: 1px solid var(--line); } .list > li:last-child { border-bottom: 0; }
.list .it { display: flex; gap: 12px; align-items: center; width: 100%; padding: 12px; background: none; border: 0; text-align: left; cursor: pointer; }
.list .it:hover { background: #FBF9F4; }
.it-main { flex: 1; min-width: 0; } .it-main b { display: block; } .it-main small { color: var(--stone); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1.5px solid var(--line-2); background: var(--card); border-radius: 20px; padding: 4px 11px; font-size: 13px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip.time { border-radius: 3px; font-variant-numeric: tabular-nums; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); opacity: 0; visibility: hidden; transition: transform .25s, opacity .25s, visibility .25s; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 4px; font-weight: 700; z-index: 200; max-width: calc(100vw - 32px); }
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
.toast.err { background: var(--brick); }
@media (max-width: 900px) { .toast { bottom: 80px; } }

/* Okna dialogowe */
dialog { border: 0; padding: 0; border-radius: 6px; width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 32px); background: var(--card); color: var(--ink); box-shadow: 0 30px 80px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(20, 19, 17, .5); }
dialog.drawer { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: min(520px, 100vw); border-radius: 0; }
.dlg { display: flex; flex-direction: column; max-height: inherit; height: 100%; }
.dlg-head { display: flex; align-items: flex-start; gap: 10px; padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.dlg-head h2 { font: 700 24px/1.05 var(--display); text-transform: uppercase; letter-spacing: .01em; flex: 1; }
.dlg-head .x { border: 0; background: none; font-size: 26px; line-height: 1; cursor: pointer; padding: 0 4px; color: var(--stone); }
.dlg-body { padding: 16px 18px; overflow-y: auto; flex: 1; }
.dlg-foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--line); background: #FBF9F4; }
@media (max-width: 600px) { dialog { width: 100vw; max-width: 100vw; max-height: 100vh; height: 100%; margin: 0; border-radius: 0; } }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; margin: 0 0 12px; font-size: 14px; }
.kv dt { color: var(--stone); font-weight: 700; font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; padding-top: 2px; }
.kv dd { margin: 0; }
.results { border: 1px solid var(--line); border-radius: 3px; margin-top: -6px; margin-bottom: 12px; max-height: 220px; overflow-y: auto; }
.results button { display: block; width: 100%; text-align: left; padding: 9px 10px; border: 0; border-bottom: 1px solid var(--line); background: #fff; cursor: pointer; }
.results button:hover, .results button:focus { background: var(--paper); }
.picked { display: flex; align-items: center; gap: 10px; padding: 10px; background: var(--paper); border-radius: 3px; margin-bottom: 12px; }
.timeline { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.timeline li { padding: 7px 0; border-bottom: 1px dashed var(--line); }

/* ===== Kalendarz ===== */
.cal-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.cal-date { font: 700 22px/1 var(--display); text-transform: uppercase; letter-spacing: .01em; min-width: 0; margin: 0 6px; }
.cal-filters { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin-bottom: 12px; }
.cal-filters .lbl { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--stone); }
.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--stone); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.sw { width: 16px; height: 12px; border: 1px solid var(--line-2); display: inline-block; }
.sw.off { background: repeating-linear-gradient(-45deg, #ECE6DA, #ECE6DA 4px, #F5F1E9 4px, #F5F1E9 8px); }
.sw.brk { background: repeating-linear-gradient(45deg, #E2DACB, #E2DACB 3px, #D3C9B6 3px, #D3C9B6 6px); }
.sw.free { background: #fff; }

.cal { display: grid; background: var(--card); border: 1px solid var(--line); border-radius: 4px; overflow: auto; max-height: calc(100vh - 210px); position: relative; }
.cal-head { position: sticky; top: 0; z-index: 6; display: grid; background: var(--card); border-bottom: 1.5px solid var(--ink); }
.cal-head > div { padding: 8px 8px 7px; font-weight: 700; font-size: 13px; border-left: 1px solid var(--line); display: flex; align-items: center; gap: 6px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-head > div:first-child { border-left: 0; }
.cal-head .today { color: var(--brick); }
.cal-body { display: grid; position: relative; }
.gutter { position: relative; border-right: 1px solid var(--line); }
.gutter span { position: absolute; right: 6px; transform: translateY(-50%); font-size: 11.5px; color: var(--stone); font-variant-numeric: tabular-nums; }
.col { position: relative; border-left: 1px solid var(--line); background: repeating-linear-gradient(-45deg, #EEE8DC, #EEE8DC 5px, #F6F2EA 5px, #F6F2EA 10px); cursor: default; }
.col .work { position: absolute; left: 0; right: 0; background-color: #fff; background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--ppm) * 60 - 1px), #EDE7DB calc(var(--ppm) * 60 - 1px), #EDE7DB calc(var(--ppm) * 60)); cursor: copy; }
.col .closed-label { position: absolute; left: 6px; right: 6px; top: 10px; font-size: 12px; font-weight: 700; color: var(--stone); text-transform: uppercase; letter-spacing: .08em; }
.col .blk { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(45deg, #E2DACB, #E2DACB 4px, #D6CCB9 4px, #D6CCB9 8px); border-top: 1px solid #BEB29C; border-bottom: 1px solid #BEB29C; font-size: 12px; font-weight: 700; padding: 3px 6px; color: var(--ink-2); overflow: hidden; z-index: 1; cursor: pointer; }
.col .blk.absence { background: repeating-linear-gradient(45deg, #DCCFC9, #DCCFC9 4px, #CDBEB6 4px, #CDBEB6 8px); }
.ghost { position: absolute; left: 3px; right: 3px; height: calc(var(--ppm) * 15); border: 1.5px dashed var(--ink); border-radius: 3px; font-size: 12px; font-weight: 700; padding: 0 6px; display: none; align-items: center; pointer-events: none; z-index: 2; background: rgba(255,255,255,.85); }
.col:hover .ghost.on { display: flex; }
.appt { position: absolute; left: 3px; right: 3px; z-index: 3; border-radius: 3px; background: #fff; border: 1.5px solid var(--ink-2); border-left: 5px solid var(--c, var(--ink)); padding: 3px 6px 3px 7px; overflow: hidden; cursor: pointer; text-align: left; font-size: 12.5px; line-height: 1.25; box-shadow: 0 1px 0 rgba(0,0,0,.04); }
.appt:hover { box-shadow: 0 4px 14px rgba(0,0,0,.15); z-index: 4; }
.appt b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.appt .meta { display: block; color: var(--stone); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt .stl { display: inline-block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-top: 1px; }
.appt.scheduled { border-style: dashed; background: #FFFCF4; }
.appt.completed { background: #F3F1EC; color: var(--ink-2); border-color: #B9B1A3; }
.appt.no_show { background: repeating-linear-gradient(-45deg, #FBEDE8, #FBEDE8 5px, #fff 5px, #fff 10px); border-color: var(--brick); }
.appt.cancelled { background: #fff; border-color: #C9BFAC; color: var(--stone); opacity: .85; }
.appt.cancelled b { text-decoration: line-through; }
.appt.compact { padding: 1px 4px 1px 5px; font-size: 11px; }
.appt.compact b { font-size: 11.5px; }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--brick); z-index: 5; pointer-events: none; }
.now-line::before { content: ''; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; background: var(--brick); transform: rotate(45deg); }

/* Lista dnia (telefon) */
.agenda { list-style: none; margin: 0; padding: 0; }
.agenda > li { display: flex; gap: 12px; padding: 12px; background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--c, var(--ink)); border-radius: 3px; margin-bottom: 8px; cursor: pointer; }
.agenda > li.free { border: 1.5px dashed var(--line-2); border-left-width: 1.5px; background: none; cursor: copy; color: var(--stone); padding: 9px 12px; }
.agenda > li.blkrow { background: repeating-linear-gradient(45deg, #EEE8DC, #EEE8DC 4px, #F6F2EA 4px, #F6F2EA 8px); border-left-color: #BEB29C; cursor: pointer; }
.agenda .tm { font: 700 18px/1.1 var(--display); min-width: 54px; font-variant-numeric: tabular-nums; }
.agenda .tm small { display: block; font: 400 12px/1.2 var(--sans); color: var(--stone); }
.agenda .bd { flex: 1; min-width: 0; }
.agenda .bd b { display: block; }
.agenda .bd .meta { color: var(--stone); font-size: 13px; }
.agenda li.cancelled { opacity: .6; } .agenda li.cancelled b { text-decoration: line-through; }
.day-sep { font: 700 13px/1 var(--sans); text-transform: uppercase; letter-spacing: .1em; margin: 16px 0 8px; color: var(--stone); }

/* Grafik */
.hours-row { display: grid; grid-template-columns: 120px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: start; }
.hours-row .ranges { display: flex; flex-direction: column; gap: 6px; }
.hours-row .range { display: flex; gap: 6px; align-items: center; }
.hours-row input[type=time] { width: 120px; }
@media (max-width: 600px) { .hours-row { grid-template-columns: 1fr; } }

.gal { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.gal figure { margin: 0; background: var(--paper); border: 1px solid var(--line); }
.gal img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.gal figcaption { padding: 6px; display: flex; gap: 6px; }
.tabs { display: flex; gap: 4px; border-bottom: 1.5px solid var(--ink); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 14px; font-weight: 700; cursor: pointer; white-space: nowrap; color: var(--stone); }
.tabs button[aria-selected="true"] { background: var(--ink); color: #fff; }
.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.check-list .mk { width: 20px; height: 20px; flex: none; border: 1.5px solid var(--ink); display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.check-list .ok .mk { background: var(--ok); border-color: var(--ok); color: #fff; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--ink); }
.login form { background: var(--paper); padding: 28px; width: min(400px, 100%); border-radius: 4px; }
.login img { width: 140px; margin: 0 auto 16px; display: block; }
.sms-preview { background: #EDE8DD; border-radius: 14px 14px 14px 3px; padding: 10px 12px; font-size: 14px; white-space: pre-wrap; max-width: 420px; }
.matrix td input { max-width: 110px; }

/* Edytor strony głównej */
.designer { display: grid; gap: 20px; align-items: start; }
@media (min-width: 1100px) { .designer { grid-template-columns: 1fr 380px; } .preview-phone { position: sticky; top: 20px; } }
.preview-phone { width: 360px; max-width: 100%; height: 740px; margin: 0 auto; border: 10px solid var(--ink); border-radius: 36px; overflow: hidden; background: var(--ink); box-shadow: 0 24px 50px rgba(0,0,0,.2); }
.preview-phone iframe { width: 100%; height: 100%; border: 0; display: block; }
.serp { margin-top: 10px; padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-radius: 6px; font-family: Arial, sans-serif; }
.serp small { display: block; color: #4d5156; font-size: 12px; } .serp b { display: block; color: #1a0dab; font-size: 18px; font-weight: 400; margin: 2px 0; } .serp span { color: #4d5156; font-size: 13px; }
[hidden] { display: none !important; }
