/* Local to the Tools calendar and its detail/editor sheet. */
body.lantern #pocket .clock-tools:has(.pocket-calendar)>.clock-tabs{display:none}
body.lantern #tools-page:has(.pocket-calendar){scroll-padding-bottom:calc(var(--kit-tabBar) + 1rem)}
body.lantern #pocket:has(#voice-mini-bar:not([hidden])) #tool-content:has(.pocket-calendar){padding-top:2.5rem}
body.lantern .pocket-calendar{color:var(--onSurface);padding-bottom:calc(var(--kit-tabBar) + 1rem);min-width:0}
body.lantern .pocket-calendar h2{padding:0;margin:.15rem 0;font-size:1.3em}
.pocket-calendar :is(h2,h3,h4,p){margin:.5rem 0;overflow-wrap:anywhere}
.calendar-controls{display:flex;flex-wrap:wrap;gap:.5rem;align-items:center;margin:.45rem 0}
.calendar-controls h2{flex:1 0 100%}
.calendar-sources{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:thin}
.calendar-sources button{flex:none}
body.lantern #pocket .calendar-controls button:not(.mind-card){
  padding:.25rem .65rem;font-size:calc(var(--kit-labelMedium) * var(--text-ratio,1));border:1px solid var(--outlineVariant);background:var(--secondaryContainer);color:var(--onSecondaryContainer)
}
.calendar-status{font-size:.875em;min-height:1.25em;overflow-wrap:anywhere}
body.lantern :is(.pocket-calendar,.calendar-sheet) button{min-height:3rem;white-space:normal;overflow-wrap:anywhere}
body.lantern #pocket .calendar-controls button[aria-pressed=true]:not(.calendar-account,.mind-card){border-color:var(--primary);background:var(--primary);color:var(--onPrimary)}
body.lantern #pocket .calendar-sources button.calendar-account:not(.mind-card){border-color:transparent;background:transparent;color:var(--onSurfaceVariant)}
body.lantern #pocket .calendar-sources button.calendar-account[aria-pressed=true]:not(.mind-card){border-color:var(--onSurfaceVariant);color:var(--onSurface)}
.calendar-account::before{content:'';flex:none;width:.55em;height:.55em;margin-inline-end:.4em;border-radius:100%;background:var(--calendar-dot)}
body.lantern .calendar-stale{color:var(--lantern-overdue)}
.calendar-page-heading{display:grid;grid-template-columns:3rem minmax(0,1fr) 3rem;align-items:center;text-align:center;gap:.35rem;margin-top:.85rem}
.calendar-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));text-align:center;gap:.12rem;touch-action:pan-y}
.calendar-grid small{font-size:.78em;overflow:hidden;text-overflow:ellipsis}
body.lantern #pocket .calendar-grid button:not(.mind-card){display:flex;flex-direction:column;align-items:center;justify-content:center;min-width:0;padding:0;border-color:transparent;background:transparent;color:var(--onSurface);font-variant-numeric:tabular-nums;white-space:nowrap;overflow-wrap:normal}
body.lantern #pocket .calendar-grid button:not(.mind-card):active{background:var(--secondaryContainer)}
.calendar-grid .outside .calendar-date{color:var(--onSurfaceVariant)}
.calendar-date{display:grid;place-items:center;inline-size:calc(2rem * var(--text-ratio,1));max-inline-size:100%;aspect-ratio:1;border:2px solid transparent;border-radius:50%}
.calendar-grid [aria-current=date] .calendar-date{border-color:var(--primary);color:var(--primary);font-weight:700}
.calendar-grid [aria-pressed=true] .calendar-date{background:var(--primary);color:var(--onPrimary);font-weight:700}
.calendar-dots{display:flex;min-height:.4375rem;gap:.1875rem;margin-top:.1875rem}
.calendar-dots span{display:block;width:.4375rem;height:.4375rem;border-radius:50%}
.calendar-agenda{touch-action:pan-y}
.calendar-row{display:flex;align-items:stretch;background:var(--surfaceContainer);border-inline-start:.2rem solid var(--calendar-dot);border-radius:.5rem;margin:.25rem 0;min-width:0}
body.lantern #pocket .calendar-row button:not(.mind-card),body.lantern dialog.calendar-sheet .calendar-row button:not(.mind-card){display:flex;flex-direction:column;align-items:flex-start;justify-content:center;gap:.18rem;text-align:start;min-width:0;flex:1;background:transparent;color:var(--onSurface);border-color:transparent;padding:.42rem .6rem}
.calendar-row button>*{max-width:100%;overflow-wrap:anywhere}
body.lantern .calendar-row .calendar-check{min-width:var(--kit-target);display:grid;place-items:center}
/* Match the Lantern Todo check mark without shrinking the native input's hit target. */
body.lantern .calendar-check input[type=checkbox]{appearance:none;position:relative;width:var(--kit-target);height:var(--kit-target);margin:0;padding:0;border:0;border-radius:.5rem;background:none}
.calendar-check input::before,.calendar-check input:checked::after{position:absolute;inset:50% auto auto 50%;transform:translate(-50%,-50%)}
.calendar-check input::before{content:'';box-sizing:border-box;width:1.25rem;height:1.25rem;border:1.5px solid var(--lantern-muted);border-radius:4px}
.calendar-check input:checked::before{background:var(--lantern-lamp);border-color:var(--lantern-lamp)}
.calendar-check input:checked::after{content:'✓';color:var(--lantern-lamp-ink);font-size:1rem}
.calendar-check input:focus-visible{outline-offset:-4px}
.calendar-check input:disabled{opacity:.55;cursor:default}
@media(forced-colors:active){
  body.lantern .calendar-check input[type=checkbox]{appearance:auto}
  .calendar-check input::before,.calendar-check input:checked::after{content:none}
}
body.lantern .calendar-row .calendar-pending-label{color:var(--lantern-calPending)}
body.lantern dialog.calendar-sheet::backdrop{background:#0008}
body.lantern dialog.calendar-sheet[open]{max-width:min(36rem,calc(100vw - 1.25rem));width:100%;padding:1rem clamp(.75rem,4vw,1.5rem);font-size:calc(1rem * var(--text-ratio,1));max-height:min(85dvh,calc(100dvh - var(--kit-tabBar) - 7rem));box-sizing:border-box;display:flex;flex-direction:column;overflow:hidden;z-index:5}
@media(max-width:700px){body.lantern dialog.calendar-sheet[open]{margin-block-end:calc(var(--kit-tabBar) + 1.65rem + env(safe-area-inset-bottom))}}
.calendar-sheet :is(h2,h3,p,strong,button){overflow-wrap:anywhere}
.calendar-sheet-header{display:flex;justify-content:space-between;align-items:center;gap:.5rem;flex:none;padding-bottom:.5rem}
.calendar-sheet-header h2{margin:0;min-width:0;flex:1}
.calendar-sheet-scroll{position:relative;display:flex;flex-direction:column;min-height:0}
.calendar-sheet-viewport{overflow:auto;overscroll-behavior:contain;scroll-padding-block:.75rem;scrollbar-width:thin;scrollbar-gutter:stable}
.calendar-sheet-scroll[data-scrolled] .calendar-sheet-viewport{--calendar-fade-top:.8rem}
/* Scale the fade with the body text and clear the clip edge before the cue. */
.calendar-sheet-scroll[data-more] .calendar-sheet-viewport{--calendar-fade-end:1.1em;--calendar-fade-clear:.4em}
.calendar-sheet-scroll:is([data-scrolled],[data-more]) .calendar-sheet-viewport{
  mask-image:linear-gradient(transparent,#000 var(--calendar-fade-top,0px),#000 calc(100% - var(--calendar-fade-end,0px)),transparent calc(100% - var(--calendar-fade-clear,0px)))
}
.calendar-sheet-more{flex:none;text-align:center;padding-block:.3rem;visibility:hidden}
.calendar-sheet-scroll:not([data-overflow]) .calendar-sheet-more{display:none}
.calendar-sheet-scroll[data-more] .calendar-sheet-more{visibility:visible}
.calendar-sheet-body{display:grid;gap:.5rem;padding:.65rem .3rem .75rem}
.calendar-sheet-body p{margin:0}
.calendar-sheet-body label{display:grid;gap:.25rem;min-width:0}
.calendar-sheet-body :is(input:not([type=checkbox]),textarea,select){width:100%;box-sizing:border-box;padding:.5rem .65rem;background:var(--surfaceContainerHighest);border:1px solid var(--outline);color:var(--onSurface)}
.calendar-sheet-body textarea{min-height:5rem;resize:vertical}
.calendar-sheet-body textarea::placeholder{color:var(--onSurfaceVariant);opacity:1}
.calendar-sheet-body input[type=checkbox]{width:1.35rem;height:1.35rem;accent-color:var(--primary)}
.calendar-description{white-space:pre-wrap}
.calendar-sheet-actions{flex:none;background:var(--surfaceContainer);display:flex;gap:.4rem;flex-wrap:wrap}
.calendar-sheet-actions:has(> :not(.calendar-status),> .calendar-status:not(:empty)){padding-top:.55rem}
.calendar-sheet-actions :is(.calendar-status,strong){flex:1 0 100%;margin:0}
.calendar-sheet-actions .calendar-status:empty{position:absolute;min-height:0}
.calendar-rsvp{flex:1 0 100%;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.4rem}
/* Reuse the shared Lantern pill geometry with visible secondary/destructive surfaces in the dialog. */
body.lantern #calendar-sheet :is(.calendar-sheet-header,.calendar-sheet-actions) button:not(.mind-card){
  padding-inline:.4rem;border:1px solid var(--outlineVariant);background:var(--secondaryContainer);color:var(--onSecondaryContainer)
}
body.lantern #calendar-sheet .calendar-sheet-header button:not(.mind-card){flex:none;padding-inline:.85rem;white-space:nowrap}
body.lantern #calendar-sheet .calendar-sheet-actions button.calendar-destructive:not(.mind-card){border-color:var(--error);background:var(--error);color:var(--onError)}
body.lantern #calendar-sheet .calendar-sheet-actions button:disabled{opacity:.55}
body.lantern #calendar-sheet .calendar-rsvp button:not(.mind-card){min-width:0;font-size:calc(var(--kit-labelMedium) * var(--text-ratio,1))}
