/* =============================================
   SIEP ESCALA DIGITAL — CSS Principal
   Design: Dark mode, glassmorphism, premium
   ============================================= */

:root {
    /* Cores Principais */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --primary-glow: rgba(99, 102, 241, 0.25);

    --secondary: #06b6d4;
    --secondary-dark: #0891b2;
    --accent: #f59e0b;
    --accent-green: #10b981;
    --accent-red: #ef4444;

    /* Backgrounds */
    --bg-base: #0a0d1a;
    --bg-surface: #111827;
    --bg-elevated: #1a2035;
    --bg-card: #1e2a40;
    --bg-hover: #252f45;
    --bg-modal: rgba(10, 13, 26, 0.95);

    /* Texto */
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-accent: #6366f1;

    /* Bordas */
    --border: rgba(99, 102, 241, 0.15);
    --border-hover: rgba(99, 102, 241, 0.35);
    --border-subtle: rgba(255, 255, 255, 0.06);

    /* Sidebar */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --sidebar-bg: rgba(17, 24, 39, 0.97);
    --sidebar-border: rgba(99, 102, 241, 0.12);

    /* Topbar */
    --topbar-height: 65px;
    --topbar-bg: rgba(17, 24, 39, 0.92);

    /* Sombras */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.2);

    /* Transições */
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;

    /* Raios */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Feedback semântico */
    --status-success: #10b981;
    --status-warning: #f59e0b;
    --status-danger: #ef4444;
    --status-info: #06b6d4;
    --surface-disabled: rgba(100, 116, 139, 0.12);
    --text-disabled: rgba(148, 163, 184, 0.55);
    --focus-ring: rgba(99, 102, 241, 0.45);
}

body.light-mode {
    --bg-base: #e2e8f0;
    --bg-surface: #ffffff;
    --bg-elevated: #f8fafc;
    --bg-card: #ffffff;
    --bg-hover: #e2e8f0;
    --bg-modal: rgba(255, 255, 255, 0.98);

    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #475569;
    --text-accent: #4338ca;

    --primary-light: #4338ca;
    --accent: #b45309;

    --border: rgba(15, 23, 42, 0.14);
    --border-hover: rgba(67, 56, 202, 0.45);
    --border-subtle: rgba(15, 23, 42, 0.1);

    --sidebar-bg: #ffffff;
    --sidebar-border: rgba(15, 23, 42, 0.1);

    --topbar-bg: #ffffff;

    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.1);
    --shadow-lg: 0 8px 32px rgba(15, 23, 42, 0.12);
    --shadow-glow: 0 0 0 1px rgba(99, 102, 241, 0.12);

    /* Superfícies do portal (glass → sólido legível) */
    --portal-welcome-bg: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
    --portal-card-bg: #ffffff;
    --portal-chat-bubble: #f1f5f9;
    --portal-chat-mine: #e0f2fe;
    --portal-input-bg: #ffffff;
    --portal-sticky-head: #e2e8f0;
    --portal-sticky-mine: #d1fae5;
}

.theme-toggle-btn {
    width: 36px;
    height: 36px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 14px;
    outline: none;
}
.theme-toggle-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ====== RESET & BASE ====== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--primary-light); text-decoration: none; transition: var(--transition-fast); }
a:hover { color: var(--primary); }

/* ====== LOGIN PAGE ====== */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-base);
    position: relative;
    overflow: hidden;
}

.login-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.login-bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.35;
    animation: orbFloat 8s ease-in-out infinite;
}

.orb1 {
    width: 500px; height: 500px;
    background: radial-gradient(circle, #6366f1, transparent);
    top: -150px; left: -100px;
}
.orb2 {
    width: 400px; height: 400px;
    background: radial-gradient(circle, #06b6d4, transparent);
    bottom: -100px; right: -100px;
    animation-delay: -3s;
}
.orb3 {
    width: 300px; height: 300px;
    background: radial-gradient(circle, #f59e0b, transparent);
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -5s;
    opacity: 0.15;
}

@keyframes orbFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-30px) scale(1.05); }
}

.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    padding: 24px;
}

.login-card {
    background: rgba(30, 42, 64, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 44px 40px;
    box-shadow: var(--shadow-lg), 0 0 60px rgba(99, 102, 241, 0.1);
}

.login-logo {
    text-align: center;
    margin-bottom: 36px;
}

.login-logo-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 28px;
    color: white;
    box-shadow: 0 8px 30px var(--primary-glow);
    animation: pulse 2.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 8px 30px rgba(99, 102, 241, 0.3); }
    50% { box-shadow: 0 8px 50px rgba(99, 102, 241, 0.6); }
}

.login-title {
    font-size: 32px;
    font-weight: 800;
    background: linear-gradient(135deg, #f1f5f9, var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.login-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 6px;
    line-height: 1.5;
}

.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 13px;
}

.alert-error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.alert-success {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

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

.form-group { display: flex; flex-direction: column; gap: 8px; }

.form-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}
.form-label i { color: var(--primary-light); font-size: 12px; }

.form-input {
    width: 100%;
    padding: 13px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    transition: var(--transition);
    outline: none;
}

.form-input:focus {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

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

.input-with-icon { position: relative; }
.input-with-icon .form-input { padding-right: 48px; }

.input-icon-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    transition: var(--transition-fast);
}
.input-icon-btn:hover { color: var(--primary-light); }

.btn-login {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 20px var(--primary-glow);
    margin-top: 8px;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.4);
}

.btn-login:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.login-switch {
    text-align: center;
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid var(--border-subtle);
}

.login-switch-hint {
    margin: 0 0 10px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.45;
}

.login-switch a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-light);
    text-decoration: none;
    transition: var(--transition-fast);
    line-height: 1.4;
}

.login-switch a:hover {
    color: var(--primary);
    text-decoration: underline;
}

.login-switch--portal a {
    color: #6ee7b7;
}

.login-switch--portal a:hover {
    color: var(--success);
}

.login-footer {
    text-align: center;
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--border-subtle);
    font-size: 12px;
    color: var(--text-muted);
}

/* ====== LAYOUT COM SIDEBAR ====== */
.layout-body {
    display: flex;
    min-height: 100vh;
    background: var(--bg-base);
}

/* ====== SIDEBAR ====== */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

.sidebar.collapsed { width: var(--sidebar-collapsed-width); }
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .logo-text,
.sidebar.collapsed .user-details,
.sidebar.collapsed .nav-arrow,
.sidebar.collapsed .nav-group-items { display: none !important; }

.sidebar.collapsed .nav-item,
.sidebar.collapsed .nav-group-toggle { justify-content: center; padding: 12px; }

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 16px;
    border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.logo-text { overflow: hidden; }
.logo-title {
    display: block;
    font-size: 18px;
    font-weight: 800;
    background: linear-gradient(135deg, #f1f5f9, var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
}
.logo-subtitle {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.sidebar-toggle {
    width: 30px;
    height: 30px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
    font-size: 12px;
}
.sidebar-toggle:hover { background: var(--primary); color: white; border-color: var(--primary); }
.sidebar.collapsed .sidebar-toggle i { transform: rotate(180deg); }

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.nav-section { margin-bottom: 24px; }

.nav-section-label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 0 8px;
    margin-bottom: 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: var(--transition);
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 500;
    position: relative;
    white-space: nowrap;
    overflow: hidden;
}

.nav-item:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-light);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    bottom: 20%;
    width: 3px;
    background: var(--primary);
    border-radius: 0 2px 2px 0;
}

.nav-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    color: var(--primary-light);
}

.nav-arrow {
    margin-left: auto;
    font-size: 10px;
    transition: transform 0.25s ease;
    flex-shrink: 0;
}

.nav-group-toggle.open .nav-arrow,
.nav-group-toggle[aria-expanded="true"] .nav-arrow { transform: rotate(180deg); }

.nav-group-items {
    display: none;
    padding-left: 16px;
    margin-top: 4px;
}
.nav-group-items.open { display: block; }

.nav-sub-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    transition: var(--transition);
    border-left: 1px solid var(--border-subtle);
    margin-bottom: 2px;
}

.nav-sub-item:hover {
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.08);
    border-left-color: var(--primary);
}

.nav-sub-item i {
    width: 16px;
    text-align: center;
    font-size: 12px;
    color: var(--primary-light);
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    overflow: hidden;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: white;
    flex-shrink: 0;
}

.user-details { overflow: hidden; }
.user-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-role {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

.btn-logout {
    width: 34px;
    height: 34px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fca5a5;
    transition: var(--transition);
    flex-shrink: 0;
    font-size: 14px;
}
.btn-logout:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: #ef4444;
}

/* ====== MAIN CONTENT ====== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex: 1;
}

.sidebar.collapsed ~ .main-content { margin-left: var(--sidebar-collapsed-width); }

/* ====== TOPBAR ====== */
.topbar {
    height: var(--topbar-height);
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(10px);
}

.topbar-left { display: flex; align-items: center; gap: 16px; }

.topbar-menu-btn {
    display: none;
    width: 36px;
    height: 36px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 15px;
}

.topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.breadcrumb-home { color: var(--primary-light); }
.breadcrumb-sep { font-size: 10px; }
.breadcrumb-current {
    color: var(--text-primary);
    font-weight: 600;
}

.topbar-right { display: flex; align-items: center; gap: 16px; }

.topbar-unidade {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-elevated);
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.topbar-unidade i { color: var(--secondary); }

.topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.topbar-avatar {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: white;
}

.badge-admin {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, var(--accent), #f97316);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
}

/* ====== PAGE CONTENT ====== */
.page-content {
    flex: 1;
    padding: 28px 28px 20px;
}

.page-header {
    margin-bottom: 28px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.page-header p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.page-footer {
    padding: 16px 28px 20px;
    border-top: 1px solid var(--border-subtle);
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
}

.page-footer-system,
.login-footer-system {
    margin: 0 0 10px;
    font-size: 12px;
    color: var(--text-muted);
}

.footer-credit {
    margin-top: 4px;
    padding-top: 10px;
    border-top: 1px solid var(--border-subtle);
}

.footer-credit-line {
    margin: 0 0 4px;
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.45;
}

.footer-credit-line strong {
    font-weight: 600;
    color: var(--text-primary);
}

.footer-credit-role {
    margin: 0;
    font-size: 10px;
    color: var(--text-muted);
    line-height: 1.4;
}

.login-footer .footer-credit {
    margin-top: 12px;
    padding-top: 12px;
}

.perm-tree {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 340px;
    overflow-y: auto;
    padding-right: 4px;
}

/* Grade de módulos — modal usuários */
.perm-tree-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
    align-content: start;
}

.perm-tree-loading {
    grid-column: 1 / -1;
    padding: 24px;
}

.perm-tree-module-hidden {
    display: none !important;
}

.perm-tree-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    padding: 24px 12px;
    margin: 0;
}

.perm-tree-module {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.perm-tree-module-head {
    padding: 0;
    margin: 0;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-subtle);
}

.perm-module-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    cursor: pointer;
    width: 100%;
    margin: 0;
}

.perm-module-label input[type="checkbox"] {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    cursor: pointer;
    accent-color: var(--primary);
}

.perm-module-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.perm-module-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

.perm-module-meta {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.perm-tree-children {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 6px 0;
    border-top: none;
    background: var(--bg-card);
}

.perm-tree-child {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.35;
    padding: 8px 14px 8px 16px;
    margin: 0;
    border-bottom: 1px solid var(--border-subtle);
    transition: background 0.15s ease;
}

.perm-tree-child:last-child {
    border-bottom: none;
}

.perm-tree-child:hover {
    background: var(--bg-elevated);
}

.perm-tree-child input[type="checkbox"] {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin-top: 2px;
    cursor: pointer;
    accent-color: var(--primary);
}

.perm-child-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.perm-child-label {
    color: var(--text-primary);
    font-weight: 500;
}

.perm-child-code {
    font-size: 10px;
    font-family: ui-monospace, monospace;
    color: var(--text-muted);
    opacity: 0.85;
    word-break: break-all;
}

.perm-tree-child input:disabled + .perm-child-text {
    opacity: 0.55;
}

.perm-tree-child input:disabled,
.perm-module-label input:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.perm-tree-module:has(.perm-module:checked) {
    border-color: rgba(99, 102, 241, 0.45);
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.12);
}

.perm-tree-module:has(.perm-module:indeterminate) {
    border-color: rgba(245, 158, 11, 0.45);
}

.setor-escopo-table-wrap {
    max-height: 280px;
    overflow: auto;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
}

.setor-escopo-table-wrap-modal {
    max-height: min(48vh, 400px);
}

.setor-escopo-table-wrap-modal .setor-escopo-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

body.light-mode .setor-escopo-table-wrap-modal .setor-escopo-table tbody tr:nth-child(even) {
    background: var(--bg-elevated);
}

.setor-escopo-table-wrap-modal .setor-escopo-table td:first-child {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 140px;
}

.setor-escopo-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.setor-escopo-table th,
.setor-escopo-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-subtle);
    text-align: left;
}

.setor-escopo-table th {
    position: sticky;
    top: 0;
    background: var(--bg-elevated);
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    z-index: 1;
}

.setor-escopo-check {
    text-align: center;
    width: 72px;
}

.setor-escopo-check input {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Modal usuários — abas */
.modal.modal-usuario {
    display: flex;
    flex-direction: column;
    max-width: 980px;
    width: min(96vw, 980px);
    max-height: min(92vh, 720px);
    overflow: hidden;
}

.modal.modal-usuario .modal-body {
    padding: 0;
}

.modal-usuario .modal-header,
.modal-usuario .usuario-modal-tabs,
.modal-usuario .modal-footer {
    flex-shrink: 0;
}

.modal-body-usuario {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 16px 24px 20px;
}

.modal-body-usuario:has(.usuario-tab-panel[data-panel="permissoes"].active) {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-body-usuario:has(.usuario-tab-panel[data-panel="permissoes"].active) #formUsuario {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.modal-body-usuario:has(.usuario-tab-panel[data-panel="permissoes"].active) .usuario-tab-panel[data-panel="permissoes"].active {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
}

.usuario-tab-panel {
    display: none !important;
}

.usuario-tab-panel.active {
    display: block !important;
}

.usuario-tab-panel[data-panel="permissoes"].active {
    display: flex !important;
    flex-direction: column;
    gap: 12px;
}

.usuario-panel-intro-compact {
    margin-bottom: 0;
    padding: 10px 12px;
    font-size: 12px;
}

.perm-panel-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
}

.perm-search-wrap {
    position: relative;
    flex: 1 1 220px;
    min-width: 180px;
    max-width: 360px;
}

.perm-search-wrap i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 13px;
    pointer-events: none;
}

.perm-search-input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-size: 13px;
}

.perm-search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.perm-toolbar-right {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.perm-contador {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-light);
    white-space: nowrap;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.perm-template-label {
    margin: 0;
    font-size: 12px;
    white-space: nowrap;
}

.perm-template-select {
    min-width: 200px;
    max-width: 280px;
    font-size: 13px;
}

.perm-panel-body {
    flex: 1 1 auto;
    min-height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    padding: 12px;
}

@media (max-width: 720px) {
    .perm-tree-grid {
        grid-template-columns: 1fr;
    }
    .perm-panel-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .perm-search-wrap {
        max-width: none;
    }
    .perm-toolbar-right {
        justify-content: space-between;
    }
    .perm-template-select {
        flex: 1;
        min-width: 0;
    }
}

.usuario-modal-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-subtle);
    padding: 0 16px;
    background: var(--bg-elevated);
}

.usuario-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.usuario-tab:hover {
    color: var(--text-primary);
}

.usuario-tab.active {
    color: var(--primary-light);
    border-bottom-color: var(--primary);
}

.usuario-tab.usuario-tab-muted {
    opacity: 0.45;
}

.usuario-tab-panel-inner {
    padding-top: 16px;
}

.usuario-panel-intro {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 14px;
    margin-bottom: 16px;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.usuario-panel-intro i {
    color: var(--primary-light);
    margin-top: 2px;
}

.usuario-admin-aviso {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.08);
    color: var(--text-primary);
}

.usuario-admin-aviso i {
    color: var(--danger);
    font-size: 18px;
    margin-top: 2px;
}

.usuario-admin-aviso p {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--text-secondary);
}

.form-hint-inline {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
}

.form-group-full {
    grid-column: 1 / -1;
}

.usuario-escopo-toolbar,
.usuario-perm-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}

.usuario-tab-panel[data-panel="dados"].active,
.usuario-tab-panel[data-panel="escopo"].active {
    padding-top: 4px;
}

.usuario-empty-hint {
    font-size: 13px;
    color: var(--text-muted);
    padding: 16px 8px;
    margin: 0;
}

.usuario-list-nome {
    font-weight: 600;
    color: var(--text-primary);
}

.usuario-list-login {
    display: inline-block;
    margin-top: 4px;
    background: var(--bg-elevated);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    color: var(--text-muted);
}

.usuario-list-perms {
    max-width: 280px;
}

.usuario-perm-badge {
    margin: 2px 4px 2px 0;
    font-size: 11px;
}

.usuario-perm-more {
    font-size: 11px;
    color: var(--text-muted);
}

.usuario-list-actions {
    display: flex;
    gap: 6px;
    justify-content: center;
}

/* Admin — configurações */
.admin-config-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 20px;
    align-items: start;
}

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

.admin-config-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: sticky;
    top: 80px;
}

.admin-config-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
}

.admin-config-nav-item:hover {
    border-color: var(--primary);
    color: var(--text-primary);
}

.admin-config-nav-item.active {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary-light);
}

.admin-config-panel {
    display: none;
}

.admin-config-panel.active {
    display: block;
}

.admin-config-card .card-header h2 {
    margin: 0 0 6px;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-config-card .card-subtitle {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
}

.admin-config-preview {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
    font-size: 13px;
    color: var(--text-primary);
    min-height: 52px;
}

.admin-config-preview i {
    color: var(--primary-light);
    margin-top: 2px;
}

.admin-config-fields-off {
    opacity: 0.45;
    pointer-events: none;
}

.admin-config-switch {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
}

.admin-config-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.admin-config-switch-ui {
    flex-shrink: 0;
    width: 44px;
    height: 24px;
    border-radius: 999px;
    background: var(--border-subtle);
    position: relative;
    transition: background 0.2s;
}

.admin-config-switch-ui::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s;
}

.admin-config-switch input:checked + .admin-config-switch-ui {
    background: var(--primary);
}

.admin-config-switch input:checked + .admin-config-switch-ui::after {
    transform: translateX(20px);
}

.admin-config-switch-label small {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 400;
}

.admin-config-actions {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-subtle);
}

.admin-config-help {
    margin-top: 16px;
}

.admin-config-help-title {
    margin: 0 0 10px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-config-help-list {
    margin: 0;
    padding-left: 18px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.6;
}

.admin-config-alert-wrap {
    margin-bottom: 16px;
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin: 6px 0 0;
    line-height: 1.45;
}

/* ====== CARDS & GRID ====== */
.cards-grid {
    display: grid;
    gap: 16px;
}

.cards-grid-4 { grid-template-columns: repeat(4, 1fr); }
.cards-grid-3 { grid-template-columns: repeat(3, 1fr); }
.cards-grid-2 { grid-template-columns: repeat(2, 1fr); }

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: var(--transition);
}
.card:hover { border-color: var(--border); box-shadow: var(--shadow-md); }

.card-header {
    margin-bottom: 16px;
}

.card-body {
    padding: 0;
}

/* Removido transform: translateY(-2px) do .card:hover para evitar flickering em dropdowns internos */

.card-clickable:hover { transform: translateY(-2px); }

.stat-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-icon.purple  { background: rgba(99, 102, 241, 0.15); color: var(--primary-light); }
.stat-icon.cyan    { background: rgba(6, 182, 212, 0.15);  color: var(--secondary); }
.stat-icon.amber   { background: rgba(245, 158, 11, 0.15); color: var(--accent); }
.stat-icon.green   { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); }
.stat-icon.red     { background: rgba(239, 68, 68, 0.15);  color: var(--accent-red); }

.stat-info { flex: 1; }
.stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -0.5px;
}
.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: 500;
}
.stat-change {
    font-size: 12px;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.stat-change.up { color: var(--accent-green); }
.stat-change.down { color: var(--accent-red); }

/* ====== TABLES ====== */
.table-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.table-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.table-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.table-actions { display: flex; align-items: center; gap: 10px; }

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    padding: 12px 16px;
    background: var(--bg-elevated);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    text-align: left;
    white-space: nowrap;
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-size: 13.5px;
    vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: rgba(99, 102, 241, 0.04); color: var(--text-primary); }

/* ====== BUTTONS ====== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    white-space: nowrap;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 15px var(--primary-glow);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 25px rgba(99, 102, 241, 0.4); color: white; }

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary-light); }

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.2);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.2); }

.btn-success {
    background: rgba(16, 185, 129, 0.1);
    color: #6ee7b7;
    border-color: rgba(16, 185, 129, 0.2);
}
.btn-success:hover { background: rgba(16, 185, 129, 0.2); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon { width: 34px; height: 34px; padding: 0; justify-content: center; }

/* ====== SEARCH INPUT ====== */
.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    font-size: 13px;
    pointer-events: none;
}

.search-input {
    padding: 9px 12px 9px 36px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    width: 260px;
    transition: var(--transition);
    outline: none;
}
.search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1); }
.search-input::placeholder { color: var(--text-muted); }

/* ====== FORMS ====== */
.form-grid { display: grid; gap: 16px; }
.form-grid-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }

.form-select {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: var(--transition);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 10px;
    padding-right: 36px;
}
.form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1); }
.form-select option { background: var(--bg-elevated); }

/* ====== MODAL ====== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(20px);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: var(--shadow-lg);
}
.modal-overlay.active .modal { transform: scale(1) translateY(0); }

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-title i { color: var(--primary-light); }

.modal-close {
    width: 32px;
    height: 32px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}
.modal-close:hover { color: var(--accent-red); border-color: rgba(239, 68, 68, 0.3); }

.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ====== BADGES ====== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.badge-purple { background: rgba(99, 102, 241, 0.15); color: var(--primary-light); }
.badge-cyan   { background: rgba(6, 182, 212, 0.15); color: var(--secondary); }
.badge-green  { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); }
.badge-amber  { background: rgba(245, 158, 11, 0.15); color: var(--accent); }
.badge-red    { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }
.badge-gray   { background: rgba(100, 116, 139, 0.15); color: var(--text-muted); }

/* Status de workflow (substituem botões desabilitados do ALZ) */
.badge-status-aprovado {
    background: rgba(16, 185, 129, 0.18);
    color: var(--status-success);
    gap: 5px;
}
.badge-status-pendente {
    background: rgba(245, 158, 11, 0.18);
    color: var(--status-warning);
    gap: 5px;
}
.badge-status-lancamento {
    background: rgba(99, 102, 241, 0.18);
    color: var(--primary-light);
    gap: 5px;
}
.badge-status-encerrado {
    background: rgba(100, 116, 139, 0.2);
    color: var(--text-muted);
    gap: 5px;
}
.badge-status-rejeitado {
    background: rgba(239, 68, 68, 0.18);
    color: #fca5a5;
    gap: 5px;
}

/* ====== ALERT BANNER (topo de formulário) ====== */
.alert-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    font-size: 13px;
    line-height: 1.45;
    border: 1px solid transparent;
}
.alert-banner-icon { font-size: 18px; line-height: 1.2; margin-top: 1px; flex-shrink: 0; }
.alert-banner-body { flex: 1; min-width: 0; }
.alert-banner-title { display: block; font-weight: 700; margin-bottom: 2px; }
.alert-banner-close {
    background: none;
    border: none;
    color: inherit;
    opacity: 0.65;
    cursor: pointer;
    padding: 2px 6px;
    flex-shrink: 0;
}
.alert-banner-close:hover { opacity: 1; }
.alert-banner-danger  { background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.35); color: #fecaca; }
.alert-banner-warning { background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.35); color: #fcd34d; }
.alert-banner-info    { background: rgba(6, 182, 212, 0.12); border-color: rgba(6, 182, 212, 0.35); color: #67e8f9; }
.alert-banner-success { background: rgba(16, 185, 129, 0.12); border-color: rgba(16, 185, 129, 0.35); color: #6ee7b7; }
.escala-alert-slot:empty { display: none; margin: 0; padding: 0; }

/* ====== COMBOBOX PESQUISÁVEL ====== */
.siep-combobox { position: relative; min-width: 160px; }
.siep-combobox-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}
.siep-combobox-input {
    width: 100%;
    padding: 9px 12px;
    font-size: 13px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    transition: var(--transition-fast);
}
.siep-combobox-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--focus-ring);
}
.siep-combobox.is-open .siep-combobox-input {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-color: var(--primary);
}
.siep-combobox-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 240px;
    overflow-y: auto;
    background: var(--bg-elevated);
    border: 1px solid var(--primary);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    z-index: 1000;
    box-shadow: var(--shadow-md);
    backface-visibility: hidden;
    transform: translateZ(0);
}
.siep-combobox-option {
    display: block;
    width: 100%;
    text-align: left;
    padding: 9px 12px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
    backface-visibility: hidden;
    transform: translateZ(0);
}
.siep-combobox-option:hover,
.siep-combobox-option.is-active {
    background: var(--bg-hover);
    color: var(--primary-light);
}
.siep-combobox-option.is-disabled { opacity: 0.4; cursor: not-allowed; }

/* ====== FORMULÁRIO BLOQUEADO ====== */
.siep-form-locked {
    position: relative;
}
.siep-form-locked input:not(.siep-combobox-input),
.siep-form-locked select,
.siep-form-locked textarea,
.siep-form-locked button:not(.month-nav-btn):not(.focus-btn):not([onclick*="exportar"]):not([onclick*="Exportar"]):not([onclick*="toggleFocus"]):not([onclick*="focusSearch"]):not([onclick*="focusPrev"]):not([onclick*="focusNext"]):not(.alert-banner-close) {
    opacity: 0.45;
    cursor: not-allowed;
}
.siep-form-locked .siep-combobox-input:not(:focus) {
    opacity: 1;
    cursor: text;
}
.siep-form-locked .alert-banner { opacity: 1; }

body.siep-focus-mode .main-content { max-width: 100%; }
body.siep-focus-mode .page-content { padding-top: 12px; }

.escala-grade-readonly .escala-table input.day-code-input {
    cursor: not-allowed;
    opacity: 0.85;
}
.escala-grade-readonly .escala-wrapper {
    overflow: auto;
}

body.light-mode .alert-banner-danger  { color: #b91c1c; background: rgba(239, 68, 68, 0.08); }
body.light-mode .alert-banner-warning { color: #b45309; background: rgba(245, 158, 11, 0.08); }
body.light-mode .alert-banner-info    { color: #0e7490; background: rgba(6, 182, 212, 0.08); }
body.light-mode .badge-status-aprovado { color: #047857; }
body.light-mode .badge-status-pendente { color: #b45309; }
body.light-mode .badge-status-lancamento { color: #4338ca; }

/* ====== ESCALA GRID ====== */
.escala-grid {
    display: grid;
    grid-template-columns: 220px repeat(31, minmax(28px, 1fr));
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    overflow: auto;
    font-size: 11px;
}

.escala-grid-header {
    display: contents;
}

.escala-col-header {
    background: var(--bg-elevated);
    padding: 8px 4px;
    text-align: center;
    font-weight: 700;
    font-size: 10px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-subtle);
    border-right: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 2;
    white-space: nowrap;
}

.escala-row {
    display: contents;
}

.escala-name-cell {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    border-right: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
    position: sticky;
    left: 0;
    z-index: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
    font-weight: 500;
}

.escala-day-cell {
    padding: 6px 2px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    border-right: 1px solid rgba(255,255,255,0.03);
    cursor: pointer;
    transition: var(--transition-fast);
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.escala-day-cell:hover { background: rgba(99, 102, 241, 0.1); }

/* Efeito de hover em toda a linha da escala para orientação do usuário */
.escala-row:hover .escala-day-cell {
    background: rgba(99, 102, 241, 0.06);
}
.escala-row:hover .escala-name-cell {
    background: rgba(99, 102, 241, 0.12);
    border-right: 2px solid var(--primary-light);
}

.escala-code {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 4px;
    border-radius: 3px;
    min-width: 22px;
    text-align: center;
}

.code-M   { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
.code-T   { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }
.code-N   { background: rgba(99, 102, 241, 0.2); color: var(--primary-light); }
.code-MN  { background: rgba(6, 182, 212, 0.2); color: #67e8f9; }
.code-TN  { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
.code-F   { background: rgba(100, 116, 139, 0.15); color: var(--text-muted); }
.code-FA  { background: rgba(239, 68, 68, 0.25) !important; color: #ef4444 !important; border: 1px solid rgba(239, 68, 68, 0.4); }
.code-FER { background: rgba(245, 158, 11, 0.25); color: var(--accent); }
.code-FP  { background: rgba(139, 92, 246, 0.2); color: #c4b5fd; }
.code-FE  { background: rgba(14, 165, 233, 0.2); color: #38bdf8; }

/* ====== TOAST ====== */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    font-size: 13px;
    min-width: 300px;
    max-width: 420px;
    pointer-events: all;
    animation: toastIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes toastIn {
    from { transform: translateX(120%) scale(0.8); opacity: 0; }
    to { transform: translateX(0) scale(1); opacity: 1; }
}

.toast.success { border-left: 3px solid var(--accent-green); }
.toast.error   { border-left: 3px solid var(--accent-red); }
.toast.warning { border-left: 3px solid var(--accent); }
.toast.info    { border-left: 3px solid var(--primary); }

/* ====== EMPTY STATE ====== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-title { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.empty-text { font-size: 13px; }

/* ====== LOADING ====== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-muted);
    gap: 12px;
    font-size: 14px;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ====== TAGS / CHIPS ====== */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

/* ====== SIDEBAR OVERLAY (MOBILE) ====== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 90;
}

/* ====== CALENDAR ====== */
.month-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.month-nav-btn {
    width: 34px;
    height: 34px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition-fast);
}
.month-nav-btn:hover { border-color: var(--primary); color: var(--primary-light); }

.month-display {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    min-width: 140px;
    text-align: center;
}

/* ====== RESPONSIVE ====== */
@media (max-width: 1200px) {
    .cards-grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .topbar-menu-btn { display: flex; }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        width: var(--sidebar-width) !important;
    }
    .sidebar.mobile-open { transform: translateX(0); }
    .sidebar-overlay { display: block; }
    
    .main-content { margin-left: 0 !important; }

    .cards-grid-4,
    .cards-grid-3 { grid-template-columns: 1fr; }
    .cards-grid-2 { grid-template-columns: 1fr; }

    .page-content { padding: 16px; }

    .search-input { width: 180px; }
    .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }

    .topbar-unidade { display: none; }

    .modal { max-width: 100%; margin: 10px; }
}

@media (min-width: 769px) {
    .sidebar-overlay { display: none !important; }
}

/* ====== UTILITIES ====== */
.text-primary    { color: var(--text-primary) !important; }
.text-secondary  { color: var(--text-secondary) !important; }
.text-muted      { color: var(--text-muted) !important; }
.text-success    { color: var(--accent-green) !important; }
.text-danger     { color: var(--accent-red) !important; }
.text-warning    { color: var(--accent) !important; }
.text-purple     { color: var(--primary-light) !important; }
.text-cyan       { color: var(--secondary) !important; }

.fw-700 { font-weight: 700; }
.fw-600 { font-weight: 600; }
.fw-500 { font-weight: 500; }

.mt-0  { margin-top: 0; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

.d-flex  { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ====== PORTAL PROFISSIONAL — MOBILE RESPONSIVE ====== */

/* Bottom Navigation (mobile app-style) */
.portal-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(17, 24, 39, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(99, 102, 241, 0.15);
    z-index: 200;
    padding-bottom: env(safe-area-inset-bottom);
}
.portal-bottom-nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-around;
    height: 60px;
    padding: 0 8px;
}
.portal-bnav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    flex: 1;
    height: 100%;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s;
    text-decoration: none;
    font-family: inherit;
    padding: 0;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.portal-bnav-item i {
    font-size: 20px;
    transition: transform 0.2s;
}
.portal-bnav-item.active {
    color: var(--primary-light);
}
.portal-bnav-item.active i {
    transform: scale(1.15);
}
.portal-bnav-item:hover { color: var(--text-primary); }

/* Portal Sections (Tabs) */
.portal-container {
    display: block;
    width: 100%;
}
.portal-section {
    display: none;
    animation: fadeInTab 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.portal-section.active {
    display: block;
}
@keyframes fadeInTab {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Portal Welcome — responsive */
@media (max-width: 768px) {
    .portal-bottom-nav { display: flex; }

    /* Espaço para bottom nav */
    .page-content {
        padding-bottom: calc(72px + env(safe-area-inset-bottom)) !important;
    }

    /* Welcome bar compacto */
    .portal-welcome {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 16px;
        margin-bottom: 16px;
        border-radius: 12px;
    }
    .portal-welcome-left h2 { font-size: 18px; }
    .portal-welcome-right {
        width: 100%;
        flex-direction: row !important;
        flex-wrap: wrap;
        gap: 8px !important;
        justify-content: flex-start !important;
    }
    .portal-welcome-right select {
        flex: 1;
        min-width: 0;
        width: auto !important;
    }
    .portal-meta-badges { flex-wrap: wrap; gap: 8px; }
    .portal-meta-badge { font-size: 11px; padding: 4px 8px; }

    /* Grid: 1 coluna */
    .portal-grid { grid-template-columns: 1fr !important; gap: 16px; }

    /* Cards do portal */
    .portal-card { padding: 16px; border-radius: 12px; margin-bottom: 16px; }
    .portal-card-header { margin-bottom: 14px; }
    .portal-card-title { font-size: 15px; }

    /* Calendário: células menores */
    .plantoes-calendar { gap: 4px; }
    .calendar-day-cell {
        min-height: 44px !important;
        padding: 4px 2px !important;
        border-radius: 6px !important;
        gap: 2px !important;
    }
    .calendar-day-num { font-size: 10px !important; }
    .calendar-plantao-badge {
        font-size: 8px !important;
        padding: 1px 3px !important;
        border-radius: 3px !important;
    }
    .calendar-day-header { font-size: 9px; }

    /* Escala do setor: scroll horizontal */
    .sector-list-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .sector-table { min-width: 600px; }
    .sector-table th, .sector-table td { padding: 6px 8px; font-size: 11px; }

    /* Permutas: lista compacta */
    #listaPermutas { max-height: 240px; }

    /* Chat: menor */
    .chat-container { height: 280px; }

    /* Modal: bottom sheet em mobile */
    .modal-overlay.active .modal {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
        border-radius: 20px 20px 0 0 !important;
        max-height: 90vh;
        overflow-y: auto;
        padding-bottom: env(safe-area-inset-bottom);
        animation: slideUpModal 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
    @keyframes slideUpModal {
        from { transform: translateY(100%); opacity: 0; }
        to   { transform: translateY(0);   opacity: 1; }
    }
    .modal-overlay { align-items: flex-end; }

    /* Topbar: ocultar nome e unidade em telas muito pequenas */
    .topbar-user span:not(.badge-admin) { display: none; }
    .topbar-unidade { display: none !important; }
}

@media (max-width: 400px) {
    .portal-welcome-left h2 { font-size: 16px; }
    .portal-card-title { font-size: 14px; }
    .calendar-day-cell { min-height: 38px !important; }
}

/* Tablet: 2 colunas nos cards menores */
@media (min-width: 601px) and (max-width: 768px) {
    .portal-meta-badges { flex-wrap: nowrap; }
}

/* Touch: área de toque maior nos botões */
@media (pointer: coarse) {
    .btn, .btn-sm { min-height: 44px; }
    .portal-bnav-item { min-height: 44px; }
    .form-select, .form-input { min-height: 44px; }
    .chat-input { min-height: 44px; }
}


/* =============================================
   MODO FOCO E CORRECOES DE CONTRASTE
   ============================================= */

body.light-mode .code-M { background: rgba(16, 185, 129, 0.15); color: #047857 !important; }
body.light-mode .code-T { background: rgba(245, 158, 11, 0.15); color: #b45309 !important; }
body.light-mode .code-N { background: rgba(79, 70, 229, 0.15); color: #3730a3 !important; }
body.light-mode .code-MN { background: rgba(6, 182, 212, 0.15); color: #0e7490 !important; }
body.light-mode .code-TN { background: rgba(239, 68, 68, 0.15); color: #b91c1c !important; }
body.light-mode .code-F { background: rgba(100, 116, 139, 0.15); color: #334155 !important; }
body.light-mode .code-FA { background: rgba(239, 68, 68, 0.2); color: #b91c1c !important; }
body.light-mode .code-FER { background: rgba(245, 158, 11, 0.15); color: #b45309 !important; }
body.light-mode .code-FP { background: rgba(139, 92, 246, 0.15); color: #5b21b6 !important; }
body.light-mode .code-FE { background: rgba(37, 99, 235, 0.12); color: #0369a1 !important; }
body.light-mode .code-V { background: rgba(37, 99, 235, 0.12); color: #0369a1 !important; }
body.light-mode .code-L { background: rgba(168, 85, 247, 0.15); color: #7e22ce !important; }
body.light-mode .code-AT { background: rgba(244, 63, 94, 0.15); color: #be123c !important; }

body.light-mode .text-muted { color: var(--text-muted); }
body.light-mode .text-secondary { color: var(--text-secondary); }

/* Destaque de fins de semana, feriados e pontos facultativos (grade de escala) */
.escala-table th.day-header-weekend {
    background: rgba(245, 158, 11, 0.18) !important;
    box-shadow: inset 0 3px 0 rgba(245, 158, 11, 0.45);
}
.escala-table th.day-header-feriado {
    background: rgba(239, 68, 68, 0.2) !important;
    box-shadow: inset 0 3px 0 rgba(239, 68, 68, 0.55);
}
.escala-table th.day-header-pf {
    background: rgba(168, 85, 247, 0.2) !important;
    box-shadow: inset 0 3px 0 rgba(168, 85, 247, 0.5);
}
.escala-table td.day-cell-weekend {
    background: rgba(245, 158, 11, 0.12);
}
.escala-table td.day-cell-feriado {
    background: rgba(239, 68, 68, 0.14);
}
.escala-table td.day-cell-pf {
    background: rgba(168, 85, 247, 0.14);
}
.escala-table .day-num-domingo {
    color: #f87171 !important;
    font-weight: 800;
}
.escala-table .day-num-sabado {
    color: #fb923c !important;
    font-weight: 800;
}
.escala-table .day-num-feriado {
    color: #fca5a5 !important;
    font-weight: 800;
}
.escala-table .day-num-pf {
    color: #d8b4fe !important;
    font-weight: 800;
}
body.light-mode .escala-table th.day-header-weekend {
    background: rgba(245, 158, 11, 0.28) !important;
    box-shadow: inset 0 3px 0 rgba(217, 119, 6, 0.55);
}
body.light-mode .escala-table th.day-header-feriado {
    background: rgba(239, 68, 68, 0.22) !important;
    box-shadow: inset 0 3px 0 rgba(220, 38, 38, 0.55);
}
body.light-mode .escala-table th.day-header-pf {
    background: rgba(168, 85, 247, 0.22) !important;
    box-shadow: inset 0 3px 0 rgba(126, 34, 206, 0.5);
}
body.light-mode .escala-table td.day-cell-weekend {
    background: rgba(245, 158, 11, 0.2);
}
body.light-mode .escala-table td.day-cell-feriado {
    background: rgba(239, 68, 68, 0.18);
}
body.light-mode .escala-table td.day-cell-pf {
    background: rgba(168, 85, 247, 0.18);
}
body.light-mode .escala-table .day-num-domingo { color: #dc2626 !important; }
body.light-mode .escala-table .day-num-sabado { color: #ea580c !important; }
body.light-mode .escala-table .day-num-feriado { color: #b91c1c !important; }
body.light-mode .escala-table .day-num-pf { color: #7e22ce !important; }

/* =============================================================================
   Grade de escalas — camadas sticky (fonte única; programada + vivencial)
   z-index: nome(10) < head/foot(20) < cantos nome+head/foot(30)
   Sem crosshair, sem pointer-events hack, sem transform GPU.
   ============================================================================= */
.escala-wrapper {
    overflow: auto;
    max-height: 520px;
    position: relative;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.escala-wrapper::-webkit-scrollbar { height: 6px; width: 6px; }
.escala-wrapper::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.escala-table {
    --escala-z-nome: 10;
    --escala-z-head: 20;
    --escala-z-foot: 25;
    --escala-z-corner: 30;
    --escala-foot-row-h: 32px;
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    min-width: 800px;
}
.escala-table th,
.escala-table td {
    border-bottom: 1px solid var(--border-subtle);
    border-right: 1px solid var(--border-subtle);
    vertical-align: middle;
}
.escala-table th {
    padding: 8px 6px;
    background: var(--bg-elevated);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    text-align: center;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: var(--escala-z-head);
}
.escala-table th.col-nome {
    text-align: left;
    padding-left: 16px;
    left: 0;
    z-index: var(--escala-z-corner);
    min-width: 200px;
    max-width: 240px;
    box-shadow: 1px 0 0 var(--border-subtle), 0 1px 0 var(--border-subtle);
}
.escala-table td {
    padding: 0;
    background: var(--bg-base);
}
.escala-table tbody td.nome-cell {
    padding: 8px 12px;
    background: var(--bg-elevated);
    position: sticky;
    left: 0;
    z-index: var(--escala-z-nome);
    min-width: 230px;
    max-width: 280px;
    box-shadow: 1px 0 0 var(--border-subtle);
}

/* Efeito de hover em toda a linha da tabela para orientação do usuário */
.escala-table tbody tr:hover td {
    background: rgba(99, 102, 241, 0.06);
}
.escala-table tbody tr:hover td.nome-cell {
    background: rgba(99, 102, 241, 0.12);
    border-right: 2px solid var(--primary-light);
    box-shadow: 2px 0 0 var(--primary-light), 0 1px 0 var(--border-subtle);
}

/* Efeito de hover nas colunas (tabela) */
.escala-table td.col-hover,
.escala-table th.col-hover {
    background: rgba(6, 182, 212, 0.08) !important;
    border-left: 1px solid rgba(6, 182, 212, 0.3);
    border-right: 1px solid rgba(6, 182, 212, 0.3);
}

/* Efeito de hover nas colunas (grid) */
.escala-day-cell.col-hover,
.escala-col-header.col-hover {
    background: rgba(6, 182, 212, 0.08) !important;
    border-left: 1px solid rgba(6, 182, 212, 0.3);
    border-right: 1px solid rgba(6, 182, 212, 0.3);
}
.nome-cell-wrap {
    display: flex;
    align-items: flex-start;
    gap: 6px;
}
.nome-cell-main {
    min-width: 0;
    flex: 1;
}
.escala-btn-remover-prof {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    background: var(--bg-base);
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    z-index: 1;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.escala-btn-remover-prof:hover:not(:disabled) {
    color: var(--accent-red, #ef4444);
    border-color: rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.08);
}
.escala-btn-remover-prof:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.escala-btn-remover-prof.escala-remover-oculto {
    display: none !important;
}
.prof-nome {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.prof-mat { font-size: 10px; color: var(--text-muted); }
.prof-ch-badge {
    display: inline-block;
    padding: 1px 4px;
    font-size: 9px;
    font-weight: 700;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    margin-left: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
}
.escala-table tfoot td {
    padding: 8px;
    background: var(--bg-elevated) !important;
    font-size: 10px;
    font-weight: 700;
    text-align: center;
    color: var(--text-muted);
    border-top: 1px solid var(--border-subtle);
}
.escala-table tfoot tr.total-diurno-row td {
    position: sticky;
    bottom: var(--escala-foot-row-h);
    z-index: var(--escala-z-foot);
}
.escala-table tfoot tr.total-noturno-row td {
    position: sticky;
    bottom: 0;
    z-index: var(--escala-z-foot);
    box-shadow: 0 -1px 0 var(--border-subtle);
}
.escala-table tfoot td.nome-cell {
    text-align: left;
    padding-left: 16px;
    left: 0;
    z-index: var(--escala-z-corner);
    color: var(--primary-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 1px 0 0 var(--border-subtle);
}

/* Células de dia — largura uniforme; input preenche td (hit-test único) */
.escala-table thead th:not(.col-nome):not([rowspan]) {
    min-width: 38px;
    max-width: 40px;
}
.escala-table .day-cell,
.escala-table td[class*="day-cell-"] {
    width: 40px;
    min-width: 38px;
    max-width: 40px;
}
.escala-table .day-cell input.day-code-input,
.escala-table .day-cell select,
.escala-table td[class*="day-cell-"] input.day-code-input,
.escala-table td[class*="day-cell-"] select {
    display: block;
    width: 100%;
    min-height: 28px;
    box-sizing: border-box;
    border: none;
    background: inherit;
    color: var(--text-secondary);
    text-align: center;
    outline: none;
    cursor: text;
    appearance: none;
    font-family: inherit;
    text-transform: uppercase;
    padding: 5px 0;
    font-size: 10px;
    letter-spacing: -0.25px;
    line-height: 1.2;
    transition: none;
}
.escala-table .day-cell select,
.escala-table td[class*="day-cell-"] select {
    cursor: pointer;
}
.escala-table .day-cell input.day-code-input:focus-visible,
.escala-table .day-cell select:focus-visible,
.escala-table td[class*="day-cell-"] input.day-code-input:focus-visible,
.escala-table td[class*="day-cell-"] select:focus-visible {
    outline: 2px solid rgba(99, 102, 241, 0.55);
    outline-offset: -2px;
}
.escala-table td.cell-codigo-composto input.day-code-input {
    font-size: 9px;
    letter-spacing: -0.4px;
    font-weight: 800;
    padding: 4px 0;
}

/* Afastamentos na grade (FE, AT, L, BE) — uma célula por dia, mesmo tamanho dos inputs */
.escala-table td.day-cell-afastamento {
    width: 40px;
    min-width: 38px;
    max-width: 40px;
    padding: 0 !important;
    vertical-align: middle;
}
.escala-table td.day-cell-afastamento.day-cell-ferias-mesclada {
    width: auto;
    min-width: 0;
    max-width: none;
}
.afastamento-span-badge.afastamento-ferias-mesclada {
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.15px;
    text-transform: uppercase;
    cursor: help;
}
.afastamento-span-badge {
    display: block;
    width: 100%;
    min-height: 28px;
    height: 28px;
    line-height: 28px;
    font-size: 10px;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-radius: 0;
    box-sizing: border-box;
    padding: 0 2px;
    user-select: none;
    letter-spacing: -0.25px;
}
.afastamento-span-badge.code-FE,
.afastamento-span-badge.code-V {
    background: rgba(37, 99, 235, 0.15);
    color: #60a5fa;
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.35);
}
.afastamento-span-badge.code-L {
    background: rgba(147, 51, 234, 0.15);
    color: #c084fc;
    box-shadow: inset 0 0 0 1px rgba(147, 51, 234, 0.35);
}
.afastamento-span-badge.code-AT {
    background: rgba(225, 29, 72, 0.15);
    color: #f43f5e;
    box-shadow: inset 0 0 0 1px rgba(225, 29, 72, 0.35);
}
.afastamento-span-badge.code-BE {
    background: rgba(6, 182, 212, 0.15);
    color: #22d3ee;
    box-shadow: inset 0 0 0 1px rgba(6, 182, 212, 0.35);
    font-size: 9px;
}
body.light-mode .afastamento-span-badge.code-FE,
body.light-mode .afastamento-span-badge.code-V {
    background: rgba(37, 99, 235, 0.08);
    color: #2563eb;
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.25);
}
body.light-mode .afastamento-span-badge.code-L {
    background: rgba(147, 51, 234, 0.08);
    color: #9333ea;
    box-shadow: inset 0 0 0 1px rgba(147, 51, 234, 0.25);
}
body.light-mode .afastamento-span-badge.code-AT {
    background: rgba(225, 29, 72, 0.08);
    color: #e11d48;
    box-shadow: inset 0 0 0 1px rgba(225, 29, 72, 0.25);
}
body.light-mode .afastamento-span-badge.code-BE {
    background: rgba(8, 145, 178, 0.08);
    color: #0891b2;
    box-shadow: inset 0 0 0 1px rgba(8, 145, 178, 0.25);
}

/* Conflito de plantão (ocupação em outro setor/unidade — estilo SIEP3) */
.escala-table .td-dia-ocupado-outro {
    cursor: help;
    background: rgba(234, 179, 8, 0.45);
    box-shadow: inset 3px 0 0 rgba(234, 179, 8, 0.85);
}
.escala-table .cell-slots-parciais {
    background: rgba(234, 179, 8, 0.32) !important;
}
.escala-table .cell-ocupado-bloqueado {
    cursor: not-allowed;
    background: rgba(100, 116, 139, 0.28) !important;
    box-shadow: inset 3px 0 0 rgba(100, 116, 139, 0.75);
}
.escala-table .cell-conflito-rejeitado {
    background: rgba(239, 68, 68, 0.22) !important;
}
.escala-table input.day-code-input.day-code-rejeitado-flash {
    animation: escala-conflito-shake 0.45s ease;
    box-shadow: inset 0 0 0 2px #ef4444 !important;
}
@keyframes escala-conflito-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-3px); }
    40% { transform: translateX(3px); }
    60% { transform: translateX(-2px); }
    80% { transform: translateX(2px); }
}
.escala-table .td-dia-ocupado-outro input.day-code-input,
.escala-table .cell-ocupado-bloqueado input.day-code-input,
.escala-table .cell-dia-cartado-composto input.day-code-input {
    font-size: 8px;
    letter-spacing: -0.2px;
    line-height: 1.1;
    padding: 4px 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Placeholder sombreado (marca d'água) */
.escala-table input.day-code-input::placeholder {
    color: var(--text-muted);
    opacity: 0.15;
    font-weight: 600;
    font-size: 7.5px;
    letter-spacing: -0.15px;
}
.escala-table input.day-code-input:focus::placeholder {
    color: transparent;
    opacity: 0;
}
.escala-table input.day-code-input:focus-visible::placeholder {
    color: transparent;
    opacity: 0;
}
.escala-table .td-dia-ocupado-outro input.day-code-input:not(:focus):placeholder-shown::placeholder,
.escala-table .cell-slots-parciais input.day-code-input:not(:focus):placeholder-shown::placeholder {
    opacity: 0.72;
    color: #ca8a04;
    font-weight: 700;
}
.escala-table .cell-ocupado-bloqueado input.day-code-input::placeholder {
    opacity: 0.85;
    color: var(--text-muted);
    font-weight: 800;
}
.escala-table input.day-code-input.day-code-violacao {
    color: #b91c1c !important;
    background-color: rgba(239, 68, 68, 0.2) !important;
}

/* Chips de turno */
.escala-table input.day-code-input.day-code-plantao {
    color: var(--text-primary);
    background: rgba(148, 163, 184, 0.08);
    border-radius: 3px;
}
.escala-table input.day-code-input.day-code-extra {
    font-weight: 700;
    color: #fb923c !important;
    background: rgba(251, 146, 60, 0.14) !important;
    border-radius: 3px;
    box-shadow: inset 0 0 0 1px rgba(251, 146, 60, 0.45);
}
.escala-table input.day-code-input.day-code-afastamento {
    color: var(--text-muted);
    background: rgba(148, 163, 184, 0.12);
    border-radius: 3px;
}
.escala-table input.day-code-input.day-code-bloqueado,
.escala-table .cell-ocupado-bloqueado input.day-code-input {
    cursor: not-allowed !important;
    opacity: 0.45;
    pointer-events: none;
}

body.light-mode .escala-table .td-dia-ocupado-outro {
    background: rgba(234, 179, 8, 0.35);
}
body.light-mode .escala-table .cell-conflito-rejeitado {
    background: rgba(239, 68, 68, 0.15) !important;
}
body.light-mode .escala-table .td-dia-ocupado-outro input.day-code-input:not(:focus):placeholder-shown::placeholder,
body.light-mode .escala-table .cell-slots-parciais input.day-code-input:not(:focus):placeholder-shown::placeholder {
    color: #a16207;
}
body.light-mode .escala-table input.day-code-input.day-code-extra {
    color: #c2410c !important;
    background: rgba(251, 146, 60, 0.12) !important;
}
.escala-conflito-hint {
    margin: 0 0 12px 0;
    padding: 10px 14px;
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-elevated);
    border: 1px dashed var(--border);
    border-radius: 8px;
    line-height: 1.45;
}

/* FOCUS MODE */
.focus-toolbar { display: flex; align-items: center; gap: 8px; background: var(--bg-elevated); padding: 4px 12px; border-radius: var(--radius-md); border: 1px solid var(--border); }
.focus-input { background: transparent; border: none; color: var(--text-primary) !important; outline: none; width: 140px; font-size: 13px; }
.focus-btn { background: transparent; border: none; color: var(--text-secondary); cursor: pointer; padding: 4px; border-radius: 4px; transition: var(--transition-fast); display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; }
.focus-btn:hover:not(:disabled) { background: var(--bg-hover); color: var(--primary-light); }
.focus-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.focus-status { font-size: 12px; color: var(--text-muted); min-width: 45px; text-align: center; }
.escala-table.focus-mode-active tbody tr { display: none !important; }
.escala-table.focus-mode-active tbody tr.focus-row-active { display: table-row !important; }
.focus-row-active td { background: var(--primary-glow) !important; }


/* =============================================
   TABS DE NAVEGACAO
   ============================================= */
.page-tabs { display: flex; gap: 10px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab-btn { background: transparent; border: none; padding: 12px 20px; color: var(--text-secondary); font-size: 14px; font-weight: 500; cursor: pointer; border-bottom: 2px solid transparent; transition: var(--transition-fast); }
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fadeIn 0.3s ease-out forwards; }

.filter-sidebar { background: var(--bg-card); border-right: 1px solid var(--border); padding: 16px; border-radius: var(--radius-md) 0 0 var(--radius-md); }
.filter-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 6px; display: block; }
.filter-group { margin-bottom: 16px; }
.result-table-wrapper { flex: 1; padding: 16px; overflow-x: auto; }

/* =============================================
   MODO CLARO — REVISÃO GLOBAL DE CONTRASTE
   ============================================= */

body.light-mode .login-card {
    background: #ffffff;
    border-color: var(--border);
    box-shadow: var(--shadow-lg);
}

body.light-mode .login-title {
    background: linear-gradient(135deg, #0f172a, var(--primary-light));
    -webkit-background-clip: text;
    background-clip: text;
}

body.light-mode .login-bg-orb { opacity: 0.12; }

body.light-mode .form-input,
body.light-mode .form-select,
body.light-mode textarea.form-input {
    background: #ffffff;
    border-color: var(--border);
    color: var(--text-primary);
}

body.light-mode .form-input:focus,
body.light-mode .form-select:focus {
    background: #ffffff;
    border-color: var(--primary);
}

body.light-mode .alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: #b91c1c;
    border-color: rgba(239, 68, 68, 0.35);
}

body.light-mode .alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: #047857;
    border-color: rgba(16, 185, 129, 0.35);
}

body.light-mode .data-table th {
    background: #f1f5f9;
    color: #334155;
}

body.light-mode .data-table td {
    color: var(--text-secondary);
}

body.light-mode .data-table tbody tr:hover td {
    background: rgba(99, 102, 241, 0.06);
    color: var(--text-primary);
}

body.light-mode .modal-overlay {
    background: rgba(15, 23, 42, 0.45);
}

body.light-mode .modal {
    background: var(--bg-card);
    border-color: var(--border);
    color: var(--text-primary);
}

body.light-mode .modal-title,
body.light-mode .table-title,
body.light-mode .page-header h1 {
    color: var(--text-primary);
}

body.light-mode .page-header p {
    color: var(--text-secondary);
}

body.light-mode .btn-secondary {
    background: #f8fafc;
    border-color: var(--border);
    color: var(--text-primary);
}

body.light-mode .btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--primary-light);
}

body.light-mode .sidebar,
body.light-mode .topbar,
body.light-mode .portal-bottom-nav {
    background: var(--sidebar-bg);
    border-color: var(--border-subtle);
}

body.light-mode .nav-item { color: var(--text-secondary); }
body.light-mode .nav-item:hover,
body.light-mode .nav-item.active {
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.08);
}

body.light-mode .breadcrumb-current,
body.light-mode .topbar-user span {
    color: var(--text-primary);
}

body.light-mode .empty-state .empty-text {
    color: var(--text-muted);
}

/* Portal do profissional */
body.light-mode .portal-welcome {
    background: var(--portal-welcome-bg);
    border-color: var(--border);
    box-shadow: var(--shadow-md);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

body.light-mode .portal-welcome-left h2,
body.light-mode .portal-card-title,
body.light-mode .portal-section h4,
body.light-mode .portal-welcome h3,
body.light-mode .portal-welcome h4 {
    color: var(--text-primary) !important;
}

body.light-mode .portal-meta-badge {
    background: var(--bg-elevated);
    border-color: var(--border);
    color: var(--text-primary);
    box-shadow: none;
}

body.light-mode .portal-card {
    background: var(--portal-card-bg);
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
}

body.light-mode .portal-card-header {
    border-bottom-color: var(--border-subtle);
}

body.light-mode .chat-bubble {
    background: var(--portal-chat-bubble);
    border-color: var(--border);
}

body.light-mode .chat-bubble.mine {
    background: var(--portal-chat-mine);
    border-color: rgba(14, 165, 233, 0.35);
}

body.light-mode .chat-bubble-text {
    color: var(--text-primary);
}

body.light-mode .chat-input {
    background: var(--portal-input-bg);
    border-color: var(--border);
    color: var(--text-primary);
}

body.light-mode .chat-messages::-webkit-scrollbar-thumb {
    background: rgba(15, 23, 42, 0.2);
}

body.light-mode .calendar-day-cell {
    background: #f8fafc;
    border-color: var(--border-subtle);
}

body.light-mode .calendar-day-cell:hover {
    background: var(--bg-hover);
    border-color: var(--border);
}

body.light-mode .calendar-day-num {
    color: var(--text-secondary);
}

body.light-mode .sector-table th {
    background: var(--portal-sticky-head);
    color: var(--text-primary);
    border-bottom-color: var(--border);
}

body.light-mode .sector-table td {
    color: var(--text-secondary);
    border-bottom-color: var(--border-subtle);
}

body.light-mode .sector-table th:first-child,
body.light-mode .sector-table td:first-child {
    background: var(--bg-card);
    border-right-color: var(--border);
}

body.light-mode .sector-table tr.mine td {
    color: var(--text-primary);
}

body.light-mode .sector-table tr.mine td:first-child {
    background: var(--portal-sticky-mine);
}

body.light-mode .portal-list-card {
    background: var(--bg-elevated) !important;
    border-color: var(--border) !important;
}

body.light-mode .portal-list-card,
body.light-mode .portal-list-card strong {
    color: var(--text-primary) !important;
}

body.light-mode .portal-list-card .portal-list-muted {
    color: var(--text-secondary) !important;
}

body.light-mode .portal-bnav-item.active {
    color: var(--primary-light);
}

/* Permutas (página gestor) */
body.light-mode .permutas-stat-card {
    background: var(--bg-card);
    border-color: var(--border);
}

body.light-mode .permutas-stat-card::after {
    background: linear-gradient(105deg, rgba(99, 102, 241, 0.06) 0%, transparent 42%);
}

body.light-mode .permuta-flow-card {
    background: var(--bg-elevated);
    border-color: var(--border);
}

body.light-mode .permuta-day-badge .day-num {
    color: var(--text-primary);
}

body.light-mode .custom-modal-overlay {
    background: rgba(15, 23, 42, 0.5);
}

body.light-mode .custom-modal-content {
    background: var(--bg-card);
    border-color: var(--border);
}

body.light-mode .custom-modal-header h2,
body.light-mode .modal-prof-name {
    color: var(--text-primary);
}

body.light-mode .modal-prof-card,
body.light-mode .modal-shift-info {
    background: var(--bg-elevated);
    border-color: var(--border-subtle);
}

body.light-mode .prof-badge-avatar {
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary-light);
}

body.light-mode .escala-table th,
body.light-mode .escala-table td {
    border-color: var(--border-subtle);
}

body.light-mode .escala-table input,
body.light-mode .escala-table select {
    color: var(--text-primary);
    background: #ffffff;
}

body.light-mode .badge-secondary {
    background: #e2e8f0;
    color: #334155;
}

body.light-mode .loading,
body.light-mode .spinner {
    color: var(--text-muted);
}

body.light-mode .page-footer,
body.light-mode .page-footer-system {
    color: var(--text-muted);
}

body.light-mode .bar-label {
    color: var(--text-secondary);
}

body.light-mode .bar-value {
    color: var(--text-primary);
}

body.light-mode .stepper-label {
    color: var(--text-secondary);
}

body.light-mode .stepper-step.completed .stepper-label,
body.light-mode .stepper-step.active .stepper-label {
    color: var(--text-primary);
}

body.light-mode .ponto-validacao-card,
body.light-mode .validacao-ponto-item,
body.light-mode .validacao-card {
    background: var(--bg-card);
    border-color: var(--border);
    color: var(--text-primary);
}

body.light-mode .validacao-prof-info h3,
body.light-mode .validacao-detail-row {
    color: var(--text-primary);
}

body.light-mode .validacao-actions-panel {
    background: var(--bg-elevated);
    border-left-color: var(--border-subtle);
}

body.light-mode .ponto-validacao-card strong,
body.light-mode .validacao-ponto-item strong {
    color: var(--text-primary) !important;
}

body.light-mode .lic-tab {
    color: var(--text-secondary);
    border-color: var(--border);
}

body.light-mode .lic-tab.active {
    color: #ffffff;
}

/* Apuração de Ponto — espelho mensal (estilo Ahgora) */
.ponto-apuracao-toolbar { margin-bottom: 16px; padding: 16px; }
.ponto-apuracao-filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.ponto-apuracao-legenda { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; font-size: 11px; color: var(--text-muted); }
.ponto-leg-item i { font-size: 8px; margin-right: 4px; }
.ponto-leg-item.sit-ok i { color: var(--status-success, #10b981); }
.ponto-leg-item.sit-pendente i { color: var(--status-warning, #f59e0b); }
.ponto-leg-item.sit-falta i { color: var(--status-danger, #ef4444); }
.ponto-leg-item.sit-afastamento i { color: #60a5fa; }
.ponto-leg-item.sit-folga i { color: #a78bfa; }
.ponto-leg-item.sit-sem i { color: var(--text-muted); }

.ponto-apuracao-layout { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
@media (max-width: 1100px) {
    .ponto-apuracao-layout { grid-template-columns: 1fr; }
}
.ponto-apuracao-main { padding: 0; overflow: hidden; min-height: 320px; }
.ponto-apuracao-detalhe { padding: 16px; position: sticky; top: 12px; max-height: calc(100vh - 100px); overflow-y: auto; }
.ponto-detalhe-placeholder { text-align: center; color: var(--text-muted); padding: 40px 16px; }
.ponto-detalhe-placeholder i { font-size: 28px; margin-bottom: 12px; opacity: 0.5; }

.ponto-espelho-scroll { overflow-x: auto; }
.ponto-espelho-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.ponto-espelho-table th, .ponto-espelho-table td { border: 1px solid var(--border-subtle); padding: 4px 2px; text-align: center; }
.ponto-espelho-table th.col-prof, .ponto-espelho-table td.col-prof { text-align: left; padding: 8px 10px; min-width: 160px; position: sticky; left: 0; background: var(--bg-card); z-index: 2; }
.ponto-espelho-table th.col-dia { min-width: 28px; font-weight: 600; color: var(--text-muted); }
.ponto-espelho-table th.col-dia.weekend { background: var(--bg-elevated); }
.ponto-espelho-table th.col-resumo, .ponto-espelho-table td.col-resumo { min-width: 72px; }
.prof-nome-apur { font-weight: 600; font-size: 12px; color: var(--text-primary); }
.prof-mat-apur { font-size: 10px; color: var(--text-muted); }

.ponto-cel { cursor: pointer; transition: transform 0.1s, box-shadow 0.15s; }
.ponto-cel:hover { transform: scale(1.08); z-index: 1; box-shadow: 0 0 0 2px var(--primary-light); }
.ponto-cel-label { font-size: 9px; font-weight: 700; }
.ponto-cel.sit-ok { background: rgba(16, 185, 129, 0.18); color: #10b981; }
.ponto-cel.sit-pendente { background: rgba(245, 158, 11, 0.18); color: #f59e0b; }
.ponto-cel.sit-falta { background: rgba(239, 68, 68, 0.2); color: #ef4444; }
.ponto-cel.sit-rejeitado { background: rgba(239, 68, 68, 0.12); color: #f87171; }
.ponto-cel.sit-afastamento { background: rgba(37, 99, 235, 0.12); color: #60a5fa; }
.ponto-cel.sit-folga { background: rgba(147, 51, 234, 0.12); color: #c084fc; }
.ponto-cel.sit-sem_plantao { background: var(--bg-elevated); color: var(--text-muted); }

.ponto-resumo-chip { display: inline-block; font-size: 9px; font-weight: 700; padding: 1px 4px; border-radius: 4px; margin: 0 1px; }
.ponto-resumo-chip.ok { background: rgba(16,185,129,0.2); color: #10b981; }
.ponto-resumo-chip.pend { background: rgba(245,158,11,0.2); color: #f59e0b; }
.ponto-resumo-chip.falta { background: rgba(239,68,68,0.2); color: #ef4444; }

.ponto-detalhe-header h3 { margin: 0 0 4px; font-size: 15px; }
.ponto-detalhe-grid { margin: 16px 0; }
.ponto-detalhe-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border-subtle); font-size: 12px; }
.ponto-detalhe-row .lbl { color: var(--text-muted); }
.ponto-detalhe-row .val { font-weight: 600; }
.ponto-acerto-form h4, .ponto-historico h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin: 0 0 8px; }
.ponto-acerto-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.ponto-historico ul { margin: 0; padding-left: 16px; font-size: 11px; color: var(--text-muted); }

.ponto-import-ahgora { padding: 16px; }
.ponto-import-title { margin: 0 0 8px; font-size: 14px; }
.ponto-import-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.ponto-import-result { margin-top: 12px; font-size: 12px; }
.ponto-import-erros { margin: 8px 0 0; padding-left: 18px; color: var(--status-danger, #ef4444); }

.ponto-batidas-timeline h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin: 0 0 8px; }
.ponto-batidas-list { list-style: none; margin: 0; padding: 0; }
.ponto-batidas-list li { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--border-subtle); font-size: 12px; }
.ponto-batida-tipo { font-weight: 600; min-width: 52px; color: var(--primary-light); }
.ponto-batida-hora { font-variant-numeric: tabular-nums; font-weight: 600; }
.ponto-batida-meta { color: var(--text-muted); font-size: 11px; }
