/* ─── Component Styles — iOS-style Clean Design ─── */

/* ─── Telemetry Tab ─── */
.telemetry-tab {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.telemetry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}

.telemetry-grid > .card {
  margin-bottom: 0;
  min-height: 240px;
  display: flex;
  flex-direction: column;
}

.telemetry-grid > .card .empty-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.telemetry-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.telemetry-list li:last-child {
  border-bottom: 0;
}

.telemetry-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.telemetry-count {
  font-weight: 600;
  color: var(--text-primary);
}

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

/* ─── Cards ─── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  border: 1px solid var(--border);
  margin-bottom: 12px;
  transition: background 0.15s ease, border-color 0.15s ease;
  position: relative;
  overflow: hidden;
  min-width: 0;
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
  line-height: 1.35;
  position: relative;
}

.card-subtitle {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-secondary);
  line-height: 1.4;
  position: relative;
}

/* ─── Stat Cards ─── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.stat-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.stat-strip::-webkit-scrollbar {
  display: none;
}

.stat-strip .stat-card {
  min-width: 140px;
  flex: 0 0 auto;
  scroll-snap-align: start;
}

.work-summary-card .card-title {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-hint);
}

.work-summary-card .stat-card {
  background: var(--surface-1);
  border-color: var(--border);
}

@media (min-width: 900px) {
  .work-summary-card .stat-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    overflow: visible;
  }

  .work-summary-card .stat-card {
    min-width: 0;
  }
}

@media (max-width: 640px) {
  .work-summary-card .card-title {
    font-size: 12px;
    letter-spacing: 0.12em;
  }

  .work-summary-card .card-subtitle {
    font-size: 12px;
  }

  .stat-strip {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    overflow: visible;
    padding-bottom: 0;
  }

  .stat-strip .stat-card {
    min-width: 0;
  }

  .work-summary-card .stat-card {
    padding: 12px 10px;
  }

  .work-summary-card .stat-value {
    font-size: 20px;
  }

  .work-summary-card .stat-label {
    font-size: 10px;
    letter-spacing: 0.08em;
  }

  .work-summary-card .stat-strip .stat-card:last-child {
    grid-column: span 2;
  }
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 16px 12px;
  text-align: center;
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.stat-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.03em;
  position: relative;
  animation: counter-up 0.4s ease both;
}

.stat-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  position: relative;
}

.stat-trend {
  font-size: 11px;
  font-weight: 600;
  margin-top: 4px;
  position: relative;
}

/* ─── Badges ─── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge-todo {
  background: rgba(100, 116, 139, 0.15);
  color: var(--color-todo);
  border-color: rgba(100, 116, 139, 0.25);
}

.badge-inprogress {
  background: rgba(59, 130, 246, 0.18);
  color: var(--color-inprogress);
  border-color: rgba(59, 130, 246, 0.35);
}

.badge-inreview {
  background: rgba(245, 158, 11, 0.18);
  color: var(--color-inreview);
  border-color: rgba(245, 158, 11, 0.35);
}

.badge-draft {
  background: rgba(245, 158, 11, 0.16);
  color: var(--color-warning, #f59e0b);
  border-color: rgba(245, 158, 11, 0.35);
}

.badge-done {
  background: rgba(16, 185, 129, 0.18);
  color: var(--color-done);
  border-color: rgba(16, 185, 129, 0.35);
}

.badge-error {
  background: rgba(239, 68, 68, 0.18);
  color: var(--color-error);
  border-color: rgba(239, 68, 68, 0.35);
}

.badge-cancelled {
  background: rgba(100, 116, 139, 0.18);
  color: var(--color-cancelled);
  border-color: rgba(100, 116, 139, 0.3);
}

.badge-critical {
  background: rgba(239, 68, 68, 0.18);
  color: var(--color-critical);
  border-color: rgba(239, 68, 68, 0.35);
}

.badge-high {
  background: rgba(245, 158, 11, 0.18);
  color: var(--color-high);
  border-color: rgba(245, 158, 11, 0.35);
}

.badge-medium {
  background: rgba(59, 130, 246, 0.18);
  color: var(--color-medium);
  border-color: rgba(59, 130, 246, 0.35);
}

.badge-low {
  background: rgba(100, 116, 139, 0.15);
  color: var(--color-low);
  border-color: rgba(100, 116, 139, 0.25);
}

.badge-info {
  background: rgba(59, 130, 246, 0.18);
  color: var(--color-inprogress);
  border-color: rgba(59, 130, 246, 0.35);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.18);
  color: var(--color-inreview);
  border-color: rgba(245, 158, 11, 0.35);
}

.badge-log {
  background: rgba(100, 116, 139, 0.12);
  color: var(--text-secondary);
  border-color: rgba(100, 116, 139, 0.2);
}

/* ─── Chips / Filters ─── */
.chip-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.chip {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), transform 0.15s ease;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
}

.chip:active {
  transform: scale(0.95);
}

.chip:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}

.chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.chip.active {
  background: var(--accent-subtle);
  color: var(--accent);
  border-color: var(--accent);
}

/* ─── Tags ─── */
.tag-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-full);
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-ui);
  line-height: 1.1;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
}

.btn-icon-compact {
  gap: 4px;
}

.btn-icon-compact svg {
  width: 14px;
  height: 14px;
}

.btn-icon-compact {
  gap: 4px;
}

.btn-icon-compact svg {
  width: 14px;
  height: 14px;
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn:disabled:hover,
.btn[disabled]:hover {
  transform: none;
}

.btn:active {
  transform: scale(0.97);
  opacity: 0.85;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 12px;
}

.btn-ghost:hover {
  background: var(--bg-card-hover);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.12);
  color: var(--color-error);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.18);
}

@media (hover: hover) {
  .btn:hover:not(:disabled) {
    transform: translateY(-1px);
  }

  .btn:active:not(:disabled) {
    transform: translateY(0) scale(0.97);
  }
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  min-height: 32px;
}

.btn-xs {
  padding: 4px 8px;
  font-size: 11px;
  min-height: 26px;
}

.btn-block {
  width: 100%;
}

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

/* ─── Inputs ─── */
.input {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  line-height: 1.4;
  min-height: 44px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  outline: none;
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.input-error {
  border-color: rgba(239, 68, 68, 0.6);
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.15);
}

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

textarea.input {
  min-height: 80px;
  resize: vertical;
}

select.input {
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239ca3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
  align-items: center;
}

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

.form-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-hint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

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

.form-hint.error {
  color: var(--color-error);
}

.form-hint.success {
  color: var(--color-done);
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.range-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.range-row input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
  height: 4px;
}

/* ─── Task Cards ─── */
.task-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 16px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  margin-bottom: 8px;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-card:active {
  background: var(--bg-card-hover);
}

.task-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.task-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}

.task-card-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}

.task-card-meta {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.task-card-badges {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.task-card[data-status="todo"] {
  border-left-color: var(--color-todo);
}

.task-card[data-status="inprogress"] {
  border-left-color: var(--color-inprogress);
}

.task-card[data-status="inreview"] {
  border-left-color: var(--color-inreview);
}

.task-card[data-status="done"],
.task-card[data-status="completed"] {
  border-left-color: var(--color-done);
}

.task-card[data-status="error"],
.task-card[data-status="failed"] {
  border-left-color: var(--color-error);
}

.task-card[data-manual="true"] {
  border-left-color: var(--color-inreview);
  background: rgba(245, 158, 11, 0.08);
}

.task-card-actions {
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

@media (max-width: 640px) {
  .task-card {
    padding: 12px;
    border-radius: 12px;
  }

  .task-card-title {
    font-size: 13px;
  }

  .task-card-meta {
    font-size: 11px;
  }

  .task-card-actions {
    flex-wrap: wrap;
  }

  .task-card-actions .btn {
    flex: 1 1 calc(50% - 6px);
    min-width: 120px;
    justify-content: center;
  }
}

/* ─── Task Modal Summary ─── */
.task-modal-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.task-modal-id {
  font-size: 12px;
  color: var(--text-hint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.task-modal-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.task-modal-actions {
  display: flex;
  gap: 8px;
}

/* ─── Create Task Form ─── */
.create-task-form {
  gap: 10px;
}

.create-task-form textarea.input {
  resize: none;
  min-height: 64px;
  line-height: 1.5;
}

.repo-select-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.repo-auto-label {
  font-size: 13px;
  color: var(--text-secondary, #aaa);
  padding: 4px 2px;
}

.repo-auto-label strong {
  color: var(--text-primary, #fff);
}

.repo-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.repo-checkboxes-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-hint, #888);
  margin-bottom: 2px;
}

.repo-checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-primary, #fff);
  cursor: pointer;
  padding: 3px 2px;
}

.repo-checkbox-item input[type="checkbox"] {
  accent-color: var(--accent, #7c6af7);
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.create-task-advanced-toggle {
  font-size: 12px;
  letter-spacing: 0.02em;
  opacity: 0.75;
  margin-top: -4px;
}

@media (max-width: 640px) {
  .task-card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .task-card-badges {
    width: 100%;
    justify-content: flex-start;
  }
}

/* ─── Progress Bar ─── */
.progress-bar {
  height: 5px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 8px;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: var(--gradient-progress);
  border-radius: var(--radius-full);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

/* ─── Donut Chart ─── */
.donut-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 0;
}

.donut-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 8px;
}

.donut-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-secondary);
}

.donut-legend-swatch {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* ─── Segmented Control ─── */
.segmented-control {
  display: inline-flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 2px;
  margin-bottom: 10px;
}

.segmented-btn {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 32px;
}

.segmented-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.segmented-btn.active {
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: var(--shadow-sm);
}

/* ─── Log Box (Terminal) ─── */
.log-box {
  background: var(--bg-primary);
  color: var(--text-primary);
  padding: 12px;
  border-radius: var(--radius-md);
  font-family: "IBM Plex Mono", "JetBrains Mono", "SF Mono", "Fira Code", monospace;
  font-size: 11px;
  line-height: 1.5;
  max-height: 300px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
  border: 1px solid var(--border);
  box-shadow: inset 0 0 20px rgba(1, 4, 9, 0.4);
}

/* ─── Skeleton Loader ─── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, rgba(240, 246, 252, 0.06) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  border-radius: var(--radius-md);
  animation: shimmer 1.5s ease-in-out infinite;
  min-height: 20px;
}

.skeleton-card {
  height: 80px;
  margin-bottom: 8px;
}

.skeleton-stat {
  height: 70px;
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  border-radius: var(--radius-sm);
}

.skeleton-text.w-60 {
  width: 60%;
}

.skeleton-text.w-40 {
  width: 40%;
}

.skeleton-text.w-80 {
  width: 80%;
}

/* ─── Modal ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--backdrop);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  z-index: 10000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s ease;
  overscroll-behavior: contain;
}

.app-shell .modal-overlay {
  padding-top: calc(var(--header-height) + 12px);
}

.modal-content {
  background: var(--bg-elevated);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  border: 1px solid var(--border);
  border-bottom: none;
  width: 100%;
  max-width: 500px;
  /* dvh = dynamic viewport height: shrinks when keyboard appears on Android/modern iOS */
  max-height: 92dvh;
  /* Fallback for browsers without dvh — use TG viewport var which updates on keyboard */
  max-height: min(92dvh, calc(var(--viewport-height, 100dvh) - var(--header-height, 60px)));
  overflow: hidden;
  /* scroll lives in .modal-body */
  display: flex;
  flex-direction: column;
  padding: 0;
  /* Lift above software keyboard on iOS (set by JS via visualViewport API) */
  margin-bottom: var(--keyboard-height, 0px);
  animation: springUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 -10px 30px rgba(1, 4, 9, 0.4);
}

.modal-content.modal-content-wide {
  max-width: 860px;
}

/* ── Desktop: Center modal as dialog ── */
@media (min-width: 769px) {
  .modal-overlay {
    align-items: center;
    padding: 24px;
    z-index: 10000;
  }

  .modal-content {
    border-radius: var(--radius-xl);
    border-bottom: 1px solid var(--border);
    max-height: 85vh;
    animation: springUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  }
}

.modal-form-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-form-span {
  width: 100%;
}

.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--border-strong);
  border-radius: var(--radius-full);
  margin: 0 auto 16px;
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

/* ─── Modal header with close button ─── */
.modal-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-elevated);
  margin: 0;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

/* ─── Modal scrollable body ─── */
.modal-body {
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  padding-bottom: max(16px, calc(var(--safe-bottom, 0px) + 16px));
  flex: 1;
  min-height: 0;
  /* critical for flex shrink to work */
}

/* ─── Modal sticky footer (submit actions) ─── */
.modal-footer {
  flex-shrink: 0;
  padding: 12px 16px;
  padding-bottom: max(14px, calc(var(--safe-bottom, 0px) + 12px));
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-header .modal-handle {
  margin-bottom: 12px;
}

.modal-header .modal-title {
  width: 100%;
  padding-right: 36px;
  text-align: left;
}

.modal-close-btn {
  position: absolute;
  top: 0;
  right: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--bg-card);
  border-radius: var(--radius-full, 50%);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  padding: 0;
}

.modal-close-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-bright);
}

.modal-close-btn svg {
  width: 16px;
  height: 16px;
}

/* ─── Toast ─── */
.toast-container {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: calc(100vw - 32px);
}

.toast {
  pointer-events: auto;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
}

.toast-success {
  background: rgba(46, 204, 113, 0.9);
}

.toast-error {
  background: rgba(231, 76, 60, 0.9);
}

.toast-info {
  background: rgba(91, 110, 174, 0.9);
}

.toast-warning {
  background: rgba(245, 166, 35, 0.9);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }

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

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }

  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

/* ─── Collapsible Section ─── */
.collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
}

.collapsible-header svg {
  transition: transform 0.2s ease;
}

.collapsible-header.open svg {
  transform: rotate(180deg);
}

.collapsible-body {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
}

.collapsible-body.open {
  max-height: 2000px;
}

.card .collapsible-header {
  padding-top: 0;
}

.card .collapsible-body.open {
  padding-bottom: 4px;
}

/* ─── Pill ─── */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

/* ─── Pull to Refresh ─── */
.ptr-spinner {
  display: flex;
  justify-content: center;
  padding: 12px 0;
}

.ptr-spinner-icon {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ─── Desktop Refresh Button ─── */
.ptr-desktop-refresh {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius-full, 50%);
  color: var(--text-secondary);
  cursor: pointer;
  z-index: 10;
  transition: background 0.15s ease, color 0.15s ease, transform 0.2s ease;
  padding: 0;
}

.ptr-desktop-refresh:hover {
  background: var(--bg-card-hover);
  color: var(--accent);
}

.ptr-desktop-refresh:active {
  transform: scale(0.9);
}

.ptr-desktop-refresh svg {
  width: 16px;
  height: 16px;
}

.ptr-desktop-refresh.spinning svg {
  animation: spin 0.8s linear infinite;
}

/* Pull arrow icon (used while dragging, before release) */
.ptr-pull-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.ptr-pull-icon svg {
  width: 24px;
  height: 24px;
  display: block;
}

.modal-open .ptr-desktop-refresh {
  display: none;
}

@media (max-width: 768px) {
  .ptr-desktop-refresh {
    display: none !important;
  }
}

.pull-to-refresh-container {
  /* Must participate in the flex chain so .main-content (flex:1) gets a
     bounded height and can actually scroll. Without flex here, .main-content's
     flex:1 + overflow-y:auto has no effect — content just overflows forever. */
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  /* Explicitly allow pan-y so Chrome's compositor correctly forwards both touch
     and touchpad/wheel scroll events down to the .main-content child. */
  touch-action: pan-y;
  overflow: visible;
}

/* ═══════════════════════════════════════════════
 *  Bot Controls — command panel launched from More sheet
 * ═══════════════════════════════════════════════ */

/* ─── Trigger button inside MoreSheet ─── */
.more-menu-bot-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  color: var(--text-primary);
  transition: background var(--transition-fast), border-color var(--transition-fast);
  text-align: left;
}

.more-menu-bot-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}

.more-menu-bot-btn:active {
  transform: scale(0.98);
}

.more-menu-bot-icon {
  font-size: 22px;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(76, 201, 240, 0.12);
  border-radius: var(--radius-md);
}

.more-menu-bot-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.more-menu-bot-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-bright);
}

.more-menu-bot-sub {
  font-size: 11px;
  color: var(--text-hint);
}

.more-menu-bot-chevron {
  font-size: 20px;
  color: var(--text-hint);
  flex-shrink: 0;
}

/* ─── Sheet inner content ─── */
.bot-controls-content {
  padding: 0;
}

.bot-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 4px 4px;
}

/* ─── Back/Home breadcrumb nav ─── */
.bot-controls-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

/* ─── Screen body text ─── */
.bot-controls-body {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

/* ─── Spinner ─── */
.bot-controls-spinner {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-hint);
  padding: 8px 0;
}

/* ─── Command result area ─── */
.bot-controls-result {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text-primary);
  max-height: 220px;
  overflow-y: auto;
}

.bot-controls-result pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.6;
}

.bot-controls-result-error {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.06);
  color: var(--color-error);
}

/* ─── Keyboard button grid ─── */
.bot-controls-keyboard {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bot-kb-row {
  display: flex;
  gap: 4px;
}

.bot-kb-btn {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  padding: 9px 6px;
  cursor: pointer;
  transition: background var(--transition-fast), transform 0.1s;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bot-kb-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}

.bot-kb-btn:active {
  background: var(--accent-subtle);
  transform: scale(0.97);
}

.bot-kb-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

/* Navigation buttons (→ another screen) — slightly muted style */
.bot-kb-btn.nav-btn {
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

.bot-kb-btn.nav-btn:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* ─── Cards need breathing room ─── */
.card+.card {
  margin-top: 12px;
}

/* ─── Misc ─── */
.meta-text {
  font-size: 12px;
  color: var(--text-hint);
}

/* ─── Pager ─── */
.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.pager-info {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
}

/* ─── Empty State ─── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
  filter: grayscale(0.3);
}

.empty-state-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-state-description {
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 280px;
  line-height: 1.5;
}

/* ─── List Item ─── */
.list-item {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

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

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

.list-item-trailing {
  flex-shrink: 0;
  color: var(--text-hint);
}

/* ─── Avatar ─── */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}

.avatar-initials {
  text-transform: uppercase;
}

/* ─── Divider ─── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

.divider-label {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-hint);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 16px 0 8px;
}

.divider-label::before,
.divider-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ─── Search Input ─── */
.search-input-wrap {
  position: relative;
  margin-bottom: 12px;
}

.search-input-wrap .input,
.search-input-wrap .search-input {
  padding-left: 36px;
  padding-right: 36px;
}

.search-input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-hint);
  pointer-events: none;
  width: 16px;
  height: 16px;
}

.search-input-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-hint);
  cursor: pointer;
  border: none;
  background: none;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── Toggle Switch ─── */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 12px;
  background: var(--border, rgba(255, 255, 255, 0.15));
  transition: background 0.2s ease;
  cursor: pointer;
  flex-shrink: 0;
}

.toggle-on {
  background: var(--accent, #3b82f6) !important;
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease;
}

.toggle-on .toggle-thumb {
  transform: translateX(20px);
}

.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.toggle-wrap.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.toggle-label {
  font-size: 14px;
  color: var(--text-primary, #fff);
}

/* ─── Stepper ─── */
.stepper {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  overflow: hidden;
}

.stepper-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}

.stepper-btn:active {
  background: var(--bg-card-hover);
}

.stepper-value {
  width: 48px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-input);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  line-height: 36px;
}

/* ─── Section Header (Telegram-style) ─── */
.section-header {
  font-size: 13px;
  font-weight: 600;
  color: var(--header-text);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 8px 0 4px;
  margin-bottom: 4px;
}

/* ─── Settings Section ─── */
.settings-section {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 0;
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.settings-section .list-item {
  padding: 14px 16px;
  margin: 0;
}

.settings-section .list-item:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

/* ─── Quick Actions Grid ─── */
.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

/* ─── Quick Action Sent Animation ─── */
.quick-action-sent {
  animation: quickActionPulse 0.3s ease;
}

@keyframes quickActionPulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(0.92);
    opacity: 0.7;
  }

  100% {
    transform: scale(1);
  }
}

/* ─── Action Card ─── */
.action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px 8px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
}

.action-card:active {
  transform: scale(0.95);
  background: var(--bg-card-hover);
}

.action-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
}

.action-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.action-card svg {
  width: 24px;
  height: 24px;
  color: var(--accent);
  filter: none;
}

/* ─── Utility Classes ─── */
.gap-sm {
  gap: 6px;
}

.gap-md {
  gap: 10px;
}

.mb-sm {
  margin-bottom: 6px;
}

.mb-md {
  margin-bottom: 12px;
}

.mb-lg {
  margin-bottom: 16px;
}

.mt-sm {
  margin-top: 6px;
}

.mt-md {
  margin-top: 12px;
}

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

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.hidden {
  display: none !important;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.flex-row {
  display: flex;
  flex-direction: row;
  align-items: center;
}

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

.flex-1 {
  flex: 1;
}

/* ─── Status Dot ─── */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  flex-shrink: 0;
  vertical-align: middle;
}

/* ─── Agent Slot Grid ─── */
.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 8px;
}

.slot-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  cursor: default;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--bg-card);
  position: relative;
}

.slot-cell[onClick] {
  cursor: pointer;
}

.slot-cell:active {
  transform: scale(0.95);
}

.slot-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.slot-idle {
  background: var(--bg-card);
  border-color: var(--border);
  opacity: 0.6;
}

.slot-busy,
.slot-running {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.4);
  animation: slot-pulse 2s ease-in-out infinite;
}

.slot-error {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.4);
}

.slot-done {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.4);
}

@keyframes slot-pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.7;
  }
}

/* ─── Agent Progress Bar ─── */
.agent-progress-bar {
  height: 4px;
  background: #21262d;
  border-radius: var(--radius-full);
  overflow: hidden;
}

.agent-progress-bar-fill {
  height: 100%;
  background: var(--gradient-progress, linear-gradient(90deg, #3b82f6, #8b5cf6));
  border-radius: var(--radius-full);
  width: 100%;
}

.agent-progress-pulse {
  animation: agent-progress-indeterminate 1.5s ease-in-out infinite;
}

@keyframes agent-progress-indeterminate {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(100%);
  }
}

/* ─── Agent Duration Indicator ─── */
.agent-duration {
  font-size: 11px;
  color: var(--text-hint);
  font-variant-numeric: tabular-nums;
}

/* ─── Workspace Viewer ─── */
.workspace-viewer {
  background: var(--bg-card);
  border-radius: var(--radius-lg, 12px);
  overflow: hidden;
  border: 1px solid var(--border);
}

.workspace-log {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: "IBM Plex Mono", "JetBrains Mono", "Fira Code", monospace;
  font-size: 12px;
  line-height: 1.5;
  padding: 12px;
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  box-shadow: inset 0 0 20px rgba(1, 4, 9, 0.4);
}

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

.workspace-controls {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
}

.workspace-controls .input {
  flex: 1;
}

.workspace-tabs {
  margin: 12px 16px 0;
}

.workspace-context .card {
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.workspace-diff {
  font-size: 11px;
  margin: 8px 0 0;
  white-space: pre-wrap;
  color: var(--text-secondary);
  overflow-x: auto;
}

.mono {
  font-family: "IBM Plex Mono", "JetBrains Mono", "Fira Code", monospace;
  font-size: 12px;
}

.branch-row {
  width: 100%;
  text-align: left;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-bottom: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  color: var(--text-primary);
  font: inherit;
  outline: none;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.branch-row:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}

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

.branch-raw {
  font-size: 11px;
  color: var(--text-hint);
}

/* ─── Dispatch Card ─── */
.dispatch-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dispatch-section .input-row {
  margin-bottom: 0;
}

/* ─── Responsive ─── */
@media (max-width: 380px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

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

@media (min-width: 600px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .modal-content {
    border-radius: var(--radius-xl);
    margin-bottom: 24px;
    /* floating above baseline on tablet/desktop */
  }

  .modal-overlay {
    align-items: center;
  }
}

@media (min-width: 900px) {
  .modal-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 20px;
  }

  .modal-form-span {
    grid-column: span 2;
  }
}

@media (min-width: 520px) {
  .quick-actions-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 768px) {
  .card {
    padding: 20px;
    margin-bottom: 16px;
  }

  .stat-card {
    padding: 18px 16px;
  }

  .stats-grid {
    gap: 12px;
    margin-bottom: 16px;
  }

  .task-card {
    padding: 18px;
    margin-bottom: 12px;
  }

  .list-item {
    padding: 14px 0;
  }

  .empty-state {
    padding: 60px 24px;
  }

  .modal-content {
    max-width: 600px;
  }

  .chip {
    padding: 8px 16px;
    font-size: 13px;
  }

  .search-input-wrap {
    max-width: 480px;
  }

  .slot-grid {
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: 10px;
  }

  .quick-actions-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* ─── Quick Action Buttons ─── */
.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs, 4px);
  padding: var(--space-md, 14px) var(--space-sm, 8px);
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
}

.quick-action-btn:active {
  transform: scale(0.93);
  background: var(--bg-card-hover);
}

.quick-action-btn:hover {
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
}

.quick-action-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.quick-action-icon {
  font-size: 22px;
  line-height: 1;
}

.quick-action-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ─── Dashboard (Pulse) Redesign ─── */
.dashboard-shell {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
  min-width: 0;
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

.dashboard-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 32px 40px;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.dashboard-header::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 50% 0%, rgba(218, 119, 86, 0.15), transparent 50%);
  pointer-events: none;
  z-index: -1;
}

.dashboard-eyebrow {
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  opacity: 0.9;
  margin-bottom: 4px;
}

.dashboard-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-bright);
  font-family: "SF Pro Display", "SF Pro Text", "Helvetica Neue", var(--font-ui);
  margin-bottom: 4px;
}

.dashboard-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 400;
}

.dashboard-header-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
}

.dashboard-chip {
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  backdrop-filter: blur(10px);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.dashboard-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.dashboard-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
}

.dashboard-card .card-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.dashboard-card-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dashboard-title-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  color: var(--accent);
  background: rgba(218, 119, 86, 0.1);
  padding: 4px;
  border-radius: 6px;
}

.dashboard-title-icon svg {
  width: 100%;
  height: 100%;
}

.dashboard-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.dashboard-status-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.dashboard-status-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-bright);
}

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

.dashboard-health-item {
  padding: 20px;
  border-radius: 20px;
  background: var(--bg-surface, rgba(255, 255, 255, 0.06));
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.dashboard-health-item:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 100%);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.dashboard-health-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

.dashboard-health-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary); /* was --text-bright; --text-primary respects Telegram theme vars */
  margin-top: 8px;
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}

.dashboard-health-progress {
  margin-top: 20px;
}

.dashboard-progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.dashboard-inline-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.dashboard-btn {
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 10px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.dashboard-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

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

.dashboard-metric {
  padding: 20px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 100%);
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.dashboard-metric:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 100%);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.dashboard-metric-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.dashboard-metric-value {
  font-size: 32px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  letter-spacing: -0.03em;
}

.dashboard-metric-value .stat-trend {
  margin-top: 0;
}

.dashboard-metric-spark {
  margin-top: 12px;
  opacity: 0.8;
}

.dashboard-work-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.dashboard-work-list {
  display: grid;
  gap: 10px;
}

.dashboard-work-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 100%);
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.dashboard-work-item:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 100%);
  transform: translateX(4px);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.dashboard-work-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.dashboard-work-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: 0 0 12px currentColor;
}

.dashboard-work-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.dashboard-work-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-bright);
  font-family: var(--font-mono);
}

.dashboard-work-chart {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 100%);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.dashboard-work-meta {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
}

.dashboard-alerts-wrap {
  display: grid;
  gap: 16px;
}

.dashboard-alert-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 100%);
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.dashboard-alert-item:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 100%);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.dashboard-alert-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.dashboard-alert-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.dashboard-alert-dot.error {
  background: var(--color-error);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
}

.dashboard-alert-dot.warning {
  background: var(--color-inreview);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}

.dashboard-alert-dot.ok {
  background: var(--color-done);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
}

.dashboard-alert-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-bright);
}

.dashboard-alert-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.dashboard-alert-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-bright);
  font-family: var(--font-mono);
}

.dashboard-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.dashboard-action-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  padding: 20px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 100%);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  text-align: left;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.dashboard-action-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--qa-color, var(--accent));
  opacity: 0.8;
  transition: height 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.dashboard-action-btn:hover {
  transform: translateY(-4px) scale(1.02);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.dashboard-action-btn:hover::before {
  height: 6px;
}

.dashboard-action-btn:active {
  transform: translateY(0) scale(0.98);
}

.dashboard-action-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--qa-color, var(--accent));
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), background 0.3s ease;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.dashboard-action-icon svg {
  width: 1em;
  height: 1em;
  max-width: 100%;
  max-height: 100%;
  display: block;
  flex: none;
}

.dashboard-action-btn:hover .dashboard-action-icon {
  transform: scale(1.1) rotate(5deg);
  background: rgba(255, 255, 255, 0.1);
}

.dashboard-action-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-bright);
  letter-spacing: 0.02em;
}

.dashboard-project-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 8px;
}

.dashboard-project-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.dashboard-project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.dashboard-project-item {
  padding: 16px 20px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 100%);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.dashboard-project-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

.dashboard-project-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-bright);
  margin-top: 8px;
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}

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

.dashboard-quality-item {
  padding: 20px 16px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 100%);
  text-align: center;
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.dashboard-quality-item:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 100%);
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.dashboard-quality-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: -0.03em;
  font-family: var(--font-mono);
}

.dashboard-quality-item.tone-good .dashboard-quality-value {
  color: var(--color-done);
}

.dashboard-quality-item.tone-warn .dashboard-quality-value {
  color: var(--color-inreview);
}

.dashboard-quality-item.tone-error .dashboard-quality-value {
  color: var(--color-error);
}

.dashboard-quality-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-top: 8px;
}

.dashboard-quality-item.tone-good {
  border-color: rgba(16, 185, 129, 0.2);
  background: rgba(16, 185, 129, 0.05);
}

.dashboard-quality-item.tone-warn {
  border-color: rgba(245, 158, 11, 0.2);
  background: rgba(245, 158, 11, 0.05);
}

.dashboard-quality-item.tone-error {
  border-color: rgba(239, 68, 68, 0.2);
  background: rgba(239, 68, 68, 0.05);
}

.dashboard-activity .list-item {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  margin-bottom: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, rgba(255, 255, 255, 0.0) 100%);
  border: 1px solid transparent;
}

.dashboard-activity .list-item:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 100%);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateX(4px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.dashboard-activity .list-item-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-bright);
  letter-spacing: 0.01em;
}

.dashboard-activity .badge {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 8px;
  font-weight: 600;
}

@media (min-width: 600px) {
  .dashboard-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .dashboard-work-layout {
    grid-template-columns: 1.2fr 0.8fr;
    align-items: center;
  }
}

@media (max-width: 599px) {
  .dashboard-shell {
    gap: 16px;
    padding: 8px 0 16px;
  }

  .dashboard-header {
    padding: 22px 20px;
    border-radius: 20px;
    gap: 14px;
  }

  .dashboard-title {
    font-size: 22px;
    line-height: 1.1;
  }

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

  .dashboard-header-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    margin-top: 0;
  }

  .dashboard-chip {
    display: flex;
    align-items: center;
    min-height: 38px;
    padding: 6px 10px;
    font-size: 11px;
    line-height: 1.35;
    white-space: normal;
  }

  .dashboard-chip-clock {
    grid-column: 1 / -1;
    justify-content: space-between;
  }

  .dashboard-chip-tz {
    flex-shrink: 0;
  }

  .dashboard-grid {
    gap: 16px;
  }

  .dashboard-card {
    border-radius: 18px;
  }
}

@media (max-width: 480px) {
  .dashboard-shell {
    gap: 14px;
    padding: 6px 0 14px;
  }

  .dashboard-header-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .dashboard-card {
    padding: 16px;
    border-radius: 16px;
  }

  .dashboard-actions-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .dashboard-action-btn {
    min-height: 108px;
    padding: 14px;
    border-radius: 14px;
  }
}

@media (min-width: 760px) {
  .dashboard-grid {
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  }

  .dashboard-activity {
    grid-column: 1 / -1;
  }
}

/* ─── Command History Dropdown ─── */
.cmd-history-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  z-index: 9999;
  max-height: 200px;
  overflow-y: auto;
  margin-top: 4px;
}

.cmd-history-item {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: none;
  color: var(--text-primary);
  font-size: 13px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.cmd-history-item:hover {
  background: var(--accent-subtle);
}

.cmd-history-item:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

/* ─── Health Dot (Infra) ─── */
.health-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  vertical-align: middle;
}

/* ─── Task Card States ─── */
.task-card-selected {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.06);
}

.task-card-expanded {
  border-color: var(--border-strong);
}

.task-card-enter {
  animation: fadeSlideUp 0.2s ease;
}

.task-checkbox {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-right: var(--space-sm, 8px);
  cursor: pointer;
}

/* ─── Batch Action Bar ─── */
.batch-action-bar {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: var(--space-sm, 8px) var(--space-md, 12px);
  align-items: center;
  border: 1px solid var(--border);
}

/* ─── Sticky Search ─── */
.sticky-search {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg-primary);
  padding: 8px 0 12px;
  margin-bottom: var(--space-sm, 8px);
  border-bottom: 1px solid var(--border);
}

.sticky-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

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

.tasks-toolbar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

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

.tasks-toolbar-actions.compact {
  flex-direction: column;
  align-items: stretch;
  width: 100%;
}

.tasks-toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.tasks-toolbar-actions.compact .filter-toggle,
.tasks-toolbar-actions.compact .view-toggle,
.tasks-toolbar-actions.compact .btn-primary {
  flex: 1;
  justify-content: center;
}

.tasks-toolbar-actions.compact .actions-wrap {
  flex: 0 0 auto;
}

.tasks-toolbar-actions.compact .actions-btn {
  min-width: 44px;
  justify-content: center;
}

.tasks-toolbar-actions.compact .actions-label {
  display: none;
}

.actions-btn svg {
  width: 16px;
  height: 16px;
}

.filter-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

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

.filter-toggle.active {
  border-color: var(--accent);
}

.filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: var(--accent-text);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.tasks-filter-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transform: translateY(-4px);
  transition: max-height 0.25s ease, opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.tasks-filter-panel.open {
  max-height: 2000px;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.tasks-filter-grid {
  display: grid;
  gap: 12px;
}

.tasks-filter-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tasks-filter-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-hint);
}

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

.tasks-filter-panel .chip-group {
  margin-bottom: 0;
}

.sticky-search-main {
  flex: 1;
  min-width: 200px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
}

.actions-wrap,
.export-wrap {
  position: relative;
}

.filter-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--text-hint);
  font-size: 11px;
}

.filter-summary-text {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  color: var(--text-secondary);
}

.filter-summary-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

@media (max-width: 768px) {
  .tasks-toolbar-row {
    align-items: stretch;
  }

  .tasks-toolbar-actions {
    width: 100%;
  }

  .filter-toggle {
    flex: 1;
    justify-content: center;
  }

  .view-toggle {
    flex: 1;
    justify-content: center;
  }

  .tasks-filter-row {
    width: 100%;
  }

  .tasks-filter-row .input {
    flex: 1;
  }

  .sticky-search-main {
    min-width: 0;
  }

  .chip-group {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .chip {
    white-space: nowrap;
  }
}

@media (max-width: 640px) {
  .tasks-toolbar-actions.compact .tasks-toolbar-group--primary {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .tasks-toolbar-actions.compact .tasks-toolbar-group--secondary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
  }

  .tasks-filter-btn {
    width: 100%;
    justify-content: center;
  }

  .tasks-view-toggle {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .tasks-view-toggle .MuiToggleButton-root {
    min-width: 0;
    padding-left: 8px;
    padding-right: 8px;
    font-size: 12px;
    justify-content: center;
  }

  .tasks-actions-btn {
    min-width: 44px;
    justify-content: center;
  }

  .tasks-new-btn {
    flex: 1 1 auto;
    min-height: 40px;
    justify-content: center;
  }

  .tasks-new-btn svg {
    width: 16px;
    height: 16px;
  }

  .task-table-wrap {
    overflow: visible;
    border: none;
    background: transparent;
  }

  .task-table,
  .task-table tbody,
  .task-table tr,
  .task-table td {
    display: block;
    width: 100%;
  }

  .task-table thead {
    display: none;
  }

  .task-table tbody {
    display: grid;
    gap: 12px;
  }

  .task-tr {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--bg-card);
  }

  .task-tr[data-status="inprogress"],
  .task-tr[data-status="inreview"],
  .task-tr[data-status="done"],
  .task-tr[data-status="completed"],
  .task-tr[data-status="error"],
  .task-tr[data-status="failed"] {
    border-left-width: 1px;
  }

  .task-td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 0;
    border: none;
  }

  .task-td::before {
    flex: 0 0 64px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-hint);
  }

  .task-td-status::before {
    content: "Status";
  }

  .task-td-pri::before {
    content: "Priority";
  }

  .task-td-title {
    display: grid;
    gap: 4px;
  }

  .task-td-title::before {
    content: "Task";
  }

  .task-td-title > * {
    min-width: 0;
  }

  .task-td-title-text {
    font-size: 14px;
  }

  .task-td-id {
    word-break: break-all;
  }

  .task-td-branch,
  .task-td-repo,
  .task-td-updated {
    display: flex;
  }

  .task-td-branch::before {
    content: "Branch";
  }

  .task-td-repo::before {
    content: "Repo";
  }

  .task-td-updated::before {
    content: "Updated";
  }

  .task-td-code,
  .task-td-date {
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: right;
  }

  .pager {
    flex-direction: column;
    align-items: stretch;
  }

  .pager > * {
    width: 100%;
    justify-content: center;
  }

  .pager-info {
    text-align: center;
  }
}

/* ─── Sticky Controls ─── */
.sticky-controls {
  position: sticky;
  top: calc(var(--header-height) + 8px);
  z-index: 20;
  background: var(--bg-secondary);
  padding: 8px 0 10px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* ─── Control Unit (sticky) ─── */
.control-unit-card {
  position: relative;
  top: auto;
  z-index: auto;
  background: var(--bg-card);
}

.control-unit-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.control-unit-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 12px;
  color: var(--text-secondary);
}

.control-unit-meta strong {
  color: var(--text-bright);
  font-weight: 600;
}

.control-unit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

@media (min-width: 768px) {
  .control-unit-body {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

/* ─── Toggle Label ─── */
.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs, 4px);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

/* ─── Settings Row ─── */
.settings-row {
  display: flex;
  align-items: center;
  gap: var(--space-md, 12px);
}

/* ─── Log Box Small ─── */
.log-box-sm {
  max-height: 120px;
  font-size: 10px;
}

/* ─── Worktree Detail ─── */
.wt-detail {
  padding: var(--space-sm, 8px) 0;
}

/* ─── ListItem extensions ─── */
.list-item-body {
  flex: 1;
  min-width: 0;
}

.list-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

.list-item-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 1px;
  line-height: 1.4;
}

.list-item-clickable {
  cursor: pointer;
  transition: background var(--transition-fast);
}

.list-item-clickable:active {
  background: var(--bg-card-hover);
}

.list-item-icon {
  width: 20px;
  height: 20px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

/* ─── Toast extensions ─── */
.toast-message {
  flex: 1;
}

.toast-close {
  border: none;
  background: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 18px;
  cursor: pointer;
  padding: 0 0 0 8px;
  line-height: 1;
}

.toast-close:hover {
  color: #fff;
}

/* ─── Spinner ─── */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.spinner {
  animation: spin 0.8s linear infinite;
}

.btn-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.7;
}

.btn-loading .spinner {
  display: inline-block;
  vertical-align: middle;
}

/* ─── Stat trend colors ─── */
.stat-trend.up,
.stat-trend-up {
  color: var(--accent-success, var(--color-done));
}

.stat-trend.down,
.stat-trend-down {
  color: var(--accent-error, var(--color-error));
}

/* ─── Input small variant ─── */
.input-sm {
  min-height: 36px;
  padding: 6px 10px;
  font-size: 13px;
}

/* ─── Modal swipe-to-dismiss ─── */
.modal-content {
  transition: transform 0.3s cubic-bezier(0.2, 0, 0, 1), opacity 0.3s ease, margin-bottom 0.15s ease;
  will-change: transform, opacity;
  touch-action: pan-y;
  overscroll-behavior: contain;
}

.modal-content.modal-dragging {
  transition: none;
}

.modal-content.modal-dragging .modal-body {
  overflow-y: hidden;
  /* freeze inner scroll while drag-dismissing */
}

/* ─── ConfirmDialog ─── */
.confirm-dialog {
  background: var(--bg-elevated);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  width: calc(100% - 48px);
  max-width: 340px;
  padding: 24px;
  animation: scaleIn 0.2s ease;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  text-align: center;
  margin: auto;
}

.confirm-dialog-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.confirm-dialog-message {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 20px;
}

.confirm-dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.confirm-dialog-actions .btn {
  flex: 1;
  min-height: 40px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: none;
}

.confirm-dialog-actions .btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.confirm-dialog-actions .btn-destructive {
  background: var(--destructive);
  color: #fff;
}

/* ─── Shared Save/Discard Bar ─── */
.ve-save-discard-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
}

.ve-save-discard-message {
  font-size: 12px;
  color: var(--text-secondary);
}

.ve-save-discard-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* ─── Toggle disabled ─── */
.toggle-wrap.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.toggle.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ─── SegmentedControl disabled ─── */
.segmented-control.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.segmented-control.disabled .segmented-btn {
  cursor: not-allowed;
}

/* ─── Stepper disabled ─── */
.stepper.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.stepper.disabled .stepper-btn {
  cursor: not-allowed;
  color: var(--text-hint);
}

.stepper-wrap.disabled {
  opacity: 0.4;
}

/* ─── SearchInput disabled ─── */
.search-input-wrap.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.search-input-wrap.disabled .search-input {
  cursor: not-allowed;
}

/* ─── Fleet Layout (Agents Tab) ─── */
.fleet-layout {
  display: grid;
  gap: 16px;
}

.fleet-span {
  grid-column: 1 / -1;
}

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

.fleet-fullview-card {
  width: 100%;
}

.fleet-fullview {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
}

.fleet-slot-rail {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
}

.fleet-session-scope {
  display: flex;
  gap: 6px;
  margin-bottom: 2px;
}

.fleet-session-scope-btn {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  cursor: pointer;
}

.fleet-session-scope-btn.active {
  color: var(--text-primary);
  border-color: color-mix(in srgb, var(--color-accent, #3b82f6) 45%, var(--border));
  background: color-mix(in srgb, var(--color-accent, #3b82f6) 16%, var(--bg-secondary));
}

.fleet-slot-item {
  width: 100%;
  text-align: left;
}

.fleet-slot-item.history {
  opacity: 0.96;
}

.fleet-fullview {
  /* Constrain the grid height so the chat scrollbar stays inside the panel
     instead of pushing the entire page.  The grid children use flex/overflow
     to fill this bounded container. */
  height: calc(100vh - 260px);
  min-height: 420px;
  max-height: calc(100vh - 180px);
}

.fleet-session-detail {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.fleet-session-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ChatView inside fleet session body must fill available space */
.fleet-session-body > .chat-view,
.fleet-session-body > .chat-view-embedded {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Constrain the fleet log viewer similarly */
.fleet-session-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.fleet-overview-card {
  /* clean — no gradient */
}

.fleet-hero {
  display: grid;
  gap: 16px;
}

.fleet-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

.fleet-health-value {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 600;
  margin-top: 6px;
}

.fleet-health-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.02);
}

.fleet-subtext {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.fleet-alert {
  margin-top: 8px;
  font-size: 12px;
  color: var(--color-error);
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  padding: 6px 8px;
  border-radius: var(--radius-md);
}

.fleet-capacity-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-top: 6px;
}

.fleet-capacity-divider {
  color: var(--text-hint);
  margin: 0 4px;
}

.fleet-capacity-bar {
  margin-top: 10px;
}

.fleet-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.fleet-metric {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.fleet-metric-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

.fleet-metric-value {
  font-size: 18px;
  font-weight: 700;
  margin-top: 6px;
}

.fleet-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.fleet-agent-card {
  border-left: 3px solid rgba(59, 130, 246, 0.35);
}

.fleet-slotmap-card .slot-grid {
  margin-top: 4px;
}

@media (min-width: 720px) {
  .fleet-hero {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  }
}

@media (min-width: 900px) {
  .fleet-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .fleet-fullview {
    grid-template-columns: 1fr;
  }
}

/* ─── Control Layout (Control Tab) ─── */
.control-layout {
  display: grid;
  gap: 16px;
}

.control-main,
.control-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}

.control-main .card,
.control-side .card {
  overflow: visible;
}

.control-hero {
  /* clean — no gradient */
}

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

.control-hero-title {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.control-hero-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
}

.control-hero-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
}

.control-hero-mode {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-primary);
}

.control-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.control-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.control-meta-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-size: 12px;
  color: var(--text-secondary);
}

.control-meta-label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 10px;
  font-weight: 600;
}

.control-meta-value {
  font-weight: 600;
  color: var(--text-primary);
}

.cmd-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.cmd-input-wrap {
  position: relative;
  flex: 1;
}

.cmd-input {
  font-family: "SF Mono", "Fira Code", "IBM Plex Mono", monospace;
}

.cmd-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-height: 240px;
  overflow-y: auto;
  z-index: 9999;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.35);
}

.cmd-dropdown-item {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cmd-dropdown-item.selected {
  background: rgba(59, 130, 246, 0.2);
}

.cmd-dropdown-item:hover {
  background: rgba(59, 130, 246, 0.15);
}

.cmd-item-title {
  font-weight: 600;
  color: #e2e8f0;
}

.cmd-item-desc {
  margin-left: 8px;
  color: #94a3b8;
  font-size: 0.85em;
}

.cmd-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.cmd-running-indicator {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 12px;
}

.cmd-running-indicator code {
  color: var(--text-primary);
}

.cmd-running-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #facc15;
  animation: cmdPulse 1s infinite;
}

@keyframes cmdPulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

.cmd-output-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cmd-output-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
}

.cmd-output-toggle {
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

.cmd-output-title code {
  color: var(--accent);
}

.cmd-output-time {
  color: var(--text-hint);
  font-size: 11px;
}

.cmd-output-panel {
  margin-top: 0;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 0 0 8px 8px;
  padding: 8px 12px;
  font-family: monospace;
  font-size: 12px;
  color: #4ade80;
  max-height: 220px;
  overflow-y: auto;
  white-space: pre-wrap;
}

.agent-control-grid {
  display: grid;
  gap: 14px;
}

.quick-commands-link {
  color: var(--tg-theme-link-color, #4ea8d6);
  text-decoration: underline;
  cursor: pointer;
}

@media (min-width: 720px) {
  .agent-control-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  .control-layout {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.9fr);
    align-items: start;
  }
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 6px;
  font-size: 1.1em;
  line-height: 0;
  vertical-align: middle;
  flex: none;
}

.btn-icon svg {
  width: 1em;
  height: 1em;
  max-width: 100%;
  max-height: 100%;
  display: block;
  flex: none;
}

/* ═══════════════════════════════════════════════
 *  Snapshot Bar  (replaces Work Summary card)
 * ═══════════════════════════════════════════════ */

.snapshot-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  padding: 6px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  font-size: 12px;
  min-height: 36px;
}

.snapshot-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px 2px 6px;
  border-radius: 99px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
}

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

.snapshot-val {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text-primary);
}

.snapshot-lbl {
  color: var(--text-muted);
  font-size: 11px;
}

.snapshot-view-tag {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-hint);
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════
 *  Task Table  (Jira-style list mode)
 * ═══════════════════════════════════════════════ */

.task-table-wrap {
  overflow-x: auto;
  margin-bottom: 8px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
}

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

/* Column widths via header cells */
.task-th:nth-child(1) {
  width: 120px;
}

/* Status */
.task-th:nth-child(2) {
  width: 76px;
}

/* Priority */
.task-th:nth-child(3) {}

/* Title — flex grows */
.task-th:nth-child(4) {
  width: 140px;
}

/* Branch */
.task-th:nth-child(5) {
  width: 110px;
}

/* Repo */
.task-th:nth-child(6) {
  width: 90px;
}

/* Updated */

.task-th {
  padding: 9px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-hint);
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: color 0.1s, background 0.1s;
}

.task-th:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.task-th-active {
  color: var(--accent);
}

.task-th-grow {
  width: auto;
}

.task-th-arrow {
  font-size: 10px;
  opacity: 0.5;
  margin-left: 2px;
}

.task-th-arrow.active {
  opacity: 1;
  color: var(--accent);
}

.task-tr {
  cursor: pointer;
  transition: background 0.1s;
  border-bottom: 1px solid var(--border);
}

.task-tr:last-child {
  border-bottom: none;
}

.task-tr:hover {
  background: var(--bg-card-hover);
}

.task-tr[data-status="inprogress"] {
  border-left: 3px solid var(--color-inprogress);
}

.task-tr[data-status="inreview"] {
  border-left: 3px solid var(--color-inreview);
}

.task-tr[data-status="done"],
.task-tr[data-status="completed"] {
  border-left: 3px solid var(--color-done);
  opacity: 0.75;
}

.task-tr[data-status="error"],
.task-tr[data-status="failed"] {
  border-left: 3px solid var(--color-error);
}

.task-tr[data-status="todo"] {
  border-left: 3px solid var(--color-todo);
}

.task-tr-selected {
  background: var(--accent-subtle) !important;
}

.task-td {
  padding: 8px 12px;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
}

.task-td-status {
  display: table-cell;
  white-space: nowrap;
}

.task-td-title {
  white-space: normal;
}

.task-td-title-text {
  font-weight: 500;
  line-height: 1.35;
  color: var(--text-primary);
  word-break: break-word;
}

.task-td-id {
  font-size: 10px;
  color: var(--text-hint);
  margin-top: 2px;
  font-family: var(--font-mono, monospace);
}

.task-td-branch .task-td-code,
.task-td-code {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  max-width: 150px;
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

.task-td-repo {
  font-size: 12px;
  color: var(--text-muted);
}

.task-td-date {
  font-size: 11px;
  color: var(--text-hint);
  white-space: nowrap;
}

.task-td-updated {
  white-space: nowrap;
}

.task-td-empty {
  color: var(--text-hint);
  font-size: 12px;
}

@media (max-width: 640px) {

  .task-th:nth-child(4),
  .task-th:nth-child(5) {
    display: none;
  }
}

/* ═══════════════════════════════════════════════
 *  Workspace Manager modal toolbar
 * ═══════════════════════════════════════════════ */

.ws-manager-modal-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

/* ═══════════════════════════════════════════════
 *  Plan chips + inline count
 * ═══════════════════════════════════════════════ */

.plan-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.plan-count-input {
  display: inline-block;
  width: 3.2rem;
  padding: 1px 6px;
  margin: 0 4px;
  text-align: center;
  vertical-align: baseline;
  font-size: inherit;
}

/* ═══════════════════════════════════════════════
 *  Tab transition animations
 * ═══════════════════════════════════════════════ */

@keyframes tabFadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

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

.tab-content-enter {
  animation: tabFadeSlideIn 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* ═══════════════════════════════════════════════
 *  Top loading bar
 * ═══════════════════════════════════════════════ */

.top-loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  z-index: 99999;
  background: linear-gradient(90deg, var(--accent), #8b5cf6);
  transition: width 0.3s ease, opacity 0.4s ease;
  pointer-events: none;
  border-radius: 0 2px 2px 0;
}

/* ═══════════════════════════════════════════════
 *  Dashboard headline variants
 * ═══════════════════════════════════════════════ */

.dashboard-headline-ok {
  color: var(--color-done);
}

.dashboard-headline-warn {
  color: var(--color-inreview);
}

.dashboard-headline-error {
  color: var(--color-error);
}

.dashboard-headline-idle {
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════
 *  Fleet ticker
 * ═══════════════════════════════════════════════ */

.fleet-ticker-wrap {
  overflow: hidden;
  position: relative;
  height: 20px;
}

@keyframes tickerScroll {
  0% {
    transform: translateY(0);
  }

  33% {
    transform: translateY(-20px);
  }

  66% {
    transform: translateY(-40px);
  }

  100% {
    transform: translateY(0);
  }
}

.fleet-ticker-inner {
  display: flex;
  flex-direction: column;
  animation: tickerScroll 6s steps(1) infinite;
}

.fleet-ticker-item {
  height: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ═══════════════════════════════════════════════
 *  Tab Error Boundary improvements
 * ═══════════════════════════════════════════════ */

.tab-error-boundary {
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.tab-error-pulse {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: errorPulse 2s ease-in-out infinite;
}

@keyframes errorPulse {

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

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

.tab-error-stack {
  max-height: 120px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 8px 12px;
  font-family: monospace;
  font-size: 11px;
  color: var(--text-secondary);
  text-align: left;
  width: 100%;
  box-sizing: border-box;
}

/* ═══════════════════════════════════════════════
 *  Offline banner — pulsing reconnect dot
 * ═══════════════════════════════════════════════ */

.offline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  animation: offlinePulse 1.6s ease-in-out infinite;
}

.offline-dot.orange {
  background: #f97316;
}

.offline-dot.red {
  background: #ef4444;
}

@keyframes offlinePulse {

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

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

/* ═══════════════════════════════════════════════
 *  Dashboard — hero "Fleet at rest" badge
 * ═══════════════════════════════════════════════ */

.fleet-rest-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 0 8px;
  text-align: center;
}

.fleet-rest-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--color-done);
}

.fleet-rest-icon svg {
  width: 1em;
  height: 1em;
  max-width: 100%;
  max-height: 100%;
  display: block;
  flex: none;
}

.fleet-rest-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-done);
}

.fleet-rest-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════
 *  Dashboard welcome card
 * ═══════════════════════════════════════════════ */

.dashboard-welcome-card {
  text-align: center;
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.dashboard-welcome-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 52px;
  line-height: 1;
  margin-bottom: 8px;
}

.dashboard-welcome-icon svg {
  width: 1em;
  height: 1em;
  max-width: 100%;
  max-height: 100%;
  display: block;
  flex: none;
}

.dashboard-welcome-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.dashboard-welcome-desc {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 340px;
  line-height: 1.6;
}

/* ═══════════════════════════════════════════════
 *  Nav Badges
 * ═══════════════════════════════════════════════ */

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--accent);
  color: var(--accent-text, #fff);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  position: absolute;
  top: 2px;
  right: 2px;
}

/* ═══════════════════════════════════════════════
 *  Dashboard Clock Chip
 * ═══════════════════════════════════════════════ */

.dashboard-chip-clock {
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono, monospace);
}

.dashboard-chip-tz {
  font-size: 10px;
  opacity: 0.7;
  margin-left: 4px;
}

/* ═══════════════════════════════════════════════
 *  Dashboard Health Score
 * ═══════════════════════════════════════════════ */

.dashboard-health-score {
  text-align: center;
  padding: 12px 0;
}

.health-score-value {
  font-size: 48px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.05em;
  font-family: var(--font-mono, monospace);
}

.health-score-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ═══════════════════════════════════════════════
 *  Dashboard Recent Commits
 * ═══════════════════════════════════════════════ */

.dashboard-commits {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dashboard-commit-item {
  display: grid;
  grid-template-columns: 56px 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-secondary, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--border);
}

.dashboard-commit-hash {
  grid-row: 1 / 3;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
  align-self: center;
  letter-spacing: 0.03em;
}

.dashboard-commit-msg {
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-commit-meta {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ═══════════════════════════════════════════════
 *  Stat Flash Animation
 * ═══════════════════════════════════════════════ */

@keyframes statFlash {
  0% {
    background: rgba(59, 130, 246, 0.15);
  }

  100% {
    background: transparent;
  }
}

.stat-flash {
  animation: statFlash 0.4s ease;
}

/* ═══════════════════════════════════════════════
 *  Keyboard Shortcuts Modal
 * ═══════════════════════════════════════════════ */

.shortcuts-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 0;
}

.shortcut-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

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

.shortcut-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--surface-secondary, rgba(255, 255, 255, 0.06));
  border: 1px solid var(--border);
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.shortcut-desc {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ─────────────────────────────────────────────────────────────
 *  Voice-to-Text & AI Task Rewrite
 * ────────────────────────────────────────────────────────────── */

/* ── Task Rewrite (Improve with AI) button ── */
.task-rewrite-btn {
  color: var(--accent, #da7756);
  border: 1px solid transparent;
  border-radius: var(--radius-full, 999px);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.task-rewrite-btn:hover:not(:disabled) {
  background: var(--accent-soft, rgba(218, 119, 86, 0.10));
  border-color: var(--accent, #da7756);
}

.task-rewrite-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ── Input with inline mic button ── */
.input-with-mic {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-mic .input {
  padding-right: 40px !important;
  flex: 1;
}

.mic-btn-inline {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: var(--text-hint, #888);
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  padding: 0;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  z-index: 1;
}

.mic-btn-inline:hover:not(:disabled) {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.18);
}

.mic-btn-inline.listening {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.45);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
  animation: micPulse 1.2s ease-in-out infinite;
}

.mic-btn-inline:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ── Textarea with mic button overlaid ── */
.textarea-with-mic {
  position: relative;
}

.textarea-with-mic .textarea-mic-btn {
  position: absolute !important;
  right: 6px !important;
  top: 8px !important;
  width: 26px !important;
  height: 26px !important;
  font-size: 13px !important;
}

/* ── Mic button base (injected by voice.js too, duplicated here as fallback) ── */
@keyframes micPulse {

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

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

/* ── Task Detail — Jira-style layout ──────────────────────── */

/* Breadcrumb bar */
.task-detail-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-hint, #8b949e);
  padding: 12px 24px 0;
}
.task-detail-breadcrumb a, .task-detail-breadcrumb span {
  color: var(--text-hint, #8b949e);
  text-decoration: none;
}
.task-detail-breadcrumb a:hover { color: var(--accent, #60a5fa); }

/* Title area — large inline-editable title */
.task-detail-title-area {
  padding: 4px 24px 12px;
}
.task-detail-title-input {
  width: 100%;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.4;
  background: transparent;
  border: none;
  color: var(--color-text, #e6edf3);
  outline: none;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: border-color 0.15s;
}
.task-detail-title-input:focus {
  border-bottom-color: var(--accent, #60a5fa);
}

/* Status transition button (like Jira's blue button) */
.task-status-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: none;
  cursor: pointer;
  transition: filter 0.12s;
}
.task-status-btn:hover { filter: brightness(1.15); }
.task-status-btn[data-status="todo"] { background: #388bfd30; color: #58a6ff; }
.task-status-btn[data-status="inprogress"] { background: #3b82f6; color: #fff; }
.task-status-btn[data-status="inreview"] { background: #a855f7; color: #fff; }
.task-status-btn[data-status="done"] { background: #22c55e; color: #fff; }
.task-status-btn[data-status="cancelled"] { background: #6b728020; color: #9ca3af; }
.task-status-btn[data-status="error"] { background: #ef4444; color: #fff; }
.task-status-btn[data-status="draft"] { background: #6b728030; color: #9ca3af; }

/* Action icon buttons */
.task-action-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border, #30363d);
  background: transparent;
  color: var(--text-secondary, #8b949e);
  cursor: pointer;
  font-size: 14px;
  transition: background 0.12s, color 0.12s;
}
.task-action-icon-btn:hover {
  background: var(--bg-card-hover, #161b22);
  color: var(--color-text, #e6edf3);
}

/* Tab bar (Jira style) */
.task-tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border, #30363d);
  padding: 0 24px;
  background: var(--bg-surface, #0d1117);
}
.task-tab-btn {
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary, #8b949e);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.12s, border-color 0.12s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.task-tab-btn:hover { color: var(--color-text, #e6edf3); }
.task-tab-btn[data-active="true"] {
  color: var(--accent, #60a5fa);
  border-bottom-color: var(--accent, #60a5fa);
  font-weight: 600;
}
.task-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--bg-card-hover, #21262d);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary, #8b949e);
}

/* Two-column details layout */
.task-detail-columns {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 0;
  min-height: 0;
}
.task-detail-main {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.task-detail-sidebar {
  padding: 16px 20px;
  border-left: 1px solid var(--border, #30363d);
  background: var(--bg-surface, #0d1117);
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Sidebar field rows (Jira detail panel) */
.task-sidebar-field {
  display: flex;
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border, #30363d) 40%, transparent);
  gap: 12px;
}
.task-sidebar-field:last-child { border-bottom: none; }
.task-sidebar-label {
  flex-shrink: 0;
  width: 90px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-hint, #8b949e);
  padding-top: 6px;
}
.task-sidebar-value {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--color-text, #e6edf3);
}

/* Section headers inside main content */
.task-section {
  border: 1px solid var(--border, #30363d);
  border-radius: 8px;
  overflow: hidden;
}
.task-section-title {
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-hint, #8b949e);
  background: var(--bg-surface, #0d1117);
  border-bottom: 1px solid var(--border, #30363d);
  display: flex;
  align-items: center;
  gap: 8px;
}
.task-section-body {
  padding: 14px;
}

.task-blocked-banner {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid rgba(248, 113, 113, 0.28);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(248, 113, 113, 0.14), rgba(245, 158, 11, 0.08)),
    var(--bg-card, #161b22);
}

.task-blocked-banner[data-category="dependency_blocked"],
.task-blocked-banner[data-category="start_guard_blocked"] {
  border-color: rgba(251, 191, 36, 0.28);
  background:
    linear-gradient(135deg, rgba(251, 191, 36, 0.14), rgba(245, 158, 11, 0.08)),
    var(--bg-card, #161b22);
}

.task-blocked-banner-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary, #f8fafc);
}

.task-blocked-banner-copy {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary, #c9d1d9);
}

.task-workflow-run-card[data-clickable="true"] {
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}

.task-workflow-run-card[data-clickable="true"]:hover,
.task-workflow-run-card[data-clickable="true"]:focus-visible {
  border-color: var(--accent, #3b82f6);
  background: rgba(59, 130, 246, 0.08);
  transform: translateY(-1px);
  outline: none;
}

.task-workflow-run-head {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: flex-start;
}

.task-workflow-run-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Priority dot */
.task-priority-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.task-priority-dot[data-priority="critical"] { background: #ef4444; }
.task-priority-dot[data-priority="high"] { background: #f97316; }
.task-priority-dot[data-priority="medium"] { background: #eab308; }
.task-priority-dot[data-priority="low"] { background: #6b7280; }

/* Timestamps */
.task-timestamps {
  padding: 12px 0 4px;
  border-top: 1px solid var(--border, #30363d);
  margin-top: 8px;
}
.task-timestamp-row {
  font-size: 11px;
  color: var(--text-hint, #8b949e);
  padding: 2px 0;
}

/* Save bar at bottom of sidebar */
.task-save-bar {
  padding: 12px 0;
  border-top: 1px solid var(--border, #30363d);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: auto;
}

/* Responsive */
@media (max-width: 900px) {
  .task-detail-columns {
    grid-template-columns: 1fr;
  }
  .task-detail-sidebar {
    border-left: none;
    border-top: 1px solid var(--border, #30363d);
  }
}

/* ── Chat input wrapper: accommodate mic btn ── */
.chat-input-wrapper .mic-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: var(--text-hint, #888);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  padding: 0;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.chat-input-wrapper .mic-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.chat-input-wrapper .mic-btn.listening {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
  animation: micPulse 1.2s ease-in-out infinite;
}

.chat-input-wrapper .mic-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ═══════════════════════════════════════════════
 *  Desktop Premium Density Overrides
 * ═══════════════════════════════════════════════ */
@media (min-width: 1200px) {

  /* Cards */
  .card {
    padding: 12px;
    margin-bottom: 10px;
  }

  .card-title {
    font-size: 13px;
    margin-bottom: 10px;
  }

  .card-subtitle {
    font-size: 12px;
    margin-bottom: 6px;
  }

  /* Stat Cards */
  .stat-card {
    padding: 12px 10px;
  }

  .stat-value {
    font-size: 22px;
  }

  .stat-label {
    font-size: 10px;
  }

  /* Task Cards */
  .task-card {
    padding: 10px 12px;
    margin-bottom: 6px;
  }

  .task-card-title {
    font-size: 13px;
    margin-bottom: 4px;
  }

  .task-card-meta {
    font-size: 11px;
  }

  /* Buttons */
  .btn {
    min-height: 32px;
    padding: 6px 12px;
    font-size: 12px;
  }

  .btn-sm {
    min-height: 26px;
    padding: 4px 10px;
    font-size: 11px;
  }

  /* Inputs */
  .input {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 13px;
  }

  textarea.input {
    min-height: 60px;
  }

  /* Chips & Pill filters */
  .chip {
    min-height: 26px;
    padding: 4px 10px;
    font-size: 11px;
  }

  .segmented-btn {
    min-height: 26px;
    padding: 4px 12px;
    font-size: 11px;
  }

  .badge {
    padding: 2px 8px;
    font-size: 10px;
  }
}

/* ════════════════════════════════════════════════════════════
 *  Task Progress Modal (.tp-*)
 * ════════════════════════════════════════════════════════════ */
.task-progress-modal .modal-body {
  padding: 0;
}

.tp-hero {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
}

.tp-pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-inprogress, #f59e0b);
  box-shadow: 0 0 0 0 var(--color-inprogress, #f59e0b);
  animation: tpPulse 1.8s ease-out infinite;
  flex-shrink: 0;
  margin-top: 5px;
}

@keyframes tpPulse {
  0%   { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7); }
  70%  { box-shadow: 0 0 0 8px rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

.tp-hero-title {
  flex: 1;
  min-width: 0;
}

.tp-hero-status-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-inprogress, #f59e0b);
  margin-bottom: 3px;
}

.tp-hero-task-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-bright);
  line-height: 1.35;
  margin: 0;
  word-break: break-word;
}

.tp-meta-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}

.tp-meta-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.tp-meta-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-hint);
}

.tp-meta-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.tp-meta-value.mono {
  font-family: var(--font-mono, monospace);
  font-size: 12px;
}

.tp-section {
  padding: 12px 20px;
}

.tp-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-hint);
  margin-bottom: 8px;
}

.tp-log-container {
  background: var(--bg-elevated, #111);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  max-height: 220px;
  overflow-y: auto;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.tp-log-line {
  white-space: pre-wrap;
  word-break: break-all;
}

.tp-log-empty,
.tp-log-loading {
  color: var(--text-hint);
  font-style: italic;
  text-align: center;
  padding: 16px 0;
}

.tp-health-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--bg-card-hover);
  overflow: hidden;
  margin-top: 4px;
}

.tp-health-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease;
}

.tp-actions {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
}

/* ════════════════════════════════════════════════════════════
 *  Task Review Modal (.tr-*)
 * ════════════════════════════════════════════════════════════ */
.task-review-modal .modal-body {
  padding: 0;
}

.tr-hero {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
}

.tr-review-icon {
  font-size: 22px;
  flex-shrink: 0;
  margin-top: 1px;
}

.tr-hero-title {
  flex: 1;
  min-width: 0;
}

.tr-hero-status-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-inreview, #6366f1);
  margin-bottom: 3px;
}

.tr-hero-task-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-bright);
  line-height: 1.35;
  margin: 0;
  word-break: break-word;
}

.tr-pr-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--accent-subtle);
  border: 1px solid var(--accent-soft, rgba(99,102,241,0.3));
  color: var(--accent);
  padding: 4px 10px;
  border-radius: var(--radius-lg);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

.tr-pr-badge:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.tr-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 24px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}

.tr-meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tr-meta-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-hint);
}

.tr-meta-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  word-break: break-word;
}

.tr-meta-value.mono {
  font-family: var(--font-mono, monospace);
  font-size: 12px;
}

.tr-section {
  padding: 12px 20px;
}

.tr-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-hint);
  margin-bottom: 8px;
}

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

.tr-check-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: var(--radius-lg);
}

.tr-check-item.pass {
  border-color: var(--color-done);
  color: var(--color-done);
}

.tr-check-item.fail {
  border-color: var(--color-error);
  color: var(--color-error);
}

.tr-check-item.pending {
  border-color: var(--border);
  color: var(--text-hint);
}

.tr-actions {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
}

.tr-actions .btn-primary {
  background: var(--color-inreview, #6366f1);
  border-color: var(--color-inreview, #6366f1);
}

/* ── Inline icon helpers ─────────────────────────────────────────────── */
.icon-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.icon-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.icon-inline svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.7;
}

/* ─── Reduced Motion ─── */
@media (prefers-reduced-motion: reduce) {
  /* Filter panel: skip max-height slide, just appear/disappear */
  .tasks-filter-panel {
    transition: opacity 0.1s ease !important;
  }

  /* Modal / sheet animations */
  .modal,
  .sheet,
  .more-sheet,
  .drawer {
    animation: none !important;
  }

  /* Skeleton pulse */
  .skeleton {
    animation: none !important;
    opacity: 0.4;
  }

  /* Toast animations */
  .toast {
    animation: none !important;
  }

  /* Button press scale */
  .btn:active,
  button:active {
    transform: none !important;
  }
}

.task-comment-composer {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
}

.task-dag-canvas-wrap {
  border: 1px solid var(--border);
  border-radius: 14px;
  background:
    radial-gradient(circle at 10% 20%, rgba(249, 115, 22, 0.12), transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(56, 189, 248, 0.08), transparent 40%),
    var(--bg-card);
  overflow: hidden;
  padding: 8px;
  min-height: 460px;
  touch-action: none;
  cursor: grab;
}

.task-dag-canvas-wrap.is-panning {
  cursor: grabbing;
}

.task-dag-canvas {
  width: 100%;
  min-width: 680px;
  height: 460px;
}

.task-dag-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.task-dag-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.task-dag-zoom-pill,
.task-dag-wire-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card-hover);
  padding: 3px 8px;
  font-size: 11px;
  color: var(--text-secondary);
}

.dag-node rect {
  transition: transform 0.15s ease, stroke 0.15s ease, filter 0.15s ease;
}

.dag-node:hover rect {
  stroke: var(--accent);
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.35));
}

.dag-node-selected rect {
  stroke: var(--accent);
  filter: drop-shadow(0 0 0 2px rgba(56, 189, 248, 0.25));
}

@media (max-width: 900px) {
  .task-comment-composer {
    grid-template-columns: 1fr;
  }
}

/* Jira-style Task Detail */
.task-detail-modal-jira .modal-body {
  max-height: min(82vh, calc(var(--viewport-height, 100dvh) - 140px));
}

.jira-task-summary {
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  margin-bottom: 10px;
}

.jira-task-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr);
  gap: 10px;
}

.jira-panel {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  padding: 10px;
}

.jira-panel-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-hint);
  margin-bottom: 8px;
}

.jira-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.task-dag-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.task-dag-legend-item {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-size: 11px;
  color: var(--text-secondary);
}

.task-dag-legend-line {
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.task-dag-legend-line-dashed {
  background: linear-gradient(to right, var(--color-warning) 60%, transparent 40%);
  background-size: 6px 2px;
}

.task-dag-legend-line-block {
  background: linear-gradient(to right, var(--color-error) 45%, transparent 45%);
  background-size: 4px 2px;
}

.task-dag-status-pill {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card-hover);
  font-size: 11px;
  color: var(--text-secondary);
}

@media (max-width: 980px) {
  .jira-task-layout {
    grid-template-columns: 1fr;
  }

  .jira-meta-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Full-screen task detail (premium) ─────────────────────── */
.modal-content.task-detail-fullscreen {
  max-width: 100%;
  width: 100%;
  height: 100%;
  border-radius: 0;
  margin: 0;
  max-height: 100dvh;
}

.task-detail-fullscreen .modal-body {
  max-height: calc(100dvh - 56px);
  padding: 0;
}

.task-fullscreen-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  grid-template-rows: auto 1fr;
  gap: 0;
  height: calc(100dvh - 56px);
  overflow: hidden;
}

.task-fullscreen-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}

.task-fullscreen-main {
  overflow-y: auto;
  padding: 20px 24px;
  scrollbar-width: thin;
}

.task-fullscreen-sidebar {
  overflow-y: auto;
  padding: 16px 20px;
  border-left: 1px solid var(--border);
  background: var(--bg-surface);
  scrollbar-width: thin;
}

.task-fullscreen-section {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  margin-bottom: 16px;
  overflow: hidden;
}

.task-fullscreen-section-header {
  padding: 12px 16px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.task-fullscreen-section-header:hover {
  background: var(--bg-card-hover);
}

.task-fullscreen-section-body {
  padding: 14px 16px;
}

/* Execution Plan node pipeline */
.exec-plan-node {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 4px;
  overflow: hidden;
  transition: border-color 0.15s;
}

.exec-plan-node:hover {
  border-color: var(--accent);
}

.exec-plan-node-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
}

.exec-plan-node-body {
  padding: 8px 12px 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
}

.exec-plan-connector {
  margin-left: 20px;
  height: 12px;
  border-left: 2px solid var(--border);
  position: relative;
}

.exec-plan-connector::after {
  content: "▼";
  position: absolute;
  left: -6px;
  bottom: -2px;
  font-size: 8px;
  color: var(--border);
}

.exec-plan-skill-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  background: var(--accent-bg, #3b82f615);
  color: var(--accent, #60a5fa);
  border: 1px solid var(--accent-border, #3b82f630);
}

.exec-plan-context-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 500;
  background: #10b98115;
  color: #34d399;
  border: 1px solid #10b98130;
}

.exec-plan-stage {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 14px;
}

.exec-plan-stage-header {
  padding: 10px 14px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
 display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.exec-plan-stage-header:hover {
  background: var(--bg-card-hover);
}

.exec-plan-stage-body {
  padding: 12px 14px;
}

.exec-plan-badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

@media (max-width: 980px) {
  .task-fullscreen-layout {
    grid-template-columns: 1fr;
  }
  .task-fullscreen-sidebar {
    border-left: none;
    border-top: 1px solid var(--border);
  }
}
