/* Błysk Manager: odświeżenie warstwy wizualnej. Style modułów i dane pozostają bez zmian. */
:root {
  color-scheme: dark;
  --bg: #0b1726;
  --panel: #172a3d;
  --panel2: #1e3449;
  --line: rgba(180, 210, 232, .18);
  --text: #f5f9fd;
  --muted: #bacbda;
  --orange: #ff9b55;
  --blue: #80d4f9;
  --green: #57dda9;
  --red: #ff91a1;
  --shadow: 0 18px 45px rgba(2, 10, 20, .24);
}
html { background: var(--bg); }
body {
  color: var(--text);
  line-height: 1.5;
  background:
    radial-gradient(ellipse 52rem 34rem at 92% -10%, rgba(69, 180, 225, .12), transparent 72%),
    radial-gradient(ellipse 36rem 30rem at 4% 12%, rgba(255, 151, 70, .07), transparent 76%),
    #0b1726;
}
::selection { background: rgba(128, 212, 249, .35); color: #fff; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
button, input, select, textarea { font-family: inherit; }
button { transition: background-color .18s ease, border-color .18s ease, transform .18s ease, box-shadow .18s ease; }
button:active { transform: translateY(1px); }

/* Logowanie */
.login-shell {
  background:
    radial-gradient(circle at 20% 18%, rgba(128, 212, 249, .15), transparent 36%),
    radial-gradient(circle at 84% 82%, rgba(255, 155, 85, .12), transparent 36%);
}
.login-card {
  width: min(450px, 100%);
  padding: clamp(26px, 5vw, 44px);
  border: 1px solid rgba(180, 210, 232, .23);
  border-radius: 26px;
  background: linear-gradient(155deg, #1b3145, #142538);
  box-shadow: 0 30px 80px rgba(0, 6, 14, .35), inset 0 1px rgba(255,255,255,.07);
}
.login-logo { width: 168px; height: 134px; }
.login-card h1 { margin: 4px 0 6px; font-size: clamp(25px, 4vw, 32px); letter-spacing: -.035em; }
.login-card p { line-height: 1.55; }
.login-card label { color: #e2edf6; font-weight: 600; }
.login-card .btn.primary { margin-top: 8px; }

/* Aplikacja i nawigacja */
.app { grid-template-columns: 252px minmax(0, 1fr); }
.sidebar {
  z-index: 6;
  padding: 20px 13px 16px;
  background: linear-gradient(180deg, #101f30, #0d1a2a);
  border-color: var(--line);
  backdrop-filter: none;
}
.brand {
  flex: none;
  padding: 9px 9px 20px;
  margin-bottom: 5px;
  border-bottom: 1px solid var(--line);
  gap: 11px;
}
.brand img { width: 54px; height: 60px; }
.brand strong { font-size: 15px; letter-spacing: -.02em; line-height: 1.2; }
.brand span { margin-top: 5px; color: var(--muted); }
.sidebar nav {
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #365066 transparent;
  gap: 4px;
  padding: 8px 3px 12px;
  align-content: start;
}
.sidebar nav::before {
  content: "NAWIGACJA";
  padding: 9px 12px 3px;
  color: #a9bed0;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .15em;
}
.sidebar nav button {
  display: block;
  min-height: 42px;
  padding: 9px 13px;
  color: #c7d5e1;
  border: 1px solid transparent;
  border-radius: 11px;
  font-size: 18px;
  line-height: 1.2;
}
.sidebar nav button span { font-size: 13px; margin-left: 7px; font-weight: 600; }
.sidebar nav button:hover { background: #23394c; color: #fff; }
.sidebar nav button.active {
  background: linear-gradient(100deg, rgba(255,155,85,.19), rgba(255,155,85,.065));
  border-color: rgba(255,155,85,.29);
  color: #fff;
  box-shadow: inset 3px 0 var(--orange);
}
.sidebar nav button.active span { font-weight: 750; }
.logout {
  flex: none;
  margin-top: 10px;
  padding: 11px 15px;
  border: 1px solid rgba(255,145,161,.16);
  background: rgba(255,145,161,.06);
  color: #ffc2ca;
  cursor: pointer;
}
.logout:hover { background: rgba(255,145,161,.15); }
.mobile-menu-btn, .mobile-menu-backdrop { display: none; }
body.mobile-navigation-open { overflow: hidden!important; }
.app main {
  width: min(100%, 1680px);
  padding: 0 clamp(20px, 3vw, 48px) 64px;
  margin-inline: auto;
}
.topbar {
  padding: 29px 0 23px;
  margin-bottom: 27px;
  border-color: var(--line);
}
.topbar h2 { font-size: clamp(25px, 2.5vw, 34px); letter-spacing: -.035em; line-height: 1.2; }
.eyebrow { color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: .17em; }

/* Powtarzalne elementy i czytelne akcje */
.btn {
  min-height: 42px;
  padding: 10px 15px;
  background: #223a50;
  border-color: rgba(180,210,232,.23);
  border-radius: 11px;
  color: var(--text);
  font-weight: 650;
}
.btn:hover { border-color: rgba(128,212,249,.6); background: #2d4a61; }
.btn.primary {
  color: #20160e;
  background: linear-gradient(135deg, #ffb478, #ff9850);
  box-shadow: 0 5px 15px rgba(255,132,54,.16);
}
.btn.primary:hover { background: linear-gradient(135deg, #ffc18e, #ffaa65); box-shadow: 0 8px 20px rgba(255,132,54,.22); }
.btn.ghost { border-color: rgba(180,210,232,.22); background: rgba(255,255,255,.025); }
.btn.ghost:hover { background: rgba(128,212,249,.09); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
input, select, textarea {
  min-height: 43px;
  background: #102136;
  border-color: rgba(180,210,232,.25);
  border-radius: 11px;
  color: var(--text);
}
input::placeholder, textarea::placeholder { color: #abbfd0; opacity: 1; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(128,212,249,.12); }
label { color: #d2deea; }
input[type="checkbox"], input[type="radio"] { min-height: 0; accent-color: #ff9b55; }
.toolbar { flex-wrap: wrap; gap: 10px; }
.toolbar input { flex: 1 1 260px; }
.toolbar .muted { margin: 0; }
.panel, .appointment-card, .client-card, .service-card, .stat,
.crm-message, .crm-client-card, .inventory-card {
  border-color: var(--line);
  background: linear-gradient(155deg, #192d41, #15283b);
  box-shadow: 0 4px 15px rgba(0, 7, 15, .10), inset 0 1px rgba(255,255,255,.035);
}
.panel, .appointment-card, .client-card, .service-card { border-radius: 17px; padding: clamp(16px, 1.7vw, 23px); }
.panel h3 { font-size: 18px; letter-spacing: -.015em; }
.stat { position: relative; overflow: hidden; border-radius: 16px; padding: 18px 19px; }
.stat::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--blue), transparent 85%); }
.stat:nth-child(4n+2)::before { background: linear-gradient(90deg, var(--orange), transparent 85%); }
.stat:nth-child(4n+3)::before { background: linear-gradient(90deg, var(--green), transparent 85%); }
.stat span { color: #c7d5e2; font-size: 12px; font-weight: 650; }
.stat strong { margin-top: 6px; font-size: clamp(22px, 2vw, 30px); line-height: 1.2; letter-spacing: -.025em; overflow-wrap: anywhere; }
.stats, .dashboard-grid { gap: 16px; }
.cards-list { gap: 11px; }
.card-main { min-width: 0; }
.card-main h3 { font-size: 17px; line-height: 1.35; }
.card-main p { overflow-wrap: anywhere; line-height: 1.45; }
.card-actions { align-items: center; }
.badge { padding: 5px 10px; font-weight: 750; }
.badge.orange { color: #ffc18b; }
.badge.green { color: #9beec8; }
.badge.red { color: #ffc0c8; }
.empty { padding: clamp(30px, 5vw, 50px) 16px; border: 1px dashed rgba(180,210,232,.22); border-radius: 14px; color: var(--muted); }
.notice { line-height: 1.55; }
.today-card { background: rgba(11,28,43,.48); border-radius: 13px; }
.today-list { display: grid; gap: 10px; }
.today-card h3 { margin-top: 0; }
.today-time { color: var(--blue); }
.finance-row { align-items: center; }
.service-card { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.service-card h3 { line-height: 1.3; }
.service-card strong { color: #ffb478; }
.service-card p { margin-top: auto; }
.segmented { border-radius: 12px; }
.segmented button { min-height: 39px; }

/* Dwa kalendarze: większe numery dni i spokojniejsze tło. */
#calendarContainer, .schedule-calendar-wrap-v600 {
  border: 1px solid rgba(180,210,232,.2);
  border-radius: 16px;
  overflow: hidden;
  background: #14273a;
}
.calendar-weekdays, .schedule-weekdays-v600 { background: #1d3448; }
.calendar-weekdays span, .schedule-weekdays-v600 span { color: #d8e5ee; font-size: 12px; font-weight: 750; }
.calendar-day, .schedule-day-v600 { background: #182d40; border-color: rgba(180,210,232,.14); }
.calendar-day:nth-child(odd), .schedule-day-v600:nth-child(odd) { background: #162a3d; }
.calendar-day:hover, .schedule-day-v600:hover { background: #223a4e; }
.calendar-day.other, .schedule-day-v600.other { opacity: .48; }
.calendar-day.today, .schedule-day-v600.today { box-shadow: inset 0 0 0 2px var(--orange); }
.day-number, .schedule-day-head-v600>span { color: #ecf4fa; font-size: 13px; font-weight: 750; }
.calendar-event:not(.status-event) { background: rgba(128,212,249,.16); color: #effbff; }
.calendar-reservation { font-weight: 650; }
.schedule-entry-v600, .schedule-today-person-v600, .schedule-status-choice { background: #112438; }
.schedule-entry-v600:hover, .schedule-today-person-v600:hover { background: #254058; }
.schedule-legend-v600 span { padding: 5px 9px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.03); }

/* Okna, raporty i pozostałe moduły */
.modal { background: rgba(2, 10, 20, .76); }
.modal-card { background: #172a3d; border-color: rgba(180,210,232,.25); box-shadow: 0 25px 80px rgba(0,5,14,.45); }
.modal-card h2 { letter-spacing: -.025em; }
.modal-close { cursor: pointer; }
/* Natywne kontrolki daty potrafią wymusić szerokość kolumny na iOS. */
#intakeProtocolForm .form-grid,
#appointmentForm.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#intakeProtocolForm .form-grid > label,
#appointmentForm.form-grid > label { min-width: 0; max-width: 100%; overflow: hidden; }
#intakeProtocolForm input[type="datetime-local"],
#appointmentForm input[type="date"],
#appointmentForm input[type="time"] {
  display: block;
  width: 100%!important;
  min-width: 0!important;
  max-width: 100%!important;
  box-sizing: border-box;
  font-size: 16px;
}
@media (max-width: 700px) {
  #intakeProtocolForm .form-grid,
  #appointmentForm.form-grid { grid-template-columns: minmax(0, 1fr); }
  #intakeProtocolForm input[type="datetime-local"],
  #appointmentForm input[type="date"],
  #appointmentForm input[type="time"] { inline-size: 100%!important; min-inline-size: 0!important; }
}
.toast { z-index: 1100; background: #25455b; color: #fff; }
.monthly-table thead, .manual-summary-table thead { background: #223b51; }
.monthly-table th, .monthly-table td { border-color: var(--line); }
.crm-message.status-ready, .inventory-card.low-stock { background: linear-gradient(110deg, rgba(255,155,85,.15), #172a3d); }
.inventory-meta span, .inventory-stock, .crm-status { border: 1px solid var(--line); }
.appointment-client-results { background: #14283c; }
.calendar-choice { background: #1d354a; }

@media (max-width: 1100px) and (min-width: 901px) {
  .app { grid-template-columns: 220px minmax(0,1fr); }
  .app main { padding-inline: 22px; }
  .stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .service-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0,1fr); }
  .app main { padding: env(safe-area-inset-top) 15px calc(102px + env(safe-area-inset-bottom)); }
  .topbar {
    margin: 0 0 20px;
    padding: 18px 0 16px!important;
    border-bottom: 1px solid var(--line);
    background: transparent!important;
  }
  .topbar h2 { font-size: clamp(21px, 5vw, 28px); }
  .topbar .eyebrow { display: block; font-size: 10px; }
  .sidebar {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    width: 100%;
    height: calc(65px + env(safe-area-inset-bottom));
    padding: 5px 7px calc(5px + env(safe-area-inset-bottom));
    z-index: 40;
    background: rgba(15,31,46,.98);
    border: 0;
    border-top: 1px solid var(--line);
    box-shadow: 0 -10px 25px rgba(1,10,20,.24);
  }
  .sidebar .brand, .sidebar .logout { display: none; }
  .sidebar nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 80%;
    flex: 1 1 80%;
    min-width: 0;
    min-height: 0;
    padding: 0;
    gap: 3px;
    overflow: hidden;
  }
  .sidebar nav::before { display: none; }
  .sidebar nav button,
  .sidebar nav button:nth-child(n+6) {
    display: none;
    min-width: 0;
    min-height: 54px;
    padding: 4px 2px;
    border: 0;
    border-radius: 10px;
    font-size: 20px;
    text-align: center;
  }
  .sidebar nav button:nth-child(-n+4) { display: block; }
  .sidebar nav button span {
    display: block;
    overflow: hidden;
    margin: 0;
    font-size: 10px;
    line-height: 1.18;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .sidebar nav button.active { box-shadow: inset 0 -3px var(--orange); }
  .mobile-menu-btn {
    display: grid;
    place-content: center;
    justify-items: center;
    flex: 1 1 20%;
    min-width: 0;
    min-height: 54px;
    padding: 3px 1px;
    color: #d7e6f0;
    background: transparent;
    border: 0;
    border-radius: 10px;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
  }
  .mobile-menu-label { margin-top: 4px; font-size: 10px; font-weight: 650; }
  .mobile-menu-btn:hover, .mobile-menu-btn[aria-expanded="true"] { background: #284156; color: #fff; }
  .mobile-menu-btn.active { background: rgba(255,155,85,.17); color: #fff; box-shadow: inset 0 -3px var(--orange); }
  .mobile-menu-backdrop { position: fixed; inset: 0; z-index: 39; background: rgba(3,12,23,.7); }
  .app.mobile-menu-open .mobile-menu-backdrop { display: block; }
  .app.mobile-menu-open .sidebar {
    top: max(12vh, env(safe-area-inset-top));
    bottom: 0;
    height: auto;
    display: flex;
    flex-direction: column;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
    border-radius: 22px 22px 0 0;
    border-top: 1px solid rgba(180,210,232,.24);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .app.mobile-menu-open .sidebar .brand {
    display: flex;
    padding: 2px 46px 12px 0;
    margin: 0 0 8px;
  }
  .app.mobile-menu-open .sidebar .brand img { width: 56px; height: 57px; }
  .app.mobile-menu-open .sidebar nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: start;
    flex: 1 0 auto;
    width: 100%;
    overflow: visible;
    gap: 7px;
  }
  .app.mobile-menu-open .sidebar nav button,
  .app.mobile-menu-open .sidebar nav button:nth-child(n+6) {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 51px;
    padding: 8px 10px;
    font-size: 20px;
    text-align: left;
    background: #1b3247;
    border: 1px solid var(--line);
  }
  .app.mobile-menu-open .sidebar nav button.hidden { display: none!important; }
  .app.mobile-menu-open .sidebar nav button span { display: inline; margin: 0; font-size: 12px; text-overflow: clip; }
  .app.mobile-menu-open .sidebar nav button.active { background: rgba(255,155,85,.17); border-color: rgba(255,155,85,.42); }
  .app.mobile-menu-open .sidebar .logout { display: block; width: 100%; margin-top: 12px; }
  .app.mobile-menu-open .mobile-menu-btn {
    position: absolute;
    top: 18px;
    right: 16px;
    width: 43px;
    height: 43px;
    min-height: 43px;
    background: #2b465b;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 22px;
  }
  .app.mobile-menu-open .mobile-menu-label { display: none; }
  .stats, .crm-stats, .inventory-stats, .protocol-stats { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
  .stat { padding: 14px; }
  .stat strong { font-size: clamp(20px,4.3vw,25px); }
  .dashboard-grid, .crm-layout { grid-template-columns: minmax(0,1fr); gap: 12px; }
  .appointment-card, .client-card { flex-direction: column; align-items: stretch; gap: 12px; }
  .card-actions { justify-content: flex-start; }
  .toolbar { align-items: stretch; }
  .toolbar input, .toolbar select { max-width: 100%; }
  .calendar-day { min-height: 89px; padding: 5px 3px; }
  .schedule-day-v600 { min-height: 90px; }
  .day-number, .schedule-day-head-v600>span { font-size: 11px; }
  .calendar-weekdays span, .schedule-weekdays-v600 span { padding-inline: 1px; font-size: 10px; }
  .modal-card, #modal .modal-card { background: #172a3d!important; }
  #modal .modal-close { background: #29465b!important; }
  #appointmentForm.appointment-form-v523 .form-actions { background: rgba(23,42,61,.98)!important; }
  .toast { right: 14px; bottom: calc(78px + env(safe-area-inset-bottom)); left: 14px; text-align: center; }
}
@media (max-width: 520px) {
  .app main { padding-inline: 12px; }
  .topbar .eyebrow { display: block; }
  .topbar-actions-v610 { max-width: 57%; }
  .topbar-actions-v610 #quickAppointment { font-size: 12px; }
  .service-grid { grid-template-columns: minmax(0,1fr); }
  .calendar-event { font-size: 9px; }
  .schedule-legend-v600 { gap: 5px; }
}
@media (prefers-reduced-motion: reduce) {
  button { transition: none; }
}
