/* ── SETTINGS MODAL ── */
.settings-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(20,10,35,0.7);
  z-index: 500;
  align-items: center; justify-content: center;
  backdrop-filter: blur(8px);
}
.settings-overlay.open { display: flex; }
.settings-modal {
  background: linear-gradient(135deg, rgba(48,31,62,0.95), rgba(90,50,80,0.95));
  border: 1px solid var(--border2);
  border-radius: var(--r-lg);
  padding: 36px;
  max-width: 480px; width: 90%;
  box-shadow: var(--shadow-lg);
  animation: fadeUp 0.25s ease both;
  backdrop-filter: blur(20px);
}
.settings-title { font-family: 'Cormorant Garamond', serif; font-size: 26px; font-weight: 400; color: var(--white); margin-bottom: 5px; }
.settings-sub { font-size: 13px; color: var(--text3); margin-bottom: 28px; }
.api-status { display: flex; align-items: center; gap: 8px; margin-bottom: 22px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); transition: background 0.2s; }
.status-dot.ok { background: var(--tiffany); box-shadow: 0 0 8px var(--tiffany); }
.status-dot.err { background: var(--danger); }
.status-text { font-size: 13px; color: var(--text3); }
.settings-note { margin-top: 16px; padding: 13px 16px; background: var(--tiffany-bg); border: 1px solid var(--tiffany-bd); border-radius: 9px; font-size: 12.5px; color: var(--text2); line-height: 1.65; }
.settings-close-row { display: flex; justify-content: flex-end; margin-top: 20px; }

/* ── SETTINGS TABS ── */
.settings-tabs { display: flex; gap: 4px; margin-bottom: 28px; background: var(--surface3); border-radius: var(--r-pill); padding: 4px; }
.settings-tab { flex: 1; padding: 10px 14px; border-radius: var(--r-pill); border: none; background: none; font-family: inherit; font-size: 12.5px; font-weight: 500; color: var(--text3); cursor: pointer; transition: all 0.18s; }
.settings-tab.active { background: var(--surface2); color: var(--white); }
.settings-pane { display: none; }
.settings-pane.active { display: block; }

/* ── TOKEN LOG ── */
.token-summary { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.token-stat { background: var(--surface3); border: 1px solid var(--border); border-radius: var(--r); padding: 14px; text-align: center; }
.token-stat-val { font-size: 22px; font-weight: 700; color: var(--tiffany); font-family: 'Cormorant Garamond', serif; margin-bottom: 3px; }
.token-stat-label { font-size: 10px; color: var(--text4); letter-spacing: 0.08em; text-transform: uppercase; }
.token-log-wrap { max-height: 340px; overflow-y: auto; }
.token-log-item { padding: 11px 14px; border: 1px solid var(--border); border-radius: var(--r); margin-bottom: 7px; background: var(--surface3); }
.token-log-item:hover { border-color: var(--tiffany-bd); }
.token-log-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.token-log-agent { font-size: 11.5px; font-weight: 700; color: var(--tiffany); }
.token-log-cost { font-size: 13px; font-weight: 700; color: var(--white); }
.token-log-time { font-size: 11px; color: var(--text4); margin-bottom: 4px; }
.token-log-detail { display: flex; gap: 8px; flex-wrap: wrap; }
.token-log-pill { font-size: 11px; padding: 2px 9px; border-radius: 20px; background: var(--surface2); color: var(--text3); }
.token-log-empty { padding: 32px; text-align: center; color: var(--text4); font-size: 13px; }
.token-clear-btn { font-size: 11.5px; color: var(--danger); background: none; border: 1px solid rgba(232,122,122,0.3); border-radius: var(--r-pill); padding: 5px 12px; cursor: pointer; font-family: inherit; transition: all 0.15s; }
.token-clear-btn:hover { background: rgba(232,122,122,0.1); }

/* ── USERS ADMIN PANEL ── */
.user-pill-role.admin { background: rgba(255,200,100,0.12); border-color: rgba(255,200,100,0.3); color: #ffc864; }

.users-table { width: 100%; border-collapse: collapse; margin-top: 16px; }
.users-table th {
  font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text3); padding: 10px 14px; text-align: left;
  border-bottom: 1px solid var(--border); background: var(--surface3);
}
.users-table th:first-child { border-radius: 8px 0 0 0; }
.users-table th:last-child { border-radius: 0 8px 0 0; }
.users-table td { padding: 14px 14px; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 13px; vertical-align: middle; line-height: 1.4; }
.users-table tr:last-child td { border-bottom: none; }
.users-table tr:hover td { background: rgba(255,255,255,0.03); }
.role-badge {
  display: inline-block; padding: 3px 10px; border-radius: 10px; font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
}
.role-badge.admin { background: rgba(255,200,100,0.12); border: 1px solid rgba(255,200,100,0.3); color: #ffc864; }
.role-badge.user  { background: var(--tiffany-bg); border: 1px solid var(--tiffany-bd); color: var(--tiffany); }
.status-badge { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.status-badge.active   { background: #69d795; }
.status-badge.inactive { background: var(--text4); }
.user-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.user-act-btn {
  padding: 6px 13px; border-radius: 20px; font-size: 11px; font-weight: 600; font-family: inherit;
  border: 1px solid var(--border); background: var(--surface2); color: var(--text2); cursor: pointer; transition: all 0.15s;
  white-space: nowrap;
}
.user-act-btn:hover { border-color: var(--tiffany-bd); color: var(--tiffany); background: var(--tiffany-bg); }
.user-act-btn.danger:hover { border-color: rgba(232,122,122,0.4); color: var(--danger); background: rgba(232,122,122,0.1); }

/* New user form */
.new-user-form {
  background: var(--surface3); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 22px; margin-bottom: 20px;
}
.new-user-form .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.new-user-form .form-row-3 { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; }

/* Reset password inline */
.reset-pass-row { display: flex; gap: 8px; margin-top: 8px; }
.reset-pass-row input { flex: 1; }

/* ── DNA REFERENCE CIRCLES ── */
.dna-section { margin-bottom: 28px; }
.dna-status {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px;
  background: var(--tiffany-bg);
  border: 1px solid var(--tiffany-bd);
  border-radius: var(--r);
  font-size: 13px; color: var(--tiffany);
  margin-bottom: 14px;
}
.dna-status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--tiffany); box-shadow: 0 0 6px var(--tiffany); flex-shrink: 0; }
.dna-status.empty { background: var(--surface3); border-color: var(--border); color: var(--text3); }
.dna-status.empty .dna-status-dot { background: var(--text4); box-shadow: none; }
.dna-circles-wrap { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.dna-circle {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  cursor: pointer;
}
.dna-circle-img {
  width: 64px; height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  transition: all 0.18s;
}
.dna-circle:hover .dna-circle-img { border-color: var(--tiffany-bd); }
.dna-circle.active .dna-circle-img {
  border-color: var(--tiffany);
  box-shadow: 0 0 0 3px var(--tiffany-bg), 0 0 16px rgba(105,197,215,0.3);
}
.dna-circle-label {
  font-size: 9.5px; font-weight: 600; color: var(--text4);
  text-align: center; max-width: 64px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  letter-spacing: 0.04em; text-transform: uppercase;
}
.dna-circle.active .dna-circle-label { color: var(--tiffany); }
.dna-selected-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 10px; }
.dna-chip {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 5px 5px 5px;
  background: var(--tiffany-bg);
  border: 1px solid var(--tiffany-bd);
  border-radius: 50px;
  font-size: 11.5px; color: var(--tiffany);
}
.dna-chip img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.dna-chip-name { padding-right: 6px; font-weight: 500; max-width: 90px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dna-chip-remove { width: 18px; height: 18px; border-radius: 50%; background: rgba(105,197,215,0.2); border: none; cursor: pointer; font-size: 10px; color: var(--tiffany); display: flex; align-items: center; justify-content: center; margin-right: 2px; }
.dna-cat-tabs { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.dna-cat-tab {
  padding: 4px 12px; border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface3);
  font-size: 11.5px; color: var(--text3);
  cursor: pointer; transition: all 0.15s;
}
.dna-cat-tab:hover { border-color: var(--tiffany-bd); color: var(--tiffany); }
.dna-cat-tab.active { background: var(--tiffany-bg); border-color: var(--tiffany); color: var(--tiffany); }

/* ── DNA PICKER POPUP ── */
.dna-picker-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(10,5,20,0.85); z-index: 500;
  align-items: center; justify-content: center;
  backdrop-filter: blur(12px);
}
.dna-picker-overlay.open { display: flex; }
.dna-picker-inner {
  width: min(680px, 96vw);
  max-height: 86vh;
  background: rgba(28,14,44,0.97);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 20px;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
  animation: fadeUp 0.22s ease both;
}
.dna-picker-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}
.dna-picker-title { font-size: 14px; font-weight: 600; color: var(--white); }
.dna-picker-close {
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255,255,255,0.07); border: none;
  color: var(--text2); font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.dna-picker-close:hover { background: rgba(255,255,255,0.14); }
.dna-picker-models {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 14px 22px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.dna-model-tab {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--surface); color: var(--text2);
  font-family: monospace; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.18s;
}
.dna-model-tab:hover { border-color: var(--tiffany-bd); color: var(--tiffany); background: var(--tiffany-bg); }
.dna-model-tab.active { background: var(--tiffany-bg); border-color: var(--tiffany); color: var(--tiffany); }
.dna-model-tab-count { font-size: 11px; color: var(--text3); font-family: 'DM Sans', sans-serif; }
.dna-model-tab.active .dna-model-tab-count { color: var(--tiffany); opacity: 0.8; }
.dna-picker-photos {
  flex: 1; overflow-y: auto; padding: 18px 22px;
}
.dna-picker-cat-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text3);
  margin: 14px 0 10px;
}
.dna-picker-cat-label:first-child { margin-top: 0; }
.dna-picker-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px; margin-bottom: 4px;
}
.dna-picker-photo {
  position: relative; aspect-ratio: 3/4;
  border-radius: 10px; overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer; transition: all 0.18s;
}
.dna-picker-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dna-picker-photo:hover { border-color: var(--tiffany-bd); transform: translateY(-2px); }
.dna-picker-photo.selected { border-color: var(--tiffany); box-shadow: 0 0 0 2px var(--tiffany); }
.dna-picker-check {
  position: absolute; top: 5px; left: 5px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--tiffany); color: #1a0a2e;
  font-size: 11px; font-weight: 700;
  display: none; align-items: center; justify-content: center;
}
.dna-picker-photo.selected .dna-picker-check { display: flex; }
.dna-picker-footer {
  padding: 14px 22px;
  border-top: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
  display: flex; justify-content: flex-end;
}
