/* ═══════════════════════════════════════════
   COMPONENTS — components.css
   ════════════════════════════════════════════ */

/* ══════════════
   BUTTONS
   ══════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background var(--transition-base),
    border-color var(--transition-base),
    color var(--transition-base),
    box-shadow var(--transition-base),
    transform var(--transition-fast);
  -webkit-user-select: none;
  user-select: none;
  line-height: 1;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
  border-radius: var(--radius-md);
  gap: var(--space-3);
}
.btn-lg svg { width: 18px; height: 18px; }

.btn-sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  border-radius: var(--radius-xs);
}
.btn-sm svg { width: 14px; height: 14px; }

/* Primary */
.btn-primary {
  background: var(--color-accent);
  color: var(--color-white);
  border-color: var(--color-accent);
}
.btn-primary:hover {
  background: var(--color-accent-dark);
  border-color: var(--color-accent-dark);
  box-shadow: 0 4px 12px rgba(var(--color-accent-rgb), 0.4);
  transform: translateY(-1px);
}

/* Secondary */
.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border);
}
.btn-secondary:hover {
  background: var(--color-surface-2);
  border-color: var(--color-gray-300);
  transform: translateY(-1px);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
}

/* Danger */
.btn-danger {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border-color: rgba(239,68,68,0.3);
}
.btn-danger:hover {
  background: var(--color-danger);
  color: var(--color-white);
  box-shadow: 0 4px 12px rgba(239,68,68,0.3);
  transform: translateY(-1px);
}

/* ══════════════
   CARDS
   ══════════════ */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-top: 2px solid var(--color-accent);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: var(--space-6);
  transition: box-shadow var(--transition-base);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  gap: var(--space-3);
}

.card-header.collapsible {
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
.card-header.collapsible:hover { background: var(--color-gray-50); }

.card-title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.card-title svg { width: 18px; height: 18px; color: var(--color-accent); }

.collapse-chevron {
  width: 18px; height: 18px;
  color: var(--color-text-muted);
  transition: transform var(--transition-base);
  flex-shrink: 0;
}
.card-header.collapsible[aria-expanded="true"] .collapse-chevron {
  transform: rotate(180deg);
}

.card-body {
  padding: var(--space-6);
}
.card-body.collapsed { display: none; }

/* ══════════════
   FORMS
   ══════════════ */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-group label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.form-group label small {
  font-weight: 400;
  color: var(--color-text-muted);
}

.form-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
  margin-top: var(--space-4);
}

.form-actions-inline {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.field-error {
  font-size: var(--text-xs);
  color: var(--color-danger);
  min-height: 16px;
  display: block;
}

input.error, select.error, textarea.error {
  border-color: var(--color-danger);
}

/* Dropdown config section */
.dropdown-config {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  animation: expandDown 0.2s ease;
}

.optionset-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.optionset-row select { flex: 1; min-width: 160px; }

.or-divider {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  white-space: nowrap;
}

.new-optionset-form {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px dashed var(--color-border);
  animation: expandDown 0.2s ease;
}

/* ══════════════
   FIELD LIST (Admin)
   ══════════════ */
.field-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.field-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  cursor: grab;
}
.field-item:hover {
  border-color: var(--color-gray-300);
  box-shadow: var(--shadow-sm);
  background: var(--color-gray-50);
}
.field-item.dragging {
  opacity: 0.5;
  cursor: grabbing;
}
.field-item.drag-over {
  border-color: var(--color-accent);
  background: var(--color-accent-light);
}

.field-drag-handle {
  color: var(--color-text-subtle);
  cursor: grab;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.field-drag-handle svg { width: 16px; height: 16px; }

.field-item-name {
  flex: 1;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  min-width: 0;
}
.field-item-name input {
  padding: var(--space-1) var(--space-2);
  width: 100%;
  font-weight: 600;
  border-radius: var(--radius-xs);
}

.field-type-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.badge-text     { background: var(--color-info-bg); color: var(--color-info); }
.badge-numeric  { background: var(--color-success-bg); color: var(--color-success); }
.badge-date     { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-dropdown { background: var(--color-accent-light); color: var(--color-accent-dark); }
.badge-lognote  { background: #E8E0F5; color: #5B3FA0; }

.field-item-optionset {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  white-space: nowrap;
}

.field-item-actions {
  display: flex;
  gap: var(--space-1);
  opacity: 0;
  transition: opacity var(--transition-base);
}
.field-item:hover .field-item-actions { opacity: 1; }

/* ══════════════
   OPTION SETS (Admin)
   ══════════════ */
.optionset-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.optionset-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.optionset-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  cursor: pointer;
  transition: background var(--transition-base);
}
.optionset-header:hover { background: var(--color-surface-2); }

.optionset-name {
  flex: 1;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}

.optionset-meta {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  display: flex;
  gap: var(--space-3);
}

.usage-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.optionset-body {
  padding: var(--space-4);
  background: var(--color-surface-2);
  display: none;
}
.optionset-body.expanded { display: block; }

.option-items {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.option-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.option-item input {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
}

.option-add-row {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-3);
}
.option-add-row input { flex: 1; }

/* ══════════════
   VIEW ALL TABLE
   ══════════════ */
.table-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.search-wrap {
  flex: 1;
  min-width: 200px;
  position: relative;
}
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--color-text-muted);
  pointer-events: none;
}
.search-wrap input {
  padding-left: 38px !important;
}

.sort-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.sort-wrap select { width: auto; }
.sort-dir-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition-base);
  flex-shrink: 0;
}
.sort-dir-btn:hover { border-color: var(--color-accent); color: var(--color-accent); }
.sort-dir-btn svg { width: 16px; height: 16px; }

.rows-per-page-wrap select { width: auto; }

/* ── Columns picker ── */
.columns-wrap {
  position: relative;
  flex-shrink: 0;
}
.columns-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 200;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  min-width: 180px;
  padding: var(--space-2) 0;
  max-height: 320px;
  overflow-y: auto;
}
.columns-dropdown.hidden { display: none; }
.col-picker-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--color-text);
  transition: background var(--transition-fast);
  user-select: none;
}
.col-picker-item:hover { background: var(--color-surface-2); }
.col-picker-item input[type="checkbox"] {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--color-accent);
  flex-shrink: 0;
  cursor: pointer;
}
.col-picker-divider {
  height: 1px;
  background: var(--color-border);
  margin: var(--space-2) 0;
}
.col-picker-actions {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
}
.col-picker-actions button {
  flex: 1;
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-border);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.col-picker-actions button:hover { border-color: var(--color-accent); color: var(--color-accent); }

.table-wrap {
  overflow: hidden;
  padding: 0;
  margin-bottom: var(--space-4);
}

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

.leads-table thead {
  background: var(--color-surface-2);
}

.leads-table th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  transition: color var(--transition-base);
}
.leads-table th:hover { color: var(--color-accent); }
.leads-table th.sorted { color: var(--color-accent); }
.leads-table th .sort-arrow { margin-left: 4px; opacity: 0.6; }

.leads-table th:first-child { width: 40px; padding-left: var(--space-4); cursor: default; }
.leads-table th:last-child { width: 80px; }

.leads-table tbody tr {
  border-bottom: 1px solid var(--color-border);
  transition: background var(--transition-fast);
  cursor: pointer;
}
.leads-table tbody tr:nth-child(even) { background: var(--color-gray-50); }
.leads-table tbody tr:hover { background: var(--color-accent-light); }
.leads-table tbody tr:last-child { border-bottom: none; }

.leads-table td {
  padding: var(--space-3) var(--space-4);
  color: var(--color-text);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leads-table td:first-child {
  width: 40px;
}

/* Row actions */
.row-actions {
  display: flex;
  gap: var(--space-1);
  opacity: 0;
  transition: opacity var(--transition-fast);
}
.leads-table tbody tr:hover .row-actions { opacity: 1; }

/* Table empty */
.table-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16) var(--space-6);
  gap: var(--space-4);
  text-align: center;
}
.table-empty svg { width: 64px; height: 64px; }
.table-empty h3 { font-size: var(--text-xl); color: var(--color-text); }
.table-empty p { color: var(--color-text-muted); max-width: 300px; }

/* Count chip */
.count-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-4) 0;
}
.pagination-info {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* ══════════════
   LEAD FORM
   ══════════════ */
.lead-selector-dropdown {
  min-width: 200px;
  max-width: 300px;
}

.lead-form-meta {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.meta-item {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.lead-form-actions-top {
  display: flex;
  gap: var(--space-2);
}

/* ══════════════════════════════════════════════════
   LEAD FORM GRID — 8-column proportional responsive
   ══════════════════════════════════════════════════

   Four tiers, each halving the column count:

     >960px   → 8 columns  spans 1–8 as stored
     641–960px → 4 columns  ceil(n/2): 1→1 2→1 3→2 4→2 5→3 6→3 7→4 8→4
     361–640px → 2 columns  ceil(n/4): 1–4→1  5–8→2
     ≤360px   → 1 column   all full-width

   Example — four fields at colSpan 2 (each 1/4):
     >960px  : 4 per row  (span 2 on 8-col = 25% each)
     641–960px: 4 per row  (span 1 on 4-col = 25% each)  ← same proportion
     361–640px: 2 per row  (span 1 on 2-col = 50% each)  ← natural 2×2 wrap
     ≤360px  : 1 per row  (full width)
   ══════════════════════════════════════════════════ */

.lead-fields-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: var(--space-5);
  position: relative;
  padding-left: 24px; /* room for absolutely-positioned drag handle */
}

/* ── 8-column spans (desktop) ── */
.lead-field-wrapper[data-colspan="1"] { grid-column: span 1; }
.lead-field-wrapper[data-colspan="2"] { grid-column: span 2; }
.lead-field-wrapper[data-colspan="3"] { grid-column: span 3; }
.lead-field-wrapper[data-colspan="4"] { grid-column: span 4; }
.lead-field-wrapper[data-colspan="5"] { grid-column: span 5; }
.lead-field-wrapper[data-colspan="6"] { grid-column: span 6; }
.lead-field-wrapper[data-colspan="7"] { grid-column: span 7; }
.lead-field-wrapper[data-colspan="8"] { grid-column: span 8; }

/* ── 4-column grid (641–960px) ──
   ceil(n/2): proportions preserved — four 1/4 fields stay 4-per-row */
@media (max-width: 960px) {
  .lead-fields-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .lead-field-wrapper[data-colspan="1"] { grid-column: span 1; }
  .lead-field-wrapper[data-colspan="2"] { grid-column: span 1; }
  .lead-field-wrapper[data-colspan="3"] { grid-column: span 2; }
  .lead-field-wrapper[data-colspan="4"] { grid-column: span 2; }
  .lead-field-wrapper[data-colspan="5"] { grid-column: span 3; }
  .lead-field-wrapper[data-colspan="6"] { grid-column: span 3; }
  .lead-field-wrapper[data-colspan="7"] { grid-column: span 4; }
  .lead-field-wrapper[data-colspan="8"] { grid-column: span 4; }
}

/* ── 2-column grid (361–640px) ──
   ceil(n/4): four 1/4 fields become 2-per-row (the 2×2 wrap) */
@media (max-width: 640px) {
  .lead-fields-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .lead-field-wrapper[data-colspan="1"] { grid-column: span 1; }
  .lead-field-wrapper[data-colspan="2"] { grid-column: span 1; }
  .lead-field-wrapper[data-colspan="3"] { grid-column: span 1; }
  .lead-field-wrapper[data-colspan="4"] { grid-column: span 1; }
  .lead-field-wrapper[data-colspan="5"] { grid-column: span 2; }
  .lead-field-wrapper[data-colspan="6"] { grid-column: span 2; }
  .lead-field-wrapper[data-colspan="7"] { grid-column: span 2; }
  .lead-field-wrapper[data-colspan="8"] { grid-column: span 2; }
}

/* ── 1-column grid (≤360px) — hide drag handles ── */
@media (max-width: 360px) {
  .lead-fields-grid {
    grid-template-columns: 1fr;
    padding-left: 0;
  }
  .lead-field-wrapper { grid-column: span 1 !important; }
  .field-drag-handle  { display: none !important; }
}

/* ── Field wrapper ── */
.lead-field-wrapper {
  position: relative;
  min-width: 0;
  transition: box-shadow var(--transition-fast);
}

/* Drop target indicator */
.lead-field-wrapper.drag-over {
  outline: 2px dashed var(--color-accent);
  outline-offset: 4px;
  border-radius: var(--radius-md);
  background: rgba(var(--color-accent-rgb), 0.04);
}

/* Being dragged */
.lead-field-wrapper.dragging {
  opacity: 0.4;
  cursor: grabbing;
}

/* ── Textarea (lead form) — no manual resize; rows controlled via popup ── */
.lead-fields-grid textarea {
  resize: none;
  min-height: 0;   /* cancel base.css min-height: 80px so rows attribute takes effect */
  overflow-y: auto;
}

/* ── Drag-to-reorder handle (left edge) ── */
.field-drag-handle {
  position: absolute;
  left: -22px;
  top: 32px;           /* below label */
  width: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-subtle);
  cursor: grab;
  opacity: 0;
  transition: opacity var(--transition-base), color var(--transition-fast);
  padding: 4px 2px;
  border-radius: var(--radius-xs);
}
.field-drag-handle svg { width: 14px; height: 20px; }
.lead-field-wrapper:hover .field-drag-handle { opacity: 1; }
.lead-field-wrapper:hover .field-drag-handle:hover { color: var(--color-accent); }
.lead-field-wrapper.dragging .field-drag-handle { opacity: 1; cursor: grabbing; }

/* ── Field label row (label + gear button) ── */
.field-label-row {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.field-label-row label { margin-bottom: 0; }

.field-options-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  background: none;
  color: var(--color-text-subtle);
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition-fast), color var(--transition-fast);
  border-radius: var(--radius-xs);
}
.field-options-btn svg { width: 12px; height: 12px; }
.lead-field-wrapper:hover .field-options-btn { opacity: 1; }
.field-options-btn:hover { color: var(--color-accent); }

/* ── Field options popup ── */
.field-options-popup {
  position: absolute;
  z-index: var(--z-dropdown, 200);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-4);
  min-width: 260px;
}
.field-options-popup.hidden { display: none; }

.fop-section { display: flex; flex-direction: column; gap: var(--space-2); }

.fop-title {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-muted);
}

.fop-btns {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.fop-btn {
  min-width: 38px;
  height: 32px;
  padding: 0 var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-raised);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}
.fop-btn:hover { background: var(--color-surface-2); color: var(--color-text); border-color: var(--color-accent); }
.fop-btn.active { background: var(--color-accent); color: var(--color-white); border-color: var(--color-accent); }

.fop-divider { height: 1px; background: var(--color-border); margin: var(--space-3) 0; }

/* ── Lead form divider — always full row at every breakpoint ── */
.lead-field-divider {
  grid-column: 1 / -1 !important;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  min-height: 32px;
}

.lead-field-divider .field-drag-handle {
  flex-shrink: 0;
  opacity: 0;
  transition: opacity var(--transition-fast);
}
.lead-field-divider:hover .field-drag-handle { opacity: 1; }

.divider-line {
  flex: 1;
  height: 2px;
  background: var(--color-border);
  border-radius: 1px;
  transition: background var(--transition-fast);
}
.lead-field-divider:hover .divider-line { background: var(--color-accent); opacity: 0.4; }

.divider-delete-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  background: none;
  color: var(--color-text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition-fast), color var(--transition-fast), background var(--transition-fast);
}
.divider-delete-btn svg { width: 14px; height: 14px; }
.lead-field-divider:hover .divider-delete-btn { opacity: 1; }
.divider-delete-btn:hover { color: var(--color-danger); background: var(--color-danger-bg); }

/* ── Admin list: divider badge + label ── */
.badge-divider {
  background: var(--color-surface-raised);
  color: var(--color-text-muted);
  border: 1px dashed var(--color-border);
}
.divider-admin-label {
  color: var(--color-text-muted);
  font-style: italic;
}

/* ══════════════════════════════════════════
   LOGGED NOTE FIELD
   ══════════════════════════════════════════ */

.lognote-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}

/* History area */
.lognote-history {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-height: 280px;
  overflow-y: auto;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
  padding: var(--space-3);
}

.lognote-empty {
  font-size: var(--text-sm);
  color: var(--color-text-subtle);
  text-align: center;
  padding: var(--space-4) 0;
}

.lognote-entry {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  border-left: 3px solid #7C5AC4;
}

.lognote-entry-meta {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  letter-spacing: 0.02em;
}

.lognote-entry-content {
  font-size: var(--text-sm);
  color: var(--color-text);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
}

/* Compose area */
.lognote-compose {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.lognote-new-textarea {
  width: 100%;
  resize: vertical;
  min-height: 0;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
  outline: none;
}
.lognote-new-textarea:focus {
  border-color: #7C5AC4;
  box-shadow: 0 0 0 3px rgba(124,90,196,0.20);
}

.lognote-submit-btn {
  align-self: flex-end;
  background: #7C5AC4;
  border-color: #7C5AC4;
  color: #fff;
}
.lognote-submit-btn:hover {
  background: #6344A8;
  border-color: #6344A8;
  box-shadow: 0 4px 12px rgba(124,90,196,0.35);
  transform: translateY(-1px);
}

/* Dark mode adjustments */
[data-theme="dark"] .lognote-history {
  background: var(--color-surface-2);
  border-color: var(--color-border);
}
[data-theme="dark"] .lognote-entry {
  background: var(--color-surface);
  border-color: var(--color-border);
}
[data-theme="dark"] .lognote-new-textarea {
  background: var(--color-surface-2);
  color: var(--color-text);
  border-color: var(--color-border);
}

/* Edit modal: locked type message */
.edit-field-type-locked-msg {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-style: italic;
}

/* ── Complete checkbox in date field label row ── */
.field-complete-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  margin-left: auto;
  white-space: nowrap;
  user-select: none;
}
.field-complete-toggle input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--color-success);
  width: 13px;
  height: 13px;
}

/* ── Completed date field — muted, no alert styling ── */
.lead-field-wrapper.lead-field-complete {
  opacity: 0.6;
}
.lead-field-wrapper.lead-field-complete input[type="date"] {
  color: var(--color-text-muted);
  text-decoration: line-through;
  border-color: var(--color-border);
  background: var(--color-surface);
  box-shadow: none;
}
.lead-field-wrapper.lead-field-complete > .field-label-row label {
  color: var(--color-text-muted);
}
.lead-field-wrapper.lead-field-complete .field-complete-toggle {
  color: var(--color-success);
}

/* ── Past-due / due-today field highlighting (lead page) ── */
.lead-field-wrapper.lead-field-past-due input[type="date"] {
  border-color: var(--color-danger);
  background: var(--color-danger-bg);
  box-shadow: 0 0 0 2px rgba(192,53,42,0.15);
}
.lead-field-wrapper.lead-field-due-today input[type="date"] {
  border-color: var(--color-warning);
  background: var(--color-warning-bg);
  box-shadow: 0 0 0 2px rgba(192,122,16,0.15);
}
.lead-field-wrapper.lead-field-past-due  > .field-label-row label { color: var(--color-danger);  }
.lead-field-wrapper.lead-field-due-today > .field-label-row label { color: var(--color-warning); }

/* ── Past-due / due-today banners (lead page) ── */
.past-due-banner,
.due-today-banner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
}
.past-due-banner  { background: var(--color-danger-bg);  border: 1px solid var(--color-danger);  color: var(--color-danger);  }
.due-today-banner { background: var(--color-warning-bg); border: 1px solid var(--color-warning); color: var(--color-warning); }
.past-due-banner svg,
.due-today-banner svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ── Date field config (admin) ── */
.date-config {
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-raised);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  margin-bottom: var(--space-3);
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
}
.form-hint {
  margin: var(--space-1) 0 0 calc(1em + var(--space-2));
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* ── View All: past-due / due-today row highlights ── */
.leads-table tbody tr.row-past-due {
  background: var(--color-danger-bg) !important;
}
.leads-table tbody tr.row-past-due:hover {
  background: rgba(239, 68, 68, 0.12) !important;
}
.leads-table tbody tr.row-due-today {
  background: var(--color-warning-bg) !important;
}
.leads-table tbody tr.row-due-today:hover {
  background: rgba(245, 158, 11, 0.12) !important;
}

/* ── Edit Field Modal ── */
.edit-field-warning {
  padding: var(--space-3) var(--space-4);
  background: var(--color-warning-bg);
  color: var(--color-warning);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  border-left: 3px solid var(--color-warning);
}
.edit-field-hint {
  font-size: var(--text-sm);
  color: var(--color-accent);
  background: var(--color-accent-light);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  margin: 0;
}

/* ── Text-to-Dropdown Modal ── */
.ttd-intro {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: 0 0 var(--space-4);
}
.ttd-options-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-height: 240px;
  overflow-y: auto;
  padding: var(--space-2) 0;
}
.ttd-option-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--text-sm);
  transition: background var(--transition-fast);
}
.ttd-option-item:hover { background: var(--color-surface-raised); }
.ttd-option-item input[type="checkbox"] { flex-shrink: 0; }
.ttd-no-values {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  font-style: italic;
  margin: var(--space-2) 0 0;
}

/* ══════════════
   MODALS
   ══════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,31,51,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  padding: var(--space-4);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease;
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  border-top: 2px solid var(--color-accent);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: scaleIn 0.2s var(--transition-spring);
}
.modal-sm { max-width: 400px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border);
}
.modal-header h2 { font-size: var(--text-lg); }

.modal-close {
  width: 32px; height: 32px;
  border: none;
  background: var(--color-surface-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 18px;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: all var(--transition-fast);
}
.modal-close:hover { background: var(--color-danger-bg); color: var(--color-danger); }

.modal-body {
  padding: var(--space-6);
}
.modal-body p { color: var(--color-text); }

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface-2);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.countdown {
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-danger);
  font-weight: 600;
}

/* ── Delete Data Modal ── */
.delete-data-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.delete-data-option {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.delete-data-option:hover { background: var(--color-surface-2); }
.delete-data-option input[type="radio"] { margin-top: 2px; flex-shrink: 0; }
.delete-data-option:has(input:checked) {
  border-color: var(--color-danger);
  background: var(--color-danger-bg);
}
.delete-data-option-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.delete-data-option-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}
.delete-data-option-desc {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.4;
}
.delete-data-tracker-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.delete-data-tracker-row.hidden { display: none; }
.delete-data-warning {
  font-size: var(--text-sm);
  color: var(--color-danger);
  min-height: 1.4em;
}

/* Template Grid */
.template-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}
@media (max-width: 480px) { .template-grid { grid-template-columns: 1fr; } }

.template-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-5);
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-base);
  text-align: center;
}
.template-card:hover {
  border-color: var(--color-accent);
  background: var(--color-accent-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.template-icon { font-size: 2rem; }
.template-card h3 { font-size: var(--text-base); font-weight: 700; color: var(--color-text); }
.template-card p { font-size: var(--text-xs); color: var(--color-text-muted); margin: 0; }
.template-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  background: var(--color-surface-2);
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
}

/* Import stats */
.import-stats {
  display: flex;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  justify-content: center;
}
.import-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  background: var(--color-surface-2);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-5);
  border: 1px solid var(--color-border);
}
.import-stat span {
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--color-accent);
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.radio-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  cursor: pointer;
  width: auto;
}
.radio-label input { width: auto; }

/* ══════════════
   TOASTS
   ══════════════ */
.toast-container {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  background: var(--color-primary);
  color: var(--color-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  font-weight: 500;
  pointer-events: all;
  max-width: 360px;
  border-left: 3px solid var(--color-accent);
  animation: slideInRight 0.25s var(--transition-spring);
}
.toast.toast-success { border-left-color: var(--color-success); }
.toast.toast-warning { border-left-color: var(--color-warning); }
.toast.toast-error   { border-left-color: var(--color-danger); }
.toast.toast-out     { animation: slideOutRight 0.2s ease forwards; }
.toast-icon { width: 18px; height: 18px; flex-shrink: 0; }

/* ══════════════
   SAVE INDICATOR
   ══════════════ */
.save-indicator {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: 500;
  min-width: 140px;
  text-align: right;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
}
.save-indicator .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--color-text-subtle);
  flex-shrink: 0;
}
.save-indicator.saving .dot  { background: var(--color-warning); animation: pulse 1s infinite; }
.save-indicator.saved .dot   { background: var(--color-success); }
.save-indicator.offline      { color: #B45309; }
.save-indicator.offline .dot { background: #D97706; }
.save-indicator.syncing      { color: var(--color-text-muted); }
.save-indicator.syncing .dot { background: var(--color-warning); animation: pulse 1s infinite; }
.save-indicator.synced       { color: var(--color-success); }
.save-indicator.synced .dot  { background: var(--color-success); }

/* ══════════════
   ALERTS PAGE
   ══════════════ */

.alerts-content {
  max-width: 760px;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding-bottom: var(--space-8);
}

.alerts-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-12) var(--space-4);
  color: var(--color-text-muted);
}
.alerts-empty svg {
  width: 48px; height: 48px;
  stroke: var(--color-success);
  opacity: 0.7;
}
.alerts-empty p {
  font-size: 1rem;
  font-weight: 500;
}

.alert-group {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.alert-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5);
  background: var(--color-surface-2);
  border-bottom: 1px solid var(--color-border);
}
.alert-group-name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text-primary);
}
.alert-group-count {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  background: var(--color-border);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.alert-group-items {
  display: flex;
  flex-direction: column;
}

.alert-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-5);
  background: none;
  border: none;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
  width: 100%;
}
.alert-item:last-child { border-bottom: none; }
.alert-item:hover { background: var(--color-surface-2); }

.alert-item-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.alert-item-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.alert-item-field {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.alert-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
}
.alert-item-date {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.alert-status {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}
.alert-past-due  { background: var(--color-danger-bg);  color: var(--color-danger);  }
.alert-due-today { background: var(--color-warning-bg); color: var(--color-warning); }

/* ══════════════
   EMPTY STATES
   ══════════════ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16) var(--space-6);
  text-align: center;
  gap: var(--space-4);
}
.empty-state .empty-icon { margin-bottom: var(--space-2); }
.empty-state .empty-icon svg { width: 80px; height: 80px; }
.empty-state h2 { font-size: var(--text-xl); color: var(--color-text); }
.empty-state p { color: var(--color-text-muted); max-width: 360px; }

.empty-list-msg {
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  padding: var(--space-4) 0;
}

/* ══════════════
   INFO BANNER
   ══════════════ */
.info-banner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  background: var(--color-info-bg);
  border: 1px solid var(--color-info);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--color-info);
  margin-bottom: var(--space-4);
}
.info-banner svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ══════════════
   SETTINGS
   ══════════════ */
.settings-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border);
}
.settings-stat-row:last-of-type { border-bottom: none; }
.stat-label { font-size: var(--text-sm); color: var(--color-text-muted); }
.stat-value { font-size: var(--text-sm); font-weight: 600; color: var(--color-text); font-family: var(--font-mono); }

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

.pref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border);
}
.pref-info { display: flex; flex-direction: column; gap: 2px; }
.pref-label { font-size: var(--text-sm); font-weight: 600; color: var(--color-text); }
.pref-desc  { font-size: var(--text-xs); color: var(--color-text-muted); }

/* Toggle Switch */
.toggle-switch {
  position: relative;
  width: 44px; height: 24px;
  background: var(--color-gray-300);
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition-base);
  flex-shrink: 0;
}
.toggle-switch[aria-checked="true"] { background: var(--color-accent); }
.toggle-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  background: var(--color-white);
  border-radius: 50%;
  transition: transform var(--transition-base);
  box-shadow: var(--shadow-sm);
}
.toggle-switch[aria-checked="true"] .toggle-thumb { transform: translateX(20px); }

/* Shortcut list */
.shortcut-list { display: flex; flex-direction: column; gap: var(--space-3); }
.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border);
}
.shortcut-row:last-child { border-bottom: none; }
.shortcut-row span { font-size: var(--text-sm); color: var(--color-text-muted); }

/* ══════════════
   ONBOARDING
   ══════════════ */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, var(--color-primary) 0%, #1D4268 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-overlay);
  padding: var(--space-4);
}

.onboarding-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-xl);
  padding: var(--space-12) var(--space-10);
  max-width: 520px;
  width: 100%;
  text-align: center;
  backdrop-filter: blur(20px);
  box-shadow: 0 40px 80px rgba(0,0,0,0.3);
  animation: scaleIn 0.4s var(--transition-spring);
}

.onboarding-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 16px;
  background: rgba(184,132,42,0.15);
  border: 1px solid rgba(184,132,42,0.35);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-accent);
  margin-bottom: var(--space-5);
}

.onboarding-title {
  font-size: clamp(1.875rem, 4vw, 2.5rem);
  font-weight: 700;
  color: var(--color-white);
  line-height: 1.2;
  margin-bottom: var(--space-4);
}

.onboarding-subtitle {
  font-size: var(--text-base);
  color: rgba(255,255,255,0.6);
  margin-bottom: var(--space-8);
  line-height: 1.6;
}

.onboarding-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.onboarding-actions .btn {
  justify-content: center;
  padding: var(--space-4);
}
.onboarding-actions .btn-primary {
  background: var(--color-accent);
  font-size: var(--text-base);
}
.onboarding-actions .btn-secondary {
  background: rgba(255,255,255,0.1);
  color: var(--color-white);
  border-color: rgba(255,255,255,0.15);
}
.onboarding-actions .btn-secondary:hover {
  background: rgba(255,255,255,0.2);
  transform: translateY(-1px);
}
.onboarding-actions .btn-ghost {
  color: rgba(255,255,255,0.5);
}
.onboarding-actions .btn-ghost:hover {
  color: rgba(255,255,255,0.8);
  background: rgba(255,255,255,0.05);
}

/* ══════════════
   TRACKER BAR
   ══════════════ */
.tracker-bar {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--space-4);
}

.tracker-selector-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 4px;
}

.tracker-select {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: var(--space-2) var(--space-3) !important;
  padding-right: 28px !important;
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--color-text);
  min-width: 160px;
  max-width: 260px;
  cursor: pointer;
}
.tracker-select:focus { box-shadow: none !important; }

.tracker-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background var(--transition-base), color var(--transition-base);
  flex-shrink: 0;
}
.tracker-btn:hover {
  background: var(--color-surface);
  color: var(--color-text);
}
.tracker-btn svg { width: 14px; height: 14px; }

.tracker-new-btn:hover {
  background: var(--color-accent);
  color: var(--color-white);
}

/* Tracker dropdown menu */
.tracker-menu-wrap {
  position: relative;
}

.tracker-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  z-index: var(--z-dropdown);
  overflow: hidden;
  animation: scaleIn 0.15s var(--transition-spring);
  transform-origin: top right;
}

.tracker-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: none;
  background: transparent;
  color: var(--color-text);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background var(--transition-fast);
}
.tracker-menu-item svg { width: 15px; height: 15px; color: var(--color-text-muted); flex-shrink: 0; }
.tracker-menu-item:hover { background: var(--color-surface-2); }

.tracker-menu-item-danger { color: var(--color-danger); }
.tracker-menu-item-danger svg { color: var(--color-danger); }
.tracker-menu-item-danger:hover { background: var(--color-danger-bg); }

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

/* Settings section label */
.settings-section-label {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
  margin-top: var(--space-2);
}

/* Dark mode: tracker bar */
[data-theme="dark"] .tracker-selector-wrap {
  background: var(--color-surface-2);
  border-color: var(--color-border);
}
[data-theme="dark"] .tracker-select {
  background: transparent !important;
  color: var(--color-text);
}
[data-theme="dark"] .tracker-dropdown-menu {
  background: var(--color-surface);
}

/* Responsive: hide tracker label on mobile */
@media (max-width: 640px) {
  .tracker-select { min-width: 120px; max-width: 160px; }
  .tracker-bar { padding: 0 var(--space-2); }
}

/* Back button */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}
.back-btn svg { width: 16px; height: 16px; }
.back-btn:hover { color: var(--color-text); }
