/* ============================================================
   CliSoft — Sistema de Gestão Hospitalar
   Tema: Clínico Profissional | Versão 2.0
   ============================================================ */

:root {
    /* ── Paleta Hospitalar ── */
    --primary:        #1558d6;
    --primary-dark:   #0f3fa8;
    --primary-mid:    #1a6fc4;
    --primary-light:  #eef4ff;

    --secondary:      #0d9488;
    --secondary-dark: #0f766e;
    --secondary-light:#ccfbf1;

    --accent:         #f59e0b;
    --accent-light:   #fef3c7;

    --danger:         #dc2626;
    --danger-dark:    #b91c1c;
    --danger-light:   #fef2f2;

    --warning:        #d97706;
    --warning-light:  #fffbeb;

    --success:        #059669;
    --success-dark:   #047857;
    --success-light:  #d1fae5;

    --info:           #0284c7;
    --info-light:     #e0f2fe;

    --purple:         #7c3aed;
    --purple-light:   #ede9fe;

    --pink:           #be185d;
    --pink-light:     #fce7f3;

    /* ── Neutros ── */
    --dark:           #0f172a;
    --dark2:          #1e293b;
    --dark3:          #334155;
    --muted:          #64748b;
    --body-bg:        #f1f5f9;
    --light:          #e2e8f0;
    --lighter:        #f8fafc;
    --white:          #ffffff;
    --border:         #e2e8f0;

    /* ── Geometria ── */
    --radius:    12px;
    --radius-sm: 8px;
    --radius-xs: 5px;
    --radius-lg: 18px;
    --radius-xl: 24px;

    /* ── Sombras ── */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-sm: 0 2px 6px rgba(15,23,42,0.06);
    --shadow:    0 4px 16px rgba(15,23,42,0.08);
    --shadow-md: 0 8px 28px rgba(15,23,42,0.12);
    --shadow-lg: 0 16px 48px rgba(15,23,42,0.16);

    /* ── Layout ── */
    --sidebar-w:  272px;
    --topbar-h:   68px;
    --font: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
}

/* ================================================================
   RESET & BASE
   ================================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body {
    font-family: var(--font);
    background: var(--body-bg);
    color: var(--dark);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
input, select, textarea, button { font-family: var(--font); }

/* ================================================================
   LAYOUT
   ================================================================ */
.layout { display: flex; min-height: 100vh; }

.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left .3s ease;
}

/* ================================================================
   SIDEBAR
   ================================================================ */
.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, #0a1628 0%, #0d1f38 50%, #091526 100%);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: fixed;
    left: 0; top: 0;
    z-index: 100;
    transition: transform .3s ease;
    overflow-y: auto;
    overflow-x: hidden;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.sidebar-header {
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.sidebar-header img { height: 46px; width: auto; object-fit: contain; }
.sidebar-title {
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: .02em;
    line-height: 1.2;
}
.sidebar-subtitle { color: rgba(255,255,255,0.38); font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase; }

.nav-section {
    padding: 22px 18px 6px;
    color: rgba(255,255,255,0.28);
    font-size: 9.5px;
    letter-spacing: .12em;
    text-transform: uppercase;
    font-weight: 700;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    margin: 2px 10px;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.58);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all .18s ease;
    position: relative;
    text-decoration: none;
}
.nav-item:hover {
    background: rgba(255,255,255,0.07);
    color: rgba(255,255,255,0.9);
    transform: translateX(2px);
}
.nav-item.active {
    background: linear-gradient(135deg, rgba(21,88,214,0.35), rgba(13,148,136,0.25));
    color: #fff;
    box-shadow: 0 2px 8px rgba(21,88,214,0.25);
}
.nav-item.active::before {
    content: '';
    position: absolute;
    left: -10px; top: 50%;
    transform: translateY(-50%);
    width: 4px; height: 20px;
    background: linear-gradient(180deg, var(--primary), var(--secondary));
    border-radius: 0 3px 3px 0;
}
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; opacity: .75; }
.nav-item.active .nav-icon, .nav-item:hover .nav-icon { opacity: 1; }
.nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 20px;
    font-weight: 700;
    animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.05)} }

.sidebar-footer {
    margin-top: auto;
    padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
}
.user-card { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); transition: background .18s; }
.user-card:hover { background: rgba(255,255,255,0.06); }
.user-avatar {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 12px; font-weight: 700; flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(21,88,214,0.4);
}
.user-name { color: #fff; font-size: 12.5px; font-weight: 600; }
.user-role { color: rgba(255,255,255,0.38); font-size: 10.5px; }

/* ================================================================
   TOPBAR
   ================================================================ */
.topbar {
    height: var(--topbar-h);
    background: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 28px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-xs);
}
.topbar-left { flex: 1; display: flex; align-items: center; gap: 14px; }
.page-title { font-size: 17px; font-weight: 700; color: var(--dark); }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.breadcrumb {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; color: var(--muted);
}
.breadcrumb-sep::before { content: '/'; color: var(--border); }

.topbar-clock {
    font-size: 12.5px;
    color: var(--muted);
    font-weight: 500;
    padding: 5px 12px;
    background: var(--lighter);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    white-space: nowrap;
}

/* ================================================================
   PAGE BODY
   ================================================================ */
.page-body { padding: 24px; flex: 1; }

/* ================================================================
   CARDS
   ================================================================ */
.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: box-shadow .2s;
}
.card:hover { box-shadow: var(--shadow); }

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-body { padding: 20px; }
.card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    background: var(--lighter);
    border-radius: 0 0 var(--radius) var(--radius);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ================================================================
   STAT CARDS — EXECUTIVOS
   ================================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    position: relative;
    overflow: hidden;
    transition: transform .2s, box-shadow .2s;
    cursor: default;
}
.stat-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--sc-color, var(--primary)), transparent);
    border-radius: var(--radius) var(--radius) 0 0;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.stat-card.sc-blue   { --sc-color: var(--primary); }
.stat-card.sc-green  { --sc-color: var(--success); }
.stat-card.sc-red    { --sc-color: var(--danger); }
.stat-card.sc-amber  { --sc-color: var(--accent); }
.stat-card.sc-teal   { --sc-color: var(--secondary); }
.stat-card.sc-purple { --sc-color: var(--purple); }
.stat-card.sc-pink   { --sc-color: var(--pink); }
.stat-card.sc-info   { --sc-color: var(--info); }

.stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.stat-icon svg { width: 24px; height: 24px; }
.si-blue   { background: var(--primary-light); color: var(--primary); }
.si-green  { background: var(--success-light); color: var(--success); }
.si-amber  { background: var(--accent-light);  color: var(--warning); }
.si-red    { background: var(--danger-light);  color: var(--danger); }
.si-purple { background: var(--purple-light);  color: var(--purple); }
.si-pink   { background: var(--pink-light);    color: var(--pink); }
.si-teal   { background: var(--secondary-light); color: var(--secondary-dark); }
.si-orange { background: #ffedd5; color: #9a3412; }
.si-info   { background: var(--info-light); color: var(--info); }

.stat-info { flex: 1; min-width: 0; }
.stat-label { font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.stat-value { font-size: 28px; font-weight: 800; color: var(--dark); line-height: 1; letter-spacing: -.02em; }
.stat-delta { font-size: 11.5px; margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.stat-delta.up   { color: var(--success); }
.stat-delta.down { color: var(--danger); }
.stat-delta.neutral { color: var(--muted); }

.progress {
    height: 5px;
    background: var(--light);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}
.progress-bar {
    height: 100%;
    border-radius: 3px;
    transition: width .6s ease;
}

/* ================================================================
   BUTTONS
   ================================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all .18s ease;
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: .01em;
}
.btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.btn:active { transform: scale(.98); }

.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(21,88,214,0.3);
}
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 14px rgba(21,88,214,0.4); }

.btn-secondary {
    background: var(--secondary);
    color: white;
    border-color: var(--secondary);
    box-shadow: 0 2px 8px rgba(13,148,136,0.3);
}
.btn-secondary:hover { background: var(--secondary-dark); }

.btn-success {
    background: var(--success);
    color: white;
    border-color: var(--success);
    box-shadow: 0 2px 8px rgba(5,150,105,0.3);
}
.btn-success:hover { background: var(--success-dark); }

.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-dark); }

.btn-warning { background: var(--accent); color: var(--dark); border-color: var(--accent); }
.btn-warning:hover { background: var(--warning); }

.btn-outline {
    background: var(--white);
    color: var(--dark3);
    border-color: var(--border);
    box-shadow: var(--shadow-xs);
}
.btn-outline:hover { background: var(--lighter); border-color: var(--muted); }

.btn-ghost { background: transparent; color: var(--muted); border-color: transparent; }
.btn-ghost:hover { background: var(--lighter); color: var(--dark); }

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-xs { padding: 3px 9px; font-size: 11px; border-radius: var(--radius-xs); }
.btn-lg { padding: 11px 26px; font-size: 14px; border-radius: var(--radius); }
.btn-icon { padding: 8px; }
.w-100 { width: 100%; justify-content: center; }

/* ================================================================
   BADGES
   ================================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .02em;
    white-space: nowrap;
}
.badge-blue   { background: var(--primary-light); color: var(--primary-dark); }
.badge-green  { background: var(--success-light); color: var(--success-dark); }
.badge-yellow { background: #fef9c3; color: #854d0e; }
.badge-red    { background: var(--danger-light); color: var(--danger-dark); }
.badge-orange { background: #ffedd5; color: #9a3412; }
.badge-gray   { background: var(--lighter); color: var(--dark3); border: 1px solid var(--border); }
.badge-purple { background: var(--purple-light); color: var(--purple); }
.badge-teal   { background: var(--secondary-light); color: var(--secondary-dark); }

/* ── Manchester ── */
.manchester {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .06em;
}
.manchester-vermelho { background: #ef4444; color: white; }
.manchester-laranja  { background: #f97316; color: white; }
.manchester-amarelo  { background: #eab308; color: #1a1a1a; }
.manchester-verde    { background: #22c55e; color: white; }
.manchester-azul     { background: #3b82f6; color: white; }

/* ================================================================
   TABLES
   ================================================================ */
.table-wrap { overflow-x: auto; border-radius: 0 0 var(--radius) var(--radius); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }

thead th {
    background: #f8fafc;
    padding: 11px 16px;
    text-align: left;
    font-weight: 700;
    font-size: 11px;
    color: var(--muted);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    letter-spacing: .04em;
    text-transform: uppercase;
}
thead th:first-child { border-radius: var(--radius-sm) 0 0 0; }
thead th:last-child  { border-radius: 0 var(--radius-sm) 0 0; }

tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--dark);
    vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: #f0f6ff; }

.table-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ================================================================
   FORMS
   ================================================================ */
.form-grid { display: grid; gap: 16px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.span-2 { grid-column: span 2; }
.form-group.span-3 { grid-column: span 3; }
.form-label { font-size: 12px; font-weight: 700; color: var(--dark3); letter-spacing: .01em; }
.form-hint  { font-size: 11px; color: var(--muted); margin-top: 2px; }

.form-control {
    width: 100%;
    padding: 9px 13px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: var(--white);
    color: var(--dark);
    outline: none;
    transition: border .18s, box-shadow .18s;
    font-family: var(--font);
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(21,88,214,0.1);
}
.form-control:hover:not(:focus) { border-color: #94a3b8; }
textarea.form-control { resize: vertical; min-height: 86px; line-height: 1.6; }
select.form-control { cursor: pointer; }
.form-control::placeholder { color: #94a3b8; }

.input-group { display: flex; gap: 0; }
.input-group .form-control { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* ================================================================
   ALERTS
   ================================================================ */
.alert {
    padding: 13px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border-width: 1px;
    border-style: solid;
    animation: fadeSlide .3s ease;
}
@keyframes fadeSlide { from{opacity:0;transform:translateY(-6px)} to{opacity:1;transform:translateY(0)} }

.alert-success { background: var(--success-light); color: #065f46; border-color: #6ee7b7; }
.alert-danger  { background: var(--danger-light);  color: #991b1b; border-color: #fca5a5; }
.alert-warning { background: var(--warning-light); color: #92400e; border-color: #fcd34d; }
.alert-info    { background: var(--info-light);    color: #075985; border-color: #7dd3fc; }

/* ================================================================
   TABS
   ================================================================ */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 22px;
    overflow-x: auto;
    scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all .18s;
    text-decoration: none;
    white-space: nowrap;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.tab:hover { color: var(--dark); background: var(--lighter); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); background: var(--primary-light); }

/* ================================================================
   MODAL
   ================================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10,22,40,0.55);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(2px);
    animation: fadeIn .2s ease;
}
@keyframes fadeIn { from{opacity:0} to{opacity:1} }

.modal {
    background: var(--white);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp .25s ease;
}
@keyframes slideUp { from{transform:translateY(20px);opacity:0} to{transform:translateY(0);opacity:1} }

.modal-header {
    padding: 22px 26px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    background: var(--white);
    z-index: 2;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.modal-title { font-size: 16px; font-weight: 700; color: var(--dark); }
.modal-body  { padding: 24px; }
.modal-footer {
    padding: 16px 26px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    background: var(--lighter);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.modal-close {
    width: 32px; height: 32px;
    border: 1px solid var(--border);
    background: var(--lighter);
    border-radius: 8px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; color: var(--muted);
    transition: all .15s;
}
.modal-close:hover { background: var(--danger-light); color: var(--danger); border-color: var(--danger); }

/* ================================================================
   LEITOS
   ================================================================ */
.leitos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.leito-card {
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 8px;
    text-align: center;
    cursor: pointer;
    transition: all .2s;
}
.leito-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.leito-disponivel  { border-color: #22c55e; background: #f0fdf4; }
.leito-ocupado     { border-color: #ef4444; background: #fef2f2; }
.leito-manutencao  { border-color: #f59e0b; background: #fffbeb; }
.leito-reservado   { border-color: #6366f1; background: #eef2ff; }
.leito-num  { font-size: 15px; font-weight: 800; }
.leito-tipo { font-size: 10px; color: var(--muted); margin-top: 2px; }

/* ================================================================
   SEARCH BOX
   ================================================================ */
.search-box { position: relative; }
.search-box input { padding-left: 38px !important; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }

/* ================================================================
   EMPTY STATE
   ================================================================ */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--muted);
}
.empty-state svg { width: 52px; height: 52px; margin: 0 auto 14px; opacity: .3; display: block; }
.empty-state h3 { font-size: 15px; font-weight: 700; color: var(--dark3); margin-bottom: 6px; }
.empty-state p  { font-size: 13px; }

/* ================================================================
   TIMELINE
   ================================================================ */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item { display: flex; gap: 12px; padding-bottom: 16px; position: relative; }
.timeline-item:not(:last-child)::before { content:''; position:absolute; left:10px; top:22px; bottom:0; width:1px; background:var(--border); }
.timeline-dot { width: 22px; height: 22px; border-radius: 50%; flex-shrink:0; display:flex; align-items:center; justify-content:center; font-size:10px; }
.timeline-content { flex:1; padding-top:2px; }

/* ================================================================
   UTILITY
   ================================================================ */
.divider { height: 1px; background: var(--border); margin: 16px 0; }

.text-muted   { color: var(--muted); }
.text-danger  { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }
.text-sm  { font-size: 12px; }
.text-xs  { font-size: 11px; }
.text-lg  { font-size: 15px; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4  { gap: 4px; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mb-4   { margin-bottom: 4px; }
.mb-8   { margin-bottom: 8px; }
.mb-16  { margin-bottom: 16px; }
.mb-24  { margin-bottom: 24px; }
.mt-8   { margin-top: 8px; }
.mt-16  { margin-top: 16px; }
.ml-auto { margin-left: auto; }
.p-0 { padding: 0; }
.text-right  { text-align: right; }
.text-center { text-align: center; }
.hidden { display: none !important; }
.truncate { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* ================================================================
   HAMBURGER / OVERLAY
   ================================================================ */
.hamburger { display: none; background: none; border: none; cursor: pointer; padding: 8px; border-radius: var(--radius-sm); }
.hamburger:hover { background: var(--lighter); }
.sidebar-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.5); z-index:99; backdrop-filter:blur(2px); }
.sidebar-overlay.show { display:block; }

/* ================================================================
   DATATABLES — CUSTOMIZAÇÃO HOSPITAL
   ================================================================ */
div.dataTables_wrapper {
    font-family: var(--font);
    font-size: 13px;
}
div.dataTables_wrapper div.dataTables_length label,
div.dataTables_wrapper div.dataTables_filter label {
    font-weight: 600;
    color: var(--muted);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}
div.dataTables_wrapper div.dataTables_length select,
div.dataTables_wrapper div.dataTables_filter input {
    padding: 6px 10px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-family: var(--font);
    color: var(--dark);
    background: var(--white);
    outline: none;
    transition: border .18s;
}
div.dataTables_wrapper div.dataTables_filter input:focus,
div.dataTables_wrapper div.dataTables_length select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(21,88,214,0.1);
}

div.dataTables_wrapper div.dataTables_info {
    font-size: 12px;
    color: var(--muted);
    font-weight: 500;
    padding-top: 10px;
}
div.dataTables_wrapper div.dataTables_paginate {
    padding-top: 10px;
}
div.dataTables_wrapper div.dataTables_paginate .paginate_button {
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius-sm) !important;
    border: 1px solid var(--border) !important;
    background: var(--white) !important;
    color: var(--dark) !important;
    margin: 0 2px;
    transition: all .15s;
}
div.dataTables_wrapper div.dataTables_paginate .paginate_button:hover {
    background: var(--primary-light) !important;
    border-color: var(--primary) !important;
    color: var(--primary) !important;
}
div.dataTables_wrapper div.dataTables_paginate .paginate_button.current,
div.dataTables_wrapper div.dataTables_paginate .paginate_button.current:hover {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: white !important;
}
div.dataTables_wrapper div.dataTables_paginate .paginate_button.disabled,
div.dataTables_wrapper div.dataTables_paginate .paginate_button.disabled:hover {
    color: var(--border) !important;
    border-color: var(--border) !important;
    cursor: default;
}

.dt-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 10px;
    background: var(--white);
    border-radius: var(--radius) var(--radius) 0 0;
}
.dt-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 8px;
    background: var(--lighter);
    border-radius: 0 0 var(--radius) var(--radius);
}

/* Buttons extension */
.dt-buttons { display: flex; gap: 6px; flex-wrap: wrap; }
.dt-button {
    padding: 5px 12px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    border-radius: var(--radius-sm) !important;
    border: 1.5px solid var(--border) !important;
    background: var(--white) !important;
    color: var(--dark3) !important;
    cursor: pointer !important;
    transition: all .15s !important;
    font-family: var(--font) !important;
}
.dt-button:hover {
    background: var(--primary-light) !important;
    border-color: var(--primary) !important;
    color: var(--primary) !important;
}

/* Orderable column indicators */
table.dataTable thead th.sorting::after,
table.dataTable thead th.sorting_asc::after,
table.dataTable thead th.sorting_desc::after {
    opacity: .5;
}
table.dataTable thead th.sorting_asc::after  { color: var(--primary); opacity: 1; }
table.dataTable thead th.sorting_desc::after { color: var(--primary); opacity: 1; }

/* Override DataTables own row hover so ours works */
table.dataTable tbody tr.selected td { background: var(--primary-light) !important; }

/* ================================================================
   PRINT
   ================================================================ */
@media print {
    .sidebar, .topbar, .btn, .table-actions, .tabs,
    .dt-header, .dt-footer, div.dataTables_wrapper div.dataTables_length,
    div.dataTables_wrapper div.dataTables_filter,
    div.dataTables_wrapper div.dataTables_paginate,
    div.dataTables_wrapper div.dataTables_info { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .card { border: 1px solid #ccc; box-shadow: none !important; }
    body { background: white; }
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 1280px) {
    :root { --sidebar-w: 240px; }
}
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .form-grid-3 { grid-template-columns: 1fr 1fr; }
    .form-grid-3 .span-3 { grid-column: span 2; }
}
@media (max-width: 768px) {
    :root { --sidebar-w: 0px; }
    .sidebar { transform: translateX(-272px); width: 272px; }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
    .form-group.span-2, .form-group.span-3 { grid-column: span 1; }
    .page-body { padding: 14px; }
    .hamburger { display: flex !important; }
    .topbar { padding: 0 16px; }
    .topbar-clock { display: none; }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .stat-value { font-size: 24px; }
}
