@import url('tokens.css');

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg-root);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
}

a {
  color: var(--accent-cyan);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 10;
}

.brand {
  padding: 0 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1rem;
}

.brand-title {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 0.25rem;
}

.brand-name {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
}

.nav {
  list-style: none;
  margin: 0;
  padding: 0 0.75rem;
  flex: 1;
}

.nav li {
  margin-bottom: 0.25rem;
}

.nav a {
  display: block;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
}

.nav a:hover,
.nav a.active {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav a.active {
  border-left: 2px solid var(--accent-cyan);
}

.main {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 1.5rem 2rem 2rem;
  max-width: 1400px;
}

.page-header {
  margin-bottom: 1.5rem;
}

.page-header h1 {
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
  font-weight: 600;
}

.page-header .subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.panel h2 {
  margin: 0 0 1rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.kpi-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1rem 1.15rem;
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--kpi-accent, var(--accent-cyan));
}

.kpi-card.purple::before { background: var(--accent-purple); }
.kpi-card.amber::before { background: var(--accent-amber); }
.kpi-card.green::before { background: var(--accent-green); }

.kpi-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

@media (max-width: 960px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: relative;
    width: 100%;
  }
  .main {
    margin-left: 0;
  }
  .layout {
    flex-direction: column;
  }
}

.herman-briefing {
  border-left: 3px solid var(--accent-cyan);
  background: linear-gradient(135deg, var(--accent-cyan-dim), transparent);
}

.herman-briefing .briefing-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.herman-briefing .briefing-body {
  white-space: pre-wrap;
  color: var(--text-secondary);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-hover);
  color: var(--text-primary);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover {
  background: var(--bg-elevated);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-cyan-dim);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.btn-approve {
  border-color: var(--accent-green);
  color: var(--accent-green);
  background: var(--accent-green-dim);
}

.btn-reject {
  border-color: var(--accent-red);
  color: var(--accent-red);
  background: var(--accent-red-dim);
}

.agent-feed {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 420px;
  overflow-y: auto;
}

.agent-feed li {
  display: flex;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.8125rem;
}

.agent-feed li:last-child {
  border-bottom: none;
}

.feed-time {
  flex-shrink: 0;
  width: 4.5rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.feed-body {
  flex: 1;
  min-width: 0;
}

.feed-message {
  color: var(--text-secondary);
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-agent-herman,
.badge-agent-cyan {
  background: var(--accent-cyan-dim);
  color: var(--accent-cyan);
}

.badge-agent-sales,
.badge-agent-purple {
  background: var(--accent-purple-dim);
  color: var(--accent-purple);
}

.badge-agent-marketing,
.badge-agent-amber {
  background: var(--accent-amber-dim);
  color: var(--accent-amber);
}

.badge-agent-ops,
.badge-agent-green {
  background: var(--accent-green-dim);
  color: var(--accent-green);
}

.badge-status-needs_approval {
  background: var(--accent-amber-dim);
  color: var(--accent-amber);
}

.badge-status-approved,
.badge-status-completed {
  background: var(--accent-green-dim);
  color: var(--accent-green);
}

.badge-status-rejected {
  background: var(--accent-red-dim);
  color: var(--accent-red);
}

.approval-queue .approval-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

.approval-queue .approval-item:last-child {
  border-bottom: none;
}

.approval-actions {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}

.approval-actions form {
  margin: 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--border-subtle);
}

.data-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.data-table tbody tr:hover {
  background: var(--bg-hover);
}

.agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.agent-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1rem;
}

.agent-card.cyan { border-top: 2px solid var(--accent-cyan); }
.agent-card.purple { border-top: 2px solid var(--accent-purple); }
.agent-card.amber { border-top: 2px solid var(--accent-amber); }
.agent-card.green { border-top: 2px solid var(--accent-green); }

.agent-card h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

.agent-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.muted {
  color: var(--text-muted);
}

.empty-state {
  color: var(--text-muted);
  font-style: italic;
  padding: 0.5rem 0;
}


/* Fase 2-4: kanban, charts, voice */
.kanban-board { display: flex; gap: 1rem; overflow-x: auto; padding-bottom: 1rem; margin-bottom: 1.25rem; }
.kanban-column { min-width: 220px; flex: 0 0 220px; background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: 0.75rem; }
.kanban-title { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin: 0 0 0.75rem; }
.kanban-card { background: var(--bg-elevated); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 0.65rem; margin-bottom: 0.5rem; font-size: 0.8125rem; }
.chart-placeholder { min-height: 160px; }
.chart-bar { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.45rem; font-size: 0.75rem; }
.chart-bar .bar { height: 8px; background: var(--accent-cyan); border-radius: 4px; min-width: 4px; }
.chart-bar .bar-purple { background: var(--accent-purple); }
.voice-widget { text-align: center; }
.voice-mic { margin: 1rem auto; min-width: 160px; }
.voice-wave { display: flex; justify-content: center; gap: 0.35rem; height: 32px; align-items: flex-end; }
.voice-wave span { width: 4px; height: 12px; background: var(--accent-cyan-dim); border-radius: 2px; animation: voice-pulse 1.2s ease-in-out infinite; }
.voice-wave span:nth-child(2) { animation-delay: 0.2s; }
.voice-wave span:nth-child(3) { animation-delay: 0.4s; }
@keyframes voice-pulse { 0%, 100% { height: 8px; opacity: 0.5; } 50% { height: 24px; opacity: 1; } }
.herman-form textarea { width: 100%; background: var(--bg-root); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); color: var(--text-primary); padding: 0.75rem; font-family: inherit; margin-bottom: 0.75rem; }

/* Command Center interactive UI */
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 100; align-items: center; justify-content: center; padding: 1rem; }
.modal.open { display: flex; }
.modal-card { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: 1.5rem; max-width: 480px; width: 100%; box-shadow: var(--shadow-lg); }
.drawer { position: fixed; top: 0; right: 0; width: min(420px, 90vw); height: 100vh; background: var(--bg-surface); border-left: 1px solid var(--border-subtle); transform: translateX(100%); transition: transform .25s ease; z-index: 90; padding: 1.5rem; overflow: auto; }
.drawer.open { transform: translateX(0); }
.drawer-close { float: right; background: transparent; border: none; color: var(--text-primary); font-size: 1.5rem; cursor: pointer; }
.btn-group { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.btn-sm { padding: .25rem .55rem; font-size: 12px; }
.clickable-row { cursor: pointer; transition: background .15s; }
.clickable-row:hover { background: var(--bg-hover); }
.clickable-kpi { text-decoration: none; color: inherit; display: block; transition: transform .15s, box-shadow .15s; }
.clickable-kpi:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.25); text-decoration: none; }
.tab-bar { display: flex; gap: .35rem; margin-bottom: 1rem; flex-wrap: wrap; }
.tab-bar button { background: var(--bg-surface); border: 1px solid var(--border-subtle); color: var(--text-secondary); padding: .45rem .9rem; border-radius: var(--radius-md); cursor: pointer; }
.tab-bar button.active { border-color: var(--accent-cyan); color: var(--text-primary); background: var(--bg-hover); }
.toast-container { position: fixed; bottom: 1rem; right: 1rem; z-index: 200; display: flex; flex-direction: column; gap: .5rem; }
.toast { padding: .75rem 1rem; border-radius: var(--radius-md); background: var(--bg-surface); border: 1px solid var(--border-subtle); animation: toastIn .2s ease; }
.toast-success { border-color: var(--accent-green); }
.toast-error { border-color: var(--accent-red, #f44); }
.toast-out { opacity: 0; transition: opacity .3s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.form-input { width: 100%; padding: .55rem .75rem; border-radius: var(--radius-md); border: 1px solid var(--border-subtle); background: var(--bg-root); color: var(--text-primary); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: .55rem .65rem; border-bottom: 1px solid var(--border-subtle); text-align: left; }
.kanban { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-top: 1rem; }
.kanban-col { background: var(--bg-surface); border-radius: var(--radius-lg); padding: .75rem; border: 1px solid var(--border-subtle); min-height: 200px; }
.kanban-card { background: var(--bg-root); border-radius: var(--radius-md); padding: .65rem; margin-bottom: .5rem; border: 1px solid var(--border-subtle); }
.chat-layout { display: flex; flex-direction: column; height: calc(100vh - 4rem); }
.chat-messages { flex: 1; overflow: auto; padding: 1rem; background: var(--bg-surface); border-radius: var(--radius-lg); margin-bottom: 1rem; }
.chat-msg { margin-bottom: .75rem; padding: .65rem; border-radius: var(--radius-md); }
.chat-msg.user { background: rgba(0,200,255,.08); }
.chat-msg.agent { background: var(--bg-root); border: 1px solid var(--border-subtle); }
.chat-input { display: flex; gap: .5rem; }
.page-tip { color: var(--text-muted); font-size: 13px; }
.ai-output { white-space: pre-wrap; background: var(--bg-root); padding: 1rem; border-radius: var(--radius-md); min-height: 80px; }
.log-list { list-style: none; padding: 0; max-height: 240px; overflow: auto; }
body.drawer-open { overflow: hidden; }
/* Herman Daily Briefing — visual dashboard */
.herman-briefing { border-left: 3px solid var(--accent-cyan); }
.herman-briefing-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.herman-briefing-header h2 { margin: 0; }
.briefing-meta { font-size: 0.75rem; color: var(--text-muted); }

.briefing-summary-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 1rem; margin-bottom: 1.25rem; }
@media (max-width: 900px) { .briefing-summary-grid { grid-template-columns: 1fr; } }

.briefing-card {
  background: var(--surface-elevated, rgba(15, 23, 42, 0.6));
  border: 1px solid var(--border-subtle, rgba(148, 163, 184, 0.15));
  border-radius: 10px;
  padding: 1rem 1.15rem;
}
.briefing-card h3 { margin: 0 0 0.65rem; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent-gold, #e8a838); }
.briefing-card.summary { border-color: rgba(56, 189, 248, 0.25); }
.briefing-card.actions { border-color: rgba(232, 168, 56, 0.25); }
.briefing-card.actions ul { margin: 0; padding-left: 1.1rem; color: var(--text-secondary); line-height: 1.55; }
.briefing-card.actions li { margin-bottom: 0.35rem; }
#briefing-summary-text { color: var(--text-primary, #e2e8f0); line-height: 1.6; font-size: 0.95rem; }

.briefing-kpi-row { display: flex; flex-wrap: wrap; gap: 0.65rem; margin-bottom: 1.25rem; }
.briefing-stat {
  flex: 1; min-width: 100px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  text-align: center;
}
.briefing-stat.green { border-color: rgba(62, 207, 142, 0.35); }
.briefing-stat.purple { border-color: rgba(167, 139, 250, 0.35); }
.briefing-stat.cyan { border-color: rgba(56, 189, 248, 0.35); }
.briefing-stat.amber { border-color: rgba(232, 168, 56, 0.35); }
.briefing-stat-label { display: block; font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.briefing-stat-value { display: block; font-size: 1.35rem; font-weight: 600; color: var(--text-primary); margin-top: 0.15rem; }

.briefing-charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.25rem; }
@media (max-width: 900px) { .briefing-charts-grid { grid-template-columns: 1fr; } }
.briefing-chart-panel {
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(148, 163, 184, 0.1);
  border-radius: 10px;
  padding: 0.75rem;
  min-height: 220px;
}

.briefing-details-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
@media (max-width: 900px) { .briefing-details-grid { grid-template-columns: 1fr; } }

.briefing-pending-item {
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.briefing-toggle { margin-top: 0.5rem; }
.briefing-full-report {
  display: none;
  margin-top: 0.75rem;
  max-height: 280px;
  overflow: auto;
  white-space: pre-wrap;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: rgba(0,0,0,0.2);
  border-radius: 8px;
  padding: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.1);
}
.briefing-full-report.open { display: block; }

.badge-positive { background: rgba(62,207,142,.2); color: #3ecf8e; padding: .15rem .45rem; border-radius: 999px; font-size: .72rem; }
.badge-neutral { background: rgba(107,114,128,.25); color: #cbd5e1; padding: .15rem .45rem; border-radius: 999px; font-size: .72rem; }
.badge-negative { background: rgba(239,68,68,.2); color: #ef4444; padding: .15rem .45rem; border-radius: 999px; font-size: .72rem; }
/* Settings page */
.settings-header { margin-bottom: 0.5rem; }

.settings-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
  padding-bottom: 0;
}
.settings-tab {
  display: inline-block;
  padding: 0.65rem 1.1rem;
  color: var(--text-muted, #94a3b8);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-size: 0.9rem;
  transition: color 0.15s, border-color 0.15s;
}
.settings-tab:hover { color: var(--text-primary, #e2e8f0); }
.settings-tab.active {
  color: var(--accent-gold, #e8a838);
  border-bottom-color: var(--accent-gold, #e8a838);
}

.settings-panel { border-left: 3px solid var(--accent-gold, #e8a838); }
.settings-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.settings-active-banner {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.85rem;
  background: rgba(62, 207, 142, 0.08);
  border: 1px solid rgba(62, 207, 142, 0.25);
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.email-account-list { display: flex; flex-direction: column; gap: 0.75rem; }
.email-account-card {
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 10px;
  padding: 1rem 1.1rem;
}
.email-account-card.is-active { border-color: rgba(62, 207, 142, 0.35); }
.email-account-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.email-account-card-head strong { display: block; }
.email-account-card-head .muted { font-size: 0.85rem; color: var(--text-muted); }
.email-account-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.settings-modal { max-width: 520px; width: 100%; }
.settings-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin: 0.75rem 0;
}
@media (max-width: 600px) { .settings-form-grid { grid-template-columns: 1fr; } }

.form-label { display: block; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.75rem; }
.form-label .form-input { margin-top: 0.25rem; }
.form-check { display: flex; align-items: center; gap: 0.5rem; margin: 0.75rem 0; font-size: 0.9rem; }

.settings-details {
  margin: 0.75rem 0;
  padding: 0.75rem;
  border: 1px dashed rgba(148, 163, 184, 0.2);
  border-radius: 8px;
}
.settings-details summary { cursor: pointer; color: var(--text-secondary); font-size: 0.85rem; }

.sidebar .nav-settings {
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

[x-cloak] { display: none !important; }
/* ── Horizontal top navigation ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(180deg, #0f172a 0%, #0b1220 100%);
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
  padding: 0.65rem 1.25rem 0;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}
.topbar-brand {
  display: inline-block;
  margin-right: 1.5rem;
  margin-bottom: 0.5rem;
  vertical-align: middle;
}
.topbar-brand .brand-title { margin: 0; font-size: 0.7rem; letter-spacing: 0.12em; color: var(--accent-gold, #e8a838); text-transform: uppercase; }
.topbar-brand .brand-name { margin: 0; font-size: 1rem; font-weight: 600; color: var(--text-primary, #e2e8f0); }

.topnav {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.35rem 1.25rem;
  padding-bottom: 0;
}
.topnav-herman {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 1.25rem;
  margin-right: 0.5rem;
  margin-bottom: -1px;
  border-radius: 8px 8px 0 0;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  color: #0f172a;
  background: linear-gradient(135deg, #e8a838 0%, #f0c060 100%);
  border: 1px solid rgba(232, 168, 56, 0.5);
  border-bottom: none;
  box-shadow: 0 -2px 12px rgba(232, 168, 56, 0.25);
}
.topnav-herman:hover { filter: brightness(1.05); color: #0f172a; }
.topnav-herman.active { background: linear-gradient(135deg, #e8a838 0%, #f5d078 100%); }

.topnav-group {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.15rem;
  padding-bottom: 0.45rem;
  border-left: 1px solid rgba(148, 163, 184, 0.12);
  padding-left: 1rem;
}
.topnav-group:first-of-type { border-left: none; padding-left: 0; }
.topnav-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted, #64748b);
  margin-right: 0.35rem;
  padding-right: 0.35rem;
}
.topnav-group a {
  display: inline-block;
  padding: 0.4rem 0.7rem;
  border-radius: 6px;
  font-size: 0.82rem;
  text-decoration: none;
  color: var(--text-secondary, #94a3b8);
  border: 1px solid transparent;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.topnav-group a:hover {
  color: var(--text-primary, #e2e8f0);
  background: rgba(148, 163, 184, 0.08);
}
.topnav-group a.active {
  color: var(--accent-cyan, #38bdf8);
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.25);
}
.topnav-group-system { margin-left: auto; border-left: 1px solid rgba(148, 163, 184, 0.12); }

.main-topnav {
  padding: 1.25rem 1.5rem 2rem;
  min-height: calc(100vh - 80px);
  background: var(--bg-root, #070b14);
}

/* Herman hub layout */
.herman-hub-header { margin-bottom: 1rem; }
.herman-hub-header h1 { margin: 0 0 0.25rem; }
.herman-hub-header .subtitle { margin: 0; }

.hub-kpi-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
@media (max-width: 1100px) { .hub-kpi-row { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) { .hub-kpi-row { grid-template-columns: repeat(2, 1fr); } }

.hub-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
@media (max-width: 1000px) { .hub-grid { grid-template-columns: 1fr; } }

.hub-section-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  padding-bottom: 0.5rem;
}
.hub-section-tabs button, .hub-section-tabs a {
  padding: 0.45rem 0.9rem;
  border-radius: 6px 6px 0 0;
  font-size: 0.85rem;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
}
.hub-section-tabs .active {
  color: var(--accent-gold);
  border-color: rgba(232, 168, 56, 0.3);
  background: rgba(232, 168, 56, 0.08);
}

.hub-feed-item {
  padding: 0.55rem 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  font-size: 0.88rem;
}
.hub-feed-time { color: var(--text-muted); font-size: 0.75rem; margin-right: 0.5rem; }

/* Hide old sidebar layout when topnav is active */
body:has(.topbar) .layout { display: block; }
body:has(.topbar) .sidebar { display: none; }
body:has(.topbar) .main { margin-left: 0; }

@media (max-width: 900px) {
  .topnav { gap: 0.25rem 0.75rem; }
  .topnav-group { padding-left: 0.5rem; }
  .topnav-label { display: none; }
}

/* Compact Herman briefing charts */
.briefing-charts-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  max-height: 180px;
}
@media (max-width: 1100px) { .briefing-charts-grid { grid-template-columns: repeat(2, 1fr); max-height: none; } }
.briefing-chart-panel {
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(148, 163, 184, 0.1);
  border-radius: 8px;
  padding: 0.35rem 0.5rem;
  min-height: 0 !important;
  height: 155px;
  position: relative;
}
.briefing-chart-panel canvas { max-height: 130px !important; }
.briefing-summary-grid { margin-bottom: 0.75rem; }
.briefing-kpi-row { margin-bottom: 0.75rem; }
.briefing-kpi-row .briefing-stat { padding: 0.45rem 0.6rem; }
.briefing-kpi-row .briefing-stat-value { font-size: 1.1rem; }

.browser-instruct-box {
  background: rgba(56, 189, 248, 0.06);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1rem;
}
.browser-instruct-box textarea { min-height: 70px; }
.browser-steps-log {
  font-size: 0.8rem; color: var(--text-muted);
  margin-top: 0.5rem; max-height: 100px; overflow: auto;
}
.browser-action-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }

.novnc-fallback {
  padding: 1rem; text-align: center; background: #111;
  border-radius: 8px; color: #94a3b8; font-size: 0.85rem;
}
.novnc-fallback a { color: var(--accent-cyan); }
