/* ============================================================
   Salon — Rezerwacje
   Motyw premium (ciepły grafit + złoto) — ciemny i jasny
   ============================================================ */

:root, [data-theme="dark"] {
  /* ciepły grafit zamiast chłodnego, miększe kontrasty */
  --bg: #14130f;
  --bg-glow: radial-gradient(1100px 520px at 78% -8%, rgba(224, 178, 96, 0.10), transparent 60%);
  --surface: #1d1b16;
  --surface-2: #272420;
  --surface-3: #322e28;
  --border: #38332b;
  --text: #f4f1ea;
  --muted: #a8a195;
  --muted-2: #756e62;

  --gold: #d9a94e;          /* wypełnienia (przyciski, zaznaczenia) */
  --gold-soft: rgba(217, 169, 78, 0.15);
  --gold-strong: #ecc277;   /* złoto jako tekst na ciemnym */
  --on-gold: #1c1407;       /* tekst na złotym wypełnieniu */

  --green: #4cbb88;
  --green-soft: rgba(76, 187, 136, 0.16);
  --amber: #e3a948;
  --amber-soft: rgba(227, 169, 72, 0.16);
  --red: #e35d54;
  --red-soft: rgba(227, 93, 84, 0.16);

  --bar-bg: rgba(20, 19, 15, 0.82);
  --bar-border: rgba(255, 255, 255, 0.06);

  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
  --safe-b: env(safe-area-inset-bottom, 0px);

  --max: 560px;
}

[data-theme="light"] {
  --bg: #f5f2ec;
  --bg-glow: radial-gradient(1100px 520px at 78% -8%, rgba(184, 134, 47, 0.10), transparent 60%);
  --surface: #ffffff;
  --surface-2: #f3efe8;
  --surface-3: #e9e3d8;
  --border: #e4ddd0;
  --text: #2a2620;
  --muted: #857d70;
  --muted-2: #aaa091;

  --gold: #cf9b3e;
  --gold-soft: rgba(176, 124, 38, 0.14);
  --gold-strong: #9a6c1c;    /* ciemniejsze złoto = czytelny tekst na jasnym */
  --on-gold: #20160a;

  --green: #2f9e6a;
  --green-soft: rgba(47, 158, 106, 0.15);
  --amber: #bd821c;
  --amber-soft: rgba(189, 130, 28, 0.15);
  --red: #d24a40;
  --red-soft: rgba(210, 74, 64, 0.14);

  --bar-bg: rgba(255, 253, 249, 0.82);
  --bar-border: rgba(0, 0, 0, 0.07);

  --shadow: 0 14px 40px rgba(120, 100, 60, 0.16);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
  overscroll-behavior-y: none;
}

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 16px; }

/* ---------- Ekran logowania (chmura) ---------- */
.auth-screen {
  position: fixed; inset: 0; z-index: 90;
  display: grid; place-items: center; padding: 20px;
  background-color: var(--bg); background-image: var(--bg-glow); background-repeat: no-repeat;
}
.auth-screen[hidden] { display: none; }
.auth-card {
  width: 100%; max-width: 380px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 28px 22px; box-shadow: var(--shadow);
  text-align: left;
}
.auth-card .bm-title { color: var(--text); }
.auth-error { color: var(--red); font-size: 13px; min-height: 18px; margin: 2px 2px 10px; }

/* ---------- App shell ---------- */
.app {
  max-width: var(--max);
  margin: 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  background-color: var(--bg);
  background-image: var(--bg-glow);
  background-repeat: no-repeat;
  background-attachment: fixed;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  background: var(--bar-bg);
  border-bottom: 1px solid var(--bar-border);
  backdrop-filter: saturate(1.4) blur(16px);
  -webkit-backdrop-filter: saturate(1.4) blur(16px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}
.brand-mark { line-height: 1; min-width: 0; padding: 2px 0; }
.bm-title {
  position: relative;
  font-size: 16px; font-weight: 600; letter-spacing: 4px; text-transform: uppercase;
  color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding-bottom: 6px;
}
.bm-title::after {
  content: ''; position: absolute; left: 1px; bottom: 0;
  width: 100%; max-width: 168px; height: 1.5px;
  background: linear-gradient(90deg, var(--gold-strong) 0%, var(--gold) 55%, transparent 100%);
}
.bm-sub {
  font-family: 'Segoe Script', 'Brush Script MT', 'Bradley Hand', 'Snell Roundhand', cursive;
  font-size: 17px; color: var(--gold-strong); margin-top: 5px; letter-spacing: 0.3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar .spacer { flex: 1; }

.icon-btn {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 18px;
}
.icon-btn:active { transform: scale(0.95); }

/* ---------- Main / views ---------- */
.main { flex: 1; padding: 0 16px calc(96px + var(--safe-b)); }
.view { display: none; animation: fade 0.22s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 22px 4px 10px; }

/* ---------- Day navigator ---------- */
.day-nav {
  display: flex; align-items: center; gap: 10px;
  margin: 4px 0 14px;
}
.day-nav .dn-btn {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  font-size: 20px; display: grid; place-items: center;
}
.day-nav .dn-date { flex: 1; text-align: center; }
.day-nav .dn-date .d-main { font-size: 18px; font-weight: 700; text-transform: capitalize; }
.day-nav .dn-date .d-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.day-nav .dn-date.is-today .d-main { color: var(--gold-strong); }
.today-btn {
  align-self: center; margin: 0 0 16px; display: inline-flex; gap: 6px;
  padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--gold-soft); color: var(--gold-strong); border: 1px solid rgba(217,169,78,0.3);
}

/* week strip */
.week-strip { display: flex; gap: 6px; margin-bottom: 16px; }
.week-strip .wd {
  flex: 1; text-align: center; padding: 8px 0; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border);
}
.week-strip .wd .wd-name { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.week-strip .wd .wd-num { font-size: 16px; font-weight: 700; margin-top: 3px; }
.week-strip .wd .wd-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--gold); margin: 4px auto 0; opacity: 0; }
.week-strip .wd.has .wd-dot { opacity: 1; }
.week-strip .wd.sel { background: var(--gold); border-color: var(--gold); }
.week-strip .wd.sel .wd-name, .week-strip .wd.sel .wd-num { color: var(--on-gold); }
.week-strip .wd.sel .wd-dot { background: var(--on-gold); }
.week-strip .wd.today:not(.sel) .wd-num { color: var(--gold-strong); }

/* ---------- Przełącznik widoku dnia ---------- */
.day-mode-bar { display: flex; justify-content: flex-end; margin: 0 0 12px; }
.seg.seg-sm { padding: 3px; gap: 4px; width: auto; }
.seg.seg-sm button { padding: 7px 14px; font-size: 12.5px; }

/* ---------- Widok listy (agenda) ---------- */
.agenda-row {
  display: flex; align-items: stretch; gap: 0; width: 100%; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 0; margin-bottom: 8px; overflow: hidden; color: var(--text);
}
.agenda-row:active { transform: scale(0.995); }
.agenda-row .ag-time {
  flex: 0 0 64px; display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: 10px 4px; font-variant-numeric: tabular-nums; background: var(--surface-2);
}
.agenda-row .ag-start { font-size: 14px; font-weight: 700; }
.agenda-row .ag-end { font-size: 11px; color: var(--muted); margin-top: 2px; }
.agenda-row .ag-bar { flex: 0 0 4px; background: var(--gold); }
.agenda-row.s-pending .ag-bar { background: var(--amber); }
.agenda-row.s-confirmed .ag-bar { background: var(--green); }
.agenda-row.s-cancelled .ag-bar { background: var(--red); }
.agenda-row .ag-main { flex: 1; min-width: 0; padding: 11px 13px; display: flex; flex-direction: column; justify-content: center; }
.agenda-row .ag-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agenda-row .ag-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agenda-row .ag-badge { flex: 0 0 auto; display: flex; align-items: center; padding: 0 14px 0 4px; color: var(--muted); font-size: 15px; }
.agenda-row.s-cancelled .ag-name { text-decoration: line-through; color: var(--muted); }
.gap-row {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 4px;
  background: transparent; border: 1px dashed var(--border); border-radius: 10px;
  padding: 9px 12px; margin-bottom: 8px; color: var(--muted-2); font-size: 12.5px; font-weight: 500;
}
.gap-row .gap-ico {
  display: inline-grid; place-items: center; width: 17px; height: 17px; border-radius: 50%;
  background: var(--gold-soft); color: var(--gold-strong); font-weight: 700; font-size: 13px;
}
.gap-row .gap-dur { color: var(--muted-2); }
.gap-row:hover { border-color: var(--gold); color: var(--gold-strong); }
.gap-row:active { transform: scale(0.99); }

/* ---------- Timeline ---------- */
.timeline {
  position: relative;
  margin-top: 6px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
}
.tl-inner { position: relative; }
.tl-hour {
  position: absolute; left: 0; right: 0;
  border-top: 1px solid var(--border);
  padding-left: 56px;
}
.tl-hour .tl-label {
  position: absolute; left: 10px; top: -9px;
  font-size: 11px; color: var(--muted-2); font-variant-numeric: tabular-nums;
}
.tl-halfhour { position: absolute; left: 56px; right: 0; border-top: 1px dashed var(--border); opacity: 0.5; }

.tl-now {
  position: absolute; left: 48px; right: 0; height: 0;
  border-top: 2px solid var(--red); z-index: 6; pointer-events: none;
}
.tl-now::before { content: ""; position: absolute; left: 0; top: -4px; width: 7px; height: 7px; border-radius: 50%; background: var(--red); }

.appt {
  position: absolute; left: 60px; right: 10px;
  border-radius: 10px; padding: 6px 24px 6px 11px; overflow: hidden;
  border-left: 3px solid var(--gold);
  background: var(--surface-3);
  z-index: 4;
  display: flex; flex-direction: column; gap: 2px; justify-content: center;
}
.appt:active { transform: scale(0.99); }
.appt .a-time { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.appt .a-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt .a-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt.s-pending { border-left-color: var(--amber); background: linear-gradient(90deg, var(--amber-soft), var(--surface-3) 60%); }
.appt.s-confirmed { border-left-color: var(--green); background: linear-gradient(90deg, var(--green-soft), var(--surface-3) 60%); }
.appt.s-cancelled { border-left-color: var(--red); background: var(--surface-2); opacity: 0.65; }
.appt.s-cancelled .a-title { text-decoration: line-through; }
.appt .a-badge { position: absolute; top: 7px; right: 9px; font-size: 14px; }
.appt .a-row { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; overflow: hidden; }
.appt .a-row .a-time { flex: 0 0 auto; }
.appt .a-row .a-title { overflow: hidden; text-overflow: ellipsis; }

.tl-empty-hint { position: absolute; inset: 0; pointer-events: none; display: grid; place-items: center; color: var(--muted-2); font-size: 13px; }

/* ---------- Empty states ---------- */
.empty {
  text-align: center; color: var(--muted); padding: 48px 20px;
}
.empty .e-emoji { font-size: 40px; }
.empty .e-title { font-size: 16px; font-weight: 600; color: var(--text); margin-top: 10px; }
.empty .e-text { font-size: 13px; margin-top: 6px; }

/* ---------- Lists / cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px;
}
.card + .card { margin-top: 10px; }

.svc-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 13px 14px; margin-bottom: 9px;
}
.svc-row .s-info { flex: 1; min-width: 0; }
.svc-row .s-name { font-weight: 600; }
.svc-row .s-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.svc-row .s-price { font-weight: 700; color: var(--gold-strong); white-space: nowrap; font-variant-numeric: tabular-nums; }
.svc-row .s-edit { color: var(--muted); font-size: 17px; padding: 4px 6px; background: none; border: none; }

.cat-head { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--gold); margin: 18px 4px 9px; font-weight: 700; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 18px; border-radius: 14px; font-size: 15px; font-weight: 600;
  border: 1px solid transparent; width: 100%;
}
.btn-primary { background: var(--gold); color: var(--on-gold); }
.btn-primary:active { background: var(--gold-strong); }
.btn-ghost { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-danger { background: var(--red-soft); color: var(--red); border-color: rgba(224,86,79,0.3); }
.btn-green { background: var(--green); color: #04140d; }
.btn:disabled { opacity: 0.4; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { width: auto; flex: 1; }
.btn-sm { padding: 9px 14px; font-size: 13px; border-radius: 10px; width: auto; }

/* ---------- FAB ---------- */
.fab {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(86px + var(--safe-b));
  z-index: 30;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 22px; border-radius: 999px;
  background: var(--gold); color: var(--on-gold); font-weight: 700; font-size: 15px;
  border: none; box-shadow: var(--shadow);
}
.fab:active { transform: translateX(-50%) scale(0.96); }
.fab .plus { font-size: 19px; line-height: 1; }

/* ---------- Bottom nav ---------- */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0;
  width: 100%; max-width: var(--max); z-index: 25;
  display: flex; justify-content: space-around;
  padding: 8px 8px calc(8px + var(--safe-b));
  background: var(--bar-bg);
  backdrop-filter: saturate(1.4) blur(16px);
  -webkit-backdrop-filter: saturate(1.4) blur(16px);
  border-top: 1px solid var(--bar-border);
}
.tab { flex: 1; background: none; border: none; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; border-radius: 10px; transition: color 0.15s; }
.tab .t-ico { font-size: 20px; }
.tab .t-lbl { font-size: 10.5px; font-weight: 600; letter-spacing: 0.3px; }
.tab.active { color: var(--gold-strong); }

/* ---------- Sheet / modal ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(0, 0, 0, 0.6);
  display: none; align-items: flex-end; justify-content: center;
}
.sheet-backdrop.open { display: flex; animation: fade 0.2s; }
.sheet {
  position: relative;
  width: 100%; max-width: var(--max);
  max-height: 92vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 22px 22px 0 0;
  padding: 8px 18px calc(26px + var(--safe-b));
  animation: slideup 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet-close {
  position: absolute; top: 12px; right: 12px; z-index: 6;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
  font-size: 15px; display: grid; place-items: center;
}
.sheet-close:active { transform: scale(0.9); }
.sheet-close:hover { color: var(--text); }
.sheet-back {
  position: absolute; top: 11px; left: 12px; z-index: 6;
  display: inline-flex; align-items: center; height: 34px; padding: 0 14px 0 10px;
  border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); font-size: 13px; font-weight: 600;
}
.sheet-back:active { transform: scale(0.95); }
.sheet-back:hover { border-color: var(--gold); }
@keyframes slideup { from { transform: translateY(100%); } to { transform: none; } }
.sheet .grabber { width: 40px; height: 4px; border-radius: 2px; background: var(--surface-3); margin: 8px auto 14px; }
.sheet.with-navbar { padding-top: 54px; }
.sheet.with-navbar .grabber { display: none; }
.sheet h2 { font-size: 19px; margin: 4px 2px 4px; }
.sheet .sub { color: var(--muted); font-size: 13px; margin: 0 2px 16px; }

/* ---------- Wizard steps ---------- */
.steps { display: flex; gap: 6px; margin: 6px 2px 18px; }
.steps .dot { flex: 1; height: 4px; border-radius: 2px; background: var(--surface-3); }
.steps .dot.done { background: var(--gold); }

.choice-grid { display: grid; gap: 9px; }
.choice {
  text-align: left; width: 100%;
  display: flex; align-items: center; gap: 12px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); padding: 13px 14px;
}
.choice:active { border-color: var(--gold); }
.choice.sel { border-color: var(--gold); background: var(--gold-soft); }
.choice .c-info { flex: 1; min-width: 0; }
.choice .c-name { font-weight: 600; }
.choice .c-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.choice .c-price { font-weight: 700; color: var(--gold-strong); font-variant-numeric: tabular-nums; }

.slot-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.slot {
  padding: 12px 0; text-align: center; border-radius: 11px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  font-weight: 600; font-variant-numeric: tabular-nums; font-size: 14px;
}
.slot:active { border-color: var(--gold); }
.slot.sel { background: var(--gold); border-color: var(--gold); color: var(--on-gold); }
.slot.taken { opacity: 0.28; text-decoration: line-through; pointer-events: none; }

/* ---------- Form fields ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin: 0 2px 7px; font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%; padding: 13px 14px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--gold); }
.field textarea { min-height: 64px; resize: vertical; }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }

.seg { display: flex; gap: 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 4px; }
.seg button { flex: 1; padding: 9px 0; border-radius: 9px; border: none; background: none; color: var(--muted); font-weight: 600; font-size: 13px; }
.seg button.sel { background: var(--surface-3); color: var(--text); }
.seg button.sel.s-confirmed { color: var(--green); }
.seg button.sel.s-pending { color: var(--amber); }
.seg button.sel.s-cancelled { color: var(--red); }

/* ---------- Detail rows ---------- */
.detail-line { display: flex; gap: 12px; padding: 12px 2px; border-bottom: 1px solid var(--border); }
.detail-line:last-of-type { border-bottom: none; }
.detail-line .dl-ico { width: 22px; text-align: center; color: var(--muted); }
.detail-line .dl-k { color: var(--muted); font-size: 13px; }
.detail-line .dl-v { font-weight: 600; }
.detail-line .dl-main { flex: 1; }
.dl-edit { flex: 0 0 auto; width: 32px; height: 32px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); font-size: 14px; margin-left: 4px; }
.dl-edit:active { transform: scale(0.9); }
.dl-edit:hover { color: var(--gold-strong); border-color: var(--gold); }

.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.status-pill.s-pending { background: var(--amber-soft); color: var(--amber); }
.status-pill.s-confirmed { background: var(--green-soft); color: var(--green); }
.status-pill.s-cancelled { background: var(--red-soft); color: var(--red); }

.spacer-sm { height: 10px; }
.spacer-md { height: 18px; }
.muted-note { color: var(--muted-2); font-size: 12px; text-align: center; margin-top: 16px; line-height: 1.5; }

.hr { height: 1px; background: var(--border); margin: 18px 0; border: none; }

/* ---------- Skok do daty ---------- */
.dn-date { cursor: pointer; position: relative; }
.dn-date .d-main::after {
  content: '  ▾'; color: var(--muted-2); font-size: 0.62em; vertical-align: middle;
}
.dn-date:active { opacity: 0.7; }
/* ---------- Kalendarz miesięczny (własny) ---------- */
.mp-head { display: flex; align-items: center; gap: 6px; margin: 4px 0 14px; }
.mp-title {
  flex: 1; text-align: center; font-size: 17px; font-weight: 700;
  background: none; border: none; color: var(--text); padding: 9px 4px; border-radius: 10px;
}
.mp-title::after { content: ' ▾'; color: var(--muted-2); font-size: 0.65em; vertical-align: middle; }
.mp-title:active { background: var(--surface-2); }
.mp-months { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mp-month {
  padding: 18px 4px; text-align: center; border-radius: 12px; white-space: nowrap;
  background: var(--surface-2); border: 1px solid transparent; color: var(--text);
  font-weight: 600; font-size: 14px;
}
.mp-month:active { transform: scale(0.94); }
.mp-month.cur { border-color: var(--gold); color: var(--gold-strong); }
.mp-month.sel { background: var(--gold); border-color: var(--gold); color: var(--on-gold); }
.mp-nav {
  width: 38px; height: 38px; border-radius: 11px; flex: 0 0 auto;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  font-size: 17px; display: grid; place-items: center;
}
.mp-nav:active { transform: scale(0.94); }
.mp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.mp-dow { text-align: center; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; padding-bottom: 4px; }
.mp-day {
  position: relative; aspect-ratio: 1 / 1;
  display: flex; align-items: center; justify-content: center;
  border-radius: 11px; background: var(--surface-2); border: 1px solid transparent;
  color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; font-size: 15px;
}
.mp-day:active { transform: scale(0.93); }
.mp-day.out { color: var(--muted-2); background: transparent; }
.mp-day.today { border-color: var(--gold); color: var(--gold-strong); }
.mp-day.sel { background: var(--gold); border-color: var(--gold); color: var(--on-gold); }
.mp-day .mp-dot { position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%); width: 5px; height: 5px; border-radius: 50%; background: var(--gold); }
.mp-day.sel .mp-dot { background: var(--on-gold); }
.mp-day.out .mp-dot { opacity: 0.5; }

/* ---------- Dymek wizyty (hover) ---------- */
.appt-tip {
  position: fixed; z-index: 70; max-width: 270px;
  background: var(--surface-3); border: 1px solid var(--border);
  border-radius: 12px; padding: 11px 13px; box-shadow: var(--shadow);
  pointer-events: none; opacity: 0; transform: translateY(4px);
  transition: opacity 0.14s ease, transform 0.14s ease;
}
.appt-tip.show { opacity: 1; transform: none; }
.appt-tip .t-name { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.appt-tip .t-row { font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.35; }
.appt-tip .t-row b { color: var(--text); font-weight: 600; }
.appt-tip .t-note { color: var(--muted-2); font-style: italic; }

.toast {
  position: fixed; left: 50%; bottom: calc(150px + var(--safe-b)); transform: translateX(-50%);
  background: var(--surface-3); color: var(--text); border: 1px solid var(--border);
  padding: 11px 18px; border-radius: 12px; font-size: 14px; z-index: 60;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-6px); }

/* ---------- Animacja zmiany statusu wizyty ---------- */
.status-anim {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center;
  background: rgba(8, 9, 11, 0.55); backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none;
}
.status-anim.show { animation: saFade 1.05s ease forwards; }
@keyframes saFade { 0% { opacity: 0; } 12% { opacity: 1; } 72% { opacity: 1; } 100% { opacity: 0; } }

.sa-card { display: flex; flex-direction: column; align-items: center; gap: 16px; transform: scale(0.78); }
.status-anim.show .sa-card { animation: saPop 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.45) forwards; }
@keyframes saPop { to { transform: scale(1); } }

.sa-ringwrap { position: relative; width: 124px; height: 124px; }
.sa-ripple {
  position: absolute; inset: 0; border-radius: 50%; border: 3px solid currentColor;
  opacity: 0; transform: scale(0.6);
}
.status-anim.show .sa-ripple { animation: saRipple 0.95s ease-out 0.12s; }
.status-anim.show .sa-ripple.delay { animation: saRipple 0.95s ease-out 0.32s; }
@keyframes saRipple { 0% { transform: scale(0.6); opacity: 0.55; } 100% { transform: scale(1.75); opacity: 0; } }
.sa-ring { width: 124px; height: 124px; filter: drop-shadow(0 6px 22px rgba(0, 0, 0, 0.5)); }
.sa-circle { fill: none; stroke-width: 6; stroke-linecap: round; stroke-dasharray: 300; stroke-dashoffset: 300; }
.sa-mark { fill: none; stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 140; stroke-dashoffset: 140; }
.status-anim.show .sa-circle { animation: saDraw 0.45s ease forwards; }
.status-anim.show .sa-mark { animation: saDraw 0.38s ease 0.42s forwards; }
@keyframes saDraw { to { stroke-dashoffset: 0; } }

.sa-label { font-size: 18px; font-weight: 800; letter-spacing: 0.3px; opacity: 0; }
.status-anim.show .sa-label { animation: saLabel 0.4s ease 0.5s forwards; }
@keyframes saLabel { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Animacja potwierdzenia gra zawsze (świadomy wybór — to celowy feedback),
   niezależnie od systemowego „ogranicz ruch". */

/* ---------- Górne menu (desktop) ---------- */
.topnav { display: none; align-items: center; gap: 2px; margin-left: 14px; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 13px; }
.topnav .tab { flex-direction: row; gap: 7px; padding: 8px 13px; border-radius: 9px; color: var(--muted); transition: background 0.15s, color 0.15s; }
.topnav .tab .t-ico { font-size: 15px; }
.topnav .tab .t-lbl { font-size: 13.5px; font-weight: 600; }
.topnav .tab.active { background: var(--gold-soft); color: var(--gold-strong); }
.topnav .tab:hover:not(.active) { color: var(--text); background: var(--surface-2); }
.newappt-top { display: none; }

/* ---------- Statystyki ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 13px; }
.kpi .k-val { font-size: 21px; font-weight: 800; line-height: 1.1; }
.kpi .k-val.gold { color: var(--gold-strong); }
.kpi .k-lbl { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.stat-legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.stat-legend b { font-size: 17px; margin-right: 3px; }
.stat-bar { margin-bottom: 12px; }
.stat-bar .sb-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 5px; }
.stat-bar .sb-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-bar .sb-val { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.stat-bar .sb-track { height: 8px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.stat-bar .sb-fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-strong)); border-radius: 5px; min-width: 4px; }

/* ---------- Wyszukiwarka ---------- */
.search-row { width: 100%; text-align: left; cursor: pointer; }
#searchInput, .search-input { width: 100%; padding: 13px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }
#searchInput:focus, .search-input:focus { outline: none; border-color: var(--gold); }
#searchResults { max-height: 60vh; overflow-y: auto; margin-top: 4px; }

/* ---------- Baza klientów ---------- */
.dup-banner {
  width: 100%; text-align: left; margin-bottom: 12px;
  background: var(--amber-soft); border: 1px solid rgba(224,162,63,0.35); color: var(--amber);
  border-radius: 12px; padding: 12px 14px; font-size: 13.5px; font-weight: 500;
}
.dup-banner b { text-decoration: underline; }
.dup-banner:active { transform: scale(0.99); }
.client-row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 13px 14px; margin-bottom: 9px; color: var(--text);
}
.client-row:active { transform: scale(0.99); }
.client-row .cl-avatar {
  width: 40px; height: 40px; flex: 0 0 auto; border-radius: 50%;
  background: var(--gold-soft); color: var(--gold-strong);
  display: grid; place-items: center; font-weight: 700; font-size: 16px;
}
.client-row .cl-info { flex: 1; min-width: 0; }
.client-row .cl-name { font-weight: 600; }
.client-row .cl-meta { font-size: 12px; color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client-row .cl-count { font-size: 12px; color: var(--muted); white-space: nowrap; }
.client-row .cl-count b { color: var(--gold-strong); font-size: 15px; }

/* ---------- Produkty w wizycie / profilu ---------- */
.prod-tag {
  display: inline-flex; align-items: center; gap: 6px; margin: 0 6px 6px 0;
  padding: 5px 11px; border-radius: 999px; font-size: 13px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.prod-tag b { color: var(--gold-strong); font-weight: 600; }
.dp-empty { color: var(--muted-2); font-size: 13px; padding: 4px 0; }
.note-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; font-size: 14px; line-height: 1.45; white-space: pre-wrap; }
.dp-head { display: flex; align-items: center; justify-content: space-between; margin: 6px 2px 10px; }
.dp-head span { font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }

/* edytor produktów */
.prod-row { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 11px; margin-bottom: 9px; }
.prod-row .pr-line { display: flex; gap: 8px; align-items: center; }
.prod-row .pr-line + .pr-line { margin-top: 8px; }
.prod-row input { width: 100%; padding: 10px 11px; border-radius: 9px; background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.prod-row input:focus { outline: none; border-color: var(--gold); }
.prod-row .p-qty { max-width: 78px; text-align: center; }
.prod-row .p-unit { max-width: 86px; }
.prod-row .p-del { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 9px; background: var(--red-soft); color: var(--red); border: 1px solid rgba(224,86,79,0.3); font-size: 16px; }

/* sekcje profilu */
.profile-head { display: flex; align-items: center; gap: 13px; margin: 2px 2px 16px; }
.profile-head .ph-avatar { width: 52px; height: 52px; border-radius: 50%; background: var(--gold-soft); color: var(--gold-strong); display: grid; place-items: center; font-weight: 700; font-size: 21px; flex: 0 0 auto; }
.profile-head .ph-name { font-size: 20px; font-weight: 700; }
.profile-head .ph-phone { font-size: 13px; color: var(--muted); margin-top: 2px; }
.visit-row {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; padding: 11px 12px; margin-bottom: 8px; color: var(--text);
}
.visit-row .v-date { font-size: 12px; color: var(--muted); flex: 0 0 auto; width: 78px; }
.visit-row .v-main { flex: 1; min-width: 0; }
.visit-row .v-svc { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.visit-row .v-prod { font-size: 12px; color: var(--muted-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.visit-row .v-price { font-weight: 700; color: var(--gold-strong); font-size: 13px; white-space: nowrap; }

/* ============================================================
   RESPONSYWNOŚĆ — desktop / tablet
   ============================================================ */
@media (min-width: 880px) {
  :root { --max: 1120px; }

  .topnav { display: flex; }
  .tabbar { display: none; }
  .newappt-top { display: inline-flex; width: auto; padding: 11px 18px; }
  .fab { display: none !important; }

  .topbar { padding: 18px 26px 14px; }
  .main { padding: 0 26px 48px; }

  /* czytelne, wyśrodkowane kolumny zamiast rozciągniętego telefonu */
  #view-calendar, #view-prices, #view-settings { max-width: 680px; margin: 0 auto; }
  #view-stats { max-width: 920px; margin: 0 auto; }

  /* okna jako wyśrodkowane dialogi, nie „od dołu” */
  .sheet-backdrop { align-items: center; }
  .sheet {
    max-width: 480px; max-height: 86vh; border-radius: 20px;
    padding-bottom: 26px; animation: pop 0.2s ease;
  }
  .sheet .grabber { display: none; }
  @keyframes pop { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }

  /* statystyki szerzej */
  .kpi-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .kpi .k-val { font-size: 26px; }
}

@media (min-width: 1200px) {
  #view-stats { max-width: 980px; }
}
