:root {
  --bg: #0f1115;
  --card: #1a1e26;
  --card2: #222834;
  --text: #e8ecf3;
  --muted: #8b95a7;
  --accent: #b8f36e;
  --accent2: #34c759;
  --danger: #ff5b5b;
  --warn: #ffb020;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(0, 0, 0, .35);
  --safe-top: max(env(safe-area-inset-top, 0px), var(--tg-safe-area-inset-top, 0px), var(--tg-content-safe-area-inset-top, 0px));
  --safe-right: max(env(safe-area-inset-right, 0px), var(--tg-safe-area-inset-right, 0px), var(--tg-content-safe-area-inset-right, 0px));
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px), var(--tg-content-safe-area-inset-bottom, 0px));
  --safe-left: max(env(safe-area-inset-left, 0px), var(--tg-safe-area-inset-left, 0px), var(--tg-content-safe-area-inset-left, 0px));
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: calc(24px + var(--safe-bottom));
}

.hidden { display: none !important; }
.master-cabinet, .client-cabinet { --bg: #101a20; --card: #17232a; --card2: #203039; --text: #f4f8f3; --muted: #aab8b1; --accent: #c7f589; --master-line: #e4f5e825; --master-line-strong: #c7f5894a; --master-separator: #ffffff18; --master-warning: #ffd588; }
.master-cabinet:not(.theme-light) { --master-accent-on: #18200f; color-scheme: dark; }
.master-cabinet.theme-light { --bg: #f5f7f9; --card: #fff; --card2: #edf6f4; --text: #15262a; --muted: #68787c; --accent: #167f70; --accent2: #187a54; --danger: #b53939; --warn: #a96217; --master-line: #e4ebeb; --master-line-strong: #aecfca; --master-separator: #e4ebeb; --master-warning: #a96217; --master-accent-on: #fff; color-scheme: light; }
.master-cabinet.theme-light header, .master-cabinet.theme-light .master-nav { border-color: var(--master-line); }
.master-cabinet.theme-light button:not(.primary):not(.success):not(.danger), .master-cabinet.theme-light input, .master-cabinet.theme-light select, .master-cabinet.theme-light textarea { border-color: var(--master-line); }
.master-cabinet.theme-light button.primary, .master-cabinet.theme-light button.success { color: #fff; }
.master-cabinet.theme-light .master-week-day.selected, .master-cabinet.theme-light .master-month-day.selected { color: #fff; }
.master-cabinet.theme-light .selected .master-date-dot { background: #fff; }
.master-cabinet.theme-light .chip { background: #e7eeec; }
.master-cabinet.theme-light .chip.green { background: #e0f2e6; color: #16693a; }
.master-cabinet.theme-light .chip.red { background: #fbe6e6; color: #a53333; }
.master-cabinet.theme-light .chip.accent { background: #e4f3f0; color: #166e63; }
.master-cabinet.theme-light .master-booking-detail, .master-cabinet.theme-light .master-more-row, .master-cabinet.theme-light .list-item { border-color: var(--master-separator); }
.master-cabinet.theme-light .setup-card { background: linear-gradient(135deg, #fff, #e6f3ed); border-color: var(--master-line-strong); }
.master-cabinet.theme-light .dashboard-invite { border-color: var(--master-line-strong); }
.master-cabinet.theme-light .master-week-day.weekend:not(.selected), .master-cabinet.theme-light .master-month-weekday.weekend, .master-cabinet.theme-light .master-month-day.weekend:not(.selected) { color: #a3454a; }
.master-cabinet header { min-height: 58px; padding-block: calc(7px + var(--safe-top)) 7px; background: var(--card); border-color: var(--master-line); }
.master-cabinet header h1 { letter-spacing: .02em; }
.master-cabinet header .master-theme-toggle { flex: 0 0 44px; width: 44px; height: 44px; padding: 0; border: 1px solid var(--master-line); border-radius: 11px; background: var(--bg); color: var(--text); font-size: 21px; line-height: 1; }
.master-cabinet header .master-theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.master-cabinet header #btn-master-home { display: grid; place-items: center; flex: 0 0 44px; width: 44px; height: 44px; padding: 0; border: 1px solid var(--master-line); border-radius: 11px; background: var(--bg); color: var(--accent); font-size: 21px; line-height: 1; }
.master-cabinet header #btn-master-home:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.master-cabinet button.primary { color: var(--master-accent-on); }
.client-cabinet .card { border: 1px solid #e4f5e825; box-shadow: none; }
.client-master-profile { position: relative; }
.client-master-profile > .row { padding-right: 50px; }
.client-master-profile > .row > div:last-child { min-width: 0; overflow-wrap: anywhere; }
.client-master-profile > .text-link { display: flex; width: fit-content; max-width: 100%; margin-top: 12px; margin-bottom: 0; }
.favorite-toggle { position: absolute; top: 14px; right: 14px; display: grid; place-items: center; width: 44px; min-width: 44px; min-height: 44px; padding: 0; border-color: #e4f5e82b; border-radius: 50%; background: var(--card2); color: var(--muted); font-size: 25px; line-height: 1; }
.favorite-toggle[aria-pressed="true"] { color: var(--accent); }
.favorite-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.master-cabinet { padding-bottom: calc(78px + var(--safe-bottom)); }
.master-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; background: var(--card); border-top: 1px solid var(--master-line); padding: 8px max(10px, var(--safe-right)) calc(8px + var(--safe-bottom)) max(10px, var(--safe-left)); }
.master-cabinet .master-nav button { min-width: 0; min-height: 48px; padding: 10px 2px; border: 0; border-radius: 11px; background: var(--card2); color: var(--text); font-size: 13px; font-weight: 600; }
.master-cabinet .master-nav button.primary { background: var(--accent); color: var(--master-accent-on); }
.master-cabinet .master-nav button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.master-cabinet .card { border: 1px solid var(--master-line); box-shadow: none; }
.master-cabinet .setup-card, .master-cabinet .dashboard-invite { border-color: var(--master-line-strong); }
.more-menu { display: grid; gap: 10px; margin-bottom: 18px; }
.more-item { text-align: left; display: grid; gap: 5px; padding: 16px; }
.more-item .sub { color: var(--muted); font-size: 13px; line-height: 1.4; }
.master-more-group h2 { margin-bottom: 7px; font-size: 17px; }
.master-more-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 52px; padding: 10px 0; border: 0; border-top: 1px solid #ffffff18; border-radius: 0; color: var(--text); background: transparent; text-align: left; }
.master-more-row:first-of-type { border-top: 0; }
.master-more-chevron { color: var(--accent); font-size: 22px; }
.master-list-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 3px 2px 14px; }
.master-list-head h2 { font-size: 21px; line-height: 1.3; }
.master-list-head .muted { color: var(--muted); font-size: 12px; }
.master-client-search { margin-bottom: 12px; }
.master-client-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 68px; margin-bottom: 8px; padding: 11px 13px; border: 1px solid #c7f5894a; border-radius: 13px; background: var(--card); text-align: left; }
.master-client-row > span:first-child { min-width: 0; }
.master-client-row strong { display: block; font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.master-client-row small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.3; overflow-wrap: anywhere; }
.master-client-chevron { flex: none; color: var(--accent); font-size: 20px; }
.master-client-detail h2 { font-size: 21px; line-height: 1.3; overflow-wrap: anywhere; }
.master-client-tg { display: flex; justify-content: center; width: 100%; min-height: 44px; margin: 12px 0; padding: 10px; border: 1px solid #e4f5e82b; border-radius: 10px; color: var(--text); background: var(--card2); font-weight: 600; }
.master-client-tg:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.service-description { margin: 12px 12px 10px; }
.service-description summary { display: flex; align-items: center; min-height: 44px; border-top: 1px solid #ffffff1a; cursor: pointer; color: var(--text); font-size: 14px; }
.service-description summary::before { content: "+"; margin-right: 10px; }
.service-description[open] summary::before { content: "−"; }
.service-description p { margin: 0 0 8px; line-height: 1.5; }
.account-contact { display:grid; gap:9px; margin-top:18px; padding-top:16px; border-top:1px solid #ffffff1a; }
.account-contact label { font-size:14px; font-weight:600; }
.account-contact input { width:100%; min-height:48px; }
.account-contact button { width:100%; min-height:48px; }
.account-contact p { margin:0; font-size:12px; line-height:1.45; }
.dashboard-page-title { margin: 3px 0 5px; font-size: 24px; line-height: 1.2; }
#dashboard-body { max-width: 390px; margin-inline: auto; }
.dashboard-date { margin: 0 0 7px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.dashboard-invite { margin-top: 10px; padding: 15px; background: var(--card); }
.invite-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 24px; }
.dashboard-invite h2 { font-size: 18px; margin: 0; }
.invite-channel { flex: none; color: var(--muted); font-size: 12px; }
.invite-modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px; padding: 3px; margin: 12px 0 10px; background: var(--card2); border-radius: 12px; }
.invite-modes button { min-width: 0; min-height: 44px; padding: 8px; background: transparent; border: 0; font-size: 13px; }
.invite-modes button[aria-pressed="true"] { background: var(--card); color: var(--text); font-weight: 600; }
.invite-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.invite-actions button { min-width: 0; min-height: 44px; padding: 8px 4px; line-height: 1.25; background: var(--card2); border-color: #ffffff26; font-size: 13px; }
.invite-actions button:first-child { font-weight: 600; }
.invite-actions button:last-child:not(:disabled) { color: var(--master-accent-on); background: var(--accent); border-color: transparent; font-weight: 700; }
.invite-link { margin-top: 12px; }
.invite-unavailable { margin: 0 0 8px; font-size: 12px; line-height: 1.4; }
.dashboard-invite .invite-hint { margin-top: 12px; color: var(--warn); }
.dashboard-next h2, .dashboard-section-title { font-size: 16px; margin: 8px 0 12px; }
.dashboard-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 22px 2px 10px; }
.dashboard-section-heading h2 { font-size: 17px; line-height: 1.3; }
.dashboard-block-title { margin: 23px 2px 10px; font-size: 17px; line-height: 1.3; }
.dashboard-all-bookings { min-height: 44px; padding: 4px; border: 0; color: var(--accent); background: transparent; font-size: 13px; font-weight: 600; white-space: nowrap; }
.dashboard-next .title { font-size: 16px; font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; }
.dashboard-next p { margin: 8px 0; }
.dashboard-next .booking-number { margin: 0 0 5px; }
.dashboard-appointment { position: relative; display: grid; grid-template-columns: 60px minmax(0, 1fr); align-items: start; gap: 12px; margin-bottom: 9px; padding: 16px; border: 1px solid var(--master-line); border-radius: 17px; background: var(--card); }
.dashboard-appointment:last-child { margin-bottom: 0; }
.dashboard-appointment-stamp { display: grid; justify-items: center; align-content: start; gap: 3px; min-width: 60px; padding: 9px 4px; border-radius: 12px; background: var(--card2); color: var(--accent); font-variant-numeric: tabular-nums; }
.dashboard-appointment-stamp strong { font-size: 15px; line-height: 1.2; }
.dashboard-appointment-stamp span { font-size: 12px; line-height: 1.2; font-weight: 700; white-space: nowrap; }
.dashboard-appointment-copy { min-width: 0; }
.dashboard-booking-number { position: absolute; top: 14px; right: 15px; display: flex; align-items: flex-start; justify-content: flex-end; min-height: 44px; min-width: 44px; padding: 2px 0; border: 0; color: var(--muted); background: transparent; font-size: 12px; text-align: right; }
.dashboard-client-link { display: grid; align-content: start; gap: 5px; width: 100%; min-height: 44px; padding: 1px 46px 0 0; border: 0; color: var(--text); background: transparent; text-align: left; }
.dashboard-client-name { font-size: 15px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.dashboard-client-service { color: var(--muted); font-size: 13px; font-weight: 400; line-height: 1.4; overflow-wrap: anywhere; }
.dashboard-visit-status { display: flex; align-items: center; gap: 6px; margin: 8px 0 0; color: var(--master-warning); font-size: 12px; line-height: 1.35; }
.dashboard-visit-status.confirmed { color: var(--accent); }
.dashboard-status-dot { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: currentColor; }
.dashboard-next .block { margin-top: 12px; }
.dashboard-manual { min-height: 48px; margin: 10px 0 4px !important; font-weight: 600; }
.dashboard-signals { padding-block: 5px; }
.dashboard-signal { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 49px; padding: 9px 0; border: 0; border-bottom: 1px solid var(--master-separator); border-radius: 0; color: var(--text); background: transparent; text-align: left; font-size: 14px; line-height: 1.4; }
.dashboard-signal-label { flex: 1; min-width: 0; }
.dashboard-signal-trailing { display: inline-flex; align-items: center; gap: 8px; flex: none; color: var(--accent); }
.dashboard-signal-count { font-size: 13px; line-height: 1.3; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dashboard-signal-arrow { font-size: 18px; line-height: 1; }
.dashboard-signal:last-child { border-bottom: 0; padding-bottom: 0; }
.free-windows-card { padding: 20px; }
.free-windows-card h2 { font-size: 18px; margin-bottom: 10px; }
.free-windows-card > .muted { line-height: 1.5; }
.free-windows-card .field { margin-top: 18px; }
.free-windows-card button.block { margin-top: 14px; }
.dashboard-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.dashboard-summary button { text-align: left; line-height: 1.5; }
.master-cabinet .card, .master-cabinet .row > *, .master-cabinet .list-item > * { min-width: 0; overflow-wrap: anywhere; }
.master-cabinet .row.spread { flex-wrap: wrap; }
.tabs { scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
button.block { margin-bottom: 8px; }

header {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
  padding: calc(14px + var(--safe-top)) calc(16px + var(--safe-right)) 10px calc(16px + var(--safe-left));
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid #ffffff12;
}
header .back { background: none; border: none; color: var(--accent); font-size: 18px; cursor: pointer; padding: 4px 8px; min-width: 44px; min-height: 44px; }
header h1 { font-size: 17px; font-weight: 700; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

main { padding: 14px calc(16px + var(--safe-right)) 14px calc(16px + var(--safe-left)); max-width: 640px; margin: 0 auto; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.card h2 { font-size: 16px; margin-bottom: 10px; }
.card .muted { color: var(--muted); font-size: 13px; }
.card p { font-size: 14px; line-height: 1.45; }

.row { display: flex; align-items: center; gap: 10px; }
.spread { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.quick-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.quick-nav button { width: 100%; }

button {
  background: var(--card2);
  color: var(--text);
  border: 1px solid #ffffff1a;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
  transition: filter .15s;
  min-height: 44px;
}
button:hover { filter: brightness(1.15); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { background: var(--accent); color: #18200f; border-color: transparent; font-weight: 700; }
button.success { background: var(--accent2); border-color: transparent; font-weight: 600; }
button.danger { background: transparent; color: var(--danger); border-color: #ff5b5b55; }
button.small { padding: 8px 10px; font-size: 13px; border-radius: 8px; min-height: 44px; }
button.block { width: 100%; margin-top: 8px; }

input, select, textarea {
  width: 100%;
  background: var(--card2);
  border: 1px solid #ffffff1a;
  color: var(--text);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 16px;
  margin-bottom: 10px;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 1px solid var(--accent); }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.field input, .field select, .field textarea { margin-bottom: 4px; }
.field-help { color: var(--muted); font-size: 12px; line-height: 1.35; }
.text-link { display: inline-flex; align-items: center; color: #8ab4ff; text-decoration: none; font-size: 14px; min-height: 44px; margin: 0 0 6px; }
.master-cabinet .text-link, .client-cabinet .text-link { color: var(--accent); }
.text-link:hover { text-decoration: underline; }
.booking-channel-link { display: flex; align-items: center; justify-content: center; min-height: 44px; margin-top: 12px; padding: 9px 12px; border: 1px solid #ffffff26; border-radius: 10px; color: var(--text); background: var(--card2); font-size: 14px; font-weight: 600; line-height: 1.3; text-align: center; text-decoration: none; }
.booking-channel-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.day-checks { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 10px; margin: 10px 0; }
.day-checks label { display: flex; align-items: center; gap: 9px; color: var(--text); min-height: 44px; cursor: pointer; }
.day-checks input { width: 22px; height: 22px; margin: 0; flex: 0 0 22px; }

.list-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 12px 0;
  border-bottom: 1px solid #ffffff0d;
}
.list-item:last-child { border-bottom: none; }
.list-item .title { font-size: 15px; font-weight: 600; }
.list-item .sub { font-size: 13px; color: var(--muted); }

.chip {
  display: inline-block; padding: 4px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 600; background: #ffffff14;
}
.chip.accent { background: #4f8cff33; color: #8ab4ff; }
.chip.green { background: #34c75933; color: #7be29b; }
.chip.red { background: #ff5b5b33; color: #ff9a9a; }
.chip.gray { color: var(--muted); }
.booking-number { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.booking-focused { border-color: var(--accent); box-shadow: 0 0 0 2px #b8f36e26; }
.client-cabinet .client-selection-card { border-color: #c7f5894a; background: linear-gradient(135deg, var(--card), #20312b); }
.client-selection-eyebrow { color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: .09em; }
.client-selection-title { margin-top: 10px; font-size: 18px; font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; }
.client-selection-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 13px; }
.client-selection-duration, .client-selection-price { padding: 6px 10px; border-radius: 999px; font-size: 13px; line-height: 1.2; }
.client-selection-duration { border: 1px solid #e4f5e82b; color: var(--text); background: var(--card2); }
.client-selection-price { color: #152118; background: var(--accent); }
.client-selection-note { margin-top: 14px; }
.client-selection-change { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 48px; margin-top: 15px; padding: 10px 0 0; border: 0; border-top: 1px solid #e4f5e82b; border-radius: 0; color: var(--accent); background: transparent; text-align: left; font-weight: 600; }
.client-selection-change:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.days-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.day-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px; }
.day-btn .dow { font-size: 11px; color: var(--muted); }
.day-btn .dnum { font-size: 18px; font-weight: 700; }
.day-btn:disabled { opacity: .3; }
.client-booking-picker { padding: 18px; }
.client-date-picker { margin: 0 0 12px; }
.client-date-picker h2 { margin-bottom: 12px; font-size: 18px; }
.client-date-head { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; gap: 5px; margin-bottom: 8px; }
.client-date-head strong { text-align: center; font-size: 15px; }
.client-date-arrow { width: 44px; min-height: 44px; padding: 0; border: 0; color: var(--accent); background: var(--card); font-size: 26px; }
.client-date-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.client-date-day { display: grid; justify-items: center; align-content: center; min-width: 0; min-height: 56px; padding: 4px 0; border: 0; border-radius: 10px; background: var(--card2); font-size: 11px; }
.client-date-day strong { margin-top: 3px; font-size: 15px; }
.client-date-day.weekend:not(:disabled):not(.selected), .client-calendar-day.weekend:not(:disabled):not(.selected), .client-calendar-weekday.weekend { color: #ff9da1; }
.client-date-day:disabled, .client-calendar-day:disabled { color: #74847c; background: #18242a; opacity: 1; }
.client-date-day.selected, .client-calendar-day.selected { color: #152118; background: var(--accent); font-weight: 700; }
.client-date-day.waitlist-day:not(.selected), .client-calendar-day.waitlist-day:not(.selected) { color: var(--muted); background: #26343a; border: 1px solid #e4f5e840; }
.client-date-day.waitlist-day.selected, .client-calendar-day.waitlist-day.selected { color: var(--text); background: #34444a; outline: 2px solid var(--accent); }
.client-calendar-toggle { display: block; width: 100%; min-height: 54px; margin-top: 11px; padding: 10px 14px; border: 1px solid #e4f5e82b; border-radius: 11px; color: var(--accent); background: var(--card2); text-align: left; }
.client-calendar-panel { margin-top: 12px; padding: 13px; border: 1px solid #e4f5e82b; border-radius: 16px; background: var(--card); }
.client-calendar-panel[hidden] { display: none; }
.client-calendar-head { display: grid; grid-template-columns: 48px minmax(0, 1fr) 48px; align-items: center; gap: 4px; margin-bottom: 8px; }
.client-calendar-head strong { text-align: center; text-transform: capitalize; font-size: 16px; }
.client-calendar-head button { width: 48px; min-height: 48px; padding: 0; border: 1px solid #e4f5e82b; border-radius: 11px; background: var(--card2); font-size: 26px; }
.client-calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.client-calendar-weekday { display: grid; place-items: center; min-height: 35px; color: var(--muted); font-size: 12px; }
.client-calendar-day { min-width: 0; min-height: 48px; padding: 0; border: 0; border-radius: 10px; background: var(--card2); font-size: 14px; }
.client-timezone { margin: 10px 2px; font-size: 12px; line-height: 1.4; }
.client-time-placeholder { margin: 20px 2px 8px; line-height: 1.4; }
.client-time-title { margin: 22px 2px 2px; font-size: 18px; line-height: 1.3; }
.client-time-hint { margin: 10px 2px 0; line-height: 1.4; }
.client-time-group { margin: 20px 0; }
.client-time-group h2 { margin: 0 0 10px; font-size: 18px; }
.client-time-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.client-time-grid .slot-btn { min-width: 0; min-height: 52px; border-radius: 15px; background: var(--bg); }
.client-time-grid .slot-btn.selected { color:#152118; background:var(--accent); }
.client-slot-summary { margin-top:20px; padding:17px; border:1px solid #c7f5894a; border-radius:14px; background:var(--card2); }
.client-slot-summary h2 { margin-bottom:10px; font-size:18px; }
.client-slot-summary p { margin:0 0 8px; line-height:1.45; overflow-wrap:anywhere; }
.client-slot-summary button { margin-top:13px; }
.client-time-grid .waitlist-slot { display: grid; align-content: center; justify-items: center; gap: 2px; color: var(--muted); background: #26343a; border-color: #e4f5e840; }
.client-time-grid .waitlist-slot strong { font-size: 15px; font-weight: 600; }
.client-time-grid .waitlist-slot small { font-size: 10px; font-weight: 400; line-height: 1.1; }
.client-waitlist-dialog h2 { font-size: 20px; margin-bottom: 10px; }
.client-waitlist-dialog .client-waitlist-when { color: var(--accent); font-size: 17px; font-weight: 700; margin-bottom: 12px; }
.client-waitlist-dialog > .muted { margin-bottom: 16px; line-height: 1.45; }
.client-waitlist-dialog .field { margin-bottom: 12px; }
.client-waitlist-dialog button.block { margin-top: 10px; }
.client-waitlist-note { margin-top: 10px; }
.client-confirm-details { margin: 4px 0 16px; padding: 2px 12px; border: 1px solid #e4f5e825; border-radius: 12px; background: var(--card2); }
.client-confirm-row { display: grid; grid-template-columns: minmax(90px, 35%) minmax(0, 1fr); align-items: start; gap: 10px; padding: 10px 0; border-bottom: 1px solid #ffffff18; font-size: 14px; line-height: 1.4; }
.client-confirm-row:last-child { border-bottom: 0; }
.client-confirm-row dt { color: var(--muted); }
.client-confirm-row dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.client-confirm-actions { display: grid; gap: 10px; margin-top: 14px; }
.client-confirm-actions button { width: 100%; min-height: 50px; margin: 0; }
.client-change-services { border-color: #e4f5e82b; background: var(--card2); }

.slots-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.slot-btn { padding: 12px 4px; font-size: 15px; font-weight: 600; }
.slot-btn.selected { background: var(--accent); border-color: transparent; }

.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--card2); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; color: var(--accent); overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 14px; padding: 2px; scroll-padding-inline: 8px; }
.tabs button { flex: 0 0 auto; border-radius: 20px; }

.alert { padding: 10px 12px; border-radius: 10px; font-size: 14px; margin-bottom: 10px; }
.alert.err { background: #ff5b5b22; color: #ff9a9a; }
.alert.ok { background: #34c75922; color: #7be29b; }

.empty { text-align: center; color: var(--muted); padding: 30px 10px; font-size: 14px; }
.spinner { text-align: center; padding: 30px; color: var(--muted); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
.service-picker { display: grid; gap: 10px; margin-top: 14px; }
.service-option { min-width: 0; border: 1px solid #e4f5e82b; border-radius: 12px; background: var(--card2); }
.service-option:has(input:checked) { border-color: var(--accent); background: #c7f58912; }
.service-choice { display: flex; align-items: center; gap: 12px; min-height: 62px; margin: 0; padding: 12px; cursor: pointer; }
.service-choice input[type="checkbox"] { width: 22px; height: 22px; flex: 0 0 22px; margin: 0; accent-color: var(--accent); }
.service-choice > span { min-width: 0; overflow-wrap: anywhere; }
.service-choice .sub { display: block; margin-top: 4px; }
.selection-total { margin-top: 14px; font-weight: 600; }
.client-booking-actions, .master-booking-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.client-booking-actions button, .master-booking-actions button { width: 100%; min-width: 0; min-height: 44px; padding-inline: 6px; }
.client-booking-actions button:first-child { grid-column: 1 / -1; }
.section-title { font-size: 15px; margin: 20px 0 8px; }
.check-row { display: flex; align-items: flex-start; gap: 8px; color: var(--text); line-height: 1.4; margin: 10px 0; }
.check-row input { width: 22px; height: 22px; flex: 0 0 22px; margin: 0; }
.review-item { padding: 12px 0; border-bottom: 1px solid #ffffff0d; }
.review-item:last-child { border-bottom: 0; }
.review-item p { margin-top: 6px; overflow-wrap: anywhere; }
.review-form { margin-top: 14px; padding-top: 14px; border-top: 1px solid #ffffff12; }
.calendar-modes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 0 0 12px; }
.timeline-day { margin: 18px 0; }
.timeline-day > h2 { position: sticky; top: calc(69px + var(--safe-top)); z-index: 3; background: var(--bg); padding: 10px 2px; font-size: 15px; }
.timeline-empty { padding: 8px 2px 16px; }
.timeline-booking { padding: 0; overflow: hidden; }
.master-booking-summary { position: relative; display: grid; grid-template-columns: 60px minmax(0, 1fr); align-items: start; gap: 12px; min-height: 112px; padding: 16px; list-style: none; cursor: pointer; }
.master-booking-summary::-webkit-details-marker { display: none; }
.master-booking-stamp { display: grid; gap: 3px; color: var(--accent); font-size: 15px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.master-booking-copy { display: grid; min-width: 0; gap: 5px; }
.master-booking-copy > strong { padding-right: 46px; font-size: 15px; line-height: 1.3; overflow-wrap: anywhere; }
.master-booking-copy .booking-number { position: absolute; top: 16px; right: 16px; margin: 0; text-align: right; }
.master-booking-service { color: var(--muted); font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.master-booking-state { display: flex; align-items: center; gap: 6px; color: var(--accent); font-size: 12px; line-height: 1.35; }
.master-booking-state.awaiting { color: var(--master-warning); }
.master-booking-state.cancelled, .master-booking-state.no_show { color: var(--danger); }
.master-booking-summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 17px; }
.master-booking-detail { padding: 0 13px 14px; border-top: 1px solid #ffffff18; }
.master-booking-detail .muted { margin: 9px 0; }
.booking-filter-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.booking-filter-heading h2 { font-size: 17px; line-height: 1.3; }
.booking-filter-heading button { flex: none; }
.master-bookings-create { min-height: 48px; margin: 12px 0 17px; }
.waitlist-entry strong { font-size: 14px; }
.waitlist-entry .muted { margin: 6px 0; }
.setup-card { position: relative; padding: 13px 15px; background: linear-gradient(135deg, var(--card), #243329); }
.setup-card details { margin: 0; }
.setup-summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: 34px 30px; align-items: center; gap: 0 8px; padding: 0 44px 0 0; line-height: 1.3; list-style: none; }
.setup-summary::-webkit-details-marker { display: none; }
.setup-summary strong { font-size: 15px; font-weight: 650; }
.setup-progress { color: var(--muted); font-size: 13px; white-space: nowrap; }
.setup-expand { grid-column: 1 / -1; color: var(--accent); font-size: 12px; font-weight: 600; }
.setup-dismiss { position: absolute; top: 7px; right: 12px; width: 44px; min-width: 44px; padding: 0; font-size: 24px; background: transparent; border: 0; color: var(--muted); }
.setup-card button.setup-next { display: block; min-height: 44px; margin-top: 0; padding: 7px 0; border: 0; color: var(--accent); background: transparent; text-align: left; font-size: 14px; font-weight: 600; }
.setup-dismiss-dialog h2 { margin-bottom: 10px; }
.setup-dismiss-dialog p { margin-bottom: 18px; line-height: 1.5; }
.import-status { white-space: pre-wrap; overflow-wrap: anywhere; padding: 8px 0; line-height: 1.4; }
.ok-text { color: var(--accent2); }
.err-text { color: var(--danger); }
.address-block, .address-editor { margin-top: 18px; overflow-wrap: anywhere; }
.address-result { white-space: normal; text-align: left; }
.support-footer { text-align: center; padding: 20px calc(16px + var(--safe-right)) calc(32px + var(--safe-bottom)) calc(16px + var(--safe-left)); }
.support-dialog { color: var(--text); background: var(--bg); border: 1px solid #ffffff30; border-radius: 16px; width: min(540px, calc(100% - 24px - var(--safe-left) - var(--safe-right))); max-height: calc(88dvh - var(--safe-top) - var(--safe-bottom)); margin: auto; padding: 20px; overflow-y: auto; }
.support-dialog::backdrop { background: #000b; }
.preserve-lines { white-space: pre-wrap; overflow-wrap: anywhere; }
details { margin: 16px 0; }
summary { cursor: pointer; padding: 10px 0; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid #ffffff0d; }
th { color: var(--muted); font-weight: 600; }

.qr-box { text-align: center; padding: 8px 0; }
.qr-box img { width: 180px; height: 180px; border-radius: 10px; background: #fff; padding: 8px; }

.master-date-picker { margin-bottom: 12px; }
.master-week-head { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; gap: 5px; margin-bottom: 8px; }
.master-week-head strong { text-align: center; font-size: 15px; }
.master-date-arrow { width: 44px; min-height: 44px; padding: 0; border: 0; color: var(--accent); background: var(--card); font-size: 26px; }
.master-week-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.master-week-day { position: relative; display: grid; justify-items: center; align-content: center; min-width: 0; min-height: 54px; padding: 4px 0 9px; border: 0; border-radius: 10px; background: var(--card); font-size: 11px; }
.master-week-day strong { margin-top: 3px; font-size: 14px; }
.master-week-day.weekend:not(.selected), .master-month-weekday.weekend, .master-month-day.weekend:not(.selected) { color: #ff9da1; }
.master-week-day.selected, .master-month-day.selected { color: #152118; background: var(--accent); font-weight: 700; }
.master-date-dot { display: none; position: absolute; bottom: 4px; left: calc(50% - 3px); width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.has-bookings .master-date-dot { display: block; }
.selected .master-date-dot { background: #152118; }
.master-month-toggle { display: block; width: 100%; min-height: 54px; margin-top: 11px; padding: 10px 14px; border: 1px solid #e4f5e82b; border-radius: 11px; color: var(--accent); background: var(--card2); text-align: left; }
.master-month-panel { margin-top: 12px; padding: 13px; border: 1px solid #e4f5e82b; border-radius: 16px; background: var(--card); }
.master-month-panel[hidden] { display: none; }
.master-month-head { display: grid; grid-template-columns: 48px minmax(0, 1fr) 48px; align-items: center; gap: 4px; margin-bottom: 8px; }
.master-month-head strong { text-align: center; text-transform: capitalize; font-size: 16px; }
.master-month-head button { width: 48px; min-height: 48px; padding: 0; border: 1px solid #e4f5e82b; border-radius: 11px; background: var(--card2); font-size: 26px; }
.master-month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.master-month-weekday { display: grid; place-items: center; min-height: 35px; color: var(--muted); font-size: 12px; }
.master-month-day { position: relative; min-width: 0; min-height: 48px; padding: 0 0 5px; border: 0; border-radius: 10px; background: var(--card2); font-size: 14px; font-variant-numeric: tabular-nums; }
.master-date-status:not(:empty) { grid-column: 1 / -1; margin: 8px 2px 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.master-date-status:empty { display: none; }

/* Invitations: readable programme copy without promoting it over booking. */
.referral-intro p { margin: 12px 0; }
.referral-intro ul { padding-left: 20px; margin: 12px 0; }
.referral-intro li { margin: 8px 0; }
.success-popup { text-align: center; }
.success-popup p { font-size: 16px; margin: 6px 0 18px; }
.onboarding-notice { margin: 12px 0 20px; }

.schedule-presets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.schedule-presets button { width: 100%; }
.schedule-current .schedule-day-row { align-items: center; }
.schedule-day-controls { display: grid; grid-template-columns: minmax(76px, 1fr) minmax(76px, 1fr) minmax(86px, auto); gap: 8px; min-width: 0; }
.schedule-day-controls input { width: 100%; min-width: 0; margin: 0; padding-inline: 7px; }
.schedule-day-controls button { white-space: nowrap; }
.break-form { margin-top: 14px; padding-top: 14px; border-top: 1px solid #ffffff12; }
.break-form h3 { font-size: 15px; margin-bottom: 6px; }
.break-form > .muted { margin-bottom: 12px; }
.break-time-range { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.break-time-range .field { min-width: 0; margin-bottom: 0; }

/* Master statistics and shared booking summaries. */
.master-booking-mini { position: relative; display: grid; grid-template-columns: 60px minmax(0, 1fr); align-items: start; gap: 12px; width: 100%; min-height: 112px; margin-top: 9px; padding: 16px; border: 1px solid var(--master-line); border-radius: 17px; background: var(--card); text-align: left; }
.master-booking-mini .master-booking-copy .booking-number { top: 16px; right: 16px; }
.dashboard-stats-insight { background: var(--card2); border-color: transparent !important; }
.dashboard-insight-kicker { margin-bottom: 9px; color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.dashboard-stats-insight > strong { display: block; max-width: 290px; font-size: 16px; line-height: 1.4; }
.dashboard-stats-insight > p { margin-top: 7px; color: var(--muted); font-size: 13px; line-height: 1.4; }
.dashboard-stats-insight .block { min-height: 44px; margin-top: 15px; }
.stats-intro { margin: -7px 0 12px; font-size: 13px; line-height: 1.4; }
.stats-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.stats-custom { width: 100%; margin: 0; }
.stats-custom summary { min-height: 44px; padding: 10px 0; color: var(--accent); font-size: 13px; }
.stats-custom-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding-top: 8px; }
.stats-custom-fields .field { min-width: 0; margin: 0; }
.stats-custom-fields .field input { min-width: 0; }
.stats-custom-fields > button { grid-column: 1 / -1; }
.stats-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; align-items: stretch; }
.master-cabinet .stats-metric { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; width: 100%; height: 100%; min-height: 120px; margin: 0; padding: 14px; background: var(--card); text-align: left; }
.stats-metric > span:first-child { font-size: 12px; line-height: 1.3; }
.stats-metric-value { font-size: 26px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stats-metric-note { margin-top: auto; color: var(--accent); font-size: 11px; line-height: 1.3; }
.stats-section-title { margin: 23px 2px 10px; font-size: 17px; line-height: 1.3; }
.stats-section { padding-block: 5px; }
.stats-line { display: grid; grid-template-columns: minmax(0, 1fr) auto 12px; align-items: center; gap: 8px; width: 100%; min-height: 49px; padding: 9px 0; border: 0; border-bottom: 1px solid var(--master-separator); border-radius: 0; background: transparent; color: var(--text); text-align: left; font-size: 13px; line-height: 1.35; }
.stats-line:last-child { border-bottom: 0; }
.stats-line > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.stats-line strong { text-align: right; font-variant-numeric: tabular-nums; }
.stats-arrow { color: var(--accent); font-size: 18px; }
.stats-due > strong { font-size: 21px; }
.stats-due > p { margin-top: 6px; }
.stats-due .block { margin-top: 14px; }
.stats-footnote { margin: 10px 2px 20px; font-size: 12px; line-height: 1.45; }
.stats-back { margin: 0 0 12px; border: 0; background: transparent; color: var(--accent); padding-left: 0; }
.stats-detail-title { margin: 0 0 5px; font-size: 21px; line-height: 1.3; overflow-wrap: anywhere; }
.stats-detail-period { margin-bottom: 15px; font-size: 13px; }
.master-cabinet .stats-detail-client, .master-cabinet .stats-detail-day { position: relative; display: grid; gap: 5px; width: 100%; min-height: 68px; padding-right: 32px; text-align: left; }
.stats-detail-client > strong, .stats-detail-day > strong { font-size: 14px; line-height: 1.3; }
.stats-detail-client > .muted, .stats-detail-day > .muted { font-size: 12px; line-height: 1.35; }
.stats-detail-client .stats-arrow, .stats-detail-day .stats-arrow { position: absolute; right: 12px; top: calc(50% - 13px); }

@media (max-width: 360px) {
  main { padding-inline: calc(10px + var(--safe-left)) calc(10px + var(--safe-right)); }
  .card { padding: 14px; }
  .schedule-current .schedule-day-row { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 6px; }
  .schedule-day-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .schedule-day-controls button { grid-column: 1 / -1; width: 100%; }
  .stats-metric-value { font-size: 23px; }
}
