:root {
  color-scheme: light;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: #f5f7fb;
  color: #1f2933;
  --surface-alt: #f8fafc;
  --text-secondary: #64748b;
  --border: #e5e7eb;
  --warning-bg: #fef3c7;
  --warning-text: #92400e;
  --warning-border: #fbbf24;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f5f7fb;
  height: 100vh;
  overflow: hidden;
}

body.chat-scroll-locked {
  overflow: hidden;
}

.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  height: 100vh;
}

.sidebar {
  background: #ffffff;
  border-right: 1px solid #e5eaf0;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
}

.sidebar-nav-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-group-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
  padding: 0 2px;
}

.sidebar-note {
  margin: 4px 2px 0;
  font-size: 12px;
}

.pill {
  background: #e6eefc;
  color: #1d4ed8;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#visibleServiceButtons {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-divider {
  height: 1px;
  background: #e5eaf0;
  margin: 6px 0;
}

/* Daily Brief Button */
.daily-brief-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 16px;
  background: #f8fafc;
  color: #1f2933;
  border: 1px solid #e5eaf0;
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
  margin-bottom: 8px;
  position: relative;
}

.daily-brief-button:hover {
  background: #ffffff;
  border-color: #cbd5e0;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(31, 41, 51, 0.08);
}

.daily-brief-button:active {
  transform: translateY(0);
  box-shadow: none;
}

.daily-brief-button.active {
  background: #e6eefc;
  border-color: #1d4ed8;
}

.daily-brief-button.active .daily-brief-title {
  color: #1d4ed8;
}

.daily-brief-button.active .daily-brief-date {
  color: #1d4ed8;
}

.daily-brief-button.has-unread {
  border-color: #ef4444;
}

.daily-brief-button.has-unread .badge {
  background: #dc2626;
}

.daily-brief-button.severity-high {
  background: #fff1f2;
  border-color: #ef4444;
}

.daily-brief-button.severity-high .daily-brief-title,
.daily-brief-button.severity-high .daily-brief-date {
  color: #b91c1c;
}

.daily-brief-button.severity-urgent {
  background: #fee2e2;
  border-color: #dc2626;
  box-shadow: 0 10px 22px rgba(220, 38, 38, 0.14);
}

.daily-brief-button.severity-urgent .daily-brief-title,
.daily-brief-button.severity-urgent .daily-brief-date {
  color: #991b1b;
}

.daily-brief-button.severity-urgent .badge {
  background: #b91c1c;
}

.daily-brief-button.severity-critical {
  background: #fecaca;
  border-color: #b91c1c;
  box-shadow: 0 12px 26px rgba(185, 28, 28, 0.2);
}

.daily-brief-button.severity-critical .daily-brief-title,
.daily-brief-button.severity-critical .daily-brief-date {
  color: #7f1d1d;
}

.daily-brief-button.severity-critical .badge {
  background: #991b1b;
}

.daily-brief-content {
  flex: 1;
  text-align: left;
}

.daily-brief-title {
  font-size: 14px;
  font-weight: 600;
  color: #1f2933;
  margin-bottom: 2px;
}

.daily-brief-date {
  font-size: 12px;
  color: #6b7280;
  font-weight: 400;
}

.daily-brief-button .badge {
  background: #1d4ed8;
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  min-width: 20px;
  text-align: center;
}

.sidebar-section details {
  background: #f8fafc;
  border-radius: 12px;
  padding: 10px 12px;
}

.sidebar-section summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #1f2933;
  list-style: none;
}

.sidebar-section summary::-webkit-details-marker {
  display: none;
}

.sidebar-section summary::marker {
  content: "";
  display: none;
}

.sidebar-list {
  margin: 10px 0;
  padding: 0 0 0 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: #475569;
}

.sidebar-link {
  background: transparent;
  border: none;
  padding: 0;
  text-align: left;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.sidebar-link:hover {
  text-decoration: underline;
}

.button.small {
  padding: 6px 10px;
  font-size: 12px;
  margin-right: 6px;
}

.nav-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
}

.nav-item {
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  color: #1f2933;
  background: #f3f6fb;
  border: none;
  text-align: left;
  cursor: pointer;
}

.nav-item.active {
  background: #1d4ed8;
  color: #ffffff;
}

.hidden {
  display: none;
}

.main {
  padding: 32px 36px 48px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-height: 0;
  height: 100vh;
  overflow-y: auto;
  /* Reserve space so fixed chat panel doesn't cover content */
  padding-bottom: 620px;
}

.main.chat-scroll-locked {
  overflow: hidden;
  padding-bottom: 48px;
}

.main.chat-inline-flow {
  padding-bottom: 48px;
}

.main.no-fixed-chat-reserve {
  padding-bottom: 48px;
}

/* Keep layout usable as window narrows before mobile breakpoints */
@media (max-width: 1280px) {
  .app {
    grid-template-columns: 220px 1fr;
  }

  .main {
    padding: 22px 20px 40px;
    padding-bottom: 560px;
  }

  .main.chat-scroll-locked {
    padding-bottom: 40px;
  }

  .main.chat-inline-flow {
    padding-bottom: 40px;
  }

  .main.no-fixed-chat-reserve {
    padding-bottom: 40px;
  }

  .header {
    flex-wrap: wrap;
    gap: 10px;
    margin: 0;
    padding: 12px 14px;
  }

  .header-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  row-gap: 10px;
  position: sticky;
  top: 0;
  background: white;
  z-index: 100;
  padding: 16px 24px;
  border-bottom: 2px solid #e5e7eb;
  margin: 0 -24px;
  margin-bottom: 20px;
}
.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.home-team-header-tools {
  flex: 0 0 100%;
  order: 3;
  width: 100%;
  display: grid;
  gap: 10px;
  padding-top: 10px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  padding: 6px 10px;
  background: #f3f6fb;
  border-radius: 999px;
}

.user-chip-name-button {
  border: none;
  background: transparent;
  padding: 0;
  color: inherit;
  cursor: pointer;
  text-align: left;
  font: inherit;
}

.user-chip-name-button:hover .user-name {
  color: #1d4ed8;
}

.user-chip-name-button:focus-visible {
  outline: 2px solid #1d4ed8;
  outline-offset: 4px;
  border-radius: 10px;
}

.user-initials {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #1d4ed8;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
}

.header h1 {
  margin: 0 0 6px;
  font-size: 26px;
}

.header p {
  margin: 0;
  color: #6b7280;
}

.panel {
  background: #ffffff;
  border-radius: 16px;
  padding: 20px 22px;
  box-shadow: 0 10px 28px rgba(31, 41, 51, 0.08);
}

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

.panel-header h2 {
  margin: 0;
  font-size: 18px;
}

.daily-brief-dashboard {
  display: grid;
  gap: 18px;
}

.daily-brief-dashboard-header {
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.daily-brief-dashboard-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.daily-brief-summary-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.daily-brief-summary-item {
  border: 1px solid var(--border, #e5e7eb);
  background: var(--surface-alt, #f8fafc);
  border-radius: 12px;
  padding: 14px 16px;
}

.daily-brief-summary-label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary, #64748b);
  margin-bottom: 6px;
}

.daily-brief-summary-value {
  display: block;
  font-size: 22px;
  font-weight: 700;
  color: var(--text, #0f172a);
}

.daily-brief-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.daily-brief-card {
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  background: var(--surface-alt, #fbfdff);
  padding: 18px;
  min-width: 0;
}

.daily-brief-card-wide {
  grid-column: span 2;
}

.daily-brief-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.daily-brief-card-header h3 {
  margin: 0;
  font-size: 15px;
}

.daily-brief-card-body {
  display: grid;
  gap: 10px;
}

.daily-brief-work-snapshot {
  display: grid;
  gap: 16px;
}

.daily-brief-work-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.daily-brief-work-group {
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  background: #ffffff;
  padding: 16px;
  display: grid;
  gap: 12px;
}

.daily-brief-work-group-header {
  display: grid;
  gap: 4px;
}

.daily-brief-work-group-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text, #0f172a);
}

.daily-brief-work-group-meta {
  font-size: 12px;
  color: var(--text-secondary, #64748b);
}

.daily-brief-work-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.daily-brief-work-metric {
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  background: var(--surface-alt, #f8fafc);
  padding: 12px 14px;
}

.daily-brief-work-metric[data-tone="primary"] {
  border-color: rgba(29, 78, 216, 0.18);
  background: rgba(219, 234, 254, 0.5);
}

.daily-brief-work-metric[data-tone="info"] {
  border-color: rgba(14, 165, 233, 0.18);
  background: rgba(224, 242, 254, 0.6);
}

.daily-brief-work-metric[data-tone="warning"] {
  border-color: rgba(245, 158, 11, 0.18);
  background: rgba(254, 243, 199, 0.65);
}

.daily-brief-work-metric[data-tone="danger"] {
  border-color: rgba(239, 68, 68, 0.18);
  background: rgba(254, 226, 226, 0.65);
}

.daily-brief-work-metric[data-tone="success"] {
  border-color: rgba(16, 185, 129, 0.18);
  background: rgba(220, 252, 231, 0.65);
}

.daily-brief-work-metric-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.daily-brief-work-metric-value {
  margin-top: 8px;
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  color: var(--text, #0f172a);
}

.daily-brief-work-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.daily-brief-work-note {
  font-size: 13px;
  color: var(--text-secondary, #64748b);
}

.daily-brief-communications-compose {
  display: grid;
  gap: 12px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
  background: rgba(248, 250, 252, 0.9);
}

.daily-brief-compose-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.daily-brief-compose-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.daily-brief-empty {
  border: 1px dashed var(--border, #dbe2ea);
  border-radius: 12px;
  padding: 14px;
  color: var(--text-secondary, #64748b);
  background: rgba(248, 250, 252, 0.75);
}

.daily-brief-stack {
  display: grid;
  gap: 10px;
}

.daily-brief-item {
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  padding: 12px 14px;
  background: #ffffff;
}

.daily-brief-loading {
  border: 1px dashed var(--border, #dbe2ea);
  border-radius: 12px;
  padding: 14px;
  color: var(--text-secondary, #64748b);
  background: rgba(248, 250, 252, 0.8);
  display: grid;
  gap: 10px;
  overflow: hidden;
}

.daily-brief-loading-banner {
  border: 1px dashed var(--border, #dbe2ea);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--text-secondary, #64748b);
  background: rgba(248, 250, 252, 0.8);
  font-weight: 600;
  display: grid;
  gap: 10px;
  overflow: hidden;
}

.daily-brief-loading-banner-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.daily-brief-loading-label {
  font-size: 13px;
  font-weight: 600;
}

.daily-brief-loading-line {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  overflow: hidden;
}

.daily-brief-loading-line::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.72) 45%,
    rgba(255, 255, 255, 0) 100%
  );
  animation: dailyBriefShimmer 1.35s ease-in-out infinite;
}

.daily-brief-loading-line-title {
  width: 58%;
  height: 12px;
}

.daily-brief-loading-line-meta {
  width: 34%;
  height: 8px;
}

.daily-brief-loading-line-short {
  width: 72%;
}

.daily-brief-loading-line-wide {
  width: 92%;
}

.daily-brief-loading-dots {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.daily-brief-loading-dots span {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.65);
  animation: dailyBriefDotPulse 1.1s ease-in-out infinite;
}

.daily-brief-loading-dots span:nth-child(2) {
  animation-delay: 0.16s;
}

.daily-brief-loading-dots span:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes dailyBriefShimmer {
  100% {
    transform: translateX(100%);
  }
}

@keyframes dailyBriefDotPulse {
  0%, 80%, 100% {
    opacity: 0.35;
    transform: scale(0.9);
  }
  40% {
    opacity: 1;
    transform: scale(1);
  }
}

.daily-brief-item-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.daily-brief-item-title {
  font-weight: 600;
  color: var(--text, #0f172a);
}

.daily-brief-item-meta {
  font-size: 12px;
  color: var(--text-secondary, #64748b);
}

.daily-brief-item-copy {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text, #1f2937);
}

.daily-brief-item-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.daily-brief-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
}

.daily-brief-list li {
  line-height: 1.5;
}

.daily-brief-kicker {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
}

.daily-brief-item-broadcast.priority-routine {
  border-color: rgba(37, 99, 235, 0.18);
}

.daily-brief-item-broadcast.priority-routine .broadcast-priority-routine {
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
}

.daily-brief-item-broadcast.priority-important {
  border-color: rgba(245, 158, 11, 0.28);
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.08);
}

.daily-brief-item-broadcast.priority-important .broadcast-priority-important {
  background: rgba(245, 158, 11, 0.16);
  color: #b45309;
}

.daily-brief-item-broadcast.priority-urgent {
  border-color: rgba(239, 68, 68, 0.38);
  box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.12);
  background: linear-gradient(180deg, rgba(254, 242, 242, 0.95), #ffffff);
}

.daily-brief-item-broadcast.priority-urgent .broadcast-priority-urgent {
  background: rgba(239, 68, 68, 0.14);
  color: #b91c1c;
}

.daily-brief-item-broadcast.priority-critical {
  border-color: rgba(185, 28, 28, 0.5);
  box-shadow: inset 0 0 0 1px rgba(185, 28, 28, 0.18), 0 10px 24px rgba(185, 28, 28, 0.08);
  background: linear-gradient(180deg, rgba(254, 226, 226, 0.92), #ffffff);
}

.daily-brief-item-broadcast.priority-critical .broadcast-priority-critical {
  background: rgba(185, 28, 28, 0.16);
  color: #991b1b;
}

.daily-brief-card-priority .daily-brief-kicker {
  background: rgba(245, 158, 11, 0.14);
  color: #b45309;
}

@media (max-width: 960px) {
  .daily-brief-dashboard-grid {
    grid-template-columns: 1fr;
  }

  .daily-brief-card-wide {
    grid-column: span 1;
  }

  .daily-brief-work-groups {
    grid-template-columns: 1fr;
  }

  .daily-brief-compose-grid {
    grid-template-columns: 1fr;
  }
}

.training-insights-toolbar {
  display: grid;
  gap: 16px;
}

.training-insights-toolbar-grid {
  display: grid;
  grid-template-columns: minmax(220px, 360px) auto;
  gap: 12px;
  align-items: end;
}

.training-insights-filter-field {
  display: grid;
  gap: 6px;
}

.training-insights-toolbar-actions {
  display: flex;
  justify-content: flex-end;
}

.training-insights-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.training-insights-tab {
  border: 1px solid var(--border, #e5e7eb);
  background: var(--surface-alt, #f8fafc);
  color: inherit;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.training-insights-tab:hover {
  border-color: #cbd5e1;
  background: #ffffff;
}

.training-insights-tab.active {
  background: rgba(29, 78, 216, 0.12);
  border-color: #2563eb;
  color: #1d4ed8;
}

.training-insights-browser-section {
  min-width: 0;
}

.training-insights-shortcuts {
  overflow: hidden;
}

.training-insights-shortcuts-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.training-insights-shortcuts-toggle:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 4px;
  border-radius: 8px;
}

.training-insights-shortcuts-copy {
  min-width: 0;
}

.training-insights-shortcuts-body {
  display: none;
}

.training-insights-shortcuts.open .training-insights-shortcuts-body {
  display: grid !important;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.stat-card {
  background: #f8fafc;
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-label {
  font-size: 12px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
}

.badge {
  width: fit-content;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
}

.badge.success {
  background: #dcfce7;
  color: #166534;
}

.badge.warning {
  background: #fef3c7;
  color: #92400e;
}

.badge.danger {
  background: #fee2e2;
  color: #991b1b;
}

.badge.neutral {
  background: #e2e8f0;
  color: #1f2933;
}

.team-snapshot-branch {
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  background: var(--surface-alt, #f9fafb);
  color: inherit;
  padding: 0;
}

.team-snapshot-root {
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  background: var(--surface-alt, #f9fafb);
  overflow: hidden;
}

.team-snapshot-root-summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-primary, #fff);
  border-radius: 12px;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.team-snapshot-root-summary::-webkit-details-marker {
  display: none;
}

.team-snapshot-root-summary::marker {
  content: "";
  display: none;
}

.team-snapshot-root-summary::after {
  content: ">";
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary, #64748b);
  transform: rotate(0deg);
  transition: transform 0.15s ease;
}

.team-snapshot-root[open] > .team-snapshot-root-summary::after {
  transform: rotate(90deg);
}

.team-snapshot-root-summary:hover {
  background: #f8fafc;
}

.team-snapshot-root-summary:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: -2px;
}

.team-snapshot-root-copy {
  min-width: 0;
}

.team-snapshot-root-title {
  font-weight: 700;
  color: inherit;
}

.team-snapshot-root-hint {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-secondary, #64748b);
}

.team-snapshot-branch-summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  transition: background-color 0.15s ease;
}

.team-snapshot-branch-summary::-webkit-details-marker {
  display: none;
}

.team-snapshot-branch-summary::marker {
  content: "";
  display: none;
}

.team-snapshot-branch-summary::before {
  content: ">";
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary, #64748b);
  transform: rotate(0deg);
  transition: transform 0.15s ease;
  flex: 0 0 auto;
  line-height: 1;
}

.team-snapshot-branch[open] > .team-snapshot-branch-summary::before {
  transform: rotate(90deg);
}

.team-snapshot-branch-summary:hover {
  background: rgba(148, 163, 184, 0.1);
}

.team-snapshot-branch-summary:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: -2px;
}

.team-snapshot-branch-body {
  padding: 0 14px 14px;
}

.team-snapshot-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.team-snapshot-status-detail {
  display: inline-block;
}

.team-snapshot-status-summary {
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid transparent;
  user-select: none;
  transition: transform 0.12s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.team-snapshot-status-summary::-webkit-details-marker {
  display: none;
}

.team-snapshot-status-summary::marker {
  content: "";
  display: none;
}

.team-snapshot-status-summary::after {
  content: ">";
  font-size: 10px;
  font-weight: 700;
  opacity: 0.8;
  transform: rotate(0deg);
  transition: transform 0.15s ease;
}

.team-snapshot-status-detail[open] > .team-snapshot-status-summary::after {
  transform: rotate(90deg);
}

.team-snapshot-status-summary:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}

.team-snapshot-status-summary:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.team-snapshot-status-panel {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  background: var(--bg-primary, #fff);
  min-width: 280px;
  max-width: 420px;
}

.team-snapshot-assignment-list {
  display: grid;
  gap: 8px;
}

.team-snapshot-assignment-item {
  padding: 10px 12px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  background: var(--surface-alt, #f9fafb);
  color: inherit;
}

body[data-theme="dark"] .team-snapshot-root-summary:hover,
body[data-theme="dark"] .team-snapshot-branch-summary:hover {
  background: rgba(148, 163, 184, 0.14);
}

body[data-theme="dark"] .team-snapshot-status-summary:hover {
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.35);
}

.outbound-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.outbound-card {
  background: #f8fafc;
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.outbound-details {
  display: flex;
  gap: 32px;
  margin-top: 12px;
}

.flag {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
}

.flag.warn {
  background: #fee2e2;
  color: #b91c1c;
}

.flag.neutral {
  background: #e2e8f0;
  color: #1f2933;
}

.advanced-section {
  margin-top: 12px;
  background: #f8fafc;
  border-radius: 12px;
  padding: 12px 14px;
}

.advanced-section summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #1f2933;
  list-style: none;
}

.advanced-section summary::-webkit-details-marker {
  display: none;
}

.advanced-section summary::marker {
  content: "";
  display: none;
}

.status-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
}

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

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f8fafc;
}

.shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.shortcuts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.shortcut-item {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid #e5eaf0;
  background: #f8fafc;
  border-radius: 14px;
  padding: 14px 14px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  position: relative;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
}

.shortcut-item strong {
  font-size: 14px;
  font-weight: 700;
  color: #1f2933;
  padding-right: 22px; /* leave space for chevron */
}

.shortcut-item span {
  font-size: 12px;
  color: #6b7280;
  padding-right: 22px; /* leave space for chevron */
}

.shortcut-item::after {
  content: "›";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 22px;
  line-height: 1;
  color: #94a3b8;
}

.shortcut-item:hover {
  background: #ffffff;
  border-color: #cbd5e1;
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(31, 41, 51, 0.12);
}

.shortcut-item:active {
  transform: translateY(0);
}

.shortcut-item:focus-visible {
  outline: 3px solid rgba(29, 78, 216, 0.35);
  outline-offset: 2px;
}

.quick-actions-hint {
  margin: 4px 0 0;
  font-size: 12px;
}

.shortcut-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

.inline-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.shortcut-card {
  border: none;
  border-radius: 12px;
  padding: 12px;
  background: #ffffff;
  box-shadow: 0 10px 22px rgba(31, 41, 51, 0.12);
  font-size: 14px;
  color: #1f2933;
  transition: transform 160ms ease, box-shadow 160ms ease;
  cursor: pointer;
}

.shortcut-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 26px rgba(31, 41, 51, 0.18);
}

.chat-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: auto; /* Start collapsed */
  padding: 0 18px 18px;
  box-sizing: border-box;
}



.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 8px;
  display: none; /* Hidden initially */
}

/* Show messages when expanded */
.chat-panel.expanded .chat-messages {
  display: flex;
}

.chat-panel .panel-header h2 {
  color: #1d4ed8;
}

.chat-message {
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  animation: fadeIn 0.3s ease-in;
  line-height: 1.6;
}

.chat-message.user {
  max-width: 66%;
  margin-left: auto;
  background: #e0e7ff;
  text-align: left;
}

.chat-message.assistant {
  max-width: 720px;
  background: #f3f6fb;
  overflow-wrap: break-word;
  word-break: break-word;
}

.chat-message.assistant table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
  margin: 12px 0;
}

.chat-message.assistant th,
.chat-message.assistant td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  line-height: 1.55;
  word-break: normal;
  overflow-wrap: anywhere;
}

.chat-message.assistant thead th {
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  background: rgba(255, 255, 255, 0.75);
  border-bottom: 2px solid #dbe3ef;
}

.chat-message.assistant tbody td {
  border-bottom: 1px solid #e5eaf0;
}

.chat-message.assistant tbody tr:last-child td {
  border-bottom: none;
}

.chat-message.assistant ul,
.chat-message.assistant ol {
  margin: 10px 0;
  padding-left: 22px;
}

.chat-message.assistant p {
  margin: 0 0 10px;
}

.chat-message.assistant p:last-child {
  margin-bottom: 0;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-message .loading {
  color: #6b7280;
  font-style: italic;
}

.shortcut-card:focus-visible {
  outline: 2px solid #1d4ed8;
  outline-offset: 2px;
}

.loading-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #1f2933;
}

.loading-label {
  font-weight: 600;
}

.loading-dots {
  color: #6b7280;
}

.loading-meta {
  margin-top: 6px;
  font-size: 12px;
  color: #6b7280;
}

.message-feedback {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.25);
}

.message-feedback-label {
  font-size: 12px;
  color: #6b7280;
}

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

.feedback-button {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.feedback-button:hover:not(:disabled) {
  background: #eff6ff;
  border-color: #93c5fd;
  transform: translateY(-1px);
}

.feedback-button.active {
  background: #dbeafe;
  border-color: #60a5fa;
}

.feedback-button:disabled {
  cursor: default;
  opacity: 0.7;
}

.chat-input {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  min-width: 0;
}

.chat-input textarea {
  flex: 1 1 auto;
  min-width: 0;
  border: 2px solid rgba(29, 78, 216, 0.55);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.45;
  box-shadow: 0 8px 18px rgba(29, 78, 216, 0.12);
  resize: none;
  overflow-y: auto;
  min-height: 48px;
  max-height: 180px;
}

.chat-input .button,
#sendButton,
#insightsSendButton {
  flex-shrink: 0;
}

.chat-panel {
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid rgba(29, 78, 216, 0.12);
  box-shadow: 0 16px 32px rgba(29, 78, 216, 0.12);
  position: fixed;
  left: calc(260px + 36px);
  right: 36px;
  bottom: 20px;
  top: auto;
  z-index: 50;
  overflow: hidden;
  transition: box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
}

/* Expanded: fill from header to bottom of viewport */
.chat-panel.expanded {
  top: auto;
  bottom: 20px;
  max-height: calc(100vh - 140px);
  height: min(560px, calc(100vh - 140px));
  min-height: 0;
  overscroll-behavior: contain;
}

.chat-panel.expanded.conversation-active {
  max-height: calc(100vh - 134px);
  height: calc(100vh - 134px);
}

.chat-panel .panel-header {
  flex-shrink: 0;
  padding: 16px 18px 0;
  margin-bottom: 0;
}

.chat-panel .chat-input {
  flex-shrink: 0;
}

.chat-panel.expanded .chat-box {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.chat-panel.expanded .chat-messages {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-top: 10px;
  scroll-padding-top: 28px;
}

.chat-panel.expanded .chat-input {
  flex-shrink: 0;
  border-top: 1px solid #e5eaf0;
  padding-top: 8px;
  background: #ffffff;
}

.chat-panel.daily-brief-layout {
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  top: auto;
  z-index: 1;
  margin-top: 0;
  max-height: none;
  height: auto;
  overflow: visible;
}

.chat-panel.daily-brief-layout .chat-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: auto;
  min-height: 0;
  overflow: visible;
}

.chat-panel.daily-brief-layout .chat-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: visible;
  padding-top: 10px;
  scroll-padding-top: 28px;
}

.chat-panel.daily-brief-layout .chat-input {
  flex-shrink: 0;
  border-top: 1px solid #e5eaf0;
  padding-top: 8px;
  background: #ffffff;
}

/* ── Hamburger button (hidden on desktop) ── */
.hamburger-btn {
  display: none;
  background: none;
  border: 1px solid #d1d7e0;
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
  color: #374151;
  flex-shrink: 0;
}

/* ── Sidebar overlay backdrop ── */
.sidebar-overlay {
  display: none;
}

/* ═══════════════════════════════════════════
   TABLET: Narrow sidebar
   ═══════════════════════════════════════════ */
@media (max-width: 980px) {
  .app {
    grid-template-columns: 220px 1fr;
  }
  .main {
    padding: 24px 20px 40px;
    padding-bottom: 560px;
  }
  .chat-panel {
    left: calc(220px + 20px);
    right: 20px;
  }
  #insightsChatPanel {
    left: calc(220px + 20px);
    right: 20px;
  }
}

/* ═══════════════════════════════════════════
   MOBILE: < 768px
   Full responsive layout for phone screens
   ═══════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Bump base font size for readability on small screens */
  :root {
    font-size: 19px;
  }

  /* Grid becomes single column */
  .app {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
  }

  body {
    overflow: auto;
  }

  /* ── Hamburger visible ── */
  .hamburger-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* ── Sidebar: off-canvas slide-over ── */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.15);
  }

  /* Overlay backdrop */
  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.4);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }
  .sidebar-overlay.visible {
    opacity: 1;
    pointer-events: auto;
  }

  /* ── Header: compact mobile bar ── */
  .header {
    padding: 10px 14px;
    margin: 0;
    gap: 8px;
    flex-wrap: nowrap;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 100;
    background: #fff;
  }
  .header h1 {
    font-size: 22px;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  /* Hide full name on narrow screens, show initials */
  .user-chip-name {
    display: none;
  }
  /* Compact user chip */
  .user-chip {
    gap: 6px;
    padding: 4px 6px;
  }
  .user-initials {
    width: 30px;
    height: 30px;
    font-size: 11px;
  }
  /* ── Main content: full-width, no excessive padding ── */
  .main {
    padding: 8px 12px 160px;
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
  }

  /* ── Shortcuts section ── */
  .panel-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-bottom: 10px;
  }
  .panel-header h2 {
    font-size: 20px;
  }
  .shortcuts-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .shortcut-item {
    padding: 16px;
    min-height: 52px;
  }
  .shortcut-item strong {
    font-size: 17px;
  }
  .shortcut-item span {
    font-size: 15px;
  }
  .muted {
    font-size: 14px;
  }

  /* ── Chat panel: full-width, pinned to bottom ── */
  .chat-panel {
    position: fixed;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    border-radius: 16px 16px 0 0;
    margin: 0;
    z-index: 50;
    max-height: 60vh;
    transition: max-height 0.3s ease;
  }
  .chat-panel .panel-header {
    padding: 10px 14px;
  }
  .chat-panel.expanded {
    max-height: min(75vh, calc(100vh - 72px));
    top: auto;
    bottom: 0;
    height: min(75vh, calc(100vh - 72px));
    border-radius: 16px 16px 0 0;
    display: flex;
    flex-direction: column;
  }
  .chat-panel.expanded.conversation-active {
    max-height: calc(100vh - 90px);
    height: calc(100vh - 90px);
  }
  .chat-box {
    gap: 8px;
  }
  .chat-input {
    gap: 8px;
    padding: 0 4px 6px;
  }
  .chat-input textarea {
    font-size: 17px; /* >= 16px prevents iOS zoom */
    padding: 14px;
    border-radius: 12px;
    min-height: 48px;
  }
  .chat-input .button,
  #sendButton {
    min-height: 48px;
    min-width: 64px;
    font-size: 16px;
    padding: 12px 16px;
    border-radius: 12px;
  }
  .chat-message {
    font-size: 17px;
    line-height: 1.6;
    padding: 14px 16px;
    border-radius: 12px;
  }
  .chat-message.user {
    max-width: 85%;
  }

  /* ── Service buttons: bigger touch targets ── */
  .service-card {
    min-height: 52px;
    padding: 16px 18px;
    font-size: 17px;
  }

  /* ── Panels ── */
  .panel {
    padding: 14px;
    border-radius: 12px;
  }

  /* ── Control Portal panel (hide on mobile) ── */
  #trainingInsightsPanel,
  #insightsChatPanel,
  #trainingInsightsSection {
    display: none !important;
  }

  /* ── Insights chat (hide on mobile) ── */
  #insightsChatPanel {
    display: none !important;
  }

  /* ── Service dropdown on mobile ── */
  .service-dropdown-trigger {
    min-height: 52px;
    font-size: 17px;
  }

  /* ── Sidebar text sizes on mobile ── */
  .sidebar-section summary {
    font-size: 17px;
  }
  .sidebar-list {
    font-size: 16px;
    gap: 10px;
  }
  .sidebar-link {
    font-size: 16px;
  }
  .daily-brief-title {
    font-size: 17px;
  }
  .daily-brief-date {
    font-size: 14px;
  }
  .brand {
    font-size: 22px;
  }
  #configLink, #logoutButton {
    padding: 8px 12px !important;
    font-size: 14px !important;
  }
  .service-picker-row {
    font-size: 16px;
    padding: 10px 8px;
  }
  .badge {
    font-size: 13px;
    padding: 4px 10px;
  }
  .chat-panel .panel-header h2 {
    font-size: 18px;
  }

  /* ── Modal on mobile ── */
  .modal {
    width: calc(100vw - 16px);
    max-height: 90vh;
    padding: 14px;
    border-radius: 12px;
  }
  .modal-backdrop {
    padding: 8px;
  }

  /* ── Sources sidebar section (hide to simplify mobile) ── */

  /* ── Daily Brief button: bigger touch target ── */
  .daily-brief-button {
    min-height: 48px;
    padding: 12px 14px;
  }
}

/* ═══════════════════════════════════════════
   VERY SMALL: < 380px (small phones)
   ═══════════════════════════════════════════ */
@media (max-width: 380px) {
  .header h1 {
    font-size: 15px;
  }
  .main {
    padding: 6px 8px 160px;
  }
  .sidebar {
    width: 260px;
  }
}

.button {
  border: none;
  border-radius: 10px;
  padding: 8px 14px;
  background: #1d4ed8;
  color: #ffffff;
  font-size: 13px;
  min-height: 36px;
  cursor: pointer;
  box-shadow: 0 10px 18px rgba(29, 78, 216, 0.2);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.button.equal {
  min-width: 150px;
  text-align: center;
}

.button.secondary {
  background: #e2e8f0;
  color: #1f2933;
  box-shadow: 0 8px 16px rgba(148, 163, 184, 0.3);
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(29, 78, 216, 0.24);
}

.button.secondary:hover {
  box-shadow: 0 10px 18px rgba(148, 163, 184, 0.4);
}

.button.danger {
  background: #b91c1c;
  color: #fff;
  box-shadow: 0 8px 16px rgba(185, 28, 28, 0.28);
}

.button.danger:hover {
  box-shadow: 0 10px 18px rgba(185, 28, 28, 0.36);
}

.button:active {
  transform: translateY(0);
}

.tag-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tag {
  background: #eef2f7;
  color: #475569;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
}

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

.table th {
  text-align: left;
  color: #6b7280;
  padding-bottom: 8px;
}

.table td {
  padding: 10px 0;
  border-top: 1px solid #eef1f5;
}

/* ── Service buttons ── */
.service-card {
  display: block;
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #e5eaf0;
  border-radius: 10px;
  padding: 12px 14px;
  background: #f8fafc;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
}

.service-card:hover {
  background: #eef2f9;
  border-color: #cbd5f5;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(31, 41, 51, 0.08);
}

.service-card:active {
  transform: translateY(0);
  box-shadow: none;
}

.service-card.active {
  border-color: #1d4ed8;
  background: #e6eefc;
  color: #1d4ed8;
  font-weight: 600;
}

/* Drag-and-drop reordering */
.service-card.dragging {
  opacity: 0.35;
  border: 2px dashed #1d4ed8;
}
.service-card.drag-over {
  border-top: 3px solid #1d4ed8;
}

/* ── Service dropdown ── */
.service-dropdown {
  position: relative;
}

.service-dropdown-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid #d1d7e0;
  border-radius: 10px;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  cursor: pointer;
  transition: border-color 120ms ease;
}
.service-dropdown-trigger:hover {
  border-color: #a5b4fc;
}
.service-dropdown-trigger svg {
  transition: transform 200ms ease;
}
.service-dropdown.open .service-dropdown-trigger svg {
  transform: rotate(180deg);
}

.service-dropdown-menu {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 50;
  background: #fff;
  border: 1px solid #d1d7e0;
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.10);
  max-height: 280px;
  overflow-y: auto;
}
.service-dropdown.open .service-dropdown-menu {
  display: block;
}

/* Checkbox rows inside the dropdown */
.service-picker-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: #374151;
}
.service-picker-row:hover {
  background: #f3f4f6;
}
.service-picker-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #1d4ed8;
  cursor: pointer;
  flex-shrink: 0;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
}

.field input,
.field select,
.field textarea {
  border: 1px solid #d5dbe1;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
}

.muted {
  color: #6b7280;
  font-size: 12px;
}

.footer-note {
  font-size: 12px;
  color: #6b7280;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 9999; /* Above everything including sticky header */
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}

.modal {
  background: #ffffff;
  border-radius: 16px;
  padding: 20px 22px;
  width: min(640px, calc(100vw - 24px));
  max-height: min(88vh, calc(100vh - 24px));
  box-shadow: 0 24px 40px rgba(15, 23, 42, 0.2);
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  z-index: 10000; /* Above backdrop */
  overflow-y: auto;
}

.settings-modal {
  width: min(720px, calc(100vw - 24px));
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid #e5e7eb;
}

.settings-section:first-of-type {
  padding-top: 4px;
  border-top: none;
}

.settings-section h4 {
  margin: 0;
  font-size: 15px;
}

.settings-help {
  line-height: 1.4;
}

.settings-readonly {
  border: 1px solid #d5dbe1;
  border-radius: 10px;
  padding: 10px 12px;
  background: #f8fafc;
  font-size: 14px;
  min-height: 42px;
  display: flex;
  align-items: center;
}

.settings-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  padding: 6px 0;
}

.settings-toggle input {
  width: 16px;
  height: 16px;
}

.settings-status {
  min-height: 18px;
}

@media (max-width: 700px) {
  .modal-backdrop {
    padding: 12px;
  }

  .modal {
    width: calc(100vw - 24px);
    padding: 14px;
    border-radius: 12px;
  }
}

.modal-header {
  flex-shrink: 0;
}

.modal-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  flex: 1 1 auto;
  padding-right: 4px;
  min-height: 0;
}

.modal-actions {
  flex-shrink: 0;
  margin-top: auto;
}

.modal-content textarea {
  min-height: 80px;
}

.role-select {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #6b7280;
}

.role-select select {
  min-width: 160px;
}

.preview-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.summary-card {
  background: #f8fafc;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.summary-stack {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: #1f2933;
  margin-bottom: 12px;
}

.table-scroll {
  max-height: 360px;
  overflow: auto;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.table-scroll .table {
  margin: 0;
  border: none;
}

.table-scroll thead th {
  position: sticky;
  top: 0;
  background: #f9fafb;
  z-index: 1;
}

.warning-banner {
  background: #fef3c7;
  color: #7c2d12;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  margin: 10px 0;
}

.inline-alert {
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  margin-bottom: 12px;
}

.inline-alert.warn {
  background: #fef3c7;
  color: #7c2d12;
}

.inline-alert .panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.inline-alert .badge {
  flex-shrink: 0;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #1f2933;
}

.role-note.hidden {
  display: none;
}

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

.info-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  margin-left: 6px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #f1f5f9;
  color: #111827;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  -webkit-appearance: none;
  appearance: none;
  box-shadow: none;
}

.info-tip:hover {
  background: #e2e8f0;
}

.info-tip:active {
  transform: translateY(0.5px);
}

.info-tip:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.35);
}

/* Setup Guide-only UI affordances (hidden unless Setup Guide is ON) */
.setup-only {
  display: none !important;
}

body.setup-mode .setup-only {
  display: inline-flex !important;
}

.blocked-banner {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: #fee2e2;
  border: 1px solid #fecaca;
  border-radius: 12px;
  margin-bottom: 16px;
}

.blocked-banner.hidden {
  display: none;
}

.blocked-text {
  font-weight: 600;
  color: #991b1b;
}

.state-banner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  margin-bottom: 12px;
}

.state-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.blocked-focus {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 12px 0 16px;
}

.blocked-focus[data-state="ready"] .approval-status,
.blocked-focus[data-state="warnings"] .approval-status {
  display: none;
}

.blocked-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.approval-status {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.status-label {
  font-weight: 600;
  color: #1f2933;
}

.severity-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}

.severity-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.outbound-details.compact {
  margin-top: 12px;
}

.details-block {
  margin: 10px 0 0;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 12px;
}

.details-block summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #1f2933;
  list-style: none;
}

.details-block summary::-webkit-details-marker {
  display: none;
}

.details-block summary::marker {
  content: "";
  display: none;
}

.zone {
  border-radius: 14px;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.zone.is-collapsed {
  opacity: 0.5;
  filter: grayscale(0.2);
}

.publish-zone {
  background: #fff7ed;
  border-color: #fed7aa;
}

.zone-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.filter-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0 12px;
}

.tab-button {
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #f8fafc;
  padding: 6px 12px;
  font-size: 12px;
  color: #1f2933;
  cursor: pointer;
}

.tab-button.active {
  background: #e2e8f0;
  font-weight: 600;
}

.pill {
  margin-left: 6px;
  background: #e2e8f0;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
}

.advanced-section.locked summary {
  opacity: 0.6;
  cursor: not-allowed;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-backdrop.show {
  display: flex;
  align-items: center; /* Center the modal */
  justify-content: center;
}

body[data-theme="dark"] {
  color-scheme: dark;
  background: #0f172a;
  color: #e5edf7;
  --surface-alt: #162033;
  --text-secondary: #cbd5e1;
  --border: #334155;
  --warning-bg: #3a2a05;
  --warning-text: #fde68a;
  --warning-border: #a16207;
}

body[data-theme="dark"] .sidebar,
body[data-theme="dark"] .header,
body[data-theme="dark"] .panel,
body[data-theme="dark"] .chat-panel,
body[data-theme="dark"] .modal,
body[data-theme="dark"] .service-dropdown-menu {
  background: #111827;
  color: #e5edf7;
  border-color: #334155;
}

body[data-theme="dark"] .main,
body[data-theme="dark"] .chat-messages,
body[data-theme="dark"] .chat-box,
body[data-theme="dark"] .sidebar-list li,
body[data-theme="dark"] .shortcut-card,
body[data-theme="dark"] .service-card,
body[data-theme="dark"] .daily-brief-button,
body[data-theme="dark"] .service-dropdown-trigger,
body[data-theme="dark"] .service-picker-row,
body[data-theme="dark"] .user-chip,
body[data-theme="dark"] .settings-readonly,
body[data-theme="dark"] .stat-card,
body[data-theme="dark"] .outbound-card {
  background: #0f172a;
  color: #e5edf7;
  border-color: #334155;
}

body[data-theme="dark"] .chat-message.assistant {
  background: #162033;
  color: #e5edf7;
}

body[data-theme="dark"] .chat-message.user {
  background: #1d4ed8;
  color: #eff6ff;
}

body[data-theme="dark"] .chat-message.assistant a {
  color: #93c5fd;
}

body[data-theme="dark"] .chat-message.assistant thead th {
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.55);
  border-bottom-color: #334155;
}

body[data-theme="dark"] .chat-message.assistant tbody td {
  border-bottom-color: #334155;
}

body[data-theme="dark"] .header {
  border-bottom-color: #334155;
}

body[data-theme="dark"] .muted,
body[data-theme="dark"] .stat-label,
body[data-theme="dark"] .daily-brief-date,
body[data-theme="dark"] .service-card-subtitle,
body[data-theme="dark"] .shortcut-card small {
  color: #94a3b8;
}

body[data-theme="dark"] .user-chip-name-button:hover .user-name,
body[data-theme="dark"] .brand,
body[data-theme="dark"] .header h1 {
  color: #f8fafc;
}

body[data-theme="dark"] .pill,
body[data-theme="dark"] .daily-brief-button.active,
body[data-theme="dark"] .service-card.active,
body[data-theme="dark"] .badge.neutral {
  background: rgba(59, 130, 246, 0.18);
  color: #bfdbfe;
  border-color: rgba(96, 165, 250, 0.3);
}

body[data-theme="dark"] .daily-brief-button.has-unread {
  border-color: rgba(248, 113, 113, 0.7);
}

body[data-theme="dark"] .daily-brief-button.has-unread .badge {
  background: #dc2626;
}

body[data-theme="dark"] .daily-brief-button.severity-high {
  background: rgba(127, 29, 29, 0.26);
  border-color: rgba(248, 113, 113, 0.75);
}

body[data-theme="dark"] .daily-brief-button.severity-high .daily-brief-title,
body[data-theme="dark"] .daily-brief-button.severity-high .daily-brief-date {
  color: #fecaca;
}

body[data-theme="dark"] .daily-brief-button.severity-urgent {
  background: rgba(153, 27, 27, 0.34);
  border-color: rgba(248, 113, 113, 0.9);
  box-shadow: 0 12px 24px rgba(127, 29, 29, 0.28);
}

body[data-theme="dark"] .daily-brief-button.severity-urgent .daily-brief-title,
body[data-theme="dark"] .daily-brief-button.severity-urgent .daily-brief-date {
  color: #fee2e2;
}

body[data-theme="dark"] .daily-brief-button.severity-critical {
  background: rgba(220, 38, 38, 0.4);
  border-color: rgba(254, 202, 202, 0.95);
  box-shadow: 0 14px 28px rgba(127, 29, 29, 0.36);
}

body[data-theme="dark"] .daily-brief-button.severity-critical .daily-brief-title,
body[data-theme="dark"] .daily-brief-button.severity-critical .daily-brief-date {
  color: #fff1f2;
}

body[data-theme="dark"] .button.secondary,
body[data-theme="dark"] #configLink,
body[data-theme="dark"] #logoutButton {
  background: #1e293b !important;
  color: #e5edf7 !important;
  border-color: #475569 !important;
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.4);
}

body[data-theme="dark"] .field input,
body[data-theme="dark"] .field select,
body[data-theme="dark"] .field textarea,
body[data-theme="dark"] .chat-input textarea,
body[data-theme="dark"] .shortcut-input,
body[data-theme="dark"] .insights-period-select {
  background: #0b1220;
  color: #e5edf7;
  border-color: #334155;
}

body[data-theme="dark"] .chat-panel.expanded .chat-input,
body[data-theme="dark"] .chat-panel.daily-brief-layout .chat-input,
body[data-theme="dark"] #insightsChatPanel.expanded .chat-input,
body[data-theme="dark"] #insightsChatPanel:not(.expanded) .chat-input {
  background: #111827;
  border-top-color: #334155;
}

body[data-theme="dark"] .daily-brief-card,
body[data-theme="dark"] .daily-brief-item,
body[data-theme="dark"] .daily-brief-summary-item,
body[data-theme="dark"] .daily-brief-work-group,
body[data-theme="dark"] .daily-brief-work-metric,
body[data-theme="dark"] .daily-brief-communications-compose,
body[data-theme="dark"] .daily-brief-loading,
body[data-theme="dark"] .daily-brief-loading-banner {
  background: #0f172a;
  border-color: #334155;
}

body[data-theme="dark"] .daily-brief-empty {
  background: rgba(15, 23, 42, 0.72);
  border-color: #334155;
  color: #94a3b8;
}

body[data-theme="dark"] .daily-brief-loading-line {
  background: rgba(148, 163, 184, 0.18);
}

body[data-theme="dark"] .daily-brief-loading-line::after {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(148, 163, 184, 0.3) 45%,
    rgba(255, 255, 255, 0) 100%
  );
}

body[data-theme="dark"] .daily-brief-loading-dots span {
  background: rgba(148, 163, 184, 0.82);
}

body[data-theme="dark"] .daily-brief-item-title,
body[data-theme="dark"] .daily-brief-summary-value,
body[data-theme="dark"] .daily-brief-work-group-title,
body[data-theme="dark"] .daily-brief-work-metric-value {
  color: #f8fafc;
}

body[data-theme="dark"] .daily-brief-item-copy,
body[data-theme="dark"] .daily-brief-card-header h3 {
  color: #e5edf7;
}

body[data-theme="dark"] .daily-brief-item-meta,
body[data-theme="dark"] .daily-brief-summary-label,
body[data-theme="dark"] .daily-brief-work-group-meta,
body[data-theme="dark"] .daily-brief-work-metric-label,
body[data-theme="dark"] .daily-brief-work-note {
  color: #94a3b8;
}

body[data-theme="dark"] .daily-brief-kicker {
  background: rgba(96, 165, 250, 0.16);
  color: #bfdbfe;
}

body[data-theme="dark"] .daily-brief-item-broadcast.priority-routine {
  border-color: rgba(96, 165, 250, 0.28);
}

body[data-theme="dark"] .daily-brief-item-broadcast.priority-routine .broadcast-priority-routine {
  background: rgba(59, 130, 246, 0.22);
  color: #bfdbfe;
}

body[data-theme="dark"] .daily-brief-item-broadcast.priority-important {
  border-color: rgba(251, 191, 36, 0.34);
  box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.1);
}

body[data-theme="dark"] .daily-brief-item-broadcast.priority-important .broadcast-priority-important {
  background: rgba(245, 158, 11, 0.22);
  color: #fcd34d;
}

body[data-theme="dark"] .daily-brief-item-broadcast.priority-urgent {
  border-color: rgba(248, 113, 113, 0.5);
  box-shadow: inset 0 0 0 1px rgba(248, 113, 113, 0.14);
  background: linear-gradient(180deg, rgba(69, 10, 10, 0.48), #0f172a);
}

body[data-theme="dark"] .daily-brief-item-broadcast.priority-urgent .broadcast-priority-urgent {
  background: rgba(220, 38, 38, 0.28);
  color: #fecaca;
}

body[data-theme="dark"] .daily-brief-item-broadcast.priority-critical {
  border-color: rgba(254, 202, 202, 0.68);
  box-shadow: inset 0 0 0 1px rgba(254, 202, 202, 0.18), 0 12px 24px rgba(69, 10, 10, 0.22);
  background: linear-gradient(180deg, rgba(127, 29, 29, 0.56), #0f172a);
}

body[data-theme="dark"] .daily-brief-item-broadcast.priority-critical .broadcast-priority-critical {
  background: rgba(248, 113, 113, 0.3);
  color: #fff1f2;
}

body[data-theme="dark"] .daily-brief-card-priority .daily-brief-kicker {
  background: rgba(251, 191, 36, 0.16);
  color: #fde68a;
}

body[data-theme="dark"] #trainingInsightsPanel select,
body[data-theme="dark"] #trainingInsightsPanel button.secondary,
body[data-theme="dark"] #trainingInsightsPanel button:not(.button) {
  background: #162033;
  color: #e5edf7;
  border-color: #334155;
}

body[data-theme="dark"] #trainingInsightsPanel option {
  background: #111827;
  color: #e5edf7;
}

body[data-theme="dark"] .field input::placeholder,
body[data-theme="dark"] .field textarea::placeholder,
body[data-theme="dark"] .chat-input textarea::placeholder {
  color: #64748b;
}

body[data-theme="dark"] .sidebar-divider,
body[data-theme="dark"] .settings-section {
  border-color: #334155;
}

body[data-theme="dark"] .modal-backdrop {
  background: rgba(2, 6, 23, 0.72);
}

/* ========================
   Control Portal Styles
   ======================== */

.insights-chart {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.insight-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: #f8f9fb;
  border-radius: 6px;
  border: 1px solid #e5eaf0;
}

.insight-label {
  flex: 1;
  font-size: 14px;
  color: #3d4852;
}

.insight-value {
  font-weight: 600;
  color: #1d4ed8;
  font-size: 14px;
}

.insight-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: #f8f9fb;
  border-radius: 8px;
  border: 1px solid #e5eaf0;
  margin-bottom: 12px;
}

.insight-stat-label {
  font-size: 14px;
  color: #636f7c;
}

.insight-stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #1d4ed8;
}

.insights-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.insights-table thead {
  background: #f8f9fb;
}

.insights-table th {
  text-align: left;
  padding: 12px;
  font-size: 13px;
  font-weight: 600;
  color: #636f7c;
  border-bottom: 2px solid #e5eaf0;
}

.insights-table td {
  padding: 12px;
  font-size: 14px;
  border-bottom: 1px solid #e5eaf0;
}

.insights-table tbody tr:hover {
  background: #f8f9fb;
}

.panel-section {
  margin-bottom: 32px;
}

.panel-section h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #1f2933;
}

.flagged-review-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.flagged-review-item {
  border: 1px solid #e5eaf0;
  border-radius: 10px;
  background: #ffffff;
  overflow: hidden;
}

.flagged-review-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: #f8fafc;
  border: none;
  text-align: left;
  cursor: pointer;
}

.flagged-review-title {
  font-size: 14px;
  font-weight: 600;
  color: #1f2933;
}

.flagged-review-meta {
  margin-top: 4px;
  font-size: 12px;
  color: #6b7280;
}

.flagged-review-toggle {
  font-size: 12px;
  color: #1d4ed8;
  white-space: nowrap;
}

body[data-theme="dark"] .flagged-review-item {
  border-color: #94a3b8;
  background: #162033;
}

body[data-theme="dark"] .flagged-review-header {
  background: #162033;
  color: #e5edf7;
}

body[data-theme="dark"] .flagged-review-title {
  color: #f8fafc;
}

body[data-theme="dark"] .flagged-review-meta {
  color: #cbd5e1;
}

body[data-theme="dark"] .flagged-review-toggle {
  color: #60a5fa;
}

body[data-theme="dark"] .flagged-review-body {
  border-top-color: #334155;
}

body[data-theme="dark"] .flagged-review-bubble.user {
  background: #1d4ed8;
  color: #eff6ff;
}

body[data-theme="dark"] .flagged-review-bubble.assistant {
  background: #0f172a;
  color: #e5edf7;
}

.flagged-review-body {
  display: none;
  padding: 14px 16px 16px;
  border-top: 1px solid #e5eaf0;
  max-height: 360px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.flagged-review-item.open .flagged-review-body {
  display: block;
}

.flagged-review-transcript {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.flagged-review-bubble {
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.55;
}

.flagged-review-bubble.user {
  background: #e0e7ff;
}

.flagged-review-bubble.assistant {
  background: #f3f6fb;
}

/* Control Portal Chat Panel */
#trainingInsightsPanel {
  margin-bottom: 24px;
}

#insightsChatPanel {
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  z-index: 1;
  background: #ffffff;
  border: 1px solid rgba(29, 78, 216, 0.12);
  box-shadow: 0 16px 32px rgba(29, 78, 216, 0.12);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
  margin-top: 20px;
  max-height: none;
  overflow: visible;
}

#insightsChatPanel.expanded {
  position: fixed;
  left: calc(260px + 36px);
  right: 36px;
  top: 90px;
  bottom: 20px;
  z-index: 50;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: calc(100vh - 110px);
  height: calc(100vh - 110px);
  overflow: hidden;
}

#insightsChatPanel .panel-header,
#insightsChatPanel .chat-input {
  flex-shrink: 0;
}

#insightsChatPanel .chat-box {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.insights-tab-prompts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin: 0 18px 12px;
}

.insights-tab-prompt {
  border: 1px solid rgba(29, 78, 216, 0.16);
  border-radius: 12px;
  background: rgba(239, 246, 255, 0.78);
  color: #1e3a8a;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.insights-tab-prompt:hover {
  border-color: #60a5fa;
  background: rgba(219, 234, 254, 0.92);
  transform: translateY(-1px);
}

#insightsChatPanel .chat-message.assistant {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}

#insightsChatPanel .chat-messages {
  display: none;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#insightsChatPanel.expanded .chat-messages {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

#insightsChatPanel.expanded .panel-header {
  flex-shrink: 0;
  padding: 16px 18px 0;
  margin-bottom: 0;
}

#insightsChatPanel.expanded .chat-box {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  gap: 12px;
  min-height: 0;
  overflow: hidden;
  padding: 0 18px 18px;
}

#insightsChatPanel.expanded .chat-input {
  display: flex;
  flex-shrink: 0;
  align-items: flex-end;
  min-height: 0;
  border-top: 1px solid #e5eaf0;
  padding-top: 8px;
  background: #ffffff;
}

#insightsChatPanel:not(.expanded) .chat-box {
  padding: 0 18px 18px;
}

#insightsChatPanel:not(.expanded) .chat-input {
  display: flex;
}


/* Responsive: Control Portal Chat */
@media (max-width: 900px) {
  #insightsChatPanel.expanded {
    left: 24px;
    right: 24px;
    bottom: 18px;
    top: 78px;
    max-height: calc(100vh - 96px);
    height: calc(100vh - 96px);
  }
}


/* ========================
   Config Page Styles
   ======================== */

.config-pill {
  background: #fef3c7;
  color: #92400e;
}

.nav-button {
  display: block;
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-radius: 8px;
  text-align: left;
  font-size: 14px;
  font-weight: 500;
  color: #636f7c;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 4px;
}

.nav-button:hover {
  background: #f3f6fb;
  color: #1d4ed8;
}

.nav-button.active {
  background: #e6eefc;
  color: #1d4ed8;
  font-weight: 600;
}

.control-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

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

.stat-card {
  background: #ffffff;
  border: 1px solid #e5eaf0;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
}

.stats-grid-compact {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-bottom: 0;
}

.stat-card-left {
  text-align: left;
}

.stat-value {
  font-size: 36px;
  font-weight: 700;
  color: #1d4ed8;
  margin-bottom: 8px;
}

.stat-label {
  font-size: 13px;
  color: #636f7c;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  border-radius: 8px;
  overflow: hidden;
}

.data-table thead {
  background: #f8f9fb;
}

.data-table th {
  text-align: left;
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #636f7c;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid #e5eaf0;
}

.data-table td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid #e5eaf0;
}

.data-table tbody tr:hover {
  background: #f8f9fb;
}

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

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


/* Role & Service Cards */
.role-card {
  background: #ffffff;
  border: 1px solid #e5eaf0;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.role-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.role-card-header h3 {
  margin: 0 0 6px 0;
  font-size: 18px;
  font-weight: 600;
  color: #1f2933;
}

.role-card-header .muted {
  margin: 0;
  font-size: 14px;
}

/* Responsive: Stack buttons on small screens */
@media (max-width: 600px) {
  .data-table td {
    font-size: 13px;
  }
  
  .data-table td:last-child {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 120px;
  }
  
  .data-table td:last-child button {
    width: 100%;
  }
}

/* For larger screens, ensure buttons stay inline */
.data-table td:last-child {
  white-space: nowrap;
}

.data-table td:last-child button {
  margin-right: 4px;
}

.data-table td:last-child button:last-child {
  margin-right: 0;
}

.control-tenant-row {
  cursor: pointer;
}

.control-tenant-row.selected td {
  background: #e6eefc;
}

.control-grid-two {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr);
  gap: 20px;
  align-items: start;
}

.tenant-workspace-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.tenant-section-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.tenant-section-nav .nav-button {
  width: auto;
  min-width: 120px;
}

.readiness-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.readiness-item {
  border: 1px solid #e5eaf0;
  border-radius: 12px;
  padding: 12px 14px;
  background: #f8fafc;
}

.readiness-item.complete {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.readiness-item.pending {
  border-color: #dbeafe;
  background: #eff6ff;
}

.readiness-item-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.action-item {
  border: 1px solid #dbeafe;
  border-radius: 12px;
  padding: 12px 14px;
  background: #ffffff;
}

.action-item-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
}

.action-item-destination {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.action-item-destination code {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 3px 8px;
  font-size: 12px;
  color: #0f172a;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-item {
  border: 1px solid #e5eaf0;
  border-radius: 12px;
  padding: 12px 14px;
  background: #fff;
}

.history-item.compact {
  padding: 10px 12px;
}

.attention-item {
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.attention-item:hover {
  border-color: #f59e0b;
  box-shadow: 0 10px 24px rgba(245, 158, 11, 0.14);
  transform: translateY(-1px);
}

.history-item-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
}

.history-item-meta {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 8px;
}

.history-item-body {
  white-space: pre-wrap;
  word-break: break-word;
  color: #0f172a;
  font-size: 14px;
}

.issue-chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.issue-chip {
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #b91c1c;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.issue-chip:hover {
  background: #fee2e2;
}

.critical-focus {
  border-color: #ef4444 !important;
  background: #fff5f5 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.credentials-locked {
  border-color: #cbd5e1;
}

.credentials-remediation {
  border-color: #ef4444;
  background: #fff7ed;
}

.read-only-input {
  background: #f8fafc !important;
  color: #475569;
  cursor: not-allowed;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.readiness-progress-bar {
  width: 100%;
  height: 12px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.readiness-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb 0%, #1d4ed8 100%);
  border-radius: 999px;
}

.readiness-progress-label {
  margin-top: 8px;
  font-size: 13px;
  color: #475569;
  font-weight: 600;
}

@media (max-width: 1100px) {
  .control-grid-two {
    grid-template-columns: 1fr;
  }

  .tenant-workspace-header {
    flex-direction: column;
  }

  .tenant-section-nav {
    width: 100%;
  }
}


/* Form textarea styling */
.field textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #d1d7e0;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
  min-height: 80px;
}

.field textarea:focus {
  outline: none;
  border-color: #1d4ed8;
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.1);
}

.top-questions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.top-question-card {
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border, #e5e7eb);
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.top-question-card:hover {
  background: var(--surface-alt, #f8fafc);
  border-color: #cbd5e1;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(31, 41, 51, 0.08);
}

.top-question-card.active {
  background: #e6eefc;
  border-color: #1d4ed8;
}

.top-question-card-accent {
  background: linear-gradient(135deg, rgba(29, 78, 216, 0.08), rgba(14, 165, 233, 0.12));
  border-color: rgba(29, 78, 216, 0.28);
}

.top-question-card-accent:hover {
  border-color: rgba(29, 78, 216, 0.45);
}

.top-question-eyebrow {
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #1d4ed8;
}

.top-question-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 8px;
  color: inherit;
}

.top-question-meta,
.top-question-status {
  font-size: 12px;
  color: var(--text-secondary, #64748b);
}

.top-question-status {
  margin-top: 6px;
}

.lesson-review-shell {
  display: grid;
  gap: 16px;
}

.lesson-preview-card {
  padding: 16px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  background: var(--surface-alt, #f8fafc);
}

.lesson-builder-card {
  padding: 18px;
  border: 1px solid rgba(29, 78, 216, 0.18);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(29, 78, 216, 0.05), rgba(248, 250, 252, 0.92));
}

.lesson-builder-actions {
  margin-top: 16px;
}

.lesson-builder-working {
  margin-top: 12px;
}

.lesson-build-banner {
  padding: 16px 18px;
  border: 1px solid rgba(29, 78, 216, 0.24);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(29, 78, 216, 0.14), rgba(14, 165, 233, 0.08));
  box-shadow: 0 10px 30px rgba(29, 78, 216, 0.12);
}

.lesson-build-banner-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.lesson-build-banner-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary, #0f172a);
}

.lesson-build-banner-detail {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary, #475569);
}

.lesson-preview-summary {
  margin: 0;
  font-size: 15px;
  line-height: 1.65;
  color: inherit;
}

.lesson-source-grid {
  display: grid;
  gap: 8px;
}

.lesson-source-card {
  padding: 10px 12px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  background: var(--surface-alt, #f8fafc);
}

.lesson-sections-grid {
  display: grid;
  gap: 12px;
}

.lesson-section-card {
  padding: 16px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  background: var(--surface-alt, #f8fafc);
}

.lesson-section-label {
  font-size: 12px;
  color: var(--text-secondary, #64748b);
  margin-bottom: 6px;
}

.lesson-section-title {
  margin: 0 0 10px;
  font-size: 18px;
  line-height: 1.35;
}

.lesson-section-body {
  font-size: 15px;
  line-height: 1.7;
  color: inherit;
}

.lesson-section-body p:first-child {
  margin-top: 0;
}

.lesson-section-body p:last-child {
  margin-bottom: 0;
}

.lesson-key-takeaway {
  margin-top: 12px;
  padding: 12px 14px;
  border-left: 4px solid #1d4ed8;
  border-radius: 10px;
  background: rgba(29, 78, 216, 0.08);
  font-size: 14px;
  line-height: 1.55;
}

.lesson-checkpoint-card {
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  background: var(--surface-alt, #f8fafc);
}

.lesson-checkpoint-question {
  font-weight: 700;
  margin-bottom: 10px;
}

.lesson-checkpoint-options {
  display: grid;
  gap: 8px;
}

.lesson-checkpoint-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  background: #ffffff;
}

.lesson-checkpoint-option.correct {
  border-color: rgba(37, 99, 235, 0.32);
  background: rgba(37, 99, 235, 0.08);
}

.lesson-checkpoint-bullet {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
  flex: 0 0 auto;
}

.lesson-checkpoint-explanation {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary, #64748b);
}

.lesson-checkpoint-correct-badge {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.lesson-review-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.lesson-approval-banner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border, #e5e7eb);
}

.lesson-approval-banner.pending {
  background: #fff7ed;
  border-color: #fdba74;
}

.lesson-approval-banner.approved {
  background: #ecfdf5;
  border-color: #86efac;
}

.lesson-edit-grid {
  display: grid;
  gap: 12px;
}

.lesson-edit-card {
  padding: 16px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  background: var(--surface-alt, #f8fafc);
}

.lesson-edit-card .field {
  margin-top: 10px;
}

.lesson-editable-surface {
  width: 100%;
  min-height: 150px;
  padding: 12px 14px;
  border: 1px solid #d1d7e0;
  border-radius: 10px;
  background: #ffffff;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.7;
  color: inherit;
  outline: none;
  overflow: auto;
}

.lesson-editable-surface:focus {
  border-color: #1d4ed8;
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.1);
}

.lesson-assignment-panel {
  padding: 16px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  background: #ffffff;
}

.lesson-assignment-grid {
  display: grid;
  gap: 12px;
}

.lesson-assignment-top {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.selection-checklist {
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  padding: 10px;
  background: var(--surface-alt, #f8fafc);
}

.control-portal-actions-layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.control-portal-calendar-layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.home-team-toolbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
  position: relative;
  z-index: 2;
}

.home-team-toolbar .field {
  position: relative;
}

.home-team-toolbar .field:focus-within {
  z-index: 36;
}

.home-team-quick-launch {
  display: flex;
  align-items: center;
  gap: 8px;
}

.home-team-quick-launch-button {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--border, #d1d5db);
  background: var(--surface-alt, #f8fafc);
  color: var(--text, #0f172a);
  font-weight: 700;
  cursor: pointer;
}

.home-team-quick-launch-button:hover {
  border-color: #2563eb;
  color: #1d4ed8;
}

.home-team-quick-launch-button.active {
  border-color: #2563eb;
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
}

.home-team-panel-header {
  position: sticky;
  top: 76px;
  z-index: 30;
  background: #ffffff;
  padding: 10px 0 12px;
  margin-top: -6px;
  border-bottom: 1px solid var(--border, #e5e7eb);
}

.home-team-quick-panel-host {
  position: sticky;
  top: 142px;
  z-index: 24;
  background: #ffffff;
  padding: 12px 0 10px;
}

.home-team-header-tools .home-team-quick-panel-host {
  position: static;
  top: auto;
  padding: 0;
}

#homeTeamPanel .home-team-panel-header .home-team-quick-launch,
#homeTeamPanel > .home-team-quick-panel-host {
  display: none !important;
}

.home-team-agenda-list {
  display: grid;
  gap: 14px;
}

.home-team-agenda-item {
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 16px;
  background: #ffffff;
  overflow: hidden;
}

.home-team-agenda-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  font-weight: 700;
}

.home-team-agenda-summary::-webkit-details-marker {
  display: none;
}

.home-team-agenda-summary::marker {
  content: "";
}

.home-team-agenda-summary::after {
  content: "+";
  font-size: 18px;
  color: var(--text-secondary, #64748b);
}

.home-team-agenda-item[open] > .home-team-agenda-summary::after {
  content: "-";
}

.home-team-agenda-summary:hover {
  background: var(--surface-alt, #f8fafc);
}

.home-team-agenda-content {
  padding: 0 18px 18px;
}

.home-team-passed-lists {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.home-team-kbi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.home-team-kbi-card {
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 16px;
  background: #ffffff;
  padding: 16px;
  display: grid;
  gap: 10px;
}

.home-team-kbi-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.home-team-kbi-kicker {
  font-size: 12px;
  color: var(--text-secondary, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.home-team-kbi-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
}

.home-team-kbi-value {
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
}

.home-team-kbi-meta {
  font-size: 13px;
  color: var(--text-secondary, #64748b);
  line-height: 1.5;
}

.home-team-kbi-description {
  font-size: 14px;
  line-height: 1.55;
}

.home-team-kbi-manage-panel {
  margin-top: 16px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 16px;
  background: var(--surface-alt, #f8fafc);
  padding: 16px;
}

.home-team-kbi-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.home-team-kbi-form-grid.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.home-team-kbi-manage-actions,
.home-team-kbi-card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.home-team-kbi-manage-actions {
  margin-top: 12px;
}

.home-team-kbi-manual-form {
  border-top: 1px solid var(--border, #e5e7eb);
  padding-top: 12px;
}

@media (max-width: 900px) {
  .home-team-kbi-form-grid,
  .home-team-kbi-form-grid.compact {
    grid-template-columns: 1fr;
  }
}

.home-team-followthrough-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.home-team-quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.home-team-attachment-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.home-team-attachment-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--surface-alt, #f8fafc);
}

.home-team-attachment-actions {
  display: flex;
  gap: 8px;
}

.control-portal-calendar-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.control-portal-calendar-list-panel {
  grid-column: span 2;
}

.control-portal-calendar-preview-list,
.control-portal-calendar-event-list {
  display: grid;
  gap: 12px;
}

.control-portal-calendar-preview-card,
.control-portal-calendar-event-card {
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  background: var(--surface-alt, #f8fafc);
  padding: 14px 16px;
}

.control-portal-calendar-preview-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.control-portal-calendar-preview-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
}

.control-portal-calendar-preview-copy,
.control-portal-calendar-event-copy {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.55;
}

.control-portal-calendar-event-impact {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(29, 78, 216, 0.08);
  color: inherit;
  display: grid;
  gap: 4px;
  font-size: 13px;
}

.control-portal-calendar-event-footer {
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.control-portal-actions-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.control-portal-summary-card {
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  background: var(--surface-alt, #f8fafc);
  padding: 14px 16px;
}

.control-portal-summary-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.control-portal-summary-value {
  margin-top: 8px;
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}

.control-portal-overview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.control-portal-overview-card {
  min-width: 0;
}

.control-portal-overview-card-wide {
  grid-column: span 2;
}

.control-portal-overview-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.control-portal-overview-work-sections {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.control-portal-overview-section {
  display: grid;
  gap: 14px;
  width: 100%;
  padding: 16px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 16px;
  background: #ffffff;
  text-align: left;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.control-portal-overview-section:hover {
  border-color: #93c5fd;
  background: var(--surface-alt, #fbfdff);
  box-shadow: 0 10px 22px rgba(29, 78, 216, 0.08);
  transform: translateY(-1px);
}

.control-portal-overview-section-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.control-portal-overview-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text, #0f172a);
}

.control-portal-overview-section-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.control-portal-summary-card[data-tone="primary"] {
  border-color: rgba(29, 78, 216, 0.18);
  background: rgba(219, 234, 254, 0.46);
}

.control-portal-summary-card[data-tone="info"] {
  border-color: rgba(14, 165, 233, 0.18);
  background: rgba(224, 242, 254, 0.52);
}

.control-portal-summary-card[data-tone="warning"] {
  border-color: rgba(245, 158, 11, 0.18);
  background: rgba(254, 243, 199, 0.62);
}

.control-portal-summary-card[data-tone="danger"] {
  border-color: rgba(239, 68, 68, 0.18);
  background: rgba(254, 226, 226, 0.62);
}

.control-portal-overview-health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.control-portal-overview-health-item,
.control-portal-overview-mini-card,
.control-portal-overview-question {
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  background: var(--surface-alt, #f8fafc);
  padding: 12px 14px;
  color: inherit;
}

.control-portal-overview-health-value {
  margin-top: 6px;
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
}

.control-portal-overview-mini-list {
  display: grid;
  gap: 10px;
}

.control-portal-overview-question {
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.control-portal-overview-question:hover {
  border-color: #93c5fd;
  background: #ffffff;
  transform: translateY(-1px);
}

.insights-detail-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.insights-detail-meta {
  min-width: 0;
  flex: 1;
}

.my-training-layout {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.my-training-layout.lesson-focused {
  grid-template-columns: minmax(0, 1fr);
}

.my-training-sidebar,
.my-training-detail {
  min-width: 0;
}

.my-training-sidebar {
  position: static;
}

.my-training-layout.lesson-focused .my-training-sidebar {
  display: none;
}

.training-assignment-list {
  display: grid;
  gap: 12px;
}

.completed-training-group {
  margin-top: 14px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  background: var(--surface-alt, #f8fafc);
  overflow: hidden;
}

.completed-training-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}

.completed-training-group summary::-webkit-details-marker {
  display: none;
}

.completed-training-group summary::marker {
  content: "";
  display: none;
}

.completed-training-list {
  padding: 0 12px 12px;
}

.training-assignment-card {
  width: 100%;
  text-align: left;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--border, #e5e7eb);
  background: #ffffff;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.training-assignment-card:hover {
  border-color: #cbd5e1;
  background: var(--surface-alt, #f8fafc);
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(31, 41, 51, 0.08);
}

.training-assignment-card.active {
  background: #e6eefc;
  border-color: #1d4ed8;
  box-shadow: 0 10px 24px rgba(29, 78, 216, 0.12);
}

.training-assignment-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.training-assignment-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  margin: 0;
}

.training-assignment-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  background: #eef2ff;
  color: #3730a3;
}

.training-assignment-badge.in-progress,
.training-assignment-badge.opened {
  background: #e0f2fe;
  color: #075985;
}

.training-assignment-badge.completed {
  background: #dcfce7;
  color: #166534;
}

.training-assignment-badge.assigned {
  background: #f3f4f6;
  color: #374151;
}

.training-assignment-badge.not-started {
  background: #f3f4f6;
  color: #374151;
}

.training-assignment-badge.blocked {
  background: #fee2e2;
  color: #991b1b;
}

.training-assignment-badge.low {
  background: #f3f4f6;
  color: #374151;
}

.training-assignment-badge.medium {
  background: #fef3c7;
  color: #92400e;
}

.training-assignment-badge.high {
  background: #dbeafe;
  color: #1d4ed8;
}

.training-assignment-badge.critical {
  background: #fee2e2;
  color: #991b1b;
}

.training-assignment-meta {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-secondary, #64748b);
}

.training-assignment-summary {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.55;
  color: #475569;
}

.training-lesson-meta {
  margin-bottom: 14px;
  font-size: 13px;
}

.training-lesson-shell {
  display: grid;
  gap: 18px;
}

.training-lesson-overview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  padding: 16px 18px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.training-lesson-overview-copy {
  min-width: 0;
}

.training-lesson-overview-label {
  font-size: 12px;
  color: var(--text-secondary, #64748b);
  margin-bottom: 8px;
}

.training-lesson-summary {
  margin: 0;
  font-size: 17px;
  line-height: 1.65;
}

.training-progress-summary {
  min-width: 200px;
  display: grid;
  gap: 8px;
}

.training-progress-label {
  font-size: 12px;
  color: var(--text-secondary, #64748b);
}

.training-progress-track {
  height: 10px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.training-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb 0%, #3b82f6 100%);
}

.training-progress-value {
  font-size: 13px;
  font-weight: 700;
  color: #1f2933;
}

.training-meta-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.training-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid var(--border, #e5e7eb);
  font-size: 12px;
  color: #475569;
}

.training-source-section {
  display: grid;
  gap: 8px;
}

.training-source-label,
.training-section-step {
  font-size: 12px;
  color: var(--text-secondary, #64748b);
}

.training-source-grid {
  display: grid;
  gap: 10px;
}

.training-source-card {
  padding: 12px 14px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  background: var(--surface-alt, #f8fafc);
}

.training-source-card a {
  font-weight: 600;
  line-height: 1.45;
}

.training-section-card {
  padding: 18px 20px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(31, 41, 51, 0.05);
}

.training-section-title {
  margin: 8px 0 12px;
  font-size: 30px;
  line-height: 1.15;
}

.training-section-body {
  font-size: 16px;
  line-height: 1.75;
  color: inherit;
}

.training-section-body p:first-child {
  margin-top: 0;
}

.training-section-body p:last-child {
  margin-bottom: 0;
}

.training-section-takeaway {
  margin-top: 16px;
  padding: 14px 16px;
  border-left: 4px solid #2563eb;
  border-radius: 12px;
  background: rgba(37, 99, 235, 0.08);
  font-size: 15px;
  line-height: 1.6;
}

.training-section-tip {
  margin-top: 16px;
  padding: 14px 16px;
  border-left: 4px solid #0f766e;
  border-radius: 12px;
  background: rgba(15, 118, 110, 0.08);
  font-size: 15px;
  line-height: 1.6;
}

.training-note-card {
  padding: 14px 16px;
  border-left: 4px solid #1d4ed8;
  border-radius: 12px;
  background: var(--surface-alt, #f8fafc);
  font-size: 14px;
  line-height: 1.6;
}

.training-lesson-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border, #e5e7eb);
}

.training-quiz-panel {
  margin-top: 18px;
}

.training-quiz-card {
  padding: 18px 20px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(31, 41, 51, 0.05);
}

.training-quiz-question {
  margin-top: 18px;
}

.training-quiz-question:first-of-type {
  margin-top: 0;
}

.training-quiz-prompt {
  font-weight: 700;
  margin-bottom: 10px;
}

.training-quiz-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 8px;
  font-size: 14px;
  line-height: 1.5;
}

.training-checkpoint-feedback {
  min-height: 24px;
  margin-top: 14px;
  font-size: 14px;
  color: #1e3a8a;
}

.training-complete-card {
  padding: 22px 24px;
  border: 1px solid rgba(37, 99, 235, 0.22);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(219, 234, 254, 0.88) 0%, rgba(255, 255, 255, 0.96) 100%);
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.12);
}

.training-complete-title {
  margin: 8px 0 10px;
  font-size: 32px;
  line-height: 1.1;
}

.training-celebration-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1200;
}

.training-celebration-overlay.fade-out {
  opacity: 0;
  transition: opacity 0.45s ease;
}

.training-celebration-card {
  position: absolute;
  left: 50%;
  top: 18%;
  transform: translateX(-50%);
  min-width: 260px;
  padding: 16px 20px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(15, 23, 42, 0.9);
  color: #f8fafc;
  text-align: center;
  box-shadow: 0 24px 50px rgba(15, 23, 42, 0.35);
}

.training-celebration-card h3 {
  margin: 0 0 6px;
  font-size: 26px;
}

.training-celebration-card p {
  margin: 0;
  font-size: 14px;
  color: rgba(248, 250, 252, 0.88);
}

.training-celebration-overlay.reduced-motion .training-celebration-card {
  animation: trainingCelebratePulse 800ms ease-out;
}

@keyframes trainingCelebratePulse {
  0% {
    transform: translateX(-50%) scale(0.96);
  }
  100% {
    transform: translateX(-50%) scale(1);
  }
}

@media (max-width: 1180px) {
  .control-portal-overview-grid {
    grid-template-columns: 1fr;
  }

  .control-portal-overview-card-wide {
    grid-column: span 1;
  }

  .control-portal-overview-work-sections,
  .control-portal-overview-section-metrics {
    grid-template-columns: 1fr;
  }

  .training-insights-toolbar-grid {
    grid-template-columns: 1fr;
  }

  .training-insights-toolbar-actions {
    justify-content: flex-start;
  }

  .my-training-layout {
    grid-template-columns: 1fr;
  }

  .control-portal-actions-layout {
    grid-template-columns: 1fr;
  }

  .control-portal-calendar-layout {
    grid-template-columns: 1fr;
  }

  .control-portal-calendar-list-panel {
    grid-column: span 1;
  }

  .control-portal-calendar-grid {
    grid-template-columns: 1fr;
  }

  .home-team-passed-lists {
    grid-template-columns: 1fr;
  }

  .home-team-panel-header {
    top: 58px;
  }

  .home-team-quick-panel-host {
    top: 124px;
  }

  .my-training-sidebar {
    position: static;
    top: auto;
  }

  .training-lesson-overview {
    grid-template-columns: 1fr;
  }

  .training-progress-summary {
    min-width: 0;
  }
}

body[data-theme="dark"] .top-question-card.active {
  background: rgba(29, 78, 216, 0.18);
  border-color: #60a5fa;
}

body[data-theme="dark"] .top-question-card-accent {
  background: linear-gradient(135deg, rgba(29, 78, 216, 0.16), rgba(14, 165, 233, 0.12));
  border-color: rgba(96, 165, 250, 0.38);
}

body[data-theme="dark"] .top-question-eyebrow {
  color: #93c5fd;
}

body[data-theme="dark"] .button.danger {
  background: #dc2626;
}

body[data-theme="dark"] .training-insights-tab {
  background: #162033;
  border-color: #334155;
  color: #e5edf7;
}

body[data-theme="dark"] .training-insights-tab:hover {
  background: #1c2940;
}

body[data-theme="dark"] .training-insights-tab.active {
  background: rgba(37, 99, 235, 0.22);
  border-color: #60a5fa;
  color: #93c5fd;
}

body[data-theme="dark"] .lesson-editable-surface {
  background: #0b1220;
  border-color: #334155;
  color: #e5edf7;
}

body[data-theme="dark"] .lesson-key-takeaway {
  background: rgba(37, 99, 235, 0.18);
}

body[data-theme="dark"] .lesson-builder-card {
  background: linear-gradient(180deg, rgba(29, 78, 216, 0.14), rgba(15, 23, 42, 0.96));
  border-color: rgba(96, 165, 250, 0.3);
}

body[data-theme="dark"] .lesson-approval-banner.pending {
  background: rgba(194, 65, 12, 0.18);
  border-color: #9a3412;
}

body[data-theme="dark"] .lesson-approval-banner.approved {
  background: rgba(22, 101, 52, 0.18);
  border-color: #166534;
}

body[data-theme="dark"] .lesson-checkpoint-card,
body[data-theme="dark"] .lesson-checkpoint-option {
  background: #162033;
  border-color: #334155;
  color: #e5edf7;
}

body[data-theme="dark"] .lesson-checkpoint-option.correct {
  background: rgba(37, 99, 235, 0.18);
}

body[data-theme="dark"] .lesson-checkpoint-bullet {
  background: rgba(96, 165, 250, 0.18);
  color: #93c5fd;
}

body[data-theme="dark"] .lesson-checkpoint-correct-badge {
  background: rgba(34, 197, 94, 0.18);
  color: #86efac;
}

body[data-theme="dark"] .lesson-assignment-panel {
  background: #111827;
  border-color: #334155;
}

body[data-theme="dark"] .home-team-quick-launch-button {
  background: #162033;
  border-color: #334155;
  color: #e5edf7;
}

body[data-theme="dark"] .home-team-quick-launch-button.active {
  background: rgba(37, 99, 235, 0.22);
  border-color: #60a5fa;
  color: #93c5fd;
}

body[data-theme="dark"] .home-team-panel-header {
  background: #111827;
  border-color: #334155;
}

body[data-theme="dark"] .home-team-quick-launch-button:hover {
  border-color: #60a5fa;
  color: #93c5fd;
}

body[data-theme="dark"] .home-team-attachment-item {
  background: #162033;
  border-color: #334155;
}

body[data-theme="dark"] .home-team-quick-panel-host,
body[data-theme="dark"] .home-team-agenda-item {
  background: #111827;
  border-color: #334155;
}

body[data-theme="dark"] .control-portal-summary-card {
  background: #162033;
  border-color: #334155;
}

body[data-theme="dark"] .control-portal-overview-health-item,
body[data-theme="dark"] .control-portal-overview-mini-card,
body[data-theme="dark"] .control-portal-overview-question,
body[data-theme="dark"] .control-portal-calendar-preview-card,
body[data-theme="dark"] .control-portal-calendar-event-card {
  background: #162033;
  border-color: #334155;
}

body[data-theme="dark"] .control-portal-overview-question:hover {
  background: #1b2940;
  border-color: #60a5fa;
}

body[data-theme="dark"] .insights-tab-prompt {
  background: rgba(30, 64, 175, 0.18);
  border-color: rgba(96, 165, 250, 0.22);
  color: #dbeafe;
}

body[data-theme="dark"] .insights-tab-prompt:hover {
  background: rgba(37, 99, 235, 0.24);
  border-color: #60a5fa;
}

body[data-theme="dark"] .control-portal-calendar-event-impact {
  background: rgba(37, 99, 235, 0.16);
}

body[data-theme="dark"] .training-assignment-card,
body[data-theme="dark"] .training-section-card,
body[data-theme="dark"] .training-quiz-card,
body[data-theme="dark"] .training-lesson-overview {
  background: #111827;
  border-color: #334155;
  box-shadow: 0 10px 28px rgba(2, 6, 23, 0.32);
}

body[data-theme="dark"] .training-assignment-card.active {
  background: rgba(29, 78, 216, 0.18);
  border-color: #60a5fa;
}

body[data-theme="dark"] .completed-training-group {
  background: #162033;
  border-color: #334155;
}

body[data-theme="dark"] .training-source-card,
body[data-theme="dark"] .training-meta-pill,
body[data-theme="dark"] .training-note-card,
body[data-theme="dark"] .training-complete-card {
  background: #162033;
  border-color: #334155;
  color: #e5edf7;
}

body[data-theme="dark"] .training-assignment-summary,
body[data-theme="dark"] .training-assignment-meta,
body[data-theme="dark"] .training-progress-label,
body[data-theme="dark"] .training-source-label,
body[data-theme="dark"] .training-section-step {
  color: #94a3b8;
}

body[data-theme="dark"] .training-progress-track {
  background: #1e293b;
}

body[data-theme="dark"] .training-progress-value,
body[data-theme="dark"] .training-assignment-title,
body[data-theme="dark"] .training-section-title,
body[data-theme="dark"] .training-complete-title,
body[data-theme="dark"] .training-lesson-summary,
body[data-theme="dark"] .training-section-body,
body[data-theme="dark"] .training-quiz-prompt,
body[data-theme="dark"] .training-quiz-option {
  color: #e5edf7;
}

body[data-theme="dark"] .training-checkpoint-feedback {
  color: #93c5fd;
}

body[data-theme="dark"] .training-section-tip {
  background: rgba(13, 148, 136, 0.18);
}

body[data-theme="dark"] .training-section-takeaway {
  background: rgba(37, 99, 235, 0.18);
}

/* Toggle Switch for Setup Mode */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #d1d5db;
  transition: background-color 0.4s ease;
  border-radius: 24px;
  border: 1px solid #9ca3af;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: transform 0.4s ease;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--primary);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

.toggle-switch input:focus + .toggle-slider {
  box-shadow: 0 0 1px var(--primary);
}

/* Setup Mode Hints */
.setup-hint {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1px solid #93c5fd;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
}

.setup-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #e5e7eb;
}

.setup-step:last-child {
  border-bottom: none;
}

.setup-step-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.setup-step-icon.complete {
  background: #10b981;
  color: white;
}

.setup-step-icon.pending {
  background: #e5e7eb;
  color: #6b7280;
}

.setup-step-text {
  flex: 1;
}

.setup-step-title {
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.setup-step-description {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Setup Action Cards */
.setup-action-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  width: 100%;
}

.setup-action-card:hover {
  border-color: #3b82f6;
  background: #f8fafc;
  transform: translateX(4px);
}

.setup-action-card.disabled,
.setup-action-card:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.setup-action-card.disabled:hover,
.setup-action-card:disabled:hover {
  border-color: #e5e7eb;
  background: white;
  transform: none;
}

.setup-action-card.disabled .setup-action-arrow,
.setup-action-card:disabled .setup-action-arrow {
  color: #cbd5e1;
}

.setup-action-card.priority {
  border-color: #fecaca;
  background: #fef2f2;
}

.setup-action-card.priority:hover {
  border-color: #ef4444;
  background: #fee2e2;
}

.setup-action-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 18px;
  flex-shrink: 0;
}

.setup-action-content {
  flex: 1;
}

.setup-action-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
  font-size: 15px;
}

.setup-action-description {
  font-size: 13px;
  color: var(--text-secondary);
}

.setup-action-arrow {
  font-size: 24px;
  color: #9ca3af;
  flex-shrink: 0;
}

.setup-action-card:hover .setup-action-arrow {
  color: #3b82f6;
}

/* Modal Info Boxes */
.modal-info-box {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.5;
}

.modal-info-box.info {
  background: #eff6ff;
  border: 1px solid #93c5fd;
  color: #1e40af;
}

.modal-info-box.warning {
  background: #fef3c7;
  border: 1px solid #fbbf24;
  color: #92400e;
}

.modal-info-box strong {
  display: block;
  margin-bottom: 4px;
}

/* CSV File Input Styling */
input[type="file"] {
  font-family: inherit;
  cursor: pointer;
}

input[type="file"]::file-selector-button {
  padding: 8px 16px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  margin-right: 12px;
}

input[type="file"]::file-selector-button:hover {
  background: #1e40af;
}

/* Shortcut Input Styling */
.shortcut-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.shortcut-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #d1d7e0;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
}

.shortcut-input:focus {
  outline: none;
  border-color: #1d4ed8;
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.1);
}

.remove-shortcut {
  width: 32px;
  height: 32px;
  border: none;
  background: #ef4444;
  color: white;
  border-radius: 6px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
}

.remove-shortcut:hover {
  background: #dc2626;
}

/* ── Insights Dashboard ── */
.insights-period-select {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-primary);
  cursor: pointer;
}

.insights-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.insights-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 20px;
  text-align: center;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.insights-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.insights-card-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: 6px;
}

.insights-card-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.insights-chart-area {
  padding: 20px;
  min-height: 180px;
  display: flex;
  align-items: flex-end;
  gap: 2px;
}

.insights-bar-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.insights-bar {
  width: 100%;
  max-width: 32px;
  background: var(--primary);
  border-radius: 4px 4px 0 0;
  min-height: 2px;
  transition: height 400ms ease, background 160ms ease;
  cursor: default;
  position: relative;
}

.insights-bar:hover {
  background: #2563eb;
}

.insights-bar-label {
  font-size: 10px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 48px;
  text-align: center;
}

.insights-bar-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: #fff;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
}

.insights-bar:hover .insights-bar-tooltip {
  display: block;
}

.insights-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
}

.insights-service-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

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

.insights-service-name {
  flex: 0 0 140px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.insights-service-bar-track {
  flex: 1;
  height: 20px;
  background: var(--bg-secondary);
  border-radius: 10px;
  overflow: hidden;
}

.insights-service-bar-fill {
  height: 100%;
  border-radius: 10px;
  background: var(--primary);
  transition: width 500ms ease;
  min-width: 2px;
}

.insights-service-count {
  flex: 0 0 50px;
  text-align: right;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.insights-hour-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 16px;
}

.insights-hour-label {
  flex: 0 0 55px;
  font-size: 12px;
  color: var(--text-secondary);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.insights-hour-bar-track {
  flex: 1;
  height: 14px;
  background: var(--bg-secondary);
  border-radius: 7px;
  overflow: hidden;
}

.insights-hour-bar-fill {
  height: 100%;
  border-radius: 7px;
  background: #10b981;
  transition: width 500ms ease;
  min-width: 2px;
}

.insights-hour-count {
  flex: 0 0 36px;
  text-align: right;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

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

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

.insights-doc-name {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 70%;
}

.insights-doc-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.insights-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

@media (max-width: 980px) {
  .insights-cards {
    grid-template-columns: repeat(2, 1fr);
  }
  .insights-two-col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .insights-cards {
    grid-template-columns: 1fr 1fr;
  }
  .insights-card {
    padding: 16px 12px;
  }
  .insights-card-value {
    font-size: 24px;
  }
}

/* ── Universal micro-animation for all clickable elements ── */
/* Header action buttons (Config, Logout, Send, etc.) */
#configLink,
#logoutButton,
#sendButton,
#insightsSendButton,
.service-dropdown-trigger,
.sidebar-list li,
#addShortcutSidebar,
[data-action="view-all-shortcuts"],
#addPromptSidebar,
.hamburger-btn,
#trainingInsightsButton {
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
}

#configLink:hover,
#logoutButton:hover,
#sendButton:hover,
#insightsSendButton:hover,
.sidebar-list li:hover,
#addShortcutSidebar:hover,
[data-action="view-all-shortcuts"]:hover,
#addPromptSidebar:hover,
#trainingInsightsButton:hover {
  transform: translateY(-1px);
}

#configLink:active,
#logoutButton:active,
#sendButton:active,
#insightsSendButton:active,
.service-dropdown-trigger:active,
.sidebar-list li:active,
#addShortcutSidebar:active,
[data-action="view-all-shortcuts"]:active,
#addPromptSidebar:active,
.hamburger-btn:active,
#trainingInsightsButton:active {
  transform: translateY(0.5px);
}

