/* Temas Rbiana — sistema visual copiado do RBIANA Studio
 * (C:\Users\agent\rbiana Studio\web\src\index.css + components/ui.tsx).
 *
 * Os tokens --app-* e os tamanhos (botões h-8/h-7, campos, raios 8/12px,
 * barra lateral de 208px, cabeçalho de página) são os MESMOS do Studio, para
 * que estas telas possam ser incorporadas lá sem mudança visual. O tema segue
 * a mesma chave do Studio: localStorage "rbiana-theme" (light/dark/system) e
 * a classe .dark no <html>.
 *
 * Os tokens --cp-* existem só como apelidos para o CSS do Curador
 * (static/clip_curator.css), que foi escrito sobre eles.
 */

@font-face {
  font-family: 'Inter Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/static/fonts/inter-latin-ext.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Inter Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/static/fonts/inter-latin.woff2') format('woff2-variations');
  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;
}

/* ---------- tokens (idênticos ao Studio) ---------- */
:root {
  --app-bg: #fbfbfa;
  --app-surface: #ffffff;
  --app-subtle: #f4f4f3;
  --app-hover: #efefed;
  --app-border: #e7e6e3;
  --app-strong-border: #d6d5d1;
  --app-text: #1d1d1f;
  --app-muted: #6e6d6a;
  --app-faint: #9b9a96;
  --app-accent: #18181b;
  --app-accent-text: #ffffff;
  --app-ring: #a5b4fc;

  --ok-bg: #ecfdf5;    --ok-text: #047857;
  --warn-bg: #fffbeb;  --warn-text: #b45309;
  --bad-bg: #fef2f2;   --bad-text: #dc2626;
  --info-bg: #eff6ff;  --info-text: #2563eb;
  --violet-bg: #f5f3ff; --violet-text: #6d28d9;

  --shadow-xs: 0 1px 2px rgb(0 0 0 / 0.05);
  --shadow-sm: 0 1px 3px rgb(0 0 0 / 0.08), 0 1px 2px -1px rgb(0 0 0 / 0.08);
  --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
  --font-sans: 'Inter Variable', ui-sans-serif, system-ui, 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

.dark {
  --app-bg: #111113;
  --app-surface: #18181b;
  --app-subtle: #1f1f23;
  --app-hover: #26262b;
  --app-border: #2a2a2f;
  --app-strong-border: #3a3a40;
  --app-text: #ececee;
  --app-muted: #a1a1aa;
  --app-faint: #71717a;
  --app-accent: #ececee;
  --app-accent-text: #111113;
  --app-ring: #6366f1;

  --ok-bg: rgb(16 185 129 / 0.12);   --ok-text: #34d399;
  --warn-bg: rgb(245 158 11 / 0.12); --warn-text: #fbbf24;
  --bad-bg: rgb(239 68 68 / 0.12);   --bad-text: #f87171;
  --info-bg: rgb(59 130 246 / 0.12); --info-text: #60a5fa;
  --violet-bg: rgb(139 92 246 / 0.14); --violet-text: #a78bfa;
  color-scheme: dark;
}

/* Apelidos para o CSS legado do Curador. */
:root, .dark {
  --cp-bg: var(--app-bg);
  --cp-surface: var(--app-surface);
  --cp-surface-2: var(--app-subtle);
  --cp-border: var(--app-border);
  --cp-border-strong: var(--app-strong-border);
  --cp-text: var(--app-text);
  --cp-text-muted: var(--app-muted);
  --cp-text-faint: var(--app-faint);
  --cp-primary: var(--app-text);
  --cp-primary-ink: var(--app-accent-text);
  --cp-primary-soft: var(--app-hover);
  --cp-success-bg: var(--ok-bg);     --cp-success-text: var(--ok-text);
  --cp-warning-bg: var(--warn-bg);   --cp-warning-text: var(--warn-text);
  --cp-danger-bg: var(--bad-bg);     --cp-danger-text: var(--bad-text);
  --cp-info-bg: var(--info-bg);      --cp-info-text: var(--info-text);
  --cp-accent-bg: var(--violet-bg);  --cp-accent-text: var(--violet-text);
  --cp-radius: 12px;
  --cp-radius-sm: 8px;
  --cp-shadow: var(--shadow-sm);
  --cp-shadow-sm: var(--shadow-xs);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { scrollbar-width: thin; scrollbar-color: var(--app-strong-border) transparent; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--app-bg);
  color: var(--app-text);
  font-family: var(--font-sans);
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}
::selection { background: color-mix(in srgb, var(--app-ring) 40%, transparent); }

a { color: inherit; text-decoration: underline; text-decoration-color: var(--app-strong-border); text-underline-offset: 2px; }
a:hover { text-decoration-color: currentColor; }
h1, h2, h3, h4 { letter-spacing: -0.01em; line-height: 1.3; color: var(--app-text); }
h1 { font-size: 20px; font-weight: 600; margin: 0 0 4px; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 10px; }
h3 { font-size: 14px; font-weight: 600; margin: 0 0 8px; }
h4 { font-size: 13px; font-weight: 600; margin: 0 0 6px; }
p { margin: 0 0 8px; }
hr { border: 0; border-top: 1px solid var(--app-border); margin: 16px 0; }
img { max-width: 100%; }
summary { cursor: pointer; }

code, kbd, pre { font-family: var(--font-mono); font-size: 12px; }
code { background: var(--app-subtle); border: 1px solid var(--app-border); border-radius: 4px; padding: 1px 5px; }
pre { background: var(--app-subtle); border: 1px solid var(--app-border); border-radius: 8px; padding: 12px; overflow: auto; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(4px) scale(0.98); } to { opacity: 1; transform: none; } }
.anim-fade { animation: fade-in 120ms ease-out; }
.anim-pop { animation: pop-in 140ms ease-out; }
@media (prefers-reduced-motion: reduce) { .anim-fade, .anim-pop { animation: none; } }

.icon { width: 16px; height: 16px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 14px; height: 14px; }
.icon-lg { width: 20px; height: 20px; }

/* ---------- campos (Input/Select/Textarea do Studio) ---------- */
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="range"]):not([type="file"]),
select, textarea {
  font: inherit;
  font-size: 13px;
  color: var(--app-text);
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 8px;
  padding: 0 10px;
  height: 32px;
  max-width: 100%;
  transition: border-color 120ms, box-shadow 120ms;
}
textarea { height: auto; min-height: 80px; padding: 8px 10px; line-height: 1.6; resize: vertical; }
select { padding-right: 28px; cursor: pointer; }
select[multiple] { height: auto; padding: 4px; }
input::placeholder, textarea::placeholder { color: var(--app-faint); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--app-strong-border);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--app-ring) 40%, transparent);
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--app-accent); width: 14px; height: 14px; margin: 0; }
input[type="file"] { font: inherit; font-size: 13px; color: var(--app-muted); }
label { font-size: 12px; font-weight: 500; color: var(--app-muted); }
fieldset { border: 1px solid var(--app-border); border-radius: 12px; padding: 12px 16px; margin: 0 0 16px; }
legend { font-size: 12px; font-weight: 600; color: var(--app-muted); padding: 0 6px; }
@media (max-width: 767px) {
  /* iOS não dá zoom em campos com 16px */
  input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea { font-size: 16px; height: 36px; }
  textarea { height: auto; }
}

/* ---------- botões (Button do Studio) ---------- */
button { font: inherit; color: inherit; }
.btn, .cc-btn, .cp-btn, .btn-primary, .btn-link, .cc-act,
.filters button, .inline-form button, .inline-form-compact button, .actions > button, .run-radar-form button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 120ms, color 120ms, opacity 120ms, border-color 120ms;
  /* secundário (padrão) */
  background: var(--app-surface);
  color: var(--app-text);
  border: 1px solid var(--app-border);
  box-shadow: var(--shadow-xs);
}
.btn:hover, .cc-btn:hover, .cp-btn:hover, .btn-link:hover, .cc-act:hover,
.filters button:hover, .inline-form button:hover, .inline-form-compact button:hover, .actions > button:hover, .run-radar-form button:hover {
  background: var(--app-hover);
}
.btn:focus-visible, .cc-btn:focus-visible, .cp-btn:focus-visible, .cc-act:focus-visible, .nav-item:focus-visible, .seg button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--app-ring);
}
.btn[disabled], .cc-btn[disabled], .cp-btn[disabled], .cc-act[disabled], button:disabled { opacity: 0.5; pointer-events: none; }

/* primário */
.btn-primary, .cc-btn-primary, .cc-btn-ok, .cp-btn-primary, .cc-btn-scout, .actions > button.btn-primary,
.filters button, .inline-form button {
  background: var(--app-accent);
  color: var(--app-accent-text);
  border-color: transparent;
  box-shadow: var(--shadow-xs);
}
.btn-primary:hover, .cc-btn-primary:hover, .cc-btn-ok:hover, .cp-btn-primary:hover, .cc-btn-scout:hover,
.filters button:hover, .inline-form button:hover {
  background: var(--app-accent);
  opacity: 0.9;
}
/* fantasma */
.btn-ghost, .cp-btn-ghost {
  background: transparent;
  color: var(--app-muted);
  border-color: transparent;
  box-shadow: none;
}
.btn-ghost:hover, .cp-btn-ghost:hover { color: var(--app-text); background: var(--app-hover); }
/* perigo */
.btn-danger, .cc-btn-danger, .cp-btn-danger {
  background: transparent;
  color: var(--bad-text);
  border-color: transparent;
  box-shadow: none;
}
.btn-danger:hover, .cc-btn-danger:hover, .cp-btn-danger:hover { background: var(--bad-bg); }
/* pequeno */
.btn-sm, .cc-btn-small, .cp-btn-sm, .cc-act, .btn-link, .inline-form button, .inline-form-compact button {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
}
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 6px; border: 0; background: transparent;
  color: var(--app-muted); cursor: pointer; transition: background-color 120ms, color 120ms;
}
.icon-btn:hover { background: var(--app-hover); color: var(--app-text); }

/* ---------- casca do app (Sidebar + main do Studio) ---------- */
.app { display: flex; height: 100%; }
.app-main {
  min-width: 0;
  flex: 1;
  overflow-y: auto;
  padding-bottom: calc(3.5rem + env(safe-area-inset-bottom));
}
@media (min-width: 768px) { .app-main { padding-bottom: 0; } }

.sidebar {
  display: none;
  width: 208px;
  flex-shrink: 0;
  flex-direction: column;
  border-right: 1px solid var(--app-border);
  background: var(--app-bg);
  padding: 12px;
  overflow-y: auto;
}
@media (min-width: 768px) { .sidebar { display: flex; } }

.brand { display: flex; align-items: center; gap: 8px; padding: 0 4px; margin-bottom: 20px; text-decoration: none; color: var(--app-text); }
.brand-logo {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  background: var(--app-accent); color: var(--app-accent-text);
  font-size: 13px; font-weight: 700;
}
.brand-title { font-size: 13px; font-weight: 600; line-height: 1.25; letter-spacing: -0.015em; }
.brand-sub { font-size: 11px; line-height: 1.25; color: var(--app-faint); }

.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.nav-section { margin: 16px 0 4px; padding: 0 8px; font-size: 11px; font-weight: 500; color: var(--app-faint); }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  height: 32px; padding: 0 8px; border-radius: 6px;
  font-size: 13px; font-weight: 500; color: var(--app-muted);
  text-decoration: none; transition: background-color 120ms, color 120ms;
  white-space: nowrap; overflow: hidden;
}
.nav-item span { overflow: hidden; text-overflow: ellipsis; }
.nav-item:hover { background: color-mix(in srgb, var(--app-hover) 60%, transparent); color: var(--app-text); }
.nav-item.active { background: var(--app-hover); color: var(--app-text); }
.nav-count { margin-left: auto; font-size: 11px; font-weight: 500; color: var(--app-faint); font-variant-numeric: tabular-nums; }

.channel-picker { margin: 0 0 12px; }
.channel-picker label { display: block; margin: 0 0 4px 4px; font-size: 11px; color: var(--app-faint); }
.channel-picker select { width: 100%; height: 30px; font-size: 13px; font-weight: 500; }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 12px; }
.user-row { display: flex; align-items: center; gap: 8px; padding: 0 4px 0 8px; height: 32px; font-size: 13px; font-weight: 500; color: var(--app-muted); }
.user-row form { margin: 0 0 0 auto; }
.user-avatar {
  display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 999px;
  background: var(--app-subtle); border: 1px solid var(--app-border); font-size: 10px; font-weight: 600; color: var(--app-muted); text-transform: uppercase;
}

/* seletor de tema: mesmo controle do rodapé do Studio */
.theme-switch { display: flex; border: 1px solid var(--app-border); border-radius: 8px; padding: 2px; }
.theme-switch button {
  flex: 1; display: flex; align-items: center; justify-content: center;
  height: 24px; border: 0; border-radius: 6px; background: transparent; color: var(--app-faint); cursor: pointer;
  transition: background-color 120ms, color 120ms;
}
.theme-switch button:hover { color: var(--app-muted); }
.theme-switch button[aria-pressed="true"] { background: var(--app-hover); color: var(--app-text); }

/* topo e barra inferior só no celular (MobileNav do Studio) */
.mobile-top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
  background: color-mix(in srgb, var(--app-bg) 95%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--app-border);
}
.mobile-top .brand { margin: 0; padding: 0; }
.mobile-top form { margin-left: auto; }
.mobile-top select { height: 32px; font-size: 14px; }
.mobile-nav {
  position: fixed; inset: auto 0 0 0; z-index: 30;
  display: flex;
  border-top: 1px solid var(--app-border);
  background: color-mix(in srgb, var(--app-bg) 95%, transparent);
  backdrop-filter: blur(8px);
  padding-bottom: env(safe-area-inset-bottom);
}
.mobile-nav a, .mobile-nav button {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  height: 56px; font-size: 10px; font-weight: 500; color: var(--app-faint); text-decoration: none;
  background: transparent; border: 0; cursor: pointer;
}
.mobile-nav a.active { color: var(--app-text); }
.mobile-nav .icon { width: 20px; height: 20px; }
.mobile-nav form { flex: 1; display: flex; margin: 0; }
@media (min-width: 768px) { .mobile-top, .mobile-nav { display: none; } }

/* ---------- página (PageHeader do Studio) ---------- */
.page { padding: 20px 16px 40px; }
@media (min-width: 640px) { .page { padding: 20px 24px 40px; } }
@media (min-width: 768px) { .page { padding: 24px 32px 48px; } }
.page-head, .cp-page-head, .cc-header {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px;
  margin-bottom: 16px;
}
.page-head h1, .cp-page-head h1, .cc-header h1 { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; margin: 0; }
.page-sub, .cp-sub, .cp-page-head .cp-sub, .cc-subtitle, .cc-theme { margin: 2px 0 0; font-size: 13px; color: var(--app-muted); }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.cp-breadcrumb, .cc-breadcrumb { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0 0 8px; font-size: 12px; color: var(--app-faint); }
.cp-breadcrumb a, .cc-breadcrumb a { color: var(--app-muted); text-decoration: none; }
.cp-breadcrumb a:hover, .cc-breadcrumb a:hover { color: var(--app-text); }

/* abas do projeto: Segmented do Studio */
.cc-subnav {
  display: inline-flex; max-width: 100%; overflow-x: auto;
  gap: 0; padding: 2px; margin: 0 0 20px;
  background: var(--app-subtle); border: 1px solid var(--app-border); border-radius: 8px;
  scrollbar-width: none;
}
.cc-subnav::-webkit-scrollbar { display: none; }
.cc-subnav-link {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  height: 28px; padding: 0 10px; border-radius: 6px;
  font-size: 12px; font-weight: 500; color: var(--app-muted); text-decoration: none;
  transition: background-color 120ms, color 120ms;
}
.cc-subnav-link:hover { color: var(--app-text); }
.cc-subnav-link.active { background: var(--app-surface); color: var(--app-text); box-shadow: var(--shadow-xs); }
.cc-subnav-link .cc-badge { padding: 0 5px; font-size: 10.5px; background: var(--app-hover); }
.cc-subnav-link.active .cc-badge { background: var(--app-subtle); }

/* ---------- superfícies ---------- */
.card, .panel, .cp-panel, .cc-panel, .cc-job-panel, .cc-estimate, .filters {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 12px;
}
.panel, .cp-panel, .cc-panel, .cc-job-panel { padding: 16px 20px; margin-bottom: 16px; }
.cp-panel h3, .cc-panel > h2, .cc-panel > h3, .cc-job-panel h2, .panel h2 { font-size: 14px; font-weight: 600; margin: 0 0 12px; }
.cc-panel > summary, .cp-panel > summary { font-size: 13px; font-weight: 600; list-style: none; }
.cc-panel > summary::-webkit-details-marker, .cp-panel > summary::-webkit-details-marker { display: none; }
.cp-panel h4 { margin: 16px 0 8px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--app-faint); }
.card { overflow: hidden; display: flex; flex-direction: column; margin-bottom: 16px; }
.card-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 10px; }
.card-body h2 { margin: 0; }
.card-body label { display: flex; flex-direction: column; gap: 4px; }
.card-body label > input, .card-body label > textarea, .card-body label > select { width: 100%; }

.cp-empty, .cc-empty {
  border: 1px dashed var(--app-border); border-radius: 12px; padding: 48px 24px;
  text-align: center; color: var(--app-muted); font-size: 13px; background: transparent;
}
.cp-empty h3, .cc-empty h3 { font-size: 15px; font-weight: 600; color: var(--app-text); margin: 0 0 6px; }
.cp-empty p, .cc-empty p { max-width: 440px; margin: 0 auto 8px; line-height: 1.6; }

/* avisos */
.cp-alert, .cc-flash, .theme-flash {
  display: flex; gap: 8px; align-items: flex-start;
  border-radius: 8px; padding: 8px 12px; margin-bottom: 16px; font-size: 13px;
  background: var(--app-subtle); color: var(--app-text); border: 0;
}
.cc-flash { display: block; }
.cp-alert-icon { flex: 0 0 auto; font-weight: 700; }
.cp-alert-error, .cc-flash-error, .run-status-error.flash { background: var(--bad-bg); color: var(--bad-text); }
.cp-alert-info, .cc-flash-success { background: var(--ok-bg); color: var(--ok-text); }
.cc-flash-warning { background: var(--warn-bg); color: var(--warn-text); }
.cc-flash code, .cp-alert code { background: transparent; border-color: currentColor; opacity: .9; }
.run-status-error { color: var(--bad-text); }
.run-status-success { color: var(--ok-text); }

/* tabelas (lista em caixa do Studio) */
table, .cp-table, .cc-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 0 0 16px; }
th, .cp-table th, .cc-table th {
  text-align: left; font-size: 12px; font-weight: 500; color: var(--app-muted);
  background: var(--app-subtle); border-bottom: 1px solid var(--app-border); padding: 8px 12px; white-space: nowrap;
}
td, .cp-table td, .cc-table td { border-bottom: 1px solid var(--app-border); padding: 8px 12px; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--app-subtle) 60%, transparent); }
.table-wrap, .cp-table-wrap { overflow-x: auto; border: 1px solid var(--app-border); border-radius: 12px; background: var(--app-surface); margin-bottom: 16px; }
.table-wrap table, .cp-table-wrap table { margin: 0; }

/* chips/badges (Badge do Studio) */
.badge, .cp-badge, .cc-badge, .flag-chip {
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: 6px; padding: 2px 6px; font-size: 11px; font-weight: 500; line-height: 1.4;
  background: var(--app-subtle); color: var(--app-muted); border: 0; text-transform: none;
}
.cp-badge-ok { background: var(--ok-bg); color: var(--ok-text); }
.cp-badge-warn, .cc-badge-warn { background: var(--warn-bg); color: var(--warn-text); }
.cp-badge-danger { background: var(--bad-bg); color: var(--bad-text); }
.cc-badge-scout, .cc-badge-dup { background: var(--violet-bg); color: var(--violet-text); text-decoration: none; }

.cp-chip, .cc-status, .cc-chip {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; padding: 2px 8px; font-size: 11px; font-weight: 500; line-height: 1.5; white-space: nowrap;
  background: var(--app-subtle); color: var(--app-muted);
}
.cp-chip::before, .cc-status::before, .cc-chip::before {
  content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; opacity: .85;
}
.cp-chip-active, .cp-chip-completed, .cp-chip-ready,
.cc-status-selected, .cc-status-approved, .cc-status-active, .cc-status-completed, .cc-status-ready, .cc-status-healthy, .cc-status-ok,
.cc-chip-selected { background: var(--ok-bg); color: var(--ok-text); }
.cp-chip-running, .cp-chip-searching, .cp-chip-mapping, .cp-chip-researching,
.cc-status-maybe, .cc-status-saved, .cc-status-running, .cc-status-paused, .cc-status-mapping, .cc-status-researching,
.cc-status-searching, .cc-status-enriching, .cc-status-completed_no_results, .cc-status-possibly_stalled, .cc-status-queued,
.cc-chip-maybe { background: var(--warn-bg); color: var(--warn-text); }
.cp-chip-failed,
.cc-status-discarded, .cc-status-rejected, .cc-status-failed, .cc-status-completed_partial, .cc-status-completed_below_target,
.cc-status-cancelled, .cc-chip-discarded { background: var(--bad-bg); color: var(--bad-text); }
.cc-status-unreviewed, .cc-status-pending, .cc-status-draft, .cc-status-archived, .cc-chip-unreviewed { background: var(--app-subtle); color: var(--app-muted); }

/* filtros em pílula (Chip do Studio) */
.cp-filters { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.cp-filter, .cc-view {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px;
  border-radius: 999px; border: 1px solid transparent; font-size: 12px; font-weight: 500;
  color: var(--app-faint); text-decoration: none; transition: color 120ms;
}
.cp-filter:hover, .cc-view:hover { color: var(--app-muted); }
.cp-filter.active, .cc-view-active { border-color: var(--app-strong-border); background: var(--app-surface); color: var(--app-text); box-shadow: var(--shadow-xs); }

.cp-card-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: auto; padding-top: 4px; }
.cp-list { display: flex; flex-direction: column; gap: 12px; }
.cp-meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 0; }
.cp-meta-grid dt { font-size: 11px; color: var(--app-faint); margin-bottom: 2px; }
.cp-meta-grid dd { margin: 0; font-size: 13px; font-weight: 500; }
.cp-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.meta, .results-count { color: var(--app-muted); font-size: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }

/* ---------- login (PinScreen do Studio) ---------- */
.login-screen {
  min-height: 100%; display: flex; align-items: center; justify-content: center;
  padding: env(safe-area-inset-top) 24px 0; background: var(--app-bg);
}
.login-box { width: 100%; max-width: 320px; text-align: center; }
.login-logo {
  margin: 0 auto 16px; display: flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; border-radius: 16px; background: var(--app-accent); color: var(--app-accent-text);
}
.login-box h1 { font-size: 18px; margin: 0; }
.login-box .page-sub { margin-top: 4px; }
.login-box input:not([type="hidden"]) { width: 100%; height: 40px; margin-top: 8px; }
.login-box input[name="username"] { margin-top: 20px; }
.login-box .login-error { margin: 8px 0 0; font-size: 13px; color: var(--bad-text); }
.login-box .btn-primary { width: 100%; height: 40px; margin-top: 12px; }
.login-box .login-hint { margin-top: 16px; font-size: 12px; color: var(--app-faint); }

/* ---------- canais ---------- */
.channel-form .card-body { gap: 12px; }
.channel-form-head { display: flex; align-items: baseline; gap: 8px; }
.channel-form-head h2 { font-size: 15px; margin: 0; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px 16px; }
.field-hint { display: block; margin-top: 2px; font-size: 11px; font-weight: 400; color: var(--app-faint); overflow-wrap: anywhere; }
