/* ============================================================
   Claude Code Orchestration – style.css
   ============================================================ */

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-bg:          #edf0f7;
  --color-surface:     #ffffff;
  --color-surface-2:   #f2f4fb;
  --color-border:      #c8cde6;
  --color-primary:     #4f46e5;
  --color-primary-h:   #4338ca;
  --color-accent:      #059669;
  --color-danger:      #dc2626;
  --color-warning:     #d97706;
  --color-text:        #111827;
  --color-text-muted:  #4b5680;
  --color-text-sub:    #8b92b8;

  --nav-width:         220px;
  --topbar-height:     56px;

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

  --shadow-card: 0 2px 12px rgba(79,70,229,0.09), 0 1px 4px rgba(0,0,0,0.06);

  --font-sans: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'Cascadia Code', 'Fira Code', monospace;

  --transition: 160ms ease;
}

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;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-h); }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--color-surface-2); }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a0a8c8; }

/* ============================================================
   TOP NAV BAR
   ============================================================ */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-height);
  background: linear-gradient(135deg, #dbeafe 0%, #e0f2fe 60%, #bfdbfe 100%);
  border-bottom: 1px solid #93c5fd;
  box-shadow: 0 2px 10px rgba(37,99,235,0.12);
  display: flex;
  align-items: center;
  padding: 0 20px;
  z-index: 100;
  gap: 24px;
}

.topbar__logo {
  font-size: 1rem;
  font-weight: 800;
  color: #1e3a8a;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar__logo span.dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--color-primary);
  box-shadow: 0 0 8px var(--color-primary);
}

.topbar__nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.topbar__nav a {
  color: #1e3a8a;
  font-size: 0.875rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}

.topbar__nav a:hover {
  background: rgba(37,99,235,0.12);
  color: #1d4ed8;
}

.topbar__nav a.active {
  background: #2563eb;
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #1e3a8a;
  background: rgba(255,255,255,0.6);
  border: 1px solid #93c5fd;
  border-radius: 20px;
  padding: 4px 12px;
}

.status-badge .pulse {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--color-accent);
  animation: pulse 2s ease infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(0,212,170,0.4); }
  50% { opacity: .7; box-shadow: 0 0 0 4px rgba(0,212,170,0); }
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.hamburger span {
  display: block;
  width: 22px; height: 2px;
  background: #1e3a8a;
  border-radius: 2px;
  transition: var(--transition);
}

/* ============================================================
   PAGE LAYOUT
   ============================================================ */
.page-wrapper {
  margin-top: var(--topbar-height);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.page-header {
  padding: 32px 36px 0;
  border-bottom: 1px solid var(--color-border);
  background: #ffffff;
}

.page-header__meta {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.page-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 6px;
}

.page-header p {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  padding-bottom: 20px;
}

.page-content {
  padding: 28px 36px;
  flex: 1;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 20px 24px;
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card__title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text);
}

.card__subtitle {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* ============================================================
   GRID UTILITIES
   ============================================================ */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color var(--transition);
}

.stat-card:hover { border-color: var(--color-primary); }

.stat-card__label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--color-text-muted);
}

.stat-card__value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1;
}

.stat-card__delta {
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-card__delta.up   { color: var(--color-accent); }
.stat-card__delta.down { color: var(--color-danger); }

.stat-card__icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  background: rgba(79,70,229,0.1);
  color: var(--color-primary);
}

.stat-card__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
}

tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
}

tbody tr:last-child td { border-bottom: none; }

tbody tr:hover td { background: var(--color-surface-2); }

/* ============================================================
   BADGES & TAGS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-green  { background: #d1fae5; color: #065f46; }
.badge-purple { background: #ede9fe; color: #4f46e5; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-gray   { background: #e5e7eb; color: #374151; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--transition), box-shadow var(--transition);
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--color-primary-h);
  color: #fff;
  box-shadow: 0 4px 14px rgba(79,70,229,0.35);
}

.btn-outline {
  background: transparent;
  border-color: var(--color-border);
  color: var(--color-text-muted);
}

.btn-outline:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
}

.btn-ghost:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.78rem;
}

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress-bar {
  height: 6px;
  background: var(--color-surface-2);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  transition: width .6s ease;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.form-input,
.form-select,
.form-textarea {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: 0.875rem;
  font-family: var(--font-sans);
  padding: 8px 12px;
  outline: none;
  transition: border-color var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.15);
}

.form-textarea { resize: vertical; min-height: 90px; }

/* Toggle switch */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
}

.toggle-row:last-child { border-bottom: none; }

.toggle-info { flex: 1; }
.toggle-info span { display: block; font-size: 0.875rem; color: var(--color-text); }
.toggle-info small { font-size: 0.78rem; color: var(--color-text-muted); }

.toggle {
  position: relative;
  width: 40px; height: 22px;
}

.toggle input { display: none; }

.toggle__track {
  display: block;
  width: 40px; height: 22px;
  background: var(--color-border);
  border-radius: 11px;
  cursor: pointer;
  transition: background var(--transition);
}

.toggle__track::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform var(--transition);
}

.toggle input:checked + .toggle__track { background: var(--color-primary); }
.toggle input:checked + .toggle__track::after { transform: translateX(18px); }

/* ============================================================
   TIMELINE / LOG
   ============================================================ */
.timeline { display: flex; flex-direction: column; gap: 0; }

.timeline-item {
  display: flex;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}

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

.timeline-dot {
  flex-shrink: 0;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-top: 5px;
}

.timeline-dot.green  { background: var(--color-accent); }
.timeline-dot.purple { background: var(--color-primary); }
.timeline-dot.red    { background: var(--color-danger); }
.timeline-dot.gray   { background: var(--color-text-sub); }

.timeline-body { flex: 1; }
.timeline-title { font-size: 0.875rem; color: var(--color-text); }
.timeline-meta  { font-size: 0.75rem; color: var(--color-text-muted); margin-top: 2px; }

/* ============================================================
   SECTION TITLE DIVIDER
   ============================================================ */
.section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--color-text-sub);
  margin-bottom: 12px;
}

/* ============================================================
   AGENT CARD
   ============================================================ */
.agent-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.agent-card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 4px 20px rgba(79,70,229,0.15);
}

.agent-card__top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.agent-avatar {
  width: 42px; height: 42px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.agent-avatar.purple { background: linear-gradient(135deg, #6c63ff, #a78bfa); }
.agent-avatar.teal   { background: linear-gradient(135deg, #00d4aa, #0099cc); }
.agent-avatar.orange { background: linear-gradient(135deg, #ff7043, #ffa726); }
.agent-avatar.pink   { background: linear-gradient(135deg, #ec4899, #a855f7); }

.agent-info { flex: 1; }
.agent-name { font-size: 0.9rem; font-weight: 600; color: var(--color-text); }
.agent-role { font-size: 0.78rem; color: var(--color-text-muted); }

.agent-stats {
  display: flex;
  gap: 16px;
}

.agent-stat { text-align: center; }
.agent-stat__val { font-size: 1.1rem; font-weight: 700; color: var(--color-text); }
.agent-stat__key { font-size: 0.7rem; color: var(--color-text-muted); }

/* ============================================================
   MINI CHART PLACEHOLDER
   ============================================================ */
.chart-placeholder {
  width: 100%;
  height: 140px;
  background: var(--color-surface-2);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 12px;
  overflow: hidden;
}

.chart-bar {
  flex: 1;
  border-radius: 3px 3px 0 0;
  background: rgba(79,70,229,0.55);
  transition: background var(--transition);
  min-height: 8px;
}

.chart-bar:hover { background: var(--color-primary); }
.chart-bar.accent { background: rgba(5,150,105,0.65); }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  color: var(--color-text-muted);
  gap: 10px;
  text-align: center;
}

.empty-state__icon { font-size: 2.2rem; opacity: .5; }
.empty-state__text { font-size: 0.875rem; }

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-24 { gap: 24px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.text-muted  { color: var(--color-text-muted); }
.text-sm     { font-size: 0.85rem; }
.text-xs     { font-size: 0.75rem; }
.font-mono   { font-family: var(--font-mono); }
.w-full      { width: 100%; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 960px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .topbar__nav { display: none; }
  .topbar__nav.open {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: var(--topbar-height);
    left: 0; right: 0;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 12px 20px;
    gap: 2px;
    z-index: 99;
  }
  .hamburger { display: flex; }
  .page-content { padding: 20px 16px; }
  .page-header  { padding: 20px 16px 0; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .topbar__logo span:not(.dot) { display: none; }
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  background: linear-gradient(135deg, #bfdbfe 0%, #e0f2fe 60%, #dbeafe 100%);
  border-top: 1px solid #93c5fd;
  padding: 22px 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.site-footer__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 800;
  color: #1e3a8a;
}

.site-footer__brand .dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #2563eb;
  box-shadow: 0 0 6px #3b82f6;
}

.site-footer__links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.site-footer__links a {
  font-size: 0.8rem;
  font-weight: 600;
  color: #1d4ed8;
  transition: color var(--transition);
}

.site-footer__links a:hover { color: #1e3a8a; text-decoration: underline; }

.site-footer__copy {
  font-size: 0.78rem;
  font-weight: 600;
  color: #1e40af;
}

@media (max-width: 768px) {
  .site-footer {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px;
    gap: 10px;
  }
}

/* ============================================================
   CARD DESCRIPTION LABEL
   ============================================================ */
.card-desc {
  margin-top: 14px;
  padding: 10px 14px;
  background: linear-gradient(90deg, #eff6ff, #f0fdf4);
  border-left: 3px solid #3b82f6;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: #1d4ed8;
  line-height: 1.55;
}
