.crm-cal-modes{display:inline-flex;gap:3px;padding:4px;border-radius:var(--r-pill,24px);background:var(--surface-sunken,#e5e8f0);box-shadow:inset 0 0 0 1px var(--line,#d6dae5)}
.crm-cal-modes button{border:0;background:transparent;color:var(--muted,#687183);font-family:inherit;font-size:var(--text-sm,14px);font-weight:600;border-radius:var(--r-pill,24px);padding:8px 16px;min-height:36px;cursor:pointer;white-space:nowrap}
.crm-cal-modes button[aria-checked=true]{color:var(--accent,#3e54dd);background:var(--surface,#f7f8fc);box-shadow:var(--elev-1,0 2px 6px #14234015)}
.crm-cal-modes button:focus-visible,.crm-cal-agenda button:focus-visible{outline:2px solid var(--accent,#3e54dd);outline-offset:-2px}
[data-crm-calendar-focus]{outline:3px solid var(--accent,#3e54dd)!important;outline-offset:3px!important}
.crm-cal-agenda{--hour-height:52px;display:flex;flex-direction:column;min-width:0;min-height:0;flex:1;border-radius:var(--r-lg,24px);background:var(--sb-glass,var(--surface,#f7f8fc));box-shadow:var(--elev-1,0 4px 18px #14234015);overflow:hidden;color:var(--ink,#222632)}
.crm-cal-day-actions{display:flex;flex-wrap:wrap;align-items:center;gap:7px;padding:12px 16px;border-bottom:1px solid var(--line,#d6dae5)}
.crm-cal-day-actions>span{margin-right:auto;font-size:var(--text-sm,14px);font-weight:600;text-transform:capitalize}
.crm-cal-day-actions button{border:1px solid var(--line-strong,#ccd2df);border-radius:var(--r-pill,24px);padding:7px 12px;background:var(--surface,#fff);color:inherit;font:inherit;font-size:var(--text-sm,14px);cursor:pointer}
.crm-cal-week-hint,.crm-cal-empty,.crm-cal-loading{margin:0;padding:9px 16px;font-size:var(--text-sm,14px);color:var(--muted,#687183)}
.crm-cal-loading{color:var(--accent,#3e54dd)}.crm-cal-empty{border-bottom:1px solid var(--line,#d6dae5)}
.crm-cal-scroll{position:relative;min-height:300px;height:calc(100dvh - 260px);max-height:calc(100dvh - 240px);overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;isolation:isolate}
.crm-cal-content{min-width:100%;position:relative}.crm-cal-content.is-week{min-width:790px}
.crm-cal-dates,.crm-cal-all-days,.crm-cal-timeline{display:grid;grid-template-columns:48px repeat(var(--day-count),minmax(0,1fr))}
.crm-cal-dates{position:sticky;top:0;z-index:6;background:var(--surface-solid,var(--surface,#f7f8fc));border-bottom:1px solid var(--line,#d6dae5)}
.crm-cal-dates button{display:flex;align-items:center;justify-content:center;gap:8px;border:0;border-left:1px solid var(--line,#d6dae5);background:transparent;color:inherit;padding:8px 2px;font:inherit;cursor:pointer;min-height:46px}
.crm-cal-dates button span{font-size:var(--text-xs,12px);color:var(--muted,#687183)}.crm-cal-dates b{display:grid;place-items:center;min-width:28px;height:28px;font-size:var(--text-base,15px);border-radius:50%}
.crm-cal-dates .is-today b{background:var(--accent,#3e54dd);color:var(--accent-ink,#fff)}
.crm-cal-corner,.crm-cal-axis-label{position:sticky;left:0;z-index:7;background:var(--surface-solid,var(--surface,#f7f8fc));padding:10px 3px;font-size:10px;color:var(--muted,#687183);text-align:center;overflow-wrap:anywhere}
.crm-cal-all-days{position:sticky;top:var(--date-header-height,46px);z-index:5;background:var(--surface-solid,var(--surface,#f7f8fc));border-bottom:1px solid var(--line,#d6dae5);min-height:34px}.crm-cal-all-list{max-height:160px;overflow-y:auto;border-left:1px solid var(--line,#d6dae5);padding:3px;display:flex;flex-direction:column;gap:3px}
.crm-cal-timeline{height:1248px}.crm-cal-hours{position:sticky;left:0;z-index:4;background:var(--surface-solid,var(--surface,#f7f8fc))}.crm-cal-hours span{position:absolute;right:4px;font-size:10px;line-height:20px;color:var(--muted,#687183);font-variant-numeric:tabular-nums}
.crm-cal-day-column{position:relative;border-left:1px solid var(--line,#d6dae5);background:repeating-linear-gradient(to bottom,transparent 0,transparent 25px,color-mix(in srgb,var(--line,#d6dae5) 50%,transparent) 25px,color-mix(in srgb,var(--line,#d6dae5) 50%,transparent) 26px,transparent 26px,transparent 51px,var(--line,#d6dae5) 51px,var(--line,#d6dae5) 52px)}
.crm-cal-event{position:absolute;box-sizing:border-box;overflow:hidden;border:0;border-left:3px solid var(--event-color);border-radius:var(--r-sm,7px);background:color-mix(in srgb,var(--event-color) 16%,var(--surface-solid,#fff));color:inherit;text-align:left;padding:3px 5px;font:inherit;font-size:var(--text-xs,12px);line-height:1.3;cursor:pointer}
.crm-cal-event strong{display:block;font-weight:600;overflow-wrap:anywhere}.crm-cal-event span,.crm-cal-event small{display:block;font-size:10px;overflow-wrap:anywhere;color:var(--muted,#687183);margin-top:3px}
.crm-cal-event-all{position:relative;flex:none;width:100%}.crm-cal-event.is-done{text-decoration:line-through;opacity:.8}.crm-cal-event.is-late{color:var(--danger,#b42318)}
.crm-cal-now{position:absolute;left:0;right:0;border-top:2px solid var(--danger,#c43a39);pointer-events:none;z-index:3}.crm-cal-now:before{content:'';display:block;position:absolute;left:-3px;top:-4px;width:6px;height:6px;border-radius:50%;background:var(--danger,#c43a39)}
@media(max-width:640px){.crm-cal-modes{width:100%}.crm-cal-modes button{flex:1;min-height:40px;padding:8px 12px;font-size:14px}.crm-cal-scroll{height:calc(100dvh - 320px);max-height:none;min-height:300px}.crm-cal-content.is-week{min-width:735px}.crm-cal-day-actions{padding:10px 12px}.crm-cal-day-actions>span{flex:1 1 100%;margin-bottom:3px}.crm-cal-week-hint{font-size:12px;line-height:1.5}.crm-cal-event{font-size:12px}}
@media(prefers-reduced-motion:reduce){.crm-cal-scroll{scroll-behavior:auto}}

.crm-cal-axis-label{font-size:9px;padding:6px 2px;overflow-wrap:normal;word-break:normal}
/* The same split workspace in month, week and day. */
.crm-cal-workspace{display:flex;align-items:stretch;flex:1;min-width:0;min-height:0;position:relative}.crm-cal-main{display:flex;flex:1;min-width:0;min-height:0}.crm-cal-main>.kb-col,.crm-cal-main>.crm-cal-agenda{width:100%;min-width:0}.crm-cal-sidebar{display:flex;flex:none;flex-direction:column;min-width:0;min-height:0;max-height:calc(100dvh - 240px)}.crm-cal-sidebar>.dayp{width:100%!important;max-width:100%!important;min-width:0!important;flex:1}.crm-cal-sidebar .dayp-acts{flex-wrap:wrap}.crm-cal-sidebar .dayp-title,.crm-cal-sidebar .dayp-date{overflow-wrap:anywhere}
.crm-cal-split{flex:0 0 26px;display:grid;place-items:center;cursor:col-resize;touch-action:none;outline:none}.crm-cal-split>span{height:44px;width:3px;background:var(--line-strong);border-radius:4px}.crm-cal-split:hover>span,.crm-cal-split:focus-visible>span{background:var(--accent)}.crm-cal-split:focus-visible{outline:2px solid var(--accent);outline-offset:-4px}.crm-cal-split[aria-disabled=true]{cursor:wait}
.crm-cal-layout-controls{display:inline-flex;gap:6px;align-items:center}.crm-cal-layout-controls button,.crm-cal-settings button{font:inherit;color:var(--ink);background:var(--surface);border:1px solid var(--line);border-radius:var(--r-pill);padding:8px 14px;min-height:38px;cursor:pointer;font-size:var(--text-sm)}.crm-cal-layout-controls button[aria-pressed=true]{color:var(--accent);background:var(--accent-wash);border-color:var(--accent)}.crm-cal-layout-controls button:focus-visible,.crm-cal-settings :focus-visible{outline:2px solid var(--accent);outline-offset:2px}.crm-cal-layout-error{font-size:var(--text-sm);color:var(--danger);flex-basis:100%;margin:4px 0}
.crm-cal-settings{position:fixed;inset:0;margin:auto;height:fit-content;box-sizing:border-box;width:min(520px,calc(100% - 24px));max-height:90dvh;overflow:auto;border:1px solid var(--line);border-radius:var(--r-lg);background:var(--surface);color:var(--ink);padding:22px;box-shadow:var(--elev-3);font:inherit}.crm-cal-settings::backdrop{background:var(--scrim)}.crm-cal-settings header{display:flex;align-items:center;justify-content:space-between;gap:12px}.crm-cal-settings h2{font-size:var(--text-lg);margin:0}.crm-cal-settings p{font-size:var(--text-sm);line-height:1.5;color:var(--muted)}.crm-cal-settings label{display:grid;gap:7px;font-size:var(--text-sm);margin-top:18px;min-width:0}.crm-cal-settings .crm-cal-check{display:flex;align-items:center;gap:10px;font-size:var(--text-base)}.crm-cal-check input{width:18px;height:18px;accent-color:var(--accent)}.crm-cal-settings select{width:100%;font:inherit;min-height:44px;border:1px solid var(--line);border-radius:var(--r-md);color:var(--ink);background:var(--surface);padding:8px;min-width:0}.crm-cal-hours-fields{display:grid;grid-template-columns:1fr 1fr;gap:12px}.crm-cal-settings footer{display:flex;flex-wrap:wrap;gap:8px;margin-top:22px;justify-content:flex-end}.crm-cal-settings button.is-primary{background:var(--accent);color:var(--accent-ink,#fff);border-color:var(--accent)}.crm-cal-settings [role=alert]{color:var(--danger)}
.crm-cal-content.is-week{min-width:560px}.crm-cal-dates button.is-selected{background:var(--accent-wash)}.crm-cal-dates button.is-selected b{outline:2px solid var(--accent);outline-offset:2px}.crm-cal-day-column{background:repeating-linear-gradient(to bottom,transparent 0,transparent calc(var(--hour-height)/2 - 1px),color-mix(in srgb,var(--line) 50%,transparent) calc(var(--hour-height)/2 - 1px),color-mix(in srgb,var(--line) 50%,transparent) calc(var(--hour-height)/2),transparent calc(var(--hour-height)/2),transparent calc(var(--hour-height) - 1px),var(--line) calc(var(--hour-height) - 1px),var(--line) var(--hour-height))}.crm-cal-scroll{height:auto;flex:1;max-height:calc(100dvh - 260px);min-height:300px}
@media(max-width:640px){.crm-cal-content.is-week{min-width:735px}.crm-cal-layout-controls{width:100%;justify-content:flex-end}.crm-cal-workspace{flex:none;min-height:0}.crm-cal-scroll{height:calc(100dvh - 350px);min-height:300px}.crm-cal-hours-fields{grid-template-columns:1fr}.crm-cal-settings{padding:18px}}
/* Keep short appointments legible; the selected day's panel shows the full text. */
.crm-cal-content.is-week .crm-cal-event strong{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.crm-cal-content.is-week .crm-cal-event-all strong{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;white-space:normal}.crm-cal-content.is-week .crm-cal-event span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.crm-cal-content.is-week .crm-cal-all-list{max-height:112px}

/* Month navigation belongs to the widget; its schedule refers to one day. */
.crm-cal-month{display:flex;flex-direction:column;flex:1;min-width:0;min-height:0;background:var(--sb-glass,var(--surface));border-radius:var(--r-lg);box-shadow:var(--elev-1);overflow:hidden}
.crm-cal-month-head{display:flex;align-items:center;gap:4px;padding:6px 8px;border-bottom:1px solid var(--line);flex-shrink:0}
.crm-cal-month-head>button{flex:none;display:grid;place-items:center;width:44px;min-height:44px;padding:0;border:0;border-radius:var(--r-pill);background:transparent;color:var(--ink);font:inherit;font-size:28px;cursor:pointer}
.crm-cal-month-head>strong{flex:1;min-width:0;text-align:center;font-size:var(--text-md);font-weight:600;overflow-wrap:anywhere}
.crm-cal-month-head .crm-cal-layout-controls{width:auto;flex:none}.crm-cal-month-head .crm-cal-layout-controls button{min-height:44px}
.crm-cal-month-grid{display:flex;flex:1;min-width:0;min-height:0;touch-action:pan-y pinch-zoom}
.crm-cal-month-grid>.kb-col{width:100%;border-radius:0!important;box-shadow:none!important}
.crm-cal-month-foot{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px;padding:8px 12px;border-top:1px solid var(--line);flex-shrink:0}
.crm-cal-month-hint{color:var(--muted);font-size:var(--text-xs)}
.crm-cal-schedule{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:44px;border:1px solid var(--line);border-radius:var(--r-pill);padding:8px 12px;background:var(--surface);color:var(--ink);font:inherit;font-size:var(--text-sm);cursor:pointer;flex-wrap:wrap}
.crm-cal-schedule-date{color:var(--muted);white-space:nowrap}.crm-cal-schedule em{display:inline-grid;place-items:center;min-width:22px;min-height:22px;padding:0 5px;border-radius:var(--r-pill);font-size:var(--text-xs);font-style:normal;font-variant-numeric:tabular-nums;background:var(--accent-wash);color:var(--accent)}
.crm-cal-schedule:disabled{opacity:.65;cursor:wait}.crm-cal-month :is(button,select):focus-visible{outline:2px solid var(--accent);outline-offset:-3px}
@media(max-width:640px){.crm-cal-month{flex:none;width:100%}.crm-cal-month-foot{justify-content:center}.crm-cal-month-hint{flex:1 1 100%;text-align:center}.crm-cal-month-foot .crm-cal-schedule{width:100%}}
