/*
 * app.css — Aggregator
 * Edit source files in modules/, not this file.
 * Order matters: tokens first, then base, then components.
 */

/* ===== modules/tokens.css ===== */
/* ═══════════════════════════════════════════════════════════════
   DESIGN TOKENS — Guild Executive (premium, exclusivo)
   ═══════════════════════════════════════════════════════════════ */
:root {
  /* Surfaces — clean admin (Mosaic-inspired), brand Guild */
  --bg: #f1f5f9;
  --bg-grad: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  --surf: #ffffff;
  --surf2: #f8fafc;
  --surf3: #f1f5f9;

  /* Lines */
  --line: #e2e8f0;
  --line2: #cbd5e1;
  --line-strong: #94a3b8;

  /* Text */
  --tx: #0f172a;
  --muted: #64748b;
  --faint: #94a3b8;

  /* Brand */
  --primary: #006400;
  --primary-h: #004d00;
  --primary-2: #1a7a1a;
  --primary-50: #f0faf0;
  --primary-100: #dcf2dc;
  --primary-300: #86d686;
  --primary-400: #4ade4a;
  --primary-500: #22a822;
  --primary-700: #005200;
  --primary-800: #004000;
  --primary-900: #003300;
  --primary-lt: #f0faf0;
  --primary-rgb: 0, 100, 0;
  --primary-grad: linear-gradient(135deg, #007a00 0%, #006400 100%);
  --accent: #6366f1;
  --accent-soft: rgba(99,102,241,.10);

  /* Status */
  --ok: #059669;     --okbg: #ecfdf5;
  --warn: #d97706;   --warnbg: #fffbeb;
  --err: #dc2626;    --errbg: #fef2f2;
  --blue: #2563eb;   --bluebg: #eff6ff;

  /* Semantic aliases (coss-inspired, compatível com stack atual) */
  --success: var(--ok);           --success-bg: var(--okbg);           --success-foreground: #047857;
  --warning: var(--warn);         --warning-bg: var(--warnbg);         --warning-foreground: #b45309;
  --danger: var(--err);           --danger-bg: var(--errbg);           --danger-foreground: #b91c1c;
  --destructive: var(--err);      --destructive-bg: var(--errbg);      --destructive-foreground: #b91c1c;
  --info: var(--blue);            --info-bg: var(--bluebg);            --info-foreground: #1d4ed8;
  --ring: rgba(var(--primary-rgb), .22);
  --input: var(--line2);
  --muted-fg: var(--muted);

  /* Shape */
  --radius: 12px;
  --radius-md: 10px;
  --radius-sm: 8px;
  --radius-xs: 6px;

  /* Elevation */
  --shadow-xs: 0 1px 2px rgba(15,23,42,.04);
  --shadow-sm: 0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --shadow-md: 0 4px 12px rgba(15,23,42,.08), 0 2px 4px rgba(15,23,42,.04);
  --shadow-lg: 0 12px 32px rgba(15,23,42,.12), 0 4px 8px rgba(15,23,42,.04);
  --shadow-nav: 0 1px 0 rgba(15,23,42,.04);

  /* Motion */
  --ease: cubic-bezier(.2,.8,.2,1);
  --transition: 160ms var(--ease);

  /* Layout */
  --nav-h: 64px;
  --focus-ring: 0 0 0 3px rgba(0,100,0,.16);
}

html.dark {
  --bg: #0f172a;
  --bg-grad: linear-gradient(180deg, #111827 0%, #0f172a 100%);
  --surf: #1e293b;
  --surf2: #243247;
  --surf3: #334155;

  --line: #334155;
  --line2: #475569;
  --line-strong: #64748b;

  --tx: #f8fafc;
  --muted: #94a3b8;
  --faint: #64748b;

  --primary: #10b981;
  --primary-h: #34d399;
  --primary-2: #10b981;
  --primary-50: rgba(16,185,129,.10);
  --primary-100: rgba(16,185,129,.16);
  --primary-300: #34d399;
  --primary-400: #10b981;
  --primary-500: #059669;
  --primary-700: #047857;
  --primary-800: #065f46;
  --primary-900: #064e3b;
  --primary-lt: rgba(16,185,129,.14);
  --primary-rgb: 16,185,129;
  --primary-grad: linear-gradient(135deg, #047857 0%, #059669 100%);
  --accent: #818cf8;
  --accent-soft: rgba(129,140,248,.14);

  --ok: #34d399;     --okbg: rgba(16,185,129,.14);
  --warn: #fbbf24;   --warnbg: rgba(245,158,11,.14);
  --err: #f87171;    --errbg: rgba(239,68,68,.14);
  --blue: #60a5fa;   --bluebg: rgba(59,130,246,.14);

  --success: var(--ok);           --success-bg: var(--okbg);           --success-foreground: #6ee7b7;
  --warning: var(--warn);         --warning-bg: var(--warnbg);         --warning-foreground: #fcd34d;
  --danger: var(--err);           --danger-bg: var(--errbg);           --danger-foreground: #fca5a5;
  --destructive: var(--err);      --destructive-bg: var(--errbg);      --destructive-foreground: #fca5a5;
  --info: var(--blue);            --info-bg: var(--bluebg);            --info-foreground: #93c5fd;
  --ring: rgba(var(--primary-rgb), .30);
  --input: var(--line2);
  --muted-fg: var(--muted);

  --shadow-xs: 0 1px 2px rgba(0,0,0,.30);
  --shadow-sm: 0 4px 12px rgba(0,0,0,.24);
  --shadow-md: 0 10px 28px rgba(0,0,0,.30);
  --shadow-lg: 0 20px 48px rgba(0,0,0,.38);
  --shadow-nav: 0 1px 0 rgba(255,255,255,.04);

  --focus-ring: 0 0 0 3px rgba(16,185,129,.22);
}


/* ===== modules/base.css ===== */
/* ═══════════════════════════════════════════════════════════════
   RESET & BASE — Fluent / Segoe UI
   ═══════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { -webkit-font-smoothing: antialiased; scroll-behavior: smooth; }
body {
  font-family: "Inter", "Manrope", "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  background-image: var(--bg-grad);
  color: var(--tx);
  line-height: 1.5;
  font-size: 14px;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
}
a { text-decoration: none; color: inherit; }
a.link { color: var(--primary); font-weight: 600; }
a.link:hover { color: var(--primary-h); text-decoration: underline; }
button { cursor: pointer; font: inherit; }
input, select, textarea { font: inherit; }
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: 4px;
}
button:focus:not(:focus-visible),
a:focus:not(:focus-visible) { outline: none; box-shadow: none; }

::selection { background: rgba(var(--primary-rgb), 0.16); color: var(--tx); }

/* ═══════════════════════════════════════════════════════════════
   SKIP LINK
   ═══════════════════════════════════════════════════════════════ */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 10000;
  padding: 8px 14px;
  background: var(--surf);
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  font-weight: 600;
  box-shadow: var(--shadow-md);
}
.skip-link:focus { left: 8px; }

/* ═══════════════════════════════════════════════════════════════
   LAYOUT — faixa de conteúdo estilo OneDrive
   ═══════════════════════════════════════════════════════════════ */
.app-main { flex: 1; width: 100%; min-width: 0; overflow-x: clip; }
.app-footer { margin-top: auto; }
.container-fluid { max-width: none !important; }
.container {
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
  padding: 24px 24px 40px;
  animation: pageFade 0.16s var(--ease);
}
@keyframes pageFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
@media (max-width: 768px) {
  .container { padding: 16px 14px calc(24px + env(safe-area-inset-bottom, 0px)); }
}


/* ===== modules/nav.css ===== */
/* ═══════════════════════════════════════════════════════════════
   APP SHELL — Microsoft 365 (topbar) + OneDrive (sidebar) + Win11
   ═══════════════════════════════════════════════════════════════ */
:root { --sidebar-w: 308px; --topbar-h: 64px; }

.app-shell { display: flex; flex-direction: column; min-height: 100vh; }
.app-body { display: flex; flex: 1; min-height: 0; align-items: stretch; }
.app-column { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }

/* ══════════ TOPBAR M365 — faixa fina 48px ══════════ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 300;
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px 0 10px;
  background: color-mix(in srgb, var(--surf) 92%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-nav);
}
html.dark .topbar { background: rgba(27,34,32,.88); }
html.dark .topbar { background: rgba(27,34,32,.88); }

/* Waffle launcher */
.waffle-btn {
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: 10px; background: transparent;
  color: var(--muted); font-size: 17px;
  transition: all var(--transition);
}
.waffle-btn:hover { background: var(--surf3); color: var(--tx); border-color: var(--line); }

.topbar-brand {
  display: flex; align-items: center; gap: 9px;
  padding: 4px 10px 4px 4px;
  border-radius: 4px;
  font-weight: 600; line-height: 1.2;
  white-space: nowrap;
}
.topbar-brand:hover { background: var(--surf3); }
.brand-logo-wrap {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  background: var(--primary-grad);
  border-radius: 9px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(var(--primary-rgb), .28);
}
.brand-logo { width: 18px; height: 18px; display: block; }
.brand-text { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.brand-title { font-size: 14px; font-weight: 600; color: var(--tx); white-space: nowrap; }
.brand-sub {
  font-size: 12px; font-weight: 400; color: var(--muted); white-space: nowrap;
  border-left: 1px solid var(--line2); padding-left: 7px;
}
.topbar-divider-v { width: 1px; height: 24px; background: var(--line2); margin: 0 6px; flex-shrink: 0; }

/* Busca central estilo M365 */
.topbar-search {
  flex: 1; display: flex; justify-content: center;
  min-width: 0; padding: 0 8px;
}
.mobile-search-toggle { display: none !important; }
.mobile-search-close { display: none !important; position: absolute; right: 2px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border: none; background: transparent; color: var(--muted); }
.topbar-search-box {
  position: relative;
  width: min(420px, 100%);
}
.topbar-search-box > i {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 14px; pointer-events: none;
}
.topbar-search-box input {
  width: 100%; height: 36px;
  padding: 0 12px 0 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surf2);
  color: var(--tx); font-size: 13px;
  transition: all var(--transition);
}
.topbar-search-box input:hover { border-color: var(--line-strong); background: var(--surf); }
.topbar-search-box input:focus {
  outline: none; background: var(--surf);
  border-color: rgba(var(--primary-rgb), .45);
  box-shadow: var(--focus-ring);
}
.topbar-search-box input::placeholder { color: var(--muted); }

/* Resultados da busca global — dropdown Fluent */
.topbar-search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  min-width: 320px;
  background: var(--surf);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 600;
  max-height: 400px;
  overflow-y: auto;
  padding: 6px;
  text-align: left;
}
.topbar-search-results[hidden] { display: none; }
.gsr-group {
  padding: 8px 10px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.gsr-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--tx);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}
.gsr-item:hover, .gsr-item.active { background: var(--surf3); }
.gsr-item .gsr-ic { color: var(--muted); font-size: 15px; flex-shrink: 0; }
.gsr-item.active .gsr-ic { color: var(--primary); }
.gsr-item .gsr-id { font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.gsr-item .gsr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.gsr-item .gsr-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.gsr-item .gsr-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--muted); font-weight: 400; }
.gsr-empty { padding: 16px 12px; font-size: 13px; color: var(--muted); text-align: center; }
.gsr-loading { padding: 16px 12px; font-size: 13px; color: var(--muted); text-align: center; }
.gsr-foot { display: flex; border-top: 1px solid var(--line); margin-top: 4px; }
.gsr-foot a { flex: 1; padding: 9px 8px; font-size: 12.5px; text-align: center; color: var(--primary); font-weight: 600; border-radius: 0 0 8px 8px; }
.gsr-foot a:hover { background: var(--surf3); }

.topbar-left { display: flex; align-items: center; gap: 2px; min-width: 0; flex-shrink: 0; }

.topbar-right { display: flex; align-items: center; gap: 4px; flex-shrink: 0; margin-left: auto; }
.bell-wrap { display: inline-flex; align-items: center; justify-content: center; }

/* Ícones da topbar — quadrados Fluent 40px */
.icon-btn {
  position: relative;
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  transition: all var(--transition);
}
.icon-btn:hover { background: var(--surf3); color: var(--tx); border-color: var(--line); }
.icon-btn:active { background: var(--line2); }
.nav-toggle { display: none; }
.bell-btn.has-notif { color: var(--primary); background: var(--primary-50); }
.bell-btn.has-notif .bi { animation: none; }
.bell-badge {
  position: absolute; top: 1px; right: 1px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px;
  background: #c50f1f; color: #fff;
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
  border: none; box-shadow: none;
  pointer-events: none;
}
.bell-badge.bell-order,
.bell-badge.bell-newrequest,
.bell-badge.bell-ticket,
.bell-badge.bell-chat { background: #c50f1f; box-shadow: none; }

.topbar-divider { width: 1px; height: 24px; background: var(--line2); margin: 0 6px; }

/* Launcher (waffle) — painel estilo office.com */
.launcher-wrap { position: relative; }
.launcher-panel {
  display: none;
  position: absolute; top: calc(100% + 6px); left: 0;
  width: 320px; max-width: calc(100vw - 24px);
  max-height: min(480px, calc(100vh - 70px)); overflow-y: auto;
  background: var(--surf);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  padding: 12px;
  z-index: 500;
}
.launcher-panel.open { display: block; animation: fluentIn 0.12s var(--ease); }
@keyframes fluentIn { from { opacity: 0; } to { opacity: 1; } }
.launcher-title { font-size: 13px; font-weight: 600; color: var(--tx); padding: 2px 6px 10px; }
.launcher-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
.launcher-app {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 12px 6px 10px; border-radius: 4px;
  color: var(--tx); font-size: 12px; font-weight: 400; text-align: center;
  transition: background var(--transition);
}
.launcher-app:hover { background: var(--surf3); }
.launcher-app .launcher-ic {
  width: 40px; height: 40px; border-radius: 4px;
  display: grid; place-items: center;
  color: #fff; font-size: 19px;
}
.launcher-ic.li-blue { background: #0f6cbd; }
.launcher-ic.li-teal { background: #038387; }
.launcher-ic.li-green { background: #107c10; }
.launcher-ic.li-purple { background: #8764b8; }
.launcher-ic.li-orange { background: #ca5010; }
.launcher-ic.li-dark { background: #323130; }

/* Persona / user chip — círculo estilo M365 */
.user-menu { position: relative; }
.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer; font: inherit; color: inherit;
  transition: background var(--transition);
  max-width: 220px;
}
.user-chip:hover { background: var(--surf3); border-color: transparent; box-shadow: none; transform: none; }
.user-chip.on { background: var(--surf3); border-color: transparent; box-shadow: none; }
.user-menu.open .user-chip { background: var(--surf3); border-color: transparent; box-shadow: none; }
.user-menu.open .user-chip-chevron { transform: rotate(180deg); }
.user-chip-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.user-chip-fallback {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--primary);
  color: #fff; font-weight: 600; font-size: 13px;
}
.user-chip-text { display: none; }
.user-chip-chevron { display: none; }

.user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 260px;
  background: var(--surf);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  padding: 4px;
  z-index: 400;
}
@keyframes userDropIn { from { opacity: 0; } to { opacity: 1; } }
.user-dropdown.open { display: block; animation: userDropIn 0.12s var(--ease); }
.user-dropdown-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}
.user-dropdown-face {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--primary); color: #fff; font-weight: 600; font-size: 15px;
  overflow: hidden;
}
.user-dropdown-face img { width: 100%; height: 100%; object-fit: cover; }
.user-dropdown-id { display: flex; flex-direction: column; min-width: 0; }
.user-dropdown-name {
  font-size: 13px; font-weight: 600; color: var(--tx);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-dropdown-email {
  font-size: 12px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 4px;
  color: var(--tx); font-size: 13px; font-weight: 400;
  transition: background var(--transition);
}
.user-dropdown-item i { font-size: 15px; color: var(--muted); transition: none; }
.user-dropdown-item:hover { background: var(--surf3); color: var(--tx); }
.user-dropdown-item:hover i { color: var(--tx); }
.user-dropdown-item.danger { color: var(--tx); }
.user-dropdown-item.danger i { color: var(--muted); }
.user-dropdown-item.danger:hover { background: var(--surf3); color: var(--tx); }
.user-dropdown-item.danger:hover i { color: var(--tx); }

/* ══════════ SIDEBAR — verde ══════════ */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  height: calc(100dvh - var(--topbar-h));
  display: flex;
  flex-direction: column;
  background: #006400;
  color: #f1f5f3;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid rgba(255,255,255,.06);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.22) transparent;
}
html.dark .sidebar { background: #006400; border-right-color: rgba(255,255,255,.08); }
.sidebar::before, .sidebar::after { content: none; display: none; }
.sidebar > * { position: relative; z-index: 1; }

/* Botão + Novo (OneDrive "Adicionar novo") */
.side-new-wrap { position: relative; z-index: 5; padding: 18px 14px 10px; }
.side-new-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  padding: 0 16px; height: 42px;
  border-radius: 12px;
  background: #ffffff;
  color: #006400;
  font-size: 13.5px; font-weight: 700;
  border: 1px solid #ffffff;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
  transition: all var(--transition);
}
.side-new-btn:hover { background: #f4fbf4; transform: translateY(-1px); }
.side-new-btn:active { background: #eaf5ea; transform: translateY(0); }
.side-new-btn i { font-size: 14px; color: #006400; }
.side-new-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 12px;
  right: 12px;
  z-index: 350;
  background: var(--surf);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
}
.side-new-menu.open { display: block; animation: fluentIn 0.12s var(--ease); }
.side-new-menu a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 4px;
  font-size: 13px; color: var(--tx);
}
.side-new-menu a i { color: var(--primary); font-size: 15px; }
.side-new-menu a:hover { background: var(--surf3); }

/* Nav */
.side-nav { flex: 1; padding: 8px 12px 16px; display: flex; flex-direction: column; gap: 2px; }
.side-group { display: flex; flex-direction: column; gap: 2px; }
.side-group + .side-group { margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.side-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(241,245,243,.46);
  padding: 2px 12px 8px;
}
.side-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  color: rgba(241,245,243,.78);
  font-size: 13.5px;
  font-weight: 500;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.side-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.side-link:focus-visible { box-shadow: 0 0 0 2px rgba(255,255,255,.28); outline: none; }
.side-link.on {
  background: rgba(255,255,255,.11);
  color: #fff;
  font-weight: 600;
  border-color: rgba(255,255,255,.06);
}
.side-link.on::before {
  content: "";
  position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 3px; border-radius: 2px;
  background: rgba(236,253,245,.72);
}
.side-ic {
  width: 20px; height: 20px;
  display: grid; place-items: center;
  flex-shrink: 0;
  font-size: 16px;
  color: rgba(241,245,243,.62);
  transition: color var(--transition);
}
.side-link:hover .side-ic { color: #fff; }
.side-link.on .side-ic { color: #d1fae5; }
html.dark .side-link.on { background: rgba(255,255,255,.11); color: #fff; border-color: rgba(255,255,255,.08); }
html.dark .side-link.on::before { background: rgba(236,253,245,.72); }
.side-chevron { margin-left: auto; font-size: 11px !important; opacity: .65; transition: transform var(--transition); color: rgba(241,245,243,.55); }
.side-dropdown.open .side-chevron { transform: rotate(180deg); }

/* Submenu */
.side-dropdown { display: flex; flex-direction: column; }
.side-submenu {
  display: none;
  flex-direction: column;
  gap: 1px;
  padding: 2px 0;
  margin: 2px 0 2px 24px;
  border-left: 1px solid rgba(255,255,255,.16);
  padding-left: 8px;
}
.side-submenu.open { display: flex; }
.side-submenu a {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  color: rgba(241,245,243,.78);
  font-size: 13px; font-weight: 500;
  transition: all var(--transition);
}
.side-submenu a i { font-size: 14px; color: rgba(241,245,243,.58); }
.side-submenu a:hover { background: rgba(255,255,255,.08); color: #fff; }
.side-submenu a.on { background: rgba(255,255,255,.12); color: #fff; font-weight: 650; }
.side-submenu a:focus-visible { box-shadow: 0 0 0 2px rgba(255,255,255,.35); outline: none; }
.side-submenu .util-parent-trigger {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 7px 10px; border: none; border-radius: 8px;
  background: none; cursor: pointer; text-align: left;
  color: rgba(241,245,243,.78); font-size: 13px; font-weight: 500; font-family: inherit;
}
.side-submenu .util-parent-trigger:hover,
.side-submenu .util-parent-trigger.open { background: rgba(255,255,255,.08); color: #fff; }
.util-chevron { margin-left: auto; font-size: 11px; color: rgba(241,245,243,.6); transition: transform .12s; }
.util-parent-trigger.open .util-chevron { transform: rotate(180deg); }
.util-children { padding: 2px 0 2px 14px; display: flex; flex-direction: column; gap: 1px; }
.util-children a.sub-link { font-size: 13px; padding: 7px 10px; }

/* Badge do chat no menu lateral */
.side-link .bell-badge.bell-chat {
  position: static;
  margin-left: auto;
  border: none;
  background: rgba(110,231,183,.18);
  color: #a7f3d0;
  box-shadow: none;
  font-size: 11px;
  min-width: 20px; height: 20px; line-height: 20px;
}
html.dark .side-link .bell-badge.bell-chat { background: rgba(110,231,183,.18); color: #a7f3d0; }

/* Sidebar footer */
.sidebar-footer { padding: 12px 16px 16px; border-top: 1px solid rgba(255,255,255,.10); }
.sidebar-version { text-align: left; font-size: 11.5px; color: rgba(241,245,243,.52); padding-left: 4px; }

/* Overlay mobile */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 190;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0; transition: opacity .12s;
}

/* ══════════ COMMAND BAR da página (faixa OneDrive) ══════════ */
.page-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 12px;
}
.page-actions-bar .page-actions:only-child { margin-left: auto; }
.page-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 400;
  color: var(--tx);
  padding: 6px 10px;
  border-radius: 4px;
  background: transparent;
  border: 1px solid transparent;
  box-shadow: none;
  transition: background var(--transition);
}
.page-back:hover { color: var(--tx); background: var(--surf3); transform: none; }
.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* ══════════ RESPONSIVO ══════════ */
@media (max-width: 1100px) {
  .topbar-search-box { width: min(320px, 100%); }
}
@media (max-width: 960px) {
  .nav-toggle { display: inline-flex; }
  .brand-sub { display: none; }
  .topbar-search { display: none; }
  .mobile-search-toggle { display: inline-flex !important; }
  .topbar.mobile-search-open .topbar-left,
  .topbar.mobile-search-open .topbar-right > :not(.mobile-search-toggle) { display: none !important; }
  .topbar.mobile-search-open .mobile-search-toggle { display: none !important; }
  .topbar.mobile-search-open .topbar-search { display: flex; flex: 1; padding: 0 4px; }
  .topbar.mobile-search-open .mobile-search-close { display: inline-flex !important; }
  .topbar.mobile-search-open .topbar-search-box { width: 100%; }
  .topbar.mobile-search-open .topbar-search-box input { padding-right: 36px; }
  .launcher-wrap { display: none; }
  .topbar-divider { display: none; }
  .topbar-right { gap: 0; }
  .topbar-right .icon-btn { width: 36px; height: 36px; font-size: 17px; }
  .topbar-right .bell-wrap:has(#notifNewRequestBellBtn),
  .topbar-right .bell-wrap:has(#notifBellBtn) { display: none; }
  #darkModeToggle, #userMenuWrap { display: none !important; }
  .sidebar {
    position: fixed; left: 0; right: 0; top: var(--topbar-h); bottom: 0;
    width: 100%; max-width: 100%;
    transform: translateX(-105%);
    transition: transform 160ms var(--ease);
    box-shadow: none;
    border-right: none;
    height: calc(100dvh - var(--topbar-h));
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open { overflow: hidden; }
  body.nav-open .sidebar-overlay { display: block; opacity: 1; }
}
@media (max-width: 520px) {
  .icon-btn { width: 36px; height: 36px; font-size: 16px; }
  .topbar { padding: 0 8px 0 4px; }
}

/* ── Sidebar mobile-only account/notifications ────────────────── */
.side-mobile-only { display: none; }
@media (max-width: 960px) {
  .side-mobile-only { display: block; padding: 8px 12px 0; }
  .side-mobile-user {
    display: flex; align-items: center; gap: 12px;
    padding: 12px; margin-bottom: 4px;
    border-radius: 12px; background: rgba(255,255,255,.06);
  }
  .side-mobile-avatar {
    width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,.12); color: #ecfdf5; font-weight: 700; overflow: hidden;
  }
  .side-mobile-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .side-mobile-user-tx { display: flex; flex-direction: column; min-width: 0; }
  .side-mobile-user-tx strong { font-size: 14px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .side-mobile-user-tx small { font-size: 12px; color: rgba(241,245,243,.62); }
  .side-mobile-logout { color: rgba(255,200,200,.88) !important; }
  .side-mobile-logout .side-ic { color: rgba(255,200,200,.72) !important; }
  .side-mobile-logout:hover { background: rgba(255,255,255,.08) !important; color: #fff !important; }
}

/* ── Mobile bottom tabbar (PWA / store operation) ─────────────── */
.mobile-tabbar { display: none; }
.mobile-create-sheet { display: none; }
@media (max-width: 900px) {
  body:has(.mobile-tabbar) .app-main { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  body:has(.mobile-tabbar) .sidebar-footer { padding-bottom: 8px; }
  .mobile-tabbar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    align-items: stretch;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 500;
    height: calc(68px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: color-mix(in srgb, var(--surf) 96%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
    box-shadow: 0 -4px 20px rgba(0,0,0,.04);
  }
  .mobile-tab {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-width: 0; padding: 8px 4px;
    color: var(--faint); font-size: 11px; font-weight: 600; text-decoration: none;
    background: transparent; border: 0; cursor: pointer; font-family: inherit;
  }
  .mobile-tab i { font-size: 21px; line-height: 1; }
  .mobile-tab span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .mobile-tab.is-active { color: var(--primary); }
  .mobile-tab:hover { color: var(--tx); }
  .mobile-tab:focus-visible { outline: none; box-shadow: inset 0 0 0 2px rgba(var(--primary-rgb),.25); border-radius: 10px; }
  .mobile-tab-create { color: var(--muted); }
  .mobile-tab-create-ic {
    width: 44px; height: 32px; border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    background: #006400; color: #ecfdf5; font-size: 18px;
    box-shadow: 0 4px 12px rgba(0,100,0,.22);
  }
  .mobile-tab-create-ic i { font-size: 18px; }
  .mobile-tab-create.is-active .mobile-tab-create-ic,
  .mobile-tab-create[aria-expanded="true"] .mobile-tab-create-ic { background: #005200; }

  .mobile-create-sheet { display: block; position: fixed; inset: 0; z-index: 700; visibility: hidden; }
  .mobile-create-sheet[hidden] { display: none; }
  .mobile-create-sheet.is-open { visibility: visible; }
  .mobile-create-backdrop { position: absolute; inset: 0; background: rgba(15,23,42,.35); opacity: 0; transition: opacity .18s ease; }
  .mobile-create-sheet.is-open .mobile-create-backdrop { opacity: 1; }
  .mobile-create-panel {
    position: absolute; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    background: var(--surf); border: 1px solid var(--line); border-radius: 20px;
    padding: 10px 14px 14px; box-shadow: var(--shadow-lg);
    transform: translateY(16px); opacity: 0; transition: transform .18s ease, opacity .18s ease;
  }
  .mobile-create-sheet.is-open .mobile-create-panel { transform: translateY(0); opacity: 1; }
  .mobile-create-handle { width: 40px; height: 4px; border-radius: 999px; background: var(--line2); margin: 4px auto 12px; }
  .mobile-create-title { margin: 0 0 12px; font-size: 14px; font-weight: 700; color: var(--tx); text-align: center; }
  .mobile-create-actions { display: flex; flex-direction: column; gap: 8px; }
  .mobile-create-action {
    display: flex; align-items: center; gap: 12px; padding: 12px;
    border-radius: 14px; border: 1px solid var(--line); background: var(--bg);
    text-decoration: none; color: var(--tx);
  }
  .mobile-create-action:hover { background: var(--surf2); }
  .mobile-create-action-ic {
    width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(0,100,0,.08); color: #006400; font-size: 20px;
  }
  .mobile-create-action-tx { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
  .mobile-create-action-tx strong { font-size: 14px; font-weight: 650; color: var(--tx); }
  .mobile-create-action-tx small { font-size: 12px; color: var(--muted); }
  .mobile-create-cancel {
    width: 100%; margin-top: 10px; padding: 12px; border-radius: 12px;
    border: 1px solid var(--line); background: var(--surf2); color: var(--tx);
    font: inherit; font-weight: 650; cursor: pointer;
  }
}

/* Dropdowns legados (caso algum HTML em cache ainda os use) */
.nav-dropdown { position: relative; }


/* ===== modules/cards-kpi.css ===== */
/* ═══════════════════════════════════════════════════════════════
   CARDS — Fluent (M365 / OneDrive)
   ═══════════════════════════════════════════════════════════════ */
.card {
  background: var(--surf);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition), border-color var(--transition);
}
.card:hover { box-shadow: var(--shadow-sm); border-color: var(--line2); }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--tx);
  letter-spacing: -0.01em;
}
.card-narrow { max-width: 820px; margin: 0 auto; }
.drawer-body .card-narrow { max-width: none; margin: 0; }

/* ═══════════════════════════════════════════════════════════════
   GRID & ROW
   ═══════════════════════════════════════════════════════════════ */
.grid { display: grid; gap: 12px; }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }
.cols-4 { grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); }
.align-start { align-items: start; }

.row { display: flex; gap: 12px; flex-wrap: wrap; }

/* ═══════════════════════════════════════════════════════════════
   KPI CARDS — Fluent: tile de ícone + valor Segoe
   ═══════════════════════════════════════════════════════════════ */
.kpi-card {
  background: var(--surf);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 14px;
  text-decoration: none;
  color: inherit;
  transition: all var(--transition);
  box-shadow: var(--shadow-xs);
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.kpi-card::before { content: none; }
.kpi-card::after { content: none; }
.kpi-card:hover { box-shadow: var(--shadow-md); border-color: rgba(var(--primary-rgb),.18); transform: translateY(-1px); }
.kpi-card.is-active { border-color: rgba(var(--primary-rgb),.35); box-shadow: 0 0 0 1px rgba(var(--primary-rgb),.12), var(--shadow-sm); }
/* Compat: blocos antigos com .kpi-icon/.kpi-body */
.kpi-card .kpi-icon,
.kpi-card > .kpi-label:first-child {
  order: -1;
}
.kpi-card .kpi-icon {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--primary-50); color: var(--primary);
  font-size: 18px;
}
.kpi-card.kpi-tone-blue .kpi-icon { background: var(--bluebg); color: var(--blue); }
.kpi-card.kpi-tone-warn .kpi-icon { background: var(--warnbg); color: var(--warn); }
.kpi-card.kpi-blue .kpi-icon { background: var(--bluebg); color: var(--blue); }
.kpi-card.kpi-warn .kpi-icon { background: var(--warnbg); color: var(--warn); }
.kpi-card.kpi-ok .kpi-icon,
.kpi-card.kpi-success .kpi-icon { background: var(--okbg); color: var(--ok); }
.kpi-card.kpi-danger .kpi-icon { background: var(--errbg); color: var(--err); }
.kpi-card.kpi-info .kpi-icon { background: var(--bluebg); color: var(--blue); }
.kpi-card.kpi-muted .kpi-icon { background: var(--surf3); color: var(--muted); }
.kpi-card .kpi-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpi-card .kpi-foot { font-size: 12px; color: var(--muted); font-weight: 400; }

.kpi-label {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 1;
}
.kpi-label i { font-size: 13px; opacity: 0.85; }
.kpi-value {
  font-size: 30px;
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.1;
  z-index: 1;
  font-variant-numeric: tabular-nums;
  color: var(--tx);
}
.kpi-value.accent-warn    { color: var(--warn); }
.kpi-value.accent-ok      { color: var(--ok); }
.kpi-value.accent-blue    { color: var(--blue); }
.kpi-value.accent-danger  { color: var(--err); }
.kpi-value.accent-success { color: var(--ok); }
.kpi-value.accent-muted   { color: var(--muted); }
.kpi-value.accent-info    { color: var(--blue); }


/* ═══════════════════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: 36px 20px;
  color: var(--faint);
}
.empty-state i {
  font-size: 32px;
  display: block;
  margin-bottom: 14px;
  opacity: 0.6;
  background: var(--surf3);
  width: 64px;
  height: 64px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  border: 1px solid var(--line);
}
.empty-state p { font-size: 14px; margin: 0; color: var(--muted); }
.results-meta {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
  font-weight: 400;
}

@media (max-width: 768px) {
  .card { padding: 16px; border-radius: 14px; }
  .card-header { margin-bottom: 14px; padding-bottom: 12px; }
}


/* ===== modules/forms.css ===== */
/* ═══════════════════════════════════════════════════════════════
   INPUTS
   ═══════════════════════════════════════════════════════════════ */
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--tx);
  margin-bottom: 6px;
  letter-spacing: 0;
  text-transform: none;
}
label.label-normal { text-transform: none; font-size: 13px; font-weight: 500; }
.input, .select, textarea.input {
  width: 100%;
  padding: 0 12px;
  min-height: 38px;
  border: 1px solid var(--line2);
  border-radius: 10px;
  background: var(--surf);
  color: var(--tx);
  font-size: 14px;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
textarea.input { resize: vertical; min-height: 110px; line-height: 1.55; padding: 10px 12px; }
.input:hover, .select:hover, textarea.input:hover { border-color: var(--line-strong); }
.input:focus, .select:focus, textarea.input:focus {
  outline: none;
  border-color: rgba(var(--primary-rgb), .45);
  box-shadow: var(--focus-ring);
  background: var(--surf);
}
.input::placeholder { color: var(--faint); }
.input[type="file"] {
  padding: 9px 12px;
  font-size: 13px;
  background: var(--surf2);
}
.input-mono,
.link.input-mono {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  letter-spacing: 0.03em;
}
.form-group { display: flex; flex-direction: column; }
/* O display:flex acima vence o [hidden] do UA stylesheet — precisa de regra própria. */
.form-group[hidden] { display: none; }
.form-grid {
  display: grid;
  gap: 16px;
  align-items: start;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.form-grid > .btn { width: fit-content; justify-self: start; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.form-row { display: grid; gap: 16px; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 600px) {
  .form-row.cols-2 { grid-template-columns: 1fr; }
}
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--tx);
  text-transform: none;
  letter-spacing: 0;
}
.checkbox-row input { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }


/* ═══════════════════════════════════════════════════════════════
   INPUT GROUP — request create form
   ═══════════════════════════════════════════════════════════════ */
.input-group {
  display: flex;
  align-items: stretch;
  gap: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--line2);
  background: var(--surf);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input-group:focus-within {
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}
.input-group .input {
  border: none;
  border-radius: 0;
  box-shadow: none !important;
  background: transparent;
}
.input-group .btn {
  border-radius: 0;
  flex-shrink: 0;
  padding-left: 18px;
  padding-right: 18px;
}

/* ═══════════════════════════════════════════════════════════════
   CUSTOM SELECT (.cs) — usado no form de solicitacoes e filtros
   ═══════════════════════════════════════════════════════════════ */
.cs { position: relative; }
.cs-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  background: var(--surf);
  border: 1px solid var(--line2);
  border-radius: var(--radius-sm);
  color: var(--tx);
  font-size: 14px;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.cs-toggle:hover { border-color: #94a3b8; }
.cs-toggle:focus,
.cs-toggle[aria-expanded="true"] {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}
.cs-summary.is-placeholder { color: var(--faint); font-weight: 500; }
.cs-toggle:disabled {
  background: var(--surf2);
  color: var(--faint);
  cursor: not-allowed;
  opacity: 0.85;
  border-color: var(--line);
}
.cs-toggle:disabled:hover { border-color: var(--line); }

/* Small variant — for toolbar (Por pagina) */
.cs-toggle.cs-toggle-sm {
  padding: 4px 8px;
  font-size: 12.5px;
  border-radius: 6px;
  width: auto;
  background: var(--surf);
}
.cs-toggle.cs-toggle-sm .cs-arrow { font-size: 11px; }

/* Status variant — for table rows (compact, pill-like, color-coded) */
.cs.cs-status { display: block; position: relative; }
.cs-toggle.cs-toggle-status {
  width: 100%;
  background: var(--surf3);
  border: 1px solid transparent;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
}
.cs-toggle.cs-toggle-status:hover {
  background: var(--surf);
  border-color: var(--line-strong);
}
.cs-toggle.cs-toggle-status .cs-summary {
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--tx);
  white-space: nowrap;
}
.cs-toggle.cs-toggle-status .cs-arrow { font-size: 11px; opacity: 0.7; }
.cs-toggle.cs-toggle-status:disabled {
  opacity: 0.6;
  cursor: wait;
}
.cs-list.cs-list-status,
.cs-list.cs-list-sm {
  min-width: 160px;
  max-height: 240px;
  padding: 3px;
}
.cs-list.cs-list-status label,
.cs-list.cs-list-sm label {
  padding: 3px 6px;
  font-size: 12px;
  gap: 7px;
  border-radius: 4px;
}
.cs-list.cs-list-status input[type="radio"],
.cs-list.cs-list-sm input[type="radio"] {
  width: 12px;
  height: 12px;
}
.cs-arrow { font-size: 12px; color: var(--muted); transition: transform var(--transition); flex-shrink: 0; }
.cs-toggle[aria-expanded="true"] .cs-arrow { transform: rotate(180deg); }

/* ═══════════════════════════════════════════════════════════════
   RECORRÊNCIA — seção do formulário de novo ticket
   ═══════════════════════════════════════════════════════════════ */
.recurring-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--tx);
  user-select: none;
}
.recurring-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}
.recurring-toggle:hover { color: var(--primary); }

/* Edição livre do intervalo (admin) */
.recurring-interval-form {
  display: flex;
  align-items: center;
  gap: 6px;
}
.recurring-interval-input {
  width: 78px;
  min-width: 78px;
  text-align: center;
}

/* Badge de ticket gerado automaticamente */
.badge-recurring {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(var(--primary-rgb), 0.10);
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
  vertical-align: middle;
}
.cs-list {
  position: absolute;
  z-index: 50;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surf);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  max-height: 260px;
  overflow-y: auto;
  padding: 6px;
  animation: dropIn 0.18s var(--ease);
}
.cs-list label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-weight: 500;
  color: var(--tx);
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
  margin: 0;
  transition: background var(--transition);
}
.cs-list label:hover { background: var(--surf2); }
.cs-list input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  margin: 0;
  cursor: pointer;
}
.cs-list .cs-empty {
  padding: 14px 12px;
  color: var(--faint);
  font-size: 13px;
  text-align: center;
}
.cs-list .cs-selected {
  background: var(--primary-lt);
  color: var(--primary-h);
  font-weight: 600;
}
.cs-list .is-active {
  background: var(--primary-lt);
  outline: 2px solid rgba(0, 100, 0, 0.18);
  outline-offset: -2px;
}

/* ═══════════════════════════════════════════════════════════════
   FORM SECTIONS — request create form
   ═══════════════════════════════════════════════════════════════ */
.form-section {
  margin-bottom: 26px;
  padding-bottom: 22px;
  border-bottom: 1px dashed var(--line);
}
.form-section:last-of-type {
  margin-bottom: 12px;
  padding-bottom: 0;
  border-bottom: none;
}
.form-section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.form-section-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary-lt);
  color: var(--primary-h);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.form-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--tx);
  letter-spacing: -0.01em;
  text-transform: none;
  margin: 0;
}
.form-section-icon {
  font-size: 13px;
}
.form-group-wide { grid-column: span 2; }
.filter-card .form-section {
  margin-bottom: 22px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.filter-card .form-section:last-of-type {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.filter-card .form-section .form-grid { margin-bottom: 0; }
.filter-card .form-section .form-grid + .form-group { margin-top: 16px; }
.form-divider {
  border: 0;
  border-top: 1px dashed var(--line);
  margin: 26px 0 22px;
}
.form-section-sub {
  font-size: 12px;
  color: var(--muted);
  margin-left: auto;
  font-weight: 500;
}

/* Required asterisk */
label.is-required::after,
.form-group.is-required > label::after {
  content: " *";
  color: var(--err);
  font-weight: 700;
  margin-left: 2px;
}


/* ═══════════════════════════════════════════════════════════════
   API MESSAGE (status text from fetch)
   ═══════════════════════════════════════════════════════════════ */
.api-message {
  display: none;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--surf2);
  color: var(--muted);
  margin-top: 10px;
}
.api-message::before {
  font-family: "bootstrap-icons";
  font-size: 14px;
  line-height: 1;
}
.api-message.is-info {
  background: var(--bluebg);
  color: var(--blue);
  border-color: rgba(29, 78, 216, 0.18);
}
.api-message.is-info::before { content: "\F431"; } /* bi-info-circle */
.api-message.is-success {
  background: var(--okbg);
  color: var(--ok);
  border-color: rgba(22, 101, 52, 0.18);
}
.api-message.is-success::before { content: "\F26B"; } /* bi-check-circle */
.api-message.is-error {
  background: var(--errbg);
  color: var(--err);
  border-color: rgba(159, 18, 57, 0.22);
}
.api-message.is-error::before { content: "\F33A"; } /* bi-exclamation-circle */

/* ═══════════════════════════════════════════════════════════════
   UNIT CHIPS — selected units as removable pills
   ═══════════════════════════════════════════════════════════════ */
.units-chips {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--surf2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  min-height: 0;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  padding-top: 0;
  padding-bottom: 0;
  margin-top: 0;
  border-width: 0;
  transition:
    opacity 220ms var(--ease),
    max-height 220ms var(--ease),
    padding 220ms var(--ease),
    margin 220ms var(--ease),
    border-width 220ms var(--ease);
}
.units-chips.has-items {
  display: flex;
  opacity: 1;
  max-height: 320px;
  padding-top: 10px;
  padding-bottom: 10px;
  margin-top: 10px;
  border-width: 1px;
}
.unit-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 10px;
  background: var(--surf);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--tx);
  max-width: 100%;
  animation: chipIn 200ms var(--ease);
}
.unit-chip-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 240px;
}
.unit-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: background var(--transition), color var(--transition);
}
.unit-chip-remove:hover {
  background: var(--errbg);
  color: var(--err);
}
.unit-chip.is-selected {
  background: color-mix(in srgb, var(--primary) 12%, var(--surf));
  border-color: var(--primary);
  color: var(--primary-h);
}
.unit-chip.is-selected .unit-chip-remove {
  color: var(--primary-h);
}
.help-text-inline {
  color: var(--faint);
  font-weight: 500;
  font-size: 12px;
  margin-left: 4px;
}
}
@keyframes chipIn {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}

/* ═══════════════════════════════════════════════════════════════
   VALIDATION STATES
   ═══════════════════════════════════════════════════════════════ */
.input.is-invalid,
.select.is-invalid,
textarea.input.is-invalid {
  border-color: var(--err);
  box-shadow: 0 0 0 3px rgba(159, 18, 57, 0.14);
}
.cs-toggle.is-invalid {
  border-color: var(--err);
  box-shadow: 0 0 0 3px rgba(159, 18, 57, 0.14);
  background: #fff5f6;
}
.cs-toggle.is-invalid .cs-summary { color: var(--err); }
.tag-picks.is-invalid {
  padding: 8px;
  border: 1.5px dashed var(--err);
  border-radius: 8px;
  background: #fff5f6;
}

/* ═══════════════════════════════════════════════════════════════
   TAGS GROUP — animated reveal
   ═══════════════════════════════════════════════════════════════ */
#tagsGroup {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition:
    grid-template-rows 320ms var(--ease),
    opacity 220ms var(--ease),
    margin 220ms var(--ease);
  overflow: hidden;
  margin-top: 0;
}
#tagsGroup > * { min-height: 0; }
#tagsGroup.is-visible {
  grid-template-rows: 1fr;
  opacity: 1;
  margin-top: 0;
}
#tagsGroup .form-group-inner {
  padding-top: 0;
  transition: padding-top 220ms var(--ease);
}
#tagsGroup.is-visible .form-group-inner {
  padding-top: 4px;
}

/* ═══════════════════════════════════════════════════════════════
   UPPERCASE INPUT
   ═══════════════════════════════════════════════════════════════ */
.input-uppercase { text-transform: uppercase; }


/* Table search in card header */
.table-search {
  position: relative;
  flex: 0 1 240px;
  min-width: 160px;
}
.table-search i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--faint);
  font-size: 14px;
  pointer-events: none;
}
.table-search input {
  width: 100%;
  padding: 6px 10px 6px 32px;
  border: 1px solid var(--line2);
  border-radius: 8px;
  font-size: 12.5px;
  background: var(--surf);
  color: var(--tx);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.table-search input:focus {
  outline: none;
  border-color: var(--primary);
  border-bottom: 2px solid var(--primary);
  box-shadow: none;
}
.table-search input::placeholder { color: var(--faint); }
.table-empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--muted);
  font-size: 14px;
}
.table-empty-state i {
  font-size: 32px;
  color: var(--faint);
  display: block;
  margin-bottom: 8px;
}
.card-header .table-search { margin-left: auto; }

/* Color input preview (tags) */
.color-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.input-color {
  width: 44px !important;
  height: 36px;
  padding: 2px;
  border: 1px solid var(--line2);
  border-radius: 8px;
  background: var(--surf);
  cursor: pointer;
  flex-shrink: 0;
}
.input-color::-webkit-color-swatch-wrapper { padding: 0; }
.input-color::-webkit-color-swatch { border: none; border-radius: 6px; }
.input-color::-moz-color-swatch { border: none; border-radius: 6px; }
.color-preview-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  min-width: 60px;
  text-align: center;
  transition: background var(--transition);
}

/* Loading state */
.btn.is-loading {
  pointer-events: none;
  opacity: 0.7;
}
.btn.is-loading::after {
  content: '';
  position: absolute;
  right: 10px;
  top: 50%;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: notif-spin 0.6s linear infinite;
}

/* Drawer form actions (sticky bottom) */
.drawer-form-actions {
  display: flex;
  gap: 8px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.drawer-form-actions .btn { flex: 0 1 auto; }
.drawer-form-actions .btn.p { flex: 1; }

/* Checkbox grid (multi-select in forms) */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px 12px;
  margin-top: 8px;
}
.checkbox-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--surf2);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.checkbox-grid label:hover {
  background: var(--primary-lt);
  border-color: var(--primary-300);
}
.checkbox-grid input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--primary);
}

/* ── Drawer forms: password field with show/hide ─────────── */
.pw-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
}
.pw-wrap .input { padding-right: 44px; }
.pw-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background var(--transition), color var(--transition);
}
.pw-toggle:hover { background: var(--surf2); color: var(--tx); }
.pw-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.pw-toggle[aria-pressed="true"] { color: var(--primary); }

/* ── Password strength meter ─────────────────────────────── */
.pw-strength {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.pw-strength-bar {
  flex: 1;
  height: 6px;
  background: var(--surf2);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.pw-strength-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--err);
  border-radius: 999px;
  transition: width 240ms var(--ease), background 240ms var(--ease);
}
.pw-strength-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  min-width: 80px;
  text-align: right;
}
.pw-strength[data-score="0"] .pw-strength-fill { width: 12%; background: var(--err); }
.pw-strength[data-score="1"] .pw-strength-fill { width: 32%; background: #f97316; }
.pw-strength[data-score="2"] .pw-strength-fill { width: 56%; background: #eab308; }
.pw-strength[data-score="3"] .pw-strength-fill { width: 80%; background: #16a34a; }
.pw-strength[data-score="4"] .pw-strength-fill { width: 100%; background: var(--primary); }
.pw-strength[data-score="0"] .pw-strength-label { color: var(--err); }
.pw-strength[data-score="1"] .pw-strength-label { color: #f97316; }
.pw-strength[data-score="2"] .pw-strength-label { color: #b45309; }
.pw-strength[data-score="3"] .pw-strength-label { color: #16a34a; }
.pw-strength[data-score="4"] .pw-strength-label { color: var(--primary-h); }

/* ═══════════════════════════════════════════════════════════════
   FIELD HELPERS (coss-inspired, compatível com stack atual)
   ═══════════════════════════════════════════════════════════════ */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label, .form-label { font-size: 13px; font-weight: 600; color: var(--tx); margin: 0; }
.field-hint, .form-hint, .field-description { font-size: 12px; color: var(--muted-fg); line-height: 1.45; }
.field-error, .form-error, .invalid-feedback {
  font-size: 12px;
  color: var(--destructive-foreground);
  line-height: 1.45;
}
.field-error[hidden], .form-error[hidden], .invalid-feedback[hidden] { display: none !important; }
.field-inline { display: flex; align-items: center; gap: 10px; }

.input[aria-invalid="true"],
.select[aria-invalid="true"],
textarea.input[aria-invalid="true"],
.input.is-invalid,
.select.is-invalid,
textarea.input.is-invalid {
  border-color: var(--destructive);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.12);
}
.input[aria-invalid="true"]:focus,
.select[aria-invalid="true"]:focus,
textarea.input[aria-invalid="true"]:focus {
  border-color: var(--destructive);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.16);
}

.form-actions-bar, .drawer-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
}
.form-actions-bar .btn.p, .drawer-actions .btn.p { min-width: 120px; }

/* ═══════════════════════════════════════════════════════════════
   DRAWER FORM PATTERN (inspirado no drawer de Artigo/KB)
   ═══════════════════════════════════════════════════════════════ */
.drawer-form-body .form-section-header > div,
.drawer-body .form-section-header > div { min-width: 0; }
.drawer-form-body .form-section-sub,
.drawer-body .form-section-sub,
.form-section-subtitle {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted-fg);
  line-height: 1.45;
}
.drawer-form-body .form-section,
.drawer-body .form-section {
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.drawer-form-body .form-section:last-of-type,
.drawer-body .form-section:last-of-type { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.drawer-form-body .form-grid,
.drawer-body .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; align-items: start; }
.drawer-form-body .form-group-wide,
.drawer-body .form-group-wide { grid-column: 1 / -1; }
.drawer-form-body .req,
.drawer-body .req { color: var(--destructive); }

.drawer-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
  padding: 16px 0 0;
  border-top: 1px solid var(--line);
}
.drawer-form-footer-hint { font-size: 12px; color: var(--muted-fg); display: flex; align-items: center; gap: 6px; }
.drawer-form-footer-actions { display: flex; gap: 8px; margin-left: auto; }

@media (max-width: 640px) {
  .drawer-form-body .form-grid,
  .drawer-body .form-grid { grid-template-columns: 1fr; }
  .drawer-form-body .form-group-wide,
  .drawer-body .form-group-wide { grid-column: auto; }
  .drawer-form-footer { flex-direction: column; align-items: stretch; }
  .drawer-form-footer-actions { margin-left: 0; justify-content: stretch; }
  .drawer-form-footer-actions .btn { flex: 1; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .btn, .input, .select, textarea.input, .cs-toggle, .cs-list, .unit-chip, #tagsGroup {
    transition: none !important;
    animation: none !important;
  }
}


/* ===== modules/buttons.css ===== */
/* ═══════════════════════════════════════════════════════════════
   BUTTONS — Guild Executive (coss-inspired patterns, stack atual)
   ═══════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line2);
  border-radius: 10px;
  padding: 0 16px;
  min-height: 36px;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.2;
  transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition), transform var(--transition), opacity var(--transition);
  white-space: nowrap;
  position: relative;
  isolation: isolate;
  background: var(--surf);
  color: var(--tx);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  text-decoration: none;
  vertical-align: middle;
}
.btn:hover { background: var(--surf2); border-color: var(--line-strong); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn:focus-visible {
  outline: none;
  border-color: rgba(var(--primary-rgb), .45);
  box-shadow: var(--focus-ring);
}
.btn:disabled, .btn[aria-disabled="true"] {
  opacity: .55;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
  pointer-events: none;
}

/* Variants (compat + semânticas) */
.btn.p, .btn-primary, .btn-primary-solid {
  background: var(--primary-grad);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 18px rgba(var(--primary-rgb), .22);
}
.btn.p:hover, .btn-primary:hover, .btn-primary-solid:hover { filter: brightness(1.03); transform: translateY(-1px); box-shadow: 0 10px 24px rgba(var(--primary-rgb), .28); color: #fff; }
.btn.p:active, .btn-primary:active, .btn-primary-solid:active { transform: translateY(0); filter: brightness(.98); }

.btn.g, .btn-ghost { background: transparent; border-color: var(--line2); color: var(--tx); box-shadow: none; }
.btn.g:hover, .btn-ghost:hover { background: var(--surf3); border-color: var(--line-strong); }

.btn-outline, .btn-secondary {
  background: var(--surf);
  border-color: var(--line2);
  color: var(--tx);
  box-shadow: none;
}
.btn-outline:hover, .btn-secondary:hover { background: var(--surf2); border-color: var(--line-strong); }

.btn.d, .btn-danger, .btn-destructive {
  background: var(--destructive-bg);
  color: var(--destructive-foreground);
  border-color: rgba(180,35,24,.12);
  box-shadow: none;
}
.btn.d:hover, .btn-danger:hover, .btn-destructive:hover { filter: brightness(.98); background: color-mix(in srgb, var(--destructive-bg) 82%, #fff); }

.btn-destructive-solid {
  background: var(--err);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(180,35,24,.18);
}
.btn-destructive-solid:hover { filter: brightness(1.02); color: #fff; }

.btn-link {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--primary);
  padding-inline: 4px;
  min-height: 30px;
}
.btn-link:hover { background: var(--primary-50); border-color: transparent; text-decoration: underline; transform: none; box-shadow: none; }

/* Sizes */
.btn-xs { padding: 0 10px; min-height: 28px; font-size: 11.5px; border-radius: 7px; gap: 6px; }
.btn-sm { padding: 0 12px; min-height: 32px; font-size: 12px; border-radius: 8px; }
.btn-lg { padding: 0 18px; min-height: 42px; font-size: 14px; border-radius: 12px; }
.btn-block { width: 100%; }

/* Icon-only */
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; min-height: 34px; padding: 0;
  border-radius: 9px;
  border: 1px solid transparent; background: transparent; color: var(--muted-fg);
  font-size: 15px; line-height: 1; cursor: pointer; text-decoration: none;
  transition: all var(--transition); box-shadow: none;
}
.btn-icon:hover { background: var(--surf3); border-color: var(--line); color: var(--tx); transform: none; }
.btn-icon:focus-visible { outline: none; box-shadow: var(--focus-ring); border-color: rgba(var(--primary-rgb),.35); }
.btn-icon.btn-icon-primary { color: var(--primary); }
.btn-icon.btn-icon-primary:hover { background: var(--primary-50); border-color: rgba(var(--primary-rgb),.12); }
.btn-icon-sm { width: 30px; height: 30px; min-height: 30px; font-size: 14px; border-radius: 8px; }
.btn-icon-lg { width: 40px; height: 40px; min-height: 40px; font-size: 18px; border-radius: 10px; }

/* Loading */
.btn .spinner {
  display: none; width: 14px; height: 14px;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin .7s linear infinite; opacity: .85;
}
.btn.p .spinner, .btn-primary .spinner, .btn-destructive-solid .spinner { border-color: rgba(255,255,255,.35); border-top-color: #fff; border-right-color: rgba(255,255,255,.35); }
.btn.is-loading .spinner { display: inline-block; }
.btn.is-loading .btn-label { opacity: .75; }
.btn.is-loading { pointer-events: none; opacity: .82; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes notif-spin { to { transform: rotate(360deg); } }


/* ===== modules/badge.css ===== */
/* ═══════════════════════════════════════════════════════════════
   BADGE
   ═══════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  line-height: 1.2;
  border: 1px solid transparent;
}

/* Legacy aliases (compat) */
.b-ok { background: var(--success-bg); color: var(--success-foreground); }
.b-e  { background: var(--danger-bg); color: var(--danger-foreground); }
.b-b  { background: var(--info-bg); color: var(--info-foreground); }
.b-w  { background: var(--warning-bg); color: var(--warning-foreground); }
.b-m  { background: var(--surf3); color: var(--muted-fg); border-color: var(--line); }
.b-p  { background: var(--primary-lt); color: var(--primary-h); }

/* Semantic variants (coss-inspired) */
.badge-success, .badge-ok { background: var(--success-bg); color: var(--success-foreground); }
.badge-danger, .badge-error, .badge-destructive { background: var(--destructive-bg); color: var(--destructive-foreground); }
.badge-info { background: var(--info-bg); color: var(--info-foreground); }
.badge-warning, .badge-warn { background: var(--warning-bg); color: var(--warning-foreground); }
.badge-muted, .badge-neutral, .badge-secondary { background: var(--surf3); color: var(--muted-fg); border-color: var(--line); }
.badge-primary { background: var(--primary-lt); color: var(--primary-h); }
.badge-outline { background: transparent; color: var(--tx); border-color: var(--line2); }
.badge-outline::before { opacity: .45; }


/* ===== modules/table.css ===== */
/* ═══════════════════════════════════════════════════════════════
   TABLE
   ═══════════════════════════════════════════════════════════════ */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: none;
  background: var(--surf);
}
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: color-mix(in srgb, var(--surf2) 88%, var(--surf));
  white-space: nowrap;
}
.table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table tbody tr { transition: background var(--transition); position: relative; }
.table tbody tr:hover { background: color-mix(in srgb, var(--primary-50) 45%, var(--surf)); }
.table tbody tr:hover td:first-child {
  box-shadow: none;
}
html.dark .table tbody tr:hover { background: rgba(255, 255, 255, 0.06); }
.table tbody tr:last-child td { border-bottom: none; }

/* ID chip */
.id-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surf3);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
}
.id-link:hover {
  background: var(--primary-lt);
  color: var(--primary-700);
  box-shadow: inset 0 0 0 1px var(--primary-300);
}
.table .sub-row td {
  background: var(--surf2);
  font-size: 12.5px;
}
.table .sub-row:hover td {
  background: #f0f2f5;
}
html.dark .table .sub-row:hover td {
  background: rgba(255, 255, 255, 0.08);
}
.sub-indent {
  display: inline-flex;
  align-items: center;
  margin-right: 4px;
  color: var(--faint);
  font-size: 11px;
}
.sla-exceeded-time {
  color: var(--warn);
  padding: 4px 10px;
  border: 1px solid var(--warn);
  border-radius: var(--radius-xs);
  background: var(--warnbg);
  display: inline-block;
  white-space: nowrap;
}
.row-title { font-weight: 700; color: var(--tx); }
a.row-title-link { text-decoration: none; }
a.row-title-link:hover { color: var(--primary); text-decoration: underline; }

.assignee { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.assignee-name { font-size: 12.5px; color: var(--tx); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }

/* ═══════════════════════════════════════════════════════════════
   DETAIL LIST
   ═══════════════════════════════════════════════════════════════ */
.detail-list { display: flex; flex-direction: column; gap: 14px; }
.detail-row {
  display: grid;
  grid-template-columns: minmax(100px, 32%) 1fr;
  gap: 8px 16px;
  align-items: start;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--line);
}
.detail-row:last-child { border-bottom: none; padding-bottom: 0; }
.detail-row dt {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.detail-row dd { margin: 0; font-size: 14px; }
@media (max-width: 640px) {
  .detail-row { grid-template-columns: 1fr; gap: 4px; }
}
.detail-block {
  background: var(--surf2);
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  white-space: pre-wrap;
  line-height: 1.6;
  font-size: 13.5px;
}
.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.card-divider {
  margin: 20px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

/* ═══════════════════════════════════════════════════════════════
   MESSAGE THREAD
   ═══════════════════════════════════════════════════════════════ */
.thread-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 480px;
  overflow-y: auto;
  padding: 16px;
  background: var(--surf2);
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
}
.thread-panel[hidden] { display: none !important; }
.thread-item {
  background: var(--surf);
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition);
}
.thread-item:hover { box-shadow: var(--shadow-sm); }
.thread-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 13px;
}
.thread-body { line-height: 1.6; }
.thread-attachments {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  background: var(--surf2);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  font-size: 12px;
  color: var(--primary);
  font-weight: 500;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}
.attach-chip:hover {
  background: var(--primary-lt);
  border-color: rgba(var(--primary-rgb), 0.25);
  transform: translateY(-1px);
}
.thread-item.thread-system {
  background: var(--muted-lt, #f8fafc);
  border-left: 3px solid var(--line2, #cbd5e1);
  font-size: 13px;
  color: var(--muted);
}

/* ── Histórico do ticket: variação clean (só nesta tela) ── */
.ticket-history .thread-panel {
  background: transparent;
  border: none;
  padding: 4px 0 0;
  max-height: none;
  overflow-y: visible;
  gap: 10px;
}
.ticket-history .thread-item {
  border-radius: 12px;
  box-shadow: none;
  padding: 12px 16px;
}
.ticket-history .thread-item:hover { box-shadow: var(--shadow-sm); }
.ticket-history .thread-meta {
  justify-content: flex-start;
  margin-bottom: 6px;
}
.ticket-history .thread-meta strong { font-size: 13.5px; }
.ticket-history .hist-date { margin-left: auto; font-size: 12px; white-space: nowrap; }
.ticket-history .hist-copy {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--faint);
  font-size: 13px;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition), background var(--transition), color var(--transition);
}
.ticket-history .thread-item:hover .hist-copy,
.ticket-history .hist-copy:focus-visible { opacity: 1; }
.ticket-history .hist-copy:hover { background: var(--surf3); color: var(--tx); border-color: var(--line); }
@media (hover: none) { .ticket-history .hist-copy { opacity: 1; } }
.ticket-history .thread-body { font-size: 13.5px; }

/* ── Filtro do histórico do ticket (eventos do sistema) ── */
.ticket-history .thread-item.is-sys-hidden { display: none !important; }
.ticket-history .hist-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.ticket-history .hist-filter .hist-filter-hint { font-size: 12px; color: var(--muted); }

/* ── Página do ticket: cantos discretos + card de recentes ── */
.ticket-show .card { border-radius: var(--radius-sm); }
.ticket-show .thread-item { border-radius: var(--radius-xs); }
.ticket-show .row.mb { margin-bottom: 12px; }
.ticket-show .card.mb { margin-bottom: 12px; }

/* ═══════════════════════════════════════════════════════════════
   DETAIL UNIFICADO (pedido/ticket) — superfície única integrada
   ═══════════════════════════════════════════════════════════════ */
.detail-unified { background: var(--surf); }
.detail-commandbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 28px;
  border-bottom: 1px solid var(--line);
}
.detail-commandbar .page-actions { margin: 0; }
.detail-unified > .card {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 20px 28px;
  margin: 0;
}
.detail-unified > .card + .card,
.detail-unified > .grid.cols-2 { border-top: 1px solid var(--line); }
.detail-unified .mb { margin-bottom: 0 !important; }
/* hero vira faixa informativa (sem glow de perfil) */
.detail-unified .profile-hero { gap: 14px; padding: 20px 28px; overflow: visible; }
.detail-unified .profile-hero::before { display: none; }
.detail-unified .profile-hero-avatar {
  width: 46px; height: 46px; font-size: 15px;
  border-radius: 12px; background: var(--primary); box-shadow: none;
}

/* duas colunas com filete central */
.detail-unified .grid.cols-2 { display: grid; gap: 1px; background: var(--line); }
.detail-unified .grid.cols-2 > .card { background: var(--surf); padding: 20px 28px; margin: 0; }
/* histórico em linhas, sem caixas */
.detail-unified .thread-panel { background: transparent; border: none; padding: 8px 0 0; max-height: none; }
.detail-unified .thread-item {
  background: var(--surf2);
  border: none;
  border-radius: 12px;
  box-shadow: none;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.detail-unified .thread-item:last-child { margin-bottom: 0; }
.detail-unified .thread-item:hover { box-shadow: none; }
/* histórico estilo conversa: avatar + bolhas */
.hist-item { display: flex; gap: 10px; align-items: flex-start; }
.hist-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary); color: #fff; font-weight: 700; font-size: 12px;
}
.hist-main { flex: 1; min-width: 0; }
.hist-item .thread-meta { gap: 8px; }
.detail-unified .thread-system { border-left: 3px solid var(--line2, #cbd5e1); padding-left: 12px; }
.detail-unified .detail-block { border: none; }
/* faixa de prioridade no topo da descrição do ticket */
.desc-prio-band {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  padding: 7px 28px;
  margin: -20px -28px 14px;
}
.desc-prio-band i { font-size: 13px; }
@media (max-width: 768px) {
  .detail-unified > .card,
  .detail-unified .grid.cols-2 > .card,
  .detail-unified .profile-hero { padding-left: 16px; padding-right: 16px; }
  .desc-prio-band { margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; }
}


/* ═══════════════════════════════════════════════════════════════
   PAGINATION
   ═══════════════════════════════════════════════════════════════ */
.pagination {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 18px 0 4px;
  align-items: center;
  justify-content: center;
}
.pagination a,
.pagination button {
  min-width: 38px;
  text-align: center;
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: var(--surf);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
  color: var(--tx);
  text-decoration: none;
}
.pagination a:hover,
.pagination button:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}
.pagination a.on,
.pagination a[aria-current="page"],
.pagination button[aria-current="page"] {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: none;
}
.pagination .pagination-nav {
  min-width: 38px;
  padding-inline: 10px;
}
.pagination .is-disabled,
.pagination a[aria-disabled="true"],
.pagination button:disabled {
  opacity: .45;
  pointer-events: none;
  transform: none !important;
}
.pagination .pagination-ellipsis {
  min-width: 28px;
  text-align: center;
  color: var(--muted-fg);
  font-weight: 600;
  padding: 0 2px;
}
.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.table-footer .pagination { padding: 0; }
.table-footer .results-meta { margin: 0; font-size: 12.5px; color: var(--muted-fg); }

@media (max-width: 720px) {
  .table-footer { justify-content: center; }
  .table-footer .results-meta { width: 100%; text-align: center; }
}

/* ═══════════════════════════════════════════════════════════════
   SKELETON / LOADING (coss-inspired)
   ═══════════════════════════════════════════════════════════════ */
.skeleton {
  background: linear-gradient(90deg, var(--surf3) 25%, color-mix(in srgb, var(--surf2) 70%, #fff) 37%, var(--surf3) 63%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
  border-radius: 6px;
}
@keyframes skeleton-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}
.skeleton-text { height: 12px; width: 100%; }
.skeleton-title { height: 16px; width: 45%; }
.skeleton-badge { height: 24px; width: 72px; border-radius: 999px; }

.table-wrap.is-loading { position: relative; }
.table-wrap.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--surf) 55%, transparent);
  pointer-events: none;
}
.table-loading-row td { padding: 14px; }
.table-loading-row .skeleton { display: block; }



/* ===== modules/flash-modal.css ===== */

/* ═══════════════════════════════════════════════════════════════
   FLASH / TOAST
   ═══════════════════════════════════════════════════════════════ */
.flash-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 420px;
  pointer-events: none;
}
.flash {
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 550;
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1.45;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.32s var(--ease);
  min-width: 280px;
  pointer-events: auto;
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
@keyframes slideInRight {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; transform: translateX(110%); }
}
.flash.hiding { animation: fadeOut 0.3s ease forwards; }
.flash.success { background: color-mix(in srgb, var(--okbg) 92%, var(--surf)); color: var(--ok); border-color: rgba(31,122,77,.18); }
.flash.error   { background: color-mix(in srgb, var(--errbg) 92%, var(--surf)); color: var(--err); border-color: rgba(180,35,24,.18); }
.flash.warning { background: color-mix(in srgb, var(--warnbg) 92%, var(--surf)); color: var(--warn); border-color: rgba(180,83,9,.18); }
.flash.info    { background: color-mix(in srgb, var(--bluebg) 92%, var(--surf)); color: var(--blue); border-color: rgba(29,95,138,.18); }
.flash-close {
  margin-left: auto;
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 4px;
  opacity: 0.6;
  border-radius: 6px;
  transition: opacity 0.2s, background 0.2s;
}
.flash-close:hover { opacity: 1; background: rgba(0, 0, 0, 0.06); }


/* ═══════════════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════════════ */
.modal-overlay {
  display: none !important;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex !important; }
.modal {
  background: var(--surf);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modalIn 0.24s var(--ease);
  border: 1px solid var(--line);
}
.modal.modal-lg { max-width: 640px; }
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.modal-title { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.modal-close {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-xs);
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
}
.modal-close:hover { background: var(--errbg); color: var(--err); }
.modal-body {
  padding: 24px;
  overflow-y: auto;
}
.modal-body-scroll { max-height: min(75vh, 560px); }

/* ═══════════════════════════════════════════════════════════════
   ADMIN: confirm modal, table search, color preview
   ═══════════════════════════════════════════════════════════════ */
.flash.warn {
  background: #fef3c7;
  color: #78350f;
  border-color: #fcd34d;
}
.flash.warn a.link { color: #78350f; text-decoration: underline; }
.flash.warn i { color: #b45309; }

/* Confirm modal */
.confirm-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 1000;
  animation: pageFade 0.18s var(--ease);
}
.confirm-modal-overlay[hidden] {
  display: none;
}
.confirm-modal {
  background: var(--surf);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.24);
  animation: dropIn 0.22s var(--ease);
  text-align: center;
}
.confirm-modal-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--errbg);
  color: var(--err);
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  font-size: 26px;
}
.confirm-modal-title {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 800;
  color: var(--tx);
}
.confirm-modal-msg {
  margin: 0 0 22px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}
.confirm-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.confirm-modal-actions .btn { flex: 1; max-width: 160px; }
.confirm-modal-danger {
  background: var(--err) !important;
  box-shadow: 0 4px 10px rgba(159, 18, 57, 0.25) !important;
}
.confirm-modal-danger:hover {
  background: #881337 !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(159, 18, 57, 0.35) !important;
}

/* ═══════════════════════════════════════════════════════════════
   ALERT (coss-inspired, inline/persistente)
   ═══════════════════════════════════════════════════════════════ */
.alert {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surf2);
  color: var(--tx);
  font-size: 13.5px;
  line-height: 1.5;
}
.alert-icon { font-size: 16px; line-height: 1; margin-top: 1px; flex-shrink: 0; }
.alert-content { flex: 1; min-width: 0; }
.alert-title { font-weight: 700; margin: 0 0 2px; font-size: 13.5px; color: inherit; }
.alert-description { margin: 0; color: inherit; opacity: .92; }
.alert-info { background: color-mix(in srgb, var(--info-bg) 88%, var(--surf)); border-color: color-mix(in srgb, var(--info) 18%, var(--line)); color: var(--info-foreground); }
.alert-success { background: color-mix(in srgb, var(--success-bg) 88%, var(--surf)); border-color: color-mix(in srgb, var(--success) 18%, var(--line)); color: var(--success-foreground); }
.alert-warning { background: color-mix(in srgb, var(--warning-bg) 88%, var(--surf)); border-color: color-mix(in srgb, var(--warning) 18%, var(--line)); color: var(--warning-foreground); }
.alert-danger, .alert-error, .alert-destructive { background: color-mix(in srgb, var(--destructive-bg) 88%, var(--surf)); border-color: color-mix(in srgb, var(--destructive) 18%, var(--line)); color: var(--destructive-foreground); }

.flash:focus-visible, .flash-close:focus-visible, .modal-close:focus-visible, .confirm-modal [data-confirm-cancel]:focus-visible, .confirm-modal [data-confirm-ok]:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

@media (prefers-reduced-motion: reduce) {
  .flash, .modal, .confirm-modal-overlay, .confirm-modal { animation: none !important; transition: none !important; }
}


/* ===== modules/drawer.css ===== */
/* ═══════════════════════════════════════════════════════════════
   DRAWER — slide-over panel from the right
   ═══════════════════════════════════════════════════════════════ */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 1100;
  pointer-events: none;
}
body.drawer-open { overflow: hidden; }

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 280ms var(--ease);
  pointer-events: auto;
}
.drawer.is-open .drawer-backdrop { opacity: 1; }

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(840px, 100%);
  background: var(--bg-grad);
  background-attachment: fixed;
  box-shadow: -16px 0 40px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 360ms var(--ease);
  pointer-events: auto;
  isolation: isolate;
}
.drawer.is-open .drawer-panel { transform: translateX(0); }

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 22px;
  background: var(--surf);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 2;
}
.drawer-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--tx);
  margin: 0;
  letter-spacing: -0.015em;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.drawer-title i { color: var(--primary); font-size: 18px; }
.drawer-close {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}
.drawer-close:hover { background: var(--errbg); color: var(--err); }
.drawer-close:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.drawer-close:disabled { opacity: .55; cursor: not-allowed; }

.drawer-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 22px 22px 0;
  -webkit-overflow-scrolling: touch;
}
.drawer-body:focus { outline: none; }
.drawer-body[aria-busy="true"] { opacity: .72; }

/* Form inside drawer: remove card chrome, sticky footer */
.drawer-body .drawer-form { display: flex; flex-direction: column; }
.drawer-body .card {
  background: var(--surf);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
}
.drawer-body .form-section { padding-bottom: 18px; margin-bottom: 18px; }
.drawer-body .form-section:last-of-type { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }

.drawer-loading,
.drawer-error {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 200px;
  color: var(--muted);
  font-size: 14px;
}
.drawer-loading i { font-size: 22px; }
.drawer-error { color: var(--err); }

/* Sticky form footer inside drawer */
.drawer-body form > .row:last-child,
.drawer-body .drawer-form-footer,
.drawer-body .kb-form-footer {
  position: sticky;
  bottom: 0;
  background: var(--surf);
  margin: 18px -22px 0;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 12px rgba(15, 23, 42, 0.05);
  z-index: 1;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.drawer-body .drawer-form-footer,
.drawer-body .kb-form-footer { justify-content: space-between; align-items: center; }

/* Mobile: drawer becomes full-screen sheet */
@media (max-width: 640px) {
  .drawer-panel { width: 100%; }
  .drawer-header { padding: 14px 16px; }
  .drawer-body { padding: 18px 16px 0; }
  .drawer-body form > .row:last-child { margin: 16px -16px 0; padding: 12px 16px; }
  .drawer-body .card { padding: 16px; }
}


/* ===== modules/login.css ===== */
/* ═══════════════════════════════════════════════════════════════
   LOGIN — clean / modern
   ═══════════════════════════════════════════════════════════════ */
body.login-page {
  min-height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background:
    radial-gradient(1000px 600px at 50% -20%, rgba(0,100,0,.10), transparent 65%),
    radial-gradient(600px 400px at 80% 100%, rgba(0,100,0,.05), transparent 60%),
    linear-gradient(180deg, #f8fbf9 0%, #edf3ef 100%);
  color: #17211d;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.login-shell {
  width: 100%;
  max-width: 460px;
}

.login-card {
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(0,100,0,.07);
  border-radius: 24px;
  padding: 44px;
  box-shadow:
    0 1px 2px rgba(0,100,0,.02),
    0 20px 60px rgba(0,100,0,.08);
  backdrop-filter: blur(8px);
}

.login-head { margin-bottom: 32px; }

.login-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.login-brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(180deg, #004d00 0%, #006400 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0,100,0,.22);
}
.login-brand-mark img { display: block; width: 22px; height: 22px; }

.login-brand-name {
  font-size: 15px;
  font-weight: 700;
  color: #17211d;
  letter-spacing: -0.02em;
}

.login-title {
  margin: 0 0 8px;
  font-size: clamp(28px, 3.4vw, 34px);
  line-height: 1.15;
  font-weight: 750;
  letter-spacing: -0.035em;
  color: #18211d;
}

.login-subtitle {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: #64756e;
}

.login-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 24px;
  padding: 13px 14px;
  border-radius: 14px;
  background: #fff5f5;
  border: 1px solid #ffd6d6;
  color: #b42318;
  font-size: 13.5px;
  line-height: 1.5;
}
.login-alert i { font-size: 16px; margin-top: 1px; flex-shrink: 0; }

.login-form { display: flex; flex-direction: column; gap: 20px; }

.login-field { display: flex; flex-direction: column; gap: 7px; }
.login-field label {
  font-size: 13px;
  font-weight: 600;
  color: #24312c;
}

.login-input-wrap { position: relative; }
.login-field-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #7c8b85;
  font-size: 17px;
  pointer-events: none;
  transition: color .15s ease;
}
.login-input-wrap .input {
  width: 100%;
  height: 48px;
  padding: 0 44px 0 44px;
  border-radius: 14px;
  border: 1px solid #d9e3de;
  background: #fcfefd;
  font-size: 14px;
  color: #17211d;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.login-input-wrap .input::placeholder { color: #91a097; }
.login-input-wrap .input:hover { border-color: #c3d1ca; background: #fff; }
.login-input-wrap .input:focus {
  outline: none;
  border-color: rgba(0,100,0,.30);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(0,100,0,.07);
}
.login-input-wrap:focus-within .login-field-icon { color: #006400; }

.login-pass-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #7c8b85;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 17px;
}
.login-pass-toggle:hover { background: #eff5f2; color: #17211d; }
.login-pass-toggle:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(0,100,0,.12); }

.btn.p.login-submit {
  width: 100%;
  height: 48px;
  margin-top: 4px;
  border-radius: 14px;
  justify-content: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 650;
  background: #006400;
  border-color: #006400;
  color: #f4fbf7;
  box-shadow: 0 10px 24px rgba(0,100,0,.20);
  transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
}
.btn.p.login-submit:hover { background: #004d00; border-color: #004d00; color: #fff; transform: translateY(-1px); box-shadow: 0 12px 28px rgba(0,100,0,.24); }
.btn.p.login-submit:active { transform: translateY(0); }
.btn.p.login-submit:focus-visible { outline: none; box-shadow: 0 0 0 4px rgba(0,100,0,.14); }

.login-footer {
  margin: 32px 0 0;
  padding-top: 20px;
  border-top: 1px solid #e7eeea;
  text-align: center;
  font-size: 12px;
  color: #84938d;
}

@media (max-width: 520px) {
  body.login-page { padding: 16px; align-items: start; padding-top: 48px; }
  .login-card { padding: 30px 20px; border-radius: 22px; box-shadow: 0 8px 30px rgba(0,100,0,.07); }
  .login-brand { margin-bottom: 28px; }
  .login-head { margin-bottom: 28px; }
}

/* ===== modules/tags.css ===== */

/* ═══════════════════════════════════════════════════════════════
   TAGS
   ═══════════════════════════════════════════════════════════════ */
.tag-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  background: color-mix(in srgb, var(--tag-color) 14%, transparent);
  color: var(--tag-color);
  border: 1px solid color-mix(in srgb, var(--tag-color) 28%, transparent);
  transition: transform var(--transition);
}
.tag-pill:hover { transform: translateY(-1px); }
.tag-check { display: inline-flex; align-items: center; cursor: pointer; user-select: none; }
.tag-check input { display: none; }
.tag-check .tag-label {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  border: 1.5px solid color-mix(in srgb, var(--tag-color) 40%, transparent);
  color: var(--tag-color);
  background: transparent;
  transition: all var(--transition);
}
.tag-check input:checked + .tag-label {
  background: color-mix(in srgb, var(--tag-color) 14%, transparent);
  border-color: var(--tag-color);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--tag-color) 18%, transparent);
}
.tag-picks { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
#createSectorContainer,
#editSectorContainer { justify-content: flex-start; width: 100%; }
#createSectorContainer .tag-check,
#editSectorContainer .tag-check { text-align: left; }

/* ═══════════════════════════════════════════════════════════════
   TYPE PICKS (Categorias)
   ═══════════════════════════════════════════════════════════════ */
.type-picks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.type-check { display: inline-flex; align-items: center; cursor: pointer; user-select: none; }
.type-check input { display: none; }
.type-check .type-label {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  border: 1.5px solid color-mix(in srgb, var(--tag-color, var(--primary)) 40%, transparent);
  color: var(--tag-color, var(--muted));
  background: transparent;
  transition: all var(--transition);
}
.type-check input:checked + .type-label {
  background: color-mix(in srgb, var(--tag-color, var(--primary)) 14%, transparent);
  border-color: var(--tag-color, var(--primary));
  color: var(--tag-color, var(--primary-h));
  font-weight: 600;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--tag-color, var(--primary)) 18%, transparent);
}

/* ═══════════════════════════════════════════════════════════════
   TAG TRACKING TOOLTIP
   ═══════════════════════════════════════════════════════════════ */
.tag-tracking { position: relative; cursor: pointer; display: inline-flex; }
.tracking-tooltip {
  display: none;
  position: fixed;
  z-index: 9999;
  background: var(--surf);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 12px 16px;
  width: 280px;
  font-size: 12px;
  color: var(--tx);
  white-space: normal;
  text-align: left;
  pointer-events: none;
}
.tag-tracking .tracking-tooltip { display: none; }
.tracking-tooltip .tt-row { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; }
.tracking-tooltip .tt-label { color: var(--faint); font-weight: 500; white-space: nowrap; }
.tracking-tooltip .tt-value { font-weight: 600; text-align: right; word-break: break-word; }
.tracking-tooltip .tt-code { font-family: ui-monospace, Consolas, monospace; font-size: 11px; letter-spacing: 0.04em; }
.tracking-tooltip .tt-divider { display: block; border-top: 1px solid var(--line); margin: 5px 0; }


/* ===== modules/rastreio.css ===== */

/* Top refresh progress bar (Rastreador "Atualizar Todos") */
.rastreador-progress {
  position: sticky;
  top: var(--nav-h, 59px);
  z-index: 150;
  background: var(--surf);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 14px 18px;
  margin-bottom: 16px;
  animation: rastreadorProgressIn 0.28s ease;
}
.rastreador-progress[hidden] { display: none; }
.rastreador-progress.is-hiding { animation: rastreadorProgressOut 0.32s ease forwards; }
.rastreador-progress.is-done {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border-color: #6ee7b7;
}
.rastreador-progress.is-error {
  background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%);
  border-color: #fca5a5;
}
.rastreador-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.rastreador-progress-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--tx);
  min-width: 0;
  flex: 1;
}
.rastreador-progress-title strong {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rastreador-progress-count {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: var(--surf2);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
}
.rastreador-progress.is-done .rastreador-progress-count {
  background: #fff;
  border-color: #6ee7b7;
  color: #047857;
}
.rastreador-progress.is-error .rastreador-progress-count {
  background: #fff;
  border-color: #fca5a5;
  color: #b91c1c;
}
.rastreador-progress-close {
  background: transparent;
  border: 0;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0 6px;
  border-radius: 4px;
  transition: background var(--transition), color var(--transition);
}
.rastreador-progress-close:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--tx);
}
.rastreador-progress-spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--primary);
  animation: rastreadorProgressSpin 0.8s linear infinite;
  flex-shrink: 0;
}
.rastreador-progress.is-done .rastreador-progress-spinner,
.rastreador-progress.is-error .rastreador-progress-spinner {
  display: none;
}
.rastreador-progress-track {
  height: 6px;
  background: var(--surf2);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.rastreador-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-2) 100%);
  border-radius: 999px;
  transition: width 0.35s ease;
}
.rastreador-progress.is-done .rastreador-progress-fill {
  background: linear-gradient(90deg, #10b981 0%, #059669 100%);
}
.rastreador-progress.is-error .rastreador-progress-fill {
  background: linear-gradient(90deg, #ef4444 0%, #b91c1c 100%);
}
.rastreador-progress-codes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  max-height: 56px;
  overflow-y: auto;
  font-size: 11.5px;
}
.rastreador-progress-code {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-family: var(--font-mono, ui-monospace, "SF Mono", Menlo, monospace);
  font-weight: 500;
  background: var(--surf2);
  border: 1px solid var(--line);
  color: var(--tx);
  animation: rastreadorChipIn 0.25s ease;
}
.rastreador-progress-code.is-ok {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: #047857;
}
.rastreador-progress-code.is-err {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #b91c1c;
}
.rastreador-progress-code i {
  font-size: 11px;
  line-height: 1;
}
@keyframes rastreadorProgressIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes rastreadorProgressOut {
  from { opacity: 1; transform: translateY(0); max-height: 200px; }
  to   { opacity: 0; transform: translateY(-8px); max-height: 0; padding-top: 0; padding-bottom: 0; margin-bottom: 0; }
}
@keyframes rastreadorProgressSpin {
  to { transform: rotate(360deg); }
}
@keyframes rastreadorChipIn {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}
.progress-track {
  background: var(--surf2);
  border-radius: var(--radius-xs);
  height: 8px;
  margin: 10px 0;
  overflow: hidden;
  border: 1px solid var(--line);
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  width: 0%;
  transition: width 0.3s ease;
  border-radius: var(--radius-xs);
}
.progress-log {
  max-height: 120px;
  overflow-y: auto;
  font-size: 12px;
  color: var(--muted);
}
.input-sm-inline {
  width: 140px;
  padding: 6px 10px;
  font-size: 12px;
}
.inline-form-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.card-code-title {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* Ações da lista em grade 2x2 compacta */
.cell-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 6px;
  justify-content: start;
  align-content: start;
}
.cell-actions-grid .btn-sm { min-width: 34px; }
.cell-actions-grid form { margin: 0; }

/* Menu de ações da linha ("...") */
.row-menu { position: relative; display: inline-block; }
.row-menu-list {
  min-width: 200px;
  background: var(--surf);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 1300;
}
.row-menu-list[hidden] { display: none; }
.row-menu-form { margin: 0; }
.row-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--tx);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
}
.row-menu-item:hover { background: var(--surf2); }
.row-menu-item i { font-size: 14px; color: var(--muted); }
.row-menu-item:hover i { color: var(--primary); }
.row-menu-item.danger { color: var(--err); }
.row-menu-item.danger i { color: var(--err); }
.row-menu-item.danger:hover { background: var(--errbg); }
.row-menu-item.danger:hover i { color: var(--err); }

/* ═══════════════════════════════════════════════════════════════
   TRACKING HERO — cartão de detalhe do rastreio
   ═══════════════════════════════════════════════════════════════ */
.track-hero { padding: 0; overflow: hidden; }
.track-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 10%, var(--surf)), var(--surf) 70%);
  border-bottom: 1px solid var(--line);
}
.track-hero-id { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.track-code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.05em;
}
.track-desc {
  margin: 0;
  padding: 12px 16px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13.5px;
}
.track-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1px;
  background: var(--line);
  border-top: 1px solid var(--line);
  margin-top: 12px;
}
.track-cell {
  background: var(--surf);
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.track-cell span {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--faint);
}
.track-cell strong { font-size: 13px; font-weight: 600; }
.help-text {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}


/* ═══════════════════════════════════════════════════════════════
   COLLAPSIBLE FILTER CARD
   ═══════════════════════════════════════════════════════════════ */
.filter-card .card-header { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.filter-card { padding: 0 16px; }
.filter-toggle {
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  padding: 12px 0;
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition);
}
.filter-card.filter-open .filter-toggle { border-bottom-color: var(--line); }
.filter-chevron {
  transition: transform 280ms ease;
  color: var(--muted);
  font-size: 14px;
}
.filter-card.filter-open .filter-chevron { transform: rotate(180deg); }
.filter-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 280ms ease;
  overflow: hidden;
}
.filter-card.filter-open .filter-body { 
  grid-template-rows: 1fr;
  overflow: visible;
}
.filter-body > form {
  min-height: 0;
  padding: 0;
  transition: padding 280ms ease;
}
.filter-card.filter-open .filter-body > form { padding: 18px 0 22px; }


/* ===== modules/notifications.css ===== */
/* ═══════════════════════════════════════════════════════════════
   NOTIFICATION BELL — aliases legados (topbar usa .bell-*)
   ═══════════════════════════════════════════════════════════════ */
.nav-bell-wrap { display: contents; }
.nav-bell-btn { all: unset; }
.nav-bell-badge, .nav-order-badge, .nav-newrequest-badge { display: none; }

/* ═══════════════════════════════════════════════════════════════
   NOTIFICATION BELL (estilos base ficam em nav.css — .bell-btn)
   ═══════════════════════════════════════════════════════════════ */
.nav-bell-wrap {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-right: 4px;
}
.nav-bell-wrap + .nav-bell-wrap {
  margin-left: 2px;
}
.nav-bell-btn {
  position: relative;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  cursor: pointer;
  color: rgba(255, 255, 255, 0.85);
  font-size: 18px;
  padding: 8px 10px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  transition: background var(--transition), color var(--transition), transform var(--transition);
  line-height: 1;
}
.nav-bell-btn:hover,
.nav-bell-btn:focus-visible {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  outline: none;
  transform: translateY(-1px);
}
.nav-bell-btn.has-notif .bi-bell,
.nav-bell-btn.has-notif .bi-box-seam,
.nav-bell-btn.has-notif .bi-plus-circle {
  animation: bell-ring 0.6s ease 0.2s 2;
}
@keyframes bell-ring {
  0%, 100% { transform: rotate(0deg); }
  20%      { transform: rotate(-18deg); }
  60%      { transform: rotate(18deg); }
}
.nav-bell-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: #f97316;          /* laranja — menos agressivo que vermelho */
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
  pointer-events: none;
  letter-spacing: 0.02em;
  box-sizing: border-box;
  box-shadow: 0 1px 4px rgba(249, 115, 22, 0.50);
}
.nav-order-badge {
  background: #3b82f6;
  box-shadow: 0 1px 4px rgba(59, 130, 246, 0.50);
}
.nav-newrequest-badge {
  background: #8b5cf6;
  box-shadow: 0 1px 4px rgba(139, 92, 246, 0.50);
}

/* ═══════════════════════════════════════════════════════════════
   NOTIFICATION POPOVER
   ═══════════════════════════════════════════════════════════════ */
.notif-modal-overlay {
  position: fixed;
  z-index: 1200;
  animation: notif-fade-in 0.18s var(--ease);
}
@keyframes notif-fade-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
.notif-modal {
  background: var(--surf);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  width: 100%;
  max-height: 480px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.notif-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  background: var(--surf2);
}
.notif-modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--tx);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.notif-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 18px;
  padding: 4px 6px;
  border-radius: var(--radius-xs);
  line-height: 1;
  display: flex;
  align-items: center;
  transition: background var(--transition), color var(--transition);
}
.notif-modal-close:hover { background: var(--errbg); color: var(--err); }
.notif-modal-body { overflow-y: auto; flex: 1; padding: 6px 0; }
.notif-loading,
.notif-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 44px 20px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}
.notif-empty i { font-size: 32px; color: #22c55e; }
.notif-loading i { font-size: 24px; }
@keyframes spin { to { transform: rotate(360deg); } }
.notif-spin { display: inline-block; animation: spin 0.8s linear infinite; }
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-item { border-bottom: 1px solid var(--line); }
.notif-item:last-child { border-bottom: none; }
.notif-item-link {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 20px;
  text-decoration: none;
  color: var(--tx);
  transition: background var(--transition);
}
.notif-item-link:hover { background: var(--surf2); }
.notif-item-icon {
  font-size: 20px;
  color: var(--muted);
  flex-shrink: 0;
  margin-top: 2px;
}
.notif-item-icon.new_request  { color: #3b82f6; }
.notif-item-icon.delivered         { color: #22c55e; }
.notif-item-icon.awaiting_correios { color: #f59e0b; }
.notif-item-icon.sla_exceeded      { color: #d97706; }
.notif-item-icon.overdue           { color: #ef4444; }
.notif-item-icon.restock_due       { color: #7c3aed; }
.notif-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.notif-item-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.notif-item-title {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.notif-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
  flex-shrink: 0;
}
.notif-badge.new_request  { background: #dbeafe; color: #1d4ed8; }
.notif-badge.delivered         { background: #dcfce7; color: #15803d; }
.notif-badge.awaiting_correios { background: #fef3c7; color: #b45309; }
.notif-badge.sla_exceeded      { background: #fef3c7; color: #b45309; }
.notif-badge.overdue           { background: #fee2e2; color: #b91c1c; }
.notif-badge.restock_due       { background: #ede9fe; color: #6d28d9; }
.notif-item-meta {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.notif-item-date { font-size: 11px; color: var(--faint); }


/* ===== modules/utils.css ===== */

/* ═══════════════════════════════════════════════════════════════
   UTILS
   ═══════════════════════════════════════════════════════════════ */
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }
.mt-sm { margin-top: 8px; }
.fs-12 { font-size: 12px; }
.nowrap { white-space: nowrap; }
.cell-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tag-list { display: flex; flex-wrap: wrap; gap: 4px; }
.me-1 { margin-right: 4px; }
.d-inline { display: inline; }


/* ═══════════════════════════════════════════════════════════════
   APP FOOTER
   ═══════════════════════════════════════════════════════════════ */
.app-footer {
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  padding: 8px 16px 20px;
  font-size: 12px;
  color: var(--faint);
  text-align: center;
}
.app-footer strong { color: var(--muted); font-weight: 600; }


/* ═══════════════════════════════════════════════════════════════
   ADMIN / UTILITIES
   ═══════════════════════════════════════════════════════════════ */
.form-inline {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}
.form-group-grow { flex: 1; min-width: 180px; max-width: 400px; }
.text-end { text-align: right; }
.cell-actions-end { justify-content: flex-end; }
.row-inactive { opacity: 0.55; }
.color-swatch {
  display: inline-block;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  vertical-align: middle;
}

code.code-chip {
  font-family: ui-monospace, Consolas, monospace;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.03em;
}
.text-late { color: var(--err); font-weight: 600; }
.truncate {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.progress-panel { display: none; }
.progress-panel.is-visible { display: block; }


/* ═══════════════════════════════════════════════════════════════
   ERROR PAGE
   ═══════════════════════════════════════════════════════════════ */
.error-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
}
.error-content {
  max-width: 500px;
  padding: 2rem;
}
.error-code {
  font-size: 8rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: 1rem;
  letter-spacing: -0.05em;
}
.error-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--tx);
  letter-spacing: -0.02em;
}
.error-message {
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: 1.75rem;
}

/* ═══════════════════════════════════════════════════════════════
   SCROLLBAR
   ═══════════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line2);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--faint); background-clip: padding-box; }

/* ═══════════════════════════════════════════════════════════════
   EMPTY STATE / ACCESSIBILITY HELPERS
   ═══════════════════════════════════════════════════════════════ */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 32px 16px; text-align: center; color: var(--muted);
}
.empty-state i { font-size: 32px; color: var(--faint); }
.empty-state p { margin: 0; font-size: 14px; }
.empty-state .empty-state-title { font-size: 15px; font-weight: 600; color: var(--tx); }

/* ═══════════════════════════════════════════════════════════════
   PRINT
   ═══════════════════════════════════════════════════════════════ */
@media print {
  .sidebar, .topbar, .app-footer, .page-actions, .page-actions-bar, .bell-wrap { display: none !important; }
  body { background: #fff; }
  .container { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}



/* ===== modules/dashboard.css ===== */

/* ═══════════════════════════════════════════════════════════════
   DASHBOARD — toolbar, sort, SLA bar, footer
   ═══════════════════════════════════════════════════════════════ */

/* Faixa de resumo de tickets */
.ticket-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 10px 20px;
  border-radius: 0;
  background: var(--surf);
  border: none;
  border-bottom: 1px solid var(--line);
  color: var(--tx);
  transition: background var(--transition);
}
.ticket-strip:hover { transform: none; box-shadow: none; background: var(--surf2); }
.ticket-strip-icon {
  width: 36px; height: 36px; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 10px;
  background: #0d9488; color: #fff; font-size: 17px;
}
.ticket-strip-text { font-size: 13.5px; color: var(--muted); }
.ticket-strip-text strong { color: var(--tx); }
.ticket-strip-go { margin-left: auto; font-size: 12.5px; font-weight: 700; color: #0d9488; white-space: nowrap; }

/* KPI foot text */
.kpi-foot {
  font-size: 11.5px;
  color: var(--faint);
  z-index: 1;
  margin-top: 2px;
}

/* Toolbar inside table card header */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.dashboard-unified > .card-header.toolbar {
  padding: 12px 16px;
  margin: 0;
  border-bottom: 1px solid var(--line);
}
/* Toolbar enxuta (sem título): linha mais fina e controles à direita */
.card-header.toolbar-slim {
  justify-content: flex-end;
  padding-bottom: 6px;
  margin-bottom: 8px;
}
.card-header.toolbar-slim .toolbar-title {
  margin-right: auto;
  font-size: 14px;
  font-weight: 700;
  color: var(--tx);
}
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 10px; }
.toolbar-left .results-meta { margin: 0; color: var(--muted); font-size: 12.5px; }
.toolbar-left .card-title { color: var(--tx); font-size: 14px; letter-spacing: -0.01em; }
.toolbar-toggle, .toolbar-perpage {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surf);
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.toolbar-toggle:hover, .toolbar-perpage:hover { background: var(--surf2); border-color: var(--line-strong); color: var(--tx); }
.toolbar-toggle.is-active { background: color-mix(in srgb, var(--primary) 12%, var(--surf)); border-color: color-mix(in srgb, var(--primary) 35%, transparent); color: var(--primary-h); }
.toolbar-toggle input { margin: 0; accent-color: var(--primary); }

/* Icon-only toolbar toggle (e.g. "Minhas") */
.toolbar-icon-toggle { cursor: pointer; }
.toolbar-icon-toggle input { position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0; }
.toolbar-icon-toggle:has(input:checked) {
  background: color-mix(in srgb, var(--primary) 14%, var(--surf));
  border-color: color-mix(in srgb, var(--primary) 40%, transparent);
  color: var(--primary-h);
}

/* Sortable column headers */
.th-sort {
  cursor: pointer;
  user-select: none;
  transition: color var(--transition);
}
.th-sort:hover { color: var(--primary); }
.th-sort i { margin-left: 4px; opacity: 0.5; font-size: 12px; }
.th-sort i:not(.bi-chevron-expand) { opacity: 1; color: var(--primary); }

/* Tag pill click-to-filter */
.tag-pill-click {
  border: none;
  cursor: pointer;
  font: inherit;
  font-size: 11.5px;
}

/* Check pill (for filter extras) */
.check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.check-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--surf2);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12.5px;
  cursor: pointer;
  user-select: none;
  transition: all var(--transition);
}
.check-pill:hover { border-color: var(--primary); background: var(--surf); }
.check-pill input { margin: 0; accent-color: var(--primary); }
.check-pill input:checked + span { color: var(--primary); font-weight: 600; }

/* SLA progress bar */
.sla-bar {
  position: relative;
  width: 100%;
  height: 18px;
  background: var(--surf3);
  border-radius: 999px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sla-bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, var(--ok), #4ade80);
  transition: width var(--transition);
}
.sla-bar.is-warn .sla-bar-fill { background: linear-gradient(90deg, #d97706, #fbbf24); }
.sla-bar.is-exceeded .sla-bar-fill { background: linear-gradient(90deg, #9f1239, #f43f5e); }
.sla-bar-text {
  position: relative;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--tx);
  letter-spacing: 0.02em;
}
.sla-bar.is-exceeded .sla-bar-text { color: #fff; }

/* Table footer (pagination + results) */
.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 16px;
  border-top: none;
}
.table-footer .pagination { padding: 0; }
/* "Por página" no rodapé: lista abre para cima */
.table-footer .cs-list {
  top: auto;
  bottom: calc(100% + 4px);
}

.pagination-nav { font-size: 13px; }
.pagination-nav.is-disabled {
  opacity: 0.4;
  pointer-events: none;
  cursor: not-allowed;
}
.pagination-ellipsis {
  display: inline-flex;
  align-items: center;
  padding: 0 6px;
  color: var(--faint);
  font-size: 13px;
}

/* Dashboard footer (last update + refresh) */
.dashboard-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  font-size: 12px;
  color: var(--faint);
  justify-content: flex-end;
}
.dashboard-footer strong {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
}
.btn-ghost:hover {
  background: var(--surf2);
  border-color: var(--line-strong);
  color: var(--tx);
}

/* Status pill (non-editable) */
.status-pill {
  display: inline-block;
  padding: 4px 10px;
  background: var(--surf3);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

/* AJAX loading state */
#ajaxResults.is-loading {
  opacity: 0.55;
  pointer-events: none;
  transition: opacity 120ms ease;
}

/* Unified dashboard block */
.dashboard-unified {
  padding: 0;
}
/* Cabeçalho slim da página (título + resumo) */
.dash-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 14px;
}
.dash-head h1 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.dash-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.dash-head .dash-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.dashboard-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1px;
  padding: 0;
  background: var(--line);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.dashboard-kpis .kpi-card {
  border: none;
  border-right: none;
  border-radius: 0;
  padding: 14px 16px;
  gap: 0;
  background: var(--surf);
  box-shadow: none;
  flex-direction: row;
  align-items: center;
  transition: background var(--transition);
  position: relative;
}
.dashboard-kpis .kpi-card:last-child { border-right: none; }
.dashboard-kpis .kpi-card::before { display: none; }
.dashboard-kpis .kpi-card::after { display: none; }
.dashboard-kpis .kpi-card:hover {
  background: var(--surf2);
  transform: none;
  box-shadow: none;
  border-color: var(--line);
}
.dashboard-kpis .kpi-card .kpi-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-right: 10px;
  font-size: 15px;
  background: var(--surf3);
  color: var(--muted);
}
.dashboard-kpis .kpi-card .kpi-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.dashboard-kpis .kpi-value { font-size: 24px; line-height: 1.1; }
.dashboard-kpis .kpi-label { font-size: 10.5px; margin: 0; }
.dashboard-kpis .kpi-foot { font-size: 11.5px; margin-top: 4px; line-height: 1.3; color: var(--muted); }

/* ── Rastreamento: acento por status + valor tingido ── */
.dashboard-kpis .kpi-card[data-kpi] { box-shadow: inset 0 3px 0 transparent; }
.dashboard-kpis .kpi-card[data-kpi="total"]    { box-shadow: inset 0 3px 0 var(--primary); }
.dashboard-kpis .kpi-card[data-kpi="transito"],
.dashboard-kpis .kpi-card[data-kpi="saiu"]     { box-shadow: inset 0 3px 0 var(--blue); }
.dashboard-kpis .kpi-card[data-kpi="entregue"] { box-shadow: inset 0 3px 0 var(--ok); }
.dashboard-kpis .kpi-card[data-kpi="postado"],
.dashboard-kpis .kpi-card[data-kpi="aguardando"] { box-shadow: inset 0 3px 0 #d97706; }
.dashboard-kpis .kpi-card[data-kpi="pendente"] { box-shadow: inset 0 3px 0 var(--faint); }
.dashboard-kpis .kpi-card[data-kpi="transito"] .kpi-value,
.dashboard-kpis .kpi-card[data-kpi="saiu"] .kpi-value { color: var(--blue); }
.dashboard-kpis .kpi-card[data-kpi="entregue"] .kpi-value { color: var(--ok); }
.dashboard-kpis .kpi-card[data-kpi="postado"] .kpi-value,
.dashboard-kpis .kpi-card[data-kpi="aguardando"] .kpi-value { color: #b45309; }
.dashboard-kpis .kpi-card.is-active { background: var(--primary-50); }

.dashboard-filters {
  border-bottom: none;
  background: var(--surf);
}
.dashboard-filters .filter-card {
  background: transparent;
  padding: 0 16px;
  border: none;
  box-shadow: none;
}
.dashboard-filters .filter-card .card-header {
  background: transparent;
  border-bottom: none;
  padding: 14px 0;
  font-size: 14px;
}
.dashboard-filters .filter-card .card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--tx);
  letter-spacing: -0.01em;
  text-transform: none;
}
.dashboard-filters .filter-card .filter-body > form {
  padding: 0;
  transition: padding 280ms ease;
}
.dashboard-filters .filter-card.filter-open .filter-body > form {
  padding: 6px 0 22px;
}
.dashboard-filters .form-section { margin-bottom: 22px; padding-bottom: 20px; border-bottom: 1px dashed var(--line); }
.dashboard-filters .form-section:last-of-type { margin-bottom: 12px; padding-bottom: 0; border-bottom: none; }
.dashboard-filters .form-section .form-grid { margin-bottom: 0; }
.dashboard-filters .form-section .form-grid + .form-group { margin-top: 16px; }
.dashboard-filters .form-grid { gap: 16px; }
.dashboard-filters .form-group-wide input { width: 100%; }
.dashboard-filters .check-row { margin-top: 8px; gap: 8px; }
.dashboard-filters .check-pill { padding: 6px 12px; font-size: 12px; }
.dashboard-filters .row { margin-top: 18px !important; }
.dashboard-filters label {
  margin-bottom: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Section header no estilo do form de solicitacoes (icone funil no lugar do numero) */
.dashboard-filters .form-section-header { margin-bottom: 14px; }
.dashboard-filters .form-section-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary-lt);
  color: var(--primary-h);
  font-size: 13px;
  flex-shrink: 0;
}
.dashboard-filters .form-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--tx);
  letter-spacing: -0.01em;
  text-transform: none;
  margin: 0;
}
.dashboard-filters .form-section-sub {
  font-size: 12px;
  color: var(--muted);
  margin-left: auto;
  font-weight: 500;
}

/* Native selects no dashboard (removido - agora sao .cs) */

#ajaxResults .toolbar {
  border-bottom: 1px solid var(--line);
  background: var(--surf);
  padding: 16px 22px;
  gap: 14px;
}
#ajaxResults .toolbar .card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--tx);
  letter-spacing: -0.01em;
  text-transform: none;
}
#ajaxResults .results-meta {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 500;
}
#ajaxResults .table-wrap { padding: 0; }
#ajaxResults .table {
  margin: 0;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-bottom: none;
}
#ajaxResults .table th,
#ajaxResults .table td {
  padding: 13px 16px;
  font-size: 13px;
}
#ajaxResults .table th {
  font-size: 10.5px;
  padding-top: 11px;
  padding-bottom: 11px;
}
#ajaxResults .id-link {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: color var(--transition);
}
#ajaxResults .id-link:hover { color: var(--primary); }
#ajaxResults .table tbody tr { transition: background var(--transition); }
#ajaxResults .table tbody tr:hover { background: #fafbfc; }
html.dark #ajaxResults .table tbody tr:hover { background: rgba(255, 255, 255, 0.06); }
#ajaxResults .table tbody tr.sla-exceeded-row td {
  background: #ffffe0;
}
html.dark #ajaxResults .table tbody tr.sla-exceeded-row td {
  background: var(--warnbg);
}
#ajaxResults .table-footer {
  padding: 14px 22px;
  background: var(--surf);
  border-top: 1px solid var(--line);
}
#ajaxResults .dashboard-footer {
  padding: 14px 22px;
  background: var(--surf2);
  border-top: 1px solid var(--line);
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
}
#ajaxResults .dashboard-footer #dashboardLastUpdate { color: var(--tx); font-weight: 600; }
#ajaxResults .dashboard-footer .btn-ghost { margin-left: auto; }

@media (max-width: 720px) {
  .dashboard-kpis { grid-template-columns: repeat(2, 1fr); }
  .dashboard-kpis .kpi-card { border-right: none; border-bottom: none; padding: 16px; }
  .dashboard-filters .filter-card { padding: 0 16px; }
  #ajaxResults .toolbar { padding: 12px 16px; }
  #ajaxResults .table th,
  #ajaxResults .table td { padding: 10px 12px; font-size: 12.5px; }
  #ajaxResults .table-footer { padding: 10px 16px; }
  #ajaxResults .dashboard-footer { padding: 12px 16px; }
}

/* Responsive: stack toolbar on small screens */
@media (max-width: 720px) {
  .toolbar { flex-direction: column; align-items: flex-start; }
  .table-footer { flex-direction: column-reverse; align-items: stretch; }
  .table-footer .pagination { justify-content: center; }
  .kpi-foot { display: none; }
  .form-group-wide { grid-column: span 1; }
  .filter-card .form-section-header { flex-wrap: wrap; }
  .filter-card .form-section-sub { width: 100%; margin-left: 38px; }
}
@media (max-width: 1280px) {
  .dashboard-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .dashboard-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .dashboard-kpis { grid-template-columns: 1fr; }
  .dashboard-kpis .kpi-card { border-bottom: none; }
}


/* ═══════════════════════════════════════════════════════════════
   DASHBOARD IMPROVEMENTS (KPIs, active filter chips, loading bar, SLA warnings)
   ═══════════════════════════════════════════════════════════════ */
.dashboard-unified {
  position: relative;
  overflow: hidden;
}

/* Loading progress bar */
.loading-progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-h) 50%, #22c55e 100%);
  background-size: 200% 100%;
  animation: loading-bar-progress 1.5s infinite linear;
  display: none;
  z-index: 1200;
}
@keyframes loading-bar-progress {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* KPI tones (icon chip color per kind) */
.dashboard-kpis .kpi-card.kpi-tone-primary .kpi-icon { background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary-h); }
.dashboard-kpis .kpi-card.kpi-tone-warn    .kpi-icon { background: color-mix(in srgb, #d97706 14%, transparent); color: #b45309; }
.dashboard-kpis .kpi-card.kpi-tone-danger  .kpi-icon { background: color-mix(in srgb, #9f1239 14%, transparent); color: #9f1239; }
.dashboard-kpis .kpi-card.kpi-tone-blue    .kpi-icon { background: color-mix(in srgb, var(--blue) 14%, transparent); color: var(--blue); }
.dashboard-kpis .kpi-card.kpi-tone-success .kpi-icon { background: color-mix(in srgb, #16a34a 14%, transparent); color: #16a34a; }
.dashboard-kpis .kpi-card.kpi-tone-muted   .kpi-icon { background: var(--surf3); color: var(--muted); }

/* Active KPI Card Highlight */
.dashboard-kpis .kpi-card.is-active::before {
  display: block;
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary);
}
.dashboard-kpis .kpi-card.kpi-tone-warn.is-active::before    { background: #d97706; }
.dashboard-kpis .kpi-card.kpi-tone-danger.is-active::before  { background: #9f1239; }
.dashboard-kpis .kpi-card.kpi-tone-blue.is-active::before    { background: var(--blue); }
.dashboard-kpis .kpi-card.kpi-tone-success.is-active::before { background: #16a34a; }
.dashboard-kpis .kpi-card.kpi-tone-muted.is-active::before   { background: var(--muted); }
.dashboard-kpis .kpi-card.is-active { background: var(--surf2); }


/* Active Filter Chips */
.active-chips-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 22px;
  background: var(--surf);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.active-chips-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.active-chips-list {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--surf2);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--tx);
  transition: all var(--transition);
}
.filter-chip:hover {
  border-color: var(--muted);
}
.filter-chip-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  padding: 0 2px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition);
}
.filter-chip-remove:hover {
  color: var(--err);
}
.filter-chip-clear {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  margin-left: 6px;
  transition: color var(--transition);
}
.filter-chip-clear:hover {
  color: var(--primary-h);
  text-decoration: underline;
}


/* ===== modules/profile.css ===== */
/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   PROFILE PAGE
   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */

/* â”€â”€ Hero: identity card â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.profile-hero {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px 28px;
  overflow: hidden;
}
.profile-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(500px circle at 0% 0%, rgba(0, 100, 0, 0.10), transparent 60%),
    radial-gradient(500px circle at 100% 100%, rgba(34, 197, 94, 0.08), transparent 60%);
  pointer-events: none;
  z-index: -1;
}

.profile-hero-avatar {
  position: relative;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--primary-grad);
  color: #fff;
  font-weight: 800;
  font-size: 23px;
  letter-spacing: 0.01em;
  flex-shrink: 0;
  box-shadow:
    0 8px 20px rgba(var(--primary-rgb), 0.30),
    inset 0 0 0 3px rgba(255, 255, 255, 0.18);
  user-select: none;
}
.profile-hero-initials { line-height: 1; }

/* Center: name + subtitle + contact */
.profile-hero-info { flex: 1; min-width: 0; }
.profile-hero-name {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--tx);
  word-break: break-word;
  line-height: 1.2;
}
.profile-hero-subtitle {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--muted);
}
.profile-hero-sep {
  color: var(--faint);
  font-weight: 700;
  user-select: none;
}
.profile-hero-status-text.ok  { color: var(--ok);  font-weight: 600; }
.profile-hero-status-text.err { color: var(--err); font-weight: 600; }
.profile-hero-contact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  font-size: 13.5px;
  color: var(--muted);
}
.profile-hero-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  text-decoration: none;
  border-radius: 6px;
  padding: 1px 2px;
  transition: color var(--transition), background var(--transition);
}
.profile-hero-link i { color: var(--faint); font-size: 14px; transition: color var(--transition); }
.profile-hero-link:hover {
  color: var(--primary);
  background: var(--primary-lt);
}
.profile-hero-link:hover i { color: var(--primary); }
.profile-hero-link.faint { color: var(--faint); cursor: default; }
.profile-hero-link.faint:hover { color: var(--faint); background: transparent; }
.hero-field { display: inline-flex; align-items: center; gap: 6px; }
.hero-field-label { font-size: 11px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: 0.06em; }
.hero-desc-card { margin-top: 12px; max-width: 900px; background: var(--surf2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 13.5px; }
.hero-desc-title { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.hero-desc-body { line-height: 1.6; }
.desc-card { padding: 20px 22px; }
.desc-body { font-size: 14px; line-height: 1.7; color: var(--tx); word-break: break-word; }
.desc-body strong { font-weight: 700; }
.desc-body em { font-style: italic; }
.desc-body code { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; background: var(--surf2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.desc-body a { color: var(--primary); font-weight: 600; }
.desc-body a:hover { text-decoration: underline; }
.desc-body.is-collapsed { max-height: 160px; overflow: hidden; position: relative; }
.desc-body.is-collapsed::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 56px; background: linear-gradient(to bottom, transparent, var(--surf)); pointer-events: none; }
.md-toolbar { display: flex; gap: 4px; margin-bottom: 6px; }
.md-toolbar .md-btn { width: 28px; height: 28px; font-size: 13px; }

@media (max-width: 720px) {
  .profile-hero { padding: 20px; gap: 14px; }
  .profile-hero-name { font-size: 18px; }
  .profile-hero-avatar { width: 56px; height: 56px; font-size: 19px; }
  .profile-hero-meta { gap: 4px 12px; font-size: 12.5px; }
}

/* â”€â”€ Section cards (inside .grid.cols-2) â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.profile-section-card { height: 100%; }
.profile-section-card .card-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--tx);
}
.profile-section-card .card-title i { color: var(--primary); font-size: 16px; }

.profile-link {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  border-radius: 4px;
  transition: color var(--transition), background var(--transition);
}
.profile-link:hover {
  color: var(--primary-h);
  background: var(--primary-lt);
  text-decoration: none;
}

/* â”€â”€ Security status banner â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.profile-security-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  background: var(--surf2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--ok);
  border-radius: var(--radius-sm);
}
.profile-security-status.has-err {
  border-left-color: var(--err);
  background: var(--errbg);
}
.profile-security-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: var(--okbg);
  color: var(--ok);
  font-size: 18px;
}
.profile-security-icon.err { background: var(--errbg); color: var(--err); }
.profile-security-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.profile-security-text strong {
  font-size: 13.5px;
  color: var(--tx);
  font-weight: 700;
}
.profile-security-text small { font-size: 12px; line-height: 1.4; }

/* â”€â”€ Security list â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.profile-security-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.profile-security-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}
.profile-security-list li i {
  font-size: 15px;
  margin-top: 2px;
  flex-shrink: 0;
  color: var(--primary);
}
.profile-security-list li i.bi-check2-circle { color: var(--ok); }
.profile-security-list li i.bi-clock-history { color: var(--blue, #2563eb); }
.profile-security-list li i.bi-envelope-paper { color: var(--muted); }

/* Password match indicator (no inline style â†’ no DOM mutation loop) */
[data-pw-match][data-state="ok"]  { color: var(--ok);  }
[data-pw-match][data-state="err"] { color: var(--err); }

/* Avatar image inside hero */
.profile-hero-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

/* Avatar with photo: remove gradient background and box-shadow */
.profile-hero-avatar:has(.profile-hero-img) {
  background: none;
  box-shadow: none;
}

/* Overlay on hover for avatar change */
.avatar-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border: none;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 2;
  font-size: 11px;
  line-height: 1.2;
}
.avatar-overlay:hover,
.avatar-overlay:focus-visible {
  opacity: 1;
}
.profile-hero-avatar:hover .avatar-overlay {
  opacity: 1;
}
.avatar-overlay i {
  font-size: 18px;
  color: #fff;
}
.avatar-overlay-label {
  font-weight: 600;
  white-space: nowrap;
}

/* Navbar avatar */
.nav-user-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

/* Admin user list avatar */
.td-avatar {
  width: 44px;
  padding-right: 0;
  vertical-align: middle;
}
.admin-list-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
  display: block;
}
.admin-list-avatar-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-grad);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

/* Admin edit avatar */
.admin-avatar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.admin-avatar-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
}


/* ===== modules/audit.css ===== */

/* ═══════════════════════════════════════════════════════════════
   AUDIT LOGS PAGE
   ═══════════════════════════════════════════════════════════════ */
.audit-kpis .kpi-card.is-active {
  border-color: var(--primary);
  box-shadow: var(--shadow-md), 0 0 0 1px var(--primary);
}
.audit-kpis .kpi-card.is-active::before { background: var(--primary); }

.audit-kpis .kpi-card.has-anomaly {
  animation: audit-anomaly-pulse 2.4s var(--ease) infinite;
}
.audit-kpis .kpi-card.has-anomaly::after {
  background: linear-gradient(135deg, rgba(159, 18, 57, 0.10) 0%, transparent 60%);
}
@keyframes audit-anomaly-pulse {
  0%, 100% { box-shadow: var(--shadow-xs); }
  50%      { box-shadow: 0 0 0 4px rgba(159, 18, 57, 0.22), var(--shadow-sm); }
}
.audit-kpis .kpi-card[aria-disabled="true"] {
  opacity: 0.7;
  pointer-events: none;
}

.audit-unified .card-header.toolbar { margin-bottom: 0; }
.audit-unified .active-chips-row { padding: 14px 24px 0; }

.audit-table td { vertical-align: middle; }
.audit-table .audit-details {
  max-width: 360px;
  color: var(--muted);
  font-size: 12.5px;
  word-break: break-word;
}
.audit-table .audit-time {
  font-size: 13px;
  color: var(--tx);
  font-variant-numeric: tabular-nums;
}
.audit-table .audit-time strong { color: var(--tx); }

.audit-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.audit-user .avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  /* AA contrast: pair bold white text with darker, saturated background */
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.32);
  font-family: var(--font-sans, Inter, system-ui, sans-serif);
}
.audit-user-info { min-width: 0; line-height: 1.25; }
.audit-user-info strong {
  display: block;
  font-size: 13.5px;
  color: var(--tx);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.audit-user-info small { font-size: 11.5px; }

.audit-table .badge i { font-size: 11px; line-height: 1; }
.audit-table .badge .muted { color: inherit; opacity: 0.7; margin-left: 2px; }
.audit-table .audit-entity-link {
  margin-left: 4px;
  color: inherit;
  text-decoration: none;
  opacity: 0.85;
  border-bottom: 1px dashed currentColor;
  transition: opacity var(--transition), color var(--transition);
}
.audit-table .audit-entity-link:hover {
  opacity: 1;
  color: var(--primary);
}

.audit-view-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.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;
}

#auditDetailModal .detail-row dt i { color: var(--primary); }
#auditDetailModal .modal-body { padding: 22px 24px; }

@media (max-width: 760px) {
  .audit-table .audit-details { max-width: 200px; }
  .audit-user-info strong { max-width: 140px; }
  .audit-unified .card-header.toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
}


/* ===== modules/settings.css ===== */
/* ═══════════════════════════════════════════════════════════════
   SETTINGS DASHBOARD
   ═══════════════════════════════════════════════════════════════ */
.settings-grid {
  display: flex;
  flex-direction: column;
  gap: 36px;
  padding: 24px 28px 8px;
}

.settings-group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.settings-group-title i {
  font-size: 16px;
  opacity: 0.7;
}

.settings-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.settings-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  background: var(--surf);
  border: none;
  border-radius: var(--radius-md);
  padding: 20px;
  text-decoration: none;
  color: inherit;
  transition: transform var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow-xs);
}

.settings-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.settings-card-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--card-color) 10%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--card-color);
  transition: transform var(--transition), background var(--transition);
}

.settings-card:hover .settings-card-icon {
  transform: scale(1.05);
  background: color-mix(in srgb, var(--card-color) 16%, transparent);
}

.settings-card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.settings-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--tx);
  line-height: 1.3;
}

.settings-card-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}

html.dark .settings-card-icon {
  background: color-mix(in srgb, var(--card-color) 18%, transparent);
}

html.dark .settings-card:hover .settings-card-icon {
  background: color-mix(in srgb, var(--card-color) 26%, transparent);
}

@media (max-width: 640px) {
  .settings-grid {
    padding: 16px 16px 8px;
  }
  .settings-cards {
    grid-template-columns: 1fr;
  }
}


/* ===== modules/estoque.css ===== */
/* ═══════════════════════════════════════════════════════════════
   CATÁLOGO DE PRODUTOS — tabela, favoritos, origem e banners
   ═══════════════════════════════════════════════════════════════ */

/* ── KPIs: os 5 cards sempre em uma única linha ─────────────────
   O grid padrão do dashboard usa 6 colunas (e quebra em 3/2/1),
   o que deixaria o 5º card sozinho numa segunda linha. Aqui as
   5 colunas são fixas e encolhem juntas. O seletor é composto
   (.dashboard-kpis.estoque-kpis) para vencer as media queries
   do dashboard, que são importadas antes deste arquivo. */
.dashboard-kpis.estoque-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 820px) {
  .dashboard-kpis.estoque-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .dashboard-kpis.estoque-kpis { grid-template-columns: 1fr; }
}

/* ── Barra de ferramentas (ações da lista) ───────────────────── */
.estoque-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin: 0 0 14px;
  padding: 10px 14px;
  border: 1px solid var(--line2);
  border-radius: var(--radius-md);
  background: var(--surf2);
}
.estoque-toolbar-info {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--muted);
  min-width: 0;
}
.estoque-toolbar-info > i {
  font-size: 15px;
  color: var(--primary);
}
.estoque-toolbar-info strong {
  color: var(--tx);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.estoque-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.estoque-toolbar-actions .btn { white-space: nowrap; }

.estoque-sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.7;
}
.estoque-sync-badge.is-ok {
  background: color-mix(in srgb, #15803d 12%, transparent);
  color: #15803d;
}
.estoque-sync-badge.is-error {
  background: var(--errbg);
  color: var(--err);
}
html.dark .estoque-sync-badge.is-ok { color: #4ade80; }

/* ── Banner de estado da integração ─────────────────────────── */
.estoque-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 14px;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.5;
  border: 1px solid transparent;
}
.estoque-banner i { font-size: 16px; flex: 0 0 auto; margin-top: 1px; }
.estoque-banner strong { font-weight: 600; }
.estoque-banner a { color: inherit; font-weight: 600; text-decoration: underline; }
.estoque-banner-warn {
  background: var(--warnbg);
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 28%, transparent);
}
.estoque-banner-error {
  background: var(--errbg);
  color: var(--err);
  border-color: color-mix(in srgb, var(--err) 28%, transparent);
}
.estoque-banner .muted { display: block; margin-top: 3px; opacity: .85; }

/* ── Divisor de grupo (favoritos da equipe) ─────────────────── */
.estoque-group-row td {
  background: var(--surf2);
  border-top: 1px solid var(--line2);
  border-bottom: 1px solid var(--line2);
  padding: 7px 14px;
}
.estoque-group-row span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #b45309;
}
.estoque-group-row small {
  margin-left: 10px;
  font-size: 11.5px;
  color: var(--faint);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

/* ── Célula do produto (thumb + textos) ─────────────────────── */
.estoque-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 4px 0;
}
.estoque-thumb {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line2);
  background: var(--surf2);
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--faint);
  font-size: 16px;
  box-shadow: var(--shadow-xs);
}
.estoque-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.estoque-thumb.is-placeholder {
  background: linear-gradient(140deg, var(--surf3), var(--surf2));
  border-style: dashed;
  box-shadow: none;
}
.estoque-initials {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--faint);
}
.estoque-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  line-height: 1.35;
}
.estoque-info strong {
  font-weight: 600;
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--tx);
}
.estoque-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.estoque-code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--muted);
  background: var(--surf3);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 1px 5px;
}
.estoque-cat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--cat-color, #6b7280);
  background: color-mix(in srgb, var(--cat-color, #6b7280) 10%, transparent);
  border-radius: 999px;
  padding: 1px 8px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.estoque-barcode {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: .01em;
}

/* ── Quantidade com barra proporcional ──────────────────────── */
.estoque-qty { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.estoque-qty-value { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.estoque-qty-bar {
  display: block;
  width: 74px;
  height: 4px;
  border-radius: 999px;
  background: var(--surf3);
  overflow: hidden;
}
.estoque-qty-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary-400), var(--primary-500));
}
html.dark .estoque-qty-bar i { background: linear-gradient(90deg, var(--primary-500), var(--primary-300)); }

.estoque-price {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ── Favorito ───────────────────────────────────────────────── */
.estoque-star {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 3px;
  font-size: 17px;
  line-height: 1;
  color: var(--line-strong);
  border-radius: var(--radius-sm);
  transition: color var(--transition), transform var(--transition), background var(--transition);
}
.estoque-star:hover {
  color: #d97706;
  background: color-mix(in srgb, #d97706 12%, transparent);
  transform: scale(1.15);
}
.estoque-star.is-on { color: #d97706; }
.estoque-star:disabled { opacity: .55; cursor: progress; transform: none; }

.estoque-row-favorite { background: color-mix(in srgb, #d97706 7%, transparent); }
.estoque-row-favorite:hover { background: color-mix(in srgb, #d97706 7%, transparent); }

/* ── Previsão de reposição ──────────────────────────────────── */
.estoque-restock {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.7;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.estoque-restock.is-none {
  background: transparent;
  color: var(--faint);
  font-weight: 400;
  padding-left: 0;
}
.estoque-restock.is-future {
  background: var(--bluebg);
  color: var(--blue);
}
.estoque-restock.is-today {
  background: var(--warnbg);
  color: var(--warn);
}
.estoque-restock.is-late {
  background: color-mix(in srgb, var(--err) 12%, transparent);
  color: var(--err);
}
.estoque-restock.is-late i:first-child { display: none; }

/* Quantidade prevista para reposição (abaixo da data) */
.estoque-restock-qty {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--tx);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ── Reposição confirmada + botão de confirmar ─────────────── */
.estoque-confirmed {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  font-size: 11.5px;
  font-weight: 600;
  color: #15803d;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
html.dark .estoque-confirmed { color: #4ade80; }

.estoque-confirm {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  padding: 3px 9px;
  border: 1px solid var(--line2);
  border-radius: 999px;
  background: var(--surf2);
  color: var(--tx);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.estoque-confirm:hover {
  background: color-mix(in srgb, #15803d 10%, transparent);
  border-color: #15803d;
}
.estoque-confirm i { color: #15803d; }

/* ── Resumo do item no drawer (modo previsão) ──────────────── */
.estoque-form-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
  padding: 10px 12px;
  border: 1px solid var(--line2);
  border-radius: var(--radius-sm);
  background: var(--surf2);
}
.estoque-form-summary > div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.estoque-form-summary span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); }
.estoque-form-summary strong {
  font-size: 12.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Histórico de previsões (drawer do modo previsão) ───────── */
.estoque-history {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  padding: 6px 2px;
}
.estoque-history-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 12px;
  line-height: 1.4;
}
.estoque-history-when {
  flex: 0 0 auto;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.estoque-history-when i { margin-right: 5px; }
.estoque-history-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.estoque-history-qty {
  margin-left: 6px;
  font-weight: 600;
  color: var(--muted);
}
.estoque-history-who {
  flex: 0 0 auto;
  color: var(--faint);
  font-size: 11.5px;
  text-align: right;
}

/* ── Badge de origem ────────────────────────────────────────── */
.origin-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.7;
  white-space: nowrap;
}
.origin-amlabs {
  background: var(--bluebg);
  color: var(--blue);
}
.origin-guild {
  background: var(--primary-100);
  color: var(--primary-700);
}
html.dark .origin-guild { color: var(--primary-300); }

/* ── Status da integração (admin) ────────────────────────────── */
.tp-status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

/* ── Ações do formulário no drawer ──────────────────────────── */
.drawer-actions { gap: 10px; flex-wrap: wrap; }


/* ===== modules/kb.css ===== */
/* ── Knowledge Base / Artigos ─────────────────────────────────── */

.kb-page {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Hero / search */
.kb-hero {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.kb-hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.kb-hero-copy { min-width: 0; }
.kb-eyebrow {
  margin: 0 0 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--primary);
}
.kb-hero-title {
  margin: 0;
  font-size: clamp(24px, 2.8vw, 32px);
  line-height: 1.2;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: var(--tx);
}
.kb-hero-sub {
  margin: 8px 0 0;
  max-width: 720px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
}
.kb-hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.kb-search-form { margin: 0; }
.kb-search-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 6px 6px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.kb-search-wrap:focus-within {
  border-color: rgba(var(--primary-rgb), .35);
  box-shadow: var(--focus-ring);
}
.kb-search-wrap > .bi-search { font-size: 18px; color: var(--faint); flex-shrink: 0; }
.kb-search-input.input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none !important;
  font-size: 15px;
}
.kb-search-input.input:focus { outline: none; }
.kb-search-clear {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--faint);
}
.kb-search-clear:hover { background: var(--surf2); color: var(--tx); }
.kb-search-wrap .btn { height: 44px; padding: 0 20px; border-radius: 10px; flex-shrink: 0; }

.kb-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}
.kb-type-filters { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 16px; }
.kb-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--transition);
}
.kb-filter-chip:hover { color: var(--tx); border-color: var(--line2); background: var(--surf2); }
.kb-filter-chip.is-active {
  color: var(--primary);
  background: var(--primary-50);
  border-color: rgba(var(--primary-rgb), .18);
}
html.dark .kb-filter-chip.is-active { background: rgba(var(--primary-rgb), .14); color: var(--primary-h); }
.kb-toolbar-meta { display: flex; align-items: center; gap: 10px; padding-top: 16px; flex-wrap: wrap; }
.kb-inline-filter { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.kb-inline-filter i { font-size: 14px; }
.kb-inline-filter .select { min-width: 220px; max-width: 320px; height: 36px; padding: 0 30px 0 10px; font-size: 13px; }
.kb-main-full { width: 100%; }
.kb-status-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 550;
  text-decoration: none;
}
.kb-status-toggle:hover { background: var(--surf2); color: var(--tx); }
.kb-status-toggle.is-active { color: var(--primary); background: var(--primary-50); }

/* Layout */
.kb-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

/* Sidebar */
.kb-sidebar {
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
  padding: 18px;
}
.kb-sidebar-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.kb-sidebar-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--tx);
  display: flex;
  align-items: center;
  gap: 8px;
}
.kb-sidebar-hint { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.kb-sidebar-total {
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surf2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.kb-cat-list { display: flex; flex-direction: column; gap: 4px; }
.kb-cat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition);
}
.kb-cat:hover { background: var(--surf2); color: var(--tx); }
.kb-cat.is-active { background: var(--primary-50); color: var(--primary); font-weight: 650; }
html.dark .kb-cat.is-active { background: rgba(var(--primary-rgb), .14); color: var(--primary-h); }
.kb-cat-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.kb-cat-name i { color: var(--faint); font-size: 14px; flex-shrink: 0; }
.kb-cat.is-active .kb-cat-name i { color: var(--primary); }
.kb-cat-count {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--faint);
  background: var(--surf2);
  padding: 2px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}
.kb-cat.is-active .kb-cat-count { color: var(--primary); background: rgba(var(--primary-rgb), .10); }
.kb-sidebar-empty { padding: 12px; font-size: 13px; color: var(--muted); }

/* Main */
.kb-main { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.kb-results-bar {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.kb-results-title { margin: 0; font-size: 15px; font-weight: 650; color: var(--tx); }
.kb-results-title strong { color: var(--primary); }
.kb-results-sub { margin: 3px 0 0; font-size: 13px; color: var(--muted); }
.kb-results-kpis { display: flex; flex-wrap: wrap; gap: 8px; }
.kb-kpi {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--surf2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
}
.kb-kpi strong { color: var(--tx); font-weight: 750; }

/* Article list */
.kb-list { display: flex; flex-direction: column; gap: 12px; }
.kb-article {
  padding: 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.kb-article:hover { border-color: rgba(var(--primary-rgb), .18); box-shadow: var(--shadow-md); }
.kb-article-main { min-width: 0; flex: 1; }
.kb-article-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 10px;
}
.kb-type {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}
.kb-type-manual { color: #1d4ed8; background: rgba(59,130,246,.10); }
.kb-type-faq { color: #7c3aed; background: rgba(139,92,246,.10); }
html.dark .kb-type-manual { color: #93c5fd; background: rgba(59,130,246,.16); }
html.dark .kb-type-faq { color: #c4b5fd; background: rgba(139,92,246,.16); }
.kb-article-cat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 550;
}
.kb-article-cat i { color: var(--faint); }
.kb-article-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.kb-article-title a { color: var(--tx); text-decoration: none; }
.kb-article-title a:hover { color: var(--primary); }
.kb-article-excerpt {
  margin: 8px 0 0;
  font-size: 14px;
  line-height: 1.65;
  color: var(--muted);
  max-width: 78ch;
}
.kb-article-meta {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 12.5px;
  color: var(--faint);
}
.kb-article-meta span { display: inline-flex; align-items: center; gap: 6px; }
.kb-article-meta i { font-size: 13px; }
.kb-article-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding-top: 2px;
}

/* Pagination / empty */
.kb-pagination.card {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.kb-pagination-nav { display: flex; align-items: center; gap: 8px; }
.kb-pagination-nav a {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; border: 1px solid var(--line);
  color: var(--muted); text-decoration: none;
}
.kb-pagination-nav a:hover:not(.is-disabled) { background: var(--surf2); color: var(--tx); }
.kb-pagination-nav a.is-disabled { opacity: .45; pointer-events: none; }
.kb-page-num { font-size: 13px; color: var(--muted); font-weight: 550; padding: 0 4px; }
.kb-empty .empty-state { padding: 48px 20px; }
.kb-empty-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 4px; }

/* Detail */
.kb-detail-layout { max-width: none; width: 100%; }
.kb-detail { padding: 28px 32px; }
.kb-detail-topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.kb-back { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); text-decoration: none; }
.kb-back:hover { color: var(--primary); }
.kb-detail-header { margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.kb-detail-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.kb-detail-title { margin: 0; font-size: clamp(26px, 3vw, 36px); line-height: 1.25; font-weight: 750; letter-spacing: -0.02em; color: var(--tx); }
.kb-detail-meta { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; color: var(--muted); }
.kb-detail-meta span { display: inline-flex; align-items: center; gap: 6px; }
.kb-detail-summary {
  margin: 0 0 24px;
  padding: 16px 18px;
  border-radius: 12px;
  background: var(--surf2);
  border: 1px solid var(--line);
  font-size: 15px;
  line-height: 1.7;
  color: var(--tx);
}
.kb-detail-body { font-size: 15px; line-height: 1.75; color: var(--tx); }
.kb-detail-body p, .kb-detail-body ul, .kb-detail-body ol, .kb-detail-body pre, .kb-detail-body blockquote { margin: 0 0 16px; }
.kb-detail-body h1, .kb-detail-body h2, .kb-detail-body h3 { margin: 28px 0 12px; line-height: 1.3; font-weight: 700; color: var(--tx); }
.kb-detail-body h1 { font-size: 28px; }
.kb-detail-body h2 { font-size: 22px; }
.kb-detail-body h3 { font-size: 18px; }
.kb-detail-body ul, .kb-detail-body ol { padding-left: 24px; }
.kb-detail-body li + li { margin-top: 6px; }
.kb-detail-body code { padding: 2px 6px; border-radius: 6px; background: var(--surf2); font-size: .92em; font-family: ui-monospace, Consolas, monospace; }
.kb-detail-body pre { padding: 16px; border-radius: 12px; background: #0f172a; color: #e2e8f0; overflow: auto; }
.kb-detail-body pre code { padding: 0; background: transparent; color: inherit; }
.kb-detail-body blockquote { margin-left: 0; padding: 12px 16px; border-left: 3px solid rgba(var(--primary-rgb), .45); background: var(--primary-50); border-radius: 0 10px 10px 0; color: var(--muted); }
.kb-detail-body img, .kb-detail-body video, .kb-md-img, .kb-md-video { display: block; max-width: min(100%, 720px); max-height: 520px; width: auto; height: auto; margin: 12px auto; border-radius: 12px; object-fit: contain; }
.kb-detail-body a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.kb-detail-footer {
  margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-size: 13px; color: var(--muted);
}

/* Attachments (article detail) */
.kb-files { margin: 0 0 28px; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surf2); }
.kb-files-header { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--tx); margin-bottom: 14px; }
.kb-files-header i { color: var(--primary); font-size: 15px; }
.kb-files-count { margin-left: auto; font-size: 11px; font-weight: 700; color: var(--muted); background: var(--surf3); border: 1px solid var(--line2); padding: 2px 8px; border-radius: 999px; line-height: 1.4; }
.kb-files-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.kb-file-item { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--line2); border-radius: 10px; background: var(--surf); min-width: 0; transition: border-color .15s, box-shadow .15s; }
.kb-file-item:hover { border-color: rgba(var(--primary-rgb), .25); box-shadow: 0 1px 4px rgba(15,23,42,.04); }
.kb-file-link { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; color: var(--tx); text-decoration: none; }
.kb-file-link:hover { color: var(--primary); }
.kb-file-link > i { font-size: 20px; color: var(--primary); flex-shrink: 0; }
.kb-file-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kb-file-size { font-size: 12px; color: var(--muted); white-space: nowrap; flex-shrink: 0; }

/* Legacy/compat used by content rendering */
.kb-content { font-size: 15px; line-height: 1.75; color: var(--tx); max-width: 960px; }
.kb-content p { margin: 0 0 14px; }
.kb-content h1, .kb-content h2, .kb-content h3 { color: var(--tx); font-weight: 700; line-height: 1.3; margin: 24px 0 10px; }
.kb-content ul, .kb-content ol { margin: 0 0 14px; padding-left: 24px; }
.kb-content code { font-family: ui-monospace, Consolas, monospace; font-size: .9em; background: var(--surf2); border: 1px solid var(--line2); padding: 1px 5px; border-radius: 4px; }
.kb-content pre { background: #0f172a; color: #e2e8f0; border-radius: 10px; padding: 14px 16px; overflow-x: auto; margin: 0 0 14px; }
.kb-content pre code { background: none; border: 0; padding: 0; color: inherit; font-size: 13px; }
.kb-content blockquote { margin: 0 0 14px; padding: 10px 14px; border-left: 3px solid rgba(var(--primary-rgb), .45); background: var(--primary-50); border-radius: 0 8px 8px 0; color: var(--muted); }
.kb-content table { width: 100%; border-collapse: collapse; margin: 0 0 14px; font-size: 14px; }
.kb-content th, .kb-content td { padding: 8px 10px; border: 1px solid var(--line2); text-align: left; }
.kb-content th { background: var(--surf2); font-weight: 600; }
.kb-content a { color: var(--primary); }
.kb-content hr { border: 0; border-top: 1px solid var(--line2); margin: 20px 0; }
.kb-content img { display: block; max-width: min(100%, 720px); max-height: 520px; width: auto; height: auto; margin: 12px auto; border-radius: 8px; object-fit: contain; }
.kb-content video, .kb-md-video { display: block; max-width: min(100%, 720px); max-height: 520px; width: auto; height: auto; border-radius: 8px; margin: 12px auto; background: #000; }

/* Form / drawer */
.kb-form .form-section-header > div { min-width: 0; }
.kb-form .form-section-sub { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.kb-form .req { color: var(--danger, #dc2626); }
.kb-form .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; align-items: start; }
.kb-form .form-group { min-width: 0; }
.kb-form .form-group-wide { grid-column: 1 / -1; }
.kb-form .form-group > label { margin-bottom: 6px; }
.kb-form .input, .kb-form .select, .kb-form textarea.input { width: 100%; }
.kb-new-cat-group { padding: 12px 14px; background: var(--surf2); border: 1px dashed var(--line2); border-radius: 10px; }
.kb-new-cat-group .kb-new-cat-label { margin-bottom: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.kb-new-cat-group .input { background: var(--bg); }

.kb-type-picker { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.kb-type-option { position: relative; display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--line2); border-radius: 12px; background: var(--bg); cursor: pointer; transition: .15s ease; }
.kb-type-option:hover { border-color: rgba(var(--primary-rgb), .3); background: var(--surf2); }
.kb-type-option.is-selected { border-color: rgba(var(--primary-rgb), .45); background: var(--primary-50); box-shadow: inset 0 0 0 1px rgba(var(--primary-rgb), .18); }
.kb-type-option input { position: absolute; opacity: 0; pointer-events: none; }
.kb-type-option-icon { width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--surf2); color: var(--muted); font-size: 16px; flex-shrink: 0; }
.kb-type-option.is-selected .kb-type-option-icon { background: rgba(var(--primary-rgb), .14); color: var(--primary); }
.kb-type-option-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kb-type-option-body strong { font-size: 13px; color: var(--tx); }
.kb-type-option-body small { font-size: 12px; color: var(--muted); line-height: 1.4; }

.kb-slug-field { display: flex; align-items: stretch; }
.kb-slug-prefix { display: inline-flex; align-items: center; padding: 0 10px; border: 1px solid var(--line); border-right: 0; border-radius: 10px 0 0 10px; background: var(--surf2); color: var(--muted); font-size: 12px; font-family: ui-monospace, Consolas, monospace; white-space: nowrap; }
.kb-slug-field .input { border-radius: 0 10px 10px 0; }

.kb-field-meta { display: flex; justify-content: space-between; gap: 10px; margin-top: 4px; font-size: 12px; }
.kb-char-count { color: var(--muted); font-variant-numeric: tabular-nums; }

.kb-editor { border: 1px solid var(--line2); border-radius: 12px; overflow: hidden; background: var(--bg); }
.kb-editor-tabs { display: flex; gap: 2px; padding: 6px; background: var(--surf2); border-bottom: 1px solid var(--line2); }
.kb-editor-tab { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 0; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; border-radius: 8px; cursor: pointer; }
.kb-editor-tab:hover { color: var(--tx); background: color-mix(in srgb, var(--bg) 60%, transparent); }
.kb-editor-tab.is-active { color: var(--tx); background: var(--bg); box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.kb-editor-toolbar { display: flex; align-items: center; gap: 4px; padding: 8px; border-bottom: 1px solid var(--line2); background: var(--surf); flex-wrap: wrap; }
.kb-tool { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: transparent; color: var(--muted); border-radius: 8px; cursor: pointer; font-size: 15px; }
.kb-tool:hover { background: var(--surf2); color: var(--tx); }
.kb-tool-sep { width: 1px; height: 20px; background: var(--line2); margin: 0 2px; }
.kb-editor-pane[hidden] { display: none !important; }
.kb-content-editor { border: 0 !important; border-radius: 0 !important; min-height: 280px; resize: vertical; box-shadow: none !important; font-family: ui-monospace, Consolas, monospace; font-size: 13px; line-height: 1.6; }
.kb-content-editor:focus { outline: none; }
.kb-preview { padding: 16px; min-height: 280px; max-height: 60vh; overflow: auto; }
.kb-editor-help { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line2); background: var(--surf2); }

.kb-switch { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line2); border-radius: 12px; background: var(--bg); cursor: pointer; }
.kb-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.kb-switch-ui { width: 44px; height: 26px; border-radius: 999px; background: var(--line); position: relative; flex-shrink: 0; transition: .2s ease; }
.kb-switch-ui::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: .2s ease; }
.kb-switch input:checked + .kb-switch-ui { background: var(--primary); }
.kb-switch input:checked + .kb-switch-ui::after { transform: translateX(18px); }
.kb-switch input:focus-visible + .kb-switch-ui { outline: 2px solid rgba(var(--primary-rgb), .35); outline-offset: 2px; }
.kb-switch-body { display: flex; flex-direction: column; gap: 2px; }
.kb-switch-body strong { font-size: 13px; color: var(--tx); }
.kb-switch-body small { font-size: 12px; color: var(--muted); }

.kb-existing-files { margin-bottom: 12px; padding: 10px 12px; border: 1px solid var(--line2); border-radius: 10px; background: var(--surf2); }
.kb-existing-files-title { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; text-transform: uppercase; letter-spacing: .03em; }
.kb-dropzone { position: relative; display: flex; align-items: center; gap: 12px; padding: 16px; border: 1px dashed rgba(var(--primary-rgb), .3); border-radius: 12px; background: rgba(var(--primary-rgb), .02); cursor: pointer; transition: .15s ease; }
.kb-dropzone:hover { border-color: var(--primary); background: rgba(var(--primary-rgb), .05); }
.kb-dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.kb-dropzone-icon { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: rgba(var(--primary-rgb), .10); color: var(--primary); font-size: 20px; flex-shrink: 0; }
.kb-dropzone-body { display: flex; flex-direction: column; gap: 2px; }
.kb-dropzone-body strong { font-size: 13px; color: var(--tx); }
.kb-dropzone-body small { font-size: 12px; color: var(--muted); }
.kb-file-picked { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.kb-picked-title { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
.kb-picked-file { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--tx); padding: 6px 8px; background: var(--surf2); border-radius: 8px; }
.kb-picked-file i { color: var(--muted); }

.kb-form-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line2); }
.kb-form-footer-hint { font-size: 12px; display: flex; align-items: center; gap: 6px; }
.kb-form-footer-actions { display: flex; gap: 8px; }

@media (max-width: 980px) {
  .kb-layout { grid-template-columns: 1fr; }
  .kb-sidebar { position: static; }
}
@media (max-width: 720px) {
  .kb-hero { padding: 18px; }
  .kb-hero-top { flex-direction: column; align-items: stretch; }
  .kb-hero-actions { width: 100%; }
  .kb-hero-actions .btn { flex: 1; justify-content: center; }
  .kb-search-wrap { flex-wrap: wrap; padding: 10px; gap: 10px; }
  .kb-search-wrap > .bi-search { display: none; }
  .kb-search-input.input { min-width: 100%; height: 42px; padding: 0 4px; }
  .kb-search-wrap .btn { width: 100%; }
  .kb-toolbar { align-items: stretch; }
  .kb-toolbar-meta { padding-top: 0; }
  .kb-results-bar { padding: 16px; }
  .kb-article { flex-direction: column; padding: 16px; gap: 14px; }
  .kb-article-actions { width: 100%; }
  .kb-article-actions .btn { flex: 1; justify-content: center; }
  .kb-pagination.card { flex-direction: column; align-items: stretch; }
  .kb-pagination-nav { justify-content: center; }
  .kb-detail { padding: 20px; }
}
@media (max-width: 640px) {
  .kb-form .form-grid { grid-template-columns: 1fr; }
  .kb-form .form-group-wide { grid-column: auto; }
  .kb-type-picker { grid-template-columns: 1fr; }
  .kb-form-footer { flex-direction: column; align-items: stretch; }
  .kb-form-footer-actions { justify-content: stretch; }
  .kb-form-footer-actions .btn { flex: 1; justify-content: center; }
}

