/**
 * ============================================================================
 * Olivius - Folha de Estilos (Tema Clean Botanical & Saúde)
 * Cores inspiradas na identidade visual da Logo: #3f7859 (oliva) e #777f4f (folhas)
 * Arquivo: assets/style.css
 * ============================================================================
 */

:root {
    /* Cores Institucionais Extraídas da Logo */
    --brand-olive: #3f7859;          /* Verde-oliva principal da tipografia da Logo */
    --brand-olive-hover: #326147;    /* Verde-oliva escurecido para interações */
    --brand-olive-active: #274d38;
    --brand-leaf: #777f4f;           /* Tom das folhas de oliveira */
    --brand-leaf-hover: #656c42;
    --brand-leaf-soft: #eef2e6;      /* Fundo suave com tom de folha */

    /* Superfícies e Estrutura (Clean & Healthcare) */
    --bg-main: #f4f7f4;              /* Fundo névoa/porcelana descansado */
    --card-bg: #ffffff;              /* Branco puro para cards clínicos e relatórios */
    --card-hover: #fafcfa;
    --border-color: #dbe4dd;         /* Bordas sutis em cinza-oliva */
    --border-subtle: #edf3ee;

    /* Tipografia com Alto Contraste e Conforto */
    --text-main: #192e23;            /* Carvão florestal escuro para leitura perfeita */
    --text-dim: #4d6958;             /* Verde-oliva médio para metadados e subtítulos */
    --text-muted: #769181;           /* Sálvia suave para rodapé e separadores */

    /* Ações e Estados */
    --primary: var(--brand-olive);
    --primary-hover: var(--brand-olive-hover);
    --primary-active: var(--brand-olive-active);
    --accent: var(--brand-olive);
    --accent-hover: var(--brand-olive-hover);

    /* Alertas e Status */
    --danger: #dc2626;               /* Vermelho clássico e seguro */
    --danger-hover: #b91c1c;
    --success: #059669;

    /* Tipografia e Geometria */
    --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --shadow-sm: 0 1px 3px rgba(25, 46, 35, 0.05), 0 1px 2px rgba(25, 46, 35, 0.03);
    --shadow-md: 0 4px 16px -2px rgba(25, 46, 35, 0.06), 0 2px 6px -1px rgba(25, 46, 35, 0.04);
    --shadow-lg: 0 12px 32px -4px rgba(25, 46, 35, 0.08), 0 4px 12px -2px rgba(25, 46, 35, 0.04);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-stack);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================================================
 * Imagens de Marca (Logo)
 * ============================================================================ */
.topbar-logo {
    height: 42px;
    width: auto;
    display: block;
    object-fit: contain;
}

.login-logo {
    max-width: 240px;
    width: 100%;
    height: auto;
    display: block;
    margin: 0 auto 8px auto;
    object-fit: contain;
}

/* ============================================================================
 * Barra Superior (Topbar)
 * ============================================================================ */
.topbar {
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--brand-olive);
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.brand-link {
    color: inherit;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-area {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 0.9rem;
    color: var(--text-dim);
}

.user-area strong {
    color: var(--text-main);
    font-weight: 600;
}

.user-greeting {
    white-space: nowrap;
}

/* ============================================================================
 * Botões e Ações Interativas
 * ============================================================================ */
.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
    border: 1px solid transparent;
    padding: 11px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    box-shadow: 0 2px 4px rgba(63, 120, 89, 0.2);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 10px rgba(63, 120, 89, 0.3);
}

.btn-primary:active {
    transform: scale(0.98);
    background-color: var(--primary-active);
}

.btn-block {
    width: 100%;
    text-align: center;
    display: flex;
}

.btn-danger {
    background-color: var(--danger);
    border-color: var(--danger-hover);
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.2);
}

.btn-danger:hover {
    background-color: var(--danger-hover);
    box-shadow: 0 4px 10px rgba(220, 38, 38, 0.3);
}

.btn-small {
    background-color: #f0f5f2;
    color: var(--brand-olive);
    border: 1px solid #d3e0d7;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}

.btn-small:hover {
    background-color: var(--brand-olive);
    color: #ffffff;
    border-color: var(--brand-olive);
}

.btn-nav {
    margin-right: 2px;
}

.btn-logout {
    background-color: transparent;
    color: var(--danger);
    border: 1px solid rgba(220, 38, 38, 0.3);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}

.btn-logout:hover {
    background-color: var(--danger);
    color: #ffffff;
    border-color: var(--danger);
}

.btn-download {
    background-color: rgba(63, 120, 89, 0.08);
    color: var(--brand-olive);
    border: 1px solid rgba(63, 120, 89, 0.3);
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}

.btn-download:hover {
    background-color: var(--brand-olive);
    color: #ffffff;
    border-color: var(--brand-olive);
    box-shadow: 0 2px 6px rgba(63, 120, 89, 0.25);
}

.btn-action-view {
    background: #f7faf8;
    color: var(--text-dim);
    border: 1px solid #d3e0d7;
    margin-right: 6px;
}

.btn-action-view:hover {
    background-color: #e6eee8;
    color: var(--brand-olive);
}

.btn-space-top {
    margin-top: 10px;
}

/* ============================================================================
 * Formulários e Campos
 * ============================================================================ */
.form-group {
    margin-bottom: 16px;
    text-align: left;
}

.form-group-lg {
    margin-bottom: 22px;
    text-align: left;
}

.form-compact {
    margin-bottom: 12px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.88rem;
    color: var(--text-main);
    font-weight: 600;
}

.form-input {
    width: 100%;
    background-color: #ffffff;
    border: 1px solid #cbdad0;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    color: var(--text-main);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus {
    border-color: var(--brand-olive);
    box-shadow: 0 0 0 3px rgba(63, 120, 89, 0.18);
}

.form-hint {
    color: var(--text-muted);
    font-size: 0.78rem;
    display: block;
    margin-top: 5px;
}

/* ============================================================================
 * Layout Principal e Cards
 * ============================================================================ */
.container {
    flex: 1;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    padding: 28px 20px;
}

.intro {
    margin-bottom: 26px;
}

.intro h2 {
    font-size: 1.65rem;
    color: var(--text-main);
    margin-bottom: 8px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.intro p {
    color: var(--text-dim);
    font-size: 1rem;
    max-width: 780px;
    line-height: 1.6;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 26px;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.card:hover {
    border-color: #b7cebf;
    box-shadow: var(--shadow-md);
}

.card h2 {
    font-size: 1.25rem;
    color: var(--brand-olive);
    margin-bottom: 10px;
    font-weight: 700;
}

.card h3 {
    font-size: 1.05rem;
    color: var(--text-main);
    margin-bottom: 8px;
    font-weight: 600;
}

.card p {
    color: var(--text-dim);
    font-size: 0.95rem;
    line-height: 1.6;
}

.card-action {
    margin-top: 22px;
}

.card pre, .card code {
    background: #f0f5f2;
    border: 1px solid #dbe4dd;
    padding: 3px 8px;
    border-radius: 4px;
    font-family: Consolas, monospace;
    font-size: 0.88rem;
    color: var(--brand-olive);
    word-break: break-all;
}

.info-list {
    list-style: none;
    padding: 0;
    margin: 14px 0 0 0;
    font-size: 0.92rem;
    line-height: 1.85;
    color: var(--text-main);
}

.security-info-text {
    font-size: 0.92rem;
    color: var(--text-dim);
    line-height: 1.65;
}

/* ============================================================================
 * Breadcrumb
 * ============================================================================ */
.breadcrumb {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.breadcrumb::-webkit-scrollbar {
    display: none;
}

.breadcrumb a {
    color: var(--brand-olive);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s ease;
    flex-shrink: 0;
}

.breadcrumb a:hover {
    color: var(--brand-olive-hover);
    text-decoration: underline;
}

.breadcrumb .sep {
    color: var(--text-muted);
    user-select: none;
    flex-shrink: 0;
}

.breadcrumb-active {
    color: var(--text-main);
    font-weight: 600;
}

/* ============================================================================
 * Barra de Busca / Filtro
 * ============================================================================ */
.filter-bar {
    margin-bottom: 20px;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-input {
    flex: 1;
    min-width: 220px;
    padding: 11px 16px;
    background: #ffffff;
    border: 1px solid #cbdad0;
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 0.95rem;
    outline: none;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.filter-input:focus {
    border-color: var(--brand-olive);
    box-shadow: 0 0 0 3px rgba(63, 120, 89, 0.18);
}

.item-count-badge {
    color: var(--text-dim);
    font-size: 0.85rem;
    white-space: nowrap;
    background: #ffffff;
    padding: 8px 14px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

/* ============================================================================
 * Tabela de Arquivos
 * ============================================================================ */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background-color: var(--card-bg);
    box-shadow: var(--shadow-sm);
}

.file-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.file-table th {
    background-color: #f0f5f2;
    color: var(--text-dim);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
}

.file-table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-main);
    font-size: 0.92rem;
    vertical-align: middle;
}

.col-name {
    width: 50%;
}

.col-size {
    width: 15%;
}

.col-date {
    width: 20%;
}

.col-actions {
    width: 15%;
    text-align: right;
}

.cell-size {
    font-size: 0.85rem;
    color: var(--text-dim);
    white-space: nowrap;
    font-weight: 500;
}

.cell-date {
    color: var(--text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
}

.cell-empty {
    color: var(--text-muted);
}

.file-table tbody tr:hover {
    background-color: rgba(63, 120, 89, 0.035);
}

.row-dir td {
    background-color: rgba(240, 245, 242, 0.5);
}

.row-dir:hover td {
    background-color: rgba(63, 120, 89, 0.07);
}

.row-parent-link {
    font-weight: 600;
    color: var(--brand-olive);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.row-parent-link:hover {
    color: var(--brand-olive-hover);
}

.file-name-cell, .file-name-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

.file-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    line-height: 1;
}

.file-info-block {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.file-title {
    word-break: break-word;
    font-weight: 500;
    color: var(--text-main);
}

.row-dir .file-title {
    color: var(--brand-olive);
    font-weight: 600;
}

.mobile-file-meta {
    display: none;
}

.actions-cell {
    white-space: nowrap;
    text-align: right;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    background-color: var(--card-bg);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-dim);
}

.empty-icon {
    font-size: 3rem;
    margin: 0 0 10px 0;
}

.empty-state h3 {
    font-size: 1.2rem;
    color: var(--text-main);
    margin-bottom: 6px;
}

/* ============================================================================
 * Telas de Login, Setup e Erro 404
 * ============================================================================ */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 24px 20px;
    background-color: var(--bg-main);
}

.login-box {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px 36px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.box-setup {
    max-width: 520px;
}

.box-404 {
    max-width: 460px;
}

.error-code-404 {
    color: var(--brand-olive);
    font-size: 2.8rem;
    margin: 0 0 10px 0;
    font-weight: 800;
}

.error-text-404 {
    font-size: 1.1rem;
    color: var(--text-dim);
    margin-bottom: 24px;
}

.login-box .brand {
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: 4px;
}

.subtitle {
    color: var(--text-dim);
    font-size: 0.95rem;
    margin-bottom: 24px;
}

.instruction-text {
    font-size: 0.9rem;
    color: var(--text-dim);
    margin-bottom: 16px;
    line-height: 1.5;
}

.link-accent {
    color: var(--brand-olive);
    text-decoration: underline;
    font-weight: 600;
}

.link-accent:hover {
    color: var(--brand-olive-hover);
}

/* ============================================================================
 * Alertas e Mensagens de Status
 * ============================================================================ */
.alert-error {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    margin-bottom: 20px;
    text-align: left;
}

.alert-warning-box {
    background-color: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
    padding: 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 22px;
    text-align: left;
}

.alert-success {
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
    padding: 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 22px;
    font-size: 0.95rem;
    text-align: left;
}

.alert-info {
    background-color: #f0fdf4;
    border: 1px solid #c7e6d1;
    color: #1b4d32;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    margin-bottom: 20px;
    text-align: left;
}

.alert-title {
    margin: 0 0 8px 0;
    font-size: 1.05rem;
    font-weight: 700;
}

.alert-title-success {
    color: #166534;
}

.alert-title-danger {
    color: #991b1b;
}

.alert-body {
    margin: 0 0 10px 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

.alert-strong {
    margin: 0;
    font-weight: 700;
    color: #991b1b;
}

.footer-text {
    margin-top: 26px;
    color: var(--text-muted);
    font-size: 0.82rem;
}

/* ============================================================================
 * Rodapé
 * ============================================================================ */
.footer {
    border-top: 1px solid var(--border-color);
    padding: 24px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    background-color: var(--card-bg);
    margin-top: auto;
}

/* ============================================================================
 * Responsividade Mobile Avançada
 * ============================================================================ */
@media (max-width: 640px) {
    .topbar {
        padding: 12px 16px;
    }

    .topbar-logo {
        height: 34px;
    }

    .login-logo {
        max-width: 190px;
    }

    .user-area {
        gap: 8px;
        font-size: 0.85rem;
    }

    .user-greeting {
        display: none;
    }

    .container {
        padding: 18px 14px;
    }

    .intro h2 {
        font-size: 1.35rem;
    }

    .intro p {
        font-size: 0.92rem;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .filter-input {
        width: 100%;
        min-width: 0;
    }

    .item-count-badge {
        align-self: flex-start;
        font-size: 0.78rem;
        padding: 4px 10px;
    }

    .file-table th:nth-child(2),
    .file-table td:nth-child(2),
    .file-table th:nth-child(3),
    .file-table td:nth-child(3) {
        display: none;
    }

    .file-table th {
        padding: 10px 14px;
    }

    .file-table td {
        padding: 12px 14px;
    }

    .mobile-file-meta {
        display: block;
        font-size: 0.78rem;
        color: var(--text-dim);
        margin-top: 3px;
        line-height: 1.3;
    }

    .mobile-file-meta strong {
        color: var(--text-main);
    }

    .actions-cell {
        display: flex;
        justify-content: flex-end;
        align-items: center;
        gap: 6px;
        padding-top: 14px;
        padding-bottom: 14px;
    }

    .btn-action-download,
    .btn-action-view {
        min-height: 38px;
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .login-box {
        padding: 30px 22px;
    }

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

/* ============================================================================
 * Badges de Status e Perfis de Usuário
 * ============================================================================ */
.badge-status-active {
    background-color: rgba(5, 150, 105, 0.12);
    color: #065f46;
    border: 1px solid #bbf7d0;
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 0.78rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-status-blocked {
    background-color: rgba(220, 38, 38, 0.1);
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 0.78rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-role-admin {
    background-color: rgba(63, 120, 89, 0.12);
    color: var(--brand-olive);
    border: 1px solid #cbdad0;
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 0.78rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-role-user {
    background-color: #f0f5f2;
    color: var(--text-dim);
    border: 1px solid #d3e0d7;
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 0.78rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-role-main {
    background-color: rgba(63, 120, 89, 0.16);
    color: var(--brand-olive);
    border: 1px solid #a3c2af;
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 0.78rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-protected {
    background-color: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 0.78rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-self {
    background-color: rgba(63, 120, 89, 0.08);
    color: var(--brand-olive);
    border: 1px solid #cbdad0;
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 0.78rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.username-title {
    color: var(--text-main);
    font-size: 0.95rem;
    font-weight: 600;
}

.card-margin-top {
    margin-top: 10px;
}

.table-margin-top {
    margin-top: 18px;
}

.action-group {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    justify-content: flex-end;
}

.inline-form {
    display: inline;
    margin: 0;
    padding: 0;
}

.form-help {
    display: block;
    margin-top: 5px;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.btn-warning {
    background-color: #f59e0b;
    border: 1px solid #d97706;
    color: #ffffff;
}

.btn-warning:hover {
    background-color: #d97706;
}

/* ============================================================================
 * Badges de Status de Conexão (Header)
 * ============================================================================ */
.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    text-decoration: none;
    transition: transform 0.15s ease, background-color 0.15s ease;
}

.status-badge-online {
    background-color: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.status-badge-offline {
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    cursor: pointer;
}

.status-badge-offline:hover {
    background-color: #fee2e2;
    transform: scale(1.02);
}

.status-badge-local {
    background-color: var(--brand-leaf-soft);
    color: var(--brand-olive-active);
    border: 1px solid var(--border-color);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
}

.status-badge-online .status-dot {
    background-color: #10b981;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.status-badge-offline .status-dot {
    background-color: #ef4444;
}

/* ============================================================================
 * Alertas e Mensagens de Conectividade
 * ============================================================================ */
.alert-box {
    display: flex;
    gap: 14px;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    background-color: #ffffff;
    box-shadow: var(--shadow-sm);
}

.alert-offline {
    background-color: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.alert-icon {
    font-size: 1.8rem;
    line-height: 1;
}

.alert-content h4 {
    font-size: 1rem;
    margin-bottom: 4px;
    color: #78350f;
}

.alert-content p {
    font-size: 0.88rem;
    line-height: 1.45;
    color: #92400e;
    margin-bottom: 10px;
}

/* ============================================================================
 * Barra de Controles e Alternador de Visão
 * ============================================================================ */
.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.filter-input-wrap {
    flex: 1;
    min-width: 240px;
}

.filter-meta-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
}

.view-mode-toggle {
    display: inline-flex;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 3px;
    gap: 2px;
}

.btn-toggle {
    background: transparent;
    border: none;
    padding: 6px 12px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-dim);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-toggle:hover {
    color: var(--text-main);
}

.btn-toggle.active {
    background-color: var(--brand-olive);
    color: #ffffff;
    box-shadow: var(--shadow-sm);
}

.table-thumb-mini {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-main);
    flex-shrink: 0;
}

/* ============================================================================
 * Grade de Galeria de Fotos (Gallery Grid)
 * ============================================================================ */
.gallery-parent-card {
    margin-bottom: 14px;
}

.gallery-back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--brand-olive);
    text-decoration: none;
    padding: 8px 14px;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.gallery-back-link:hover {
    background-color: var(--card-hover);
    border-color: var(--brand-olive);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.gallery-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.gallery-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--brand-olive);
}

.gallery-card-dir {
    padding: 16px;
    text-decoration: none;
    color: var(--text-main);
    flex-direction: row;
    align-items: center;
    gap: 12px;
}

.gallery-card-icon {
    font-size: 2rem;
    line-height: 1;
}

.gallery-thumb-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background-color: var(--bg-main);
    cursor: pointer;
    overflow: hidden;
}

.gallery-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.25s ease;
}

.gallery-thumb-wrap:hover .gallery-img {
    transform: scale(1.05);
}

.gallery-overlay-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background-color: rgba(25, 46, 35, 0.75);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    opacity: 0;
    transition: opacity 0.15s ease;
    backdrop-filter: blur(4px);
}

.gallery-thumb-wrap:hover .gallery-overlay-badge {
    opacity: 1;
}

.gallery-thumb-placeholder {
    width: 100%;
    aspect-ratio: 4 / 3;
    background-color: var(--bg-main);
    display: flex;
    align-items: center;
    justify-content: center;
}

.placeholder-ext {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--brand-leaf);
    background-color: var(--brand-leaf-soft);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    letter-spacing: 0.5px;
}

.gallery-card-info {
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gallery-card-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gallery-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2px;
}

.gallery-card-meta {
    font-size: 0.76rem;
    color: var(--text-dim);
}

.gallery-download-icon {
    text-decoration: none;
    font-size: 1rem;
    opacity: 0.6;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.gallery-download-icon:hover {
    opacity: 1;
    transform: scale(1.15);
}

/* ============================================================================
 * Lightbox Modal (Visualizador de Imagens)
 * ============================================================================ */
.lightbox-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background-color: rgba(10, 20, 15, 0.88);
    backdrop-filter: blur(8px);
}

.lightbox-dialog {
    position: relative;
    z-index: 10;
    width: 95vw;
    height: 94vh;
    display: flex;
    flex-direction: column;
    pointer-events: auto;
}

.lightbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background-color: rgba(18, 32, 24, 0.8);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.lightbox-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
}

.lightbox-title {
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60vw;
}

.lightbox-counter {
    color: #94a3b8;
    font-size: 0.82rem;
    background-color: rgba(255, 255, 255, 0.12);
    padding: 2px 8px;
    border-radius: 12px;
}

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

.lightbox-close-btn {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 6px;
    opacity: 0.8;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.lightbox-close-btn:hover {
    opacity: 1;
    transform: scale(1.15);
}

.lightbox-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    padding: 10px;
    overflow: hidden;
}

.lightbox-stage {
    flex: 1;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.lightbox-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transition: opacity 0.2s ease;
}

.lightbox-nav-btn {
    background-color: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
    font-size: 1.6rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    z-index: 20;
    user-select: none;
}

.lightbox-nav-btn:hover {
    background-color: rgba(255, 255, 255, 0.35);
    transform: scale(1.08);
}

.lightbox-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

@media (max-width: 768px) {
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .filter-meta-wrap {
        justify-content: space-between;
    }
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }
    .lightbox-nav-btn {
        width: 38px;
        height: 38px;
        font-size: 1.2rem;
    }
}

/* ============================================================================
 * Login Passwordless & OTP
 * ============================================================================ */
.login-instruction {
    font-size: 0.88rem;
    color: var(--text-dim);
    line-height: 1.45;
    margin-bottom: 18px;
    text-align: center;
}

.login-credentials-tip {
    margin-top: 18px;
    padding: 10px 12px;
    background-color: var(--brand-leaf-soft);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
    text-align: center;
}

.btn-danger {
    background-color: var(--danger);
    color: #ffffff;
    border: 1px solid var(--danger-hover);
}

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




