/* Fonts loaded via link tag in head for non-blocking */

:root {
  /* Font stacks */
  --font-display: "Inter", ui-sans-serif, system-ui, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  --font-body: "Inter", ui-sans-serif, system-ui, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", "Courier New", monospace;

  /* Type scale (inspired by Paper.design, shifted for dashboard density) */
  --text-xs: 11px;
  --text-sm: 13px;
  --text-base: 14px;
  --text-lg: 16px;
  --text-xl: 18px;
  --text-2xl: 22px;
  --text-3xl: 28px;
  --text-4xl: 42px;

  /* Line heights paired to scale */
  --leading-xs: 16px;
  --leading-sm: 20px;
  --leading-base: 22px;
  --leading-lg: 24px;
  --leading-xl: 28px;
  --leading-2xl: 30px;
  --leading-3xl: 36px;
  --leading-4xl: 48px;

  /* Letter spacing paired to scale (tighter at large sizes) */
  --tracking-xs: 0.015em;
  --tracking-sm: 0.01em;
  --tracking-base: 0.005em;
  --tracking-lg: 0;
  --tracking-xl: -0.01em;
  --tracking-2xl: -0.015em;
  --tracking-3xl: -0.02em;
  --tracking-4xl: -0.025em;

  /* Font weights */
  --font-light: 300;
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;

  /* Colors */
  --bg-base: #0b0a08;
  --bg-surface: #14110f;
  --bg-elevated: #1d1813;
  --bg-hover: #2a221b;
  --bg-active: #352b22;
  --border: #2a221b;
  --border-subtle: #1f1914;
  --text-primary: #f2ece4;
  --text-secondary: #c7bfb5;
  --text-tertiary: #8d8478;
  --accent-blue: #4aa3a1;
  --accent-purple: #b66a3c;
  --accent-green: #6f8f3a;
  --accent-yellow: #d6a436;
  --accent-orange: #db6b3a;
  --accent-red: #c24b4b;
  --accent-pink: #d27a7a;
  --accent-cyan: #56b0aa;
  --shadow-soft: 0 18px 40px rgba(0, 0, 0, 0.35);
  --ui-text-scale: 1;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background:
    radial-gradient(1200px 800px at 10% -10%, rgba(214, 164, 54, 0.08), transparent 60%),
    radial-gradient(900px 600px at 90% 10%, rgba(74, 163, 161, 0.12), transparent 55%),
    linear-gradient(160deg, #0b0a08 0%, #12100d 50%, #0b0a08 100%);
  color: var(--text-primary);
  font-size: calc(var(--text-base) * var(--ui-text-scale));
  line-height: 1.5;
  letter-spacing: var(--tracking-base);
  -webkit-font-smoothing: antialiased;
}

body[data-text-size="large"] .form-input,
body[data-text-size="large"] .form-select,
body[data-text-size="large"] .btn,
body[data-text-size="large"] .setting-name,
body[data-text-size="large"] .setting-desc {
  font-size: calc(1em * 1.05);
}

body[data-text-size="xlarge"] .form-input,
body[data-text-size="xlarge"] .form-select,
body[data-text-size="xlarge"] .btn,
body[data-text-size="xlarge"] .setting-name,
body[data-text-size="xlarge"] .setting-desc {
  font-size: calc(1em * 1.14);
}

body[data-text-size="large"] .nav-text,
body[data-text-size="large"] .chat-input,
body[data-text-size="large"] .chat-model-hint,
body[data-text-size="large"] .chat-model-picker select,
body[data-text-size="large"] .help-bubble,
body[data-text-size="large"] .help-message,
body[data-text-size="large"] .composer-input,
body[data-text-size="large"] .message-content,
body[data-text-size="large"] .message-text {
  font-size: 1.08em !important;
}

body[data-text-size="xlarge"] .nav-text,
body[data-text-size="xlarge"] .chat-input,
body[data-text-size="xlarge"] .chat-model-hint,
body[data-text-size="xlarge"] .chat-model-picker select,
body[data-text-size="xlarge"] .help-bubble,
body[data-text-size="xlarge"] .help-message,
body[data-text-size="xlarge"] .composer-input,
body[data-text-size="xlarge"] .message-content,
body[data-text-size="xlarge"] .message-text {
  font-size: 1.2em !important;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: var(--theme-overlay1, radial-gradient(600px 300px at 70% 0%, rgba(182, 106, 60, 0.12), transparent 60%), radial-gradient(500px 400px at 0% 100%, rgba(111, 143, 58, 0.1), transparent 70%));
  pointer-events: none;
  z-index: -2;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='180' height='180' viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
  pointer-events: none;
  z-index: -1;
}

h1,
h2,
h3,
.page-title,
.section-title,
.detail-title,
.workspace-name {
  font-family: var(--font-display);
  font-weight: var(--font-semibold);
  letter-spacing: var(--tracking-2xl);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
}

.app {
  display: grid;
  grid-template-columns: var(--sidebar-width, 220px) 1fr;
  height: 100vh;
  overflow: hidden;
}

.main-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

.main-shell-content {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

.app-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.app-topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── Topbar icon buttons (search, help) ─── */
.topbar-icon-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: var(--text-lg);
  font-weight: 700;
  transition: background 0.15s, color 0.15s;
  padding: 0;
  flex-shrink: 0;
}

.topbar-icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.topbar-icon-btn svg {
  width: 18px;
  height: 18px;
}

/* ─── Smart search overlay ─── */
.smart-search-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.35);
  animation: smart-search-slide 0.2s ease-out;
}

@keyframes smart-search-slide {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.smart-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
}

.smart-search-icon {
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.smart-search-icon svg {
  width: 18px;
  height: 18px;
}

.smart-search-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: var(--text-lg);
  outline: none;
}

.smart-search-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.smart-search-mic {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.smart-search-mic:hover {
  background: var(--bg-hover);
}

.smart-search-mic svg {
  width: 18px;
  height: 18px;
}

.smart-search-mic.active {
  background: var(--accent-red) !important;
  color: white !important;
  border-color: transparent;
  animation: mic-pulse 1.5s ease-in-out infinite;
}

.smart-search-results {
  max-height: 420px;
  overflow-y: auto;
  padding: 0 8px 10px;
}

.smart-search-result {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.1s;
}

.smart-search-result:hover,
.smart-search-result.active {
  background: var(--bg-hover);
}

.smart-search-result-body {
  flex: 1;
  min-width: 0;
}

.smart-search-kind {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--bg-tertiary);
  color: var(--text-tertiary);
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 2px;
}

.smart-search-title {
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.smart-search-snippet {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 1px;
}

.smart-search-source {
  font-size: var(--text-xs);
  color: var(--accent-cyan);
  margin-top: 2px;
}

.smart-search-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: var(--text-sm);
}

.smart-search-scrim {
  position: fixed;
  inset: 0;
  z-index: 199;
  background: rgba(0, 0, 0, 0.3);
}

/* Knowledge Document Modal (from Search) */
.knowledge-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.knowledge-modal-content {
  background: var(--bg-primary);
  border-radius: 12px;
  width: 100%;
  max-width: 720px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
}

.knowledge-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.knowledge-modal-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.knowledge-modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  flex-shrink: 0;
}

.knowledge-modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.knowledge-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  min-height: 200px;
}

.knowledge-modal-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  height: 200px;
  color: var(--text-secondary);
}

.knowledge-modal-loading .spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.knowledge-modal-summary {
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--text-primary);
}

.knowledge-modal-summary h2,
.knowledge-modal-summary h3,
.knowledge-modal-summary h4 {
  margin: 16px 0 8px;
  color: var(--text-primary);
}

.knowledge-modal-summary h2 { font-size: var(--text-lg); }
.knowledge-modal-summary h3 { font-size: var(--text-base); }
.knowledge-modal-summary h4 { font-size: var(--text-sm); font-weight: 600; }

.knowledge-modal-summary p {
  margin: 0 0 12px;
}

.knowledge-modal-summary ul {
  margin: 8px 0;
  padding-left: 20px;
}

.knowledge-modal-summary li {
  margin: 4px 0;
}

.knowledge-modal-summary code {
  background: var(--bg-elevated);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.9em;
}

.knowledge-modal-summary strong {
  color: var(--text-primary);
  font-weight: 600;
}

.knowledge-error {
  text-align: center;
  padding: 32px;
  color: var(--text-secondary);
}

.knowledge-error .error-detail {
  font-size: var(--text-xs);
  color: var(--accent-red);
  margin-top: 8px;
}

.knowledge-modal-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  flex-shrink: 0;
}

.knowledge-modal-actions-left,
.knowledge-modal-actions-right {
  display: flex;
  gap: 8px;
}

.knowledge-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  background: var(--bg-primary);
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.knowledge-action:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.knowledge-action.secondary {
  background: var(--bg-elevated);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.knowledge-action.secondary:hover {
  background: var(--accent-blue);
  color: var(--bg-base);
}

.knowledge-action.primary {
  background: var(--accent-green);
  border-color: var(--accent-green);
  color: var(--bg-base);
}

.knowledge-action.primary:hover {
  filter: brightness(1.1);
}

.knowledge-action.hidden {
  display: none;
}

.knowledge-action svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.knowledge-modal-related {
  padding: 12px 20px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.knowledge-modal-related h4 {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-tertiary);
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.knowledge-related-files {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.knowledge-related-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.knowledge-related-file:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.knowledge-related-file.sheets-file {
  border-color: var(--accent-green);
  color: var(--accent-green);
}

.knowledge-related-file.sheets-file:hover {
  background: var(--accent-green);
  color: var(--bg-base);
}

.knowledge-related-file svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.help-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  cursor: pointer;
}

/* Topbar Teams Dropdown */
.topbar-teams-dropdown {
  position: relative;
}

.topbar-teams-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.topbar-teams-current-label {
  display: inline-block;
  max-width: 5ch;
  overflow: hidden;
  white-space: nowrap;
}

.topbar-teams-trigger:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.topbar-teams-trigger .nav-icon {
  font-size: var(--text-base);
  width: auto;
  opacity: 0.8;
}

.topbar-teams-chevron {
  font-size: var(--text-sm);
  opacity: 0.6;
  transition: transform 0.2s;
}

.topbar-teams-dropdown.open .topbar-teams-chevron {
  transform: rotate(180deg);
}

.topbar-teams-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  max-width: 280px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 200;
  max-height: min(62vh, calc(100vh - 140px));
  overflow-y: auto;
}

.topbar-teams-dropdown.open .topbar-teams-menu {
  display: block;
}

.topbar-teams-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: var(--text-sm);
  transition: background 0.1s;
  text-decoration: none;
}

.topbar-teams-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.topbar-teams-item .team-dot {
  width: 10px;
  height: 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
  background: var(--accent-blue);
  flex-shrink: 0;
}

.topbar-teams-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-teams-item.selected {
  background: var(--bg-active);
  color: var(--text-primary);
}

.topbar-teams-add {
  border-top: 1px solid var(--border-subtle);
  margin-top: 4px;
  padding-top: 8px;
  color: var(--text-tertiary);
}

.topbar-teams-add .nav-icon {
  font-size: var(--text-base);
  width: auto;
  opacity: 0.7;
}

/* Notification Bell */
.notification-bell-wrapper {
  position: relative;
}

.notification-bell-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.notification-bell-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border);
}

.notification-bell-btn:active {
  background: var(--bg-active);
}

.notification-bell-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(82, 157, 255, 0.45);
}

.notification-bell-btn svg {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

.notification-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 21px;
  height: 21px;
  padding: 0 6px;
  font-size: var(--text-xs);
  font-weight: 700;
  line-height: 21px;
  text-align: center;
  background: radial-gradient(circle at 30% 26%, #ff8d8d 0%, #ff4545 45%, #d31111 100%);
  color: white;
  border-radius: 999px;
  box-shadow: 0 8px 16px rgba(211, 17, 17, 0.45);
  letter-spacing: 0.01em;
}

.notification-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  max-height: 480px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  z-index: 9999;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.notification-dropdown.open {
  display: flex;
}

.notification-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.notification-dropdown-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
}

.notification-mark-all {
  font-size: var(--text-sm);
  color: var(--accent-primary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.notification-mark-all:hover {
  background: var(--bg-hover);
}

.notification-dropdown-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 10px 16px;
  text-align: center;
  flex-shrink: 0;
}

.notification-view-all {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--accent-blue);
  transition: color 0.15s;
}

.notification-view-all:hover {
  color: var(--text-primary);
}

.notification-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px;
}

.notification-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: var(--text-sm);
}

.notification-item {
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 120ms ease;
}

.notification-item:hover {
  background: var(--bg-hover);
}

.notification-item.unread {
  background: var(--bg-elevated);
}

.notification-item.unread::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-primary);
}

.notification-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.notification-content {
  flex: 1;
  min-width: 0;
}

.notification-title {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notification-subtitle {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notification-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.notification-action-link {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 6px;
  background: var(--bg-surface);
}

.notification-action-link:hover {
  background: var(--bg-hover);
}

.notification-time {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  flex-shrink: 0;
}

/* Mobile Notification */
.mobile-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-notification-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.mobile-notification-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border);
}

.mobile-new-issue-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  color: white;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.mobile-new-issue-btn:hover {
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.mobile-new-issue-btn .lucide-icon {
  width: 20px;
  height: 20px;
}

.mobile-notification-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 200ms ease, visibility 200ms ease;
  z-index: 9998;
}

.mobile-notification-overlay.open {
  opacity: 1;
  visibility: visible;
}

.mobile-notification-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 84vh;
  background: var(--bg-surface);
  border-radius: 16px 16px 0 0;
  transform: translateY(100%);
  transition: transform 300ms ease;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mobile-notification-sheet.open {
  transform: translateY(0);
}

.mobile-notification-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.mobile-notification-sheet-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.mobile-notification-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
}

.mobile-notification-sheet-actions {
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.mobile-notification-sheet .notification-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  max-height: none;
}

.mobile-notification-sheet-footer {
  padding: 10px 16px 14px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  flex-shrink: 0;
}

/* Hide mobile notification elements on desktop */
@media (min-width: 769px) {

  .mobile-notification-overlay,
  .mobile-notification-sheet {
    display: none !important;
  }
}

/* Hide desktop notification dropdown on mobile */
@media (max-width: 768px) {
  .topbar-teams-menu {
    left: 0;
    right: auto;
    width: min(86vw, 320px);
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    z-index: 1200;
  }

  .notification-bell-wrapper {
    display: none !important;
  }

  .notification-dropdown {
    display: none !important;
  }
}

.help-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 92vw);
  height: 100vh;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  box-shadow: -24px 0 60px rgba(0, 0, 0, 0.4);
  transform: translateX(110%);
  transition: transform 240ms ease;
  z-index: 9998;
  display: flex;
  flex-direction: column;
}

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

.help-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 4, 6, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
  z-index: 9997;
}

.help-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.help-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

.help-logo {
  font-size: var(--text-2xl);
  line-height: 1;
}

.help-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 600;
  background: linear-gradient(120deg,
      var(--accent-orange) 0%, var(--accent-yellow) 28%,
      var(--accent-cyan) 58%, var(--accent-blue) 78%,
      var(--accent-orange) 100%);
  background-size: 220% 220%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: salsaWordUndulate 8s ease-in-out infinite;
}

.help-voice-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.help-voice-start {
  margin-left: auto;
}

.help-voice-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.help-docs-link {
  text-decoration: none;
  color: #7fd8ff;
}

.help-voice-btn .lucide-icon {
  width: 16px;
  height: 16px;
}

.help-voice-btn.active {
  color: #6af3bf;
  border-color: rgba(106, 243, 191, 0.7);
  background: rgba(33, 87, 66, 0.3);
}

.help-voice-btn.unavailable {
  opacity: 0.45;
  cursor: not-allowed;
}

.help-voice-icon-off {
  display: none;
}

.help-voice-btn.muted .help-voice-icon-on {
  display: none;
}

.help-voice-btn.muted .help-voice-icon-off {
  display: inline-flex;
}

.help-close-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: var(--text-xl);
  cursor: pointer;
  transition: background 0.15s ease;
}

.help-close-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.help-voice-coach {
  min-height: 30px;
  padding: 6px 16px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  background: rgba(26, 29, 38, 0.45);
}

.help-voice-coach.ready {
  color: #6af3bf;
}

.help-voice-coach.warn {
  color: #f2bd5b;
}

.help-voice-coach.error {
  color: #ff8f8f;
}

.help-voice-settings {
  display: none;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(18, 21, 29, 0.7);
}

.help-voice-settings.open {
  display: grid;
}

.help-voice-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.help-voice-field span {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.help-voice-field select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: var(--text-sm);
  padding: 8px 10px;
}

.help-body {
  flex: 1;
  overflow: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.help-message {
  display: flex;
  gap: 10px;
}

.help-message.user {
  flex-direction: row-reverse;
}

.help-bubble {
  max-width: 78%;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: var(--text-sm);
  line-height: 1.5;
}

.help-message.user .help-bubble {
  background: var(--accent-blue);
  color: #0b0a08;
}

.help-sources {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: 6px;
}

.help-input {
  padding: 12px 16px 18px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.help-input textarea {
  flex: 1;
  resize: none;
  min-height: 44px;
  max-height: 180px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  overflow-y: auto;
  line-height: 1.4;
  word-break: break-word;
  white-space: pre-wrap;
}

@media (max-width: 768px) {

  .help-voice-btn,
  .help-close-btn {
    width: 38px;
    height: 38px;
  }

  .help-voice-btn .lucide-icon {
    width: 18px;
    height: 18px;
  }

  .help-voice-settings {
    grid-template-columns: 1fr;
  }
}

/* === Salsa Composer — unified input bar for chat, comments, help === */
.salsa-composer-wrapper {
  padding: 12px 16px;
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.salsa-composer {
  align-items: flex-end;
  background: var(--bg-elevated);
  border-radius: 16px;
  border: 1px solid var(--border);
  display: flex;
  gap: 6px;
  min-height: 47px;
  padding: 6px 6px 6px 4px;
  transition: border-color 0.2s ease;
}

.salsa-composer:focus-within {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 1px rgba(0, 207, 232, 0.12);
}

.salsa-composer .composer-icon-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.salsa-composer .composer-icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.salsa-composer .composer-icon-btn.recording {
  color: var(--accent-red, #ef4444);
  animation: pulse-composer-mic 1.2s ease-in-out infinite;
}

@keyframes pulse-composer-mic {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.salsa-composer .composer-input {
  flex: 1;
  min-width: 0;
  resize: none;
  min-height: 32px;
  max-height: 160px;
  padding: 6px 10px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: var(--text-sm);
  line-height: 1.45;
  font-family: inherit;
  outline: none;
  overflow-y: auto;
  box-sizing: border-box;
}

.salsa-composer .composer-input::placeholder {
  color: var(--text-tertiary);
}

.salsa-composer .composer-send-btn {
  flex-shrink: 0;
  width: 32px !important;
  height: 32px !important;
  padding: 0 !important;
  border-radius: 10px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── Salsa Side Panel ── reusable side-panel component ── */
.salsa-side-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  overflow: hidden;
  position: relative;
}

.salsa-side-panel.collapsed {
  min-width: 0;
  width: 0;
  border-left: none;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}

/* Slide-in for fixed/overlay panels (federation, board guide) */
.salsa-side-panel.salsa-panel-fixed {
  transform: translateX(100%);
  transition: transform 0.22s ease;
}

.salsa-side-panel.salsa-panel-fixed.open {
  transform: translateX(0);
}

.salsa-side-panel-resizer {
  position: absolute;
  top: 0;
  left: -3px;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  background: transparent;
  z-index: 5;
}

.salsa-side-panel-resizer::after {
  content: "";
  position: absolute;
  top: 0;
  left: 2px;
  width: 1px;
  height: 100%;
  background: var(--border-subtle);
  opacity: 0;
  transition: opacity 0.15s;
}

.salsa-side-panel-resizer:hover::after,
.salsa-side-panel-resizer.dragging::after {
  opacity: 0.6;
}

.salsa-side-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.salsa-side-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
}

.salsa-side-panel-title .lucide-icon {
  width: 16px;
  height: 16px;
  color: var(--accent-cyan);
}

.salsa-side-panel-close {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
  padding: 0;
}

.salsa-side-panel-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.salsa-side-panel-close .lucide-icon {
  width: 14px;
  height: 14px;
}

.salsa-side-panel-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
}

/* Toggle button (used outside the panel to re-open it) */
.salsa-panel-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.salsa-panel-toggle .lucide-icon {
  width: 16px;
  height: 16px;
}

@media (max-width: 768px) {
  .salsa-side-panel.salsa-panel-fixed {
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    width: 100%;
    height: 70vh;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
  }

  .salsa-side-panel.salsa-panel-fixed.open {
    transform: translateY(0);
  }
}

/* Legacy aliases — keep until full migration */
.chat-composer-wrapper {
  padding: 12px 16px;
  border-top: 1px solid var(--border-subtle);
}

.chat-composer {
  display: flex;
  gap: 6px;
  align-items: flex-end;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 6px 6px 6px 4px;
  transition: border-color 0.2s ease;
}

.chat-composer:focus-within {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 1px rgba(0, 207, 232, 0.12);
}

.chat-composer .chat-icon-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: var(--text-tertiary);
  background: transparent;
  border: none;
}

.docs-page {
  padding: 40px;
  min-height: max-content;
  background:
    radial-gradient(circle at 0% 0%, rgba(182, 106, 60, 0.08), transparent 40%),
    radial-gradient(circle at 100% 100%, rgba(0, 113, 227, 0.08), transparent 40%),
    var(--bg-base);
  font-family: var(--font-body);
}

.docs-hero {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  padding: 60px 40px;
  background: linear-gradient(135deg, rgba(20, 24, 33, 0.95), rgba(13, 15, 20, 0.98));
  box-shadow: 0 32px 64px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
  margin-bottom: 40px;
}

.docs-hero::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -20%;
  width: 60%;
  height: 200%;
  background: radial-gradient(circle, rgba(182, 106, 60, 0.15) 0%, transparent 70%);
  transform: rotate(-15deg);
  z-index: 0;
}

.docs-kicker {
  position: relative;
  z-index: 1;
  font-size: var(--text-sm);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #b66a3c;
  font-weight: 800;
  margin-bottom: 16px;
}

.docs-hero h1 {
  position: relative;
  z-index: 1;
  margin: 0 0 20px;
  font-size: 56px;
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(180deg, #FFFFFF 0%, rgba(255, 255, 255, 0.7) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.02em;
}

.docs-hero p {
  position: relative;
  z-index: 1;
  max-width: 600px;
  color: rgba(255, 255, 255, 0.65);
  font-size: var(--text-xl);
  line-height: 1.6;
  margin-bottom: 32px;
}

.docs-hero-actions {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 16px;
}

.docs-hero-actions .btn {
  padding: 14px 28px;
  font-weight: 600;
  border-radius: 12px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  color: rgba(255, 255, 255, 0.85);
  border-color: rgba(255, 255, 255, 0.2);
}

.docs-hero-actions .btn.primary {
  background: #b66a3c;
  color: white;
  box-shadow: 0 8px 20px rgba(182, 106, 60, 0.3);
}

.docs-hero-actions .btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(182, 106, 60, 0.4);
}

.docs-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 40px;
}

.docs-sidebar {
  position: sticky;
  top: 40px;
  align-self: start;
}

.docs-sidebar-title {
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-tertiary);
  margin-bottom: 12px;
  font-weight: 700;
}

.docs-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.docs-sidebar-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 1.5rem 0;
}

.docs-sidebar a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--text-base);
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.btn-docs-back {
  background: var(--accent-cyan-dim) !important;
  color: var(--accent-cyan) !important;
  border: 1px solid var(--accent-cyan-opaque) !important;
  font-weight: 700 !important;
  box-shadow: 0 4px 12px rgba(0, 207, 232, 0.15);
}

.btn-docs-back:hover {
  background: var(--accent-cyan-opaque) !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 207, 232, 0.25);
}

.docs-sidebar a:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}


.docs-sidebar a:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  padding-left: 20px;
}

.docs-sidebar a.active {
  background: rgba(182, 106, 60, 0.1);
  color: #b66a3c;
  font-weight: 600;
}

.docs-content {
  display: flex;
  flex-direction: column;
  gap: 48px;
}

.docs-section {
  scroll-margin-top: 40px;
}

.docs-section h2 {
  margin: 0 0 24px;
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 12px;
}

.docs-section h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border-subtle), transparent);
}

.docs-section h3 {
  margin: 32px 0 12px;
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--text-primary);
}

.docs-section p {
  color: var(--text-secondary);
  font-size: var(--text-lg);
  line-height: 1.7;
  margin-bottom: 20px;
}

.docs-section ul,
.docs-section ol {
  margin: 16px 0 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.docs-section li {
  color: var(--text-secondary);
  font-size: var(--text-lg);
  line-height: 1.6;
}

.docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 24px;
  margin-top: 32px;
}

.concept-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.concept-card:hover {
  transform: translateY(-8px);
  border-color: rgba(182, 106, 60, 0.3);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.3);
}

.concept-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: #000;
  border-bottom: 1px solid var(--border-subtle);
}

.concept-body {
  padding: 24px;
}

.concept-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.concept-desc {
  font-size: var(--text-base);
  color: var(--text-secondary);
  line-height: 1.6;
}

.docs-note {
  margin-top: 24px;
  border-left: 4px solid #b66a3c;
  background: rgba(182, 106, 60, 0.05);
  border-radius: 4px 12px 12px 4px;
  padding: 20px 24px;
  font-size: var(--text-lg);
  color: var(--text-secondary);
  line-height: 1.6;
}

.docs-note strong {
  color: #b66a3c;
  font-weight: 700;
  display: block;
  margin-bottom: 4px;
  text-transform: uppercase;
  font-size: var(--text-sm);
  letter-spacing: 0.05em;
}

/* Quickstart step cards */
.docs-quickstart-steps {
  display: grid;
  gap: 14px;
  counter-reset: step-counter;
}

.docs-step-card {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 18px 20px;
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.docs-step-num {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(86, 176, 170, 0.15);
  border: 1px solid rgba(86, 176, 170, 0.3);
  color: var(--accent-cyan);
  font-weight: 700;
  font-size: var(--text-base);
  display: flex;
  align-items: center;
  justify-content: center;
}

.docs-step-body h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  margin-bottom: 4px;
}

.docs-step-body p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.45;
  margin: 0;
}

.docs-step-body code {
  background: var(--bg-elevated);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: var(--text-sm);
}

/* Glossary */
.docs-glossary {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px 20px;
  align-items: baseline;
}

.docs-glossary dt {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--accent-cyan);
  font-weight: 600;
}

.docs-glossary dd {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.45;
  padding-left: 12px;
  border-left: 2px solid var(--border-subtle);
}

@media (max-width: 768px) {
  .docs-glossary {
    grid-template-columns: 1fr;
  }
  .docs-glossary dd {
    margin-bottom: 8px;
  }
}

.docs-live-card {
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 24px;
  background: rgba(255, 255, 255, 0.02);
  margin-top: 16px;
}

.docs-live-card h3 {
  margin: 0 0 12px;
  font-size: var(--text-lg);
  color: var(--accent-blue);
}

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

  .docs-sidebar {
    display: none;
  }

  .docs-hero h1 {
    font-size: var(--text-4xl);
  }
}

@media (max-width: 600px) {
  .docs-page {
    padding: 20px;
  }

  .docs-hero {
    padding: 40px 24px;
  }

  .docs-hero h1 {
    font-size: var(--text-3xl);
  }
}

.chat-composer .chat-icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.chat-send-btn {
  flex-shrink: 0;
  width: 32px !important;
  height: 32px !important;
  padding: 0 !important;
  border-radius: 10px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chat-input {
  flex: 1;
  min-width: 0;
  resize: none;
  min-height: 32px;
  max-height: 160px;
  padding: 6px 8px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: var(--text-base);
  line-height: 1.45;
  outline: none;
}

.chat-input::placeholder {
  color: var(--text-tertiary);
}

.chat-composer-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px 6px;
}

.chat-model-picker {
  position: relative;
  flex-shrink: 0;
  display: flex;
  gap: 6px;
  align-items: center;
}

.chat-model-hint {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

/* Thinking/reasoning collapsible section in chat messages */
.chat-thinking {
  margin-bottom: 8px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: var(--bg-inset, rgba(0,0,0,0.03));
  overflow: hidden;
}
.chat-thinking-summary {
  padding: 6px 10px;
  font-size: 11px;
  color: var(--text-tertiary);
  cursor: pointer;
  user-select: none;
}
.chat-thinking-summary:hover {
  color: var(--text-secondary);
}
.chat-thinking[open] .chat-thinking-summary {
  border-bottom: 1px solid var(--border-subtle);
}
.chat-thinking-content {
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
  white-space: pre-wrap;
  max-height: 300px;
  overflow-y: auto;
  margin: 0;
  font-family: var(--font-mono, monospace);
}
.chat-response-meta {
  font-size: 10px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.chat-attachments {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.chat-attachment {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.chat-attachment img {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  object-fit: cover;
}

.chat-progress {
  height: 4px;
  width: 60px;
  border-radius: 999px;
  background: var(--border-subtle);
  overflow: hidden;
}

.chat-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent-cyan);
}

.chat-icon-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-recording {
  color: var(--accent-red);
  font-size: var(--text-xs);
}

/* Mic button active (listening) state */
#chat-mic-btn.primary {
  background: var(--accent-red) !important;
  color: white !important;
  border-radius: 50%;
  animation: mic-pulse 1.5s ease-in-out infinite;
}

@keyframes mic-pulse {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }

  50% {
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
  }
}

#chat-voice-toggle.voice-active {
  background: var(--accent-cyan);
  color: var(--bg-base);
}

#chat-voice-toggle:not(.voice-active) #voice-waves {
  opacity: 0.3;
}

.typing-cursor {
  animation: blink 0.7s infinite;
  color: var(--accent-cyan);
  font-weight: bold;
}

/* Hide cursor when typing is complete (data-typing removed) */
.activity-text:not([data-typing]) .typing-cursor,
div:not([data-typing]) > .typing-cursor {
  display: none;
}

@keyframes blink {

  0%,
  50% {
    opacity: 1;
  }

  51%,
  100% {
    opacity: 0;
  }
}

.properties-panel {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

.agents-resizer {
  width: 6px;
  cursor: col-resize;
  background: transparent;
  border-left: 1px solid var(--border-subtle);
}

.checkbox-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: rgba(20, 16, 12, 0.7);
  white-space: nowrap;
}

.checkbox-toggle input {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  flex-shrink: 0;
  width: 46px;
  height: 24px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(0, 0, 0, 0.2));
  border: 1px solid var(--border);
  position: relative;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  margin: 0;
}

.checkbox-toggle input::-ms-check {
  display: none;
}

.checkbox-toggle input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, #f2ece4 0%, #c7bfb5 100%);
  transition: transform 150ms ease, background 150ms ease, box-shadow 150ms ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.checkbox-toggle input:checked {
  background: linear-gradient(135deg, rgba(86, 176, 170, 0.8), rgba(214, 164, 54, 0.5));
  border-color: transparent;
}

.checkbox-toggle input:checked::after {
  transform: translateX(22px);
  background: #0b0a08;
  box-shadow: 0 0 0 1px rgba(86, 176, 170, 0.5), 0 6px 16px rgba(86, 176, 170, 0.35);
}

.app-search {
  position: relative;
  flex: 1;
  max-width: 520px;
}

.app-search-input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.app-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  opacity: 0.6;
}

.app-search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.2);
  max-height: 360px;
  overflow-y: auto;
  z-index: 20;
  padding: 8px;
}

.app-search-result {
  padding: 8px 10px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.app-search-result:hover {
  background: var(--bg-hover);
}

.app-search-result.active {
  background: var(--bg-hover);
}

.app-search-meta {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.app-search-title {
  font-size: var(--text-sm);
  font-weight: 600;
}

.app-search-snippet {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.install-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(148, 163, 184, 0.4);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.9s linear infinite;
}

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

/* Onboarding */
.onboarding {
  --onboard-display: var(--font-display);
  --onboard-body: var(--font-body);
  font-family: var(--onboard-body);
  min-height: 100vh;
  padding: 56px clamp(20px, 6vw, 80px) 80px;
  background:
    radial-gradient(900px 520px at 8% 8%, rgba(214, 164, 54, 0.16), transparent 65%),
    radial-gradient(1000px 700px at 88% 20%, rgba(86, 176, 170, 0.2), transparent 60%),
    linear-gradient(165deg, #0b0a08 0%, #14110f 45%, #0e0c0a 100%);
  position: relative;
  overflow: hidden;
}

.onboarding.onboarding-minimal {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
}

.onboarding-minimal .onboarding-hero {
  align-items: center;
  max-width: 400px;
}

.onboarding-minimal .onboarding-title {
  font-size: clamp(64px, 18vw, 120px);
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #d6a436 0%, #b66a3c 50%, #4aa3a1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.onboarding-minimal .onboarding-subtitle {
  font-size: var(--text-lg);
  opacity: 0.7;
  max-width: 280px;
}

.onboarding-minimal .onboard-cta {
  margin-top: 8px;
  padding: 14px 48px;
  font-size: var(--text-lg);
  font-weight: 500;
}

.onboarding::before {
  content: "";
  position: absolute;
  inset: -20% -10% auto auto;
  width: 520px;
  height: 520px;
  border-radius: 40%;
  background: conic-gradient(from 120deg, rgba(214, 164, 54, 0.2), rgba(182, 106, 60, 0.08), rgba(74, 163, 161, 0.18));
  filter: blur(12px);
  opacity: 0.6;
  transform: rotate(12deg);
  z-index: 0;
}

.onboarding-grid {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 36px;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
}

.onboarding-hero {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.onboarding-kicker {
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: var(--text-xs);
  color: var(--accent-yellow);
}

.onboarding-title {
  font-family: var(--onboard-display);
  font-size: clamp(38px, 5.5vw, 82px);
  line-height: 0.96;
}

.onboarding-subtitle {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  max-width: 560px;
}

.onboarding-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.onboard-cta {
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid rgba(214, 164, 54, 0.45);
  background: linear-gradient(140deg, rgba(214, 164, 54, 0.18), rgba(182, 106, 60, 0.22));
  color: var(--text-primary);
  font-weight: 600;
  cursor: pointer;
}

.onboard-ghost {
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
}

.onboarding-card {
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 18px 20px;
  background: rgba(20, 17, 15, 0.7);
  box-shadow: var(--shadow-soft);
}

.onboarding-card h3 {
  font-family: var(--onboard-display);
  font-size: var(--text-xl);
  margin-bottom: 6px;
}

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

.onboarding-pillars {
  display: grid;
  gap: 14px;
}

.onboarding-pillars .pillar {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(86, 176, 170, 0.28);
  background: rgba(8, 10, 12, 0.45);
}

.onboarding-map {
  margin-top: 24px;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.onboarding-map .map-item {
  border-radius: 14px;
  padding: 14px 16px;
  border: 1px solid rgba(182, 106, 60, 0.25);
  background: rgba(14, 12, 10, 0.6);
}

.onboarding-strip {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

.onboarding-strip span {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(20, 17, 15, 0.5);
}

.onboarding-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.onboarding-quote {
  font-family: var(--onboard-display);
  font-size: var(--text-2xl);
  line-height: 1.2;
}

.onboarding-vision {
  display: grid;
  gap: 10px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.onboarding-reveal {
  animation: onboardFade 0.7s ease both;
}

.onboarding-reveal.delay-1 {
  animation-delay: 0.1s;
}

.onboarding-reveal.delay-2 {
  animation-delay: 0.2s;
}

.onboarding-reveal.delay-3 {
  animation-delay: 0.3s;
}

.onboarding-reveal.delay-4 {
  animation-delay: 0.4s;
}

@keyframes onboardFade {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* Pairing Walkthrough */
.pairing-walkthrough {
  position: relative;
  z-index: 1;
  margin-top: 48px;
}

.pairing-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.pairing-step {
  padding: 20px;
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  background: rgba(20, 17, 15, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.pairing-step-num {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(86, 176, 170, 0.15);
  border: 1px solid rgba(86, 176, 170, 0.3);
  color: var(--accent-cyan);
  font-weight: 700;
  font-size: var(--text-base);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pairing-step-content h3 {
  font-family: var(--onboard-display);
  font-size: var(--text-lg);
  margin-bottom: 4px;
}

.pairing-step-content p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.45;
}

@media (max-width: 768px) {
  .pairing-steps {
    grid-template-columns: 1fr;
  }
}

/* Setup Wizard */
.setup-wizard {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}

.setup-steps {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 40px;
}

.setup-step {
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0.35;
  transition: opacity 0.2s;
}

.setup-step.active,
.setup-step.done {
  opacity: 1;
}

.setup-step .step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 600;
  border: 1.5px solid var(--border);
  color: var(--text-secondary);
}

.setup-step.active .step-num {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: var(--bg-base);
}

.setup-step.done .step-num {
  background: var(--accent-green);
  border-color: var(--accent-green);
  color: var(--bg-base);
}

.setup-step .step-label {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  font-weight: 500;
}

.setup-step.active .step-label {
  color: var(--text-primary);
}

.setup-panel {
  animation: onboardFade 0.4s ease both;
}

.setup-title {
  font-family: var(--onboard-display);
  font-size: var(--text-3xl);
  font-weight: 400;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.setup-desc {
  font-size: var(--text-base);
  color: var(--text-secondary);
  margin-bottom: 28px;
}

.setup-choice-row {
  display: flex;
  gap: 16px;
}

.setup-choice {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 16px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}

.setup-choice:hover {
  border-color: var(--accent-blue);
  background: var(--bg-elevated);
}

.setup-choice-icon {
  font-size: var(--text-3xl);
  margin-bottom: 12px;
}

.setup-choice-label {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.setup-choice-desc {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  line-height: 1.4;
}

.setup-form {
  text-align: left;
}

.setup-field {
  margin-bottom: 16px;
}

.setup-field label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.setup-field input {
  width: 100%;
  padding: 10px 14px;
  font-size: var(--text-base);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  box-sizing: border-box;
}

.setup-field input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 1px rgba(0, 207, 232, 0.12);
}

.setup-input-row {
  display: flex;
  gap: 8px;
}

.setup-input-row input {
  flex: 1;
}

.setup-field-row {
  display: flex;
  gap: 12px;
}

.setup-url-preview {
  font-size: var(--text-sm);
  color: var(--accent-cyan);
  margin-top: 6px;
  font-family: var(--font-mono);
  min-height: 18px;
}

.setup-status {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  margin-bottom: 12px;
  min-height: 18px;
}

.setup-status.success {
  color: var(--accent-green);
}

.setup-status.error {
  color: var(--accent-red);
}

.setup-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 20px 0;
}

.setup-section-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 12px;
}

.setup-skip {
  margin-top: 24px;
  text-align: center;
}

.setup-skip-link {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  text-decoration: none;
}

.setup-skip-link:hover {
  color: var(--text-secondary);
}

@media (max-width: 480px) {
  .setup-choice-row {
    flex-direction: column;
  }
  .setup-field-row {
    flex-direction: column;
  }
}

.chat-search-bar {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.chat-search {
  position: relative;
  max-width: 520px;
}

.chat-search-input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-primary);
}
/* Sidebar - Linear style */
.sidebar {
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  min-width: 64px;
  position: relative;
}

.sidebar.collapsed .workspace-name,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .nav-section-header,
.sidebar.collapsed .sidebar-footer span {
  display: none;
}

.sidebar.collapsed .sidebar-header {
  justify-content: center;
}

.sidebar.collapsed .nav-item {
  justify-content: center;
}

.sidebar-resizer {
  position: absolute;
  top: 0;
  right: -3px;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  background: transparent;
}

.sidebar-resizer::after {
  content: "";
  position: absolute;
  top: 0;
  right: 2px;
  width: 1px;
  height: 100%;
  background: var(--border-subtle);
  opacity: 0.4;
}

.sidebar-header {
  padding: 12px 12px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.workspace-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: var(--text-primary);
}

.workspace-icon {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 600;
  color: white;
}

.workspace-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 23px;
}

.sidebar .workspace-name {
  background: linear-gradient(120deg,
      var(--accent-orange) 0%,
      var(--accent-yellow) 28%,
      var(--accent-cyan) 58%,
      var(--accent-blue) 78%,
      var(--accent-orange) 100%);
  background-size: 220% 220%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: salsaWordUndulate 8s ease-in-out infinite;
}

@keyframes salsaWordUndulate {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 55%;
  }

  100% {
    background-position: 0% 50%;
  }
}

.sidebar-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: var(--text-sm);
  transition: background 0.1s;
}

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

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

.nav-item.dragging {
  opacity: 0.5;
}

.nav-item.drag-over {
  outline: 1px dashed var(--border);
}

.nav-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.95;
}

.nav-item.active .nav-icon {
  opacity: 1;
}

.nav-icon .lucide-icon {
  transition: filter 0.18s ease, stroke 0.18s ease, opacity 0.18s ease;
}

.sidebar .nav-item[href="/chat"] .nav-icon,
.mobile-drawer .drawer-nav-item[href="/chat"] .drawer-nav-icon {
  color: #5ab2ff;
}

.sidebar .nav-item[href="/inbox"] .nav-icon,
.mobile-drawer .drawer-nav-item[href="/inbox"] .drawer-nav-icon {
  color: #36c0f2;
}

.sidebar .nav-item[href="/spend"] .nav-icon,
.mobile-drawer .drawer-nav-item[href="/spend"] .drawer-nav-icon {
  color: #e7b95a;
}

.sidebar .nav-item[href="/terminal"] .nav-icon,
.mobile-drawer .drawer-nav-item[href="/terminal"] .drawer-nav-icon {
  color: #9dd16d;
}

.sidebar .nav-item[href="/canvas"] .nav-icon,
.mobile-drawer .drawer-nav-item[href="/canvas"] .drawer-nav-icon {
  color: #9e8bff;
}

.sidebar .nav-item[href="/insights"] .nav-icon,
.mobile-drawer .drawer-nav-item[href="/insights"] .drawer-nav-icon {
  color: #e8845a;
}

.sidebar .nav-item[href="/plans"] .nav-icon,
.mobile-drawer .drawer-nav-item[href="/plans"] .drawer-nav-icon {
  color: #61d6be;
}

.sidebar .nav-item[href="/board"] .nav-icon,
.mobile-drawer .drawer-nav-item[href="/board"] .drawer-nav-icon {
  color: #8bb8ff;
}

.sidebar .nav-item:hover .nav-icon .lucide-icon,
.sidebar .nav-item.active .nav-icon .lucide-icon {
  filter: drop-shadow(0 0 6px rgba(86, 176, 170, 0.25));
}

.nav-favorite-item .nav-icon {
  color: #f2c94c;
  opacity: 1;
}

.nav-badge {
  margin-left: auto;
  background: var(--accent-blue);
  color: var(--bg-base);
  padding: 1px 6px;
  border-radius: 10px;
  font-size: var(--text-xs);
  font-weight: 500;
}

.nav-count {
  margin-left: auto;
  color: var(--text-tertiary);
  font-size: var(--text-sm);
}

.nav-section {
  margin-top: 16px;
}

/* Prevent FOUC when reordering nav items - hide until JS applies stored order */
[data-nav-section] {
  opacity: 0;
  transition: opacity 0.05s ease-out;
}

[data-nav-section].nav-ready {
  opacity: 1;
}

.nav-section-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-tertiary);
  cursor: pointer;
}

.nav-section-header:hover {
  color: var(--text-secondary);
}

.section-arrow {
  width: 12px;
  height: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

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

.sidebar-footer {
  flex-shrink: 0;
  padding: 12px;
  border-top: 1px solid var(--border-subtle);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.user-profile:hover {
  background: var(--bg-hover);
}

.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--bg-base);
}

.user-name {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.settings-icon {
  margin-left: auto;
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  opacity: 0;
  transition: opacity 0.15s;
}

.user-profile:hover .settings-icon {
  opacity: 1;
}

/* Main Content - Three panel layout */
.main-content {
  display: grid;
  grid-template-columns: 300px 1fr;
  overflow: hidden;
  background: var(--bg-base);
  height: 100%;
  width: 100%;
}

.main-content.with-properties {
  grid-template-columns: 408px 1fr 0;
}

.main-content.detail-with-properties {
  grid-template-columns: 1fr;
}

/* Transition is only enabled AFTER JS init completes (data-panel-ready)
   to prevent FOUC / layout jank on initial page load. */
.main-content.chat-layout[data-panel-ready] {
  transition: grid-template-columns 0.22s ease;
}

.main-content.chat-layout.panel-collapsed {
  grid-template-columns: 220px 1fr 0px;
}

.main-content.detail-with-properties>.detail-panel {
  border-right: none;
}

.main-shell[data-active="chat"] .main-shell-content {
  overflow: hidden;
}

.main-content.single-panel {
  grid-template-columns: 1fr;
}

.main-content.single-panel.docs-scroll-page {
  display: block;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.main-content>* {
  min-width: 0;
}

/* Chat Layout - Three columns: channels | messages | context panel.
   Default grid hides panel column (0px) to prevent FOUC.
   side_panel.js expands the column via inline style if localStorage says open. */
.main-content.chat-layout {
  grid-template-columns: 220px 1fr var(--chat-side-width, 0px);
}

.main-content.chat-layout>.list-panel {
  z-index: 2;
  position: relative;
}

.main-content.chat-layout>.detail-panel {
  z-index: 1;
  position: relative;
}

/* .agents-resizer removed — resize is now inside .salsa-side-panel-resizer */

.main-content.chat-layout>.properties-panel,
.main-content.chat-layout>.salsa-side-panel {
  z-index: 2;
  position: relative;
}

/* Context Panel sections */
.ctx-section-title {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-bottom: 6px;
  padding: 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ctx-issue-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-decoration: none;
  transition: background 0.15s ease;
}

.ctx-issue-row:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.tag-chip {
  display: inline-block;
  font-size: var(--text-xs);
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.ctx-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  font-size: var(--text-xs);
  padding: 0 4px;
}

.ctx-stat-grid dt {
  color: var(--text-tertiary);
  margin: 0;
}

.ctx-stat-grid dd {
  margin: 0;
  color: var(--text-primary);
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.btn.ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Mobile channel toggle button */
.mobile-channel-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: var(--text-sm);
  cursor: pointer;
}

.mobile-channel-toggle:hover {
  background: var(--bg-hover);
}

/* List Panel */
.list-panel {
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-surface);
}

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

.list-title {
  font-size: var(--text-base);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.list-count {
  color: var(--text-tertiary);
  font-weight: 400;
}

.list-actions {
  display: flex;
  gap: 4px;
}

.list-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  font-size: var(--text-base);
}

.list-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sort-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.sort-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border);
}

.sort-toggle .sort-label {
  display: flex;
  align-items: center;
  gap: 4px;
}

.sort-toggle svg {
  width: 14px;
  height: 14px;
}

.list-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.filter-select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: var(--text-sm);
  cursor: pointer;
}

.filter-select:hover {
  background: var(--bg-hover);
}

.list-items {
  flex: 1;
  overflow-y: auto;
}

.empty-hint {
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  padding: 16px 0;
  text-align: center;
}

.collab-row-button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  text-align: left;
  color: inherit;
  cursor: pointer;
}

.collab-team-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.collab-team-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 11px;
}

.collab-team-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

.collab-detail-shell {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.collab-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.collab-detail-badges,
.collab-inline-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.collab-status-badge,
.collab-perm-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1;
}

.collab-status-badge {
  background: rgba(139, 184, 255, 0.16);
  color: var(--accent-blue);
  text-transform: capitalize;
}

.collab-perm-badge {
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

.collab-add-team-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(150px, 0.8fr) auto;
  gap: 10px;
  align-items: end;
}

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

.collab-team-access-row {
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--bg-elevated);
  overflow: hidden;
}

.collab-team-access-row > summary {
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
}

.collab-team-access-row > summary::-webkit-details-marker {
  display: none;
}

.collab-team-access-main {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.collab-inline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.collab-inline-editor {
  border-top: 1px solid var(--border-subtle);
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.collab-inline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  font-size: 12px;
  color: var(--text-secondary);
}

.collab-inline-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.collab-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.collab-inline-actions .form-select {
  min-width: 140px;
}

.collab-inline-note {
  font-size: 12px;
  color: var(--text-tertiary);
}

@media (max-width: 880px) {
  .collab-add-team-row {
    grid-template-columns: 1fr;
  }

  .collab-detail-header,
  .collab-team-access-row > summary {
    flex-direction: column;
  }

  .collab-inline-meta {
    justify-content: flex-start;
  }
}

/* Inbox command center wrapper */
.inbox-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.inbox-wrapper > .main-content {
  flex: 1;
  height: auto;
  min-height: 0;
}

/* Command strip - quick actions bar at top of inbox */
.command-strip {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  flex-shrink: 0;
}

.command-strip-section {
  display: flex;
  align-items: center;
  gap: 8px;
}

.command-strip-label {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.command-strip-actions {
  display: flex;
  gap: 4px;
}

.cmd-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.cmd-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border);
  color: var(--text-primary);
}

.cmd-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.command-strip-stats {
  display: flex;
  gap: 12px;
}

.cmd-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 40px;
}

.cmd-stat-value {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  line-height: 1;
}

.cmd-stat-label {
  font-size: 10px;
  color: var(--text-tertiary);
  line-height: 1.4;
}

.cmd-sync-status {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cmd-sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cmd-sync-dot.online { background: var(--accent-green); }
.cmd-sync-dot.offline { background: var(--text-tertiary); }
.cmd-sync-dot.syncing { background: var(--accent-blue); animation: pulse-sync 1.5s infinite; }

@keyframes pulse-sync {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.cmd-sync-text {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  white-space: nowrap;
}

/* Mobile: stack command strip sections vertically, hide labels */
@media (max-width: 768px) {
  .command-strip {
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
  }
  .command-strip-label {
    display: none;
  }
  .command-strip-sync {
    margin-left: auto;
  }
  .cmd-btn span {
    display: none;
  }
  .cmd-btn {
    padding: 6px 8px;
  }
}

/* Chat first-visit suggested actions */
.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
  max-width: 480px;
}

.chat-suggestion-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.chat-suggestion-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border);
  color: var(--text-primary);
}

.chat-suggestion-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--accent-blue);
}

/* Inbox item style - notification style like Linear */
.inbox-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.12s ease;
  position: relative;
  text-decoration: none;
}

.inbox-item:hover {
  background: var(--bg-hover);
}

.inbox-item.active {
  background: var(--bg-active);
}

.inbox-priority-bar {
  width: 3px;
  height: 28px;
  border-radius: 2px;
  flex-shrink: 0;
}

.inbox-priority-bar.urgent { background: var(--accent-red); }
.inbox-priority-bar.high { background: var(--accent-orange); }
.inbox-priority-bar.medium { background: var(--accent-yellow); }
.inbox-priority-bar.low { background: var(--border); }

.item-content {
  flex: 1;
  min-width: 0;
}

.item-title {
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
  font-size: 13.5px;
  line-height: 1.3;
}

.item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

.item-team {
  font-weight: 500;
}

.item-subtitle {
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-time {
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  white-space: nowrap;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.status-dot.urgent {
  background: var(--accent-red);
  box-shadow: 0 0 8px var(--accent-red);
}

.status-dot.high {
  background: var(--accent-orange);
}

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

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

.status-dot.done {
  background: var(--accent-purple);
}

/* Signal-Based Inbox Styles */
.signal-inbox {
  padding: 20px;
  overflow-y: auto;
}

.inbox-section {
  margin-bottom: 24px;
}

.mini-plan {
  background: var(--bg-elevated);
  border-radius: 14px;
  padding: 14px;
  border: 1px solid var(--border-muted);
}

.mini-plan-summary {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  margin-bottom: 10px;
}

.mini-plan-nodes {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mini-plan-node {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.mini-plan-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bg-hover);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.04);
}

.mini-plan-node.completed .mini-plan-dot {
  background: var(--accent-green);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.35);
}

.mini-plan-node.in-progress .mini-plan-dot {
  background: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.35);
}

.mini-plan-node.blocked .mini-plan-dot {
  background: var(--accent-red);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.35);
}

.mini-plan-node.pending .mini-plan-dot {
  background: var(--accent-orange);
}

.mini-plan-text {
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-plan-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.mini-plan-legend .completed {
  color: var(--accent-green);
}

.mini-plan-legend .in-progress {
  color: var(--accent-cyan);
}

.mini-plan-legend .blocked {
  color: var(--accent-red);
}

.mini-plan-legend .pending {
  color: var(--accent-orange);
}

/* --- Premium Plan Run Cards --- */
.plan-run-card {
  background: linear-gradient(145deg, rgba(29, 24, 19, 0.8), rgba(20, 17, 15, 0.9));
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease;
  margin-bottom: 12px;
}

.plan-run-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  border-color: rgba(255, 255, 255, 0.1);
}

.plan-run-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.plan-run-title-container {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.plan-run-title {
  font-weight: 700;
  color: var(--text-primary);
  font-size: var(--text-base);
  line-height: 1.3;
  letter-spacing: -0.01em;
  flex: 1;
  min-width: 140px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.plan-run-status-badge {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--bg-hover);
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Status variants for the badge */
.plan-run-card.blocked .plan-run-status-badge {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

.plan-run-card.failed .plan-run-status-badge {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.plan-run-card.completed .plan-run-status-badge {
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
}

.plan-run-card.running .plan-run-status-badge,
.plan-run-card.in_progress .plan-run-status-badge {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  animation: badge-pulse 2s infinite;
}

@keyframes badge-pulse {
  0% {
    opacity: 0.8;
  }

  50% {
    opacity: 1;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.3);
  }

  100% {
    opacity: 0.8;
  }
}

.plan-run-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.plan-run-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.plan-run-progress {
  height: 4px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 999px;
  overflow: hidden;
}

.plan-run-progress span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #4aa3a1, #6f8f3a);
  transition: width 0.6s cubic-bezier(0.65, 0, 0.35, 1);
}

.plan-run-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0;
}

.plan-run-step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  transition: color 0.15s ease;
}

.plan-run-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--bg-hover);
  flex-shrink: 0;
  box-shadow: 0 0 0 2px transparent;
  transition: all 0.2s ease;
}

.plan-run-step.completed .plan-run-dot {
  background: var(--accent-green);
  box-shadow: 0 0 6px rgba(111, 143, 58, 0.4);
}

.plan-run-step.in-progress .plan-run-dot {
  background: var(--accent-cyan);
  animation: dot-blink 1.5s infinite;
}

.plan-run-step.blocked .plan-run-dot {
  background: var(--accent-red);
}

.plan-run-step.pending .plan-run-dot {
  background: var(--text-tertiary);
  opacity: 0.5;
}

body[data-theme-mode="light"] .plan-run-card {
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--bg-surface) 94%, #ffffff 6%),
    color-mix(in srgb, var(--bg-elevated) 96%, #ffffff 4%)
  );
  border-color: color-mix(in srgb, var(--border) 84%, var(--accent-blue) 16%);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

body[data-theme-mode="light"] .plan-run-card:hover {
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.12);
  border-color: color-mix(in srgb, var(--border) 70%, var(--accent-blue) 30%);
}

body[data-theme-mode="light"] .plan-run-progress {
  background: rgba(15, 23, 42, 0.08);
}

@keyframes dot-blink {

  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.3);
    opacity: 0.6;
  }
}

.section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: 12px;
  cursor: pointer;
}

.section-header.critical {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.section-header.stream {
  background: rgba(59, 130, 246, 0.1);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.section-header.noise {
  background: var(--bg-elevated);
  color: var(--text-tertiary);
  border: 1px solid var(--border-subtle);
}

.section-icon {
  font-weight: 700;
  font-family: var(--font-mono);
}

.section-count {
  margin-left: auto;
  background: var(--bg-hover);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: var(--text-xs);
}

.inbox-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.inbox-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  transition: all 0.15s ease;
}

.inbox-card:hover {
  background: var(--bg-hover);
  transform: translateX(2px);
}

.inbox-card.critical {
  border-color: rgba(239, 68, 68, 0.4);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.2);
  animation: critical-pulse 2s ease-in-out infinite;
}

@keyframes critical-pulse {

  0%,
  100% {
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.2);
  }

  50% {
    box-shadow: 0 0 16px rgba(239, 68, 68, 0.4);
  }
}

.inbox-card.stream {
  border-color: var(--border-subtle);
}

.inbox-card.noise {
  opacity: 0.7;
  border-color: var(--border-subtle);
}

.card-priority {
  flex-shrink: 0;
}

.signal-badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: var(--text-xs);
  font-weight: 600;
  font-family: var(--font-mono);
}

.signal-badge.critical {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.signal-badge.stream {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.signal-badge.noise {
  background: var(--bg-hover);
  color: var(--text-tertiary);
}

.card-content {
  flex: 1;
  min-width: 0;
}

.card-type {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.card-title {
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
  font-size: var(--text-base);
}

.card-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.4;
}

.card-meta {
  flex-shrink: 0;
  text-align: right;
}

.card-from {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.noise-section details summary {
  list-style: none;
}

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

.noise-section details[open] .section-header::after {
  transform: rotate(90deg);
}

/* Detail Panel - Left side content */
.detail-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-base);
  height: 100%;
}

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

.detail-header-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

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

.breadcrumb-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 5px;
}

.breadcrumb-item:hover {
  background: var(--bg-hover);
}

a.breadcrumb-link {
  text-decoration: none;
  color: var(--text-secondary);
  cursor: pointer;
}

a.breadcrumb-link:hover {
  color: var(--accent);
  background: var(--bg-hover);
}

.breadcrumb-icon {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  color: white;
}

.breadcrumb-sep {
  color: var(--text-tertiary);
  font-size: var(--text-xs);
}

.detail-nav-buttons {
  display: flex;
  gap: 2px;
  margin-left: 8px;
}

.detail-nav-btn {
  padding: 4px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.detail-nav-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.detail-nav-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.detail-nav-btn svg {
  width: 14px;
  height: 14px;
}

.detail-toolbar {
  display: flex;
  gap: 6px;
}

.detail-btn {
  padding: 5px 10px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
}

.detail-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Star button states */
.detail-btn.star-btn.starred {
  color: var(--accent-yellow);
  background: rgba(234, 179, 8, 0.15);
  border-color: var(--accent-yellow);
}

.detail-btn.star-btn.starred .lucide-icon {
  fill: var(--accent-yellow);
  stroke: var(--accent-yellow);
}

.detail-btn.star-btn.starred:hover {
  background: rgba(234, 179, 8, 0.25);
}

/* Dispatch button states */
.detail-btn.dispatch-btn.dispatching {
  pointer-events: none;
  color: var(--accent-blue);
}

.detail-btn.dispatch-btn.success {
  color: var(--accent-green);
  background: rgba(34, 197, 94, 0.15);
  border-color: var(--accent-green);
}

/* Spinning animation for dispatch loading */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.lucide-icon.spinning {
  animation: spin 1s linear infinite;
}

.detail-btn-menu {
  position: relative;
}

.detail-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  min-width: 160px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 100;
  display: none;
  padding: 4px;
  /* Removed overflow: hidden so submenu is not clipped */
}

.detail-menu.open {
  display: block;
}

.detail-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  border-radius: 4px;
}

.detail-menu-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.detail-menu-item.danger {
  color: var(--accent-red);
}

.detail-menu-item.danger:hover {
  background: rgba(194, 75, 75, 0.15);
}

.detail-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
}

.issue-title {
  font-family: var(--font-body);
  font-size: 31px;
  font-weight: 600;
  margin-bottom: 18px;
  line-height: 1.25;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.issue-description {
  color: var(--text-secondary);
  font-size: var(--text-lg);
  line-height: 1.65;
  margin-bottom: 20px;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
}

.issue-description p {
  margin: 0 0 12px;
}

.issue-description p:last-child {
  margin-bottom: 0;
}

.issue-description strong,
.issue-description b {
  color: var(--text-primary);
  font-weight: 600;
}

.issue-description em,
.issue-description i {
  color: var(--text-secondary);
}

.issue-description a {
  color: var(--accent-blue);
  text-decoration: none;
  border-bottom: 1px solid rgba(74, 163, 161, 0.3);
  transition: border-color 0.12s ease;
}

.issue-description a:hover {
  border-bottom-color: var(--accent-blue);
}

.issue-description h1,
.issue-description h2,
.issue-description h3,
.issue-description h4 {
  color: var(--text-primary);
  font-weight: 600;
  margin: 20px 0 8px;
  line-height: 1.3;
}

.issue-description h1 {
  font-size: var(--text-2xl);
}

.issue-description h2 {
  font-size: var(--text-xl);
}

.issue-description h3 {
  font-size: var(--text-lg);
}

.issue-description h4 {
  font-size: var(--text-base);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
}

.issue-description ul,
.issue-description ol {
  margin: 8px 0 14px;
  padding-left: 1.4rem;
}

/* Task-list UL — match both direct-child and nested-in-p checkboxes */
.issue-description ul.contains-task-list,
.issue-description ul:has(li input[type="checkbox"]) {
  list-style: none;
  padding-left: 0;
  counter-reset: ac-counter;
}

.issue-description li {
  margin: 4px 0;
  padding-left: 2px;
  line-height: 1.55;
}

/* Task-list items — clean professional rows, no checkbox visible */
.issue-description li:has(input[type="checkbox"]) {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  transition: background 0.12s ease;
  counter-increment: ac-counter;
  list-style: none;
}

.issue-description li:has(input[type="checkbox"])::before {
  content: counter(ac-counter);
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-blue);
  color: var(--bg-base);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.issue-description li:has(input[type="checkbox"]):hover {
  background: var(--bg-hover);
}

.issue-description li:has(input[type="checkbox"]) + li:has(input[type="checkbox"]) {
  margin-top: -1px;
}

/* Hide the checkbox input entirely — replaced by numbered circle */
.issue-description input[type="checkbox"] {
  display: none;
}

.issue-description li p {
  margin: 0;
}

.issue-description ul li::marker,
.issue-description ol li::marker {
  color: var(--text-tertiary);
}

.issue-description code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 2px 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--text-primary);
}

.issue-description pre {
  margin: 12px 0;
  padding: 14px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  overflow-x: auto;
  white-space: pre;
  line-height: 1.5;
}

.issue-description pre code {
  padding: 0;
  background: none;
  border: none;
  border-radius: 0;
  font-size: var(--text-sm);
}

.issue-description blockquote {
  margin: 12px 0;
  padding: 8px 16px;
  border-left: 3px solid var(--border);
  color: var(--text-tertiary);
  font-style: italic;
}

.issue-description blockquote p {
  margin: 0;
}

.issue-description hr {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 16px 0;
}

.issue-description img {
  max-width: 100%;
  border-radius: 8px;
  margin: 8px 0;
}

.issue-description table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: var(--text-base);
}

.issue-description th,
.issue-description td {
  padding: 8px 12px;
  border: 1px solid var(--border-subtle);
  text-align: left;
}

.issue-description th {
  background: var(--bg-hover);
  color: var(--text-primary);
  font-weight: 600;
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.issue-description.placeholder {
  color: var(--text-tertiary);
  font-style: italic;
  cursor: text;
}

.issue-description.placeholder:hover {
  color: var(--text-secondary);
}

.attachment-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  margin-bottom: 24px;
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  cursor: pointer;
}

.attachment-area:hover {
  border-color: var(--text-tertiary);
}

/* Sub-issues section */
.sub-issues {
  margin-bottom: 24px;
}

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

.section-title {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-count {
  padding: 2px 6px;
  background: var(--bg-elevated);
  border-radius: 4px;
  font-size: var(--text-xs);
}

.section-actions {
  display: flex;
  gap: 4px;
}

.section-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: var(--text-sm);
}

.section-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Activity section */
.activity-section {
  border-top: 1px solid var(--border-subtle);
  padding-top: 24px;
  margin-top: 12px;
}

.activity-section .section-title {
  font-family: var(--font-body);
  font-size: 27px;
  font-weight: 300;
  color: var(--team-accent, var(--accent-orange));
}

.activity-item {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.activity-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.activity-content {
  flex: 1;
  min-width: 0;
}

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

.activity-item.error .activity-content {
  background: rgba(239, 68, 68, 0.08);
  border-left: 3px solid var(--accent-red);
  padding: 10px 12px;
  border-radius: 8px;
}

.activity-author {
  font-weight: 500;
  font-size: var(--text-sm);
  cursor: pointer;
}

.activity-time {
  color: var(--text-tertiary);
  font-size: var(--text-sm);
}

.activity-edited {
  color: var(--text-tertiary);
  font-size: var(--text-xs);
}

.activity-edited.auth-binding {
  color: var(--accent-cyan);
  font-weight: 600;
}

.activity-text {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.6;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.activity-text a {
  color: var(--accent-blue);
}

.activity-text a:hover {
  text-decoration: underline;
}

/* User messages on right, AI on left */
.activity-item.human {
  flex-direction: row-reverse;
}

.activity-item.human .activity-avatar {
  background: var(--accent-blue);
  color: var(--bg-base);
  font-size: var(--text-xs);
  font-weight: 600;
}

.activity-item.human .activity-content {
  text-align: right;
}

.activity-item.human .activity-header {
  justify-content: flex-end;
}

.activity-item.human .activity-text {
  background: var(--accent-purple);
  color: white;
  padding: 10px 14px;
  border-radius: 16px 16px 4px 16px;
  display: inline-block;
  text-align: left;
  max-width: 85%;
}

.activity-item:not(.human) .activity-text {
  background: var(--bg-elevated);
  padding: 10px 14px;
  border-radius: 16px 16px 16px 4px;
  display: inline-block;
  max-width: 85%;
}

/* Markdown rendered content in chat messages */
.md-content {
  line-height: 1.55;
}

.md-content>*:first-child {
  margin-top: 0;
}

.md-content>*:last-child {
  margin-bottom: 0;
}

.md-h {
  color: var(--text-primary);
  font-weight: 600;
  margin: 12px 0 4px;
  line-height: 1.3;
}

h1.md-h {
  font-size: var(--text-lg);
}

h2.md-h {
  font-size: var(--text-base);
}

h3.md-h {
  font-size: var(--text-sm);
}

h4.md-h {
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-tertiary);
}

.md-p {
  margin: 4px 0;
}

.md-hr {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 10px 0;
}

.md-bq {
  border-left: 3px solid var(--accent-blue);
  margin: 6px 0;
  padding: 4px 0 4px 12px;
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  font-style: italic;
}

.md-list {
  margin: 4px 0;
  padding-left: 20px;
}

.md-list li {
  margin: 2px 0;
}

.md-list li::marker {
  color: var(--text-tertiary);
}

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

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

.md-code {
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

/* Markdown tables */
.md-table-wrap {
  overflow-x: auto;
  margin: 6px 0;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}

.md-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.md-table th {
  text-align: left;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  font-weight: 600;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border-subtle);
}

.md-table td {
  padding: 5px 10px;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

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

.md-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Keep human message bubbles clean */
.activity-item.human .md-content {
  line-height: 1.5;
}

.activity-item.human .md-h {
  color: white;
}

.activity-item.human .md-bq {
  border-left-color: rgba(255, 255, 255, 0.4);
  color: rgba(255, 255, 255, 0.8);
}

.activity-item.human .md-table th {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.activity-item.human .md-table td {
  color: rgba(255, 255, 255, 0.9);
}

.activity-item.human .md-code {
  background: rgba(255, 255, 255, 0.15);
}

.activity-item.human .md-link {
  color: white;
  text-decoration: underline;
}

/* Agent Activity Log - shows AI/LLM work on issues */
.agent-activity-section {
  border-top: 1px solid var(--border-subtle);
  padding: 24px 20px;
  margin-top: 16px;
  background: linear-gradient(to bottom, rgba(74, 163, 161, 0.03), transparent);
}

.agent-activity-section .section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.agent-badge {
  font-size: var(--text-xs);
  font-weight: 500;
  padding: 3px 8px;
  background: var(--accent-teal);
  color: var(--bg-base);
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.agent-activity-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--bg-elevated);
  border-radius: 8px;
  border-left: 3px solid var(--accent-teal);
}

.agent-avatar {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--accent-teal);
  color: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 600;
  flex-shrink: 0;
}

.agent-activity-content {
  flex: 1;
  min-width: 0;
}

.agent-activity-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.agent-name {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.model-tag {
  font-size: var(--text-xs);
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.model-opus {
  background: #7c3aed;
  color: white;
}

.model-sonnet {
  background: #2563eb;
  color: white;
}

.model-haiku {
  background: #059669;
  color: white;
}

.model-claude {
  background: #d97706;
  color: white;
}

.model-other {
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

.agent-action {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.action-badge {
  font-size: var(--text-xs);
  font-weight: 500;
  padding: 2px 8px;
  background: rgba(74, 163, 161, 0.15);
  color: var(--accent-teal);
  border-radius: 4px;
  flex-shrink: 0;
}

.action-details {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ============================================================================
   Stream of Consciousness - Agent Telemetry Visualization
   Patent Section 7.5: Agent Transparency
   ============================================================================ */

.agent-stream {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: linear-gradient(135deg, rgba(74, 163, 161, 0.05), rgba(59, 130, 246, 0.05));
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  margin: 8px 0;
}

.agent-stream-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.agent-stream-header::before {
  content: '🧠';
}

.stream-step {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-surface);
  border-radius: 8px;
  border-left: 3px solid var(--accent-teal);
  animation: stream-fade-in 0.3s ease-out;
}

@keyframes stream-fade-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stream-step-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-base);
  flex-shrink: 0;
}

.stream-step-content {
  flex: 1;
  min-width: 0;
}

.stream-step-type {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.stream-step-text {
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--text-primary);
}

/* Step type variations */
.stream-step.thinking {
  border-left-color: var(--accent-purple);
}

.stream-step.thinking .stream-step-type {
  color: var(--accent-purple);
}

.stream-step.thinking .stream-step-icon::before {
  content: '💭';
}

.stream-step.tool-call {
  border-left-color: var(--accent-blue);
}

.stream-step.tool-call .stream-step-type {
  color: var(--accent-blue);
}

.stream-step.tool-call .stream-step-icon::before {
  content: '🔧';
}

.stream-step.tool-result {
  border-left-color: var(--accent-teal);
}

.stream-step.tool-result .stream-step-type {
  color: var(--accent-teal);
}

.stream-step.tool-result .stream-step-icon::before {
  content: '✅';
}

.stream-step.tool-result.error {
  border-left-color: var(--accent-red);
}

.stream-step.tool-result.error .stream-step-type {
  color: var(--accent-red);
}

.stream-step.tool-result.error .stream-step-icon::before {
  content: '❌';
}

.stream-step.memory-recall {
  border-left-color: var(--accent-orange);
}

.stream-step.memory-recall .stream-step-type {
  color: var(--accent-orange);
}

.stream-step.memory-recall .stream-step-icon::before {
  content: '🧠';
}

.stream-step.code-execution {
  border-left-color: #10b981;
}

.stream-step.code-execution .stream-step-type {
  color: #10b981;
}

.stream-step.code-execution .stream-step-icon::before {
  content: '🐍';
}

.stream-step.final-response {
  border-left-color: var(--accent-teal);
  background: rgba(74, 163, 161, 0.1);
}

.stream-step.final-response .stream-step-type {
  color: var(--accent-teal);
}

.stream-step.final-response .stream-step-icon::before {
  content: '🎯';
}

/* Code within stream */
.stream-step .code-inline {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  background: var(--bg-elevated);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent-blue);
}

.stream-step pre {
  background: var(--bg-elevated);
  border-radius: 6px;
  padding: 10px 12px;
  margin: 8px 0 0 0;
  overflow-x: auto;
  font-size: var(--text-sm);
  line-height: 1.4;
}

.stream-step pre code {
  font-family: var(--font-mono);
  color: var(--text-primary);
}

/* Thinking animation */
.stream-step.thinking.active::after {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 8px;
  background: var(--accent-purple);
  border-radius: 50%;
  animation: thinking-pulse 1s ease-in-out infinite;
}

@keyframes thinking-pulse {

  0%,
  100% {
    opacity: 0.3;
    transform: scale(0.8);
  }

  50% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Agent creator badge in properties panel */
.property-row.agent-creator {
  background: rgba(74, 163, 161, 0.08);
  border-radius: 6px;
  margin: 0 -8px;
  padding: 8px;
}

.agent-creator-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  font-weight: 500;
  padding: 3px 10px;
  background: var(--accent-teal);
  color: white;
  border-radius: 4px;
}

.mermaid-container {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin: 12px 0;
  overflow-x: auto;
}

.mermaid-container svg {
  max-width: 100%;
  height: auto;
}

.mermaid {
  background: transparent;
  font-family: inherit;
}

.code-block {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  margin: 8px 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.5;
  white-space: pre;
  color: var(--text-primary);
}

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

.comment-composer-bar {
  flex-shrink: 0;
  padding: 12px 16px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-base);
}

.comment-composer {
  display: flex;
  gap: 6px;
  align-items: flex-end;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 6px 6px 6px 4px;
  transition: border-color 0.2s ease;
}

.comment-composer:focus-within {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 1px rgba(0, 207, 232, 0.12);
}

.comment-input {
  flex: 1;
  padding: 6px 10px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  resize: none;
  min-height: 20px;
  max-height: 120px;
  font-size: var(--text-sm);
  line-height: 1.4;
  font-family: inherit;
  overflow-y: auto;
}

.comment-input:focus {
  outline: none;
}

.comment-input::placeholder {
  color: var(--text-tertiary);
}

.comment-composer .chat-icon-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.comment-composer .chat-icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.comment-composer .chat-icon-btn.recording {
  color: var(--accent-red, #ef4444);
  animation: pulse-mic 1.2s ease-in-out infinite;
}

@keyframes pulse-mic {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.comment-send-btn {
  flex-shrink: 0;
  width: 32px !important;
  height: 32px !important;
  border-radius: 10px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.activity-item.thinking .activity-text {
  color: var(--text-tertiary);
  font-style: italic;
}

.activity-item.thinking .activity-avatar {
  animation: pulse-thinking 1.5s ease-in-out infinite;
}

@keyframes pulse-thinking {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

/* === Dispatch Accent Button === */
.detail-btn.dispatch-accent {
  background: rgba(74, 163, 161, 0.15);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.detail-btn.dispatch-accent:hover {
  background: rgba(74, 163, 161, 0.25);
  color: #7dd3d0;
}



/* === Toast Notification === */
.toast-notification {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 10px 20px;
  border-radius: 8px;
  font-size: var(--text-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 500;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.toast-notification.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* === Dispatch Drawer === */
.dispatch-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 200;
}

.dispatch-overlay.open {
  display: block;
}

.dispatch-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 440px;
  max-width: 100vw;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  overflow: hidden;
}

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

.dispatch-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.dispatch-close-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
}

.dispatch-close-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.dispatch-drawer-body {
  flex: 1 1 50%;
  min-height: 120px;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dispatch-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dispatch-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-tertiary);
}

.dispatch-select {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: var(--text-sm);
  cursor: pointer;
}

.dispatch-select:focus {
  outline: none;
  border-color: var(--accent-blue);
}

.dispatch-textarea {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: var(--text-sm);
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

.dispatch-textarea:focus {
  outline: none;
  border-color: var(--accent-blue);
}

.dispatch-toggle-row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.dispatch-toggle {
  width: 40px;
  height: 22px;
  background: var(--bg-active);
  border-radius: 11px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease;
}

.dispatch-toggle.on {
  background: var(--accent-blue);
}

.dispatch-toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.dispatch-toggle.on .dispatch-toggle-knob {
  transform: translateX(18px);
}

/* Action bar: always visible between body and progress */
.dispatch-action-bar {
  flex-shrink: 0;
  padding: 10px 20px;
  border-top: 1px solid var(--border-subtle);
}

.dispatch-run-btn {
  width: 100%;
  padding: 12px;
  font-size: var(--text-base);
}

/* Dispatch Progress */
.dispatch-progress {
  flex: 1 1 50%;
  min-height: 80px;
  overflow-y: auto;
  padding: 16px 20px;
  border-top: none;
}

/* Drag handle between body and progress */
.dispatch-resize-handle {
  flex-shrink: 0;
  height: 6px;
  cursor: row-resize;
  background: var(--border-subtle);
  position: relative;
  transition: background 0.12s ease;
}

.dispatch-resize-handle:hover,
.dispatch-resize-handle.dragging {
  background: var(--accent-blue);
}

.dispatch-resize-handle::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 2px;
  background: var(--text-tertiary);
  border-radius: 1px;
  opacity: 0.5;
}

.dispatch-resize-handle:hover::after,
.dispatch-resize-handle.dragging::after {
  opacity: 1;
  background: var(--text-primary);
}

.dispatch-progress-header {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-tertiary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dispatch-progress-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.dispatch-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

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

.dispatch-step.pending .dispatch-step-dot {
  background: var(--text-tertiary);
}

.dispatch-step.in-progress .dispatch-step-dot {
  background: var(--accent-cyan);
  box-shadow: 0 0 8px rgba(34, 211, 238, 0.4);
}

.dispatch-step.completed .dispatch-step-dot {
  background: var(--accent-green);
}

.dispatch-step.failed .dispatch-step-dot {
  background: var(--accent-red);
}

.dispatch-step.blocked {
  color: var(--accent-yellow);
}

.dispatch-step.blocked .dispatch-step-dot {
  background: var(--accent-yellow);
  box-shadow: 0 0 8px rgba(214, 164, 54, 0.4);
}

.dispatch-progress-status {
  padding: 8px 12px;
  border-radius: 6px;
  font-size: var(--text-sm);
  font-weight: 500;
  text-align: center;
}

.dispatch-progress-status.running {
  background: rgba(34, 211, 238, 0.1);
  color: var(--accent-cyan);
}

.dispatch-progress-status.completed {
  background: rgba(34, 197, 94, 0.1);
  color: var(--accent-green);
}

.dispatch-progress-status.failed {
  background: rgba(239, 68, 68, 0.1);
  color: var(--accent-red);
}

.dispatch-progress-status.blocked {
  background: rgba(234, 179, 8, 0.1);
  color: var(--accent-yellow);
}

/* Dispatch Advanced Details */
.dispatch-advanced {
  margin: 4px 0 8px;
}

.dispatch-advanced-summary {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px 0;
  user-select: none;
}

.dispatch-advanced-summary:hover {
  color: var(--text-secondary);
}

.dispatch-advanced[open] .dispatch-field {
  margin-top: 8px;
}

/* ============================================================
   Exec Stepper — Vertical step tracker with typed icons
   ============================================================ */

.exec-stepper {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
}

.exec-stepper-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 12px;
}

.exec-stepper-title {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.exec-stepper-count {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-tertiary);
  background: rgba(255, 255, 255, 0.04);
  padding: 2px 8px;
  border-radius: 10px;
}

/* Individual step row */
.exec-step {
  display: flex;
  align-items: stretch;
  gap: 0;
  position: relative;
  min-height: 56px;
}

/* Left rail: dot + connector line */
.exec-step-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 32px;
  flex-shrink: 0;
  position: relative;
}

/* Vertical connector line between steps */
.exec-step-rail::after {
  content: '';
  position: absolute;
  top: 28px;
  left: 50%;
  transform: translateX(-50%);
  width: 1.5px;
  bottom: 0;
  background: var(--border-subtle);
  transition: background 0.15s ease;
}

/* Last step has no connector line */
.exec-step:last-child .exec-step-rail::after {
  display: none;
}

/* Completed rail line turns green */
.exec-step.completed .exec-step-rail::after {
  background: rgba(34, 197, 94, 0.25);
}

/* Running step rail pulses */
.exec-step.running .exec-step-rail::after {
  background: rgba(34, 211, 238, 0.2);
}

/* Status dot */
.exec-step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  transition: all 0.15s ease;
}

/* Pending dot: hollow */
.exec-step.pending .exec-step-dot {
  background: transparent;
  border: 1.5px solid var(--border);
}

.exec-step.pending .exec-step-dot svg {
  opacity: 0.35;
}

/* Running dot: cyan glow */
.exec-step.running .exec-step-dot {
  background: rgba(34, 211, 238, 0.12);
  border: 1.5px solid var(--accent-cyan);
  box-shadow: 0 0 12px rgba(34, 211, 238, 0.25), 0 0 4px rgba(34, 211, 238, 0.15);
  animation: exec-step-pulse 2s ease-in-out infinite;
}

/* Completed dot: green */
.exec-step.completed .exec-step-dot {
  background: rgba(34, 197, 94, 0.12);
  border: 1.5px solid var(--accent-green);
}

/* Failed dot: red */
.exec-step.failed .exec-step-dot {
  background: rgba(194, 75, 75, 0.12);
  border: 1.5px solid var(--accent-red);
}

/* Blocked dot: yellow */
.exec-step.blocked .exec-step-dot {
  background: rgba(214, 164, 54, 0.12);
  border: 1.5px solid var(--accent-yellow);
  box-shadow: 0 0 8px rgba(214, 164, 54, 0.15);
}

/* Dot icon (16x16 SVG) */
.exec-step-dot svg {
  width: 14px;
  height: 14px;
  transition: opacity 0.15s ease;
}

.exec-step.pending .exec-step-dot svg {
  color: var(--text-tertiary);
}

.exec-step.running .exec-step-dot svg {
  color: var(--accent-cyan);
}

.exec-step.completed .exec-step-dot svg {
  color: var(--accent-green);
}

.exec-step.failed .exec-step-dot svg {
  color: var(--accent-red);
}

.exec-step.blocked .exec-step-dot svg {
  color: var(--accent-yellow);
}

/* Right side: step body content */
.exec-step-body {
  flex: 1;
  min-width: 0;
  padding: 2px 0 16px 8px;
}

.exec-step-title {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.35;
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.exec-step.pending .exec-step-title {
  color: var(--text-tertiary);
}

/* Type badge (e.g., "Image Generation", "Web Research") */
.exec-step-type {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 4px;
  margin-bottom: 4px;
}

.exec-step.pending .exec-step-type {
  color: var(--text-tertiary);
  background: rgba(255, 255, 255, 0.03);
}

.exec-step.running .exec-step-type {
  color: var(--accent-cyan);
  background: rgba(34, 211, 238, 0.08);
}

.exec-step.completed .exec-step-type {
  color: var(--accent-green);
  background: rgba(34, 197, 94, 0.08);
}

.exec-step.failed .exec-step-type {
  color: var(--accent-red);
  background: rgba(194, 75, 75, 0.08);
}

.exec-step.blocked .exec-step-type {
  color: var(--accent-yellow);
  background: rgba(214, 164, 54, 0.08);
}

/* Status line (state + duration) */
.exec-step-status {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.exec-step-status-icon {
  font-size: var(--text-xs);
  line-height: 1;
}

.exec-step.running .exec-step-status {
  color: var(--accent-cyan);
}

.exec-step.completed .exec-step-status {
  color: var(--accent-green);
}

.exec-step.failed .exec-step-status {
  color: var(--accent-red);
}

.exec-step.blocked .exec-step-status {
  color: var(--accent-yellow);
}

/* Output/result summary */
.exec-step-output {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  line-height: 1.45;
  margin-top: 2px;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.02);
  border-left: 2px solid rgba(255, 255, 255, 0.06);
  border-radius: 0 4px 4px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.exec-step.failed .exec-step-output {
  border-left-color: rgba(194, 75, 75, 0.3);
  color: var(--accent-red);
}

.exec-step.completed .exec-step-output {
  border-left-color: rgba(34, 197, 94, 0.2);
}

/* Pulse animation for running steps */
@keyframes exec-step-pulse {

  0%,
  100% {
    box-shadow: 0 0 12px rgba(34, 211, 238, 0.25), 0 0 4px rgba(34, 211, 238, 0.15);
  }

  50% {
    box-shadow: 0 0 18px rgba(34, 211, 238, 0.35), 0 0 8px rgba(34, 211, 238, 0.25);
  }
}

/* Empty state */
.exec-stepper-empty {
  text-align: center;
  padding: 24px 16px;
  color: var(--text-tertiary);
  font-size: var(--text-sm);
}

/* Activity Detail Card — structured dispatch info */
.activity-detail-card {
  padding: 10px 12px;
  margin-top: 6px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  font-size: var(--text-sm);
  line-height: 1.5;
}

.activity-detail-label {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-blue);
  margin-bottom: 4px;
}

.activity-detail-desc {
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.55;
}

.activity-detail-row {
  display: flex;
  gap: 8px;
  align-items: baseline;
  padding: 3px 0;
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  border-top: 1px solid rgba(255, 255, 255, 0.03);
}

.activity-detail-row:first-of-type {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 6px;
  padding-top: 6px;
}

.activity-detail-key {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  flex-shrink: 0;
  min-width: 52px;
}

.activity-detail-row code {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  padding: 1px 5px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  color: var(--text-secondary);
}

.activity-detail-row.error {
  color: var(--accent-red);
}

.activity-detail-row.error .activity-detail-key {
  color: var(--accent-red);
}

/* Artifact download link in activity */
.artifact-download-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  margin-top: 6px;
  background: rgba(74, 163, 161, 0.1);
  border: 1px solid rgba(74, 163, 161, 0.25);
  border-radius: 6px;
  color: var(--accent-blue);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.artifact-download-link:hover {
  background: rgba(74, 163, 161, 0.18);
  border-color: rgba(74, 163, 161, 0.4);
}

.artifact-download-icon {
  font-size: var(--text-lg);
  line-height: 1;
}

/* --- Step structured body (JSON → human-readable) --- */
.step-structured-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.step-field-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: var(--text-sm);
  line-height: 1.4;
  color: var(--text-secondary);
}

.step-field-label {
  flex-shrink: 0;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  min-width: 60px;
}

.step-field-value {
  color: var(--text-secondary);
  word-break: break-word;
}

.step-body-text {
  font-size: var(--text-sm);
  line-height: 1.4;
  color: var(--text-secondary);
  word-break: break-word;
}

/* Expand / collapse toggle */
.exp-toggle {
  display: inline;
  background: none;
  border: none;
  color: var(--accent-blue);
  font-size: var(--text-xs);
  cursor: pointer;
  padding: 0 2px;
  text-decoration: underline;
  text-decoration-style: dotted;
}

.exp-toggle:hover {
  color: var(--accent-cyan);
}

/* Run Status Card — failure recovery */
.run-status-card {
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  margin: 12px 0;
}

.run-status-card:empty {
  display: none;
}

.run-status-card.failed {
  border-color: rgba(194, 75, 75, 0.3);
  background: rgba(194, 75, 75, 0.06);
}

.run-status-card.completed {
  border-color: rgba(111, 143, 58, 0.3);
  background: rgba(111, 143, 58, 0.06);
}

.run-status-card.blocked {
  border-color: rgba(214, 164, 54, 0.3);
  background: rgba(214, 164, 54, 0.06);
}

.run-status-title {
  font-size: var(--text-base);
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.run-status-card.failed .run-status-title {
  color: var(--accent-red);
}

.run-status-card.completed .run-status-title {
  color: var(--accent-green);
}

.run-status-card.blocked .run-status-title {
  color: var(--accent-yellow);
}

.run-status-explanation {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: 10px;
  line-height: 1.5;
}

.run-status-cta {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: opacity 0.12s;
}

.run-status-cta:hover {
  opacity: 0.85;
}

.run-status-cta.retry {
  background: var(--accent-blue);
  color: var(--bg-base);
}

.run-status-cta.settings {
  background: var(--accent-orange);
  color: #fff;
}

.run-status-meta {
  margin-top: 8px;
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

/* Light theme overrides */
body[data-theme-mode="light"] .run-status-card.failed {
  background: rgba(194, 75, 75, 0.08);
}

body[data-theme-mode="light"] .run-status-card.completed {
  background: rgba(111, 143, 58, 0.08);
}

body[data-theme-mode="light"] .run-status-card.blocked {
  background: rgba(214, 164, 54, 0.08);
}

/* Persistent issue run feedback strip */
.issue-run-feedback {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: rgba(34, 211, 238, 0.06);
}

.issue-run-feedback-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.issue-run-feedback-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent-cyan);
  box-shadow: 0 0 8px rgba(34, 211, 238, 0.45);
  animation: pulse-dot 1.2s ease-in-out infinite;
  flex: 0 0 auto;
}

.issue-run-feedback-text {
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.issue-run-feedback-elapsed {
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  white-space: nowrap;
}

.issue-run-feedback.completed {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.28);
}

.issue-run-feedback.completed .issue-run-feedback-dot {
  animation: none;
  background: var(--accent-green);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
}

.issue-run-feedback.failed {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.3);
}

.issue-run-feedback.failed .issue-run-feedback-dot {
  animation: none;
  background: var(--accent-red);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

@keyframes pulse-dot {
  0% {
    opacity: 0.55;
    transform: scale(0.92);
  }

  50% {
    opacity: 1;
    transform: scale(1.06);
  }

  100% {
    opacity: 0.55;
    transform: scale(0.92);
  }
}

/* === Activity Feed: Compact System Events === */
.activity-item.system {
  gap: 0;
  margin-bottom: 8px;
}

.activity-item.system .activity-avatar {
  display: none;
}

.activity-system-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

.activity-system-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-tertiary);
  flex-shrink: 0;
}

/* Activity model badge */
.activity-model-badge {
  font-size: var(--text-xs);
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--bg-elevated);
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

/* === Done Checkmark on Title === */
.done-check {
  color: #4ade80;
  margin-right: 8px;
  font-weight: 700;
}

/* === Step Pipeline Mini-Map === */
.step-pipeline {
  padding: 16px 0;
  margin-bottom: 16px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.02);
}

.step-pipeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.step-pipeline-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.step-pipeline-progress {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  font-weight: 500;
}

.step-pipeline-track {
  display: flex;
  align-items: flex-start;
  padding: 8px 0;
  overflow-x: auto;
}

/* Step Node */
.step-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  flex-shrink: 0;
}

.step-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 600;
  border: 2px solid;
  transition: transform 0.15s, box-shadow 0.15s;
}

.step-circle:hover {
  transform: scale(1.08);
}

.step-node.active .step-circle {
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.3);
}

/* Status Colors */
.step-circle.completed {
  background: rgba(74, 222, 128, 0.15);
  border-color: #4ade80;
  color: #4ade80;
}

.step-circle.in_progress {
  background: rgba(96, 165, 250, 0.15);
  border-color: #60a5fa;
  color: #60a5fa;
  animation: pulse-step 2s ease-in-out infinite;
}

@keyframes pulse-step {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(96, 165, 250, 0.2);
  }

  50% {
    box-shadow: 0 0 0 6px rgba(96, 165, 250, 0);
  }
}

.step-circle.failed {
  background: rgba(248, 113, 113, 0.15);
  border-color: #f87171;
  color: #f87171;
}

.step-circle.pending {
  background: rgba(141, 132, 120, 0.1);
  border-color: var(--text-tertiary);
  color: var(--text-tertiary);
}

/* Connector Line — pinned to circle vertical center */
.step-connector {
  flex: 1;
  min-width: 40px;
  max-width: 72px;
  height: 3px;
  border-radius: 999px;
  margin-top: 18px;
  /* (38px circle / 2) - (3px line / 2) ≈ 18px */
}

.step-connector.completed {
  background: linear-gradient(90deg, #4ade80, #34d399);
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.25);
}

.step-connector.in_progress {
  background: linear-gradient(90deg, #60a5fa, rgba(107, 114, 128, 0.35));
}

.step-connector.pending {
  background: rgba(107, 114, 128, 0.2);
}

/* Step Label */
.step-label {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  max-width: 80px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Step Detail Card (expanded on click) */
.step-detail {
  display: none;
  margin-top: 10px;
  padding: 14px 16px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-left: 3px solid var(--text-tertiary);
}

.step-detail.open {
  display: block;
}

.step-detail.completed {
  border-left-color: #4ade80;
}

.step-detail.in_progress {
  border-left-color: #60a5fa;
}

.step-detail.failed {
  border-left-color: #f87171;
}

/* Status pill badge */
.step-detail-status {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 6px;
  background: rgba(141, 132, 120, 0.15);
  color: var(--text-tertiary);
}

.step-detail.completed .step-detail-status {
  background: rgba(74, 222, 128, 0.15);
  color: #4ade80;
}

.step-detail.in_progress .step-detail-status {
  background: rgba(96, 165, 250, 0.15);
  color: #60a5fa;
}

.step-detail.failed .step-detail-status {
  background: rgba(248, 113, 113, 0.15);
  color: #f87171;
}

.step-detail-type {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.step-detail-title {
  font-size: var(--text-sm);
  color: var(--text-primary);
  line-height: 1.5;
  margin-bottom: 8px;
}

.step-detail-facts {
  margin-top: 6px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.step-detail-fact-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: var(--text-sm);
}

.step-detail-fact-label {
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.step-detail-fact-value {
  color: var(--text-secondary);
  text-align: right;
  word-break: break-word;
}

.step-detail-link-row {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Unified action pill buttons */
.step-detail-link,
.step-detail-link-actions .btn {
  display: inline-flex;
  align-items: center;
  font-size: var(--text-sm);
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.step-detail-link {
  background: rgba(86, 176, 170, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(86, 176, 170, 0.25);
}

.step-detail-link:hover {
  background: rgba(86, 176, 170, 0.22);
  text-decoration: none;
}

.step-detail-link.pending {
  background: rgba(141, 132, 120, 0.08);
  color: var(--text-tertiary);
  border-color: rgba(141, 132, 120, 0.15);
  font-weight: 500;
  cursor: default;
}

.step-detail-link-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.step-detail-path {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  padding: 3px 8px;
  border-radius: 6px;
  word-break: break-all;
}

/* QA Pass/Fail Action Buttons */
.step-qa-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.step-qa-actions .btn.danger {
  background: rgba(248, 113, 113, 0.15);
  border-color: #f87171;
  color: #f87171;
}

.step-qa-actions .btn.danger:hover {
  background: rgba(248, 113, 113, 0.25);
}

/* Light theme overrides for plan step pipeline */
body[data-theme-mode="light"] .step-pipeline {
  background: #f5f5f5;
  border-color: #ddd;
}

body[data-theme-mode="light"] .step-detail {
  background: #f0f0f0;
  border-color: #ddd;
}

body[data-theme-mode="light"] .step-detail-path {
  background: rgba(0, 0, 0, 0.05);
  color: #3b4758;
}

body[data-theme-mode="light"] .step-connector.pending {
  background: rgba(0, 0, 0, 0.1);
}

body[data-theme-mode="light"] .step-circle.pending {
  background: rgba(0, 0, 0, 0.05);
}

body[data-theme-mode="light"] .step-qa-actions {
  border-top-color: rgba(0, 0, 0, 0.08);
}

/* Error state on activity items (stale thinking / failed requests) */
.activity-item.error .activity-content {
  background: rgba(239, 68, 68, 0.08);
  border-left: 3px solid var(--accent-red);
  padding: 10px 12px;
  border-radius: 8px;
}

.activity-item.error .activity-text {
  color: var(--accent-red);
  font-style: italic;
}

/* Mobile: dispatch drawer full width */
@media (max-width: 768px) {
  .detail-header {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px 12px;
    align-items: start;
  }

  .detail-header-main {
    width: 100%;
    min-width: 0;
  }

  .detail-nav-buttons {
    margin-left: auto;
  }

  .detail-header-main .breadcrumb {
    flex: 1;
    min-width: 0;
    gap: 4px;
    flex-wrap: nowrap;
  }

  .detail-header-main .breadcrumb .breadcrumb-item {
    padding: 2px 4px;
    font-size: var(--text-xs);
    min-width: 0;
  }

  #issue-team-key,
  #issue-identifier {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .detail-toolbar {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 6px;
  }

  .detail-toolbar .detail-btn {
    height: 32px;
    padding: 5px 9px;
    font-size: var(--text-xs);
  }

  .detail-toolbar .dispatch-btn {
    margin-right: auto;
  }

  .detail-body {
    padding: 20px 16px 18px;
  }

  .issue-title {
    font-size: clamp(26px, 8.2vw, 40px);
    line-height: 1.14;
    margin-bottom: 14px;
    letter-spacing: -0.025em;
  }

  .issue-description {
    font-size: var(--text-lg);
    line-height: 1.6;
    margin-bottom: 14px;
  }

  .issue-description p {
    margin: 0 0 10px;
  }

  .issue-description li p {
    margin: 0;
  }

  .issue-description pre {
    padding: 10px 12px;
  }

  .issue-description ul,
  .issue-description ol {
    padding-left: 1rem;
    margin: 6px 0 10px;
  }

  .issue-description li {
    margin: 3px 0;
    line-height: 1.45;
  }

  .activity-section {
    padding-top: 14px;
    margin-top: 4px;
  }

  .activity-section .section-header {
    margin-bottom: 10px;
  }

  .activity-section .section-title {
    font-size: clamp(24px, 7vw, 30px);
    line-height: 1.1;
    font-weight: 300;
  }

  .dispatch-drawer {
    width: 100vw;
  }


}

/* ============================================================
   Shell-level modals — rendered in Shell, must be hidden on ALL pages
   (full styling also in style_interactive.css for workspace pages)
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--bg-elevated);
  border-radius: 16px;
  padding: 32px;
  max-width: 360px;
  width: 90%;
  text-align: center;
  border: 1px solid var(--border);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.modal-title {
  font-size: var(--text-xl);
  font-weight: 600;
  margin-bottom: 8px;
}

.modal-subtitle {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin-bottom: 24px;
}

.modal-close {
  background: var(--accent-blue);
  color: var(--bg-base);
  border: none;
  padding: 10px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: opacity 0.2s;
}

.modal-close:hover {
  opacity: 0.9;
}

.qr-container {
  background: white;
  padding: 16px;
  border-radius: 12px;
  display: inline-block;
  margin-bottom: 20px;
}

.qr-container img {
  display: block;
  width: 200px;
  height: 200px;
}

.modal-url {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  background: var(--bg-surface);
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 20px;
  word-break: break-all;
}

.qr-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.qr-buttons .btn {
  display: inline-flex;
  align-items: center;
  padding: 10px 20px;
}

#qr-copy-btn.copied {
  background: var(--accent-green);
  border-color: var(--accent-green);
  color: var(--bg-base);
}

#qr-copy-btn.copied:hover {
  background: var(--accent-green);
}

/* Edit Issue modal */
.edit-modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg, rgba(0, 0, 0, 0.7));
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.edit-modal-overlay.active {
  display: flex;
}

.edit-modal {
  background: var(--bg-surface);
  border-radius: 12px;
  width: 90%;
  max-width: 560px;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: editModalIn 0.2s ease;
}

@keyframes editModalIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.edit-modal-header {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  gap: 12px;
}

.edit-modal-header h3 {
  flex: 1;
  margin: 0;
  font-size: var(--text-xl);
  font-weight: 600;
}

.edit-modal-close {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
}

.edit-modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.edit-modal-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

.edit-field {
  margin-bottom: 20px;
}

.edit-field label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.edit-field select,
.edit-field input,
.edit-field textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: var(--text-lg);
}

.edit-field select:focus,
.edit-field input:focus,
.edit-field textarea:focus {
  outline: none;
  border-color: var(--accent-blue);
}

.edit-field textarea {
  min-height: 180px;
  resize: vertical;
  font-family: inherit;
  line-height: 1.5;
}

.edit-field-row {
  display: flex;
  gap: 12px;
}

.edit-field-row .edit-field {
  flex: 1;
  min-width: 0;
}

.edit-rich-editor {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-elevated);
}

.edit-rich-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border-bottom: 1px solid var(--border-subtle);
  background: color-mix(in srgb, var(--bg-elevated) 85%, var(--bg-surface) 15%);
  flex-wrap: wrap;
}

.edit-rich-btn {
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  border-radius: 8px;
  padding: 5px 8px;
  font-size: var(--text-sm);
  cursor: pointer;
  min-height: 30px;
}

.edit-rich-btn:hover {
  color: var(--text-primary);
  border-color: var(--border);
  background: var(--bg-hover);
}

.edit-rich-surface {
  min-height: 220px;
  max-height: 48vh;
  overflow-y: auto;
  padding: 12px 14px;
  color: var(--text-primary);
  font-size: var(--text-lg);
  line-height: 1.55;
  outline: none;
}

.edit-rich-surface p {
  margin: 0 0 10px;
}

.edit-rich-surface ul,
.edit-rich-surface ol {
  margin: 0 0 10px;
  padding-left: 20px;
}

.edit-rich-surface li {
  margin: 4px 0;
}

.edit-rich-surface blockquote {
  margin: 0 0 10px;
  padding-left: 10px;
  border-left: 2px solid var(--accent-blue);
  color: var(--text-secondary);
}

.edit-rich-surface pre {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.edit-modal-actions {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--border-subtle);
}

.edit-modal-actions button {
  flex: 1;
  padding: 14px;
  border-radius: 10px;
  font-size: var(--text-lg);
  font-weight: 500;
  cursor: pointer;
}

.edit-modal-actions .btn-cancel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.edit-modal-actions .btn-save {
  background: var(--accent-blue);
  border: none;
  color: var(--bg-base);
}

/* Reusable Salsa confirmation modal */
.salsa-confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 8, 20, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 5000;
  backdrop-filter: blur(6px);
}

.salsa-confirm-overlay.active {
  display: flex;
}

.salsa-confirm-modal {
  width: min(92vw, 420px);
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg-elevated) 92%, #0b1224 8%), var(--bg-surface));
  border: 1px solid color-mix(in srgb, var(--accent-blue) 24%, var(--border) 76%);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  padding: 20px;
}

.salsa-confirm-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(96, 165, 250, 0.18);
  color: #7cc1ff;
  font-size: var(--text-2xl);
  font-weight: 700;
}

.salsa-confirm-overlay.danger .salsa-confirm-icon {
  background: rgba(239, 68, 68, 0.18);
  color: #fb7185;
}

.salsa-confirm-title {
  margin: 14px 0 8px;
  font-size: var(--text-2xl);
  line-height: 1.2;
  font-weight: 700;
  color: var(--text-primary);
}

.salsa-confirm-message {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--text-base);
  line-height: 1.5;
}

.salsa-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.salsa-confirm-actions .btn {
  min-width: 96px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-weight: 600;
  cursor: pointer;
}

.salsa-confirm-actions .btn:hover {
  filter: brightness(1.08);
}

.salsa-confirm-actions .btn-confirm {
  background: color-mix(in srgb, var(--accent-blue) 32%, var(--bg-elevated) 68%);
  border-color: color-mix(in srgb, var(--accent-blue) 48%, var(--border) 52%);
}

.salsa-confirm-overlay.danger .salsa-confirm-actions .btn-confirm {
  background: color-mix(in srgb, #ef4444 28%, var(--bg-elevated) 72%);
  border-color: color-mix(in srgb, #ef4444 52%, var(--border) 48%);
  color: #ffd7de;
}

/* ── Salsa Dialog (replaces all native prompt/confirm/alert) ─────────────── */

.salsa-dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 8, 20, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 5000;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.salsa-dialog-overlay.active {
  display: flex;
}

.salsa-dialog {
  width: min(92vw, 420px);
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg-elevated) 92%, #0b1224 8%), var(--bg-surface));
  border: 1px solid color-mix(in srgb, var(--accent-blue) 24%, var(--border) 76%);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  padding: 20px;
  animation: salsaDialogIn 0.18s ease;
}

@keyframes salsaDialogIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.salsa-dialog-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(96, 165, 250, 0.18);
  color: #7cc1ff;
  font-size: var(--text-2xl);
  font-weight: 700;
}

.salsa-dialog-overlay.danger .salsa-dialog-icon {
  background: rgba(239, 68, 68, 0.18);
  color: #fb7185;
}

.salsa-dialog-title {
  margin: 14px 0 8px;
  font-size: var(--text-2xl);
  line-height: 1.2;
  font-weight: 700;
  color: var(--text-primary);
}

.salsa-dialog-message {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--text-base);
  line-height: 1.5;
}

.salsa-dialog-input {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 10px 14px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: var(--text-base);
  font-family: var(--font-body);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
}

.salsa-dialog-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.salsa-dialog-input::placeholder {
  color: var(--text-tertiary);
}

.salsa-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.salsa-dialog-actions .btn {
  min-width: 96px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.12s ease;
}

.salsa-dialog-actions .btn:hover {
  filter: brightness(1.08);
}

.salsa-dialog-btn-confirm {
  background: color-mix(in srgb, var(--accent-blue) 32%, var(--bg-elevated) 68%) !important;
  border-color: color-mix(in srgb, var(--accent-blue) 48%, var(--border) 52%) !important;
}

.salsa-dialog-btn-danger {
  background: color-mix(in srgb, #ef4444 28%, var(--bg-elevated) 72%) !important;
  border-color: color-mix(in srgb, #ef4444 52%, var(--border) 48%) !important;
  color: #ffd7de !important;
}

/* Toast container */
.salsa-toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.salsa-toast {
  padding: 10px 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: auto;
}

.salsa-toast.active {
  opacity: 1;
  transform: translateY(0);
}

.salsa-toast.exiting {
  opacity: 0;
  transform: translateY(-8px);
}

.salsa-toast.danger {
  border-color: color-mix(in srgb, #ef4444 40%, var(--border) 60%);
  color: #fca5a5;
}

.salsa-toast.success {
  border-color: color-mix(in srgb, var(--accent-green) 40%, var(--border) 60%);
  color: #86efac;
}

@media (max-width: 600px) {
  .edit-modal-overlay {
    align-items: flex-end;
  }

  .edit-modal {
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    padding-bottom: env(safe-area-inset-bottom, 20px);
  }

  .edit-field-row {
    flex-direction: column;
    gap: 0;
  }

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

  .salsa-dialog {
    width: calc(100vw - 24px);
    padding: 18px;
    border-radius: 14px;
  }

  .salsa-toast-container {
    bottom: calc(16px + env(safe-area-inset-bottom));
    left: 12px;
    right: 12px;
    transform: none;
  }

  .salsa-toast {
    width: 100%;
  }
}

/* ========================================================================== */
/* Channel Management Menu                                                    */
/* ========================================================================== */

.channel-item-wrapper:hover .channel-menu-btn {
  opacity: 0.6;
}

.channel-item-wrapper .channel-menu-btn:hover {
  opacity: 1;
}

.channel-menu-btn svg {
  width: 14px;
  height: 14px;
  color: var(--text-tertiary);
}

.channel-context-menu {
  position: absolute;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  padding: 4px;
  min-width: 160px;
  z-index: 1000;
}

.channel-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.1s;
}

.channel-menu-item:hover {
  background: var(--bg-hover);
}

.channel-menu-item svg {
  width: 14px;
  height: 14px;
  color: var(--text-tertiary);
}

.channel-menu-item-danger {
  color: var(--accent-red);
}

.channel-menu-item-danger svg {
  color: var(--accent-red);
}

.channel-menu-item-danger:hover {
  background: rgba(239, 68, 68, 0.15);
}

/* ---- Sync Status Bar ---- */
.sync-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 500;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.sync-bar-hidden {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}
.sync-bar-inner {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sync-bar-icon {
  display: flex;
  align-items: center;
}
.sync-bar-icon svg {
  width: 14px;
  height: 14px;
}
.sync-bar-icon.spin svg {
  animation: sync-spin 1s linear infinite;
}
@keyframes sync-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.sync-bar-dismiss {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 4px;
  display: flex;
  align-items: center;
  opacity: 0.6;
  margin-left: 8px;
}
.sync-bar-dismiss:hover {
  opacity: 1;
}
.sync-bar-dismiss svg {
  width: 12px;
  height: 12px;
}

/* Sync bar states */
.sync-bar-syncing {
  background: var(--accent-blue);
  color: #fff;
}
.sync-bar-syncing .sync-bar-dismiss { color: #fff; }

.sync-bar-connected {
  background: var(--accent-green, #22c55e);
  color: #fff;
}
.sync-bar-connected .sync-bar-dismiss { color: #fff; }

.sync-bar-disconnected {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
}

/* Sync bar overlays content — no layout shift */
/* Properties Panel - Right sidebar like Linear */
.properties-panel {
  border-left: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  height: 100%;
  max-height: 100%;
  box-sizing: border-box;
}

.properties-panel::-webkit-scrollbar {
  display: none;
}

.properties-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-tertiary);
}

.properties-body {
  padding: 12px 0 0 0;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

/* Agent assign container - flex with constrained select */
.agent-assign-row {
  display: grid !important;
  grid-template-columns: 1fr auto;
  gap: 6px;
  margin-bottom: 10px;
  width: 100%;
  box-sizing: border-box;
}

#agent-assign-select {
  min-width: 0;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

#agent-assign-btn {
  white-space: nowrap;
  padding-left: 8px;
  padding-right: 8px;
}

.property-row {
  display: flex;
  flex-direction: column;
  padding: 8px 16px;
  cursor: pointer;
}

.property-row:hover { background: var(--bg-hover); }

.property-row-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.property-icon {
  width: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
}

.property-icon svg { width: 14px; height: 14px; }

.property-content { flex: 1; width: 100%; }

.property-label {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

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

.property-value.placeholder { color: var(--text-tertiary); }

.property-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: var(--text-sm);
  font-weight: 500;
}

.property-badge.status { background: var(--bg-elevated); color: var(--text-secondary); }
.property-badge.done { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }
.property-badge.in_progress { background: rgba(59, 130, 246, 0.15); color: #93c5fd; }
.property-badge.triage { background: rgba(234, 179, 8, 0.15); color: #fde047; }
.property-badge.backlog { background: var(--bg-elevated); color: var(--text-secondary); }

.property-badge.urgent { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }
.property-badge.high { background: rgba(249, 115, 22, 0.15); color: #fdba74; }
.property-badge.medium { background: rgba(234, 179, 8, 0.15); color: #fde047; }
.property-badge.low { background: rgba(74, 222, 128, 0.15); color: #86efac; }

.property-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 600;
  color: var(--bg-base);
}

.property-section {
  padding: 12px 16px;
  border-top: 1px solid var(--border-subtle);
}

.property-section-title {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

/* Labels */
.labels-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.labels-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.labels-empty {
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  font-style: italic;
}
.label-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}
.label-tag:hover {
  background: var(--bg-hover);
}
.label-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  font-size: var(--text-base);
  cursor: pointer;
  border-radius: 50%;
  line-height: 1;
}
.label-remove:hover {
  background: var(--accent-red);
  color: white;
}
.label-input-wrapper {
  position: relative;
}
.label-input {
  width: 100%;
  padding: 6px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: var(--text-sm);
}
.label-input:focus {
  outline: none;
  border-color: var(--accent-blue);
}
.label-input::placeholder {
  color: var(--text-tertiary);
}

.label-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: var(--text-sm);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  margin-right: 6px;
  margin-bottom: 6px;
}

.label-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* Inline property select */
.property-select {
  width: 100%;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--text-primary);
  font-size: var(--text-sm);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.property-select:hover {
  background: var(--bg-elevated);
  border-color: var(--border);
}

.property-select:focus {
  outline: none;
  background: var(--bg-elevated);
  border-color: var(--accent-blue);
}

.property-save-btn {
  display: block;
  box-sizing: border-box;
  width: 100%;
  padding: 10px 16px;
  margin: 0;
  border-radius: 6px;
  border: none;
  background: var(--accent-blue);
  color: var(--bg-base);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.property-save-btn:hover {
  background: var(--accent-purple);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

/* Timestamps section at bottom of properties */
.timestamps-section {
  padding: 12px 16px;
  border-top: 1px solid var(--border-subtle);
  margin-top: auto;
}
.timestamp-row {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  padding: 3px 0;
}
.timestamp-label {
  color: var(--text-tertiary);
}
.timestamp-value {
  color: var(--text-secondary);
}

.property-save-row {
  margin-top: 10px;
}

.property-save-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

/* Status color dots on property triggers */
.property-custom-select[data-name="status"] .property-custom-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.property-custom-select[data-name="status"] .property-custom-trigger::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-tertiary);
}
.property-custom-select[data-name="status"][data-value="triage"] .property-custom-trigger::before { background: #eab308; }
.property-custom-select[data-name="status"][data-value="backlog"] .property-custom-trigger::before { background: var(--text-tertiary); }
.property-custom-select[data-name="status"][data-value="in_progress"] .property-custom-trigger::before { background: var(--accent-blue); }
.property-custom-select[data-name="status"][data-value="done"] .property-custom-trigger::before { background: var(--accent-green); }
.property-custom-select[data-name="status"][data-value="canceled"] .property-custom-trigger::before { background: var(--accent-red); }

/* Priority color dots */
.property-custom-select[data-name="priority"] .property-custom-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.property-custom-select[data-name="priority"] .property-custom-trigger::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-tertiary);
}
.property-custom-select[data-name="priority"][data-value="urgent"] .property-custom-trigger::before { background: #ef4444; }
.property-custom-select[data-name="priority"][data-value="high"] .property-custom-trigger::before { background: #f97316; }
.property-custom-select[data-name="priority"][data-value="medium"] .property-custom-trigger::before { background: #eab308; }
.property-custom-select[data-name="priority"][data-value="low"] .property-custom-trigger::before { background: #4ade80; }

/* Full Panel Pages */
.full-panel {
  padding: 32px;
  overflow-y: auto;
  width: 100%;
  height: 100%;
}

/* Hide Scrollbar Globally */
::-webkit-scrollbar {
  display: none;
}
* {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

/* Override: show scrollbar for notification list */
.notification-list {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.notification-list::-webkit-scrollbar {
  display: block;
  width: 6px;
}
.notification-list::-webkit-scrollbar-track {
  background: transparent;
}
.notification-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
.notification-list::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

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

.page-title { font-size: var(--text-2xl); font-weight: 600; margin-bottom: 4px; }
.page-subtitle { color: var(--text-tertiary); font-size: var(--text-sm); }

.edit-team-heading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.edit-team-title {
  display: block;
  margin: 0;
  line-height: 1.1;
}

.edit-team-subtitle {
  display: block;
  margin: 0;
  line-height: 1.25;
}

.team-edit-page {
  width: 100%;
  max-width: 1320px;
}

.team-edit-header {
  margin-bottom: 24px;
}

.team-edit-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 20px;
  align-items: start;
}

.team-edit-column {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.team-section-card {
  cursor: default;
  padding: 28px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.16);
  border-color: var(--border-subtle);
}

.team-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.team-section-title {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.team-section-subtitle {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.team-edit-form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.team-edit-form-row-tight {
  grid-template-columns: minmax(0, 1fr) 88px;
}

.team-edit-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.team-edit-actions .btn {
  flex: 1;
}

.team-inline-form,
.team-edit-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.team-mini-label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--text-tertiary);
}

.team-disclosure {
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--bg-secondary);
  padding: 10px 12px;
}

.team-disclosure summary {
  cursor: pointer;
  color: var(--accent-blue);
  font-size: 12px;
  font-weight: 500;
  list-style: none;
}

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

.team-disclosure[open] summary {
  margin-bottom: 10px;
}

.team-port-input {
  width: 88px;
}

.team-inline-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.team-inline-badge {
  font-size: 12px;
  color: var(--accent-green);
  font-weight: 600;
}

.team-inline-status {
  min-height: 18px;
  font-size: 12px;
  color: var(--text-tertiary);
}

.team-summary-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  padding: 7px 10px;
  white-space: nowrap;
}

.team-summary-pill.muted {
  background: transparent;
  color: var(--text-tertiary);
}

.team-empty-inline {
  padding: 18px;
  border: 1px dashed var(--border-subtle);
  border-radius: 12px;
  color: var(--text-tertiary);
  background: var(--bg-secondary);
  font-size: 13px;
  text-align: center;
}

.team-oauth-grid,
.team-integration-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.team-integration-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--bg-secondary);
}

.team-integration-main {
  flex: 1;
  min-width: 0;
}

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

.team-integration-name,
.team-marketplace-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.team-integration-description,
.team-marketplace-description {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.team-integration-meta {
  margin-top: 6px;
  font-size: 12px;
  color: var(--accent-green);
}

.team-integration-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.team-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-active);
  color: var(--text-secondary);
}

.team-status-badge.success {
  background: rgba(111, 143, 58, 0.18);
  color: var(--accent-green);
}

.team-status-badge.warning {
  background: rgba(214, 164, 54, 0.18);
  color: #d6a436;
}

.team-integration-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.team-text-link {
  color: var(--accent-blue);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
}

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

.team-capability-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.team-capability-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 5px 9px;
  background: rgba(39, 134, 185, 0.14);
  color: var(--accent-blue);
  font-size: 11px;
  font-weight: 600;
}

.team-marketplace-toolbar {
  margin-bottom: 14px;
}

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

.team-marketplace-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 168px;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
}

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

.team-marketplace-meta {
  margin-top: 3px;
  font-size: 11px;
  color: var(--text-tertiary);
}

.team-marketplace-actions {
  margin-top: auto;
  display: flex;
  justify-content: flex-end;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

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

.stat-value { font-size: var(--text-3xl); font-weight: 600; margin-bottom: 2px; }
.stat-label { color: var(--text-tertiary); font-size: var(--text-sm); }

/* Team Cards */
.teams-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.team-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  display: flex;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
}
.team-card:hover {
  border-color: var(--card-accent, var(--accent-blue));
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

.team-card-accent {
  width: 4px;
  flex-shrink: 0;
}

.team-card-body {
  flex: 1;
  padding: 16px;
}

.team-header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }

.team-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xl);
  font-weight: 600;
  color: white;
}

.team-info { flex: 1; min-width: 0; }
.team-name { font-weight: 600; font-size: var(--text-lg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team-key { color: var(--text-tertiary); font-size: var(--text-xs); font-weight: 500; letter-spacing: 0.3px; text-transform: uppercase; }

.team-progress-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.team-progress-bar {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--bg-tertiary);
  overflow: hidden;
}
.team-progress-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--card-accent, var(--accent-green));
  transition: width 0.4s ease;
  min-width: 0;
}
.team-progress-pct {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-tertiary);
  min-width: 30px;
  text-align: right;
}

.team-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.team-stat { text-align: center; padding: 4px 0; border-radius: 6px; }
.team-stat-value { font-size: var(--text-xl); font-weight: 700; }
.team-stat-label { font-size: var(--text-xs); color: var(--text-tertiary); font-weight: 500; }
.team-stat.active .team-stat-value { color: var(--accent-blue); }
.team-stat.backlog .team-stat-value { color: var(--text-secondary); }
.team-stat.done .team-stat-value { color: var(--accent-green); }

/* Issue Cards Grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.issue-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  display: block;
  transition: border-color 0.15s, transform 0.15s;
}

.issue-card:hover { border-color: var(--accent-blue); transform: translateY(-1px); }

.issue-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.issue-card-icon {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  max-width: 32px;
  max-height: 32px;
  flex-shrink: 0;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-base);
  line-height: 1;
  font-weight: 600;
  color: white;
}

.issue-card-title { font-weight: 500; font-size: var(--text-base); }
.issue-card-id { color: var(--text-tertiary); font-size: var(--text-sm); }

.issue-card-desc {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.5;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.issue-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.meta-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: var(--text-xs);
  font-weight: 500;
}

.meta-badge.urgent { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }
.meta-badge.high { background: rgba(249, 115, 22, 0.15); color: #fdba74; }
.meta-badge.medium { background: rgba(234, 179, 8, 0.15); color: #fde047; }
.meta-badge.low { background: rgba(74, 222, 128, 0.15); color: #86efac; }
.meta-badge.status { background: var(--bg-elevated); color: var(--text-secondary); }

.meta-time { color: var(--text-tertiary); font-size: var(--text-xs); margin-left: auto; }

/* Settings Page - Professional Layout */
.settings-page {
  display: flex;
  height: 100%;
  overflow: hidden;
}

/* Settings Sidebar Navigation */
.settings-tabs {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 12px;
  width: 180px;
  flex-shrink: 0;
  border-right: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  overflow-y: auto;
}

.settings-tabs [data-settings-tab] {
  text-align: left;
  justify-content: flex-start;
  padding: 10px 14px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 400;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.settings-tabs [data-settings-tab]:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.settings-tabs [data-settings-tab].active {
  background: var(--bg-active);
  color: var(--text-primary);
  font-weight: 500;
}

/* Settings Content Area */
.settings-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
  min-width: 0;
}

/* Settings Panels - Single Column for Clarity */
[data-settings-panel] {
  display: none;
  max-width: 640px;
  animation: settingsFadeIn 0.15s ease;
}

[data-settings-panel].active,
[data-settings-panel][style*="display: block"] {
  display: block;
}

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

/* Settings Section Card */
.settings-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
}

.settings-section:last-child {
  margin-bottom: 0;
}

.settings-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  padding-bottom: 0;
  border-bottom: none;
}

.settings-desc {
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  line-height: 1.5;
  margin-bottom: 16px;
}

/* Setting Rows */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.setting-row:first-of-type {
  padding-top: 0;
}

.setting-row:last-of-type,
.setting-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.setting-info {
  flex: 1;
  min-width: 0;
}

.setting-name {
  font-weight: 500;
  font-size: var(--text-sm);
  color: var(--text-primary);
  margin-bottom: 2px;
}

.setting-desc {
  margin-bottom: 0;
}

/* Toggle Switch */
.toggle {
  width: 44px;
  height: 24px;
  background: var(--border);
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.toggle.on {
  background: var(--accent-blue);
}

.toggle::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.toggle.on::after {
  transform: translateX(20px);
}

/* Light mode: softer toggle colors */
body[data-theme-mode="light"] .toggle {
  background: #c5cdd8;
}

body[data-theme-mode="light"] .toggle.on {
  background: #4fb8b6;
}

/* Marketplace Panel - Full Width */
[data-settings-panel="marketplace"] {
  max-width: none;
}

[data-settings-panel="marketplace"] .settings-section {
  max-width: none;
}

/* Marketplace Card Hover */
.marketplace-card:hover {
  border-color: var(--accent-blue) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  cursor: pointer;
}

/* Agent Detail Page */
.agent-detail-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.agent-detail-back {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.agent-detail-back a {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--text-sm);
}

.agent-detail-back a:hover {
  color: var(--text-primary);
}

.agent-detail-content {
  flex: 1;
  overflow-y: auto;
  display: flex;
}

.agent-detail-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 24px;
  background: var(--bg-surface);
}

.agent-detail-icon {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-3xl);
  flex-shrink: 0;
  color: var(--accent-blue);
}

.agent-detail-info {
  flex: 1;
  min-width: 0;
}

.agent-detail-name {
  font-size: var(--text-2xl);
  font-weight: 600;
  margin: 0 0 8px 0;
  color: var(--text-primary);
}

.agent-detail-desc {
  font-size: var(--text-base);
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

.agent-detail-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  border-top: 1px solid var(--border-subtle);
}

.agent-detail-sidebar {
  width: 320px;
  border-right: 1px solid var(--border-subtle);
  flex-shrink: 0;
  overflow-y: auto;
  background: var(--bg-surface);
}

.agent-detail-install-btn {
  width: 100%;
  padding: 12px 16px;
  font-size: var(--text-base);
  font-weight: 500;
  margin-bottom: 20px;
}

.agent-detail-stats {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
}

.agent-detail-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  font-size: var(--text-sm);
}

.agent-detail-stat:not(:last-child) {
  border-bottom: 1px solid var(--border-subtle);
}

.agent-detail-stat-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
}

.agent-detail-stat-value {
  font-weight: 500;
  color: var(--text-primary);
}

.agent-detail-category {
  display: inline-block;
  padding: 6px 12px;
  background: var(--bg-secondary);
  border-radius: 16px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.agent-detail-main {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

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

.agent-detail-tools-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text-primary);
}

.agent-detail-tools-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.agent-detail-tools-nav button {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  color: var(--text-secondary);
}

.agent-detail-tools-nav button:hover:not(:disabled) {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.agent-detail-tools-nav button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.agent-detail-tools-page {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.agent-detail-tool {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  margin-bottom: 8px;
}

.agent-detail-tool-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #10b981;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  flex-shrink: 0;
  margin-top: 2px;
}

.agent-detail-tool-info {
  flex: 1;
  min-width: 0;
}

.agent-detail-tool-name {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.agent-detail-tool-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.4;
}

@media (max-width: 768px) {
  .agent-detail-content {
    flex-direction: column;
  }

  .agent-detail-body {
    flex-direction: column;
  }

  .agent-detail-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    padding: 16px;
  }

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

  .agent-detail-stat {
    flex: 1;
    min-width: 80px;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 0;
    border: none !important;
  }

  .agent-detail-header {
    flex-direction: column;
    gap: 12px;
  }
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .settings-page {
    flex-direction: column;
  }

  .settings-tabs {
    flex-direction: row;
    width: 100%;
    padding: 12px 16px;
    gap: 6px;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .settings-tabs::-webkit-scrollbar {
    display: none;
  }

  .settings-tabs [data-settings-tab] {
    padding: 8px 12px;
    flex-shrink: 0;
  }

  .settings-container {
    padding: 16px;
  }

  .settings-section {
    padding: 16px;
  }

  .setting-row {
    flex-wrap: wrap;
  }

  .setting-info {
    flex-basis: 100%;
    margin-bottom: 8px;
  }
}

.llm-config-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
}

.form-input, .form-select {
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: var(--text-sm);
  transition: border-color 0.15s;
}

.form-select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
  cursor: pointer;
}

.form-select:hover {
  border-color: var(--text-tertiary);
}

.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.form-input::placeholder {
  color: var(--text-tertiary);
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin: 0;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.btn.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.btn.secondary:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all 0.15s;
}

.btn:hover { background: var(--bg-hover); }
.btn.primary { background: var(--accent-blue); border-color: var(--accent-blue); color: var(--bg-base); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.sm { padding: 5px 10px; font-size: var(--text-sm); }
.btn.danger { background: transparent; border-color: var(--error, #dc2626); color: var(--error, #dc2626); }
.btn.danger:hover { background: var(--error, #dc2626); color: white; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-label { display: block; margin-bottom: 6px; font-weight: 500; font-size: var(--text-sm); color: var(--text-secondary); }
.form-hint { font-size: var(--text-xs); color: var(--text-tertiary); margin-top: 4px; }

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: var(--text-sm);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--accent-blue);
}

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

.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  min-height: 60vh;
  height: 100%;
}

.empty-icon {
  width: 200px;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  background: transparent;
  color: var(--text-tertiary);
}

.empty-icon svg {
  width: 100%;
  height: 100%;
}

.empty-title { font-size: var(--text-xl); font-weight: 600; margin-bottom: 8px; color: var(--text-primary); }
.empty-text { color: var(--text-tertiary); max-width: 320px; line-height: 1.5; margin-bottom: 24px; font-size: var(--text-base); }

/* Mobile Navigation - Drawer Style */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 200;
  padding: 0 16px;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.mobile-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-header-logo {
  font-size: var(--text-2xl);
}

.mobile-menu-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mobile-menu-btn:hover { background: var(--bg-hover); }

.mobile-header-title {
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 600;
  line-height: 1;
  background: linear-gradient(
    120deg,
    var(--accent-orange) 0%,
    var(--accent-yellow) 28%,
    var(--accent-cyan) 58%,
    var(--accent-blue) 78%,
    var(--accent-orange) 100%
  );
  background-size: 220% 220%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: salsaWordUndulate 8s ease-in-out infinite;
}

.mobile-header-logo {
  margin-left: 2px;
  font-size: var(--text-xl);
  color: inherit;
  display: flex;
  align-items: center;
  line-height: 1;
}

/* Mobile Drawer */
.mobile-drawer-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 4200;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-drawer-overlay.active {
  display: block;
  opacity: 1;
}

.mobile-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  background: var(--bg-surface);
  z-index: 4201;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.drawer-header {
  height: 56px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 12px;
  box-sizing: border-box;
}

.drawer-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xl);
  background: transparent;
  box-shadow: none;
  line-height: 1;
}

.drawer-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 600;
  background: linear-gradient(
    120deg,
    var(--accent-orange) 0%,
    var(--accent-yellow) 28%,
    var(--accent-cyan) 58%,
    var(--accent-blue) 78%,
    var(--accent-orange) 100%
  );
  background-size: 220% 220%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: salsaWordUndulate 8s ease-in-out infinite;
}

.drawer-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
}

.drawer-nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--text-base);
  font-weight: 500;
  transition: all 0.15s ease;
}

.drawer-nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.drawer-nav-item.active {
  background: rgba(139, 92, 246, 0.15);
  color: var(--accent-blue);
}

.drawer-nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Colorful nav icons matching desktop sidebar */
.drawer-nav-item[href="/chat"] .drawer-nav-icon { color: #5ab2ff; }
.drawer-nav-item[href="/inbox"] .drawer-nav-icon { color: #36c0f2; }
.drawer-nav-item[href="/spend"] .drawer-nav-icon { color: #e7b95a; }
.drawer-nav-item[href="/terminal"] .drawer-nav-icon { color: #9dd16d; }
.drawer-nav-item[href="/canvas"] .drawer-nav-icon { color: #9e8bff; }
.drawer-nav-item[href="/insights"] .drawer-nav-icon { color: #e8845a; }
.drawer-nav-item[href="/plans"] .drawer-nav-icon { color: #61d6be; }
.drawer-nav-item[href="/board"] .drawer-nav-icon { color: #8bb8ff; }

.drawer-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 12px 16px;
}

.drawer-section-label {
  padding: 8px 16px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.drawer-new-btn {
  margin-left: auto;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  text-decoration: none;
  border: 1px solid var(--border-subtle);
  transition: background 0.15s ease;
}
.drawer-new-btn svg {
  width: 18px;
  height: 18px;
}

.drawer-new-btn:hover {
  background: var(--bg-hover);
}

.drawer-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 8px;
  flex-shrink: 0;
}

.drawer-footer-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all 0.15s ease;
}

.drawer-footer-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.drawer-footer-avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--bg-base);
  background: var(--accent-purple);
  flex-shrink: 0;
}

/* Mobile FAB (Floating Action Button) */
.mobile-fab {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  color: white;
  border: none;
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4);
  cursor: pointer;
  z-index: 100;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.mobile-fab:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
}

.mobile-fab:active {
  transform: scale(0.95);
}

/* Legacy bottom-nav - hidden by default, replaced by drawer */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 8px 16px 24px;
  justify-content: space-around;
  z-index: 100;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background: rgba(24, 24, 27, 0.9);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.2s;
}

.bottom-nav-item.active {
  color: var(--accent-blue);
  background: rgba(139, 92, 246, 0.1);
}

.bottom-nav-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2px;
}

.lucide-icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bottom-nav-icon .lucide-icon { width: 20px; height: 20px; }
.nav-icon .lucide-icon { width: 16px; height: 16px; }
.list-btn .lucide-icon { width: 14px; height: 14px; }
.settings-icon .lucide-icon { width: 14px; height: 14px; }
.detail-btn .lucide-icon { width: 14px; height: 14px; }
.section-arrow .lucide-icon { width: 12px; height: 12px; }
.workspace-ctrl-btn .lucide-icon { width: 18px; height: 18px; }
.workspace-header-btn .lucide-icon { width: 14px; height: 14px; }
.nav-count .lucide-icon { width: 10px; height: 10px; }
.user-avatar .lucide-icon { width: 12px; height: 12px; }

/* ======================================================================
   TEAM DETAIL PAGE - Redesigned (Jira/Notion competitive)
   ====================================================================== */

/* Breadcrumb */
.team-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  font-size: var(--text-sm);
}
.team-breadcrumb-link {
  color: var(--text-tertiary);
  transition: color 0.15s;
}
.team-breadcrumb-link:hover { color: var(--text-primary); }
.team-breadcrumb-sep { color: var(--text-tertiary); opacity: 0.5; }
.team-breadcrumb-current { color: var(--text-secondary); font-weight: 500; }

/* Team Detail Header */
.team-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.team-detail-header-left {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.team-color-dot {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 7px;
}
.team-detail-name {
  font-size: var(--text-2xl);
  font-weight: 600;
  margin-bottom: 6px;
  line-height: 1.2;
}
.team-detail-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.team-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: var(--text-xs);
  font-weight: 500;
}
.team-badge.key {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
}
.team-badge.visibility {
  background: var(--bg-elevated);
  color: var(--text-tertiary);
  text-transform: capitalize;
}
.team-badge.stat {
  background: rgba(74, 163, 161, 0.1);
  color: var(--accent-blue);
}
.team-badge.sla-breach {
  background: rgba(194, 75, 75, 0.15);
  color: #fca5a5;
}
.team-detail-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.btn.icon-btn {
  padding: 7px 8px;
  color: var(--text-tertiary);
}
.btn.icon-btn:hover {
  color: var(--accent-red);
  background: rgba(194, 75, 75, 0.1);
  border-color: rgba(194, 75, 75, 0.3);
}

/* Stats Dashboard */
.team-stats-dashboard {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 24px;
}
.team-progress-section { margin-bottom: 16px; }
.team-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.team-progress-label {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  font-weight: 500;
}
.team-progress-pct {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--accent-blue);
}
.team-progress-bar {
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 3px;
  overflow: hidden;
}
.team-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-blue), #6f8f3a);
  border-radius: 3px;
  transition: width 0.6s ease;
  min-width: 2px;
}
.team-stats-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.team-stat-chip {
  flex: 1;
  min-width: 80px;
  text-align: center;
  padding: 12px 8px;
  border-radius: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  cursor: default;
  transition: border-color 0.15s, background 0.15s;
}
.team-stat-chip:hover { border-color: var(--border); }
.team-stat-chip.triage { border-left: 3px solid #d6a436; }
.team-stat-chip.backlog { border-left: 3px solid var(--text-tertiary); }
.team-stat-chip.active { border-left: 3px solid var(--accent-blue); }
.team-stat-chip.done { border-left: 3px solid #6f8f3a; }
.team-stat-chip.sla { border-left: 3px solid var(--accent-red); }
.team-stat-chip-value {
  font-size: var(--text-2xl);
  font-weight: 600;
  display: block;
  margin-bottom: 2px;
}
.team-stat-chip-label {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

/* Toolbar */
.team-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.team-toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}
.team-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.team-toolbar-search {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 10px;
  min-width: 180px;
}
.team-toolbar-search .lucide-icon {
  width: 14px;
  height: 14px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}
.team-search-input {
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: var(--text-sm);
  padding: 7px 0;
  width: 100%;
  outline: none;
}
.team-search-input::placeholder { color: var(--text-tertiary); }
.team-filter-select {
  padding: 6px 24px 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%238d8478' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
.team-filter-select:focus {
  outline: none;
  border-color: var(--accent-blue);
}
.team-view-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.team-view-btn {
  padding: 6px 10px;
  background: var(--bg-surface);
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.team-view-btn + .team-view-btn { border-left: 1px solid var(--border); }
.team-view-btn:hover { color: var(--text-primary); background: var(--bg-hover); }
.team-view-btn.active {
  background: var(--bg-elevated);
  color: var(--accent-blue);
}
.team-view-btn .lucide-icon { width: 14px; height: 14px; }

/* Issue Groups (collapsible) */
.issue-group { margin-bottom: 2px; }
.issue-group-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  text-align: left;
  border-radius: 6px;
  transition: background 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.issue-group-header:hover { background: var(--bg-hover); }
.issue-group-chevron {
  display: flex;
  transition: transform 0.2s;
}
.issue-group-chevron .lucide-icon { width: 12px; height: 12px; }
.issue-group[data-collapsed="true"] .issue-group-chevron {
  transform: rotate(-90deg);
}
.issue-group[data-collapsed="true"] .issue-group-body {
  display: none;
}
.issue-group-count {
  color: var(--text-tertiary);
  font-weight: 400;
  margin-left: 4px;
}

/* Issue Table */
.issue-table {
  width: 100%;
  border-collapse: collapse;
}
.issue-row {
  cursor: pointer;
  transition: background 0.1s;
  border-bottom: 1px solid var(--border-subtle);
}
.issue-row:hover { background: var(--bg-hover); }
.issue-row:last-child { border-bottom: none; }
.issue-row td {
  padding: 10px 8px;
  vertical-align: middle;
  font-size: var(--text-sm);
}
.issue-col-priority { width: 28px; text-align: center; }
.issue-col-identifier { width: 80px; white-space: nowrap; }
.issue-col-title { }
.issue-col-status { width: 100px; }
.issue-col-type { width: 32px; text-align: center; }
.issue-col-labels { width: 120px; }
.issue-col-time { width: 70px; text-align: right; white-space: nowrap; }

/* Priority indicators */
.priority-indicator {
  display: inline-block;
  width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  font-size: var(--text-sm);
  border-radius: 3px;
}
.priority-indicator.urgent { color: #fca5a5; }
.priority-indicator.urgent::after { content: "\25B2\25B2"; font-size: 8px; font-weight: 700; letter-spacing: -2px; }
.priority-indicator.high { color: #fdba74; }
.priority-indicator.high::after { content: "\25B2"; font-size: var(--text-xs); }
.priority-indicator.medium { color: #fde047; }
.priority-indicator.medium::after { content: "\2014"; font-size: var(--text-xs); }
.priority-indicator.low { color: #86efac; }
.priority-indicator.low::after { content: "\25BC"; font-size: var(--text-xs); }
.priority-indicator.none { color: var(--text-tertiary); }
.priority-indicator.none::after { content: "\2014"; font-size: var(--text-xs); }

.issue-identifier {
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  font-family: var(--font-mono);
}
.issue-title-text {
  color: var(--text-primary);
  font-weight: 500;
}
.issue-status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: capitalize;
  white-space: nowrap;
}
.issue-status-badge.triage { background: rgba(234, 179, 8, 0.15); color: #fde047; }
.issue-status-badge.backlog { background: var(--bg-elevated); color: var(--text-secondary); }
.issue-status-badge.todo { background: var(--bg-elevated); color: var(--text-secondary); }
.issue-status-badge.in_progress { background: rgba(74, 163, 161, 0.15); color: #56b0aa; }
.issue-status-badge.in-progress { background: rgba(74, 163, 161, 0.15); color: #56b0aa; }
.issue-status-badge.review { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }
.issue-status-badge.done { background: rgba(111, 143, 58, 0.15); color: #a3be6a; }
.issue-status-badge.cancelled { background: var(--bg-elevated); color: var(--text-tertiary); }

/* Issue Context & Style References */
.context-files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 8px;
}

.context-file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.context-file-item:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-blue);
    transform: translateY(-1px);
}

.context-file-icon {
    font-size: var(--text-2xl);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: 6px;
}

.context-file-thumb {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    flex-shrink: 0;
}

.context-file-info {
    flex: 1;
    min-width: 0;
}

.context-file-name {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.context-file-meta {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    text-transform: capitalize;
}

.dispatch-context-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    padding: 12px;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
}

.context-file-item.mini {
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border-radius: 6px;
}

.context-file-item.mini .context-file-icon,
.context-file-item.mini .context-file-thumb {
    font-size: var(--text-base);
    width: 24px;
    height: 24px;
}

.context-file-item.mini .context-file-name {
    font-size: var(--text-sm);
}

/* Activity Day Grouping & Collapsible */
.activity-groups {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.activity-day-group {
    display: flex;
    flex-direction: column;
}

.activity-day-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
    cursor: pointer;
    user-select: none;
    transition: opacity 0.2s;
}

.activity-day-header:hover {
    opacity: 0.8;
}

.activity-day-title {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.activity-day-count {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    background: var(--bg-elevated);
    padding: 2px 8px;
    border-radius: 10px;
}

.activity-day-chevron {
    margin-left: auto;
    color: var(--text-tertiary);
    transition: transform 0.3s ease;
}

.activity-day-group.collapsed .activity-day-chevron {
    transform: rotate(-90deg);
}

.activity-day-group.collapsed .activity-day-content {
    display: none;
}

.activity-day-group.collapsible.collapsed .activity-day-header {
    border-bottom: none;
    margin-bottom: 0;
}

/* General Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 5000;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 5001;
    animation: modalScaleIn 0.2s ease-out;
}

@keyframes modalScaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Issue type icons */
.issue-type-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  font-size: var(--text-sm);
}
.issue-type-icon.bug { color: #fca5a5; }
.issue-type-icon.bug::after { content: "\25CF"; }
.issue-type-icon.feature { color: #a78bfa; }
.issue-type-icon.feature::after { content: "\2605"; }
.issue-type-icon.task { color: var(--accent-blue); }
.issue-type-icon.task::after { content: "\2611"; }
.issue-type-icon.improvement { color: #6f8f3a; }
.issue-type-icon.improvement::after { content: "\25B2"; }
.issue-type-icon.epic { color: #d6a436; }
.issue-type-icon.epic::after { content: "\26A1"; }
.issue-type-icon.story { color: #56b0aa; }
.issue-type-icon.story::after { content: "\25CB"; }

.issue-label-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: var(--text-xs);
  background: var(--bg-elevated);
  color: var(--text-tertiary);
  margin-right: 4px;
}

.issue-time {
  color: var(--text-tertiary);
  font-size: var(--text-xs);
}

/* Team issues container */
.team-issues-container { }

/* Mobile responsive for team detail */
@media (max-width: 768px) {
  .team-detail-header {
    flex-direction: column;
    gap: 12px;
  }
  .team-detail-header-actions {
    width: 100%;
    justify-content: flex-end;
  }
  .team-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .team-toolbar-left, .team-toolbar-right {
    width: 100%;
  }
  .team-stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }
  .issue-col-labels, .issue-col-type {
    display: none;
  }
  .team-toolbar-search {
    min-width: unset;
    width: 100%;
  }
}

.push-prompt-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  flex-shrink: 0;
}

.push-prompt-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.push-prompt-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.push-prompt-close .lucide-icon {
  width: 14px;
  height: 14px;
}

/* ======================================================================
   CORE MOBILE RESPONSIVE — loaded via STYLE_SHELL on ALL pages
   ====================================================================== */
@media (max-width: 1100px) {
  .main-content { grid-template-columns: 1fr; }
  .main-content.with-properties,
  .main-content.detail-with-properties { grid-template-columns: 1fr; }
  .properties-panel:not(.salsa-panel-fixed):not(#context-panel) { display: none; }
  .teams-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .app {
    grid-template-columns: 1fr;
    padding-top: 56px;
    padding-bottom: 0;
  }
  .sidebar { display: none; }

  /* Show mobile header and FAB instead of bottom nav */
  .mobile-header { display: flex; }
  .mobile-fab { display: flex; }
  .bottom-nav { display: none; }

  /* Hide desktop topbar on mobile — icons are in mobile-header */
  .app-topbar { display: none; }

  /* Fix main-shell height on mobile to account for header */
  .main-shell {
    height: calc(100vh - 56px);
  }

  /* Mobile icon buttons in mobile header */
  .mobile-icon-btn {
    width: 32px;
    height: 32px;
    font-size: var(--text-base);
    border-radius: 8px;
  }
  .mobile-icon-btn svg {
    width: 16px;
    height: 16px;
  }

  /* Smart search overlay on mobile */
  .smart-search-overlay {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    z-index: 300;
    max-height: calc(100vh - 56px);
    overflow-y: auto;
  }
  .smart-search-scrim {
    z-index: 299;
  }

  .main-shell-content {
    flex: 1;
    min-height: 0;
    overflow: auto;
  }

  .main-content {
    height: 100%;
    overflow: hidden;
  }

  .list-panel, .detail-panel {
    border-right: none;
    height: 100%;
    overflow: hidden;
  }

  .full-panel {
    padding: 20px 16px;
  }

  .teams-grid {
    grid-template-columns: 1fr;
  }

  .team-edit-main-content {
    padding: 16px 12px 28px !important;
  }

  .team-edit-panel-wrap {
    max-width: none !important;
  }

  .team-edit-page .issue-card {
    padding: 20px 16px !important;
  }

  .team-edit-hero .page-title {
    font-size: 22px !important;
    line-height: 1.15;
  }

  .team-edit-hero-bar,
  .team-email-toolbar,
  .team-autopilot-row,
  .team-edit-footer-actions {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .team-edit-hero-actions,
  .team-email-toolbar-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px !important;
    align-items: stretch !important;
  }

  .team-edit-hero-actions > .btn,
  .team-email-toolbar-actions > .btn {
    flex: 1 1 140px;
    justify-content: center;
    text-align: center;
  }

  .team-edit-footer-actions > .btn {
    flex: 0 0 auto;
    width: 100%;
    min-height: 44px;
    justify-content: center;
    text-align: center;
  }

  .team-edit-main-grid,
  .team-edit-section-grid,
  .team-edit-grid-2,
  .team-edit-grid-3,
  .team-edit-port-grid {
    grid-template-columns: 1fr !important;
  }

  .team-edit-column,
  .team-edit-sidebar,
  .team-edit-main-grid > *,
  .team-edit-section-grid > * {
    min-width: 0;
  }

  .team-edit-page .team-color-grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }
}
}

/* Salsa Dropdown - Premium Custom Component */
.salsa-dropdown {
  position: relative;
  width: 100%;
}

.salsa-dropdown-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: var(--text-base);
  font-weight: 400;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: left;
  outline: none;
  min-height: 44px; /* Mobile touch target */
}

.salsa-dropdown-trigger:hover {
  border-color: var(--accent-blue);
  background: var(--bg-hover);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.salsa-dropdown-trigger:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.salsa-dropdown-chevron {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  transition: transform 0.2s;
}

.salsa-dropdown-menu.active ~ .salsa-dropdown-trigger .salsa-dropdown-chevron {
  transform: rotate(180deg);
}

.salsa-dropdown-menu {
  /* position/top/left/width set via JS (fixed, appended to body) */
  position: fixed;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.salsa-dropdown-menu.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.salsa-dropdown-item {
  padding: 12px 14px;
  font-size: var(--text-base);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.15s;
  min-height: 44px; /* Mobile touch target */
}

.salsa-dropdown-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.salsa-dropdown-item.selected {
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent-blue);
  font-weight: 500;
}

.salsa-dropdown-check {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: var(--accent-blue);
}

/* Dropup variant — menu opens above trigger */
.salsa-dropdown--dropup .salsa-dropdown-menu {
  top: auto;
  bottom: calc(100% + 6px);
  transform: translateY(8px);
}

.salsa-dropdown--dropup .salsa-dropdown-menu.active {
  transform: translateY(0);
}

/* Compact variant — smaller trigger for inline/toolbar usage */
.salsa-dropdown--compact {
  width: auto;
}

.salsa-dropdown--compact .salsa-dropdown-trigger {
  min-height: 0;
  padding: 3px 24px 3px 8px;
  font-size: var(--text-xs);
  font-weight: 500;
  border-radius: 999px;
  border-color: var(--border-subtle);
  background: var(--bg-surface);
  gap: 4px;
}

.salsa-dropdown--compact .salsa-dropdown-trigger:hover {
  border-color: var(--border);
  background: var(--bg-hover);
  box-shadow: none;
}

.salsa-dropdown--compact .salsa-dropdown-chevron {
  width: 10px;
  height: 10px;
}

.salsa-dropdown--compact .salsa-dropdown-chevron svg {
  width: 10px;
  height: 10px;
}

.salsa-dropdown--compact .salsa-dropdown-menu {
  min-width: 140px;
  width: auto;
  right: auto;
}

.salsa-dropdown--compact .salsa-dropdown-item {
  padding: 8px 12px;
  font-size: var(--text-sm);
  min-height: 0;
}

/* Animations */
@keyframes dropdownFadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive adjustments — bottom-sheet on mobile.
   !important overrides the inline fixed positioning set by JS. */
@media (max-width: 600px) {
  .salsa-dropdown-menu {
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.3);
  }

  .salsa-dropdown-menu.active {
    transform: translateY(0);
  }
  
  .salsa-dropdown-item {
    padding: 16px 20px;
    font-size: var(--text-lg);
    border-bottom: 1px solid var(--border-subtle);
  }
  
  .salsa-dropdown-item:last-child {
    border-bottom: none;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
}

/* ========================================================================
   Model Discovery Modal
   ======================================================================== */

.model-discovery-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.model-discovery-panel {
  display: flex;
  flex-direction: column;
  width: min(90vw, 800px);
  max-height: 85vh;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

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

.model-discovery-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
}
.model-discovery-close:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.model-discovery-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-base);
}

.model-discovery-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.mdm-filter-pill {
  padding: 4px 10px;
  font-size: var(--text-xs);
  font-weight: 500;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}
.mdm-filter-pill:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}
.mdm-filter-pill.active {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: white;
}

.model-discovery-grid {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
}

.model-discovery-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s;
}
.model-discovery-row:hover {
  background: var(--bg-elevated);
}

.model-discovery-row input[type="checkbox"] {
  margin-top: 3px;
  flex-shrink: 0;
  accent-color: var(--accent-blue);
  width: 16px;
  height: 16px;
}

.model-discovery-row-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.model-discovery-row-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.model-discovery-row-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.model-discovery-row-meta {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.model-discovery-row-desc {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  line-height: 1.4;
}

.model-discovery-row-stats {
  display: flex;
  gap: 12px;
  font-size: 10px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.model-discovery-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-base);
}

@media (max-width: 1100px) {
  .team-edit-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .team-section-card {
    padding: 20px;
  }

  .team-edit-form-row,
  .team-edit-form-row-tight,
  .team-marketplace-grid {
    grid-template-columns: 1fr;
  }

  .team-integration-item,
  .team-integration-top,
  .team-section-header,
  .team-edit-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .team-integration-pills,
  .team-integration-actions {
    justify-content: flex-start;
    align-items: flex-start;
  }
}
