/* ============================================================================
   Tecnosys UI-Kit — folha de TOKENS + peças canônicas dos apps STANDALONE.
   Porte fiel do design system "Aurora" do Hub (hub.css): canvas de crepúsculo
   quente, formas generosamente arredondadas (raio MACIO), profundidade em
   camadas suaves. Distinto do datasheet do Fluxion.

   Hook de ACCENT por-app: cada app injeta a sua cor via `--accent` / `--accent-2`
   (ex.: agenda vermelho, elo lima, forms ciano) — em :root, num container, ou
   inline no wrapper do select. Todos os componentes leem `--accent`; o default
   é o índigo do Hub. Ex.:  :root { --accent:#DC2626; --accent-2:#F87171; }

   Sem @import: as famílias caem em system-ui se o app não carregar Hanken/Bricolage —
   para carregá-las sem CDN, sirva também a folha OPT-IN de fontes (UiKitAssets.FontsCss
   + os .woff2 de UiKitAssets.Font, sob `ui-kit-fonts/` relativo à folha · 0.1.2). Suporta tema por [data-theme] (o app alterna).
   ============================================================================ */

:root {
  /* --- superfícies / tinta (claro) --- */
  --canvas: #F1F1FA;
  --canvas-2: #E9E9F5;
  --surface: #FFFFFF;
  --surface-2: #FAFAFE;
  --ink: #16152A;
  --ink-soft: #56546F;
  /* Verde-AA (= hub.css:17 · PO 2026-08-26): 4.97:1 sobre surface — o antigo #8B89A6 reprovava como texto. */
  --ink-faint: #6F6D89;
  --line: rgba(22, 21, 42, 0.08);
  --line-2: rgba(22, 21, 42, 0.13);

  /* --- accent por-app (default = índigo do Hub) --- */
  --accent: #5B5BF5;
  --accent-2: #8B5CF6;
  --accent-soft: rgba(91, 91, 245, 0.10);

  /* aliases internos: os componentes usam --hue* (nome do Hub); mapeiam do accent.
     Assim o markup portado do Hub funciona sem reescrever seletores. */
  --hue: var(--accent);
  --hue2: var(--accent-2);
  --hue-soft: var(--accent-soft);

  /* --- estados semânticos --- */
  --ok: #0FA968;
  --warn: #E6920B;
  --danger: #EF4560;
  /* tintas de TEXTO AA (= hub.css): o token gráfico (--ok/--warn/--danger) segue vívido para ícone/borda. */
  --danger-ink: #B4132F;
  --warn-text: #8A5600;
  --ok-text: #0A7048;
  /* âmbar gráfico do badge "pede ação" (= hub.css:31) — theme-invariant. */
  --warn-2: #EF9D10;
  /* fundo de botão DESTRUTIVO com texto branco AA nos 2 temas (= --danger-ink claro; NÃO muda no dark — branco 6,83:1). */
  --danger-solid: #B4132F;

  /* --- cores por TIPO de arquivo (= hub.css:59) — theme-invariant --- */
  --ft-doc: #2563EB; --ft-xls: #16A34A; --ft-ppt: #EA7317; --ft-pdf: #EF4444; --ft-gen: #64748B;

  /* --- overlay / alvo de toque / camadas (= hub.css:132, :137, :159-166) --- */
  --scrim-modal: rgba(11,11,19,.46);
  --tap: 44px;
  --z-toast: 100;     /* toasts do shell */
  --z-modal: 200;     /* scrims de modal */
  --z-popover: 1200;  /* AuroraSelect e popovers acima de tudo, inclusive dentro de modal/drawer */

  /* --- sombras (macias, em camadas) --- */
  --shadow-sm: 0 1px 2px rgba(22,21,42,.06), 0 2px 6px rgba(22,21,42,.05);
  --shadow-md: 0 4px 12px rgba(22,21,42,.07), 0 12px 30px rgba(22,21,42,.08);
  --shadow-lg: 0 8px 24px rgba(22,21,42,.10), 0 24px 60px rgba(22,21,42,.12);

  /* --- raio (MACIO) --- */
  --r-lg: 22px;
  --r-md: 15px;
  --r-sm: 10px;
  --r-pill: 999px;

  /* --- espaçamento (escala 4pt) --- */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --sp-8: 64px;

  /* --- tipografia --- */
  --font-ui: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Bricolage Grotesque", var(--font-ui);
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

[data-theme="dark"] {
  --canvas: #0E0E19;
  --canvas-2: #0A0A13;
  --surface: #191827;
  --surface-2: #201F31;
  --ink: #F3F2FB;
  --ink-soft: #ABA9C6;
  /* Verde-AA (= hub.css:208): ≥4.5:1 sobre surface/surface-2 no dark. */
  --ink-faint: #8987A6;
  --danger-ink: #FF7A90;
  --warn-text: #F3B44E;
  --ok-text: #34D399;
  --line: rgba(255,255,255,0.08);
  --line-2: rgba(255,255,255,0.14);
  --accent-soft: rgba(139, 92, 246, 0.16);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 6px 20px rgba(0,0,0,.45);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.55);
}

/* ---------------------------------------------------------------------------
   Ícone base (HubIcon.Svg) — herda cor de currentColor e tamanho de font-size.
   --------------------------------------------------------------------------- */
.hub-ico {
  display: inline-block;
  vertical-align: -0.14em;
  flex: none;
}

/* ---------------------------------------------------------------------------
   Select canônico (UiSelect) — <select> nativo estilizado (piso zero-JS) +
   realce opcional em painel listbox (tecnosys-ui-kit.js). Equivalente ao
   AuroraSelect do Hub, com o accent do app.
   --------------------------------------------------------------------------- */
.ui-select {
  position: relative;
  display: inline-block;
  font-family: var(--font-ui);
}
.ui-select.ui-select--field { display: block; width: 100%; }

/* o <select> nativo: appearance:none + espaço à direita p/ o chevron */
.ui-select-native {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  cursor: pointer;
  width: 100%;
  min-height: 40px;
  padding: 8px 38px 8px 12px;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.3;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  transition: border-color .14s, background .14s, color .14s, box-shadow .14s;
}
.ui-select-native:hover { border-color: var(--ink-faint); }
.ui-select-native:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 1.5px var(--accent);
}
.ui-select-native:disabled { opacity: .5; cursor: not-allowed; }
.ui-select-native[multiple] { padding-right: 12px; min-height: 120px; }
/* placeholder desenhado como opção oculta selecionada → some ao escolher */
.ui-select-native:invalid { color: var(--ink-faint); font-weight: 500; }

/* chevron sobreposto */
.ui-select-chev {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-faint);
  font-size: 15px;
  pointer-events: none;
  display: inline-flex;
  transition: transform .2s cubic-bezier(.2,.8,.3,1);
}
.ui-select.is-open .ui-select-chev { transform: translateY(-50%) rotate(180deg); }
.ui-select-native[multiple] ~ .ui-select-chev { display: none; }

/* variante CHIP (pílula de filtro) */
.ui-select--chip { display: inline-block; }
.ui-select--chip .ui-select-native {
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 13px;
  min-height: 36px;
  padding: 7px 34px 7px 14px;
}
.ui-select--chip .ui-select-chev { font-size: 13px; }

/* ---- REALCE (listbox), aplicado por tecnosys-ui-kit.js ao [data-enhance] ---- */
/* quando realçado, o <select> nativo fica visualmente escondido mas acessível
   (fallback de teclado/leitor); o botão-gatilho + painel assumem o visual. */
.ui-select.ui-enhanced .ui-select-native {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
.ui-select.ui-enhanced .ui-select-chev { z-index: 1; }

.ui-sel-trigger {
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  padding: 8px 38px 8px 12px;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  text-align: left;
  transition: border-color .14s, background .14s, color .14s, box-shadow .14s;
}
.ui-select--chip .ui-sel-trigger {
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 13px;
  min-height: 36px;
}
.ui-sel-trigger:hover { border-color: var(--ink-faint); }
.ui-sel-trigger:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 1.5px var(--accent);
}
.ui-sel-trigger .ui-sel-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-sel-trigger .ui-sel-label.placeholder { color: var(--ink-faint); font-weight: 500; }
.ui-select--chip .ui-sel-trigger.has-value { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

.ui-sel-panel {
  position: absolute;
  z-index: 60;
  top: calc(100% + 6px);
  left: 0;
  width: max-content;
  min-width: 220px;
  max-width: min(340px, calc(100vw - 20px));
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: none;
  flex-direction: column;
  max-height: 60vh;
}
.ui-select.is-open .ui-sel-panel { display: flex; }
.ui-select.flip-up .ui-sel-panel { top: auto; bottom: calc(100% + 6px); }

.ui-sel-search { position: relative; padding: 10px 10px 8px; border-bottom: 1px solid var(--line); flex: none; }
.ui-sel-search input {
  width: 100%; font: inherit; font-size: 13.5px; padding: 8px 12px 8px 32px;
  border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink);
}
.ui-sel-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ui-sel-search .mag { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); color: var(--ink-faint); font-size: 13px; pointer-events: none; display: inline-flex; }

.ui-sel-list { padding: 6px; overflow-y: auto; overscroll-behavior: contain; flex: 1 1 auto; }
.ui-sel-list::-webkit-scrollbar { width: 9px; }
.ui-sel-list::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 999px; border: 2px solid var(--surface); }

.ui-sel-group { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); padding: 8px 10px 4px; }

.ui-sel-opt {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r-sm);
  cursor: pointer; font-size: 13.5px; color: var(--ink); min-height: 44px; scroll-margin: 8px;
}
.ui-sel-opt:hover { background: var(--surface-2); }
.ui-sel-opt.active { background: var(--accent-soft); }
.ui-sel-opt[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.ui-sel-opt .lab { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-sel-opt .mark {
  width: 20px; height: 20px; flex: none; display: grid; place-items: center;
  border-radius: 6px; border: 1.5px solid var(--line-2); color: #fff; font-size: 11px; transition: all .12s;
}
.ui-select[data-ui-select="single"] .ui-sel-opt .mark { border-radius: 50%; color: transparent; }
.ui-sel-opt[aria-selected="true"] .mark { background: var(--accent); border-color: var(--accent); }
/* single: a marca é só o ponto (::after 8px) centrado no círculo — sem glifo concorrendo na grade (igual hub.css AuroraSelect) */
.ui-select[data-ui-select="single"] .ui-sel-opt[aria-selected="true"] .mark { color: transparent; font-size: 0; align-content: center; }
.ui-select[data-ui-select="single"] .ui-sel-opt[aria-selected="true"] .mark::after {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff;
}

.ui-sel-empty { padding: 22px 16px; text-align: center; color: var(--ink-faint); font-size: 13px; }
