/* ==========================================================================
   Virtual Team Manager Hub — Style System (Light Theme)
   Matches BEM class names used in all 13 PHP templates
   ========================================================================== */

/* ---------- CSS Custom Properties ---------- */
:root {
  --bg: #f0f2f5;
  --surface: #ffffff;
  --surface-hover: #f8f9fa;
  --border: #e2e8f0;
  --text-primary: #1a202c;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --accent-blue: #3b82f6;
  --accent-green: #16a34a;
  --accent-yellow: #ca8a04;
  --accent-red: #dc2626;
  --accent-purple: #7c3aed;
  --sidebar-bg: #1e293b;
  --sidebar-text: #e2e8f0;
  --sidebar-active: #3b82f6;
  --topbar-bg: #ffffff;
  --topbar-border: #e2e8f0;
  --topbar-text: #1a202c;
  --font-mono: 'IBM Plex Mono', monospace;
  --font-sans: 'IBM Plex Sans', sans-serif;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.1);
  --transition: 150ms ease;
  --sidebar-width: 240px;
  --topbar-height: 56px;
  --banner-height: 36px;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--bg);
  font-family: var(--font-sans);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

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

a:hover {
  color: #2563eb;
}

img {
  max-width: 100%;
  display: block;
}

ul, ol {
  list-style: none;
}

/* ---------- Typography Utilities ---------- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.1rem; }

.text-muted { color: var(--text-muted); font-size: 0.875rem; }
.text-secondary { color: var(--text-secondary); }
.text-mono { font-family: var(--font-mono); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.hidden { display: none !important; }


/* =========================================================================
   LAYOUT — Sidebar (layout.php) — Dark sidebar for contrast
   ========================================================================= */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  z-index: 900;
  transition: transform 300ms ease;
  overflow: hidden;
}

.sidebar__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  height: var(--topbar-height);
  flex-shrink: 0;
}

.sidebar__logo-icon {
  flex-shrink: 0;
}

.sidebar__logo-text {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--sidebar-text);
  letter-spacing: 1px;
}

.sidebar__nav {
  flex: 1;
  padding: 8px 0;
  overflow-y: auto;
}

.sidebar__nav-item {
  list-style: none;
}

.sidebar__nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: rgba(226, 232, 240, 0.65);
  font-size: 14px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all var(--transition);
  text-decoration: none;
}

.sidebar__nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--sidebar-text);
}

.sidebar__nav-item--active .sidebar__nav-link {
  color: #fff;
  background: rgba(59, 130, 246, 0.15);
  border-left-color: var(--sidebar-active);
}

.sidebar__nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar__nav-icon svg {
  display: block;
}

.sidebar__nav-label {
  flex: 1;
}

.sidebar__badge {
  margin-left: auto;
  background: var(--accent-red);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  line-height: 1.4;
}

.sidebar__footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.sidebar__logout {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(226, 232, 240, 0.5);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  padding: 6px 0;
  transition: color var(--transition);
}

.sidebar__logout:hover {
  color: var(--accent-red);
}

.sidebar__logout svg {
  flex-shrink: 0;
}


/* =========================================================================
   LAYOUT — Top Bar (layout.php) — White with bottom border
   ========================================================================= */

.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--topbar-height);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  z-index: 100;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.topbar__left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.topbar__menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--topbar-text);
  cursor: pointer;
  padding: 4px;
  line-height: 0;
}

.topbar__title {
  font-size: 16px;
  font-weight: 600;
  color: var(--topbar-text);
  white-space: nowrap;
  font-family: var(--font-mono);
}

.topbar__center {
  flex: 1;
  display: flex;
  justify-content: center;
  min-width: 0;
}

.topbar__quick-command {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 4px 4px 12px;
  max-width: 400px;
  width: 100%;
}

.topbar__quick-command-input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-sans);
  flex: 1;
  outline: none;
  min-width: 0;
}

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

.topbar__quick-command-send {
  background: var(--accent-blue);
  border: none;
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition);
}

.topbar__quick-command-send:hover {
  background: #2563eb;
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.topbar__status-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  transition: all var(--transition);
}

.topbar__status-toggle:hover {
  background: var(--surface-hover);
}

.topbar__status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.topbar__status-dot--running {
  background: var(--accent-green);
  box-shadow: 0 0 6px rgba(22, 163, 74, 0.5);
}

.topbar__status-dot--paused {
  background: var(--accent-red);
  box-shadow: 0 0 6px rgba(220, 38, 38, 0.5);
  animation: pulse-red 1.5s ease-in-out infinite;
}

.topbar__status-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.topbar__user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.topbar__avatar--placeholder {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

.topbar__user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--topbar-text);
}


/* =========================================================================
   LAYOUT — Main Content (layout.php)
   ========================================================================= */

.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--topbar-height);
  min-height: calc(100vh - var(--topbar-height));
}

/* When banners are present, push content down */
.has-banner .main-content {
  margin-top: calc(var(--topbar-height) + var(--banner-height));
}

.has-quota-banner .main-content {
  margin-top: calc(var(--topbar-height) + var(--banner-height));
}

.has-banner.has-quota-banner .main-content {
  margin-top: calc(var(--topbar-height) + var(--banner-height) * 2);
}

.main-content__inner {
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
}


/* =========================================================================
   LAYOUT — System Banners (below topbar)
   ========================================================================= */

.system-banner {
  position: fixed;
  top: var(--topbar-height);
  left: var(--sidebar-width);
  right: 0;
  z-index: 99;
  padding: 0;
  height: var(--banner-height);
}

.system-banner + .system-banner {
  top: calc(var(--topbar-height) + var(--banner-height));
}

.system-banner__inner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 24px;
  font-size: 13px;
  font-weight: 600;
  height: 100%;
}

.system-banner__icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.system-banner__text {
  flex: 1;
}

.system-banner--paused {
  background: var(--accent-red);
}

.system-banner--paused .system-banner__inner {
  color: #fff;
}

.system-banner--quota {
  background: #fef3c7;
}

.system-banner--quota .system-banner__inner {
  color: #92400e;
}


/* =========================================================================
   LAYOUT — Mobile Bottom Tab Bar (layout.php)
   ========================================================================= */

.mobile-tabs {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 900;
  justify-content: space-around;
  align-items: center;
  padding: 0 4px;
}

.mobile-tabs__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 10px;
  font-weight: 500;
  position: relative;
  transition: color var(--transition);
}

.mobile-tabs__item--active {
  color: var(--accent-blue);
}

.mobile-tabs__icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-tabs__icon svg {
  display: block;
}

.mobile-tabs__label {
  line-height: 1;
}

.mobile-tabs__badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--accent-red);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  min-width: 14px;
  height: 14px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}


/* =========================================================================
   SHARED — Page Header
   ========================================================================= */

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

.page-header__left {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.page-header__title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.page-header__count {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 400;
}


/* =========================================================================
   SHARED — Panel (used everywhere) — White cards with subtle shadow
   ========================================================================= */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.panel--full-height {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}

.panel__header--collapsible {
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
}

.panel__header--collapsible:hover {
  background: var(--surface-hover);
}

.panel__header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel__title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel__title svg {
  flex-shrink: 0;
  color: var(--text-secondary);
}

.panel__badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  color: #fff;
}

.panel__badge--red {
  background: var(--accent-red);
}

.panel__collapse-icon {
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: transform var(--transition);
}

.panel__body {
  padding: 16px 20px;
}


/* =========================================================================
   SHARED — Empty State
   ========================================================================= */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  text-align: center;
  gap: 12px;
}

.empty-state--sm {
  padding: 16px 12px;
}

.empty-state__text {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

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


/* =========================================================================
   SHARED — Badges (BEM style: badge--variant)
   ========================================================================= */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  line-height: 1.5;
  background: #f1f5f9;
  color: var(--text-secondary);
  border: 1px solid transparent;
}

.badge--sm {
  font-size: 10px;
  padding: 1px 6px;
}

/* Role badge */
.badge--role {
  background: #f1f5f9;
  color: var(--text-secondary);
  border: 1px solid #e2e8f0;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Category badges */
.badge--category { }
.badge--action_needed {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}
.badge--permission_to_act {
  background: #dbeafe;
  color: #1e40af;
  border-color: #bfdbfe;
}
.badge--info {
  background: #ede9fe;
  color: #5b21b6;
  border-color: #ddd6fe;
}
.badge--status_update {
  background: #dcfce7;
  color: #166534;
  border-color: #bbf7d0;
}
.badge--error {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}
.badge--order {
  background: #dbeafe;
  color: #1e40af;
  border-color: #bfdbfe;
}

/* Priority badges */
.badge--priority { }
.badge--critical {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}
.badge--high {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}
.badge--normal {
  background: #f1f5f9;
  color: var(--text-secondary);
}
.badge--low {
  background: #f8fafc;
  color: var(--text-muted);
}

/* Status badges */
.badge--status { }
.badge--draft { background: #f1f5f9; color: var(--text-secondary); }
.badge--pending { background: #fef3c7; color: #92400e; }
.badge--approved { background: #dbeafe; color: #1e40af; }
.badge--in_progress { background: #ede9fe; color: #5b21b6; }
.badge--review { background: #fef3c7; color: #92400e; }
.badge--completed { background: #dcfce7; color: #166534; }
.badge--failed { background: #fee2e2; color: #991b1b; }
.badge--cancelled { background: #f8fafc; color: var(--text-muted); }

/* Branch badges */
.badge--branch {
  border: 1px solid;
  background: transparent;
}
.badge--branch-smartaianswers { color: var(--accent-blue); border-color: var(--accent-blue); background: #eff6ff; }
.badge--branch-clientn { color: var(--accent-purple); border-color: var(--accent-purple); background: #f5f3ff; }
.badge--branch-vm_infrastructure { color: var(--accent-green); border-color: var(--accent-green); background: #f0fdf4; }
.badge--branch-freelancing { color: var(--accent-yellow); border-color: var(--accent-yellow); background: #fefce8; }

/* Action type badges (activity log) */
.badge--action { }
.badge--task_created { background: #dbeafe; color: #1e40af; }
.badge--task_completed { background: #dcfce7; color: #166534; }
.badge--task_failed { background: #fee2e2; color: #991b1b; }
.badge--message_sent { background: #dbeafe; color: #1e40af; }
.badge--config_changed { background: #fef3c7; color: #92400e; }
.badge--member_activated { background: #dcfce7; color: #166534; }
.badge--member_deactivated { background: #fee2e2; color: #991b1b; }
.badge--run_started { background: #dbeafe; color: #1e40af; }
.badge--run_completed { background: #dcfce7; color: #166534; }
.badge--structure_changed { background: #ede9fe; color: #5b21b6; }
.badge--system_paused { background: #fee2e2; color: #991b1b; }
.badge--system_resumed { background: #dcfce7; color: #166534; }

/* GM proposal action badges */
.badge--approve-all, .badge--approve-selected, .badge--approved { background: #dcfce7; color: #166534; }
.badge--reject, .badge--rejected { background: #fee2e2; color: #991b1b; }

/* Color utility badges (settings service tokens) */
.badge--green { background: #dcfce7; color: #166534; }
.badge--red { background: #fee2e2; color: #991b1b; }


/* =========================================================================
   SHARED — Buttons (BEM: btn--variant)
   ========================================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 500;
  font-size: 13px;
  font-family: var(--font-sans);
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  line-height: 1.3;
  white-space: nowrap;
  text-decoration: none;
  color: var(--text-primary);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn svg {
  flex-shrink: 0;
}

.btn--primary {
  background: var(--accent-blue);
  color: #fff;
}
.btn--primary:hover:not(:disabled) { background: #2563eb; }

.btn--green {
  background: var(--accent-green);
  color: #fff;
}
.btn--green:hover:not(:disabled) { background: #15803d; }

.btn--red {
  background: var(--accent-red);
  color: #fff;
}
.btn--red:hover:not(:disabled) { background: #b91c1c; }

.btn--yellow {
  background: var(--accent-yellow);
  color: #fff;
}
.btn--yellow:hover:not(:disabled) { background: #a16207; }

.btn--blue {
  background: var(--accent-blue);
  color: #fff;
}
.btn--blue:hover:not(:disabled) { background: #2563eb; }

.btn--outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn--outline:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--text-primary);
  border-color: #cbd5e1;
}

.btn--sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn--xs {
  padding: 3px 8px;
  font-size: 11px;
}


/* =========================================================================
   SHARED — Forms
   ========================================================================= */

.form-group {
  margin-bottom: 16px;
}

.form-group--inline {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.form-group--full {
  width: 100%;
}

.form-row {
  margin-bottom: 16px;
}

.form-row--2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-row--3col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.form-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-sans);
  transition: border-color var(--transition);
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-input--sm {
  padding: 5px 8px;
  font-size: 12px;
}

.form-input--xs {
  max-width: 80px;
}

.form-input--inline {
  background: transparent;
  border-color: transparent;
  padding: 4px 6px;
  font-size: 12px;
}

.form-input--inline:focus {
  background: #fff;
  border-color: var(--accent-blue);
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.form-select--sm {
  padding: 5px 28px 5px 8px;
  font-size: 12px;
}

.form-select--inline {
  background-color: transparent;
  border-color: transparent;
  padding: 3px 24px 3px 6px;
  font-size: 12px;
}

.form-select--inline:focus {
  background-color: #fff;
  border-color: var(--accent-blue);
}

.form-textarea {
  resize: vertical;
  min-height: 60px;
  line-height: 1.5;
}

.form-textarea--mono {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
}

.form-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-blue);
  cursor: pointer;
  flex-shrink: 0;
}

.form-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
}

.form-range {
  width: 100%;
  accent-color: var(--accent-blue);
}

.form-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-input-prefix {
  display: flex;
  align-items: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.form-input-prefix__text {
  padding: 8px 0 8px 12px;
  color: var(--text-muted);
  font-size: 13px;
  font-family: var(--font-mono);
  white-space: nowrap;
  flex-shrink: 0;
}

.form-input-prefix .form-input {
  border: none;
  border-radius: 0;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 8px;
}


/* =========================================================================
   SHARED — Filter Bar
   ========================================================================= */

.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-wrap: wrap;
  box-shadow: var(--shadow);
}

.filter-bar--simple {
  background: transparent;
  border: none;
  padding: 0;
  margin-bottom: 12px;
  box-shadow: none;
}

.filter-bar__group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-bar__select {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 28px 6px 10px;
  color: var(--text-primary);
  font-size: 12px;
  font-family: var(--font-sans);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  outline: none;
  transition: border-color var(--transition);
}

.filter-bar__select:focus {
  border-color: var(--accent-blue);
}

.filter-bar__date {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--text-primary);
  font-size: 12px;
  font-family: var(--font-sans);
  outline: none;
}

.filter-bar__date:focus {
  border-color: var(--accent-blue);
}

.filter-bar__clear {
  flex-shrink: 0;
}

.filter-bar__search {
  width: 100%;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-sans);
  outline: none;
}

.filter-bar__search:focus {
  border-color: var(--accent-blue);
}


/* =========================================================================
   SHARED — View Toggle
   ========================================================================= */

.view-toggle {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  width: fit-content;
}

.view-toggle__btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-sans);
  color: var(--text-secondary);
  background: var(--surface);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
}

.view-toggle__btn:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
}

.view-toggle__btn--active {
  color: #fff;
  background: var(--accent-blue);
}


/* =========================================================================
   SHARED — Pagination
   ========================================================================= */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 20px;
  padding: 12px 0;
}

.pagination__btn {
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.pagination__btn:hover:not(:disabled):not(.pagination__btn--active) {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.pagination__btn--active {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #fff;
}

.pagination__btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.pagination__dots {
  padding: 0 4px;
  color: var(--text-muted);
  font-size: 13px;
}


/* =========================================================================
   SHARED — Data Table — White bg with light striped rows
   ========================================================================= */

.table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table--compact {
  font-size: 12px;
}

.data-table__th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  background: var(--surface-hover);
}

.data-table__th--check {
  width: 40px;
}

.data-table__td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table__td--check {
  width: 40px;
}

.data-table__td--title {
  max-width: 300px;
}

.data-table__td--actions {
  white-space: nowrap;
  display: flex;
  gap: 4px;
}

.data-table__row {
  transition: background var(--transition);
}

.data-table__row:hover {
  background: var(--surface-hover);
}

.data-table__row:nth-child(even) {
  background: #fafbfc;
}

.data-table__row:nth-child(even):hover {
  background: var(--surface-hover);
}

.data-table__link {
  color: var(--accent-blue);
  font-weight: 500;
}

.data-table__link:hover {
  text-decoration: underline;
}

.data-table__date {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}

.data-table__empty {
  text-align: center;
  padding: 24px;
}

/* Assignee cell in tasks table */
.assignee-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.assignee-cell__avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}

.assignee-cell__avatar--placeholder {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
}

.assignee-cell__name {
  font-size: 13px;
}


/* =========================================================================
   SHARED — Modals
   ========================================================================= */

.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  align-items: center;
  justify-content: center;
}

.modal[data-open="true"] {
  display: flex;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
}

.modal__dialog {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-width: 500px;
  width: calc(100% - 32px);
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.modal__dialog--lg {
  max-width: 700px;
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal__title {
  font-size: 1rem;
  font-weight: 600;
}

.modal__close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  line-height: 0;
  transition: color var(--transition);
}

.modal__close:hover {
  color: var(--text-primary);
}

.modal__body {
  padding: 20px;
}

.modal__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 16px;
}

/* Dynamic modal overlay (created by app.js showModal) */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  align-items: center;
  justify-content: center;
}
.modal-overlay.visible {
  display: flex;
}
.modal-overlay .modal {
  display: block;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-width: 500px;
  width: calc(100% - 32px);
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}
.modal-overlay .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-overlay .modal-header h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}
.modal-overlay .modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  font-size: 1.5rem;
  line-height: 1;
  transition: color var(--transition);
}
.modal-overlay .modal-close:hover {
  color: var(--text-primary);
}
.modal-overlay .modal-body {
  padding: 20px;
}
.modal-overlay .modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}


/* =========================================================================
   SHARED — Alerts
   ========================================================================= */

.alert {
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 13px;
}

.alert--error {
  background: #fee2e2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.alert--info {
  background: #dbeafe;
  border: 1px solid #bfdbfe;
  color: #1e40af;
}

.alert__header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-weight: 600;
}

.alert__meta {
  font-weight: 400;
  font-size: 12px;
  opacity: 0.8;
}

.alert__body {
  line-height: 1.5;
  font-size: 13px;
}


/* =========================================================================
   SHARED — Breadcrumb
   ========================================================================= */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  font-size: 13px;
}

.breadcrumb__link {
  color: var(--text-secondary);
  text-decoration: none;
}

.breadcrumb__link:hover {
  color: var(--accent-blue);
}

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

.breadcrumb__current {
  color: var(--text-primary);
  font-weight: 500;
}


/* =========================================================================
   SHARED — Code Blocks & Inline Code
   ========================================================================= */

.code-block {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 16px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-primary);
}

.code-block--sm {
  padding: 10px 12px;
  font-size: 11px;
}

.code-block--readonly {
  opacity: 0.8;
}

.code-block code {
  font-family: inherit;
  background: none;
  padding: 0;
}

.inline-code {
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-primary);
}

.inline-code--sm {
  font-size: 11px;
}

.inline-code--lg {
  font-size: 13px;
  padding: 3px 10px;
}


/* =========================================================================
   SHARED — Toggle Switch
   ========================================================================= */

.toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.toggle-switch__input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch__slider {
  width: 44px;
  height: 24px;
  background: #cbd5e1;
  border-radius: 12px;
  position: relative;
  transition: background 200ms;
}

.toggle-switch__slider::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform 200ms;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.toggle-switch__input:checked + .toggle-switch__slider {
  background: var(--accent-green);
}

.toggle-switch__input:checked + .toggle-switch__slider::after {
  transform: translateX(20px);
}


/* =========================================================================
   SHARED — Toggle Group (billing mode)
   ========================================================================= */

.toggle-group {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.toggle-group__btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-sans);
  color: var(--text-secondary);
  background: var(--surface);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
}

.toggle-group__btn:hover {
  background: var(--surface-hover);
}

.toggle-group__btn--active {
  background: var(--accent-blue);
  color: #fff;
}


/* =========================================================================
   SHARED — Subsection Title
   ========================================================================= */

.subsection-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
  margin-top: 8px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}


/* =========================================================================
   SHARED — Collapsible Section
   ========================================================================= */

.collapsible-section__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 0;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: color var(--transition);
}

.collapsible-section__toggle:hover {
  color: var(--text-primary);
}

.collapsible-section__icon {
  flex-shrink: 0;
  transition: transform var(--transition);
}

.collapsible-section__content {
  padding-top: 8px;
}


/* =========================================================================
   SHARED — Status Indicators
   ========================================================================= */

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-dot--green { background: var(--accent-green); }
.status-dot--yellow { background: var(--accent-yellow); }
.status-dot--red { background: var(--accent-red); }

.status-indicator {
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
}

.status-indicator--green { background: #dcfce7; color: #166534; }
.status-indicator--yellow { background: #fef3c7; color: #92400e; }
.status-indicator--red { background: #fee2e2; color: #991b1b; }
.status-indicator--blue { background: #dbeafe; color: #1e40af; }


/* =========================================================================
   SHARED — Context Indicator (report-detail.php)
   ========================================================================= */

.context-indicator {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.context-indicator--populated { color: var(--accent-green); }
.context-indicator--empty { color: var(--accent-yellow); }


/* =========================================================================
   DASHBOARD — dashboard.php
   ========================================================================= */

.page-dashboard {
  /* No special outer styles */
}

/* Status Toggle */
.dashboard-status-toggle {
  margin-bottom: 16px;
}

.status-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-radius: 8px;
  border: 1px solid;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all var(--transition);
}

.status-toggle-btn--running {
  background: #dcfce7;
  border-color: #bbf7d0;
  color: #166534;
}

.status-toggle-btn--running .status-toggle-btn__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px rgba(22, 163, 74, 0.4);
  animation: pulse-green 2s ease-in-out infinite;
}

.status-toggle-btn--paused {
  background: #fee2e2;
  border-color: #fecaca;
  color: #991b1b;
  animation: pulse-red-border 1.5s ease-in-out infinite;
}

.status-toggle-btn--paused .status-toggle-btn__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-red);
  box-shadow: 0 0 8px rgba(220, 38, 38, 0.4);
}

.status-toggle-btn--sm {
  padding: 8px 16px;
  font-size: 12px;
}

.status-toggle-btn__label {
  /* inherits from parent */
}

/* Quick Command Form (dashboard) */
.dashboard-quick-command {
  margin-bottom: 20px;
}

.quick-command-form {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 6px 6px 16px;
  box-shadow: var(--shadow);
}

.quick-command-form__input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-sans);
  outline: none;
  min-width: 0;
}

.quick-command-form__input::placeholder {
  color: var(--text-muted);
}

.quick-command-form__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--accent-blue);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition);
}

.quick-command-form__btn:hover {
  background: #2563eb;
}

/* Quota Meter */
.dashboard-quota {
  margin-bottom: 20px;
}

.quota-header {
  margin-bottom: 6px;
}

.quota-header__label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.quota-bar__track {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}

.quota-bar__fill {
  height: 100%;
  border-radius: 4px;
  transition: width 500ms ease;
  background: var(--accent-green);
}

.quota-bar__fill.quota-bar--green { background: var(--accent-green); }
.quota-bar__fill.quota-bar--yellow { background: var(--accent-yellow); }
.quota-bar__fill.quota-bar--red { background: var(--accent-red); }

/* Stats Cards Grid — White cards with colored left border accent */
.dashboard-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow);
  border-left: 3px solid var(--border);
}

.stat-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.stat-card--blue { border-left-color: var(--accent-blue); }
.stat-card--green { border-left-color: var(--accent-green); }
.stat-card--yellow { border-left-color: var(--accent-yellow); }
.stat-card--red { border-left-color: var(--accent-red); }
.stat-card--purple { border-left-color: var(--accent-purple); }

.stat-card__icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-card__icon--blue { background: #dbeafe; color: var(--accent-blue); }
.stat-card__icon--green { background: #dcfce7; color: var(--accent-green); }
.stat-card__icon--yellow { background: #fef3c7; color: var(--accent-yellow); }
.stat-card__icon--red { background: #fee2e2; color: var(--accent-red); }
.stat-card__icon--purple { background: #ede9fe; color: var(--accent-purple); }

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

.stat-card__label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Dashboard Two-Column Layout */
.dashboard-columns {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.dashboard-column--wide { }
.dashboard-column--narrow { }

/* Attention List */
.attention-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.attention-item {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fafbfc;
  transition: background var(--transition);
}

.attention-item:hover {
  background: var(--surface-hover);
}

.attention-item__header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.attention-item__from {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
}

.attention-item__category {
  /* inherits from .badge */
}

.attention-item__time {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}

.attention-item__subject {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.attention-item__body {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 10px;
}

.attention-item__actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Weekly Chart */
.weekly-chart__bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 100px;
  padding-top: 8px;
}

.weekly-chart__bar-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
}

.weekly-chart__bar {
  width: 100%;
  max-width: 32px;
  min-height: 3px;
  background: var(--accent-blue);
  border-radius: 3px 3px 0 0;
  transition: height 500ms ease;
}

.weekly-chart__day-label {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
}

/* System Health Meter */
.health-meter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.health-meter__ring {
  position: relative;
  width: 120px;
  height: 120px;
}

.health-meter__svg {
  width: 100%;
  height: 100%;
  display: block;
}

.health-meter__track {
  fill: none;
  stroke: #e2e8f0;
  stroke-width: 8;
}

.health-meter__fill {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
}

.health-meter__fill--green { stroke: var(--accent-green); }
.health-meter__fill--yellow { stroke: var(--accent-yellow); }
.health-meter__fill--red { stroke: var(--accent-red); }

.health-meter__value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.health-meter__stats {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

.health-meter__stat {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.health-meter__stat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.health-meter__stat-dot--green { background: var(--accent-green); }
.health-meter__stat-dot--red { background: var(--accent-red); }

/* Activity Feed (dashboard) */
.activity-feed__list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.activity-feed__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.activity-feed__item:last-child {
  border-bottom: none;
}

.activity-feed__time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.activity-feed__member {
  font-weight: 600;
  color: var(--text-primary);
  flex-shrink: 0;
}

.activity-feed__summary {
  color: var(--text-secondary);
  flex: 1;
  min-width: 0;
}


/* =========================================================================
   MESSAGES — messages.php
   ========================================================================= */

.page-messages { }

.messages-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.message-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all var(--transition);
  box-shadow: var(--shadow);
}

.message-card--unread {
  border-left: 3px solid var(--accent-blue);
}

.message-card__main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px 16px;
  cursor: pointer;
  gap: 16px;
  transition: background var(--transition);
}

.message-card__main:hover {
  background: var(--surface-hover);
}

.message-card__left {
  flex: 1;
  min-width: 0;
}

.message-card__from {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.message-card__name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
}

.message-card__subject {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.message-card__preview {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-card__right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.message-card__time {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Expanded content */
.message-card__expanded {
  display: none;
  padding: 0 16px 14px;
  border-top: 1px solid var(--border);
}

.message-card[data-expanded="true"] .message-card__expanded {
  display: block;
}

.message-card__body {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.6;
  padding: 12px 0;
}

.message-card__actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}


/* =========================================================================
   MESSAGE DETAIL — message-detail.php
   ========================================================================= */

.page-message-detail { }

.message-detail__header {
  margin-bottom: 20px;
}

.message-detail__title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.message-detail__subject {
  font-size: 1.5rem;
  font-weight: 700;
}

.message-detail__badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.message-detail__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  flex-wrap: wrap;
  gap: 8px;
}

.message-detail__participants {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-secondary);
}

.message-detail__from,
.message-detail__to {
  display: flex;
  align-items: center;
  gap: 6px;
}

.message-detail__time {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

/* Thread View */
.message-thread {
  margin-bottom: 20px;
}

.message-thread__item {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  background: var(--surface);
}

.message-thread__item--current {
  border-color: var(--accent-blue);
  background: #eff6ff;
}

.message-thread__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.message-thread__author {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
}

.message-thread__time {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}

.message-thread__body {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.6;
}

/* Related task */
.message-detail__related {
  margin-bottom: 16px;
}

.message-detail__related-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.message-detail__related-link {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--accent-blue);
  text-decoration: none;
}

.message-detail__related-link:hover {
  text-decoration: underline;
}

/* Action buttons */
.message-detail__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

/* Reply Form */
.message-reply {
  margin-top: 20px;
}

.message-reply__title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
}


/* =========================================================================
   TASKS — tasks.php
   ========================================================================= */

.page-tasks { }

.bulk-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: #dbeafe;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  margin-bottom: 12px;
}

.bulk-actions__count {
  font-size: 13px;
  font-weight: 600;
  color: #1e40af;
}


/* =========================================================================
   TASK DETAIL — task-detail.php
   ========================================================================= */

.page-task-detail { }

.task-detail__header {
  margin-bottom: 20px;
}

.task-detail__title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.task-detail__title {
  font-size: 1.5rem;
  font-weight: 700;
}

.task-detail__badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* State Machine */
.state-machine {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
}

.state-machine__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.state-machine__dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #cbd5e1;
  background: #f8fafc;
  color: var(--text-muted);
}

.state-machine__dot-inner {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.state-machine__step--completed .state-machine__dot {
  background: var(--accent-green);
  border-color: var(--accent-green);
  color: #fff;
}

.state-machine__step--current .state-machine__dot {
  border-color: var(--accent-blue);
}

.state-machine__step--current .state-machine__dot-inner {
  background: var(--accent-blue);
}

.state-machine__step--failed .state-machine__dot {
  border-color: var(--accent-red);
}

.state-machine__step--failed .state-machine__dot-inner {
  background: var(--accent-red);
}

.state-machine__step--cancelled .state-machine__dot {
  border-color: var(--text-muted);
}

.state-machine__step--cancelled .state-machine__dot-inner {
  background: var(--text-muted);
}

.state-machine__label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.state-machine__step--current .state-machine__label {
  color: var(--accent-blue);
}

.state-machine__step--completed .state-machine__label {
  color: var(--accent-green);
}

.state-machine__step--failed .state-machine__label {
  color: var(--accent-red);
}

.state-machine__connector {
  width: 24px;
  height: 2px;
  background: #cbd5e1;
  flex-shrink: 0;
  margin: 0 4px;
  align-self: center;
  margin-bottom: 20px;
}

.state-machine__connector--completed {
  background: var(--accent-green);
}

/* Task detail timestamps */
.task-detail__timestamps {
  display: flex;
  gap: 20px;
  padding-top: 16px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 12px;
}

/* Result Section */
.result-section {
  margin-bottom: 16px;
}

.result-section__title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.result-section__content {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.6;
}


/* =========================================================================
   REPORTS — reports.php (Grid of report cards)
   ========================================================================= */

.page-reports { }

.reports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.report-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  text-decoration: none;
  color: inherit;
  transition: all var(--transition);
  box-shadow: var(--shadow);
}

.report-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(59, 130, 246, 0.3);
}

.report-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

.report-card__identity {
  display: flex;
  align-items: center;
  gap: 10px;
}

.report-card__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}

.report-card__avatar--placeholder {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

.report-card__name-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.report-card__name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.report-card__unread-badge {
  background: var(--accent-red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.report-card__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.report-card__readiness {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
}

.report-card__readiness--ready { color: var(--accent-green); }
.report-card__readiness--not-ready { color: var(--accent-yellow); }

.report-card__stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.report-card__stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.report-card__stat-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-muted);
}

.report-card__stat-value {
  font-size: 13px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.report-card__run-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.report-card__run-indicator--success { background: var(--accent-green); }
.report-card__run-indicator--fail { background: var(--accent-red); }

.report-card__token-bar {
  width: 100%;
  height: 4px;
  background: #e2e8f0;
  border-radius: 2px;
  overflow: hidden;
  margin-top: 2px;
}

.report-card__token-fill {
  height: 100%;
  background: var(--accent-blue);
  border-radius: 2px;
  transition: width 500ms ease;
}

.report-card__token-fill--yellow { background: var(--accent-yellow); }
.report-card__token-fill--red { background: var(--accent-red); }


/* =========================================================================
   REPORT DETAIL — report-detail.php
   ========================================================================= */

.page-report-detail { }

.report-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.report-header__left {
  display: flex;
  align-items: flex-start;
}

.report-header__identity {
  display: flex;
  align-items: center;
  gap: 14px;
}

.report-header__avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}

.report-header__avatar--placeholder {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.report-header__name {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.report-header__badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.report-header__right {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.report-header__indicator {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
}

.report-header__indicator-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

/* Editable section spacing */
.editable-section .save-field-btn {
  margin-top: 6px;
}

/* Tag List (required skills) */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.tag-list__tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: #dbeafe;
  border: 1px solid #bfdbfe;
  border-radius: 4px;
  font-size: 12px;
  color: #1e40af;
}

.tag-list__remove {
  background: none;
  border: none;
  color: var(--accent-red);
  cursor: pointer;
  padding: 0;
  line-height: 0;
  opacity: 0.7;
  transition: opacity var(--transition);
}

.tag-list__remove:hover {
  opacity: 1;
}

.tag-list__add {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tag-list__input {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 12px;
  color: var(--text-primary);
  outline: none;
  width: 120px;
}

.tag-list__input:focus {
  border-color: var(--accent-blue);
}

/* Knowledge Base */
.knowledge-base-wrapper {
  position: relative;
}

.knowledge-base-actions {
  margin-top: 8px;
}

/* Run History (report-detail.php) */
.run-history__list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.run-history__item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.run-history__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  transition: background var(--transition);
}

.run-history__header:hover {
  background: var(--surface-hover);
}

.run-history__status {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
}

.run-history__status--success, .run-history__status--completed {
  background: #dcfce7;
  color: #166534;
}

.run-history__status--failed, .run-history__status--error {
  background: #fee2e2;
  color: #991b1b;
}

.run-history__status--running, .run-history__status--in_progress {
  background: #dbeafe;
  color: #1e40af;
}

.run-history__status--unknown {
  background: #f1f5f9;
  color: var(--text-secondary);
}

.run-history__time {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.run-history__tokens {
  font-size: 12px;
  color: var(--text-secondary);
  margin-left: auto;
}

.run-history__expand-icon {
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform var(--transition);
}

.run-history__detail {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: #fafbfc;
}

.run-history__summary {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.5;
}

.run-history__completed {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Metrics Grid (report-detail.php) */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.metric-card {
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}

.metric-card__value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.metric-card__unit {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-secondary);
  margin-left: 2px;
}

.metric-card__label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}


/* =========================================================================
   TEAM — team.php (Split layout: Org Chart + GM Chat)
   ========================================================================= */

.page-team { }

.team-split {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 20px;
  align-items: start;
}

.team-org { }

.team-gm-chat {
  position: sticky;
  top: calc(var(--topbar-height) + 24px);
}

/* Org Chart */
.org-chart { }

.org-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.org-item {
  list-style: none;
}

.org-item__row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background var(--transition);
  flex-wrap: wrap;
}

.org-item__row:hover {
  background: var(--surface-hover);
}

.org-item__toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 2px;
  line-height: 0;
  flex-shrink: 0;
  transition: transform var(--transition);
}

.org-item__toggle-spacer {
  width: 18px;
  flex-shrink: 0;
}

.org-item__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.org-item__dot--green { background: var(--accent-green); box-shadow: 0 0 4px rgba(22, 163, 74, 0.3); }
.org-item__dot--yellow { background: var(--accent-yellow); box-shadow: 0 0 4px rgba(202, 138, 4, 0.3); }
.org-item__dot--red { background: var(--accent-red); box-shadow: 0 0 4px rgba(220, 38, 38, 0.3); }

.org-item__name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
}

.org-item__meta {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.org-item__metric {
  font-size: 11px;
  color: var(--text-secondary);
}

.org-item__children {
  margin-left: 8px;
  border-left: 1px solid var(--border);
}

/* GM Chat */
.gm-chat__messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 500px;
}

.gm-chat__bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
}

.gm-chat__bubble--owner {
  align-self: flex-end;
  background: var(--accent-blue);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.gm-chat__bubble--gm {
  align-self: flex-start;
  background: #f1f5f9;
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.gm-chat__bubble-body {
  margin-bottom: 4px;
}

.gm-chat__bubble-time {
  font-size: 10px;
  opacity: 0.65;
}

/* GM Chat Proposal */
.gm-chat__proposal {
  margin-top: 10px;
  padding: 10px;
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.gm-chat__proposal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 12px;
}

.gm-chat__proposal-summary {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.gm-chat__proposal-changes {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.gm-chat__proposal-item {
  font-size: 12px;
}

.gm-chat__proposal-detail {
  margin-top: 6px;
}

.gm-chat__proposal-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Chat Input */
.gm-chat__input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.gm-chat__input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.gm-chat__input {
  flex: 1;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-sans);
  resize: none;
  outline: none;
  min-height: 40px;
}

.gm-chat__input:focus {
  border-color: var(--accent-blue);
}

.gm-chat__send-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 8px;
}

/* Archived threads */
.gm-chat__archived {
  padding: 8px 16px 12px;
  border-top: 1px solid var(--border);
}

.archived-list {
  list-style: none;
  padding: 0;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.archived-list__item { }

.archived-list__link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background var(--transition);
}

.archived-list__link:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.archived-list__meta {
  font-size: 10px;
  color: var(--text-muted);
}

/* Structure Change Log */
.changelog-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.changelog-list__item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.changelog-list__time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
  min-width: 80px;
}

.changelog-list__summary {
  color: var(--text-secondary);
}

/* Slide-in Member Detail Panel */
.member-detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 360px;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 1100;
  transform: translateX(100%);
  transition: transform 300ms ease;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.08);
}

.member-detail-panel[data-open="true"] {
  transform: translateX(0);
}

.member-detail-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.member-detail-panel__title {
  font-size: 1rem;
  font-weight: 600;
}

.member-detail-panel__close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  line-height: 0;
}

.member-detail-panel__close:hover {
  color: var(--text-primary);
}

.member-detail-panel__body {
  padding: 16px 20px;
  flex: 1;
}

.member-detail-panel__field {
  margin-bottom: 14px;
}

.member-detail-panel__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.3px;
  margin-bottom: 4px;
  display: block;
}

.member-detail-panel__value {
  font-size: 13px;
  color: var(--text-primary);
}

.member-detail-panel__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 20px;
}

/* Mobile floating button */
.floating-btn {
  display: none;
  position: fixed;
  bottom: 76px;
  right: 16px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-blue);
  color: #fff;
  border: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  z-index: 800;
  align-items: center;
  justify-content: center;
}


/* =========================================================================
   ACTIVITY LOG — activity-log.php
   ========================================================================= */

.page-activity-log { }

.activity-log-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.activity-entry {
  border-left: 2px solid var(--border);
}

.activity-entry__main {
  display: flex;
  gap: 0;
  padding: 10px 0;
  cursor: pointer;
  transition: background var(--transition);
}

.activity-entry__main:hover {
  background: var(--surface-hover);
}

.activity-entry__timeline {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 24px;
  flex-shrink: 0;
  position: relative;
}

.activity-entry__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
  position: relative;
  left: -6px;
}

.activity-entry__dot--green { background: var(--accent-green); }
.activity-entry__dot--red { background: var(--accent-red); }
.activity-entry__dot--blue { background: var(--accent-blue); }
.activity-entry__dot--yellow { background: var(--accent-yellow); }
.activity-entry__dot--purple { background: var(--accent-purple); }

.activity-entry__line {
  flex: 1;
  width: 2px;
  background: var(--border);
  margin-left: -6px;
}

.activity-entry__content {
  flex: 1;
  padding: 0 12px;
  min-width: 0;
}

.activity-entry__header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.activity-entry__time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.activity-entry__member {
  font-weight: 600;
  font-size: 13px;
}

.activity-entry__member-link {
  color: var(--accent-blue);
  text-decoration: none;
}

.activity-entry__member-link:hover {
  text-decoration: underline;
}

.activity-entry__summary {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.activity-entry__expand {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
  line-height: 0;
  transition: color var(--transition);
}

.activity-entry__expand:hover {
  color: var(--text-primary);
}

.activity-entry__detail {
  margin-left: 24px;
  padding: 0 12px 10px;
}


/* =========================================================================
   SETTINGS — settings.php
   ========================================================================= */

.page-settings { }

/* Account row */
.settings-account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.settings-account-row__info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-account-row__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}

.settings-account-row__avatar--placeholder {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.settings-account-row__name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.settings-account-row__email {
  font-size: 13px;
  color: var(--text-secondary);
}

/* New token display */
.new-token-value {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

/* System Info Grid */
.system-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.system-info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.system-info-item__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-muted);
}

.system-info-item__value {
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

/* Status row in settings */
.settings-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.settings-status-row__label {
  font-size: 14px;
  color: var(--text-secondary);
}


/* =========================================================================
   SKILLS — skills.php
   ========================================================================= */

.page-skills { }

/* Tab Navigation */
.tab-nav {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border);
}

.tab-nav__btn {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-sans);
  color: var(--text-secondary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: all var(--transition);
}

.tab-nav__btn:hover {
  color: var(--text-primary);
}

.tab-nav__btn--active {
  color: var(--accent-blue);
  border-bottom-color: var(--accent-blue);
}

/* Tab Content */
.tab-content { }

/* Skill Cards */
.skills-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skill-card {
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: border-color var(--transition);
}

.skill-card:hover {
  border-color: rgba(59, 130, 246, 0.3);
}

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

.skill-card__name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.skill-card__modified {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.skill-card__preview {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.skill-card__agents {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.skill-card__agents-label {
  font-size: 11px;
  color: var(--text-muted);
}

.skill-card__actions {
  display: flex;
  gap: 6px;
}

/* Migration Guide Content */
.migration-guide-content {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.7;
}

.migration-guide-content h1,
.migration-guide-content h2,
.migration-guide-content h3 {
  margin-top: 20px;
  margin-bottom: 8px;
}

.migration-guide-content p {
  margin-bottom: 12px;
}

.migration-guide-content code {
  background: #f1f5f9;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 13px;
}

.migration-guide-content pre {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 16px;
  overflow-x: auto;
  margin-bottom: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.migration-guide-content ul,
.migration-guide-content ol {
  padding-left: 24px;
  margin-bottom: 12px;
}

.migration-guide-content li {
  margin-bottom: 4px;
  list-style: disc;
}

.migration-guide-content ol li {
  list-style: decimal;
}


/* =========================================================================
   KEYFRAME ANIMATIONS
   ========================================================================= */

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 4px rgba(22, 163, 74, 0.2); }
  50% { box-shadow: 0 0 12px rgba(22, 163, 74, 0.4); }
}

@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 4px rgba(220, 38, 38, 0.2); }
  50% { box-shadow: 0 0 12px rgba(220, 38, 38, 0.4); }
}

@keyframes pulse-red-border {
  0%, 100% { border-color: #fecaca; }
  50% { border-color: #fca5a5; }
}


/* =========================================================================
   RESPONSIVE — Mobile Breakpoint
   ========================================================================= */

@media (max-width: 768px) {
  /* Hide desktop sidebar */
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.sidebar--open {
    transform: translateX(0);
  }

  /* Adjust topbar */
  .topbar {
    left: 0;
  }

  .topbar__menu-toggle {
    display: flex;
  }

  .topbar__center {
    display: none;
  }

  .topbar__user-name {
    display: none;
  }

  /* Adjust main content */
  .main-content {
    margin-left: 0;
    padding-bottom: 70px;
  }

  .main-content__inner {
    padding: 16px;
  }

  /* Show mobile bottom tabs */
  .mobile-tabs {
    display: flex;
  }

  /* System banners full width */
  .system-banner {
    left: 0;
  }

  /* Team split to single column */
  .team-split {
    grid-template-columns: 1fr;
  }

  .team-gm-chat {
    position: static;
  }

  /* Dashboard columns to single */
  .dashboard-columns {
    grid-template-columns: 1fr;
  }

  /* Reports grid */
  .reports-grid {
    grid-template-columns: 1fr;
  }

  /* Show floating GM button */
  .floating-btn {
    display: flex;
  }

  /* Table horizontal scroll */
  .data-table {
    min-width: 600px;
  }

  /* Form rows single column */
  .form-row--2col,
  .form-row--3col {
    grid-template-columns: 1fr;
  }

  /* Report header stack */
  .report-header {
    flex-direction: column;
  }

  /* Member detail panel full width */
  .member-detail-panel {
    width: 100%;
  }

  /* Filter bar wrapping */
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-bar__group {
    flex-wrap: wrap;
  }

  /* Stat cards */
  .dashboard-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .dashboard-stats-grid {
    grid-template-columns: 1fr;
  }

  .state-machine {
    gap: 4px;
    padding: 12px;
  }

  .state-machine__connector {
    width: 12px;
  }
}
