/* Copyright (c) 2025-2026 Ioannis Belesiotis. All rights reserved.
   This source code is proprietary and confidential. */
/* ── Settings Modal ──────────────────────────────────────────────────────── */

.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.settings-modal.hidden {
  display: none;
}

.settings-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30, 34, 60, 0.50);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}

.settings-modal-dialog {
  position: relative;
  z-index: 1;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: calc(100vw - 32px);
  height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header */
.settings-modal-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-modal-header h3 {
  margin: 0;
  font-size: var(--font-md);
  font-weight: 600;
  color: var(--color-text);
  flex-shrink: 0;
}

.settings-modal-header .settings-plan-bar {
  flex: 1;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  font-size: 11px;
}

.settings-modal-header .modal-close {
  flex-shrink: 0;
  margin-left: auto;
}

/* Body */
.settings-modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
}

/* Tabs that aren't flex-stretched (General, Jira) need their own scroll */
.settings-modal-body > .settings-tab-panel:not(#settingsResources):not(#settingsUsers) {
  overflow-y: auto;
  flex: 1 1 0;
  min-height: 0;
}

/* Two-column layout for Jira chip sections */
.settings-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Section */
.settings-section {
  display: flex;
  flex-direction: column;
}

.settings-section + .settings-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--color-border);
}

.settings-section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--color-text-light);
  margin-bottom: 6px;
}

.settings-section-desc {
  margin: 0 0 12px;
  font-size: var(--font-sm);
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* Project chips list */
.settings-project-list {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 6px;
  min-height: 28px;
  margin-bottom: 10px;
  max-height: 200px;
  overflow-y: auto;
}

/* Project rows — responsive grid, min 280px per card */
#settingsProjectList {
  display: block;
}

/* Issue-type chip list keeps the original flex-wrap card layout. */
#settingsIssueTypeList {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ── Reusable form primitives ──────────────────────────────────────────────── */
.settings-field-group  { display: flex; align-items: center; gap: 8px; }
.settings-field-label  { font-size: var(--font-sm); color: var(--color-text-muted); white-space: nowrap; cursor: pointer; }
.settings-checkbox-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.settings-checkbox     { width: 16px; height: 16px; cursor: pointer; accent-color: var(--color-accent); }
.settings-input-narrow { max-width: 80px; text-transform: none; letter-spacing: 0; }
.settings-input-date   { max-width: 160px; text-transform: none; letter-spacing: 0; }
.settings-unit-label   { font-size: var(--font-sm); color: var(--color-text-muted); }
.settings-btn-group    { display: flex; gap: 8px; }
.settings-field-label-sm { font-size: var(--font-xs); color: var(--color-text-muted); white-space: nowrap; cursor: pointer; }

/* Sync config — two fields side-by-side */
.settings-sync-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.settings-sync-item-stacked {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Collapsible sections (native <details>) */
.settings-collapsible {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0;
  background: var(--color-surface-alt);
}

.settings-collapsible > summary {
  cursor: pointer;
  padding: 10px 14px;
  margin-bottom: 0;
  list-style: none;
}

.settings-collapsible > summary::-webkit-details-marker { display: none; }
.settings-collapsible > summary::marker { content: ''; }

.settings-collapsible > summary::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--color-text-muted);
  border-bottom: 1.5px solid var(--color-text-muted);
  transform: rotate(-45deg);
  margin-left: 8px;
  vertical-align: 1px;
  transition: transform 0.15s;
}

.settings-collapsible[open] > summary::after {
  transform: rotate(45deg);
  vertical-align: 2px;
}

.settings-collapsible[open] > summary {
  margin-bottom: 0;
  border-bottom: 1px solid var(--color-border);
}

.settings-collapsible-body {
  padding: 12px 14px 14px;
}

.settings-collapsible-body > .settings-section-desc {
  margin-top: 0;
}

.settings-sync-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-project-list:empty::before {
  content: 'No projects configured.';
  font-size: var(--font-sm);
  color: var(--color-text-light);
  font-style: italic;
}

#settingsIssueTypeList:empty::before {
  content: 'No issue types configured.';
}

.settings-project-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px 3px 10px;
  background: var(--color-accent-subtle);
  color: var(--color-accent);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.4px;
}

.settings-project-chip button {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--color-accent);
  opacity: 0.6;
  transition: opacity 0.1s;
  line-height: 1;
}

.settings-project-chip button:hover {
  opacity: 1;
}

/* Add row (legacy — kept for Sync tab) */
.settings-add-row {
  display: flex;
  gap: 8px;
  max-width: 320px;
}

/* Picker anchor + popover */
.settings-picker-anchor {
  position: relative;
  display: inline-block;
}

.settings-picker-popover {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 280px;
  max-width: 360px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 400;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.settings-picker-popover.hidden {
  display: none;
}

.settings-picker-search {
  padding: 8px 10px;
  border-bottom: 1px solid var(--color-border);
  font-size: var(--font-sm);
  color: var(--color-text);
  background: var(--color-surface);
  border-top: none;
  border-left: none;
  border-right: none;
  outline: none;
  width: 100%;
}

.settings-picker-list {
  overflow-y: auto;
  max-height: 220px;
  padding: 4px 0;
}

.settings-picker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: var(--font-sm);
  cursor: pointer;
  -webkit-user-select: none; user-select: none;
}

.settings-picker-item:hover {
  background: var(--color-accent-subtle);
}

.settings-picker-item.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.settings-picker-item input[type="checkbox"] {
  accent-color: var(--color-accent);
  flex-shrink: 0;
  cursor: pointer;
}

.settings-picker-item-key {
  font-weight: 700;
  color: var(--color-accent);
  min-width: 44px;
  flex-shrink: 0;
}

.settings-picker-item-name {
  color: var(--color-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-picker-item img {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.settings-picker-footer {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid var(--color-border);
  background: var(--color-surface-alt);
}

.settings-picker-empty {
  padding: 16px 12px;
  font-size: var(--font-sm);
  color: var(--color-text-muted);
  text-align: center;
}

.settings-project-input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--font-sm);
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--color-text);
  background: var(--color-surface-alt);
  outline: none;
  transition: border-color 0.15s;
}

.settings-project-input:focus {
  border-color: var(--color-accent);
  background: var(--color-surface);
}

.settings-project-input::placeholder {
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--color-text-light);
}

/* Footer */
.settings-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--color-border);
}

/* Gear + avatar grouped in header */
.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* Gear button in header */
#btnSettings {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: var(--radius-md);
  opacity: 0.7;
  transition: opacity 0.15s, background 0.15s;
}

#btnSettings:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.08);
}

/* Settings tabs strip */
.settings-plan-bar {
  padding: 8px 20px;
  font-size: 11px;
  color: var(--color-text-muted);
  background: var(--color-surface-alt);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.settings-plan-bar .plan-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--color-accent-subtle);
  color: var(--color-accent);
}
.settings-plan-bar .plan-badge-link {
  text-decoration: none;
  cursor: pointer;
  transition: filter 0.15s, transform 0.15s;
}
.settings-plan-bar .plan-badge-link:hover {
  filter: brightness(1.1);
  transform: scale(1.05);
}
.settings-plan-bar .usage-item { display: inline-flex; gap: 3px; }
.settings-plan-bar .usage-ok { color: var(--color-text-muted); }
.settings-plan-bar .usage-warn { color: var(--color-warning); font-weight: 600; }
.settings-plan-bar .usage-full { color: var(--color-danger); font-weight: 600; }

.settings-tabs {
  display: flex;
  gap: 2px;
  padding: 0 20px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-alt);
}

.settings-tab-btn {
  position: relative;
  padding: 10px 14px;
  font-size: var(--font-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.15s;
  white-space: nowrap;
}

.settings-tab-btn::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--color-accent);
  border-radius: 2px 2px 0 0;
  opacity: 0;
  transition: opacity 0.15s;
}

.settings-tab-btn:hover {
  color: var(--color-text);
}

.settings-tab-btn.active {
  color: var(--color-accent);
  font-weight: 600;
}

.settings-tab-btn.active::after {
  opacity: 1;
}

/* Tab panels */
.settings-tab-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.settings-tab-panel.hidden {
  display: none;
}

/* Inner tabs (Team: Resources / Users) */
.settings-inner-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 12px;
}

.settings-inner-tab {
  padding: 8px 16px;
  font-size: var(--font-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  background: none;
  border: none;
  cursor: pointer;
  position: relative;
}

.settings-inner-tab::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: transparent;
}

.settings-inner-tab:hover {
  color: var(--color-text);
}

.settings-inner-tab.active {
  color: var(--color-accent);
  font-weight: 600;
}

.settings-inner-tab.active::after {
  background: var(--color-accent);
}

.settings-inner-panel {
  padding: 16px 0 0;
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
}

.settings-inner-panel.hidden {
  display: none;
}

/* Inner pill tabs (Jira + Team) */
.settings-inner-pills {
  display: flex;
  gap: 4px;
  padding: 10px var(--space-md) 0;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.settings-inner-pill {
  padding: 5px 14px;
  font-size: var(--font-xs);
  font-weight: 500;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  transition: color 0.15s, background 0.15s;
  margin-bottom: -1px;
}

.settings-inner-pill:hover {
  color: var(--color-text);
  background: var(--color-surface-alt);
}

.settings-inner-pill.active {
  color: var(--color-accent);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-bottom-color: var(--color-surface);
  font-weight: 600;
}

/* Form grid — labels and inputs aligned */
.settings-form-grid {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 10px 16px;
  align-items: center;
  max-width: 460px;
  margin: 0 auto;
}

.settings-form-grid .settings-field-label {
  text-align: right;
  justify-self: end;
  font-size: var(--font-sm);
  color: var(--color-text);
  font-weight: 500;
}

/* Centered form wrapper — desc + grid + action share the same max-width and centering */
.settings-form-centered {
  max-width: 460px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-form-centered .settings-form-grid {
  max-width: none;
  margin: 0;
}

/* Action row below form grid — indented to align with the input column */
.settings-form-grid-action {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding-left: calc(130px + 16px); /* label-col + gap */
}

.settings-form-grid-action .btn {
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 160px;
}

/* Sprint 2.5 — Atlassian OAuth status block (replaces API-token form) */
.atlassian-status {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface-alt);
  align-items: flex-start;
  max-width: 540px;
}
.atlassian-status-connected {
  border-color: color-mix(in srgb, var(--color-success) 35%, var(--color-border));
}
.atlassian-status-title {
  font-size: var(--font-md);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
}
.atlassian-status-meta {
  font-size: var(--font-sm);
  color: var(--color-text-muted);
}
.atlassian-status .btn {
  margin-top: var(--space-xs);
}

/* Form grid inputs — override the uppercase/bold used on project-key chips */
.settings-form-grid .settings-project-input {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  font-size: var(--font-sm);
  padding: 7px 10px;
}

/* Copilot model plan badges */
.copilot-model-plan-tag {
  font-size: 10px;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-left: 4px;
}

.copilot-model-pill-btn.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.copilot-model-pill-btn.disabled input {
  pointer-events: none;
}

/* Resources & Users tabs: stretch to fill the modal body, tighter gap */
#settingsResources,
#settingsUsers {
  flex: 1 1 0;
  min-height: 0;
  gap: 8px;
}

/* Danger zone */
.settings-danger-zone {
  border: 1px solid color-mix(in srgb, var(--color-danger) 30%, transparent);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  background: color-mix(in srgb, var(--color-danger) 5%, transparent);
}

.settings-danger-title {
  color: var(--color-danger) !important;
}

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

.settings-danger-info {
  flex: 1;
  min-width: 0;
}

.settings-danger-label {
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 2px;
}

.settings-danger-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Confirm modal */
.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: flex;
  align-items: center;
  justify-content: center;
}

.confirm-modal[hidden] {
  display: none;
}

.confirm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30, 34, 60, 0.50);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}

.confirm-dialog {
  position: relative;
  z-index: 1;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 360px;
  max-width: calc(100vw - 32px);
  overflow: hidden;
}
.confirm-dialog.wide {
  width: 520px;
}

.confirm-body {
  padding: 24px 24px 16px;
}

.confirm-title {
  margin: 0 0 8px;
  font-size: var(--font-md);
  font-weight: 600;
  color: var(--color-text);
}

.confirm-message {
  margin: 0;
  font-size: var(--font-sm);
  color: var(--color-text-muted);
  line-height: 1.55;
  white-space: pre-line;
}

.confirm-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 24px 20px;
}
.confirm-footer .btn {
  font-size: var(--font-xs);
  padding: 6px 12px;
  white-space: nowrap;
}

/* ── Schedule Confirm (backlog drop with existing dates) ───────────────── */
.schedule-confirm-warn {
  display: flex;
  color: var(--color-warning, #f59e0b);
  flex-shrink: 0;
}
.schedule-confirm-warn svg { display: block; }
.schedule-confirm-task {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.schedule-confirm-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.schedule-confirm-key {
  font-weight: 600;
  font-size: var(--font-md);
  color: var(--color-text);
}
.schedule-confirm-subtitle {
  font-size: var(--font-sm);
  color: var(--color-text-muted);
  margin-bottom: 14px;
}
.schedule-confirm-dates {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}
.schedule-confirm-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.schedule-confirm-divider {
  height: 1px;
  background: var(--color-border);
  margin: 8px 0;
}
.schedule-confirm-label {
  font-size: var(--font-xs);
  font-weight: 500;
  color: var(--color-text-muted);
  min-width: 52px;
}
.schedule-confirm-value {
  font-size: var(--font-sm);
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}
.schedule-confirm-new {
  color: var(--color-accent);
  font-weight: 500;
}

/* ── Scheduling Choice Modal ─────────────────────────────────────────────── */
.sched-choice-dialog {
  position: relative;
  z-index: 1;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 460px;
  max-width: calc(100vw - 32px);
  padding: 28px 24px 20px;
}

.sched-choice-header {
  text-align: center;
  margin-bottom: 22px;
}

.sched-choice-header-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: var(--color-accent-subtle);
  border-radius: var(--radius-full);
  color: var(--color-accent);
  margin-bottom: 14px;
}

.sched-choice-header h4 {
  margin: 0 0 6px;
  font-size: var(--font-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
}

.sched-choice-header p {
  margin: 0;
  font-size: var(--font-sm);
  color: var(--color-text-muted);
  line-height: 1.5;
}

.sched-choice-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.sched-choice-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 16px;
  background: var(--color-surface-alt);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}

.sched-choice-card:hover {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-subtle);
  transform: translateY(-1px);
}

.sched-choice-card--primary {
  border-color: var(--color-accent);
  background: var(--color-accent-subtle);
}

.sched-choice-card--primary:hover {
  box-shadow: 0 0 0 3px var(--color-accent-subtle), 0 4px 12px rgba(91, 115, 245, 0.18);
}

.sched-choice-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  margin-bottom: 6px;
  flex-shrink: 0;
}

.sched-choice-card--primary .sched-choice-card-icon {
  color: var(--color-accent);
}

.sched-choice-card strong {
  display: block;
  font-size: var(--font-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  line-height: 1.3;
}

.sched-choice-card span:last-child {
  font-size: var(--font-xs);
  color: var(--color-text-muted);
  line-height: 1.45;
}

.sched-choice-cancel-row {
  display: flex;
  justify-content: center;
}

.sched-choice-cancel-row .btn {
  background: transparent;
  border-color: transparent;
  color: var(--color-text-muted);
  font-size: var(--font-sm);
  font-weight: var(--font-weight-normal);
  padding: 4px 10px;
}

.sched-choice-cancel-row .btn:hover {
  background: transparent;
  color: var(--color-text);
  text-decoration: underline;
}

/* Empty state for General tab */
.settings-empty-state {
  font-size: var(--font-sm);
  color: var(--color-text-muted);
  font-style: italic;
  text-align: center;
  padding: 24px 0 8px;
  margin: 0;
  line-height: 1.6;
}

/* ── Small button variant ─────────────────────────────────────────────────── */

.btn-sm {
  padding: 4px 10px;
  font-size: var(--font-xs);
}

/* ── Management tabs (Resources / Users) ─────────────────────────────────── */

/* Header row: action buttons flush-right */
.settings-mgmt-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

/* Table wrapper — scroll both axes so the horizontal scrollbar is always
   visible at the bottom of the table area without requiring the outer modal
   body to scroll vertically first. */
#resources-list-container,
#users-list-container {
  overflow-x: auto;
  overflow-y: auto;
  flex: 1 1 0;
  min-height: 120px;
}

/* Restore scrollbars (global rule hides them) */
#resources-list-container::-webkit-scrollbar,
#users-list-container::-webkit-scrollbar {
  display: block;
  width: 8px;
  height: 8px;
}

#resources-list-container::-webkit-scrollbar-thumb,
#users-list-container::-webkit-scrollbar-thumb {
  background: var(--color-border-strong);
  border-radius: 4px;
}

#resources-list-container::-webkit-scrollbar-track,
#users-list-container::-webkit-scrollbar-track {
  background: transparent;
}

.settings-mgmt-table {
  width: 100%;
  min-width: 520px;
}

.settings-mgmt-table thead th {
  background: transparent;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--color-text-light);
  border-bottom: 1px solid var(--color-border);
  padding: 6px 12px 4px;
}

/* Name cell with avatar */
.mgmt-name-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mgmt-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}

.mgmt-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-accent);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
}

.sortable-th {
  cursor: pointer;
  -webkit-user-select: none; user-select: none;
  transition: color 0.15s;
}

.sortable-th:hover {
  color: var(--color-accent);
}

/* Status / role badges */
.mgmt-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}

.mgmt-badge-active {
  background: color-mix(in srgb, var(--color-success) 15%, transparent);
  color: var(--color-success);
}

.mgmt-badge-inactive {
  background: color-mix(in srgb, var(--color-text-muted) 12%, transparent);
  color: var(--color-text-muted);
}

.mgmt-badge-admin {
  background: color-mix(in srgb, var(--color-danger) 12%, transparent);
  color: var(--color-danger);
}

.mgmt-badge-planner {
  background: var(--color-accent-subtle);
  color: var(--color-accent);
}

.mgmt-badge-engineer {
  background: color-mix(in srgb, var(--color-success) 12%, transparent);
  color: var(--color-success);
}

/* Text helpers */
.mgmt-muted {
  color: var(--color-text-muted);
}

.mgmt-monospace {
  font-family: monospace;
  font-size: 11px;
  color: var(--color-text-muted);
}

/* Actions column — buttons flush-right */
.mgmt-actions {
  white-space: nowrap;
  text-align: right;
}
.mgmt-actions .btn {
  margin-left: 2px;
}

.mgmt-actions-right {
  display: inline-flex;
  gap: 4px;
  float: right;
}

.mgmt-btn-deactivate {
  color: var(--color-text-muted);
}

.mgmt-btn-deactivate:hover {
  color: var(--color-danger);
}

.mgmt-btn-danger {
  color: var(--color-danger);
  opacity: 0.7;
}

.mgmt-btn-danger:hover {
  opacity: 1;
}

/* Role select in users table */
.mgmt-role-select {
  padding: 3px 6px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: var(--font-xs);
  background: var(--color-surface-alt);
  color: var(--color-text);
  cursor: pointer;
}

.mgmt-role-select:focus {
  outline: none;
  border-color: var(--color-accent);
}

/* Inline add/edit form card */
.settings-form-card {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
}

.settings-form-title {
  margin: 0 0 14px;
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--color-text);
}

.settings-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}

.settings-form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.settings-form-group-full {
  grid-column: 1 / -1;
}

.settings-form-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* Override uppercase/weight on form inputs (settings-project-input is shared) */
.settings-form-card .settings-project-input {
  text-transform: none;
  font-weight: 400;
  letter-spacing: 0;
}

.settings-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.settings-form-hint {
  margin: 10px 0 0;
  font-size: var(--font-xs);
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* Required / optional field markers */
.mgmt-required {
  color: var(--color-danger);
}

.mgmt-optional {
  color: var(--color-text-muted);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

/* Status messages */
.settings-loading,
.settings-empty,
.settings-error {
  padding: 20px 0;
  margin: 0;
  font-size: var(--font-sm);
  color: var(--color-text-muted);
  text-align: center;
}

.settings-error {
  color: var(--color-danger);
}

/* Project colour swatch (color input inside each project row) */
.project-color-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  padding: 0;
  background: none;
  flex-shrink: 0;
  -webkit-appearance: none;
  appearance: none;
  overflow: hidden;
}
.project-color-swatch::-webkit-color-swatch-wrapper { padding: 0; }
.project-color-swatch::-webkit-color-swatch { border: none; border-radius: 50%; }
.project-color-swatch::-moz-color-swatch { border: none; border-radius: 50%; }

/* Per-project sync status rows */
.settings-project-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.settings-project-row .project-color-swatch {
  flex-shrink: 0;
}

.settings-project-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-project-key {
  font-size: var(--font-sm);
  font-weight: 700;
  color: var(--color-accent);
}

.project-sync-status {
  font-size: 11px;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-sync-status.never {
  color: var(--color-warning);
  font-style: italic;
}

.project-sync-status.archived {
  color: var(--color-text-muted);
  font-style: italic;
}

.settings-project-row.archived {
  opacity: 0.55;
}

.settings-project-row.archived .settings-project-key {
  text-decoration: line-through;
}

.project-archive-btn.active {
  color: var(--color-warning);
}

.btn-xs {
  padding: 2px 8px;
  font-size: var(--font-xs);
  border-radius: var(--radius-sm);
}

/* Step 14 (cursor-lifecycle.md §2.5): read-only projects summary table */
.settings-project-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-sm);
}

.settings-project-table thead th {
  text-align: left;
  font-size: var(--font-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  padding: 6px 10px;
  border-bottom: 1px solid var(--color-border);
}

.settings-project-table .settings-project-th-actions {
  text-align: right;
}

.settings-project-table tbody tr.settings-project-trow {
  border-bottom: 1px solid var(--color-border);
}

.settings-project-table tbody tr.settings-project-trow:last-child {
  border-bottom: none;
}

.settings-project-table tbody tr.archived {
  opacity: 0.55;
}

.settings-project-table tbody tr.archived .settings-project-key {
  text-decoration: line-through;
}

.settings-project-table td {
  padding: 8px 10px;
  vertical-align: middle;
}

.settings-project-td-key {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.settings-project-td-key .project-color-swatch {
  flex-shrink: 0;
}

.settings-project-td-portfolios {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 160px;
}

.project-portfolio-chip {
  display: inline-block;
  padding: 1px 8px;
  font-size: 11px;
  background: var(--color-accent-subtle);
  color: var(--color-accent);
  border-radius: var(--radius-full);
  font-weight: 500;
}

.project-portfolio-missing {
  font-style: italic;
  color: var(--color-text-light);
  font-size: 11px;
}

.project-status-pill {
  display: inline-block;
  padding: 1px 8px;
  font-size: 11px;
  border-radius: var(--radius-full);
  font-weight: 500;
}

.project-status-synced {
  background: rgba(16, 185, 129, 0.12);
  color: var(--color-success);
}

.project-status-archived {
  background: rgba(148, 163, 184, 0.18);
  color: var(--color-text-muted);
}

.settings-project-td-actions {
  text-align: right;
  white-space: nowrap;
}

.settings-project-td-actions .btn {
  margin-left: 4px;
}

.settings-project-empty {
  margin: 0;
  padding: 12px;
  font-size: var(--font-sm);
  color: var(--color-text-muted);
  font-style: italic;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-alt);
}

/* Step 15 (cursor-lifecycle.md §13.3): Add Project modal */
.apm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  z-index: 10100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.apm-card {
  width: 100%;
  max-width: 540px;
  max-height: calc(100vh - 48px);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border-top: 3px solid var(--color-accent);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.apm-head {
  padding: 16px 20px 8px;
}

.apm-title {
  font-size: var(--font-lg);
  font-weight: 600;
  color: var(--color-text);
}

.apm-desc {
  margin: 6px 0 0;
  font-size: var(--font-sm);
  color: var(--color-text-muted);
  line-height: 1.5;
}

.apm-body {
  padding: 8px 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.apm-section + .apm-section {
  margin-top: 16px;
}

.apm-section[hidden] { display: none; }

.apm-section-label {
  font-size: var(--font-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

.apm-section-hint {
  font-size: var(--font-xs);
  color: var(--color-text-muted);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  margin: 4px 0 0;
}

.apm-search {
  width: 100%;
  padding: 8px 10px;
  font-size: var(--font-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  margin-bottom: 8px;
}

.apm-search:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px var(--color-accent-subtle);
}

.apm-project-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-alt);
}

.apm-project-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: var(--font-sm);
  border-bottom: 1px solid var(--color-border);
}

.apm-project-option:last-child { border-bottom: none; }
.apm-project-option:hover      { background: var(--color-surface); }
.apm-project-option.selected   { background: var(--color-accent-subtle); }

.apm-project-option input[type="radio"] { margin: 0; }

.apm-project-key {
  font-weight: 700;
  color: var(--color-accent);
}

.apm-project-name {
  color: var(--color-text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.apm-project-owned {
  font-size: 11px;
  color: var(--color-text-muted);
  font-style: italic;
}

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

.apm-issuetype-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: var(--font-sm);
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  cursor: pointer;
}

.apm-issuetype-chip.checked {
  background: var(--color-accent-subtle);
  border-color: var(--color-accent);
  color: var(--color-accent);
  font-weight: 500;
}

.apm-issuetype-chip input { margin: 0; }

.apm-portfolio-select {
  width: 100%;
  padding: 8px 10px;
  font-size: var(--font-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
}

.apm-portfolio-select:disabled {
  background: var(--color-surface-alt);
  cursor: not-allowed;
}

.apm-empty {
  padding: 16px;
  text-align: center;
  font-size: var(--font-sm);
  color: var(--color-text-muted);
  font-style: italic;
}

.apm-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--color-border);
  background: var(--color-surface-alt);
}

.apm-foot-msg {
  flex: 1;
  font-size: var(--font-xs);
  color: var(--color-text-muted);
}

.apm-foot-msg.apm-foot-error {
  color: var(--color-danger);
}

/* Custom Field ID mapping grid */
.settings-field-map-grid {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 8px 16px;
  align-items: center;
  margin-top: 10px;
}

.settings-field-map-label {
  font-size: var(--font-sm);
  color: var(--color-text);
  white-space: nowrap;
  text-align: right;
}

.settings-field-map-input {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  font-family: monospace;
  max-width: 260px;
}

.settings-field-map-static {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--font-sm);
}

.settings-field-map-static code {
  font-size: var(--font-xs);
  color: var(--color-text-muted);
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
}

.settings-field-map-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--color-text-muted);
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: 1px 6px;
}
/* Tightens spacing between the three intro paragraphs (Standard / Auto-
   detected / Opt-in) so each tier is visibly its own line without leaving
   wide gaps that make the section feel disconnected. */
.settings-fm-intro .settings-section-desc {
  margin: 0 0 6px 0;
}
.settings-fm-intro .settings-section-desc:last-child {
  margin-bottom: 12px;
}

/* feat/epic-link-auto-detect: auto-detected badge — visually distinct from
   STANDARD (which is purely Atlassian-fixed). Accent tint signals "Mermix
   found this in your Jira automatically; no configuration needed."
   white-space: nowrap prevents the badge text wrapping to two lines when
   the grid value cell is space-constrained. */
.settings-field-map-badge {
  white-space: nowrap;
}
.settings-field-map-badge--auto {
  color: var(--color-accent);
  background: color-mix(in srgb, var(--color-accent) 10%, transparent);
  border-color: color-mix(in srgb, var(--color-accent) 30%, transparent);
}
/* Epic-Link hint paragraph lives on its own grid row spanning column 2 to
   the end. This avoids the prior layout where an in-cell <p> escaped its
   <span> parent and landed in the narrow label column, wrapping awkwardly. */
.sfm-epic-hint {
  grid-column: 2 / -1;
  margin: -2px 0 4px 0;
  font-size: var(--font-xs);
  color: var(--color-text-muted);
  max-width: 480px;
}

.settings-field-map-divider {
  grid-column: 1 / -1;
  border-top: 1px solid var(--color-border);
  margin: 4px 0;
}

/* ── Field-mapping picker rows (feat/jira-field-mapping-picker) ─────────── */
.sfm-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--space-sm);
  min-width: 0;
}
.sfm-row .sfm-display {
  flex: 1 1 0;
  min-width: 0;
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-alt);
  font-size: var(--font-sm);
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sfm-row .sfm-display.unlinked {
  color: var(--color-text-muted);
  font-style: italic;
}
.sfm-row .sfm-display code {
  font-size: 0.85em;
  color: var(--color-text-muted);
  margin-left: 6px;
}
.sfm-row .sfm-display .sfm-type-badge {
  display: inline-block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  margin-left: 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--color-accent) 12%, transparent);
  color: var(--color-accent);
}
/* Tightened CTA-style buttons inline with the display field. Link gets the
   outlined treatment (visible CTA); Clear is muted/icon-y until hovered. */
.sfm-row .sfm-link-btn,
.sfm-row .sfm-clear-btn {
  flex: 0 0 auto;
  padding: 5px 12px;
  font-size: var(--font-xs);
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}
.sfm-row .sfm-link-btn {
  background: transparent;
  color: var(--color-accent);
  border: 1px solid var(--color-accent);
}
.sfm-row .sfm-link-btn:hover {
  background: var(--color-accent);
  color: #fff;
}
.sfm-row .sfm-clear-btn {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}
.sfm-row .sfm-clear-btn:hover {
  color: var(--color-danger);
  border-color: var(--color-danger);
}
.sfm-row .sfm-clear-btn[hidden] { display: none; }
.sfm-row .sfm-hint {
  flex-basis: 100%;
  margin: 4px 0 0 0;
}
/* Epic Link row has the hint paragraph as a child — let it wrap to a new
   line beneath the inline display + buttons. */
.sfm-row:has(.sfm-hint) {
  flex-wrap: wrap;
}

/* ── Field-mapping picker modal (feat/jira-field-mapping-picker) ─────────── */
.sfm-picker-overlay {
  position: fixed; inset: 0;
  background: rgba(30, 34, 60, 0.5);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  z-index: 1400;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.sfm-picker-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: min(560px, 100%);
  max-height: calc(100vh - 64px);
  display: flex; flex-direction: column;
  border-top: 3px solid var(--color-accent);
  animation: sfm-picker-in 0.18s ease-out;
}
@keyframes sfm-picker-in {
  from { opacity: 0; transform: scale(0.97); }
  to   { opacity: 1; transform: scale(1); }
}
.sfm-picker-head {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--color-border);
}
.sfm-picker-title {
  font-size: var(--font-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  margin-bottom: 4px;
}
.sfm-picker-desc {
  font-size: var(--font-sm);
  color: var(--color-text-muted);
  margin: 0;
}
.sfm-picker-search {
  margin: var(--space-md) var(--space-lg) 0 var(--space-lg);
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: var(--font-sm);
  width: auto;
}
.sfm-picker-list {
  overflow-y: auto;
  padding: var(--space-md) var(--space-lg);
  flex: 1 1 auto;
}
.sfm-picker-option {
  display: flex; align-items: center;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  gap: var(--space-sm);
}
.sfm-picker-option:hover { background: var(--color-surface-alt); }
.sfm-picker-option.selected { background: color-mix(in srgb, var(--color-accent) 10%, transparent); }
.sfm-picker-option-name { flex: 1; font-size: var(--font-sm); color: var(--color-text); }
.sfm-picker-option-id   { font-size: 11px; color: var(--color-text-muted); font-family: var(--font-mono, monospace); }
.sfm-picker-option-type {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--color-accent) 12%, transparent);
  color: var(--color-accent);
}
.sfm-picker-empty {
  padding: var(--space-xl);
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--font-sm);
}
.sfm-picker-foot {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--color-border);
  display: flex; justify-content: flex-end; gap: var(--space-sm);
}

/* ── Copilot tab ───────────────────────────────────────────────────────── */
/* Compact model + context row */
.copilot-config-row {
  display: flex;
  align-items: flex-end;
  gap: var(--space-lg);
}
.copilot-config-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.copilot-config-group--grow {
  flex: 1;
}

/* Model pill toggle — same pattern as calendar zoom */
.copilot-model-pill {
  display: flex;
  gap: 2px;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 2px;
}
.copilot-model-pill-btn {
  display: flex;
  align-items: center;
  padding: 5px 14px;
  border-radius: calc(var(--radius-md) - 1px);
  font-size: var(--font-xs);
  font-weight: 400;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  -webkit-user-select: none; user-select: none;
}
.copilot-model-pill-btn input[type="radio"] {
  display: none;
}
.copilot-model-pill-btn:hover {
  color: var(--color-text);
}
.copilot-model-pill-btn:has(input:checked) {
  background: var(--color-surface);
  color: var(--color-accent);
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}

/* Copilot context size slider */
.copilot-context-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.copilot-context-slider {
  flex: 1;
  height: 4px;
  accent-color: var(--color-accent);
  cursor: pointer;
}
.copilot-context-label {
  font-size: var(--font-xs);
  color: var(--color-text-muted);
  min-width: 90px;
  text-align: right;
}

/* Copilot custom instructions — inner pill tabs */
.copilot-prompt-tabs {
  display: flex;
  gap: 2px;
  background: var(--color-surface-alt);
  border-radius: var(--radius-md);
  padding: 2px;
  flex-shrink: 0;
}
.copilot-prompt-tab {
  flex: 1;
  padding: 5px 8px;
  border: none;
  background: transparent;
  border-radius: calc(var(--radius-md) - 1px);
  font-size: var(--font-xs);
  font-weight: 400;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.copilot-prompt-tab:hover {
  color: var(--color-text);
}
.copilot-prompt-tab.active {
  background: var(--color-surface);
  color: var(--color-text);
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}

/* Panels: only active is visible; fills remaining height */
.copilot-prompt-panel {
  display: none;
  flex-direction: column;
  gap: var(--space-xs);
  flex: 1;
  min-height: 0;
}
.copilot-prompt-panel.active {
  display: flex;
}
.copilot-prompt-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-sm);
  flex-shrink: 0;
}
.copilot-prompt-header .settings-section-desc {
  margin: 0;
}
.copilot-view-default {
  white-space: nowrap;
  flex-shrink: 0;
}
.copilot-prompt-textarea {
  flex: 1;
  min-height: 80px;
  resize: none;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 12px;
  line-height: 1.5;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color 0.15s;
}
.copilot-prompt-textarea:focus {
  outline: none;
  border-color: var(--color-accent);
}

/* Read-only default preview — hidden by default, shown when "View default" toggled */
.copilot-default-preview {
  display: none;
  flex: 1;
  min-height: 80px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 12px;
  line-height: 1.5;
  padding: 8px 10px;
  margin: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-alt);
  color: var(--color-text-muted);
}
.copilot-default-preview.visible {
  display: block;
}

.btn-link-muted {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: var(--font-xs);
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.btn-link-muted:hover {
  color: var(--color-accent);
}

/* ── Portfolio selector (calendar pane-header) ──────────────────────────── */
.portfolio-selector {
  font-size: var(--font-xs);
  font-weight: 500;
  padding: 3px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  max-width: 160px;
}
.portfolio-selector:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}

/* ── Portfolio form (inside settings-form-card) ────────────────────────── */
.pf-checklists {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  grid-column: 1 / -1;
  margin-top: 6px;
  align-items: stretch;
}
.pf-checklist-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.pf-checklist-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.pf-checklist-count {
  font-weight: 500;
  font-size: 10px;
  color: var(--color-accent);
  background: var(--color-accent-subtle);
  padding: 0 5px;
  border-radius: 8px;
  line-height: 16px;
  text-transform: none;
  letter-spacing: 0;
}
.pf-checklist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.pf-toggle-all {
  background: none;
  border: none;
  color: var(--color-accent);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  letter-spacing: 0;
  text-transform: none;
}
.pf-toggle-all:hover {
  text-decoration: underline;
}

/* Step 16: + Add Jira Project button in portfolio form header */
.pf-checklist-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pf-add-jira-project {
  background: none;
  border: 1px solid var(--color-accent);
  color: var(--color-accent);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  letter-spacing: 0;
  text-transform: none;
}
.pf-add-jira-project:hover {
  background: var(--color-accent-subtle);
}
.pf-check-item.checked {
  background: var(--color-accent-subtle);
}
.pf-check-item.taken {
  opacity: 0.45;
  cursor: not-allowed;
}
.pf-check-taken {
  margin-left: auto;
  font-size: 10px;
  font-weight: 500;
  color: var(--color-text-muted);
  background: var(--color-surface-alt);
  padding: 1px 6px;
  border-radius: 8px;
  flex-shrink: 0;
  white-space: nowrap;
}
.pf-checklist-toolbar {
  display: flex;
  gap: 4px;
  align-items: center;
}
.pf-search {
  flex: 1;
  padding: 3px 8px;
  font-size: var(--font-xs);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  outline: none;
}
.pf-search:focus {
  border-color: var(--color-accent);
}
.pf-search::placeholder {
  color: var(--color-text-muted);
}
.pf-auto-suggest {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-accent);
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.pf-auto-suggest:hover {
  background: var(--color-accent-subtle);
  border-color: var(--color-accent);
}
.pf-checklist-box {
  flex: 1;
  max-height: 260px;
  overflow-y: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 5px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pf-check-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: var(--font-sm);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--color-text);
  transition: background 0.1s;
}
.pf-check-item:hover {
  background: var(--color-accent-subtle);
}
.pf-check-item input[type="checkbox"] {
  accent-color: var(--color-accent);
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.pf-check-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pf-lookback {
  margin-left: auto;
  width: 48px;
  padding: 1px 4px;
  font-size: 11px;
  text-align: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  flex-shrink: 0;
}
.pf-lookback::placeholder {
  color: var(--color-text-muted);
  font-size: 10px;
}
.pf-lookback:focus {
  outline: none;
  border-color: var(--color-accent);
}
/* Hide spinner arrows */
.pf-lookback::-webkit-inner-spin-button,
.pf-lookback::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.pf-lookback { -moz-appearance: textfield; }
.pf-project-reset {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 13px;
  cursor: pointer;
  padding: 0 2px;
  flex-shrink: 0;
  line-height: 1;
  opacity: 0.5;
  transition: opacity 0.15s, color 0.15s;
}
.pf-project-reset:hover {
  opacity: 1;
  color: var(--color-danger);
}
.pf-project-archive {
  background: none;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  cursor: pointer;
  padding: 1px 4px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  line-height: 1.2;
  opacity: 0.5;
  transition: opacity 0.15s, color 0.15s, background 0.15s, border-color 0.15s;
}
.pf-project-archive:hover {
  opacity: 0.9;
  border-color: var(--color-warning);
}
.pf-project-archive.active {
  opacity: 1;
  color: var(--color-warning);
  background: color-mix(in srgb, var(--color-warning) 12%, transparent);
  border-color: var(--color-warning);
}
.pf-check-item.archived {
  opacity: 0.5;
}
.pf-check-item.archived .pf-check-text {
  text-decoration: line-through;
}
.pf-check-other {
  font-size: 9px;
  font-weight: 600;
  color: var(--color-warning);
  background: color-mix(in srgb, var(--color-warning) 12%, transparent);
  width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}
.pf-check-role {
  margin-left: auto;
  font-size: 10px;
  font-weight: 500;
  color: var(--color-text-muted);
  background: var(--color-surface-alt);
  padding: 1px 6px;
  border-radius: 8px;
  flex-shrink: 0;
}
.pf-table-name {
  font-weight: 500;
  color: var(--color-text);
}
.pf-table-desc {
  font-size: var(--font-xs);
  color: var(--color-text-muted);
  margin-top: 1px;
}
.pf-table-count {
  display: inline-block;
  min-width: 24px;
  text-align: center;
  font-weight: 500;
  font-size: var(--font-sm);
  color: var(--color-text);
  background: var(--color-surface-alt);
  padding: 2px 8px;
  border-radius: 8px;
}
.pf-empty-state {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}
.pf-lobby-cta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* ── Rates tab (MERMIX-76, ADR-038) ─────────────────────────────────── */
.rates-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
}
.rates-toolbar-left,
.rates-toolbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.rates-toolbar-label {
  font-size: var(--font-sm);
  color: var(--color-text-muted);
  font-weight: 500;
}
.rates-currency-select {
  max-width: 140px;
  text-transform: none;
  letter-spacing: 0;
}
.rates-table-container {
  max-height: 50vh;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}
.rates-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-sm);
}
.rates-table thead {
  position: sticky;
  top: 0;
  background: var(--color-surface-alt);
  z-index: 1;
}
.rates-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
.rates-table th.rates-col-num {
  text-align: right;
  width: 140px;
}
.rates-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
.rates-table tr:last-child td {
  border-bottom: none;
}
.rates-table tr:hover td {
  background: var(--color-surface-alt);
}
.rates-table .rates-resource-name {
  font-weight: 500;
  color: var(--color-text);
}
.rates-table input.rates-input {
  width: 100%;
  max-width: 110px;
  padding: 4px 8px;
  font-size: var(--font-sm);
  font-family: inherit;
  text-align: right;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
}
.rates-table input.rates-input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px var(--color-accent-subtle);
}
.rates-table input.rates-input.rates-input-dirty {
  border-color: var(--color-warning);
}
.rates-footer {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding-top: var(--space-md);
  margin-top: var(--space-md);
  border-top: 1px solid var(--color-border);
}
.rates-save-status {
  font-size: var(--font-sm);
  color: var(--color-text-muted);
}
.rates-save-status.success { color: var(--color-success); }
.rates-save-status.error   { color: var(--color-danger); }

/* Apply-to-all dialog */
.rates-apply-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}
.rates-apply-form .rates-apply-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-sm);
  align-items: center;
}
.rates-apply-form label {
  font-size: var(--font-sm);
  color: var(--color-text-muted);
}
.rates-apply-form input {
  width: 110px;
  padding: 4px 8px;
  text-align: right;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: inherit;
  font-size: var(--font-sm);
}

/* Portfolio Rates section */
.pf-rates-section {
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border);
}
.pf-rates-section h4 {
  font-size: var(--font-md);
  font-weight: 600;
  margin: 0 0 var(--space-xs);
  color: var(--color-text);
}
.pf-rates-section .pf-rates-desc {
  font-size: var(--font-sm);
  color: var(--color-text-muted);
  margin: 0 0 var(--space-md);
}
.pf-rates-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.pf-rates-table th {
  text-align: left;
  padding: 8px 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  color: var(--color-text-muted);
  background: var(--color-surface-alt);
  border-bottom: 1px solid var(--color-border);
}
.pf-rates-table th.num { text-align: right; width: 110px; }
.pf-rates-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--color-border);
}
.pf-rates-table tr:last-child td { border-bottom: none; }
.pf-rates-table .pf-rates-default {
  text-align: right;
  color: var(--color-text-muted);
  font-style: italic;
}
.pf-rates-table input {
  width: 90px;
  padding: 4px 6px;
  text-align: right;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: inherit;
  font-size: var(--font-sm);
}
.pf-rates-table input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px var(--color-accent-subtle);
}
