/* ============================================================
   Agência N4 — Design System
   Primário: #590158 | Destaque: #FBDA25 | Fundo: #FFFFFF
   ============================================================ */

:root {
  --color-primary: #590158;
  --color-primary-dark: #3d003c;
  --color-primary-light: #7a1279;
  --color-accent: #FBDA25;
  --color-accent-dark: #e5c510;
  /* Pontes para os tokens do N4 Orbit (orbit.css) — mantêm todo componente
     que já usa var(--color-bg)/var(--color-surface)/etc. (cards, tabelas,
     modais, badges...) consciente de tema claro/escuro sem reescrever cada
     seletor individualmente. Fallback hex preserva o valor original caso
     orbit.css não esteja carregado. */
  --color-bg: var(--bg-surface, #FFFFFF);
  --color-surface: var(--bg-elevated, #f7f7f8);
  --color-surface-2: var(--bg-overlay, #f0f0f2);
  --color-border: var(--border-default, #e4e4e7);
  --color-text: var(--text-primary, #18181b);
  --color-text-muted: var(--text-secondary, #71717a);
  --color-text-light: var(--text-muted, #a1a1aa);
  --color-success: #16a34a;
  --color-error: #dc2626;
  --color-warning: #d97706;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,.1);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.12);

  --sidebar-width: 220px;
  --header-height: 60px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ── */
.header {
  height: var(--header-height);
  background: var(--color-primary);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(89,1,88,.3);
}
.header-inner {
  max-width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo-mark {
  background: var(--color-accent);
  color: var(--color-primary-dark);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.5px;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.logo-text { display: flex; flex-direction: column; }
.logo-name { color: #fff; font-weight: 600; font-size: 14px; line-height: 1.2; }
.logo-sub { color: rgba(255,255,255,0.55); font-size: 11px; }

.header-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary, rgba(255,255,255,0.75));
  font-size: 12px;
}
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--color-text-light);
  transition: background .3s;
}
.status-dot--running { background: var(--color-accent); animation: pulse 1s infinite; }
.status-dot--done    { background: var(--color-success); }

.header-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: 16px;
  border-left: 1px solid rgba(255,255,255,0.15);
}
.header-user-name {
  color: rgba(255,255,255,0.85);
  font-size: 13px;
  font-weight: 500;
}
.btn-logout {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s;
}
.btn-logout:hover { background: rgba(255,255,255,0.12); }

.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.users-table th {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-weight: 500;
}
.users-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
.status-dot--error   { background: var(--color-error); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .4; }
}

/* ── Layout ── */
.layout {
  display: flex;
  flex: 1;
  min-height: calc(100vh - var(--header-height));
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  flex-shrink: 0;
}
.sidebar-section { padding: 16px 12px 0; flex: 1; }
.sidebar-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--color-text-light);
  padding: 0 8px;
  margin-bottom: 8px;
}
.client-list { list-style: none; }
.client-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s;
  margin-bottom: 2px;
}
.client-item:hover { background: var(--color-surface-2); }
.client-item--active {
  background: var(--color-primary);
  color: #fff;
}
.client-item--active .client-avatar {
  background: var(--color-accent);
  color: var(--color-primary-dark);
}
.client-avatar {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: var(--color-primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}
.client-name { font-size: 13px; font-weight: 500; }
.client-empty { padding: 10px; font-size: 12px; color: var(--color-text-light); }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--color-border);
}
.sidebar-link {
  display: block;
  font-size: 12px;
  color: var(--color-text-muted);
  text-decoration: none;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: background .15s, color .15s;
}
.sidebar-link:hover { background: var(--color-surface-2); color: var(--color-text); }

/* ── Main Panel ── */
.panel {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
  max-width: calc(100vw - var(--sidebar-width));
}

/* ── Empty State ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 60vh;
  text-align: center;
  color: var(--color-text-muted);
}
.empty-icon { font-size: 48px; margin-bottom: 16px; filter: grayscale(.3); }
.empty-state h2 { font-size: 20px; color: var(--color-text); margin-bottom: 8px; }
.empty-state p { font-size: 14px; max-width: 320px; line-height: 1.6; }

/* ── Client Header ── */
.client-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--color-border);
}
.client-header-avatar {
  width: 52px; height: 52px;
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius-md);
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  flex-shrink: 0;
}
.client-header-name { font-size: 22px; font-weight: 700; text-transform: capitalize; }
.client-header-sub { font-size: 13px; color: var(--color-text-muted); margin-top: 2px; }

/* ── Section Title ── */
.section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--color-text-light);
  margin-bottom: 14px;
}

/* ── Agents Grid ── */
.agents-section { margin-bottom: 24px; }
.agents-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
@media (max-width: 900px) {
  .agents-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .agents-grid { grid-template-columns: 1fr; }
}
.agent-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border: 1.5px solid var(--border-default, var(--color-border));
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  position: relative;
  background: var(--bg-surface, var(--color-bg));
}
.agent-card:not(.agent-card--soon):hover {
  border-color: var(--accent-primary, var(--color-primary-light));
}
.agent-card--active {
  border-color: var(--accent-primary, var(--color-primary)) !important;
  background: rgba(124,58,237,.12);
}
.agent-card--soon {
  opacity: 0.4;
  cursor: not-allowed;
}
.agent-icon {
  width: 24px; height: 24px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary, var(--color-text-muted));
}
.agent-icon svg { width: 24px; height: 24px; }
.agent-card--active .agent-icon,
.agent-card:not(.agent-card--soon):hover .agent-icon { color: var(--accent-primary, var(--color-primary)); }
.agent-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary, var(--color-text));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.agent-badge {
  font-size: 10px;
  font-weight: 600;
  background: var(--color-surface-2);
  color: var(--color-text-light);
  padding: 2px 7px;
  border-radius: 20px;
  flex-shrink: 0;
}

/* ── Run Section ── */
.run-section { display: flex; align-items: center; gap: var(--space-4, 16px); margin-bottom: 28px; }
.btn-run:disabled {
  background: var(--color-text-light) !important;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.btn-run--running {
  opacity: 0.7 !important;
  cursor: not-allowed !important;
}
.btn-run-icon { display: inline-flex; align-items: center; }
.btn-run-icon--spinner { display: none; }
.btn-run--running .btn-run-icon--play { display: none; }
.btn-run--running .btn-run-icon--spinner { display: inline-flex; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.run-info { font-size: var(--text-sm, 13px); color: var(--text-muted, var(--color-text-muted)); }
.run-info--ready { color: var(--accent-primary, var(--color-primary)); font-weight: 500; }
.run-info--error { color: var(--status-error, var(--color-error)); font-weight: 500; }

/* ── Output Section ── */
.output-section {
  border: 1px solid var(--border-subtle, var(--color-border));
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  background: var(--bg-surface, var(--color-bg));
}
.output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-elevated, var(--color-surface));
  border-bottom: 1px solid var(--border-subtle, var(--color-border));
}
.output-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}
.output-agent { color: var(--color-primary); }
.output-sep { color: var(--color-text-light); }
.output-client { color: var(--color-text-muted); }
.output-actions { display: flex; gap: 6px; }

.btn-action {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: var(--font-sans);
  cursor: pointer;
  color: var(--color-text-muted);
  transition: background .15s, color .15s, border-color .15s;
}
.btn-action:hover { background: var(--color-surface-2); color: var(--color-text); }
.btn-action--danger:hover { background: #fff1f1; border-color: #fca5a5; color: var(--color-error); }

.output-body {
  padding: 16px 18px;
  min-height: 200px;
  max-height: 70vh;
  overflow-y: auto;
  background: var(--bg-elevated, var(--color-bg));
}

/* ── Rendered Markdown ── */
.output-rendered {
  font-size: var(--text-sm, 13px);
  line-height: 1.7;
  color: var(--color-text);
}
.output-rendered h1 { font-size: 22px; font-weight: 600; margin: 0 0 16px; color: var(--text-primary, var(--color-text)); border-bottom: 2px solid var(--color-accent); padding-bottom: 8px; }
.output-rendered h2 { font-size: 17px; font-weight: 600; margin: 28px 0 12px; color: var(--text-primary, var(--color-text)); }
.output-rendered h3 { font-size: 15px; font-weight: 600; margin: 20px 0 8px; color: var(--text-primary, var(--color-text)); }
.output-rendered h4 { font-size: 13px; font-weight: 600; margin: 16px 0 6px; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: .04em; }
.output-rendered p { margin-bottom: 12px; }
.output-rendered ul, .output-rendered ol { padding-left: 20px; margin-bottom: 12px; }
.output-rendered li { margin-bottom: 4px; }
.output-rendered strong { font-weight: 600; color: var(--color-text); }
.output-rendered em { font-style: italic; color: var(--color-text-muted); }
.output-rendered code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--color-surface);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--color-primary);
}
.output-rendered pre {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  overflow-x: auto;
  margin-bottom: 16px;
}
.output-rendered pre code { background: none; padding: 0; color: var(--color-text); }
.output-rendered blockquote {
  border-left: 3px solid var(--color-accent);
  padding: 10px 16px;
  margin: 16px 0;
  background: #fffbeb;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: var(--color-text-muted);
}
/* Tabelas dentro do output do agente seguem o visual de .orbit-table
   automaticamente (marked.js gera <table> sem classe própria). */
.agent-output table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
  font-size: var(--text-sm, 13px);
}
.agent-output th {
  text-align: left;
  font-size: var(--text-xs, 11px);
  font-weight: 600;
  color: var(--text-muted, var(--color-text-muted));
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle, var(--color-border));
}
.agent-output td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle, var(--color-border));
  color: var(--text-secondary, var(--color-text));
}
.agent-output tr:hover td { background: var(--bg-elevated, var(--color-surface)); }
.output-rendered hr { border: none; border-top: 1px solid var(--color-border); margin: 24px 0; }

/* ── Raw Markdown ── */
.output-raw {
  font-family: var(--font-mono);
  font-size: var(--text-sm, 13px);
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--color-text);
  line-height: 1.7;
}

/* ── Output States ── */
.output-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--color-text-muted);
  font-size: 13px;
  padding: 20px 0;
}
.output-error {
  color: var(--color-error);
  background: #fff1f1;
  border: 1px solid #fca5a5;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 13px;
}

.cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--color-primary);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink .8s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ── Spinner ── */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* ── Output Footer ── */
.output-footer {
  padding: 10px 16px;
  background: var(--bg-elevated, var(--color-surface));
  border-top: 1px solid var(--border-subtle, var(--color-border));
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--color-success);
}
.btn-toggle-raw {
  background: none;
  border: none;
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--color-text-muted);
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}
.btn-toggle-raw:hover { color: var(--color-text); }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--color-text);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  transform: translateY(80px);
  opacity: 0;
  transition: transform .3s ease, opacity .3s ease;
  z-index: 1000;
}
.toast--show { transform: translateY(0); opacity: 1; }

/* ── Context Section ── */
.context-section {
  background: var(--bg-surface, var(--color-surface));
  border: 1px solid var(--border-subtle, var(--color-border));
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 20px;
}
.context-textarea {
  width: 100%;
  min-height: 140px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--color-text);
  resize: vertical;
  line-height: 1.5;
  transition: border-color .15s, box-shadow .15s;
  margin-top: 10px;
}
.context-textarea:focus {
  outline: none;
  border-color: var(--color-primary-light);
  box-shadow: 0 0 0 3px rgba(89,1,88,.08);
}
.context-textarea::placeholder { color: var(--color-text-light); }

/* ── Linha compacta de período/modo (Contexto adicional) ── */
.period-row {
  display: flex;
  align-items: center;
  gap: var(--space-4, 16px);
  flex-wrap: wrap;
}
.period-row-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.period-row-label {
  font-size: var(--text-xs, 11px);
  font-weight: 600;
  color: var(--text-muted, var(--color-text-muted));
  text-transform: uppercase;
  letter-spacing: .04em;
}
.period-row-sep {
  width: 1px;
  align-self: stretch;
  background: var(--border-subtle, var(--color-border));
}
.form-select.period-select, .form-input.period-input {
  width: auto;
  height: 32px;
  padding: 0 10px;
  font-size: var(--text-sm, 13px);
}

.frequency-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
  flex-wrap: wrap;
}
.frequency-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
}
.frequency-input {
  width: 72px;
  padding: 6px 10px;
  border: 2px solid var(--color-primary);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 700;
  color: var(--color-primary);
  text-align: center;
  transition: border-color .15s, box-shadow .15s;
}
.frequency-input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(89,1,88,.12);
}
.frequency-hint {
  font-size: 12px;
  color: var(--color-text-muted);
}
.frequency-hint strong { color: var(--color-primary); }

/* ── Refine Section ── */
.refine-section {
  padding: 14px 18px;
  background: var(--bg-elevated, #fdf8ff);
  border-top: 1px solid var(--border-subtle, var(--color-border));
}
.refine-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.refine-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-primary, var(--color-primary));
}
.refine-hint {
  font-size: 11px;
  color: var(--text-muted, var(--color-text-muted));
}
.refine-textarea {
  width: 100%;
  min-height: 80px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--color-text);
  resize: vertical;
  line-height: 1.5;
  transition: border-color .15s, box-shadow .15s;
  margin-bottom: 12px;
}
.refine-textarea:focus {
  outline: none;
  border-color: var(--color-primary-light);
  box-shadow: 0 0 0 3px rgba(89,1,88,.08);
}
.refine-textarea::placeholder { color: var(--color-text-light); }

.refine-actions { display: flex; justify-content: flex-end; }

.btn-refine {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--color-accent);
  color: var(--color-primary-dark);
  border: none;
  border-radius: var(--radius-md);
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background .15s, transform .1s, box-shadow .15s;
  box-shadow: var(--shadow-sm);
}
.btn-refine:hover:not(:disabled) {
  background: var(--color-accent-dark);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.btn-refine:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

/* ── Spinner small ── */
.spinner-sm {
  display: inline-block;
  width: 13px; height: 13px;
  border: 2px solid rgba(89,1,88,.3);
  border-top-color: var(--color-primary-dark);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
}

/* ── Tabs Bar ── */
.tabs-bar {
  display: none;
  gap: 2px;
  padding: 8px 12px 0;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
  overflow-x: auto;
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: none;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  position: relative;
  bottom: -1px;
  transition: background .12s, color .12s;
  white-space: nowrap;
}
.tab:hover { background: var(--color-surface-2); color: var(--color-text); }
.tab--active {
  background: var(--color-bg);
  border-color: var(--color-border);
  color: var(--color-primary);
  font-weight: 600;
}
.tab-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.tab-dot--aprovado { background: var(--color-success); }
.tab-dot--ajuste   { background: var(--color-warning); }
.tab-dot--refacao  { background: var(--color-error); }

/* ── Approval Section ── */
.approval-section {
  display: none;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 18px;
  background: var(--bg-elevated, var(--color-surface));
  border-top: 1px solid var(--border-subtle, var(--color-border));
}
.approval-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted, var(--color-text-muted));
  margin-right: 4px;
}
.btn-approval {
  padding: var(--space-2, 6px) var(--space-4, 14px);
  border: 2px solid transparent;
  border-radius: var(--radius-md, var(--radius-sm));
  font-family: var(--font-sans);
  font-size: var(--text-xs, 12px);
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, filter .15s;
}
.btn-approval:hover { filter: brightness(1.15); }
/* Sempre com a cor semântica translúcida — o estado ativo (selecionado)
   só acrescenta a borda sólida correspondente. */
.btn-approval--aprovado { background: rgba(34,197,94,.15); color: #4ade80; }
.btn-approval--ajuste   { background: rgba(251,218,37,.15); color: var(--orbit-yellow-600, #92400e); }
.btn-approval--refacao  { background: rgba(239,68,68,.15); color: #f87171; }
.btn-approval--aprovado.btn-approval--active { border-color: var(--status-success, #16a34a); }
.btn-approval--ajuste.btn-approval--active   { border-color: var(--status-warning, var(--color-warning)); }
.btn-approval--refacao.btn-approval--active  { border-color: var(--status-error, var(--color-error)); }
.approval-timestamp {
  font-size: 11px;
  color: var(--color-text-light);
  font-style: italic;
}

/* ── History Section ── */
.history-section { margin-bottom: 20px; }
.history-section-header { padding: 0 0 12px; }
.history-section-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: none;
  border: none;
  font-family: var(--font-sans);
  text-align: left;
  cursor: pointer;
  padding: 0 0 12px;
  -webkit-appearance: none;
  appearance: none;
}
.history-section-toggle:hover .section-title { color: var(--text-secondary, var(--color-text-muted)); }
.history-section-toggle .history-month-chevron { color: var(--text-muted, var(--color-text-light)); }
.history-month {
  background: var(--bg-surface, var(--color-bg));
  border: 1px solid var(--border-subtle, var(--color-border));
  border-radius: var(--radius-lg, var(--radius-md));
  margin-bottom: 12px;
  overflow: hidden;
}
.history-month:last-child { margin-bottom: 0; }
.history-month-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  background: none;
  border: none;
  font-family: var(--font-sans);
  text-align: left;
  cursor: pointer;
  transition: background .12s;
}
.history-month-header:hover { background: var(--color-surface-2); }
.history-month-chevron { font-size: 10px; color: var(--color-text-light); flex-shrink: 0; }
.history-month-label { font-size: 13px; font-weight: 600; flex: 1; }
.history-month-count { font-size: 11px; color: var(--color-text-light); }
.history-month-body { padding: 4px 16px 12px; }
.history-agent-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--color-surface-2);
  font-size: 13px;
}
.history-agent-row:last-of-type { border-bottom: none; }
.history-agent-icon { font-size: 14px; flex-shrink: 0; }
.history-agent-name { flex: 1; font-weight: 500; }
.history-status-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}
.history-status--aprovado  { background: #dcfce7; color: #15803d; }
.history-status--ajuste    { background: #fef9c3; color: #92400e; }
.history-status--refacao   { background: #fee2e2; color: #b91c1c; }
.history-status--arquivado { background: var(--color-surface-2); color: var(--color-text-muted); }
.history-agent-date { font-size: 11px; color: var(--color-text-light); white-space: nowrap; }

/* ── Versioning ── */
.history-agent-block { padding: 8px 0; border-bottom: 1px solid var(--color-border); }
.history-agent-block:last-child { border-bottom: none; }
.history-agent-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.history-versions { display: flex; flex-direction: column; gap: 4px; padding-left: 22px; }
.history-version-row {
  display: flex; align-items: center; gap: 8px;
  padding: 3px 0;
}
.version-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: #e0e7ff; color: #3730a3;
  font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 999px;
  letter-spacing: .03em; flex-shrink: 0;
}
.btn-edit-version {
  font-size: 11px; padding: 2px 8px;
  background: none; border: 1px solid #cbd5e1; color: #475569;
  border-radius: var(--radius-sm); cursor: pointer;
  font-family: var(--font-sans);
  transition: background .15s, color .15s;
  margin-left: auto;
}
.btn-edit-version:hover { background: #f1f5f9; color: #1e293b; }
.btn-delete-version {
  font-size: 11px; padding: 2px 8px;
  background: none; border: 1px solid #fca5a5; color: #b91c1c;
  border-radius: var(--radius-sm); cursor: pointer;
  font-family: var(--font-sans);
  transition: background .15s, color .15s;
}
.btn-delete-version:hover { background: #fee2e2; }
.modal-edit-textarea {
  width: 100%; box-sizing: border-box;
  min-height: 380px; resize: vertical;
  font-family: var(--font-mono, monospace); font-size: 13px;
  line-height: 1.6; padding: 12px;
  border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  background: var(--color-surface-2); color: var(--color-text);
}

.btn-history-view {
  padding: 6px 14px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background .15s;
}
.btn-history-view:hover { background: var(--color-primary-light); }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-text-light); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; border-right: none; border-bottom: 1px solid var(--color-border); flex-direction: row; }
  .nav { flex-direction: row; overflow-x: auto; padding: 4px; }
  .nav-label { display: none; }
  .panel { padding: 20px 16px; max-width: 100%; }
  .agents-grid { grid-template-columns: 1fr; }
  .clients-grid { grid-template-columns: 1fr; }
  .run-section { flex-direction: column; align-items: stretch; }
  .btn-run { justify-content: center; }
  .output-body { padding: 16px; }
  .modal-box { width: 98vw; max-height: 95vh; }
  .modal-tabs { overflow-x: auto; }
  .calendar-layout { flex-direction: column; }
}

/* ══════════════════════════════════════════════════════════════════
   NEW NAVIGATION SIDEBAR
══════════════════════════════════════════════════════════════════ */

.sidebar {
  width: 180px;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  flex-shrink: 0;
  padding: 12px 8px;
}

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-divider { height: 1px; background: var(--color-border); margin: 6px 4px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--color-surface-2); color: var(--color-text); }
.nav-item--active {
  background: var(--color-primary);
  color: #fff;
}
.nav-icon { font-size: 16px; flex-shrink: 0; }
.nav-label { font-size: 13px; }
a.nav-item { text-decoration: none; box-sizing: border-box; }

/* ══════════════════════════════════════════════════════════════════
   HEADER ADDITIONS
══════════════════════════════════════════════════════════════════ */

.header-right { display: flex; align-items: center; gap: 16px; }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.breadcrumb-back {
  background: none;
  border: none;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-secondary, rgba(255,255,255,0.75));
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background .12s;
}
.breadcrumb-back:hover { background: var(--bg-elevated, rgba(255,255,255,.1)); color: var(--text-primary, #fff); }
.breadcrumb-sep { color: var(--text-muted, rgba(255,255,255,.4)); }
.breadcrumb-current { color: var(--text-primary, #fff); font-weight: 600; }
.btn-edit-briefing {
  display: inline-flex;
  align-items: center;
  background: rgba(251,218,37,.15);
  border: 1px solid rgba(251,218,37,.4);
  color: var(--color-accent);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .12s;
}
.btn-edit-briefing:hover { background: rgba(251,218,37,.25); }

/* ══════════════════════════════════════════════════════════════════
   VIEW SYSTEM
══════════════════════════════════════════════════════════════════ */

.panel { flex: 1; padding: 28px 32px; overflow-y: auto; max-width: calc(100vw - 180px); }

.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--color-border);
}
.view-title { font-size: 22px; font-weight: 700; color: var(--color-text); margin-bottom: 2px; }
.view-subtitle { font-size: 13px; color: var(--color-text-muted); margin-top: 2px; }

.placeholder-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 40vh;
  color: var(--color-text-muted);
  text-align: center;
}
.placeholder-icon { font-size: 40px; margin-bottom: 12px; filter: grayscale(.3); }

/* ══════════════════════════════════════════════════════════════════
   BUTTONS (new styles)
══════════════════════════════════════════════════════════════════ */

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background .15s, transform .1s;
  white-space: nowrap;
}
.btn-primary:hover { background: var(--color-primary-light); transform: translateY(-1px); }
.btn-primary:disabled { background: var(--color-text-light); cursor: not-allowed; transform: none; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--color-surface-2);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background .15s;
}
.btn-secondary:hover { background: var(--color-border); }

/* ══════════════════════════════════════════════════════════════════
   CLIENTS GRID
══════════════════════════════════════════════════════════════════ */

.clients-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.client-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .1s;
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.client-card:hover {
  border-color: var(--color-primary-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.client-card-avatar {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -0.5px;
}
.client-card-info { flex: 1; }
.client-card-name { font-size: 15px; font-weight: 700; color: var(--color-text); margin-bottom: 2px; }
.client-card-segment { font-size: 12px; color: var(--color-text-muted); margin-bottom: 2px; }
.client-card-city { font-size: 12px; color: var(--color-text-light); }
.client-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--color-surface-2);
}
.client-card-badges { display: flex; gap: 4px; flex-wrap: wrap; }

.service-badge {
  font-size: 10px;
  font-weight: 600;
  background: #f0e8ff;
  color: var(--color-primary);
  border: 1px solid #ddd0ff;
  padding: 2px 7px;
  border-radius: 20px;
}

.status-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
}
.status-badge--ativo   { background: #dcfce7; color: #15803d; }
.status-badge--inativo { background: var(--color-surface-2); color: var(--color-text-muted); }

.clients-loading { padding: 40px; text-align: center; color: var(--color-text-muted); font-size: 14px; }
.clients-empty { padding: 60px 20px; text-align: center; color: var(--color-text-muted); }
.clients-empty .empty-icon { font-size: 40px; margin-bottom: 12px; }

/* ══════════════════════════════════════════════════════════════════
   MODAL SYSTEM
══════════════════════════════════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay[hidden] { display: none !important; }

.modal-box {
  background: var(--color-bg);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 820px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-box--md { max-width: 680px; }
.modal-box--lg { max-width: 900px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.modal-header h2 { font-size: 17px; font-weight: 700; }

.btn-modal-close {
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--color-text-muted);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: background .12s, color .12s;
}
.btn-modal-close:hover { background: var(--color-surface-2); color: var(--color-text); }

.modal-tabs {
  display: flex;
  gap: 2px;
  padding: 8px 12px 0;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
  overflow-x: auto;
}
.modal-tab {
  padding: 7px 13px;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: none;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  bottom: -1px;
  transition: background .12s, color .12s;
}
.modal-tab:hover { background: var(--color-surface-2); color: var(--color-text); }
.modal-tab--active {
  background: var(--color-bg);
  border-color: var(--color-border);
  color: var(--color-primary);
  font-weight: 600;
}

.modal-body {
  flex: 1;
  padding: 20px;
}
.modal-body--scrollable { overflow-y: auto; }

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
  flex-shrink: 0;
}

.modal-tab-prev, .modal-tab-next {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background .12s, color .12s;
}
.modal-tab-prev:hover, .modal-tab-next:hover { background: var(--color-surface-2); color: var(--color-text); }

/* ══════════════════════════════════════════════════════════════════
   FORM COMPONENTS
══════════════════════════════════════════════════════════════════ */

.form-section { display: flex; flex-direction: column; gap: 16px; }
.form-section[hidden] { display: none !important; }
.form-group { display: flex; flex-direction: column; gap: 5px; flex: 1; }
.form-group--xs { max-width: 90px; }
.form-row { display: flex; gap: 12px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: .04em; }
.form-hint { font-size: 12px; color: var(--color-text-muted); line-height: 1.5; }

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--color-text);
  line-height: 1.4;
  transition: border-color .15s, box-shadow .15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--color-primary-light);
  box-shadow: 0 0 0 3px rgba(89,1,88,.08);
}
.form-textarea { resize: vertical; }
.form-input::placeholder, .form-textarea::placeholder { color: var(--color-text-light); }

.checkbox-group { display: flex; flex-wrap: wrap; gap: 8px; }
.checkbox-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--color-text);
  cursor: pointer;
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  transition: border-color .12s, background .12s;
}
.checkbox-item:hover { border-color: var(--color-primary-light); background: #faf0fa; }
.checkbox-item input { margin: 0; accent-color: var(--color-primary); }

.color-input-wrap { display: flex; align-items: center; gap: 8px; }
.color-input-wrap input[type="color"] {
  width: 36px; height: 36px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 2px;
  cursor: pointer;
  flex-shrink: 0;
}

.months-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

/* ══════════════════════════════════════════════════════════════════
   AGENTS CATALOG
══════════════════════════════════════════════════════════════════ */

.agents-catalog { display: flex; flex-direction: column; gap: 12px; }

.agent-catalog-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  background: var(--color-bg);
  transition: box-shadow .15s;
}
.agent-catalog-card:hover { box-shadow: var(--shadow-sm); }

.agent-catalog-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}
.agent-catalog-icon { font-size: 28px; flex-shrink: 0; }
.agent-catalog-meta { display: flex; flex-direction: column; gap: 3px; }
.agent-catalog-name { font-size: 15px; font-weight: 700; }
.agent-catalog-desc { font-size: 13px; color: var(--color-text-muted); line-height: 1.5; }

.agent-status {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  display: inline-block;
}
.agent-status--active { background: #dcfce7; color: #15803d; }
.agent-status--soon { background: var(--color-surface-2); color: var(--color-text-light); }

/* ══════════════════════════════════════════════════════════════════
   CALENDAR
══════════════════════════════════════════════════════════════════ */

.calendar-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.calendar-month-title { font-size: 20px; font-weight: 700; flex: 1; text-align: center; }
.btn-cal-nav {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s;
}
.btn-cal-nav:hover { background: var(--color-border); }
.calendar-filters { display: flex; gap: 8px; }
.calendar-filters select { padding: 7px 10px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); font-family: var(--font-sans); font-size: 13px; background: var(--color-bg); }

.calendar-layout { display: flex; gap: 20px; }
.calendar-main { flex: 1; }

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 6px;
  padding: 0 2px;
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-day {
  min-height: 72px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 6px;
  cursor: pointer;
  transition: background .12s, border-color .12s;
  position: relative;
  background: var(--color-bg);
}
.cal-day:hover { background: var(--color-surface); border-color: var(--color-primary-light); }
.cal-day--empty { background: transparent; border-color: transparent; cursor: default; }
.cal-day--empty:hover { background: transparent; border-color: transparent; }
.cal-day--today { border-color: var(--color-primary); background: #faf0fa; }
.cal-day--today .cal-day-num { color: var(--color-primary); font-weight: 700; }
.cal-day--has-events { background: #fffbf5; }
.cal-day-num { font-size: 13px; font-weight: 500; color: var(--color-text); display: block; margin-bottom: 4px; }
.cal-dots { display: flex; flex-wrap: wrap; gap: 3px; }
.cal-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.cal-more { font-size: 10px; color: var(--color-text-muted); font-weight: 600; }

.calendar-sidebar {
  width: 280px;
  flex-shrink: 0;
}
.calendar-sidebar-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--color-text-light); margin-bottom: 10px; }

.calendar-events-list { display: flex; flex-direction: column; gap: 4px; max-height: 460px; overflow-y: auto; }
.cal-event-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  font-size: 12px;
}
.cal-event-item--client { background: #f0e8ff; }
.cal-event-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 3px; }
.cal-event-day { font-weight: 700; color: var(--color-text-muted); min-width: 22px; flex-shrink: 0; }
.cal-event-name { flex: 1; color: var(--color-text); line-height: 1.4; }
.cal-event-type { font-size: 10px; font-weight: 600; color: var(--color-text-light); white-space: nowrap; }
.cal-client-events-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--color-primary); margin: 10px 0 4px; padding: 0 8px; }

.calendar-day-detail {
  margin-top: 12px;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-md);
  padding: 12px;
  background: #faf0fa;
}
.calendar-day-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13px;
}

/* ══════════════════════════════════════════════════════════════════
   REPORT BUILDER
══════════════════════════════════════════════════════════════════ */

.report-steps-bar {
  display: flex;
  align-items: center;
  margin-bottom: 6px;
  padding: 0 8px;
  max-width: 600px;
}
.report-step-dot {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-light);
  background: var(--color-bg);
  flex-shrink: 0;
  transition: all .2s;
}
.report-step-dot.active { border-color: var(--color-primary); color: var(--color-primary); background: #faf0fa; }
.report-step-dot.done   { border-color: var(--color-primary); color: #fff; background: var(--color-primary); }
.report-step-line { flex: 1; height: 2px; background: var(--color-border); }

.report-steps-labels {
  display: flex;
  justify-content: space-between;
  max-width: 600px;
  padding: 4px 8px 16px;
  font-size: 11px;
  color: var(--color-text-muted);
  font-weight: 500;
}

.report-step-panel { max-width: 700px; }
.report-step-title { font-size: 18px; font-weight: 700; margin-bottom: 20px; }
.step-actions { display: flex; gap: 10px; margin-top: 24px; }

.module-list { display: flex; flex-direction: column; gap: 8px; }
.module-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  background: var(--color-bg);
}
.module-item:hover { border-color: var(--color-primary-light); background: #faf0fa; }
.module-item input { accent-color: var(--color-primary); width: 18px; height: 18px; flex-shrink: 0; cursor: pointer; }
.module-item-body { display: flex; flex-direction: column; gap: 2px; }
.module-item-body strong { font-size: 14px; font-weight: 600; }
.module-item-body span { font-size: 12px; color: var(--color-text-muted); }

.metrics-section { margin-bottom: 24px; }
.metrics-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--color-surface-2);
}

.report-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

/* ══════════════════════════════════════════════════════════════════
   HISTORIC CONSOLIDATED EDITING
══════════════════════════════════════════════════════════════════ */

.hist-section { margin-bottom: 0; }

.hist-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.hist-section-title { flex: 1; min-width: 0; }
.hist-section-title h2 { margin-top: 0 !important; }
.hist-section-title p { margin: 0; }

.hist-section-body { padding-left: 4px; }

.hist-section-edit { padding: 4px 0; }

.hist-edit-ta {
  font-family: var(--font-mono) !important;
  font-size: 12px !important;
  line-height: 1.6;
}

.hist-edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* History month actions */
.history-month-actions { padding-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }

.btn-history-download {
  padding: 6px 14px;
  background: var(--color-surface-2);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background .15s;
}
.btn-history-download:hover { background: var(--color-border); }

/* Social media mode selector */
.sm-mode-opt { padding: 8px 14px; }
.sm-mode-opt input[type="radio"] { accent-color: var(--color-primary); }

/* ── Upload de referências visuais ─────────────────────────────────────────── */
.btn-upload-ref {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--color-surface-2);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn-upload-ref:hover { background: var(--color-border); border-color: var(--color-primary); }

.ref-file-list { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.ref-file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}
.ref-file-preview {
  width: 36px; height: 36px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--color-border);
  flex-shrink: 0;
}
.ref-file-icon { font-size: 20px; flex-shrink: 0; width: 36px; text-align: center; }
.ref-file-name { flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ref-file-size { font-size: 12px; color: var(--color-text-muted); flex-shrink: 0; }
.ref-file-del {
  background: none; border: none;
  color: var(--color-text-muted);
  cursor: pointer; padding: 2px 6px;
  font-size: 16px; line-height: 1;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  transition: color .15s;
}
.ref-file-del:hover { color: var(--color-error); }
.ref-file-empty { font-size: 13px; color: var(--color-text-muted); padding: 4px 0; }

/* ══════════════════════════════════════════════════════════════════
   MÓDULO PROJETOS
══════════════════════════════════════════════════════════════════ */

.filters-bar {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 22px;
}
.filter-group { display: flex; flex-direction: column; gap: 5px; }
.filter-group .form-label { margin-bottom: 0; }
.filter-group .form-select, .filter-group .orbit-select { min-width: 190px; }

.page-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 22px;
}

/* ── Project cards ── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.project-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color .15s, box-shadow .15s, transform .1s;
}
.project-card:hover { border-color: var(--color-primary-light); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.project-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.project-card-name { font-size: 15px; font-weight: 700; color: var(--color-text); margin-bottom: 2px; }
.project-card-client { font-size: 12px; color: var(--color-text-muted); }
.project-card-month { font-size: 12px; color: var(--color-text-light); margin-top: 2px; }
.status-badge--em_andamento { background: #fef9c3; color: #92400e; }
.status-badge--concluido    { background: #dcfce7; color: #15803d; }

.progress-track {
  background: var(--color-surface-2);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}
.progress-fill { background: var(--color-primary); height: 100%; border-radius: 999px; transition: width .3s; }
.progress-row { display: flex; align-items: center; gap: 8px; }
.progress-label { font-size: 11px; color: var(--color-text-muted); white-space: nowrap; }

.project-card-footer { display: flex; justify-content: flex-end; padding-top: 4px; }

/* ── Project overview (detail page) ── */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  align-items: start;
}
.overview-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
}
.overview-card-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--color-text-light);
  margin-bottom: 14px;
}
.circular-progress { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 6px; }
.circular-progress-value { font-size: 24px; font-weight: 800; color: var(--color-primary); }
.circular-progress-sub { font-size: 12px; color: var(--color-text-muted); }
.step-count-row, .assignee-count-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 0; border-bottom: 1px solid var(--color-surface-2); font-size: 13px;
}
.step-count-row:last-child, .assignee-count-row:last-child { border-bottom: none; }
.step-count-name, .assignee-count-name { font-weight: 500; }
.count-pill {
  background: var(--color-primary); color: #fff;
  font-size: 11px; font-weight: 700;
  padding: 2px 9px; border-radius: 999px; min-width: 22px; text-align: center;
}

.project-detail-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 6px; flex-wrap: wrap; }
.project-detail-name { font-size: var(--text-2xl, 22px); font-weight: 700; letter-spacing: -0.5px; color: var(--text-primary, var(--color-text)); }
.project-detail-client { font-size: 13px; color: var(--text-muted, var(--color-text-muted)); margin-top: 2px; }

/* ── Activities table ── */
.activities-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.activities-table th {
  text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--color-border);
  color: var(--color-text-muted); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: .04em;
}
.activities-table td { padding: 10px 12px; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
.activity-row { cursor: pointer; transition: background .12s; }
.activity-row:hover { background: var(--color-surface); }
.activities-empty { padding: 40px; text-align: center; color: var(--color-text-muted); }

.priority-badge { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 20px; white-space: nowrap; }
.priority-badge--alta  { background: #fee2e2; color: #b91c1c; }
.priority-badge--media { background: #fef9c3; color: #92400e; }
.priority-badge--baixa { background: #e0e7ff; color: #3730a3; }

.status-badge--pendente  { background: var(--color-surface-2); color: var(--color-text-muted); }
.status-badge--concluida { background: #dcfce7; color: #15803d; }

.step-chip {
  display: inline-block; font-size: 11px; font-weight: 600;
  background: #f0e8ff; color: var(--color-primary);
  border: 1px solid #ddd0ff; padding: 3px 9px; border-radius: 20px;
  white-space: nowrap;
}

/* ── Side drawer (activity detail) ── */
.drawer-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.35);
  z-index: 400;
}
.drawer-overlay[hidden] { display: none !important; }
.drawer-box {
  position: fixed; top: 0; right: 0; height: 100vh;
  width: 420px; max-width: 100vw;
  background: var(--bg-surface, var(--color-bg));
  border-left: 1px solid var(--border-default, var(--color-border));
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  animation: drawerIn .2s ease;
}
@keyframes drawerIn { from { transform: translateX(24px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.drawer-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  padding: 18px 20px; border-bottom: 1px solid var(--color-border);
}
.drawer-title-input {
  font-size: 16px; font-weight: 700; border: none; background: none;
  color: var(--color-text); font-family: var(--font-sans); width: 100%;
  padding: 2px 0; border-bottom: 1px dashed transparent;
}
.drawer-title-input:focus { outline: none; border-bottom-color: var(--color-primary-light); }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 18px; }
.drawer-footer { padding: 14px 20px; border-top: 1px solid var(--color-border); display: flex; justify-content: flex-end; gap: 8px; }

.drawer-field-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--color-text-light); margin-bottom: 6px; }
.drawer-field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.drawer-field { flex: 1; min-width: 140px; }

.step-advance-box {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); padding: 14px 16px;
}
.step-advance-current { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }

.history-item { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--color-surface-2); font-size: 12px; }
.history-item:last-child { border-bottom: none; }
.history-item-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-primary-light); margin-top: 5px; flex-shrink: 0; }
.history-item-body { flex: 1; }
.history-item-meta { color: var(--color-text-muted); font-size: 11px; margin-top: 2px; }
.history-empty { font-size: 12px; color: var(--color-text-light); padding: 6px 0; }

.workflow-step-builder-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.workflow-step-builder-row .form-input { flex: 1; }
.btn-remove-step {
  background: none; border: 1px solid var(--color-border); color: var(--color-text-muted);
  border-radius: var(--radius-sm); width: 30px; height: 30px; cursor: pointer; font-size: 15px; flex-shrink: 0;
}
.btn-remove-step:hover { background: #fee2e2; border-color: #fca5a5; color: #b91c1c; }

@media (max-width: 1100px) {
  .projects-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .projects-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .overview-grid { grid-template-columns: 1fr; }
  .drawer-box { width: 100vw; }
}
