:root {
    color-scheme: light;
    --bg: #f6f7f5;
    --bg-soft: #ffffff;
    --surface: #ffffff;
    --surface-2: #f8faf6;
    --line: #dfe6da;
    --line-strong: #c8d2c3;
    --text: #26352d;
    --muted: #687365;
    --green-900: #26352d;
    --green-800: #344239;
    --green-700: #3f8f2b;
    --green-500: #59bd24;
    --green-400: #b7dca1;
    --lime-soft: #f2f7ef;
    --lime-table: #edf7e7;
    --lime-table-line: #c5d9b8;
    --lime-table-text: #365c2f;
    --yellow: #f6b731;
    --orange: #ef9b28;
    --orange-dark: #c97812;
    --logo-icon: #ef9b28;
    --logo-icon-soft: #fff7e8;
    --logo-icon-line: #f2d6a7;
    --success: #3f8f2b;
    --warning: #c97812;
    --danger: #c97812;
    --shadow: 0 16px 34px rgba(38, 53, 45, .08);
    --shadow-soft: 0 8px 22px rgba(38, 53, 45, .05);
    --radius: 12px;
}

* { box-sizing: border-box; }

[hidden] {
    display: none !important;
}

html { min-height: 100%; }

body {
    margin: 0;
    min-height: 100%;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
}

a { color: inherit; }

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    grid-template-rows: 74px minmax(0, 1fr);
    grid-template-areas:
        "topbar topbar"
        "sidebar main";
    overflow-x: hidden;
}

.app-shell.public-shell {
    display: block;
    min-height: 100vh;
}

.app-shell.public-shell .main {
    min-height: 100vh;
    padding: 24px;
}

.sidebar {
    grid-area: sidebar;
    width: 250px;
    min-height: calc(100vh - 74px);
    background: #ffffff;
    color: var(--green-900);
    padding: 20px 16px;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas:
        "clock"
        "nav";
    align-content: start;
    align-items: stretch;
    gap: 18px;
    position: fixed;
    top: 74px;
    left: 0;
    bottom: 0;
    z-index: 20;
    height: auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    box-shadow: none;
}

.topbar {
    grid-area: topbar;
    min-width: 0;
    height: 74px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 0 24px 0 34px;
    background: #ffffff;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 6px 18px rgba(38, 53, 45, .035);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 30;
}

.brand {
    width: 320px;
    min-width: 320px;
    height: 74px;
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0;
    border-right: 0;
    border-bottom: 0;
    background: transparent;
    flex: 0 0 auto;
    overflow: hidden;
}

.brand img {
    display: block;
    width: auto;
    height: 62px;
    max-width: 100%;
    object-fit: contain;
}

nav {
    grid-area: nav;
    display: grid;
    align-items: stretch;
    justify-content: stretch;
    flex: none;
    gap: 10px;
    min-width: 0;
    overflow-x: visible;
    scrollbar-width: none;
    padding: 0;
    margin-top: 0;
}

nav a {
    position: relative;
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 48px;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 13px;
    color: #1d2b20;
    font-size: 14px;
    font-weight: 900;
    line-height: 1.1;
    transition: background .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease;
}

nav a:hover {
    background: #f2f4f0;
    color: #25372a;
    transform: none;
    box-shadow: inset 0 0 0 1px #d7ded2;
}

nav a:hover .nav-icon {
    background: #e3e7df;
    color: #5f695d;
}

nav a.active {
    background: #eef8e9;
    color: var(--green-700);
    box-shadow: inset 4px 0 0 var(--green-500), inset 0 0 0 1px #cfe6c1;
}

nav a.active:hover {
    background: #f1f2ef;
    color: #25372a;
    box-shadow: inset 4px 0 0 #858f84, inset 0 0 0 1px #d7ddd3;
}

.nav-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    background: #eef8e9;
    color: var(--green-500);
}

nav a.active .nav-icon {
    background: var(--green-500);
    color: #ffffff;
}

nav a.active:hover .nav-icon {
    background: #6f7867;
    color: #ffffff;
}

.nav-group {
    display: grid;
    gap: 8px;
    margin-top: 6px;
    padding-top: 12px;
    border-top: 1px solid #edf1e8;
}

.nav-group.level-1 {
    margin-top: 0;
    padding-top: 0;
    padding-left: 11px;
    border-top: 0;
    border-left: 2px solid #e4ebdd;
}

.nav-group-title {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 38px;
    padding: 4px 10px;
    border-radius: 11px;
    color: #53604f;
    font-size: 12px;
    font-weight: 950;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.nav-group-title .nav-icon {
    width: 28px;
    height: 28px;
    background: #f2f5ef;
    color: #657260;
}

.nav-group.active > .nav-group-title {
    color: var(--green-700);
}

.nav-group.active > .nav-group-title .nav-icon {
    background: #edf8e4;
    color: var(--green-500);
}

.nav-group-items {
    display: grid;
    gap: 8px;
}

nav a.level-1,
nav a.level-2 {
    min-height: 42px;
    padding: 7px 10px;
    font-size: 13px;
}

nav a.level-2 {
    margin-left: 11px;
    font-size: 12px;
}

.nav-icon svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.sidebar-footer {
    grid-area: auto;
    margin-top: 0;
    margin-left: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex: 0 0 auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--green-900);
    white-space: nowrap;
}

.header-info {
    grid-area: auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-direction: row;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.datetime-chip,
.sidebar-clock {
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 2px 9px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #ffffff;
    color: #25372a;
    white-space: nowrap;
}

.datetime-chip span,
.sidebar-clock span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 850;
    text-transform: capitalize;
}

.datetime-chip strong,
.sidebar-clock strong {
    color: var(--green-700);
    font-size: 14px;
    font-weight: 950;
    line-height: 1;
}

.sidebar-clock {
    grid-area: clock;
    min-height: 58px;
    justify-content: center;
    gap: 11px;
    padding: 10px 12px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--green-900);
    box-shadow: inset 4px 0 0 var(--orange), inset 0 0 0 1px var(--line-strong);
    position: relative;
    overflow: hidden;
}

.clock-status {
    display: none;
}

.clock-text {
    display: grid;
    gap: 2px;
    justify-items: center;
    text-align: center;
    position: relative;
    z-index: 1;
}

.clock-text small {
    color: #6d6d66;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: capitalize;
}

.clock-text strong {
    color: #3a3425;
    font-size: 25px;
    font-weight: 800;
    line-height: 1;
}

.notice-chip {
    min-height: 24px;
    max-width: 420px;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 2px 10px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #ffffff;
    color: #3a3425;
    white-space: nowrap;
}

.notice-chip span {
    color: var(--orange-dark);
    font-size: 11px;
    font-weight: 950;
    text-transform: uppercase;
}

.notice-chip strong {
    overflow: hidden;
    color: #3a3425;
    font-size: 12px;
    font-weight: 850;
    text-overflow: ellipsis;
}

.user-chip {
    min-height: 36px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px 4px 5px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #ffffff;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--green-500);
    color: #ffffff;
    font-size: 12px;
    font-weight: 950;
}

.user-meta {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.user-meta strong {
    max-width: 120px;
    overflow: hidden;
    color: #25372a;
    font-size: 12px;
    font-weight: 950;
    line-height: 1.1;
    text-overflow: ellipsis;
}

.user-meta small {
    color: var(--green-700);
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
}

.sidebar-footer a {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 5px 10px;
    border-radius: 11px;
    background: transparent;
    color: #1d2b20;
    text-decoration: none;
    font-size: 14px;
    font-weight: 900;
}

.sidebar-footer a:hover {
    background: #f2f4f0;
    color: var(--green-700);
}

.sidebar-footer a .nav-icon {
    background: #edf8e4;
    color: var(--green-500);
}

.main {
    grid-area: main;
    flex: 1;
    min-width: 0;
    padding: 70px 28px 38px;
    overflow-x: clip;
}

.notice-banner {
    position: fixed;
    top: 82px;
    left: calc(250px + 14px);
    right: 14px;
    z-index: 25;
    width: auto;
    max-width: none;
    margin: 0;
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #ffffff;
    color: var(--text);
    box-shadow: 0 8px 18px rgba(38, 53, 45, .045);
}

.notice-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    background: #fff7e8;
    color: var(--orange);
    box-shadow: inset 0 0 0 1px #f2d6a7;
}

.notice-icon svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.notice-content {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: baseline;
    justify-content: center;
    gap: 8px;
    min-width: 0;
    text-align: center;
}

.notice-content small {
    color: var(--orange-dark);
    font-size: 11px;
    font-weight: 950;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.notice-content strong {
    overflow: hidden;
    color: var(--text);
    font-size: 13px;
    font-weight: 850;
    line-height: 1.35;
    text-overflow: ellipsis;
}

.public-main {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.page-head > div:first-child {
    min-width: 0;
}

.dashboard-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin: 0 0 24px;
    padding: 30px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #ffffff;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.dashboard-hero h1 {
    position: relative;
    margin-bottom: 14px;
    max-width: 760px;
    color: var(--green-900);
    font-size: clamp(36px, 3.7vw, 52px);
    font-weight: 800;
    line-height: 1.08;
}

.dashboard-hero h1 span {
    display: inline;
    color: var(--green-500);
    font-size: 1em;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: none;
}

.dashboard-hero h1 strong {
    color: #343a35;
    font-weight: 900;
}

.dashboard-hero p {
    max-width: 700px;
    margin-bottom: 0;
    color: #4d5a51;
    font-size: 22px;
    font-weight: 500;
    line-height: 1.35;
}

.eyebrow {
    display: inline-flex;
    width: fit-content;
    margin-bottom: 10px;
    color: #20352a;
    font-size: 16px;
    font-weight: 950;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.hero-actions {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    padding-top: 10px;
}

h1,
h2,
p { margin-top: 0; }

h1 {
    margin-bottom: 8px;
    font-size: clamp(28px, 3vw, 40px);
    line-height: 1.08;
    letter-spacing: 0;
    color: var(--green-900);
}

h2 {
    margin-bottom: 18px;
    font-size: 20px;
    line-height: 1.2;
    color: var(--green-800);
}

p {
    color: var(--muted);
    line-height: 1.58;
}

.panel,
.auth-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    padding: 24px;
    margin-bottom: 22px;
}

.auth-card {
    position: relative;
    width: min(480px, 100%);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.auth-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 7px;
    background: var(--green-500);
}

.auth-card.wide { width: min(920px, 100%); }
.auth-card h1 { font-size: 34px; }

.login-card {
    padding-top: 28px;
}

.login-logo {
    display: flex;
    justify-content: center;
    margin: 0 0 18px;
}

.login-logo img {
    display: block;
    width: min(300px, 86%);
    height: auto;
    object-fit: contain;
}

.login-card h1,
.login-card p {
    text-align: center;
}

.login-card h1 {
    margin-bottom: 6px;
    font-size: 28px;
}

.login-card p {
    margin-bottom: 20px;
    color: var(--muted);
}

.login-card form {
    max-width: 360px;
    margin-inline: auto;
}

.login-card label,
.login-card .btn,
.login-card .text-link {
    width: 100%;
}

.login-card label > span {
    text-align: center;
}

.login-card .btn,
.login-card .text-link {
    justify-content: center;
    text-align: center;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 26px;
}

.metrics article {
    position: relative;
    overflow: hidden;
    min-height: 154px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 22px;
    box-shadow: var(--shadow-soft);
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.metrics article::before {
    content: "";
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: block;
    margin-bottom: 16px;
    background: var(--yellow);
    box-shadow: 0 12px 24px rgba(154, 202, 60, .22);
}

.metrics .metric-icon {
    width: 58px;
    height: 58px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: var(--yellow);
    color: var(--green-900);
    box-shadow: none;
}

.metrics .metric-icon svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

.metrics article::before {
    display: none;
}

.metrics article::after {
    content: "";
    position: absolute;
    right: 0;
    top: 0;
    width: 8px;
    height: 100%;
    border-radius: 0;
    background: var(--green-500);
}

.metrics span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.metrics strong {
    display: block;
    margin-top: 10px;
    font-size: 42px;
    line-height: 1;
    color: var(--green-900);
}

.metrics small {
    display: block;
    margin-top: 10px;
    color: var(--muted);
    font-weight: 750;
}

.metric-card.green { border-color: #cfe8bd; }
.metric-card.green .metric-icon,
.metric-card.green::after { background: var(--green-500); color: #ffffff; }
.metric-card.yellow { border-color: #f2dfae; }
.metric-card.yellow .metric-icon,
.metric-card.yellow::after { background: var(--yellow); color: #2f2a17; }
.metric-card.neutral { border-color: #d8ddd3; }
.metric-card.neutral .metric-icon,
.metric-card.neutral::after { background: #6f7867; color: #ffffff; }
.metric-card.gray { border-color: #d8ddd3; }
.metric-card.gray .metric-icon,
.metric-card.gray::after { background: #5c6c5f; color: #ffffff; }

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(340px, .75fr);
    gap: 22px;
    align-items: stretch;
}

.dashboard-grid .panel {
    margin-bottom: 22px;
}

.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.panel-head h2,
.panel-head p {
    margin-bottom: 0;
}

.panel-head h2 {
    margin-bottom: 5px;
}

.status-row {
    display: grid;
    grid-template-columns: 12px minmax(140px, .8fr) minmax(160px, 1fr) 48px;
    gap: 14px;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid #edf2e6;
}

.status-row:last-child {
    border-bottom: 0;
}

.status-row strong,
.status-row span {
    display: block;
}

.status-row strong {
    color: var(--green-900);
}

.status-row span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 750;
}

.status-row b {
    color: var(--green-800);
    font-size: 13px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--green-500);
}

.status-track {
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: #eef3e9;
}

.status-track i {
    display: block;
    height: 100%;
    min-width: 4px;
    border-radius: inherit;
    background: var(--green-500);
}

.status-row.pendente .status-dot,
.status-row.pendente .status-track i { background: var(--yellow); }
.status-row.liberado .status-dot,
.status-row.liberado .status-track i { background: var(--green-500); }
.status-row.rascunho .status-dot,
.status-row.rascunho .status-track i { background: #7f8a78; }
.status-row.cancelado .status-dot,
.status-row.cancelado .status-track i { background: var(--danger); }

.dashboard-today {
    background: var(--surface);
}

.today-numbers {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0;
}

.today-numbers div {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #ffffff;
}

.today-numbers strong {
    display: block;
    color: var(--green-900);
    font-size: 34px;
    line-height: 1;
}

.today-numbers span {
    display: block;
    margin-top: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.quick-actions a {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    min-height: 54px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #ffffff;
    color: #26352d;
    box-shadow: 0 8px 18px rgba(38, 53, 45, .04);
    font-size: 13px;
    font-weight: 900;
    line-height: 1;
    text-align: left;
    text-decoration: none;
    transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.quick-actions a:hover {
    border-color: var(--line-strong);
    background: #f4f6f2;
    transform: translateY(-1px);
}

.quick-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: inline-grid;
    place-items: center;
    background: #eef8e9;
    color: var(--green-500);
    flex: 0 0 auto;
}

.quick-icon svg {
    width: 17px;
    height: 17px;
    fill: currentColor;
}

.quick-actions a > span:last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: end;
}

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

.patient-form {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 18px;
}

.patient-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.patient-step {
    min-height: 54px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: #ffffff;
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    text-align: left;
    transition: background .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease;
}

.patient-step span {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    background: #eef1eb;
    color: var(--muted);
    font-size: 13px;
    font-weight: 950;
}

.patient-step strong {
    color: inherit;
    font-size: 14px;
    font-weight: 900;
    line-height: 1.15;
}

.patient-step:hover {
    background: #f4f5f2;
    border-color: var(--line-strong);
    color: #344239;
}

.patient-step.active {
    background: #eef8e9;
    border-color: #cfe6c1;
    color: var(--green-700);
    box-shadow: inset 4px 0 0 var(--green-500);
}

.patient-step.active span {
    background: var(--green-500);
    color: #ffffff;
}

.patient-step.completed {
    color: #344239;
}

.patient-step.completed span {
    background: #e0e5dc;
    color: #4f5a4d;
}

.form-section {
    position: relative;
    display: none;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    min-width: 0;
    margin: 0;
    padding: 22px 18px 18px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 10px 22px rgba(38, 53, 45, .04);
}

.form-section.is-active {
    display: grid;
}

.form-section legend {
    padding: 0 10px;
    color: #4e5b4c;
    font-size: 12px;
    font-weight: 950;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.form-section label.span-2 { grid-column: span 2; }
.form-section label.span-4 { grid-column: 1 / -1; }
.form-section > .span-4 { grid-column: 1 / -1; }
.patient-form > .btn { justify-self: start; }

.exam-final-step {
    padding: 20px 18px 16px;
}

.exam-final-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 14px;
    align-items: start;
}

.exam-final-grid .final-field {
    min-width: 0;
    gap: 7px;
}

.exam-final-grid .final-field > span {
    color: #3c4d40;
    font-size: 12px;
    font-weight: 650;
}

.final-status,
.final-date {
    grid-column: span 3;
}

.final-result {
    grid-column: span 6;
}

.final-notes,
.final-file {
    grid-column: span 6;
}

.exam-final-grid input,
.exam-final-grid select,
.exam-final-grid textarea {
    border-radius: 14px;
    background: #fbfcfa;
}

.exam-final-grid input,
.exam-final-grid select {
    min-height: 48px;
}

.exam-final-grid textarea {
    min-height: 92px;
    padding: 12px 14px;
    line-height: 1.45;
}

.final-file input[type="file"] {
    min-height: 58px;
    padding: 9px 10px;
    border-style: solid;
}

.final-file input[type="file"]::file-selector-button {
    margin-right: 12px;
    padding: 10px 13px;
    border: 1px solid #cfe6c1;
    border-radius: 11px;
    background: #eef8e9;
    color: var(--green-700);
    font: inherit;
    font-weight: 650;
    cursor: pointer;
}

.final-file input[type="file"]::file-selector-button:hover {
    background: #e3f3dc;
}

.exam-final-step .step-actions {
    margin-top: 2px;
    padding-top: 14px;
    border-top: 1px solid #eef2eb;
}

@media (max-width: 1100px) {
    .final-status,
    .final-date {
        grid-column: span 6;
    }

    .final-result,
    .final-notes,
    .final-file {
        grid-column: 1 / -1;
    }
}

@media (max-width: 760px) {
    .exam-final-grid {
        grid-template-columns: 1fr;
    }

    .final-status,
    .final-date,
    .final-result,
    .final-notes,
    .final-file {
        grid-column: auto;
    }
}

.patient-meta {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(180px, .6fr) minmax(260px, 1fr);
    gap: 14px;
    margin-bottom: 2px;
}

.patient-meta label {
    gap: 7px;
}

.patient-form input,
.patient-form select,
.patient-form textarea {
    border-radius: 10px;
    background: #ffffff;
}

.patient-form label span {
    color: #465346;
    font-size: 13px;
    font-weight: 850;
}

.patient-form label.required-by-age span::after {
    content: " obrigatorio";
    margin-left: 4px;
    color: var(--orange-dark);
    font-size: 11px;
    font-weight: 900;
}

.patient-form textarea {
    min-height: 92px;
}

.name-social-row {
    display: grid;
    grid-template-columns: minmax(420px, 2fr) minmax(150px, 180px) minmax(250px, 1fr);
    gap: 12px;
    align-items: end;
}

.name-main-field {
    min-width: 0;
}

.social-toggle {
    justify-content: flex-start;
}

.social-name-field {
    display: none;
}

.social-name-field.is-open {
    display: grid;
}

.contact-compact-row {
    display: grid;
    grid-template-columns: minmax(150px, 180px) minmax(185px, 230px) minmax(170px, 210px) minmax(220px, 1fr);
    gap: 12px;
    align-items: end;
}

.social-data-row {
    display: grid;
    grid-template-columns: minmax(160px, 1fr) minmax(150px, 190px) minmax(140px, 170px) minmax(190px, 230px);
    gap: 12px;
    align-items: end;
}

.minor-fields {
    display: none;
    grid-column: 1 / -1;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.minor-fields.show {
    display: grid;
}

.minor-fields label.span-2 { grid-column: span 2; }

.minor-hint {
    grid-column: 1 / -1;
    margin: -2px 0 0;
    padding: 10px 12px;
    border: 1px solid #f0dfb6;
    border-radius: 10px;
    background: #fffaf0;
    color: #6b4b13;
    font-size: 13px;
    font-weight: 800;
}

.patient-form input:disabled {
    border-color: #d9dfd4;
    background: #f5f6f3;
    color: #798174;
    cursor: not-allowed;
    -webkit-text-fill-color: #798174;
}

.patient-form input:disabled::placeholder {
    color: #9da59a;
    opacity: 1;
}

.step-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 4px;
}

.step-actions .btn {
    min-height: 42px;
    border-radius: 11px;
    font-size: 13px;
}

.step-actions .btn.primary {
    background: #ef9b28;
    border-color: #d88919;
    color: #241b0e;
    box-shadow: 0 8px 18px rgba(239, 155, 40, .13);
}

.step-actions .btn.primary:hover {
    background: #df8f20;
}

label {
    display: grid;
    gap: 8px;
    color: #33452f;
    font-size: 14px;
    font-weight: 850;
}

label.span-2 { grid-column: 1 / -1; }

.input-action {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    gap: 8px;
    align-items: center;
}

.whatsapp-action {
    grid-template-columns: minmax(0, 1fr) 48px;
}

.value-reference-action {
    grid-template-columns: minmax(0, 1fr) 42px;
}

.field-icon-btn {
    width: 44px;
    height: 44px;
    border: 1px solid #d8ded1;
    border-radius: 12px;
    display: inline-grid;
    place-items: center;
    background: #ffffff;
    color: #6f7867;
    cursor: pointer;
}

.field-icon-btn:hover {
    background: #f1f2ef;
    color: #25372a;
}

.field-icon-btn.reference-btn {
    width: 42px;
    height: 42px;
    border-color: #d8ded1;
    background: #f8faf5;
    color: #66725e;
}

.field-icon-btn.reference-btn:hover {
    background: #edf8e4;
    color: var(--green-700);
}

.field-icon-btn.whatsapp-btn {
    width: 48px;
    height: 44px;
    border-color: #cce8cb;
    background: #eefbf0;
    color: #209b45;
}

.field-icon-btn.whatsapp-btn:hover {
    border-color: #a9dca8;
    background: #e1f7e5;
    color: #128c37;
}

.field-icon-btn:disabled {
    cursor: wait;
    opacity: .55;
}

.field-icon-btn .btn-icon {
    width: 24px;
    height: 24px;
    background: #eef1eb;
}

.field-icon-btn.whatsapp-btn .btn-icon {
    background: #d8f5de;
    color: #128c37;
}

.checkbox-row {
    min-height: 44px;
    align-self: end;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid #dfe6d8;
    border-radius: 12px;
    background: #ffffff;
    color: #465346;
    font-size: 13px;
    font-weight: 900;
    cursor: pointer;
}

.checkbox-row input {
    width: 18px;
    height: 18px;
    padding: 0;
    accent-color: var(--green-500);
    flex: 0 0 auto;
}

.checkbox-row span {
    color: inherit;
    font-size: inherit;
    line-height: 1.2;
}

.patient-form input.is-synced {
    border-color: #bfe1b0;
    background: #f7fbf1;
    color: #43513e;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    padding: 12px 15px;
    font: inherit;
    color: var(--text);
    background: #ffffff;
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

textarea {
    min-height: 112px;
    resize: vertical;
    border-radius: var(--radius);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--green-500);
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(89, 189, 36, .15);
}

.pricing-reference-popover {
    grid-column: 1 / -1;
    justify-self: start;
    display: inline-grid;
    grid-template-columns: repeat(3, auto);
    gap: 8px;
    max-width: 560px;
    margin-top: -6px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #ffffff;
    box-shadow: var(--shadow-soft);
}

.pricing-reference-popover[hidden] {
    display: none;
}

.pricing-reference-popover > span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
}

.pricing-reference-popover div {
    min-width: 112px;
    padding: 8px 10px;
    border: 1px solid #e8ede4;
    border-radius: 10px;
    background: #f8faf6;
}

.pricing-reference-popover small {
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
}

.pricing-reference-popover strong {
    color: var(--green-900);
    font-size: 14px;
    font-weight: 950;
}

.pricing-reference-popover.danger {
    border-color: #f2dfae;
    background: #fffaf0;
}

.btn {
    border: 1px solid transparent;
    border-radius: 9px;
    padding: 0 16px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    font-weight: 900;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease;
}

.btn:hover { transform: translateY(-1px); }

.btn.primary {
    background: var(--yellow);
    color: #1f251c;
    border-color: #e7a91f;
    box-shadow: 0 8px 18px rgba(239, 155, 40, .12);
}

.btn.primary:hover {
    background: #eaa917;
    box-shadow: 0 10px 22px rgba(239, 155, 40, .16);
}

.btn.ghost {
    background: #ffffff;
    border-color: #d8ded1;
    color: #344239;
    box-shadow: 0 6px 14px rgba(38, 53, 45, .04);
}

.btn.ghost:hover {
    background: #f1f2ef;
    border-color: #c9d0c4;
    color: #25372a;
}

.btn.danger {
    background: #fff7e8;
    color: var(--danger);
    border-color: #f2dfae;
}

.btn.danger:hover { background: #fff2d2; }

.btn.ok {
    background: #e9f7e8;
    color: var(--success);
    border-color: #c2e6bf;
}

.btn.ok:hover { background: #dcf2da; }

.btn-icon {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    background: rgba(255, 255, 255, .42);
    color: currentColor;
}

.btn-icon svg {
    width: 15px;
    height: 15px;
    fill: currentColor;
}

.btn-small {
    min-height: 32px;
    padding: 0 9px;
    gap: 6px;
    border-radius: 8px;
    font-size: 12px;
    box-shadow: none;
}

.btn-small .btn-icon {
    width: 22px;
    height: 22px;
    border-radius: 6px;
}

.btn-small .btn-icon svg {
    width: 13px;
    height: 13px;
}

.btn.ghost .btn-icon {
    background: #eef1eb;
    color: #6f7867;
}

.btn.ghost:hover .btn-icon {
    background: #e0e5dc;
    color: #4f5a4d;
}

.actions a[href*="view"] .btn-icon {
    background: #eef1eb;
    color: #5f695d;
}

.actions a[href*="edit"] .btn-icon {
    background: #edf8e4;
    color: var(--green-500);
}

.actions a[target="_blank"] .btn-icon {
    background: #fff6df;
    color: #d58a11;
}

.btn.danger .btn-icon {
    background: #fff2d2;
}

.btn.ok .btn-icon {
    background: #d8f1d4;
}

.text-link {
    color: var(--green-700);
    font-weight: 900;
    text-decoration: none;
}

.text-link:hover { color: var(--green-900); }

.alert {
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 18px;
    background: #e9f7e8;
    color: var(--success);
    border: 1px solid #c2e6bf;
    font-weight: 850;
    box-shadow: var(--shadow-soft);
}

.alert.danger {
    background: #fff7e8;
    color: var(--danger);
    border-color: #f2dfae;
}

.operation-modal[hidden] {
    display: none;
}

.operation-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(38, 53, 45, .34);
}

.operation-modal-card {
    width: min(430px, 100%);
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 14px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #ffffff;
    box-shadow: var(--shadow);
}

.operation-modal-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: #eef8e9;
    color: var(--green-500);
}

.operation-modal-icon svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.operation-modal-card h2 {
    margin: 0 0 6px;
    color: var(--green-900);
    font-size: 20px;
}

.operation-modal-card p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.operation-password-field,
.operation-modal-actions {
    grid-column: 1 / -1;
}

.operation-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 2px;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

table {
    width: 100%;
    min-width: 980px;
    border-collapse: separate;
    border-spacing: 0;
}

th,
td {
    padding: 14px 13px;
    border-bottom: 1px solid #e4ebe0;
    text-align: left;
    vertical-align: top;
}

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

tbody tr {
    transition: background .16s ease;
}

tbody tr:hover { background: #f4f9ef; }

th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--lime-table);
    color: var(--lime-table-text);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom-color: var(--lime-table-line);
}

td small {
    color: var(--muted);
    line-height: 1.5;
}

.actions {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    min-width: max-content;
    white-space: nowrap;
}

.actions .btn-small {
    width: 36px;
    min-width: 36px;
    min-height: 36px;
    border-radius: 11px;
    padding: 0;
    background: #ffffff;
    border-color: var(--line);
    font-size: 0;
    line-height: 0;
}

.actions .btn-small .btn-icon {
    width: 26px;
    height: 26px;
    border-radius: 9px;
}

.actions .btn-small .btn-icon svg {
    width: 14px;
    height: 14px;
}

.inline-form {
    display: inline-flex;
    margin: 0;
    flex: 0 0 auto;
}

.actions .inline-form {
    width: auto;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 0;
}

.detail-grid div {
    min-height: 72px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #ffffff;
}

.detail-grid dt {
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.detail-grid dd {
    margin: 0;
    color: var(--green-900);
    font-size: 14px;
    font-weight: 850;
    overflow-wrap: anywhere;
}

.detail-note {
    margin-top: 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #ffffff;
}

.detail-note strong {
    display: block;
    margin-bottom: 6px;
    color: var(--green-900);
}

.detail-note p {
    margin-bottom: 0;
}

.patient-view {
    padding: 0;
    overflow: hidden;
}

.patient-view-hero {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    padding: 22px 24px;
    border-bottom: 1px solid var(--line);
    background: #ffffff;
}

.patient-view-avatar {
    width: 58px;
    height: 58px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: #f4b629;
    color: #26352d;
    font-size: 18px;
    font-weight: 950;
}

.patient-view-title {
    min-width: 0;
}

.patient-view-title span {
    display: block;
    margin-bottom: 4px;
    color: var(--green-700);
    font-size: 12px;
    font-weight: 950;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.patient-view-title h2 {
    margin-bottom: 5px;
    color: var(--green-900);
    font-size: 26px;
    line-height: 1.1;
}

.patient-view-title p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 14px;
    font-weight: 750;
}

.patient-view-meta {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    padding: 18px 24px;
    background: #f8faf6;
    border-bottom: 1px solid var(--line);
}

.patient-view-meta div,
.patient-view-grid div {
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #ffffff;
}

.patient-view-meta small,
.patient-view-grid small {
    display: block;
    margin-bottom: 6px;
    color: #737d70;
    font-size: 11px;
    font-weight: 950;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.patient-view-meta strong,
.patient-view-grid strong {
    color: #25372a;
    font-size: 14px;
    font-weight: 850;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.patient-view-section {
    padding: 20px 24px 4px;
}

.patient-view-section:last-child {
    padding-bottom: 22px;
}

.patient-view-section h3 {
    margin: 0 0 12px;
    color: #344239;
    font-size: 15px;
    font-weight: 950;
}

.patient-view-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.patient-whatsapp-line {
    display: inline-flex;
    align-items: center;
    gap: 9px;
}

.patient-whatsapp-link {
    width: 32px;
    height: 32px;
    border: 1px solid #bfe6c4;
    border-radius: 10px;
    display: inline-grid;
    place-items: center;
    background: #e9f9ed;
    color: #128c37;
    text-decoration: none;
    transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

.patient-whatsapp-link:hover {
    border-color: #95d69d;
    background: #dcf5e2;
    transform: translateY(-1px);
}

.patient-whatsapp-link .btn-icon {
    width: 24px;
    height: 24px;
    background: transparent;
    color: currentColor;
}

.patient-view-note {
    margin: 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #ffffff;
    color: var(--green-900);
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 25px;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 950;
    background: #eef3e9;
    color: #607054;
}

.badge.ok {
    background: #e6f5e0;
    color: var(--success);
}

.badge.warn {
    background: #fff2d2;
    color: var(--warning);
}

.badge.danger {
    background: #fff7e8;
    color: var(--danger);
}

.badge.muted {
    background: #edf2e8;
    color: #66725e;
}

.filters {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    align-items: end;
}

.settings-panel .filters {
    grid-template-columns: minmax(260px, 1fr) auto auto;
}

.compact-check {
    min-height: 48px;
    align-self: end;
    justify-content: center;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #ffffff;
}

.sus-values-form {
    display: grid;
    gap: 16px;
}

.sus-values-table table {
    min-width: 900px;
}

.sus-values-table th:nth-child(4),
.sus-values-table td:nth-child(4) {
    width: 190px;
}

.table-input {
    display: block;
    margin: 0;
}

.table-input span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.table-input input {
    width: 130px;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid #dce6d2;
    border-radius: 10px;
    background: #ffffff;
    color: var(--green-900);
    font-weight: 900;
    text-align: right;
}

.table-input input:focus {
    outline: 3px solid rgba(89, 189, 36, .16);
    border-color: var(--green-500);
}

.form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.form-footer span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 850;
}

.portal-results {
    display: grid;
    gap: 14px;
    margin-top: 22px;
}

.result-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 17px;
    display: grid;
    gap: 10px;
    background: #ffffff;
}

.result-card strong,
.result-card span,
.result-card small {
    display: block;
}

.result-card strong {
    font-size: 17px;
    color: var(--green-900);
}

.result-card small,
.result-card span {
    color: var(--muted);
}

@media (max-width: 1100px) {
    .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }

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

    .app-shell {
        grid-template-columns: 236px minmax(0, 1fr);
    }

    .notice-banner {
        left: calc(236px + 12px);
        right: 12px;
    }

    .sidebar {
        width: 236px;
        padding: 16px 12px;
        grid-template-columns: 1fr;
        grid-template-areas:
            "clock"
            "nav";
        align-items: stretch;
    }

    .brand,
    .brand img {
        width: 320px;
        min-width: 0;
    }

    .brand img { height: 78px; }

    nav {
        display: grid;
        overflow-x: visible;
    }
}

@media (max-width: 920px) {
    .app-shell {
        display: grid;
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr;
        grid-template-areas:
            "topbar"
            "sidebar"
            "main";
    }

    .sidebar {
        position: relative;
        width: 100%;
        min-height: auto;
        height: auto;
        top: 0;
        left: auto;
        bottom: auto;
        overflow-y: visible;
        padding: 10px 12px;
        grid-template-columns: 1fr;
        grid-template-areas:
            "clock"
            "nav";
        align-items: flex-start;
    }

    .topbar {
        position: sticky;
        top: 0;
        left: auto;
        right: auto;
        z-index: 25;
        flex-wrap: wrap;
        justify-content: space-between;
        min-height: auto;
        padding: 8px 12px;
    }

    .brand {
        width: 170px;
        min-width: 170px;
        align-self: auto;
        border-right: 0;
        border-bottom: 0;
        justify-content: flex-start;
        padding: 0;
    }

    .header-info {
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    nav {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
        justify-content: stretch;
    }

    .main {
        padding: 8px 18px 28px;
    }

    .notice-banner {
        position: static;
        margin: 0 -6px 16px;
    }

    .page-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .dashboard-hero {
        align-items: flex-start;
        flex-direction: column;
        margin: 0 0 24px;
        padding: 24px 18px;
        background: #ffffff;
    }

    .hero-actions {
        justify-content: flex-start;
    }

    .metrics,
    .form-grid,
    .form-section,
    .filters {
        grid-template-columns: 1fr;
    }

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

    .pricing-reference-popover {
        grid-template-columns: 1fr;
        justify-self: stretch;
        max-width: none;
    }

    .form-footer {
        align-items: stretch;
        flex-direction: column;
    }

    label.span-2 { grid-column: auto; }
    .form-section label.span-2,
    .form-section label.span-4 { grid-column: auto; }
    .minor-fields {
        grid-template-columns: 1fr;
    }
    .minor-fields label.span-2 { grid-column: auto; }
    .patient-meta {
        grid-template-columns: 1fr;
    }
    .patient-steps {
        grid-template-columns: 1fr;
    }
    .name-social-row,
    .contact-compact-row,
    .social-data-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .sidebar {
        padding: 8px 10px;
        gap: 10px;
    }

    nav { grid-template-columns: 1fr; }

    .brand {
        min-width: 0;
        width: 150px;
        flex-basis: 150px;
    }

    .brand img {
        width: 150px;
        height: 40px;
    }

    .header-info {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .notice-chip {
        max-width: 100%;
        flex: 1;
    }

    .notice-banner {
        align-items: flex-start;
    }

    .notice-content {
        grid-template-columns: 1fr;
        gap: 2px;
    }

    .sidebar-footer {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .user-chip {
        min-width: 0;
        flex: 1;
    }

    .user-meta strong {
        max-width: 100%;
    }

    .sidebar-footer a {
        min-height: 34px;
        padding: 4px 7px;
    }

    .panel,
    .auth-card {
        padding: 18px;
    }

    h1 { font-size: 28px; }

    .dashboard-hero h1 {
        font-size: 38px;
    }

    .dashboard-hero p {
        font-size: 18px;
    }

    .status-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .today-numbers {
        grid-template-columns: 1fr;
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }

    .actions,
    .btn,
    .inline-form {
        width: 100%;
    }

    .actions {
        flex-wrap: wrap;
    }

    .actions .btn,
    .actions .inline-form {
        width: auto;
    }

    .actions .btn-small {
        width: 36px;
        min-width: 36px;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .patient-view-hero {
        grid-template-columns: 1fr;
    }

    .patient-view-meta,
    .patient-view-grid {
        grid-template-columns: 1fr;
    }
}

.nav-icon,
.quick-icon,
.notice-icon,
.operation-modal-icon,
.metrics .metric-icon,
.patient-step span,
.field-icon-btn,
.field-icon-btn .btn-icon,
.btn.ghost .btn-icon,
.actions .btn-small .btn-icon,
.patient-whatsapp-link,
.patient-whatsapp-link .btn-icon {
    background: #eef8e9;
    color: var(--green-500);
}

nav a:hover .nav-icon,
.quick-actions a:hover .quick-icon,
.field-icon-btn:hover,
.btn.ghost:hover .btn-icon,
.patient-whatsapp-link:hover {
    background: #e3eedc;
    color: var(--green-700);
}

nav a.active .nav-icon,
nav a.active:hover .nav-icon,
.patient-step.active span {
    background: var(--green-500);
    color: #ffffff;
}

.nav-group-title .nav-icon,
.nav-group.active > .nav-group-title .nav-icon,
.sidebar-footer a .nav-icon,
.field-icon-btn.reference-btn,
.field-icon-btn.whatsapp-btn {
    background: #eef8e9;
    color: var(--green-500);
}

.field-icon-btn,
.field-icon-btn.reference-btn,
.field-icon-btn.whatsapp-btn,
.patient-whatsapp-link {
    border-color: #cfe6c1;
}

body {
    font-weight: 400;
    letter-spacing: 0;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1,
.dashboard-hero h1,
.patient-view-title h2 {
    font-weight: 700;
}

h2,
.panel-head h2,
.patient-view-section h3 {
    font-weight: 650;
}

p,
td,
input,
select,
textarea {
    font-weight: 400;
}

nav a,
.btn,
.quick-actions a,
.sidebar-footer a,
label,
.checkbox-row,
.text-link {
    font-weight: 600;
}

.dashboard-hero h1 span,
.dashboard-hero h1 strong,
.metrics strong,
.today-numbers strong,
.patient-view-avatar,
.user-avatar {
    font-weight: 700;
}

.eyebrow,
.nav-group-title,
.metrics span,
.badge,
th,
.detail-grid dt,
.patient-view-meta small,
.patient-view-grid small,
.notice-content small,
.clock-text small,
.user-meta small {
    font-weight: 650;
    letter-spacing: .02em;
}

.metrics small,
.today-numbers span,
.detail-grid dd,
.patient-view-meta strong,
.patient-view-grid strong,
.notice-content strong,
.user-meta strong {
    font-weight: 500;
}

.datetime-chip strong,
.sidebar-clock strong,
.notice-chip span,
.notice-chip strong,
.user-avatar,
.user-meta small,
.sidebar-footer a,
.notice-content small,
.dashboard-hero h1 span,
.dashboard-hero h1 strong,
.eyebrow,
.metrics span,
.quick-actions a,
.patient-step span,
.patient-step strong,
.form-section legend,
.minor-hint,
.checkbox-row,
.pricing-reference-popover small,
.pricing-reference-popover strong,
.btn,
.text-link,
.detail-grid dt,
.detail-note strong,
.patient-view-avatar,
.patient-view-title span,
.patient-view-meta small,
.patient-view-grid small,
.patient-view-section h3,
.badge,
.form-footer,
.sus-update-status {
    font-weight: 600;
}

.span-full,
.exam-option-row {
    grid-column: 1 / -1;
}

.quick-select {
    position: relative;
    gap: 7px;
}

.select-search-wrap {
    position: relative;
    min-width: 0;
}

.select-search {
    width: 100%;
    min-height: 38px;
    border-style: dashed;
    background: #fbfcfa;
    font-size: 13px;
}

.select-results {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 5px);
    z-index: 80;
    display: grid;
    gap: 4px;
    max-height: 230px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--line-strong);
    border-radius: 11px;
    background: #ffffff;
    box-shadow: 0 14px 28px rgba(38, 53, 45, .12);
}

.select-results[hidden] {
    display: none;
}

.select-results button {
    width: 100%;
    min-height: 34px;
    padding: 7px 9px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--green-900);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 550;
    line-height: 1.25;
    text-align: left;
}

.select-results button:hover {
    background: #eef8e9;
    color: var(--green-700);
}

.quick-select select {
    margin-top: 0;
}

.quick-select select[data-search-select] {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    border: 0;
    opacity: 0;
    pointer-events: none;
    clip-path: inset(50%);
}

.exam-wizard {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 18px;
}

.exam-steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.exam-origin-card {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--surface-2);
}

.exam-origin-card div {
    min-width: 0;
    padding: 10px;
    border: 1px solid #edf1e8;
    border-radius: 10px;
    background: #ffffff;
}

.exam-origin-card span {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 650;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.exam-origin-card strong {
    display: block;
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--green-900);
    font-size: 13px;
    font-weight: 600;
}

.exam-option-row {
    justify-self: start;
    width: auto;
    min-height: 42px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #ffffff;
}

.multi-exam-builder {
    grid-column: 1 / -1;
    display: grid;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #ffffff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .65);
}

.multi-exam-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.multi-exam-head h3 {
    margin: 0 0 4px;
    color: var(--green-900);
    font-size: 18px;
    line-height: 1.15;
    font-weight: 650;
}

.multi-exam-head p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.multi-exam-total {
    display: grid;
    gap: 3px;
    min-width: 160px;
    padding: 9px 12px;
    border: 1px solid #cfe6c1;
    border-radius: 12px;
    background: #f7fbf4;
    text-align: right;
}

.multi-exam-total span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 650;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.multi-exam-total strong,
.multi-exam-head > strong {
    color: var(--green-700);
    font-size: 20px;
    line-height: 1;
    font-weight: 750;
    white-space: nowrap;
}

.multi-exam-items {
    display: grid;
    gap: 10px;
}

.multi-exam-item {
    position: relative;
    display: grid;
    grid-template-columns: minmax(250px, .95fr) minmax(220px, .75fr) minmax(220px, .75fr) 44px;
    gap: 10px;
    align-items: end;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--surface-2);
}

.multi-exam-item.uses-partner,
.multi-exam-item.uses-lab {
    grid-template-columns: minmax(250px, .9fr) minmax(230px, .82fr) minmax(220px, .72fr) minmax(230px, .76fr) 44px;
}

.multi-exam-item label {
    min-width: 0;
}

.multi-exam-value-field .input-action {
    grid-template-columns: minmax(120px, 1fr) 40px;
    gap: 6px;
}

.multi-exam-value-field .field-icon-btn {
    width: 40px;
    height: 42px;
}

.multi-exam-item [data-exam-item-value] {
    min-width: 120px;
    padding-inline: 12px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.multi-exam-item .field-icon-btn {
    align-self: end;
}

.multi-exam-reference {
    position: absolute;
    right: 56px;
    bottom: 58px;
    z-index: 20;
    display: none;
    flex-wrap: wrap;
    gap: 6px;
    max-width: min(420px, calc(100% - 80px));
    padding: 8px 10px;
    border: 1px solid #dfe8d8;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: var(--shadow-soft);
    color: var(--muted);
    font-size: 12px;
}

.multi-exam-value-field:hover + .multi-exam-reference,
.multi-exam-reference:hover,
.multi-exam-reference.is-open {
    display: flex;
}

.multi-exam-reference span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 7px;
    border-radius: 999px;
    background: #f2f7ef;
}

.multi-exam-reference strong {
    color: var(--green-900);
    font-weight: 650;
}

.multi-exam-reference.danger {
    border-color: #f2dfae;
    background: #fffaf0;
    color: var(--orange-dark);
}

@media (max-width: 1500px) {
    .multi-exam-item,
    .multi-exam-item.uses-partner,
    .multi-exam-item.uses-lab {
        grid-template-columns: minmax(0, 1.1fr) minmax(0, .95fr) minmax(190px, .7fr) 44px;
    }

    .multi-exam-type {
        grid-column: 1 / 2;
    }

    .multi-exam-partner:not([hidden]) {
        grid-column: 2 / 3;
    }

    .multi-exam-rule {
        grid-column: 1 / 2;
    }

    .multi-exam-value-field {
        grid-column: 2 / 4;
    }

    .multi-exam-item > .field-icon-btn[data-remove-exam-item] {
        grid-column: 4 / 5;
        grid-row: 1 / 3;
    }
}

@media (max-width: 1180px) {
    .multi-exam-item,
    .multi-exam-item.uses-partner,
    .multi-exam-item.uses-lab {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px;
    }

    .multi-exam-value-field {
        grid-column: 2 / 3;
    }

    .multi-exam-item > .field-icon-btn[data-remove-exam-item] {
        grid-column: 3 / 4;
    }
}

.multi-exam-builder > .btn {
    justify-self: start;
}

@media (max-width: 760px) {
    .multi-exam-head {
        align-items: stretch;
        flex-direction: column;
    }

    .exam-steps,
    .exam-origin-card {
        grid-template-columns: 1fr;
    }

    .multi-exam-total,
    .multi-exam-head > strong {
        text-align: left;
    }

    .multi-exam-item,
    .multi-exam-item.uses-partner,
    .multi-exam-item.uses-lab {
        grid-template-columns: 1fr;
    }

    .multi-exam-type,
    .multi-exam-partner:not([hidden]),
    .multi-exam-rule,
    .multi-exam-value-field,
    .multi-exam-item > .field-icon-btn[data-remove-exam-item] {
        grid-column: auto;
        grid-row: auto;
    }

    .multi-exam-reference {
        right: 12px;
        bottom: 64px;
        max-width: calc(100% - 24px);
    }

    .multi-exam-item > .field-icon-btn[data-remove-exam-item] {
        width: 100%;
    }

    .multi-exam-value-field .field-icon-btn {
        width: 40px;
    }
}
