@font-face {
    font-family: "SF Pro Display";
    src: url("fonts/SFPRODISPLAYREGULAR.OTF") format("opentype");
    font-style: normal;
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: "SF Pro Display";
    src: url("fonts/SFPRODISPLAYMEDIUM.OTF") format("opentype");
    font-style: normal;
    font-weight: 500 600;
    font-display: swap;
}

@font-face {
    font-family: "SF Pro Display";
    src: url("fonts/SFPRODISPLAYBOLD.OTF") format("opentype");
    font-style: normal;
    font-weight: 700 900;
    font-display: swap;
}

:root {
    --so-brand-700: #0037c7;
    --so-primary-600: #076df2;
    --so-primary-700: #005dcc;
    --so-ink-900: #141f59;
    --so-ink-700: #2f3c75;
    --so-surface-blue-50: #f1f1fc;
    --so-border-soft: #e1e1f3;
    --so-white: #ffffff;
    --so-neutral-50: #f5f5f5;
    --so-success-600: #2aab81;
    --so-danger-600: #ff3b52;
    --so-warning-500: #ffa726;
    --so-font-sans: "SF Pro Display", "Segoe UI", Arial, sans-serif;
    --so-shadow-sm: 0 3px 12px rgba(20, 31, 89, 0.08);
    --so-radius-sm: 0.5rem;
    --so-radius-md: 0.75rem;
}

html, body {
    min-height: 100%;
    background: var(--so-neutral-50);
    color: var(--so-ink-900);
    font-family: var(--so-font-sans);
    font-size: 16px;
    overflow-x: clip;
}

/* Select pesquisável no padrão visual do sistema, sem substituir o binding do Blazor. */
.so-select2 { position: relative; width: 100%; }
.so-select2 > select { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.so-select2__control { display: flex; align-items: center; min-height: 2.75rem; border: 1px solid var(--so-border-soft); border-radius: var(--so-radius-sm); background: var(--so-white); cursor: text; }
.so-select2:focus-within .so-select2__control, .so-select2.is-open .so-select2__control { border-color: var(--so-primary-600); box-shadow: 0 0 0 .2rem rgba(7, 109, 242, .18); }
.so-select2__input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: inherit; padding: .625rem .75rem; font: inherit; }
.so-select2__clear { border: 0; background: transparent; color: #64748b; font-size: 1.25rem; line-height: 1; padding: .25rem .7rem; cursor: pointer; }
.so-select2__clear:hover { color: var(--so-danger-600); }
.so-select2.is-disabled .so-select2__control { opacity: .65; cursor: not-allowed; background: #f8fafc; }
.so-select2.is-disabled .so-select2__input { cursor: not-allowed; }
.so-select2__dropdown { display: none; position: absolute; z-index: 1000; left: 0; right: 0; top: calc(100% + .35rem); padding: .35rem; border: 1px solid var(--so-border-soft); border-radius: var(--so-radius-sm); background: var(--so-white); box-shadow: var(--so-shadow-sm); }
.so-select2.is-open .so-select2__dropdown { display: block; }
.so-select2__options { max-height: 15rem; overflow-y: auto; }
.so-select2__option { display: block; width: 100%; border: 0; border-radius: .35rem; background: transparent; color: inherit; text-align: left; padding: .6rem .7rem; cursor: pointer; font: inherit; }
.so-select2__option:hover, .so-select2__option.is-selected { background: var(--so-surface-blue-50); color: var(--so-primary-700); }
.so-select2__option:disabled { opacity: .5; cursor: not-allowed; }
.so-select2__empty { color: #64748b; padding: .75rem; font-size: .9rem; }
html[data-theme="dark"] .so-select2__control, html[data-theme="dark"] .so-select2__dropdown { background: #1e293b; border-color: #475569; color: #e5e7eb; }
html[data-theme="dark"] .so-select2__input { color: #f8fafc; }
html[data-theme="dark"] .so-select2.is-disabled .so-select2__control { background: #172033; }
html[data-theme="dark"] .so-select2__option:hover, html[data-theme="dark"] .so-select2__option.is-selected { background: #172554; color: #bfdbfe; }
html[data-theme="dark"] .so-select2__empty { color: #cbd5e1; }

/* Autenticação: regras globais para evitar que navegadores mobile exibam o formulário nativo. */
.auth-shell {
    width: 100%;
    min-height: 100dvh;
    overflow-x: hidden;
}
.auth-shell .login-card {
    display: block;
    width: min(100%, 28rem);
    max-width: 100%;
    margin-inline: auto;
    padding: 2.25rem;
    overflow: hidden;
}
.auth-shell .login-card__logo {
    display: block;
    width: min(10rem, 62vw) !important;
    max-width: 100%;
    height: auto;
    margin-inline: auto;
}
.auth-shell .login-card form {
    display: grid;
    width: 100%;
    min-width: 0;
}
.auth-shell .login-card .login-field,
.auth-shell .login-card .form-control,
.auth-shell .login-card .login-submit,
.auth-shell .login-card .login-register-link {
    width: 100%;
    max-width: 100%;
}
.auth-shell .login-card .form-control {
    min-height: 2.75rem;
    appearance: none;
    -webkit-appearance: none;
}
.auth-shell .login-honeypot {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

@media (max-width: 480px) {
    .auth-shell {
        align-items: start;
        padding: max(1rem, env(safe-area-inset-top)) .75rem max(1rem, env(safe-area-inset-bottom));
    }
    .auth-shell .login-card {
        width: 100%;
        padding: 1.35rem;
        border-radius: 1rem;
    }
    .auth-shell .login-card__logo {
        width: min(9rem, 58vw) !important;
        margin-bottom: 1.35rem;
    }
    .auth-shell .login-card h1 {
        font-size: clamp(1.8rem, 9vw, 2.35rem);
        line-height: 1.05;
        overflow-wrap: anywhere;
    }
    .auth-shell .login-card__subtitle {
        line-height: 1.4;
    }
    .auth-shell .login-theme {
        top: .8rem;
        right: .8rem;
    }
    .auth-shell .login-submit,
    .auth-shell .login-register-link {
        min-height: 2.9rem;
    }
}

/* Alternador de tema (lua/sol): global, pois o botão é renderizado pelo componente ThemeToggle
   e regras de CSS isolado de AuthLayout/LandingLayout nunca alcançam elementos de componentes filhos. */
.so-theme-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1100;
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid rgb(255 255 255 / 70%);
    border-radius: 50%;
    background: rgb(255 255 255 / 34%);
    color: #14235f;
    box-shadow: inset 0 1px 0 rgb(255 255 255 / 60%), 0 .35rem 1rem rgb(0 20 80 / 22%);
    -webkit-backdrop-filter: blur(14px) saturate(150%);
    backdrop-filter: blur(14px) saturate(150%);
    cursor: pointer;
    font-size: .95rem;
    line-height: 1;
    transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease, border-color .18s ease;
}

.so-theme-toggle:hover { transform: translateY(-2px) rotate(-8deg); box-shadow: inset 0 1px 0 rgb(255 255 255 / 45%), 0 .55rem 1.3rem rgb(0 20 80 / 32%); }
.landing-shell .so-theme-toggle { top: 1.1rem; right: 1.2rem; }
html[data-theme="dark"] .so-theme-toggle { border-color: rgb(147 197 253 / 45%); background: rgb(30 41 59 / 55%); color: #93c5fd; box-shadow: inset 0 1px 0 rgb(255 255 255 / 14%), 0 .35rem 1rem rgb(2 6 23 / 45%); }

@media (max-width: 600px) {
    .so-theme-toggle { top: .75rem; right: .75rem; width: 2.1rem; height: 2.1rem; font-size: .9rem; }
    .landing-shell .so-theme-toggle { top: .75rem; right: .75rem; }
}

*, *::before, *::after { box-sizing: border-box; }

h1, h2, h3, h4, h5, h6 {
    color: var(--so-ink-900);
    font-weight: 700;
    letter-spacing: -0.01em;
}

a, .btn-link { color: var(--so-primary-600); font-weight: 500; }
a:hover, .btn-link:hover { color: var(--so-primary-700); }

.btn {
    border-radius: var(--so-radius-sm);
    font-family: var(--so-font-sans);
    font-weight: 600;
    min-height: 2.75rem;
    padding: 0.625rem 1rem;
}

.btn-primary {
    -webkit-backdrop-filter: blur(12px) saturate(140%);
    backdrop-filter: blur(12px) saturate(140%);
    background: linear-gradient(135deg, rgb(37 133 255 / 96%), rgb(7 93 224 / 96%));
    border: 1px solid rgb(147 197 253 / 62%);
    box-shadow: inset 0 1px 0 rgb(255 255 255 / 28%), 0 .45rem 1rem rgb(7 78 178 / 22%);
    color: var(--so-white);
    isolation: isolate;
    overflow: hidden;
    position: relative;
    transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.btn-primary::after {
    background: radial-gradient(circle, rgb(255 255 255 / 58%) 0, rgb(191 219 254 / 28%) 24%, transparent 67%);
    border-radius: 50%;
    content: "";
    height: 3rem;
    left: 50%;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%) scale(.15);
    width: 3rem;
    z-index: 0;
}
.btn-primary:active::after { animation: so-liquid-button-press .46s cubic-bezier(.2, .75, .25, 1) forwards; }
.btn-primary > * { position: relative; z-index: 1; }
.btn-primary:hover {
    background: linear-gradient(135deg, rgb(59 146 255 / 98%), rgb(13 103 239 / 98%));
    border-color: rgb(191 219 254 / 84%);
    box-shadow: inset 0 1px 0 rgb(255 255 255 / 38%), 0 .65rem 1.25rem rgb(7 78 178 / 30%);
    color: var(--so-white);
    transform: translateY(-1px);
}
.btn-primary:active {
    background: linear-gradient(135deg, rgb(13 103 239 / 98%), rgb(5 72 172 / 98%));
    box-shadow: inset 0 2px 5px rgb(0 33 91 / 28%), 0 .2rem .55rem rgb(7 78 178 / 18%);
    color: var(--so-white);
    transform: translateY(0);
}
.btn-primary:disabled, .btn-primary.disabled {
    box-shadow: none;
    cursor: not-allowed;
    opacity: .58;
    transform: none;
}
.btn-outline-primary { color: var(--so-primary-600); border-color: var(--so-primary-600); }
.btn-outline-primary:hover { background-color: var(--so-primary-600); border-color: var(--so-primary-600); color: #fff; }
.btn-light { background: #fff; border-color: #cbd5e1; color: var(--so-ink-900); }
.btn-light:hover { background: var(--so-surface-blue-50); border-color: var(--so-primary-600); color: var(--so-primary-700); }
.btn-outline-secondary { border-color: #cbd5e1; color: var(--so-ink-700); }
.btn-outline-secondary:hover { background-color: var(--so-ink-700); border-color: var(--so-ink-700); color: #fff; }
.btn-outline-danger { border-color: var(--so-danger-600); color: var(--so-danger-600); }
.btn-outline-danger:hover { background-color: var(--so-danger-600); border-color: var(--so-danger-600); color: #fff; }
.btn-success { background-color: var(--so-success-600); border-color: var(--so-success-600); }
.btn-danger { background-color: var(--so-danger-600); border-color: var(--so-danger-600); }
html[data-theme="dark"] .btn-outline-primary { border-color: #60a5fa; color: #60a5fa; }
html[data-theme="dark"] .btn-outline-primary:hover { background-color: #2563eb; border-color: #2563eb; color: #fff; }
html[data-theme="dark"] .btn-light { background: #1e293b; border-color: #475569; color: #e5e7eb; }
html[data-theme="dark"] .btn-light:hover { background: #263449; border-color: #60a5fa; color: #dbeafe; }
html[data-theme="dark"] .btn-outline-secondary { border-color: #475569; color: #cbd5e1; }
html[data-theme="dark"] .btn-outline-secondary:hover { background-color: #cbd5e1; border-color: #cbd5e1; color: #0f172a; }
html[data-theme="dark"] .btn-outline-danger { border-color: #f87171; color: #f87171; }
html[data-theme="dark"] .btn-outline-danger:hover { background-color: #dc2626; border-color: #dc2626; color: #fff; }

.btn:focus-visible, .btn-link:focus-visible, a:focus-visible, .form-control:focus, .form-select:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.2rem var(--so-white), 0 0 0 0.4rem rgba(7, 109, 242, 0.5);
    outline: none;
}

.form-control, .form-select {
    border-color: var(--so-border-soft);
    border-radius: var(--so-radius-sm);
    color: var(--so-ink-900);
    font-family: var(--so-font-sans);
    min-height: 2.75rem;
}

.form-control:focus, .form-select:focus { border-color: var(--so-primary-600); }

.so-card { background: var(--so-white); border: 1px solid var(--so-border-soft); border-radius: var(--so-radius-md); box-shadow: var(--so-shadow-sm); }
.so-page-title { font-size: clamp(1.5rem, 3vw, 2rem); line-height: 1.25; margin: 0; }
.so-page-subtitle { color: var(--so-ink-700); margin: 0.35rem 0 0; }

.so-status { align-items: center; border-radius: 999px; display: inline-flex; font-size: 0.875rem; font-weight: 600; gap: 0.375rem; padding: 0.35rem 0.75rem; }
.so-status--success { background: #e8f8f2; color: #167354; }
.so-status--warning { background: #fff4e5; color: #a55c00; }
.so-status--danger { background: #fff0f2; color: #bf1731; }

html[data-theme="dark"] {
    --so-neutral-50: #0f172a;
    --so-ink-900: #e5e7eb;
    --so-ink-700: #cbd5e1;
    --so-surface-blue-50: #172554;
    --so-border-soft: #334155;
    --so-shadow-sm: 0 3px 12px rgba(0, 0, 0, .28);
}
html[data-theme="dark"] body { background: var(--so-neutral-50); color: var(--so-ink-900); }
html[data-theme="dark"] .so-card,
html[data-theme="dark"] .home-notice,
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] textarea { background-color: #1e293b; color: var(--so-ink-900); }
html[data-theme="dark"] .form-control::placeholder { color: #94a3b8; }
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea { color-scheme: dark; }
html[data-theme="dark"] input[type="date"],
html[data-theme="dark"] input[type="time"],
html[data-theme="dark"] input[type="datetime-local"],
html[data-theme="dark"] input[type="month"] { color-scheme: dark; }

/* Cadastro de clínica: neutraliza estilos nativos e mantém o padrão dos formulários. */
.tenant-create-form input {
    appearance: none;
    background: #fff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: .55rem !important;
    box-shadow: none !important;
    box-sizing: border-box;
    color: #10245d !important;
    display: block;
    font: inherit;
    line-height: 1.35;
    min-height: 42px;
    outline: none;
    padding: .65rem .75rem;
    width: 100%;
}
.tenant-create-form input:focus {
    border-color: #0d6efd !important;
    box-shadow: 0 0 0 3px rgb(13 110 253 / 16%) !important;
}
html[data-theme="dark"] .tenant-create-form input {
    background: #1e293b !important;
    border-color: #64748b !important;
    color: #f8fafc !important;
    color-scheme: dark;
}
html[data-theme="dark"] .tenant-create-form input:focus {
    border-color: #60a5fa !important;
    box-shadow: 0 0 0 3px rgb(96 165 250 / 24%) !important;
}
html[data-theme="dark"] .home-history__table th { background: #172554; }
html[data-theme="dark"] .home-history__table td { background: #1e293b; }
html[data-theme="dark"] .btn-primary { color: #fff; }
html[data-theme="dark"] .home-count { background: #1e3a8a; color: #dbeafe; border: 1px solid #60a5fa; }
html[data-theme="dark"] .home-history__meta { color: #93c5fd; }
html[data-theme="dark"] .home-history__meta span { color: #bfdbfe; }
html[data-theme="dark"] .receivable-tab { background: #1e293b; color: #cbd5e1; border-color: #475569; }
html[data-theme="dark"] .receivable-tab--active { background: #076df2; color: #fff; border-color: #60a5fa; }
html[data-theme="dark"] .receivable-tab strong { background: #1e3a8a; color: #dbeafe !important; }
html[data-theme="dark"] .receivable-tab--active strong { background: #0b3b91; color: #fff !important; }
html[data-theme="dark"] .receivable-summary > div,
html[data-theme="dark"] .receivable-kpis > div { background: #172554; border-color: #3b82f6; }
html[data-theme="dark"] .receivable-summary span,
html[data-theme="dark"] .receivable-kpis span { color: #cbd5e1; }
html[data-theme="dark"] .receivable-summary strong,
html[data-theme="dark"] .receivable-kpis strong { color: #bfdbfe; }
html[data-theme="dark"] .receivable-cash-item { background: #1e293b; color: #e5e7eb; border-color: #475569; }
html[data-theme="dark"] .receivable-cash-item:hover,
html[data-theme="dark"] .receivable-cash-item--selected { background: #172554; border-color: #60a5fa; }
html[data-theme="dark"] .receivable-cash-item strong,
html[data-theme="dark"] .receivable-cash-item-value strong { color: #bfdbfe; }
html[data-theme="dark"] .receivable-cash-item small { color: #cbd5e1; }
html[data-theme="dark"] .receivable-table th { background: #172554; color: #dbeafe; border-color: #475569; }
html[data-theme="dark"] .receivable-table td { background: #1e293b; color: #e5e7eb; border-color: #334155; }
html[data-theme="dark"] .receivable-table tbody tr:nth-child(even) { background: #172033; }
html[data-theme="dark"] .receivable-table tbody tr:hover { background: #172554; }
html[data-theme="dark"] .receivable-reconcile { background: #172033; border-color: #2563eb; }
html[data-theme="dark"] .receivable-reconcile p:not(.eyebrow),
html[data-theme="dark"] .receivable-reconcile-total > span { color: #cbd5e1; }
html[data-theme="dark"] .receivable-conference-by { background: #12352b; border-color: #15803d; color: #bbf7d0; }
html[data-theme="dark"] .cash-summary--blue { background: #172554; border-color: #3b82f6; }
html[data-theme="dark"] .cash-summary--green { background: #12352b; border-color: #22c55e; }
html[data-theme="dark"] .cash-summary--purple { background: #2e1065; border-color: #8b5cf6; }
html[data-theme="dark"] .cash-summary span { color: #cbd5e1; }
html[data-theme="dark"] .cash-summary strong { color: #dbeafe; }
html[data-theme="dark"] .cash-summary .cash-status { background: #14532d; border: 1px solid #4ade80; color: #dcfce7 !important; }
html[data-theme="dark"] .cash-warning { background: #422006; color: #fde68a; border-color: #b45309; }
html[data-theme="dark"] .cash-table th { background: #172554; color: #dbeafe; }
html[data-theme="dark"] .cash-table td { background: #1e293b; color: #e5e7eb; border-color: #334155; }
html[data-theme="dark"] .cash-table tr.cash-row--selected { background: #172554; }
html[data-theme="dark"] .cash-procedure-card { background: #1e293b; color: #e5e7eb; border-color: #475569; }
html[data-theme="dark"] .cash-procedure-card:hover,
html[data-theme="dark"] .cash-procedure-card--selected { background: #172554; border-color: #60a5fa; }
html[data-theme="dark"] .cash-procedure-main strong { color: #f8fafc; }
html[data-theme="dark"] .cash-procedure-main span,
html[data-theme="dark"] .cash-procedure-value { color: #bfdbfe; }
html[data-theme="dark"] .cash-checkout { background: linear-gradient(180deg, #172554 0%, #1e293b 100%); border-color: #3b82f6; }
html[data-theme="dark"] .cash-payment-total > div { background: #172033; border-color: #475569; }
html[data-theme="dark"] .cash-payment-total strong { color: #dbeafe; }
html[data-theme="dark"] .cash-payment-total span { color: #cbd5e1; }
html[data-theme="dark"] .cash-payment-total { background: transparent; }
html[data-theme="dark"] .cash-checkout-balance { background: #172554; color: #dbeafe; }
html[data-theme="dark"] .cash-checkout-balance strong { color: #bfdbfe; }
html[data-theme="dark"] .cash-empty { color: #cbd5e1; }
html[data-theme="dark"] .patient-tabs { background: #172554; }
html[data-theme="dark"] .patient-tab { color: #cbd5e1; }
html[data-theme="dark"] .patient-tab:hover,
html[data-theme="dark"] .patient-tab:focus-visible { background: #263449; color: #dbeafe; }
html[data-theme="dark"] .patient-info-group { background: #1e293b; }
html[data-theme="dark"] .patient-orcamentos-summary__card--total { background: linear-gradient(135deg, #164e63, #155e75) !important; border-color: #22d3ee !important; color: #cffafe; }
html[data-theme="dark"] .patient-orcamentos-summary__card--planned { background: linear-gradient(135deg, #1e1b4b, #312e81) !important; border-color: #818cf8 !important; color: #e0e7ff; }
html[data-theme="dark"] .patient-orcamentos-summary__card--open { background: linear-gradient(135deg, #431407, #7c2d12) !important; border-color: #fb923c !important; color: #ffedd5; }
html[data-theme="dark"] .patient-orcamentos-summary span { color: #cbd5e1; }
html[data-theme="dark"] .patient-orcamentos-summary strong { color: #f8fafc; }
html[data-theme="dark"] .patient-summary-progress { background: linear-gradient(90deg, #818cf8 0%, #818cf8 var(--progress), #312e81 var(--progress), #312e81 100%); }
html[data-theme="dark"] .patient-summary-progress--open { background: linear-gradient(90deg, #fb923c 0%, #fb923c var(--progress), #7c2d12 var(--progress), #7c2d12 100%); }
html[data-theme="dark"] .patient-orcamentos-table th { background: #172554; color: #dbeafe; }
html[data-theme="dark"] .patient-orcamentos-table td { background: #1e293b; color: #e5e7eb; border-color: #334155; }
html[data-theme="dark"] .patient-orcamentos-table td small { color: #cbd5e1; }
html[data-theme="dark"] .patient-status--info { background: #172554; border-color: #3b82f6; color: #bfdbfe; }
html[data-theme="dark"] .patient-status--success { background: #12352b; border-color: #22c55e; color: #bbf7d0; }
html[data-theme="dark"] .patient-status--warning { background: #422006; border-color: #f59e0b; color: #fde68a; }
html[data-theme="dark"] .patient-status--danger { background: #450a0a; border-color: #ef4444; color: #fecaca; }
html[data-theme="dark"] .patient-payment-progress { background: linear-gradient(135deg, #12352b, #14532d); border-color: #22c55e; }
html[data-theme="dark"] .patient-payment-progress__header,
html[data-theme="dark"] .patient-payment-progress__footer,
html[data-theme="dark"] .patient-payment-progress--compact small { color: #bbf7d0; }
html[data-theme="dark"] .patient-payment-progress__track { background: #14532d; }
html[data-theme="dark"] .payables-summary > div { background: #172554; border-color: #3b82f6; }
html[data-theme="dark"] .payables-summary span { color: #cbd5e1; }
html[data-theme="dark"] .payables-summary strong { color: #dbeafe; }
html[data-theme="dark"] .payables-table th { background: #172554; color: #dbeafe; }
html[data-theme="dark"] .payables-table td { background: #1e293b; color: #e5e7eb; border-color: #334155; }
html[data-theme="dark"] .payables-table small { color: #cbd5e1; }
html[data-theme="dark"] .payables-form,
html[data-theme="dark"] .payables-modal { background: #1e293b; }
html[data-theme="dark"] .payables-row-actions button { color: #93c5fd; }
html[data-theme="dark"] .payables-modal-backdrop .so-card { background: #1e293b; }
html[data-theme="dark"] .patients-action--view { background: #263449; border-color: #475569; color: #e2e8f0; }
html[data-theme="dark"] .patients-action--view:hover { background: #334155; border-color: #60a5fa; color: #bfdbfe; }
html[data-theme="dark"] .patient-modal,
html[data-theme="dark"] .agenda-modal { background: #1e293b; }
html[data-theme="dark"] .agenda-timeline { background: #0f172a; border-color: #475569; }
html[data-theme="dark"] .agenda-timeline__hours { background: #172033; border-color: #475569; }
html[data-theme="dark"] .agenda-timeline__body { background: #0f172a; }
html[data-theme="dark"] .agenda-timeline__row { border-color: #334155; }
html[data-theme="dark"] .agenda-timeline__hours span { color: #cbd5e1; }
html[data-theme="dark"] .agenda-timeline__item { background: color-mix(in srgb, var(--professional-color) 42%, #172033); border-color: color-mix(in srgb, var(--professional-color) 75%, #64748b); color: #f8fafc; box-shadow: 0 .25rem .7rem rgb(0 0 0 / 35%); }
html[data-theme="dark"] .agenda-timeline__item small { color: #cbd5e1; }
html[data-theme="dark"] .agenda-column { background: #172033; }
html[data-theme="dark"] .agenda-grid .agenda-item { background: #1e293b; color: #e5e7eb; }
html[data-theme="dark"] .agenda-modal__details div { background: #172554; }
html[data-theme="dark"] .agenda-modal__anamnese { background: #172033; }
html[data-theme="dark"] .agenda-modal__box input { background: #0f172a; border-color: #64748b; color: #f8fafc; }
html[data-theme="dark"] .agenda-status--info { background: #172554; color: #93c5fd; border-color: #2563eb; }
html[data-theme="dark"] .agenda-status--success { background: #12352b; color: #86efac; border-color: #15803d; }
html[data-theme="dark"] .agenda-status--warning { background: #422006; color: #fde68a; border-color: #b45309; }
html[data-theme="dark"] .agenda-status--danger { background: #450a0a; color: #fca5a5; border-color: #dc2626; }

.content { padding-top: 1.5rem; }
h1:focus { outline: none; }
.valid.modified:not([type=checkbox]) { outline: 1px solid var(--so-success-600); }
.invalid { outline: 1px solid var(--so-danger-600); }
.validation-message { color: var(--so-danger-600); }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}
/* Loading skeleton compartilhado para manter a estrutura das telas durante consultas assíncronas. */
.so-loading-skeleton { display: grid; gap: .75rem; padding: 1.5rem; }
.so-loading-skeleton__line, .so-loading-skeleton__block { position: relative; display: block; overflow: hidden; border-radius: .6rem; background: color-mix(in srgb, var(--so-border-soft) 68%, transparent); }
.so-loading-skeleton__line::after, .so-loading-skeleton__block::after { position: absolute; inset: 0 auto 0 -45%; width: 42%; background: linear-gradient(105deg, transparent 0%, color-mix(in srgb, var(--so-white) 18%, transparent) 35%, color-mix(in srgb, var(--so-white) 78%, transparent) 50%, color-mix(in srgb, var(--so-white) 18%, transparent) 65%, transparent 100%); content: ""; animation: so-loading-light-sweep 1.35s ease-in-out infinite; }
.so-loading-skeleton__line { height: .85rem; width: 68%; }
.so-loading-skeleton__line--short { width: 35%; }
.so-loading-skeleton__line--title { height: 1.65rem; width: 42%; }
.so-loading-skeleton__block { min-height: 4.25rem; width: 100%; }
.so-loading-skeleton__block--large { min-height: 10rem; }
@keyframes so-loading-light-sweep { 0% { transform: translateX(0); opacity: 0; } 15% { opacity: 1; } 70% { opacity: 1; } 100% { transform: translateX(345%); opacity: 0; } }
/* Rolagem global alinhada à identidade visual */
html {
    scrollbar-color: #2563eb #e8eef8;
    scrollbar-width: thin;
}

html[data-theme="dark"] {
    scrollbar-color: #60a5fa #0f172a;
}

* {
    scrollbar-width: thin;
    scrollbar-color: #2563eb #e8eef8;
}

*::-webkit-scrollbar {
    height: 10px;
    width: 10px;
}

*::-webkit-scrollbar-track {
    background: #e8eef8;
    border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #3b82f6, #1d4ed8);
    border: 2px solid #e8eef8;
    border-radius: 999px;
}

*::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #60a5fa, #2563eb);
}

html[data-theme="dark"] * {
    scrollbar-color: #60a5fa #0f172a;
}

html[data-theme="dark"] *::-webkit-scrollbar-track {
    background: #0f172a;
}

html[data-theme="dark"] *::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #60a5fa, #2563eb);
    border-color: #0f172a;
}

html[data-theme="dark"] *::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #93c5fd, #3b82f6);
}

@keyframes so-liquid-button-press {
    0% { opacity: .8; transform: translate(-50%, -50%) scale(.15); }
    45% { opacity: .42; transform: translate(-50%, -50%) scale(3.2); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(5.2); }
}

@media (prefers-reduced-motion: reduce) {
    .btn-primary::after { animation: none !important; }
}

/* Base responsiva: nenhum componente deve provocar rolagem horizontal da página. */
html, body, #app, .page, main, article, .content {
    max-width: 100%;
    min-width: 0;
}

img, svg, video, canvas { max-width: 100%; }

@media (max-width: 800px) {
    html, body { overflow-x: hidden; }
    .content { padding: 1rem .75rem 1.5rem !important; }
    main { padding-bottom: env(safe-area-inset-bottom); }
    .so-card { border-radius: .7rem; }
    .so-page-title { font-size: clamp(1.35rem, 7vw, 1.8rem); }
    .so-page-subtitle { font-size: .92rem; line-height: 1.4; }
    .btn { max-width: 100%; }

    /* Grids comuns viram uma coluna; os componentes que precisam de largura
       própria (tabelas e agenda) usam seus wrappers com rolagem interna. */
    .home-columns, .reports-grid, .report-grid, .dashboard-grid,
    .cash-layout, .receivable-layout, .payables-layout,
    .patient-details-grid, .patient-details-grid--compact,
    .patient-orcamentos-summary, .patient-files-grid {
        grid-template-columns: 1fr !important;
    }

    .agenda-toolbar { grid-template-columns: 1fr !important; }
    .agenda-toolbar__search, .agenda-toolbar__button { grid-column: auto !important; }
    .agenda-header, .agenda-header__create-actions, .agenda-header__actions { width: 100%; }
    .agenda-header__create-actions, .agenda-header__actions { flex-wrap: wrap; }
    .agenda-header__create-actions .btn, .agenda-header__actions .btn { flex: 1 1 10rem; }

    .patient-tabs { max-width: 100%; overflow-x: auto; }
    .patient-tab { flex: 0 0 auto; }
    .patient-details-hero__main { min-width: 0; }
    .patient-details-hero__main h1, .patient-details-hero__main p { overflow-wrap: anywhere; }

    .receivable-table-wrap, .payables-table-wrap, .cash-table-wrap,
    .patient-orcamentos-table-wrap, .home-history__table-wrap,
    .agenda-timeline, .agenda-grid { max-width: 100%; overflow-x: auto; }
    .receivable-table-wrap, .payables-table-wrap, .cash-table-wrap,
    .patient-orcamentos-table-wrap, .home-history__table-wrap,
    .table-responsive {
        display: block;
        width: 100%;
        min-width: 0;
        overflow-x: scroll;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
        touch-action: pan-x;
    }

    .receivable-detail, .payables-table-card, .cash-movement-card,
    .patient-details-card, .home-history {
        min-width: 0;
    }

    .receivable-table, .payables-table, .cash-table,
    .patient-orcamentos-table, .home-history__table { min-width: 680px; }

    .agenda-timeline { height: min(70dvh, 38rem); }
    .agenda-grid { min-width: max-content; }
    .agenda-modal-backdrop, .payables-modal-backdrop { align-items: start; padding: .5rem; }
    .agenda-modal, .payables-modal, .patient-modal { max-height: calc(100dvh - 1rem); width: 100%; }
    .agenda-modal__header, .agenda-modal__footer, .patient-modal__footer { padding: 1rem; }
    .agenda-modal__footer { grid-template-columns: 1fr; }

    .form-actions, .patient-form__actions { flex-wrap: wrap; }
    .form-actions .btn, .patient-form__actions .btn { flex: 1 1 12rem; }
    .table-responsive { max-width: 100%; overflow-x: auto; }
}

@media (max-width: 480px) {
    .content { padding-inline: .55rem !important; }
    .so-card { padding-left: .85rem; padding-right: .85rem; }
    .agenda-day { padding: .85rem; }
    .agenda-item { grid-template-columns: 3.5rem .2rem minmax(0, 1fr); gap: .5rem; padding: .65rem; }
    .agenda-item h3 { white-space: normal; overflow-wrap: anywhere; }
    .patient-details-hero__actions { margin-left: 0 !important; }
    .patient-details-hero__actions .btn, .agenda-header__create-actions .btn { width: 100%; }
    .modal-footer, .payables-modal__footer { align-items: stretch; flex-direction: column; }
    .modal-footer .btn, .payables-modal__footer .btn { width: 100%; }
}
