:root {
    --navy: #073d6f;
    --sidebar: #005da8;
    --sidebar-dark: #00457e;
    --accent: #0a6cbe;
    --accent-light: #e2f1fd;
    --surface: #f7fafd;
    --border: #b8d3ea;
    --text: #112b46;
    --muted: #64778b;
    --green: #14a33c;
    --red: #e74c3c;
    --shadow: 0 8px 24px rgba(5, 55, 99, .08);
    font-family: "Segoe UI", Arial, sans-serif;
    color: var(--text);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #fff; }
body { overflow-x: hidden; }
button, input, select, textarea { font: inherit; }
a { color: inherit; }

.app-shell { min-height: 100vh; display: flex; }
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 260px;
    display: flex;
    flex-direction: column;
    color: #fff;
    background: linear-gradient(180deg, var(--sidebar), var(--sidebar-dark));
    transition: width .2s ease, transform .2s ease;
    z-index: 20;
}
.brand {
    min-height: 126px;
    padding: 29px 27px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    text-decoration: none;
    font-size: 18px;
    line-height: 1.08;
    font-weight: 750;
}
.brand-icon { font-size: 45px; line-height: 1; transform: rotate(90deg); }
.main-nav { flex: 1; overflow-y: auto; }
.nav-item {
    width: 100%;
    min-height: 60px;
    padding: 0 23px;
    display: flex;
    align-items: center;
    gap: 14px;
    color: #fff;
    background: transparent;
    border: 0;
    text-decoration: none;
    font-size: 17px;
    cursor: pointer;
    transition: background .15s ease;
}
.nav-item:hover, .nav-group.open > .nav-item { background: rgba(73, 165, 224, .45); }
.nav-icon { width: 28px; text-align: center; font-size: 23px; font-weight: 700; }
.nav-arrow { margin-left: auto; }
.nav-submenu { display: none; padding: 4px 0 8px 66px; background: rgba(0, 48, 93, .22); }
.nav-group.open .nav-submenu { display: block; }
.nav-submenu a {
    display: block;
    padding: 10px 15px;
    color: #e8f6ff;
    text-decoration: none;
    border-left: 2px solid rgba(255,255,255,.18);
}
.nav-submenu a:hover { color: #fff; border-left-color: #fff; }
.exit-item { margin-top: auto; margin-bottom: 18px; }

.main-area { margin-left: 260px; width: calc(100% - 260px); min-height: 100vh; transition: all .2s ease; }
.topbar {
    position: sticky;
    top: 0;
    height: 58px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 21px 0 13px;
    background: rgba(255, 255, 255, .97);
    border-bottom: 1px solid #d2dce5;
    z-index: 10;
}
.topbar-button, .topbar-icon {
    width: 44px;
    height: 42px;
    border: 0;
    background: transparent;
    color: var(--navy);
    font-size: 24px;
    cursor: pointer;
    border-radius: 5px;
}
.topbar-button:hover, .topbar-icon:hover { background: var(--accent-light); }
.topbar-icon { width: 35px; font-size: 19px; font-weight: 700; }
.topbar-spacer { flex: 1; }
.topbar-user { display: flex; gap: 10px; align-items: center; font-size: 16px; color: var(--navy); }
.topbar-separator { height: 30px; width: 1px; background: #c7d0d9; margin: 0 7px; }
.content-area { padding: 18px 24px 24px; }

body.sidebar-collapsed .sidebar { width: 0; overflow: hidden; }
body.sidebar-collapsed .main-area { margin-left: 0; width: 100%; }

.page-heading { display: flex; align-items: center; gap: 18px; min-height: 78px; margin-bottom: 14px; }
.compact-heading { min-height: 56px; margin-bottom: 7px; }
.page-heading-icon {
    display: grid;
    place-items: center;
    width: 55px;
    height: 55px;
    border-radius: 6px;
    color: #fff;
    background: linear-gradient(145deg, #1585d8, #075aa2);
    box-shadow: 0 3px 8px rgba(0, 89, 160, .25);
    font-size: 29px;
    font-weight: 700;
}
.page-heading-icon.danger { background: var(--red); }
.page-heading h1 { margin: 0; color: var(--navy); font-size: clamp(25px, 2.2vw, 34px); line-height: 1.1; }
.page-heading p { margin: 5px 0 0; color: var(--muted); }

.dashboard-grid { display: grid; grid-template-columns: repeat(3, minmax(235px, 1fr)); gap: 20px; }
.dashboard-card {
    min-height: 150px;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 21px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 6px solid var(--accent);
    border-radius: 7px;
    color: var(--text);
    text-decoration: none;
    box-shadow: var(--shadow);
    transition: transform .15s ease, box-shadow .15s ease;
}
.dashboard-card:hover { transform: translateY(-3px); box-shadow: 0 13px 28px rgba(5,55,99,.13); }
.card-icon { color: var(--accent); font-size: 45px; }
.card-content { display: flex; flex-direction: column; }
.card-content strong { color: var(--navy); font-size: 18px; }
.card-content b { color: var(--accent); font-size: 34px; line-height: 1.1; margin-top: 4px; }
.card-content small { color: var(--muted); margin-top: 5px; }
.info-panel { margin-top: 25px; padding: 24px 27px; background: var(--surface); border: 1px solid var(--border); border-radius: 7px; }
.info-panel h2 { margin: 0 0 9px; color: var(--navy); }
.info-panel p { margin: 0; line-height: 1.55; color: var(--muted); }

.reception-type-grid { display: grid; grid-template-columns: repeat(2, minmax(280px, 430px)); gap: 24px; }
.reception-type-card {
    min-height: 190px; padding: 28px; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 8px; color: #fff; text-decoration: none; text-align: center;
    background: linear-gradient(145deg, #1685d4, #075a9f); border-radius: 10px; box-shadow: var(--shadow);
}
.reception-type-card.inpatient { background: linear-gradient(145deg, #0d659f, #073d6f); }
.reception-type-card > span { font-size: 44px; }
.reception-type-card strong { font-size: 25px; }
.reception-type-card small { opacity: .9; font-size: 14px; }
.reception-actions { display: flex; gap: 12px; margin: 8px 0 2px; }
.data-table .risk-unclassified td { color: #111; }
.data-table .risk-blue td { color: #0969da; }
.data-table .risk-green td { color: #17823b; }
.data-table .risk-yellow td { color: #9a7200; }
.data-table .risk-orange td { color: #d45b00; }
.data-table .risk-red td { color: #c82121; font-weight: 700; }
.data-table tr[class^="risk-"]:hover td { background: #f5f9fc; }
.risk-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; margin-top: 10px; }
.risk-legend small { flex-basis: 100%; color: var(--muted); }
.risk-dot { width: 12px; height: 12px; display: inline-block; border-radius: 50%; margin-left: 5px; border: 1px solid rgba(0,0,0,.18); }
.risk-dot-unclassified { background: #111; }
.risk-dot-blue { background: #0969da; }
.risk-dot-green { background: #17823b; }
.risk-dot-yellow { background: #d6a400; }
.risk-dot-orange { background: #e56b00; }
.risk-dot-red { background: #c82121; }
.row-actions { white-space: nowrap; }
.row-actions form { display: inline; margin-left: 8px; }
.row-actions a, .row-actions button { color: var(--accent); background: transparent; border: 0; padding: 0; font-weight: 700; cursor: pointer; text-decoration: none; }
.data-table .risk-unclassified .row-actions a, .data-table .risk-unclassified .row-actions button { color: #111; text-decoration: underline; }
.data-table .risk-blue .row-actions a, .data-table .risk-blue .row-actions button { color: #0969da; }
.data-table .risk-green .row-actions a, .data-table .risk-green .row-actions button { color: #17823b; }
.data-table .risk-yellow .row-actions a, .data-table .risk-yellow .row-actions button { color: #9a7200; }
.data-table .risk-orange .row-actions a, .data-table .risk-orange .row-actions button { color: #d45b00; }
.data-table .risk-red .row-actions a, .data-table .risk-red .row-actions button { color: #c82121; }
.reception-editor { max-height: none; overflow: visible; }
.reception-save-bar { justify-content: flex-start; padding-left: 12px; border-top: 1px solid #d6e0e8; }
.editor-scroll.reception-editor { max-height: none; overflow: visible; }

.alert { margin: 7px 0 12px; padding: 11px 15px; border-radius: 5px; border: 1px solid; }
.alert.success { color: #126b2d; background: #eaf8ee; border-color: #9dd7ad; }
.alert.error { color: #9d261a; background: #fff0ee; border-color: #efb1a9; }

.editor-scroll {
    max-height: none;
    overflow: visible;
    padding-right: 5px;
}
.form-section {
    min-width: 0;
    margin: 0 0 10px;
    padding: 12px 13px 13px;
    background: linear-gradient(180deg, #f3f9fe, #edf6fd);
    border: 1px solid var(--border);
    border-radius: 6px;
}
.form-section legend { padding: 0 8px; color: var(--accent); font-size: 17px; font-weight: 700; }
.form-section:disabled { opacity: 1; }
.form-section:disabled input, .form-section:disabled select, .form-section:disabled textarea {
    color: #2b3f52;
    background: #edf6fc;
    cursor: default;
}
.form-grid { display: grid; grid-template-columns: repeat(16, minmax(0, 1fr)); gap: 11px 12px; }
.form-field { min-width: 0; display: flex; flex-direction: column; gap: 4px; color: var(--text); font-size: 14px; font-weight: 550; }
.form-field > span:first-child { white-space: nowrap; }
.form-field.field-tiny { grid-column: span 1; }
.form-field.field-small { grid-column: span 2; }
.form-field.field-medium { grid-column: span 3; }
.form-field.field-large { grid-column: span 4; }
.form-field.field-wide { grid-column: span 5; }
.form-field.field-long { grid-column: span 8; }
.form-field.field-full { grid-column: span 16; }
.required { color: var(--red); }
.form-field input, .form-field select, .form-field textarea {
    width: 100%;
    min-height: 36px;
    padding: 7px 10px;
    color: #1c2f40;
    background: #f8fcff;
    border: 1px solid #aebecd;
    border-radius: 4px;
    outline: none;
    box-shadow: inset 0 1px 2px rgba(0,0,0,.035);
}
.form-field textarea { min-height: 66px; resize: vertical; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(10,108,190,.13);
}
.check-field { min-height: 36px; display: flex; align-items: center; gap: 9px; }
.check-field input { width: 19px; min-height: 19px; accent-color: var(--accent); }

.action-bar {
    min-height: 57px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 8px 0;
    border: 1px solid #d6e0e8;
    border-top: 0;
    border-radius: 0 0 5px 5px;
}
.action-bar form { margin: 0; }
.btn {
    min-width: 145px;
    min-height: 38px;
    padding: 8px 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: 1px solid transparent;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 700;
    cursor: pointer;
    transition: filter .12s ease, transform .12s ease;
}
.btn:hover:not(:disabled):not(.disabled) { filter: brightness(.96); transform: translateY(-1px); }
.btn-outline { color: var(--navy); background: #fff; border-color: #b7c4cf; }
.btn-primary { color: #fff; background: var(--accent); }
.btn-success { color: #fff; background: var(--green); }
.btn-danger { color: #fff; background: var(--red); }
.btn:disabled, .btn.disabled { opacity: .48; pointer-events: none; cursor: not-allowed; }

.search-bar {
    min-height: 45px;
    display: flex;
    align-items: center;
    margin-top: 8px;
}
.search-bar button {
    width: 48px;
    height: 37px;
    color: var(--navy);
    background: #fff;
    border: 1px solid #aebecd;
    border-radius: 4px 0 0 4px;
    font-size: 23px;
    cursor: pointer;
}
.search-bar input {
    width: min(390px, 45vw);
    height: 37px;
    padding: 7px 11px;
    border: 1px solid #aebecd;
    border-left: 0;
    outline: none;
}
.search-bar select {
    height: 37px;
    min-width: 170px;
    padding: 5px 9px;
    margin-left: 9px;
    border: 1px solid #aebecd;
    border-radius: 4px;
    background: #fff;
}
.record-count { margin-left: auto; padding-right: 5px; color: var(--muted); font-size: 14px; }

.table-wrap { width: 100%; overflow: auto; border: 1px solid #aebecd; border-radius: 5px; }
.data-table { width: 100%; border-collapse: collapse; white-space: nowrap; font-size: 14px; }
.data-table th {
    height: 37px;
    padding: 7px 11px;
    color: var(--navy);
    background: #dfeef9;
    border-right: 1px solid #b8cbdc;
    text-align: left;
}
.data-table td { height: 34px; padding: 7px 11px; border-top: 1px solid #d1dbe4; border-right: 1px solid #dfe6ec; }
.data-table tbody tr:nth-child(even) { background: #f7fafc; }
.data-table tbody tr:hover { background: #e7f3fc; }
.data-table tr.selected { color: #fff; background: linear-gradient(90deg, #0869b9, #0477c8) !important; }
.selector-column { width: 30px; min-width: 30px !important; padding: 0 !important; text-align: center !important; }
.selector-column a { display: grid; place-items: center; min-height: 34px; color: inherit; text-decoration: none; font-size: 25px; }
.empty-row { padding: 25px !important; color: var(--muted); text-align: center; }

@media (max-width: 1250px) {
    .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
    .btn { min-width: 120px; }
}

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); width: 260px; box-shadow: 8px 0 24px rgba(0,0,0,.18); }
    .main-area { margin-left: 0; width: 100%; }
    body.mobile-menu-open .sidebar { transform: translateX(0); }
    body.sidebar-collapsed .sidebar { width: 260px; }
    .content-area { padding: 13px; }
    .topbar-user, .topbar-separator, .topbar-icon { display: none; }
    .form-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); }
    .form-field.field-tiny { grid-column: span 1; }
    .form-field.field-small { grid-column: span 2; }
    .form-field.field-medium { grid-column: span 3; }
    .form-field.field-large { grid-column: span 4; }
    .form-field.field-wide { grid-column: span 5; }
    .form-field.field-long, .form-field.field-full { grid-column: span 8; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .editor-scroll { max-height: none; overflow: visible; }
    .action-bar { position: sticky; bottom: 0; z-index: 6; background: rgba(255,255,255,.97); flex-wrap: wrap; gap: 7px; }
    .btn { min-width: 110px; flex: 1 1 125px; }
    .record-count { display: none; }
    .reception-type-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .content-area { padding: 10px; }
    .page-heading { gap: 11px; }
    .page-heading-icon { width: 45px; height: 45px; font-size: 23px; }
    .page-heading p { display: none; }
    .form-grid { grid-template-columns: 1fr; }
    .form-field.field-tiny, .form-field.field-small, .form-field.field-medium,
    .form-field.field-large, .form-field.field-wide, .form-field.field-long,
    .form-field.field-full { grid-column: span 1; }
    .form-section { padding: 9px; }
    .action-bar .btn span { display: none; }
    .btn { min-width: 52px; flex-basis: 52px; font-size: 19px; }
    .search-bar { flex-wrap: wrap; gap: 7px 0; }
    .search-bar input { width: calc(100% - 48px); }
    .search-bar select { width: 100%; margin-left: 0; }
}


/* Fix025 - consulta CNS no cadastro de paciente */
.cns-lookup-row { display: flex; width: 100%; gap: 6px; align-items: stretch; }
.cns-lookup-row input { min-width: 0; flex: 1 1 auto; }
.cns-lookup-button {
    flex: 0 0 auto; min-width: 112px; padding: 0 10px; border: 1px solid #0a70b5;
    border-radius: 4px; color: #fff; background: #0a70b5; font-weight: 600; cursor: pointer;
}
.cns-lookup-button:disabled { opacity: .55; cursor: wait; }
.cns-lookup-status { display: block; min-height: 17px; margin-top: 3px; font-size: 11px; color: var(--muted); }
.cns-lookup-status.ok { color: #16723c; }
.cns-lookup-status.error { color: #a42323; }
@media (max-width: 560px) { .cns-lookup-row { flex-wrap: wrap; } .cns-lookup-button { height: 35px; width: 100%; } }


/* FIX029 - autocomplete de paciente */
.patient-autocomplete { position: relative; display: block; width: 100%; }
.patient-autocomplete > input[type="text"] { width: 100%; }
.patient-autocomplete-results {
    display: none;
    position: absolute;
    z-index: 1200;
    left: 0;
    right: 0;
    top: calc(100% + 3px);
    max-height: 280px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #b8c9d8;
    border-radius: 5px;
    box-shadow: 0 8px 22px rgba(20,54,82,.18);
}
.patient-autocomplete-results.open { display: block; }
.patient-autocomplete-item {
    display: block;
    width: 100%;
    padding: 9px 11px;
    border: 0;
    border-bottom: 1px solid #e4edf4;
    background: #fff;
    color: #20384c;
    text-align: left;
    cursor: pointer;
}
.patient-autocomplete-item:hover,
.patient-autocomplete-item:focus { background: #eaf5fc; outline: none; }
.patient-autocomplete-empty { display: block; padding: 10px 11px; color: #6b7f8f; }
.card-content b { white-space: nowrap; overflow: visible; text-overflow: clip; min-width: 7ch; }


/* FIX031 - Recepção Web mais compacta, próxima da proporção da tela Windows */
.reception-form-shell,
.reception-save-bar {
    width: min(1120px, 100%);
}
.reception-form-shell .form-section {
    margin-bottom: 7px;
    padding: 8px 10px 10px;
}
.reception-form-shell .form-section legend {
    font-size: 15px;
    padding: 0 6px;
}
.reception-form-shell .form-grid {
    gap: 7px 9px;
}
.reception-form-shell .form-field {
    gap: 2px;
    font-size: 12.5px;
}
.reception-form-shell .form-field input,
.reception-form-shell .form-field select,
.reception-form-shell .form-field textarea {
    min-height: 31px;
    padding: 5px 8px;
    font-size: 13px;
}
.reception-form-shell .form-field textarea {
    min-height: 52px;
}
.reception-form-shell .check-field {
    min-height: 31px;
}
.reception-form-shell .patient-autocomplete-results {
    max-height: 230px;
}
.reception-save-bar {
    min-height: 48px;
    gap: 9px;
    padding-top: 5px;
    padding-bottom: 5px;
}
.reception-save-bar .btn {
    min-height: 34px;
    min-width: 132px;
    padding: 6px 14px;
    font-size: 13px;
}
.compact-heading {
    max-width: 1120px;
}
@media (max-width: 1200px) {
    .reception-form-shell,
    .reception-save-bar,
    .compact-heading {
        width: 100%;
        max-width: none;
    }
}


/* FIX032 - interface Web compacta */
@media (min-width: 901px) {
    .sidebar { width: 220px; }
    .main-area { margin-left: 220px; width: calc(100% - 220px); }
    .brand {
        min-height: 94px;
        padding: 18px 20px;
        gap: 9px;
        font-size: 15px;
    }
    .brand-icon { font-size: 34px; }
    .nav-item {
        min-height: 44px;
        padding: 0 17px;
        gap: 10px;
        font-size: 14px;
    }
    .nav-icon { width: 22px; font-size: 18px; }
    .nav-submenu { padding: 2px 0 5px 50px; }
    .nav-submenu a { padding: 7px 11px; font-size: 13px; }

    .topbar {
        height: 48px;
        padding: 0 15px 0 8px;
    }
    .topbar-button { width: 36px; height: 34px; font-size: 20px; }
    .topbar-icon { width: 30px; height: 32px; font-size: 16px; }
    .topbar-user { font-size: 13px; }

    .content-area { padding: 10px 16px 16px; }

    .page-heading {
        min-height: 54px;
        gap: 12px;
        margin-bottom: 8px;
    }
    .compact-heading { min-height: 48px; margin-bottom: 5px; }
    .page-heading-icon {
        width: 42px;
        height: 42px;
        font-size: 22px;
    }
    .page-heading h1 { font-size: 24px; }
    .page-heading p { margin-top: 2px; font-size: 12.5px; }

    .dashboard-grid {
        grid-template-columns: repeat(4, minmax(180px, 1fr));
        gap: 10px;
    }
    .dashboard-card {
        min-height: 105px;
        padding: 12px 14px;
        gap: 12px;
        border-left-width: 4px;
        box-shadow: 0 4px 12px rgba(5,55,99,.06);
    }
    .card-icon { font-size: 31px; }
    .card-content strong { font-size: 14px; }
    .card-content b { font-size: 26px; margin-top: 2px; }
    .card-content small { font-size: 11px; margin-top: 2px; }

    .form-section {
        margin-bottom: 6px;
        padding: 8px 9px 9px;
    }
    .form-section legend { font-size: 14px; padding: 0 5px; }
    .form-grid { gap: 6px 8px; }
    .form-field { gap: 2px; font-size: 12px; }
    .form-field input,
    .form-field select,
    .form-field textarea {
        min-height: 30px;
        padding: 4px 7px;
        font-size: 12.5px;
    }
    .form-field textarea { min-height: 48px; }
    .check-field { min-height: 30px; }
    .check-field input { width: 16px; min-height: 16px; }

    .action-bar {
        min-height: 46px;
        gap: 8px;
        padding: 5px 0;
    }
    .btn {
        min-width: 116px;
        min-height: 32px;
        padding: 5px 11px;
        gap: 6px;
        font-size: 12px;
    }
    .search-bar { min-height: 42px; }
    .search-bar input,
    .search-bar select { min-height: 30px; font-size: 12px; }

    .data-table { font-size: 12px; }
    .data-table th,
    .data-table td { padding: 6px 8px; }

    .reception-type-grid {
        grid-template-columns: repeat(2, minmax(240px, 360px));
        gap: 14px;
    }
    .reception-type-card { min-height: 135px; padding: 18px; }
    .reception-type-card > span { font-size: 32px; }
    .reception-type-card strong { font-size: 19px; }
    .reception-type-card small { font-size: 12px; }

    .reception-form-shell,
    .reception-save-bar,
    .compact-heading {
        width: min(1040px, 100%);
    }
}

/* Estado da pesquisa de paciente */
.patient-autocomplete-status {
    display: block;
    margin-top: 3px;
    color: #64778b;
    font-size: 11px;
    font-weight: 400;
}
.patient-autocomplete-status.error { color: #b42318; }
.patient-autocomplete-results { z-index: 3000; }


/* FIX033 - padrão lista primeiro / cadastro separado */
.list-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 8px;
}
.list-toolbar > .btn {
    flex: 0 0 auto;
}
.list-toolbar .compact-search {
    flex: 1 1 auto;
    margin: 0;
    border: 0;
}
.list-only-grid {
    min-height: 360px;
}
.separate-editor-form {
    width: min(1120px, 100%);
}
.separate-editor-actions {
    width: min(1120px, 100%);
    justify-content: flex-start;
    padding-left: 10px;
}
@media (min-width: 901px) {
    .separate-editor-form,
    .separate-editor-actions {
        width: min(1040px, 100%);
    }
}
@media (max-width: 760px) {
    .list-toolbar {
        align-items: stretch;
        flex-direction: column;
    }
    .list-toolbar .compact-search {
        width: 100%;
    }
    .separate-editor-form,
    .separate-editor-actions {
        width: 100%;
    }
}


/* FIX035 - etapas separadas da consulta */
.reception-flow-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(210px, 1fr));
    gap: 12px;
    max-width: 1040px;
}
.reception-flow-card {
    min-height: 125px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    color: #fff;
    text-decoration: none;
    background: linear-gradient(145deg,#1685d4,#075a9f);
    border-radius: 7px;
    box-shadow: 0 4px 12px rgba(5,55,99,.10);
}
.reception-flow-card > span { font-size: 29px; }
.reception-flow-card strong { font-size: 17px; }
.reception-flow-card small { opacity: .9; font-size: 12px; }
.reception-flow-card.triage { background: linear-gradient(145deg,#16a085,#087565); }
.reception-flow-card.doctor { background: linear-gradient(145deg,#3d72b4,#234b78); }
.reception-flow-card.exams { background: linear-gradient(145deg,#7668b3,#554a91); }
.reception-flow-card.medication { background: linear-gradient(145deg,#d47a22,#a65712); }
.reception-flow-card.inpatient { background: linear-gradient(145deg,#0d659f,#073d6f); }
@media (max-width: 900px) {
    .reception-flow-grid { grid-template-columns: repeat(2,minmax(190px,1fr)); }
}
@media (max-width: 560px) {
    .reception-flow-grid { grid-template-columns: 1fr; }
}


/* FIX038 - ações clínicas e documentos médicos */
.clinical-document-actions {
    width: min(1040px,100%);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 5px 0 10px;
    padding: 9px 10px;
    border: 1px solid #d5e1eb;
    background: #f7fbfe;
    border-radius: 6px;
}
.clinical-document-actions .btn {
    min-width: 135px;
}
.clinical-action-hint {
    color: #687b8f;
    font-size: 12px;
}

.medical-document-editor {
    width: min(920px,100%);
}
.medical-document-sheet {
    min-height: 980px;
    padding: 42px 54px;
    background: #fff;
    border: 1px solid #d7e0e7;
    box-shadow: 0 4px 18px rgba(10,45,75,.08);
    color: #1f2d38;
}
.medical-document-sheet > header > h1 {
    text-align: center;
    text-transform: uppercase;
    font-size: 23px;
    margin: 0 0 30px;
}
.medical-document-meta {
    display: grid;
    grid-template-columns: repeat(2,minmax(220px,1fr));
    gap: 5px 18px;
    margin-bottom: 22px;
    font-size: 13px;
}
.medical-document-fields {
    display: grid;
    grid-template-columns: repeat(4,minmax(120px,1fr));
    gap: 8px;
    padding: 10px;
    margin-bottom: 16px;
    background: #f4f8fb;
    border: 1px solid #dbe5ec;
}
.medical-document-fields label {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 11px;
}
.medical-document-fields input {
    min-height: 30px;
    border: 1px solid #b9c8d4;
    border-radius: 3px;
    padding: 4px 6px;
}
.medical-document-content {
    width: 100%;
    min-height: 430px;
    resize: vertical;
    border: 1px solid #c5d1da;
    padding: 18px;
    line-height: 1.65;
    font: 15px "Segoe UI",Arial,sans-serif;
    background: #fff;
}


.medical-document-formal-details {
    margin: 4px 0 18px;
    font-size: 14px;
    font-weight: 600;
}
.medical-document-print-content {
    display: none;
    white-space: pre-wrap;
    line-height: 1.65;
    font-size: 15px;
    min-height: 430px;
}
.medical-document-signature {
    width: 390px;
    max-width: 85%;
    margin: 100px auto 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
}
.signature-line {
    width: 100%;
    border-top: 1px solid #283642;
    margin-bottom: 4px;
}
.medical-document-signature small {
    margin-top: 8px;
    color: #687684;
}

@media print {
    .sidebar,
    .topbar,
    .no-print {
        display: none !important;
    }
    .main-area {
        margin: 0 !important;
        width: 100% !important;
    }
    .content-area {
        padding: 0 !important;
    }
    .medical-document-editor {
        width: 100% !important;
    }
    .medical-document-sheet {
        border: 0 !important;
        box-shadow: none !important;
        min-height: auto;
        padding: 12mm 15mm;
    }
    .medical-document-fields {
        display: none !important;
    }
    .medical-document-content {
        display: none !important;
    }
    .medical-document-print-content {
        display: block !important;
        min-height: 120mm;
    }
}


/* FIX041 - cabeçalho da empresa padrão e receita em duas vias */
.medical-company-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    margin: 0 0 18px;
    padding: 0 0 12px;
    border-bottom: 2px solid #233746;
    text-align: center;
}
.medical-company-header strong {
    font-size: 20px;
    color: #18364f;
}
.medical-company-header > span {
    font-size: 12px;
    font-weight: 600;
}
.medical-company-header small {
    font-size: 11px;
    color: #455866;
}
.medical-document-sheet > h1 {
    text-align: center;
    text-transform: uppercase;
    font-size: 22px;
    margin: 10px 0 22px;
}
.document-copy-label {
    float: right;
    margin: -22px -28px 8px 12px;
    padding: 4px 8px;
    border: 1px solid #aebbc5;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .3px;
    color: #40515f;
}
.recipe-document-sheet {
    min-height: 575px;
    margin-bottom: 14px;
    padding-top: 32px;
    padding-bottom: 28px;
}
.recipe-document-sheet .medical-company-header {
    margin-bottom: 10px;
    padding-bottom: 8px;
}
.recipe-document-sheet > h1 {
    font-size: 18px;
    margin: 7px 0 12px;
}
.recipe-document-sheet .medical-document-meta {
    margin-bottom: 10px;
    font-size: 12px;
}
.recipe-content-editor {
    min-height: 210px;
}
.recipe-document-sheet .medical-document-print-content {
    min-height: 210px;
}
.recipe-signature {
    width: 320px;
    margin-top: 45px;
}
.recipe-second-copy .recipe-copy-content {
    display: block;
    min-height: 210px;
    white-space: pre-wrap;
}
@media print {
    @page {
        size: A4 portrait;
        margin: 6mm;
    }
    .medical-company-header strong {
        font-size: 15px;
        color: #000;
    }
    .medical-company-header > span,
    .medical-company-header small {
        color: #000;
        font-size: 9px;
    }
    .document-copy-label {
        margin-top: -10px;
        color: #000;
        border-color: #777;
    }
    .recipe-document-sheet {
        box-sizing: border-box;
        height: 137mm;
        min-height: 137mm !important;
        max-height: 137mm;
        padding: 6mm 10mm !important;
        margin: 0 !important;
        overflow: hidden;
        page-break-inside: avoid;
        border-bottom: 1px dashed #777 !important;
    }
    .recipe-document-sheet.recipe-second-copy {
        border-bottom: 0 !important;
    }
    .recipe-document-sheet .medical-document-print-content,
    .recipe-second-copy .recipe-copy-content {
        display: block !important;
        min-height: 48mm !important;
        max-height: 48mm;
        overflow: hidden;
        font-size: 11px;
        line-height: 1.35;
    }
    .recipe-document-sheet .medical-document-meta {
        margin-bottom: 4mm;
        gap: 1mm 5mm;
        font-size: 9px;
    }
    .recipe-document-sheet > h1 {
        font-size: 15px;
        margin: 2mm 0 3mm;
    }
    .recipe-signature {
        margin-top: 8mm;
        width: 75mm;
    }
    .recipe-signature strong,
    .recipe-signature span,
    .recipe-signature small {
        font-size: 9px;
    }
}


/* FIX043 - primeiro nível da Sala de Medicação por consulta */
.medication-consultation-row {
    cursor: pointer;
}
.medication-consultation-row:hover td {
    text-decoration: none;
}
