/* ============ VERYA · skin "grafite" ============
   Loaded after styles.css on the panel pages, for screens only (the link
   carries media="screen"): paper keeps the one-sheet layout of styles.css. Neutral graphite surfaces in
   dark and white ones in light: bevelled cards, a floating sidebar, boxed
   controls, IBM Plex Mono caps for labels. Only surfaces, type and layout
   live here: every colour comes from the brand tokens in styles.css, and
   each AI's own colour from charts.js. Shape follows the brand book:
   radius 32 for cards, 26 for KPI cards, 14 for controls. */

:root[data-theme="dark"] {
--shadow-card: 0 1px 2px rgba(0,0,0,.4), 0 20px 40px -20px rgba(0,0,0,.55), 0 60px 90px -50px rgba(0,0,0,.7);
/* Satin glass, dark (brand book): white at 3.5 to 13%. */
--surface: linear-gradient(165deg, rgba(255,255,255,.13), rgba(255,255,255,.045) 55%, rgba(255,255,255,.08));
--surface-border: rgba(255,255,255,.14);
--bevel: inset 0 1px 0 rgba(255,255,255,.2), inset 0 0 0 5px rgba(5,7,13,.45), inset 0 0 0 6px rgba(255,255,255,.07);
--control: rgba(255,255,255,.07);
--seg-bg: transparent;
--sb-text:#C3C8D4;
--sb-strong:#FFFFFF;
--sb-muted:#8F97A8;
--sb-line:rgba(255,255,255,.14);
--sb-pill:rgba(255,255,255,.13);
}

:root[data-theme="light"] {
--shadow-card: var(--glass-light-shadow);
--topbar-fade: none;
/* Satin glass (brand book): white at 46 to 78%, so the light of the page shows through. */
--surface: var(--glass-light);
--surface-border: rgba(255,255,255,.9);
--bevel: inset 0 1px 0 rgba(255,255,255,.95), inset 0 0 0 5px rgba(255,255,255,.42), inset 0 0 0 6px rgba(10,26,51,.05);
--control: #FFFFFF;
--seg-bg: transparent;
--sb-text:#2E3A50;
--sb-strong:#0A1A33;
--sb-muted:#6B7487;
--sb-line:rgba(10,26,51,.07);
--sb-pill:#FFFFFF;
}

/* ---------- page ---------- */
:root[data-theme="dark"], :root[data-theme="light"] { background: var(--bg); }
:root[data-theme="dark"] body {
/* Brand book: a blue light low in the middle, lavender and ice in the corners. */
background: var(--page-dark);
background-attachment: fixed;
}
:root[data-theme="light"] body { background: transparent; }
.bg-shapes, :root[data-theme="light"] .bg-shapes { display: none !important; }

@media (min-width: 821px) {
.app, :root[data-theme="light"] .app { grid-template-columns: 274px 1fr; }
.main { max-width: 1500px; padding: 0 26px 40px 22px; }
}

/* ---------- sidebar: a floating panel ---------- */
.sidebar,
:root[data-theme="light"] .sidebar,
:root[data-theme="dark"] .sidebar {
margin: 12px 0 12px 16px;
height: calc(100vh - 24px); top: 12px;
padding: 26px 18px 18px;
border-radius: 32px;
border: 1px solid var(--sb-line);
backdrop-filter: none; -webkit-backdrop-filter: none;
}
:root[data-theme="dark"] .sidebar {
background:
  radial-gradient(360px 300px at 50% 108%, rgba(166,166,218,.30), transparent 70%),
  linear-gradient(165deg, rgba(255,255,255,.13), rgba(255,255,255,.045) 55%, rgba(255,255,255,.08));
-webkit-backdrop-filter: blur(26px) saturate(150%); backdrop-filter: blur(26px) saturate(150%);
box-shadow: 0 18px 44px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.2);
}
:root[data-theme="light"] .sidebar {
background: var(--surface);
border-color: rgba(255,255,255,.9);
-webkit-backdrop-filter: blur(26px) saturate(150%); backdrop-filter: blur(26px) saturate(150%);
box-shadow: inset 0 1px 0 rgba(255,255,255,.95), 0 1px 2px rgba(10,26,51,.05), 0 12px 24px -12px rgba(10,26,51,.12), 0 40px 70px -40px rgba(10,26,51,.24);
}
.sidebar::after, :root[data-theme="light"] .sidebar::after, :root[data-theme="dark"] .sidebar::after { display: none; }

.brand { display: block; padding: 4px 8px 24px; }
.brand-mark { display: block; height: 19px; width: auto; margin-bottom: 14px; }
.brand-mark.for-dark, :root[data-theme="dark"] .brand-mark.for-light { display: none; }
:root[data-theme="dark"] .brand-mark.for-dark { display: block; }
.brand-sub, :root[data-theme="light"] .brand-sub { font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; color: var(--sb-text); margin-top: 0; }
.brand-spec, :root[data-theme="light"] .brand-spec { font-size: 12.5px; color: var(--sb-muted); margin-top: 3px; }

.nav-section, :root[data-theme="light"] .nav-section { font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--sb-muted); margin: 22px 10px 10px; }
.nav-item, :root[data-theme="light"] .nav-item { font-size: 15px; font-weight: 400; color: var(--sb-text); padding: 10px 14px; border-radius: 14px; margin-bottom: 2px; gap: 10px; }
.nav-dot { width: 6px; height: 6px; border-radius: 999px; margin-left: -2px; display: none; }
.nav-item:hover, :root[data-theme="light"] .nav-item:hover { color: var(--sb-strong); background: color-mix(in srgb, var(--sb-pill) 55%, transparent); }
/* The active item is pressed into the bar (the brand book's inner bevel):
   a shadow at its top edge, a line of light at its foot. */
.nav-item.active,
:root[data-theme="light"] .nav-item.active,
:root[data-theme="dark"] .nav-item.active {
color: var(--sb-strong); font-weight: 500;
backdrop-filter: none; -webkit-backdrop-filter: none;
}
:root[data-theme="light"] .nav-item.active {
background: rgba(10,26,51,.045);
box-shadow: inset 0 2px 3px rgba(10,26,51,.10), inset 0 -1px 0 rgba(255,255,255,.95), inset 0 0 0 1px rgba(10,26,51,.04);
}
:root[data-theme="dark"] .nav-item.active {
background: rgba(0,0,0,.24);
box-shadow: inset 0 2px 4px rgba(0,0,0,.45), inset 0 -1px 0 rgba(255,255,255,.12), inset 0 0 0 1px rgba(255,255,255,.05);
}
.nav-item.active .nav-dot,
:root[data-theme="light"] .nav-item.active .nav-dot { display: block; background: var(--accent); box-shadow: none; }

.side-card { margin-top: auto; padding: 14px 16px; border-radius: 18px; border: 1px solid var(--sb-line); background: color-mix(in srgb, var(--sb-pill) 60%, transparent); display: flex; flex-direction: column; gap: 3px; }
:root[data-theme="light"] .side-card { background: rgba(255,255,255,.5); border-color: rgba(255,255,255,.9); }
.side-card small { font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--sb-muted); margin-bottom: 4px; }
.side-card strong { font-size: 15px; font-weight: 600; color: var(--sb-strong); }
.side-card span, .side-card button { font-size: 12.5px; color: var(--sb-text); }
.side-card button { appearance: none; border: 0; background: none; padding: 0; text-align: left; font-family: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.side-card button:hover { color: var(--sb-strong); }
/* The report, one click from any page: a control like the edition buttons. */
.side-report { display: flex; align-items: center; justify-content: center; height: 40px; margin-top: 10px; border-radius: 14px; border: 1px solid var(--sb-line); background: var(--sb-pill); color: var(--sb-strong); font-size: 13.5px; font-weight: 500; text-decoration: none; }
.side-report:hover { border-color: var(--border-strong); }
.side-report[hidden] { display: none; }
.sidebar-footer, :root[data-theme="light"] .sidebar-footer { margin-top: 10px; padding: 0 4px; border-top: 0; font-size: 12px; color: var(--sb-muted); }
.sidebar-footer:empty { display: none; }

/* ---------- top bar: crumbs and boxed controls ---------- */
.topbar { padding: 16px 0 6px; align-items: flex-start; }
/* The bar is part of the page and scrolls away with it. Kept in place, the
   page ran under it: text behind a blur, or text over text. */
.topbar, :root[data-theme="light"] .topbar, :root[data-theme="dark"] .topbar { position: static; background: none; }
.crumbs { font-size: 13.5px; color: var(--text-muted); padding-top: 4px; }
.crumbs span { color: var(--text); font-weight: 500; }
.topbar-right { gap: 10px; }
.edition, :root[data-theme="light"] .edition { background: transparent; border: 0; padding: 0; gap: 10px; backdrop-filter: none; -webkit-backdrop-filter: none; }
.edition > button, .theme-toggle, :root[data-theme="light"] .theme-toggle {
height: 42px; border-radius: 14px;
background: var(--control); color: var(--text-soft);
border: 1px solid var(--surface-border);
box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--bg) 55%, transparent), var(--shadow-card);
backdrop-filter: none; -webkit-backdrop-filter: none;
}
:root[data-theme="light"] .edition > button, :root[data-theme="light"] .theme-toggle { box-shadow: 0 1px 2px rgba(22,24,40,.05), 0 6px 16px rgba(40,44,90,.06); }
.ed-arrow { width: 36px; }
.ed-arrow:hover:not(:disabled) { background: var(--control); color: var(--text); border-color: var(--border-strong); }
.ed-label { padding: 0 14px 0 16px; gap: 8px; font-size: 13.5px; font-weight: 500; letter-spacing: -.01em; color: var(--text); }
.ed-label small { font-size: 13px; font-weight: 400; color: var(--text-soft); }
.theme-toggle { width: 42px; }
.theme-toggle:hover { border-color: var(--border-strong); color: var(--text); }
.ed-menu { background: var(--bg-elev); border-color: var(--border-strong); }
:root[data-theme="dark"] .ed-menu button.on { color: var(--brand); }

/* ---------- headline: sits right under the crumbs ---------- */
/* On a wide screen the headline shares its line with the edition controls. */
.headline, :root[data-theme="light"] .headline { padding: 0 0 20px; margin: 4px 0 0; border-bottom: 0; }
@media (min-width: 1280px) { .headline, :root[data-theme="light"] .headline { margin-top: -14px; max-width: calc(100% - 400px); } }
.headline h1 { font-size: 31px; font-weight: 500; letter-spacing: -.035em; line-height: 1.12; max-width: 700px; text-wrap: balance; }
.headline .lede { font-size: 14.5px; margin-top: 8px; color: var(--text-soft); }

/* ---------- surfaces: bevelled cards ---------- */
.card, .kpi, .bucket-card, .callout-connect,
:root[data-theme="light"] .card, :root[data-theme="light"] .kpi,
:root[data-theme="light"] .bucket-card, :root[data-theme="light"] .callout-connect {
background: var(--surface);
border: 1.2px solid var(--surface-border);
border-radius: 32px;
box-shadow: var(--bevel), var(--shadow-card);
}
.kpi, :root[data-theme="light"] .kpi, .bucket-card, :root[data-theme="light"] .bucket-card, .callout-connect, :root[data-theme="light"] .callout-connect { border-radius: 26px; }
/* No backdrop blur per card: over a soft gradient it changes nothing the eye
   can see, and it was the main cost of scrolling (see styles.css). */
.card { padding: 22px 24px; }
.card-title { font-size: 16px; font-weight: 500; letter-spacing: -.025em; }
.card-head { margin-bottom: 14px; }
.info-btn { top: 18px; right: 18px; width: 17px; height: 17px; background: transparent; border-color: var(--border-strong); color: var(--text-muted); font-weight: 500; }
.info-btn:hover, .info-btn:focus { border-color: var(--text-soft); color: var(--text); }

/* ---------- KPI row ---------- */
.kpi-grid, .kpi-grid-5 { gap: 16px; margin-bottom: 16px; }
.kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi-grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpi-grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 820px) { .kpi-grid, .kpi-grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* A KPI card as the brand book's dashboard draws it: an 11.5px label on one
   line, a 46px number, one 13px line under it. */
.kpi { padding: 22px 24px; min-width: 0; display: flex; flex-direction: column; }
.kpi-label { font-family: var(--mono); font-size: 11.5px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; line-height: 1.35; color: var(--text-soft); margin-bottom: 10px; padding-right: 22px; }
.kpi-value { margin-top: auto; font-size: 46px; font-weight: 600; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
/* Label, number and the line under it share their rows across the cards of
   a row, so the numbers stay on one baseline whichever label or note wraps. */
@supports (grid-template-rows: subgrid) {
.kpi-grid, .kpi-grid-5 { grid-auto-rows: auto; }
.kpi { display: grid; grid-template-rows: subgrid; grid-row: span 3; row-gap: 0; }
.kpi-value { margin-top: 0; align-self: end; }
}
@media (min-width: 1101px) and (max-width: 1500px) { .kpi { padding-left: 20px; padding-right: 20px; } .kpi-label { padding-right: 18px; } }
.kpi-grid-5 .kpi-value { font-size: 34px; }
.kpi-value.v-text, .kpi-grid-5 .kpi-value.v-text { font-size: 24px; letter-spacing: -.01em; line-height: 1.2; padding: 8px 0 10px; overflow-wrap: anywhere; }
.kpi-value small { font-size: 16px; font-weight: 500; letter-spacing: 0; color: var(--text-faint); margin-left: 4px; }
.kpi-change { margin-top: 12px; gap: 5px; line-height: 1.35; }
.kpi-trend, .kpi-was, .kpi-mom { font-size: 13px; }
.kpi-trend { font-weight: 600; }
.kpi-was { color: var(--text-muted); }
.kpi-mom { margin-top: 6px; }

/* ---------- overview: three cards in a row ---------- */
.grid-3 { display: grid; grid-template-columns: minmax(0, 1.02fr) minmax(0, .98fr) minmax(0, 1.2fr); gap: 16px; margin-bottom: 16px; }
.grid-3 > .card, .grid-3 > div > .card { margin-bottom: 0; height: 100%; }
.grid-3 .chart-wrap { height: 250px; }
/* The names chart on the overview: seven rows, as compact as the brand book draws it. */
.chart-wrap.names { height: 250px; }
/* minmax(0, ...) everywhere: a chart canvas keeps its width when the window
   narrows, and a plain 1fr column would let it push the page sideways. */
.grid-3 > * { min-width: 0; }
@media (max-width: 1280px) { .grid-3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .grid-3 > :last-child { grid-column: 1 / -1; } }
@media (max-width: 900px) { .grid-3 { grid-template-columns: minmax(0, 1fr); } .grid-3 > :last-child { grid-column: auto; } }

.ai-scores { gap: 13px; }
.ai-score { grid-template-columns: 100px minmax(0, 1fr) 28px 44px; gap: 12px; font-size: 14px; }
.ai-score .ai-name { font-weight: 400; }
.ai-score .ai-name i { width: 7px; height: 7px; }
.ai-bar { height: 7px; }
.ai-score strong { font-weight: 600; }
.ai-delta { font-size: 12px; }
.ai-known { margin-top: 22px; padding-top: 16px; font-size: 13px; }

.funnel-row { grid-template-columns: minmax(108px, 150px) 1fr 30px; gap: 14px; padding: 9px 0; }
.funnel-label { font-size: 13.5px; font-weight: 500; line-height: 1.25; }
.funnel-bar, :root[data-theme="light"] .funnel-bar { height: 9px; background: var(--meter-track); }
.funnel-count { font-size: 14.5px; font-weight: 600; }

/* the first open action, under the funnel */
.act-chip { display: flex; align-items: baseline; gap: 12px; margin-top: 16px; padding: 12px 16px; border-radius: 14px; border: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 35%, transparent); font-size: 13px; color: var(--text-soft); text-decoration: none; }
:root[data-theme="light"] .act-chip { background: rgba(255,255,255,.55); border-color: rgba(255,255,255,.9); }
.act-chip:hover { border-color: var(--border-strong); color: var(--text); }
.act-tag { flex: none; font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); white-space: nowrap; }

.action-row, :root[data-theme="light"] .action-row { background: color-mix(in srgb, var(--bg) 30%, transparent); border-color: var(--border); }
.action-row:hover, :root[data-theme="light"] .action-row:hover { background: var(--bg-soft); border-color: var(--border-strong); }

/* ---------- small things that carried the old palette ---------- */
.print-btn { border-radius: 14px; background: var(--control); border-color: var(--surface-border); text-decoration: none; display: inline-flex; align-items: center; height: 40px; padding: 0 16px; font-size: 13.5px; font-weight: 500; color: var(--text); margin-right: 0; }
:root[data-theme="light"] .fchip, :root[data-theme="light"] .src-chip { background: #FFFFFF; border-color: var(--border-strong); }
:root[data-theme="light"] .filterbar input[type="text"] { background: #FFFFFF; border-color: var(--border-strong); }
:root[data-theme="light"] .prompt-table table.dt thead th { background: #FFFFFF; }
:root[data-theme="dark"] .prompt-table table.dt thead th { background: #0F1524; }
:root[data-theme="dark"] .weights .w1 { background: var(--accent); }
.footer { padding-top: 22px; }

/* A short screen (a small laptop): the bar tightens so the report button and
   "Sair" stay in reach, and scrolls if it still does not fit. */
@media (min-width: 821px) {
.sidebar, :root[data-theme="light"] .sidebar, :root[data-theme="dark"] .sidebar { overflow-y: auto; scrollbar-width: none; }
.sidebar::-webkit-scrollbar { display: none; }
}
@media (min-width: 821px) and (max-height: 800px) {
.sidebar, :root[data-theme="light"] .sidebar, :root[data-theme="dark"] .sidebar { padding: 18px 16px 12px; }
.brand { padding-bottom: 12px; }
.brand-mark { margin-bottom: 10px; }
.nav-section, :root[data-theme="light"] .nav-section { margin: 12px 10px 5px; }
.nav-item, :root[data-theme="light"] .nav-item { padding: 7px 14px; font-size: 14.5px; margin-bottom: 1px; }
.side-card { padding: 10px 14px; }
.side-report { height: 36px; margin-top: 8px; }
.sidebar-footer, :root[data-theme="light"] .sidebar-footer { margin-top: 8px; }
}

/* ---------- phones: the sidebar folds back into a bar ---------- */
@media (max-width: 820px) {
.sidebar, :root[data-theme="light"] .sidebar, :root[data-theme="dark"] .sidebar { margin: 10px; height: auto; top: 0; padding: 12px 16px; border-radius: 24px; }
.brand { padding: 0 10px 0 0; }
.brand-mark { height: 16px; margin-bottom: 6px; }
.brand-spec { display: none; }
.nav-toggle, :root[data-theme="light"] .nav-toggle { color: var(--sb-strong); border-color: var(--sb-line); background: var(--sb-pill); border-radius: 14px; }
.side-card { margin-top: 8px; }
.headline, :root[data-theme="light"] .headline { margin-top: 0; padding-bottom: 16px; }
.headline h1 { font-size: 24px; }
.kpi-value { font-size: 36px; }
.card { padding: 20px 20px; }
.card, :root[data-theme="light"] .card { border-radius: 24px; }
.kpi, :root[data-theme="light"] .kpi { border-radius: 24px; }
}
/* A phone (brand book): margin 16, radius 24, the four KPIs two by two, the plan last. */
@media (max-width: 520px) {
.main { padding-left: 16px; padding-right: 16px; }
.kpi-grid, .kpi-grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.kpi { padding: 16px 16px 14px; }
.kpi-label { padding-right: 16px; font-size: 11px; }
.kpi-value { font-size: 30px; }
.kpi-value small { font-size: 13px; margin-left: 3px; }
.kpi .info-btn { top: 12px; right: 12px; }
.topbar-right, .edition, :root[data-theme="light"] .edition { gap: 6px; }
.ed-label { padding: 0 10px 0 12px; }
.ed-label small { display: none; }
.ed-arrow { width: 34px; }
.act-under { display: none; }
}
@media (min-width: 521px) { .act-last { display: none; } }
