﻿/* ================================================================
   Unimed Santos – Censo de Internados
   Design System v2 – 2026
   =============================================================== */

:root {
    --brand-900: #0a2818;
    --brand-800: #0f3d20;
    --brand-700: #145228;
    --brand-600: #1a6633;
    --brand-500: #22803f;
    --brand-400: #3aa358;
    --brand-300: #6dc589;
    --brand-100: #dff2e6;
    --brand-50:  #f0faf3;

    --hscs:  #1b5e20;
    --hcss:  #558b2f;
    --hsl:   #37474f;
    --enf:   #2e7d32;
    --uti:   #b71c1c;

    --gray-900: #111827;
    --gray-700: #374151;
    --gray-500: #6b7280;
    --gray-300: #d1d5db;
    --gray-100: #f3f4f6;
    --gray-50:  #f9fafb;

    --surface:  #ffffff;
    --bg:       #edf2ee;
    --border:   #dde7df;

    --shadow-xs: 0 1px 2px rgba(0,0,0,.07);
    --shadow-sm: 0 1px 4px rgba(0,0,0,.09), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 16px rgba(0,0,0,.10), 0 2px 4px rgba(0,0,0,.06);

    --radius-lg: 10px;
    --radius:     7px;
    --radius-sm:  5px;

    --font: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--gray-900);
    font-size: 13px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Navbar */
.navbar {
    background: var(--brand-900);
    display: flex;
    align-items: center;
    height: 52px;
    padding: 0 20px;
    gap: 2px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.navbar .brand {
    color: #fff;
    font-weight: 800;
    font-size: 15px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: auto;
}
.navbar .brand svg { width: 30px; height: 30px; border-radius: 7px; overflow: hidden; flex-shrink: 0; }
.nav-btn {
    color: rgba(255,255,255,.7);
    text-decoration: none;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    transition: background .15s, color .15s;
    white-space: nowrap;
}
.nav-btn:hover  { background: rgba(255,255,255,.1); color: #fff; }
.nav-btn.active { background: rgba(255,255,255,.12); color: #fff; font-weight: 600; }
.nav-btn.btn-new { background: var(--brand-500); color: #fff; font-weight: 700; margin-left: 6px; }
.nav-btn.btn-new:hover { background: var(--brand-600); }

/* Wrapper */
.dashboard-wrapper { max-width: 1440px; margin: 14px auto; padding: 0 14px 24px; }

/* Header */
.dash-header {
    background: linear-gradient(120deg, var(--brand-900) 0%, var(--brand-800) 55%, var(--brand-700) 100%);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    display: grid;
    grid-template-columns: 180px 1fr 200px;
    align-items: center;
    padding: 14px 22px;
    gap: 16px;
    position: relative;
    overflow: hidden;
}
.dash-header::before {
    content: '';
    position: absolute;
    width: 280px; height: 280px;
    border-radius: 50%;
    border: 40px solid rgba(255,255,255,.04);
    right: -80px; top: -100px;
    pointer-events: none;
}
.logo-box { display: flex; flex-direction: column; line-height: 1; }
.logo-unimed { font-size: 23px; font-weight: 900; color: #fff; letter-spacing: -.5px; }
.logo-unimed span { color: var(--brand-300); }
.logo-sub { font-size: 10px; color: rgba(255,255,255,.45); text-transform: uppercase; letter-spacing: 2.5px; font-weight: 600; margin-top: 3px; }
.title-box { text-align: center; }
.title-box h1 { font-size: 17px; font-weight: 800; color: #fff; letter-spacing: .3px; text-transform: uppercase; line-height: 1.3; }
.title-box h2 { font-size: 12px; color: var(--brand-300); margin-top: 5px; font-weight: 600; letter-spacing: .8px; }
.audit-box { text-align: right; font-size: 11px; color: rgba(255,255,255,.5); line-height: 1.7; }
.audit-box strong { color: rgba(255,255,255,.9); font-size: 12px; display: block; }
.dash-subtitle { background: var(--brand-700); color: rgba(255,255,255,.65); font-size: 11px; padding: 6px 22px; text-align: center; letter-spacing: .2px; border-bottom: 1px solid rgba(255,255,255,.07); }

/* Filter Bar */
.filter-bar { background: var(--surface); padding: 8px 16px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.filter-bar label { font-size: 11px; font-weight: 700; color: var(--gray-500); text-transform: uppercase; letter-spacing: .4px; }
.filter-bar strong { font-size: 13px; color: var(--gray-900); font-weight: 700; }
.filter-bar select { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px 8px; font-size: 12px; color: var(--gray-900); background: var(--gray-50); outline: none; cursor: pointer; }
.filter-bar select:focus { border-color: var(--brand-500); }
.btn-print { margin-left: auto; background: transparent; color: var(--gray-700); border: 1px solid var(--border); padding: 5px 12px; border-radius: var(--radius-sm); cursor: pointer; font-size: 12px; font-weight: 600; transition: all .15s; display: inline-flex; align-items: center; gap: 5px; }
.btn-print:hover { background: var(--brand-50); border-color: var(--brand-400); color: var(--brand-700); }

/* Main Body */
.main-body { background: var(--bg); border-radius: 0 0 var(--radius-lg) var(--radius-lg); padding: 12px; display: flex; flex-direction: column; gap: 10px; }

/* Card */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); border: 1px solid var(--border); overflow: hidden; }
.card-header { background: var(--brand-800); color: rgba(255,255,255,.9); font-size: 11px; font-weight: 700; padding: 7px 12px; text-transform: uppercase; letter-spacing: .7px; }
.card-body { padding: 12px; }

/* KPI Grid */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.kpi-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    min-width: 0;
    transition: box-shadow .2s, transform .2s;
    cursor: default;
    position: relative;
    overflow: hidden;
}
.kpi-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--brand-500); }
.kpi-card.enf::before  { background: #2e7d32; }
.kpi-card.uti::before  { background: var(--uti); }
.kpi-card.hosp::before { background: #37474f; }
.kpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.kpi-icon { width: 54px; height: 54px; border-radius: 12px; background: var(--brand-800); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 26px; }
.kpi-card.enf .kpi-icon  { background: #2e7d32; }
.kpi-card.uti .kpi-icon  { background: var(--uti); }
.kpi-card.hosp .kpi-icon { background: #37474f; }
.kpi-text { min-width: 0; }
.kpi-label { font-size: 10px; font-weight: 700; color: var(--gray-500); text-transform: uppercase; letter-spacing: .7px; margin-bottom: 4px; }
.kpi-value { font-size: 44px; font-weight: 900; color: var(--brand-800); line-height: 1; letter-spacing: -1.5px; }
.kpi-card.enf .kpi-value  { color: #2e7d32; }
.kpi-card.uti .kpi-value  { color: var(--uti); }
.kpi-card.hosp .kpi-value { color: #37474f; }

/* Layout Principal */
.dashboard-grid { display: grid; grid-template-columns: 1fr 340px; gap: 10px; align-items: start; }
.dashboard-grid > * { min-width: 0; }
.dash-left { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.row-charts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
/* Posição Assistencial | Observações | Detalhe HSCS-UTI */
.row-info { display: grid; grid-template-columns: 2fr 1.4fr 1fr; gap: 10px; align-items: stretch; }
.row-info > * { min-width: 0; }
/* lista dentro do card Observações */
.obs-list { padding-left: 16px; font-size: 11px; line-height: 1.75; color: var(--gray-700); }
.obs-list li { margin-bottom: 3px; }

.row-bottom { display: grid; grid-template-columns: 310px 1fr; gap: 10px; align-items: start; }
.row-bottom > * { min-width: 0; }
.row-bottom-left { display: flex; flex-direction: column; gap: 10px; min-width: 0; }

/* Charts */
.chart-wrap    { position: relative; height: 195px; }
.chart-wrap-sm { position: relative; height: 150px; }

/* Tabela Assistencial */
.tbl-assistencial { width: 100%; border-collapse: collapse; font-size: 12px; }
.tbl-assistencial thead tr { background: var(--brand-800); color: #fff; }
.tbl-assistencial th { padding: 7px 10px; text-align: center; font-size: 11px; font-weight: 700; letter-spacing: .3px; }
.tbl-assistencial th:first-child { text-align: left; }
.tbl-assistencial td { padding: 7px 10px; border-bottom: 1px solid var(--brand-50); text-align: right; }
.tbl-assistencial td:first-child { text-align: left; font-weight: 600; }
.tbl-assistencial tbody tr:nth-child(even) { background: var(--brand-50); }
.tbl-assistencial tbody tr:hover { background: var(--brand-100); }
.tbl-assistencial tr.total-row { background: var(--brand-100); }
.tbl-assistencial tr.total-row td { font-weight: 800; color: var(--brand-800); border-bottom: none; }
.hscs-badge { color: var(--hscs) !important; }
.hcss-badge { color: var(--hcss) !important; }
.hsl-badge  { color: var(--hsl)  !important; }

/* Observacoes */
.obs-box { background: var(--brand-50); border-left: 3px solid var(--brand-400); padding: 10px 12px; font-size: 11px; line-height: 1.7; color: var(--gray-700); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.obs-box .obs-title { font-weight: 700; color: var(--brand-800); margin-bottom: 5px; font-size: 11px; }
.obs-box ul { padding-left: 14px; }
.obs-box li { margin-bottom: 2px; }

/* Detalhe UTI */
.detail-uti-box { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; font-size: 12px; }
.detail-uti-box .dh { background: var(--brand-800); color: rgba(255,255,255,.9); padding: 6px 10px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.detail-uti-row { display: flex; justify-content: space-between; align-items: center; padding: 5px 10px; border-bottom: 1px solid var(--brand-50); transition: background .1s; }
.detail-uti-row:hover { background: var(--brand-50); }
.detail-uti-row:last-of-type { border-bottom: none; }
.detail-uti-row strong { font-weight: 700; color: var(--brand-800); min-width: 22px; text-align: right; }
.detail-uti-total { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; background: var(--brand-100); font-weight: 800; color: var(--brand-800); font-size: 12px; border-top: 1px solid var(--border); }

/* Comparativo */
.tbl-comparativo { width: 100%; border-collapse: collapse; font-size: 12px; }
.tbl-comparativo thead tr { background: var(--brand-800); color: #fff; }
.tbl-comparativo th { padding: 6px 8px; text-align: center; font-size: 11px; font-weight: 700; }
.tbl-comparativo td { padding: 5px 8px; text-align: center; border-bottom: 1px solid var(--brand-50); }
.tbl-comparativo td:first-child { font-weight: 600; text-align: left; font-size: 11px; }
.tbl-comparativo tbody tr:nth-child(even) { background: var(--brand-50); }
.tbl-comparativo tbody tr:hover { background: var(--brand-100); }
.tbl-comparativo tr.latest { background: var(--brand-100) !important; }
.tbl-comparativo tr.latest td { font-weight: 800; color: var(--brand-800); }
.tbl-comparativo .note { font-size: 10px; color: var(--gray-500); padding: 5px 8px; border-top: 1px solid var(--border); line-height: 1.5; }

/* HSL Panel */
/* 4 blocos do HSL lado a lado (Unimed 001 | Intercâmbio | Consolidado | Chart UTI) */
.hsl-inner { display: grid; grid-template-columns: 1fr 1fr 1fr 1.4fr; gap: 10px; }
.hsl-inner > * { min-width: 0; }
.hsl-uti-chart { display: flex; flex-direction: column; justify-content: center; }
.hsl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.hsl-sub-box { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; font-size: 11px; }
.hsl-sub-box .sh { background: var(--brand-600); color: #fff; padding: 5px 10px; font-weight: 700; font-size: 10px; text-transform: uppercase; letter-spacing: .6px; }
.hsl-sub-box.intercambio .sh { background: #455a64; }
.hsl-kpi-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 10px; border-bottom: 1px solid var(--brand-50); }
.hsl-kpi-row:last-child { border: none; }
.hsl-kpi-row .val { font-weight: 700; color: var(--brand-800); min-width: 20px; text-align: right; }
.hsl-kpi-row.subtotal { background: var(--brand-100); font-weight: 800; }
.hsl-kpi-row.subtotal .val { color: var(--brand-800); }
.hsl-consolidado { border: 1px solid var(--brand-400); border-radius: var(--radius-sm); overflow: hidden; font-size: 12px; }
.hsl-consolidado .sh { background: var(--brand-800); color: #fff; padding: 6px 10px; font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.hsl-total-row { display: flex; justify-content: space-between; align-items: center; padding: 5px 10px; border-bottom: 1px solid var(--brand-50); font-size: 12px; }
.hsl-total-row:last-child { border: none; }
.hsl-total-row .val { font-weight: 700; color: var(--brand-800); }
.hsl-total-row.highlight { background: var(--brand-100); font-weight: 800; color: var(--brand-800); font-size: 13px; border-top: 1px solid var(--border); }

/* Footer */
.dash-footer { background: var(--brand-900); color: rgba(255,255,255,.45); font-size: 11px; padding: 9px 22px; display: flex; justify-content: space-between; align-items: center; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.dash-footer strong { color: rgba(255,255,255,.85); }

/* CRUD Pages */
.page-wrapper { max-width: 900px; margin: 20px auto; padding: 0 14px; }
.page-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); border: 1px solid var(--border); overflow: hidden; }
.page-card-header { background: var(--brand-800); color: #fff; padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; }
.page-card-header h1 { font-size: 17px; font-weight: 700; }
.page-card-body { padding: 20px; }
.form-section { margin-bottom: 22px; }
.form-section-title { font-size: 11px; font-weight: 800; text-transform: uppercase; color: var(--brand-600); border-bottom: 2px solid var(--brand-100); padding-bottom: 5px; margin-bottom: 12px; letter-spacing: .5px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.form-group label { display: block; font-size: 11px; font-weight: 700; color: var(--gray-500); margin-bottom: 4px; }
.form-group input[type=number], .form-group input[type=date] { width: 100%; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; outline: none; color: var(--gray-900); background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.form-group input:focus { border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(34,128,63,.12); }
.form-actions { display: flex; gap: 8px; margin-top: 6px; align-items: center; }
.btn { padding: 8px 18px; border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer; font-size: 13px; font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: 5px; transition: all .15s; line-height: 1; }
.btn:hover { opacity: .88; }
.btn-primary   { background: var(--brand-600); color: #fff; }
.btn-secondary { background: var(--gray-700);  color: #fff; }
.btn-danger    { background: #c62828;           color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 11px; }
.alert { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 13px; border-left: 3px solid; }
.alert-success { background: var(--brand-50);  border-color: var(--brand-400); color: var(--brand-800); }
.alert-danger  { background: #fff3f3;           border-color: #c62828;          color: #7f1010; }
.tbl-crud { width: 100%; border-collapse: collapse; font-size: 12px; }
.tbl-crud thead tr { background: var(--brand-800); color: #fff; }
.tbl-crud th { padding: 8px 10px; text-align: center; font-weight: 700; font-size: 11px; }
.tbl-crud th:first-child { text-align: left; }
.tbl-crud td { padding: 7px 10px; text-align: center; border-bottom: 1px solid var(--brand-50); }
.tbl-crud td:first-child { text-align: left; font-weight: 600; }
.tbl-crud tbody tr:hover { background: var(--brand-50); }
.badge-total { background: var(--brand-100); color: var(--brand-800); padding: 3px 10px; border-radius: 12px; font-weight: 800; font-size: 12px; }
.no-data-box { text-align: center; padding: 60px 20px; color: var(--gray-500); }
.no-data-box h2 { font-size: 20px; margin-bottom: 10px; color: var(--brand-800); }
.no-data-box p { margin-bottom: 16px; }

@media print {
    .navbar, .filter-bar, .btn-print { display: none !important; }
    body { background: #fff; font-size: 11px; }
    .dashboard-wrapper { margin: 0; padding: 0; max-width: 100%; }
    .main-body { background: #fff; padding: 8px; gap: 8px; }
    .dash-footer { display: none; }
    .kpi-card { transform: none !important; }
}
