:root { font-family: 'PT Sans', Arial, sans-serif; color: #363b44; background: #fff; font-synthesis: none; --cal-blue: #4c8bf7; --cal-blue-border: #4077d6; --cal-border: #e5e7e9; --cal-muted: #92989f; }
* { box-sizing: border-box; }
body { margin: 0; min-width: 760px; }
.kzm-lead-mode body { min-width: 320px; height: 100dvh; overflow: hidden; }
.kzm-lead-mode .cal-app { display: block; height: 100dvh; min-height: 0; overflow: hidden; }
.cal-lead-mode .cal-rail { display: none; }
.cal-lead-mode .cal-main { min-height: 0; height: 100%; overflow: hidden; }
.cal-lead-mode :is(.cal-toolbar, .cal-lead-tools, .cal-datebar, .cal-notice) { flex-shrink: 0; }
.cal-lead-mode .cal-toolbar { min-height: 48px; padding: 8px 14px; gap: 12px; flex-wrap: wrap; }
.cal-lead-mode .cal-title { font-size: 16px; letter-spacing: 0; }
.cal-lead-mode .cal-toolbar-actions { margin-left: auto; }
.cal-lead-mode .cal-datebar { padding: 0 8px; }
.cal-lead-mode .cal-date-title { font-size: 14px; }
.cal-lead-mode .cal-workspace { display: flex; min-height: min(240px, 40dvh); height: auto; flex: 1 1 auto; border-bottom: 1px solid var(--cal-border); }
.cal-lead-mode .cal-grid-scroll { min-width: 180px; }
.cal-lead-mode .cal-side { position: relative; inset: auto; transform: none; width: min(360px, 48%); flex: 0 0 min(360px, 48%); max-width: none; min-width: 280px; max-height: none; height: 100%; overflow: auto; border-left: 1px solid var(--cal-border); box-shadow: none; z-index: 10; }
.cal-lead-mode.cal-fields-open .cal-workspace { min-height: 0; }
.cal-lead-mode.cal-fields-open :is(.cal-lead-tools, .cal-datebar, .cal-lead-records) { display: none; }
.cal-lead-mode .cal-lead-records { flex: 0 1 auto; max-height: 36dvh; overflow: auto; }
.cal-lead-mode .cal-workspace:has(.cal-fields-content) .cal-side { width: 100%; flex-basis: 100%; }
.cal-lead-mode .cal-workspace:has(.cal-fields-content) .cal-grid-scroll { display: none; }
.cal-lead-mode .cal-panel-header { padding: 10px 14px; min-height: 44px; }
.cal-lead-mode .cal-panel-header h2 { font-size: 16px; }
.cal-lead-mode .cal-form-body, .cal-lead-mode .cal-detail-content { padding: 12px 14px; }
.cal-lead-mode .cal-form-footer { position: sticky; bottom: 0; background: #fff; padding: 10px 14px; }
.cal-lead-mode .cal-form-summary { display: none; }
.cal-lead-mode .cal-notice { position: relative; top: auto; left: auto; transform: none; max-width: none; margin: 0; border-radius: 0; box-shadow: none; }
.cal-lead-tools { display: flex; align-items: center; min-height: 52px; padding: 8px 14px; border-bottom: 1px solid var(--cal-border); }
.cal-lead-tools .cal-search-wrap { width: 100%; max-width: none; min-width: 0; }
.cal-lead-tools .cal-search-box { min-height: 36px; }
.cal-lead-tools .cal-field { display: grid; grid-template-columns: 88px minmax(180px, 340px); align-items: center; gap: 8px; margin: 0; }
.cal-lead-tools .cal-multi { min-width: 0; }
.cal-lead-tools .cal-multi-dropdown { z-index: 50; }
.cal-lead-records { padding: 12px 16px 18px; background: #fff; }
.cal-lead-records-header { display: flex; align-items: center; justify-content: space-between; }
.cal-lead-records h2 { margin: 0; font-size: 16px; }
.cal-lead-records h3 { margin: 10px 0 6px; font-size: 13px; color: #92989f; font-weight: 400; }
.cal-lead-records p { margin: 6px 0; }
.cal-lead-record-list { display: flex; flex-direction: column; }
.cal-lead-record { display: grid; grid-template-columns: 68px minmax(150px, 1fr) minmax(90px, 1fr) auto; gap: 8px; padding: 10px 0; text-align: left; border: 0; border-bottom: 1px solid #edf0f3; border-radius: 0; white-space: normal; }
.cal-lead-record.is-new { background: #f4f7fc; }
.cal-lead-record-address, .cal-record-sync { grid-column: 2 / -1; color: #7d8792; font-size: 13px; overflow-wrap: anywhere; }
.cal-record-sync { font-size: 12px; }
.cal-lead-record .cal-status-badge { font-size: 12px; }
.cal-cancel-form, .cal-fields-content { padding: 14px 18px; }
.cal-cancel-form .cal-form-actions { margin-top: 16px; }
.cal-event-audit { margin: 16px 0; border-top: 1px solid var(--cal-border); padding-top: 12px; }
.cal-event-audit summary { cursor: pointer; color: #427dc9; }
.cal-audit-row { display: flex; flex-direction: column; gap: 3px; font-size: 13px; padding: 10px 0; border-bottom: 1px solid #edf0f3; }
.cal-sync-status { display: flex; flex-direction: column; gap: 3px; margin: 12px 0 0; color: #7d8792; font-size: 13px; }
/* Keep the header gutter outside the scrolling fields, including opened lists. */
.cal-side:has(> .cal-fields-content) { overflow: hidden; }
.cal-side:has(> .cal-fields-content) > .cal-panel-header { margin-bottom: 14px; }
.cal-fields-content { display: flex; flex-direction: column; gap: 14px; flex: 1 1 auto; min-height: 0; padding-top: 0; overflow: auto; overscroll-behavior: contain; }
.cal-fields-presets { display: flex; flex-wrap: wrap; gap: 8px; }
.cal-fields-content h3, .cal-fields-intro { margin: 0; }
.cal-fields-group { display: flex; flex-direction: column; gap: 12px; padding-top: 12px; border-top: 1px solid var(--cal-border); }
.cal-fields-control { display: flex; flex-direction: column; gap: 5px; }
.cal-fields-enum-row { display: grid; grid-template-columns: minmax(100px, 1fr) minmax(120px, 1fr); gap: 8px; align-items: center; margin-top: 6px; }
.cal-fields-preview { border-collapse: collapse; width: 100%; font-size: 13px; }
.cal-fields-preview td, .cal-fields-preview th { text-align: left; border-bottom: 1px solid var(--cal-border); padding: 8px 5px; vertical-align: top; overflow-wrap: anywhere; }
.cal-fields-content + .cal-error-text { margin: 0 18px 18px; }
/* Field mapping follows the amoCRM Storybook Select styling, independently of native OS menus. */
.cal-single { position: relative; min-width: 0; }
.cal-single.is-open { z-index: 30; }
.cal-single-trigger { display: flex; align-items: center; position: relative; width: 100%; height: 36px; min-width: 0; padding: 1px 25px 1px 9px; border: 1px solid #d4d5d8; border-bottom-width: 2px; border-radius: 3px; background: linear-gradient(#fcfcfc, #f8f8f9); color: #2e3640; font: 15px/17.25px 'PT Sans', Arial, sans-serif; text-align: left; }
.cal-single-trigger::after { content: ''; position: absolute; top: calc(50% - 5px); right: 12px; width: 6px; height: 6px; border-right: 1px solid #000; border-bottom: 1px solid #000; transform: rotate(45deg); }
.cal-single-trigger:focus-visible, .cal-single-trigger[aria-expanded="true"] { border-color: #c1c1c1; }
button.cal-single-trigger:focus-visible, button.cal-single-option:focus-visible { outline: 1px solid #707378; outline-offset: -2px; }
.cal-single-trigger:disabled { background: transparent; border-color: #dfdfdf; border-bottom-width: 1px; color: #b3b6bd; }
.cal-single-trigger:disabled::after { border-color: #b3b6bd; }
.cal-single-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-single > select:has(option:checked:not([value=""])) + .cal-single-trigger:not(:disabled) .cal-single-value { color: var(--trade-selected); }
.cal-single-dropdown { position: absolute; left: 0; right: 0; z-index: 30; border: 1px solid #d4d5d8; border-radius: 3px; background: #fff; overflow: hidden; color: #2e3640; font: 15px/20px 'PT Sans', Arial, sans-serif; }
.cal-single-search-wrap { display: flex; align-items: center; height: 36px; gap: 8px; padding: 0 9px; border-bottom: 1px solid #dbdedf; }
.cal-single-search-wrap img { width: 18px; height: 18px; opacity: .4; }
.cal-single-search { appearance: none; width: 100%; min-width: 0; height: 34px; padding: 0; border: 0; background: #fff; color: #313942; font: 15px/20px 'PT Sans', Arial, sans-serif; outline: 0; }
.cal-single-search::placeholder { color: #92989f; opacity: 1; }
.cal-single-search::-webkit-search-cancel-button { appearance: none; }
.cal-single-options { max-height: 211px; overflow: auto; overscroll-behavior: contain; }
.cal-single-option { display: flex; align-items: center; position: relative; width: 100%; min-height: 35px; padding: 8px 6px 7px 22px; border: 0; border-radius: 0; background: #fff; color: #2e3640; font: 15px/20px 'PT Sans', Arial, sans-serif; text-align: left; cursor: pointer; }
.cal-single-option > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-single-option:hover, .cal-single-option:focus, .cal-single-option.is-active { background: #f5f5f5; }
.cal-single-option[aria-selected="true"] { color: var(--trade-selected); }
.cal-single-check { position: absolute; left: 7px; top: 12px; width: 10px; height: 10px; }
.cal-single-option[aria-selected="false"] .cal-single-check { visibility: hidden; }
.cal-single-option:disabled { color: #b3b6bd; cursor: default; background: #fff; }
.cal-single-empty { padding: 8px 9px; color: #92989f; }
@media (max-width: 620px) {
  .cal-lead-mode .cal-toolbar { gap: 6px; }
  .cal-lead-mode .cal-toolbar-actions { gap: 4px; }
  .cal-lead-mode .cal-toolbar-actions .cal-button { padding: 0 8px; }
  .cal-lead-mode .cal-toolbar-actions .cal-button .cal-icon { display: none; }
  .cal-lead-mode .cal-workspace.has-panel { flex-direction: column; height: auto; }
  .cal-lead-mode .cal-workspace.has-panel .cal-grid-scroll { height: 230px; flex: none; }
  .cal-lead-mode .cal-workspace.has-panel .cal-side { width: 100%; flex-basis: auto; min-width: 0; height: auto; max-height: 460px; border-left: 0; border-top: 1px solid var(--cal-border); }
  .cal-lead-mode.cal-fields-open .cal-workspace .cal-side { flex: 1 1 auto; height: 100%; max-height: none; }
  .cal-lead-mode .cal-date-title { max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cal-lead-record { grid-template-columns: 65px 1fr; }
  .cal-lead-record > :nth-child(3) { grid-column: 2; }
  .cal-lead-record > :nth-child(4) { grid-column: 2; justify-self: start; }
}
/* The same lead iframe gains the modal viewport; its draft and DOM stay mounted. */
.kzm-lead-expanded body { height: 100dvh; overflow: hidden; }
.kzm-lead-expanded .cal-lead-mode { height: 100dvh; min-height: 0; overflow: hidden; }
.kzm-lead-expanded .cal-lead-mode .cal-main { height: 100%; min-height: 0; overflow: hidden; }
.kzm-lead-expanded .cal-lead-mode :is(.cal-toolbar, .cal-lead-tools, .cal-datebar, .cal-notice) { flex-shrink: 0; }
.kzm-lead-expanded .cal-lead-mode .cal-workspace,
.kzm-lead-expanded .cal-lead-mode .cal-workspace:has(.cal-fields-content) { flex: 1 1 auto; height: auto; min-height: min(280px, 40dvh); }
.kzm-lead-expanded .cal-lead-mode .cal-lead-records { max-height: 36dvh; }
.kzm-lead-expanded .cal-lead-mode.cal-fields-open .cal-workspace { min-height: 0; }
@media (max-width: 620px) {
  .kzm-lead-expanded .cal-lead-mode .cal-workspace.has-panel .cal-grid-scroll { flex: 1 1 180px; height: auto; min-height: 120px; }
  .kzm-lead-expanded .cal-lead-mode .cal-workspace.has-panel .cal-side { flex: 1 1 auto; min-height: 120px; max-height: 50dvh; }
  .kzm-lead-expanded .cal-lead-mode.cal-fields-open .cal-workspace.has-panel .cal-side { min-height: 0; max-height: none; height: 100%; }
}
.kzm-lead-mode .cal-lead-mode .cal-workspace .cal-side.cal-lead-form { position: fixed; inset: 0 0 0 auto; width: min(480px, 100vw); min-width: 0; max-width: none; height: 100dvh; max-height: 100dvh; flex: none; overflow: hidden; border-top: 0; z-index: 102; }
.cal-lead-mode .cal-side.cal-lead-form .cal-appointment-form { flex: 1 1 auto; min-height: 0; overflow: hidden; }
.cal-lead-mode .cal-side.cal-lead-form .cal-form-body { flex: 1 1 auto; min-height: 0; overflow: auto; }
.cal-lead-mode .cal-side.cal-lead-form .cal-form-footer { position: static; flex: 0 0 auto; }
.kzm-embedded .cal-rail { display: none; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }
.cal-app { display: flex; height: 100dvh; min-height: 520px; overflow: hidden; font-size: 14px; line-height: 1.4; }
.cal-icon { display: block; flex: 0 0 20px; width: 20px; height: 20px; }
.cal-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 0 12px; border: 1px solid #d1d8e0; border-radius: 3px; background: #fff; color: #273440; font-size: 14px; font-weight: 400; line-height: 1.2; text-decoration: none; white-space: nowrap; }
.cal-button:where(:not(:disabled)):hover { background: #f5f7fa; border-color: #b7c2ce; }
.cal-app :is(button, input, select, textarea, a, summary, [tabindex]):is(:focus, :focus-visible) { outline: none; outline-offset: 0; box-shadow: none; }
.cal-button:focus-visible, .cal-check-option input:focus-visible  { outline: none; outline-offset: 0; }
.cal-input:focus  {  box-shadow: none; }
.cal-search-box:focus-within  {  box-shadow: none; }
.cal-search-input:focus, .cal-date-input:focus  { outline: none; box-shadow: none; }
.cal-button:disabled { background: #eef1f4; color: #8a95a2; border-color: #dce1e7; }
.cal-primary { height: 36px; border-color: #4077d6; border-radius: 3px; background: #4c8bf7; color: #fff; font-size: 14px; font-weight: 700; box-shadow: 0 1px 0 #00000005; }
.cal-primary:where(:not(:disabled)):hover { background: #4c8bf7; border-color: #3369c8; box-shadow: inset 0 0 0 1px #ffffff20; }
.cal-primary .cal-icon { filter: brightness(0) invert(1); }
.cal-icon-button { padding: 0; width: 36px; min-width: 36px; }
.cal-text-button { border-color: transparent; color: #427dc9; background: transparent; padding-left: 0; padding-right: 0; justify-content: flex-start; }
.cal-text-button:hover { border-color: transparent; background: transparent; color: #2e66ad; }
.cal-button-wide { width: 100%; }
.cal-rail { width: 64px; min-width: 64px; background: #1b3444; color: #e1eaf0; display: flex; align-items: center; flex-direction: column; border-right: 1px solid #0d2b36; }
.cal-brand { width: 34px; height: 34px; margin: 15px 0 15px; border-radius: 50%; background: #557a8b; display: grid; place-items: center; font-size: 22px; color: #fff; }
.cal-nav-current { margin-top: 15px; display: flex; flex-direction: column; width: 100%; height: 72px; padding: 8px 3px; gap: 7px; border: 0; border-radius: 0; background: transparent; color: #99a9b0; font-size: 11px; font-weight: 400; }
.cal-nav-current:hover, .cal-nav-current:disabled, .cal-nav-current:disabled:hover { background: transparent; color: #99a9b0; border: 0; box-shadow: none; }
.cal-nav-current[aria-current="page"], .cal-nav-current[aria-current="page"]:disabled { color: #fff; font-weight: 700; }
.cal-nav-date { display: flex; flex: none; flex-direction: column; width: 32px; height: 34px; overflow: hidden; border: 1px solid #99a9b0; border-radius: 6px; color: #99a9b0; font-style: normal; text-align: center; }
.cal-nav-weekday { display: block; flex: 0 0 11px; border-bottom: 1px solid #99a9b0; font-size: 9px; font-weight: 700; line-height: 11px; }
.cal-nav-day { display: block; flex: 1; font-size: 21px; font-weight: 400; line-height: 21px; font-variant-numeric: tabular-nums; }
.cal-nav-current[aria-current="page"] .cal-nav-date { border-color: #28a7d8; background: #fff; color: #1b3444; }
.cal-nav-current[aria-current="page"] .cal-nav-weekday { border-color: #28a7d8; background: #28a7d8; color: #fff; }
.cal-main { display: flex; flex-direction: column; flex: 1; min-width: 0; height: 100%; }
.cal-toolbar { display: flex; align-items: stretch; gap: 0; min-height: 64px; padding: 0; border-bottom: 1px solid var(--cal-border); background: #fff; z-index: 30; }
.cal-title { display: flex; align-items: center; padding: 0 22px; font-size: 17px; line-height: 36px; font-weight: 700; letter-spacing: .3px; margin: 0; white-space: nowrap; }
.cal-search-wrap { position: relative; min-width: 0; max-width: none; flex: 1; border-inline: 1px solid var(--cal-border); }
.cal-search-box { display: flex; align-items: center; min-height: 63px; height: 100%; gap: 7px; padding: 12px 18px; border: 0; border-radius: 0; box-shadow: none; background: #fff; }
.cal-search-box > .cal-icon { opacity: .55; }
.cal-search-input { appearance: none; border: 0; outline: none; min-width: 120px; width: 140px; flex: 1; height: 28px; font-size: 15px; color: #363b44; background: transparent; padding: 0; }
.cal-search-input::placeholder { color: #b3b3b3; opacity: 1; }
.cal-search-input::-webkit-search-cancel-button { appearance: none; }
.cal-filter-summary { color: #7c8796; font-size: 12px; padding-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-toolbar-actions { display: flex; gap: 10px; align-items: center; margin-left: auto; padding: 12px 18px; }
.cal-button.cal-toolbar-plain, .cal-button.cal-toolbar-plain:hover, .cal-button.cal-toolbar-plain:disabled, .cal-button.cal-toolbar-plain:disabled:hover { background: #fff; box-shadow: none; }
.cal-add { text-transform: uppercase; font-size: 13px; letter-spacing: .2px; padding: 0 13px; }
.cal-menu-wrap { position: relative; }
.cal-menu { position: absolute; right: 0; top: 43px; width: 260px; padding: 5px; border: 1px solid #cbd3dd; border-radius: 3px; background: #fff; box-shadow: 0 6px 20px #162b4526; z-index: 50; }
.cal-menu-item { display: flex; width: 100%; justify-content: flex-start; border: 0; height: 39px; }
.cal-filter-popover { position: absolute; left: 0; top: 64px; width: min(440px, 80vw); max-height: calc(100dvh - 115px); overflow-y: auto; padding: 0 18px; border: 1px solid #cbd3dd; border-radius: 3px; background: #fff; box-shadow: 0 7px 24px #162b4526; z-index: 45; }
.cal-popover-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0 7px; font-size: 15px; }
.cal-filter-group { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; padding: 10px 0 16px; border: 0; border-top: 1px solid #edf0f3; margin: 7px 0 0; }
.cal-filter-group legend { font-size: 12px; font-weight: 700; color: #7d8792; padding: 0 7px 0 0; }
.cal-check-option { display: flex; align-items: flex-start; gap: 7px; line-height: 1.3; cursor: pointer; }
.cal-check-option input { width: 15px; height: 15px; margin: 1px 0 0; accent-color: #4c8bf7; flex: 0 0 15px; }
.cal-popover-footer { display: flex; justify-content: flex-end; padding: 10px 0 14px; border-top: 1px solid #edf0f3; position: sticky; bottom: 0; background: #fff; }
.cal-datebar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 40px; padding: 0 14px; border-bottom: 1px solid var(--cal-border); background: #fff; }
.cal-date-navigation, .cal-date-right { display: flex; align-items: center; gap: 14px; }
.cal-datebar .cal-icon-button { border: 0; }
.cal-datebar .cal-button:disabled { background: transparent; color: #92989f; }
.cal-datebar .cal-icon-button .cal-icon { width: 24px; height: 24px; }
.cal-today { border-color: transparent; font-size: 14px; padding: 0 3px; }
.cal-date-control { display: flex; justify-content: center; }
.cal-date-picker { position: relative; cursor: pointer; display: flex; align-items: center; min-height: 38px; padding: 0; border: 0; background: transparent; font-family: inherit; }
.cal-date-title { font-size: 16px; font-weight: 400; color: #6f7780; }
.cal-date-picker:not(:disabled):hover, .cal-date-picker[aria-expanded="true"] { color: #363b44; }
.cal-date-picker:disabled { cursor: default; }
.cal-app .cal-date-picker:focus-visible { outline: 1px solid #508ef4; outline-offset: 2px; }
.cal-date-right { justify-content: flex-end; }
.cal-timezone { display: none; }
.cal-notice { position: absolute; top: 112px; left: 50%; transform: translateX(-50%); max-width: 560px; min-height: 36px; box-shadow: 0 3px 14px #1b344418; border: 1px solid #d4e1d6; border-radius: 3px; display: flex; align-items: center; justify-content: space-between; padding: 4px 12px 4px 20px; gap: 14px; border-bottom: 1px solid #d4e1d6; background: #eff7f1; color: #406449; z-index: 60; }
.cal-notice .cal-icon-button { border: 0; background: transparent; min-height: 28px; width: 28px; }
.cal-notice-error { background: #fff4ee; color: #8d4f32; border-color: #ead0bf; }
.cal-workspace { display: flex; flex: 1; min-height: 0; min-width: 0; }
.cal-grid-scroll { flex: 1; min-width: 0; min-height: 0; overflow: auto; position: relative; scrollbar-color: #bbc2cc #f7f8fa; scrollbar-width: thin; overscroll-behavior: contain; }
.cal-grid-scroll.is-panning, .cal-grid-scroll.is-panning * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }
.cal-visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.cal-grid-scroll::-webkit-scrollbar { width: 9px; height: 10px; }
.cal-grid-scroll::-webkit-scrollbar-thumb { background: #b9c1cb; border: 2px solid #f7f8fa; border-radius: 5px; }
.cal-grid { min-width: max(100%, calc(60px + var(--cal-column-count) * 190px)); position: relative; }
.cal-grid-head { display: grid; grid-template-columns: 60px repeat(var(--cal-column-count), minmax(190px, 1fr)); position: sticky; top: 0; height: 60px; background: #fff; z-index: 15; box-shadow: 0 1px 0 #e5e7e9; }
.cal-time-head { position: sticky; left: 0; background: #fff; border-right: 1px solid #e3e6e8; display: grid; place-items: center; z-index: 17; color: #a0a8b3; }
.cal-time-head .cal-icon { opacity: .35; width: 17px; height: 17px; }
.cal-employee-heading { min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 7px; border-right: 1px solid #e3e6e8; overflow: hidden; }
.cal-employee-heading > strong { font-size: 15px; font-weight: 400; white-space: nowrap; text-overflow: ellipsis; max-width: 100%; overflow: hidden; }
.cal-position-tags { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; justify-content: center; }
.cal-tag { display: inline-block; font-size: 11px; font-weight: 400; line-height: 19px; padding: 0 7px; color: #46535f; background: #f0f2f5; border: 1px solid #d6dce3; border-radius: 3px; white-space: nowrap; }
.cal-tag-empty { border-color: transparent; background: transparent; color: #8c97a4; }
.cal-grid-body { display: grid; grid-template-columns: 60px repeat(var(--cal-column-count), minmax(190px, 1fr)); position: relative; }
.cal-time-gutter { position: sticky; left: 0; z-index: 10; background: #fff; border-right: 1px solid #e3e6e8; }
.cal-time-label { position: absolute; display: block; right: 10px; transform: translateY(3px); font-size: 12px; color: #92989f; line-height: 18px; }
.cal-time-label:last-child { transform: translateY(-18px); }
.cal-employee-column { position: relative; border-right: 1px solid #e3e6e8; min-width: 0; }
.cal-slot { position: absolute; inset-inline: 0; width: 100%; min-height: 0; border: 0; border-top: 1px solid #e5e7e9; border-radius: 0; padding: 0; background: #fff; }
.cal-slot.cal-half-hour { border-top: 1px dotted #e5e7e9; }
.cal-slot:hover { background: #eef5ff; border-color: #d5dce5; }
.cal-slot:focus-visible  { z-index: 3; outline-offset: 0; }
.cal-slot:disabled { background: #f7f8fa; border-color: #e5e9ee; }
.cal-grid.is-editing .cal-slot:disabled { background: #fff; }
.cal-event { display: flex; align-items: stretch; flex-direction: column; justify-content: flex-start; gap: 2px; position: absolute; left: 2px; right: 2px; min-height: 0; padding: 5px 7px 4px 9px; overflow: hidden; white-space: normal; text-align: left; border: 1px solid #d8dee5; border-left: 4px solid #9aa6b2; border-radius: 4px; background: #f0f3f6; z-index: 4; color: #304151; box-shadow: none; }
.cal-event:hover { background: #e7edf5; border-color: #c1cddb; border-left-color: #8c9cad; }
.cal-event-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 5px; line-height: 1.3; }
.cal-event-top > strong { font-size: 13px; white-space: nowrap; }
.cal-event-shared .cal-event-top { padding-right: 21px; }
.cal-event-shared-mark { position: absolute; top: 3px; right: 7px; display: inline-flex; width: 16px; height: 16px; color: #92989f; cursor: inherit; }
.cal-event-shared-mark > .cal-icon { width: 16px; height: 16px; flex-basis: 16px; pointer-events: none; user-select: none; -webkit-user-drag: none; }
.cal-event-status { font-size: 9px; font-weight: 400; padding: 1px 4px; background: #ffffffa8; border-radius: 2px; color: #667789; white-space: nowrap; }
.cal-event-title { display: block; font-size: 12px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event-address { font-size: 12px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event-current { background: #e7f1ff; border-left-color: #4c8bf7; border-top-color: #d1e0f4; border-bottom-color: #d1e0f4; }
.cal-event-current:hover { background: #dfecff; border-left-color: #4c8bf7; }
.cal-event-completed { background: #e8f5e5; border-left-color: #65b757; border-top-color: #d1e7cb; border-bottom-color: #d1e7cb; }
.cal-event-completed:hover { background: #e0f0db; border-left-color: #65b757; }
.cal-event-completed .cal-event-status { background: #65b757; color: #fff; }
.cal-event-overdue { background: #fff6d7; border-left-color: #dfb637; border-top-color: #efdfac; border-bottom-color: #efdfac; }
.cal-event-overdue:hover { background: #fff0c6; border-left-color: #dfb637; }
.cal-event.is-selected { filter: brightness(.96); }
.cal-selected-slot { position: absolute; inset-inline: 2px; z-index: 5; border: 1px dashed #4c8bf7; border-radius: 4px; background: #eaf2ffcc; padding: 5px 8px; pointer-events: none; display: flex; flex-direction: column; overflow: hidden; color: #3c587b; font-size: 12px; }
.cal-selected-slot strong { font-size: 13px; }
.cal-filtered-busy { position: absolute; inset-inline: 2px; z-index: 3; overflow: hidden; pointer-events: none; padding: 5px 8px; border-left: 3px solid #b6bec8; background: repeating-linear-gradient(135deg, #f0f2f5, #f0f2f5 5px, #e8ecf1 5px, #e8ecf1 6px); color: #8c97a4; font-size: 11px; }
.cal-now-line { position: absolute; left: 0; right: 0; border-top: 1px solid #2494d7; z-index: 6; pointer-events: none; }
.cal-grid-empty { padding: 50px 25px; text-align: center; color: #7b8796; background: repeating-linear-gradient(to bottom, #fff 0, #fff 41px, #e9edf2 42px); }
.cal-grid-empty > strong { color: #536172; font-size: 16px; }
.cal-grid-empty p { margin: 8px 0 17px; }
.cal-history-strip { position: sticky; bottom: 0; left: 0; border-top: 1px solid #d7dfe8; background: #fcfdfe; padding: 0 14px; z-index: 12; min-width: 100%; }
.cal-history-strip .cal-button { font-size: 12px; min-height: 32px; }
.cal-loading { padding: 70px 30px; display: flex; align-items: center; flex-direction: column; color: #7c8999; }
.cal-loading p { margin: 8px 0 20px; }
.cal-loading strong { color: #334555; font-size: 19px; }
.cal-loading-indicator { display: flex; align-items: center; justify-content: center; min-height: 40px; padding: 10px; visibility: hidden; }
.cal-opening { min-height: 144px; }
.cal-spinner { display: inline-block; flex: 0 0 auto; width: 20px; height: 20px; box-sizing: border-box; visibility: hidden; }
@keyframes cal-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .cal-spinner { animation: none; } }
.cal-side { width: 32%; min-width: 320px; max-width: 480px; flex: 0 0 32%; height: 100%; border-left: 1px solid #c8d1dc; display: flex; flex-direction: column; overflow: hidden; background: #fff; position: relative; z-index: 20; box-shadow: -1px 0 3px #1d31450a; }
.cal-panel-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 13px 16px 12px; border-bottom: 1px solid #e2e7ed; flex: 0 0 auto; }
.cal-panel-header h2 { margin: 0; font-size: 18px; font-weight: 400; line-height: 1.3; }
.cal-panel-header p { margin: 4px 0 0; font-size: 12px; }
.cal-panel-header .cal-icon-button { min-height: 25px; width: 25px; min-width: 25px; border: 0; }
.cal-muted { color: #7b8796; }
.cal-panel-message { padding: 8px 17px; line-height: 1.5; color: #7a8695; }
.cal-error-text { color: #a25640; }
.cal-appointment-form { min-height: 0; flex: 1; display: flex; flex-direction: column; }
.cal-form-body { flex: 1; min-height: 0; overflow: auto; padding: 12px 16px 16px; }
.cal-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; min-width: 0; }
.cal-field-label { color: #777f88; font-size: 13px; font-weight: 400; }
.cal-input { width: 100%; min-width: 0; height: 36px; border: 1px solid #c8d1dc; border-radius: 3px; background: #fff; padding: 7px 10px; font-size: 14px; color: #293947; box-shadow: inset 0 1px 2px #172a3a04; }
.cal-input:disabled { background: #f6f7f9; color: #7d8895; }
select.cal-input { padding-right: 27px; }
.cal-textarea { height: auto; min-height: 64px; resize: vertical; line-height: 1.4; }
.cal-field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.cal-field-row .cal-field { margin-bottom: 5px; }
.cal-field-hint { display: block; font-size: 12px; line-height: 1.4; color: #8190a0; }
.cal-form-body > .cal-field-hint { margin: 0 0 12px; }
.cal-form-tags { justify-content: flex-start; margin: -7px 0 12px; }
.cal-form-footer { border-top: 1px solid #dfe5ed; margin: 0 16px; padding: 10px 0 12px; background: #fff; flex: 0 0 auto; }
.cal-form-summary { font-size: 12px; color: #92989f; margin: 0 0 9px; }
.cal-form-actions { display: flex; justify-content: flex-end; gap: 10px; }
.cal-form-error { padding: 9px 11px; margin: 10px 0 0; background: #fff3ee; color: #994b34; border: 1px solid #ecd2c7; border-radius: 3px; font-size: 13px; }
.cal-form-error .cal-button { white-space: normal; }
.cal-detail-content { overflow: auto; min-height: 0; padding: 17px 18px 24px; }
.cal-status-badge { display: inline-block; align-self: flex-start; padding: 3px 7px; font-size: 11px; border-radius: 3px; background: #eff2f5; color: #647588; }
.cal-status-completed { background: #e6f4e1; color: #4e8644; }
.cal-status-current { background: #e5efff; color: #4a76ad; }
.cal-status-overdue { background: #fff3cc; color: #9a7a1f; }
.cal-status-cancelled { background: #f5ece8; color: #9b715f; }
.cal-object-title { font-size: 18px; font-weight: 700; margin: 13px 0 17px; line-height: 1.3; }
.cal-detail-list { margin: 0 0 18px; }
.cal-detail-row { margin: 0 0 13px; }
.cal-detail-row dt { font-size: 11px; color: #8a96a4; margin-bottom: 3px; }
.cal-detail-row dd { font-size: 14px; color: #354657; margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.cal-detail-section { border-top: 1px solid #e2e7ed; padding-top: 16px; margin-top: 20px; }
.cal-detail-section h3 { font-size: 15px; margin: 0 0 11px; }
.cal-detail-section > p { font-size: 12px; }
.cal-detail-section > .cal-button { margin-right: 7px; margin-bottom: 6px; }
.cal-attachments { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.cal-attachments li { min-width: 0; }
.cal-attachment-button { white-space: normal; text-align: left; justify-content: flex-start; width: 100%; overflow-wrap: anywhere; padding: 7px 9px; }
.cal-attachments .cal-field-hint { margin: 3px 0 0 2px; }
.cal-history-list { flex: 1; min-height: 0; overflow: auto; padding: 5px 16px 20px; }
.cal-history-item { width: 100%; padding: 15px 0; border: 0; border-bottom: 1px solid #e7ebf0; border-radius: 0; display: flex; align-items: stretch; flex-direction: column; justify-content: flex-start; gap: 6px; white-space: normal; text-align: left; }
.cal-history-item:hover { border-color: #d4dce7; background: #f8fafc; }
.cal-history-item strong { font-size: 14px; }
.cal-history-item > span:not(.cal-status-badge) { font-size: 12px; }
.cal-staff-host { flex: 1; min-height: 0; overflow: auto; background: #f8f9fb; }
@media (min-width: 1600px) { .cal-grid { min-width: max(100%, calc(60px + var(--cal-column-count) * 210px)); } .cal-grid-head, .cal-grid-body { grid-template-columns: 60px repeat(var(--cal-column-count), minmax(210px, 1fr)); } }
@media (max-width: 1150px) { .cal-toolbar { gap: 15px; padding-inline: 15px; } .cal-title { font-size: 17px; } .cal-toolbar-actions { gap: 8px; } .cal-add { font-size: 12px; padding-inline: 10px; } .cal-side { flex-basis: 330px; min-width: 300px; } .cal-timezone { display: none; } .cal-event-status { display: none; } }
@media (max-width: 900px) { .cal-rail { width: 58px; min-width: 58px; } .cal-nav-current { font-size: 10px; } .cal-toolbar { flex-wrap: wrap; gap: 8px 14px; min-height: 100px; } .cal-title { flex: 1; } .cal-search-wrap { order: 3; flex-basis: 100%; max-width: none; } .cal-toolbar-actions { margin-left: 0; } .cal-filter-popover { top: 61px; } .cal-date-title { font-size: 16px; } .cal-datebar { padding-inline: 8px; } .cal-date-navigation { gap: 5px; } .cal-today { font-size: 14px; } .cal-side { flex-basis: 310px; min-width: 290px; } }

/* Vertical rescheduling: the original stays in place until the server accepts it. */
.cal-event-draggable { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.cal-event-resize-handle { position: absolute; inset-inline: 0; bottom: 0; z-index: 3; height: 8px; cursor: ns-resize; touch-action: none; }
.cal-event-resize-handle::after { content: ''; position: absolute; width: 22px; height: 2px; left: calc(50% - 11px); bottom: 2px; border-radius: 1px; background: #8498aa; opacity: .45; }
.cal-event:hover .cal-event-resize-handle::after, .cal-event:focus-visible .cal-event-resize-handle::after { opacity: 1; }
.cal-is-dragging, .cal-is-dragging * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }
.cal-is-resizing, .cal-is-resizing * { cursor: ns-resize !important; }
.cal-drag-source, .cal-event.is-pending-move { opacity: .4; }
.cal-drag-ghost { position: absolute; inset-inline: 2px; z-index: 18; display: flex; flex-direction: column; gap: 3px; padding: 5px 8px; border: 1px solid #4c8bf7; border-left-width: 4px; border-radius: 3px; background: #eaf2fff2; box-shadow: 0 3px 8px #2d4c7026; color: #365c8d; pointer-events: none; overflow: hidden; font-size: 12px; }
.cal-drag-ghost strong { font-size: 13px; }
.cal-drag-ghost.is-invalid { border-color: #ca735e; background: #fff0ebf2; color: #a0523d; }
.cal-drag-ghost.is-invalid span { color: #a0523d; }
.cal-resize-ghost.is-short { gap: 0; padding: 1px 7px; }
.cal-resize-ghost.is-short strong { font-size: 12px; line-height: 12px; }
.cal-resize-ghost.is-short .cal-resize-duration { font-size: 10px; line-height: 10px; }
.cal-resize-ghost.is-short > span:last-child { display: none; }
.cal-move-pending-slot { border-style: solid; background: #eaf2ffe8; z-index: 7; }

/* Working hours and a single visit shared by several specialists. */
.cal-grid-head { height: 76px; }
.cal-grid-head.is-compact { height: 56px; }
.cal-position-tags:empty, .cal-event-tags:empty { display: none; }
.cal-employee-heading { gap: 3px; }
.cal-employee-hours { font-size: 10px; line-height: 13px; color: #90969d; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.cal-slot.cal-slot-nonworking:disabled, .cal-grid.is-editing .cal-slot.cal-slot-nonworking:disabled { background: repeating-linear-gradient(135deg,#f2f3f4,#f2f3f4 5px,#eceef0 5px,#eceef0 6px); }
.cal-event { gap: 1px; padding: 3px 7px 3px 8px; }
.cal-event-top > strong { font-size: 13px; line-height: 15px; }
.cal-event-title { font-size: 12px; line-height: 14px; }
.cal-event-team { font-size: 11px; line-height: 13px; color: #53616b; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.cal-event-tags { display: flex; gap: 3px; align-items: center; flex-wrap: nowrap; min-height: 15px; overflow: hidden; }
.cal-event-tags .cal-tag { font-size: 10px; line-height: 14px; padding: 0 4px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; }
.cal-event-outside-hours { border-top-style: dashed; border-bottom-style: dashed; }
.cal-event-short { display: grid; grid-template-columns: auto minmax(0,1fr); grid-template-rows: 13px 13px; column-gap: 5px; }
.cal-event-short .cal-event-top { grid-column: 1; grid-row: 1; }
.cal-event-short .cal-event-status, .cal-event-short .cal-event-team { display: none; }
.cal-event-short .cal-event-title { grid-column: 1 / -1; grid-row: 2; }
.cal-event-short .cal-event-tags { grid-column: 2; grid-row: 1; min-height: 13px; }
.cal-event-short .cal-event-top > strong, .cal-event-short .cal-event-title { font-size: 11px; line-height: 13px; }
.cal-event-short .cal-event-tags .cal-tag { font-size: 9px; line-height: 11px; }
.cal-event-short.cal-event-shared .cal-event-top { padding-right: 0; }
.cal-event-short.cal-event-shared .cal-event-tags, .cal-event-short.cal-event-shared .cal-event-title { padding-right: 21px; }
.cal-multi { position: relative; min-width: 0; }
.cal-multi-trigger { display: flex; align-items: center; gap: 8px; text-align: left; box-shadow: none; }
.cal-multi-trigger > .cal-icon { width: 14px; height: 14px; flex-basis: 14px; margin-left: auto; transform: rotate(90deg); opacity: .45; }
.cal-multi-trigger.is-empty { color: #92989f; }
.cal-multi-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-multi-dropdown { position: absolute; top: calc(100% + 3px); left: 0; width: 100%; z-index: 20; border: 1px solid #e2e5e8; border-radius: 3px; background: #fff; overflow: hidden; box-shadow: 0 2px 6px #26313b08; }
.cal-multi-search-wrap { display: flex; align-items: center; gap: 8px; height: 37px; padding: 0 9px; border-bottom: 1px solid #e5e7e9; }
.cal-multi-search-wrap > .cal-icon { width: 18px; height: 18px; flex-basis: 18px; opacity: .36; }
.cal-multi-search { width: 100%; min-width: 0; height: 35px; padding: 0; border: 0; outline: none; background: #fff; font-size: 14px; color: #363b44; }
.cal-multi-search::placeholder { color: #a3a6aa; opacity: 1; }
.cal-multi-options { max-height: min(252px, 36vh); overflow-y: auto; overscroll-behavior: contain; }
.cal-multi-option { display: flex; align-items: center; min-height: 36px; gap: 8px; padding: 7px 8px; color: #363b44; font-size: 14px; line-height: 20px; cursor: pointer; }.cal-multi-option:hover { background: #f5f5f5; }
.cal-multi-all { color: #92989f; }
.cal-multi-option > input { appearance: none; -webkit-appearance: none; flex: 0 0 20px; width: 20px; height: 20px; margin: 0; border: 1px solid #e2e5e8; border-radius: 3px; background: #fff center / 18px 18px no-repeat; cursor: pointer; }
.cal-multi-option > input:checked { background-image: url('/assets/icons/check.svg'); }
.cal-multi-option > input:indeterminate { background-image: url('/assets/icons/minus.svg'); }
.cal-multi-option > input:focus-visible  { outline: none; outline-offset: 0; }
.cal-multi-option > input:disabled { cursor: default; opacity: .55; }
.cal-multi-empty { padding: 10px 9px; color: #92989f; font-size: 13px; }
.cal-team-hours { border-left: 2px solid #e2e5e9; padding: 3px 8px; margin: 0 0 13px; color: #818b94; font-size: 11px; line-height: 1.7; }
.cal-team-hours .cal-hours-warning { color: #a5753a; }
.cal-detail-tags { justify-content: flex-start; margin: 0 0 16px; }
.cal-schedule-warning { background: #fbf4e8; border: 1px solid #ead8b9; color: #906b34; font-size: 12px; padding: 9px; border-radius: 3px; }

/* The deal is committed only by an explicit result selection. */
.cal-lead-picker { position: relative; min-width: 0; }
.cal-lead-input { padding-right: 32px; text-overflow: ellipsis; }
.cal-lead-input[readonly] { background: #f7f8f9; color: #657380; }
.cal-lead-clear { position: absolute; right: 1px; top: 1px; width: 31px; height: 34px; padding: 0; border: 0; background: transparent; color: #92989f; cursor: pointer; font-size: 22px; line-height: 30px; }
.cal-lead-clear:hover { color: #354657; }
.cal-lead-picker > .cal-field-hint { display: block; margin-top: 5px; }
.cal-lead-dropdown { position: absolute; top: 38px; left: 0; right: 0; z-index: 30; overflow: hidden; border: 1px solid #dce2e8; border-radius: 3px; background: #fff; box-shadow: 0 3px 10px #26313b15; }
.cal-lead-results { max-height: min(260px, 35vh); overflow-y: auto; overscroll-behavior: contain; }
.cal-lead-option { display: flex; flex-direction: column; gap: 3px; padding: 9px 10px; cursor: pointer; color: #354657; border-bottom: 1px solid #f0f2f4; }
.cal-lead-option:hover, .cal-lead-option.is-active { background: #edf4ff; }
.cal-lead-title { font-size: 13px; line-height: 18px; overflow-wrap: anywhere; }
.cal-lead-id { font-size: 11px; line-height: 15px; color: #92989f; }
.cal-lead-status { padding: 10px; color: #7d8995; font-size: 12px; line-height: 18px; }
.cal-lead-more { width: 100%; padding: 10px; border: 0; border-top: 1px solid #e7ebf0; background: #fff; color: #397ab8; font-size: 12px; cursor: pointer; }
.cal-lead-more:hover { background: #f5f8fc; }
.cal-lead-more:disabled { color: #92989f; cursor: default; }
