/* ==========================================================================
   Sistema de Registro de Plantão - Águia Sistemas
   Estilos CSS Modernos, Responsivos e Otimizados para Impressão
   ========================================================================== */

:root {
    --primary: #0f2d59;
    --primary-light: #1e5bb8;
    --primary-dark: #0a1f3d;
    --secondary: #00a8cc;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --bg-page: #f4f7fb;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --border-focus: #3b82f6;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --transition: all 0.2s ease-in-out;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.5;
    font-size: 15px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   Header & Menu Horizontal Profissional
   ========================================================================== */
.header-horizontal {
    background: #091a33;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0,0,0,0.22);
}

/* Linha 1: Topbar */
.topbar {
    background: #061326;
    padding: 0.65rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.topbar-container {
    max-width: 1440px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
}

.topbar-brand-group {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.brand-horizontal {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    text-decoration: none;
}

.brand-logo-h {
    height: 38px;
    width: auto;
    background: #fff;
    padding: 3px 8px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.brand-info {
    display: flex;
    flex-direction: column;
}

.brand-title-h {
    font-size: 1.12rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.2px;
    line-height: 1.2;
}

.brand-sub-h {
    font-size: 0.7rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

/* Pílula de Status Firebird */
.fb-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.8rem;
    border-radius: 20px;
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.fb-status-pill.online {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.fb-status-pill.offline {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.35);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    display: inline-block;
    box-shadow: 0 0 6px currentColor;
}

/* Pílula de Usuário & Menu Dropdown */
.user-dropdown-wrapper {
    position: relative;
    display: inline-block;
}

.user-pill-btn {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    background: rgba(255,255,255,0.06);
    padding: 0.35rem 0.9rem;
    border-radius: 30px;
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    outline: none;
    font-family: inherit;
}

.user-pill-btn:hover, .user-pill-btn.active {
    background: rgba(255,255,255,0.14);
    border-color: rgba(255,255,255,0.3);
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    background: rgba(255,255,255,0.06);
    padding: 0.35rem 0.9rem;
    border-radius: 30px;
    text-decoration: none;
    transition: var(--transition);
    border: 1px solid rgba(255,255,255,0.12);
}

.user-pill:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.25);
}

.user-avatar {
    font-size: 1.15rem;
}

.user-meta {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.user-role-badge {
    font-size: 0.6rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.user-role-badge.role-admin {
    color: #38bdf8;
}

.user-role-badge.role-tecnico {
    color: #4ade80;
}

.user-role-badge.role-financeiro {
    color: #c084fc;
}

.user-arrow {
    font-size: 0.75rem;
    color: #cbd5e1;
    margin-left: 0.2rem;
    transition: transform 0.2s ease;
}

.user-pill-btn.active .user-arrow {
    transform: rotate(180deg);
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 250px;
    background: #ffffff;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    display: none;
    flex-direction: column;
    z-index: 10000;
    overflow: hidden;
    animation: dropIn 0.2s ease-out;
}

.user-dropdown-menu.show {
    display: flex;
}

@keyframes dropIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.dropdown-user-header {
    padding: 0.85rem 1rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.dropdown-user-name {
    font-weight: 700;
    color: #0f172a;
    font-size: 0.9rem;
    line-height: 1.2;
}

.dropdown-user-email {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 2px;
    word-break: break-all;
}

.dropdown-user-badge {
    display: inline-block;
    margin-top: 5px;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.dropdown-user-badge.role-admin {
    background: #e0f2fe;
    color: #0284c7;
}

.dropdown-user-badge.role-tecnico {
    background: #dcfce7;
    color: #16a34a;
}

.dropdown-user-badge.role-financeiro {
    background: #f3e8ff;
    color: #7e22ce;
}

.dropdown-divider {
    height: 1px;
    background: #f1f5f9;
    margin: 4px 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    color: #334155;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
}

.dropdown-item:hover {
    background: #f1f5f9;
    color: var(--primary);
}

.dropdown-item.active {
    background: #eff6ff;
    color: #0284c7;
    font-weight: 600;
}

.dropdown-item.item-danger {
    color: #ef4444;
}

.dropdown-item.item-danger:hover {
    background: #fef2f2;
    color: #dc2626;
}

.dropdown-item .item-icon {
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

.btn-logout {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 0.4rem 0.85rem;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    transition: var(--transition);
}

.btn-logout:hover {
    background: #ef4444;
    color: #fff;
}

/* Linha 2: Barra de Navegação Horizontal */
.nav-horizontal-bar {
    background: #0f2d59;
    padding: 0.35rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.nav-horizontal-container {
    max-width: 1440px;
    margin: 0 auto;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none; /* Firefox: oculta barra de scroll */
    -ms-overflow-style: none; /* IE e Edge */
}

/* Oculta totalmente a barra de rolagem no Chrome, Edge e Safari */
.nav-horizontal-container::-webkit-scrollbar {
    display: none;
    height: 0;
    width: 0;
}

.nav-horizontal-list {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    list-style: none;
    margin: 0;
    padding: 4px 0 6px 0;
    white-space: nowrap;
    min-height: 48px;
}

.nav-h-item {
    flex-shrink: 0;
}

.nav-h-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #cbd5e1;
    text-decoration: none;
    padding: 0.55rem 0.95rem;
    border-radius: 6px;
    font-size: 0.88rem;
    font-weight: 600;
    transition: var(--transition);
    line-height: 1.2;
    border: 1px solid transparent;
}

.nav-h-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.09);
}

.nav-h-link.active {
    color: #fff;
    background: rgba(255,255,255,0.16);
    border-color: rgba(255,255,255,0.2);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

/* Botão Novo Plantão destacado */
.nav-h-highlight {
    background: #059669 !important;
    color: #fff !important;
    border-color: #10b981 !important;
    box-shadow: 0 2px 6px rgba(5, 150, 105, 0.4);
}

.nav-h-highlight:hover {
    background: #047857 !important;
    transform: translateY(-1px);
}

.nav-icon {
    font-size: 1.1rem;
    line-height: 1;
}

.nav-text {
    line-height: 1;
}

/* ==========================================================================
   Menu Hambúrguer & Drawer Mobile (Off-Canvas)
   ========================================================================== */
.mobile-hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4.5px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    cursor: pointer;
    padding: 8px;
    transition: var(--transition);
    outline: none;
}

.mobile-hamburger-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.3);
}

.hamburger-line {
    display: block;
    width: 20px;
    height: 2px;
    background-color: #ffffff;
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.2s ease;
}

.mobile-hamburger-btn.is-active .hamburger-line:nth-child(1) {
    transform: translateY(6.5px) rotate(45deg);
}

.mobile-hamburger-btn.is-active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-hamburger-btn.is-active .hamburger-line:nth-child(3) {
    transform: translateY(-6.5px) rotate(-45deg);
}

/* Backdrop escuro com blur */
.mobile-nav-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 25, 47, 0.72);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1090;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.mobile-nav-backdrop.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Drawer Lateral Deslizante */
.mobile-nav-drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 82%;
    max-width: 320px;
    background: #091a33;
    color: #ffffff;
    z-index: 1100;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 4px 0 25px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-nav-drawer.open {
    transform: translateX(0);
}

.mobile-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.25rem 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: #061326;
}

.mobile-drawer-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.mobile-user-avatar {
    font-size: 1.4rem;
    background: rgba(255, 255, 255, 0.1);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.mobile-user-meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.mobile-user-name {
    font-size: 0.92rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
}

.mobile-drawer-close-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #cbd5e1;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.mobile-drawer-close-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.4);
}

.mobile-drawer-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
}

/* CTA Novo Plantão no Drawer */
.mobile-cta-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    background: #059669;
    color: #ffffff;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.35);
    border: 1px solid #10b981;
    transition: var(--transition);
}

.mobile-cta-btn:hover, .mobile-cta-btn.active {
    background: #047857;
    transform: translateY(-1px);
}

.mobile-menu-section-label {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #64748b;
    margin-top: 0.85rem;
    padding-left: 0.35rem;
}

.mobile-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #cbd5e1;
    text-decoration: none;
    padding: 0.75rem 0.95rem;
    border-radius: 8px;
    font-size: 0.92rem;
    font-weight: 600;
    transition: var(--transition);
    border: 1px solid transparent;
}

.mobile-nav-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

.mobile-nav-link.active {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.12);
    border-color: rgba(56, 189, 248, 0.3);
    font-weight: 700;
}

.mobile-nav-link.highlight-app {
    color: #34d399;
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.25);
}

.mobile-nav-link.highlight-app:hover {
    background: rgba(16, 185, 129, 0.2);
}

.mobile-nav-link.link-danger {
    color: #fca5a5;
}

.mobile-nav-link.link-danger:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.12);
}

.mobile-nav-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 0.5rem 0;
}

.mobile-badge-count {
    margin-left: auto;
    background: #ef4444;
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 9999px;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
}


/* ==========================================================================
   Layout Principal
   ========================================================================== */
.main-content {
    flex: 1;
    max-width: 1400px;
    width: 100%;
    margin: 1.5rem auto;
    padding: 0 1rem;
}

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* ==========================================================================
   Cards & Grids
   ========================================================================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--primary);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.stat-icon.blue { background: #e0f2fe; color: #0284c7; }
.stat-icon.green { background: #dcfce7; color: #16a34a; }
.stat-icon.amber { background: #fef3c7; color: #d97706; }
.stat-icon.purple { background: #f3e8ff; color: #9333ea; }

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.1;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ==========================================================================
   Formulários & Inputs
   ========================================================================== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.col-12 { grid-column: span 12; }
.col-11 { grid-column: span 11; }
.col-10 { grid-column: span 10; }
.col-9  { grid-column: span 9; }
.col-8  { grid-column: span 8; }
.col-7  { grid-column: span 7; }
.col-6  { grid-column: span 6; }
.col-5  { grid-column: span 5; }
.col-4  { grid-column: span 4; }
.col-3  { grid-column: span 3; }
.col-2  { grid-column: span 2; }
.col-1  { grid-column: span 1; }

/* Modais Modernos */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 1rem;
}
.modal-overlay.active {
    display: flex;
}
.modal-container {
    background: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: 620px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    animation: modalIn 0.25s ease-out;
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(0.96) translateY(-10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.15rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}
.modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}
.modal-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: #64748b;
    padding: 0.25rem;
    line-height: 1;
    border-radius: 6px;
    transition: var(--transition);
}
.modal-close:hover {
    color: #0f172a;
    background: #e2e8f0;
}
.modal-body {
    padding: 1.5rem;
}
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}

label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
}

label .req {
    color: var(--danger);
}

.form-control {
    width: 100%;
    padding: 0.55rem 0.75rem;
    font-size: 0.92rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text-main);
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

textarea.form-control {
    resize: vertical;
    min-height: 90px;
    font-family: inherit;
}

.form-help {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Autocomplete de Clientes */
.autocomplete-container {
    position: relative;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    max-height: 250px;
    overflow-y: auto;
    z-index: 1050;
    box-shadow: var(--shadow-lg);
    display: none;
}

.autocomplete-item {
    padding: 0.6rem 0.85rem;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.88rem;
    transition: background 0.1s;
}

.autocomplete-item:hover, .autocomplete-item.selected {
    background: #f0f7ff;
}

.autocomplete-item .cli-name {
    font-weight: 600;
    color: var(--primary);
}

.autocomplete-item .cli-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ==========================================================================
   Botões
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: var(--transition);
}

.btn-primary { background: var(--primary-light); color: #fff; }
.btn-primary:hover { background: var(--primary); }

.btn-secondary { background: #64748b; color: #fff; }
.btn-secondary:hover { background: #475569; }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }

.btn-outline {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-main);
}
.btn-outline:hover {
    background: #f1f5f9;
}

.btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 0.75rem 1.4rem;
    font-size: 1rem;
}

/* ==========================================================================
   Tabelas
   ========================================================================== */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    background: #fff;
    border-radius: var(--radius-sm);
}

.table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    text-align: left;
    padding: 0.75rem 0.85rem;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.table td {
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.table tr:hover td {
    background: #f8fafc;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    font-size: 0.74rem;
    font-weight: 600;
    border-radius: 20px;
    text-transform: uppercase;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #e0f2fe; color: #075985; }

/* Alerts / Flash */
.alert {
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.9rem;
}

.alert-sucesso { background: #ecfdf5; border-left: 4px solid var(--success); color: #065f46; }
.alert-erro { background: #fef2f2; border-left: 4px solid var(--danger); color: #991b1b; }
.alert-aviso { background: #fffbeb; border-left: 4px solid var(--warning); color: #92400e; }
.alert-info { background: #eff6ff; border-left: 4px solid var(--info); color: #1e40af; }

/* ==========================================================================
   Login Screen
   ========================================================================== */
.login-body {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, #1e3a8a 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.login-card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 420px;
    padding: 2.2rem;
    text-align: center;
}

.login-logo {
    max-width: 170px;
    margin-bottom: 1.25rem;
}

.login-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.login-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* ==========================================================================
   Relatório de Impressão (Fiel ao .ODT da Águia Sistemas)
   ========================================================================== */
.print-actions-bar {
    background: #fff;
    padding: 1rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.plantao-print-sheet {
    background: #fff;
    width: 210mm;
    min-height: 297mm;
    margin: 0 auto 2rem auto;
    padding: 12mm 15mm;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
    color: #000;
    box-sizing: border-box;
}

.via-box {
    background: #ffffff;
    margin-bottom: 12px;
    page-break-inside: avoid;
    box-sizing: border-box;
}

/* Tabelas e Bordas Estilo ODT Oficial */
.via-table-odt {
    width: 100%;
    border-collapse: collapse;
    border: 1.5px solid #000000;
    box-sizing: border-box;
}

.via-table-odt.no-top {
    border-top: none;
}

.via-table-odt td {
    border: 1.5px solid #000000;
    box-sizing: border-box;
}

.via-logo-cell {
    width: 130px;
    text-align: center;
    vertical-align: middle;
    padding: 4px;
    border-right: 1.5px solid #000000 !important;
}

.via-logo-img {
    max-height: 68px;
    max-width: 120px;
    object-fit: contain;
    display: inline-block;
}

.via-company-info {
    text-align: center;
    vertical-align: middle;
    padding: 4px 8px;
    line-height: 1.25;
    color: #000000;
}

.via-company-title {
    font-weight: bold;
    font-size: 10.5pt;
    margin-bottom: 2px;
    letter-spacing: 0.3px;
}

.via-meta-row td {
    padding: 4px 8px;
    font-size: 9pt;
    line-height: 1.25;
    color: #000000;
}

.via-desc-title-odt {
    border: 1.5px solid #000000;
    border-top: none;
    background: #e6e6e6 !important;
    color: #000000;
    text-align: center;
    font-weight: bold;
    font-size: 9.5pt;
    padding: 4px 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-sizing: border-box;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.via-desc-content-odt {
    border: 1.5px solid #000000;
    border-top: none;
    padding: 6px 8px;
    font-size: 9pt;
    line-height: 1.35;
    color: #000000;
    white-space: pre-wrap;
    word-break: break-word;
    overflow: hidden;
    box-sizing: border-box;
}

.via-timing-odt td {
    width: 33.33%;
    padding: 4px 8px;
    font-size: 9pt;
    color: #000000;
}

.cut-line {
    border-top: 1.5px dashed #64748b;
    margin: 14px 0;
    position: relative;
    text-align: center;
}

.cut-line::after {
    content: " ✂  Corte aqui (Separação dos Atendimentos) ";
    position: relative;
    top: -10px;
    background: #fff;
    padding: 0 10px;
    font-size: 7.5pt;
    color: #666;
    letter-spacing: 1px;
}

/* ==========================================================================
   CSS de Impressão (@media print)
   ========================================================================== */
@media print {
    body {
        background: #fff !important;
        color: #000 !important;
        font-size: 10pt !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .navbar, .print-actions-bar, .footer, .btn, .no-print {
        display: none !important;
    }

    .main-content {
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .plantao-print-sheet {
        width: 100% !important;
        min-height: auto !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .via-box {
        border: none !important;
        padding: 0 !important;
    }

    .via-table-odt {
        border: 1.5px solid #000000 !important;
    }

    .via-table-odt td {
        border: 1.5px solid #000000 !important;
    }

    .via-desc-title-odt {
        background: #e6e6e6 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    @page {
        size: A4 portrait;
        margin: 8mm 10mm;
    }
}

/* ==========================================================================
   Responsividade Mobile
   ========================================================================== */
@media (max-width: 768px) {
    /* Exibir botão hambúrguer e ocultar menu horizontal extenso no mobile */
    .mobile-hamburger-btn {
        display: flex;
    }

    .nav-horizontal-bar {
        display: none !important;
    }

    /* Otimizações da Topbar no celular */
    .topbar {
        padding: 0.55rem 0.85rem;
    }

    .topbar-brand-group {
        gap: 0.6rem;
    }

    .brand-horizontal {
        gap: 0.5rem;
    }

    .brand-logo-h {
        height: 32px;
        padding: 2px 6px;
    }

    .brand-sub-h {
        display: none;
    }

    /* Compacta a pílula do usuário para caber na tela do celular */
    .user-pill-btn {
        padding: 0.35rem 0.55rem;
        gap: 0.3rem;
    }

    .user-pill-btn .user-meta {
        display: none;
    }

    .user-pill-btn .user-arrow {
        display: none;
    }


    .form-grid {
        display: flex;
        flex-direction: column;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-actions {
        width: 100%;
    }

    .page-actions .btn {
        flex: 1;
    }

    .plantao-print-sheet {
        width: 100%;
        padding: 0.5rem;
    }
}

/* ==========================================================================
   Componentes de Filtros & Paginação (Abas de Páginas)
   ========================================================================== */
.filter-card {
    background: #ffffff;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.85rem;
    align-items: flex-end;
}

.filter-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.filter-chip-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px dashed var(--border-color);
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #e0f2fe;
    color: #0369a1;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.25rem 0.65rem;
    border-radius: 9999px;
    border: 1px solid #bae6fd;
}

.filter-chip a {
    color: #0369a1;
    text-decoration: none;
    font-weight: bold;
    margin-left: 2px;
}

.filter-chip a:hover {
    color: #b91c1c;
}

/* Paginação Estilo Abas / Botões */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1.25rem 0 0.5rem 0;
    border-top: 1px solid var(--border-color);
    margin-top: 1rem;
}

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

.pagination {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 0.35rem;
    flex-wrap: wrap;
    align-items: center;
}

.page-item {
    display: inline-block;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 0.65rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-main);
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: var(--transition);
}

.page-link:hover:not(.disabled) {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: var(--primary);
}

.page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(15, 45, 89, 0.25);
}

.page-item.disabled .page-link {
    color: #cbd5e1;
    background: #f8fafc;
    border-color: #e2e8f0;
    cursor: not-allowed;
    pointer-events: none;
}

.page-dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 36px;
    color: var(--text-muted);
    font-weight: bold;
}

.pagination-jump {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.pagination-jump input {
    width: 58px;
    padding: 0.35rem 0.5rem;
    font-size: 0.88rem;
    text-align: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

