/* ==========================================================================
   Painel administrativo — CSS puro, sem framework.
   ========================================================================== */

:root {
    --ink: #11151c;
    --ink-soft: #4b5563;
    --ink-faint: #8a93a0;
    --line: #e4e7ec;
    --bg: #f3f5f8;
    --card: #fff;
    --brand: #16233f;
    --brand-soft: #24355c;
    --accent: #ffb703;
    --accent-ink: #4a3100;
    --hot: #d61f3a;
    --ok: #0f7b43;
    --warn: #b45309;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(17, 21, 28, .06), 0 4px 14px rgba(17, 21, 28, .06);
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Poppins, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 14.5px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-soft); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------------------- layout */

.admin-bar {
    background: var(--brand);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 40;
}

.admin-bar-inner {
    max-width: 1320px;
    margin: 0 auto;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.admin-logo { display: block; line-height: 0; flex-shrink: 0; }
.admin-logo img { height: 24px; width: auto; }
.admin-logo:hover { text-decoration: none; }

.admin-bar nav {
    display: flex;
    gap: 2px;
    flex: 1;
    overflow-x: auto;
    scrollbar-width: none;
}

.admin-bar nav::-webkit-scrollbar { display: none; }

.admin-bar nav a {
    color: rgba(255, 255, 255, .8);
    padding: 7px 11px;
    border-radius: 999px;
    font-size: 14px;
    white-space: nowrap;
}

.admin-bar nav a:hover { background: rgba(255, 255, 255, .1); color: #fff; text-decoration: none; }
.admin-bar nav a.is-active { background: var(--accent); color: var(--accent-ink); font-weight: 700; }

.admin-user {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: rgba(255, 255, 255, .72);
}

.admin-user form { margin: 0; }

.admin-user button {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, .28);
    color: #fff;
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 13px;
}

.admin-user button:hover { background: rgba(255, 255, 255, .12); }

.admin-main { max-width: 1320px; margin: 0 auto; padding: 20px 16px 56px; }

.page-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.page-title h1 { font-size: 21px; margin: 0; letter-spacing: -.4px; }
.page-title p { margin: 3px 0 0; color: var(--ink-soft); font-size: 14px; }

/* -------------------------------------------------------------------- cards */

.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    margin-bottom: 16px;
}

.card > h2 {
    font-size: 15px;
    margin: 0 0 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--ink-soft);
}

.cards-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.stat {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px 16px;
}

.stat .label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--ink-faint);
    font-weight: 700;
}

.stat .value { font-size: 28px; font-weight: 800; letter-spacing: -1px; line-height: 1.15; margin-top: 2px; }
.stat .hint { font-size: 13px; color: var(--ink-soft); }
.stat .up { color: var(--ok); font-weight: 700; }
.stat .down { color: var(--hot); font-weight: 700; }

.two-col { display: grid; gap: 16px; }
@media (min-width: 900px) { .two-col { grid-template-columns: 1fr 1fr; } }

.three-col { display: grid; gap: 16px; }
@media (min-width: 1100px) { .three-col { grid-template-columns: 1fr 1fr 1fr; } }

/* ------------------------------------------------------------------ tabelas */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }

th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }

th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--ink-faint);
    font-weight: 700;
    white-space: nowrap;
}

tbody tr:hover { background: #fafbfc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.thumb { width: 46px; height: 46px; object-fit: contain; border-radius: 6px; background: #f1f3f6; }
.row-title { font-weight: 600; }
.row-sub { font-size: 12px; color: var(--ink-faint); }

/* -------------------------------------------------------------------- selos */

.pill {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    padding: 3px 8px;
    border-radius: 999px;
    white-space: nowrap;
}

.pill-verde { background: #e7f5ec; color: var(--ok); }
.pill-cinza { background: #eef1f4; color: var(--ink-soft); }
.pill-vermelho { background: #fdeaed; color: var(--hot); }
.pill-amarelo { background: #fff3d6; color: var(--warn); }
.pill-azul { background: #e8eef9; color: var(--brand-soft); }

/* ------------------------------------------------------------------- botões */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 9px 14px;
    font-size: 14px;
    font-weight: 600;
    background: var(--brand);
    color: #fff;
}

.btn:hover { background: var(--brand-soft); text-decoration: none; color: #fff; }
.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { background: #ffc736; color: var(--accent-ink); }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink-soft); }
.btn-ghost:hover { background: #f7f8fa; color: var(--ink); }
.btn-danger { background: #fff; border-color: #f3c3cb; color: var(--hot); }
.btn-danger:hover { background: #fdeaed; color: var(--hot); }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-xs { padding: 4px 8px; font-size: 12px; border-radius: 6px; }

.actions { display: flex; gap: 5px; flex-wrap: wrap; }
.actions form { margin: 0; display: inline; }

/* A coluna de ações é a última da tabela e, sem uma largura mínima, o
   navegador a espreme até os botões virarem uma pilha vertical. */
td .actions { min-width: 252px; justify-content: flex-end; }

/* ----------------------------------------------------------------- formulário */

.form-grid { display: grid; gap: 16px; }
@media (min-width: 860px) { .form-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; } }

.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }

.field label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 5px;
}

.field .help { font-size: 12px; color: var(--ink-faint); margin-top: 4px; }

.field input[type=text],
.field input[type=email],
.field input[type=password],
.field input[type=url],
.field input[type=number],
.field input[type=date],
.field input[type=datetime-local],
.field input[type=file],
.field select,
.field textarea {
    width: 100%;
    font: inherit;
    font-size: 14px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--ink);
}

.field textarea { min-height: 84px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand-soft); }
.field .is-invalid { border-color: var(--hot); background: #fffafb; }
.field .error { color: var(--hot); font-size: 13px; margin-top: 4px; font-weight: 600; }

.field-row { display: grid; gap: 14px; }
@media (min-width: 560px) { .field-row { grid-template-columns: 1fr 1fr; } }

.check { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 10px; }
.check input { margin-top: 3px; width: 17px; height: 17px; flex-shrink: 0; }
.check label { font-weight: 600; font-size: 14px; margin: 0; }
.check .help { margin-top: 2px; }

fieldset { border: 0; padding: 0; margin: 0 0 20px; }

fieldset > legend {
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--ink-faint);
    padding: 0;
    margin-bottom: 10px;
}

.form-footer {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    margin-top: 6px;
}

/* ------------------------------------------------------------------ filtros */

.filter-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: flex-end;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 12px;
    margin-bottom: 16px;
}

.filter-bar .field { margin: 0; }
.filter-bar input, .filter-bar select { min-width: 150px; }
.filter-bar label { font-size: 12px; }

.period-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }

.period-tabs a {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 7px 13px;
    font-size: 13px;
    color: var(--ink-soft);
    font-weight: 600;
}

.period-tabs a:hover { text-decoration: none; background: #f7f8fa; }
.period-tabs a.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ------------------------------------------------------------------ alertas */

.alert {
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 600;
}

.alert-ok { background: #e7f5ec; color: #0b5c33; }
.alert-err { background: #fdeaed; color: #8c1226; }
.alert-err ul { margin: 6px 0 0; padding-left: 18px; font-weight: 500; }

.empty-state { text-align: center; padding: 30px 16px; color: var(--ink-soft); }
.empty-state strong { display: block; color: var(--ink); margin-bottom: 4px; font-size: 16px; }

/* --------------------------------------------------------------- barras/graf */

.bar-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.bar-list li { font-size: 14px; }

.bar-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.bar-head .n { color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-track { height: 7px; background: #eceff3; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--brand); border-radius: 999px; }
.bar-fill.alt { background: var(--accent); }

.chart-box { position: relative; height: 260px; }

/* -------------------------------------------------------------- paginação */

.pagination {
    display: flex; flex-wrap: wrap; gap: 5px; list-style: none;
    margin: 18px 0 0; padding: 0; justify-content: center;
}

.pagination a, .pagination span {
    display: block; min-width: 36px; text-align: center; padding: 7px 10px;
    border-radius: var(--radius-sm); background: #fff; border: 1px solid var(--line);
    font-size: 13px; color: var(--ink-soft);
}

.pagination a:hover { text-decoration: none; background: #f7f8fa; }
.pagination .is-current span { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
.pagination .is-disabled span { opacity: .45; }

/* ------------------------------------------------------------------- login */

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px 16px;
    background: var(--brand);
}

.login-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .3);
    padding: 26px;
    width: 100%;
    max-width: 390px;
}

.login-card h1 { font-size: 20px; margin: 0 0 4px; letter-spacing: -.4px; }
.login-card .sub { color: var(--ink-soft); font-size: 14px; margin: 0 0 20px; }
.login-card .brand { height: 34px; width: auto; margin-bottom: 18px; }
.login-foot { text-align: center; margin-top: 16px; font-size: 13px; }
.login-foot a { color: rgba(255, 255, 255, .8); }
