@font-face {
  font-family: 'Instrument Sans';
  font-style: italic;
  font-weight: 400;
  font-stretch: 100%;
  font-display: swap;
  src: url(/static/fonts/instrument-sans-400-italic.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 400;
  font-stretch: 100%;
  font-display: swap;
  src: url(/static/fonts/instrument-sans-400.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 500;
  font-stretch: 100%;
  font-display: swap;
  src: url(/static/fonts/instrument-sans-500.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 600;
  font-stretch: 100%;
  font-display: swap;
  src: url(/static/fonts/instrument-sans-600.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 700;
  font-stretch: 100%;
  font-display: swap;
  src: url(/static/fonts/instrument-sans-700.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Instrument Serif';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url(/static/fonts/instrument-serif-400-italic.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Instrument Serif';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/static/fonts/instrument-serif-400.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/static/fonts/jetbrains-mono-400.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/static/fonts/jetbrains-mono-500.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/static/fonts/jetbrains-mono-600.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* ═══════════════════════════════════════════════════════════════
   AffiliPro — Liquid Glass (H.Tech Evolve)
   Linguagem visual portada de fluxo-service/src/web/app.css + colors_and_type.css.
   Camada 1: tokens · Camada 2: componentes · Camada 3: overrides AffiliPro.
   Fundo lilás fixo (sem dark mode). Fontes/JS self-hosted (CDN proibido).
   ═══════════════════════════════════════════════════════════════ */

/* ── Camada 1 — Tokens ───────────────────────────────────────── */
:root {
  /* Brand */
  --ht-purple: #683DE6; --ht-purple-mid: #8A6BEE; --ht-purple-light: #EEE8FC;
  --ht-teal: #11E5D4; --ht-teal-light: #D5FAF6;
  --ht-ink: #150E22; --ht-dark: #1A1228;

  /* Surfaces (lilás claro) */
  --bg: #F4F1FA; --bg-deep: #ECE6F6; --bg-alt: #F8F6FC;
  --surface: #FFFFFF; --surface-2: #FAFAFB;
  --border: rgba(20,14,34,0.06); --border-strong: rgba(20,14,34,0.10);

  /* Foreground */
  --fg-strong: #1A1228; --fg: #463764; --fg-muted: #6E6585; --fg-faint: #B8B0C5;
  --accent: var(--ht-purple);
  --accent-wash: rgba(104,61,230,0.10);
  --chip-bg: rgba(104,61,230,0.08);
  --sidebar-bg: rgba(255,255,255,0.58);

  /* Status */
  --status-good: #1F9D63; --status-attention: #C26A12; --status-critical: #D23B2C; --status-neutral: #6B7280;

  /* Glass */
  --glass-thin: rgba(255,255,255,0.38);
  --glass-regular: rgba(255,255,255,0.60);
  --glass-thick: rgba(255,255,255,0.78);
  --glass-ultra: rgba(255,255,255,0.90);
  --glass-blur-thin: blur(20px) saturate(180%);
  --glass-blur-regular: blur(32px) saturate(200%) contrast(1.05);
  --glass-blur-thick: blur(48px) saturate(220%) contrast(1.08);
  --specular-top: linear-gradient(180deg, rgba(255,255,255,0.92) 0%, rgba(255,255,255,0) 60%);
  --specular-overlay: linear-gradient(135deg, rgba(255,255,255,0.22) 0%, rgba(255,255,255,0) 40%, rgba(255,255,255,0.04) 100%);

  /* Shadows (glass, com highlight interno) */
  --shadow-xs: inset 0 1px 0 rgba(255,255,255,0.7), 0 1px 2px rgba(20,14,34,0.04);
  --shadow-sm: inset 0 1px 0 rgba(255,255,255,0.75), 0 1px 3px rgba(20,14,34,0.06), 0 4px 12px -2px rgba(20,14,34,0.05);
  --shadow-md: inset 0 1px 0 rgba(255,255,255,0.8), 0 2px 4px rgba(20,14,34,0.04), 0 12px 28px -8px rgba(20,14,34,0.10);
  --shadow-lg: inset 0 1px 0 rgba(255,255,255,0.85), 0 4px 10px rgba(20,14,34,0.06), 0 24px 48px -12px rgba(20,14,34,0.16);
  --shadow-float: inset 0 1px 0 rgba(255,255,255,0.9), 0 0 0 0.5px rgba(20,14,34,0.06), 0 8px 24px -4px rgba(20,14,34,0.06), 0 32px 64px -16px rgba(104,61,230,0.18);

  --ht-gradient-bar: linear-gradient(90deg, #683DE6 0%, #11E5D4 100%);

  /* Tipografia (self-hosted) */
  --font-sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Instrument Sans", system-ui, sans-serif;
  --font-serif: "Instrument Serif", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Motion */
  --spring-smooth: cubic-bezier(0.32, 0.72, 0, 1);
  --spring-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-quick: 180ms; --dur-base: 320ms; --dur-slow: 620ms;

  /* Radius */
  --radius-window: 24px; --radius-panel: 20px; --radius-card: 18px; --radius-sm: 10px; --radius-pill: 9999px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--fg-strong);
  font-family: var(--font-sans);
  font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body { min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ── Camada 2 — Componentes ──────────────────────────────────── */

/* Ambient aurora */
.ambient-bg { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.ambient-bg::before, .ambient-bg::after {
  content: ""; position: absolute; border-radius: 50%;
  filter: blur(90px); opacity: 0.55; mix-blend-mode: screen;
  animation: ambient-drift 48s ease-in-out infinite alternate;
}
.ambient-bg::before { width: 720px; height: 720px; top: -160px; left: -120px; background: radial-gradient(circle, rgba(104,61,230,0.45), transparent 65%); }
.ambient-bg::after { width: 600px; height: 600px; bottom: -150px; right: -100px; background: radial-gradient(circle, rgba(17,229,212,0.36), transparent 65%); animation-direction: alternate-reverse; animation-duration: 60s; }
.ambient-bg .blob-3 { position: absolute; width: 480px; height: 480px; top: 42%; left: 52%; transform: translate(-50%,-50%); background: radial-gradient(circle, rgba(138,107,238,0.30), transparent 65%); border-radius: 50%; filter: blur(110px); mix-blend-mode: screen; opacity: 0.5; animation: ambient-drift 76s ease-in-out infinite; }
@keyframes ambient-drift { 0% { transform: translate(0,0) scale(1); } 50% { transform: translate(5vw,4vh) scale(1.07); } 100% { transform: translate(-4vw,3vh) scale(0.96); } }

/* App shell */
.app {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: 260px 1fr; gap: 12px;
  padding: 12px; min-height: 100vh;
  background-image:
    radial-gradient(800px 400px at 15% 0%, rgba(104,61,230,0.07), transparent 60%),
    radial-gradient(700px 400px at 85% 100%, rgba(17,229,212,0.06), transparent 60%);
}

/* Sidebar (glass flutuante) */
.sidebar {
  background: var(--sidebar-bg);
  backdrop-filter: var(--glass-blur-thick); -webkit-backdrop-filter: var(--glass-blur-thick);
  border-radius: var(--radius-panel);
  display: flex; flex-direction: column;
  position: sticky; top: 12px; height: calc(100vh - 24px);
  overflow: hidden; box-shadow: var(--shadow-float);
  border: 0.5px solid rgba(255,255,255,0.6);
}
.sidebar::before { content: ""; position: absolute; inset: 0; background: var(--specular-top); opacity: 0.5; pointer-events: none; border-radius: inherit; }
.sidebar-scroll { overflow-y: auto; flex: 1; padding-bottom: 8px; position: relative; }
.sidebar-brand { padding: 18px 20px 16px; position: relative; }
.sidebar-brand::after { content: ""; position: absolute; left: 20px; right: 20px; bottom: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--border-strong), transparent); }
.brand-row { display: flex; align-items: center; gap: 10px; }
.brand-logo { font-family: var(--font-display); font-weight: 600; font-size: 20px; letter-spacing: -0.02em; color: var(--fg-strong); display: inline-flex; align-items: baseline; line-height: 1; }
.brand-logo .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--ht-purple); display: inline-block; margin: 0 2px; transform: translateY(-2px); box-shadow: 0 0 12px rgba(104,61,230,0.6); animation: pulse-dot 2.4s var(--spring-smooth) infinite; }
@keyframes pulse-dot { 0%,100% { box-shadow: 0 0 12px rgba(104,61,230,0.6); } 50% { box-shadow: 0 0 20px rgba(104,61,230,0.9); } }
.brand-product { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--fg-muted); padding-left: 10px; border-left: 1px solid var(--border-strong); }

.nav-group { padding: 14px 10px 4px; }
.nav-group-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--fg-faint); padding: 0 10px 8px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin: 1px 0; border-radius: 10px; color: var(--fg); font-size: 13.5px; font-weight: 500; transition: color var(--dur-quick) var(--spring-smooth), transform var(--dur-quick) var(--spring-smooth), background var(--dur-quick) var(--spring-smooth); }
.nav-item:hover { color: var(--fg-strong); transform: translateX(2px); text-decoration: none; }
.nav-item.active { color: var(--fg-strong); background: var(--glass-ultra); box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), 0 4px 12px -2px rgba(104,61,230,0.18); }
.nav-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--fg-faint); transition: all var(--dur-base) var(--spring-smooth); flex-shrink: 0; }
.nav-item.active .nav-dot { background: var(--ht-purple); box-shadow: 0 0 0 3px rgba(104,61,230,0.15), 0 0 10px rgba(104,61,230,0.5); }
.sidebar-footer { padding: 12px 20px; border-top: 1px solid var(--border); font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; color: var(--fg-faint); }

/* Main column + topbar */
.main-col { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.topbar {
  height: 52px; border-radius: 999px;
  background: var(--glass-regular);
  backdrop-filter: var(--glass-blur-regular); -webkit-backdrop-filter: var(--glass-blur-regular);
  border: 0.5px solid rgba(255,255,255,0.55);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 10px 0 18px; position: sticky; top: 12px; z-index: 20;
  box-shadow: var(--shadow-sm);
}
.crumbs { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--fg-muted); min-width: 0; }
.crumbs strong { color: var(--fg-strong); font-weight: 600; font-family: var(--font-display); letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs .sep { opacity: 0.4; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.hamburger { display: none; height: 34px; width: 38px; padding: 0; justify-content: center; font-size: 18px; }

/* User menu */
.user-menu { position: relative; }
.user-avatar-btn { width: 32px; height: 32px; border-radius: 50%; border: 0.5px solid rgba(255,255,255,0.5); background: var(--glass-thick); color: var(--fg-strong); font-weight: 600; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; box-shadow: var(--shadow-xs); }
.user-menu-pop { position: absolute; right: 0; top: 40px; min-width: 160px; background: var(--glass-ultra); backdrop-filter: var(--glass-blur-thick); -webkit-backdrop-filter: var(--glass-blur-thick); border: 0.5px solid rgba(255,255,255,0.6); border-radius: 12px; box-shadow: var(--shadow-md); padding: 6px; z-index: 40; }
.user-menu-pop form { margin: 0; }
.user-menu-item { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: transparent; border-radius: 8px; color: var(--fg); font-size: 13px; cursor: pointer; }
.user-menu-item:hover { background: var(--accent-wash); }
.user-menu-item.danger { color: var(--status-critical); }

/* Main content panel */
.main { min-width: 0; background: var(--surface); border-radius: var(--radius-panel); border: 0.5px solid var(--border); box-shadow: var(--shadow-sm); padding: 28px 32px 48px; position: relative; overflow: hidden; animation: page-enter var(--dur-slow) var(--spring-smooth); }
.main::before { content: ""; position: absolute; inset: 0; background: var(--specular-overlay); opacity: 0.5; pointer-events: none; }
.main > * { position: relative; }
@keyframes page-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Page header */
.page-eyebrow { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.page-title { font-family: var(--font-serif); font-style: italic; font-weight: 400; font-size: 38px; line-height: 1.05; letter-spacing: -0.01em; color: var(--fg-strong); margin: 0 0 6px; }
.page-sub { font-size: 14px; color: var(--fg-muted); margin: 0 0 24px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 999px; border: 0.5px solid rgba(255,255,255,0.5); background: var(--glass-regular); backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%); color: var(--fg-strong); font-size: 13px; font-weight: 500; cursor: pointer; box-shadow: var(--shadow-xs); text-decoration: none; transition: transform var(--dur-quick) var(--spring-smooth), box-shadow var(--dur-quick) var(--spring-smooth), background var(--dur-quick) var(--spring-smooth); }
.btn:hover { background: var(--glass-thick); box-shadow: var(--shadow-sm); transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0) scale(0.97); }
.btn.primary { background: linear-gradient(180deg, #7A4FF0 0%, #5E32DE 100%); color: #fff; border-color: rgba(255,255,255,0.2); box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 2px 4px rgba(104,61,230,0.2), 0 8px 20px -4px rgba(104,61,230,0.4); }
.btn.primary:hover { background: linear-gradient(180deg, #8A62F2 0%, #6E42E6 100%); }
.btn.ghost { background: transparent; border-color: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: none; }
.btn.ghost:hover { background: var(--glass-thin); border-color: rgba(255,255,255,0.3); }
.btn.touch { min-height: 44px; padding: 0 16px; }
.btn:disabled, .btn[disabled] { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.btn .spinner { display: none; width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; }
.btn.htmx-request .spinner { display: inline-block; animation: spin 0.8s linear infinite; }
.subtab .spinner { display: none; width: 11px; height: 11px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; margin-left: 6px; vertical-align: -1px; }
.subtab.htmx-request .spinner { display: inline-block; animation: spin 0.8s linear infinite; }
.app-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(16px); max-width: 90vw; padding: 12px 18px; border-radius: 12px; background: var(--status-critical); color: #fff; font-size: 13px; font-weight: 600; box-shadow: 0 10px 30px rgba(20,14,34,0.28); opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; z-index: 1000; }
.app-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@keyframes spin { to { transform: rotate(360deg); } }

/* Cards */
.card { position: relative; background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--radius-card); padding: 20px; box-shadow: var(--shadow-sm); overflow: hidden; transition: box-shadow var(--dur-base) var(--spring-smooth), transform var(--dur-base) var(--spring-smooth); }
.card::before { content: ""; position: absolute; inset: 0; background: var(--specular-top); opacity: 0.35; pointer-events: none; border-radius: inherit; }
.card > * { position: relative; }
.card.padded-lg { padding: 28px; }
.card.tight { padding: 16px; }
.card.accent-on { border-color: var(--accent); background: var(--accent-wash); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent), var(--shadow-sm); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-title { font-family: var(--font-display); font-weight: 600; font-size: 14px; letter-spacing: -0.01em; color: var(--fg-strong); margin: 0; }
.card-sub { font-size: 12.5px; color: var(--fg-muted); margin-top: 2px; }
.card-link { font-size: 12.5px; color: var(--accent); font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }

/* KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.kpi-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.kpi-card { position: relative; background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--radius-card); padding: 18px 20px; box-shadow: var(--shadow-sm); overflow: hidden; transition: box-shadow var(--dur-base) var(--spring-smooth), transform var(--dur-base) var(--spring-smooth); }
.kpi-card::before { content: ""; position: absolute; inset: 0; background: var(--specular-top); opacity: 0.4; pointer-events: none; border-radius: inherit; }
.kpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.kpi-card > * { position: relative; z-index: 1; }
.kpi-label { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--fg-muted); margin-bottom: 10px; }
.kpi-value { font-family: var(--font-serif); font-weight: 400; font-size: 38px; letter-spacing: -0.02em; line-height: 1; color: var(--fg-strong); font-variant-numeric: tabular-nums; }
.kpi-foot { margin-top: 10px; font-size: 12px; color: var(--fg-muted); }

/* Chips / pills */
.chip { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.06em; padding: 3px 9px; border-radius: 8px; background: var(--chip-bg); color: var(--ht-purple); text-transform: uppercase; border: 0.5px solid rgba(104,61,230,0.15); white-space: nowrap; box-shadow: inset 0 1px 0 rgba(255,255,255,0.4); }
.chip.sm { font-size: 9.5px; padding: 2px 7px; }
.chip.good { background: rgba(31,157,99,0.12); color: var(--status-good); border-color: rgba(31,157,99,0.25); }
.chip.warn { background: rgba(194,106,18,0.12); color: var(--status-attention); border-color: rgba(194,106,18,0.25); }
.chip.bad { background: rgba(210,59,44,0.10); color: var(--status-critical); border-color: rgba(210,59,44,0.22); }
.chip.info { background: rgba(104,61,230,0.10); color: var(--accent); border-color: rgba(104,61,230,0.18); }
.chip.teal { background: rgba(17,229,212,0.14); color: #0C7D74; border-color: rgba(17,229,212,0.28); }
.chip.neutral { background: var(--bg-alt); color: var(--fg-muted); border-color: var(--border-strong); }
/* Barra de filtro de grupos: checkbox real (teclado/leitor de tela) vestido de chip */
.filter-chip { cursor: pointer; position: relative; user-select: none; background: var(--bg-alt); color: var(--fg-muted); border-color: var(--border-strong); }
.filter-chip input[type="checkbox"] { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.filter-chip:hover { color: var(--fg-strong); }
.filter-chip:has(input:checked) { background: rgba(104,61,230,0.10); color: var(--accent); border-color: rgba(104,61,230,0.18); }
.filter-chip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
#group-filters input[type="search"] { width: auto; flex: 1 1 180px; max-width: 260px; padding: 7px 10px; }
.dot-mark { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* Tables */
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data thead th { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--fg-muted); text-align: left; padding: 12px 14px 10px; border-bottom: 1px solid var(--border-strong); font-weight: 500; }
table.data tbody td { padding: 12px 14px; border-bottom: 0.5px solid var(--border); color: var(--fg); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background var(--dur-quick) var(--spring-smooth); }
table.data tbody tr:hover { background: var(--accent-wash); }
table.data td.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
table.data td.strong, .text-strong { color: var(--fg-strong); font-weight: 500; }
td.empty, .empty { padding: 20px 8px; text-align: center; color: var(--fg-muted); font-style: italic; }
li.empty { display: block; }

/* Subtabs (glass pill group) */
.subtabs { position: relative; display: inline-flex; gap: 2px; padding: 3px; background: var(--glass-thin); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 0.5px solid rgba(255,255,255,0.5); border-radius: 12px; margin-bottom: 18px; box-shadow: var(--shadow-xs); flex-wrap: wrap; }
.subtab { position: relative; padding: 7px 14px; border-radius: 9px; font-size: 13px; font-weight: 500; color: var(--fg-muted); cursor: pointer; border: none; background: transparent; transition: color var(--dur-quick) var(--spring-smooth); }
.subtab.active { background: var(--glass-ultra); color: var(--fg-strong); box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), 0 1px 2px rgba(20,14,34,0.05); }
.subtab:hover:not(.active) { color: var(--fg-strong); }

/* Alerts */
.alert { position: relative; display: flex; gap: 14px; padding: 14px 18px; border-radius: var(--radius-card); border: 0.5px solid var(--border); background: var(--surface); align-items: flex-start; margin-bottom: 10px; overflow: hidden; box-shadow: var(--shadow-sm); }
.alert::before { content: ""; position: absolute; inset: 0; background: var(--specular-top); opacity: 0.3; pointer-events: none; }
.alert > * { position: relative; }
.alert.good { background: color-mix(in srgb, var(--status-good) 7%, var(--surface)); border-color: color-mix(in srgb, var(--status-good) 22%, var(--border)); }
.alert.bad { background: color-mix(in srgb, var(--status-critical) 7%, var(--surface)); border-color: color-mix(in srgb, var(--status-critical) 22%, var(--border)); }
.alert.warn { background: color-mix(in srgb, var(--status-attention) 8%, var(--surface)); border-color: color-mix(in srgb, var(--status-attention) 24%, var(--border)); }
.alert.info { background: color-mix(in srgb, var(--accent) 7%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 20%, var(--border)); }
.alert-title { font-weight: 600; color: var(--fg-strong); font-size: 14px; margin-bottom: 3px; display: flex; align-items: center; gap: 8px; }
.alert-desc { font-size: 12.5px; color: var(--fg-muted); line-height: 1.5; }
.alert-square { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.alert.good .alert-square { background: var(--status-good); }
.alert.bad .alert-square { background: var(--status-critical); }
.alert.warn .alert-square { background: var(--status-attention); }
.alert.info .alert-square { background: var(--accent); }
.alert-count { font-family: var(--font-mono); font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 99px; color: #fff; }
.alert.good .alert-count { background: var(--status-good); }
.alert.bad .alert-count { background: var(--status-critical); }

/* Progress bars */
.progress { height: 6px; border-radius: 99px; background: rgba(104,61,230,0.10); overflow: hidden; position: relative; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: var(--status-good); transition: width var(--dur-slow) var(--spring-smooth); }
.progress.warn > span { background: var(--status-attention); }
.progress.bad > span { background: var(--status-critical); }
.progress.brand > span { background: var(--ht-gradient-bar); }

/* Layouts */
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.lg { gap: 20px; }

/* Stream card (linha de lista) */
.stream-card { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--radius-card); padding: 14px 16px; box-shadow: var(--shadow-xs); margin-bottom: 10px; }

/* Inputs / fields (glass) */
.field { display: block; margin-bottom: 14px; }
.field-label, label.field-label { display: block; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-muted); margin-bottom: 6px; }
.field-hint { font-size: 12.5px; color: var(--fg-muted); margin-top: 4px; }
input, textarea, select { width: 100%; font-family: var(--font-sans); font-size: 14px; color: var(--fg-strong); background: var(--surface); border: 0.5px solid var(--border-strong); border-radius: var(--radius-sm); padding: 10px 12px; box-shadow: var(--shadow-xs); transition: border-color var(--dur-quick) var(--spring-smooth), box-shadow var(--dur-quick) var(--spring-smooth); }
input::placeholder, textarea::placeholder { color: var(--fg-faint); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
textarea { min-height: 120px; resize: vertical; }
input[type="checkbox"] { width: auto; box-shadow: none; accent-color: var(--accent); }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--fg); background: var(--bg-alt); border: 0.5px solid var(--border); border-radius: 99px; padding: 6px 12px; cursor: pointer; text-transform: none; letter-spacing: 0; font-family: var(--font-sans); }

/* Forms wrapper */
form.card-form { background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--radius-card); padding: 20px; box-shadow: var(--shadow-sm); margin-bottom: 16px; }

/* QR */
.qr-frame { background: #fff; padding: 14px; border-radius: var(--radius-sm); display: inline-block; box-shadow: var(--shadow-xs); }
.qr-frame img { display: block; max-width: 240px; width: 100%; }
.qr-steps { margin: 14px 0 4px; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.qr-steps li { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--fg); }

/* WhatsApp bubble (preview) */
.wa-preview { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.wa-bubble { position: relative; max-width: 380px; background: #F0FBF4; border: 0.5px solid rgba(31,157,99,0.18); border-radius: 14px 14px 14px 4px; padding: 12px 14px; font-family: var(--font-sans); font-size: 14px; line-height: 1.5; color: var(--fg-strong); white-space: pre-wrap; box-shadow: var(--shadow-xs); }

/* Copy-link */
.copy-link { display: inline-flex; gap: 6px; align-items: center; }
.copy-link code, .mono { font-family: var(--font-mono); }
.copy-link code { font-size: 12px; color: var(--fg-muted); background: var(--bg-alt); padding: 2px 6px; border-radius: 6px; }

/* Utilities */
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.text-bad { color: var(--status-critical); }
.text-muted { color: var(--fg-muted); }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }

/* ── Camada 3 — Overrides AffiliPro (responsivo + modos) ─────── */

/* Flat mode — remove vidro */
[data-material="flat"] .sidebar, [data-material="flat"] .topbar, [data-material="flat"] .btn, [data-material="flat"] .subtabs, [data-material="flat"] .user-avatar-btn, [data-material="flat"] .user-menu-pop {
  backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
}
[data-material="flat"] .sidebar, [data-material="flat"] .topbar { background: var(--surface); }
[data-material="flat"] .ambient-bg { display: none; }

/* Reduced motion (toggle manual) */
[data-motion="reduced"] *, [data-motion="reduced"] *::before, [data-motion="reduced"] *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 80ms !important; }
[data-motion="reduced"] .ambient-bg::before, [data-motion="reduced"] .ambient-bg::after, [data-motion="reduced"] .ambient-bg .blob-3 { animation: none !important; }

/* Mobile (≤860px): drawer + flat + 1 coluna — defesa de perf no PRIMEIRO paint, sem JS */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; padding: 8px; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 264px; height: 100vh; border-radius: 0 var(--radius-panel) var(--radius-panel) 0; transform: translateX(-100%); transition: transform var(--dur-base) var(--spring-smooth); z-index: 60; }
  .sidebar.open { transform: none; }
  .drawer-overlay { position: fixed; inset: 0; background: rgba(20,14,34,0.4); z-index: 55; opacity: 0; pointer-events: none; transition: opacity var(--dur-base) ease; }
  .drawer-overlay.open { opacity: 1; pointer-events: auto; }
  .hamburger { display: inline-flex; }
  .main { padding: 20px 16px 36px; }
  .kpi-grid, .kpi-grid.cols-3, .kpi-grid.cols-2, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  /* desliga vidro/aurora no mobile (perf) já no 1º paint */
  .sidebar, .topbar, .btn, .subtabs, .user-avatar-btn, .user-menu-pop { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
  .topbar { background: var(--surface-2); }
  .ambient-bg { display: none; }
  /* table → cards empilhados */
  table.data thead { display: none; }
  table.data tbody tr { display: block; border: 0.5px solid var(--border); border-radius: var(--radius-card); padding: 10px 12px; margin-bottom: 10px; box-shadow: var(--shadow-xs); }
  table.data tbody td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 6px 0; }
  table.data tbody td::before { content: attr(data-label); font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-muted); }
}
@media (min-width: 861px) { .hamburger { display: none; } .drawer-overlay { display: none; } }

/* A11y — respeita preferências do SO */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 80ms !important; }
  .ambient-bg::before, .ambient-bg::after, .ambient-bg .blob-3 { animation: none !important; }
}
@media (prefers-reduced-transparency: reduce) {
  .sidebar, .topbar, .btn, .subtabs, .user-avatar-btn, .user-menu-pop { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
  .sidebar, .topbar { background: var(--surface); }
  .ambient-bg { display: none; }
}

/* Alpine: evita flash de elementos x-show antes do JS subir */
[x-cloak] { display: none !important; }

/* Telas de autenticação (fora do shell) */
.auth-wrap { position: relative; z-index: 1; min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card .brand-row { justify-content: center; margin-bottom: 8px; }
.auth-card .page-title { text-align: center; font-size: 30px; margin-bottom: 18px; }
.auth-foot { text-align: center; margin-top: 16px; color: var(--fg-muted); font-size: 13px; }
.btn.block { width: 100%; justify-content: center; height: 42px; }

/* Tour guiado de primeiro acesso */
.tour-blocker { position: fixed; inset: 0; z-index: 1000; }
.tour-blocker.dim { background: rgba(20,14,34,0.55); }
.tour-spotlight { position: fixed; z-index: 1001; border-radius: 12px; pointer-events: none; box-shadow: 0 0 0 9999px rgba(20,14,34,0.55), 0 0 0 2px var(--accent), 0 0 24px rgba(104,61,230,0.5); transition: top .25s var(--spring-smooth), left .25s var(--spring-smooth), width .25s var(--spring-smooth), height .25s var(--spring-smooth); }
.tour-card { position: fixed; z-index: 1002; left: 50%; bottom: 28px; transform: translateX(-50%); width: calc(100% - 32px); max-width: 380px; background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow-lg); padding: 18px 20px; }
.tour-card.center { top: 50%; bottom: auto; transform: translate(-50%, -50%); }
.tour-step { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--fg-muted); margin-bottom: 6px; }
.tour-card h4 { margin: 0 0 6px; font-size: 16px; color: var(--fg-strong); font-family: var(--font-display); }
.tour-card p { margin: 0 0 14px; font-size: 13.5px; color: var(--fg-muted); line-height: 1.5; }
.tour-actions { display: flex; justify-content: space-between; gap: 8px; }
