
:root {
    --bg-dark: #050505;
    --bg-panel: #0d0d0d;
    --accent-blue: #3b82f6;
    --text-muted: #6b7280;

    /* White opacity scale */
    --w02: rgba(255, 255, 255, 0.02);
    --w03: rgba(255, 255, 255, 0.03);
    --w05: rgba(255, 255, 255, 0.05);
    --w06: rgba(255, 255, 255, 0.06);
    --w07: rgba(255, 255, 255, 0.07);
    --w08: rgba(255, 255, 255, 0.08);
    --glass-bg: var(--w03);
    --glass-border: var(--w08);

    /* Z-index scale */
    --z-content: 10;
    --z-header: 30;
    --z-popup: 40;
    --z-sidebar: 100;
    --z-mobile-overlay: 149;
    --z-mobile-sidebar: 150;
    --z-mobile-toggle: 200;
    --z-modal: 300;
    --z-modal-nested: 350;
    --z-notif-overlay: 400;
    --z-notif: 410;
    --z-toast: 500;
}

@keyframes nl-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

body {
    background-color: var(--bg-dark);
    color: #ffffff;
    font-family: 'Inter', sans-serif;
    margin: 0;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

.main-content {
    animation: nl-fade-in 180ms ease both;
}

.liquid-glass {
    background: var(--w02);
    backdrop-filter: blur(24px);
    border: none;
    border-radius: 2rem;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.liquid-glass-bordered {
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: 2rem;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.liquid-glass-bordered:hover {
    border-color: rgba(59, 130, 246, 0.3);
    background: var(--w05);
}

.text-glow { text-shadow: 0 0 40px rgba(59, 130, 246, 0.4); }

/* Clean Modern Sidebar */
.sidebar {
    width: 280px;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    padding: 0;
    background: #050505;
    border-right: 1px solid var(--w05);
    z-index: var(--z-sidebar);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 2.5rem 1.5rem 1rem;
    flex-shrink: 0;
}

.sidebar-nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0 1.5rem;
    scrollbar-gutter: stable;
}

.sidebar-footer {
    padding: 0.75rem 1.5rem 1.5rem;
    flex-shrink: 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 16px; /* Espaço fixo entre ícone e texto */
    padding: 0.85rem 1.25rem;
    margin-bottom: 0.25rem;
    border-radius: 0.75rem;
    color: #555;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    transition: all 0.2s ease;
}

.sidebar-link i, .sidebar-link svg {
    width: 18px;
    height: 18px;
    opacity: 0.5;
    flex-shrink: 0;
}

/* Chat Specific Styles */
.chat-layout {
    display: flex;
    height: calc(100vh - 8rem); /* Descontando breadcrumbs e padding */
    gap: 2rem;
}

.chat-channels {
    width: 240px;
    flex-shrink: 0;
    border-right: 1px solid var(--w03);
    padding-right: 2rem;
}

.channel-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    color: #444;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    transition: all 0.2s;
}

.channel-link:hover, .channel-link.active {
    color: #fff;
    background: var(--w03);
}

/* Email Viewer Styles */
.email-list {
    width: 350px;
    border-right: 1px solid var(--w05);
    overflow-y: auto;
}

.email-item {
    padding: 1.5rem;
    border-bottom: 1px solid var(--w03);
    cursor: pointer;
    transition: all 0.2s;
}

.email-item:hover {
    background: var(--w02);
}

.email-item.active {
    background: rgba(59, 130, 246, 0.05);
    border-right: 2px solid var(--accent-blue);
}

/* Resource Grid */
.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
}

.resource-card {
    padding: 1.5rem;
    text-align: center;
    border-radius: 1.5rem;
    background: var(--w02);
    transition: all 0.3s;
    cursor: pointer;
}

.resource-card:hover {
    background: var(--w05);
    transform: translateY(-5px);
}

/* Calendar Styles */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--w05);
    border: 1px solid var(--w05);
    border-radius: 1.5rem;
    overflow: hidden;
}

.calendar-day {
    aspect-ratio: 1;
    padding: 1.5rem;
    background: #050505;
    transition: all 0.2s;
}

.calendar-day:hover {
    background: var(--w02);
}

.calendar-day.today {
    background: rgba(59, 130, 246, 0.03);
}

.calendar-day.today .day-number {
    color: var(--accent-blue);
}

.day-number {
    font-size: 10px;
    font-weight: 900;
    color: #333;
    margin-bottom: 1rem;
    display: block;
}

.event-tag {
    font-size: 8px;
    padding: 4px 8px;
    border-radius: 4px;
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-blue);
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Kanban Board */
.kanban-board {
    display: flex;
    gap: 2rem;
    overflow-x: auto;
    padding-bottom: 2rem;
}

.kanban-column {
    flex: 1;
    min-width: 300px;
}

.kanban-header {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
}

.kanban-card {
    background: var(--w02);
    border: 1px solid var(--w05);
    padding: 1.5rem;
    border-radius: 1.5rem;
    margin-bottom: 1rem;
    cursor: grab;
    transition: all 0.3s;
}

.kanban-card:hover {
    border-color: rgba(59, 130, 246, 0.3);
    transform: translateY(-3px);
}

.sidebar-link:hover {
    color: #fff;
    background: var(--w03);
}

.sidebar-link.active {
    color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.1);
    box-shadow: inset 3px 0 0 var(--accent-blue);
}

.sidebar-link.active i,
.sidebar-link.active svg {
    color: var(--accent-blue);
    opacity: 1;
}

.sidebar-section-label {
    font-size: 9px;
    font-weight: 900;
    color: #222;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    margin: 2.5rem 0 1rem 1rem;
}

/* Breadcrumbs (Ladder path) */
.ladder-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: #333;
    margin-bottom: 3rem;
}

.ladder-breadcrumb span.active {
    color: var(--accent-blue);
}

.role-badge {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    padding: 4px 12px;
    border-radius: 99px;
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-blue);
}

.btn-pill {
    border-radius: 9999px;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 0.2em;
    font-size: 9px;
    gap: 8px;
    cursor: pointer;
    border: none;
}
.btn-pill:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
    padding: 0.75rem 2rem;
    background: #3b82f6;
    color: #fff;
    box-shadow: 0 8px 32px rgba(59, 130, 246, 0.2);
}
.btn-primary:hover:not(:disabled) { background: #2563eb; transform: translateY(-1px); }

.btn-primary-full {
    width: 100%;
    padding: 1rem;
    background: #3b82f6;
    color: #fff;
    font-size: 11px;
    font-weight: 900;
    box-shadow: 0 10px 40px rgba(59, 130, 246, 0.3);
}
.btn-primary-full:hover:not(:disabled) { background: #2563eb; box-shadow: 0 15px 50px rgba(59, 130, 246, 0.4); transform: translateY(-1px); }

.btn-secondary {
    padding: 0.75rem 2rem;
    background: var(--w03);
    border: 1px solid var(--w08) !important;
    color: #d1d5db;
}
.btn-secondary:hover:not(:disabled) { background: var(--w06); color: #fff; }

.btn-success {
    padding: 0.75rem 2rem;
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.3) !important;
    color: #22c55e;
}
.btn-success:hover:not(:disabled) { background: rgba(34, 197, 94, 0.18); border-color: rgba(34, 197, 94, 0.5) !important; }

.btn-danger {
    padding: 0.75rem 2rem;
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.3) !important;
    color: rgba(239, 68, 68, 0.7);
}
.btn-danger:hover:not(:disabled) { background: rgba(239, 68, 68, 0.06); color: #ef4444; border-color: rgba(239, 68, 68, 0.5) !important; }

.btn-ghost {
    padding: 0.75rem 2rem;
    background: var(--w03);
    border: 1px solid var(--w06) !important;
    color: #6b7280;
}
.btn-ghost:hover { background: var(--w05); color: #fff; }

.tab-btn {
    padding: 8px 20px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: #555;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    background: transparent;
}
.tab-btn.active { background: var(--w06); color: #fff; }

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: #050505; }
::-webkit-scrollbar-thumb { background: #1a1a1a; border-radius: 20px; }

/* ── Form fields — force dark theme across all pages ─────────────────────── */

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
select,
textarea {
    background-color: var(--w03) !important;
    color: #ffffff !important;
    border-color: var(--w08);
    -webkit-text-fill-color: #ffffff;
    color-scheme: dark;
}

.empty-state {
    font-size: 9px;
    color: #374151;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    padding: 2rem 0;
}

.form-input {
    width: 100%;
    background: var(--w03);
    border: 1px solid var(--w07);
    border-radius: 0.875rem;
    padding: 0.875rem 1rem;
    color: #fff;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
.form-input:focus { border-color: rgba(59, 130, 246, 0.5); }
.form-input::placeholder { color: #2a2a2a; }

.form-otp {
    width: 100%;
    background: var(--w03);
    border: 1px solid var(--w07);
    border-radius: 0.875rem;
    padding: 1rem;
    color: #fff;
    font-size: 24px;
    font-family: monospace;
    font-weight: 900;
    letter-spacing: 0.4em;
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
}
.form-otp:focus { border-color: rgba(59, 130, 246, 0.5); }
.form-otp::placeholder { color: #222; }

/* Browser autocomplete override */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #0d0d0d inset !important;
    -webkit-text-fill-color: #ffffff !important;
    caret-color: #ffffff;
}

select option {
    background-color: #0d0d0d;
    color: #ffffff;
}

/* Panel form fields — ensures dark inputs inside modals, drawers, popups */
#nl-modal input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
#nl-modal select, #nl-modal textarea,
#nl-drawer input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
#nl-drawer select, #nl-drawer textarea,
[id$="-modal"] input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
[id$="-modal"] select, [id$="-modal"] textarea {
    background-color: var(--w03) !important;
    color: #fff !important;
    border-color: var(--w08) !important;
    -webkit-text-fill-color: #fff !important;
}

/* Role-gated financial values — blurred for non-admin */
.restricted-value { transition: filter .2s; }
body:not(.is-admin) .restricted-value { filter: blur(8px); pointer-events: none; user-select: none; }

/* Dashboard Titles */
.page-title {
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    text-transform: uppercase;
}

/* ── Notification panel ─────────────────────────────────────────────────── */
#nl-notif-panel {
    position: fixed; top: 0; right: 0; bottom: 0; width: 360px;
    background: #070707; border-left: 1px solid var(--w06);
    z-index: var(--z-notif); display: flex; flex-direction: column;
    transform: translateX(100%);
    transition: transform .25s cubic-bezier(0.16,1,0.3,1);
    box-shadow: -24px 0 60px rgba(0,0,0,.7);
}
#nl-notif-panel.open  { transform: translateX(0); }

#nl-notif-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.45); z-index: var(--z-notif-overlay);
}
#nl-notif-overlay.visible { display: block; }

.nl-bell-badge {
    display: flex; align-items: center; justify-content: center;
    position: absolute; top: -5px; right: -5px;
    min-width: 16px; height: 16px; border-radius: 99px;
    background: #ef4444; color: #fff;
    font-size: 7px; font-weight: 900; letter-spacing: 0;
    padding: 0 3px; border: 2px solid #050505;
}
.nl-bell-badge.hidden { display: none; }

.notif-item {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 10px 12px; border-radius: 10px;
    transition: background .12s; cursor: pointer;
    text-decoration: none; border: 1px solid transparent;
    color: inherit;
}
.notif-item:hover  { background: var(--w03); }
.notif-item.n-warn { border-color: rgba(249,115,22,.15); }
.notif-item.n-err  { border-color: rgba(239,68,68,.15);  }
.notif-dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }

/* ── Notification prompt ────────────────────────────────────────────────── */
.notif-prompt {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 12px 16px; margin-bottom: 1.5rem; border-radius: 1rem;
    background: rgba(59,130,246,.05); border: 1px solid rgba(59,130,246,.12);
}

/* ── Offline banner ─────────────────────────────────────────────────────── */
.offline-banner {
    position: fixed; top: 0; left: 280px; right: 0; z-index: var(--z-toast);
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 8px 16px; font-size: 11px; font-weight: 700;
    background: rgba(239, 68, 68, 0.12); color: #f87171;
    border-bottom: 1px solid rgba(239, 68, 68, 0.2);
    transform: translateY(-100%); transition: transform .3s cubic-bezier(0.16,1,0.3,1);
    pointer-events: none;
}
.offline-banner.visible { transform: translateY(0); }
.offline-banner.online { background: rgba(34,197,94,0.12); color: #4ade80; border-color: rgba(34,197,94,0.2); }
body.is-offline button:not(#nl-logout-btn):not(#nl-bell-btn):not(#nl-search-btn):not(#nl-mobile-toggle):not([data-offline-ok]) {
    opacity: 0.4; pointer-events: none;
}
body.is-offline a.sidebar-link { opacity: 1; pointer-events: auto; }
body.is-offline input, body.is-offline textarea, body.is-offline select { opacity: 0.5; pointer-events: none; }

@media (max-width: 768px) {
    .offline-banner { left: 0; }
}

/* ── Search palette (Ctrl+K) ────────────────────────────────────────────── */
.search-overlay {
    position: fixed; inset: 0; z-index: var(--z-modal);
    background: rgba(0,0,0,.65); backdrop-filter: blur(4px);
    display: flex; align-items: flex-start; justify-content: center;
    padding-top: min(20vh, 160px);
}
.search-palette {
    width: min(580px, 92vw);
    background: #0a0a0a; border: 1px solid var(--w08);
    border-radius: 1.25rem; overflow: hidden;
    box-shadow: 0 25px 60px rgba(0,0,0,.7), 0 0 0 1px rgba(255,255,255,.03);
}
.search-input-row {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 20px; border-bottom: 1px solid var(--w05);
}
.search-input-row input {
    flex: 1; background: transparent; border: none; outline: none;
    color: #fff; font-size: 15px; font-weight: 500;
    font-family: 'Inter', sans-serif;
}
.search-input-row input::placeholder { color: #444; }
.search-kbd {
    padding: 2px 7px; border-radius: 6px; font-size: 10px; font-weight: 700;
    color: #555; background: var(--w05); border: 1px solid var(--w08);
    font-family: 'Inter', sans-serif; line-height: 1.6;
}
.search-results {
    max-height: 380px; overflow-y: auto; padding: 8px;
}
.search-hint {
    text-align: center; padding: 2rem 1rem;
    color: #444; font-size: 12px; font-weight: 600;
}
.search-group { margin-bottom: 4px; }
.search-group-label {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 12px; font-size: 9px; font-weight: 900;
    text-transform: uppercase; letter-spacing: 0.3em; color: #555;
}
.search-result {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px; border-radius: 10px;
    transition: background .1s; text-decoration: none; color: inherit;
}
.search-result:hover { background: var(--w05); }
.search-result-icon {
    width: 30px; height: 30px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

/* ── Audit Trail Diff ──────────────────────────────────────────────────── */
.diff-view {
    display: flex; flex-direction: column; gap: 4px;
    padding: 8px 12px; margin-top: 6px;
    background: rgba(255,255,255,0.02); border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.05);
}
.diff-row {
    display: flex; align-items: center; gap: 8px;
    font-size: 10px; font-family: monospace;
}
.diff-field {
    color: rgba(255,255,255,0.4); font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.1em;
    min-width: 90px; flex-shrink: 0;
}
.diff-before { color: #f87171; }
.diff-arrow  { color: rgba(255,255,255,0.2); }
.diff-after  { color: #4ade80; }
.log-expand-btn {
    cursor: pointer; opacity: 0.3; transition: opacity 0.2s;
    width: 14px; height: 14px; flex-shrink: 0;
}
.log-expand-btn:hover { opacity: 0.7; }
.log-expand-btn.active { opacity: 0.8; transform: rotate(90deg); }
.log-diff-row { display: none; }
.log-diff-row.open { display: table-row; }

/* ── Undo Toast ────────────────────────────────────────────────────���──── */
.undo-toast { position: relative; overflow: hidden; min-width: 280px; }
.undo-toast-bar {
    position: absolute; bottom: 0; left: 0; height: 2px; width: 100%;
    background: rgba(234,179,8,0.4); border-radius: 0 0 1rem 1rem;
}

/* ── Bulk Selection ────────────────────────────────────────────────────── */
.bulk-bar {
    position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%) translateY(20px);
    display: none; align-items: center; gap: 16px;
    padding: 12px 20px; border-radius: 9999px;
    background: #111; border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    z-index: var(--z-modal); opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
}
.bulk-bar.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.bulk-bar-count {
    font-size: 11px; font-weight: 800; color: white;
    white-space: nowrap; letter-spacing: 0.05em;
}
.bulk-bar-actions { display: flex; gap: 8px; }
.bulk-bar-clear {
    display: flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 50%;
    background: rgba(255,255,255,0.05); border: none; color: rgba(255,255,255,0.4);
    cursor: pointer; transition: background 0.2s;
}
.bulk-bar-clear:hover { background: rgba(255,255,255,0.1); color: white; }
.bulk-cb {
    appearance: none; width: 16px; height: 16px; border-radius: 4px;
    border: 1.5px solid rgba(255,255,255,0.15); background: transparent;
    cursor: pointer; transition: all 0.15s; flex-shrink: 0;
    position: relative;
}
.bulk-cb:hover { border-color: rgba(255,255,255,0.3); }
.bulk-cb:checked {
    background: #3b82f6; border-color: #3b82f6;
}
.bulk-cb:checked::after {
    content: ''; position: absolute; top: 2px; left: 5px;
    width: 4px; height: 8px;
    border: solid white; border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* ── Mobile responsive ────────────────────────────────────────────────────────── */
#nl-mobile-toggle {
    display: none;
    position: fixed; top: .9rem; left: .9rem; z-index: var(--z-mobile-toggle);
    width: 40px; height: 40px; border-radius: 11px;
    background: rgba(5,5,5,.92); border: 1px solid rgba(255,255,255,.09);
    align-items: center; justify-content: center;
    color: #fff; cursor: pointer; backdrop-filter: blur(12px);
}

#nl-mobile-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.6); z-index: var(--z-mobile-overlay);
}
#nl-mobile-overlay.visible { display: block; }

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .25s cubic-bezier(0.16,1,0.3,1);
        z-index: var(--z-mobile-sidebar);
    }
    .sidebar.mobile-open  { transform: translateX(0); }
    .main-content         { margin-left: 0 !important; width: 100% !important; padding: 2rem 1.5rem !important; }
    #nl-mobile-toggle     { display: flex; }
    #nl-notif-panel       { width: min(360px, 92vw); }
}
