.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.single-time-section { display: grid; gap: 7px; }
.single-time-heading { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 13px; align-items: center; }
.single-time-heading > label { font-size: .77rem; color: #4f5a73; font-weight: 750; }
.single-time-values { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 13px; }
.single-time-values .form-field { margin-bottom: 16px; }
.single-time-heading:has(.next-day-field[hidden]) { grid-template-columns: 1fr 1fr; }
.next-day-field { min-width: 0; display: flex; align-items: center; justify-content: flex-end; }
.next-day-field[hidden] { display: none !important; }
.next-day-switch { min-height: 18px; padding: 0; border: 0; background: transparent; display: flex; align-items: center; gap: 5px; cursor: pointer; font-size: .68rem; font-weight: 750; color: #737c90; white-space: nowrap; }
.next-day-switch input { position: absolute; opacity: 0; pointer-events: none; }
.next-day-switch i { width: 28px; height: 17px; border-radius: 999px; background: #cfd5e1; position: relative; transition: background .16s; flex: 0 0 auto; }
.next-day-switch i::after { content: ""; position: absolute; width: 13px; height: 13px; left: 2px; top: 2px; border-radius: 50%; background: white; box-shadow: 0 1px 4px rgba(0,0,0,.18); transition: transform .16s; }
.next-day-switch input:checked + i { background: var(--blue); }
.next-day-switch input:checked + i::after { transform: translateX(11px); }
.repeat-field { border: 1px solid var(--line); border-radius: 15px; padding: 14px; margin: 2px 0 15px; }
.switch-label { display: flex; align-items: center; gap: 14px; cursor: pointer; }
.switch-label > span { flex: 1; }
.switch-label strong { display: block; font-size: .85rem; }
.switch-label small { display: block; color: var(--muted); margin-top: 2px; }
.switch-label input { position: absolute; opacity: 0; }
.switch-label i { width: 42px; height: 24px; border-radius: 20px; background: #d9dde6; position: relative; transition: background .18s; }
.switch-label i::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; background: white; top: 3px; left: 3px; box-shadow: 0 2px 6px rgba(0,0,0,.14); transition: transform .18s; }
.switch-label input:checked + i { background: var(--blue); }
.switch-label input:checked + i::after { transform: translateX(18px); }
.repeat-options { margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--line); }
.repeat-date-range { margin-top: 13px; }
.repeat-date-range .form-field { margin-bottom: 0; }
.repeat-slot-list { display: grid; gap: 8px; margin-top: 9px; }
.repeat-slot-row { display: grid; grid-template-columns: 72px 1fr 1fr 34px; gap: 7px; align-items: center; }
.repeat-slot-row select { min-width: 0; height: 40px; padding: 7px 8px; border: 1px solid #dfe3eb; border-radius: 10px; background: #fafbfc; }
.time-picker-native { position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; padding: 0 !important; opacity: 0; pointer-events: none; }
.time-picker-trigger { width: 100%; min-height: 46px; padding: 11px 34px 11px 12px; border: 1px solid #dfe3eb; border-radius: 12px; background: #fafbfc; color: var(--ink); cursor: pointer; text-align: left; font: inherit; position: relative; }
.time-picker-trigger::after { content: "⌄"; position: absolute; right: 12px; color: #778198; }
.repeat-slot-row .time-picker-trigger { min-width: 0; min-height: 40px; padding: 7px 24px 7px 8px; border-radius: 10px; }
.time-picker-popover { position: fixed; inset: auto; width: 224px; height: 278px; margin: 0; padding: 8px; border: 1px solid #d8deea; border-radius: 14px; background: #fff; color: var(--ink); box-shadow: 0 18px 48px rgba(16,24,47,.24); grid-template-columns: 72px 1fr; gap: 8px; z-index: 300; }
.time-picker-popover:popover-open { display: grid; }
.time-picker-hours { overflow-y: auto; padding-right: 4px; border-right: 1px solid #edf0f5; }
.time-picker-hours button, .time-picker-minutes button { width: 100%; border: 0; border-radius: 8px; background: transparent; color: #4f5a73; cursor: pointer; font: inherit; font-size: .76rem; font-weight: 750; }
.time-picker-hours button { min-height: 31px; }
.time-picker-hours button:hover, .time-picker-hours button:focus-visible, .time-picker-hours button.active { background: #eef2ff; color: #3152ca; outline: none; }
.time-picker-minutes { align-content: start; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 5px; overflow-y: auto; }
.time-picker-popover:has(.time-picker-hours[hidden]) { grid-template-columns: minmax(0,1fr); }
.time-picker-minutes .time-picker-back { grid-column: 1 / -1; }
.time-picker-minutes button { min-height: 36px; background: #f7f8fb; }
.time-picker-minutes button:hover, .time-picker-minutes button:focus-visible, .time-picker-minutes button.selected { background: var(--navy); color: #fff; outline: none; }
.repeat-slot-delete { width: 34px; height: 34px; border: 0; border-radius: 9px; background: #fff0ef; color: #b94b45; cursor: pointer; }
.repeat-slot-add { margin-top: 9px; min-height: 38px; }
.exception-current, .exception-history { margin-top: 13px; padding-top: 13px; border-top: 1px solid var(--line); }
.exception-history > span { color: #4f5a73; font-size: .77rem; font-weight: 750; }
#exceptionList { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.exception-date { border: 1px solid #d9deea; border-radius: 9px; padding: 6px 8px; background: #f5f7fb; color: #4f5a73; cursor: pointer; font-size: .72rem; }
.day-checks { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-top: 8px; }
.day-checks label { cursor: pointer; }
.day-checks input { position: absolute; opacity: 0; }
.day-checks span { display: grid; place-items: center; height: 33px; border-radius: 9px; background: #eff1f5; font-size: .76rem; font-weight: 750; }
.day-checks input:checked + span { background: var(--navy); color: white; }
.form-error { color: #c44b43; min-height: 20px; margin: 0 0 5px; font-size: .78rem; }
.modal-actions { margin-top: 11px; }
.action-spacer { flex: 1; }
.settings-preview { background: var(--navy); color: white; border-radius: 16px; padding: 15px 17px; margin-bottom: 18px; display: flex; justify-content: space-between; align-items: center; }
.settings-preview span { color: #b9c1d8; font-size: .76rem; }
.settings-preview strong { font-size: 1rem; }
.settings-help { margin: -2px 0 18px; color: var(--muted); font-size: .77rem; }
.theme-setting { margin: 2px 0 18px; padding: 14px 15px; border: 1px solid var(--line); border-radius: 14px; background: #f8f9fc; }
.date-range-row { padding-top: 3px; }
.type-picker { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 7px; }
.compact-button { min-height: 46px; padding: 8px 11px; white-space: nowrap; }
.color-field input[type="color"] { width: 72px; padding: 5px; cursor: pointer; }
.category-list { display: grid; gap: 9px; margin-bottom: 12px; }
.category-row { display: grid; grid-template-columns: 30px 42px minmax(0,1fr) auto; align-items: center; gap: 8px; }
.category-row.reordering { opacity: .45; }
.category-drag { width: 30px; height: 38px; border: 0; border-radius: 8px; background: #f1f3f7; color: #7b8498; cursor: grab; font-size: 1rem; letter-spacing: -3px; touch-action: none; }
.category-drag:active { cursor: grabbing; }
.category-row input[type="color"] { width: 42px; height: 42px; padding: 3px; border: 1px solid #dfe3eb; border-radius: 10px; background: #fafbfc; cursor: pointer; }
.category-row input[type="text"] { min-width: 0; height: 42px; padding: 9px 11px; border: 1px solid #dfe3eb; border-radius: 10px; background: #fafbfc; }
.category-delete { height: 38px; padding: 7px 10px; border: 0; border-radius: 9px; background: #fff0ef; color: #b94b45; cursor: pointer; font-weight: 750; }
.add-category-button { width: 100%; min-height: 42px; border: 1px dashed #cbd2df; border-radius: 11px; background: #f8f9fc; color: #4f5a73; cursor: pointer; font-weight: 800; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); border-radius: 12px; padding: 11px 16px; background: var(--navy); color: white; box-shadow: var(--shadow); font-size: .82rem; opacity: 0; pointer-events: none; transition: all .22s ease; z-index: 20; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.hover-tooltip { position: fixed; z-index: 160; width: min(280px, calc(100vw - 24px)); padding: 10px 12px; border-radius: 11px; background: #111a35; color: white; box-shadow: 0 12px 30px rgba(17,26,53,.28); pointer-events: none; white-space: pre-wrap; font-size: .76rem; line-height: 1.45; }
.hover-tooltip strong { display: block; margin-bottom: 3px; font-size: .8rem; }
.calendar-context-menu { position: fixed; z-index: 220; min-width: 132px; max-width: min(260px, calc(100vw - 16px)); max-height: 320px; overflow-y: auto; padding: 4px; border: 1px solid #dce1eb; border-radius: 9px; background: #fff; box-shadow: 0 14px 34px rgba(16,24,47,.2); }
.calendar-context-menu button { width: 100%; min-height: 32px; padding: 6px 9px; border: 0; border-radius: 7px; background: transparent; color: var(--ink); cursor: pointer; text-align: left; font-size: .75rem; font-weight: 750; }
.calendar-context-menu button:hover, .calendar-context-menu button:focus-visible { background: #eef2ff; color: #3152ca; outline: none; }
.month-picker-modal { width: min(390px, calc(100vw - 28px)); }

#eventForm .form-field > span { display: block; margin-bottom: 8px; font-size: .82rem; font-weight: 800; }
#eventForm .single-time-heading > span { font-size: .82rem; font-weight: 800; }
.time-picker-hours[hidden], .time-picker-minutes[hidden] { display: none; }

.time-picker-popover { grid-template-columns: 1fr; }
.time-picker-hours { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); border-right: 0; padding-right: 0; }
#eventForm .single-time-heading { grid-template-columns: 1fr 1fr; }
.changelog-layer.open:has(.history-menu:not([hidden])) ~ .hover-tooltip { z-index: 230; }

#eventDialog #manageTypesButton, #noteDialog #manageNoteTypesButton { min-height: 34px; align-self: end; padding: 7px 8px; font-size: .72rem; font-weight: 600; }

#eventDialog .repeat-field:has(#repeatOptions[hidden]) { display: none; }
#eventDialog[data-editor-mode="routine"] .repeat-field { border: 0; border-radius: 0; padding: 0; }
#eventDialog[data-editor-mode="routine"] .repeat-options { border: 0; margin-top: 0; padding-top: 0; }
body:has(#scratchpadDialog:not([hidden])) .toast { z-index: 250; transition: opacity .22s ease, transform .22s ease; }

.toast[popover] { inset: auto; left: 50%; bottom: 28px; margin: 0; border: 0; overflow: visible; z-index: 1100; transition: opacity .22s ease, transform .22s ease; }
