/* =========================================================
   RESET GERAL
========================================================= */
* {
    box-sizing: border-box;
}

/* =========================================================
   VARIÁVEIS - TEMA ESCURO PADRÃO
========================================================= */
:root {
    --bg: #1b1f24;
    --bg-soft: #232a31;
    --panel: #262d35;
    --panel-2: #2b333b;
    --panel-3: #313b45;

    --border: rgba(255, 255, 255, 0.08);

    --text: #f5f7fa;
    --muted: #b7c0c9;
    --title: #ffffff;

    --accent: #2AD2C9;
    --accent-soft: rgba(42, 210, 201, 0.12);

    --success: #3ecf8e;
    --danger: #ff6b6b;
    --warning: #f5b942;

    --shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
    --radius: 16px;

    --menu-bg: rgba(22, 26, 31, 0.94);
    --menu-link: #e5edf3;
    --menu-link-hover: #ffffff;
    --menu-active: #d8fffc;

    --card-title: #ffffff;
    --row-alt: rgba(255, 255, 255, 0.015);
    --row-hover: rgba(42, 210, 201, 0.07);
    --soft-block: rgba(255, 255, 255, 0.02);
}

/* =========================================================
   VARIÁVEIS - TEMA CLARO
========================================================= */
body.theme-contrast {
    --bg: #eef2f5;
    --bg-soft: #e5eaee;
    --panel: #ffffff;
    --panel-2: #f7f9fb;
    --panel-3: #dde4ea;

    --border: rgba(0, 0, 0, 0.10);

    --text: #1f2933;
    --muted: #5f6b76;
    --title: #111827;

    --accent: #2AD2C9;
    --accent-soft: rgba(42, 210, 201, 0.12);

    --shadow: 0 10px 24px rgba(0, 0, 0, 0.08);

    --menu-bg: rgba(255, 255, 255, 0.94);
    --menu-link: #24313c;
    --menu-link-hover: #111827;
    --menu-active: #0f172a;

    --card-title: #111827;
    --row-alt: rgba(0, 0, 0, 0.02);
    --row-hover: rgba(42, 210, 201, 0.10);
    --soft-block: rgba(0, 0, 0, 0.02);
}

/* =========================================================
   BASE
========================================================= */
body {
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    margin: 0;
    padding: 0;
    background:
        radial-gradient(circle at top right, rgba(42, 210, 201, 0.05), transparent 24%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-soft) 100%);
    color: var(--text);
    transition: background 0.25s ease, color 0.25s ease;
}

a {
    color: inherit;
    text-decoration: none;
}

/* =========================================================
   CONTAINER PRINCIPAL
========================================================= */
.container {
    max-width: 1600px;
    width: calc(100% - 40px);
    margin: 26px auto 36px auto;
    padding: 28px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(8px);
}

.container h1,
.container h2,
.container h3 {
    color: var(--title);
    letter-spacing: 0.3px;
}

.container h1 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 28px;
    font-weight: 700;
}

.container h2 {
    margin-top: 34px;
    margin-bottom: 16px;
    font-size: 20px;
    font-weight: 600;
}

.subtle {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 22px;
}

/* =========================================================
   LOGIN / AUTH
========================================================= */
.auth-container {
    max-width: 420px;
    margin: 90px auto;
    padding: 28px;
    text-align: center;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

/* =========================================================
   FORMULÁRIOS
========================================================= */
input[type="text"],
input[type="password"],
input[type="date"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    margin: 10px 0;
    font-size: 14px;
    color: var(--text);
    background: var(--panel-2);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(42, 210, 201, 0.12);
    background: var(--panel);
}

textarea {
    min-height: 110px;
    resize: vertical;
}

button {
    background: linear-gradient(180deg, #2AD2C9 0%, #20b8b0 100%);
    color: #0f1418;
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
    box-shadow: 0 8px 20px rgba(42, 210, 201, 0.18);
}

button:hover {
    transform: translateY(-1px);
    opacity: 0.98;
}

.form-modern {
    max-width: 520px;
    margin: 20px auto;
    padding: 25px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
}

/* =========================================================
   ALERTAS
========================================================= */
.alert {
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 18px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid transparent;
}

.alert.success {
    background: rgba(62, 207, 142, 0.12);
    color: #2c9a69;
    border-color: rgba(62, 207, 142, 0.22);
}

.alert.error {
    background: rgba(255, 107, 107, 0.12);
    color: #d96767;
    border-color: rgba(255, 107, 107, 0.22);
}

body:not(.theme-contrast) .alert.success {
    color: #9ef0c5;
}

body:not(.theme-contrast) .alert.error {
    color: #ffb4b4;
}

/* =========================================================
   FILTROS
========================================================= */
.filtros {
    display: flex;
    gap: 18px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin: 15px 0 30px 0;
    padding: 18px;
    background: var(--soft-block);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.filtros div {
    display: flex;
    flex-direction: column;
}

.filtros label {
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 5px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.filtros input,
.filtros select {
    min-width: 220px;
}

.filtros button {
    height: 43px;
}

.filtros a {
    font-size: 14px;
    margin-left: 6px;
    color: var(--muted);
}

/* =========================================================
   TABELAS
========================================================= */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 18px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
}

.table th,
.table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table th {
    background: var(--panel-3);
    color: var(--title);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.table td {
    color: var(--text);
    font-size: 14px;
}

.table tbody tr:nth-child(even) {
    background: var(--row-alt);
}

.table tbody tr:hover {
    background: var(--row-hover);
}

.table a {
    display: inline-block;
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    transition: 0.2s;
}

.table a.edit {
    background: rgba(42, 210, 201, 0.10);
    color: #1aa39b;
    border: 1px solid rgba(42, 210, 201, 0.24);
}

.table a.delete {
    background: rgba(255, 107, 107, 0.12);
    color: #c75a5a;
    border: 1px solid rgba(255, 107, 107, 0.22);
}

body:not(.theme-contrast) .table a.edit {
    color: #7ff3ec;
}

body:not(.theme-contrast) .table a.delete {
    color: #ffc0c0;
}

/* =========================================================
   STATUS
========================================================= */
.status {
    padding: 7px 12px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 12px;
    display: inline-block;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.status.aberto {
    background: rgba(255, 107, 107, 0.12);
    color: #d96767;
    border: 1px solid rgba(255, 107, 107, 0.22);
}

.status.fechado {
    background: rgba(62, 207, 142, 0.12);
    color: #2c9a69;
    border: 1px solid rgba(62, 207, 142, 0.22);
}

body:not(.theme-contrast) .status.aberto {
    color: #ffb4b4;
}

body:not(.theme-contrast) .status.fechado {
    color: #9ef0c5;
}

/* =========================================================
   PRIORIDADES
========================================================= */
.prioridade {
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.prioridade.alta {
    background: rgba(255, 107, 107, 0.12);
    color: #d96767;
    border: 1px solid rgba(255, 107, 107, 0.22);
}

.prioridade.media,
.prioridade.média {
    background: rgba(245, 185, 66, 0.12);
    color: #c28a18;
    border: 1px solid rgba(245, 185, 66, 0.22);
}

.prioridade.baixa {
    background: rgba(42, 210, 201, 0.12);
    color: #15978f;
    border: 1px solid rgba(42, 210, 201, 0.22);
}

.prioridade.critica,
.prioridade.crítica {
    background: rgba(220, 38, 38, 0.16);
    color: #b91c1c;
    border: 1px solid rgba(220, 38, 38, 0.24);
}

body:not(.theme-contrast) .prioridade.critica,
body:not(.theme-contrast) .prioridade.crítica {
    color: #fecaca;
}

body:not(.theme-contrast) .prioridade.alta {
    color: #ffb9b9;
}

body:not(.theme-contrast) .prioridade.media,
body:not(.theme-contrast) .prioridade.média {
    color: #ffd67c;
}

body:not(.theme-contrast) .prioridade.baixa {
    color: #aefaf5;
}

/* =========================================================
   GRID / CARDS PADRÃO
========================================================= */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 18px;
    margin-bottom: 10px;
}

.card {
    position: relative;
    background: linear-gradient(180deg, var(--panel-2) 0%, var(--panel) 100%);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 24px;
    text-align: left;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, border-color 0.2s ease;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-4px);
    border-color: rgba(42, 210, 201, 0.25);
}

.card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
    opacity: 0.95;
}

.card h2 {
    font-size: 34px;
    margin: 0 0 8px 0;
    font-weight: 800;
    color: var(--card-title);
}

.card h2 .status,
.card h2 .prioridade {
    font-size: 14px;
    vertical-align: middle;
}

.card p {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.card.abertos::before { background: #ff6b6b; }
.card.fechados::before { background: #3ecf8e; }
.card.usuarios::before { background: #2AD2C9; }
.card.eventos::before { background: #ffffff; }

body.theme-contrast .card.eventos::before {
    background: #9aa6b2;
}

.card.abertos {
    background: linear-gradient(180deg, rgba(255, 107, 107, 0.07), var(--panel) 100%);
}

.card.fechados {
    background: linear-gradient(180deg, rgba(62, 207, 142, 0.07), var(--panel) 100%);
}

.card.usuarios {
    background: linear-gradient(180deg, rgba(42, 210, 201, 0.08), var(--panel) 100%);
}

.card.eventos {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), var(--panel) 100%);
}

body.theme-contrast .card.eventos {
    background: linear-gradient(180deg, rgba(154, 166, 178, 0.10), var(--panel) 100%);
}

/* =========================================================
   MENU - ESTRUTURA GERAL
========================================================= */
.menu {
    position: sticky;
    top: 0;
    z-index: 999;
    padding: 14px 18px;
    background: var(--menu-bg);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.10);
}

.menu-inner {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

/* =========================================================
   MENU - ÁREA ESQUERDA / LOGO
========================================================= */
.menu-left {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-shrink: 0;
}

.menu .logo {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 220px;
    min-width: 220px;
    height: 48px;
    flex-shrink: 0;
}

.logo-link {
    position: relative;
    display: block;
    width: 220px;
    height: 48px;
    text-decoration: none;
}

.menu .logo img {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    height: 42px;
    width: auto;
    max-width: 220px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.menu .logo .logo-dark {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.menu .logo .logo-light {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

body.theme-contrast .menu .logo .logo-dark {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

body.theme-contrast .menu .logo .logo-light {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* =========================================================
   MENU - BOTÃO MOBILE
========================================================= */
.menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    padding: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: none;
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
}

.menu-toggle:hover {
    background: var(--accent-soft);
    border-color: rgba(42, 210, 201, 0.18);
}

/* =========================================================
   MENU - PAINEL E GRUPOS (DESKTOP)
========================================================= */
.menu-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex: 1;
    min-width: 0;
}

.menu-group {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.menu-group-primary {
    justify-content: flex-start;
    flex-wrap: wrap;
}

.menu-group-secondary {
    justify-content: flex-end;
    flex-wrap: wrap;
    margin-left: auto;
}

/* =========================================================
   MENU - LINKS E AÇÕES
========================================================= */
.menu a {
    color: var(--menu-link);
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 10px;
    border: 1px solid transparent;
    transition: all 0.22s ease;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.menu a:hover {
    background: var(--accent-soft);
    border-color: rgba(42, 210, 201, 0.14);
    color: var(--menu-link-hover);
}

.menu a.active {
    background: rgba(42, 210, 201, 0.12);
    border-color: rgba(42, 210, 201, 0.28);
    color: var(--menu-active);
    box-shadow: inset 0 0 0 1px rgba(42, 210, 201, 0.08);
}

.menu a.logout {
    color: #d96b6b;
    background: rgba(255, 107, 107, 0.10);
    border-color: rgba(255, 107, 107, 0.16);
}

.menu a.logout:hover {
    background: rgba(255, 107, 107, 0.16);
    color: #ffffff;
}

body:not(.theme-contrast) .menu a.logout {
    color: #ffd6d6;
}

.menu .user-label {
    color: var(--muted);
    font-size: 12px;
    padding: 0 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
}

.theme-toggle {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    box-shadow: none;
    white-space: nowrap;
}

.theme-toggle:hover {
    background: var(--accent-soft);
    border-color: rgba(42, 210, 201, 0.18);
}

/* =========================================================
   GRÁFICOS
========================================================= */
.grafico-box,
.grafico-container {
    margin-top: 22px;
    padding: 20px;
    background: var(--soft-block);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.grafico-container {
    height: 360px;
}

#graficoChamados,
#meuGrafico {
    width: 100% !important;
    height: 340px !important;
}

/* =========================================================
   ADMIN - CARDS DE MENU
========================================================= */
.admin-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 18px;
}

.admin-card {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    width: 100%;
    padding: 24px 26px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, var(--panel-2) 0%, var(--panel) 100%);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition:
        transform 0.22s ease,
        border-color 0.22s ease,
        box-shadow 0.22s ease,
        background 0.22s ease;
}

.admin-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 5px;
    height: 100%;
    background: var(--accent);
    opacity: 0.95;
    transition: width 0.22s ease, opacity 0.22s ease;
}

.admin-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        rgba(42, 210, 201, 0.00) 0%,
        rgba(42, 210, 201, 0.05) 50%,
        rgba(42, 210, 201, 0.00) 100%
    );
    opacity: 0;
    transition: opacity 0.22s ease;
    pointer-events: none;
}

.admin-card:hover {
    transform: translateY(-4px);
    border-color: rgba(42, 210, 201, 0.28);
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.22);
    background: linear-gradient(180deg, var(--panel-3) 0%, var(--panel) 100%);
}

.admin-card:hover::before {
    width: 8px;
}

.admin-card:hover::after {
    opacity: 1;
}

.admin-card-content {
    position: relative;
    z-index: 1;
    flex: 1;
}

.admin-card-content h2 {
    margin: 0 0 8px 0;
    font-size: 22px;
    font-weight: 700;
    color: var(--title);
    letter-spacing: 0.02em;
}

.admin-card-content p {
    margin: 0;
    font-size: 14px;
    line-height: 1.55;
    color: var(--muted);
}

.admin-card-arrow {
    position: relative;
    z-index: 1;
    font-size: 28px;
    font-weight: 700;
    color: var(--accent);
    transition: transform 0.22s ease, opacity 0.22s ease;
    opacity: 0.85;
}

.admin-card:hover .admin-card-arrow {
    transform: translateX(6px);
    opacity: 1;
}

/* =========================================================
   CHECKLIST DE EVENTOS
========================================================= */
.eventos-checklist {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin: 10px 0 20px 0;
    padding: 14px;
    background: var(--soft-block);
    border: 1px solid var(--border);
    border-radius: 14px;
    max-height: 260px;
    overflow-y: auto;
}

.check-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    color: var(--text);
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.check-item:hover {
    background: var(--accent-soft);
    border-color: rgba(42, 210, 201, 0.18);
    transform: translateX(2px);
}

.check-item span {
    font-size: 14px;
    color: var(--text);
}

/* =========================================================
   RESPONSIVO - TABLETS
========================================================= */
@media (max-width: 768px) {
    .container {
        padding: 20px;
        width: calc(100% - 20px);
    }

    .filtros {
        flex-direction: column;
        align-items: stretch;
    }

    .filtros input,
    .filtros select {
        width: 100%;
        min-width: 100%;
    }

    .menu {
        padding: 12px 14px;
    }

    .menu-inner {
        display: grid;
        grid-template-columns: 1fr 52px;
        gap: 14px;
        align-items: center;
    }

    .menu-left {
        min-width: 0;
    }

    .menu .logo,
    .logo-link {
        width: 190px;
        min-width: 190px;
    }

    .menu .logo img {
        max-width: 190px;
        height: 38px;
    }

    .menu-toggle {
        display: inline-flex;
        justify-self: end;
    }

    .menu-panel {
        grid-column: 1 / -1;
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        padding-top: 8px;
        flex: initial;
    }

    .menu-panel.open {
        display: flex;
    }

    .menu-group {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 14px;
        background: var(--soft-block);
        border: 1px solid var(--border);
        border-radius: 16px;
    }

    .menu-group-secondary {
        margin-left: 0;
    }

    .menu a,
    .theme-toggle,
    .menu .user-label {
        width: 100%;
    }

    .menu .user-label {
        padding: 10px 14px;
        border: 1px solid var(--border);
        border-radius: 10px;
        background: var(--panel);
        text-align: center;
    }
}

/* =========================================================
   RESPONSIVO - CELULAR
========================================================= */
@media (max-width: 700px) {
    .grid {
        grid-template-columns: 1fr;
    }

    .table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .menu .logo,
    .logo-link {
        width: 200px;
        min-width: 200px;
    }

    .menu .logo img {
        max-width: 200px;
        height: 38px;
    }

    .admin-card {
        padding: 20px 18px;
        align-items: flex-start;
    }

    .admin-card-content h2 {
        font-size: 19px;
    }

    .admin-card-arrow {
        font-size: 24px;
    }
}