:root {
    --page-gray: var(--cale-surface-page, #797979);
    --body-text: var(--cale-text-page, #25282e);
    --panel: var(--cale-surface-panel, #25282e);
    --panel-head: var(--cale-surface-panel-header, #30343a);
    --line: var(--cale-border-default, rgba(255, 255, 255, .14));
    --light: var(--cale-text-primary, #f2f3f5);
    --muted: var(--cale-text-secondary, #b8c0ca);
    --number: #c2c8d0;
    --accent: var(--cale-accent-primary, #2dd4bf);
    --accent-strong: var(--cale-accent-strong, #14b8a6);
    --panel-shadow: 0 10px 26px rgba(0, 0, 0, .24);
    --button-size: 120px;
    --button-height: 84px;
}

* { box-sizing: border-box; }

html { background: var(--page-gray); }

body {
    margin: 0;
    color: var(--body-text);
    background: var(--page-gray);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Arial, sans-serif;
}

button, input, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.page {
    width: min(96%, 2400px);
    min-height: 100vh;
    margin: 0 auto;
    padding: 10px 0 24px;
}

.date-line {
    display: flex;
    min-height: 26px;
    gap: 10px;
    align-items: baseline;
    justify-content: flex-end;
    color: var(--body-text);
    font-size: clamp(.72rem, 1.5vw, .85rem);
    font-variant-numeric: tabular-nums;
    letter-spacing: .015em;
}

#currentDate, #currentTime { display: inline-block; white-space: nowrap; }
#currentTime { width: 8ch; text-align: right; }

.header-banner {
    position: relative;
    z-index: 5;
    display: grid;
    grid-template-columns: repeat(3, 10.714%) 35.716% repeat(3, 10.714%);
    width: min(100%, 504px);
    height: clamp(64px, 17.86vw, 90px);
    margin: 10px auto 18px;
}

.header-action {
    position: relative;
    display: flex;
    min-width: 0;
    height: 100%;
    margin: 0;
    padding: 0;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    color: var(--accent);
    background: transparent;
    text-decoration: none;
    cursor: pointer;
    touch-action: manipulation;
    transition: background .15s ease, color .15s ease;
}

.header-action:hover, .header-action:focus {
    color: var(--accent-strong);
    background: rgba(37, 40, 46, .08);
    outline: none;
}

.header-action:focus-visible { box-shadow: inset 0 0 0 2px var(--body-text); }

.header-action.is-inactive {
    color: rgba(37, 40, 46, .35);
    cursor: default;
}

.header-action-icon {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}

.header-square-icon {
    display: block;
    width: clamp(24px, 5.4vw, 27px);
    height: clamp(24px, 5.4vw, 27px);
    border-radius: 6px;
    pointer-events: none;
}

.header-home {
    overflow: visible;
    color: #fff;
    font-size: clamp(1.65rem, 7.8vw, 2.45rem);
    font-weight: 600;
    letter-spacing: -.025em;
    white-space: nowrap;
}

.header-home:hover, .header-home:focus { color: #fff; }

.header-action[data-tooltip]::after {
    position: absolute;
    top: calc(100% + 5px);
    left: 50%;
    z-index: 10;
    max-width: min(230px, 80vw);
    padding: 6px 9px;
    border: 1px solid rgba(255, 255, 255, .19);
    border-radius: 7px;
    color: var(--light);
    background: var(--panel);
    box-shadow: var(--panel-shadow);
    content: attr(data-tooltip);
    font-size: .72rem;
    font-weight: 400;
    line-height: 1.25;
    opacity: 0;
    pointer-events: none;
    text-align: center;
    transform: translate(-50%, -4px);
    transition: opacity .12s ease, transform .12s ease;
    white-space: nowrap;
}

.header-action[data-tooltip]:hover::after,
.header-action[data-tooltip]:focus::after,
.header-action[data-tooltip]:active::after {
    opacity: 1;
    transform: translate(-50%, 0);
}

.content-panel {
    width: min(100%, 820px);
    min-height: 220px;
    margin: 12px auto;
    padding: clamp(18px, 3vw, 30px);
    border: 1px solid rgba(255, 255, 255, .19);
    border-radius: 12px;
    color: var(--light);
    background: var(--panel);
    box-shadow: var(--panel-shadow);
}

.test-phase-notice {
    display: flex;
    width: min(100%, 820px);
    margin: 0 auto 18px;
    padding: 10px 14px;
    gap: 5px 8px;
    align-items: baseline;
    justify-content: center;
    flex-wrap: wrap;
    border: 1px solid rgba(111, 73, 0, .62);
    border-radius: 10px;
    color: #2d2719;
    background: rgba(255, 230, 153, .72);
    box-shadow: 0 5px 14px rgba(0, 0, 0, .12);
    text-align: center;
    font-size: clamp(.72rem, 1.5vw, .85rem);
    line-height: 1.45;
}

.test-phase-notice strong { font-weight: 700; }
.test-phase-notice a {
    color: inherit;
    font-weight: 600;
    text-underline-offset: 2px;
}

.content-panel h1 {
    margin: 0 0 10px;
    font-size: clamp(1.2rem, 2.5vw, 1.55rem);
    font-weight: 500;
    text-align: center;
}

.content-panel h2 {
    margin: 0 0 10px;
    font-size: clamp(1.15rem, 2.3vw, 1.45rem);
    font-weight: 600;
    text-align: center;
}

.schedule-panel {
    width: min(100%, 1420px);
    margin: 12px auto;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .19);
    border-radius: 14px;
    color: var(--light);
    background: var(--cale-surface-calendar, #25282e);
    box-shadow: var(--panel-shadow);
}

.calendar-area-panel {
    border: 2px solid var(--calendar-area-color);
    box-shadow: var(--panel-shadow), inset 0 0 0 2px var(--calendar-area-color);
}

.base-calendar-panel {
    --calendar-area-color: var(--cale-calendar-base, #806d00);
}

.calendar-area-panel > .schedule-title-row {
    color: #ffffff;
    background: var(--calendar-area-color);
    border-bottom-color: rgba(255, 255, 255, .32);
}

.calendar-area-panel > .schedule-title-row .schedule-kicker {
    color: #ffffff;
}

.calendar-area-panel > .schedule-title-row .schedule-privacy {
    color: #ffffff;
    border-color: rgba(255, 255, 255, .7);
    background: rgba(0, 0, 0, .16);
}

.specialist-calendar-name {
    border-color: var(--calendar-area-color);
}

.specialist-calendar-dot {
    background: var(--calendar-area-color);
}

.specialist-topics {
    padding: 16px 20px 18px;
    border-bottom: 1px solid var(--line);
    background: #262a30;
}

.specialist-topics-heading {
    display: flex;
    gap: 14px;
    align-items: center;
    justify-content: space-between;
}

.specialist-topics-heading h2 {
    margin: 2px 0 0;
    font-size: 1rem;
    font-weight: 600;
}

.schedule-tool.specialist-master-button {
    min-width: 220px;
    border-color: var(--calendar-area-color);
    color: #ffffff;
    background: var(--calendar-area-color);
}

.schedule-tool.specialist-master-button.is-active {
    border-color: var(--calendar-area-color);
    box-shadow: 0 0 0 2px var(--calendar-area-color);
    color: #ffffff;
    background: var(--calendar-area-color);
}

.schedule-tool.specialist-master-button:hover,
.schedule-tool.specialist-master-button:focus-visible {
    border-color: var(--calendar-area-color);
    color: #ffffff;
    background: var(--calendar-area-color);
    filter: brightness(1.18);
}

.specialist-topic-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    width: min(100%, 620px);
    margin: 16px auto 0;
}

.specialist-topic-button {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 94px;
    padding: 20px 5px 8px;
    gap: 7px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--light);
    background: var(--panel-head);
    cursor: pointer;
    text-decoration: none;
    transition: transform .15s ease, border-color .15s ease, background .15s ease, box-shadow .15s ease;
}

.specialist-topic-button::before {
    position: absolute;
    top: 5px;
    left: 5px;
    color: var(--number);
    content: attr(data-number) "\A" attr(data-subnumber);
    font-size: 13px;
    font-weight: 800;
    line-height: .82;
    white-space: pre;
}

.specialist-topic-button:hover,
.specialist-topic-button:focus-visible {
    border-color: var(--calendar-area-icon-color);
    background: #353a41;
    outline: none;
    transform: translateY(-1px);
}

.specialist-topic-button.is-active {
    border-color: var(--calendar-area-icon-color);
    background: #353a41;
    box-shadow: 0 0 0 2px var(--calendar-area-icon-color);
}

.specialist-topic-icon {
    display: block;
    width: 32px;
    height: 32px;
    color: var(--calendar-area-icon-color);
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.specialist-topic-icon use {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.specialist-topic-button > span {
    overflow: hidden;
    max-width: 100%;
    font-size: 11px;
    line-height: 1.15;
    text-align: center;
    text-overflow: ellipsis;
}

.specialist-topic-status {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: .76rem;
    line-height: 1.4;
    text-align: center;
}

.schedule-title-row {
    display: flex;
    min-height: 74px;
    padding: 16px 20px;
    gap: 18px;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
}

.schedule-title-row h1 {
    margin: 2px 0 0;
    font-size: clamp(1.2rem, 2.5vw, 1.55rem);
    font-weight: 600;
}

.schedule-kicker {
    color: var(--accent);
    font-size: .72rem;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.schedule-privacy {
    padding: 6px 10px;
    border: 1px solid rgba(45, 212, 191, .38);
    border-radius: 999px;
    color: var(--accent);
    background: rgba(45, 212, 191, .07);
    font-size: .74rem;
    white-space: nowrap;
}

.schedule-toolbar {
    display: grid;
    grid-template-columns: minmax(210px, 1fr) minmax(240px, 1.4fr) minmax(270px, 1fr);
    min-height: 58px;
    padding: 9px 12px;
    gap: 12px;
    align-items: center;
    border-bottom: 1px solid var(--line);
    background: var(--panel-head);
}

.schedule-navigation,
.schedule-view-switch {
    display: flex;
    gap: 6px;
}

.schedule-view-switch { justify-content: flex-end; }

.schedule-tool {
    min-height: 36px;
    padding: 7px 13px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 8px;
    color: var(--light);
    background: var(--cale-button-secondary, rgba(255, 255, 255, .025));
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, transform .15s ease;
}

.schedule-tool:hover,
.schedule-tool:focus-visible {
    border-color: var(--accent);
    background: rgba(45, 212, 191, .08);
    outline: none;
}

.schedule-tool:active { transform: translateY(1px); }
.schedule-tool.is-active {
    border-color: var(--cale-button-primary, #2dd4bf);
    color: var(--panel);
    background: var(--cale-button-primary, #2dd4bf);
    font-weight: 700;
}

.schedule-arrow { min-width: 40px; padding-inline: 8px; font-size: 1.1rem; }
.specialist-schedule-context {
    display: flex;
    min-width: 0;
    gap: 12px;
    align-items: baseline;
    justify-content: center;
}

.specialist-context-label {
    color: var(--calendar-area-icon-color);
    font-size: .78rem;
    font-weight: 700;
    white-space: nowrap;
}

.schedule-range { text-align: center; font-size: .95rem; }

.specialist-calendar-view[hidden],
.specialist-tool-view[hidden] {
    display: none;
}

.specialist-tool-view {
    display: grid;
    min-height: 320px;
    padding: 42px 20px;
    place-items: center;
    align-content: center;
    border-top: 1px solid var(--line);
    text-align: center;
}

.specialist-tool-view h2 {
    margin: 6px 0 10px;
    font-size: 1.25rem;
}

.specialist-tool-view p {
    max-width: 560px;
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.schedule-legend {
    display: flex;
    min-height: 38px;
    padding: 8px 16px;
    gap: 8px 18px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: .72rem;
}

.schedule-legend span { display: inline-flex; gap: 6px; align-items: center; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cale-status-private1, #00e5a3); }
.legend-dot.is-private1 { background: var(--cale-status-private1, #00e5a3); }
.legend-dot.is-private2 { background: var(--cale-status-private2, #448aff); }
.legend-dot.is-private3 { background: var(--cale-status-private3, #ffa400); }
.legend-dot.is-other { background: var(--cale-status-other, #e040fb); }
.legend-dot.is-level1 { background: var(--cale-status-level1, #00ff00); }
.legend-dot.is-level2 { background: var(--cale-status-level2, #0000ff); }
.legend-dot.is-level3 { background: var(--cale-status-level3, #ffff00); }
.legend-dot.is-important { background: var(--cale-status-important, #e73838); }
.legend-dot.is-done { background: var(--cale-status-done, #b0b8c4); }
.legend-blocking {
    width: 18px;
    height: 10px;
    border: 1px solid var(--cale-status-blocked, #00e5a3);
    border-radius: 2px;
    background: repeating-linear-gradient(135deg, #27605a 0 3px, #343b42 3px 6px);
}
.legend-line { width: 18px; height: 2px; background: var(--cale-status-current-time, #f87171); }

.schedule-stage {
    position: relative;
    min-height: 520px;
    max-height: 680px;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-color: #59606b var(--panel);
}

.appointment-editor-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    padding: 20px;
    place-items: center;
    background: rgba(18, 20, 24, .72);
    backdrop-filter: blur(3px);
}

.appointment-editor-overlay[hidden] { display: none; }

.appointment-editor {
    width: min(100%, 680px);
    max-height: calc(100vh - 40px);
    padding: clamp(18px, 3vw, 28px);
    overflow: auto;
    border: 1px solid rgba(45, 212, 191, .42);
    border-radius: 14px;
    color: var(--light);
    background: var(--panel);
    box-shadow: 0 24px 70px rgba(0, 0, 0, .5);
}

.appointment-editor.is-birthday-editor { width: min(100%, 920px); }
.appointment-editor-grid[hidden],
.appointment-options[hidden],
.birthday-editor-fields[hidden] { display: none; }

.birthday-editor-fields {
    display: grid;
    gap: 18px;
}

.birthday-accordion-stack {
    display: grid;
    gap: 10px;
}

.birthday-accordion {
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 10px;
    background: rgba(255, 255, 255, .025);
}

.birthday-accordion > summary {
    display: grid;
    position: relative;
    min-height: 58px;
    padding: 12px 48px 12px 14px;
    cursor: pointer;
    list-style: none;
    align-content: center;
    gap: 3px;
    color: var(--light);
    user-select: none;
}

.birthday-accordion > summary::-webkit-details-marker { display: none; }
.birthday-accordion > summary::marker { content: ""; }

.birthday-accordion > summary::after {
    position: absolute;
    top: 50%;
    right: 17px;
    width: 10px;
    height: 10px;
    border-right: 2px solid var(--calendar-area-color, var(--accent));
    border-bottom: 2px solid var(--calendar-area-color, var(--accent));
    content: "";
    transform: translateY(-70%) rotate(45deg);
    transition: transform .18s ease;
}

.birthday-accordion[open] > summary {
    border-bottom: 1px solid rgba(255, 255, 255, .1);
    background: rgba(255, 255, 255, .035);
}

.birthday-accordion[open] > summary::after {
    transform: translateY(-30%) rotate(225deg);
}

.birthday-accordion > summary:hover,
.birthday-accordion > summary:focus-visible {
    background: rgba(255, 255, 255, .055);
}

.birthday-accordion > summary:focus-visible {
    outline: 2px solid var(--calendar-area-color, var(--accent));
    outline-offset: -3px;
}

.birthday-accordion > summary > span {
    font-size: .92rem;
    font-weight: 700;
}

.birthday-accordion > summary > small {
    color: var(--muted);
    font-size: .72rem;
    font-weight: 400;
}

.birthday-accordion:not([open]) > summary {
    color: var(--panel);
    background: var(--accent);
}

.birthday-accordion:not([open]) > summary > small {
    color: rgba(32, 36, 43, .82);
}

.birthday-accordion:not([open]) > summary::after {
    border-color: var(--panel);
}

.birthday-accordion:not([open]) > summary:hover,
.birthday-accordion:not([open]) > summary:focus-visible {
    background: #5eead4;
}

.birthday-accordion-content {
    padding: 14px;
}

.birthday-section-heading {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    justify-content: space-between;
}

.birthday-section-heading h3,
.birthday-history-card h3 {
    margin: 3px 0 0;
    color: var(--light);
    font-size: 1rem;
}

.birthday-year-badge {
    padding: 6px 10px;
    border: 1px solid var(--calendar-area-color, var(--accent));
    border-radius: 999px;
    color: var(--light);
    font-size: .72rem;
    white-space: nowrap;
}

.birthday-editor-grid,
.birthday-history-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.birthday-field-name { grid-column: span 2; }
.birthday-field-wide { grid-column: 1 / -1; }
.appointment-field small { color: #8f98a3; font-weight: 400; }

.birthday-number-unit {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
}

.birthday-relationship-combo {
    display: grid;
    gap: 7px;
}

.birthday-relationship-combo input[hidden] { display: none; }

.birthday-number-unit em {
    color: var(--muted);
    font-style: normal;
}

.birthday-history-card { display: grid; gap: 5px; }

.birthday-history-card p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: .75rem;
}

.schedule-all-day-more {
    display: block;
    padding: 3px 5px;
    color: var(--muted);
    font-size: .66rem;
}

.appointment-editor-heading {
    display: flex;
    margin-bottom: 20px;
    gap: 18px;
    align-items: flex-start;
    justify-content: space-between;
}

.appointment-editor-heading h2 {
    margin: 3px 0 0;
    font-size: 1.35rem;
    font-weight: 600;
}

.appointment-editor-close {
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
    background: var(--panel-head);
    cursor: pointer;
    font-size: 1.4rem;
    line-height: 1;
}

.appointment-editor-close:hover,
.appointment-editor-close:focus-visible {
    border-color: var(--accent);
    color: var(--accent);
    outline: none;
}

.appointment-editor-grid {
    display: grid;
    grid-template-columns: 1.35fr 1fr 1fr 1fr;
    gap: 12px;
}

.appointment-field {
    display: grid;
    min-width: 0;
    gap: 6px;
    color: var(--muted);
    font-size: .76rem;
}

.appointment-field-wide { grid-column: 1 / -1; }
.appointment-field-topic,
.appointment-field-status { grid-column: span 2; }

.appointment-field input,
.appointment-field textarea,
.appointment-field select {
    width: 100%;
    min-width: 0;
    padding: 10px 11px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 8px;
    color: var(--light);
    background: var(--panel-head);
    outline: none;
}

.appointment-field textarea { resize: vertical; line-height: 1.45; }

.appointment-field input:focus,
.appointment-field textarea:focus,
.appointment-field select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(45, 212, 191, .13);
}

.appointment-field input:disabled {
    color: #8f98a3;
    background: #292d33;
}

.appointment-options {
    display: flex;
    margin-top: 14px;
    gap: 18px;
    align-items: center;
    color: var(--muted);
    font-size: .8rem;
}

.appointment-options label { display: inline-flex; gap: 7px; align-items: center; cursor: pointer; }
.appointment-options input { accent-color: var(--accent); }

.appointment-editor-message {
    min-height: 19px;
    margin: 12px 0 0;
    color: #f5b942;
    font-size: .76rem;
}

.appointment-overlap-prompt {
    margin: 0 0 14px;
    padding: 12px;
    border: 1px solid rgba(245, 185, 66, .48);
    border-radius: 9px;
    color: var(--light);
    background: rgba(245, 185, 66, .09);
}

.appointment-overlap-prompt[hidden] { display: none; }
.appointment-overlap-prompt p { margin: 0 0 10px; font-size: .82rem; }
.appointment-overlap-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.appointment-overlap-confirm { border-color: #f5b942; color: #f5b942; }

.appointment-editor-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.specialist-calendar-panel .appointment-editor-actions {
    grid-template-columns: minmax(170px, 1.45fr) repeat(3, minmax(0, 1fr));
}

.specialist-calendar-panel .appointment-editor-actions:has(.appointment-delete[hidden]) {
    grid-template-columns: minmax(190px, 1.55fr) repeat(2, minmax(0, 1fr));
}

.appointment-topic-overview {
    border-color: var(--calendar-area-color, var(--accent));
    color: var(--light);
}

.appointment-topic-overview:disabled {
    border-color: var(--line);
    color: var(--muted);
    cursor: not-allowed;
    opacity: .62;
}

.appointment-save {
    border-color: var(--cale-button-primary, #2dd4bf);
    color: var(--panel);
    background: var(--cale-button-primary, #2dd4bf);
    font-weight: 700;
}

.related-module-links {
    display: flex;
    width: min(100%, 1040px);
    margin: 10px auto 18px;
    justify-content: flex-end;
}

.related-module-links a {
    display: inline-flex;
    padding: 9px 12px;
    gap: 8px;
    align-items: baseline;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--light);
    background: var(--panel-head);
    text-decoration: none;
}

.related-module-links a:hover,
.related-module-links a:focus-visible { border-color: var(--calendar-area-icon-color, #448aff); outline: none; }
.related-module-links small { color: var(--muted); }

.specialist-topic-button.status-prepared {
    cursor: default;
    opacity: .78;
}

.specialist-topic-button.status-prepared:hover,
.specialist-topic-button.status-prepared:focus-visible {
    border-color: var(--line);
    background: var(--panel-head);
    transform: none;
}

.specialist-topic-state {
    color: var(--muted);
    font-size: 8px;
    line-height: 1.1;
    text-align: center;
}

.appointment-save:hover,
.appointment-save:focus-visible {
    border-color: var(--accent);
    color: var(--panel);
    background: var(--cale-button-primary-hover, #5eead4);
}

.appointment-delete { border-color: rgba(248, 113, 113, .5); color: #fca5a5; }

.schedule-time-grid.is-day .schedule-hour-cell {
    cursor: crosshair;
}

.schedule-empty {
    display: grid;
    min-height: 120px;
    padding: 18px;
    place-items: center;
    color: var(--muted);
    text-align: center;
}

.schedule-time-grid {
    position: relative;
    display: grid;
    min-width: 720px;
    grid-template-columns: 64px repeat(var(--schedule-days), minmax(130px, 1fr));
    background: var(--panel);
}

.schedule-time-grid.is-week {
    min-width: 100%;
    grid-template-columns: clamp(34px, 8vw, 64px) repeat(7, minmax(0, 1fr));
}

.schedule-time-grid.is-week .schedule-day-head,
.schedule-time-grid.is-week .schedule-hour-cell {
    cursor: pointer;
    touch-action: manipulation;
}

.schedule-corner,
.schedule-day-head {
    position: sticky;
    top: 0;
    z-index: 5;
    min-height: 58px;
    padding: 9px 6px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: var(--cale-surface-calendar-alternate, #2b2f35);
    text-align: center;
}

.schedule-corner { left: 0; z-index: 7; }
.schedule-day-head strong,
.schedule-day-head span { display: block; }
.schedule-day-head strong { margin-top: 2px; font-size: 1rem; }
.schedule-day-head span { color: var(--muted); font-size: .7rem; }
.schedule-day-head.is-selected { box-shadow: inset 0 3px 0 var(--accent); }
.schedule-day-head.is-today strong { color: var(--cale-accent-today, #2dd4bf); }

.schedule-time-label {
    position: sticky;
    left: 0;
    z-index: 3;
    height: 56px;
    padding: 7px 9px 0 4px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    color: var(--muted);
    background: #292d33;
    font-size: .7rem;
    text-align: right;
}

.schedule-hour-cell {
    position: relative;
    height: 56px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    background-image: linear-gradient(to bottom, transparent 49%, rgba(255,255,255,.035) 50%, transparent 51%);
}

.schedule-hour-cell.is-today { background-color: rgba(45, 212, 191, .025); }

.schedule-now-line {
    position: absolute;
    right: 0;
    left: 0;
    z-index: 4;
    height: 2px;
    background: var(--cale-status-current-time, #f87171);
    box-shadow: 0 0 6px rgba(248, 113, 113, .45);
    pointer-events: none;
}

.schedule-now-line::before {
    position: absolute;
    top: -3px;
    left: -4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--cale-status-current-time, #f87171);
    content: "";
}

.schedule-event {
    --event-color: var(--cale-status-private1, #00e5a3);
    position: absolute;
    z-index: 2;
    top: var(--event-top, 4px);
    right: auto;
    left: calc(var(--event-left, 0%) + 5px);
    width: calc(var(--event-width, 100%) - 10px);
    height: var(--event-height, 36px);
    min-height: 36px;
    padding: 6px 7px 5px 9px;
    overflow: hidden;
    border: 1px solid var(--event-color);
    border-left: 3px solid var(--event-color);
    border-radius: 6px;
    color: var(--light);
    background: var(--cale-surface-event, #343b42);
    box-shadow: 0 4px 10px rgba(0,0,0,.17);
    font-size: .7rem;
    line-height: 1.25;
    text-align: left;
    cursor: pointer;
}

.schedule-event:hover,
.schedule-event:focus-visible { z-index: 6; }

.schedule-event.is-private1 { --event-color: var(--cale-status-private1, #00e5a3); }
.schedule-event.is-private2 { --event-color: var(--cale-status-private2, #448aff); }
.schedule-event.is-private3 { --event-color: var(--cale-status-private3, #ffa400); }
.schedule-event.is-other { --event-color: var(--cale-status-other, #e040fb); }
.schedule-event.is-level1 { --event-color: var(--cale-status-level1, #00ff00); }
.schedule-event.is-level2 { --event-color: var(--cale-status-level2, #0000ff); }
.schedule-event.is-level3 { --event-color: var(--cale-status-level3, #ffff00); }
.schedule-event.is-important { --event-color: var(--cale-status-important, #e73838); }
.schedule-event.is-done { --event-color: var(--cale-status-done, #b0b8c4); opacity: .72; }
.schedule-event.is-blocking {
    background: repeating-linear-gradient(
        135deg,
        color-mix(in srgb, var(--cale-status-blocked, var(--event-color)) 24%, var(--cale-surface-event, #343b42)) 0 7px,
        var(--cale-surface-event, #343b42) 7px 14px
    );
}
.schedule-event.is-nonblocking { border-style: dashed; }
.schedule-event-time { display: block; color: var(--event-color); font-weight: 700; }

.schedule-all-day-row {
    display: grid;
    min-width: 720px;
    grid-template-columns: 64px repeat(var(--schedule-days), minmax(130px, 1fr));
    border-bottom: 1px solid var(--line);
    background: #292d33;
}

.schedule-all-day-row.is-week {
    min-width: 100%;
    grid-template-columns: clamp(34px, 8vw, 64px) repeat(7, minmax(0, 1fr));
}

.schedule-all-day-label {
    position: sticky;
    left: 0;
    z-index: 4;
    padding: 8px 5px;
    border-right: 1px solid var(--line);
    color: var(--muted);
    background: #292d33;
    font-size: .62rem;
    text-align: center;
}

.schedule-all-day-cell { min-height: 40px; padding: 4px; border-right: 1px solid var(--line); }
.schedule-all-day-item {
    padding: 4px 6px;
    overflow: hidden;
    border-radius: 5px;
    color: var(--light);
    background: rgba(45, 212, 191, .16);
    font-size: .68rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

button.schedule-all-day-item {
    width: 100%;
    border: 0;
    text-align: left;
    cursor: pointer;
}

.schedule-month {
    display: grid;
    min-width: 100%;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.schedule-month-weekday {
    position: sticky;
    top: 0;
    z-index: 4;
    padding: 10px 6px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    background: var(--cale-surface-calendar-alternate, #2b2f35);
    font-size: .72rem;
    text-align: center;
}

.schedule-month-day {
    min-height: 112px;
    padding: 7px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: var(--cale-surface-calendar, #25282e);
    cursor: pointer;
}

.schedule-month-day:hover { background: #2b3036; }
.schedule-month-day.is-outside { color: #777f89; background: #22262b; }
.schedule-month-day.is-selected { box-shadow: inset 0 0 0 2px var(--accent); }
.schedule-month-day.is-today .schedule-month-number { color: var(--panel); background: var(--cale-accent-today, #2dd4bf); }
.schedule-month-number {
    display: inline-grid;
    width: 25px;
    height: 25px;
    margin-bottom: 5px;
    place-items: center;
    border-radius: 50%;
    font-size: .76rem;
    font-weight: 700;
}

.schedule-month-entry {
    --event-color: var(--cale-status-private1, #00e5a3);
    display: block;
    margin: 2px 0;
    padding: 3px 5px;
    overflow: hidden;
    border-left: 2px solid var(--event-color);
    border-radius: 3px;
    color: var(--light);
    background: var(--cale-surface-event-compact, #343a41);
    font-size: .64rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.schedule-month-entry.is-private1 { --event-color: var(--cale-status-private1, #00e5a3); }
.schedule-month-entry.is-private2 { --event-color: var(--cale-status-private2, #448aff); }
.schedule-month-entry.is-private3 { --event-color: var(--cale-status-private3, #ffa400); }
.schedule-month-entry.is-other { --event-color: var(--cale-status-other, #e040fb); }
.schedule-month-entry.is-level1 { --event-color: var(--cale-status-level1, #00ff00); }
.schedule-month-entry.is-level2 { --event-color: var(--cale-status-level2, #0000ff); }
.schedule-month-entry.is-level3 { --event-color: var(--cale-status-level3, #ffff00); }
.schedule-month-entry.is-important { --event-color: var(--cale-status-important, #e73838); }
.schedule-month-entry.is-done { --event-color: var(--cale-status-done, #b0b8c4); opacity: .7; }
.schedule-month-entry.is-blocking {
    background: repeating-linear-gradient(
        135deg,
        color-mix(in srgb, var(--cale-status-blocked, var(--event-color)) 22%, var(--cale-surface-event-compact, #343a41)) 0 5px,
        var(--cale-surface-event-compact, #343a41) 5px 10px
    );
}
.schedule-month-entry.is-nonblocking { border-left-style: dashed; }
.schedule-month-more { color: var(--muted); font-size: .62rem; }

.output-panel { min-height: 0; }

.content-panel p {
    margin: 0 auto;
    color: var(--muted);
    font-size: .86rem;
    line-height: 1.55;
    text-align: center;
}

.info-document {
    width: min(100%, 980px);
    min-height: 0;
}

.info-document p {
    margin: 0;
    color: var(--muted);
    font-size: clamp(.84rem, 1.7vw, .94rem);
    line-height: 1.65;
    text-align: left;
}

.info-document p + p { margin-top: 12px; }

.info-lead {
    max-width: 760px;
    margin: 0 auto !important;
    color: var(--light) !important;
    font-size: clamp(.94rem, 2vw, 1.06rem) !important;
    text-align: center !important;
}

.info-meta {
    margin-top: 10px !important;
    color: var(--muted) !important;
    font-size: .76rem !important;
    text-align: center !important;
}

.info-section {
    margin-top: 24px;
    padding-top: 22px;
    border-top: 1px solid var(--line);
}

.info-section h2 {
    margin: 0 0 11px;
    color: var(--light);
    font-size: clamp(1.02rem, 2vw, 1.22rem);
    font-weight: 600;
    text-align: left;
}

.info-section h3 {
    margin: 18px 0 8px;
    color: var(--light);
    font-size: .94rem;
    font-weight: 600;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
    gap: 12px;
    margin-top: 14px;
}

.info-card {
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel-head);
}

.info-card h3 { margin: 0 0 7px; }
.info-card p { font-size: .83rem; }

.info-list {
    margin: 10px 0 0;
    padding-left: 20px;
    color: var(--muted);
    font-size: clamp(.84rem, 1.7vw, .94rem);
    line-height: 1.6;
}

.info-list li + li { margin-top: 7px; }

.info-callout {
    margin-top: 18px;
    padding: 14px 16px;
    border: 1px solid rgba(45, 212, 191, .42);
    border-radius: 10px;
    color: var(--light);
    background: rgba(45, 212, 191, .08);
}

.info-callout strong {
    display: block;
    margin-bottom: 5px;
}

.info-callout p { color: var(--light); }

.info-callout.is-warning {
    border-color: rgba(255, 201, 80, .5);
    background: rgba(255, 201, 80, .09);
}

.info-callout.is-required {
    border-color: rgba(231, 56, 56, .58);
    background: rgba(231, 56, 56, .09);
}

.info-definition {
    display: grid;
    grid-template-columns: minmax(150px, .7fr) minmax(0, 1.7fr);
    gap: 8px 16px;
    margin: 12px 0 0;
}

.info-definition dt {
    color: var(--light);
    font-size: .85rem;
    font-weight: 600;
}

.info-definition dd {
    margin: 0;
    color: var(--muted);
    font-size: .85rem;
    line-height: 1.55;
}

.info-document a {
    color: var(--accent);
    text-underline-offset: 2px;
}

.legal-field-missing {
    display: inline-block;
    padding: 2px 5px;
    border-radius: 4px;
    color: #ffe8a6;
    background: rgba(255, 201, 80, .14);
    font-weight: 600;
}

@media (max-width: 560px) {
    .info-definition { grid-template-columns: 1fr; gap: 3px; }
    .info-definition dd + dt { margin-top: 8px; }
}

.context-status { margin-top: 15px !important; }
.context-status a { color: var(--accent); }

.button-group { margin: 24px auto 0; }
.button-group + .button-group { margin-top: 8px; }

.icon-row {
    display: grid;
    grid-template-columns: repeat(4, var(--button-size));
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.image-button {
    position: relative;
    display: flex;
    width: var(--button-size);
    height: var(--button-height);
    padding: 8px 4px;
    gap: 6px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--light);
    background: var(--panel-head);
    text-decoration: none;
    cursor: pointer;
    transition: transform .15s ease, background .15s ease, border-color .15s ease;
}

.image-button::before {
    position: absolute;
    top: 4px;
    left: 4px;
    color: var(--number);
    content: attr(data-number);
    font-size: 16px;
    font-weight: 800;
    line-height: 1;
}

.image-button[data-subnumber]::before {
    content: attr(data-number) "\A" attr(data-subnumber);
    line-height: .85;
    white-space: pre;
}

.image-button:hover, .image-button:focus-visible {
    border-color: rgba(255, 255, 255, .19);
    background: #383c43;
    outline: none;
    transform: translateY(-1px);
}

.image-button:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.function-icon { display: block; width: 32px; height: 32px; }
.image-button-label { font-size: 11.5px; line-height: 1.2; white-space: nowrap; }

.footer-navigation {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    width: min(100%, 820px);
    margin: 16px auto 0;
}

.portal-navigation {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: min(100%, 820px);
    margin: 16px auto 0;
}

.portal-navigation + .footer-navigation {
    margin-top: 8px;
}

.footer-button {
    display: flex;
    min-height: 36px;
    padding: 6px 10px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 8px;
    color: var(--body-text);
    background: rgba(255, 255, 255, .025);
    font-weight: 500;
    text-decoration: none;
    transition: transform .16s ease, background .16s ease, border-color .16s ease;
}

.footer-button:hover, .footer-button:focus-visible {
    border-color: var(--body-text);
    background: rgba(37, 40, 46, .08);
    outline: none;
    transform: translateY(-1px);
}

.footer-safety-navigation {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: min(100%, 440px);
    margin: 24px auto 0;
    border-radius: 8px;
    background: #797979;
}

.footer-safety-button {
    display: flex;
    min-height: 36px;
    padding: 6px 10px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 8px;
    color: #25282e;
    background: rgba(255, 255, 255, .025);
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0;
    text-align: center;
    text-decoration: none;
    transition: transform .16s ease, background .16s ease, border-color .16s ease;
}

.footer-safety-button:hover,
.footer-safety-button:focus-visible {
    color: #25282e;
    background: rgba(37, 40, 46, .08);
    border-color: #25282e;
    transform: translateY(-1px);
}

.footer-safety-button:focus-visible {
    outline: 2px solid #25282e;
    outline-offset: 2px;
}

@media (max-width: 560px) {
    :root {
        --button-size: min(22vw, 112px);
        --button-height: min(19.5vw, 99px);
    }
    .page { width: calc(100% - 12px); }
    .icon-row { gap: 5px; }
    .image-button-label { font-size: clamp(7px, 2vw, 10px); }
    .footer-navigation { grid-template-columns: 1fr 1fr; }
    .footer-safety-navigation { width: min(100%, 440px); }
    .schedule-title-row { align-items: flex-start; flex-direction: column; gap: 10px; }
    .schedule-privacy { align-self: flex-start; white-space: normal; text-align: center; }
    .specialist-topics { padding: 14px 8px 16px; }
    .specialist-topics-heading { align-items: stretch; flex-direction: column; }
    .specialist-master-button { width: 100%; min-width: 0; }
    .specialist-topic-grid { gap: 5px; }
    .specialist-topic-button { min-height: 82px; padding: 19px 2px 6px; gap: 5px; }
    .specialist-topic-button::before { top: 4px; left: 4px; font-size: 11px; }
    .specialist-topic-icon { width: 27px; height: 27px; }
    .specialist-topic-button > span { font-size: clamp(7px, 2.25vw, 10px); }
    .schedule-toolbar { grid-template-columns: 1fr; }
    .schedule-navigation,
    .schedule-view-switch { justify-content: center; }
    .specialist-schedule-context {
        grid-row: 1;
        flex-direction: column;
        gap: 2px;
        align-items: center;
    }
    .schedule-legend { justify-content: flex-start; overflow-x: auto; white-space: nowrap; }
    .schedule-stage {
        min-height: 480px;
        max-height: 620px;
        overscroll-behavior-y: auto;
    }

    .schedule-stage[data-view="day"] {
        min-height: 360px;
        max-height: 465px;
    }

    /* Die Tagesansicht darf auf Smartphones keine Desktop-Mindestbreite
       behalten. Zeitspalte und Tagesfläche teilen sich immer die
       tatsächlich verfügbare Breite. */
    .schedule-time-grid.is-day,
    .schedule-all-day-row.is-day {
        width: 100%;
        min-width: 100%;
        grid-template-columns: clamp(42px, 13vw, 56px) minmax(0, 1fr);
    }

    .schedule-time-grid.is-day .schedule-corner,
    .schedule-time-grid.is-day .schedule-day-head {
        min-height: 50px;
        padding: 7px 3px;
    }

    .schedule-time-grid.is-day .schedule-time-label {
        padding-right: 4px;
        font-size: .58rem;
    }

    .schedule-all-day-row.is-day .schedule-all-day-label {
        padding: 8px 2px;
        overflow: hidden;
        font-size: .55rem;
    }

    .schedule-time-grid.is-day .schedule-event {
        left: calc(var(--event-left, 0%) + 3px);
        width: calc(var(--event-width, 100%) - 6px);
    }

    .schedule-time-grid.is-week,
    .schedule-all-day-row.is-week {
        min-width: 100%;
        grid-template-columns: clamp(34px, 8vw, 64px) repeat(7, minmax(0, 1fr));
    }

    .schedule-time-grid.is-week .schedule-corner,
    .schedule-time-grid.is-week .schedule-day-head {
        min-height: 48px;
        padding: 7px 1px;
    }

    .schedule-time-grid.is-week .schedule-day-head span {
        font-size: 0;
    }

    .schedule-time-grid.is-week .schedule-day-head span::after {
        color: var(--muted);
        content: attr(data-short);
        font-size: .58rem;
    }

    .schedule-time-grid.is-week .schedule-day-head strong {
        font-size: .64rem;
        letter-spacing: -.04em;
    }

    .schedule-time-grid.is-week .schedule-time-label {
        padding: 7px 3px 0 0;
        font-size: .52rem;
    }

    .schedule-all-day-row.is-week .schedule-all-day-label {
        padding: 7px 1px;
        overflow: hidden;
        font-size: 0;
    }

    .schedule-all-day-row.is-week .schedule-all-day-label::after {
        content: "Tag";
        font-size: .5rem;
    }

    .schedule-all-day-row.is-week .schedule-all-day-cell { padding: 3px 2px; }
    .schedule-all-day-row.is-week .schedule-all-day-item {
        min-height: 7px;
        padding: 0;
        font-size: 0;
    }

    .schedule-time-grid.is-week .schedule-hour-cell { overflow: visible; }
    .schedule-time-grid.is-week .schedule-event {
        top: var(--event-top, 4px);
        right: auto;
        left: calc(var(--event-left, 0%) + 2px);
        width: calc(var(--event-width, 100%) - 4px);
        height: var(--event-height, 30px);
        min-height: 30px;
        padding: 3px 1px;
        border-left-width: 2px;
        font-size: 0;
    }

    .schedule-time-grid.is-week .schedule-event-time {
        overflow: hidden;
        font-size: .48rem;
        letter-spacing: -.04em;
        text-align: center;
        text-overflow: clip;
        white-space: nowrap;
    }

    .schedule-month {
        min-width: 100%;
        grid-template-columns: repeat(7, minmax(0, 1fr));
    }

    .schedule-month-weekday {
        padding: 8px 1px;
        font-size: .58rem;
    }

    .schedule-month-day {
        min-height: 70px;
        padding: 3px;
    }

    .schedule-month-number {
        width: 21px;
        height: 21px;
        margin-bottom: 3px;
        font-size: .62rem;
    }

    .schedule-month-entry {
        height: 5px;
        margin: 2px 1px;
        padding: 0;
        border-left-width: 3px;
        font-size: 0;
    }

    .schedule-month-more {
        display: block;
        overflow: hidden;
        font-size: .5rem;
        text-align: center;
        white-space: nowrap;
    }

    .appointment-editor-overlay {
        padding: 8px;
        align-items: end;
    }

    .appointment-editor {
        width: 100%;
        max-height: calc(100vh - 16px);
        padding: 18px;
        border-radius: 14px 14px 8px 8px;
    }

    .appointment-editor-grid { grid-template-columns: 1fr 1fr; }
    .birthday-editor-grid,
    .birthday-history-grid { grid-template-columns: 1fr 1fr; }
    .birthday-field-name,
    .birthday-field-wide { grid-column: 1 / -1; }
    .birthday-section-heading { align-items: flex-start; flex-direction: column; }
    .appointment-field-date,
    .appointment-field-topic,
    .appointment-field-status,
    .appointment-field-wide { grid-column: 1 / -1; }
    .appointment-options { align-items: flex-start; flex-direction: column; gap: 9px; }
    .appointment-editor-actions { grid-template-columns: 1fr; }
}

@media (max-width: 360px) {
    .footer-safety-navigation { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: .01ms !important; }
}
