/* =========================================================================
   OEDash controls — the one shared control vocabulary for every dashboard
   page: radius tokens, label, panel title, buttons, select, segmented
   control, tabs, chip, table head, stat tile, callout.
   Linked before each page's own <style>, so page-local rules still win until
   a page adopts these classes. Colour/type/space tokens only from
   ds-kit/colors_and_type.css (its --oe-radius-* stay 0; not edited).
   ========================================================================= */
:root {
  /* OE radius vocabulary 0 / 2 / 4 / 16 (openeconomics-design). */
  /* Medium scale — user, 2026-10-02 */
  --dash-radius-surface: 8px;    /* panels, tiles, modal, floating lists */
  --dash-radius-inner: 6px;      /* surfaces inside a card: wells, stat tiles, callouts */
  --dash-radius-control: 6px;    /* inputs, buttons, segmented items */
  --dash-radius-pill: 999px;     /* chips and tags: fully round */
  --dash-hairline: rgba(0, 0, 0, 0.1);
  /* Floating layers only (dropdowns, popups, modal) — the OE popover shadow. */
  --dash-shadow-float: var(--oe-shadow-3);
  /* Type scale (user, 2026-10-03): nothing below 12px. Headings and big numbers keep their own sizes. */
  --dash-fs-xs: 12px;            /* smallest notes, badges, tags */
  --dash-fs-sm: 13px;            /* chips, footnotes, "Fonte:" lines */
  --dash-fs-md: 14px;            /* labels, table cells, panel text */
  --dash-fs-lg: 15px;            /* body text, buttons, selects */
  --dash-ease: cubic-bezier(0.2, 0.7, 0.2, 1);   /* OE general motion */
}

/* ---------- Label: sans, sentence case ---------- */
.field-label {
  display: block;
  margin: 0 0 6px;
  font-family: var(--oe-font-sans);
  font-size: var(--dash-fs-md);
  font-weight: 500;
  line-height: 1.4;
  color: var(--oe-gray-700);
}

/* ---------- Panel title: weight and space, no rule under it ---------- */
.panel-title {
  margin: 0;
  font-family: var(--oe-font-sans);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--oe-bluette-900);
  text-wrap: balance;
}

/* ---------- Buttons ---------- */
/* Same property set as the page-local .btn-link / .btn-solid copies, so a
   page that still defines its own keeps its look until it adopts these. */
.btn-solid {
  font: 500 var(--dash-fs-lg)/1.3 var(--oe-font-sans);
  background: var(--oe-bluette-700);
  color: var(--oe-white);
  border: 0;
  padding: 8px 16px;
  border-radius: var(--dash-radius-control);
  cursor: pointer;
}
.btn-solid:hover { background: var(--oe-bluette-800); }
.btn-solid:disabled { background: var(--oe-gray-300); color: var(--oe-gray-700); cursor: default; }

.btn-link {
  font-family: var(--oe-font-sans);
  font-size: var(--dash-fs-lg);
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
  background: none;
  border: none;
  color: var(--oe-bluette-700);
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.btn-link:hover { color: var(--oe-bluette-900); }

/* Ghost button on the dark bluette-900 header. The legacy header classes
   map here so every page's header actions read as one set. */
.btn-ghost,
.shell-header__actions .metodologia-trigger,
.shell-header__actions .site-header__cta,
.shell-header__actions .site-header__back {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--oe-font-sans);
  font-size: var(--dash-fs-lg);
  font-weight: 500;
  line-height: 1.3;
  text-transform: none;
  letter-spacing: normal;
  color: var(--oe-white);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: var(--dash-radius-control);
  padding: 7px 14px;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 160ms var(--dash-ease), border-color 160ms var(--dash-ease);
}
.btn-ghost:hover,
.shell-header__actions .metodologia-trigger:hover,
.shell-header__actions .site-header__cta:hover,
.shell-header__actions .site-header__back:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.7);
  color: var(--oe-white);
}
.btn-ghost:focus-visible,
.shell-header__actions .metodologia-trigger:focus-visible,
.shell-header__actions .site-header__cta:focus-visible,
.shell-header__actions .site-header__back:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.75);
  outline-offset: 2px;
}

/* ---------- Select / combobox trigger: one shape, one caret ---------- */
.select {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  max-width: 100%;
  padding: 0 34px 0 12px;
  font: 400 var(--dash-fs-lg)/1.3 var(--oe-font-sans);
  color: var(--oe-fg);
  text-align: left;
  background: var(--oe-white)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%234400B3' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    no-repeat right 12px center;
  border: 1px solid var(--oe-gray-300);
  border-radius: var(--dash-radius-control);
  cursor: pointer;
}
.select:hover { border-color: var(--oe-gray-400); }
.select:disabled { color: var(--oe-gray-600); background-color: var(--oe-gray-100); cursor: default; }

/* ---------- Segmented control: muted track, white active item, no dividers ---------- */
.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--oe-gray-100);
  border-radius: var(--dash-radius-control);
}
.segmented > button {
  font: 500 var(--dash-fs-md)/1.3 var(--oe-font-sans);
  color: var(--oe-gray-700);
  background: transparent;
  border: 0;
  border-radius: var(--dash-radius-control);
  padding: 5px 12px;
  cursor: pointer;
  white-space: nowrap;
}
.segmented > button:hover { color: var(--oe-fg); }
.segmented > button[aria-pressed="true"],
.segmented > button[aria-selected="true"] {
  background: var(--oe-white);
  color: var(--oe-bluette-700);   /* OE: active filter reads Bluette, never black */
  box-shadow: 0 0 0 1px var(--dash-hairline);
}

/* ---------- Tabs: one of N views of the same panel ---------- */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--oe-space-5);
  border-bottom: 1px solid var(--dash-hairline);
}
.tabs > button {
  font: 500 var(--dash-fs-lg)/1.3 var(--oe-font-sans);
  color: var(--oe-gray-700);
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 8px 0;
  cursor: pointer;
}
.tabs > button:hover { color: var(--oe-fg); }
.tabs > button[aria-selected="true"],
.tabs > button[aria-pressed="true"] {
  color: var(--oe-bluette-900);
  border-bottom-color: var(--oe-bluette-700);
}

/* ---------- Chip: sans, fully round (status, type, filter token) ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 500 var(--dash-fs-sm)/1.4 var(--oe-font-sans);
  color: var(--oe-gray-800);
  background: var(--oe-gray-100);
  border: 1px solid transparent;
  border-radius: var(--dash-radius-pill);
  padding: 2px 10px;
  white-space: nowrap;
}
.chip--brand { color: var(--oe-bluette-800); background: var(--oe-bluette-050); }
.chip__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }

/* ---------- Data table: OE table — Bluette head, banded rows, sans numbers ---------- */
.data-table { width: 100%; border-collapse: collapse; font-size: var(--dash-fs-md); }
.data-table th {
  font: 500 var(--dash-fs-sm)/1.3 var(--oe-font-sans);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--oe-white);
  text-align: left;
  background: var(--oe-bluette-700);
  padding: 10px 12px;
}
.data-table td { padding: 8px 12px; color: var(--oe-fg-soft); }
.data-table tbody tr:nth-child(even) td { background: var(--oe-gray-100); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.data-table td.num { font-weight: 600; color: var(--oe-black); }

/* ---------- Stat tile: one number tile, no stripes ---------- */
.stat-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: var(--oe-space-4) var(--oe-space-5);
  background: var(--oe-gray-100);
  border: 0;
  border-radius: var(--dash-radius-inner);
  color: var(--oe-fg);
  text-align: left;
  font: inherit;
}
button.stat-tile { cursor: pointer; transition: background 160ms var(--dash-ease); }
button.stat-tile:hover { background: var(--oe-gray-200); }
.stat-tile__label { font: 500 var(--dash-fs-md)/1.4 var(--oe-font-sans); color: var(--oe-gray-700); }
.stat-tile__value {
  font-family: var(--oe-font-sans);
  font-size: clamp(24px, 2.4vw, 32px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--oe-black);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
.stat-tile__sub { font-size: var(--dash-fs-md); line-height: 1.4; color: var(--oe-gray-700); }

/* ---------- Selected state: the one "this is chosen" look for tiles/cards ---------- */
.is-selected,
.stat-tile[aria-pressed="true"],
button.stat-tile[aria-pressed="true"]:hover {
  background: var(--oe-white);
  box-shadow: inset 0 0 0 2px var(--oe-bluette-700);
}

/* ---------- Callout: tint only, no side bar ---------- */
.callout {
  margin: 0;
  padding: var(--oe-space-3) var(--oe-space-4);
  background: var(--oe-bluette-050);
  border-radius: var(--dash-radius-inner);
  font-size: var(--dash-fs-lg);
  line-height: 1.5;
  color: var(--oe-gray-800);
}
.callout strong { color: var(--oe-bluette-900); font-weight: 600; }

/* ---------- Focus: one ring for every light-surface control ---------- */
.btn-solid:focus-visible,
.btn-link:focus-visible,
.select:focus-visible,
.segmented > button:focus-visible,
.tabs > button:focus-visible,
button.stat-tile:focus-visible {
  outline: 2px solid var(--oe-bluette-700);
  outline-offset: 2px;
}

@media (pointer: coarse) {
  .select, .btn-solid { min-height: 44px; }
  .segmented > button, .tabs > button { min-height: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .btn-ghost, button.stat-tile,
  .shell-header__actions .metodologia-trigger,
  .shell-header__actions .site-header__cta,
  .shell-header__actions .site-header__back { transition: none; }
}
