/* =========================================================================
   SEOData — Design System v2
   Tokens · layout (sidebar recolhível + topbar glass) · componentes · temas
   ========================================================================= */

/* ------------------------------------------------------------ tokens */
:root {
  color-scheme: light;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #f4f6fb;
  --bg-glow-1: rgba(99, 102, 241, .10);
  --bg-glow-2: rgba(6, 182, 212, .08);
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f4f9;
  --surface-glass: rgba(255, 255, 255, .72);
  --border: #e7eaf1;
  --border-strong: #d6dbe6;
  --text: #0f172a;
  --text-2: #4b5768;
  --muted: #8592a6;

  --primary: #6366f1;
  --primary-2: #8b5cf6;
  --primary-600: #4f46e5;
  --primary-ink: #4338ca;
  --primary-soft: #eef0ff;
  --primary-glow: rgba(99, 102, 241, .35);
  --accent: #06b6d4;

  --success: #10b981; --success-soft: #ecfdf5; --success-ink: #047857;
  --warning: #f59e0b; --warning-soft: #fffbeb; --warning-ink: #b45309;
  --danger:  #ef4444; --danger-soft:  #fef2f2; --danger-ink:  #b91c1c;
  --info:    #0ea5e9; --info-soft:    #f0f9ff; --info-ink:    #0369a1;
  --neutral-soft: #eef1f6; --neutral-ink: #3f4b5d;

  --sidebar-bg: #0b1020;
  --sidebar-bg-2: #0e1530;
  --sidebar-text: #c7cfe0;
  --sidebar-muted: #6b7691;
  --sidebar-border: rgba(255, 255, 255, .07);
  --sidebar-hover: rgba(255, 255, 255, .05);
  --sidebar-active: linear-gradient(90deg, rgba(99, 102, 241, .28), rgba(99, 102, 241, .06));

  --radius-lg: 18px;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 7px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 2px 6px rgba(16, 24, 40, .05), 0 12px 32px -20px rgba(16, 24, 40, .25);
  --shadow-lg: 0 24px 60px -24px rgba(16, 24, 40, .35), 0 8px 24px -12px rgba(16, 24, 40, .2);
  --ring: 0 0 0 3px rgba(99, 102, 241, .22);

  --sidebar-w: 268px;
  --sidebar-w-collapsed: 78px;
  --topbar-h: 64px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #090d18;
  --bg-glow-1: rgba(99, 102, 241, .14);
  --bg-glow-2: rgba(6, 182, 212, .07);
  --surface: #111729;
  --surface-2: #151c31;
  --surface-3: #1a2239;
  --surface-glass: rgba(17, 23, 41, .72);
  --border: #1e2740;
  --border-strong: #2a3554;
  --text: #e7ebf5;
  --text-2: #a5afc4;
  --muted: #6f7b95;

  --primary: #818cf8;
  --primary-2: #a78bfa;
  --primary-600: #6366f1;
  --primary-ink: #c7d2fe;
  --primary-soft: rgba(129, 140, 248, .14);
  --primary-glow: rgba(129, 140, 248, .35);

  --success: #34d399; --success-soft: rgba(52, 211, 153, .14); --success-ink: #a7f3d0;
  --warning: #fbbf24; --warning-soft: rgba(251, 191, 36, .14);  --warning-ink: #fde68a;
  --danger:  #f87171; --danger-soft:  rgba(248, 113, 113, .14); --danger-ink:  #fecaca;
  --info:    #38bdf8; --info-soft:    rgba(56, 189, 248, .14);  --info-ink:    #bae6fd;
  --neutral-soft: rgba(148, 163, 184, .14); --neutral-ink: #cbd5e1;

  --sidebar-bg: #070b15;
  --sidebar-bg-2: #0a1020;
  --shadow-xs: none;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 12px 32px -20px rgba(0, 0, 0, .6);
  --shadow-lg: 0 24px 60px -24px rgba(0, 0, 0, .8);
  --ring: 0 0 0 3px rgba(129, 140, 248, .3);
}

/* ------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); color: var(--text); line-height: 1.5;
  background: var(--bg);
  background-image: radial-gradient(900px 480px at 8% -10%, var(--bg-glow-1), transparent 60%), radial-gradient(700px 400px at 100% 0%, var(--bg-glow-2), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  transition: background-color .25s var(--ease), color .25s var(--ease);
}
a { color: var(--primary-ink); text-decoration: none; }
[data-theme="dark"] a { color: var(--primary); }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.015em; line-height: 1.25; }
h1 { font-size: 1.55rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
code, pre { font-family: var(--mono); font-size: .84em; }
pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .8rem 1rem; overflow: auto; }
code.inline { background: var(--surface-3); border: 1px solid var(--border); padding: .1em .45em; border-radius: 6px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.1rem 0; }
::selection { background: rgba(99, 102, 241, .25); }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }

.muted { color: var(--muted); } .text-2 { color: var(--text-2); }
.small { font-size: .82rem; } .mono { font-family: var(--mono); font-size: .84em; }
.nowrap { white-space: nowrap; } .truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; display: block; }
[hidden] { display: none !important; } /* o atributo hidden vence display de classes (.btn, .badge, flex/grid) */
.text-right { text-align: right; } .text-center { text-align: center; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; } .mb-2 { margin-bottom: 1rem; }
.flex { display: flex; gap: .5rem; align-items: center; } .flex-wrap { flex-wrap: wrap; } .between { justify-content: space-between; } .grow { flex: 1; }
.stack { display: flex; flex-direction: column; gap: .5rem; }
.tabular { font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ------------------------------------------------------------ layout */
#progress-bar { position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 1000; opacity: 0; transition: width .3s var(--ease), opacity .3s;
  background: linear-gradient(90deg, var(--primary), var(--primary-2), var(--accent)); box-shadow: 0 0 12px var(--primary-glow); }
#progress-bar.active { opacity: 1; }

.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); position: fixed; inset: 0 auto 0 0; z-index: 50; display: flex; flex-direction: column;
  color: var(--sidebar-text); background: linear-gradient(180deg, var(--sidebar-bg-2) 0%, var(--sidebar-bg) 40%);
  border-right: 1px solid var(--sidebar-border);
  transition: width .22s var(--ease), transform .22s var(--ease);
  overflow: hidden;
}
.sidebar::after { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(420px 260px at -10% -10%, rgba(99, 102, 241, .28), transparent 70%); }
.sidebar > * { position: relative; z-index: 1; }
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; transition: margin-left .22s var(--ease); }
body.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
body.sidebar-collapsed .main { margin-left: var(--sidebar-w-collapsed); }

.topbar {
  height: var(--topbar-h); position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: .75rem; padding: 0 1.5rem;
  background: var(--surface-glass); backdrop-filter: blur(14px) saturate(160%); -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid var(--border);
}
.topbar-title { font-weight: 650; font-size: 1.02rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -.01em; display: flex; align-items: center; gap: .5rem; }
.topbar-title .crumb { color: var(--muted); font-weight: 500; font-size: .9rem; }
.topbar-title .sep { color: var(--border-strong); font-weight: 400; }
.topbar-title .current { overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: .6rem; }
#sidebar-toggle { display: none; }
.content { padding: 1.6rem 1.75rem 3rem; max-width: 1520px; width: 100%; animation: page-in .28s var(--ease); }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (max-width: 980px) {
  .sidebar { transform: translateX(-100%); width: var(--sidebar-w) !important; }
  body.sidebar-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(2, 6, 23, .55); }
  .main { margin-left: 0 !important; }
  #sidebar-toggle { display: inline-flex; }
  .content { padding: 1rem; }
  .topbar { padding: 0 1rem; }
  .sidebar-collapse-btn, .search-trigger .kbd { display: none !important; }
}

/* ------------------------------------------------------------ sidebar */
.sidebar-brand { padding: 1.05rem 1.1rem; display: flex; align-items: center; gap: .7rem; border-bottom: 1px solid var(--sidebar-border); min-height: var(--topbar-h); }
.sidebar-brand a { color: #fff; font-weight: 700; display: flex; align-items: center; gap: .7rem; text-decoration: none; font-size: .9rem; letter-spacing: -.01em; white-space: nowrap; min-width: 0; flex: 1; }
.sidebar-brand .brand-text { min-width: 0; }
.sidebar-brand .brand-text > span { display: block; overflow: hidden; text-overflow: ellipsis; }
.sidebar-brand .logo { width: 36px; height: 36px; flex: none; border-radius: 11px; display: grid; place-items: center; font-size: .72rem; letter-spacing: .06em;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 55%, #22d3ee 130%); box-shadow: 0 8px 20px -8px rgba(99, 102, 241, .8), inset 0 1px 0 rgba(255, 255, 255, .25); }
.sidebar-brand .brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.sidebar-brand .brand-text small { font-weight: 500; color: var(--sidebar-muted); font-size: .7rem; letter-spacing: .04em; text-transform: uppercase; }
.sidebar-collapse-btn { margin-left: auto; background: var(--sidebar-hover); border: 1px solid var(--sidebar-border); color: var(--sidebar-text); width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; cursor: pointer; flex: none; transition: background .15s; }
.sidebar-collapse-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.sidebar-collapse-btn svg { width: 16px; height: 16px; transition: transform .22s var(--ease); }
body.sidebar-collapsed .sidebar-collapse-btn svg { transform: rotate(180deg); }

.project-switcher { padding: .9rem .9rem .3rem; }
.project-switcher summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: .65rem; padding: .55rem .65rem; border-radius: 12px;
  background: rgba(255, 255, 255, .04); border: 1px solid var(--sidebar-border); transition: background .15s, border-color .15s; }
.project-switcher summary::-webkit-details-marker { display: none; }
.project-switcher summary:hover { background: rgba(255, 255, 255, .07); border-color: rgba(255, 255, 255, .12); }
.project-switcher .pj-avatar { width: 30px; height: 30px; flex: none; border-radius: 9px; display: grid; place-items: center; font-weight: 700; font-size: .72rem; color: #fff;
  background: linear-gradient(135deg, var(--pj-c1, #6366f1), var(--pj-c2, #22d3ee)); }
.project-switcher .pj-text { min-width: 0; flex: 1; line-height: 1.2; }
.project-switcher .pj-text small { display: block; color: var(--sidebar-muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; }
.project-switcher .pj-text b { display: block; color: #fff; font-weight: 600; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-switcher .pj-chevron { width: 16px; height: 16px; color: var(--sidebar-muted); flex: none; }
.project-switcher .pj-menu { margin-top: .4rem; background: #0f1630; border: 1px solid rgba(255, 255, 255, .1); border-radius: 12px; padding: .35rem; max-height: 280px; overflow-y: auto; box-shadow: var(--shadow-lg); }
.project-switcher .pj-menu a { display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem; border-radius: 8px; color: var(--sidebar-text); font-size: .86rem; text-decoration: none; }
.project-switcher .pj-menu a:hover, .project-switcher .pj-menu a.current { background: rgba(255, 255, 255, .07); color: #fff; }
.project-switcher .pj-menu a .pj-avatar { width: 24px; height: 24px; font-size: .62rem; border-radius: 7px; }
.project-switcher .pj-menu .pj-new { border-top: 1px solid var(--sidebar-border); margin-top: .3rem; padding-top: .45rem; color: var(--primary); }

.nav { padding: .4rem .7rem 1rem; flex: 1; overflow-y: auto; overflow-x: hidden; }
.nav-section { font-size: .66rem; text-transform: uppercase; letter-spacing: .1em; color: var(--sidebar-muted); padding: 1rem .7rem .4rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav a { position: relative; display: flex; align-items: center; gap: .7rem; padding: .58rem .7rem; margin-bottom: 2px; border-radius: 10px; color: var(--sidebar-text); font-size: .9rem; font-weight: 500; text-decoration: none; white-space: nowrap; transition: background .15s, color .15s; }
.nav a:hover { background: var(--sidebar-hover); color: #fff; }
.nav a.active { background: var(--sidebar-active); color: #fff; }
.nav a.active::before { content: ''; position: absolute; left: -.7rem; top: 20%; bottom: 20%; width: 3px; border-radius: 0 3px 3px 0; background: linear-gradient(180deg, var(--primary), var(--accent)); box-shadow: 0 0 12px var(--primary-glow); }
.nav a i, .nav a svg { width: 18px; height: 18px; flex: none; opacity: .8; transition: opacity .15s; }
.nav a:hover svg, .nav a.active svg { opacity: 1; }
.nav a .label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav a .count { margin-left: auto; background: rgba(255, 255, 255, .08); border-radius: 999px; padding: 0 .5rem; font-size: .7rem; font-weight: 600; }
.sidebar-footer { padding: .75rem .9rem; border-top: 1px solid var(--sidebar-border); display: flex; align-items: center; gap: .6rem; font-size: .8rem; white-space: nowrap; }
.sidebar-footer .avatar { width: 32px; height: 32px; font-size: .72rem; flex: none; }
.sidebar-footer .who { min-width: 0; flex: 1; line-height: 1.2; }
.sidebar-footer .who b { display: block; color: #fff; overflow: hidden; text-overflow: ellipsis; }
.sidebar-footer .who span { color: var(--sidebar-muted); font-size: .72rem; overflow: hidden; text-overflow: ellipsis; display: block; }
.sidebar-footer form button { background: none; border: 0; color: var(--sidebar-muted); cursor: pointer; padding: .35rem; border-radius: 8px; display: grid; place-items: center; }
.sidebar-footer form button:hover { color: #fff; background: var(--sidebar-hover); }
.sidebar-footer form button svg { width: 16px; height: 16px; }

/* recolhida */
body.sidebar-collapsed .sidebar-brand .brand-text, body.sidebar-collapsed .nav a .label, body.sidebar-collapsed .nav a .count,
body.sidebar-collapsed .project-switcher .pj-text, body.sidebar-collapsed .project-switcher .pj-chevron,
body.sidebar-collapsed .sidebar-footer .who, body.sidebar-collapsed .sidebar-footer form { display: none; }
body.sidebar-collapsed .sidebar-brand { justify-content: center; padding-left: .6rem; padding-right: .6rem; flex-direction: column; gap: .5rem; min-height: auto; }
body.sidebar-collapsed .sidebar-collapse-btn { margin: 0; }
body.sidebar-collapsed .nav-section { text-align: center; font-size: 0; padding: .6rem 0 .2rem; border-top: 1px solid var(--sidebar-border); margin-top: .4rem; }
body.sidebar-collapsed .nav a { justify-content: center; padding: .62rem 0; }
body.sidebar-collapsed .nav a.active::before { left: 0; }
body.sidebar-collapsed .project-switcher { padding: .7rem .6rem .2rem; }
body.sidebar-collapsed .project-switcher summary { justify-content: center; padding: .45rem; }
body.sidebar-collapsed .sidebar-footer { justify-content: center; }
body.sidebar-collapsed [data-tip] { position: relative; }
body.sidebar-collapsed [data-tip]:hover::after { content: attr(data-tip); position: absolute; left: calc(100% + 14px); top: 50%; transform: translateY(-50%); background: #0f172a; color: #fff; font-size: .78rem; font-weight: 500; padding: .35rem .6rem; border-radius: 7px; white-space: nowrap; z-index: 80; box-shadow: var(--shadow-lg); border: 1px solid rgba(255, 255, 255, .1); }

/* ------------------------------------------------------------ topbar widgets */
.search-trigger { display: inline-flex; align-items: center; gap: .55rem; padding: .45rem .75rem; min-width: 240px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); font: inherit; font-size: .85rem; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.search-trigger:hover { border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.search-trigger svg { width: 15px; height: 15px; }
.search-trigger .kbd { margin-left: auto; }
.kbd { display: inline-block; padding: 0 .4rem; border-radius: 5px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); font-family: var(--mono); font-size: .68rem; line-height: 1.5; }
@media (max-width: 720px) { .search-trigger { min-width: 0; } .search-trigger span:not(.kbd) { display: none; } }

.theme-switch { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface-3); border: 1px solid var(--border); gap: 2px; }
.theme-switch button { border: 0; background: transparent; color: var(--muted); width: 30px; height: 28px; border-radius: 8px; display: grid; place-items: center; cursor: pointer; transition: background .15s, color .15s, box-shadow .15s; }
.theme-switch button svg { width: 15px; height: 15px; }
.theme-switch button:hover { color: var(--text); }
.theme-switch button.active { background: var(--surface); color: var(--primary-ink); box-shadow: var(--shadow-xs); }
[data-theme="dark"] .theme-switch button.active { color: var(--primary); }

.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .78rem; color: #fff; letter-spacing: .02em;
  background: linear-gradient(135deg, var(--primary), var(--primary-2)); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--border-strong); }
.avatar.soft { background: var(--primary-soft); color: var(--primary-ink); box-shadow: none; }

/* ------------------------------------------------------------ page header */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.35rem; flex-wrap: wrap; }
.page-header .page-title { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.page-header .page-sub { color: var(--text-2); font-size: .9rem; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.breadcrumb { display: flex; gap: .4rem; font-size: .78rem; color: var(--muted); flex-wrap: wrap; align-items: center; }
.breadcrumb a { color: var(--text-2); font-weight: 500; }
.breadcrumb span:not(:last-child):not(a) { opacity: .6; }

/* ------------------------------------------------------------ cards & grid */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); position: relative; }
.card.hoverable { transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s; }
.card.hoverable:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .95rem 1.2rem; border-bottom: 1px solid var(--border); }
.card-title { font-size: .95rem; font-weight: 650; display: flex; align-items: center; gap: .5rem; }
.card-title svg { width: 16px; height: 16px; color: var(--muted); }
.card-body { padding: 1.2rem; }
.card-body.flush { padding: 0; }
.grid { display: grid; gap: 1.1rem; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
@media (max-width: 1200px) { .cols-4 { grid-template-columns: repeat(2, 1fr); } .cols-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px) { .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr; } .span-2 { grid-column: auto; } }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1.1rem; margin-bottom: 1.35rem; }
.kpi { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.05rem 1.15rem 1rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .2rem; min-height: 112px; transition: transform .18s var(--ease), box-shadow .18s var(--ease); }
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.kpi-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.kpi-value { font-size: 1.75rem; font-weight: 700; letter-spacing: -.03em; margin-top: .15rem; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi-sub { font-size: .8rem; color: var(--text-2); margin-top: .2rem; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.kpi .kpi-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-ink); flex: none; }
[data-theme="dark"] .kpi .kpi-icon { color: var(--primary); }
.kpi .kpi-icon svg { width: 15px; height: 15px; }
.kpi.accent { border-color: transparent; background: linear-gradient(135deg, #6366f1 0%, #7c3aed 60%, #6d28d9 100%); color: #fff; box-shadow: 0 16px 36px -18px rgba(99, 102, 241, .8); }
.kpi.accent .kpi-label, .kpi.accent .kpi-sub { color: rgba(255, 255, 255, .78); }
.kpi.accent .kpi-icon { background: rgba(255, 255, 255, .18); color: #fff; }
.kpi.accent::after { content: ''; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .22), transparent 65%); }
.kpi.tone-success { border-left: 3px solid var(--success); } .kpi.tone-warning { border-left: 3px solid var(--warning); } .kpi.tone-muted { border-left: 3px solid var(--border-strong); }
.kpi .spark { position: absolute; left: 0; right: 0; bottom: 0; height: 34px; opacity: .9; }
.kpi.has-spark { padding-bottom: 2.1rem; }
.spark { width: 100%; height: 36px; display: block; }
.spark-line { fill: none; stroke: var(--primary); stroke-width: 1.6; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.spark-area { fill: var(--primary); opacity: .12; }
.kpi.accent .spark-line { stroke: #fff; } .kpi.accent .spark-area { fill: #fff; opacity: .18; }
.delta { display: inline-flex; align-items: center; gap: .2rem; font-size: .74rem; font-weight: 700; padding: .1rem .45rem; border-radius: 999px; font-variant-numeric: tabular-nums; }
.delta.up { background: var(--success-soft); color: var(--success-ink); }
.delta.down { background: var(--danger-soft); color: var(--danger-ink); }
.delta.flat { background: var(--neutral-soft); color: var(--neutral-ink); }
.kpi.accent .delta { background: rgba(255, 255, 255, .2); color: #fff; }

.chart-box { position: relative; height: 300px; }
.chart-box.sm { height: 220px; }
.chart-box.lg { height: 360px; }

/* ------------------------------------------------------------ buttons */
.btn { display: inline-flex; align-items: center; gap: .45rem; padding: .52rem .95rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: .87rem; font-weight: 550; cursor: pointer; text-decoration: none; white-space: nowrap; box-shadow: var(--shadow-xs); transition: background .15s, border-color .15s, transform .08s, box-shadow .15s; }
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled, .btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn i, .btn svg { width: 16px; height: 16px; }
.btn-primary { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%); box-shadow: 0 8px 18px -8px var(--primary-glow), inset 0 1px 0 rgba(255, 255, 255, .2); }
.btn-primary:hover { background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-2) 100%); border-color: transparent; box-shadow: 0 10px 22px -8px var(--primary-glow); }
.btn-danger { color: var(--danger-ink); background: var(--danger-soft); border-color: transparent; box-shadow: none; }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 22%, var(--danger-soft)); }
.btn-ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; }
.btn-sm { padding: .32rem .65rem; font-size: .8rem; border-radius: 8px; }
.btn-icon { padding: .48rem; border-radius: 10px; }
.btn-icon.btn-sm { padding: .32rem; }
.btn-block { width: 100%; justify-content: center; }

/* ------------------------------------------------------------ badges */
.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .17rem .6rem; border-radius: 999px; font-size: .73rem; font-weight: 650; line-height: 1.5; white-space: nowrap; letter-spacing: .01em; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .75; }
.badge-tier1 { background: var(--success-soft); color: var(--success-ink); }
.badge-tier2 { background: var(--warning-soft); color: var(--warning-ink); }
.badge-tier3 { background: var(--neutral-soft); color: var(--neutral-ink); }
.badge-success, .badge-connected, .badge-completed, .badge-done, .badge-improved { background: var(--success-soft); color: var(--success-ink); }
.badge-warning, .badge-pending, .badge-in_progress { background: var(--warning-soft); color: var(--warning-ink); }
.badge-danger, .badge-error, .badge-failed, .badge-declined { background: var(--danger-soft); color: var(--danger-ink); }
.badge-info, .badge-running, .badge-monitoring, .badge-diagnosing { background: var(--info-soft); color: var(--info-ink); }
.badge-neutral, .badge-new, .badge-disabled, .badge-dismissed, .badge-neutral-outcome { background: var(--neutral-soft); color: var(--neutral-ink); }
.badge-primary, .badge-optimizing { background: var(--primary-soft); color: var(--primary-ink); }
.badge-optimized { background: var(--success-soft); color: var(--success-ink); }
.badge-running::before, .badge-diagnosing::before, .badge-optimizing::before { animation: pulse 1.2s infinite; }

/* ------------------------------------------------------------ workflow de oportunidades */
.wf-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .7rem; margin-bottom: 1.1rem; }
.wf-step { position: relative; display: flex; flex-direction: column; gap: .25rem; padding: .8rem .95rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-xs); color: var(--text); text-decoration: none; transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s var(--ease); }
.wf-step:hover { transform: translateY(-1px); box-shadow: var(--shadow); text-decoration: none; }
.wf-step.active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.wf-step .wf-label { display: flex; align-items: center; gap: .45rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 650; color: var(--muted); }
.wf-step .wf-label svg { width: 15px; height: 15px; }
.wf-step .wf-value { font-size: 1.45rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.wf-step .wf-sub { font-size: .74rem; color: var(--text-2); min-height: 1em; }
.wf-step.tone-neutral { border-top: 3px solid var(--border-strong); }
.wf-step.tone-warning { border-top: 3px solid var(--warning); }
.wf-step.tone-info { border-top: 3px solid var(--info); }
.wf-step.tone-primary { border-top: 3px solid var(--primary); }
.wf-step.tone-success { border-top: 3px solid var(--success); }
.wf-step.goal .wf-value { color: var(--warning-ink); }
.wf-step.goal.zero .wf-value { color: var(--success-ink); }
[data-theme="dark"] .wf-step.goal .wf-value { color: var(--warning); }
[data-theme="dark"] .wf-step.goal.zero .wf-value { color: var(--success); }
.wf-arrow { position: absolute; right: -11px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border); display: grid; place-items: center; color: var(--muted); z-index: 1; }
.wf-arrow svg { width: 11px; height: 11px; }
@media (max-width: 900px) { .wf-arrow { display: none; } }
.wf-help { font-size: .8rem; color: var(--text-2); margin-top: .35rem; line-height: 1.45; }
.wf-help b { color: var(--text); }

/* lista de oportunidades: 11 colunas — compacta o espaçamento e esconde CTR em telas menores para o Status caber */
.opp-table th, .opp-table td { padding-left: .7rem; padding-right: .7rem; }
@media (max-width: 1600px) { .opp-table .col-ctr, .opp-table .col-recent { display: none; } }

/* ------------------------------------------------------------ monitoramento (URLs otimizadas) */
.badge-improving { background: var(--success-soft); color: var(--success-ink); }
.badge-stable, .badge-neutral-result { background: var(--neutral-soft); color: var(--neutral-ink); }
.badge-declining { background: var(--danger-soft); color: var(--danger-ink); }
.badge-pending-data { background: var(--info-soft); color: var(--info-ink); }
.badge-pending-data::before { animation: pulse 1.2s infinite; }
.progress { height: 6px; border-radius: 999px; background: var(--neutral-soft); overflow: hidden; min-width: 70px; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: var(--primary); }
.progress.done > span { background: var(--success); }
.mon-metric { display: flex; flex-direction: column; gap: .1rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mon-metric .from { color: var(--muted); font-size: .78rem; }
.mon-metric .to { font-weight: 700; }
.mon-metric .arrow { color: var(--muted); margin: 0 .25rem; }
.mon-spark { width: 90px; height: 26px; display: block; }
.mon-spark svg { width: 100%; height: 100%; display: block; }
.mon-spark .spark-line { fill: none; stroke: var(--primary); stroke-width: 2; }
.mon-spark .spark-area { fill: var(--primary); opacity: .12; }
.mon-spark.good .spark-line { stroke: var(--success); } .mon-spark.good .spark-area { fill: var(--success); }
.mon-spark.bad .spark-line { stroke: var(--danger); } .mon-spark.bad .spark-area { fill: var(--danger); }
.verdict-card { display: flex; gap: 1rem; align-items: flex-start; padding: 1rem 1.15rem; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.verdict-card .verdict-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.verdict-card .verdict-icon svg { width: 22px; height: 22px; }
.verdict-card.tone-success { border-color: color-mix(in srgb, var(--success) 40%, transparent); background: color-mix(in srgb, var(--success-soft) 60%, var(--surface)); }
.verdict-card.tone-success .verdict-icon { background: var(--success-soft); color: var(--success-ink); }
.verdict-card.tone-danger { border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: color-mix(in srgb, var(--danger-soft) 60%, var(--surface)); }
.verdict-card.tone-danger .verdict-icon { background: var(--danger-soft); color: var(--danger-ink); }
.verdict-card.tone-neutral .verdict-icon { background: var(--neutral-soft); color: var(--neutral-ink); }
.verdict-card.tone-info .verdict-icon { background: var(--info-soft); color: var(--info-ink); }
.verdict-card h3 { margin: 0 0 .25rem; font-size: 1.05rem; }
.verdict-card p { margin: 0; font-size: .9rem; color: var(--text-2); line-height: 1.5; }
.verdict-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; margin-top: .75rem; }
.verdict-facts .fact { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .55rem .7rem; }
.verdict-facts .fact small { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; }
.verdict-facts .fact b { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.week-table td.good { color: var(--success-ink); font-weight: 650; } .week-table td.bad { color: var(--danger-ink); font-weight: 650; }
[data-theme="dark"] .week-table td.good { color: var(--success); } [data-theme="dark"] .week-table td.bad { color: var(--danger); }
.changes-list { list-style: none; margin: 0; padding: 0; }
.changes-list li { padding: .45rem 0; border-bottom: 1px solid var(--border); font-size: .88rem; display: flex; gap: .6rem; align-items: flex-start; }
.changes-list li:last-child { border-bottom: 0; }
.changes-list li .chip { flex: none; margin-top: .1rem; }

/* seleção em massa */
.table td.sel, .table th.sel { width: 34px; padding-right: 0; padding-left: .8rem; }
.table td.sel input, .table th.sel input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; vertical-align: middle; }
.table tbody tr.selected { background: var(--primary-soft); }
.bulk-bar { position: sticky; bottom: 1rem; z-index: 30; display: none; align-items: center; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; padding: .7rem .9rem; background: var(--surface); border: 1px solid var(--primary); border-radius: var(--radius); box-shadow: var(--shadow-lg), 0 0 0 4px var(--primary-soft); }
.bulk-bar.show { display: flex; animation: bulk-in .18s var(--ease); }
@keyframes bulk-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.bulk-bar .bulk-count { font-weight: 700; font-variant-numeric: tabular-nums; }
.bulk-bar .bulk-count b { color: var(--primary-ink); }
[data-theme="dark"] .bulk-bar .bulk-count b { color: var(--primary); }
.bulk-bar .form-control { width: auto; min-width: 230px; box-shadow: none; }
.bulk-bar .bulk-all { font-size: .8rem; }
.bulk-bar .bulk-all a { cursor: pointer; }
.bulk-bar .spacer { flex: 1; }
@keyframes pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
.trend { font-variant-numeric: tabular-nums; font-size: .8rem; font-weight: 650; }
.trend-improving { color: var(--success-ink); } .trend-declining { color: var(--danger-ink); } .trend-stable { color: var(--muted); }
[data-theme="dark"] .trend-improving { color: var(--success); } [data-theme="dark"] .trend-declining { color: var(--danger); }
.rank { display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 .35rem; border-radius: 9px; background: var(--primary-soft); color: var(--primary-ink); font-weight: 700; font-size: .78rem; font-variant-numeric: tabular-nums; }
[data-theme="dark"] .rank { color: var(--primary); }
.score-bar { height: 5px; border-radius: 999px; background: var(--neutral-soft); overflow: hidden; margin-top: .35rem; }
.score-bar > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--accent)); }

/* ------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th, .table td { padding: .7rem .95rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 650; white-space: nowrap; background: var(--surface-2); }
.table thead th:first-child { border-top-left-radius: var(--radius); } .table thead th:last-child { border-top-right-radius: var(--radius); }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: color-mix(in srgb, var(--primary-soft) 55%, transparent); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions .btn { opacity: .75; } .table tbody tr:hover .actions .btn { opacity: 1; }
.table .url { max-width: 440px; }
.table .url a { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-weight: 550; }
.table .url .sub { font-size: .77rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sort-link { color: inherit; } .sort-link.active { color: var(--primary-ink); } [data-theme="dark"] .sort-link.active { color: var(--primary); }
.pagination { display: flex; align-items: center; justify-content: space-between; padding: .85rem 1.1rem; gap: 1rem; flex-wrap: wrap; border-top: 1px solid var(--border); }
.pagination-info { font-size: .8rem; color: var(--muted); padding: .85rem 1.1rem; }
.pagination .pagination-info { padding: 0; }
.pagination ul { list-style: none; display: flex; gap: .3rem; margin: 0; padding: 0; }
.pagination li a, .pagination li span { display: inline-block; min-width: 32px; text-align: center; padding: .3rem .5rem; border-radius: 8px; font-size: .84rem; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.pagination li a:hover { border-color: var(--border-strong); background: var(--surface-2); text-decoration: none; }
.pagination li.active span { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination li.disabled span, .pagination li.gap { color: var(--muted); border-color: transparent; background: transparent; }
.empty { text-align: center; padding: 2.75rem 1rem; color: var(--muted); }
.empty h3 { color: var(--text-2); margin: .5rem 0 .3rem; }
.empty i, .empty svg { width: 22px; height: 22px; color: var(--primary-ink); }
.empty > i, .empty > svg { width: 52px; height: 52px; padding: 14px; border-radius: 16px; background: var(--primary-soft); color: var(--primary-ink); box-sizing: border-box; }
[data-theme="dark"] .empty > svg { color: var(--primary); }

/* ------------------------------------------------------------ forms */
.form-group { margin-bottom: 1rem; }
.form-group label, .form-label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: .38rem; color: var(--text-2); }
.form-control { width: 100%; padding: .58rem .8rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; font-size: .92rem; box-shadow: var(--shadow-xs); transition: border-color .15s, box-shadow .15s; }
.form-control::placeholder { color: var(--muted); }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.form-control.is-invalid { border-color: var(--danger); }
textarea.form-control { min-height: 96px; resize: vertical; }
select.form-control { appearance: none; -webkit-appearance: none; padding-right: 2rem; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238592a6' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>"); background-repeat: no-repeat; background-position: right .7rem center; }
.form-help { font-size: .77rem; color: var(--muted); margin-top: .35rem; }
.field-error { font-size: .77rem; color: var(--danger-ink); margin-top: .35rem; font-weight: 500; }
[data-theme="dark"] .field-error { color: var(--danger); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.form-actions { display: flex; gap: .5rem; align-items: center; margin-top: 1.25rem; flex-wrap: wrap; }
.check { display: flex; align-items: center; gap: .55rem; font-size: .9rem; cursor: pointer; font-weight: 500 !important; color: var(--text) !important; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.toolbar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; padding: .7rem .8rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-xs); }
.toolbar .form-control { width: auto; min-width: 150px; box-shadow: none; }
.toolbar .search { min-width: 240px; }
.inline-form { display: inline; }
.fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.15rem; margin-bottom: 1rem; }

/* ------------------------------------------------------------ misc components */
.dropdown { position: relative; }
.dropdown summary { list-style: none; cursor: pointer; }
.dropdown summary::-webkit-details-marker { display: none; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: .4rem; z-index: 60; animation: pop .14s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.dropdown-menu a, .dropdown-menu button { display: flex; width: 100%; align-items: center; gap: .55rem; padding: .5rem .65rem; border-radius: 8px; background: none; border: 0; font: inherit; font-size: .88rem; font-weight: 500; color: var(--text); cursor: pointer; text-align: left; text-decoration: none; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-3); }
.dropdown-menu a svg, .dropdown-menu button svg { width: 15px; height: 15px; color: var(--muted); }
.dropdown-menu .menu-head { padding: .5rem .65rem .65rem; border-bottom: 1px solid var(--border); margin-bottom: .3rem; }
.alert { padding: .85rem 1rem; border-radius: var(--radius-sm); font-size: .88rem; border: 1px solid transparent; margin-bottom: 1rem; line-height: 1.55; }
.alert svg { width: 16px; height: 16px; display: inline-block; vertical-align: -3px; margin-right: .4rem; }
.alert-info { background: var(--info-soft); color: var(--info-ink); border-color: color-mix(in srgb, var(--info) 25%, transparent); }
.alert-warning { background: var(--warning-soft); color: var(--warning-ink); border-color: color-mix(in srgb, var(--warning) 25%, transparent); }
.alert-danger { background: var(--danger-soft); color: var(--danger-ink); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert-success { background: var(--success-soft); color: var(--success-ink); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: .8rem; padding: .65rem 0; border-bottom: 1px solid var(--border); font-size: .88rem; }
.timeline li:last-child { border-bottom: 0; }
.timeline .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); margin-top: .5rem; flex: none; box-shadow: 0 0 0 3px var(--primary-soft); }
.timeline .when { color: var(--muted); font-size: .76rem; margin-top: .1rem; }
.gap-item { border: 1px solid var(--border); border-left: 4px solid var(--muted); border-radius: var(--radius-sm); padding: .8rem 1rem; margin-bottom: .6rem; background: var(--surface-2); }
.gap-item.high { border-left-color: var(--danger); } .gap-item.medium { border-left-color: var(--warning); } .gap-item.low { border-left-color: var(--info); }
.gap-item .gap-title { font-weight: 650; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip { background: var(--neutral-soft); color: var(--neutral-ink); border-radius: 999px; padding: .15rem .6rem; font-size: .76rem; font-weight: 550; }
.status-strip { display: flex; height: 10px; border-radius: 999px; overflow: hidden; gap: 2px; background: var(--neutral-soft); }
.status-strip span { display: block; height: 100%; }
.project-card { display: flex; flex-direction: column; gap: .5rem; padding: 1.2rem; height: 100%; }
.project-card h3 a { color: var(--text); }
.project-card .meta { font-size: .78rem; color: var(--muted); }
.project-card .stats { display: flex; gap: 1.2rem; font-size: .8rem; margin-top: auto; padding-top: .6rem; border-top: 1px dashed var(--border); }
.project-card .stats b { display: block; font-size: 1.15rem; font-weight: 700; letter-spacing: -.02em; }
.project-card .stats span { color: var(--muted); }
.integration-card .provider { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 650; }
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.tabs a { padding: .55rem .9rem; border-bottom: 2px solid transparent; color: var(--text-2); font-size: .87rem; font-weight: 550; margin-bottom: -1px; }
.tabs a.active, .tabs a:hover { color: var(--primary-ink); border-color: var(--primary); text-decoration: none; }
[data-theme="dark"] .tabs a.active { color: var(--primary); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1rem; font-size: .88rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.section-title { display: flex; align-items: center; gap: .6rem; margin: 1.6rem 0 .9rem; }
.section-title h2 { font-size: 1.05rem; }
.section-title .line { flex: 1; height: 1px; background: var(--border); }

/* ------------------------------------------------------------ toasts & modal & palette */
#toast-container { position: fixed; right: 1.25rem; bottom: 1.25rem; display: flex; flex-direction: column; gap: .5rem; z-index: 200; max-width: 400px; transition: bottom .2s var(--ease); }
body.btt-visible #toast-container { bottom: 4.6rem; }

/* ------------------------------------------------------------ back to top */
.back-to-top { position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 100; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text); display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow-lg); opacity: 0; visibility: hidden; transform: translateY(12px) scale(.9); transition: opacity .2s var(--ease), transform .2s var(--ease), visibility 0s linear .2s, bottom .2s var(--ease), background .15s, color .15s; }
.back-to-top.show { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.back-to-top svg { width: 20px; height: 20px; }
.back-to-top:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.back-to-top:focus-visible { outline: none; box-shadow: var(--ring), var(--shadow-lg); }
body:has(.bulk-bar.show) .back-to-top { bottom: 5.4rem; }
@media (max-width: 980px) { .back-to-top { right: 1rem; bottom: 1rem; width: 40px; height: 40px; } body.btt-visible #toast-container { bottom: 4.1rem; } }

.toast { background: var(--surface); color: var(--text); border: 1px solid var(--border); padding: .75rem .95rem; border-radius: 12px; font-size: .88rem; box-shadow: var(--shadow-lg); display: flex; gap: .65rem; align-items: center; animation: toast-in .22s var(--ease); backdrop-filter: blur(10px); }
.toast::before { content: ''; width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--info); }
.toast.success::before { background: var(--success); } .toast.error::before { background: var(--danger); } .toast.warning::before { background: var(--warning); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-backdrop { position: fixed; inset: 0; background: rgba(2, 6, 23, .55); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 150; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.6rem; width: min(440px, 92vw); box-shadow: var(--shadow-lg); animation: pop .18s var(--ease); }
.modal p { color: var(--text-2); }
.modal .modal-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.25rem; }

.palette { position: fixed; inset: 0; z-index: 160; background: rgba(2, 6, 23, .5); backdrop-filter: blur(6px); display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; animation: fade .12s; }
.palette[hidden] { display: none; }
.palette-box { width: min(640px, 94vw); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .18s var(--ease); }
.palette-input { display: flex; align-items: center; gap: .7rem; padding: .85rem 1.1rem; border-bottom: 1px solid var(--border); }
.palette-input svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.palette-input input { flex: 1; border: 0; outline: 0; background: transparent; font: inherit; font-size: 1rem; color: var(--text); }
.palette-list { max-height: 400px; overflow-y: auto; padding: .4rem; }
.palette-group { font-size: .66rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); padding: .6rem .7rem .3rem; font-weight: 650; }
.palette-item { display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border-radius: 10px; cursor: pointer; color: var(--text); text-decoration: none; }
.palette-item:hover, .palette-item.active { background: var(--primary-soft); text-decoration: none; }
.palette-item svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.palette-item .pi-text { min-width: 0; flex: 1; }
.palette-item .pi-text b { display: block; font-weight: 550; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item .pi-text span { display: block; font-size: .76rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item .badge { flex: none; }
.palette-empty { padding: 1.5rem; text-align: center; color: var(--muted); font-size: .88rem; }
.palette-foot { display: flex; gap: 1rem; padding: .55rem 1rem; border-top: 1px solid var(--border); font-size: .74rem; color: var(--muted); background: var(--surface-2); }

/* ------------------------------------------------------------ auth */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-side { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 3rem; color: #fff;
  background: radial-gradient(900px 500px at 10% 0%, #4f46e5 0%, transparent 60%), radial-gradient(700px 500px at 100% 100%, #0891b2 0%, transparent 55%), linear-gradient(160deg, #0b1020 0%, #111a3a 100%); }
.auth-side .brand { display: flex; align-items: center; gap: .7rem; font-weight: 700; font-size: 1.05rem; }
.auth-side .brand .logo { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: .75rem; letter-spacing: .06em; background: linear-gradient(135deg, #6366f1, #8b5cf6 55%, #22d3ee 130%); box-shadow: 0 8px 20px -8px rgba(99, 102, 241, .8); }
.auth-side h2 { font-size: 2.1rem; font-weight: 700; letter-spacing: -.03em; line-height: 1.15; max-width: 22ch; }
.auth-side p { color: rgba(255, 255, 255, .7); max-width: 46ch; font-size: .98rem; }
.auth-side .float-cards { display: grid; gap: .8rem; grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 520px; margin-top: 2rem; }
.auth-side .fc { background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .12); border-radius: 14px; padding: .9rem 1rem; backdrop-filter: blur(8px); }
.auth-side .fc b { display: block; font-size: 1.3rem; letter-spacing: -.02em; }
.auth-side .fc span { font-size: .78rem; color: rgba(255, 255, 255, .7); }
.auth-side .foot { font-size: .78rem; color: rgba(255, 255, 255, .5); }
.auth-form { display: grid; place-items: center; padding: 2rem; background: var(--bg); }
.auth-card { width: min(420px, 100%); }
.auth-card .brand { display: none; align-items: center; gap: .65rem; margin-bottom: 1.5rem; font-weight: 700; }
.auth-card .brand .logo { width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(135deg, #6366f1, #22d3ee); color: #fff; display: grid; place-items: center; font-size: .75rem; }
.auth-card h1 { font-size: 1.7rem; letter-spacing: -.03em; margin-bottom: .3rem; }
.auth-card .form-control { padding: .7rem .9rem; }
.auth-card .btn-block { padding: .7rem; font-size: .95rem; }
.auth-theme { position: absolute; top: 1rem; right: 1rem; }
@media (max-width: 900px) { .auth-wrap { grid-template-columns: 1fr; } .auth-side { display: none; } .auth-card .brand { display: flex; } }

/* ------------------------------------------------------------ pipeline de conteúdo (revisões geradas pela IA) */
.badge-draft { background: var(--warning-soft); color: var(--warning-ink); }
.badge-applied, .badge-auto { background: var(--success-soft); color: var(--success-ink); }
.badge-rejected, .badge-manual { background: var(--neutral-soft); color: var(--neutral-ink); }
.badge-reverted { background: var(--danger-soft); color: var(--danger-ink); }
.badge-generating { background: var(--info-soft); color: var(--info-ink); }
.badge-generating::before { animation: pulse 1.2s infinite; }
.badge-meta, .badge-full { background: var(--primary-soft); color: var(--primary-ink); }
[data-theme="dark"] .badge-meta, [data-theme="dark"] .badge-full { color: var(--primary); }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.compare .col-title { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 650; margin-bottom: .35rem; }
.compare .val { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .6rem .8rem; font-size: .9rem; min-height: 2.6rem; white-space: pre-wrap; word-break: break-word; }
.compare .val.after { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.len { font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; margin-left: .4rem; text-transform: none; letter-spacing: 0; }
.len.over { color: var(--danger-ink); font-weight: 650; }
.field-row { padding: .9rem 0; border-bottom: 1px solid var(--border); }
.field-row:first-child { padding-top: 0; }
.field-row:last-child { border-bottom: 0; padding-bottom: 0; }
.field-row .field-name { font-weight: 650; font-size: .88rem; margin-bottom: .45rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.diff { font-size: .88rem; line-height: 1.55; max-height: 640px; overflow: auto; }
.diff .d { padding: .4rem .7rem; border-left: 3px solid transparent; border-radius: 6px; margin-bottom: .2rem; white-space: pre-wrap; word-break: break-word; }
.diff .d.ins { background: var(--success-soft); border-left-color: var(--success); }
.diff .d.del { background: var(--danger-soft); border-left-color: var(--danger); color: var(--danger-ink); text-decoration: line-through; }
.diff .d.eq { color: var(--text-2); }
.diff .d.eq.collapsed { display: none; }
.diff-legend { display: flex; gap: 1rem; align-items: center; font-size: .78rem; color: var(--muted); margin-bottom: .6rem; flex-wrap: wrap; }
.diff-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .3rem; vertical-align: -1px; }
.preview-frame { width: 100%; min-height: 560px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; }
.tabs button { background: none; border: 0; padding: .55rem .9rem; border-bottom: 2px solid transparent; color: var(--text-2); font: inherit; font-size: .87rem; font-weight: 550; margin-bottom: -1px; cursor: pointer; }
.tabs button.active, .tabs button:hover { color: var(--primary-ink); border-color: var(--primary); }
[data-theme="dark"] .tabs button.active { color: var(--primary); }
.form-control.mono, textarea.mono { font-family: var(--mono); font-size: .8rem; line-height: 1.5; }
.map-table td { vertical-align: top; }
.map-table .form-control { box-shadow: none; }
.changes li { margin-bottom: .45rem; font-size: .9rem; }
.changes .chip { margin-right: .4rem; }
.steps { counter-reset: step; list-style: none; margin: 0; padding: 0; display: grid; gap: .65rem; }
.steps li { display: flex; gap: .75rem; align-items: flex-start; font-size: .88rem; line-height: 1.55; }
.steps li::before { counter-increment: step; content: counter(step); flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-ink); font-weight: 700; font-size: .75rem; display: grid; place-items: center; margin-top: .1rem; }
[data-theme="dark"] .steps li::before { color: var(--primary); }
@media (max-width: 800px) { .compare { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------ listas ao vivo (fragmentos AJAX com loader) */
.live { position: relative; }
.live-body { transition: opacity .15s; }
.live.is-loading .live-body { opacity: .45; pointer-events: none; user-select: none; }
.live-loader { display: none; position: absolute; inset: 0; z-index: 3; justify-content: center; align-items: flex-start; padding-top: 4.25rem; pointer-events: none; }
.live.is-loading .live-loader { display: flex; }
.live-pill { display: inline-flex; align-items: center; gap: .55rem; padding: .5rem .95rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-size: .82rem; font-weight: 550; color: var(--text-2); animation: pop .15s var(--ease); }
.spinner { flex: none; width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--primary); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { display: block; height: 11px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.3s ease-in-out infinite; }
.skeleton.sm { height: 8px; margin-top: .45rem; opacity: .7; }
.table td.num .skeleton { margin-left: auto; }
.skeleton-row td { padding-top: .95rem; padding-bottom: .95rem; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.toolbar [data-live-clear] { color: var(--muted); }
.toolbar [data-live-clear]:hover { color: var(--text); }
@media (prefers-reduced-motion: reduce) { .spinner, .skeleton { animation-duration: 2.5s; } .live-body { transition: none; } }
/* esqueleto de dashboard (partials/skeleton_dashboard) */
.skeleton.lg { height: 22px; margin-top: .55rem; }
.skeleton.chart { height: 150px; border-radius: 10px; margin-top: .7rem; }
.skeleton.row { height: 12px; margin-top: .85rem; }
.skeleton-kpi { gap: .35rem; justify-content: center; }
.skeleton-kpi:hover { transform: none; box-shadow: var(--shadow); }
.skeleton-card { padding: 1.2rem; display: flex; flex-direction: column; }
.live-dashboard > .live-loader { padding-top: 7rem; }
