:root {
  --ink: #382732;
  --muted: #715b66;
  --line: #e6d6dd;
  --berry: #973d65;
  --paper: #fffbfc;
  --blush: #f8e6ed;
  --soft: #fcf2f5;
  --control-line: #a27e8e;
  color: var(--ink);
  background: var(--paper);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 15px;
}
* { box-sizing: border-box }
body { margin: 0 }
button, select, input { font: inherit; color: inherit }
button { cursor: pointer }
button:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid var(--berry); outline-offset: 2px }
button:disabled { opacity: .55; cursor: default }
h1, h2, h3, p { margin: 0 }
h1, h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 500 }
.crm-page { height: 100vh; height: 100dvh; display: flex; flex-direction: column }
.masthead { min-height: 72px; padding: 3px 32px; border-bottom: 1px solid var(--line); display: flex; flex: none; align-items: center; gap: 21px; background: var(--blush) }
.brand-logo { display: block; flex: none; border-radius: 50% }
.admin-profile { min-width: 0; min-height: 38px; padding: 4px 0; border: 0; background: transparent; color: var(--berry); font-weight: 650; text-align: left; overflow-wrap: anywhere }
.admin-profile:hover { text-decoration: underline }
.mast-date { margin-left: auto; display: flex; align-items: center; gap: 9px; font-size: 14px; color: var(--muted) }
#today-label::first-letter, #dialog-title::first-letter { text-transform: uppercase }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #b66083 }
.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: clamp(255px, 23vw, 335px) minmax(0, 1fr) }
#directory { min-height: 0; display: flex; flex-direction: column; background: var(--soft); border-right: 1px solid var(--line) }
.directory-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 20px 20px 0 25px; padding: 4px; border-radius: 10px; background: var(--blush) }
.directory-tabs button { min-height: 36px; padding: 4px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 600 }
.directory-tabs button[aria-selected="true"] { border-color: var(--line); background: var(--paper); color: var(--berry) }
.directory-panel { display: flex; flex: 1; min-height: 0; flex-direction: column }
.directory-panel[hidden] { display: none }
.directory-head { display: flex; align-items: center; gap: 8px; padding: 12px 20px 12px 25px }
.directory-head .search-field { flex: 1; min-width: 0 }
.schedule-head, .calendar-toolbar, .month-switch, .day-head, .calendar-foot, #legend, .dialog-head { display: flex; align-items: center }
.count { font-size: 12px; color: #743d54; background: #f3d8e3; padding: 3px 8px; border-radius: 30px; font-variant-numeric: tabular-nums }
.search-field { border: 1px solid var(--control-line); border-radius: 8px; display: flex; align-items: center; gap: 11px; padding: 0 12px; background: var(--paper) }
.search-field i { width: 13px; height: 13px; border: 1.5px solid var(--muted); border-radius: 50%; position: relative; flex: none }
.search-field i::after { content: ''; position: absolute; bottom: -3px; right: -4px; border-top: 1.5px solid var(--muted); transform: rotate(45deg); width: 6px }
.search-field input { min-width: 0; width: 100%; height: 39px; background: transparent; border: 0; font-size: 14px }
.search-field input::placeholder { color: var(--muted); opacity: 1 }
.search-field:focus-within { outline: 2px solid var(--berry) }
.search-field input:focus { outline: 0 }
.directory-body { min-height: 0; flex: 1; position: relative }
.directory-list { height: 100%; overflow-y: auto; padding: 0 37px 16px 25px; scrollbar-width: thin; scrollbar-color: #bd9dad transparent }
.directory-group h3 { color: var(--berry); font: 600 13px "Segoe UI", sans-serif; margin: 13px 0 1px }
.directory-row { display: block; background: none; border: 0; border-bottom: 1px solid var(--line); text-align: left; width: 100%; padding: 9px 3px 11px 0 }
.directory-row:hover { background: var(--blush) }
.directory-row strong { display: block; font-size: 14px; line-height: 1.35; font-weight: 600 }
.directory-row small { color: var(--muted); display: block; margin-top: 3px }
.directory-letters { position: absolute; top: 50%; right: 7px; transform: translateY(-50%); display: flex; flex-direction: column; max-height: 100%; overflow: auto; border-radius: 12px; background: #f5dfe8; scrollbar-width: none }
.letter { background: transparent; border: 0; color: #743d54; min-width: 21px; font-size: 11px; padding: 2px 3px; line-height: 1.35 }
.letter:hover { background: #eacbd8 }
.directory-foot { padding: 14px 22px; border-top: 1px solid var(--line) }
.directory-foot button { width: 100% }
.primary, .secondary, #specialist-filter, .arrow { border-radius: 8px; min-height: 38px; font-weight: 550; font-size: 14px; padding: 8px 14px }
.secondary, #specialist-filter, .arrow { border: 1px solid var(--control-line); background: var(--paper); color: var(--ink) }
.primary { border: 1px solid var(--berry); background: var(--berry); color: white }
.primary:hover { background: #792b4f }
.login-page { min-height: 100dvh; display: flex; flex-direction: column; background: var(--soft) }
.login-page .login-main { flex: 1; height: auto; display: grid; place-items: center; padding: 32px 16px }
.login-card { width: min(100%, 395px); padding: clamp(24px, 5vw, 38px); background: var(--paper); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 12px 36px #71354f0d }
.login-logo { display: block; margin: 0 auto 26px; max-width: 100%; height: auto; border-radius: 50% }
.login-card form, .login-card label { display: grid; gap: 8px }
.login-card form { gap: 18px }
.login-card label { color: var(--ink); font-size: 14px; font-weight: 550 }
.login-card input { width: 100%; min-height: 44px; border: 1px solid var(--control-line); border-radius: 8px; padding: 8px 12px; background: #fff }
.login-card button { min-height: 44px; margin-top: 4px }
#login-error { color: #8d3048; line-height: 1.45; font-size: 14px }
.secondary:hover, .arrow:hover, .add-day:hover { background: var(--blush) }
.primary b, .secondary b { font-size: 17px; font-weight: 400 }
.mobile-clients, .directory-backdrop, .mobile-day-select, .mobile-agenda { display: none }
main { min-width: 0; overflow: auto; padding: 24px clamp(18px, 2.25vw, 42px) 16px }
.schedule-head, .calendar-toolbar, .calendar-foot, .dialog-head { justify-content: space-between; gap: 12px }
h1 { font-size: clamp(34px, 3.4vw, 52px); line-height: 1.1; letter-spacing: -1.8px }
.schedule-head .primary { padding: 9px 18px }
.calendar-toolbar { margin: 23px 0 16px; flex-wrap: wrap }
.month-switch { gap: 5px }
#month-label { font-size: clamp(21px, 2vw, 29px); letter-spacing: -.6px; margin-right: 10px }
.arrow { font: 23px/1 Georgia, serif; padding: 0 7px; min-height: 31px; min-width: 30px }
.today-button { margin-left: 4px; min-height: 31px; padding: 4px 10px; font-weight: 500 }
#specialist-filter { max-width: 100%; min-height: 33px; padding: 5px 7px; font-weight: 500 }
.calendar { border: 1px solid var(--line); background: var(--line); border-radius: 11px; overflow: hidden }
.weekdays, #days { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 1px }
.weekdays { background: #f6e7ed; border-bottom: 1px solid var(--line); color: var(--muted); font-weight: 600; font-size: 12px }
.weekdays span { padding: 9px 10px }
.day { padding: 6px; min-height: clamp(87px, 11vh, 148px); background: #ffffff; min-width: 0 }
.day:nth-child(7n), .day:nth-child(7n - 1) { background: #fff7fa }
.day.outside { background: #f6eff2 }
.outside .day-number { color: var(--muted) }
.day.current { box-shadow: inset 0 0 0 1.5px var(--berry) }
.day-head { justify-content: space-between; gap: 3px; min-height: 23px }
.day-number { font-size: 13px; font-weight: 600; display: inline-grid; place-items: center; width: 23px; height: 23px }
.current .day-number { color: white; border-radius: 50%; background: var(--berry) }
.add-day { color: var(--muted); background: transparent; border: 0; border-radius: 5px; width: 23px; height: 23px; padding: 0; font-size: 17px }
.tone-0 { --accent: #ad4c75; --fill: #f8dce7; --text: #692d48 }
.tone-1 { --accent: #8162a8; --fill: #eee5f7; --text: #513d68 }
.tone-2 { --accent: #a76147; --fill: #f9e2d6; --text: #703e2c }
.tone-3 { --accent: #526fa4; --fill: #e1eafa; --text: #344c74 }
.tone-4 { --accent: #90702e; --fill: #f5ebcf; --text: #634b1e }
.tone-5 { --accent: #398076; --fill: #dceee9; --text: #2b554e }
.event { margin-top: 3px; width: 100%; border: 0; border-left: 3px solid var(--accent); border-radius: 4px; background: var(--fill); color: var(--text); padding: 4px 5px; text-align: left; line-height: 1.2 }
.event:hover { filter: brightness(.95) }
.event[data-booking] { cursor: grab; touch-action: pan-y; user-select: none }
.event.drag-source { opacity: .4 }
.day.drop-target { background: var(--blush); box-shadow: inset 0 0 0 2px var(--berry) }
.event.drag-preview { position: fixed; top: 0; left: 0; z-index: 10; pointer-events: none; margin: 0; box-shadow: 0 5px 16px #51253936 }
.event span, .event strong, .event small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.event .event-time { font: 11px/1.25 Arial, sans-serif; font-variant-numeric: tabular-nums; white-space: normal; overflow: visible }
.event strong { font-size: 13px; font-weight: 600; margin: 1px 0 }
.event small { font-size: 11px }
.event.just-saved { outline: 2px solid var(--accent); outline-offset: -1px }
.more { border: 0; background: none; color: var(--berry); padding: 4px 2px; font-size: 12px; font-weight: 600 }
.more:hover { text-decoration: underline }
.calendar-foot { padding-top: 13px; color: var(--muted); font-size: 12px; flex-wrap: wrap }
#legend { gap: 14px; flex-wrap: wrap }
button.legend-item { padding: 3px 1px; border: 0; border-radius: 3px; background: transparent; color: var(--muted); text-decoration: underline; text-decoration-color: var(--control-line); text-underline-offset: 3px }
button.legend-item:hover { color: var(--ink); text-decoration-color: currentColor }
.legend-item::before { content: ''; width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 5px; background: var(--accent) }
.empty { padding: 12px 0; color: var(--muted); line-height: 1.5 }
dialog { width: min(530px, calc(100% - 22px)); max-height: 90dvh; padding: 0; border: 1px solid var(--line); border-radius: 15px; color: var(--ink); background: var(--paper); box-shadow: 0 24px 90px #47213838 }
dialog::backdrop { background: #37232e66 }
.dialog-head { padding: 20px 23px 15px; border-bottom: 1px solid var(--line) }
.dialog-head h2 { font-size: 25px; line-height: 1.2 }
.close { border: 0; border-radius: 50%; background: var(--blush); font-size: 22px; width: 30px; height: 30px; line-height: 1; flex: none }
#dialog-body { padding: 19px 23px 22px }
.day-list { display: grid; gap: 6px }
.day-list .event { padding: 8px 12px }
.day-list .secondary { margin-top: 9px }
#load-error { padding: 16px; background: #f9e4e0 }
@media (max-width: 1024px) {
  .masthead { padding: 3px 16px; min-height: 57px; gap: 14px }
  .brand-logo { width: 49px; height: 49px }
  .mobile-clients { display: block; margin-left: auto }
  .mast-date { margin-left: 0; font-size: 12px }
  .workspace { position: relative; display: block }
  #directory { display: none; position: absolute; inset: 0 auto 0 0; width: min(375px, 88vw); z-index: 2; box-shadow: 12px 12px 40px #47213826 }
  #directory.open { display: flex }
  #directory.open + .directory-backdrop { display: block; position: absolute; inset: 0; z-index: 1; width: 100%; border: 0; background: #37232e55 }
  .workspace > main { height: 100%; padding: 18px clamp(12px, 3vw, 30px) }
  .calendar-toolbar { margin-top: 17px }
}
@media (max-width: 640px) {
  .masthead { gap: 8px; padding: 5px 10px }
  .brand-logo { width: 40px; height: 40px }
  .admin-profile { font-size: 13px; line-height: 1.25 }
  .masthead .secondary { padding-inline: 8px }
  .mast-date { display: none }
  .schedule-head h1 { font-size: clamp(28px, 8vw, 37px) }
  .schedule-head .primary { padding-inline: 9px; flex: none }
  .calendar-toolbar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px }
  .month-switch { flex-wrap: wrap }
  #month-label { flex: 1; min-width: 134px; margin-right: 0 }
  .weekdays span { padding: 6px 0; text-align: center }
  .day { min-height: 0; padding: 0 }
  .day.current { box-shadow: none }
  .day > :not(.mobile-day-select) { display: none }
  .mobile-day-select { display: grid; place-content: center; justify-items: center; min-height: 48px; width: 100%; border: 0; padding: 2px; background: transparent; color: var(--ink); font-weight: 600; line-height: 1.15 }
  .mobile-day-count { min-height: 12px; color: var(--berry); font-size: 11px; font-weight: 700 }
  .mobile-day-select[aria-current="date"] { box-shadow: inset 0 0 0 1px var(--berry) }
  .mobile-day-select[aria-pressed="true"] { background: var(--berry); color: #fff }
  .mobile-day-select[aria-pressed="true"] .mobile-day-count { color: inherit }
  .outside .mobile-day-select[aria-pressed="false"] { color: var(--muted) }
  .mobile-agenda { display: grid; gap: 8px; margin-top: 16px }
  .agenda-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px }
  .agenda-head h2 { font-size: 22px }
  .agenda-head h2::first-letter { text-transform: uppercase }
  .mobile-agenda .event { min-height: 48px }
  .mobile-agenda .event strong, .mobile-agenda .event small { white-space: normal; overflow-wrap: anywhere }
  .mobile-agenda .event-time, .mobile-agenda .event small { font-size: 13px }
  .login-page .login-main { padding: 16px }
  .login-logo { max-width: min(100%, 48vw); margin-bottom: 18px }
  .login-card input, .search-field input { font-size: 16px }
  dialog { width: calc(100% - 16px); max-height: calc(100dvh - 16px) }
  .dialog-head { position: sticky; top: 0; z-index: 1; background: var(--paper); padding: 10px 14px }
  #dialog-body { padding: 14px }
}
@media (pointer: coarse), (max-width: 640px) {
  .primary, .secondary, #specialist-filter, .arrow, .close, .directory-tabs button, .directory-row, .admin-profile, .more, .legend-item {
    min-height: 44px;
  }
  .arrow, .close { min-width: 44px }
  .directory-letters { display: none }
  .directory-list { padding-right: 20px }
  .login-card input, .search-field input { font-size: 16px }
}
