/* ==========================================================================
   Conecta Jurídico — núcleo do design system (v2)
   Tokens · reset · tipografia · layout do aplicativo (sidebar, topbar, página)
   ========================================================================== */

/* ---------- Fontes (hospedadas em /static/fonts, sem CDN) ---------- */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/inter-latin.woff2') format('woff2');
  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: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url('../fonts/source-serif-4-latin.woff2') format('woff2');
  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;
}

/* ---------- Tokens: tema claro (padrão) ---------- */
:root {
  color-scheme: light;

  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-serif: 'Source Serif 4', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, 'Times New Roman', serif;

  --fs-2xs: .6875rem;
  --fs-xs: .75rem;
  --fs-sm: .8125rem;
  --fs-base: .9375rem;
  --fs-md: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.375rem;
  --fs-2xl: 1.75rem;
  --fs-3xl: 2.25rem;

  /* superfícies — "branco quente" (efeito de proteção ocular, bem suave).
     Para ajustar a intensidade, mexa só nestes seis valores: quanto mais amarelo o --surface, mais quente a tela. */
  --bg: #f5f1e8;
  --surface: #fffcf5;
  --surface-2: #fbf8ef;
  --sunken: #f0ece0;
  --line: #e7e0cf;
  --line-strong: #d5cdb7;
  --overlay: rgba(8, 18, 34, .55);

  /* texto */
  --text: #0d1b2e;
  --text-2: #36465c;
  --text-3: #55657a;
  --text-faint: #6a778b;
  --on-brand: #ffffff;

  /* marca (azul GPS) */
  --brand: #003366;
  --brand-hover: #002a55;
  --brand-active: #00224a;
  --brand-soft: #e6eef7;
  --brand-soft-text: #0a3a70;
  --link: #0b5aa8;
  --ring: rgba(11, 90, 168, .32);

  /* acento (latão) */
  --gold: #b38a3e;
  --gold-300: #ddb972;
  --gold-soft: #f6ecd8;
  --gold-text: #75561a;

  /* estados do chamado */
  --st-aberto-dot: #d99a00;     --st-aberto-fg: #7a4f00;     --st-aberto-bg: #fff1cf;
  --st-analise-dot: #2f78db;    --st-analise-fg: #164e9e;    --st-analise-bg: #e1ecfc;
  --st-assinatura-dot: #8a5bdb; --st-assinatura-fg: #5b31a8; --st-assinatura-bg: #ece6fb;
  --st-concluido-dot: #1fa36b;  --st-concluido-fg: #0e6b45;  --st-concluido-bg: #ddf3e8;
  --st-neutro-dot: #7b8aa0;     --st-neutro-fg: #36465c;     --st-neutro-bg: #e9edf3;

  /* níveis de risco */
  --rk-baixo: #1fa36b;  --rk-baixo-fg: #0e6b45;
  --rk-medio: #d99a00;  --rk-medio-fg: #7a4f00;
  --rk-alto: #e2661b;   --rk-alto-fg: #a2410a;
  --rk-critico: #d12c3a; --rk-critico-fg: #a3162a;

  /* normas */
  --n01-fg: #8e1f32; --n01-bg: #fbe6ea; --n01-dot: #b3263d;
  --n02-fg: #0b6670; --n02-bg: #dcf1f3; --n02-dot: #0e8794;
  --n03-fg: #8f530b; --n03-bg: #fbebd6; --n03-dot: #bd7410;
  --n04-fg: #1e4e96; --n04-bg: #e2ecfa; --n04-dot: #2c6bc4;

  /* feedback */
  --danger: #c4283a;      --danger-bg: #fde9ec;   --danger-line: #f4b9c1;
  --success: #12804f;     --success-bg: #ddf3e8;  --success-line: #a5dcc0;
  --warning: #8a5a00;     --warning-bg: #fff1cf;  --warning-line: #f1d48a;
  --info: #164e9e;        --info-bg: #e1ecfc;     --info-line: #b4cdf1;

  /* sidebar (sempre azul-marinho) */
  --side-bg: linear-gradient(185deg, #072446 0%, #051a34 100%);
  --side-solid: #061d3a;
  --side-line: rgba(255, 255, 255, .09);
  --side-text: rgba(255, 255, 255, .74);
  --side-muted: rgba(255, 255, 255, .44);

  /* elevação (sombras neutro-quentes, para combinar com o branco quente) */
  --sh-1: 0 1px 2px rgba(42, 33, 14, .07), 0 1px 1px rgba(42, 33, 14, .04);
  --sh-2: 0 6px 16px -4px rgba(42, 33, 14, .11), 0 2px 5px rgba(42, 33, 14, .06);
  --sh-3: 0 22px 48px -12px rgba(30, 24, 12, .30), 0 6px 14px rgba(30, 24, 12, .10);

  /* raios */
  --r-xs: 6px;
  --r-sm: 9px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-pill: 999px;

  /* layout */
  --side-w: 272px;
  --topbar-h: 64px;
  --page-pad: clamp(16px, 3vw, 36px);
  --page-max: 1360px;

  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* ---------- Tokens: tema escuro ---------- */
:root[data-theme='dark'] {
  color-scheme: dark;

  --bg: #091120;
  --surface: #0f1a2e;
  --surface-2: #132038;
  --sunken: #0b1527;
  --line: #1c2b46;
  --line-strong: #2b3f62;
  --overlay: rgba(2, 8, 18, .72);

  --text: #e8eef7;
  --text-2: #b9c5d8;
  --text-3: #8e9db4;
  --text-faint: #71829c;
  --on-brand: #ffffff;

  --brand: #2a6bb8;
  --brand-hover: #3678c8;
  --brand-active: #2a64ab;
  --brand-soft: #13284a;
  --brand-soft-text: #a9cbf3;
  --link: #7db2f0;
  --ring: rgba(125, 178, 240, .38);

  --gold: #d3ad66;
  --gold-300: #e2c486;
  --gold-soft: #2c2415;
  --gold-text: #e8cd93;

  --st-aberto-dot: #f2b63c;     --st-aberto-fg: #f6cb72;     --st-aberto-bg: rgba(242, 182, 60, .14);
  --st-analise-dot: #5b9be6;    --st-analise-fg: #a2c7f4;    --st-analise-bg: rgba(91, 155, 230, .16);
  --st-assinatura-dot: #a98be8; --st-assinatura-fg: #cbb9f3; --st-assinatura-bg: rgba(169, 139, 232, .17);
  --st-concluido-dot: #3cc48a;  --st-concluido-fg: #82dfb5;  --st-concluido-bg: rgba(60, 196, 138, .15);
  --st-neutro-dot: #8e9db4;     --st-neutro-fg: #b9c5d8;     --st-neutro-bg: rgba(142, 157, 180, .15);

  --rk-baixo: #3cc48a;  --rk-baixo-fg: #82dfb5;
  --rk-medio: #f2b63c;  --rk-medio-fg: #f6cb72;
  --rk-alto: #f08a4b;   --rk-alto-fg: #f6a877;
  --rk-critico: #ee5a68; --rk-critico-fg: #f58f99;

  --n01-fg: #f2a1ae; --n01-bg: rgba(238, 90, 104, .15); --n01-dot: #ee5a68;
  --n02-fg: #7fd3dc; --n02-bg: rgba(40, 180, 196, .15); --n02-dot: #37b9c7;
  --n03-fg: #f1bf82; --n03-bg: rgba(240, 160, 60, .15); --n03-dot: #ef9f3e;
  --n04-fg: #9fc2f2; --n04-bg: rgba(91, 155, 230, .16); --n04-dot: #5b9be6;

  --danger: #f27a87;      --danger-bg: rgba(238, 90, 104, .14);  --danger-line: rgba(238, 90, 104, .38);
  --success: #54d09b;     --success-bg: rgba(60, 196, 138, .14); --success-line: rgba(60, 196, 138, .38);
  --warning: #f3c466;     --warning-bg: rgba(242, 182, 60, .14); --warning-line: rgba(242, 182, 60, .38);
  --info: #9fc2f2;        --info-bg: rgba(91, 155, 230, .15);    --info-line: rgba(91, 155, 230, .38);

  --side-bg: linear-gradient(185deg, #0a182e 0%, #060e1c 100%);
  --side-solid: #08142a;

  --sh-1: 0 1px 2px rgba(0, 0, 0, .35);
  --sh-2: 0 8px 20px -6px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .3);
  --sh-3: 0 26px 56px -14px rgba(0, 0, 0, .7), 0 8px 18px rgba(0, 0, 0, .4);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar-h) + 18px); }
body, h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img, svg, video { display: block; max-width: 100%; }
table { border-collapse: collapse; width: 100%; }
[hidden] { display: none !important; }
::selection { background: color-mix(in srgb, var(--link) 30%, transparent); }

body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'cv11', 'ss03';
  min-height: 100dvh;
}

:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; border-radius: 4px; }
:focus:not(:focus-visible) { outline: none; }

/* barras de rolagem discretas */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); background-clip: content-box; border: 3px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Tipografia ---------- */
h1, h2 { font-family: var(--font-serif); font-weight: 600; letter-spacing: -.015em; line-height: 1.18; color: var(--text); font-optical-sizing: auto; }
h3, h4, h5 { font-weight: 650; letter-spacing: -.005em; line-height: 1.3; color: var(--text); }
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-md); }
h4 { font-size: var(--fs-base); }
strong, b { font-weight: 650; }
small { font-size: var(--fs-sm); }

.serif { font-family: var(--font-serif); font-optical-sizing: auto; }
.tnum { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum', 'cv11'; }
.muted { color: var(--text-3); }
.faint { color: var(--text-faint); }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2, .clamp-3 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-2 { -webkit-line-clamp: 2; line-clamp: 2; }
.clamp-3 { -webkit-line-clamp: 3; line-clamp: 3; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---------- Ícones (sprite inline) ---------- */
.i { width: 1.125rem; height: 1.125rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; }
.i--sm { width: .9375rem; height: .9375rem; stroke-width: 2; }
.i--xs { width: .8125rem; height: .8125rem; stroke-width: 2.1; }
.i--lg { width: 1.375rem; height: 1.375rem; stroke-width: 1.6; }
.i--xl { width: 1.75rem; height: 1.75rem; stroke-width: 1.5; }
.i--spin { animation: cj-spin .9s linear infinite; }
@keyframes cj-spin { to { transform: rotate(360deg); } }

/* ---------- Avatar ---------- */
.avatar {
  --sz: 36px;
  width: var(--sz); height: var(--sz); flex: none;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: calc(var(--sz) * .38); font-weight: 650; letter-spacing: .01em;
  color: #fff;
  background: var(--av, #1f5a9e);
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16);
  user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--xs { --sz: 22px; }
.avatar--sm { --sz: 28px; }
.avatar--md { --sz: 36px; }
.avatar--lg { --sz: 52px; }
.avatar--xl { --sz: 76px; }
.av-1 { --av: #1f5a9e; } .av-2 { --av: #0f7a85; } .av-3 { --av: #5b4bb0; } .av-4 { --av: #a25a14; }
.av-5 { --av: #2c7a4b; } .av-6 { --av: #a03a5b; } .av-7 { --av: #5a6a86; } .av-8 { --av: #7a5a1c; }

/* ==========================================================================
   Layout do aplicativo
   ========================================================================== */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100dvh; }
.app__main { min-width: 0; display: flex; flex-direction: column; }

.skip-link { position: fixed; left: 12px; top: -60px; z-index: 200; background: var(--brand); color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 600; transition: top .2s; }
.skip-link:focus { top: 12px; text-decoration: none; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky; top: 0; height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--side-bg);
  color: var(--side-text);
  border-right: 1px solid var(--side-line);
  overflow-y: auto; overscroll-behavior: contain;
  scrollbar-color: rgba(255, 255, 255, .2) transparent;
  z-index: 60;
}
.sidebar ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .2); background-clip: content-box; }

.brand { display: flex; align-items: center; gap: .8rem; padding: 22px 20px 18px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand__mark {
  width: 40px; height: 40px; flex: none; border-radius: 12px;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(150deg, #0d5aa8 0%, #063266 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18), 0 6px 14px -4px rgba(0, 0, 0, .55);
}
.brand__mark .i { width: 22px; height: 22px; stroke-width: 1.6; }
.brand__text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand__name { font: 600 1.1875rem/1.1 var(--font-serif); letter-spacing: -.012em; color: #fff; }
.brand__sub { margin-top: 5px; font-size: .625rem; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--gold-300); opacity: .92; }
.sidebar__close { display: none; margin-left: auto; color: var(--side-text); width: 36px; height: 36px; border-radius: 10px; place-items: center; }
.sidebar__close:hover { background: rgba(255, 255, 255, .08); color: #fff; }

/* O botão de recolher/expandir fica só no topo (.topbar__collapse), visível apenas em telas largas. */
.topbar__collapse { flex: none; }

/* ---- barra lateral recolhida: só ícones ---- */
:root[data-sidebar='collapsed'] { --side-w: 76px; }
@media (min-width: 1024px) {
  .app { transition: grid-template-columns .28s var(--ease); }
  .sidebar { overflow-x: hidden; }
  :root[data-sidebar='collapsed'] .sidebar__top { justify-content: center; padding: 18px 0 8px; }
  :root[data-sidebar='collapsed'] .brand { flex: none; padding: 0; }
  :root[data-sidebar='collapsed'] .brand__text { display: none; }
  :root[data-sidebar='collapsed'] .nav { padding: 6px 12px 12px; }
  :root[data-sidebar='collapsed'] .nav__label { height: 1px; margin: 12px 16px; padding: 0; font-size: 0; line-height: 0; background: var(--side-line); overflow: hidden; }
  :root[data-sidebar='collapsed'] .nav__label:first-child { display: none; }
  :root[data-sidebar='collapsed'] .nav__item { justify-content: center; gap: 0; padding: .72rem 0; }
  :root[data-sidebar='collapsed'] .nav__item > span:not(.nav__badge) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  :root[data-sidebar='collapsed'] .nav__badge { position: absolute; top: 2px; right: 7px; min-width: 17px; height: 17px; margin: 0; padding: 0 4px; font-size: .625rem; }
  :root[data-sidebar='collapsed'] .sidebar__foot { padding: 10px 12px 12px; }
  :root[data-sidebar='collapsed'] .usercard { justify-content: center; padding: 6px; background: transparent; }
  :root[data-sidebar='collapsed'] .usercard__meta, :root[data-sidebar='collapsed'] .usercard__out { display: none; }
}
/* Dica flutuante dos itens quando a barra está recolhida (fora da barra para não ser cortada).
   O centramento vertical usa `translate` e a animação usa `transform`: são propriedades independentes, então a
   dica não "pula" quando a animação termina (antes a animação sobrescrevia o translateY(-50%)). */
.side-tip { position: fixed; z-index: 150; translate: 0 -50%; padding: .42rem .75rem; border-radius: 9px; background: #0d1b2e; color: #fff; font-size: .8125rem; font-weight: 600; line-height: 1.2; white-space: nowrap; pointer-events: none; box-shadow: var(--sh-2); animation: cj-side-tip .14s ease-out; }
@keyframes cj-side-tip { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
:root[data-theme='dark'] .side-tip { background: #e8eef7; color: #0d1b2e; }

.nav { padding: 4px 12px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav__label { padding: 18px 12px 7px; font-size: .6875rem; font-weight: 650; letter-spacing: .12em; text-transform: uppercase; color: var(--side-muted); }
.nav__label:first-child { padding-top: 6px; }
.nav__item {
  position: relative; display: flex; align-items: center; gap: .8rem;
  padding: .62rem .8rem; border-radius: 11px;
  color: var(--side-text); font-size: .875rem; font-weight: 500; line-height: 1.25;
  transition: background .15s, color .15s;
}
.nav__item > span:not(.nav__badge) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav__item:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }
.nav__item .i { width: 1.1875rem; height: 1.1875rem; opacity: .85; transition: opacity .15s; }
.nav__item:hover .i { opacity: 1; }
.nav__item[aria-current='page'] { background: rgba(255, 255, 255, .11); color: #fff; font-weight: 600; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06); }
.nav__item[aria-current='page'] .i { opacity: 1; color: var(--gold-300); }
.nav__item[aria-current='page']::before { content: ''; position: absolute; left: -12px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold-300); }
.nav__badge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 99px; background: var(--gold-300); color: #2b1d04; font-size: .72rem; font-weight: 700; display: grid; place-items: center; font-variant-numeric: tabular-nums; }

.sidebar__foot { position: sticky; bottom: 0; margin-top: auto; padding: 14px 14px 16px; border-top: 1px solid var(--side-line); background: var(--side-solid); }
@media (min-width: 1024px) and (max-height: 800px) {
  .brand { padding: 16px 18px 12px; }
  .nav__item { padding: .5rem .75rem; }
  .nav__label { padding: 12px 12px 5px; }
  .sidebar__foot { padding: 10px 12px 12px; }
}
.usercard { display: flex; align-items: center; gap: .7rem; padding: .55rem; border-radius: 12px; background: rgba(255, 255, 255, .05); }
.usercard__meta { min-width: 0; flex: 1; line-height: 1.25; }
.usercard__name { font-size: .875rem; font-weight: 600; color: #fff; }
.usercard__role { font-size: .75rem; color: var(--side-muted); }
.usercard__out { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; color: var(--side-text); flex: none; }
.usercard__out:hover { background: rgba(255, 255, 255, .1); color: #fff; text-decoration: none; }
.sidebar__ver { margin-top: 10px; font-size: .6875rem; color: var(--side-muted); text-align: center; letter-spacing: .02em; }

.scrim { position: fixed; inset: 0; background: var(--overlay); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .25s; }
.scrim.is-on { opacity: 1; pointer-events: auto; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  height: var(--topbar-h); padding: 0 var(--page-pad);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: saturate(1.5) blur(14px); backdrop-filter: saturate(1.5) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar__menu { display: none; width: 40px; height: 40px; border-radius: 11px; place-items: center; color: var(--text-2); }
.topbar__menu:hover { background: var(--sunken); }
.gsearch { position: relative; flex: 1 1 auto; max-width: 540px; }
.gsearch input {
  width: 100%; height: 40px; padding: 0 3.2rem 0 2.6rem;
  border-radius: 12px; border: 1px solid transparent; background: var(--sunken); color: var(--text);
  font-size: .875rem; transition: border-color .15s, background .15s, box-shadow .15s;
}
.gsearch input::placeholder { color: var(--text-faint); }
.gsearch input:hover { border-color: var(--line); }
.gsearch input:focus { outline: none; background: var(--surface); border-color: var(--link); box-shadow: 0 0 0 3px var(--ring); }
.gsearch .i { position: absolute; left: 13px; top: 50%; translate: 0 -50%; color: var(--text-3); pointer-events: none; }
.kbd { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; background: var(--surface); color: var(--text-3); font: 600 .6875rem/1 var(--font-sans); }
.gsearch .kbd { position: absolute; right: 10px; top: 50%; translate: 0 -50%; pointer-events: none; }
.topbar__spacer { flex: 1; }
.topbar__actions { display: flex; align-items: center; gap: 6px; }

.icon-btn { position: relative; width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 11px; color: var(--text-2); transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--sunken); color: var(--text); text-decoration: none; }
.icon-btn[aria-expanded='true'] { background: var(--sunken); color: var(--text); }
.icon-btn__dot { position: absolute; top: 5px; right: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--danger); color: #fff; font-size: .6875rem; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--surface); font-variant-numeric: tabular-nums; }

.profile-trigger { display: flex; align-items: center; gap: .6rem; padding: 4px 8px 4px 4px; border-radius: 99px; transition: background .15s; }
.profile-trigger:hover, .profile-trigger[aria-expanded='true'] { background: var(--sunken); }
.profile-trigger__name { font-size: .875rem; font-weight: 600; max-width: 140px; }

/* ---------- Página ---------- */
.page { width: 100%; max-width: var(--page-max); margin-inline: auto; padding: clamp(20px, 2.8vw, 32px) var(--page-pad) 96px; flex: 1; }
.page--narrow { max-width: 960px; }
.page--wide { max-width: 1520px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 14px 28px; margin-bottom: clamp(18px, 2.4vw, 28px); }
.page-head__text { min-width: 0; }
.eyebrow { display: flex; align-items: center; gap: .55rem; margin-bottom: 8px; font-size: .75rem; font-weight: 650; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.eyebrow::before { content: ''; width: 20px; height: 2px; border-radius: 2px; background: var(--gold); }
.page-title { font-size: clamp(1.625rem, 2.5vw, 2.125rem); }
.page-lead { margin-top: 8px; max-width: 64ch; color: var(--text-2); font-size: var(--fs-base); }
.page-head__actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- Grids utilitários ---------- */
.stack { display: flex; flex-direction: column; gap: var(--gap, 1rem); }
.row { display: flex; align-items: center; gap: var(--gap, .75rem); }
.row--wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.grid { display: grid; gap: var(--gap, 1rem); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ---------- Responsivo do shell ---------- */
@media (max-width: 1023.98px) {
  .app { display: block; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(312px, 88vw); height: 100dvh;
    /* fechada: sem sombra (ela vazava como uma faixa escura na borda esquerda da tela) e fora da ordem de foco */
    transform: translateX(-102%); box-shadow: none; visibility: hidden;
    transition: transform .3s var(--ease), box-shadow .3s var(--ease), visibility 0s linear .3s;
  }
  .sidebar.is-open { transform: none; box-shadow: var(--sh-3); visibility: visible; transition-delay: 0s; }
  .sidebar__close { display: grid; }
  .topbar__collapse { display: none; }
  .topbar__menu { display: grid; }
  .profile-trigger__name { display: none; }
  .gsearch .kbd { display: none; }
}
@media (max-width: 640px) {
  .topbar { gap: 6px; }
  .topbar .btn--cta .btn__label { display: none; }
  /* painéis do topo (notificações, perfil) alinham com a barra e não com o botão que os abriu:
     antes o de notificações vazava ~60px para fora da tela, à esquerda */
  .topbar .menu-wrap { position: static; }
  .topbar .menu { top: calc(100% + 6px); left: 12px; right: 12px; width: auto; max-width: none; }
  .topbar .menu--profile { left: auto; width: min(280px, calc(100vw - 24px)); }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ---------- Movimento reduzido ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ---------- Impressão ---------- */
@media print {
  .sidebar, .topbar, .scrim, .lexia, .toasts { display: none !important; }
  .app { display: block; }
  body { background: #fff; }
}
