/* =========================================
   OMNIA AI AIOS — DASHBOARD STYLES
   ========================================= */
:root {
  --bg: #08090e;
  --bg-secondary: #0d0f16;
  --card: #13161f;
  --card-hover: #1a1f2e;
  --accent: #7c3aed;
  --accent-hover: #9055f5;
  --accent-glow: rgba(124, 58, 237, 0.18);
  --cyan: #00e5c3;
  --cyan-dim: rgba(0, 229, 195, 0.12);
  --text: #f0f4ff;
  --text-muted: #7a8499;
  --text-dim: #b0bccc;
  --border: rgba(255, 255, 255, 0.09);
  --border-accent: rgba(124, 58, 237, 0.4);
  --radius: 8px;
  --radius-lg: 12px;
  --font-mono: 'Space Mono', 'Courier New', monospace;
  --font-sans: 'Inter', sans-serif;
  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  --sidebar-width: 300px;
  --nav-height: 54px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }

/* Custom scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

/* =========================================
   LOGIN OVERLAY (JWT-based SMS OTP)
   ========================================= */
#login-overlay {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 50% 18%, rgba(124, 58, 237, 0.22), transparent 34%),
    radial-gradient(circle at 70% 78%, rgba(0, 229, 195, 0.10), transparent 28%),
    var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  flex-direction: column;
}

.login-form-container {
  width: min(400px, calc(100vw - 40px));
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: center;
  padding: 48px 40px;
  background: rgba(19, 22, 31, 0.95);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(14px);
}

.login-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  text-align: center;
}

.login-logo {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  color: #fff;
  font-size: 1.8rem;
  box-shadow: 0 0 28px rgba(0, 229, 195, 0.16);
}

.login-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--text);
  margin: 0;
}

.login-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 0;
}

#login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.phone-section,
.otp-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#login-form label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  letter-spacing: 0.02em;
}

.login-input {
  width: 100%;
  padding: 12px 14px;
  background: rgba(8, 9, 14, 0.86);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(124, 58, 237, 0.4);
}

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

.login-btn {
  width: 100%;
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--accent), #6d28d9);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.login-btn:hover {
  background: linear-gradient(135deg, var(--accent-hover), var(--accent));
  box-shadow: 0 10px 28px rgba(124, 58, 237, 0.28);
}

.login-btn:active {
  transform: scale(0.98);
}

.login-error {
  font-size: 0.8rem;
  color: #f87171;
  text-align: center;
  min-height: 1.2em;
  display: none;
}

.login-resend {
  text-align: center;
  font-size: 0.85rem;
  margin-top: 8px;
}

#resend-link {
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  transition: color 0.2s;
}

#resend-link:hover {
  color: var(--accent-hover);
}

.auth-loading {
  display: none;
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 12px auto 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* =========================================
   OFFLINE BANNER
   ========================================= */
#offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #fed7aa;
  color: #92400e;
  padding: 12px 16px;
  text-align: center;
  z-index: 999;
  display: none;
  font-size: 0.875rem;
  font-weight: 500;
  border-bottom: 1px solid rgba(146, 64, 14, 0.2);
}

#offline-close {
  float: right;
  cursor: pointer;
  font-weight: bold;
  color: #92400e;
  background: none;
  border: none;
  padding: 0;
  margin-left: 16px;
  font-size: 1rem;
  transition: opacity 0.2s;
}

#offline-close:hover {
  opacity: 0.7;
}

/* =========================================
   APP SHELL
   ========================================= */
#app { display: flex; flex-direction: column; min-height: 100vh; }

/* =========================================
   NAV
   ========================================= */
.nav {
  height: var(--nav-height);
  border-bottom: 0;
  display: flex;
  align-items: center;
  padding: 0 24px;
  position: sticky;
  top: 0;
  background:
    linear-gradient(180deg, rgba(124,58,237,0.06) 0%, transparent 100%),
    rgba(8, 9, 14, 0.96);
  backdrop-filter: blur(12px);
  z-index: 100;
}
.nav::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--cyan), transparent);
}
.nav-left { display: flex; align-items: center; gap: 16px; flex: 1; }
.nav-right { display: flex; align-items: center; gap: 12px; }

.nav-logo,
.nav-logo-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  color: var(--accent);
  line-height: 1;
}
.nav-brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.06em;
  color: var(--text);
}
.nav-tabs { display: flex; gap: 4px; }
.nav-tab {
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  border: 1px solid transparent;
  transition: all 0.15s;
}
.nav-tab.active {
  background: var(--card);
  border-color: var(--border-accent);
  color: var(--text);
}
.nav-tab:hover:not(.active) { color: var(--text-dim); }

/* Lock button */
.btn-lock {
  padding: 5px 12px;
  border-radius: 20px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  transition: all 0.15s;
}
.btn-lock:hover {
  border-color: rgba(248,113,113,0.35);
  color: #f87171;
}

/* Active tab indicator */
.nav-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
}
.nav-tab {
  position: relative;
}

/* Status pill */
.status-pill {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 12px; border-radius: 20px;
  background: var(--card); border: 1px solid var(--border);
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em;
  color: var(--text-muted); transition: all 0.2s;
}
.status-pill .status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(255,255,255,0.25); box-shadow: 0 0 4px rgba(255,255,255,0.15);
}
.status-pill.status-running .status-dot { background: #f59e0b; box-shadow: 0 0 6px #f59e0b; animation: pulse 1s infinite; }
.status-pill.status-running { border-color: rgba(245,158,11,0.3); color: #f59e0b; }
.status-pill.status-error .status-dot { background: #f87171; box-shadow: 0 0 6px #f87171; }
.status-pill.status-error { border-color: rgba(248,113,113,0.3); color: #f87171; }
.status-pill .status-label { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slideIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes resultSlideIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes skillRunningPulse { from { transform: scale(1); } to { transform: scale(1.01); } }
@keyframes toastIn { from { opacity: 0; transform: translate(18px, 12px); } to { opacity: 1; transform: translate(0, 0); } }
@keyframes toastOut { to { opacity: 0; transform: translate(18px, 12px); } }
@keyframes toastProgress { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* =========================================
   MAIN LAYOUT — two column grid
   ========================================= */
.dashboard {
  display: grid;
  grid-template-columns: 1fr var(--sidebar-width);
  flex: 1;
  min-height: calc(100vh - var(--nav-height));
  overflow: hidden;
}

/* =========================================
   MAIN COLUMN
   ========================================= */
.main-col {
  padding: 24px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Tab panels */
.tab-panel { display: flex; flex-direction: column; gap: 20px; }

/* Section labels */
.section-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* =========================================
   METRICS ROW
   ========================================= */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.metric-card {
  position: relative;
  background: linear-gradient(135deg, var(--card) 0%, rgba(124,58,237,0.05) 100%);
  border: 1px solid var(--border);
  border-top: 1px solid;
  border-image: linear-gradient(90deg, var(--accent), var(--cyan)) 0 0 0 1;
  border-radius: var(--radius);
  padding: 16px 18px;
}
.metric-card::before {
  content: attr(data-icon);
  position: absolute;
  top: 12px;
  right: 14px;
  font-size: 0.95rem;
  opacity: 0.78;
}
.metric-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.metric-value {
  font-family: var(--font-mono);
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 10px;
  line-height: 1;
  letter-spacing: -0.02em;
}
.metric-bar-track {
  height: 5px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}
.metric-bar {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
  transition: width 0.7s ease;
}
.metric-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* =========================================
   ACTIVITY CHART
   ========================================= */
.chart-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.chart-container { height: 130px; position: relative; }

/* =========================================
   INTEGRATIONS ROW
   ========================================= */
.integrations-row {
  display: flex;
  gap: 20px;
  align-items: center;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.integration-dot { display: flex; align-items: center; gap: 7px; }
.integration-dot .dot { width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 5px currentColor; }
.integration-dot .dot-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

/* =========================================
   PROMPT SECTION
   ========================================= */
.prompt-section { display: flex; flex-direction: column; gap: 10px; }
.prompt-textarea {
  width: 100%;
  min-height: 110px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
  line-height: 1.6;
}
.prompt-textarea:focus { border-color: var(--border-accent); }
.prompt-textarea::placeholder { color: var(--text-muted); font-style: italic; }

.prompt-actions { display: flex; gap: 8px; align-items: center; }
.run-shortcut-hint {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  padding: 0 4px;
}
.prompt-counter {
  align-self: flex-end;
  margin-top: -6px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  padding: 10px 22px;
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  display: flex; align-items: center; gap: 8px;
  transition: all 0.15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.btn-ghost:hover { border-color: var(--border-accent); color: var(--text); }
.btn-spinner {
  width: 13px; height: 13px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* =========================================
   RESULT PANEL
   ========================================= */
.result-panel {
  background: var(--card);
  border: 1px solid var(--border-accent);
  border-left: 3px solid var(--cyan);
  border-radius: var(--radius);
  padding: 16px;
  animation: resultSlideIn 0.3s ease-out;
}
.result-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.result-header-actions { display: flex; align-items: center; gap: 8px; }
.result-label { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--cyan); }
.result-close {
  font-size: 0.8rem; color: var(--text-muted);
  padding: 2px 8px; border-radius: 4px;
  transition: color 0.15s;
}
.result-close:hover { color: var(--text); }
.btn-copy {
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.08em;
  padding: 3px 10px; border-radius: 4px;
  background: rgba(0,229,195,0.08); border: 1px solid rgba(0,229,195,0.2);
  color: var(--cyan); transition: all 0.15s;
}
.btn-copy:hover { background: rgba(0,229,195,0.15); border-color: rgba(0,229,195,0.4); }

/* Skill filter */
.skill-filter-wrap { margin-bottom: 4px; }
.skill-filter-input {
  width: 100%; padding: 9px 14px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-family: var(--font-sans); font-size: 0.85rem;
  outline: none; transition: border-color 0.2s;
}
.skill-filter-input:focus { border-color: var(--border-accent); }
.skill-filter-input::placeholder { color: var(--text-muted); }
.result-body {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.7;
  white-space: normal;
  max-height: 520px;
  overflow-y: auto;
}
.result-body .md-h1 { font-family: var(--font-display); font-size: 1rem; font-weight: 700; color: var(--text); margin: 14px 0 6px; }
.result-body .md-h2 { font-family: var(--font-display); font-size: 0.88rem; font-weight: 700; color: var(--cyan); margin: 12px 0 4px; letter-spacing: 0.04em; text-transform: uppercase; }
.result-body .md-h3 { font-size: 0.83rem; font-weight: 700; color: var(--text-dim); margin: 10px 0 4px; }
.result-body .md-p { margin-bottom: 5px; color: var(--text-dim); }
.result-body .md-list { padding-left: 18px; margin: 4px 0 8px; list-style: disc; }
.result-body .md-list li { margin-bottom: 4px; color: var(--text-dim); }
.result-body .md-list li::marker { color: var(--accent); }
.result-body .md-code { font-family: var(--font-mono); font-size: 0.8em; background: rgba(255,255,255,0.07); padding: 1px 6px; border-radius: 3px; color: var(--cyan); }
.result-body .md-hr { border: none; border-top: 1px solid var(--border); margin: 10px 0; }
.result-body .md-gap { height: 6px; }
.result-body strong { color: var(--cyan); font-weight: 700; }
.result-body em { color: var(--text-dim); font-style: italic; }
.result-table-wrap { overflow-x: auto; margin: 10px 0 14px; }
.result-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 0.82rem;
}
.result-table th,
.result-table td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}
.result-table th {
  background: rgba(124,58,237,0.16);
  color: var(--cyan);
  font-weight: 700;
}
.result-table tr:nth-child(even) td { background: rgba(255,255,255,0.025); }

/* =========================================
   SKILLS GRID
   ========================================= */
.skills-grid { display: flex; flex-direction: column; gap: 4px; }

.skill-category-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 10px;
  margin-bottom: 4px;
}
.skill-category-pill,
.skill-category {
  width: fit-content;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 6px 12px;
}
.skill-category-pill {
  flex: 0 0 auto;
  transition: all 0.15s;
}
.skill-category-pill:hover,
.skill-category-pill.active {
  border-color: var(--border-accent);
  color: var(--text);
  background: rgba(124,58,237,0.14);
}
.skill-category {
  margin-top: 12px;
}
.skill-category:first-child { margin-top: 0; }

.skill-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 10px;
}
.skill-card {
  --skill-gradient: linear-gradient(135deg, rgba(124,58,237,0.18), rgba(0,229,195,0.08));
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 80px;
}
.skill-card:hover {
  border-color: var(--accent);
  background: var(--card-hover);
  transform: translateY(-1px) scale(1.01);
  box-shadow: 0 0 20px rgba(124,58,237,0.25);
  border-left: 3px solid var(--accent);
}
.skill-card.active {
  border-color: var(--accent);
  background: var(--accent-glow);
  border-left: 3px solid var(--accent);
}
.skill-card.is-running {
  border-color: #f59e0b;
  box-shadow: 0 0 22px rgba(245,158,11,0.32);
  animation: skillRunningPulse 0.9s ease-in-out infinite alternate;
}
.skill-card-icon {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--skill-gradient);
  border: 1px solid rgba(255,255,255,0.08);
  font-size: 1.05rem;
}
.skill-card-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.skill-card-label {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text);
}
.skill-card-desc {
  font-size: 0.78rem;
  color: var(--text-dim);
  line-height: 1.5;
}
.skill-card-badge {
  display: inline-block;
  margin-top: 2px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(124,58,237,0.15);
  color: var(--accent);
  width: fit-content;
}

/* =========================================
   SIDEBAR
   ========================================= */
.sidebar {
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
}
.sidebar-section { display: flex; flex-direction: column; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.sidebar-section:last-child { border-bottom: none; padding-bottom: 0; }
.sidebar-label {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

/* RECENT RUNS */
.recent-runs { display: flex; flex-direction: column; gap: 2px; }
.run-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px; border-radius: 6px;
  transition: background 0.15s;
}
.run-item:hover { background: var(--card); }
.run-time {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  min-width: 38px;
}
.run-status-icon {
  width: 14px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
}
.run-item.run-success .run-status-icon { color: var(--cyan); }
.run-item.run-error .run-status-icon { color: #f87171; }
.run-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.run-item.run-empty { color: var(--text-muted); font-size: 0.78rem; font-style: italic; padding: 4px 8px; }

/* MINI CHART */
.mini-chart-container { height: 72px; position: relative; }

/* FORECAST */
.forecast-status { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; color: var(--cyan); margin-bottom: 6px; }
.forecast-bar-track { height: 6px; background: rgba(255,255,255,0.07); border-radius: 3px; overflow: hidden; }
.forecast-bar { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--accent), var(--cyan)); transition: width 0.7s ease; }

/* SCHEDULE */
.schedule-list { display: flex; flex-direction: column; gap: 6px; }
.schedule-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 10px;
  background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--border);
}
.schedule-name {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  font-weight: 700;
  letter-spacing: 0.06em;
}
.schedule-countdown {
  font-size: 0.68rem;
  color: var(--cyan);
  font-family: var(--font-mono);
}

/* WORKFLOW PULSE */
.workflow-pulse { display: flex; flex-direction: column; gap: 5px; }
.pulse-item { display: flex; align-items: center; gap: 10px; padding: 5px 0; }
.pulse-item.pulse-empty { color: var(--text-muted); font-size: 0.75rem; font-style: italic; }
.pulse-badge {
  font-size: 0.6rem; font-weight: 700; letter-spacing: 0.06em;
  padding: 3px 8px; border-radius: 4px;
  min-width: 54px; text-align: center;
}
.pulse-item.pulse-active .pulse-badge { background: rgba(0,229,195,0.12); color: var(--cyan); }
.pulse-item.pulse-inactive .pulse-badge { background: rgba(255,255,255,0.06); color: var(--text-muted); }
.pulse-item.pulse-error .pulse-badge { background: rgba(248,113,113,0.12); color: #f87171; }
.pulse-name {
  font-size: 0.73rem;
  color: var(--text-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* =========================================
   LOGS TAB
   ========================================= */
.logs-section { display: flex; flex-direction: column; gap: 8px; }
.logs-list { display: flex; flex-direction: column; gap: 4px; }
.logs-empty { font-size: 0.82rem; color: var(--text-muted); font-style: italic; padding: 16px 0; }
.log-row {
  display: grid; grid-template-columns: 72px 140px 1fr 44px;
  gap: 12px; padding: 10px 12px;
  background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 0.78rem; align-items: center;
}
.log-status { font-weight: 700; font-size: 0.65rem; letter-spacing: 0.06em; }
.log-row.log-success .log-status { color: var(--cyan); }
.log-row.log-error .log-status { color: #f87171; }
.log-time { color: var(--text-muted); font-family: var(--font-mono); font-size: 0.68rem; }
.log-name { color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-dur { color: var(--text-muted); font-family: var(--font-mono); font-size: 0.68rem; text-align: right; }

/* =========================================
   CLIENTS TAB
   ========================================= */
.clients-section { display: flex; flex-direction: column; gap: 10px; }
.clients-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.client-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.client-card-header { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.client-name {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}
.client-subtitle {
  font-size: 0.74rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.client-deliverables {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}
.client-badge {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 7px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--text-dim);
  background: rgba(255,255,255,0.03);
}
.client-badge.done { border-color: rgba(0,229,195,0.25); color: var(--cyan); }
.client-badge.paused { border-color: rgba(245,158,11,0.22); color: #f59e0b; }
.client-badge.blocked { border-color: rgba(248,113,113,0.25); color: #f87171; }
.client-badge.pending { border-color: rgba(255,255,255,0.1); color: var(--text-muted); }
.client-next {
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.5;
}
.client-actions { display: flex; gap: 8px; align-items: center; }
.btn-open-dashboard {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border: 1px solid var(--border-accent);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent);
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-open-dashboard:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--text);
}

/* =========================================
   TOAST
   ========================================= */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px; z-index: 500;
}
.toast {
  position: relative;
  overflow: hidden;
  padding: 12px 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.82rem;
  color: var(--text);
  display: flex; align-items: center; gap: 10px;
  animation: toastIn 0.2s ease;
  min-width: 240px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.toast-success { border-color: rgba(0,229,195,0.35); border-left-color: var(--cyan); }
.toast-success::before { content: 'OK'; color: var(--cyan); font-weight: 700; font-size: 0.72rem; }
.toast-error { border-color: rgba(248,113,113,0.35); border-left-color: #f87171; }
.toast-error::before { content: 'ERR'; color: #f87171; font-weight: 700; font-size: 0.72rem; }
.toast-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: currentColor;
  transform-origin: left;
  animation: toastProgress 4s linear forwards;
  opacity: 0.7;
}
.toast-success .toast-progress { color: var(--cyan); }
.toast-error .toast-progress { color: #f87171; }
.toast-out { animation: toastOut 0.3s ease forwards; }

/* =========================================
   DASHBOARD PANELS (Wave 4)
   ========================================= */

/* Panel base styles */
.panel {
  background: white;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: none;
}

.panel.active {
  display: block;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid #e5e7eb;
  padding-bottom: 0.75rem;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.25rem;
  color: #1f2937;
}

.badge {
  background: var(--accent);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 600;
}

.empty-state {
  text-align: center;
  padding: 2rem;
  color: #9ca3af;
}

.error-banner {
  background: #fee2e2;
  color: #991b1b;
  padding: 0.75rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

/* Chat styles */
.chat-messages {
  height: 400px;
  overflow-y: auto;
  margin-bottom: 1rem;
  padding: 1rem;
  background: #f9fafb;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chat-bubble {
  margin-bottom: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  max-width: 70%;
  word-wrap: break-word;
}

.chat-user {
  align-self: flex-end;
  background: var(--accent);
  color: white;
}

.chat-assistant {
  align-self: flex-start;
  background: #e5e7eb;
  color: #1f2937;
}

.chat-text {
  margin-bottom: 0.25rem;
}

.chat-time {
  font-size: 0.75rem;
  opacity: 0.7;
}

.chat-loading {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem;
  color: #6b7280;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #e5e7eb;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.chat-form {
  display: flex;
  gap: 0.5rem;
}

.chat-form input {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 0.95rem;
}

.chat-form button {
  padding: 0.75rem 1.5rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
}

.chat-error {
  color: #ef4444;
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

/* Approvals styles */
.approvals-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.approval-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: #f9fafb;
  transition: all 0.3s ease;
}

.approval-item[data-status="processing"] {
  opacity: 0.6;
}

.approval-content {
  flex: 1;
}

.approval-action {
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 0.25rem;
}

.approval-time {
  font-size: 0.875rem;
  color: #6b7280;
}

.approval-buttons {
  display: flex;
  gap: 0.5rem;
}

.btn-approve, .btn-reject {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.875rem;
  transition: opacity 0.2s;
}

.btn-approve {
  background: #10b981;
  color: white;
}

.btn-approve:hover {
  opacity: 0.9;
}

.btn-reject {
  background: #ef4444;
  color: white;
}

.btn-reject:hover {
  opacity: 0.9;
}

.processing {
  color: #6b7280;
  font-size: 0.875rem;
}

/* Audit trail styles */
.audit-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.btn-secondary {
  padding: 0.5rem 1rem;
  background: #e5e7eb;
  color: #1f2937;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}

.btn-secondary:hover {
  background: #d1d5db;
}

.audit-info {
  font-size: 0.875rem;
  color: #6b7280;
}

.audit-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.audit-entry {
  border-bottom: 1px solid #e5e7eb;
  padding: 0.75rem 0;
}

.audit-row {
  display: grid;
  grid-template-columns: 100px 2fr 100px 150px 80px;
  gap: 1rem;
  font-size: 0.875rem;
  align-items: center;
}

.audit-action {
  font-weight: 600;
  color: #1f2937;
  text-transform: uppercase;
}

.audit-desc {
  color: #6b7280;
}

.audit-actor {
  color: #9ca3af;
}

.audit-time {
  color: #9ca3af;
}

.audit-outcome {
  text-transform: uppercase;
  font-weight: 600;
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  text-align: center;
}

.outcome-success {
  background: #d1fae5;
  color: #065f46;
}

.outcome-pending {
  background: #fef3c7;
  color: #92400e;
}

.outcome-error {
  background: #fee2e2;
  color: #991b1b;
}

/* Scheduled jobs styles */
.scheduled-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.scheduled-job {
  padding: 1rem;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: #f9fafb;
}

.job-name {
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 0.5rem;
}

.job-schedule {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  color: #6b7280;
}

.job-frequency {
  text-transform: uppercase;
  font-weight: 600;
}

.job-next {
  color: var(--accent);
}

/* =========================================
   MOBILE
   ========================================= */
@media (max-width: 768px) {
  .dashboard { grid-template-columns: 1fr; overflow: auto; }
  .sidebar { border-left: none; border-top: 1px solid var(--border); }
  .metrics-row { grid-template-columns: 1fr 1fr; gap: 8px; }
  .skill-row { grid-template-columns: 1fr; }
  .clients-list { grid-template-columns: 1fr; }
  .client-deliverables { display: none; }
  .nav { padding: 0 12px; }
  .nav-left { gap: 10px; min-width: 0; }
  .nav-brand { display: none; }
  .nav-tabs { overflow-x: auto; }
  .nav-tab { padding: 6px 10px; }
  .log-row { grid-template-columns: 60px 1fr 40px; }
  .log-time { display: none; }
}
@media (max-width: 480px) {
  .metrics-row { grid-template-columns: 1fr; }
  .main-col { padding: 16px; }
}
