* {
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

/* ===========================
   BASE
   =========================== */
body {
    margin: 0;
    background: #f4f7fb;
    color: #1f2937;
}

/* ===========================
   TOPBAR
   =========================== */
.topbar {
    background: #0f172a;
    color: #fff;
    padding: 16px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.topbar .logo a {
    color: #fff;
    text-decoration: none;
    font-size: 20px;
    font-weight: 700;
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.topbar-logo {
    display: block;
    height: 60px;
    width: auto;
    object-fit: contain;
}

.menu-right {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.menu-links {
    display: flex;
    align-items: center;
    gap: 18px;
}

.menu-links a {
    color: #fff;
    text-decoration: none;
    font-weight: 500;
}

.user-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.08);
    padding: 8px 12px;
    border-radius: 999px;
}

.user-name {
    color: #fff;
    font-size: 14px;
    font-weight: 500;
}

.btn-user {
    text-decoration: none;
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    transition: 0.2s;
}

.btn-user:hover {
    background: rgba(255, 255, 255, 0.2);
}

.logout-btn {
    background: rgba(239, 68, 68, 0.22);
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.35);
}

/* ===========================
   LAYOUT GERAL
   =========================== */
.page-container {
    padding: 30px;
}

.card {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    margin-bottom: 24px;
}

.card.form-card {
    width: 100%;
    max-width: 900px;
    margin: 30px auto 0 auto;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-header h1 {
    margin: 0;
    font-size: 26px;
}

/* ===========================
   TABELAS
   =========================== */
.table-wrap {
    overflow-x: auto;
}

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

table thead th {
    background: #eef2ff;
    padding: 14px;
    text-align: left;
    font-size: 14px;
}

table tbody td {
    padding: 14px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
    vertical-align: top;
}

/* ===========================
   BOTÕES
   =========================== */
.btn {
    display: inline-block;
    padding: 10px 16px;
    border-radius: 10px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-weight: 600;
}

.btn-sm {
    padding: 8px 12px;
    font-size: 13px;
}

.btn-primary {
    background: #2563eb;
    color: #fff;
}

.btn-warning {
    background: #f59e0b;
    color: #fff;
}

.btn-info {
    background: #0ea5e9;
    color: #fff;
}

.btn-danger {
    background: #ef4444;
    color: #fff;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-success {
    background: #22c55e;
    color: #fff;
}

.btn-success:hover {
    background: #16a34a;
}

.btn-light {
    background: #e5e7eb;
    color: #111827;
}

.btn-light:hover {
    background: #d1d5db;
}

/* ===========================
   FORMULÁRIOS GERAIS
   =========================== */
label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #fff;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

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

/* ===========================
   BADGES E ALERTAS
   =========================== */
.badge {
    display: inline-block;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.badge-ok {
    background: #dcfce7;
    color: #166534;
}

.badge-alerta {
    background: #fef3c7;
    color: #92400e;
}

.badge-expirada {
    background: #fee2e2;
    color: #991b1b;
}

.badge-neutral {
    background: #e5e7eb;
    color: #374151;
}

.badge-info {
    background: #dbeafe;
    color: #1d4ed8;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-weight: 500;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-weight: 500;
}

.alert-info {
    background: #dbeafe;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-weight: 500;
}

/* ===========================
   INFO BOXES
   =========================== */
.info-box {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 20px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.info-item {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.info-item.full {
    grid-column: 1 / -1;
}

.info-label {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
}

.info-value {
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
}

.info-value .badge {
    vertical-align: middle;
}

/* ===========================
   FILTROS
   =========================== */
.filters-card {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 20px;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.filters-search {
    margin-bottom: 16px;
}

.filters-search input {
    width: 100%;
}

.filters-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}

/* ===========================
   AÇÕES
   =========================== */
.actions-cell {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.actions-cell form {
    margin: 0;
}

/* ===========================
   DASHBOARD CARDS
   =========================== */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 24px;
}

.dashboard-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    border-left: 5px solid #2563eb;
}

.dashboard-card-warning {
    border-left-color: #f59e0b;
}

.dashboard-card-danger {
    border-left-color: #ef4444;
}

.dashboard-card-muted {
    border-left-color: #64748b;
}

.dashboard-card-info {
    border-left-color: #60a5fa;
}

.dashboard-label {
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 10px;
}

.dashboard-value {
    font-size: 32px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1;
}

/* ===========================
   DRAWERS
   =========================== */
.dashboard-drawer {
    position: fixed;
    left: 0;
    z-index: 1000;
    display: flex;
    align-items: flex-start;
}

.resumo-drawer {
    top: 140px;
}

.alertas-drawer {
    top: 250px;
}

.dashboard-drawer-toggle {
    border: none;
    background: #0f172a;
    color: #fff;
    padding: 14px 12px;
    border-radius: 0 12px 12px 0;
    cursor: pointer;
    font-weight: 600;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
    transition: background 0.2s ease;
}

.alertas-toggle {
    background: #1d4ed8;
}

.dashboard-drawer.open .dashboard-drawer-toggle {
    background: #2563eb;
}

.dashboard-drawer-panel {
    width: 320px;
    max-width: 80vw;
    max-height: calc(100vh - 180px);
    overflow-y: auto;
    background: #ffffff;
    border-radius: 0 18px 18px 0;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.16);
    padding: 18px;
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.28s ease, opacity 0.28s ease;
}

.dashboard-drawer.open .dashboard-drawer-panel {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

.dashboard-drawer-header {
    margin-bottom: 14px;
}

.dashboard-drawer-header h3 {
    margin: 0;
    font-size: 18px;
    color: #0f172a;
}

.dashboard-cards-drawer {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 0;
}

.dashboard-cards-drawer .dashboard-card {
    padding: 18px;
}

.dashboard-cards-drawer .dashboard-value {
    font-size: 28px;
}

.alerts-list-drawer {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.drawer-toggle-text {
    display: inline-block;
}

.drawer-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    margin-top: 8px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.drawer-badge-danger {
    background: #ef4444;
    color: #fff;
}

.drawer-badge-warning {
    background: #f59e0b;
    color: #fff;
}

/* ===========================
   ALERTAS
   =========================== */
.alerts-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.alert-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 16px 18px;
    border-radius: 14px;
    text-decoration: none;
    border: 1px solid #e5e7eb;
    background: #f8fafc;
    transition: 0.2s ease;
}

.alert-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.alert-item-danger {
    background: #fef2f2;
    border-color: #fecaca;
}

.alert-item-warning {
    background: #fffbeb;
    border-color: #fde68a;
}

.alert-item-info {
    background: #eff6ff;
    border-color: #bfdbfe;
}

.alert-item-main {
    min-width: 0;
}

.alert-item-title {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 4px;
}

.alert-item-subtitle {
    font-size: 13px;
    color: #64748b;
}

.alert-item-side {
    text-align: right;
    flex-shrink: 0;
}

.alert-item-deadline {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 4px;
}

.alert-item-date {
    font-size: 12px;
    color: #64748b;
}

.empty-alerts {
    padding: 18px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px dashed #d1d5db;
    color: #64748b;
}

/* ===========================
   LOGIN
   =========================== */
body.login-page {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.10), transparent 30%),
        radial-gradient(circle at bottom right, rgba(14, 165, 233, 0.10), transparent 28%),
        linear-gradient(135deg, #eef4fb 0%, #e8f0f8 45%, #dde9f5 100%);
}

.login-wrapper.login-wrapper-centered {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
}

.login-card.login-card-light {
    width: 100%;
    max-width: 480px;
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 26px;
    padding: 42px 34px 34px 34px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
}

.login-brand.login-brand-light {
    text-align: center;
    margin-bottom: 28px;
}

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

.login-brand-title.login-brand-title-dark {
    font-size: 34px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.login-brand-subtitle.login-brand-subtitle-dark {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.72);
}

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

.login-form-light .form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #e2e8f0;
}

.input-icon.input-light {
    position: relative;
}

.input-icon.input-light i.fa {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 15px;
}

.input-icon.input-light input {
    width: 100%;
    height: 54px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    padding: 0 48px 0 46px;
    font-size: 15px;
    outline: none;
    transition: 0.2s ease;
}

.input-icon.input-light input::placeholder {
    color: #94a3b8;
}

.input-icon.input-light input:focus {
    border-color: #38bdf8;
    background: rgba(255, 255, 255, 0.10);
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.12);
}

.toggle-pass.toggle-pass-light {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    width: 34px;
    height: 34px;
    border-radius: 8px;
}

.toggle-pass.toggle-pass-light:hover {
    background: rgba(148, 163, 184, 0.10);
}

.btn-login.btn-login-light {
    width: 100%;
    height: 54px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #22b8db 0%, #31c7e8 100%);
    color: #082032;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 14px 28px rgba(34, 184, 219, 0.22);
    margin-top: 4px;
}

.btn-login.btn-login-light:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 32px rgba(34, 184, 219, 0.28);
}

.alert-error.alert-error-light {
    background: rgba(239, 68, 68, 0.14);
    border: 1px solid rgba(239, 68, 68, 0.30);
    color: #fecaca;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 14px;
    margin-bottom: 2px;
}

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

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

@media (max-width: 900px) {
    .topbar {
        padding: 16px 20px;
    }

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

@media (max-width: 768px) {
    .info-grid {
        grid-template-columns: 1fr;
    }

    .alert-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .alert-item-side {
        text-align: left;
    }

    .resumo-drawer {
        top: 110px;
    }

    .alertas-drawer {
        top: 210px;
    }

    .dashboard-drawer-panel {
        width: 280px;
        max-height: calc(100vh - 140px);
    }
}

@media (max-width: 640px) {
    .dashboard-cards,
    .filters-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .login-wrapper.login-wrapper-centered {
        padding: 18px;
    }

    .login-card.login-card-light {
        padding: 30px 20px 24px 20px;
        border-radius: 20px;
    }

    .login-logo.login-logo-top {
        max-width: 180px;
    }

    .login-brand-title.login-brand-title-dark {
        font-size: 28px;
    }

    .topbar-logo {
        height: 48px;
    }
}