/* Estilo moderno e elegante - cores: laranja, branco, preto */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #f97316; /* laranja mais suave */
    --primary-dark: #ea580c;
    --primary-light: #fdba74;
    --primary-bg: #fff7ed;
    --dark: #020617;
    --dark-light: #0f172a;
    --gray: #4b5563;
    --gray-light: #9ca3af;
    --gray-bg: #f3f4f6;
    --border: #e5e7eb;
    --shadow: rgba(15, 23, 42, 0.06);
    --shadow-lg: rgba(15, 23, 42, 0.12);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f3f4f6;
    color: #111827;
    line-height: 1.6;
    min-height: 100vh;
}

body.login-page {
    margin: 0;
    background: #f3f4f6;
}

body.app-page {
    background: url('img/login.png') center top / cover fixed no-repeat;
}

/* Topbar melhorado */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.7rem clamp(12px, 2vw, 20px);
    background: transparent;
    color: #f9fafb;
    box-shadow: none;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.logo-link {
    text-decoration: none !important;
    color: inherit;
    display: inline-flex;
    align-items: center;
}

.logo-link:hover {
    text-decoration: none !important;
}

.logo-link .logo {
    text-decoration: none !important;
}

.logo {
    font-weight: 700;
    font-size: 1.3rem;
    letter-spacing: 0.05em;
    color: var(--primary);
    text-shadow: 0 2px 4px rgba(255, 136, 0, 0.3);
    transition: transform 0.2s ease;
    cursor: pointer;
    text-decoration: none;
}

.logo:hover {
    transform: scale(1.05);
}

.logo-header {
    height: 56px;
    width: 220px;
    display: block;
    object-fit: cover;
    object-position: center;
}

.topbar-right {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: nowrap;
}

/* Mobile menu toggle (header) */
.mobile-menu-toggle {
    display: none;
    border: 1px solid rgba(255, 136, 0, 0.45);
    background: rgba(255, 136, 0, 0.18);
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.2rem;
    align-items: center;
    justify-content: center;
}

.notif-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 999px;
    text-decoration: none;
    color: #fff;
    background: rgba(255, 136, 0, 0.18);
    border: 1px solid rgba(255, 136, 0, 0.45);
    backdrop-filter: blur(10px);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.notif-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(0,0,0,0.15);
}

.notif-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    color: #fff;
    background: #ef4444;
    border: 2px solid rgba(255,255,255,0.85);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.35);
    line-height: 1;
}

@keyframes notifPulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.55); transform: scale(1); }
    70% { box-shadow: 0 0 0 14px rgba(239, 68, 68, 0); transform: scale(1.03); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); transform: scale(1); }
}

.notif-pulse {
    animation: notifPulse 1.1s ease-out 1;
}

.card-icon-wrap {
    position: relative;
    display: inline-block;
}

.card-badge {
    position: absolute;
    top: -10px;
    right: -14px;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    color: #fff;
    background: #ef4444;
    border: 2px solid rgba(255,255,255,0.9);
    box-shadow: 0 8px 18px rgba(239, 68, 68, 0.35);
    line-height: 1;
}

.user-info {
    font-size: 0.9rem;
    padding: 0.4rem 0.8rem;
    background: rgba(255, 136, 0, 0.2);
    border: 1px solid rgba(255, 136, 0, 0.5);
    border-radius: 999px;
    backdrop-filter: blur(10px);
    color: var(--primary-light);
}

/* Botões do topo usam o tamanho normal dos .btn */

/* Container */
.container {
    max-width: 1500px;
    width: min(1500px, calc(100% - 2rem));
    margin: clamp(1rem, 2.5vw, 2rem) auto clamp(1.5rem, 4vw, 3rem);
    padding: 0;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Cards melhorados */
.card {
    background: #fff;
    border-radius: 12px;
    padding: clamp(1.25rem, 2.5vw, 2rem);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.card:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

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

.card-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--dark);
    letter-spacing: -0.02em;
}

.dashboard-card {
    border-left: 5px solid var(--primary);
    background: linear-gradient(135deg, #fff 0%, var(--primary-bg) 100%);
}

.dashboard-card .card-title {
    color: var(--primary-dark);
}

/* Botões melhorados */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.5rem;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(255, 136, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.btn:not(.btn-outline):link,
.btn:not(.btn-outline):visited {
    color: #fff;
    text-decoration: none;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:hover {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 136, 0, 0.4);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(255, 136, 0, 0.3);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    box-shadow: none;
}

.btn-outline::before {
    display: none;
}

.btn-outline:hover {
    background: transparent; /* mantém fundo branco/transparente */
    color: var(--primary);   /* mantém texto laranja */
    box-shadow: 0 6px 20px rgba(255, 136, 0, 0.35); /* apenas o efeito de zoom/sombra */
}

.btn-outline:link,
.btn-outline:visited {
    color: var(--primary);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(255, 136, 0, 0.3);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    box-shadow: 0 6px 20px rgba(255, 136, 0, 0.4);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.toolbar-buttons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-toolbar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.5rem;
    padding: 0.5rem 1rem;
    box-sizing: border-box;
    font-size: 0.9rem;
    gap: 0.35rem;
}

.form-buttons-equal {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    align-self: end;
    min-width: min-content;
}
.form-buttons-equal .btn {
    width: 7rem;
    font-weight: 500;
    min-height: 2.25rem;
    padding: 0.5rem 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

/* Botões de filtro (Filtrar/Limpar) com mesma largura */
.filter-actions {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    width: 100%;
    justify-content: center;
}

.filter-actions .btn {
    min-width: 6rem;
    justify-content: center;
    min-height: 48px; /* ligeiramente maior para alinhar com os inputs */
}

/* Formulários melhorados */
form .field {
    margin-bottom: 1.2rem;
}

form label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark);
}

form input[type="text"],
form input[type="number"],
form input[type="password"],
form input[type="url"],
form input[type="tel"],
form input[type="date"],
form select,
form textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 2px solid var(--border);
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background: #fff;
    font-family: inherit;
}

form input:focus,
form select:focus,
form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 136, 0, 0.1);
    transform: translateY(-1px);
}

form textarea {
    min-height: 100px;
    resize: vertical;
}

form .field-inline {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

form input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
    cursor: pointer;
    accent-color: var(--primary);
}

/* Alertas melhorados */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 10px;
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
    border-left: 4px solid;
    animation: slideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.alert::before {
    font-size: 1.2rem;
}

.alert-error {
    background: #fff5f5;
    color: #c53030;
    border-left-color: #c53030;
}

.alert-error::before {
    content: '⚠️';
}

.alert-success {
    background: #f0fff4;
    color: #2d5016;
    border-left-color: #48bb78;
}

.alert-success::before {
    content: '✓';
}

.alert-info {
    background: #ebf8ff;
    color: #2c5282;
    border-left-color: #4299e1;
}

.alert-info::before {
    content: 'ℹ️';
}

/* Modal de confirmação (remoção pedido) - visual mais profissional */
.modal-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-confirm-overlay[style*="display: flex"],
.modal-confirm-overlay.show {
    display: flex;
}

.modal-confirm-card {
    max-width: 520px;
    width: calc(100% - 2rem);
    padding: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, #ffffff 0%, #fbfbff 100%);
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.modal-confirm-header {
    padding: 1rem 1.1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.6) 100%);
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

.modal-confirm-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-confirm-icon {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(197, 53, 53, 0.12);
    border: 1px solid rgba(197, 53, 53, 0.25);
    font-size: 1.05rem;
}

.modal-confirm-close {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    color: #111827;
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
}

.modal-confirm-close:hover {
    background: rgba(17, 24, 39, 0.08);
}

.modal-confirm-body {
    padding: 0.9rem 1.1rem 0.2rem 1.1rem;
}

.modal-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 0.75rem 1.1rem 1.0rem 1.1rem;
}

.modal-confirm-actions .btn {
    min-width: 96px;
}

.modal-confirm-actions .btn-ok {
    background: linear-gradient(135deg, #dc2626 0%, #c53030 100%) !important;
    box-shadow: 0 10px 30px rgba(197, 53, 53, 0.28);
    border-radius: 10px;
}

.modal-confirm-actions .btn-ok:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 14px 40px rgba(197, 53, 53, 0.35);
}

.modal-confirm-actions .btn-cancel {
    border-color: rgba(75, 85, 99, 0.35) !important;
    color: #374151 !important;
}

.modal-confirm-actions .btn-cancel:hover {
    box-shadow: 0 8px 20px rgba(17, 24, 39, 0.12);
}

/* Footer */
.footer {
    border-top: 1px solid var(--border);
    padding: 1.5rem;
    text-align: center;
    font-size: 0.85rem;
    background: #fff;
    color: var(--gray);
    margin-top: 3rem;
}

/* Dashboard actions */
.dashboard-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.dashboard-actions .card {
    text-align: center;
    padding: 2.5rem 2rem;
    background: linear-gradient(135deg, #fff 0%, #fafafa 100%);
    border: 2px solid transparent;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.dashboard-actions .card:hover {
    border-color: var(--primary);
    transform: translateY(-5px) scale(1.02);
}

.dashboard-actions .card-title {
    font-size: 1.3rem;
    margin-bottom: 0.75rem;
    color: var(--dark);
}

.dashboard-actions .card p {
    color: var(--gray);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* Alinhar botões no fundo dos cards do dashboard */
.dashboard-actions .card > .btn,
.dashboard-actions .card > .dashboard-equal-buttons {
    margin-top: auto;
}

.dashboard-actions .card > .btn {
    align-self: center;
    min-width: 12rem;
}

/* Sub-card (ex: "Consultar") dentro do card do dashboard */
.dashboard-subcard {
    margin-top: 1rem;
    padding: 1.25rem 1rem;
    background: #fff;
    border: 2px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.dashboard-subcard .sub-icon {
    font-size: 2.25rem;
    margin-bottom: 0.5rem;
}

.dashboard-subcard .sub-title {
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 0.35rem;
}

.dashboard-subcard .sub-desc {
    font-size: 0.9rem;
    color: #6b7280;
    margin-bottom: 0.9rem;
    line-height: 1.5;
}

.dashboard-subcard .btn {
    min-width: 12rem;
}

/* Dois botões com a mesma largura (dashboard) */
.dashboard-equal-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.dashboard-equal-buttons .btn {
    width: 12.5rem;
    justify-content: center;
}

@media (max-width: 520px) {
    .dashboard-equal-buttons .btn {
        width: 100%;
    }
}

/* Tags melhoradas */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
}

.tag-pendente {
    background: linear-gradient(135deg, #fff7e0 0%, #ffe8b3 100%);
    color: #b7791f;
    border: 1px solid rgba(183, 121, 31, 0.2);
}

.tag-encomendado {
    background: linear-gradient(135deg, #e7f1ff 0%, #cce5ff 100%);
    color: #2c5282;
    border: 1px solid rgba(44, 82, 130, 0.2);
}

.tag-sem-stock {
    background: linear-gradient(135deg, #fff5f5 0%, #ffe5e5 100%);
    color: #c53030;
    border: 1px solid rgba(197, 48, 48, 0.2);
}

.tag-enviado {
    background: linear-gradient(135deg, #f0fff4 0%, #c6f6d5 100%);
    color: #2d5016;
    border: 1px solid rgba(45, 80, 22, 0.2);
}

/* Tabelas melhoradas */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

table thead {
    background: linear-gradient(135deg, var(--dark) 0%, var(--dark-light) 100%);
    color: #fff;
}

table th {
    padding: 1rem 1.25rem;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

table th:first-child {
    padding-left: 1.5rem;
}

table th:last-child {
    padding-right: 1.5rem;
}

table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s ease;
}

table th,
table td {
    vertical-align: middle;
    white-space: nowrap;
}

/* Permitir quebra de linha apenas onde for necessário (ex: nome do produto) */
td.cell-wrap,
th.cell-wrap {
    white-space: normal !important;
    overflow-wrap: anywhere;
    word-break: break-word;
}

td.cell-wrap {
    max-width: 520px;
}

/* Não quebrar o código do voucher em duas linhas */
table td code {
    white-space: nowrap;
}

table td:first-child {
    padding-left: 1.5rem;
}

table td:last-child {
    padding-right: 1.5rem;
}

table tbody tr {
    transition: background 0.2s ease;
}

/* Zebra rows */
table tbody tr:nth-child(odd) {
    background: #ffffff;
}

table tbody tr:nth-child(even) {
    background: #fff6ec;
}

table tbody tr:hover {
    background: #fff0de;
}

table tbody tr:last-child td {
    border-bottom: none;
}

/* Wrapper para evitar que as tabelas saiam fora em ecrãs pequenos */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

/* Tabelas compactas (sem quebrar texto) em ecrãs pequenos */
@media (max-width: 900px) {
    .table-responsive table {
        width: 100%;
    }

    /* Vouchers têm colunas “curtas” mas com texto muito compacto.
       Forçar `table-layout: fixed` pode esmagar os cabeçalhos e quebrar o texto de forma estranha.
       Deixa o browser calcular a largura. */
    table.vouchers-table {
        table-layout: auto;
    }

    .table-responsive th,
    .table-responsive td {
        padding: 0.55rem 0.6rem;
        font-size: 0.8rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Só as células com classe cell-wrap é que podem quebrar linhas */
    .table-responsive td.cell-wrap,
    .table-responsive th.cell-wrap {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        word-break: break-word;
    }

    /* Vouchers: esconder colunas menos importantes para caber sem scroll */
    table.vouchers-table th:nth-child(2),
    table.vouchers-table td:nth-child(2), /* Descrição */
    table.vouchers-table th:nth-child(3),
    table.vouchers-table td:nth-child(3), /* Tipo */
    table.vouchers-table th:nth-child(8),
    table.vouchers-table td:nth-child(8), /* Criado em */
    table.vouchers-table th:nth-child(9),
    table.vouchers-table td:nth-child(9)  /* Criado por */ {
        display: none;
    }

    /* Ajustes globais (ex.: gestao_lojas) — tabelas sem wrapper .table-responsive */
    table {
        width: 100%;
    }

    table th,
    table td {
        padding: 0.55rem 0.4rem;
        font-size: 0.8rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    table .col-acoes {
        min-width: 6rem;
    }
}

table a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
}

table a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Estado dos vouchers */
.badge-status {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.7rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-status-used {
    background: #dcfce7;
    color: #166534;
    border: 1px solid rgba(22, 101, 52, 0.2);
}

.badge-status-expired {
    background: #f3f4f6;
    color: #4b5563;
    border: 1px solid rgba(148, 163, 184, 0.4);
}

.badge-status-active {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid rgba(234, 179, 8, 0.4);
}

.badge-status-inactive {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

/* Botão imprimir vouchers */
.btn-print {
    white-space: nowrap;
    padding-inline: 1.25rem;
}

/* Filtros melhorados */
.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: var(--gray-bg);
    border-radius: 10px;
}

/* Evitar overflow de inputs (ex.: date) dentro do grid em mobile */
.filters .field {
    min-width: 0;
}
.filters input,
.filters select,
.filters textarea {
    min-width: 0;
}

/* Login melhorado */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 1.5rem;
    background: url('img/login.png') center right / cover no-repeat fixed;
    position: relative;
    overflow: hidden;
}

.login-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, rgba(255,255,255,0.75) 0%, rgba(248,250,252,0.6) 40%, rgba(15,23,42,0.35) 100%);
}

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

.login-card {
    background: #fff;
    padding: 3rem 2.5rem;
    border-radius: 20px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
    animation: slideUp 0.5s ease;
}

.login-logo {
    display: block;
    margin: 0 auto 0.75rem;
    width: 180px;
    max-width: 100%;
    object-fit: contain;
}

.login-card .btn {
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
    box-shadow: 0 12px 30px rgba(37, 99, 235, 0.5);
}

.login-card .btn:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
    box-shadow: 0 16px 36px rgba(37, 99, 235, 0.6);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
}

.login-subtitle {
    font-size: 0.95rem;
    color: var(--gray);
    margin-bottom: 2rem;
    text-align: center;
}

.login-footer {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--gray);
    text-align: center;
    line-height: 1.8;
}

.login-footer p {
    margin-bottom: 0.25rem;
}

.login-footer strong {
    color: var(--primary-dark);
}

/* Grid actions */
.grid-actions {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    align-items: stretch;
    width: 100%;
    min-width: 0;
}

.grid-actions .btn {
    width: 100%;
    min-width: 0;
    min-height: 2.25rem;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    white-space: nowrap;
}

.grid-actions-form {
    display: block;
    width: 100%;
    min-width: 0;
}

table .col-acoes {
    width: 1%;
    white-space: nowrap;
    min-width: 6rem;
}

/* Responsividade melhorada */
@media (max-width: 768px) {
    .topbar {
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
        padding: 0.75rem 16px;
    }

    .container {
        margin-top: 1rem;
        padding: 0 1rem;
    }

    .card {
        padding: 1.5rem;
    }

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

    .login-card {
        padding: 2rem 1.5rem;
        margin: 1rem;
    }

    table {
        font-size: 0.8rem;
    }

    table th,
    table td {
        padding: 0.75rem 0.5rem;
    }

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

@media (max-width: 480px) {
    .card-title {
        font-size: 1.1rem;
    }

    .btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }

    .topbar-right {
        width: 100%;
        justify-content: space-between;
    }

    /* Cabeçalho (title + botões) em coluna para não empurrar */
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .card-header > div {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-end;
    }

    /* Modal/toolbar (quando existe classe específica) */
    .toolbar-buttons {
        width: 100%;
        flex-direction: column;
        align-items: flex-end;
        gap: 0.5rem;
    }

    /* Mobile: logo + botão hamburger */
    .mobile-menu-toggle {
        display: inline-flex;
        margin-left: auto;
    }

    .topbar-right {
        display: none;
        flex-direction: column;
        align-items: flex-end;
        gap: 0.5rem;
        position: absolute;
        left: 12px;
        right: 12px;
        top: 68px;
        padding: 0.75rem 0.85rem;
        background: rgba(2, 6, 23, 0.72);
        border: 1px solid rgba(255, 136, 0, 0.25);
        border-radius: 14px;
        backdrop-filter: blur(10px);
        z-index: 200;
    }

    .topbar-right.open {
        display: flex !important;
        width: auto;
    }

    .topbar {
        padding-left: 12px;
        padding-right: 12px;
    }

    .topbar-left {
        flex: 1;
        display: flex;
        justify-content: flex-start;
        align-items: center;
    }

    .topbar {
        justify-content: space-between;
    }

    .user-info {
        width: 100%;
        justify-content: center;
        text-align: center;
        padding: 0.35rem 0.6rem;
        font-size: 0.85rem;
    }

    .topbar-right .btn-secondary {
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    table .col-acoes {
        min-width: 4.5rem;
    }

    .grid-actions {
        gap: 0.25rem;
    }

    .grid-actions .btn {
        min-height: 2rem;
        padding: 0.45rem 0.75rem;
        font-size: 0.85rem;
    }

    .logo-header {
        width: min(280px, 70vw);
        height: 64px;
        object-fit: contain;
    }

    td.cell-wrap {
        max-width: 100%;
    }

    img {
        max-width: 100%;
        height: auto;
    }
}

/* Animações de loading (para futuras melhorias) */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Scrollbar personalizada */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--gray-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}
