/* === LAYOUT: login, sidebar, topbar === */

/* ── Login ─────────────────────────────────────────────────────────────────── */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: radial-gradient(ellipse at 60% 20%, rgba(0,168,255,.08) 0%, transparent 60%),
                radial-gradient(ellipse at 20% 80%, rgba(13,62,122,.12) 0%, transparent 50%),
                var(--bg);
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 24px 64px rgba(0,0,0,.4);
}

.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    margin-bottom: 1.75rem;
}
.login-logo-icon {
    width: 44px; height: 44px;
    background: linear-gradient(135deg, var(--blue), #0d3e7a);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; color: #fff;
    box-shadow: 0 4px 16px rgba(0,168,255,.25);
}
.login-logo-text {
    text-align: left;
    line-height: 1.2;
}
.login-logo-text strong { font-size: 1rem; font-weight: 700; color: var(--text); display: block; }
.login-logo-text span   { font-size: 0.72rem; color: var(--text2); }

.login-card h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.3rem; }
.login-card > p { color: var(--text2); font-size: 0.82rem; margin-bottom: 2rem; }

.step-indicator {
    background: rgba(0,168,255,.08);
    border: 1px solid rgba(0,168,255,.2);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-size: 0.78rem;
    color: var(--blue);
    font-weight: 500;
    margin-bottom: 1.5rem;
    display: inline-block;
}

.form-group { margin-bottom: 1.25rem; text-align: left; }
.form-group label { display: block; margin-bottom: 0.4rem; font-size: 0.82rem; font-weight: 500; color: var(--text2); }
.form-group input {
    width: 100%; padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: 0.9rem;
    transition: border-color .2s;
}
.form-group input:focus { outline: none; border-color: var(--orange); }

#mfaInput { text-align: center; font-size: 1.6rem; letter-spacing: 10px; font-weight: 700; }

.mfa-instructions { color: var(--text2); font-size: 0.8rem; margin-bottom: 0.75rem; }
.mfa-timer-bar { margin-bottom: 1rem; }
.mfa-timer-bar span { font-size: 0.75rem; color: var(--yellow); }

.btn-primary {
    width: 100%; padding: 10px 16px;
    background: linear-gradient(135deg, var(--orange), var(--orange2));
    color: #fff; border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem; font-weight: 600;
    cursor: pointer;
    transition: opacity .2s, transform .15s;
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
}
.btn-primary:hover { opacity: .9; transform: translateY(-1px); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.error-msg { color: var(--red); margin-top: 0.75rem; font-size: 0.8rem; min-height: 1.1rem; }

/* ── Dashboard shell ────────────────────────────────────────────────────────── */
.dashboard { display: flex; min-height: 100vh; }

/* ── Sidebar ────────────────────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    min-height: 100vh;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    z-index: 200;
    transition: width .25s ease;
}
.sidebar.collapsed { width: var(--sidebar-collapsed); }

.sidebar-logo {
    height: var(--topbar-h);
    display: flex; align-items: center;
    padding: 0 1rem;
    border-bottom: 1px solid var(--border);
    gap: 0.75rem;
    overflow: hidden;
    white-space: nowrap;
}
.sidebar-logo-icon {
    width: 32px; height: 32px; flex-shrink: 0;
    background: linear-gradient(135deg, var(--blue), #0d3e7a);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.9rem; color: #fff;
}
.sidebar-logo-text { font-size: 0.85rem; font-weight: 700; color: var(--text); }

.sidebar-nav { flex: 1; padding: 0.75rem 0; overflow: hidden; }

.nav-section-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text3);
    padding: 0.5rem 1.1rem 0.25rem;
    white-space: nowrap;
    overflow: hidden;
}
.sidebar.collapsed .nav-section-label { opacity: 0; }

.nav-item {
    display: flex; align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.1rem;
    color: var(--text2);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 0;
    transition: background .15s, color .15s;
    white-space: nowrap;
    overflow: hidden;
    border: none; background: none; width: 100%; text-align: left;
    position: relative;
}
.nav-item:hover { background: rgba(255,255,255,.04); color: var(--text); }
.nav-item.active {
    background: rgba(0,168,255,.1);
    color: var(--blue);
    border-right: 2px solid var(--blue);
}
.nav-item.active .nav-icon { color: var(--orange); }
.nav-icon {
    width: 20px; height: 20px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.9rem; color: var(--text3);
}
.nav-label { flex: 1; }
.nav-bot-badge {
    background: var(--green);
    color: #fff;
    font-size: 0.6rem;
    padding: 1px 5px;
    border-radius: 10px;
    font-weight: 700;
}

.sidebar-footer {
    padding: 0.75rem 0;
    border-top: 1px solid var(--border);
}

.sidebar-toggle {
    display: flex; align-items: center; justify-content: center;
    width: 28px; height: 28px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    color: var(--text2);
    font-size: 0.7rem;
    position: absolute;
    right: -14px; top: calc(var(--topbar-h) / 2 - 14px);
    transition: background .15s;
    z-index: 201;
}
.sidebar-toggle:hover { background: var(--border); color: var(--text); }

/* ── Topbar ─────────────────────────────────────────────────────────────────── */
.main-area {
    flex: 1;
    margin-left: var(--sidebar-w);
    transition: margin-left .25s ease;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
}
.main-area.sidebar-collapsed { margin-left: var(--sidebar-collapsed); }

.topbar {
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    position: sticky; top: 0; z-index: 100;
}

.topbar-breadcrumb {
    flex: 1;
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 0.82rem; color: var(--text2);
}
.topbar-breadcrumb strong { color: var(--text); font-weight: 600; }
.topbar-breadcrumb .sep { color: var(--text3); }

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

.btn-icon {
    width: 34px; height: 34px;
    background: var(--surface2);
    color: var(--text2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem;
    transition: all .15s;
    flex-shrink: 0;
}
.btn-icon:hover { color: var(--orange); border-color: var(--orange); background: rgba(255,107,53,.08); }

.btn-icon-green  { color: var(--green)  !important; border-color: rgba(16,185,129,.4)  !important; }
.btn-icon-purple { color: var(--purple) !important; border-color: rgba(139,92,246,.4)  !important; }
.btn-icon-green:hover  { background: rgba(16,185,129,.08)  !important; }
.btn-icon-purple:hover { background: rgba(139,92,246,.08)  !important; }

.date-select {
    padding: 6px 10px;
    background: var(--surface2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    cursor: pointer;
}
.date-select:focus { outline: none; border-color: var(--orange); }

/* ── Content ────────────────────────────────────────────────────────────────── */
.dash-content {
    flex: 1;
    padding: 1.5rem;
    max-width: 1400px;
    width: 100%;
    overflow-x: hidden;
}

/* ── Modal ──────────────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(11,17,32,.85);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; padding: 1rem;
}
.modal-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%; max-width: 720px;
    max-height: 90vh; overflow-y: auto;
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.modal-header h3 { font-size: 0.95rem; font-weight: 600; }
.modal-body { padding: 1.25rem; }

/* ── Responsive ─────────────────────────────────────────────────────────────── */

/* Mobile: sidebar vira bottom nav */
@media (max-width: 767px) {
    :root { --topbar-h: 52px; }

    /* Esconde sidebar lateral */
    .sidebar {
        width: 100% !important;
        height: 60px;
        min-height: unset;
        top: auto; bottom: 0; left: 0;
        flex-direction: row;
        align-items: stretch;
        justify-content: center;
        border-right: none;
        border-top: 1px solid var(--border);
        z-index: 300;
    }
    .sidebar-logo    { display: none; }
    .sidebar-toggle  { display: none; }
    .sidebar-footer  { display: none; }
    .sidebar-nav {
        flex: 1 !important;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-around;
        padding: 0;
        overflow: visible;
    }
    .nav-section-label { display: none; }
    .sidebar .nav-item {
        flex-direction: column !important;
        gap: 2px !important;
        padding: 6px 8px !important;
        font-size: 0.58rem !important;
        align-items: center !important;
        justify-content: center !important;
        flex: 1 !important;
        width: auto !important;
        height: 60px !important;
        border-right: none !important;
        border-top: 2px solid transparent !important;
        white-space: nowrap !important;
        text-align: center !important;
        display: flex !important;
        overflow: hidden !important;
    }
    .sidebar .nav-item.active {
        border-right: none !important;
        border-top: 2px solid var(--blue) !important;
        background: rgba(0,168,255,.08) !important;
    }
    .sidebar .nav-icon { width: auto; height: auto; font-size: 1.1rem; }
    .sidebar .nav-label { font-size: 0.6rem; line-height: 1; }
    .nav-bot-badge { display: none; }

    /* Logout no bottom nav */
    .sidebar-footer {
        display: flex !important;
        border-top: none;
        padding: 0;
        flex-shrink: 0;
        width: auto;
    }
    .sidebar-footer .nav-item {
        flex-direction: column !important;
        gap: 2px !important;
        padding: 6px 8px !important;
        font-size: 0.58rem !important;
        align-items: center !important;
        justify-content: center !important;
        flex: none !important;
        width: 60px !important;
        height: 60px !important;
        border-right: none !important;
        border-top: 2px solid transparent !important;
        white-space: nowrap !important;
        text-align: center !important;
        display: flex !important;
    }
    .sidebar-footer .nav-item .nav-icon {
        width: auto !important;
        height: auto !important;
        font-size: 1.1rem !important;
    }
    .sidebar-footer .nav-item .nav-label {
        font-size: 0.6rem !important;
        line-height: 1 !important;
    }

    /* Main area: margem embaixo para bottom nav */
    .main-area {
        margin-left: 0 !important;
        padding-bottom: 60px;
    }

    /* Topbar mobile */
    .topbar { padding: 0 0.75rem; gap: 0.5rem; }
    .topbar-breadcrumb { font-size: 0.78rem; }
    .topbar-breadcrumb .sep,
    #topbarClient { display: none; }

    /* Content */
    .dash-content { padding: 0.75rem; }

    /* Modal full screen */
    .modal-overlay { padding: 0; align-items: flex-end; }
    .modal-card {
        max-width: 100%;
        border-radius: 16px 16px 0 0;
        max-height: 92vh;
    }
}

/* Tablet: sidebar colapsada por padrão */
@media (min-width: 768px) and (max-width: 1023px) {
    .sidebar { width: var(--sidebar-collapsed); }
    .sidebar .nav-label,
    .sidebar .nav-section-label,
    .sidebar .sidebar-logo-text,
    .sidebar .nav-bot-badge { display: none; }
    .main-area { margin-left: var(--sidebar-collapsed); }
    .dash-content { padding: 1.25rem; }
}

/* Desktop */
@media (min-width: 1024px) {
    .dash-content { padding: 1.5rem; }
}
