:root {
    color-scheme: dark;
    --site-header-height: 84px;
    --ink-950: #111111;
    --ink-900: #1e1e1e;
    --ink-700: #3c3b37;
    --stone-500: #888780;
    --stone-300: #b4b2a9;
    --brand-500: #97c459;
    --brand-600: #6fa832;
    --bg: #141414;
    --surface: rgba(34, 34, 34, 0.86);
    --surface-strong: rgba(28, 28, 28, 0.96);
    --border: rgba(180, 178, 169, 0.28);
    --text: #ece9df;
    --muted: #b7b3a8;
    --accent: var(--brand-500);
    --accent-strong: var(--brand-600);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Avenir Next", "Segoe UI", sans-serif;
    color: var(--text);
    /* Solid, like the home page — no background gradient. */
    background: var(--bg);
}

/* =========================================================================
   App shell: shared header / main / footer layout for every page.
   Header and footer are fixed rows; the central area (.app-body) is the only
   thing that scrolls, so the footer nav pill sits at the exact same spot on
   every screen.
   ========================================================================= */

body.app-shell {
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
}

.app-body {
    min-height: 0;
    overflow: auto;
    display: flex;
    flex-direction: column;
}

.app-body > main {
    flex: 1 1 auto;
    min-height: 0;
}

.app-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 5.5rem;
}

/* Pages without a nav pill (landing, admin) leave the footer empty. */
.app-footer:empty {
    display: none;
}

/* Home page: solid dark background, no gradient. */
body.home-page {
    background: var(--bg);
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid rgba(180, 178, 169, 0.22);
    background: rgba(20, 20, 20, 0.82);
    backdrop-filter: blur(8px);
}

.site-header__inner {
    width: min(1320px, calc(100vw - 2rem));
    margin: 0 auto;
    min-height: calc(var(--site-header-height) - 20px);
    padding-top: 10px;
    padding-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Bottom-left of the header, out of the way of the nav. */
.site-build {
    align-self: flex-end;
    color: var(--stone-500);
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.site-nav {
    display: flex;
    gap: 0.9rem;
}

.site-nav a {
    color: var(--muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.94rem;
}

.site-nav a:hover {
    color: var(--brand-500);
}

.page-shell {
    width: min(1080px, calc(100vw - 2rem));
    margin: 0 auto;
    padding: 4rem 0 5rem;
}

.hero {
    padding: 2rem;
}

.hero.compact {
    padding-bottom: 1rem;
}

/* Admin action row: [Início]  [Alterar senha]   [Sair]. The gap before Sair is
   a touch wider than the one before "Alterar senha", so logout reads as set
   apart from the two navigation buttons. */
.admin-hero__actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.85rem;
}

.admin-hero__actions .button {
    margin-top: 0;
}

.admin-hero__actions .logout-form {
    margin: 0 0 0 0.6rem;
}

.eyebrow {
    margin: 0 0 0.75rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--stone-300);
    font-size: 0.78rem;
}

h1 {
    margin: 0;
    font-size: clamp(2.5rem, 6.5vw, 5rem);
    line-height: 0.98;
}

.lede {
    max-width: 42rem;
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--muted);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 0.75rem;
    padding: 0.62rem 1rem;
    border-radius: 0.65rem;
    border: 1px solid rgba(111, 168, 50, 0.45);
    background: linear-gradient(180deg, var(--brand-500) 0%, var(--brand-600) 100%);
    color: #14200d;
    text-decoration: none;
    font-weight: 700;
}

.category-actions {
    display: flex;
    gap: 0.6rem;
}

.category-actions .button {
    margin-top: 0;
    min-width: 180px;
}

.hidden {
    display: none;
}

.danger-button {
    border-color: rgba(209, 92, 89, 0.55);
    background: rgba(178, 62, 58, 0.16);
    color: #f3d8d8;
}

.danger-button:hover {
    background: rgba(178, 62, 58, 0.26);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    padding: 0 2rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 1.25rem;
    padding: 1.25rem;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.card h2 {
    margin-top: 0;
}

.card p,
.card li {
    color: var(--muted);
    line-height: 1.6;
}

.admin-shell {
    width: min(1320px, calc(100vw - 2rem));
}

.admin-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    padding: 0 2rem;
}

.admin-card {
    background: var(--surface-strong);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1rem;
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.35);
}

.admin-card h2,
.admin-card h3 {
    margin-top: 0;
}

.stacked-form {
    display: grid;
    gap: 0.55rem;
    margin-bottom: 0.9rem;
}

.stacked-form label,
.check {
    display: grid;
    gap: 0.28rem;
    color: var(--stone-300);
    font-size: 0.92rem;
}

input,
select,
textarea,
button {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid rgba(180, 178, 169, 0.35);
    background: rgba(17, 17, 17, 0.95);
    color: var(--text);
    border-radius: 0.55rem;
    padding: 0.48rem 0.6rem;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid rgba(151, 196, 89, 0.38);
    border-color: var(--brand-600);
}

button {
    border-radius: 0.55rem;
    border: 1px solid rgba(180, 178, 169, 0.32);
    background: rgba(42, 42, 42, 0.96);
    color: var(--text);
    padding: 0.44rem 0.72rem;
    cursor: pointer;
}

button:hover {
    background: rgba(55, 55, 55, 0.96);
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
    margin-bottom: 0.35rem;
}

.inline-form.wide input[type="text"]:first-child {
    min-width: 260px;
    flex: 1;
}

.danger-inline button {
    border-color: rgba(209, 92, 89, 0.45);
    background: rgba(178, 62, 58, 0.18);
}

.danger-inline button:hover {
    background: rgba(178, 62, 58, 0.28);
}

.table-wrap {
    overflow-x: auto;
}

.category-tree {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.45rem;
}

.category-tree li {
    display: block;
    padding-left: calc(var(--depth) * 1.1rem);
}

.category-tree li.is-collapsed>ul {
    display: none;
}

.tree-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    width: 100%;
    padding: 0.35rem 0.4rem;
    border-radius: 0.4rem;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: color 120ms ease, background-color 120ms ease;
}

.tree-item:hover {
    color: #f5f2e7;
    background: rgba(255, 255, 255, 0.04);
}

.tree-item:focus-visible {
    outline: none;
    color: #f5f2e7;
    background: rgba(255, 255, 255, 0.04);
}

.tree-item.is-selected {
    color: #d9efb6;
    background: rgba(111, 168, 50, 0.16);
}

.tree-item__label {
    color: inherit;
    font-size: 0.95rem;
    font-weight: 600;
}

.tree-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 1.4rem;
    width: 1.4rem;
    height: 1.4rem;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    color: inherit;
    transition: transform 120ms ease;
    flex-shrink: 0;
}

.tree-toggle.is-hidden {
    visibility: hidden;
}

.tree-toggle[aria-expanded="false"] {
    transform: rotate(-90deg);
}

.tree-toggle__icon {
    display: block;
}

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

th,
td {
    border-top: 1px solid rgba(180, 178, 169, 0.24);
    padding: 0.45rem 0.2rem;
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--stone-300);
    font-size: 0.86rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.muted {
    color: var(--stone-500);
    display: block;
    margin-bottom: 0.35rem;
}

@media (max-width: 700px) {
    .page-shell {
        padding-top: 2rem;
    }

    .hero,
    .card-grid,
    .admin-grid,
    .admin-tabs,
    .admin-panel,
    .admin-two-pane {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* =========================================================================
   Admin: tabs + two-pane (Temas / Localidades)
   ========================================================================= */

.admin-tabs {
    display: flex;
    gap: 0.4rem;
    padding: 0 2rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.admin-tab {
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0.5rem 0.5rem 0 0;
    background: transparent;
    color: var(--stone-300);
    font-weight: 600;
    padding: 0.55rem 0.9rem;
}

.admin-tab:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
}

.admin-tab.is-active {
    color: var(--text);
    border-bottom-color: var(--brand-500);
    background: rgba(111, 168, 50, 0.1);
}

.admin-panel {
    padding: 0 2rem;
}

/* ---------- Settings row + toggle switch (Configurações) ---------- */
.setting-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    padding-top: 0.5rem;
}

.setting-row__text {
    max-width: 46ch;
}

.setting-row__text h3 {
    margin: 0 0 0.35rem;
}

.setting-warning {
    color: #e6b566;
    font-weight: 600;
    margin-top: 0.5rem;
}

.switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    flex: 0 0 auto;
}

.switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.switch__slider {
    position: absolute;
    inset: 0;
    cursor: pointer;
    background: rgba(180, 178, 169, 0.28);
    border-radius: 999px;
    transition: background 0.15s ease;
}

.switch__slider::before {
    content: "";
    position: absolute;
    height: 22px;
    width: 22px;
    left: 3px;
    top: 3px;
    background: var(--text);
    border-radius: 50%;
    transition: transform 0.15s ease;
}

.switch input:checked + .switch__slider {
    background: var(--brand-600);
}

.switch input:checked + .switch__slider::before {
    transform: translateX(24px);
}

.switch input:disabled + .switch__slider {
    cursor: not-allowed;
    opacity: 0.5;
}

.switch input:focus-visible + .switch__slider {
    outline: 2px solid var(--brand-500);
    outline-offset: 2px;
}

.admin-two-pane {
    display: grid;
    grid-template-columns: minmax(260px, 340px) 1fr;
    gap: 1rem;
    align-items: start;
}

.tp-left,
.tp-right {
    background: var(--surface-strong);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1rem;
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.35);
}

.tp-left__head,
.tp-right__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    margin-bottom: 0.7rem;
}

.tp-left__head h2,
.tp-right__head h2 {
    margin: 0;
    font-size: 1.15rem;
}

.theme-editor {
    margin-top: 0.9rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--border);
}

.theme-editor h3 {
    margin: 0 0 0.6rem;
    font-size: 0.98rem;
}

.tp-empty {
    color: var(--stone-500);
    padding: 1.4rem 0.4rem;
    text-align: center;
}

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

.question-create {
    border: 1px solid var(--border);
    border-radius: 0.8rem;
    padding: 0.9rem;
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.02);
    display: grid;
    gap: 0.55rem;
}

.question-create h3 {
    margin: 0;
    font-size: 0.98rem;
}

.question-list {
    display: grid;
    gap: 0.8rem;
}

.question-card {
    border: 1px solid var(--border);
    border-radius: 0.8rem;
    padding: 0.8rem 0.9rem;
    background: rgba(255, 255, 255, 0.02);
}

.qc-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.6rem;
}

.qc-prompt {
    margin: 0;
    font-weight: 600;
    line-height: 1.4;
}

.qc-actions {
    display: flex;
    gap: 0.3rem;
    flex-shrink: 0;
}

.qc-actions form {
    display: inline-flex;
}

.qc-badge {
    display: inline-block;
    margin-left: 0.4rem;
    padding: 0.05rem 0.4rem;
    border-radius: 0.4rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #e6c07a;
    background: rgba(230, 192, 122, 0.14);
    vertical-align: middle;
}

.alt-list {
    list-style: none;
    margin: 0.6rem 0 0;
    padding: 0;
    display: grid;
    gap: 0.3rem;
}

.alt-list li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--muted);
    font-size: 0.92rem;
}

.alt-pos {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.5rem;
    padding: 0 0.35rem;
    border-radius: 0.4rem;
    background: rgba(111, 168, 50, 0.16);
    color: #d9efb6;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.alt-label {
    color: var(--text);
}

.alt-empty {
    color: var(--stone-500);
    font-style: italic;
}

.alt-hint {
    margin: 0 0 0.5rem;
    font-size: 0.82rem;
    color: var(--stone-500);
    line-height: 1.45;
}

/* ---- Small icon buttons ---- */

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    padding: 0;
    border-radius: 0.45rem;
    line-height: 1;
    flex-shrink: 0;
}

/* Transient confirmation after an in-place save keeps the editor open. */
.is-saved {
    border-color: rgba(96, 178, 120, 0.55) !important;
    background: rgba(72, 160, 100, 0.22) !important;
    color: #8fd6a8 !important;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.save-error {
    border-color: rgba(209, 92, 89, 0.6) !important;
    background: rgba(178, 62, 58, 0.24) !important;
    color: #e79b98 !important;
}

.icon-btn.danger {
    border-color: rgba(209, 92, 89, 0.45);
    background: rgba(178, 62, 58, 0.16);
    color: #e79b98;
}

.icon-btn.danger:hover {
    background: rgba(178, 62, 58, 0.3);
}

/* ---- In-place question editor ---- */

.qc-edit {
    margin-top: 0.6rem;
    padding-top: 0.8rem;
    border-top: 1px dashed var(--border);
    display: grid;
    gap: 0.7rem;
}

.qc-edit h4 {
    margin: 0;
    font-size: 0.9rem;
    color: var(--stone-300);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.qc-edit-form {
    display: grid;
    gap: 0.5rem;
}

.qc-edit-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.7rem;
}

.qc-edit-row label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--stone-300);
    font-size: 0.9rem;
}

.qc-edit-row input[type="number"] {
    width: 5rem;
}

.alt-edit-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.4rem;
}

.alt-edit {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.alt-edit-form,
.alt-add-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    flex: 1;
}

.alt-edit-form input,
.alt-add-form input {
    width: auto;
}

.alt-edit-form input[name="label"],
.alt-add-form input[name="label"] {
    flex: 1 1 160px;
    min-width: 130px;
}

.alt-edit-form input.num,
.alt-add-form input.num {
    width: 4.5rem;
    flex: 0 0 auto;
}

.alt-edit-form input[type="checkbox"],
.alt-add-form input[type="checkbox"],
.qc-edit-row input[type="checkbox"] {
    width: auto;
}

.alt-add-form {
    padding-top: 0.4rem;
    border-top: 1px solid var(--border);
}

.qc-edit-foot {
    display: flex;
    justify-content: flex-end;
}

.button.ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.button.ghost:hover {
    background: rgba(255, 255, 255, 0.05);
}

@media (max-width: 900px) {
    .admin-two-pane {
        grid-template-columns: 1fr;
    }
}

/* =========================================================================
   Guided voter-flow footer (Local / Temas)
   ========================================================================= */

.flow-footer {
    /* The navigation pill. A fixed-size box centered by .app-footer, so it has
       the same size and position on every page — only the label text changes. */
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    /* Fixed width => the box is identical regardless of label length. */
    width: 22rem;
    max-width: calc(100vw - 2rem);
    height: 3.4rem;
    padding: 0 1.1rem;
    border: 1px solid var(--border);
    border-radius: 0.9rem;
    background: rgba(20, 20, 20, 0.6);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.flow-footer__label {
    /* Fixed width keeps the two chevrons at the same spacing regardless of the
       label text, so their size and position don't shift between screens. */
    width: 11rem;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--text);
}

.flow-footer__chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: rgba(42, 42, 42, 0.9);
    color: var(--text);
    text-decoration: none;
    transition: background-color 120ms ease;
}

.flow-footer__chevron:hover {
    background: rgba(55, 55, 55, 0.95);
}

.flow-footer__chevron.is-disabled {
    opacity: 0.28;
    pointer-events: none;
}

/* ===================== Monitor do sistema ===================== */

.monitor-status {
    color: var(--muted);
    font-size: 0.9rem;
    align-self: center;
}

.gauge-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    margin-bottom: 1rem;
}

/* There are exactly four gauges: on a wide screen say so, instead of letting
   auto-fit wrap them 3 + 1. */
@media (min-width: 1040px) {
    .gauge-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.gauge-card {
    background: var(--surface-strong);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.1rem 1.1rem 0.9rem;
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.gauge-card h2 {
    margin: 0 0 0.4rem;
    font-size: 0.98rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--text);
}

.gauge-arc {
    width: 100%;
    max-width: 168px;
}

.gauge-arc__svg {
    width: 100%;
    height: auto;
    display: block;
}

.gauge-arc__track {
    fill: rgba(180, 178, 169, 0.16);
}

.gauge-arc__value {
    transition: d 0.4s ease, fill 0.4s ease;
}

.gauge-arc__label {
    fill: var(--text);
    font-size: 25px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.gauge-detail {
    margin: 0.15rem 0 0;
    color: var(--text);
    font-size: 0.92rem;
    font-variant-numeric: tabular-nums;
}

.gauge-source {
    margin: 0.3rem 0 0;
    color: var(--stone-500);
    font-size: 0.75rem;
    line-height: 1.4;
}

.gauge-spark {
    width: 100%;
    margin-top: 0.55rem;
}

.spark__svg {
    width: 100%;
    height: 46px;
    display: block;
}

.monitor-traffic {
    margin: 0 0 1rem;
}

.monitor-traffic__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.monitor-headline {
    margin: 0;
    font-size: 2.1rem;
    font-weight: 600;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.monitor-headline small {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--muted);
}

.monitor-spark {
    margin-top: 0.6rem;
}

.monitor-bars {
    margin-top: 0.6rem;
}

.bars__svg {
    width: 100%;
    height: auto;
    display: block;
}

.bars__bar rect {
    fill: var(--brand-500);
    fill-opacity: 0.85;
    rx: 2px;
}

.bars__bar:hover rect {
    fill-opacity: 1;
}

.bars__value {
    fill: var(--muted);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.bars__day {
    fill: var(--stone-500);
    font-size: 10px;
    font-variant-numeric: tabular-nums;
}

/* The table is the one element that can outgrow a narrow screen; it scrolls
   inside its own box so the page body never scrolls sideways. */
.table-scroll {
    overflow-x: auto;
}

.monitor-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.monitor-table th,
.monitor-table td {
    padding: 0.5rem 0.6rem;
    border-bottom: 1px solid rgba(180, 178, 169, 0.14);
    text-align: left;
    white-space: nowrap;
}

.monitor-table th {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.monitor-table td.num,
.monitor-table th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.monitor-table td.muted {
    color: var(--stone-500);
}

.monitor-table td.route {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 0.85rem;
    color: var(--text);
}

.monitor-empty td {
    color: var(--stone-500);
    font-style: italic;
}

.method {
    display: inline-block;
    min-width: 3.4rem;
    padding: 0.12rem 0.4rem;
    border-radius: 0.4rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-align: center;
    background: rgba(180, 178, 169, 0.16);
    color: var(--muted);
}

.method--get {
    background: rgba(151, 196, 89, 0.18);
    color: var(--brand-500);
}

.method--post {
    background: rgba(227, 179, 65, 0.18);
    color: #e3b341;
}

.monitor-status-row {
    margin-bottom: 0.9rem;
}

/* ===== Câmara dos Deputados (admin tab) ===== */

.camara-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.camara-controls__leg {
    display: grid;
    gap: 0.28rem;
    color: var(--stone-300);
    font-size: 0.92rem;
    min-width: 260px;
}

.camara-controls__buttons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    /* Fill the row so #camara-apagar's right edge lines up with the
       "Dados a baixar" fieldset outline below. */
    flex: 1 1 auto;
}

.camara-controls__buttons #camara-apagar {
    margin-left: auto;
}

.camara-arquivos-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.92rem;
    color: var(--stone-300);
    white-space: nowrap;
}

.camara-arquivos-toggle input[type="checkbox"],
.camara-auto-deps input[type="checkbox"],
.camara-anos input[type="checkbox"] {
    width: auto;
}

.camara-anos {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.3rem 0.8rem;
    font-size: 0.9rem;
    color: var(--stone-300);
    padding-bottom: 0.35rem;
}

.camara-anos label {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.camara-auto-deps {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: -0.4rem 0 1rem;
    font-size: 0.92rem;
    color: var(--stone-300);
}

.camara-deps-dialog {
    background: var(--surface, #1c1b1a);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.1rem 1.3rem;
    max-width: 32rem;
}

.camara-deps-dialog::backdrop {
    background: rgba(0, 0, 0, 0.55);
}

.camara-deps-dialog__actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    margin-top: 1rem;
}

.camara-apagar-dialog {
    background: var(--surface, #1c1b1a);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.1rem 1.3rem;
    max-width: 40rem;
    width: calc(100vw - 2rem);
}

.camara-apagar-dialog::backdrop {
    background: rgba(0, 0, 0, 0.55);
}

.camara-apagar-dialog h4 {
    margin: 0 0 0.25rem;
}

.camara-apagar-list {
    list-style: none;
    margin: 0.75rem 0;
    padding: 0;
    max-height: 45vh;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 0.6rem;
}

.camara-apagar-list > li {
    border-bottom: 1px solid var(--border);
}

.camara-apagar-list > li:last-child {
    border-bottom: 0;
}

.camara-apagar-list > li.muted {
    padding: 0.6rem 0.75rem;
}

.camara-apagar-list label {
    display: flex;
    align-items: baseline;
    gap: 0.55rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.92rem;
    cursor: pointer;
}

.camara-apagar-list input[type="checkbox"] {
    width: auto;
}

.camara-apagar-item__name {
    font-weight: 500;
}

.camara-apagar-item__badge {
    font-size: 0.72rem;
    padding: 0.05rem 0.4rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    color: var(--muted);
    white-space: nowrap;
}

.camara-apagar-item__badge--por_ano {
    color: var(--accent);
    border-color: var(--accent);
}

.camara-apagar-item__badge--global {
    color: #e0a458;
    border-color: #e0a458;
}

.camara-apagar-item__count {
    margin-left: auto;
    color: var(--muted);
    white-space: nowrap;
}

.camara-apagar-note__global {
    color: #e0a458;
}

.camara-apagar-dialog__actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    margin-top: 1rem;
}

.camara-fases {
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 0.75rem 0.9rem 0.9rem;
    margin: 0 0 1rem;
}

.camara-fases legend {
    padding: 0 0.4rem;
    font-size: 0.92rem;
    color: var(--stone-300);
}

.camara-fases__shortcuts {
    margin-left: 0.5rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.linklike {
    background: none;
    border: 0;
    padding: 0;
    color: var(--accent);
    cursor: pointer;
    font-size: inherit;
    text-decoration: underline;
}

.camara-fases__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.35rem 1rem;
}

.camara-fases__grid label {
    display: flex;
    align-items: baseline;
    gap: 0.45rem;
    font-size: 0.92rem;
    color: var(--text);
}

.camara-fases__grid input[type="checkbox"] {
    width: auto;
}

.camara-progress {
    margin-bottom: 1rem;
}

.camara-progress progress {
    width: 100%;
    height: 0.9rem;
    accent-color: var(--accent);
}

.camara-counts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.camara-counts__break {
    grid-column: 1 / -1;
    height: 0;
}

.camara-counts__cell {
    background: rgba(17, 17, 17, 0.6);
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    padding: 0.5rem 0.65rem;
    display: grid;
    gap: 0.1rem;
}

.camara-counts__cell strong {
    font-size: 1.05rem;
    color: var(--brand-500);
}

.camara-counts__cell span {
    font-size: 0.78rem;
    color: var(--muted);
}

.camara-log {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.8rem;
    line-height: 1.45;
    background: rgba(10, 10, 10, 0.8);
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    padding: 0.6rem 0.75rem;
    max-height: 320px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.camara-log__line--warn {
    color: #e3b341;
}

.camara-log__line--error {
    color: #e0603f;
}

.camara-log__line--debug {
    color: var(--muted);
}

/* The UA's [hidden] display:none loses to any author display rule (e.g.
   .button's inline-flex), silently un-hiding elements. Make hidden final. */
[hidden] {
    display: none !important;
}

.button.danger {
    background: #7a2e1d;
    color: #f5ded6;
}

.button.danger:hover {
    background: #933722;
}

.camara-counts__title {
    margin: 0.9rem 0 0.35rem;
    font-size: 0.95rem;
    color: var(--stone-300);
}

.camara-counts__note {
    margin: 0 0 0.5rem;
    font-size: 0.82rem;
}

/* ===== Backup tab ===== */

.backup-actions {
    display: flex;
    gap: 0.6rem;
    margin: 0.6rem 0;
}

.backup-warning {
    background: rgba(122, 46, 29, 0.25);
    border: 1px solid #7a2e1d;
    border-radius: 0.6rem;
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
}

/* Space the stacked cards in the Backup tab so their outlines don't touch. */
.admin-panel[data-panel="backup"] {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.backup-table-wrap {
    overflow-x: auto;
}

/* Restore listing: cap the height and scroll vertically when it overflows,
   keeping the (sortable) header visible. */
.backup-table-wrap--scroll {
    max-height: 22rem;
    overflow-y: auto;
}

.backup-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

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

.backup-table-wrap--scroll thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface-strong);
}

.backup-table--sortable th.is-sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.backup-table--sortable th.is-sortable:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
}

.backup-table--sortable th.is-sortable .sort-arrow {
    color: var(--brand-500);
    font-weight: 700;
}

.backup-table__name {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.8rem;
    word-break: break-all;
}

.backup-agenda-enable {
    display: block;
    margin-bottom: 0.6rem;
}

.backup-agenda-grid {
    display: grid;
    gap: 0.45rem;
    margin-bottom: 0.6rem;
}

.backup-agenda-grid input[type="number"] {
    width: 4.5rem;
}
