/* ==========================================================================
   SGPJ — sistema visual
   Direção: o vermelho-rubi do Direito, papel de ofício frio, abas de índice
   (como as de um Vade Mecum) marcando categoria e navegação, e a fonte Archivo
   usando a largura variável: larga nos títulos, condensada nos números.
   ========================================================================== */

@font-face {
  font-family: "Archivo Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url("../vendor/fonts/archivo-latin-wdth-normal.de2f1fe81758.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304,
    U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Archivo Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url("../vendor/fonts/archivo-latin-ext-wdth-normal.589f7bc0fac4.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* --- Tokens ------------------------------------------------------------- */
:root {
  color-scheme: light;
  --canvas: #eef0f3;
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --surface-3: #e8ebef;
  --ink: #1a1d24;
  --ink-2: #4a5060;
  --ink-3: #6b7282;
  --line: #dadde3;
  --line-strong: #c3c8d1;
  --ruby: #8e1b32;
  --ruby-strong: #6e1426;
  --ruby-soft: #f6e7ea;
  --ruby-line: #e6c4cb;
  --on-ruby: #ffffff;
  --ok: #1f7a4d;
  --ok-soft: #e2f3ea;
  --warn: #8a5a00;
  --warn-soft: #fbf0d9;
  --info: #1f5fa8;
  --info-soft: #e3edf8;
  --danger: #b3261e;
  --danger-soft: #fbe7e5;
  --focus: #1f5fa8;
  --chart-grid: #e6e8ec;
  --chart-axis: #6b7282;
  --radius-s: 6px;
  --radius-m: 10px;
  --radius-l: 16px;
  --shadow-pop: 0 18px 40px -18px rgb(26 29 36 / 0.35), 0 2px 6px rgb(26 29 36 / 0.06);
  --font: "Archivo Variable", "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --sidebar-w: 252px;
  --gutter: 32px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --canvas: #111318;
    --surface: #191c22;
    --surface-2: #1f232a;
    --surface-3: #282d35;
    --ink: #e9ebef;
    --ink-2: #b8bdc8;
    --ink-3: #8f96a4;
    --line: #2b3039;
    --line-strong: #3b414c;
    --ruby: #e0566f;
    --ruby-strong: #ec7387;
    --ruby-soft: #36181f;
    --ruby-line: #5a2632;
    --on-ruby: #1a0a0e;
    --ok: #4cc38a;
    --ok-soft: #15301f;
    --warn: #e3a94b;
    --warn-soft: #362812;
    --info: #6aa5ec;
    --info-soft: #162a40;
    --danger: #f07167;
    --danger-soft: #3b1b19;
    --focus: #6aa5ec;
    --chart-grid: #2a2f37;
    --chart-axis: #8f96a4;
    --shadow-pop: 0 18px 40px -18px rgb(0 0 0 / 0.7), 0 2px 6px rgb(0 0 0 / 0.3);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #111318;
  --surface: #191c22;
  --surface-2: #1f232a;
  --surface-3: #282d35;
  --ink: #e9ebef;
  --ink-2: #b8bdc8;
  --ink-3: #8f96a4;
  --line: #2b3039;
  --line-strong: #3b414c;
  --ruby: #e0566f;
  --ruby-strong: #ec7387;
  --ruby-soft: #36181f;
  --ruby-line: #5a2632;
  --on-ruby: #1a0a0e;
  --ok: #4cc38a;
  --ok-soft: #15301f;
  --warn: #e3a94b;
  --warn-soft: #362812;
  --info: #6aa5ec;
  --info-soft: #162a40;
  --danger: #f07167;
  --danger-soft: #3b1b19;
  --focus: #6aa5ec;
  --chart-grid: #2a2f37;
  --chart-axis: #8f96a4;
  --shadow-pop: 0 18px 40px -18px rgb(0 0 0 / 0.7), 0 2px 6px rgb(0 0 0 / 0.3);
}

/* --- Base --------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img,
svg,
canvas {
  max-width: 100%;
  display: block;
}
a {
  color: var(--ruby);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover {
  color: var(--ruby-strong);
}
p {
  margin: 0 0 0.75em;
}
h1,
h2,
h3,
h4 {
  margin: 0;
  line-height: 1.2;
  font-weight: 650;
}
hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 24px 0;
}
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
[x-cloak] {
  display: none !important;
}
.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;
}
.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 100;
  background: var(--ink);
  color: var(--surface);
  padding: 8px 14px;
  border-radius: var(--radius-s);
}
.skip-link:focus {
  top: 12px;
}

/* --- Tipografia --------------------------------------------------------- */
.page-title {
  font-size: 28px;
  font-weight: 700;
  font-stretch: 116%;
  letter-spacing: -0.012em;
  line-height: 1.15;
}
.page-subtitle {
  margin: 6px 0 0;
  color: var(--ink-2);
  max-width: 70ch;
}
.section-title {
  font-size: 17px;
  font-weight: 650;
  font-stretch: 110%;
}
.muted {
  color: var(--ink-3);
}
.small {
  font-size: 13px;
}
.tabular {
  font-variant-numeric: tabular-nums;
}
.figure {
  font-stretch: 72%;
  font-weight: 640;
  letter-spacing: -0.01em;
  line-height: 1;
}
.text-ok {
  color: var(--ok);
}
.text-danger {
  color: var(--danger);
}

/* --- Estrutura do app --------------------------------------------------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  background: linear-gradient(
    to right,
    var(--surface) calc(var(--sidebar-w) - 1px),
    var(--line) calc(var(--sidebar-w) - 1px),
    var(--line) var(--sidebar-w),
    transparent var(--sidebar-w)
  );
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line);
  z-index: 40;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  color: var(--ink);
  text-decoration: none;
}
.brand-mark {
  width: 36px;
  height: 36px;
  flex: none;
}
.brand-name {
  font-size: 19px;
  font-weight: 760;
  font-stretch: 122%;
  letter-spacing: 0.01em;
  line-height: 1;
}
.brand-org {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.25;
  font-weight: 450;
  letter-spacing: 0;
}
.nav {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0 16px;
}
.nav-group {
  margin-top: 18px;
  padding: 0 20px 6px;
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 500;
}
.nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 1px 12px;
  padding: 8px 12px;
  border-radius: var(--radius-s);
  color: var(--ink-2);
  text-decoration: none;
  font-weight: 500;
}
.nav a .bi {
  font-size: 17px;
  width: 20px;
  text-align: center;
  color: var(--ink-3);
}
.nav a:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.nav a.is-active {
  background: var(--ruby-soft);
  color: var(--ruby);
  font-weight: 620;
}
.nav a.is-active .bi {
  color: var(--ruby);
}
/* A aba do índice: o item ativo "sai" da borda da barra lateral. */
.nav a.is-active::after {
  content: "";
  position: absolute;
  right: -13px;
  top: 5px;
  bottom: 5px;
  width: 5px;
  border-radius: 0 4px 4px 0;
  background: var(--ruby);
}
.nav-count {
  margin-left: auto;
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--ruby);
  color: var(--on-ruby);
  font-size: 12px;
  font-weight: 650;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.sidebar-foot {
  padding: 16px 20px 20px;
  border-top: 1px solid var(--line);
}
.sidebar-foot .btn {
  width: 100%;
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px var(--gutter);
  background: color-mix(in srgb, var(--canvas) 86%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
}
.topbar-spacer {
  flex: 1;
}
.menu-toggle {
  display: none;
}
.content {
  width: 100%;
  max-width: 1320px;
  padding: 4px var(--gutter) 72px;
}
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin: 8px 0 24px;
}
.page-head-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* --- Botões ------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-s);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 560;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}
.btn:hover {
  background: var(--surface-2);
  border-color: var(--ink-3);
  color: var(--ink);
}
.btn .bi {
  font-size: 16px;
}
.btn-primary {
  background: var(--ruby);
  border-color: var(--ruby);
  color: var(--on-ruby);
}
.btn-primary:hover {
  background: var(--ruby-strong);
  border-color: var(--ruby-strong);
  color: var(--on-ruby);
}
.btn-ok {
  background: var(--ok);
  border-color: var(--ok);
  color: #fff;
}
.btn-ok:hover {
  filter: brightness(1.08);
  background: var(--ok);
  color: #fff;
}
.btn-danger-ghost {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 45%, var(--line));
}
.btn-danger-ghost:hover {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger);
}
.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--ink-2);
}
.btn-ghost:hover {
  background: var(--surface-3);
  border-color: transparent;
}
.btn-sm {
  min-height: 32px;
  padding: 5px 11px;
  font-size: 14px;
}
.btn-icon {
  width: 38px;
  padding: 0;
}
.btn-icon.btn-sm {
  width: 32px;
}
.btn[disabled],
.btn.is-disabled {
  opacity: 0.55;
  pointer-events: none;
}
.icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  font-size: 19px;
}
.icon-btn:hover {
  background: var(--surface-3);
  color: var(--ink);
}
.dot-count {
  position: absolute;
  top: 3px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  border: 2px solid var(--canvas);
  background: var(--ruby);
  color: var(--on-ruby);
  font-size: 11px;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
}

/* --- Formulários -------------------------------------------------------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 20px;
}
.form-grid > .field-wide,
.form-grid > .field:has(textarea),
.form-grid > .field:has(.checkbox-list),
.form-grid > .field:has(div > div > label > input[type="checkbox"]),
.form-grid > .field-check {
  grid-column: 1 / -1;
}
.field {
  margin-bottom: 14px;
}
.field > label,
.field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 560;
  color: var(--ink);
}
.req {
  color: var(--ruby);
  margin-left: 2px;
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="month"],
input[type="search"],
input[type="tel"],
input[type="url"],
select,
textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-s);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  line-height: 1.4;
}
textarea {
  min-height: 84px;
  resize: vertical;
}
select {
  appearance: none;
  padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%),
    linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
select[multiple] {
  background-image: none;
  padding-right: 12px;
  min-height: 120px;
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent);
}
input[type="color"] {
  width: 64px;
  height: 40px;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-s);
  background: var(--surface);
  cursor: pointer;
}
input[type="file"] {
  width: 100%;
  font: inherit;
  font-size: 14px;
  color: var(--ink-2);
}
input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 7px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-s);
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-weight: 560;
  cursor: pointer;
}
input[type="checkbox"],
input[type="radio"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--ruby);
  flex: none;
}
.help {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--ink-3);
}
.errorlist {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  color: var(--danger);
  font-size: 13.5px;
  font-weight: 500;
}
.errorlist.nonfield,
.form-errors {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: var(--radius-s);
  background: var(--danger-soft);
  color: var(--danger);
}
.has-error input,
.has-error select,
.has-error textarea {
  border-color: var(--danger);
}
.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-weight: 500;
  cursor: pointer;
}
.check input {
  margin-top: 2px;
}
.checkbox-list,
.field ul:not(.errorlist) {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}
.field ul:not(.errorlist) label {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  background: var(--surface);
  font-weight: 500;
  cursor: pointer;
}
.field ul:not(.errorlist) label:has(input:checked) {
  border-color: var(--ruby-line);
  background: var(--ruby-soft);
}
.field div:has(> div > label > input[type="checkbox"]),
.field div:has(> div > label > input[type="radio"]) {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}
.field div > div > label:has(> input[type="checkbox"]),
.field div > div > label:has(> input[type="radio"]) {
  display: flex;
  gap: 10px;
  align-items: center;
  height: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  background: var(--surface);
  font-weight: 500;
  font-size: 14.5px;
  cursor: pointer;
}
.field div > div > label:has(> input:checked) {
  border-color: var(--ruby-line);
  background: var(--ruby-soft);
}
.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 8px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.input-icon {
  position: relative;
}
.input-icon .bi {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
}
.input-icon input {
  padding-left: 36px;
}

/* --- Painéis ------------------------------------------------------------ */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 20px 22px;
}
.panel + .panel {
  margin-top: 20px;
}
.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.panel-head .link {
  font-size: 14px;
  font-weight: 560;
  text-decoration: none;
}
.panel-flush {
  padding: 0;
  overflow: hidden;
}
.panel-flush .panel-head {
  padding: 18px 22px 0;
}
.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.grid-2-even {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
}
.stack > * + * {
  margin-top: 20px;
}
.narrow {
  max-width: 760px;
}

/* --- Filtros e abas de página ------------------------------------------ */
.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 18px;
}
.toolbar select,
.toolbar input {
  width: auto;
  min-width: 170px;
}
.toolbar .input-icon {
  flex: 1 1 260px;
  max-width: 380px;
}
.toolbar .input-icon input {
  width: 100%;
}
.tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.tabs a {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px 11px;
  color: var(--ink-2);
  text-decoration: none;
  font-weight: 560;
}
.tabs a:hover {
  color: var(--ink);
}
.tabs a.is-active {
  color: var(--ruby);
}
.tabs a.is-active::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--ruby);
}
.tab-count {
  font-size: 12.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--radius-s);
  background: var(--surface-3);
}
.segmented a {
  padding: 6px 14px;
  border-radius: 5px;
  color: var(--ink-2);
  text-decoration: none;
  font-weight: 560;
  font-size: 14px;
}
.segmented a.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.08);
}

/* --- Configurações: sub-navegação -------------------------------------- */
.settings {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
.settings-nav {
  position: sticky;
  top: 76px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.settings-nav a {
  padding: 8px 12px;
  border-radius: var(--radius-s);
  color: var(--ink-2);
  text-decoration: none;
  font-weight: 520;
  border-left: 3px solid transparent;
}
.settings-nav a:hover {
  background: var(--surface);
  color: var(--ink);
}
.settings-nav a.is-active {
  background: var(--surface);
  color: var(--ruby);
  border-left-color: var(--ruby);
  font-weight: 620;
}

/* --- Tabelas ------------------------------------------------------------ */
.table-wrap {
  /* position: relative mantém textos de leitor de tela (.sr-only) dentro da rolagem da tabela,
     sem alargar a página no celular. */
  position: relative;
  width: 100%;
  overflow-x: auto;
}
table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}
.table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 13px;
  font-weight: 560;
  color: var(--ink-3);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table tbody tr:last-child td {
  border-bottom: 0;
}
.table tbody tr:hover td {
  background: var(--surface-2);
}
.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.table .actions {
  text-align: right;
  white-space: nowrap;
}
.table tfoot td {
  font-weight: 650;
  border-top: 1px solid var(--line-strong);
  border-bottom: 0;
}
.swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: var(--swatch, var(--line));
  vertical-align: -1px;
}
.bool-yes {
  color: var(--ok);
}
.bool-no {
  color: var(--ink-3);
}

/* --- Chips de situação, selos e pílulas -------------------------------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px 2px 8px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 20px;
  white-space: nowrap;
  background: var(--surface-3);
  color: var(--ink-2);
}
.chip::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.chip-pendente {
  background: var(--warn-soft);
  color: var(--warn);
}
.chip-em_analise {
  background: var(--info-soft);
  color: var(--info);
}
.chip-aprovado {
  background: var(--ok-soft);
  color: var(--ok);
}
.chip-rejeitado {
  background: var(--danger-soft);
  color: var(--danger);
}
.chip-plain::before {
  display: none;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 560;
  color: var(--ink-2);
  background: var(--surface);
  white-space: nowrap;
}
.points {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.points-plus {
  color: var(--ok);
}
.level-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 650;
  color: var(--ink);
}
.level-badge::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 2px;
  transform: rotate(45deg);
  background: var(--level, var(--ink-3));
}

/* --- Avatares ----------------------------------------------------------- */
.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  border-radius: 50%;
  overflow: hidden;
  background: var(--ruby-soft);
  color: var(--ruby);
  font-weight: 700;
  font-stretch: 90%;
  letter-spacing: 0.02em;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.avatar-xs {
  width: 24px;
  height: 24px;
  font-size: 10px;
}
.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: 12px;
}
.avatar-md {
  width: 40px;
  height: 40px;
  font-size: 14px;
}
.avatar-lg {
  width: 64px;
  height: 64px;
  font-size: 22px;
}
.avatar-xl {
  width: 96px;
  height: 96px;
  font-size: 32px;
}
.person {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.person-name {
  display: block;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.person-meta {
  display: block;
  font-size: 13px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Ficha do painel (herói) ------------------------------------------- */
.ficha {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  overflow: hidden;
}
.ficha-main {
  padding: 26px 30px 24px;
}
.ficha-side {
  display: grid;
  grid-template-rows: 1fr 1fr;
  border-left: 1px solid var(--line);
  background: var(--surface-2);
}
.ficha-side > div {
  padding: 22px 26px;
}
.ficha-side > div + div {
  border-top: 1px solid var(--line);
}
.ficha-label {
  font-size: 14px;
  color: var(--ink-2);
  font-weight: 500;
}
.hero-figure {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 8px 0 18px;
}
.hero-figure .figure {
  font-size: 76px;
  color: var(--ink);
}
.hero-figure .unit {
  font-size: 17px;
  color: var(--ink-3);
  font-weight: 560;
}
.side-figure {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 6px;
}
.side-figure .figure {
  font-size: 46px;
}
.side-figure .of {
  color: var(--ink-3);
  font-weight: 500;
}
.side-figure .level-figure {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 34px;
}
.level-figure::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 3px;
  transform: rotate(45deg);
  background: var(--level, var(--ink-3));
}

/* A régua da meta: medidor com marcas a cada 10% e a meta destacada. */
.regua {
  position: relative;
  height: 14px;
  border-radius: 4px;
  background: var(--ruby-soft);
  overflow: hidden;
}
.regua-fill {
  height: 100%;
  width: var(--pct, 0%);
  background: var(--ruby);
  border-radius: 4px 0 0 4px;
  transition: width 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.regua-fill.is-full {
  border-radius: 4px;
}
.regua-ticks {
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    to right,
    transparent 0,
    transparent calc(10% - 1px),
    color-mix(in srgb, var(--surface) 75%, transparent) calc(10% - 1px),
    color-mix(in srgb, var(--surface) 75%, transparent) 10%
  );
  pointer-events: none;
}
.regua-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.regua-note {
  margin-top: 12px;
  color: var(--ink-2);
}
.regua-note strong {
  color: var(--ink);
}
.goal-hit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ok);
  font-weight: 650;
}
.progress {
  height: 8px;
  border-radius: 4px;
  background: var(--surface-3);
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  width: var(--pct, 0%);
  background: var(--ruby);
  border-radius: 4px;
}
.progress.is-ok > span {
  background: var(--ok);
}

/* --- Faixa de indicadores ---------------------------------------------- */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
}
.kpi-strip.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.kpi-strip.cols-6 {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
.kpi {
  padding: 16px 20px;
  min-width: 0;
}
.kpi + .kpi {
  border-left: 1px solid var(--line);
}
.kpi-label {
  font-size: 13px;
  color: var(--ink-3);
  font-weight: 500;
}
.kpi-value {
  margin-top: 4px;
  font-size: 30px;
  font-stretch: 78%;
  font-weight: 640;
  line-height: 1.1;
  white-space: nowrap;
}
.kpi-foot {
  margin-top: 4px;
  font-size: 13px;
  color: var(--ink-2);
}
.htmx-request.kpi-strip,
.kpi-strip.htmx-request {
  opacity: 0.6;
}

/* --- Listas com aba de categoria (índice) ------------------------------ */
.rows {
  list-style: none;
  margin: 0;
  padding: 0;
}
.row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 13px 18px 13px 22px;
  border-top: 1px solid var(--line);
}
.rows > .row:first-child {
  border-top: 0;
}
.tabbed::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 5px;
  border-radius: 0 4px 4px 0;
  background: var(--tab, var(--line-strong));
}
.row-title {
  display: block;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}
a.row-title:hover {
  color: var(--ruby);
}
.row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 2px;
  font-size: 13px;
  color: var(--ink-3);
}
.row-meta .bi {
  margin-right: 4px;
}
.row-end {
  display: flex;
  align-items: center;
  gap: 12px;
}
.cat-icon {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--tab, var(--ink-3)) 14%, var(--surface));
  color: color-mix(in srgb, var(--tab, var(--ink-3)) 70%, var(--ink));
  font-size: 16px;
  flex: none;
}
.row-tight {
  padding-left: 0;
  padding-right: 0;
}
.row-with-icon {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

/* --- Barras em HTML (gráficos acessíveis) ------------------------------ */
.barlist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}
.barlist li {
  display: grid;
  grid-template-columns: minmax(110px, 34%) minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}
.barlist .bar-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--ink);
}
.barlist .bar-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.barlist .bar-track {
  height: 14px;
}
.barlist .bar-fill {
  height: 100%;
  min-width: 2px;
  width: var(--pct, 0%);
  border-radius: 0 4px 4px 0;
  background: var(--ruby);
}
.barlist .bar-value {
  min-width: 56px;
  text-align: right;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.chart-box {
  position: relative;
  height: 240px;
}
.chart-box.tall {
  height: 300px;
}
.chart-caption {
  margin-top: 10px;
  font-size: 13px;
  color: var(--ink-3);
}
.chart-table summary {
  margin-top: 12px;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
}

/* --- Pódio do ranking -------------------------------------------------- */
.podium {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: end;
  margin-bottom: 22px;
}
.podium-step {
  position: relative;
  padding: 22px 18px 18px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
}
.podium-step .avatar {
  margin: 0 auto 10px;
}
.podium-step.first {
  padding-top: 30px;
  border-color: var(--ruby-line);
  box-shadow: inset 0 4px 0 var(--ruby);
}
.podium-pos {
  position: absolute;
  top: 12px;
  left: 14px;
  font-size: 30px;
  font-stretch: 70%;
  font-weight: 700;
  color: var(--ink-3);
  line-height: 1;
}
.podium-step.first .podium-pos {
  color: var(--ruby);
}
.podium-points {
  margin-top: 6px;
  font-size: 28px;
  font-stretch: 74%;
  font-weight: 650;
  line-height: 1.1;
}
.rank-pos {
  width: 46px;
  font-size: 20px;
  font-stretch: 72%;
  font-weight: 700;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.rank-pos.top {
  color: var(--ruby);
}
.table tr.is-me td,
.table tr.is-me:hover td {
  background: var(--ruby-soft);
}

/* --- Detalhe da atividade e o carimbo ---------------------------------- */
.doc {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  overflow: hidden;
}
.doc-head {
  position: relative;
  padding: 24px 28px 20px 32px;
  border-bottom: 1px solid var(--line);
}
.doc-head.tabbed::before {
  top: 22px;
  bottom: auto;
  height: 44px;
  width: 6px;
}
.doc-body {
  padding: 22px 28px 26px 32px;
}
.doc-title {
  font-size: 24px;
  font-weight: 700;
  font-stretch: 112%;
  line-height: 1.2;
}
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px 24px;
  margin: 0;
}
.facts dt {
  font-size: 13px;
  color: var(--ink-3);
  font-weight: 500;
}
.facts dd {
  margin: 2px 0 0;
  font-weight: 560;
  overflow-wrap: anywhere;
}
.facts dd a.tabular {
  white-space: nowrap;
}
.doc-text {
  max-width: 72ch;
  white-space: pre-line;
}
.stamp {
  position: absolute;
  right: 26px;
  top: 22px;
  padding: 6px 14px 5px;
  border: 3px solid currentColor;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 800;
  font-stretch: 85%;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transform: rotate(-7deg);
  opacity: 0.88;
  pointer-events: none;
  mix-blend-mode: multiply;
}
:root[data-theme="dark"] .stamp {
  mix-blend-mode: normal;
}
.stamp-aprovado {
  color: var(--ok);
}
.stamp-rejeitado {
  color: var(--danger);
}
.stamp-em_analise {
  color: var(--info);
}
.stamp-pendente {
  color: var(--warn);
}
.stamp.is-new {
  animation: stamp-in 0.42s cubic-bezier(0.2, 0.9, 0.3, 1.25) both;
}
@keyframes stamp-in {
  0% {
    transform: rotate(-7deg) scale(2.2);
    opacity: 0;
  }
  70% {
    transform: rotate(-7deg) scale(0.94);
    opacity: 0.95;
  }
  100% {
    transform: rotate(-7deg) scale(1);
    opacity: 0.88;
  }
}
.calc {
  display: grid;
  grid-template-columns: 1fr auto;
  row-gap: 6px;
  margin: 0;
  font-variant-numeric: tabular-nums;
}
.calc dt {
  color: var(--ink-2);
}
.calc dd {
  margin: 0;
  padding-left: 16px;
  text-align: right;
  font-weight: 600;
}
.calc .total {
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 18px;
  font-weight: 750;
  color: var(--ink);
}
.review-box {
  border: 1px solid var(--ruby-line);
  background: color-mix(in srgb, var(--ruby-soft) 45%, var(--surface));
}
.note {
  padding: 12px 14px;
  border-radius: var(--radius-s);
  background: var(--surface-2);
  border-left: 3px solid var(--line-strong);
}
.note-danger {
  background: var(--danger-soft);
  border-left-color: var(--danger);
}
.note-ok {
  background: var(--ok-soft);
  border-left-color: var(--ok);
}
.attachment {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  background: var(--surface-2);
  color: var(--ink);
  text-decoration: none;
  font-weight: 560;
}
.attachment:hover {
  border-color: var(--ink-3);
  color: var(--ink);
}

/* --- Fila de aprovação -------------------------------------------------- */
.approval-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 18px 20px 18px 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
}
.approval-card + .approval-card {
  margin-top: 12px;
}
.approval-card.is-decided {
  background: var(--surface-2);
}
.approval-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
  min-width: 150px;
}
.approval-desc {
  margin: 8px 0 0;
  color: var(--ink-2);
  max-width: 80ch;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.reject-form {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.reject-form textarea {
  min-height: 64px;
}

/* --- Feed --------------------------------------------------------------- */
.feed {
  max-width: 720px;
}
.composer {
  margin-bottom: 20px;
}
.composer textarea {
  border: 0;
  padding: 4px 0;
  min-height: 72px;
  box-shadow: none;
  font-size: 16px;
}
.composer textarea:focus {
  box-shadow: none;
}
.composer-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.composer-foot select {
  width: auto;
  min-height: 34px;
  padding-top: 5px;
  padding-bottom: 5px;
  font-size: 14px;
}
.file-pick {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 560;
  cursor: pointer;
}
.file-pick input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.post {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 18px 20px 12px;
}
.post + .post,
.post + .sys-post,
.sys-post + .post,
.sys-post + .sys-post {
  margin-top: 12px;
}
.post-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.post-kind {
  margin-left: auto;
}
.post-body {
  margin-top: 12px;
  overflow-wrap: anywhere;
}
.post-body p:last-child {
  margin-bottom: 0;
}
.post-image {
  margin-top: 12px;
  border-radius: var(--radius-s);
  border: 1px solid var(--line);
  max-height: 460px;
  object-fit: cover;
  width: 100%;
}
.post-shared {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  background: var(--surface-2);
}
.post-actions {
  display: flex;
  gap: 4px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.post-actions .btn-ghost.is-on {
  color: var(--ruby);
}
.mention {
  font-weight: 600;
  text-decoration: none;
}
.sys-post {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px 12px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-m);
  background: transparent;
  color: var(--ink-2);
}
.sys-post .sys-icon {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 15px;
  color: var(--ink-2);
  flex: none;
}
.sys-post strong {
  color: var(--ink);
}
.sys-post .sys-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-3);
  white-space: nowrap;
}
.comments {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.comment {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}
.comment-bubble {
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  min-width: 0;
}
.comment-bubble p {
  margin: 2px 0 0;
}
.comment-form {
  display: flex;
  gap: 8px;
}

/* --- Chat --------------------------------------------------------------- */
.chat {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  height: calc(100vh - 150px);
  min-height: 460px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  overflow: hidden;
}
.chat-list {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  min-height: 0;
}
.chat-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.chat-list-items {
  flex: 1;
  overflow-y: auto;
}
.chat-item {
  position: relative;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 11px 16px;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}
.chat-item:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.chat-item.is-active {
  background: var(--ruby-soft);
}
.chat-item.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 4px;
  border-radius: 0 3px 3px 0;
  background: var(--ruby);
}
.chat-item-main {
  min-width: 0;
  flex: 1;
}
.chat-item-title {
  display: block;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-item-preview {
  display: block;
  font-size: 13px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.group-icon {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--tab, var(--ink-3)) 16%, var(--surface));
  color: color-mix(in srgb, var(--tab, var(--ink-3)) 75%, var(--ink));
  font-weight: 700;
  flex: none;
}
.chat-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
.chat-pane-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px;
  background: var(--surface-2);
}
.msg {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  max-width: 78%;
}
.msg.mine {
  margin-left: auto;
  flex-direction: row-reverse;
}
.msg-bubble {
  padding: 8px 12px;
  border-radius: 14px 14px 14px 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  overflow-wrap: anywhere;
  white-space: pre-line;
}
.msg.mine .msg-bubble {
  border-radius: 14px 14px 4px 14px;
  background: var(--ruby);
  border-color: var(--ruby);
  color: var(--on-ruby);
}
.msg-sender {
  display: block;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--ink-2);
}
.msg-time {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--ink-3);
  text-align: right;
}
.chat-compose {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}
.chat-compose textarea {
  min-height: 42px;
  height: 42px;
  max-height: 140px;
  resize: none;
}
.unread {
  min-width: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--ruby);
  color: var(--on-ruby);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}
.chat-back {
  display: none;
}

/* --- Notificações e toasts --------------------------------------------- */
.dropdown {
  position: relative;
}
.dropdown-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(380px, calc(100vw - 24px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-pop);
  z-index: 60;
  overflow: hidden;
}
.dropdown-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.dropdown-foot {
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 14px;
}
.notif-list {
  max-height: 420px;
  overflow-y: auto;
}
.notif {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}
.notif:last-child {
  border-bottom: 0;
}
.notif:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.notif.is-unread {
  background: color-mix(in srgb, var(--ruby-soft) 55%, var(--surface));
}
.notif-icon {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--ink-2);
  flex: none;
}
.notif-title {
  display: block;
  font-size: 14px;
  line-height: 1.4;
}
.notif-time {
  display: block;
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--ink-3);
}
.menu-panel {
  width: 240px;
  padding: 6px;
}
.menu-panel a,
.menu-panel button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: var(--radius-s);
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-decoration: none;
  text-align: left;
  cursor: pointer;
}
.menu-panel a:hover,
.menu-panel button:hover {
  background: var(--surface-2);
}
.menu-sep {
  height: 1px;
  margin: 6px 0;
  background: var(--line);
}
.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(400px, calc(100vw - 40px));
}
.toast {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius-m);
  background: var(--ink);
  color: var(--canvas);
  box-shadow: var(--shadow-pop);
  font-size: 14.5px;
  animation: toast-in 0.24s ease-out both;
}
.toast a {
  color: inherit;
  font-weight: 650;
}
.toast .bi {
  font-size: 18px;
  line-height: 1.2;
}
.toast-success .bi {
  color: #6ee0a6;
}
.toast-error .bi {
  color: #ff9a92;
}
.toast-warning .bi {
  color: #f6c86d;
}
.toast-close {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: inherit;
  opacity: 0.7;
  cursor: pointer;
  font-size: 16px;
}
@keyframes toast-in {
  from {
    transform: translateY(10px);
    opacity: 0;
  }
}
.flash {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: var(--radius-s);
  background: var(--info-soft);
  color: var(--info);
  font-weight: 500;
}
.flash-success {
  background: var(--ok-soft);
  color: var(--ok);
}
.flash-error {
  background: var(--danger-soft);
  color: var(--danger);
}
.flash-warning {
  background: var(--warn-soft);
  color: var(--warn);
}

/* --- Gamificação -------------------------------------------------------- */
.ladder {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  overflow: hidden;
  background: var(--surface);
}
.ladder li {
  position: relative;
  padding: 16px 14px 14px;
  border-left: 1px solid var(--line);
}
.ladder li:first-child {
  border-left: 0;
}
.ladder li::before {
  content: "";
  display: block;
  width: 14px;
  height: 14px;
  margin-bottom: 10px;
  border-radius: 3px;
  transform: rotate(45deg);
  background: var(--level);
}
.ladder li.is-done {
  background: var(--surface-2);
}
.ladder li.is-current {
  background: color-mix(in srgb, var(--level) 10%, var(--surface));
  box-shadow: inset 0 -4px 0 var(--level);
}
.ladder-name {
  display: block;
  font-weight: 650;
}
.ladder-points {
  display: block;
  font-size: 13px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.badges {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}
.badge-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
}
.badge-card.is-locked {
  background: transparent;
  border-style: dashed;
}
.badge-card.is-locked .badge-emoji {
  filter: grayscale(1);
  opacity: 0.45;
}
.badge-emoji {
  font-size: 30px;
  line-height: 1;
  flex: none;
}
.badge-name {
  display: block;
  font-weight: 650;
}
.badge-desc {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  color: var(--ink-3);
}
.badge-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.badge-strip .pill {
  font-size: 13px;
}

/* --- Perfil ------------------------------------------------------------- */
.profile-head {
  display: flex;
  gap: 22px;
  align-items: center;
  flex-wrap: wrap;
}
.profile-name {
  font-size: 30px;
  font-weight: 720;
  font-stretch: 114%;
  line-height: 1.1;
}
.profile-stats {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.profile-stats .figure {
  font-size: 30px;
}

/* --- Vazio e erros ------------------------------------------------------ */
.empty {
  padding: 36px 24px;
  text-align: center;
  color: var(--ink-2);
}
.empty .bi {
  display: block;
  margin-bottom: 10px;
  font-size: 30px;
  color: var(--ink-3);
}
.empty strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 16px;
}
.error-page {
  max-width: 560px;
  margin: 12vh auto;
  padding: 0 24px;
}
.error-code {
  font-size: 96px;
  font-stretch: 66%;
  font-weight: 760;
  color: var(--ruby);
  line-height: 1;
}

/* --- Páginas de entrada (login, cadastro, senha) ------------------------ */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 520px);
}
.auth-art {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 44px 56px;
  background: var(--ruby);
  color: #fff;
  overflow: hidden;
}
.auth-art .brand-name {
  font-size: 22px;
}
.auth-art-mark {
  display: flex;
  align-items: center;
  gap: 12px;
}
.auth-headline {
  max-width: 16ch;
  font-size: clamp(36px, 4.4vw, 60px);
  font-weight: 760;
  font-stretch: 118%;
  letter-spacing: -0.02em;
  line-height: 1.02;
}
.auth-firm {
  font-size: 15px;
  opacity: 0.85;
}
/* Abas de índice na lateral, uma por tipo de serviço padrão. */
.auth-tabs {
  position: absolute;
  right: 0;
  top: 18%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.auth-tabs span {
  display: block;
  height: 34px;
  border-radius: 6px 0 0 6px;
  background: rgb(255 255 255 / 0.14);
}
.auth-tabs span:nth-child(odd) {
  width: 46px;
}
.auth-tabs span:nth-child(even) {
  width: 30px;
}
.auth-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 56px;
  background: var(--surface);
}
.auth-panel h1 {
  font-size: 26px;
  font-weight: 720;
  font-stretch: 114%;
}
.auth-panel .lead {
  margin: 8px 0 26px;
  color: var(--ink-2);
}
.auth-panel form .btn-primary {
  width: 100%;
  min-height: 44px;
}
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0;
  color: var(--ink-3);
  font-size: 13px;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.btn-google {
  width: 100%;
  min-height: 44px;
}
.auth-links {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
  font-size: 14px;
}
.auth-simple {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}
.auth-card {
  width: min(480px, 100%);
  padding: 36px 36px 30px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
}
.auth-card .brand {
  padding: 0 0 22px;
}

/* --- Utilitários -------------------------------------------------------- */
.flex {
  display: flex;
  align-items: center;
  gap: 10px;
}
.flex-wrap {
  flex-wrap: wrap;
}
.space-between {
  justify-content: space-between;
}
.mt-0 {
  margin-top: 0;
}
.mt-1 {
  margin-top: 8px;
}
.mt-2 {
  margin-top: 16px;
}
.mt-3 {
  margin-top: 24px;
}
.mb-0 {
  margin-bottom: 0;
}
.mb-2 {
  margin-bottom: 16px;
}
.w-100 {
  width: 100%;
}
.nowrap {
  white-space: nowrap;
}
.right {
  text-align: right;
}
.inline-form {
  display: inline;
}
.fab {
  display: none;
}
.pagination {
  display: flex;
  gap: 6px;
  justify-content: center;
  align-items: center;
  margin-top: 20px;
}
.pagination .current {
  padding: 0 10px;
  color: var(--ink-2);
  font-size: 14px;
}
.htmx-indicator {
  opacity: 0;
  transition: opacity 0.15s;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  opacity: 1;
}
.spin {
  display: inline-block;
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.insight-body {
  color: var(--ink);
}
.insight-body ul {
  margin: 8px 0 0;
  padding-left: 20px;
}
.insight-body li + li {
  margin-top: 6px;
}
.insight-body h4 {
  margin: 10px 0 4px;
  font-size: 15px;
}

/* --- Responsivo --------------------------------------------------------- */
@media (max-width: 1180px) {
  .kpi-strip.cols-6 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .kpi-strip.cols-6 .kpi:nth-child(4) {
    border-left: 0;
  }
  .kpi-strip.cols-6 .kpi:nth-child(n + 4) {
    border-top: 1px solid var(--line);
  }
}
@media (max-width: 1080px) {
  .grid-2,
  .grid-2-even {
    grid-template-columns: minmax(0, 1fr);
  }
  .settings {
    grid-template-columns: minmax(0, 1fr);
  }
  .settings-nav {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    gap: 4px;
    padding-bottom: 4px;
  }
  .settings-nav a {
    border-left: 0;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
  }
  .settings-nav a.is-active {
    border-bottom-color: var(--ruby);
  }
}
@media (max-width: 960px) {
  :root {
    --gutter: 16px;
  }
  .app {
    grid-template-columns: minmax(0, 1fr);
    background: none; /* a faixa da barra lateral só existe no desktop */
  }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(300px, 86vw);
    transform: translateX(-102%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow-pop);
  }
  .sidebar.is-open {
    transform: translateX(0);
  }
  .nav a.is-active::after {
    display: none;
  }
  .scrim {
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgb(10 12 16 / 0.42);
  }
  .menu-toggle {
    display: inline-grid;
  }
  .page-title {
    font-size: 24px;
  }
  .ficha {
    grid-template-columns: minmax(0, 1fr);
  }
  .ficha-side {
    grid-template-rows: none;
    grid-template-columns: 1fr 1fr;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .ficha-side > div + div {
    border-top: 0;
    border-left: 1px solid var(--line);
  }
  .ficha-main {
    padding: 20px;
  }
  .ficha-side > div {
    padding: 16px 20px;
  }
  .hero-figure .figure {
    font-size: 60px;
  }
  .side-figure .figure {
    font-size: 36px;
  }
  .kpi-strip,
  .kpi-strip.cols-3,
  .kpi-strip.cols-6 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .kpi-strip .kpi:nth-child(odd) {
    border-left: 0;
  }
  .kpi-strip .kpi:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }
  .kpi-strip.cols-6 .kpi:nth-child(4) {
    border-left: 1px solid var(--line);
  }
  .kpi-value {
    font-size: 26px;
  }
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .podium {
    gap: 8px;
  }
  .podium-step {
    padding: 18px 8px 12px;
  }
  .podium-points {
    font-size: 22px;
  }
  .ladder {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ladder li:nth-child(odd) {
    border-left: 0;
  }
  .ladder li:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }
  .chat {
    grid-template-columns: minmax(0, 1fr);
    height: calc(100vh - 120px);
  }
  .chat.has-active .chat-list {
    display: none;
  }
  .chat:not(.has-active) .chat-pane {
    display: none;
  }
  .chat-back {
    display: inline-grid;
  }
  .approval-card {
    grid-template-columns: minmax(0, 1fr);
  }
  .approval-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .auth {
    grid-template-columns: minmax(0, 1fr);
  }
  .auth-art {
    padding: 28px 24px;
    min-height: 0;
  }
  .auth-headline {
    margin-top: 24px;
    font-size: 34px;
  }
  .auth-tabs {
    display: none;
  }
  .auth-panel {
    padding: 32px 20px 40px;
  }
  .stamp {
    position: static;
    display: inline-block;
    margin-top: 10px;
    font-size: 15px;
  }
  .fab {
    position: fixed;
    right: 16px;
    bottom: 18px;
    z-index: 25;
    display: inline-flex;
    box-shadow: var(--shadow-pop);
    border-radius: 999px;
    min-height: 48px;
    padding: 10px 18px;
  }
  .table-wrap .table:not(.table-fluid) {
    min-width: 560px;
  }
  .barlist li {
    grid-template-columns: minmax(90px, 38%) minmax(0, 1fr) auto;
  }
  .doc-head,
  .doc-body {
    padding-left: 22px;
    padding-right: 18px;
  }
}
@media (max-width: 520px) {
  .ficha-side {
    grid-template-columns: minmax(0, 1fr);
  }
  .ficha-side > div + div {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .row:not(.row-tight) {
    grid-template-columns: minmax(0, 1fr);
  }
  .row:not(.row-tight) .row-end {
    justify-content: space-between;
  }
  .hide-sm {
    display: none;
  }
  .toolbar select,
  .toolbar input {
    min-width: 0;
    flex: 1 1 140px;
  }
  .page-head-actions .btn {
    flex: 1 1 auto;
  }
  .msg {
    max-width: 90%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .sidebar,
  .topbar,
  .fab,
  .toasts,
  .page-head-actions {
    display: none !important;
  }
  .app {
    display: block;
  }
  body {
    background: #fff;
  }
  .panel,
  .doc,
  .ficha {
    break-inside: avoid;
  }
}
