/* AI Pharma Guard — design system SaaS premium */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    /* Azul clínico suave + verde confiança (pouca saturação) */
    --primary: #2c5d8c;
    --primary-dark: #234a6e;
    --primary-light: #4a7eb0;
    --primary-soft: rgba(44, 93, 140, 0.11);
    --accent-health: #3d7d6e;
    --accent-health-soft: rgba(61, 125, 110, 0.14);
    --secondary: #1e293b;
    --bg: #f1f5f9;
    --surface-elevated: #ffffff;
    --card: #ffffff;
    --text: #1e293b;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --success: #2f7d59;
    --error: #c53030;

    /* Raio e elevação (escala única em todo o produto) */
    --radius-sm: 8px;
    --radius: 10px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.07), 0 2px 6px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 14px 40px rgba(15, 23, 42, 0.1), 0 4px 12px rgba(15, 23, 42, 0.05);
    --focus-ring: 0 0 0 3px var(--primary-soft);

    /* Escala de espaçamento (8 · 16 · 24 · 32) */
    --space-1: 8px;
    --space-2: 16px;
    --space-3: 24px;
    --space-4: 32px;
    /* Altura única para inputs e botões (alinhamento) */
    --control-height: 44px;
    --control-height-sm: 36px;
    --control-pad-x: 14px;

    --sidebar-width: 240px;
    --topbar-height: 56px;
    --card-bg: var(--card);
    --bg-page: var(--bg);
    --card-border: var(--border);
    --card-shadow: var(--shadow-md);
    /* Secundário mais escuro para legibilidade em fundos claros */
    --text-muted: #475569;
    /* Subtítulos: tom da cor secundária, legível mas claramente abaixo do título */
    --text-subtitle: #334155;
    --login-brand-from: #1a2d4a;
    --login-brand-to: #2c5d8c;
    --sidebar-bg: #1a2332;
    --sidebar-hover: rgba(255, 255, 255, 0.07);
    --sidebar-active-bg: rgba(44, 93, 140, 0.22);
    --sidebar-text: #e2e8f0;
    --risk-none: var(--success);
    --risk-moderate: #ca8a04;
    --risk-severe: var(--error);

    /* Botões — sombras e interação */
    --btn-primary-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), 0 4px 14px rgba(44, 93, 140, 0.28);
    --btn-primary-shadow-hover: 0 6px 22px rgba(44, 93, 140, 0.4), 0 2px 8px rgba(74, 126, 176, 0.32), 0 0 0 1px rgba(255, 255, 255, 0.14) inset;
    --btn-primary-shadow-active: 0 1px 3px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(44, 93, 140, 0.32), inset 0 2px 4px rgba(15, 23, 42, 0.12);
    --btn-secondary-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 2px 10px rgba(15, 23, 42, 0.06);
    --btn-secondary-shadow-hover: 0 4px 16px rgba(44, 93, 140, 0.1), 0 2px 8px rgba(15, 23, 42, 0.08);
    --btn-secondary-shadow-active: 0 1px 3px rgba(15, 23, 42, 0.1), inset 0 1px 2px rgba(15, 23, 42, 0.06);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

::selection {
    background: rgba(44, 93, 140, 0.18);
    color: var(--secondary);
}

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-page);
    background-image:
        radial-gradient(ellipse 120% 60% at 50% -15%, rgba(44, 93, 140, 0.08), transparent 55%),
        radial-gradient(ellipse 70% 50% at 100% 0%, rgba(61, 125, 110, 0.06), transparent 50%);
    background-attachment: fixed;
    color: var(--text);
    min-height: 100vh;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* ---- Topbar (fundo branco, sombra leve) ---- */
.app-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: #ffffff;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 0 var(--space-3) 0 var(--space-2);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-xs), 0 1px 0 rgba(61, 125, 110, 0.05);
    z-index: 100;
}

.app-topbar__brand {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
}

.app-topbar__brand-row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.app-topbar-mark {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.app-topbar-mark svg {
    display: block;
    width: 36px;
    height: 36px;
}

.app-topbar__titles {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
}

.app-topbar__brand h1,
.app-topbar__titles h1 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.25;
    color: var(--secondary);
}

.app-topbar__tagline {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.02em;
    line-height: 1.35;
}

.app-topbar__spacer {
    flex: 1;
    min-width: 8px;
}

.app-topbar__actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-topbar-notify {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.app-topbar-notify:hover {
    background: var(--bg-page);
    color: var(--primary);
    border-color: var(--border);
}

.app-topbar-notify svg {
    width: 22px;
    height: 22px;
}

.app-topbar-notify__dot {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.35);
}

.app-topbar-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 0.6875rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #fff;
    background: linear-gradient(145deg, var(--primary-light) 0%, var(--primary) 100%);
    border: 2px solid rgba(255, 255, 255, 0.85);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
    flex-shrink: 0;
    user-select: none;
}

.app-topbar-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 36px;
    padding: 0 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.app-topbar-logout:hover {
    border-color: rgba(44, 93, 140, 0.35);
    color: var(--primary);
    background: var(--primary-soft);
}

.app-topbar-logout svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.user-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text);
    background: var(--bg);
    border-radius: 999px;
    border: 1px solid var(--border);
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.user-pill:hover {
    background: #fff;
    border-color: #cbd5e1;
}

/* Botão menu (mobile) */
.sidebar-toggle {
    display: none;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    color: var(--secondary);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.sidebar-toggle:hover {
    background: #fff;
    border-color: var(--primary);
    color: var(--primary);
}

.sidebar-toggle:active {
    transform: scale(0.97);
}

/* Overlay só em telas estreitas (drawer) */
.app-overlay {
    display: none;
}

/* Conteúdo central */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    margin-bottom: 0;
}

.input-group label {
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: 0.02em;
    color: var(--text-muted);
}

.input-group input,
.input-group select,
.input-group textarea {
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-group input:not([type='checkbox']):not([type='radio']),
.input-group select {
    height: var(--control-height);
    padding: 0 var(--control-pad-x);
    box-sizing: border-box;
}

.input-group textarea {
    min-height: 96px;
    padding: var(--space-2);
    resize: vertical;
    box-sizing: border-box;
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

.input-group input::placeholder,
.input-group textarea::placeholder,
.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #94a3b8;
    opacity: 1;
}

.input-group input:disabled,
.input-group select:disabled,
.input-group textarea:disabled,
.form-group input:disabled,
.form-group select:disabled,
.form-group textarea:disabled {
    opacity: 0.72;
    cursor: not-allowed;
    background: #f8fafc;
    border-color: var(--border);
    color: var(--text-muted);
}

.form-stack {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    max-width: 560px;
}

.alert {
    padding: var(--space-2) var(--space-3);
    border-radius: 12px;
    font-size: 0.9375rem;
    font-weight: 500;
    border: 1px solid transparent;
}

.alert--info {
    background: var(--primary-soft);
    border-color: rgba(44, 93, 140, 0.2);
    color: var(--primary-dark);
}

.page-head {
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--border);
}

.page-head .page-subtitle:last-child {
    margin-bottom: 0;
}

/* ---- Menu lateral (240px, fundo escuro SaaS) ---- */
.app-sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--topbar-height));
    background: var(--sidebar-bg);
    z-index: 99;
    overflow-y: auto;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    transition: transform 0.28s ease, box-shadow 0.28s ease;
    -webkit-overflow-scrolling: touch;
}

.app-sidebar nav {
    padding: var(--space-3) 0;
}

.app-sidebar .nav-title {
    padding: var(--space-1) var(--space-3);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(226, 232, 240, 0.55);
}

.app-sidebar ul {
    list-style: none;
    margin: 0;
    padding: 0 12px;
}

.app-sidebar li {
    margin: var(--space-1) 0;
}

.app-sidebar a {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2);
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.9375rem;
    transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.app-sidebar a:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.app-sidebar a.active {
    background: rgba(44, 93, 140, 0.22);
    color: #fff;
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--primary);
}

.app-sidebar .nav-title--spaced {
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.app-sidebar .nav-link-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    color: inherit;
}

.app-sidebar .nav-link-icon svg {
    width: 20px;
    height: 20px;
}

.app-sidebar button.app-sidebar__logout {
    display: flex;
    width: 100%;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2);
    margin: 0;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: var(--sidebar-text);
    font: inherit;
    font-weight: 500;
    font-size: 0.9375rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.app-sidebar button.app-sidebar__logout:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.app-sidebar button.app-sidebar__logout .nav-link-icon svg {
    stroke: currentColor;
}

/* Ícones lineares (saúde / clínico) — máscara em currentColor */
.app-sidebar .nav-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    font-size: 0;
    line-height: 0;
    overflow: hidden;
}

.app-sidebar .nav-icon::before {
    content: '';
    display: block;
    width: 20px;
    height: 20px;
    background-color: currentColor;
    opacity: 0.88;
    -webkit-mask-image: var(--nav-ico);
    mask-image: var(--nav-ico);
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}

.app-sidebar a.active .nav-icon::before {
    opacity: 1;
}

.nav-icon--chart {
    --nav-ico: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Crect%20x%3D%224%22%20y%3D%2212%22%20width%3D%223.5%22%20height%3D%228%22%20rx%3D%221%22%20fill%3D%22black%22%2F%3E%3Crect%20x%3D%2210.25%22%20y%3D%228%22%20width%3D%223.5%22%20height%3D%2212%22%20rx%3D%221%22%20fill%3D%22black%22%2F%3E%3Crect%20x%3D%2216.5%22%20y%3D%224%22%20width%3D%223.5%22%20height%3D%2216%22%20rx%3D%221%22%20fill%3D%22black%22%2F%3E%3C%2Fsvg%3E");
}

.nav-icon--users {
    --nav-ico: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22black%22%20d%3D%22M12%2011a4%204%200%201%200-4-4%204%204%200%200%200%204%204Zm-7%209a7%207%200%200%201%2014%200v1H5v-1Z%22%2F%3E%3C%2Fsvg%3E");
}

.nav-icon--clipboard {
    --nav-ico: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22black%22%20d%3D%22M9%202h6a2%202%200%200%201%202%202v1h1a2%202%200%200%201%202%202v15a2%202%200%200%201-2%202H6a2%202%200%200%201-2-2V7a2%202%200%200%201%202-2h1V4a2%202%200%200%201%202-2Zm1%204h4V4h-4v2Zm-3%202v14h12V8H7Zm2%203h8v2H9v-2Zm0%204h8v2H9v-2Z%22%2F%3E%3C%2Fsvg%3E");
}

.nav-icon--pill {
    --nav-ico: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22black%22%20d%3D%22M14.5%204.5a4%204%200%200%201%200%205.7l-5%205a4%204%200%201%201-5.7-5.7l5-5a4%204%200%200%201%205.7%200Z%22%2F%3E%3C%2Fsvg%3E");
}

.nav-icon--alert {
    --nav-ico: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22black%22%20d%3D%22M12%202%202%2020h20L12%202Zm0%204.2L18.5%2018h-13L12%206.2ZM11%2010h2v5h-2v-5Zm0%206h2v2h-2v-2Z%22%2F%3E%3C%2Fsvg%3E");
}

.nav-icon--report {
    --nav-ico: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22black%22%20d%3D%22M6%202h9l5%205v15a2%202%200%200%201-2%202H6a2%202%200%200%201-2-2V4a2%202%200%200%201%202-2Zm0%202v16h12v-12h-5V4H6Zm3%208h6v2H9v-2Zm0%204h6v2H9v-2Z%22%2F%3E%3C%2Fsvg%3E");
}

.nav-icon--lock {
    --nav-ico: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22black%22%20d%3D%22M6%2010V8a6%206%200%201%201%2012%200v2h1a2%202%200%200%201%202%202v10a2%202%200%200%201-2%202H5a2%202%200%200%201-2-2V12a2%202%200%200%201%202-2h1Zm2%200h8V8a4%204%200%200%200-8%200v2Z%22%2F%3E%3C%2Fsvg%3E");
}

.nav-icon--hospital {
    --nav-ico: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22black%22%20d%3D%22M4%2022V2h10l6%206v14H4Zm2-2h12V9h-5V4H6v16Zm4-8h4v4h-4v-4Zm-2-2h8v2H8v-2Z%22%2F%3E%3C%2Fsvg%3E");
}

.user-pill__ico {
    display: inline-flex;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    font-size: 0;
    overflow: hidden;
    --nav-ico: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22black%22%20d%3D%22M12%2011a4%204%200%201%200-4-4%204%204%200%200%200%204%204Zm-7%209a7%207%200%200%201%2014%200v1H5v-1Z%22%2F%3E%3C%2Fsvg%3E");
}

.user-pill__ico::before {
    content: '';
    display: block;
    width: 100%;
    height: 100%;
    background-color: currentColor;
    opacity: 0.85;
    -webkit-mask-image: var(--nav-ico);
    mask-image: var(--nav-ico);
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
}

/* ---- Área principal ---- */
.app-main {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    padding: var(--space-4) var(--space-4) calc(var(--space-4) + var(--space-3));
    min-height: calc(100vh - var(--topbar-height));
    max-width: 1400px;
}

.app-main .page-title {
    margin: 0 0 var(--space-2);
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.15;
    color: var(--secondary);
    letter-spacing: -0.035em;
}

.app-main .page-subtitle {
    margin: 0;
    max-width: 52rem;
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.55;
    color: var(--text-subtitle);
}

/* Links no conteúdo (não botões): hierarquia clara e hover consistente */
.app-main a:not(.btn):not([class*='btn-']):not(.table-actions a) {
    color: var(--primary);
    font-weight: 500;
    text-decoration: none;
    text-underline-offset: 3px;
    transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.app-main a:not(.btn):not([class*='btn-']):not(.table-actions a):hover {
    color: var(--primary-dark);
    text-decoration: underline;
    text-decoration-color: rgba(44, 93, 140, 0.45);
}

.app-main a:not(.btn):not([class*='btn-']):not(.table-actions a):focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 2px;
}

/* h1/h2 em conteúdo (ex.: termos, textos longos) */
.app-main h1:not(.page-title) {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.035em;
    color: var(--secondary);
    margin: 0 0 var(--space-2);
}

.app-main h2 {
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: -0.025em;
    color: var(--secondary);
    margin: var(--space-4) 0 var(--space-2);
}

.app-main p.lead,
.app-main .text-lead {
    font-size: 1rem;
    line-height: 1.55;
    color: var(--text-subtitle);
    margin: 0 0 var(--space-3);
}

/* Páginas sem .page-head: cabeçalho alinhado ao bloco .page-head */
.app-main > h1.page-title:first-child {
    margin-bottom: var(--space-2);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--border);
}

.app-main > h1.page-title:first-child + p.page-subtitle,
.app-main > h1.page-title:first-child + .page-subtitle {
    margin: var(--space-2) 0 var(--space-4);
    max-width: 52rem;
}

/* ---- Cards (padrão SaaS) ---- */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    box-shadow: var(--card-shadow);
    padding: var(--space-3);
    margin-bottom: var(--space-4);
    border: 1px solid var(--border);
    transition: box-shadow 0.22s ease, border-color 0.22s ease, transform 0.2s ease;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    border-color: #dbe3ec;
}

.card h3 {
    margin: 0 0 var(--space-3);
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--secondary);
    letter-spacing: -0.025em;
    line-height: 1.3;
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--border);
}

.card h3 + p,
.card h3 + .form-grid {
    margin-top: 0;
}

/* Texto corrido em cards (termos, descrições): ritmo vertical claro */
.app-main .card > p {
    margin: 0 0 var(--space-2);
    line-height: 1.65;
}

.app-main .card > p:last-child {
    margin-bottom: 0;
}

.app-main .card > ul,
.app-main .card > ol {
    margin: 0 0 var(--space-3);
    padding-left: var(--space-4);
    line-height: 1.6;
}

.app-main .card > ul:last-child,
.app-main .card > ol:last-child {
    margin-bottom: 0;
}

/* ---- Grid de estatísticas (dashboard) ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    box-shadow: var(--card-shadow);
    padding: var(--space-3);
    border: 1px solid var(--card-border);
    border-top: 4px solid var(--primary);
    transition: box-shadow 0.22s ease, transform 0.18s ease;
}

.stat-card:hover {
    box-shadow: 0 8px 28px rgba(44, 93, 140, 0.14);
    transform: translateY(-2px);
}

.stat-card .stat-value {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.1;
    letter-spacing: -0.03em;
}

.stat-card .stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: var(--space-1);
    font-weight: 500;
    line-height: 1.45;
}

/* ---- Formulários ---- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-3);
    align-items: start;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.form-group label {
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: 0.02em;
    color: var(--text-muted);
}

.form-group input,
.form-group select,
.form-group textarea {
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    background: #fff;
    color: var(--text);
    box-sizing: border-box;
    width: 100%;
}

.form-group input:not([type='checkbox']):not([type='radio']),
.form-group select {
    height: var(--control-height);
    padding: 0 var(--control-pad-x);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

.form-group textarea {
    min-height: 96px;
    padding: var(--space-2);
    resize: vertical;
    line-height: 1.5;
}

/* Classe utilitária de campo (formulários) — mesma altura que .btn padrão */
.input,
input.input,
select.input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    height: var(--control-height);
    padding: 0 var(--control-pad-x);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    background: #fff;
    color: var(--text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea.input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    min-height: 96px;
    padding: var(--space-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    background: #fff;
    color: var(--text);
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input:focus,
input.input:focus,
select.input:focus,
textarea.input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

/* ---- Botões (altura alinhada a inputs: 44px) ---- */
a.btn {
    text-decoration: none;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    box-sizing: border-box;
    min-height: var(--control-height);
    height: var(--control-height);
    padding: 0 var(--space-3);
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    line-height: 1.2;
    -webkit-tap-highlight-color: transparent;
    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.22s ease,
        transform 0.18s ease,
        filter 0.2s ease;
}

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

.btn-secondary:focus-visible {
    outline-offset: 3px;
}

.btn:active:not(:disabled):not(.btn-export-pdf) {
    transition-duration: 0.12s;
}

.btn-primary {
    background: linear-gradient(180deg, var(--primary-light) 0%, var(--primary) 55%, var(--primary-dark) 100%);
    color: #fff;
    padding: 0 var(--space-3);
    min-height: var(--control-height);
    height: var(--control-height);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: var(--btn-primary-shadow);
}

.btn-primary:hover:not(:disabled):not(.is-loading) {
    background: linear-gradient(180deg, #6b9cc4 0%, var(--primary) 50%, var(--primary-dark) 100%);
    filter: brightness(1.04);
    transform: translateY(-2px);
    box-shadow: var(--btn-primary-shadow-hover);
}

.btn-primary:active:not(:disabled):not(.is-loading) {
    background: linear-gradient(180deg, var(--primary-dark) 0%, #1a3a56 100%);
    filter: brightness(0.97);
    transform: translateY(0) scale(0.98);
    box-shadow: var(--btn-primary-shadow-active);
}

.btn-primary:disabled,
.btn-primary.is-loading {
    opacity: 0.72;
    cursor: wait;
    transform: none;
    filter: none;
    pointer-events: none;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.btn-secondary {
    background: #fff;
    color: var(--primary);
    border: 2px solid var(--primary);
    box-shadow: var(--btn-secondary-shadow);
}

.btn-secondary:hover:not(:disabled) {
    background: linear-gradient(180deg, #ffffff 0%, var(--primary-soft) 100%);
    border-color: var(--primary-light);
    color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--btn-secondary-shadow-hover);
    filter: brightness(1.02);
}

.btn-secondary:active:not(:disabled) {
    background: var(--primary-soft);
    border-color: var(--primary-dark);
    color: var(--primary-dark);
    transform: translateY(0) scale(0.98);
    box-shadow: var(--btn-secondary-shadow-active);
    filter: brightness(0.99);
}

.btn-secondary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    filter: none;
    box-shadow: var(--btn-secondary-shadow);
}

.btn-sm {
    min-height: var(--control-height-sm);
    height: var(--control-height-sm);
    padding: 0 var(--space-2);
    font-size: 0.8125rem;
}

.btn-sm.btn-primary,
.btn-sm.btn-secondary {
    border-radius: 8px;
}

.btn-export-pdf {
    background: linear-gradient(180deg, #22c55e 0%, var(--risk-none) 55%, #15803d 100%);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    text-decoration: none;
    margin-left: var(--space-1);
    min-height: var(--control-height-sm);
    height: var(--control-height-sm);
    padding: 0 var(--space-2);
    font-size: 0.8125rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), 0 3px 10px rgba(22, 163, 74, 0.28);
}

.btn-export-pdf:hover:not(:disabled) {
    background: linear-gradient(180deg, #4ade80 0%, #22c55e 50%, var(--risk-none) 100%);
    color: #fff;
    filter: brightness(1.05);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(22, 163, 74, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.12) inset;
}

.btn-export-pdf:active:not(:disabled) {
    filter: brightness(0.96);
    transform: translateY(0) scale(0.98);
    box-shadow: 0 1px 4px rgba(22, 100, 50, 0.35), inset 0 2px 3px rgba(0, 0, 0, 0.12);
}

.btn-export-pdf:focus-visible {
    outline-color: #15803d;
}

/* ---- Tabelas organizadas ---- */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-sm);
    background: var(--surface-elevated);
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

table.data-table th,
table.data-table td {
    padding: var(--space-2);
    text-align: left;
    border-bottom: 1px solid var(--border);
}

table.data-table thead {
    position: relative;
}

table.data-table th {
    background: linear-gradient(180deg, #f1f5f9 0%, #e8eef4 100%);
    font-weight: 700;
    color: var(--secondary);
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid var(--border-strong);
    white-space: nowrap;
}

table.data-table tbody tr {
    transition: background 0.2s ease;
}

table.data-table tbody tr:hover {
    background: rgba(44, 93, 140, 0.06);
}

table.data-table tbody tr:nth-child(even) {
    background: #fafbfc;
}

table.data-table tbody tr:nth-child(even):hover {
    background: rgba(44, 93, 140, 0.08);
}

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

table.data-table td {
    color: var(--text);
    font-weight: 500;
    vertical-align: middle;
}

table.data-table td .btn,
table.data-table td .btn-sm {
    margin: 2px 4px 2px 0;
}

.table-actions {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-2);
}

/* ---- Tabela de pacientes (listagem clínica) ---- */
table.data-table--patients {
    border-collapse: separate;
    border-spacing: 0;
}

table.data-table--patients thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: var(--space-2) var(--space-3);
    background: linear-gradient(180deg, #e2e8f0 0%, #cbd5e1 100%);
    color: #0f172a;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-bottom: none;
    box-shadow: 0 1px 0 #94a3b8, 0 4px 12px rgba(15, 23, 42, 0.06);
}

table.data-table--patients th.data-table__col-actions {
    text-align: right;
}

table.data-table--patients tbody td {
    padding: var(--space-3) var(--space-3);
    line-height: 1.5;
    vertical-align: middle;
    border-bottom: 1px solid #e8ecf1;
}

table.data-table--patients tbody tr {
    transition: background-color 0.22s ease, box-shadow 0.22s ease;
}

table.data-table--patients tbody tr:nth-child(even) {
    background: #f8fafc;
}

table.data-table--patients tbody tr:hover {
    background: rgba(44, 93, 140, 0.06);
    box-shadow: inset 4px 0 0 var(--primary);
}

table.data-table--patients tbody tr:nth-child(even):hover {
    background: rgba(44, 93, 140, 0.075);
    box-shadow: inset 4px 0 0 var(--primary);
}

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

table.data-table--patients td.data-table__actions {
    text-align: right;
    width: 1%;
    white-space: nowrap;
}

table.data-table--patients .table-actions .btn-sm {
    margin: 0;
    box-shadow: var(--btn-secondary-shadow);
}

table.data-table--patients .table-actions .btn-secondary.btn-sm:hover:not(:disabled) {
    transform: translateY(-1px);
}

table.data-table--patients .table-actions .btn-secondary.btn-sm:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
}

table.data-table--patients .table-actions .btn-export-pdf {
    margin-left: 0;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), 0 2px 8px rgba(22, 163, 74, 0.22);
}

table.data-table--patients .table-actions .btn-export-pdf:hover:not(:disabled) {
    transform: translateY(-1px);
}

.table-wrap--patients {
    border-radius: 12px;
    border: 1px solid #dce4ee;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

/* ---- Cores de risco ---- */
.risk-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.risk-none {
    background: rgba(22, 163, 74, 0.12);
    color: var(--risk-none);
}

.risk-moderate {
    background: rgba(202, 138, 4, 0.15);
    color: #a16207;
}

.risk-severe {
    background: rgba(220, 38, 38, 0.12);
    color: var(--risk-severe);
}

/* ---- Resultados de interações ---- */
.interacoes-result {
    margin-top: var(--space-3);
    min-height: 140px;
    padding: var(--space-1) 0;
}

.interacoes-result.empty {
    background: var(--primary-soft);
    border: 2px dashed var(--primary-light);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.9375rem;
    line-height: 1.5;
    padding: var(--space-4);
}

.interacoes-result .interacao-item {
    background: var(--card-bg);
    border-radius: 12px;
    padding: var(--space-3);
    margin-bottom: var(--space-2);
    box-shadow: var(--card-shadow);
    border: 1px solid var(--card-border);
    border-left: 5px solid var(--border);
}

.interacoes-result .interacao-item.risco-baixo { border-left-color: var(--risk-none); }
.interacoes-result .interacao-item.risco-medio { border-left-color: var(--risk-moderate); }
.interacoes-result .interacao-item.risco-alto { border-left-color: var(--risk-severe); }

.interacao-item .med-names {
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: var(--space-1);
    font-size: 1.0625rem;
    line-height: 1.35;
}

.interacao-item .tipo,
.interacao-item .recomendacao {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: var(--space-1);
    line-height: 1.45;
}

/* ---- Relatórios ---- */
.reports-placeholder {
    text-align: center;
    padding: var(--space-4) var(--space-4);
    color: var(--text-muted);
    font-size: 0.9375rem;
    line-height: 1.55;
}

.reports-placeholder p {
    margin: var(--space-1) 0;
}

/* ---- Ações rápidas (dashboard) ---- */
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.quick-actions .btn {
    min-width: 180px;
}

/* ---- Utilitários ---- */
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mb-2 { margin-bottom: var(--space-2); }

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

.subtitle {
    color: var(--text-subtitle);
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.55;
}

.hidden { display: none !important; }

/* ---- Verificação de alergia ---- */
.alergia-check-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.alergia-check-row label {
    margin: 0;
    min-width: 120px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--text-muted);
}
.alergia-check-row .input-select,
.alergia-check-row .input-text {
    height: var(--control-height);
    padding: 0 var(--control-pad-x);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9375rem;
    box-sizing: border-box;
    color: var(--text);
    background: #fff;
}

.alerta-banner {
    padding: 12px 16px;
    border-radius: 10px;
    font-weight: 500;
    margin-top: 8px;
}

.alerta-banner--vermelho {
    background: #fef2f2;
    border: 1px solid var(--risk-severe);
    color: #b91c1c;
}

.alerta-banner--verde {
    background: #f0fdf4;
    border: 1px solid var(--risk-none);
    color: #15803d;
}

.alerta-banner--amarelo {
    background: #fefce8;
    border: 1px solid var(--risk-moderate);
    color: #a16207;
}

/* ---- Avisos e termos ---- */
.disclaimer-footer {
    font-size: 0.6875rem;
    color: rgba(226, 232, 240, 0.65);
    text-align: center;
    padding: var(--space-2) var(--space-1);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: auto;
    line-height: 1.5;
}

.disclaimer-footer a {
    color: rgba(226, 232, 240, 0.85);
    text-decoration: underline;
}

.aceite-termos-group {
    margin: var(--space-2) 0;
    padding: var(--space-2);
    background: #f8fafc;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.aceite-termos-group label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.5;
}

.aceite-termos-group input[type="checkbox"] {
    margin-top: 2px;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* ---- Verificação de interações (pacientes) ---- */
.medicamentos-verificar-row {
    display: flex;
    gap: var(--space-2);
    align-items: center;
    flex-wrap: wrap;
}

.medicamentos-verificar-row input {
    flex: 1;
    min-width: 200px;
    height: var(--control-height);
    padding: 0 var(--control-pad-x);
    box-sizing: border-box;
}

.banner-interacoes {
    margin-top: var(--space-2);
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.95rem;
}

.banner-interacoes.hidden {
    display: none;
}

.banner-interacoes--vermelho {
    background: #fef2f2;
    border: 1px solid var(--risk-severe);
    color: #b91c1c;
}

.banner-interacoes--amarelo {
    background: #fefce8;
    border: 1px solid var(--risk-moderate);
    color: #a16207;
}

.banner-interacoes--verde {
    background: #f0fdf4;
    border: 1px solid var(--risk-none);
    color: #15803d;
}

.banner-interacoes-item {
    padding: 8px 0;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.banner-interacoes-item:last-child {
    border-bottom: none;
}

.banner-interacoes-item--grave { color: #b91c1c; }
.banner-interacoes-item--moderada { color: #a16207; }
.banner-interacoes-item--baixo { color: #15803d; }

.banner-interacoes-rec {
    font-size: 0.9rem;
    opacity: 0.95;
    display: block;
    margin-top: 4px;
}

/* ---- Paginação ---- */
.paginacao-wrap {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--card-border);
}

.paginacao-info {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.paginacao-wrap .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Checkboxes de medicamentos (interações) */
#lista-medicamentos-check {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.med-check-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    cursor: pointer;
    padding: var(--space-2) var(--space-2);
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text);
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.med-check-pill:hover {
    background: var(--primary-soft);
    border-color: rgba(44, 93, 140, 0.35);
}

.med-check-pill input[type='checkbox'] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.legend-risco {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
    font-size: 0.875rem;
    line-height: 1.45;
    color: var(--text-muted);
}

@media (max-width: 900px) {
    .sidebar-toggle {
        display: inline-flex;
    }

    .app-sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }

    body.sidebar-open .app-sidebar {
        transform: translateX(0);
        box-shadow: 8px 0 40px rgba(15, 23, 42, 0.2);
    }

    .app-overlay {
        display: none;
        position: fixed;
        top: var(--topbar-height);
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(15, 23, 42, 0.45);
        z-index: 90;
        opacity: 0;
        transition: opacity 0.25s ease;
        pointer-events: none;
    }

    body.sidebar-open .app-overlay {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }

    .app-main {
        margin-left: 0 !important;
        padding: var(--space-3) var(--space-2) calc(var(--space-4) + var(--space-3));
    }

    .app-topbar__tagline {
        display: none;
    }

    .user-pill span:last-child {
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .card {
        padding: var(--space-3);
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .quick-actions {
        flex-direction: column;
    }

    .quick-actions .btn {
        min-width: unset;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .card:hover,
    .stat-card:hover,
    .btn-primary:hover:not(:disabled):not(.is-loading),
    .btn-secondary:hover:not(:disabled) {
        transform: none;
    }

    .login-spinner {
        animation: none;
    }

    .login-submit--v2:hover:not(:disabled):not(.is-loading) {
        transform: none;
    }
}

/* ---- Página de login (SaaS médico — 50/50, Linear/Vercel) ---- */
.login-page-body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg-page);
    color: var(--text);
}

.login-page-body--v2 {
    background: #ffffff;
}

.login-page-layout {
    display: grid;
    min-height: 100vh;
    min-height: 100dvh;
}

.login-page-layout--split {
    grid-template-columns: 1fr 1fr;
}

/* Coluna esquerda — gradiente institucional */
.login-brand-panel--spec {
    position: relative;
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: clamp(32px, 5vw, 48px);
    overflow: hidden;
    color: #f8fafc;
    background: linear-gradient(155deg, var(--login-brand-from) 0%, var(--login-brand-to) 72%, #234a6e 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.login-brand-panel__mesh {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 90% 60% at 15% 10%, rgba(255, 255, 255, 0.12), transparent 50%),
        radial-gradient(ellipse 70% 50% at 90% 80%, rgba(61, 125, 110, 0.22), transparent 55%);
    pointer-events: none;
}

.login-brand-panel__inner {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 22rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-brand-logo {
    margin-bottom: var(--space-3);
}

.login-brand-logo__svg {
    display: block;
    width: 56px;
    height: 56px;
    filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.25));
}

.login-brand-name {
    margin: 0 0 var(--space-2);
    font-size: clamp(1.5rem, 2.4vw, 1.875rem);
    font-weight: 800;
    letter-spacing: -0.035em;
    line-height: 1.15;
    color: #ffffff;
}

.login-brand-tagline {
    margin: 0 0 var(--space-4);
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.6;
    color: rgba(248, 250, 252, 0.88);
    text-wrap: balance;
}

.login-benefits {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.login-benefits__item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.45;
    color: rgba(248, 250, 252, 0.92);
}

.login-benefits__check {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin-top: 1px;
    border-radius: 999px;
    background: rgba(61, 125, 110, 0.28);
    color: #b8e0d4;
}

.login-brand-foot {
    margin: var(--space-4) 0 0;
    padding-top: var(--space-4);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.5;
    color: rgba(248, 250, 252, 0.55);
}

/* Coluna direita — branco puro */
.login-form-panel--white {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(24px, 4vw, 48px);
    background: #ffffff;
}

.login-page-shell {
    width: 100%;
    max-width: 400px;
}

.login-card--premium.login-card--v2 {
    padding: 0 !important;
    margin: 0;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

.login-card-header--v2 {
    margin-bottom: 28px;
}

.login-welcome {
    margin: 0 0 8px;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.032em;
    line-height: 1.2;
    color: #0f172a;
}

.login-welcome__emoji {
    font-weight: 500;
}

.login-subtitle {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #64748b;
}

.login-form--v2 {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.login-field-v2 {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.login-label {
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: #334155;
}

.login-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.login-link-forgot {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.15s ease;
}

.login-link-forgot:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.login-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 0 12px 0 14px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-sizing: border-box;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.login-input-wrap:focus-within {
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

.login-input-wrap__icon {
    flex-shrink: 0;
    display: flex;
    color: #94a3b8;
}

.login-input.login-input--inset {
    flex: 1;
    min-width: 0;
    height: 46px;
    padding: 0 4px;
    border: none;
    border-radius: 0;
    font-size: 0.9375rem;
    font-family: inherit;
    color: #0f172a;
    background: transparent;
    box-shadow: none;
}

.login-input--inset::placeholder {
    color: #94a3b8;
}

.login-input--inset:focus {
    outline: none;
    box-shadow: none;
}

.login-pass-toggle {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: 0 -4px 0 0;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.login-pass-toggle:hover {
    background: #f1f5f9;
    color: var(--primary);
}

.login-actions--v2 {
    margin-top: 4px;
}

.login-submit.login-submit--v2 {
    width: 100%;
    min-height: 48px;
    height: 48px;
    border-radius: 10px;
    font-size: 0.9375rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(180deg, var(--primary-light) 0%, var(--primary) 52%, var(--primary-dark) 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    color: #fff !important;
    box-shadow: var(--btn-primary-shadow);
    transition: box-shadow 0.2s ease, transform 0.18s ease, filter 0.2s ease;
}

.login-submit--v2:hover:not(:disabled):not(.is-loading) {
    filter: brightness(1.05);
    transform: translateY(-1px);
    box-shadow: var(--btn-primary-shadow-hover);
}

.login-submit--v2:active:not(:disabled):not(.is-loading) {
    transform: translateY(0) scale(0.99);
    box-shadow: var(--btn-primary-shadow-active);
}

.login-submit--v2.is-loading,
.login-submit--v2:disabled {
    opacity: 0.92;
    cursor: wait;
    transform: none;
}

.login-submit-idle,
.login-submit-loading {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.login-spinner {
    width: 20px;
    height: 20px;
    animation: login-spin 0.65s linear infinite;
}

@keyframes login-spin {
    to {
        transform: rotate(360deg);
    }
}

.login-card--v2 .login-alert {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.45;
}

.login-alert--err {
    background: #fef2f2;
    border: 1px solid rgba(220, 38, 38, 0.25);
    color: #b91c1c;
}

.login-alert--ok {
    background: #f0fdf4;
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #15803d;
}

.login-or-divider {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin: 28px 0 20px;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #94a3b8;
}

.login-or-divider::before,
.login-or-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.login-secondary-cta {
    text-align: center;
}

.login-register-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 var(--space-3);
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #f8fafc;
    width: 100%;
    box-sizing: border-box;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.login-register-link:hover {
    background: var(--primary-soft);
    border-color: rgba(44, 93, 140, 0.28);
    color: var(--primary-dark);
}

.login-card--v2 .login-disclaimer {
    margin: 28px 0 0;
    padding-top: 20px;
    border-top: 1px solid #f1f5f9;
    font-size: 0.6875rem;
    line-height: 1.55;
    color: #94a3b8;
    text-align: center;
}

.login-card--v2 .login-disclaimer a {
    color: #64748b;
    text-decoration: underline;
}

.login-card--v2 .login-disclaimer a:hover {
    color: #475569;
}

@media (max-width: 900px) {
    .login-page-layout--split {
        grid-template-columns: 1fr;
    }

    .login-brand-panel--spec {
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        min-height: auto;
        text-align: center;
    }

    .login-brand-panel__inner {
        margin: 0 auto;
        max-width: 26rem;
    }

    .login-brand-logo,
    .login-brand-name,
    .login-brand-tagline {
        text-align: center;
    }

    .login-brand-logo {
        display: flex;
        justify-content: center;
    }

    .login-benefits {
        text-align: left;
    }

    .login-benefits__item {
        justify-content: flex-start;
    }

    .login-form-panel--white {
        padding: var(--space-3) var(--space-2) var(--space-4);
    }
}

@media (max-width: 400px) {
    .login-welcome {
        font-size: 1.3125rem;
    }

    .login-label-row {
        flex-wrap: wrap;
    }

    .login-link-forgot {
        margin-left: auto;
    }
}

/* ---- Páginas públicas auth: cadastro, esqueci senha, nova senha (sem sidebar) ---- */
.cadastro-page-body,
.esqueci-page-body,
.nova-senha-page-body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--bg-page);
    background-image:
        radial-gradient(ellipse 120% 60% at 50% -15%, rgba(44, 93, 140, 0.08), transparent 55%),
        radial-gradient(ellipse 70% 50% at 100% 0%, rgba(61, 125, 110, 0.06), transparent 50%);
    background-attachment: fixed;
    color: var(--text);
}

.cadastro-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: clamp(24px, 5vw, 48px) 20px 40px;
    box-sizing: border-box;
}

.cadastro-page__header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    text-align: center;
}

.cadastro-page__brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cadastro-page__logo svg {
    display: block;
    width: 40px;
    height: 40px;
}

.cadastro-page__brand-name {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--secondary);
}

.cadastro-page__back {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    transition: color 0.15s ease;
}

.cadastro-page__back:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.cadastro-card {
    width: 100%;
    max-width: 480px;
    padding: 40px;
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    box-sizing: border-box;
}

.cadastro-card--narrow {
    max-width: 420px;
}

/* Ícone hero (esqueci / nova senha) */
.public-auth-hero-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    border-radius: 14px;
    background: rgba(44, 93, 140, 0.1);
    color: var(--primary);
}

.public-auth-hero-icon--mail svg {
    width: 56px;
    height: 56px;
}

.public-auth-hero-icon--lock svg {
    width: 40px;
    height: 40px;
}

.esqueci-footer-link {
    display: block;
    margin-top: 24px;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
}

.esqueci-footer-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.esqueci-success {
    text-align: center;
}

.esqueci-success__check {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: rgba(61, 125, 110, 0.14);
    color: var(--accent-health);
}

.esqueci-success__check svg {
    width: 28px;
    height: 28px;
}

.esqueci-success__title {
    margin: 0 0 10px;
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--secondary);
}

.esqueci-success__text {
    margin: 0 0 20px;
    font-size: 0.9375rem;
    line-height: 1.55;
    color: var(--text-muted);
}

.nova-invalid {
    text-align: center;
}

.nova-invalid__text {
    margin: 0 0 20px;
    font-size: 0.9375rem;
    line-height: 1.55;
    color: var(--text-muted);
}

.nova-invalid .cadastro-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cadastro-card__title {
    margin: 0 0 8px;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.032em;
    line-height: 1.2;
    color: #0f172a;
}

.cadastro-card__subtitle {
    margin: 0 0 28px;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-muted);
    line-height: 1.5;
}

.cadastro-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.cadastro-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cadastro-label {
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: #334155;
}

.cadastro-label--optional {
    font-weight: 500;
    color: var(--text-muted);
}

.cadastro-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 0 12px 0 14px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-sizing: border-box;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.cadastro-input-wrap:focus-within {
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

.cadastro-input-wrap__icon {
    flex-shrink: 0;
    display: flex;
    color: #94a3b8;
}

.cadastro-input.cadastro-input--inset {
    flex: 1;
    min-width: 0;
    height: 46px;
    padding: 0 4px;
    border: none;
    border-radius: 0;
    font-size: 0.9375rem;
    font-family: inherit;
    color: #0f172a;
    background: transparent;
    box-shadow: none;
}

.cadastro-input--inset::placeholder {
    color: #94a3b8;
}

.cadastro-input--inset:focus {
    outline: none;
}

.cadastro-pass-toggle {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: 0 -4px 0 0;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.cadastro-pass-toggle:hover {
    background: #f1f5f9;
    color: var(--primary);
}

.cadastro-pw-meter {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
}

.cadastro-pw-meter__bars {
    display: flex;
    gap: 6px;
    height: 4px;
}

.cadastro-pw-meter__bar {
    flex: 1;
    border-radius: 999px;
    background: #e2e8f0;
    transition: background 0.2s ease;
}

.cadastro-pw-meter__bar--on {
    background: #cbd5e1;
}

.cadastro-pw-meter[data-strength='1'] .cadastro-pw-meter__bar--on {
    background: #f87171;
}

.cadastro-pw-meter[data-strength='2'] .cadastro-pw-meter__bar--on {
    background: #fbbf24;
}

.cadastro-pw-meter[data-strength='3'] .cadastro-pw-meter__bar--on {
    background: #4a7eb0;
}

.cadastro-pw-meter[data-strength='4'] .cadastro-pw-meter__bar--on {
    background: var(--accent-health);
}

.cadastro-pw-meter__hint {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}

.cadastro-match-hint {
    margin: 4px 0 0;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--risk-severe);
}

.cadastro-terms {
    margin: 4px 0 0;
}

.cadastro-terms__label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-subtitle);
}

.cadastro-terms__label input[type='checkbox'] {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    accent-color: var(--primary);
}

.cadastro-terms__label a {
    color: var(--primary);
    font-weight: 600;
}

.cadastro-actions {
    margin-top: 4px;
}

.cadastro-submit {
    width: 100%;
    min-height: 48px;
    height: 48px;
    border-radius: 10px;
    font-size: 0.9375rem;
    font-weight: 600;
}

.cadastro-submit:disabled {
    opacity: 0.75;
    cursor: wait;
}

.cadastro-footer-line {
    margin: 24px 0 0;
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.cadastro-footer-line__link {
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
}

.cadastro-footer-line__link:hover {
    text-decoration: underline;
    color: var(--primary-dark);
}

.cadastro-msg {
    margin: 16px 0 0;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.45;
    text-align: center;
}

.cadastro-msg--ok {
    color: var(--risk-none);
}

.cadastro-msg--err {
    color: var(--risk-severe);
}

@media (max-width: 480px) {
    .cadastro-card {
        padding: 28px 22px;
    }
}
