/* ========== ТЕМЫ (светлая / тёмная) ========== */
:root, [data-theme="light"] {
    --bg-primary: #f8f9fa;
    --bg-card: #ffffff;
    --bg-card-alt: #f8f9fa;
    --bg-input: #ffffff;
    --bg-hover: #f0f0f0;
    --bg-active: #e9ecef;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --text-muted: #95a5a6;
    --text-inverse: #ffffff;
    --border-color: #ddd;
    --border-light: #ecf0f1;
    --border-dashed: #f0f0f0;
    --accent-primary: #3498db;
    --accent-success: #27ae60;
    --accent-success-hover: #219a52;
    --accent-error: #e74c3c;
    --accent-error-hover: #c0392b;
    --accent-warning: #f39c12;
    --accent-yellow: #f1c40f;
    --gradient-dark: linear-gradient(135deg, #2c3e50, #34495e);
    --gradient-menu: linear-gradient(135deg, #2c3e50, #3498db);
    --shadow: none;
    --shadow-sm: none;
    --calendar-motion-ease: cubic-bezier(0.22, 0.25, 0, 1);
    --calendar-week-stripe: #eeeeee;

    /* --- Дизайн-токены: отступы, скругления, типографика, касания, фокус --- */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-7: 28px;
    --space-8: 32px;

    --radius-xs: 6px;
    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 12px;
    --radius-xl: 14px;
    --radius-2xl: 16px;
    --radius-3xl: 20px;
    --radius-pill: 999px;

    --font-sans: 'Segoe UI', Arial, sans-serif;
    --text-2xs: 11px;
    --text-xs: 12px;
    --text-sm: 13px;
    --text-base: 15px;
    --text-md: 16px;
    --text-lg: 18px;
    --text-xl: 20px;
    --text-2xl: 22px;
    --text-3xl: 24px;
    --text-display: 26px;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    --touch-min: 44px;
    --touch-comfort: 48px;
    --max-modal-width: 500px;

    --ease-standard: cubic-bezier(0.22, 0.25, 0, 1);
    --duration-fast: 0.15s;
    --duration-normal: 0.2s;

    --focus-ring-width: 2px;
    --focus-ring-offset: 2px;
    --focus-ring-color: var(--accent-primary);

    --scrollbar-size: 8px;
    --scrollbar-thumb: rgba(120, 125, 140, 0.45);
    --scrollbar-thumb-hover: rgba(90, 95, 110, 0.6);
    --scrollbar-track: transparent;

    /* Шапка главного календаря: зарезервированная высота текста (без скачков при переносе / i18n) */
    --main-calendar-header-context-font-size: 17px;
    --main-calendar-header-context-line-height: 1.25;
    --main-calendar-header-context-max-lines: 2;
    --main-calendar-header-date-font-size: 15px;
    --main-calendar-header-date-line-height: 1.3;
    --main-calendar-header-context-date-gap: 4px;
    --main-calendar-header-center-min-height: calc(
        var(--main-calendar-header-context-font-size) * var(--main-calendar-header-context-line-height) *
            var(--main-calendar-header-context-max-lines) + var(--main-calendar-header-context-date-gap) +
            var(--main-calendar-header-date-font-size) * var(--main-calendar-header-date-line-height) + 4px
    );
}

[data-theme="dark"] {
    /* Отступы/радиусы/шрифт — дублируем для html с data-theme="dark" (цвета ниже) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-7: 28px;
    --space-8: 32px;
    --radius-xs: 6px;
    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 12px;
    --radius-xl: 14px;
    --radius-2xl: 16px;
    --radius-3xl: 20px;
    --radius-pill: 999px;
    --font-sans: 'Segoe UI', Arial, sans-serif;
    --text-lg: 18px;

    --bg-primary: #0f0f14;
    --bg-card: #1a1a24;
    --bg-card-alt: #252532;
    --bg-input: #252532;
    --bg-hover: #2d2d3a;
    --bg-active: #353545;
    --text-primary: #e8e8ed;
    --text-secondary: #a0a0b0;
    --text-muted: #7a7a8c;
    --text-inverse: #ffffff;
    --border-color: #3a3a4a;
    --border-light: #2d2d3a;
    --border-dashed: #2d2d3a;
    --calendar-week-stripe: rgba(255, 255, 255, 0.1);
    --accent-primary: #5dade2;
    --accent-success: #2ecc71;
    --accent-success-hover: #27ae60;
    --accent-error: #d47474;
    --accent-error-hover: #c0392b;
    --accent-warning: #f39c12;
    --accent-yellow: #f1c40f;
    --gradient-dark: linear-gradient(135deg, #1a1a24, #252532);
    --gradient-menu: linear-gradient(135deg, #1e1e2a, #2a3548);
    --shadow: none;
    --shadow-sm: none;

    --focus-ring-color: var(--accent-primary);

    --scrollbar-thumb: rgba(255, 255, 255, 0.28);
    --scrollbar-thumb-hover: rgba(255, 255, 255, 0.42);
    --scrollbar-track: transparent;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-sans, 'Segoe UI', Arial, sans-serif);
    /* WebView/Android/Chrome: отключаем системный ореол тапа везде; отклик — через :active / свои стили */
    -webkit-tap-highlight-color: transparent;
}

/*
 * Скроллбары Chromium / Яндекс.Браузер / Safari:
 * Не задавать здесь scrollbar-width / scrollbar-color — в Chrome это включает «тонкую» системную полосу,
 * которая игнорирует ::-webkit-scrollbar и даёт прямоугольный бегунок.
 * #recentPatients и #todayPatients из селектора исключены — там системный скроллбар (без «отъедания» ширины кастомом).
 */
#htmlRoot::-webkit-scrollbar,
html::-webkit-scrollbar,
body::-webkit-scrollbar,
*:not(#recentPatients):not(#todayPatients)::-webkit-scrollbar {
    width: var(--scrollbar-size);
    height: var(--scrollbar-size);
}
#htmlRoot::-webkit-scrollbar-track,
html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track,
*:not(#recentPatients):not(#todayPatients)::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}
#htmlRoot::-webkit-scrollbar-thumb,
html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb,
*:not(#recentPatients):not(#todayPatients)::-webkit-scrollbar-thumb {
    /* 9999px + прозрачная «рамка» + clip — стабильнее скругление в WebKit */
    background-color: var(--scrollbar-thumb);
    background-clip: padding-box;
    border: 3px solid transparent;
    border-radius: 9999px;
}
#htmlRoot::-webkit-scrollbar-thumb:hover,
html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover,
*:not(#recentPatients):not(#todayPatients)::-webkit-scrollbar-thumb:hover {
    background-color: var(--scrollbar-thumb-hover);
}
#htmlRoot::-webkit-scrollbar-corner,
html::-webkit-scrollbar-corner,
body::-webkit-scrollbar-corner,
*:not(#recentPatients):not(#todayPatients)::-webkit-scrollbar-corner {
    background: transparent;
}

/* Меньше задержка тапа и без двойного тап-зума на кнопках и основных кликабельных блоках */
button,
input[type="button"],
input[type="submit"],
input[type="reset"],
input[type="color"] {
    touch-action: manipulation;
}

.main-calendar-today-btn,
.btn-calendar-style,
.main-calendar-expand-btn,
.expandable-header,
.add-button,
.burger-menu,
.back-button,
.close-button,
.edit-button,
.search-button,
.menu-item,
.patient-item-base,
.settings-section-header,
.close-modal,
.edit-record-patient-row,
.edit-record-phone-row,
.open-record-row,
/* Расписание на главной — те же тапы, что у «Открытых записей» */
.patient-item[data-aid],
.phone-action-btn,
.phone-actions-close,
.patient-link,
.reminder-patient-row,
.quick-add {
    touch-action: manipulation;
}

body {
    background: var(--bg-primary);
    padding: var(--space-2);
    padding-bottom: 80px;
    font-size: var(--text-lg);
    transition: background 0.3s ease;
}

/* Клавиатурный фокус (тап по-прежнему без системного ореола — см. *) */
button:focus-visible,
.reminders-brief-btn:focus-visible,
.burger-menu:focus-visible,
.add-button:focus-visible,
.menu-item:focus-visible,
.cancel-btn:focus-visible,
.save-btn:focus-visible,
.delete-btn-small:focus-visible,
.big-action-btn:focus-visible,
.finance-add-btn:focus-visible,
.schedule-toggle-completed-btn:focus-visible,
.patient-reminders-history-btn:focus-visible,
.reminder-action-btn:focus-visible,
.reminder-clear-time-btn:focus-visible,
.ui-btn--primary:focus-visible,
.ui-btn--secondary:focus-visible,
.ui-btn--danger-sm:focus-visible {
    outline: var(--focus-ring-width) solid var(--focus-ring-color);
    outline-offset: var(--focus-ring-offset);
}

/* Верхняя панель */
.top-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.top-bar-main {
    align-items: stretch;
    /* как расстояние от левого края экрана до бургера (body padding 8px) */
    gap: 8px;
}

.reminders-brief-btn {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 132px;
    height: 48px;
    min-height: 48px;
    padding: 0 12px;
    border-radius: 12px;
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: none;
    cursor: pointer;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    white-space: nowrap;
}

/* Нет активных напоминаний (сегодня/завтра/просрочка) — только колокольчик */
.reminders-brief-bell {
    display: none;
    font-size: 22px;
    line-height: 1;
    align-items: center;
    justify-content: center;
}

.reminders-brief-btn--icon-only {
    max-width: none;
    width: 48px;
    min-width: 48px;
    padding: 0;
}

.reminders-brief-btn--icon-only .reminders-brief-line {
    display: none !important;
}

.reminders-brief-btn--icon-only .reminders-brief-bell {
    display: inline-flex;
}

.reminders-brief-line {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.reminders-brief-overdue {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-error);
    margin-right: 1px;
}

.reminders-brief-overdue:empty {
    display: none !important;
}

.reminders-count-today {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
}

.reminders-brief-sep {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 1px;
    opacity: 0.35;
}

.reminders-count-tomorrow {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    opacity: 0.55;
}

.reminders-brief-btn:active {
    transform: scale(0.98);
    background: var(--bg-hover);
}

.add-button-compact {
    flex: 1;
    min-width: 0;
}

.add-button-compact .add-text {
    font-size: 15px;
    letter-spacing: 0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========== ЭКРАНЫ ========== */
.screen-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--bg-primary);
    position: sticky;
    top: 0;
    z-index: 10;
}

.back-button {
    font-size: 28px;
    cursor: pointer;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.close-button {
    font-size: 28px;
    cursor: pointer;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.close-button:active {
    background: var(--bg-hover);
}

.back-button:active {
    background: var(--bg-hover);
}

.screen-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    text-align: center;
    margin: 0 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.screen-header .back-button,
.screen-header .edit-button,
.screen-header .search-button {
    flex-shrink: 0;
}

.modal-header h3 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}
.modal-header-centered {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.modal-header-centered h3 {
    flex: 1;
    text-align: center;
}
.modal-header-centered .close-modal {
    font-size: 28px;
    cursor: pointer;
    flex-shrink: 0;
    width: 44px;
    text-align: right;
}

.edit-button, .search-button {
    font-size: 24px;
    cursor: pointer;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

/* ========== ФОРМА НОВОЙ ЗАПИСИ ========== */
.form-container {
    padding: 16px 0;
}

.edit-appointment-screen-body {
    padding-bottom: 28px;
}

.edit-appointment-screen-title {
    white-space: normal;
    line-height: 1.15;
    max-width: 220px;
}

#editAppointmentScreen .edit-record-patient-block {
    margin-bottom: 16px;
}

#editAppointmentScreen .modal-input {
    padding: 14px;
    margin: 0;
    border-radius: 12px;
}

#editAppointmentScreen .form-group,
#editAppointmentScreen .form-row {
    margin-bottom: 16px;
}

#editAppointmentScreen .form-row .form-group {
    margin-bottom: 0;
}

.info-screen-body {
    padding: 16px 0 28px;
}

.info-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 14px;
}

.info-card--hero {
    background: var(--bg-card-alt);
}

.info-card-title {
    margin: 0 0 10px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.info-card-text {
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.info-accent {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--bg-hover);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
}

.info-steps,
.info-list {
    margin: 0;
    padding-left: 20px;
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.5;
}

.info-steps li,
.info-list li {
    margin: 0 0 8px;
}

.info-steps li:last-child,
.info-list li:last-child {
    margin-bottom: 0;
}

.info-feature-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.info-feature-item {
    padding: 12px;
    border-radius: 12px;
    background: var(--bg-card-alt);
}

.info-feature-name {
    margin-bottom: 4px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.info-feature-text {
    font-size: 14px;
    line-height: 1.45;
    color: var(--text-secondary);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 600;
}

.field-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.field-label-row label {
    margin-bottom: 0;
}

.field-add-btn {
    flex-shrink: 0;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 16px;
    background: var(--bg-input);
    color: var(--text-primary);
}

/* Выпадающие списки и опции в тёмной теме */
[data-theme="dark"] select,
[data-theme="dark"] option,
[data-theme="dark"] .search-result-item,
[data-theme="dark"] .search-result-item span,
[data-theme="dark"] .autocomplete-dropdown {
    color: var(--text-inverse);
}
[data-theme="dark"] select,
[data-theme="dark"] option {
    background: var(--bg-card);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

/* Обёртка автодополнения */
.autocomplete-wrap {
    position: relative;
}
.autocomplete-field {
    min-height: 44px;
    resize: none;
    overflow: hidden;
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 16px;
    font-family: inherit;
    box-sizing: border-box;
}
.autocomplete-field:focus {
    outline: none;
    border-color: var(--accent-primary);
}
.autocomplete-wrap .autocomplete-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 100;
    margin: 6px 0 0;
    margin-bottom: 0;
    padding: 4px;
    max-height: 258px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
    box-sizing: border-box;
    overflow-y: auto;
}

.autocomplete-wrap .autocomplete-dropdown:empty {
    display: none;
}

/* Результаты поиска */
.search-results {
    margin: 8px 0 16px 0;
    max-height: 200px;
    overflow-y: auto;
}

.autocomplete-wrap .search-results.autocomplete-dropdown {
    margin: 6px 0 0;
    max-height: 258px;
}

.search-result-item {
    display: flex;
    align-items: flex-start;
    padding: 12px;
    background: var(--bg-card-alt);
    border-radius: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    border-left: 4px solid var(--accent-primary);
    width: 100%;
    box-sizing: border-box;
    line-height: 1.4;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.autocomplete-wrap .autocomplete-dropdown .search-result-item {
    padding: 10px 12px;
    margin-bottom: 4px;
    border: 1px solid var(--border-light);
    border-left: 4px solid var(--accent-primary);
}

.autocomplete-wrap .autocomplete-dropdown .search-result-item:last-child {
    margin-bottom: 0;
}

.search-result-item:active {
    background: var(--bg-active);
}

.search-results-empty {
    padding: 10px 12px;
    color: var(--text-secondary);
}

.result-avatar {
    width: 40px;
    height: 40px;
    background: var(--accent-primary);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    margin-right: 12px;
}

.result-info {
    flex: 1;
}

.result-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.result-details {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Кнопки формы */
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

/* Новая запись — уведомление в мессенджер после сохранения */
.new-appointment-notify-group {
    margin-top: 16px;
}
.new-appointment-notify-card {
    position: relative;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg, 14px);
    padding: 14px 16px;
    background: var(--bg-input);
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.new-appointment-notify-card--on {
    border-color: var(--accent-success);
    box-shadow: 0 0 0 1px rgba(39, 174, 96, 0.25);
}
[data-theme='dark'] .new-appointment-notify-card--on {
    box-shadow: 0 0 0 1px rgba(46, 204, 113, 0.35);
}
.new-appointment-notify-checkbox {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.new-appointment-notify-header {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    text-align: left;
    font: inherit;
    color: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    border-radius: var(--radius-md, 10px);
}
.new-appointment-notify-header:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}
.new-appointment-notify-copy {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}
.new-appointment-notify-title {
    font-size: 15px;
    font-weight: var(--font-weight-semibold, 600);
    line-height: 1.3;
    color: var(--text-primary);
}
.new-appointment-notify-hint {
    font-size: 13px;
    line-height: 1.35;
    color: var(--text-secondary);
}
.new-appointment-notify-channels {
    flex-direction: row;
    align-items: stretch;
    gap: 12px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    box-sizing: border-box;
}
.new-appointment-notify-channel {
    position: relative;
    flex: 1;
    display: flex;
    min-width: 0;
    margin: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.new-appointment-notify-channel input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
}
.new-appointment-notify-channel-ui {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 48px;
    text-transform: none;
    letter-spacing: normal;
}
.new-appointment-notify-channel-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    object-fit: contain;
}
.new-appointment-notify-channel input:focus-visible + .new-appointment-notify-channel-ui {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}
.new-appointment-notify-channel input[value='whatsapp']:checked + .new-appointment-notify-channel-ui {
    background: var(--accent-success);
    border-color: var(--accent-success-hover);
    color: #fff;
}
.new-appointment-notify-channel input[value='whatsapp']:checked + .new-appointment-notify-channel-ui:active {
    background: var(--accent-success-hover);
    border-color: var(--accent-success-hover);
}
.new-appointment-notify-channel input[value='telegram']:checked + .new-appointment-notify-channel-ui {
    background: #229ed9;
    border-color: #1b8ec4;
    color: #fff;
}
.new-appointment-notify-channel input[value='telegram']:checked + .new-appointment-notify-channel-ui:active {
    background: #1b8ec4;
    border-color: #1884b8;
}
[data-theme='dark'] .new-appointment-notify-channel input[value='telegram']:checked + .new-appointment-notify-channel-ui {
    background: #2aabee;
    border-color: #229ed9;
    color: #fff;
}
[data-theme='dark'] .new-appointment-notify-channel input[value='telegram']:checked + .new-appointment-notify-channel-ui:active {
    background: #229ed9;
    border-color: #1b8ec4;
}
#newAppointmentSaveBtn .new-appointment-save-label {
    pointer-events: none;
}

.cancel-btn,
.save-btn,
.ui-btn--secondary,
.ui-btn--primary {
    flex: 1;
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    font-size: var(--text-lg);
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    border-width: 1px;
    border-style: solid;
}

.cancel-btn,
.ui-btn--secondary {
    background: var(--border-light);
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.save-btn,
.ui-btn--primary {
    background: var(--accent-success);
    color: white;
    border-color: var(--accent-success-hover);
}

.cancel-btn:active,
.ui-btn--secondary:active {
    background: var(--bg-active);
    border-color: var(--border-color);
}

.save-btn:active,
.ui-btn--primary:active {
    background: var(--accent-success-hover);
    border-color: var(--accent-success-hover);
}

/* Квадратные икон-кнопки 40×40 — один размер; отличаются только цветом роли */
.delete-btn-small,
.ui-btn--danger-sm,
.history-delete-btn,
.settings-add-btn,
.settings-edit-btn,
.settings-del-btn {
    box-sizing: border-box;
    width: 40px;
    height: 40px;
    min-width: 40px;
    padding: 0;
    border-radius: 8px;
    border-width: 1px;
    border-style: solid;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
    font-weight: bold;
    cursor: pointer;
    flex-shrink: 0;
    color: #fff;
    transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease, transform 0.12s ease, filter 0.15s ease;
}

.delete-btn-small,
.ui-btn--danger-sm,
.history-delete-btn {
    background: var(--accent-error);
    border-color: var(--accent-error-hover);
}

.delete-btn-small:hover,
.ui-btn--danger-sm:hover,
.history-delete-btn:hover {
    background: var(--accent-error-hover);
}

.settings-add-btn {
    background: var(--accent-success);
    border-color: var(--accent-success-hover);
}

.settings-add-btn:hover {
    background: var(--accent-success-hover);
}

.settings-edit-btn {
    background: var(--accent-warning);
    border-color: #d68910;
}

.settings-edit-btn:hover {
    filter: brightness(0.92);
}

.settings-del-btn {
    background: var(--accent-error);
    border-color: var(--accent-error-hover);
}

.settings-del-btn:hover {
    background: var(--accent-error-hover);
}

.delete-btn-small:active,
.ui-btn--danger-sm:active,
.history-delete-btn:active,
.settings-add-btn:active,
.settings-edit-btn:active,
.settings-del-btn:active {
    opacity: 0.9;
    transform: scale(0.97);
}

.form-actions-edit-record {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 4px;
    flex-wrap: nowrap;
}
.form-actions-edit-record .cancel-btn,
.form-actions-edit-record .save-btn {
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
    min-height: 48px;
    height: 48px;
    padding: 0 10px;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* В ряду с «Отмена / Сохранить» — та же высота, что у соседних кнопок (остальные .delete-btn-small остаются 40×40) */
.form-actions-edit-record .delete-btn-small {
    width: 48px;
    height: 48px;
    min-width: 48px;
}

/* Модальные кнопки — в тёмной теме как в светлой (единый вид) */
[data-theme="dark"] .form-actions-edit-record .cancel-btn {
    background: #ecf0f1;
    color: #7f8c8d;
    border-color: #bdc3c7;
}
[data-theme="dark"] .form-actions-edit-record .save-btn {
    background: #27ae60;
    color: white;
    border-color: #1e8449;
}
[data-theme="dark"] .delete-btn-small,
[data-theme="dark"] .ui-btn--danger-sm,
[data-theme="dark"] .history-delete-btn,
[data-theme="dark"] .form-actions-edit-record .delete-btn-small {
    background: #e74c3c;
    color: #fff;
    border-color: #c0392b;
}

[data-theme="dark"] .delete-btn-small:hover,
[data-theme="dark"] .ui-btn--danger-sm:hover,
[data-theme="dark"] .history-delete-btn:hover,
[data-theme="dark"] .form-actions-edit-record .delete-btn-small:hover {
    background: #c0392b;
}

.edit-record-patient-block {
    margin-bottom: 20px;
    padding: 12px 16px;
    background: var(--bg-card-alt);
    border-radius: 12px;
}
.edit-record-patient-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 4px 0;
    border-radius: 8px;
    transition: opacity 0.15s ease;
}

.edit-record-patient-row:active {
    opacity: 0.82;
}
.edit-record-patient-name {
    font-weight: 600;
    font-size: 18px;
    color: var(--text-primary);
}
.edit-record-patient-card {
    font-size: 14px;
    color: var(--accent-primary);
}
.edit-record-phone-row {
    display: flex;
    align-items: center;
    padding: 8px 0 0;
    margin-top: 8px;
    border-top: 1px solid var(--border-light);
    cursor: pointer;
}
.edit-record-phone-row:hover {
    opacity: 0.8;
}

.edit-record-phone-row:active {
    opacity: 0.72;
}
.edit-record-phone-row .contact-icon {
    font-size: 20px;
    margin-right: 8px;
}
.edit-record-phone-row .contact-text {
    flex: 1;
    font-size: 16px;
}
.edit-record-phone-row .contact-arrow {
    font-size: 12px;
    color: var(--text-muted);
}

.edit-record-birth-row {
    cursor: default;
}

.edit-record-birth-row:hover,
.edit-record-birth-row:active {
    opacity: 1;
}

/* ========== ЭКРАН ФИНАНСОВ ========== */
.finance-screen-content {
    padding: 16px 0;
}
.finance-period-block {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 16px 20px;
    margin-bottom: 20px;
    box-shadow: none;
}
.finance-period-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}
.finance-period-row .form-group {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
}
.finance-period-row .form-group input {
    width: 100%;
    box-sizing: border-box;
}
/* Единый вид с остальными .save-btn; полная ширина — от контейнера периода */
.finance-period-block > .save-btn {
    width: 100%;
    box-sizing: border-box;
}
.finance-section {
    margin-bottom: 24px;
}
.finance-stat-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 16px 20px;
    margin-bottom: 12px;
    box-shadow: none;
}
.finance-stat-card.income {
    border-left: 4px solid var(--accent-success);
}
.finance-stat-card.expense {
    border-left: 4px solid var(--accent-error);
}
.finance-stat-card.total {
    border-left: 4px solid var(--accent-primary);
}
.finance-stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.finance-stat-value {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

/* График финансов */
.finance-chart-section {
    margin-bottom: 24px;
}
.finance-chart-wrap {
    position: relative;
    background: var(--bg-card-alt);
    border-radius: 12px;
    padding: 16px;
    min-height: 220px;
}

.finance-chart-tooltip {
    position: absolute;
    z-index: 2;
    max-width: 230px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 12px;
    line-height: 1.35;
    box-shadow: none;
    pointer-events: none;
}

.finance-kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.finance-kpi-card,
.finance-top-card {
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 12px;
}

.finance-kpi-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.finance-kpi-value {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.finance-top-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.finance-top-title {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 600;
}

.finance-top-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.finance-top-item,
.finance-entry-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    background: var(--bg-card-alt);
    border-radius: 10px;
    padding: 10px 12px;
}

.finance-top-item-name,
.finance-entry-main {
    color: var(--text-primary);
    font-size: 14px;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.finance-top-item-value,
.finance-entry-amount {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.finance-top-item-value.income,
.finance-entry-amount.income {
    color: var(--accent-success);
}

.finance-top-item-value.expense,
.finance-entry-amount.expense {
    color: var(--accent-error);
}

.finance-entries-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.finance-entry-sub {
    color: var(--text-secondary);
    font-size: 12px;
}

.finance-empty {
    color: var(--text-secondary);
    font-size: 13px;
    background: var(--bg-card-alt);
    border-radius: 10px;
    padding: 10px 12px;
}

@media (max-width: 560px) {
    .finance-kpi-grid,
    .finance-top-grid {
        grid-template-columns: 1fr;
    }
}

/* ========== КАРТОЧКА ПАЦИЕНТА ========== */
.patient-card-content {
    padding: 16px 0;
}

.card-section,
.ui-surface-card {
    background: var(--bg-card);
    border-radius: var(--radius-2xl);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
    box-shadow: none;
}

.contact-row {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-dashed);
}

.contact-row:last-child {
    border-bottom: none;
}

.contact-row-clickable {
    cursor: pointer;
}
.contact-row-clickable:hover {
    background: var(--bg-card-alt);
    margin: 0 -16px;
    padding: 8px 16px;
    border-radius: 8px;
}

.contact-arrow {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-muted);
}
.contact-row:not(.contact-row-clickable) .contact-arrow {
    display: none;
}

.contact-icon {
    font-size: 24px;
    width: 40px;
}

.contact-text {
    font-size: 18px;
    color: var(--text-primary);
}

.section-subtitle {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.patient-reminders-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.patient-reminders-header .section-subtitle {
    margin-bottom: 0;
}

.patient-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.patient-history-header .section-subtitle {
    margin-bottom: 0;
}

/* Компактные кнопки у заголовков, полей, календаря, списка напоминаний, сброса времени — высота 28px */
.patient-reminders-history-btn,
.reminder-action-btn,
.reminder-clear-time-btn {
    box-sizing: border-box;
    flex-shrink: 0;
    max-width: 100%;
    height: 28px;
    min-height: 28px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
    line-height: 1;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.reminder-clear-time-btn {
    width: 28px;
    min-width: 28px;
    max-width: 28px;
    padding: 0;
    font-size: 12px;
}

/* «Скрыть/Показать завершённые»: стиль кнопки календаря + прежние высота 28px и кегль 11px */
.schedule-toggle-completed-btn.btn-calendar-style {
    height: 28px;
    min-height: 28px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
    line-height: 1;
    white-space: nowrap;
    box-sizing: border-box;
    flex-shrink: 0;
    max-width: 100%;
}

.schedule-toggle-completed-btn.btn-calendar-style:hover {
    background: var(--bg-hover);
}

.patient-reminders-history-btn:hover,
.reminder-action-btn:hover,
.reminder-clear-time-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-subtle, var(--border-light));
}

.patient-reminders-history-btn:active,
.reminder-action-btn:active,
.reminder-clear-time-btn:active {
    opacity: 0.92;
}

.patient-history-sort-btn {
    min-width: 28px;
    padding-left: 6px;
    padding-right: 6px;
    font-size: 13px;
}

#patientRemindersBlock.patient-reminders-block-empty {
    padding: 12px 14px;
}

#patientRemindersBlock.patient-reminders-block-empty .patient-reminders-header {
    margin-bottom: 8px;
}

#patientRemindersBlock.patient-reminders-block-empty .section-subtitle {
    font-size: 17px;
}

.info-row {
    display: flex;
    margin-bottom: 8px;
    font-size: 16px;
}

.info-label {
    width: 100px;
    color: var(--text-secondary);
}

.info-value {
    flex: 1;
    color: var(--text-primary);
}

.info-value-block {
    font-size: 16px;
    color: var(--text-primary);
    padding-top: 4px;
    line-height: 1.4;
}

.stats-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border-dashed);
}

.stats-row:last-child {
    border-bottom: none;
}

.stats-number {
    font-weight: 600;
    color: var(--accent-success);
}

.history-visit-block {
    background: var(--bg-card-alt);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 10px;
    cursor: pointer;
    border: none;
}
.history-visit-block:last-child {
    margin-bottom: 0;
}
.history-visit-block:hover {
    background: var(--bg-hover);
}

.history-visit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.history-visit-datetime {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}
.history-visit-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.history-visit-status {
    font-size: 20px;
}
.history-visit-service {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.history-visit-money {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    line-height: 1.45;
}
.history-money-line {
    margin: 2px 0;
}
.history-money-label {
    font-weight: 500;
    color: var(--text-muted);
    margin-right: 6px;
}
.history-visit-price {
    font-size: 16px;
    font-weight: 600;
    color: var(--accent-success);
    margin-bottom: 6px;
}
.history-visit-work {
    font-size: 14px;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.4;
}

/* Автовысота многострочных полей (аллергии, услуга, заметки) */
#newAppointmentScreen textarea.autocomplete-field,
#newAppointmentScreen textarea#newNotes,
#editAppointmentScreen textarea.autocomplete-field,
#editAppointmentScreen textarea.modal-textarea-auto,
#editAppointmentModal textarea.autocomplete-field,
#editAppointmentModal textarea.modal-textarea-auto,
#editPatientModal textarea.autocomplete-field,
#editPatientModal textarea.modal-textarea-auto {
    min-height: 2.75em;
    max-height: 45vh;
    overflow-y: auto;
    resize: vertical;
    box-sizing: border-box;
}

.history-item-wrap {
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    padding: 10px 0;
}
.history-item-wrap:last-child {
    border-bottom: none;
}
.history-item {
    display: flex;
    justify-content: space-between;
    font-size: 16px;
}
.history-work {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 6px;
    padding-left: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Полноширинный акцентный CTA: карточка, напоминания, финансы на главном, «добавить напоминание» в записи (высота 48px — согласовано с рядом редактирования и телефонными действиями) */
.big-action-btn,
.finance-add-btn,
#editAppointmentScreen .edit-appointment-add-reminder-btn,
#editAppointmentModal .edit-appointment-add-reminder-btn {
    width: 100%;
    box-sizing: border-box;
    min-height: 48px;
    height: 48px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-primary);
    color: var(--text-inverse);
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.big-action-btn {
    margin: 16px 0;
}

.big-action-btn:active,
.finance-add-btn:active,
#editAppointmentScreen .edit-appointment-add-reminder-btn:active,
#editAppointmentModal .edit-appointment-add-reminder-btn:active {
    opacity: 0.92;
    transform: scale(0.99);
}

/* ========== БАЗА ПАЦИЕНТОВ ========== */
.search-bar {
    padding: 12px 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
}

.search-bar input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 16px;
    background: var(--bg-input);
    color: var(--text-primary);
}
.search-bar input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.patients-list {
    padding: 16px 0;
}

.letter-group {
    font-size: 18px;
    font-weight: 600;
    color: var(--accent-primary);
    margin: 16px 0 8px 0;
    padding-left: 8px;
}

.patient-item-base {
    display: flex;
    align-items: center;
    padding: 12px;
    background: var(--bg-card);
    border-radius: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    box-shadow: none;
    transition: background 0.15s ease;
}

.patient-item-base:active {
    background: var(--bg-hover);
}

.patient-avatar {
    width: 48px;
    height: 48px;
    background: var(--accent-primary);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    margin-right: 12px;
}

.patient-info-base {
    flex: 1;
}

.patient-name-base {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.patient-meta {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.burger-menu {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 12px;
    transition: background 0.2s;
    flex-shrink: 0;  /* чтобы не сжимался */
}

.burger-menu:active {
    background: var(--bg-hover);
}

.burger-icon {
    width: 24px;
    height: 18px;
    position: relative;
}

.burger-icon span {
    display: block;
    position: absolute;
    height: 3px;
    width: 100%;
    background: var(--text-primary);
    border-radius: 3px;
}

.burger-icon span:nth-child(1) { top: 0; }
.burger-icon span:nth-child(2) { top: 7px; }
.burger-icon span:nth-child(3) { top: 14px; }


/* Большая кнопка добавления */
.add-button {
    flex: 1;  /* занимает всё оставшееся место */
    height: 48px;
    background: var(--accent-success);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: none;
    transition: all 0.2s;
    border: 1px solid var(--accent-success-hover);
    box-sizing: border-box;
}

.add-button:active {
    background: var(--accent-success-hover);
    transform: scale(0.98);
}

.add-icon {
    font-size: 24px;
    color: white;
}

.add-text {
    font-size: 18px;
    font-weight: 600;
    color: white;
    letter-spacing: 0.5px;
}

/* Главный экран: календарь — одна карточка; фон, рамка и скругление как у карточек приложения (.info-card) */
.main-calendar-unified {
    margin-bottom: 20px;
    border-radius: var(--radius-2xl);
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    box-shadow: none;
}

/* Напоминания: календарь занимает ширину контейнера, как карточка на главной. */
#remindersScreen #remindersClv3Host .main-calendar-unified {
    width: 100%;
    margin: 0;
}

.main-calendar-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 22px;
    touch-action: pan-y;
    /* Вертикальные отступы + зарезервированная высота центра (без скачков при 2 vs 3 строках текста) */
    min-height: calc(var(--main-calendar-header-center-min-height) + 36px);
}

/* стиль кнопки календарь — общий вид как у «Сегодня» в шапке календаря; класс .btn-calendar-style для других кнопок */
.btn-calendar-style {
    padding: 10px 16px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 0.02em;
    transition: opacity 0.15s ease, background 0.15s ease;
}

.btn-calendar-style:active {
    opacity: 0.85;
}

.main-calendar-today-btn {
    flex-shrink: 0;
}

.main-calendar-header-center {
    flex: 1;
    min-width: 0;
    text-align: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: opacity 0.15s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: var(--main-calendar-header-center-min-height);
    /* Иначе горизонтальный жест уходит в скролл/жест браузера, pointerup может не прийти */
    touch-action: pan-y;
}

.main-calendar-header-center:active {
    opacity: 0.88;
}

.main-calendar-context-line {
    font-size: var(--main-calendar-header-context-font-size);
    font-weight: 700;
    color: var(--text-primary);
    line-height: var(--main-calendar-header-context-line-height);
    letter-spacing: 0.02em;
    max-width: 100%;
    overflow-wrap: break-word;
}

.main-calendar-date-line {
    font-size: var(--main-calendar-header-date-font-size);
    font-weight: 400;
    color: var(--text-muted);
    margin-top: var(--main-calendar-header-context-date-gap);
    line-height: var(--main-calendar-header-date-line-height);
    cursor: inherit;
    max-width: 100%;
    overflow-wrap: break-word;
}

/* Год — часть подписи, без отдельной «кнопки» */
.main-calendar-date-year-part {
    cursor: inherit;
}

.main-calendar-expand-btn {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--bg-hover);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

.main-calendar-expand-btn:active {
    transform: scale(0.96);
}

.main-calendar-expand-icon {
    display: block;
    transition: transform 0.28s var(--calendar-motion-ease, ease);
}

.main-calendar-expand-btn--open .main-calendar-expand-icon {
    transform: rotate(180deg);
}

.calendar-icon {
    font-size: 24px;
    filter: none;
}

/* Календарь */
.calendar-section {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 20px;
    display: none;
    overflow: hidden;
}

.calendar-section.show {
    display: block;
    overflow: hidden;
    transition: max-height 300ms var(--calendar-motion-ease), opacity 220ms var(--calendar-motion-ease);
}

/* Сетка главного календаря внутри общей карточки: не display:none, чтобы шапка оставалась единым блоком */
.main-calendar-unified #calendarSection.calendar-section {
    display: block;
    background: transparent;
    border-radius: 0;
    margin-bottom: 0;
    padding: 0 12px;
}

.main-calendar-unified #calendarSection.calendar-section:not(.show) {
    max-height: 0 !important;
    min-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}

.main-calendar-unified #calendarSection.calendar-section.show {
    opacity: 1;
    pointer-events: auto;
    padding: 8px 12px 14px;
}
.calendar-section.calendar-expanded { max-height: 1200px; }
.calendar-section.calendar-collapsed { max-height: 500px; }
.calendar-section.calendar-week { max-height: 200px; }
.calendar-gesture-zone {
    touch-action: none;
}

/* Экран напоминаний: компактный календарь с точками */
.reminders-screen-body {
    padding: 0 0 24px;
}

/* Список карточек напоминаний — без общей обёртки-карточки (.patient-list) */
.reminders-day-list {
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    margin-bottom: 16px;
    padding: 0;
    overflow: visible;
}

.reminders-list-empty {
    text-align: center;
    padding: 20px 12px;
    color: var(--text-muted);
    font-size: 15px;
    line-height: 1.4;
}

#patientRemindersBlock.patient-reminders-block-empty .reminders-list-empty {
    padding: 8px 4px 10px;
    font-size: 14px;
}

.reminders-filter-wrap {
    margin: 8px 0 14px;
}

.reminders-filter-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
}

.reminders-filter-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

.reminders-mode-select {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 11px 12px;
    margin: 0;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-primary);
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.3;
    cursor: pointer;
    appearance: auto;
    -webkit-appearance: menulist;
}

.reminders-mode-select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Карточка напоминания на экране «Напоминания» — отдельный блок */
.reminder-list-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 14px 14px 16px;
    margin-bottom: 12px;
    background: var(--bg-card);
    border: none;
    border-radius: 14px;
    box-shadow: none;
    overflow: hidden;
    transform-origin: top center;
    transition: opacity 180ms ease, transform 180ms ease, max-height 220ms ease, margin 220ms ease, padding 220ms ease;
}

#remindersDayList .reminder-list-card:last-child,
#patientRemindersList .reminder-list-card:last-child {
    margin-bottom: 0;
}

/* Напоминания в карточке пациента — тот же вид карточек, что на экране «Напоминания» (без ФИО/тел.) */
#patientRemindersBlock .patient-card-reminders-day-list {
    margin-bottom: 8px;
}
#patientRemindersBlock .reminder-list-card {
    border: none;
}

.reminder-list-head-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    min-width: 0;
}

.reminder-list-datetime-part {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
    flex: 1;
    font-size: 14px;
    font-weight: 600;
}

.reminder-list-date {
    color: var(--text-primary);
}

.reminder-list-time-sep {
    color: var(--text-muted);
    font-weight: 600;
    user-select: none;
}

.reminder-list-time {
    color: var(--text-secondary);
    font-weight: 600;
}

.reminder-list-actions-inline {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* Статус — только цвет текста, без плашки */
.reminder-list-card .reminder-item-status {
    display: block;
    font-size: 13px;
    font-weight: 700;
    padding: 0;
    margin: 0 0 8px;
    letter-spacing: 0.02em;
    background: none !important;
    border-radius: 0;
}

.reminder-item-status--active {
    color: var(--accent-primary);
}

.reminder-item-status--overdue {
    color: var(--accent-error);
}

.reminder-item-status--done,
.reminder-item-status--rescheduled {
    color: var(--accent-success);
}

.reminder-item-patient-block {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
}

.reminder-item-patient-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    margin: -8px -10px 2px;
    border-radius: 12px;
    cursor: pointer;
}

.reminder-item-patient-nav:active {
    background: var(--bg-hover);
}

.reminder-item-patient-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
    margin-bottom: 0;
    min-width: 0;
}

.reminder-item-patient-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-primary);
    white-space: nowrap;
}

.reminder-item-patient-link-icon {
    font-size: 16px;
    line-height: 1;
}

.reminder-item-patient-link-label {
    line-height: 1.2;
}

.reminder-list-phone-row {
    margin-top: 0 !important;
    padding-top: 4px !important;
    border-top: none !important;
}

.reminder-list-phone-row--tap {
    cursor: pointer;
}

.reminder-list-phone-row--tap:active {
    opacity: 0.85;
}

.reminder-list-phone-row--muted {
    cursor: default;
    opacity: 0.75;
}

.reminder-item-row-done {
    opacity: 0.94;
}

.reminder-list-card.reminder-list-card--removing {
    opacity: 0;
    transform: translateY(-4px);
    max-height: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    pointer-events: none;
}

.reminder-item-row-done .reminder-item-text {
    color: var(--text-secondary);
}

.reminders-calendar-host {
    margin-bottom: 12px;
}

.reminders-calendar-host #remindersClv3Host {
    width: 100%;
}

/* Напоминания: используем внешний вид календаря как на главной (месяц), но без раскрытия/сворачивания. */
#remindersScreen #remindersClv3Host .main-calendar-expand-btn {
    display: none;
}

/* В напоминаниях сетка всегда видна (без «аккордеона»). */
#remindersScreen #remindersClv3Host #calendarSection {
    display: block;
}

/* Модалка напоминания: только строка телефона (без ФИО сверху) — убираем border-top и лишние отступы от .edit-record-phone-row */
.reminder-modal-patient-contact.edit-record-patient-block {
    margin-top: 8px;
    margin-bottom: 12px;
    padding: 10px 14px;
}

.reminder-modal-patient-contact .edit-record-phone-row {
    margin-top: 0;
    padding: 0;
    border-top: none;
    min-height: 0;
}

.reminder-item-row {
    align-items: flex-start;
    gap: 8px;
}

/* Карточка пациента: список напоминаний (не экран «Напоминания») */
.reminder-item-body {
    flex: 1;
    min-width: 0;
}

.reminder-item-time {
    font-size: 13px;
    color: var(--accent-primary);
    font-weight: 600;
}

.reminder-item-text {
    font-size: 16px;
    color: var(--text-primary);
    line-height: 1.45;
}

.reminder-list-card .reminder-item-text {
    margin-bottom: 0;
}

.reminder-item-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}

/* Иконки в списке напоминаний — та же высота 28px, чуть шире под глиф */
.reminder-action-btn {
    min-width: 28px;
    padding: 0 6px;
    font-size: 13px;
}

.reminders-add-main-btn {
    margin: 16px 0 0;
}

/* Отступы в потоке формы записи (общий вид кнопки — см. .big-action-btn выше) */
#editAppointmentScreen .edit-appointment-add-reminder-btn,
#editAppointmentModal .edit-appointment-add-reminder-btn {
    margin: 0 0 16px;
}

/* Ряд действий: те же отступы от края блока, что у «Добавить напоминание» (без padding 4px у .form-actions-edit-record) */
#editAppointmentScreen .form-actions.edit-appointment-form-actions,
#editAppointmentModal .form-actions.edit-appointment-form-actions {
    margin-top: 0;
    padding: 0;
    align-items: stretch;
}

/* «Отмена» и «Сохранить» — высота строки как у удаления (48px), размер кнопки удаления не меняем */
#editAppointmentScreen .form-actions.edit-appointment-form-actions .cancel-btn,
#editAppointmentScreen .form-actions.edit-appointment-form-actions .save-btn,
#editAppointmentModal .form-actions.edit-appointment-form-actions .cancel-btn,
#editAppointmentModal .form-actions.edit-appointment-form-actions .save-btn {
    flex: 1;
    min-width: 0;
    min-height: 48px;
    padding: 0 14px;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
}

.patient-reminders-list {
    margin-bottom: 8px;
}

.reminder-patient-row {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.15s ease;
}

.reminder-patient-row:active {
    background: var(--bg-hover);
}

.reminder-patient-row:last-child {
    border-bottom: none;
}

.reminder-patient-date {
    font-weight: 600;
    margin-right: 8px;
}

.reminder-patient-time {
    font-size: 13px;
    color: var(--text-secondary);
}

.reminder-patient-text {
    font-size: 15px;
    margin-top: 4px;
    color: var(--text-primary);
}

.reminder-patient-card-row {
    align-items: flex-start;
}

.reminder-patient-date-line {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
}

.reminder-add-inline-btn {
    box-sizing: border-box;
    width: 100%;
    min-height: 48px;
    height: 48px;
    padding: 0 12px;
    margin-top: 4px;
    border: 1px dashed var(--border-color);
    border-radius: 12px;
    background: transparent;
    color: var(--accent-primary);
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.reminder-add-inline-btn:active {
    background: var(--bg-hover);
}

#patientRemindersBlock.patient-reminders-block-empty .reminder-add-inline-btn {
    margin-top: 0;
    min-height: 48px;
    height: 48px;
    padding: 0 12px;
    font-size: 15px;
}

.info-value-block.muted {
    color: var(--text-muted);
    font-size: 15px;
}

/* Секция календаря: переменные для transition-скрипта (сетка — main-clv3) */
#calendarSection {
    --monthEventsOpacity: 1;
    --dotEventsOpacity: 0;
    --dotScale: 0;
}
#calendarSection.calendar-expanded:not(.calendar-transition-ec) {
    --dotEventsOpacity: 1;
    --dotScale: 1;
}
#calendarSection.calendar-collapsed:not(.calendar-transition-ec),
#calendarSection.calendar-week {
    --dotEventsOpacity: 1;
    --dotScale: 1;
}
#calendarSection.calendar-dragging {
    transition: none !important;
    will-change: max-height;
}
.calendar-placeholder {
    text-align: center;
    padding: 30px;
    color: var(--text-muted);
    font-size: 16px;
}

/* Заголовки секций */
.section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    margin-top: 8px;
    letter-spacing: 0.5px;
}

/* Ряд: заголовок «Расписание» + переключатель */
.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    margin-top: 8px;
}

.section-title-row .section-title--schedule {
    margin: 0;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 6px;
}

/* Счётчик в одном стиле с надписью заголовка (цвет, кегль, начертание) */
.section-title-count {
    font-size: inherit;
    font-weight: inherit;
    letter-spacing: inherit;
    line-height: inherit;
    color: inherit;
    white-space: nowrap;
}

/* Список пациентов */
.patient-list {
    background: var(--bg-card);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: none;
    margin-bottom: 24px;
    padding: 0 16px;
}

.patient-item {
    padding: 16px 0 16px 0;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 4px;
}

/* Строка с записью (есть data-aid) — нажатие по всей полосе, как «Открытые записи» */
.patient-item[data-aid] {
    cursor: pointer;
}
.patient-item[data-aid]:hover {
    background: var(--bg-hover);
}

.patient-item[data-aid]:active {
    background: var(--bg-active);
}

.patient-item:last-child {
    border-bottom: none;
}

/* Подсказки / пустой список в расписании — читаемый цвет в тёмной теме */
.patient-item.schedule-list-hint {
    justify-content: center;
    text-align: center;
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.45;
    padding-left: 8px;
    padding-right: 8px;
}
.patient-item.schedule-list-hint.schedule-list-hint--tap-add {
    cursor: pointer;
}
.patient-item.schedule-list-hint.schedule-list-hint--tap-add:hover {
    background: var(--bg-hover);
}
.patient-item.schedule-list-hint.schedule-list-hint--tap-add:active {
    background: var(--bg-active);
}
.patient-item.schedule-list-hint.schedule-list-hint--tap-add .schedule-free-slot-inner {
    flex: 1;
    width: 100%;
    max-width: 100%;
}
.schedule-list-hint-message {
    color: inherit;
    font-size: inherit;
    line-height: inherit;
}

/* Быстрое закрытие: свайп влево → «Выполнено», затем 3 с на отмену */
.swipe-complete-host {
    position: relative;
    overflow: hidden;
    touch-action: pan-y;
    --swipe-reveal-norm: 0;
    --swipe-panel-w-active: 132px;
    --swipe-panel-translate: 132px;
    /* Ширина плато маски зелёной полосы под подпись «Выполнено» (переопределяется из JS) */
    --swipe-done-text-w: 88px;
}
.swipe-complete-host--schedule {
    border-bottom: 1px solid var(--border-light);
}
.swipe-complete-host--schedule .patient-item {
    border-bottom: none;
}
/* Завершённые/отменённые в расписании: обёртка как у свайпа, без полосы «Выполнено» */
.swipe-complete-host--schedule-closed-only .swipe-complete-foreground .patient-item {
    cursor: pointer;
    background: var(--bg-card, #fff);
    border-bottom: none;
}
.swipe-complete-host--schedule-closed-only.swipe-complete-host--schedule-closed-collapsed {
    max-height: 0 !important;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    border-bottom: none;
}
#todayPatients > .swipe-complete-host:last-child,
#todayPatients > .patient-item:last-child {
    border-bottom: none;
}
.swipe-complete-host--open-record {
    border-bottom: 1px solid var(--border-light);
}
.swipe-complete-host--open-record .open-record-row {
    border-bottom: none;
}
#recentPatients .swipe-complete-host--open-record:last-child {
    border-bottom: none;
}
.swipe-complete-slide .patient-item,
.swipe-complete-slide .open-record-row {
    cursor: pointer;
    background: var(--bg-card, #fff);
}

#recentPatients .swipe-complete-slide,
#recentPatients .swipe-complete-slide .open-record-row {
    background: transparent;
}
.swipe-complete-underlay {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
    background: transparent;
}
.swipe-complete-underlay-panel {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    width: var(--swipe-panel-w-active);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    box-sizing: border-box;
    background: transparent;
    isolation: isolate;
    transform: translate3d(var(--swipe-panel-translate), 0, 0);
    opacity: var(--swipe-reveal-norm, 0);
    will-change: transform, opacity, width;
}
.swipe-complete-underlay-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: var(--accent-success, #27ae60);
    /* Маска зелени: плато по ширине текста «Выполнено» (--swipe-done-text-w), края плавные */
    -webkit-mask-image: linear-gradient(
        to right,
        transparent 0%,
        #000 max(0px, calc(50% - var(--swipe-done-text-w, 88px) / 2)),
        #000 min(100%, calc(50% + var(--swipe-done-text-w, 88px) / 2)),
        transparent 100%
    );
    mask-image: linear-gradient(
        to right,
        transparent 0%,
        #000 max(0px, calc(50% - var(--swipe-done-text-w, 88px) / 2)),
        #000 min(100%, calc(50% + var(--swipe-done-text-w, 88px) / 2)),
        transparent 100%
    );
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
}
.swipe-complete-underlay-text {
    position: relative;
    z-index: 1;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.96);
    letter-spacing: 0.02em;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.swipe-complete-foreground {
    position: relative;
    overflow: hidden;
    background: transparent;
}
.swipe-complete-slide {
    position: relative;
    z-index: 1;
    touch-action: pan-y;
    will-change: transform;
    width: 100%;
    background: var(--bg-card, #fff);
}
.swipe-complete-host--pending .swipe-complete-slide {
    opacity: 1;
    transition: opacity 0.18s ease;
}
.swipe-complete-pending-overlay {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
    box-sizing: border-box;
    background: transparent;
    pointer-events: auto;
}
.swipe-complete-pending-overlay[hidden] {
    display: none !important;
}
.swipe-complete-pending-inner {
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: row;
    align-items: center;
    flex: 1 1 auto;
    width: 100%;
    min-height: 100%;
    box-sizing: border-box;
    margin: 0;
    border-radius: 0;
    overflow: hidden;
    background: transparent;
    border: none;
}
/* Матовое стекло; маска уже, чем у зелени: края по 1/16 градиент, центр 14/16 плотный */
.swipe-complete-pending-inner::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.28);
    backdrop-filter: blur(2px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    box-shadow: none;
    /* Маска: 1/16 + 14/16 + 1/16; на краях градиент */
    -webkit-mask-image: linear-gradient(
        to right,
        transparent 0%,
        #000 calc(100% / 16),
        #000 calc(100% * 15 / 16),
        transparent 100%
    );
    mask-image: linear-gradient(
        to right,
        transparent 0%,
        #000 calc(100% / 16),
        #000 calc(100% * 15 / 16),
        transparent 100%
    );
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
}
.swipe-complete-pending-col {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: stretch;
    min-width: 0;
    padding: 0 12px;
    box-sizing: border-box;
}
.swipe-complete-pending-col--count {
    flex: 1 1 0;
}
.swipe-complete-pending-col--action {
    flex: 2 1 0;
}
.swipe-complete-countdown {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    min-width: 1.1em;
    text-align: center;
    color: var(--text-primary);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}
.swipe-complete-cancel-btn {
    margin: 0;
    flex-shrink: 0;
    max-width: 100%;
    box-shadow: none;
}
.swipe-complete-host--collapsing {
    overflow: hidden;
    transition: max-height 0.38s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.32s ease;
    opacity: 0;
}

[data-theme="dark"] .swipe-complete-slide,
[data-theme="dark"] .swipe-complete-slide .patient-item,
[data-theme="dark"] .swipe-complete-slide .open-record-row {
    background: var(--bg-card);
}
[data-theme="dark"] #recentPatients .swipe-complete-slide,
[data-theme="dark"] #recentPatients .swipe-complete-slide .open-record-row {
    background: transparent;
}
[data-theme="dark"] .swipe-complete-pending-inner::before {
    background: rgba(18, 22, 30, 0.48);
    box-shadow: none;
}
[data-theme="dark"] .swipe-complete-countdown {
    color: rgba(255, 255, 255, 0.96);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

/* Свободное окно в списке расписания — отдельная композиция (центр, стрелки по краям) */
.patient-item.schedule-free-slot {
    cursor: pointer;
    justify-content: center;
}
.patient-item.schedule-free-slot:hover {
    background: var(--bg-hover);
}
.patient-item.schedule-free-slot:active {
    background: var(--bg-active);
}
.schedule-free-slot-inner {
    display: flex;
    align-items: stretch;
    flex: 1;
    min-width: 0;
    gap: 10px;
    max-width: 100%;
}
.schedule-free-slot-chevron {
    flex-shrink: 0;
    width: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 300;
    line-height: 1;
    letter-spacing: -0.12em;
    color: var(--text-secondary, #6b7280);
    opacity: 0.42;
    user-select: none;
}
.schedule-free-slot-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 3px;
}
.schedule-free-slot-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary, #6b7280);
    line-height: 1.2;
}
.schedule-free-slot-times {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.25;
    white-space: nowrap;
}
.schedule-free-slot-time-strong {
    color: var(--text-primary);
    font-weight: 600;
}
.schedule-free-slot-time-dur {
    color: var(--text-secondary, #6b7280);
    font-weight: 500;
    font-size: 0.92em;
}
.schedule-free-slot-time-sep {
    color: var(--text-secondary, #9ca3af);
    font-weight: 400;
    opacity: 0.85;
}

/* Расписание на главной и «Открытые записи»: компактные строки как в #todayPatients */
#todayPatients .patient-item,
#recentPatients .open-record-row.patient-item {
    padding: 6px 0;
}
#todayPatients .patient-time {
    min-width: 76px;
}
#todayPatients .patient-time.patient-time-range {
    line-height: 10.4px;
    margin-left: -6px;
}
#todayPatients .patient-time.patient-time-range .patient-time-start {
    font-size: 14px;
    font-weight: 700;
    line-height: 10.4px;
}
#todayPatients .patient-time.patient-time-range .patient-time-end {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary, #9ca3af);
    line-height: 10.4px;
}
#todayPatients .patient-time.patient-time-range .patient-time-sep {
    font-size: 8px;
    opacity: 0.75;
    line-height: 10.4px;
    white-space: nowrap;
}
#todayPatients .patient-name,
#recentPatients .open-record-row .patient-name {
    font-size: 16px;
}
#recentPatients .open-record-row .patient-open-record-date {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary, #9ca3af);
    margin-top: 2px;
    line-height: 1.2;
}
#todayPatients .patient-service,
#recentPatients .open-record-row .patient-service {
    font-size: 11px;
    margin-top: 1px;
    line-height: 1.2;
}
#todayPatients .service-dot,
#recentPatients .open-record-row .service-dot {
    width: 8px;
    margin-right: 8px;
    border-radius: 4px;
}
#todayPatients .patient-item-actions,
#recentPatients .open-record-row .patient-item-actions {
    padding: 3px 6px;
    margin: -3px -6px;
}
#todayPatients .patient-item-actions .status-icon,
#recentPatients .open-record-row .patient-item-actions .status-icon {
    font-size: 16px;
}
#todayPatients .patient-item.schedule-list-hint {
    padding-top: 11px;
    padding-bottom: 11px;
    font-size: 12px;
    line-height: 1.35;
}
#todayPatients .schedule-free-slot-inner {
    gap: 6px;
}
#todayPatients .schedule-free-slot-chevron {
    width: 18px;
    font-size: 13px;
    opacity: 0.38;
}
#todayPatients .schedule-free-slot-title {
    font-size: 12px;
}
#todayPatients .schedule-free-slot-times {
    font-size: 11px;
}
#todayPatients .schedule-free-slot-body {
    gap: 2px;
}

/* Время + полоска услуги + текст — высота ряда по блоку с ФИО/услугой; полоска тянется как в «Открытых записях» */
.patient-item-inner {
    display: flex;
    align-items: stretch;
    flex: 1;
    min-width: 0;
}

.service-dot {
    display: block;
    width: 8px;
    flex-shrink: 0;
    align-self: stretch;
    min-height: 1em;
    border-radius: 4px;
    margin-right: 12px;
}

.patient-item-actions {
    display: flex;
    align-items: center;
    align-self: center;
    padding: 8px 12px;
    margin: -8px -12px;
    border-radius: 8px;
    flex-shrink: 0;
    pointer-events: none;
}

.patient-item-actions .status-icon {
    font-size: 24px;
}

.patient-time {
    font-size: 22px;
    font-weight: bold;
    color: var(--text-primary);
    min-width: 60px;
    flex-shrink: 0;
}
/* Тот же блок времени вне #todayPatients — пропорционально компактнее */
.patient-time.patient-time-range {
    line-height: 12px;
    text-align: center;
    margin-left: -8px;
    align-self: center;
}
.patient-time.patient-time-range .patient-time-start {
    font-size: 13px;
    font-weight: 700;
    line-height: 12px;
}
.patient-time.patient-time-range .patient-time-end {
    font-size: 9px;
    font-weight: 600;
    color: var(--text-secondary, #6b7280);
    line-height: 12px;
}
.patient-time.patient-time-range .patient-time-sep {
    font-size: 10px;
    opacity: 0.75;
    line-height: 12px;
}

.patient-info {
    flex: 1;
    min-width: 0;
    margin-left: 0;
}

.patient-name {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.patient-service {
    font-size: 16px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.record-dimmed {
    opacity: 0.55;
}

/* Финансовый блок и Открытые записи — светлая тема по умолчанию */
.expandable-block {
    background: var(--bg-card);
    border-radius: 16px;
    color: var(--text-primary);
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: none;
    border: none;
}

.expandable-header {
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    min-height: 65px;
    border-radius: 16px 16px 0 0;
}

.expandable-title {
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.expandable-arrow {
    font-size: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--border-light);
    border-radius: 20px;
    color: var(--text-primary);
}

.expandable-header:active {
    background: var(--bg-hover);
}

.expandable-content {
    padding: 12px 20px 16px 20px;
    display: none;
    border-top: 1px solid var(--border-light);
    background: var(--bg-card-alt);
}

.expandable-content.show {
    display: block;
}

/* «Открытые записи»: тот же фон, что у карточки блока (без bg-card-alt), отступы как у .patient-list */
#mainOpenRecordsBlock .expandable-header {
    padding-left: 16px;
    padding-right: 16px;
}
#openRecordsContent.expandable-content {
    background: transparent;
    padding: 0 16px 16px;
}

/* Открытые записи — светлая тема */
#recentPatients {
    max-height: 450px;
    overflow-y: auto;
}
.open-record-empty {
    padding: 12px 0;
    color: var(--text-secondary);
    font-size: 16px;
}
.open-record-row {
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
}
.open-record-row:last-child {
    border-bottom: none;
}
.open-record-row:hover {
    background: var(--bg-hover);
}

.open-record-row:active {
    background: var(--bg-active);
}

.open-record-row.record-dimmed {
    opacity: 0.55;
}

.finance-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 16px;
    padding: 4px 0;
    min-height: 28px;
    color: var(--text-primary);
}
/* Разделитель блока «сегодня» / «месяц» (как у итога за месяц) */
.finance-row-group-divider {
    padding-top: 6px;
    margin-top: 2px;
    border-top: 1px solid var(--border-light);
}

.finance-row-total {
    font-weight: 600;
    padding-top: 6px;
    margin-top: 2px;
    border-top: 1px solid var(--border-light);
}
.finance-row:last-child {
    margin-bottom: 0;
}
.finance-add-row {
    margin-top: 12px;
    padding-top: 4px;
    border-top: none;
}

.finance-total {
    font-size: 24px;
    font-weight: bold;
    border-top: 2px solid rgba(255,255,255,0.3);
    padding-top: 15px;
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    color: var(--accent-yellow);
}

/* Кнопка быстрой записи */
.quick-add {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 70px;
    height: 70px;
    background: var(--accent-primary);
    border-radius: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 40px;
    box-shadow: none;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.35);
    z-index: 1000;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.quick-add:active {
    transform: scale(0.96);
    opacity: 0.92;
}

/* Меню */
.side-menu {
    position: fixed;
    top: 0;
    left: -300px;
    width: 280px;
    height: 100vh;
    background: var(--bg-card);
    z-index: 1000;
    transition: left 0.3s ease;
    box-shadow: none;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
}

.side-menu.open {
    left: 0;
}

.menu-header {
    background: var(--gradient-menu);
    color: white;
    padding: 30px 20px;
}

.menu-avatar,
.menu-avatar-img {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    margin-bottom: 10px;
    object-fit: cover;
}
.menu-avatar {
    font-size: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.2);
}

.menu-name {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 5px;
}

.menu-email {
    font-size: 14px;
    opacity: 0.8;
}

.menu-google-btn {
    margin-top: 12px;
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.35);
    background: rgba(255,255,255,0.15);
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.menu-google-btn:active {
    background: rgba(255,255,255,0.25);
}

.menu-cloud-status {
    margin-top: 10px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0.9;
}
.menu-cloud-status.pending {
    color: #ffeaa7;
}
.menu-cloud-status.synced {
    color: #c8e6c9;
}
.menu-cloud-status.offline {
    color: rgba(255,255,255,0.75);
}

.menu-items {
    padding: 20px 0;
}

.menu-item {
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-primary);
    transition: background 0.15s ease;
}

.menu-item:not(.menu-item-theme):active {
    background: var(--bg-hover);
}

.menu-divider {
    height: 1px;
    background: var(--border-light);
    margin: 10px 0;
}

.menu-item.logout {
    color: var(--accent-error);
}

.menu-item-theme {
    justify-content: space-between;
    cursor: default;
}
.menu-item-theme:hover {
    background: transparent;
}
.menu-theme-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}

.menu-footer {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    border-top: 1px solid var(--border-light);
}

.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    display: none;
}

.menu-overlay.show {
    display: block;
}

/* Модальное окно */
#timeWarningModal,
#deletePatientConfirmModal {
    z-index: 2100;
}
/* Поверх окна редактирования записи / карточки */
#reminderEditModal {
    z-index: 2200;
}
.modal-centered {
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal {
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    overflow-y: auto;
}

.modal-content {
    background-color: var(--bg-card);
    margin: 20px auto;
    padding: 20px;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    box-shadow: none;
    border: none;
}

.developer-contact-text {
    font-size: 14px;
    line-height: 1.45;
    color: var(--text-secondary);
    margin-bottom: 14px;
}

.patient-reminder-history-modal-content {
    max-width: 520px;
    height: auto;
    max-height: none;
    align-self: flex-start;
}

.patient-reminder-history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
    max-height: min(50vh, 360px);
    overflow-y: auto;
}

#patientReminderHistoryModal {
    align-items: flex-start;
    justify-content: center;
    padding: 20px 0;
    box-sizing: border-box;
}

.patient-reminder-history-item {
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--bg-card-alt);
    border: 1px solid var(--border-light);
}

.patient-reminder-history-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.patient-reminder-history-date {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.patient-reminder-history-status {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    white-space: nowrap;
}

.patient-reminder-history-text {
    font-size: 15px;
    line-height: 1.45;
    color: var(--text-primary);
}

.patient-reminder-history-meta {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.close-modal {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-modal:hover,
.close-modal:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.close-modal:active {
    opacity: 0.55;
}

.modal-input {
    width: 100%;
    padding: 12px;
    margin: 8px 0 16px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-primary);
    border-radius: 8px;
    font-size: 16px;
}
.modal-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Напоминание: подпись времени + кнопка очистки */
.reminder-time-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 4px;
}
.reminder-time-label-row label {
    margin: 0;
    flex: 1;
}
#reminderEditModal .reminder-time-label-row + .modal-input {
    margin-top: 0;
}
.modal-textarea-auto,
#editAppointmentScreen textarea.modal-input,
#editAppointmentModal textarea.modal-input,
#editPatientModal textarea.modal-input {
    resize: none;
    overflow: hidden;
    min-height: 44px;
}

/* Маленькое окошко предупреждения */
.warning-modal-content {
    max-width: 340px !important;
    padding: 20px;
}
.warning-modal-text {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 20px;
    line-height: 1.4;
}
.form-actions-warning {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}
.form-actions-warning .cancel-btn,
.form-actions-warning .save-btn {
    flex: 1;
    min-width: 0;
}

.patient-link {
    cursor: pointer;
    transition: background 0.2s;
}
.patient-link:active {
    background: var(--bg-hover);
}

/* Меню действий с телефоном (звонок, WhatsApp, Telegram, MAX, WeChat) */
.phone-actions-overlay {
    position: fixed;
    z-index: 2500;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
}
.phone-actions-sheet {
    position: fixed;
    z-index: 2501;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-card);
    border-radius: 20px 20px 0 0;
    padding: 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    box-shadow: none;
    border-top: 1px solid var(--border-light);
}
.phone-actions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.phone-actions-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}
.phone-actions-close {
    font-size: 28px;
    color: var(--text-muted);
    cursor: pointer;
}
.phone-actions-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.phone-action-icon-img {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    object-fit: contain;
}
.phone-action-btn {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    height: 48px;
    padding: 0 14px;
    background: var(--bg-card-alt);
    border-radius: 12px;
    font-size: 15px;
    line-height: 1;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.2s;
}
.phone-action-btn:hover,
.phone-action-btn:active {
    background: var(--border-light);
}

/* Настройки — строки услуг (2 ряда). Справа без padding — действия на одной вертикали с кнопкой «➕» под списком. */
.service-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
    padding: 12px 0 12px 12px;
    background: var(--bg-card-alt);
    border-radius: 8px;
    gap: 10px;
}
.service-row-single {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
}
.service-row .service-name {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    color: var(--text-primary);
    word-wrap: break-word;
}
.service-row .service-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Новая / редактирование записи — цвет в календаре */
.appointment-calendar-color-group {
    position: relative;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Скрытый нативный color input: значение и программный вызов диалога */
.appointment-calendar-native-color {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    border: 0;
    opacity: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.appointment-calendar-presets {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 4px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}
.appointment-calendar-preset {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}
.appointment-calendar-preset--selected {
    box-shadow: 0 0 0 2px var(--bg-primary), 0 0 0 4px var(--accent-primary);
}
.appointment-calendar-preset--custom {
    background: var(--bg-input);
    border-style: dashed;
}
.appointment-calendar-preset--custom.appointment-calendar-preset--swatch-filled {
    border-style: solid;
    background: var(--custom-fill, var(--bg-input));
}
.appointment-calendar-preset--custom.appointment-calendar-preset--selected {
    border-color: var(--border-color);
}
.appointment-calendar-preset-plus {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    line-height: 0;
    pointer-events: none;
    user-select: none;
}
.appointment-calendar-preset-plus-icon {
    display: block;
    flex-shrink: 0;
    color: var(--text-secondary);
}
.appointment-calendar-preset--custom.appointment-calendar-preset--swatch-filled .appointment-calendar-preset-plus-icon {
    color: #fff;
    filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.45));
}
.appointment-calendar-preset:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.settings-default-duration-group {
    margin-top: 4px;
}
.settings-default-duration-group select {
    width: 100%;
}

/* Настройки — строки видов дохода/расхода (2 ряда). Справа без padding — «Удалить» на одной линии с «➕». */
.finance-category-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
    padding: 12px 0 12px 12px;
    background: var(--bg-card-alt);
    border-radius: 8px;
    gap: 10px;
}
.finance-category-row-top {
    display: flex;
    align-items: center;
}
.finance-category-row .finance-category-name {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    color: var(--text-primary);
    word-wrap: break-word;
}
.finance-category-row-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
}
.finance-category-row .finance-category-amount {
    width: 90px;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 14px;
}
.finance-category-row .finance-category-amount:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Настройки — вид карточки (как Услуги) */
.settings-list {
    margin-bottom: 12px;
}
.settings-list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    margin-bottom: 8px;
    background: var(--bg-card-alt);
    border-radius: 8px;
    font-size: 14px;
}
.settings-list-label {
    flex: 1;
    color: var(--text-primary);
    font-size: 14px;
}
.settings-list-row-inline {
    display: flex;
    align-items: center;
    gap: 8px;
}
.settings-checkbox {
    width: 24px;
    height: 24px;
    cursor: pointer;
}

/* Строки списка (аллергии, хронические). Справа без внутреннего padding — край «Удалить» совпадает с кнопкой «➕» в .form-row ниже (у секции общий padding .settings-section-content). */
.simple-list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0 12px 12px;
    margin-bottom: 8px;
    background: var(--bg-card-alt);
    border-radius: 8px;
    font-size: 14px;
}
.simple-list-row .simple-list-name {
    flex: 1;
    min-width: 0;
    color: var(--text-primary);
}
.simple-list-row .simple-list-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Сворачиваемые секции настроек */
.settings-section-collapsible {
    margin-bottom: 16px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-card-alt);
}
.settings-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    cursor: pointer;
    user-select: none;
}
.settings-section-header:hover {
    background: var(--bg-hover);
}

.settings-section-header:active {
    background: var(--bg-active);
}

.settings-section-header .section-subtitle {
    margin-bottom: 0;
}
.settings-section-arrow {
    font-size: 14px;
    color: var(--text-muted);
    transition: transform 0.2s;
}
.settings-section-collapsible.collapsed .settings-section-arrow {
    transform: rotate(-90deg);
}
.settings-section-content {
    padding: 16px;
    border-top: 1px solid var(--border-light);
}
.settings-section-collapsible.collapsed .settings-section-content {
    display: none;
}

/* В тёмной теме — кнопки настроек как в светлой */
[data-theme="dark"] .settings-add-btn {
    background: #27ae60;
    color: white;
    border-color: #1e8449;
}
[data-theme="dark"] .settings-edit-btn {
    background: #f39c12;
    color: white;
    border-color: #c87f0a;
}
[data-theme="dark"] .settings-del-btn {
    background: #e74c3c;
    color: white;
    border-color: #c0392b;
}

/* Тема — не переносить текст */
.menu-item-theme-label {
    white-space: nowrap;
}

/* ========== ПЕРЕКЛЮЧАТЕЛЬ ТЕМЫ (в меню) ========== */
.theme-toggle-switch {
    position: relative;
    width: 56px;
    height: 30px;
    background: var(--border-light);
    border-radius: 15px;
    cursor: pointer;
    transition: background 0.3s;
}
.theme-toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    box-shadow: none;
    transition: transform 0.3s;
}
.theme-toggle-switch.dark::after {
    transform: translateX(26px);
}
.theme-toggle-switch.dark {
    background: var(--accent-primary);
}
.theme-toggle-text {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Тёмная тема — блоки Открытые записи и Финансы */
[data-theme="dark"] .expandable-block {
    background: var(--gradient-dark);
    color: white;
    border-color: transparent;
}
[data-theme="dark"] .expandable-arrow {
    background: rgba(255,255,255,0.15);
    color: white;
}
[data-theme="dark"] .expandable-content {
    border-top-color: rgba(255,255,255,0.15);
    background: rgba(0,0,0,0.2);
}
[data-theme="dark"] #openRecordsContent.expandable-content {
    background: transparent;
}
[data-theme="dark"] .open-record-empty {
    color: rgba(255,255,255,0.8);
}
[data-theme="dark"] .open-record-row {
    border-bottom-color: rgba(255,255,255,0.15);
}
[data-theme="dark"] .open-record-row:hover {
    background: rgba(255,255,255,0.05);
}
[data-theme="dark"] .patient-item[data-aid]:hover {
    background: rgba(255,255,255,0.05);
}
[data-theme="dark"] #recentPatients .open-record-row .patient-open-record-date {
    color: rgba(255, 255, 255, 0.72);
}
[data-theme="dark"] .finance-row {
    color: white;
}
[data-theme="dark"] .patient-item.schedule-list-hint {
    color: rgba(255, 255, 255, 0.92);
}
[data-theme="dark"] .patient-item.schedule-list-hint.schedule-list-hint--tap-add:hover {
    background: rgba(255, 255, 255, 0.05);
}
[data-theme="dark"] .patient-item.schedule-list-hint.schedule-list-hint--tap-add:active {
    background: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .schedule-free-slot-title,
[data-theme="dark"] .schedule-free-slot-time-dur,
[data-theme="dark"] .schedule-free-slot-time-sep {
    color: rgba(255, 255, 255, 0.65);
}
[data-theme="dark"] .schedule-free-slot-times,
[data-theme="dark"] .schedule-free-slot-time-strong {
    color: rgba(255, 255, 255, 0.95);
}
[data-theme="dark"] .schedule-free-slot-chevron {
    color: rgba(255, 255, 255, 0.38);
}
[data-theme="dark"] .patient-item.schedule-free-slot:hover {
    background: rgba(255, 255, 255, 0.05);
}
[data-theme="dark"] .patient-item.schedule-free-slot:active {
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .finance-add-row {
    border-top: none;
}
/* Тёмная тема — иконки и элементы */
[data-theme="dark"] .main-calendar-unified .calendar-icon:not(.calendar-icon-light) {
    filter: brightness(0) invert(1);
}
[data-theme="dark"] .calendar-icon-light {
    filter: none;
}
[data-theme="dark"] .back-button,
[data-theme="dark"] .close-button {
    color: var(--text-inverse);
}
[data-theme="dark"] .settings-section-header .section-subtitle:first-child {
    color: var(--text-primary);
}
[data-theme="dark"] .section-icon:not(.section-icon-light) {
    filter: brightness(0) invert(1);
}
[data-theme="dark"] .section-icon-light {
    filter: none;
}
[data-theme="dark"] #contentWorkTime .section-subtitle,
[data-theme="dark"] #contentWorkTime label,
[data-theme="dark"] .settings-section-header .section-subtitle {
    color: var(--text-primary);
}
[data-theme="dark"] .service-row {
    background: var(--bg-card-alt) !important;
    color: var(--text-primary) !important;
}
[data-theme="dark"] .service-row span {
    color: var(--text-primary) !important;
}
[data-theme="dark"] #incomeCategoriesList .finance-category-name,
[data-theme="dark"] #expenseCategoriesList .finance-category-name {
    color: var(--text-primary) !important;
}
[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="time"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.8;
}
[data-theme="dark"] .edit-button,
[data-theme="dark"] .search-button {
    color: var(--text-inverse);
}
[data-theme="dark"] .stats-number {
    color: var(--accent-success);
}
[data-theme="dark"] .stats-row span:first-child {
    color: var(--text-primary);
}

.settings-hint { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }

/* Настройки: шаблон сообщения пациенту — кнопки подстановок и превью */
.notify-messenger-insert-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}
.notify-messenger-chip {
    padding: 8px 12px;
    font-size: 14px;
    font-weight: var(--font-weight-semibold, 600);
    border-radius: var(--radius-md, 10px);
    border: 1px solid var(--border-color);
    background: var(--border-light);
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    line-height: 1.2;
    -webkit-tap-highlight-color: transparent;
}
.notify-messenger-chip:active {
    background: var(--bg-active);
}
.notify-messenger-chip:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}
[data-theme='dark'] .notify-messenger-chip {
    background: var(--bg-card-alt);
    color: var(--text-primary);
}
.notify-messenger-preview {
    background: var(--bg-card-alt);
    color: var(--text-primary);
    cursor: default;
}

.new-service-input { flex: 1; padding: 12px; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-input); color: var(--text-primary); }
.new-service-input:focus { outline: none; border-color: var(--accent-primary); }
.add-service-btn { background: var(--accent-success); color: white; border: 1px solid var(--accent-success-hover); padding: 0 20px; border-radius: 8px; font-weight: bold; cursor: pointer; }
.service-color-picker { width: 60px; height: 40px; padding: 4px; border-radius: 8px; cursor: pointer; border: 1px solid var(--border-color); }
.service-color-hex { flex: 1; padding: 12px; border: 1px solid var(--border-color); border-radius: 8px; font-family: monospace; background: var(--bg-input); color: var(--text-primary); }
.service-color-hex:focus { outline: none; border-color: var(--accent-primary); }

.pwa-install-modal {
    z-index: 2600;
}
.pwa-install-card {
    max-width: 380px;
    margin-top: 18vh;
    text-align: center;
}
.pwa-install-card h3 {
    margin: 0 0 10px;
    color: var(--text-primary);
    font-size: var(--text-xl);
}
.pwa-install-text {
    margin: 0 0 18px;
    font-size: 15px;
    line-height: 1.45;
    color: var(--text-secondary);
}
.pwa-install-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.pwa-install-actions .save-btn {
    width: 100%;
}
.pwa-install-later {
    width: 100%;
    min-height: var(--touch-min);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 15px;
    cursor: pointer;
}