/* ==========================================================================
   WS DESIGN SYSTEM 2027 — Camada 2027
   Carregar DEPOIS de base.css e components.css (herdados do WS Glass).
   1. Ajustes nos componentes existentes (mesmas classes, novo visual).
   2. Componentes novos: estrutura de painel, navegação, indicadores,
      tabela profissional, selo de aluno, ajuda (i), popover e painel lateral.
   Compatível com CSP style-src 'self': nenhuma regra depende de estilo inline.
   ========================================================================== */

/* ---------- 1. Ajustes nos componentes herdados ---------- */
:focus-visible {
  outline: 2px solid var(--ws-focus);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px var(--ws-focus-halo);
}

/* Cards e superfícies: borda em vez de sombra, vidro só onde pedido */
.ws-card { border-radius: var(--ws-radius-md); background: var(--ws-surface-solid); box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.ws-card--interactive:hover { transform: none; border-color: var(--ws-border-strong); box-shadow: var(--ws-shadow-sm); }
.ws-card__icon { border-radius: var(--ws-radius-sm); }

/* Botões: cantos de 8 px; verde sempre #00FF00 (sem tom mais claro no hover) */
.ws-btn { border-radius: var(--ws-radius-sm); min-height: var(--ws-touch); padding: 0 var(--ws-space-4); font-weight: var(--ws-weight-semibold); }
.ws-btn--icon { padding: 0; }
.ws-btn--primary { box-shadow: inset 0 0 0 1px var(--ws-accent-border); }
.ws-btn--primary:hover { --_bg: var(--ws-green); box-shadow: inset 0 0 0 2px var(--ws-on-green); }
.ws-btn--primary:active { transform: translateY(1px); }
@media (pointer: fine) {
  .ws-panel-ui .ws-btn { min-height: var(--ws-control-h); }
  .ws-panel-ui .ws-btn--sm { min-height: 1.875rem; }
}

/* Campos */
.ws-input, .ws-select, .ws-textarea { border-radius: var(--ws-radius-sm); background: var(--ws-surface-solid); }

/* Badges: cantos de 6 px, mais discretos */
.ws-badge { border-radius: 0.375rem; font-weight: var(--ws-weight-medium); }
.ws-badge--accent { --_bg: var(--ws-green); --_fg: var(--ws-on-green); }

/* Tabelas: cabeçalho fixo, linha com destaque no hover */
.ws-table-wrap { border-radius: var(--ws-radius-md); background: var(--ws-surface-solid); }
.ws-table th { position: sticky; top: 0; background: var(--ws-surface-solid); z-index: 1; text-transform: none; letter-spacing: 0; font-size: var(--ws-text-xs); }
.ws-table tbody tr:hover td { background: var(--ws-surface-2); }
.ws-table td.ws-num, .ws-table th.ws-num { text-align: right; font-variant-numeric: tabular-nums; }

/* Modal e toasts */
.ws-modal { border-radius: var(--ws-radius-lg); }
.ws-toast { border-radius: var(--ws-radius-sm); }
.ws-toast--danger .ws-icon { color: var(--ws-danger); }

/* Link com sublinhado verde: forma de usar o verde em texto no tema claro */
.ws-link {
  color: var(--ws-text); font-weight: var(--ws-weight-medium);
  text-decoration: underline; text-decoration-color: var(--ws-accent-underline);
  text-decoration-thickness: 2px; text-underline-offset: 0.22em;
}
.ws-link:hover { text-decoration-thickness: 3px; }

/* ---------- 2. Estrutura de painel (sidebar + conteúdo) ---------- */
.ws-shell {
  display: grid; grid-template-columns: var(--ws-sidebar-w) minmax(0, 1fr);
  min-height: 100dvh; background: var(--ws-bg);
}
.ws-shell[data-collapsed="true"] { grid-template-columns: var(--ws-sidebar-w-collapsed) minmax(0, 1fr); }

.ws-sidebar {
  position: sticky; top: 0; height: 100dvh; overflow-y: auto;
  display: flex; flex-direction: column; gap: var(--ws-space-1);
  padding: var(--ws-space-4) var(--ws-space-3);
  background: var(--ws-surface-solid); border-right: 1px solid var(--ws-border);
  z-index: var(--ws-z-sidebar);
}
.ws-sidebar__brand { display: flex; align-items: center; gap: var(--ws-space-3); padding: 0 var(--ws-space-2) var(--ws-space-4); min-width: 0; }
.ws-sidebar__logo { width: 2.25rem; height: 2.25rem; flex: none; border-radius: var(--ws-radius-sm); object-fit: contain; }
.ws-sidebar__name { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.ws-sidebar__name strong { font-family: var(--ws-font-display); font-size: var(--ws-text-md); letter-spacing: -0.01em; }
.ws-sidebar__name span { font-size: var(--ws-text-xs); color: var(--ws-text-3); }
.ws-sidebar__collapse { margin-left: auto; }
.ws-sidebar__foot { margin-top: auto; display: flex; align-items: center; gap: var(--ws-space-3); padding: var(--ws-space-3) var(--ws-space-2) 0; border-top: 1px solid var(--ws-border); min-width: 0; }
.ws-avatar { width: 2rem; height: 2rem; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--ws-surface-3); font-size: var(--ws-text-xs); font-weight: var(--ws-weight-semibold); }

.ws-nav { display: flex; flex-direction: column; gap: 2px; }
.ws-nav__label { padding: var(--ws-space-3) var(--ws-space-3) var(--ws-space-1); font-size: 0.6875rem; font-weight: var(--ws-weight-semibold); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ws-text-3); }
.ws-nav__item, .ws-nav__group > summary {
  display: flex; align-items: center; gap: var(--ws-space-3);
  min-height: var(--ws-control-h); padding: 0 var(--ws-space-3);
  border-radius: var(--ws-radius-sm); color: var(--ws-text-2);
  font-size: var(--ws-text-sm); text-decoration: none; cursor: pointer; list-style: none;
  transition: background var(--ws-dur-fast) var(--ws-ease), color var(--ws-dur-fast) var(--ws-ease);
}
.ws-nav__group > summary::-webkit-details-marker { display: none; }
.ws-nav__item:hover, .ws-nav__group > summary:hover { background: var(--ws-surface-2); color: var(--ws-text); }
.ws-nav__item[aria-current="page"] { background: var(--ws-surface-2); color: var(--ws-text); font-weight: var(--ws-weight-medium); box-shadow: inset 3px 0 0 var(--ws-green); }
.ws-nav__item .ws-icon, .ws-nav__group > summary .ws-icon { width: 1.125rem; height: 1.125rem; }
.ws-nav__text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-nav__chevron { transition: transform var(--ws-dur) var(--ws-ease); color: var(--ws-text-3); }
.ws-nav__group[open] > summary .ws-nav__chevron { transform: rotate(90deg); }
.ws-nav__sub { display: flex; flex-direction: column; gap: 1px; padding: 2px 0 var(--ws-space-2) 2.375rem; }
.ws-nav__sub .ws-nav__item { min-height: 2rem; padding: 0 var(--ws-space-2); font-size: 0.8125rem; }
.ws-nav__count { min-width: 1.25rem; padding: 0 0.375rem; border-radius: var(--ws-radius-pill); background: var(--ws-surface-3); font-size: 0.6875rem; font-weight: var(--ws-weight-semibold); text-align: center; color: var(--ws-text); }

/* Sidebar recolhida: só ícones (tooltips pelos atributos title/aria-label) */
.ws-shell[data-collapsed="true"] .ws-nav__text,
.ws-shell[data-collapsed="true"] .ws-nav__chevron,
.ws-shell[data-collapsed="true"] .ws-nav__sub,
.ws-shell[data-collapsed="true"] .ws-nav__label,
.ws-shell[data-collapsed="true"] .ws-nav__count,
.ws-shell[data-collapsed="true"] .ws-sidebar__name,
.ws-shell[data-collapsed="true"] .ws-sidebar__foot > :not(.ws-avatar) { display: none; }
.ws-shell[data-collapsed="true"] .ws-nav__item, .ws-shell[data-collapsed="true"] .ws-nav__group > summary { justify-content: center; padding: 0; }

.ws-main { min-width: 0; display: flex; flex-direction: column; }
.ws-topbar {
  position: sticky; top: 0; z-index: var(--ws-z-header);
  display: flex; align-items: center; gap: var(--ws-space-3);
  min-height: var(--ws-header-h); padding: var(--ws-space-2) var(--ws-gutter);
  background: var(--ws-surface); border-bottom: 1px solid var(--ws-border);
  -webkit-backdrop-filter: blur(var(--ws-blur)); backdrop-filter: blur(var(--ws-blur));
  flex-wrap: wrap;
}
.ws-topbar__menu { display: none; }
@media (min-width: 961px) {
  .ws-topbar { flex-wrap: nowrap; }
  .ws-topbar .ws-breadcrumb { flex: 1 1 auto; flex-wrap: nowrap; overflow: hidden; white-space: nowrap; }
  .ws-topbar__actions { flex: none; flex-wrap: nowrap; }
  .ws-topbar .ws-search { width: clamp(14rem, 26vw, 22rem); }
}
.ws-topbar__actions { margin-left: auto; display: flex; align-items: center; gap: var(--ws-space-2); flex-wrap: wrap; }
.ws-breadcrumb { display: flex; align-items: center; gap: var(--ws-space-2); font-size: var(--ws-text-sm); color: var(--ws-text-3); min-width: 0; flex-wrap: wrap; }
.ws-breadcrumb a { color: inherit; text-decoration: none; }
.ws-breadcrumb a:hover { color: var(--ws-text); }
.ws-breadcrumb [aria-current="page"] { color: var(--ws-text); }

.ws-search {
  display: flex; align-items: center; gap: var(--ws-space-2);
  width: min(24rem, 100%); min-height: var(--ws-control-h); padding: 0 var(--ws-space-3);
  border: 1px solid var(--ws-border); border-radius: var(--ws-radius-sm);
  background: var(--ws-surface-solid); color: var(--ws-text-3);
}
.ws-search:focus-within { border-color: var(--ws-border-strong); box-shadow: 0 0 0 4px var(--ws-focus-halo); }
.ws-search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: var(--ws-text-sm); color: var(--ws-text); }
.ws-kbd { font-family: var(--ws-font-sans); font-size: 0.6875rem; padding: 1px 0.375rem; border: 1px solid var(--ws-border); border-radius: var(--ws-radius-xs); color: var(--ws-text-3); white-space: nowrap; }

.ws-content { padding: var(--ws-space-6) var(--ws-gutter) var(--ws-space-12); display: flex; flex-direction: column; gap: var(--ws-space-6); max-width: var(--ws-container-wide); width: 100%; }
.ws-page-head { display: flex; align-items: flex-end; gap: var(--ws-space-4); flex-wrap: wrap; }
.ws-page-head__title { margin: 0; display: flex; align-items: center; gap: var(--ws-space-2); font-size: var(--ws-text-2xl); letter-spacing: var(--ws-tracking-display); }
.ws-page-head__desc { margin: var(--ws-space-1) 0 0; color: var(--ws-text-3); max-width: var(--ws-container-text); }
.ws-page-head__actions { margin-left: auto; display: flex; gap: var(--ws-space-2); flex-wrap: wrap; }

/* Indicadores (KPI) — só números que pedem ação */
.ws-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: var(--ws-space-4); }
.ws-kpi { display: flex; flex-direction: column; gap: var(--ws-space-1); padding: var(--ws-space-4) var(--ws-space-5); border: 1px solid var(--ws-border); border-radius: var(--ws-radius-md); background: var(--ws-surface-solid); min-width: 0; }
.ws-kpi__label { font-size: var(--ws-text-sm); color: var(--ws-text-3); }
.ws-kpi__value { font-family: var(--ws-font-display); font-size: var(--ws-text-2xl); font-weight: var(--ws-weight-bold); letter-spacing: var(--ws-tracking-display); font-variant-numeric: tabular-nums; line-height: 1.15; }
.ws-kpi__meta { font-size: var(--ws-text-xs); color: var(--ws-text-3); }
.ws-kpi--alert { border-color: var(--ws-warning); }
.ws-kpi--alert .ws-kpi__label { color: var(--ws-warning); }

/* Painel (card com cabeçalho) */
.ws-panel { border: 1px solid var(--ws-border); border-radius: var(--ws-radius-md); background: var(--ws-surface-solid); min-width: 0; }
.ws-panel__head { display: flex; align-items: center; gap: var(--ws-space-3); padding: var(--ws-space-4) var(--ws-space-5); border-bottom: 1px solid var(--ws-border); flex-wrap: wrap; }
.ws-panel__title { margin: 0; display: flex; align-items: center; gap: var(--ws-space-2); font-family: var(--ws-font-sans); font-size: var(--ws-text-md); font-weight: var(--ws-weight-semibold); letter-spacing: 0; }
.ws-panel__body { padding: var(--ws-space-5); }
.ws-panel__body--flush { padding: 0; }
.ws-panel .ws-table-wrap { border: 0; border-radius: 0 0 var(--ws-radius-md) var(--ws-radius-md); }

/* Linha de configuração: rótulo + ajuda à esquerda, controle à direita */
.ws-setting { display: flex; align-items: center; gap: var(--ws-space-4); padding: var(--ws-space-4) var(--ws-space-5); border-top: 1px solid var(--ws-border); flex-wrap: wrap; }
.ws-panel__head + .ws-setting { border-top: 0; }
.ws-setting__text { flex: 1 1 16rem; min-width: 0; }
.ws-setting__title { display: flex; align-items: center; gap: var(--ws-space-2); font-weight: var(--ws-weight-medium); }
.ws-setting__desc { font-size: var(--ws-text-sm); color: var(--ws-text-3); }

/* Filtros em chip */
.ws-filters { display: flex; gap: var(--ws-space-2); flex-wrap: wrap; }
.ws-filter {
  min-height: 2rem; padding: 0 var(--ws-space-3); border-radius: var(--ws-radius-pill);
  border: 1px solid var(--ws-border); background: transparent; color: var(--ws-text-2); font-size: var(--ws-text-xs); font-weight: var(--ws-weight-medium);
}
.ws-filter:hover { border-color: var(--ws-border-strong); color: var(--ws-text); }
.ws-filter[aria-pressed="true"] { border-color: var(--ws-text); background: var(--ws-surface-2); color: var(--ws-text); box-shadow: inset 0 -2px 0 var(--ws-green); }

/* Status com ponto */
.ws-status { display: inline-flex; align-items: center; gap: var(--ws-space-2); font-size: var(--ws-text-xs); color: var(--ws-text-2); white-space: nowrap; }
.ws-status::before { content: ""; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--ws-text-3); flex: none; }
.ws-status--on::before { background: var(--ws-green); box-shadow: 0 0 0 1px var(--ws-accent-border); }
.ws-status--warn::before { background: var(--ws-warning); }
.ws-status--off::before { background: transparent; border: 1.5px solid var(--ws-text-3); }

/* Selo de aluno — verde com texto preto; keyline no tema claro */
.ws-seal {
  display: inline-flex; align-items: center; gap: 0.375rem; min-height: 1.5rem; padding: 0 0.5rem;
  border-radius: 0.375rem; background: var(--ws-green); color: var(--ws-on-green);
  box-shadow: inset 0 0 0 1px var(--ws-accent-border);
  font-size: 0.6875rem; font-weight: var(--ws-weight-bold); letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap;
}
.ws-seal .ws-icon { width: 0.875rem; height: 0.875rem; stroke-width: 2.25; }

/* Barra de salvar fixa (formulários longos) */
.ws-savebar {
  position: sticky; bottom: 0; z-index: var(--ws-z-header);
  display: flex; align-items: center; gap: var(--ws-space-3); flex-wrap: wrap;
  padding: var(--ws-space-3) var(--ws-gutter) calc(var(--ws-space-3) + env(safe-area-inset-bottom, 0px));
  background: var(--ws-surface); border-top: 1px solid var(--ws-border);
  -webkit-backdrop-filter: blur(var(--ws-blur)); backdrop-filter: blur(var(--ws-blur));
}
.ws-savebar__msg { font-size: var(--ws-text-sm); color: var(--ws-text-2); margin-right: auto; }

/* ---------- Ajuda contextual (i) ---------- */
.ws-help {
  display: inline-grid; place-items: center; flex: none;
  width: 1.25rem; height: 1.25rem; padding: 0; position: relative;
  border-radius: 50%; border: 1px solid var(--ws-border-strong); background: transparent; color: var(--ws-text-2);
  font: italic 600 0.6875rem/1 Georgia, "Times New Roman", serif;
  transition: border-color var(--ws-dur-fast) var(--ws-ease), background var(--ws-dur-fast) var(--ws-ease), color var(--ws-dur-fast) var(--ws-ease);
}
/* Área de toque de 44 px sem aumentar o círculo */
.ws-help::after { content: ""; position: absolute; inset: -0.75rem; }
.ws-help:hover { border-color: var(--ws-text); color: var(--ws-text); }
.ws-help[aria-expanded="true"] { background: var(--ws-green); border-color: var(--ws-accent-border); color: var(--ws-on-green); }

.ws-tooltip {
  position: fixed; z-index: var(--ws-z-popover); max-width: 16rem; padding: 0.375rem 0.5rem;
  border-radius: var(--ws-radius-xs); background: var(--ws-surface-inverse); color: var(--ws-text-inverse);
  font-size: var(--ws-text-xs); line-height: 1.35; pointer-events: none;
  animation: ws-ds-fade var(--ws-dur-fast) var(--ws-ease);
}

.ws-popover {
  position: fixed; z-index: var(--ws-z-popover); width: min(22rem, calc(100vw - 1rem));
  max-height: min(70dvh, 32rem); overflow-y: auto;
  display: flex; flex-direction: column; gap: var(--ws-space-3);
  padding: var(--ws-space-4); border-radius: var(--ws-radius-md);
  background: var(--ws-surface-solid); color: var(--ws-text);
  border: 1px solid var(--ws-border-strong); box-shadow: var(--ws-shadow-lg);
  animation: ws-ds-pop var(--ws-dur) var(--ws-ease);
}
.ws-popover:focus, .ws-popover:focus-visible { outline: none; box-shadow: var(--ws-shadow-lg); }
.ws-popover__head { display: flex; align-items: center; gap: var(--ws-space-2); }
.ws-popover__title { margin: 0; font-family: var(--ws-font-sans); font-size: var(--ws-text-md); font-weight: var(--ws-weight-semibold); letter-spacing: 0; flex: 1; min-width: 0; }
.ws-popover__close { width: 2rem; height: 2rem; display: grid; place-items: center; border: 0; border-radius: var(--ws-radius-xs); background: transparent; color: var(--ws-text-3); }
.ws-popover__close:hover { background: var(--ws-surface-2); color: var(--ws-text); }
.ws-help-part__label { font-size: 0.6875rem; font-weight: var(--ws-weight-semibold); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ws-text-3); }
.ws-help-part__text { margin: 0.25rem 0 0; font-size: var(--ws-text-sm); line-height: 1.5; }
.ws-where { display: flex; flex-wrap: wrap; gap: 0.375rem; margin-top: 0.375rem; }
.ws-where__chip { padding: 0.125rem 0.5rem; border-radius: var(--ws-radius-pill); border: 1px solid var(--ws-border-strong); font-size: var(--ws-text-xs); }
.ws-help-caution { display: flex; gap: var(--ws-space-2); padding: var(--ws-space-3); border-radius: var(--ws-radius-sm); background: var(--ws-warning-soft); font-size: var(--ws-text-sm); line-height: 1.45; }
.ws-help-caution strong { color: var(--ws-warning); }
.ws-help-more { align-self: flex-start; padding: 0; border: 0; background: none; font-size: var(--ws-text-sm); }

/* Miniatura "onde aparece": esquema da página com a área afetada em verde */
.ws-mini { margin: 0; padding: var(--ws-space-3); border: 1px solid var(--ws-border); border-radius: var(--ws-radius-sm); background: var(--ws-surface-2); }
.ws-mini__caption { margin: 0 0 var(--ws-space-2); font-size: var(--ws-text-xs); color: var(--ws-text-3); }
.ws-mini__page { display: flex; flex-direction: column; gap: 0.375rem; padding: 0.625rem; border-radius: 0.375rem; background: var(--ws-surface-solid); border: 1px solid var(--ws-border); }
.ws-mini__row { height: 0.5rem; border-radius: 0.25rem; background: var(--ws-surface-3); }
.ws-mini__row--short { width: 45%; }
.ws-mini__row--mid { width: 70%; }
.ws-mini__block { height: 2.25rem; border-radius: 0.25rem; background: var(--ws-surface-3); }
.ws-mini__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.375rem; }
.ws-mini__grid > span { height: 1.75rem; border-radius: 0.25rem; background: var(--ws-surface-3); }
.ws-mini__hot { display: flex; align-items: center; justify-content: space-between; gap: var(--ws-space-2); min-height: 1.75rem; padding: 0.25rem 0.5rem; border-radius: 0.25rem; background: var(--ws-green); color: var(--ws-on-green); font-size: 0.6875rem; font-weight: var(--ws-weight-semibold); box-shadow: inset 0 0 0 1px var(--ws-accent-border); }

/* Painel lateral (desktop) e folha inferior (celular), sobre <dialog> */
.ws-sheet {
  position: fixed; inset: 0 0 0 auto; margin: 0; width: min(26rem, 100vw); max-width: 100vw; height: 100dvh; max-height: 100dvh;
  padding: 0; border: 0; border-left: 1px solid var(--ws-border);
  background: var(--ws-surface-solid); color: var(--ws-text); box-shadow: var(--ws-shadow-lg);
}
.ws-sheet[open] { display: flex; flex-direction: column; animation: ws-ds-slide-in var(--ws-dur-slow) var(--ws-ease); }
.ws-sheet::backdrop { background: var(--ws-overlay); }
.ws-sheet__head { display: flex; align-items: center; gap: var(--ws-space-2); padding: var(--ws-space-4) var(--ws-space-5); border-bottom: 1px solid var(--ws-border); }
.ws-sheet__title { margin: 0; flex: 1; font-family: var(--ws-font-sans); font-size: var(--ws-text-lg); font-weight: var(--ws-weight-semibold); letter-spacing: 0; }
.ws-sheet__body { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: var(--ws-space-4); padding: var(--ws-space-5); padding-bottom: calc(var(--ws-space-5) + env(safe-area-inset-bottom, 0px)); }
.ws-sheet__grip { display: none; }

/* Marca dentro da sidebar e ferramentas do rodapé */
.ws-sidebar__brand .adm-brand { display: flex; align-items: center; gap: var(--ws-space-3); min-width: 0; flex: 1; color: var(--ws-text); text-decoration: none; }
.ws-sidebar__brand .adm-brand img { height: 2rem; width: auto; flex: none; }
.ws-sidebar__tools { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.ws-sidebar__foot { flex-wrap: wrap; }
.ws-sidebar__foot .ws-sidebar__name { flex: 1; min-width: 0; }
.ws-sidebar__foot .ws-sidebar__name strong { font-family: var(--ws-font-sans); font-size: var(--ws-text-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-shell[data-collapsed="true"] .ws-sidebar__collapse .ws-icon { transform: rotate(180deg); }
.ws-shell[data-collapsed="true"] .ws-sidebar__brand { flex-direction: column; padding-inline: 0; }
.ws-shell[data-collapsed="true"] .ws-sidebar__tools { margin: 0 auto; flex-direction: column; }
.ws-shell[data-collapsed="true"] .ws-sidebar__tools > :not(:first-child) { display: none; }
.ws-shell[data-collapsed="true"] .ws-sidebar__foot { justify-content: center; }
.ws-nav__group--current > summary { color: var(--ws-text); }

/* Busca de telas com lista de resultados */
.ws-search--menu { position: relative; }
.ws-search__list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: var(--ws-z-popover);
  margin: 0; padding: var(--ws-space-1); list-style: none;
  background: var(--ws-surface-solid); border: 1px solid var(--ws-border-strong); border-radius: var(--ws-radius-sm); box-shadow: var(--ws-shadow-lg);
}
.ws-search__list li { display: flex; justify-content: space-between; gap: var(--ws-space-3); padding: var(--ws-space-2) var(--ws-space-3); border-radius: var(--ws-radius-xs); font-size: var(--ws-text-sm); color: var(--ws-text); cursor: pointer; }
.ws-search__list li[aria-selected="true"] { background: var(--ws-surface-2); box-shadow: inset 2px 0 0 var(--ws-green); }
.ws-search__group { color: var(--ws-text-3); font-size: var(--ws-text-xs); }
.ws-search__list .ws-search__empty { color: var(--ws-text-3); cursor: default; }

.ws-shell__scrim { display: none; }

/* ---------- Navegação inferior (painel no celular) ---------- */
.ws-bottom-nav { display: none; }

/* ---------- Responsivo ---------- */
@media (max-width: 960px) {
  .ws-shell, .ws-shell[data-collapsed="true"] { grid-template-columns: minmax(0, 1fr); }
  .ws-sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(18rem, 86vw); height: 100dvh;
    transform: translateX(-100%); transition: transform var(--ws-dur-slow) var(--ws-ease);
    padding-left: max(var(--ws-space-3), env(safe-area-inset-left, 0px));
  }
  .ws-shell[data-nav-open="true"] .ws-sidebar { transform: none; box-shadow: var(--ws-shadow-lg); }
  .ws-shell__scrim { position: fixed; inset: 0; background: var(--ws-overlay); z-index: calc(var(--ws-z-sidebar) - 1); }
  .ws-shell[data-nav-open="true"] .ws-shell__scrim { display: block; }
  .ws-sidebar__collapse { display: none; }
  .ws-shell[data-collapsed="true"] .ws-nav__text, .ws-shell[data-collapsed="true"] .ws-nav__label, .ws-shell[data-collapsed="true"] .ws-sidebar__name, .ws-shell[data-collapsed="true"] .ws-nav__chevron { display: revert; }
  .ws-topbar__menu { display: inline-flex; }
  .ws-search { order: 10; width: 100%; }
  .ws-bottom-nav {
    position: sticky; bottom: 0; z-index: var(--ws-z-tabbar);
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    min-height: var(--ws-tabbar-h); padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--ws-surface-solid); border-top: 1px solid var(--ws-border);
  }
  .ws-bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 0.6875rem; color: var(--ws-text-3); text-decoration: none; }
  .ws-bottom-nav a[aria-current="page"] { color: var(--ws-text); font-weight: var(--ws-weight-semibold); box-shadow: inset 0 2px 0 var(--ws-green); }
}
@media (max-width: 640px) {
  /* Tabela vira lista de cards: cada <td> precisa de data-label */
  .ws-table--stack thead { display: none; }
  .ws-table--stack, .ws-table--stack tbody, .ws-table--stack tr, .ws-table--stack td { display: block; width: 100%; }
  .ws-table--stack tr { padding: var(--ws-space-3) var(--ws-space-4); border-bottom: 1px solid var(--ws-border); }
  .ws-table--stack td { display: flex; justify-content: space-between; gap: var(--ws-space-3); padding: 0.25rem 0; border: 0; white-space: normal; }
  .ws-table--stack td::before { content: attr(data-label); color: var(--ws-text-3); font-size: var(--ws-text-xs); }
  .ws-table--stack td:first-child { font-weight: var(--ws-weight-semibold); }
  .ws-table--stack td:first-child::before { content: none; }
  /* Painel lateral vira folha inferior */
  .ws-sheet { inset: auto 0 0 0; width: 100vw; height: auto; max-height: 88dvh; border-left: 0; border-top: 1px solid var(--ws-border); border-radius: var(--ws-radius-lg) var(--ws-radius-lg) 0 0; }
  .ws-sheet[open] { animation-name: ws-ds-slide-up; }
  .ws-sheet__grip { display: block; width: 2.5rem; height: 0.25rem; margin: var(--ws-space-2) auto 0; border-radius: 999px; background: var(--ws-border-strong); }
  .ws-popover { width: calc(100vw - 1rem); }
}

@keyframes ws-ds-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ws-ds-pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes ws-ds-slide-in { from { transform: translateX(1.5rem); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes ws-ds-slide-up { from { transform: translateY(1.5rem); opacity: 0; } to { transform: none; opacity: 1; } }
