/* ============================================================
   Медицинская клиника — Административная панель
   Полный admin.css (исправленный)
   ============================================================ */

/* Тёмная тема (по умолчанию) */
:root {
    --primary: #0ea5e9;
    --primary-dark: #0284c7;
    --primary-light: #0c4a6e;
    --primary-foreground: #ffffff;
    --success: #10b981;
    --success-light: #064e3b;
    --danger: #ef4444;
    --danger-light: #7f1d1d;
    --warning: #f59e0b;
    --warning-light: #78350f;
    --info: #3b82f6;

    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border: #334155;

    --sidebar-width: 260px;
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.2s ease;
}

/* Светлая тема */
:root[data-theme="light"] {
    --primary: #0ea5e9;
    --primary-dark: #0284c7;
    --primary-light: #e0f2fe;
    --primary-foreground: #ffffff;
    --success: #10b981;
    --success-light: #d1fae5;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --info: #3b82f6;

    --bg-dark: #f8fafc;
    --bg-card: #ffffff;
    --bg-hover: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --border: #e2e8f0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-secondary); border-radius: 3px; }

/* ---------- Страница логина ---------- */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

:root[data-theme="light"] .login-container {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
}

/* Кнопка переключения темы */
.theme-toggle {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.6rem;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-primary);
}
.theme-toggle:hover {
    background: var(--border);
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.08);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.login-form .form-group {
    margin-bottom: 1.25rem;
}

.login-form label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
}

.login-form input {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14,165,233,0.2);
}

.btn-block {
    width: 100%;
    margin-top: 1rem;
}

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.login-footer a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition);
}

.login-footer a:hover {
    color: var(--primary);
}

/* ---------- Контейнер и боковая панель ---------- */
.container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    box-shadow: 1px 0 8px rgba(0,0,0,0.03);
    z-index: 50;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.sidebar-nav {
    padding: 1rem 0;
}

.nav-group-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    border: 0;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 0.95rem;
    text-align: left;
    cursor: pointer;
    transition: var(--transition);
}

.nav-group-toggle:hover,
.nav-group.has-active > .nav-group-toggle {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-group-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-chevron {
    transition: transform 0.2s ease;
}

.nav-group.is-open > .nav-group-toggle .nav-chevron {
    transform: rotate(180deg);
}

.nav-submenu {
    display: none;
}

.nav-group.is-open > .nav-submenu {
    display: block;
}

.nav-subitem {
    padding-left: 3rem;
    font-size: 0.9rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    font-size: 0.95rem;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--primary);
    color: var(--primary-foreground);
    font-weight: 500;
}

.nav-icon {
    font-size: 1.2rem;
}

/* ---------- Основной контент ---------- */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 2rem;
    background: var(--bg-dark);
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.header-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-secondary);
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-admin {
    background: var(--primary-light);
    color: var(--primary);
}

/* ---------- Секции ---------- */
.content-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.content-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ---------- Таблицы ---------- */
.table-container {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.table-container.contracts-table-container {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.contracts-table-container:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.contracts-table {
    min-width: 1320px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.data-table th {
    background: var(--bg-hover);
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.8rem;
}

.data-table tr:hover td {
    background: var(--bg-hover);
}

.data-table .loading {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
}

.table-container.employee-report-table-container {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}

.employee-report-table-container:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.employee-report-table {
    width: max-content;
    min-width: 100%;
}

.employee-report-table th,
.employee-report-table td {
    white-space: nowrap;
}

.employee-report-table th:first-child,
.employee-report-table td:first-child {
    position: sticky;
    left: 0;
    min-width: 12rem;
}

.employee-report-table th:first-child {
    z-index: 3;
    background: var(--bg-hover);
    box-shadow: 1px 0 var(--border);
}

.employee-report-table td:first-child {
    z-index: 2;
    background: var(--bg-card);
    box-shadow: 1px 0 var(--border);
}

.employee-report-table tbody tr:hover td:first-child {
    background: var(--bg-hover);
}

.employee-report-table .report-sort-button {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    text-transform: inherit;
    letter-spacing: inherit;
    cursor: pointer;
}

.employee-report-table .report-sort-button:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}

/* ---------- Статусные бейджи ---------- */
.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
}

.status-active {
    background: var(--success-light);
    color: #34d399;
}

:root[data-theme="light"] .status-active {
    color: #065f46;
}

.status-blocked {
    background: var(--danger-light);
    color: #f87171;
}

.status-partial {
    background: var(--warning-light);
    color: #fcd34d;
}

:root[data-theme="light"] .status-partial {
    color: #92400e;
}

:root[data-theme="light"] .status-blocked {
    color: #991b1b;
}

/* ---------- Карточки ---------- */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.role-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: var(--transition);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.role-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

.role-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.role-card h3 {
    color: var(--primary);
    font-size: 1.1rem;
}

.role-card .description {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.role-card .permissions-list-mini {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.permission-tag {
    background: var(--bg-hover);
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.role-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* ---------- Кнопки ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: var(--primary-foreground);
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(14,165,233,0.3);
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-info {
    background: var(--info);
    color: #fff;
}

.btn-info:hover {
    background: #2563eb;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-logout {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-logout:hover {
    background: var(--danger-light);
    border-color: var(--danger);
    color: var(--danger);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

.btn-icon {
    padding: 0.375rem;
    font-size: 1rem;
}

/* ---------- Формы ---------- */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
}

.form-input,
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group input[type="password"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-input:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14,165,233,0.2);
}

.form-input::placeholder,
.form-group input::placeholder {
    color: var(--text-secondary);
}

.checkbox-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    max-height: 200px;
    overflow-y: auto;
    padding: 0.5rem;
    background: var(--bg-dark);
    border-radius: var(--radius-sm);
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    margin: 0;
    color: var(--text-primary);
}

.checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

/* ---------- Модальные окна ---------- */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal.modal--above {
    z-index: 1001;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.1);
}

.modal-large {
    max-width: 700px;
}

.modal-fullwidth {
    max-width: 95vw;
    width: 95%;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.25rem;
    border-top: 1px solid var(--border);
}

/* ---------- Разное ---------- */
.permissions-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.permission-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem;
    text-align: center;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.clients-toolbar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
    gap: 0.65rem;
    align-items: end;
    margin-bottom: 0.65rem;
}

.clients-toolbar .form-input {
    min-width: 0;
}

.clients-date-filter {
    display: grid;
    min-width: 0;
    gap: 0.25rem;
}

.clients-date-filter > span,
.clients-total-count {
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.clients-total-count {
    margin: 0.5rem 0;
}

.client-full-page {
    min-width: 0;
}

.client-full-page-header {
    position: sticky;
    top: 0;
    z-index: 8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 0;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border);
}

.client-full-page-title {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

.client-full-page-title h2 {
    margin: 0.3rem 0;
    overflow-wrap: anywhere;
}

.client-full-page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    justify-content: flex-end;
}

.client-full-page-contact-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
}

.client-full-page-contact-actions[hidden] {
    display: none;
}

.client-full-page-tabs {
    position: sticky;
    top: 5.2rem;
    z-index: 7;
    display: flex;
    gap: 0.35rem;
    overflow-x: auto;
    padding: 0.7rem 0;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border);
}

.client-full-page-tabs button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    flex: 0 0 auto;
    padding: 0.55rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    font: inherit;
}

.client-profile-tab-count {
    display: inline-flex;
    min-width: 1.25rem;
    justify-content: center;
    padding: 0.05rem 0.3rem;
    border-radius: 999px;
    background: color-mix(in srgb, currentColor 14%, transparent);
    font-size: 0.72rem;
    line-height: 1.5;
}

.client-full-page-tabs button.active {
    border-color: var(--primary);
    background: var(--primary);
    color: var(--primary-foreground);
}

.client-full-page-tabs button:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.client-full-page-content {
    min-height: 260px;
    padding-top: 1rem;
}

.client-profile-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.client-profile-error {
    display: grid;
    justify-items: start;
    gap: 0.6rem;
    padding: 1rem;
    border: 1px solid var(--danger);
    border-radius: var(--radius-sm);
    color: var(--danger);
}

.client-profile-error p {
    margin: 0;
}

.client-payment-remaining {
    display: block;
    margin-top: 0.35rem;
    color: var(--text-secondary);
}

.client-row-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.25rem;
}

.client-tag-chip {
    display: inline-flex;
    padding: 0.12rem 0.4rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    color: var(--primary);
    font-size: 0.7rem;
    font-weight: 500;
}

.client-source-label {
    color: var(--text-secondary);
    font-size: 0.72rem;
}

.client-profile-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
    gap: 0.6rem;
    margin: 0.85rem 0;
}

.client-profile-summary-item {
    display: grid;
    gap: 0.25rem;
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-dark);
}

.client-profile-summary-item span {
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.client-profile-summary-item strong {
    overflow-wrap: anywhere;
}

.client-profile-follow-ups {
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.4fr) auto;
    align-items: center;
    gap: 0.75rem;
    margin: 0.75rem 0;
    padding: 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
}

.client-profile-follow-ups.has-overdue {
    border-color: var(--warning, #d97706);
}

.client-profile-follow-up-count {
    font-weight: 600;
}

.client-profile-next-follow-up {
    display: grid;
    gap: 0.2rem;
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.client-profile-next-follow-up strong {
    color: var(--text-primary);
}

.client-profile-next-follow-up span {
    overflow-wrap: anywhere;
}

.client-profile-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 0.6rem;
    margin-bottom: 0.85rem;
}

.client-profile-filters .form-group {
    flex: 1 1 11rem;
    min-width: 0;
    margin: 0;
}

.client-profile-filter-actions {
    display: flex;
    flex-wrap: wrap;
    flex: 0 0 auto;
    gap: 0.4rem;
}

.client-finances-mobile {
    display: none;
}

.client-finance-mobile-card {
    display: grid;
    gap: 0.7rem;
    padding: 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-dark);
}

.client-finance-mobile-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.client-finance-mobile-header > div {
    display: grid;
    gap: 0.2rem;
}

.client-finance-mobile-header time {
    color: var(--text-secondary);
    font-size: 0.76rem;
}

.client-finance-mobile-header strong {
    overflow-wrap: anywhere;
}

.client-finance-mobile-type {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.client-finance-mobile-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
    margin: 0;
}

.client-finance-mobile-details > div {
    min-width: 0;
}

.client-finance-mobile-details dt {
    color: var(--text-secondary);
    font-size: 0.72rem;
}

.client-finance-mobile-details dd {
    margin: 0.15rem 0 0;
    overflow-wrap: anywhere;
}

.client-interaction-form {
    display: grid;
    grid-template-columns: minmax(120px, 0.7fr) minmax(180px, 1.4fr)
        minmax(150px, 1fr) minmax(150px, 1fr) auto;
    align-items: end;
    gap: 0.6rem;
    margin-bottom: 0.8rem;
}

.client-interaction-form .form-group {
    min-width: 0;
    margin: 0;
}

.client-interaction-form-actions,
.client-interaction-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
}

.client-interaction-actions {
    justify-content: flex-end;
}

.client-interaction-list {
    display: grid;
    gap: 0.55rem;
}

.client-interaction-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.25rem 0.75rem;
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-dark);
}

.client-interaction-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.8rem;
    color: var(--text-secondary);
    font-size: 0.76rem;
}

.client-interaction-note {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.client-follow-up-due {
    color: var(--warning, #d97706);
    font-size: 0.78rem;
}

.dashboard-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: -0.5rem 0 1rem;
}

.dashboard-date-label,
.dashboard-organization-filter > span {
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.dashboard-organization-filter {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: min(100%, 340px);
}

.dashboard-organization-filter .form-input {
    min-width: 0;
}

.dashboard-shortcuts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.dashboard-shortcuts .btn,
.dashboard-panel-action {
    font-size: 0.85rem;
}

.dashboard-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.dashboard-kpi {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    align-items: center;
    gap: 0.35rem 0.75rem;
    min-width: 0;
    padding: 1rem 1.1rem;
    text-align: left;
    border-top: 3px solid var(--primary);
}

.dashboard-kpi strong {
    grid-column: 1;
    color: var(--text-primary);
    font-size: clamp(1.2rem, 2vw, 1.55rem);
    overflow-wrap: anywhere;
}

.dashboard-kpi > span:last-child {
    grid-column: 1;
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.35;
}

.dashboard-kpi-icon {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
    color: var(--text-secondary);
    font-size: 1.35rem;
}

.dashboard-kpi.is-income { border-top-color: var(--success); }
.dashboard-kpi.is-expense { border-top-color: var(--danger); }
.dashboard-kpi.is-balance { border-top-color: var(--primary); }
.dashboard-kpi.is-appointments { border-top-color: #8b5cf6; }
.dashboard-kpi.is-employees { border-top-color: #f59e0b; }
.dashboard-kpi.is-income strong,
.dashboard-chart-legend .is-income::before { color: var(--success); }
.dashboard-kpi.is-expense strong,
.dashboard-chart-legend .is-expense::before { color: var(--danger); }

.dashboard-content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 1fr);
    gap: 0.9rem;
}

.dashboard-panel {
    min-width: 0;
    padding: 1.1rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.dashboard-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.8rem;
}

.dashboard-panel-header h3 {
    margin: 0;
    font-size: 1rem;
}

.dashboard-business-summary {
    margin-bottom: 0.9rem;
}

.dashboard-business-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 0.75rem;
}

.dashboard-business-summary-card {
    min-width: 0;
    padding: 0.85rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.dashboard-business-summary-card h4 {
    margin: 0 0 0.6rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.4;
}

.dashboard-business-summary-count {
    display: block;
    color: var(--text-primary);
    font-size: 1.6rem;
    line-height: 1.2;
}

.dashboard-business-summary-list {
    display: grid;
    gap: 0.15rem;
    max-height: 190px;
    overflow: auto;
}

.dashboard-business-summary-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.82rem;
}

.dashboard-business-summary-row:last-child {
    border-bottom: 0;
}

.dashboard-business-summary-row span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.dashboard-business-summary-row strong {
    flex: 0 0 auto;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.dashboard-panel-count {
    flex: 0 0 auto;
    color: var(--text-secondary);
    font-size: 0.83rem;
}

.dashboard-schedule-list,
.dashboard-employee-list,
.dashboard-audit-list {
    display: grid;
    gap: 0.55rem;
}

.dashboard-schedule-list {
    max-height: 410px;
    overflow: auto;
}

.dashboard-appointment-row {
    display: grid;
    grid-template-columns: 3.4rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.75rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.dashboard-appointment-time {
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

.dashboard-appointment-details {
    display: grid;
    min-width: 0;
    gap: 0.15rem;
}

.dashboard-appointment-details strong,
.dashboard-appointment-details span,
.dashboard-appointment-details small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-appointment-details strong {
    font-size: 0.9rem;
}

.dashboard-appointment-details span,
.dashboard-appointment-details small {
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.dashboard-appointment-status {
    padding: 0.25rem 0.45rem;
    border-radius: 999px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.7rem;
    white-space: nowrap;
}

.dashboard-appointment-status.is-performed {
    background: color-mix(in srgb, var(--success) 14%, transparent);
    color: var(--success);
}

.dashboard-employee-row,
.dashboard-audit-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0.65rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
}

.dashboard-employee-row span:last-child,
.dashboard-audit-row time {
    color: var(--text-secondary);
    text-align: right;
}

.dashboard-empty-state {
    padding: 1.25rem 0.75rem;
    color: var(--text-secondary);
    text-align: center;
    font-size: 0.88rem;
}

.dashboard-panel-action {
    margin-top: 0.8rem;
}

.dashboard-text-link {
    padding: 0.25rem;
    border: 0;
    background: transparent;
    color: var(--primary);
    cursor: pointer;
    font: inherit;
    font-size: 0.82rem;
}

.dashboard-finance-chart {
    min-height: 210px;
    overflow-x: auto;
}

.dashboard-finance-chart svg {
    display: block;
    width: 100%;
    min-width: 460px;
    height: auto;
}

.dashboard-chart-gridline {
    stroke: var(--border);
    stroke-width: 1;
}

.dashboard-chart-label {
    fill: var(--text-secondary);
    font-size: 10px;
}

.dashboard-chart-income { fill: var(--success); }
.dashboard-chart-expense { fill: var(--danger); }

.dashboard-chart-legend {
    display: flex;
    gap: 1rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.dashboard-chart-legend span::before {
    display: inline-block;
    width: 0.55rem;
    height: 0.55rem;
    margin-right: 0.4rem;
    border-radius: 2px;
    background: currentColor;
    content: "";
}

.dashboard-audit-row {
    align-items: flex-start;
}

.dashboard-audit-row span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.dashboard-audit-row time {
    flex: 0 0 auto;
    font-size: 0.75rem;
}

.refunds-toolbar {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1rem;
    margin-bottom: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.refunds-toolbar .form-group {
    margin: 0;
    min-width: 180px;
}

.refunds-toolbar .btn {
    min-height: 42px;
}

.contract-date-presets {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.contract-date-range-hint {
    flex-basis: 100%;
    color: var(--text-secondary);
}

.refunds-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.contracts-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.contracts-pagination label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.contracts-pagination select {
    width: auto;
    min-width: 5rem;
}

.fin-operations-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.fin-operations-pagination label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.fin-operations-pagination select {
    width: auto;
    min-width: 5rem;
}

.fin-operations-table-container {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.fin-operations-table-container:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.fin-operations-table {
    min-width: 1240px;
}

.fin-op-amount-income {
    color: var(--success);
}

.fin-op-amount-expense {
    color: var(--danger);
}

.refund-summary-card {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    min-height: 126px;
    padding: 1.1rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.refund-summary-paid {
    border-left-color: #22a06b;
}

.refund-summary-unpaid {
    border-left-color: #e5a000;
}

.refund-summary-label,
.refund-summary-details {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.refund-summary-card strong {
    color: var(--text-primary);
    font-size: 1.5rem;
    line-height: 1.2;
}

@media (max-width: 600px) {
    .refunds-toolbar {
        align-items: stretch;
    }

    .refunds-toolbar .form-group,
    .refunds-toolbar .btn {
        width: 100%;
    }

    .refunds-toolbar .contract-date-presets {
        width: 100%;
    }

    .refunds-toolbar .contract-date-presets .btn {
        width: auto;
        flex: 1 1 7rem;
    }
}

/* Записи */
.appointments-page-header {
    align-items: flex-start;
    gap: 1rem;
}

.appointments-toolbar {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.75rem;
    min-width: 0;
}

.appointments-date-navigation,
.appointments-filters {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.appointment-date-filter,
.appointment-filter {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.appointment-date-input {
    width: auto;
    min-width: 10rem;
}

.appointment-filter {
    min-width: 10rem;
}

.appointments-daily-summary {
    margin-bottom: 1rem;
}

.appointments-daily-summary-heading {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    margin-bottom: 0.65rem;
}

.appointments-daily-summary-heading h3,
.appointments-daily-summary-heading p {
    margin: 0;
}

.appointments-daily-summary-heading h3 {
    font-size: 1rem;
}

.appointments-daily-summary-heading p,
.appointments-daily-summary-help {
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

.appointments-daily-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: 0.75rem;
}

.appointments-daily-summary-card {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0.65rem;
    background: var(--bg-card);
}

.appointments-daily-summary-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.appointments-daily-summary-value {
    color: var(--text-primary);
    font-size: 1.5rem;
    line-height: 1.2;
}

.appt-cell {
    cursor: pointer;
    height: 48px;
    min-height: 48px;
    max-height: 48px;
    padding: 0 !important;
    vertical-align: top;
    position: relative;
    overflow: visible;
    transition: background 0.2s;
}
.appt-cell:hover {
    background: var(--bg-hover) !important;
}
.appt-cell:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: -3px;
    z-index: 4;
}
.appt-cell.drag-over {
    background: var(--primary-light) !important;
}

.appt-item {
    position: absolute;
    top: 0;
    left: 2px;
    right: 2px;
    z-index: 2;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    color: white;
    overflow: hidden;
}

.appt-item:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
    box-shadow: 0 0 0 5px var(--primary);
    z-index: 4;
}

.appointment-reschedule-fields {
    margin-bottom: 1rem;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.appointment-reschedule-fields[hidden] {
    display: none;
}

.appointment-reschedule-fields h4 {
    margin: 0 0 0.75rem;
}

.appointment-reschedule-fields-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.appt-item-stacked {
    width: calc(50% - 4px);
}
.appt-item-stacked:nth-child(1) {
    left: 2px;
    right: auto;
}
.appt-item-stacked:nth-child(2) {
    left: auto;
    right: 2px;
}

/* Поиск */
.search-dropdown {
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    animation: fadeInDown 0.15s ease;
}
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 300px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    animation: slideIn 0.3s ease;
}
.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Выбранные теги */
.selected-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--primary-light);
    color: var(--primary);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.85rem;
}
.selected-tag-remove {
    cursor: pointer;
    font-weight: bold;
    opacity: 0.7;
}
.selected-tag-remove:hover { opacity: 1; }

/* Адаптивность */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    .main-content {
        margin-left: 0;
    }
    .cards-grid {
        grid-template-columns: 1fr;
    }
}

.appt-resize-handle {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 8px;
    cursor: ns-resize;
    background: transparent;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
    pointer-events: auto;
    z-index: 3;
}
.appt-resize-handle:hover {
    background: rgba(255, 255, 255, 0.25);
}
.appt-resize-handle:active {
    background: rgba(255, 255, 255, 0.35);
}

/* ============================================================
   Client Details Modal (cd-*)
   ============================================================ */

.cd-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.cd-name {
    margin: 0 0 0.5rem;
    font-size: 1.35rem;
    font-weight: 700;
}

.cd-summary {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.cd-summary-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 110px;
    padding: 0.6rem 0.9rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-hover);
}

.cd-summary-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.cd-summary-value {
    font-size: 1.05rem;
    font-weight: 700;
}

.cd-summary-income .cd-summary-value { color: var(--success); }
.cd-summary-expense .cd-summary-value { color: var(--danger); }
.cd-summary-balance .cd-summary-value { color: var(--primary); }
.cd-summary-pending .cd-summary-value { color: var(--warning, #d97706); }

.client-sensitive-notice {
    margin: 0.75rem 0 0;
    color: var(--text-secondary);
    font-size: 0.84rem;
}

.cd-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    margin-bottom: 1rem;
}

.cd-card-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.cd-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 0.4rem;
    border-radius: 9999px;
    background: var(--primary);
    color: var(--primary-foreground);
    font-size: 0.72rem;
    font-weight: 700;
}

.cd-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.cd-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.cd-table th,
.cd-table td {
    padding: 0.6rem 0.85rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.cd-table th {
    background: var(--bg-hover);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.cd-table tbody tr:last-child td {
    border-bottom: none;
}

.cd-table tbody tr:hover td {
    background: var(--bg-hover);
}

.client-profile-statuses,
.client-profile-row-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.client-profile-statuses .status-badge {
    white-space: nowrap;
}

.client-profile-row-actions .btn {
    min-width: 2rem;
    padding: 0.35rem 0.5rem;
}

.cd-empty {
    padding: 1rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
}

.cd-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.25rem 1.5rem;
}

.cd-info-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border);
}

.cd-info-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    flex-shrink: 0;
}

.cd-info-value {
    text-align: right;
    word-break: break-word;
    font-size: 0.85rem;
}

.cd-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.55rem;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 600;
}

.cd-type-income {
    background: var(--success-light);
    color: var(--success);
}

.cd-type-expense {
    background: var(--danger-light);
    color: var(--danger);
}

.cd-amount-income { color: var(--success); font-weight: 600; }
.cd-amount-expense { color: var(--danger); font-weight: 600; }

@media (max-width: 768px) {
    .cd-info-grid { grid-template-columns: 1fr; }
    .cd-summary { width: 100%; }
}

.reports-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
    gap: 0.75rem;
    align-items: end;
    padding: 1rem;
    margin-bottom: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.reports-filters .form-group {
    min-width: 0;
    margin: 0;
}

.reports-filters .form-group span {
    display: block;
    margin-bottom: 0.4rem;
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.reports-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.reports-tabs .active {
    background: var(--primary);
    color: var(--primary-foreground);
}

.reports-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.employee-report-note {
    grid-column: 1 / -1;
    margin: 0;
}

.report-kpi,
.report-panel {
    min-width: 0;
    padding: 1.1rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.report-kpi {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.report-kpi span,
.report-kpi small,
.report-footnote {
    color: var(--text-secondary);
    font-size: 0.84rem;
}

.report-kpi strong {
    color: var(--text-primary);
    font-size: 1.35rem;
    overflow-wrap: anywhere;
}

.report-kpi small {
    line-height: 1.45;
}

.report-panel {
    margin-bottom: 1rem;
}

.report-panel h3 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
}

.report-chart {
    width: 100%;
    min-height: 120px;
    overflow-x: auto;
}

.reports-svg {
    display: block;
    width: 100%;
    min-width: 560px;
    max-height: 420px;
}

.report-gridline {
    stroke: var(--border);
    stroke-width: 1;
}

.report-bar-primary {
    fill: var(--primary);
}

.report-bar-secondary {
    fill: var(--danger);
}

.report-axis-label,
.report-item-label,
.report-legend {
    fill: var(--text-secondary);
    font-size: 11px;
}

.report-footnote {
    margin: 0.75rem 0 0;
    line-height: 1.5;
}

@media (max-width: 600px) {
    .appointments-page-header {
        align-items: stretch;
        flex-direction: column;
    }

    .appointments-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .appointments-date-navigation {
        align-items: stretch;
    }

    .appointment-date-filter {
        flex: 1 1 100%;
    }

    .appointment-date-input {
        width: 100%;
    }

    .appointments-date-navigation .btn {
        flex: 1 1 5.5rem;
    }

    .appointments-filters {
        align-items: stretch;
    }

    .appointment-reschedule-fields-grid {
        grid-template-columns: 1fr;
    }

    .appointment-filter {
        flex: 1 1 9rem;
    }

    .client-full-page-header {
        align-items: stretch;
        flex-direction: column;
    }

    .client-full-page-title {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.35rem;
    }

    .client-full-page-actions {
        justify-content: flex-start;
    }

    .client-profile-filters {
        align-items: end;
    }

    .client-profile-filters .form-group {
        flex: 1 1 calc(50% - 0.3rem);
    }

    .client-profile-filter-actions {
        flex: 1 1 100%;
    }

    .client-finances-desktop {
        display: none;
    }

    .client-finances-mobile {
        display: grid;
        gap: 0.55rem;
    }

    .client-profile-follow-ups {
        grid-template-columns: 1fr;
    }

    .client-full-page-tabs {
        top: 8.5rem;
    }

    .clients-toolbar {
        grid-template-columns: 1fr 1fr;
    }

    .clients-toolbar > input[type="search"] {
        grid-column: 1 / -1;
    }

    .client-interaction-form {
        grid-template-columns: 1fr;
    }

    .client-interaction-item {
        grid-template-columns: 1fr;
    }

    .dashboard-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .dashboard-organization-filter {
        align-items: stretch;
        flex-direction: column;
        gap: 0.35rem;
    }

    .dashboard-content-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-appointment-row {
        grid-template-columns: 3rem minmax(0, 1fr);
    }

    .dashboard-appointment-status {
        grid-column: 2;
        justify-self: start;
    }

    .dashboard-shortcuts .btn {
        flex: 1 1 42%;
    }

    .reports-filters {
        grid-template-columns: 1fr 1fr;
    }

    .reports-filters > .btn {
        grid-column: 1 / -1;
    }

    .reports-summary {
        grid-template-columns: 1fr 1fr;
    }

    .report-kpi {
        padding: 0.9rem;
    }

    .report-kpi strong {
        font-size: 1.1rem;
    }
}