.shift-template-group {min-width:0;margin:.6rem 0;padding:0;border:0;background:transparent;border-radius:0;box-shadow:none;}
.shift-template-group h3 {font-size:1rem;margin:.75rem 0 .4rem;}
.shift-block-settings {margin:.75rem 0;}
.shift-block-settings label {display:block;margin:.5rem 0 .2rem;}
.shift-block-settings input[type=checkbox] {width:auto;}
.shift-block-settings fieldset {min-width:0;border:1px solid var(--line);border-radius:8px;margin:1rem 0;padding:.75rem;}
.shift-block-settings select,.shift-block-settings input {max-width:100%;min-height:44px;}
.shift-block-settings [hidden] {display:none;}

/* Calendar block editing and shared multiline details/list/print. */
#shift-dialog .shift-block-settings {min-width:0;border:1px solid var(--line);border-radius:8px;padding:.75rem;margin:.75rem 0;}
#shift-dialog .shift-block-settings label {display:block;}
#shift-dialog .shift-block-settings select,#shift-dialog .shift-block-settings input {width:100%;max-width:100%;min-width:0;}
#shift-dialog .shift-block-settings[hidden] {display:none;}
#calendar-service-description,.mobile-day-item>p:not(.mobile-day-note),.entry-line>span {white-space:pre-line;}
@media (min-width:1025px) {#planer .quick-split .quick-badge-full {display:block;white-space:pre-line;}}
@media (max-width:1024px) {#planer .quick-split {height:auto;max-height:none;}#planer .quick-split .quick-badge-time {display:block;line-height:1.2;font-variant-numeric:tabular-nums;white-space:normal;overflow:visible;}}

/* Readable privacy guidance shared by template forms and service notes. */
.privacy-input-hint {font-size:14px;color:var(--ink);line-height:1.5;white-space:normal;overflow-wrap:break-word;}
.template-health-notice {display:flex;align-items:flex-start;gap:10px;margin:16px 0;padding:12px;background:#F0EFED;border-radius:10px;color:#34383D;}
.template-health-notice>span:last-child {min-width:0;}
.template-health-icon {display:inline-flex;align-items:center;justify-content:center;flex:0 0 18px;height:18px;margin-top:1px;border:1px solid currentColor;border-radius:50%;font-size:12px;font-weight:600;line-height:1;}
#template-health-hint a {display:block;width:fit-content;max-width:100%;margin-top:4px;color:#0759B5;text-decoration:underline;text-underline-offset:3px;font-weight:600;}
#template-health-hint a:visited {color:#0759B5;}
#template-health-hint a:focus-visible {color:#003F87;outline:2px solid #0759B5;outline-offset:3px;border-radius:2px;}
@media (hover:hover) and (pointer:fine) {#template-health-hint a:hover {color:#003F87;text-decoration-thickness:2px;}}

/* Existing template form is reused inside the edit dialog. */
.template-edit-dialog {width:min(560px,calc(100% - 24px));max-height:calc(100dvh - 24px);overflow:auto;padding:24px;border:1px solid var(--line);border-radius:12px;background:#fff;color:var(--ink);}
.template-edit-dialog form {margin:0;min-width:0;}
.template-edit-dialog input,.template-edit-dialog select {width:100%;min-width:0;box-sizing:border-box;}
.template-edit-dialog input[type=checkbox] {width:auto;}
.template-edit-dialog .time-inputs {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;}
.template-edit-dialog #template-save,.template-edit-dialog #template-cancel {min-height:46px;margin-top:12px;}
@media(max-width:480px){.template-edit-dialog {padding:16px;}}

.shift-block-settings fieldset.single-shift {border:0;padding:0;margin:.75rem 0;}

/* Shared category controls: identification colors never replace service colors. */
.category-edit-dialog .category-dialog-actions {display:flex;flex-wrap:wrap;gap:8px;margin-top:16px;}
.category-edit-dialog .category-dialog-actions button {flex:1 1 130px;min-height:46px;white-space:normal;}
.category-edit-dialog input[type=color] {height:46px;}
.category-edit-dialog p {margin:12px 0;}
.category-edit-dialog [hidden],.category-management [hidden] {display:none!important;}
@media(max-width:480px){.category-edit-dialog {padding:16px;}}

/* Compact category and template management (narrow planner column, tablet, phone). */
.category-management {min-width:0;margin:.5rem 0 .25rem;}
.category-management h3 {font-size:1rem;margin:.25rem 0 .2rem;}
.category-help {margin:0 0 6px;font-size:13px;}
.category-help>summary {display:inline-flex;align-items:center;gap:6px;min-height:32px;cursor:pointer;color:var(--muted);font-weight:600;list-style:none;}
.category-help>summary::-webkit-details-marker {display:none;}
.category-help>summary::before {content:"i";display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;border:1px solid currentColor;border-radius:50%;font-size:11px;line-height:1;}
.category-help>summary:focus-visible {outline:2px solid var(--ink);outline-offset:2px;border-radius:4px;}
.category-help>.input-hint {margin:2px 0 6px;font-size:13px;line-height:1.45;}
.category-management>.button {min-height:36px;margin:4px 6px 4px 0;padding:6px 12px;font-size:13px;line-height:1.25;}
.category-marker {display:inline-block;width:10px;height:10px;flex:0 0 10px;border:1px solid #696A6B;border-radius:3px;vertical-align:middle;}

#template-list:has(>.category-row) {gap:0;}
#template-list>.category-row {display:block;margin:0;padding:2px 0;border:0;border-top:1px solid var(--line);border-radius:0;min-width:0;background:transparent;}
#template-list .category-header {display:flex;flex-wrap:nowrap;align-items:center;gap:2px;min-width:0;min-height:40px;}
#template-list .category-toggle {display:flex;align-items:center;gap:6px;flex:1 1 auto;min-width:0;min-height:40px;margin:0;padding:4px 4px 4px 2px;border:0;border-radius:8px;background:transparent;color:inherit;text-align:left;font:inherit;font-size:14px;font-weight:650;cursor:pointer;}
#template-list .category-arrow {flex:0 0 12px;font-size:12px;text-align:center;transform-origin:center;transition:transform .15s ease;}
#template-list .category-toggle[aria-expanded="true"] .category-arrow {transform:rotate(90deg);}
#template-list .category-name {display:flex;align-items:center;gap:6px;flex:1 1 auto;min-width:0;}
#template-list .category-title {min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
#template-list .category-name>.category-count {display:inline-flex;align-items:center;justify-content:center;flex:none;min-width:22px;height:20px;padding:0 7px;border-radius:999px;background:var(--design-surface,#E3E1DE);color:var(--ink);font-size:12px;font-weight:600;line-height:1;font-variant-numeric:tabular-nums;}
#template-list .category-templates {min-width:0;padding:0 0 6px;}
#template-list .category-templates[hidden] {display:none!important;}
#template-list .category-templates>.input-hint {margin:2px 0 4px;font-size:13px;}
#template-list .category-template-create {display:flex;align-items:center;justify-content:center;width:100%;min-height:36px;margin:2px 0 0;padding:4px 10px;border:1px dashed var(--line);border-radius:10px;background:transparent;color:var(--ink);font-size:13px;font-weight:600;box-shadow:none;}
#template-list .category-template-create::before {content:"+";margin-right:6px;font-size:15px;line-height:1;}

/* Template card: color stripe, name, service times and one action menu. */
#template-list .category-row .template-card {display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:2px;min-height:44px;margin:0 0 4px;padding:0 2px 0 0;border:0;border-radius:10px;background:var(--pale);box-shadow:none;overflow-wrap:anywhere;}
#template-list .category-row .template-card.template-selected {box-shadow:inset 0 0 0 2px var(--ink);background:var(--design-white,#fff);}
#template-list .category-row .template-select {display:block;width:100%;min-width:0;min-height:44px;margin:0;padding:0;border:0;border-radius:10px;background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer;}
#template-list .category-row .template-select:disabled {cursor:default;opacity:1;}
#template-list .category-row .template-card .template-info {display:grid;grid-template-columns:4px minmax(0,1fr);column-gap:8px;row-gap:1px;align-items:center;min-width:0;min-height:44px;padding:5px 4px 5px 6px;overflow-wrap:anywhere;}
#template-list .category-row .template-card .template-info .calendar-swatch {grid-column:1;grid-row:1 / span 3;align-self:stretch;width:4px;height:auto;min-height:28px;margin:0;border-radius:2px;display:block;}
#template-list .category-row .template-card .template-info>:not(.calendar-swatch) {grid-column:2;display:block;}
#template-list .category-row .template-card .template-info strong {font-size:13px;font-weight:600;line-height:1.3;}
#template-list .category-row .template-card .template-info>.template-times,#template-list .category-row .template-card .template-info>small {font-size:12px;line-height:1.3;color:var(--muted);font-variant-numeric:tabular-nums;white-space:normal;}
@media(hover:hover) and (pointer:fine) {#template-list .category-row .template-card:hover {background:var(--design-surface,#E3E1DE);}#template-list .category-row .template-card.template-selected:hover {background:var(--design-white,#fff);}#template-list .category-row .template-select:hover {color:inherit;}}
#template-list .category-row .template-select:focus-visible,#template-list .category-toggle:focus-visible {outline:2px solid var(--ink);outline-offset:2px;}

/* Action menu (category "⋯", template "⋮"). */
#template-list .action-menu {position:relative;flex:none;align-self:center;}
#template-list .action-menu-toggle {display:inline-flex;align-items:center;justify-content:center;width:36px;height:36px;min-height:0;margin:0;padding:0;border:0;border-radius:8px;background:transparent;color:var(--ink);font:inherit;font-size:20px;font-weight:700;line-height:1;cursor:pointer;}
#template-list .action-menu-toggle[aria-expanded="true"] {background:var(--design-surface,#E3E1DE);}
@media(hover:hover) and (pointer:fine) {#template-list .action-menu-toggle:hover {background:var(--design-surface,#E3E1DE);}#template-list .template-card:hover .action-menu-toggle:hover {background:var(--line);}}
#template-list .action-menu-toggle:focus-visible {outline:2px solid var(--ink);outline-offset:1px;}
#template-list .action-menu-toggle:disabled {opacity:.55;cursor:not-allowed;}
#template-list .action-menu .action-menu-panel {position:absolute;top:calc(100% + 4px);right:0;z-index:40;display:flex;flex-direction:column;flex-wrap:nowrap;align-items:stretch;justify-content:flex-start;gap:0;min-width:180px;max-width:min(240px,calc(100vw - 32px));padding:4px;border:1px solid var(--line);border-radius:10px;background:var(--design-white,#fff);box-shadow:0 8px 24px rgba(52,56,61,.16);overflow-y:auto;overscroll-behavior:contain;}
/* Low window heights: JS limits the menu height; entries keep their size and the menu scrolls. */
#template-list .action-menu .action-menu-panel>* {flex-shrink:0;}
#template-list .action-menu.opens-up .action-menu-panel {top:auto;bottom:calc(100% + 4px);}
#template-list .action-menu .action-menu-panel[hidden] {display:none!important;}
#template-list .action-menu .action-menu-panel:focus {outline:none;}
#template-list .action-menu .action-menu-title,#template-list .action-menu .action-menu-backdrop {display:none;}
#template-list .action-menu .action-menu-item {display:flex;align-items:center;width:100%;min-width:0;min-height:38px;margin:0;padding:8px 12px;border:0;border-radius:6px;background:transparent;color:var(--ink);font:inherit;font-size:14px;font-weight:500;line-height:1.25;text-align:left;white-space:nowrap;cursor:pointer;}
#template-list .action-menu .action-menu-item:focus-visible {outline:2px solid var(--ink);outline-offset:-2px;background:var(--pale);}
@media(hover:hover) and (pointer:fine) {#template-list .action-menu .action-menu-item:not(:disabled):hover {background:var(--pale);}}
#template-list .action-menu .action-menu-item.template-delete {color:#a13030;}
#template-list .action-menu .action-menu-item:disabled {color:var(--muted);opacity:.6;cursor:not-allowed;}
#template-list .action-menu .action-menu-separator {height:1px;margin:4px 6px;background:var(--line);}
#template-list .action-menu .action-menu-hint {margin:0 12px 6px;font-size:12px;line-height:1.35;color:var(--muted);white-space:normal;}

/* Touch devices (tablet and phone): larger hit areas, same layout. */
@media(pointer:coarse) {
 #template-list .action-menu-toggle {width:44px;height:44px;}
 #template-list .action-menu .action-menu-item {min-height:44px;}
 #template-list .category-header,#template-list .category-toggle {min-height:44px;}
 #template-list .category-template-create,.category-management>.button {min-height:44px;}
}

/* Phone: action menus become a bottom sheet. */
@media(max-width:480px) {
 #template-list .category-row .template-card {min-height:52px;}
 #template-list .category-row .template-card .template-info {min-height:52px;}
 #template-list .category-row .template-card .template-info strong {font-size:14px;}
 #template-list .category-row .template-card .template-info>.template-times {font-size:13px;}
 #template-list .action-menu.is-open .action-menu-backdrop {display:block;position:fixed;inset:0;z-index:1000;background:rgba(52,56,61,.42);}
 #template-list .action-menu .action-menu-panel,#template-list .action-menu.opens-up .action-menu-panel {position:fixed;top:auto;right:0;bottom:0;left:0;z-index:1001;width:auto;min-width:0;max-width:none;max-height:min(80vh,80dvh);overflow:auto;padding:6px 12px calc(12px + env(safe-area-inset-bottom,0px));border-width:1px 0 0;border-radius:16px 16px 0 0;box-shadow:0 -8px 24px rgba(52,56,61,.18);overscroll-behavior:contain;}
 #template-list .action-menu .action-menu-title {display:block;margin:0 0 4px;padding:14px 4px 10px;border-bottom:1px solid var(--line);overflow-wrap:anywhere;}
 #template-list .action-menu .action-menu-title::before {content:"";display:block;width:36px;height:4px;margin:-8px auto 12px;border-radius:2px;background:var(--line);}
 #template-list .action-menu .action-menu-title strong {display:block;font-size:15px;line-height:1.3;}
 #template-list .action-menu .action-menu-title span {display:block;margin-top:2px;font-size:13px;color:var(--muted);}
 #template-list .action-menu .action-menu-item {min-height:48px;padding:10px 8px;font-size:16px;}
 #template-list .action-menu .action-menu-hint {margin:0 8px 8px;font-size:13px;}
}
@media(prefers-reduced-motion:reduce) {#template-list .category-arrow {transition:none;}}

/* Shared pastel palette for templates (planner and account page) and own categories. */
.color-palette .color-choice {box-shadow:inset 0 0 0 1px rgba(52,56,61,.18);}
.color-palette .color-choice[aria-pressed="true"] {border-color:var(--ink,#34383D);box-shadow:inset 0 0 0 2px #fff,inset 0 0 0 3px rgba(52,56,61,.18);}
@media(hover:hover) and (pointer:fine) {.color-palette .color-choice:hover {box-shadow:inset 0 0 0 1px rgba(52,56,61,.18),0 0 0 3px rgba(107,92,240,.28);}}
.color-palette .color-choice.color-custom {outline:2px dashed #575A5D;outline-offset:2px;}
.color-palette .color-choice.color-custom:focus-visible {outline:3px solid var(--ink,#34383D);outline-offset:2px;}
.color-custom-hint {font-size:13px;line-height:1.4;color:var(--muted,#575A5D);margin:-4px 0 10px;}
.color-custom-hint[hidden] {display:none;}
@media(pointer:coarse) {.color-palette .color-choice {width:44px;height:44px;min-width:44px;}}
