/* ============================================
   Утилитарный профессиональный стиль
   Медицинский фонд — Система консилиумов
   ============================================ */

:root {
    /* Цвета (сдержанная палитра) */
    --bg: #f8f9fb;
    --surface: #ffffff;
    --surface-2: #f1f3f5;
    --text: #1f2937;           /* тёмно-серый */
    --text-muted: #6b7280;
    --border: #e5e7eb;

    /* Акценты (без фанатизма) */
    --accent: #0f766e;         /* спокойный бирюзовый */
    --accent-hover: #0d5c57;
    --danger: #c2410c;         /* приглушённый оранжевый */
    --danger-hover: #9a3412;
    --success: #166534;
    --warning: #b45309;
}

/* Базовые стили */
* {
    box-sizing: border-box;
}

body {
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background-color: var(--bg);
    margin: 0;
    padding: 0;
}

h1, h2, h3 {
    font-weight: 600;
    line-height: 1.3;
    margin-top: 0;
}

h1 { font-size: 1.65rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.15rem; }

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Контейнер */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* Карточки / Секции */
.section,
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.section h2,
.section h3 {
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}

/* Таблицы */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

th, td {
    padding: 11px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--surface-2);
    font-weight: 600;
    color: var(--text);
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover {
    background: #f8fafc;
}

/* Tables inside .section look especially nice */
.section table {
    border: none;
    box-shadow: none;
    margin: -4px 0;
}

/* Формы — минимальные изменения */
label {
    display: block;
    font-weight: 500;
    margin-bottom: 5px;
    font-size: 0.9em;
}

form {
    display: flex;
    flex-direction: column;
    /* Базовый отступ между элементами формы */
    gap: 12px;
}

/* Не трогаем сильно поля ввода, только лёгкие улучшения */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
select,
textarea {
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
}

/* Кнопки */
button,
.btn {
    display: inline-block;
    padding: 10px 18px;
    font-size: 14.5px;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.1s ease;
    font-family: inherit;
    margin-top: 4px; /* небольшой отступ от предыдущего элемента */
}

button.primary,
.btn.primary {
    background-color: var(--accent);
    color: white;
}

button.primary:hover,
.btn.primary:hover {
    background-color: var(--accent-hover);
}

button.secondary,
.btn.secondary {
    background-color: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
}

button.secondary:hover,
.btn.secondary:hover {
    background-color: #e5e7eb;
}

button.danger,
.btn.danger {
    background-color: var(--danger);
    color: white;
}

button.danger:hover,
.btn.danger:hover {
    background-color: var(--danger-hover);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Ссылки как кнопки */
a.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Утилиты */
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }

/* Сообщения */
.success { color: var(--success); font-weight: 500; }
.error   { color: var(--danger);   font-weight: 500; }

/* Скрытые элементы */
.hidden { display: none !important; }

/* Сообщения об отсутствии данных (используется на многих страницах) */
.no-data {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 24px;
}

/* Пагинация */
.pagination {
    margin-top: 20px;
    text-align: center;
    font-size: 0.9em;
}

.pagination a,
.pagination span {
    margin: 0 6px;
    color: var(--text);
}

.pagination a {
    color: var(--accent);
}

.pagination a:hover {
    text-decoration: underline;
}

.sort-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: inherit;
    font: inherit;
    font-weight: 600;
    letter-spacing: inherit;
    text-transform: inherit;
    text-decoration: none;
    white-space: nowrap;
}

.sort-link:hover {
    color: var(--accent);
    text-decoration: none;
}

.sort-mark {
    font-size: 0.95em;
    line-height: 1;
}

/* ============================================
   HEADER / ШАПКА
   ============================================ */

.app-header {
    background-color: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    gap: 24px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 24px;
}

.header-brand {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
}

.header-brand:hover {
    text-decoration: none;
    color: var(--accent);
}

.header-breadcrumb {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.header-breadcrumb a {
    color: var(--text);
}

.header-breadcrumb a:hover {
    color: var(--accent);
}

.header-breadcrumb .separator {
    margin: 0 8px;
    color: #9ca3af;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.9rem;
}

.header-user {
    color: var(--text-muted);
}

.header-user strong {
    color: var(--text);
}

.header-nav a {
    color: var(--text);
    padding: 6px 12px;
    border-radius: 6px;
}

.header-nav a:hover {
    background-color: var(--surface-2);
    text-decoration: none;
}

.header-nav .admin-link {
    color: var(--accent);
    font-weight: 500;
}

/* ============================================
   Теги кодов МКБ-10 (используются в форме заключения и карточке ребёнка)
   ============================================ */

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.tag {
    background: #e0f2f1;
    color: #134e4b;
    padding: 3px 9px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    font-size: 0.82em;
    border: 1px solid #5eead4;
    max-width: 100%;
    line-height: 1.3;
}

.tag .mkb-code {
    font-family: monospace;
    font-weight: 600;
    color: #0ea5a0;
    margin-right: 5px;
    white-space: nowrap;
}

.tag .mkb-desc {
    /* В истории (карточка ребёнка) можно обрезать, в форме редактирования показываем полностью */
}

/* Компактные теги только с кодом (используются в карточке ребёнка) */
.tag.tag-code-only {
    padding: 2px 7px;
    font-size: 0.78em;
    background: #f0fdfa;
    border-color: #99f6e4;
    cursor: default;
}

.tag.tag-code-only .mkb-code {
    color: #0f766e;
    margin-right: 0;
}

.mkb-tag-list {
    margin-top: 6px;
}

/* ============================================
   Вход и двухфакторная аутентификация
   ============================================ */

.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 24px;
}

.auth-shell {
    width: 100%;
    max-width: 420px;
}

.auth-body-setup {
    align-items: flex-start;
}

.auth-shell-setup {
    max-width: 480px;
    margin: 12px auto 24px;
}

.auth-lead {
    margin: 0 0 8px;
    font-weight: 600;
}

.auth-apps {
    margin: 0 0 14px;
    padding-left: 1.2em;
}

.auth-apps li {
    margin-bottom: 4px;
}

.auth-brand {
    display: block;
    text-align: center;
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
}

.auth-brand:hover {
    color: var(--accent);
    text-decoration: none;
}

.auth-kicker {
    margin: 4px 0 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.auth-card h2 {
    margin-bottom: 16px;
}

.auth-card form {
    gap: 14px;
}

.auth-field label {
    margin-bottom: 6px;
}

.auth-card input[type="text"],
.auth-card input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    font: inherit;
    color: var(--text);
}

.auth-card button {
    width: 100%;
    margin-top: 4px;
}

.auth-help {
    margin: 0 0 14px;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.auth-note {
    margin: 14px 0 0;
    text-align: center;
}

.auth-link {
    margin: 16px 0 0;
    text-align: center;
    font-size: 0.9rem;
}

.auth-qr {
    display: flex;
    justify-content: center;
    margin: 8px 0 16px;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.auth-qr svg {
    width: 180px;
    height: 180px;
}

.auth-secret {
    margin: 0 0 16px;
    padding: 10px 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: 0.08em;
    background: var(--surface-2);
    border-radius: 6px;
    word-break: break-all;
}

.auth-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(31, 41, 55, 0.45);
}

.auth-modal {
    width: 100%;
    max-width: 380px;
    padding: 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
}

.auth-modal h2 {
    margin-bottom: 8px;
    font-size: 1.2rem;
}

.auth-modal p {
    margin: 0 0 16px;
    color: var(--text);
}

.auth-modal button {
    width: 100%;
}

/* Загрузка шаблона документа */
.template-modal-backdrop[hidden] {
    display: none !important;
}

.template-dialog {
    max-width: 440px;
}

.template-dialog .template-upload {
    max-width: none;
}

.template-upload-note {
    margin: 0 0 20px;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.template-upload {
    gap: 0;
}

.template-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.template-modal-actions .btn {
    width: auto;
    margin-top: 0;
}

.template-table-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.template-table-head h2 {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 10px;
}

.template-add {
    width: 36px;
    height: 36px;
    margin: 0 0 8px;
    padding: 0;
    font-size: 1.4rem;
    line-height: 1;
}

.template-page-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.template-page-head h1 {
    margin: 0;
}

.template-help {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin: 0;
    padding: 0;
    border-radius: 50%;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1;
}

.template-help-dialog {
    max-width: 640px;
    max-height: min(80vh, 720px);
    overflow: auto;
}

.template-help-dialog h3 {
    margin: 20px 0 8px;
    font-size: 1.05rem;
}

.template-help-dialog p,
.template-help-dialog li {
    font-size: 0.95rem;
}

.template-help-dialog ul {
    margin: 0 0 12px;
    padding-left: 1.2em;
}

.template-help-dialog li {
    margin-bottom: 6px;
}

.template-help-dialog code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.84em;
    background: var(--surface-2);
    padding: 1px 5px;
    border-radius: 4px;
}

.template-help-dialog pre {
    margin: 0 0 12px;
    padding: 12px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow-x: auto;
    white-space: pre-wrap;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.84rem;
    line-height: 1.45;
}

.template-help-dialog pre code {
    background: none;
    padding: 0;
}

.template-help-dialog table {
    margin: 0 0 12px;
    font-size: 0.88rem;
}

.template-help-dialog th {
    text-transform: none;
    letter-spacing: 0;
}

.template-help-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

.template-help-actions .btn {
    width: auto;
    margin-top: 0;
}

.template-row-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.template-row-actions form {
    display: inline-flex;
    flex-direction: row;
    gap: 0;
    margin: 0;
}

.template-row-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    margin-top: 0;
    padding: 0 12px;
    font-size: 0.85rem;
    line-height: 1;
}

.template-row-actions .template-icon-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    flex: 0 0 36px;
}

.template-row-actions .template-icon-btn svg {
    display: block;
    width: 24px;
    height: 24px;
    flex: 0 0 auto;
}

.template-empty {
    margin: 0;
    color: var(--text-muted);
}

.template-flashes {
    margin-bottom: 16px;
}

.template-flashes p {
    margin: 0 0 8px;
}

.template-field {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
}

.template-field label {
    margin-bottom: 8px;
}

.template-field input[type="text"],
.template-field input[type="file"] {
    width: 100%;
    padding: 10px 12px;
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.child-dialog {
    max-width: 640px;
}

.child-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 20px;
}

.child-form input[type="text"],
.child-form input[type="date"],
.child-form select {
    width: 100%;
    height: 42px;
    margin: 0;
    padding: 0 12px;
    font: inherit;
    line-height: 1.2;
    color: var(--text);
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.child-form select {
    appearance: none;
    padding-right: 36px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

@media (max-width: 640px) {
    .child-form-grid {
        grid-template-columns: 1fr;
    }
}

.template-field input[type="file"] {
    background: var(--surface-2);
    cursor: pointer;
}

.template-hint {
    margin: 8px 0 0;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.template-actions .btn {
    margin-top: 0;
}

/* Боковое меню админки и основного приложения. Шапка остаётся на месте, сдвигается только контент. */
body.has-admin-nav {
    --admin-nav-width: 256px;
    --admin-nav-rail: 72px;
}

body.has-admin-nav .container {
    max-width: 1200px;
    margin-left: max(var(--admin-nav-width), calc((100% - 1200px) / 2));
    margin-right: auto;
    transition: margin-left 0.2s ease;
}

body.has-admin-nav.admin-nav-collapsed .container {
    margin-left: max(var(--admin-nav-rail), calc((100% - 1200px) / 2));
    margin-right: auto;
}

.admin-sidebar .admin-nav-toggle {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 40px;
    margin: 0 0 8px;
    padding: 8px 12px 8px 14px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #344054;
    font: inherit;
    font-weight: 500;
    line-height: 1.25;
    text-align: left;
    cursor: pointer;
    transition: gap 0.2s ease;
}

.admin-nav-burger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    padding: 0 2px;
    box-sizing: border-box;
}

.admin-nav-burger span {
    display: block;
    height: 1.75px;
    background: currentColor;
    border-radius: 1px;
}

.admin-nav-toggle-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    transition: opacity 0.2s ease;
}

.admin-sidebar .admin-nav-toggle:hover {
    background: #f9fafb;
    color: #101828;
}

.admin-sidebar .admin-nav-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

body.admin-nav-collapsed .admin-sidebar .admin-nav-toggle {
    gap: 0;
}

body.admin-nav-collapsed .admin-nav-toggle-label {
    opacity: 0;
}

.admin-sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    width: var(--admin-nav-width, 256px);
    z-index: 90;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 12px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    transition: width 0.2s ease;
}

.admin-sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

body.admin-nav-collapsed .admin-sidebar {
    width: var(--admin-nav-rail, 72px);
    overflow: visible;
}

.users-section {
    overflow-x: auto;
}

.users-table-head {
    padding-bottom: 16px;
}

.users-table-head h2 {
    padding-bottom: 0;
}

.users-save {
    height: 36px;
    margin: 0;
    padding: 0 16px;
}

.users-table {
    min-width: 980px;
}

.users-table th,
.users-table td {
    vertical-align: middle;
}

.users-col-id {
    width: 56px;
}

.users-col-role {
    width: 180px;
}

.users-col-field {
    width: 22%;
}

.users-col-actions {
    width: 180px;
}

.users-table select,
.users-table input[type="text"] {
    width: 100%;
    height: 42px;
    margin: 0;
    padding: 0 12px;
    font: inherit;
    line-height: 1.2;
    color: var(--text);
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.users-table select {
    appearance: none;
    padding-right: 36px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.users-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}

.users-actions form {
    display: flex;
    flex-direction: row;
    gap: 0;
    margin: 0;
}

.users-actions .btn {
    width: 100%;
    height: 36px;
    margin: 0;
    padding: 0 12px;
    font-size: 0.85rem;
    line-height: 1;
    white-space: nowrap;
}

.admin-sidebar a {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 40px;
    padding: 8px 12px 8px 14px;
    border-radius: 8px;
    color: #344054;
    font-weight: 500;
    line-height: 1.25;
    text-decoration: none;
    white-space: nowrap;
    transition: gap 0.2s ease;
}

.admin-sidebar a span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.2s ease;
}

.admin-nav-icon {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    color: #667085;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.admin-sidebar a:hover {
    background: #f9fafb;
    color: #101828;
    text-decoration: none;
}

.admin-sidebar a:hover .admin-nav-icon,
.admin-sidebar a.is-active .admin-nav-icon {
    color: #344054;
}

.admin-sidebar a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.admin-sidebar a.is-active {
    background: #f2f4f7;
    color: #101828;
    font-weight: 600;
}

body.admin-nav-collapsed .admin-sidebar a {
    gap: 0;
}

body.admin-nav-collapsed .admin-sidebar a span {
    opacity: 0;
}

body.admin-nav-collapsed .admin-sidebar a:hover::after,
body.admin-nav-collapsed .admin-sidebar a:focus-visible::after,
body.admin-nav-collapsed .admin-sidebar .admin-nav-toggle:hover::after,
body.admin-nav-collapsed .admin-sidebar .admin-nav-toggle:focus-visible::after {
    content: attr(data-label);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    z-index: 2;
    transform: translateY(-50%);
    padding: 6px 10px;
    border-radius: 8px;
    background: #111827;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.18);
    pointer-events: none;
}

@media (max-width: 800px) {
    body.has-admin-nav .container,
    body.has-admin-nav.admin-nav-collapsed .container {
        margin-left: var(--admin-nav-rail);
        margin-right: 0;
    }

    body.has-admin-nav:not(.admin-nav-collapsed) .admin-sidebar {
        width: min(280px, calc(100vw - 48px));
        z-index: 110;
        box-shadow: 12px 0 32px rgba(15, 23, 42, 0.16);
    }

    body.has-admin-nav:not(.admin-nav-collapsed)::after {
        content: "";
        position: fixed;
        top: 56px;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 100;
        background: rgba(17, 24, 39, 0.35);
    }
}

.bmi-value {
    font-weight: 600;
}

.child-metrics {
    line-height: 1.35;
    white-space: nowrap;
}

.child-metrics .text-muted {
    display: block;
    margin-top: 2px;
    font-size: 0.85em;
}

.measure-accordion {
    padding: 0;
}

.measure-accordion summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 56px;
    padding: 16px 20px;
    cursor: pointer;
    list-style: none;
}

.measure-accordion summary::-webkit-details-marker {
    display: none;
}

.measure-accordion summary::after {
    content: "";
    width: 8px;
    height: 8px;
    margin-top: -4px;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: rotate(45deg);
    flex: none;
}

.measure-accordion[open] summary {
    border-bottom: 1px solid var(--border);
}

.measure-accordion[open] summary::after {
    margin-top: 4px;
    transform: rotate(-135deg);
}

.measure-accordion-title {
    font-size: 1.35rem;
    font-weight: 600;
    line-height: 1.3;
}

.measure-accordion-body {
    padding: 16px 20px 20px;
}

.measure-form {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 180px));
    gap: 16px 20px;
    align-items: end;
    margin-top: 20px;
}

.measure-form.exam-measure-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 0;
}

.measure-form.exam-measure-form.exam-measure-inline {
    margin-top: 16px;
}

.exam-bmi-line {
    grid-column: 1 / -1;
    margin: 0;
}

.measure-form label {
    margin-bottom: 8px;
}

.measure-form input[type="text"],
.measure-form input[type="date"] {
    width: 100%;
    height: 42px;
    margin: 0;
    padding: 0 12px;
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.measure-actions {
    grid-column: 1 / -1;
}

.measure-actions .btn {
    width: auto;
    margin-top: 0;
}

@media (max-width: 640px) {
    .measure-form,
    .measure-form.exam-measure-form {
        grid-template-columns: 1fr;
    }
}
