/* ── Painel Novo PAC — Design System ── */

:root {
    --font-sans: "IBM Plex Sans", "Aptos", "Segoe UI", sans-serif;
    --font-serif: "IBM Plex Serif", "Palatino Linotype", serif;
    --layout-width: min(1320px, calc(100vw - 32px));
    --theme-background: #f7f7f4;
    --theme-background-strong: #f0f1ec;
    --theme-foreground: #1f2937;
    --theme-foreground-muted: #5b6470;
    --theme-foreground-focus: #0f766e;
    --theme-border: #d3d8df;
    --theme-card-background: rgba(255, 255, 255, 0.96);
    --theme-accent: #b45309;
    --theme-accent-soft: #fbf3ea;
    --theme-success-soft: #edf6f4;
    --theme-info: #356c8c;
    --theme-danger: #b42318;
    --theme-shadow-sm: 0 1px 2px rgba(20, 32, 43, 0.04);
    --theme-shadow-md: 0 8px 18px rgba(20, 32, 43, 0.05);
    --theme-shadow-lg: 0 14px 28px rgba(20, 32, 43, 0.06);
    --theme-radius-sm: 10px;
    --theme-radius-md: 14px;
    --theme-radius-lg: 18px;
    --theme-radius-xl: 24px;
}

html { background: var(--theme-background); }

body {
    background:
        radial-gradient(circle at top left, rgba(15,118,110,0.08), transparent 26%),
        radial-gradient(circle at bottom right, rgba(180,83,9,0.08), transparent 24%),
        linear-gradient(180deg, #fafaf8 0%, #f7f7f4 100%);
    color: var(--theme-foreground);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

/* ── Observable overrides ── */

.observablehq, #observablehq-center, #observablehq-main,
#observablehq-footer, #observablehq-header { background: transparent; }

.observablehq a { color: var(--theme-foreground-focus); transition: color 0.18s ease; }
.observablehq a:hover { color: #0b5e57; }

.observablehq h1, .observablehq h2, .observablehq h3,
.observablehq h4, .observablehq h5, .observablehq h6 { max-width: none; }

.observablehq p, .observablehq table, .observablehq .card,
.observablehq .metrics-grid, .observablehq .table-shell { max-width: none; }

.observablehq--block { margin: 0; width: 100%; }
.observablehq--block:empty { display: none; }

#observablehq-main .observablehq--block > .observablehq {
    display: block; width: 100%; max-width: none;
}

#observablehq-header {
    border-bottom: none; position: sticky; top: 0; height: auto;
    padding: 0; background: transparent; z-index: 1000; display: block; margin: 0;
}
#observablehq-header ~ #observablehq-main { margin-top: 0; }

#observablehq-center { width: var(--layout-width); margin: 0 auto; }
#observablehq-main { width: 100%; margin: 0 auto; padding: 0 0 3rem; }
#observablehq-main.observablehq { line-height: 1.45; }

.site-shell { width: var(--layout-width); margin: 0 auto; }

/* ── Topbar ── */

.site-topbar {
    display: flex; justify-content: flex-start; gap: 1.5rem;
    align-items: flex-end; padding: 1.2rem 1rem 1rem;
}
.brand-lockup { display: flex; justify-content: flex-start; flex: 1 1 auto; }
.brand-home {
    display: flex; align-items: center; gap: 0.7rem;
    color: inherit; text-decoration: none;
}
.brand-text { display: flex; flex-direction: column; gap: 0.15rem; }
.brand-kicker {
    color: var(--theme-foreground-muted); text-transform: uppercase;
    letter-spacing: 0.08em; font-size: 0.72rem;
}
.brand-title { color: var(--theme-foreground); font-weight: 700; font-size: 1.2rem; }

.site-nav { display: flex; gap: 1rem; flex-wrap: wrap; margin-left: auto; }
.site-nav a {
    color: var(--theme-foreground); text-decoration: none;
    padding-bottom: 0.15rem; border-bottom: 2px solid transparent;
}
.site-nav a:hover { border-color: var(--theme-accent); }
.site-nav a[aria-current="page"] {
    border-color: var(--theme-foreground-focus); font-weight: 600;
}

/* ── Cards e Metrics ── */

.card, .metric-card, .table-shell {
    background: #ffffff;
    border: 1px solid rgba(215,210,199,0.9);
    border-radius: 22px;
    box-shadow: 0 22px 60px rgba(20,31,39,0.06);
}

@supports (backdrop-filter: blur(14px)) {
    .card, .metric-card, .table-shell {
        background: var(--theme-card-background);
        backdrop-filter: blur(14px);
    }
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin: 1.25rem 0 1.5rem;
}

.metric-card { padding: 1.1rem 1rem; position: relative; }
.metric-card::before {
    content: ""; position: absolute; inset: 0 0 auto; height: 4px;
    border-radius: 22px 22px 0 0;
    background: linear-gradient(90deg, rgba(47,107,79,0.9), rgba(200,154,43,0.9));
}
.metric-card.tone-fin::before { background: #e07b39; }
.metric-card.tone-ogu::before { background: #3b7bc8; }
.metric-card.tone-legado::before { background: #7a7a7a; }
.metric-card.tone-danger::before { background: var(--theme-danger); }
.metric-card.tone-accent::before { background: var(--theme-accent); }

.metric-label { margin: 0; font-size: 0.82rem; color: var(--theme-foreground-muted); }
.metric-value { display: block; margin-top: 0.6rem; font-size: 2rem; line-height: 1; }
.metric-detail { margin: 0.65rem 0 0; color: var(--theme-foreground-muted); font-size: 0.9rem; }

.metric-pill {
    display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px;
    font-size: 0.72rem; font-weight: 600; letter-spacing: 0.02em; vertical-align: middle;
}
.metric-pill--blue   { background: #e3f2fd; color: #1565c0; }
.metric-pill--orange  { background: #fff3e0; color: #e65100; }
.metric-pill--green   { background: #d4edda; color: #1b5e20; }
.metric-pill--red     { background: #fde2e2; color: #b71c1c; }
.metric-pill--gray    { background: #eeeeee; color: #616161; }
.metric-pills-row { display: flex; gap: 0.4rem; margin-top: 0.3rem; }

/* ── Grid layouts ── */

.grid-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin: 1rem 0 1.5rem; }
.grid-three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin: 1rem 0 1.5rem; }

.card { padding: 1.2rem; min-width: 0; }
.card h2, .section-heading h2 { margin: 0 0 0.3rem; font-family: var(--font-serif); font-size: 1.22rem; }
.card p, .section-heading p { margin: 0; color: var(--theme-foreground-muted); font-size: 0.88rem; }

.section-heading {
    display: flex; justify-content: space-between; align-items: end;
    gap: 1rem; margin-bottom: 0.55rem;
}

/* ── Dashboard toolbar ── */

.dashboard-toolbar {
    display: grid; grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 1rem; align-items: start; margin-bottom: 1rem;
    padding: 0.9rem 1rem; border-radius: 18px;
    background: linear-gradient(135deg, rgba(255,255,255,0.98), rgba(248,250,247,0.98));
    border: 1px solid rgba(217,221,215,0.95);
    box-shadow: 0 14px 36px rgba(20,31,39,0.05);
}
.dashboard-toolbar__title h1 {
    margin: 0; font-family: var(--font-sans);
    font-size: clamp(1.5rem, 2vw, 2rem); line-height: 1.12; font-weight: 700;
}
.dashboard-toolbar__title p {
    margin: 0.2rem 0 0; color: var(--theme-foreground-muted);
    font-size: 0.92rem; white-space: nowrap;
}
.dashboard-toolbar__meta {
    display: flex; justify-content: end; align-items: center;
    font-size: 0.78rem; color: var(--theme-foreground-muted); white-space: nowrap;
}

/* ── Table ── */

.table-shell { padding: 1.2rem; margin: 1rem 0 1.5rem; }
.table-wrap { overflow: auto; max-width: 100%; }

.data-table { width: 100%; border-collapse: collapse; font-size: 0.94rem; }
.data-table th, .data-table td {
    padding: 0.85rem 0.65rem; border-bottom: 1px solid rgba(215,210,199,0.75); vertical-align: top;
}
.data-table th { text-align: left; color: var(--theme-foreground-muted); font-weight: 600; }

.status-pill {
    display: inline-flex; align-items: center; padding: 0.28rem 0.55rem;
    border-radius: 999px; font-size: 0.82rem;
}

/* ── Pagination ── */

.table-pagination {
    display: flex; align-items: center; justify-content: space-between;
    gap: 0.75rem 1rem; flex-wrap: wrap; margin: 0.5rem 0 0.9rem;
}
.table-pagination__summary { font-size: 0.84rem; color: var(--theme-foreground-muted); }
.table-pagination__actions { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.table-pagination__button {
    min-height: 36px; padding: 0 0.8rem;
    border: 1px solid rgba(211,216,223,0.96); border-radius: 10px;
    background: #ffffff; color: var(--theme-foreground);
    font: inherit; font-size: 0.86rem; font-weight: 600; cursor: pointer;
}
.table-pagination__button:hover:not(:disabled) { background: #fafaf8; border-color: rgba(163,172,184,0.95); }
.table-pagination__button[data-active="true"] {
    background: rgba(15,118,110,0.08); border-color: rgba(15,118,110,0.18); color: #0b5e57;
}
.table-pagination__button:disabled { opacity: 0.45; cursor: not-allowed; }
.table-pagination__ellipsis { padding: 0 0.15rem; color: var(--theme-foreground-muted); font-size: 0.9rem; }

/* ── Filter bar ── */

.filter-bar {
    display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: end;
    margin-bottom: 1rem; padding: 0.9rem 1rem; border-radius: 18px;
    background: rgba(255,255,255,0.92);
    border: 1px solid rgba(217,221,215,0.95);
    box-shadow: 0 10px 26px rgba(20,31,39,0.04);
}
.filter-bar label { font-size: 0.84rem; color: var(--theme-foreground-muted); }

/* ── Footer ── */

.footer-shell { padding: 1.2rem 0 2.5rem; color: var(--theme-foreground-muted); font-size: 0.9rem; }
.footer-content { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.footer-logo { height: 48px; }
.page-note-divider { border: none; border-top: 1px solid var(--theme-border); margin: 2.5rem 0 1.5rem; }

/* ── Responsive ── */

@media (max-width: 768px) {
    .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-two, .grid-three { grid-template-columns: 1fr; }
    .site-topbar { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
    .site-nav { margin-left: 0; }
    .dashboard-toolbar { grid-template-columns: 1fr; }
}
