*, *::before, *::after { box-sizing: border-box; }

    body { font-family: 'Geist', sans-serif; background-color: #051424; color: #d4e4fa; margin: 0; }

    

    /* ─── Global Inputs & Selects ─────────────────────────────── */

    input, select, textarea {

      background-color: #1c2b3c;

      color: #d4e4fa;

      border: 1px solid #334155;

      border-radius: 8px;

      font-size: 13px;

      font-family: 'Geist', sans-serif;

      transition: border-color 0.2s ease;

    }

    input:focus, select:focus, textarea:focus {

      border-color: #0566d9;

      outline: none;

    }

    input::placeholder { color: #64748b; }



    .material-symbols-outlined { font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24; user-select: none; }



    /* ─── Cards ─────────────────────────────── */

    .card { background-color: #0f172a; border: 1px solid #1e293b; transition: border-color 0.2s ease; }

    .card:hover { border-color: #334155; }



    /* ─── Scrollbar ─────────────────────────── */

    ::-webkit-scrollbar { width: 4px; height: 4px; }

    ::-webkit-scrollbar-track { background: #051424; }

    ::-webkit-scrollbar-thumb { background: #273647; border-radius: 3px; }

    ::-webkit-scrollbar-thumb:hover { background: #45464d; }



    /* ─── SPA Router ─────────────────────────  */

    .view { display: none; }

    .view.view-active { display: block; }



    /* ─── Sidebar ────────────────────────────  */

    #sidebar {

      position: fixed; left: 0; top: 0; height: 100%;

      width: 260px;

      background: #0d1c2d;

      border-right: 1px solid #1e293b;

      display: flex; flex-direction: column;

      z-index: 50;

      transform: translateX(-260px);

      transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);

    }

    #sidebar.open { transform: translateX(0); }



    /* Desktop: always open */

    @media (min-width: 1024px) {

      #sidebar { transform: translateX(0) !important; }

      #sidebar-overlay { display: none !important; }

    }



    /* Sidebar overlay (mobile) */

    #sidebar-overlay {

      display: none; position: fixed; inset: 0; z-index: 49;

      background: rgba(0,0,0,0.55); backdrop-filter: blur(2px);

    }

    #sidebar-overlay.show { display: block; }



    /* Nav link */

    .nav-link {

      display: flex; align-items: center; gap: 12px;

      padding: 10px 16px; border-radius: 4px;

      font-size: 14px; color: #c6c6cd;

      transition: background-color 0.18s, color 0.18s, border-color 0.18s;

      cursor: pointer; text-decoration: none;

      border-left: 3px solid transparent;

    }

    .nav-link:hover { background: #1c2b3c; color: #d4e4fa; }

    .nav-link.active { color: #bec6e0; background: rgba(15,23,42,0.7); border-left-color: #0566d9; padding-left: 13px; }



    /* Main area offset on desktop */

    @media (min-width: 1024px) {

      #main-wrapper { margin-left: 260px; }

    }



    /* ─── Topbar ─────────────────────────────  */

    #topbar {

      position: sticky; top: 0; z-index: 40;

      background: #051424;

      border-bottom: 1px solid #1e293b;

      height: 56px;

      display: flex; align-items: center; justify-content: space-between;

      padding: 0 16px;

      gap: 12px;

    }

    @media (min-width: 640px) { #topbar { padding: 0 24px; } }

    @media (min-width: 1024px) { #topbar { padding: 0 40px; height: 64px; } }



    /* Hide hamburger on desktop */

    #hamburger { display: flex; }

    @media (min-width: 1024px) { #hamburger { display: none; } }



    /* Search: hidden on small, visible md+ */

    #topbar-search { display: none; }

    @media (min-width: 768px) { #topbar-search { display: block; } }



    /* ─── Badge helpers ──────────────────────  */

    .badge-ok   { display:inline-flex; align-items:center; padding:1px 8px; border-radius:9999px; font-size:11px; font-weight:500; background:#064e3b; color:#34d399; }

    .badge-warn { display:inline-flex; align-items:center; padding:1px 8px; border-radius:9999px; font-size:11px; font-weight:500; background:#422006; color:#fbbf24; }

    .badge-err  { display:inline-flex; align-items:center; padding:1px 8px; border-radius:9999px; font-size:11px; font-weight:500; background:#450a0a; color:#f87171; }

    .badge-info { display:inline-flex; align-items:center; padding:1px 8px; border-radius:9999px; font-size:11px; font-weight:500; background:#0c2040; color:#adc6ff; }



    /* ─── Table rows ─────────────────────────  */

    .trow:hover { background: #0d1c2d; }

    .trow-hover:hover { background: #1c2b3c; }



    /* ─── Progress bar ───────────────────────  */

    .progress-bar { height:4px; border-radius:9999px; background:#273647; overflow:hidden; }

    .progress-fill { height:100%; border-radius:9999px; transition: width 1s ease; }



    /* ─── Mobile bottom nav ──────────────────  */

    #mobile-bottom-nav {
      display: flex;
      position: fixed; bottom: 0; left: 0; right: 0; z-index: 45;
      background: #0d1c2d;
      border-top: 1px solid #1e293b;
      height: 60px;
      overflow: hidden;
    }

    @media (min-width: 1024px) { #mobile-bottom-nav { display: none !important; } }

    .bottom-nav-item {
      flex: 1;
      min-width: 0;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 2px;
      font-size: 9px;
      color: #798098;
      cursor: pointer;
      transition: color 0.18s;
      text-decoration: none;
      padding: 4px 2px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .bottom-nav-item span:not(.material-symbols-outlined) {
      max-width: 100%;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      display: block;
    }

    .bottom-nav-item .material-symbols-outlined { font-size: 20px !important; }

    .bottom-nav-item.active { color: #0566d9; }

    .bottom-nav-item:hover { color: #d4e4fa; }



    /* ─── Main canvas padding ─────────────────  */

    #main-canvas {

      flex: 1; overflow-y: auto; overflow-x: hidden;

      background: #051424;

      padding: 16px;

      padding-bottom: 72px; /* space for mobile bottom nav */

    }

    @media (min-width: 640px)  { #main-canvas { padding: 24px; padding-bottom: 80px; } }

    @media (min-width: 1024px) { #main-canvas { padding: 40px; padding-bottom: 40px; } }



    /* ─── KPI grid ────────────────────────────  */

    .kpi-grid { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }

    @media (min-width: 640px)  { .kpi-grid { gap: 16px; } }

    @media (min-width: 1280px) { .kpi-grid { grid-template-columns: repeat(4, 1fr); gap: 24px; } }



    /* ─── Two-col grid (chart + panel) ────────  */

    .chart-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }

    @media (min-width: 1024px) { .chart-grid { grid-template-columns: 2fr 1fr; gap: 24px; } }



    /* ─── Three-col grid (custo) ──────────────  */

    .custo-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }

    @media (min-width: 1024px) { .custo-grid { grid-template-columns: 3fr 2fr; gap: 24px; } }



    /* ─── Bank cards grid ─────────────────────  */

    .bank-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }

    @media (min-width: 640px)  { .bank-grid { grid-template-columns: 1fr 1fr; } }

    @media (min-width: 1024px) { .bank-grid { grid-template-columns: repeat(3, 1fr); } }



    /* ─── Period toggle ───────────────────────  */

    .period-toggle { display:flex; gap:4px; padding:4px; background:#273647; border-radius:6px; border:1px solid #1e293b; }

    .period-btn { padding: 6px 14px; border-radius:4px; font-size:12px; font-weight:500; color:#798098; cursor:pointer; transition:all 0.18s; border:none; background:transparent; }

    .period-btn.active { background:#0f172a; color:#bec6e0; border:1px solid #45464d; }



    /* ─── Section spacing ─────────────────────  */

    .view > * + * { margin-top: 16px; }

    @media (min-width: 1024px) { .view > * + * { margin-top: 24px; } }



    /* ─── Page header row ─────────────────────  */

    .page-header { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 12px; }



    /* ─── Print / PDF ─────────────────────────  */

    @media print {

      #sidebar, #sidebar-overlay, #topbar, #mobile-bottom-nav { display: none !important; }

      #main-wrapper { margin-left: 0 !important; }

      #main-canvas { padding: 0 !important; overflow: visible !important; height: auto !important; }

      .no-print { display: none !important; }

      body { background: #051424 !important; -webkit-print-color-adjust: exact; color-adjust: exact; }

      .view { display: none !important; }

      .view.view-active { display: block !important; }

    }



    @media (min-width: 640px) { #rel-kpi-grid { grid-template-columns: repeat(2, 1fr); } }

  
    /* Mobile Tables */
    .table-responsive, .overflow-x-auto {
      width: 100%;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      border-radius: 8px;
    }
    
    /* Make tables fit screen better on mobile */
    @media (max-width: 768px) {
      .table-responsive table, .overflow-x-auto table {
         font-size: 12px; 
      }
      .table-responsive th, .table-responsive td, .overflow-x-auto th, .overflow-x-auto td {
         padding: 8px 6px;
         white-space: nowrap;
      }
    }

  
    .desktop-tabs { display: flex; gap: 0; border-bottom: 1px solid #1e293b; margin-bottom: 24px; flex-wrap:wrap; }
    @media (max-width: 1023px) {
      .desktop-tabs { display: none !important; }
    }
    
    /* Dynamically added bottom nav active state overrides */
    .bottom-nav-item.active-clinica { color: #f472b6 !important; }
    .bottom-nav-item.active-contab { color: #f59e0b !important; }

/* ADMIN STYLES */

*, *::before, *::after { box-sizing: border-box; }
    body { font-family: 'Geist', sans-serif; background-color: #051424; color: #d4e4fa; margin: 0; padding: 24px; }
    .material-symbols-outlined { font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24; user-select: none; }
    .card { background-color: #0f172a; border: 1px solid #1e293b; border-radius: 8px; padding: 24px; margin-bottom: 24px; }
    
    .input-field {
      width: 100%; background: #1c2b3c; border: 1px solid #334155; color: #d4e4fa;
      border-radius: 6px; height: 40px; padding: 0 12px; font-size: 14px; outline: none; transition: border-color 0.2s;
    }
    .input-field:focus { border-color: #0566d9; box-shadow: 0 0 0 2px rgba(5, 102, 217, 0.2); }
    .btn-primary {
      background: #0566d9; color: #fff; border: none; border-radius: 6px; padding: 0 16px;
      height: 40px; font-weight: 600; cursor: pointer; transition: background 0.2s; display: inline-flex; align-items: center; gap: 8px;
    }
    .btn-primary:hover { background: #0452ad; }
    label { display: block; font-size: 12px; font-weight: 500; color: #798098; text-transform: uppercase; margin-bottom: 6px; letter-spacing: 0.05em; }
    .form-group { margin-bottom: 16px; }
  
    .tab-btn.active { background: #1e293b !important; color: #fff !important; }
    .tab-btn:hover { background: rgba(30, 41, 59, 0.5); }
    .tab-content { animation: fadeIn 0.3s ease; }
    @keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }