/* LeadSift — Components */

/* ===== SIDEBAR ===== */
.logo {
  font-size: 1.1rem; font-weight: 700; color: var(--text);
  padding: 0 8px 24px; display: flex; align-items: center; gap: 10px;
}
.logo-icon {
  width: 28px; height: 28px; background: var(--accent); color: #fff;
  border-radius: var(--radius-md); display: flex; align-items: center;
  justify-content: center; font-size: 14px;
}
.nav-section-label {
  font-size: 0.65rem; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--text-dim); padding: 16px 8px 8px; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px; border-radius: var(--radius-md); cursor: pointer;
  transition: all 0.15s; font-size: 0.88rem; color: var(--text-muted); font-weight: 500;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item > span:first-child { display: flex; align-items: center; }
.nav-item .icon, .nav-item .svg-icon-wrapper { width: 20px; margin-right: 10px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.svg-icon-wrapper { display: inline-flex; align-items: center; }
.lucide-icon { display: block; }
.nav-badge {
  font-size: 0.72rem; padding: 2px 8px; border-radius: var(--radius-lg);
  font-weight: 600; min-width: 28px; text-align: center;
}
.badge-hot { background: var(--green-soft); color: var(--green); }
.badge-warn { background: var(--yellow-soft); color: var(--yellow); }
.badge-info { background: var(--blue-soft); color: var(--blue); }
.badge-muted { background: var(--surface-3); color: var(--text-dim); }
.badge-red { background: var(--red-soft); color: var(--red); }
.sidebar-footer {
  margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border);
}

/* ===== CONVERSATION LIST ===== */
.conv-list-title {
  font-size: 1rem; font-weight: 700; margin-bottom: 12px;
  display: flex; align-items: center; justify-content: space-between;
}
.search-wrapper { position: relative; margin-bottom: 10px; }
.search-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--text-dim); font-size: 0.85rem;
  display: flex; align-items: center;
}
.search-box {
  width: 100%; padding: 8px 12px 8px 32px; border-radius: var(--radius-md);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 0.82rem; font-family: inherit;
  outline: none; transition: border-color 0.15s;
}
.search-box:focus { border-color: var(--accent); }
.search-box::placeholder { color: var(--text-muted); }
.filter-bar {
  display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap;
}
.filter-chip {
  padding: 4px 12px; border-radius: var(--radius-lg); font-size: 0.72rem;
  font-weight: 500; cursor: pointer; transition: all 0.15s;
  background: var(--surface); color: var(--text-dim); border: 1px solid var(--border);
}
.filter-chip:hover { color: var(--text); border-color: var(--text-dim); }
.filter-chip.active {
  background: var(--accent-soft); color: var(--accent); border-color: var(--accent);
}

/* Conversation Row */
.conv-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px 14px 24px; cursor: pointer;
  transition: background 0.1s, border-color 0.15s, padding 0.15s;
  border-bottom: 1px solid var(--border); position: relative;
}
.conv-row:hover { background: var(--surface-2); }
.conv-row.selected { background: var(--surface-3); border-left: 3px solid var(--accent); padding-left: 21px; }
.conv-row.selected:hover { background: var(--surface-3); }
.unread-dot {
  position: absolute; left: 8px; top: 50%; transform: translateY(-50%);
  width: 8px; height: 8px; border-radius: var(--radius-full); background: var(--green);
}
.conv-score {
  width: 40px; height: 40px; border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.82rem; font-weight: 700; flex-shrink: 0;
}
.score-hot { background: var(--green-soft); color: var(--green); }
.score-warm { background: var(--yellow-soft); color: var(--yellow); }
.score-cool { background: var(--blue-soft); color: var(--blue); }
.score-cold { background: var(--surface-3); color: var(--text-dim); }
.score-dead { background: var(--red-soft); color: var(--red); }
.score-meeting { background: var(--green-soft); color: var(--green); }
.conv-info { flex: 1; min-width: 0; }
.conv-name {
  font-size: 0.88rem; font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.location-tag {
  font-size: 0.65rem; padding: 1px 6px; border-radius: var(--radius-sm);
  background: var(--accent-soft); color: var(--accent); font-weight: 500;
}
.conv-address {
  font-size: 0.75rem; color: var(--text-dim); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conv-preview {
  font-size: 0.78rem; color: var(--text-muted); margin-top: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conv-meta {
  display: flex; align-items: center; gap: 8px; margin-top: 4px;
}
.conv-time { font-size: 0.7rem; color: var(--text-dim); }
.conv-status-tag {
  font-size: 0.65rem; font-weight: 600; padding: 3px 8px;
  border-radius: var(--radius-lg);
}
.tag-qualifying { background: var(--blue-soft); color: var(--blue); }
.tag-review { background: var(--yellow-soft); color: var(--yellow); }
.tag-scheduling { background: var(--orange-soft); color: var(--orange); }
.tag-meeting { background: var(--green-soft); color: var(--green); }
.tag-dead { background: var(--red-soft); color: var(--red); }
.tag-snoozed { background: var(--surface-3); color: var(--text-dim); }
.tag-waiting { background: var(--blue-soft); color: var(--blue); }
.tag-sent-crm { background: var(--blue-soft); color: var(--blue); }

/* Follow-up badge */
.follow-up-badge {
  font-size: 0.7rem; margin-top: 2px; padding: 1px 6px;
  border-radius: var(--radius-sm); display: inline-flex; align-items: center; gap: 4px;
}
.follow-up-badge.tier-1 { background: var(--yellow-soft); color: var(--yellow); }
.follow-up-badge.tier-2 { background: var(--orange-soft); color: var(--orange); }
.follow-up-badge.tier-3 { background: var(--red-soft); color: var(--red); }
.follow-up-badge.tier-4 { background: var(--surface-3); color: var(--text-dim); }

/* ===== THREAD ===== */
.thread-header {
  padding: 16px 24px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: flex-start; flex-shrink: 0;
}
.thread-contact { font-size: 1rem; font-weight: 700; }
.thread-meta-link { font-size: 0.78rem; color: var(--text-dim); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-group { display: flex; flex-direction: column; }
.msg-label {
  font-size: 0.7rem; color: var(--text-dim); margin-bottom: 4px;
}
.msg-label.right { text-align: right; }
.msg-bubble {
  max-width: 75%; padding: 10px 14px; border-radius: 12px;
  font-size: 0.82rem; line-height: 1.5; word-wrap: break-word;
}
.msg-inbound {
  background: var(--bubble-inbound); align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.msg-outbound {
  background: var(--accent); align-self: flex-end;
  border-bottom-right-radius: 4px; color: #fff;
}
/* Call messages in thread */
.msg-call {
  max-width: 75%; padding: 10px 14px; border-radius: 12px;
  font-size: 0.82rem; display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border); background: var(--surface-2);
}
.msg-call-in { align-self: flex-start; border-bottom-left-radius: 4px; }
.msg-call-out { align-self: flex-end; border-bottom-right-radius: 4px; border-color: rgba(108, 92, 231, 0.3); }
.msg-call-icon { font-size: 1.1rem; flex-shrink: 0; }
.msg-call-info { display: flex; flex-direction: column; gap: 2px; }
.msg-call-label { font-weight: 600; color: var(--text); font-size: 0.78rem; }
.msg-call-detail { font-size: 0.72rem; color: var(--text-muted); }

/* Status Banner */
.thread-status-banner {
  padding: 12px 24px; font-size: 0.82rem; font-weight: 500;
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.banner-dead { background: var(--red-soft); color: var(--red); }
.banner-snoozed { background: var(--surface-2); color: var(--text-muted); }
.banner-meeting { background: var(--green-soft); color: var(--green); }
.banner-waiting { background: var(--blue-soft); color: var(--blue); }
.banner-sent-crm { background: var(--green-soft); color: var(--green); }
.banner-action {
  margin-left: auto; padding: 5px 14px; border-radius: var(--radius-sm);
  font-size: 0.75rem; font-weight: 600; cursor: pointer;
  border: 1px solid; background: transparent; font-family: inherit;
}
.banner-action.reactivate { border-color: var(--accent); color: var(--accent); }
.banner-action.reactivate:hover { background: var(--accent-soft); }
.banner-action.unsnooze { border-color: var(--accent); color: var(--accent); }
.banner-action.unsnooze:hover { background: var(--accent-soft); }
.banner-action.send-crm-banner { border-color: var(--green); color: var(--green); }
.banner-action.send-crm-banner:hover { background: var(--green-soft); }

/* ===== REPLY AREA ===== */
.reply-area {
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

/* --- AI suggestion bar (normal state) --- */
.ai-suggestion-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 20px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.ai-suggestion-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}
.ai-suggestion-icon { color: var(--accent); }
.kbd {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface-3);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-dim);
  border: 1px solid var(--border);
}

/* --- Regenerate button --- */
.btn-regen {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-regen:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.btn-regen:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn-regen--error {
  border-color: var(--red);
  color: var(--red);
}
.btn-regen--error:hover {
  background: var(--red-soft);
  border-color: var(--red);
}

/* --- AI Error Banner --- */
.ai-error-banner {
  padding: 10px 20px 12px;
  background: var(--red-soft);
  border-bottom: 1px solid rgba(255, 107, 107, 0.25);
  border-left: 3px solid var(--red);
}
.ai-error-body {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.ai-error-icon { color: var(--red); flex-shrink: 0; margin-top: 2px; }
.ai-error-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ai-error-message {
  font-size: 0.82rem;
  color: var(--red);
  font-weight: 600;
  line-height: 1.4;
}
.ai-error-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.ai-error-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
  padding-left: 26px;
}
.ai-error-details-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.72rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
  font-family: inherit;
}
.ai-error-details-btn:hover { color: var(--text-muted); }
.ai-error-technical {
  margin-top: 6px;
  font-size: 0.7rem;
  color: var(--text-dim);
  font-family: 'SF Mono', 'Fira Code', monospace;
  line-height: 1.5;
  background: var(--surface);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  word-break: break-word;
  width: 100%;
}

/* --- Compose box --- */
.reply-compose-box { padding: 14px 20px 0; }
.reply-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 0.85rem;
  font-family: inherit;
  resize: none;
  outline: none;
  line-height: 1.5;
  transition: border-color 0.15s;
}
.reply-textarea:focus { border-color: var(--accent); }
.reply-textarea::placeholder { color: var(--text-muted); }

/* --- Footer: feedback + actions --- */
.reply-footer {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 20px 16px;
}
.feedback-zone {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.feedback-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-dim);
  cursor: default;
}
.feedback-input {
  width: 100%;
  padding: 7px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-family: inherit;
  outline: none;
  resize: none;
  min-height: 44px;
  line-height: 1.45;
  box-sizing: border-box;
  transition: border-color 0.15s, color 0.15s;
}
.feedback-input::placeholder { color: var(--text-dim); }
.feedback-input:focus {
  border-color: var(--accent);
  color: var(--text);
}

/* Action buttons row */
.reply-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-reject {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--red);
  font-size: 0.8rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-reject:hover { background: var(--red-soft); }
.btn-reject:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.btn-snooze {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-snooze:hover { background: var(--surface-3); color: var(--text); }
.btn-snooze:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.snooze-chevron {
  transition: transform 0.15s;
  color: var(--text-dim);
}
.snooze-chevron.open { transform: rotate(180deg); }
.btn-approve {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--green);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 8px rgba(0, 196, 140, 0.25);
}
.btn-approve:hover {
  opacity: 0.92;
  box-shadow: 0 4px 14px rgba(0, 196, 140, 0.35);
}
.btn-approve:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* Snooze Dropdown */
.snooze-dropdown { position: relative; }
.snooze-menu {
  display: none;
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  min-width: 176px;
  z-index: 100;
  padding: 4px 0;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  overflow: hidden;
}
.snooze-menu.open { display: block; }
.snooze-group-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  font-weight: 600;
  padding: 8px 14px 4px;
}
.snooze-option {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: background 0.1s, color 0.1s;
}
.snooze-option:hover { background: var(--surface-2); color: var(--text); }
.snooze-option:focus-visible { outline: none; background: var(--surface-2); color: var(--text); }
.snooze-divider { border-top: 1px solid var(--border); margin: 4px 0; }
.snooze-option--stop { color: var(--red); }
.snooze-option--stop:hover { background: var(--red-soft); color: var(--red); }

/* ===== DETAIL PANEL ===== */
.detail-section-title {
  font-size: 0.65rem; text-transform: uppercase; letter-spacing: 1px;
  color: var(--text-dim); margin-bottom: 10px; font-weight: 600;
}

/* Qualification compact */
.qual-compact {
  display: flex; align-items: center; gap: 12px; margin-bottom: 8px;
}
.score-ring {
  width: 42px; height: 42px; border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.05rem; font-weight: 700; flex-shrink: 0;
}
.score-ring.high { background: var(--green-soft); color: var(--green); border: 2px solid var(--green); }
.score-ring.medium { background: var(--yellow-soft); color: var(--yellow); border: 2px solid var(--yellow); }
.score-ring.low { background: var(--surface-3); color: var(--text-dim); border: 2px solid var(--border); }
.score-ring.dead { background: var(--red-soft); color: var(--red); border: 2px solid var(--red); }
.score-ring.booked { background: var(--green-soft); color: var(--green); border: 2px solid var(--green); }
.score-summary { font-size: 0.78rem; color: var(--text-muted); }
.score-summary strong { color: var(--text); display: block; font-size: 0.85rem; }

/* Progress bar */
.qual-progress { margin-top: 6px; }
.qual-progress-label {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.72rem; margin-bottom: 5px;
}
.qual-progress-label span:first-child { color: var(--text-dim); }
.qual-progress-label span:last-child { color: var(--text-muted); font-weight: 600; }
.progress-bar-bg {
  height: 4px; background: var(--surface-3); border-radius: 2px; overflow: hidden;
}
.progress-bar-fill {
  height: 100%; border-radius: 2px; transition: width 0.3s;
}
.fill-green { background: var(--green); }
.fill-yellow { background: var(--yellow); }
.fill-dim { background: var(--text-dim); }

/* Signal grid */
.signal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.signal-item { padding: 4px 8px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.signal-item-label {
  font-size: 0.65rem; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.signal-item-value { font-size: 0.72rem; font-weight: 600; margin-top: 1px; }
.s-positive { color: var(--green); }
.s-neutral { color: var(--yellow); }
.s-negative { color: var(--red); }
.s-unknown { color: var(--text-dim); }

/* Detail rows */
.detail-row {
  display: flex; justify-content: space-between; padding: 3px 0; font-size: 0.76rem;
}
.detail-row-label { color: var(--text-dim); }
.detail-row-value {
  color: var(--text); font-weight: 500; text-align: right;
  max-width: 65%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Deal math */
.deal-math-row {
  display: flex; justify-content: space-between; padding: 3px 0; font-size: 0.74rem;
}
.deal-math-row-label { color: var(--text-dim); }
.deal-math-row-value {
  color: var(--text); font-weight: 600; font-family: 'DM Sans', monospace;
}
.deal-verdict {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: var(--radius-sm); margin-top: 4px;
  font-size: 0.74rem; font-weight: 600;
}
.verdict-likely { background: var(--green-soft); color: var(--green); }
.verdict-possible { background: var(--yellow-soft); color: var(--yellow); }
.verdict-thin { background: var(--surface-3); color: var(--text-dim); }
.verdict-no { background: var(--red-soft); color: var(--red); }
.verdict-unknown { background: var(--surface-3); color: var(--text-dim); }

/* Action buttons */
.action-buttons { display: flex; flex-direction: column; gap: 6px; }
.action-btn {
  width: 100%; padding: 7px; border-radius: var(--radius-md);
  font-size: 0.76rem; font-weight: 600; cursor: pointer;
  transition: all 0.15s; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.action-btn:hover { background: var(--surface-3); }
.action-btn.send-crm { background: var(--accent); color: #fff; border-color: var(--accent); }
.action-btn.send-crm:hover { opacity: 0.9; }
.action-btn.call { background: var(--green-soft); color: var(--green); border-color: rgba(0,196,140,0.3); }

/* CRM export form */
.crm-form-field { margin-bottom: 10px; }
.crm-form-label {
  display: block; font-size: 0.72rem; font-weight: 600; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px;
}
.crm-form-input {
  width: 100%; box-sizing: border-box;
  padding: 8px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg);
  color: var(--text); font-size: 0.82rem; font-family: inherit;
  transition: border-color 0.15s;
}
.crm-form-input:focus { outline: none; border-color: var(--accent); }
.crm-form-textarea { resize: vertical; min-height: 60px; }
.crm-form-actions { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }

/* Sent to CRM read-only banner */
.crm-sent-banner {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: var(--radius-md);
  background: var(--green-soft); color: var(--green);
  font-size: 0.82rem; font-weight: 600;
  border: 1px solid rgba(0,196,140,0.3);
}

/* ===== EMPTY STATES ===== */
.empty-state {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px;
  color: var(--text-dim); padding: 40px;
}
.empty-state-icon { font-size: 2.5rem; opacity: 0.4; }
.empty-state-title { font-size: 1rem; font-weight: 600; color: var(--text-muted); }
.empty-state-desc {
  font-size: 0.82rem; text-align: center; max-width: 280px; line-height: 1.5;
}

/* ===== QUICK STATS (no selection) ===== */
.stats-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.stat-card {
  background: var(--bg); padding: 14px; border-radius: var(--radius-md); text-align: center;
  border: 1px solid var(--border);
}
.stat-number { font-size: 1.3rem; font-weight: 700; }
.stat-label { font-size: 0.7rem; color: var(--text-dim); margin-top: 4px; }

/* ===== FOCUS & DISABLED ===== */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.nav-item:focus-visible,
.conv-row:focus-visible,
.filter-chip:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--accent);
}
.btn-approve:disabled,
.btn-snooze:disabled,
.btn-reject:disabled,
.btn-regen:disabled,
.action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Settings nav-item */
.nav-settings { color: var(--text-dim); font-size: 0.82rem; }

/* ===== SETTINGS PAGE ===== */
.settings-page {
  flex: 1; padding: 32px 40px; overflow-y: auto; background: var(--bg);
}
.settings-header { margin-bottom: 28px; }
.settings-title {
  font-size: 1.4rem; font-weight: 700; color: var(--text); margin: 0;
}
.settings-subtitle {
  font-size: 0.85rem; color: var(--text-muted); margin-top: 4px;
}
.settings-body {
  max-width: 680px; display: flex; flex-direction: column; gap: 16px;
}
.settings-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px 24px;
}
.settings-card-title {
  font-size: 0.82rem; font-weight: 700; color: var(--text);
  margin-bottom: 16px; text-transform: uppercase; letter-spacing: 0.5px;
}

/* Superadmin context banner */
.settings-superadmin-banner {
  position: sticky; top: 0; z-index: 10;
  background: var(--yellow-soft); border: 1px solid rgba(245, 166, 35, 0.3);
  border-radius: var(--radius-lg); padding: 12px 16px;
  display: flex; align-items: center; gap: 12px; margin-bottom: 8px;
}
.settings-superadmin-banner-icon { font-size: 16px; flex-shrink: 0; }
.settings-superadmin-banner-text {
  flex: 1; font-size: 0.82rem; color: var(--yellow); font-weight: 500; line-height: 1.4;
}
.settings-superadmin-banner-client { font-weight: 700; color: var(--text); }
.settings-superadmin-banner-badge {
  font-size: 0.65rem; font-weight: 700; padding: 3px 10px;
  border-radius: var(--radius-lg); background: rgba(245, 166, 35, 0.25);
  color: var(--yellow); border: 1px solid rgba(245, 166, 35, 0.4);
  text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap;
}

/* Section header with icon */
.settings-section-header {
  display: flex; align-items: center; gap: 10px; margin-bottom: 18px;
}
.settings-section-icon {
  width: 28px; height: 28px; border-radius: var(--radius-md);
  background: var(--surface-2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0; color: var(--text-muted);
}
.settings-section-title {
  font-size: 0.82rem; font-weight: 700; color: var(--text);
  text-transform: uppercase; letter-spacing: 0.5px; flex: 1;
}
.settings-section-badge {
  font-size: 0.65rem; font-weight: 600; padding: 2px 8px; border-radius: var(--radius-lg);
}
.settings-section-badge.badge-phase4 { background: var(--surface-3); color: var(--text-dim); }
.settings-section-badge.badge-coming-soon { background: var(--blue-soft); color: var(--blue); }

/* Platform key fallback status (admin read-only) */
.settings-platform-key-status {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; background: var(--bg);
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  font-size: 0.78rem; color: var(--text-muted); margin-bottom: 16px;
}
.settings-platform-key-status .status-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.settings-platform-key-status .status-dot.enabled { background: var(--green); }
.settings-platform-key-status .status-dot.disabled { background: var(--red); }

/* Webhook URL display */
.settings-webhook-url {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.settings-webhook-code {
  flex: 1; font-size: 0.78rem; font-family: monospace; color: var(--text);
  word-break: break-all; line-height: 1.4;
}
.settings-webhook-copy-btn {
  padding: 5px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text-muted); font-size: 0.72rem; font-weight: 500;
  cursor: pointer; font-family: inherit; flex-shrink: 0; transition: all 0.15s;
}
.settings-webhook-copy-btn:hover { background: var(--surface-3); color: var(--text); }
.settings-webhook-copy-btn.copied { color: var(--green); border-color: var(--green); }
.settings-webhook-copy-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Add Account form */
.settings-add-account-form {
  margin-top: 16px; padding: 16px; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  display: flex; flex-direction: column; gap: 12px;
}
.settings-add-account-row { display: flex; gap: 8px; }
.settings-add-account-row .settings-input { flex: 1; min-width: 0; }

/* Role dropdown in team member rows */
.user-mgmt-role-select {
  font-size: 0.72rem; font-weight: 600; padding: 3px 8px;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--bg); color: var(--text-muted);
  cursor: pointer; font-family: inherit;
}
.user-mgmt-role-select:disabled { cursor: not-allowed; opacity: 0.6; }

/* Password reset button */
.user-mgmt-action-btn.reset { color: var(--blue); }
.user-mgmt-action-btn.reset:hover { border-color: var(--blue); background: var(--blue-soft); }

/* Future/disabled section */
.settings-card.settings-card-future { opacity: 0.6; }
.settings-card.settings-card-future fieldset { border: none; padding: 0; margin: 0; }

/* Divider within a card */
.settings-divider { border-top: 1px solid var(--border); margin: 16px 0; }
.settings-field { margin-bottom: 16px; }
.settings-field:last-child { margin-bottom: 0; }
.settings-label {
  font-size: 0.78rem; font-weight: 600; color: var(--text); margin-bottom: 6px; display: block;
}
.settings-hint {
  font-size: 0.7rem; color: var(--text-dim); margin-top: 4px;
}
.settings-error {
  font-size: 0.7rem; color: var(--red); margin-top: 4px;
}
.settings-input, .settings-select {
  width: 100%; padding: 8px 12px; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-size: 0.82rem; font-family: inherit; outline: none;
}
.settings-input:focus, .settings-select:focus { border-color: var(--accent); }
.settings-select { cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238b8fa3'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 32px;
}
.settings-range-row {
  display: flex; align-items: center; gap: 12px;
}
.settings-range {
  flex: 1; -webkit-appearance: none; appearance: none; height: 4px;
  background: var(--surface-3); border-radius: 2px; outline: none;
}
.settings-range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); cursor: pointer; border: 2px solid var(--bg);
}
.settings-range-value {
  font-size: 0.82rem; font-weight: 700; color: var(--accent); min-width: 40px; text-align: right;
}
.settings-input-prefix {
  display: flex; align-items: center; gap: 0;
}
.settings-prefix {
  padding: 8px 0 8px 12px; background: var(--bg); border: 1px solid var(--border);
  border-right: none; border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  color: var(--text-dim); font-size: 0.82rem;
}
.settings-input-prefix .settings-input {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Toggle switch */
.settings-toggle {
  width: 40px; height: 22px; border-radius: 11px; cursor: pointer;
  background: var(--surface-3); position: relative; transition: background 0.2s;
  flex-shrink: 0;
}
.settings-toggle.on { background: var(--accent); }
.settings-toggle-knob {
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  position: absolute; top: 3px; left: 3px; transition: left 0.2s;
}
.settings-toggle.on .settings-toggle-knob { left: 21px; }
.settings-toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--border); gap: 16px;
}
.settings-toggle-row:last-child { border-bottom: none; }

/* Account / location list */
.settings-account-list { display: flex; flex-direction: column; }
.settings-location-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--border); gap: 12px;
}
.settings-location-row:last-child { border-bottom: none; }
.settings-location-info { flex: 1; min-width: 0; }
.settings-location-name { font-size: 0.82rem; color: var(--text); font-weight: 500; }
.settings-location-meta {
  display: flex; align-items: center; gap: 6px; margin-top: 3px;
  font-size: 0.7rem; color: var(--text-dim); flex-wrap: wrap;
}
.settings-location-id { font-family: monospace; font-size: 0.68rem; opacity: 0.7; }
.settings-location-sep { opacity: 0.4; }
.settings-location-caller.dim { font-style: italic; opacity: 0.5; }
.settings-location-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.settings-location-remove {
  width: 24px; height: 24px; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: transparent; color: var(--text-dim); font-size: 1.1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all 0.15s;
}
.settings-location-remove:hover { border-color: var(--red); color: var(--red); background: var(--surface-2); }

/* Twilio config grid */
.settings-twilio-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.settings-field-compact { display: flex; flex-direction: column; gap: 3px; }
.settings-label-sm { font-size: 0.7rem; font-weight: 500; color: var(--text-dim); }
.settings-input-mono { font-family: monospace; font-size: 0.78rem; }
.settings-add-section-label {
  font-size: 0.75rem; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.03em; display: flex; align-items: center;
}

/* (dead .settings-team-* block removed — replaced by .user-mgmt-* classes) */
.settings-btn-add {
  width: 100%; padding: 8px; border-radius: var(--radius-sm); font-size: 0.78rem;
  font-weight: 500; cursor: pointer; background: transparent;
  color: var(--accent); border: 1px dashed var(--border); font-family: inherit;
  transition: all 0.15s;
}
.settings-btn-add:hover { background: var(--accent-soft); border-color: var(--accent); }
.settings-btn-secondary {
  width: 100%; padding: 8px; border-radius: var(--radius-sm); font-size: 0.78rem;
  font-weight: 500; cursor: pointer; background: var(--surface-2);
  color: var(--text-muted); border: 1px solid var(--border); font-family: inherit;
  transition: all 0.15s; text-align: center;
}
.settings-btn-secondary:hover { background: var(--surface-3); color: var(--text); }
.settings-btn-secondary:disabled {
  opacity: 0.4; cursor: not-allowed; pointer-events: none;
}

/* Version badge */
.settings-version {
  font-size: 0.72rem; font-weight: 600; color: var(--text-dim);
  background: var(--surface-2); padding: 4px 10px; border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

/* Active model display */
.settings-active-model {
  font-size: 0.78rem; color: var(--text-muted); padding: 8px 12px;
  background: var(--bg); border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.settings-active-model strong { color: var(--accent); }

/* Row between */
.settings-row-between {
  display: flex; justify-content: space-between; align-items: center;
}
.settings-value-mono {
  font-size: 0.82rem; font-weight: 600; color: var(--text); font-family: monospace;
}

/* AI Performance stats */
.settings-stats-row {
  display: flex; gap: 12px;
}
.settings-stat {
  flex: 1; text-align: center; padding: 12px 8px;
  background: var(--bg); border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.settings-stat-number { font-size: 1.2rem; font-weight: 700; }
.settings-stat-label { font-size: 0.7rem; color: var(--text-dim); margin-top: 2px; }
.settings-stat-count { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }

@media (max-width: 700px) {
  .settings-body { gap: 12px; }
  .settings-page { padding: 20px 16px; }
  .settings-add-account-row { flex-direction: column; }
  .settings-twilio-grid { grid-template-columns: 1fr; }
  .user-add-row { flex-direction: column; }
}

/* ===== APP LOADING / ERROR STATES ===== */
.app-loading, .app-error {
  display: flex; align-items: center; justify-content: center;
  height: 100vh; width: 100%; background: var(--bg);
}
.app-loading-inner, .app-error-inner { text-align: center; }
.app-loading-icon, .app-error-icon {
  font-size: 2rem; margin-bottom: 8px;
}
.app-loading-text, .app-error-text {
  color: var(--text-dim); font-size: 0.88rem;
}
.app-error-text { color: var(--red); margin-bottom: 12px; }
.app-error-retry {
  padding: 6px 16px; border-radius: var(--radius-md);
  border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; font-family: inherit; font-size: 0.82rem;
  color: var(--text);
}
.app-error-retry:hover { background: var(--surface-2); }

/* ===== SKELETON LOADING ===== */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== CALL UI (DetailPanel) ===== */
.call-active-ui {
  margin-top: 10px; padding: 10px 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.call-status-row {
  display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
}
.call-status-text {
  font-size: 0.82rem; font-weight: 600; color: var(--text);
}
/* Pulsing dot for dialing */
.call-pulse-dot {
  width: 8px; height: 8px; border-radius: var(--radius-full);
  background: var(--yellow); flex-shrink: 0;
  animation: call-pulse 1s ease-in-out infinite;
}
@keyframes call-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}
/* Solid green dot for in-call */
.call-live-dot {
  width: 8px; height: 8px; border-radius: var(--radius-full);
  background: var(--green); flex-shrink: 0;
}
.call-phone-display {
  font-size: 0.75rem; color: var(--text-muted); margin-bottom: 6px;
}
.call-timer-display {
  font-size: 1.1rem; font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums; margin-bottom: 8px;
}
.action-btn.call-hangup {
  background: var(--red-soft); color: var(--red);
  border-color: rgba(255, 107, 107, 0.3);
}
.action-btn.call-hangup:hover { background: var(--red); color: #fff; }
.call-ended-ui {
  margin-top: 10px; padding: 8px 12px;
  background: var(--surface-2); border-radius: var(--radius-md);
  font-size: 0.78rem; color: var(--text-muted); text-align: center;
}
.call-error {
  font-size: 0.72rem; color: var(--red); padding: 6px 0;
}

/* ===== ANALYTICS PANEL ===== */
.analytics-content {
  display: flex; flex-direction: column; gap: 20px;
}
.analytics-card-wide { flex: 2; min-width: 0; }

/* Filters bar */
.analytics-filters {
  display: flex; gap: 16px; margin-bottom: 16px;
}
.analytics-filter-group { display: flex; flex-direction: column; gap: 4px; min-width: 160px; }

/* Stat boxes — 4 across */
.analytics-stat-boxes {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 8px;
}
.analytics-stat-boxes-4 {
  grid-template-columns: repeat(4, 1fr);
}
.analytics-stat-box {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 20px; text-align: center;
}
.analytics-stat-number {
  font-size: var(--fs-xl); font-weight: 700; color: var(--text);
}
.analytics-stat-number--positive { color: var(--green); }
.analytics-stat-label {
  font-size: var(--fs-xs); color: var(--text-dim); margin-top: 4px;
}
.analytics-stat-hint {
  font-size: var(--fs-xs); color: var(--text-dim); margin-top: 2px;
}

/* Two-column rows — Trends+Quality uses 2fr/1fr; Sentiment+Funnel uses equal halves */
.analytics-row-2 {
  display: grid; grid-template-columns: 2fr 1fr; gap: 20px;
}
.analytics-row-equal {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
}

/* Sentiment */
.analytics-sentiment-rows { display: flex; flex-direction: column; gap: 4px; }
.analytics-sentiment-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.78rem;
}
.analytics-sentiment-label { font-weight: 500; }
.analytics-sentiment-count { font-weight: 700; color: var(--text); }
.analytics-sentiment-bar {
  display: flex; height: 8px; border-radius: 4px;
  overflow: hidden; margin-top: 8px; background: var(--surface-3);
}
.analytics-sentiment-fill { height: 100%; transition: width 0.4s; }
.analytics-fill-green { background: var(--green); }
.analytics-fill-red { background: var(--red); }

/* Trend chart */
.analytics-trend-chart { margin-top: 8px; }
.analytics-trend-legend {
  display: flex; gap: 16px; margin-bottom: 10px; font-size: 0.7rem; color: var(--text-dim);
}
.analytics-legend-item { display: flex; align-items: center; gap: 4px; }
.analytics-legend-dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block;
}
.analytics-legend-dot--msg { background: var(--blue); }
.analytics-legend-dot--action { background: var(--green); }
.analytics-trend-bars {
  display: flex; gap: 3px; align-items: flex-end; height: 180px;
  border-bottom: 1px solid var(--border); padding-bottom: 4px;
}
.analytics-trend-bar-group {
  flex: 1; display: flex; flex-direction: column; align-items: center; min-width: 0;
}
.analytics-trend-bar-container {
  display: flex; gap: 2px; align-items: flex-end; height: 168px; width: 100%;
  justify-content: center;
}
.analytics-trend-bar {
  width: 45%; max-width: 16px; border-radius: 2px 2px 0 0;
  min-height: 2px; transition: height 0.3s;
}
.analytics-trend-bar-msg { background: var(--blue); }
.analytics-trend-bar-action { background: var(--green); }
.analytics-trend-label {
  font-size: 0.65rem; color: var(--text-dim); margin-top: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%; text-align: center;
}

/* Conversion funnel */
.analytics-funnel { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.analytics-funnel-bar-container {
  height: 20px; background: var(--surface-3); border-radius: var(--radius-sm);
  overflow: hidden;
}
.analytics-funnel-bar {
  height: 100%; border-radius: var(--radius-sm); transition: width 0.4s;
  min-width: 4px;
}
.analytics-funnel-bar--contacts { background: var(--text-dim); }
.analytics-funnel-bar--interested { background: var(--blue); }
.analytics-funnel-bar--replied { background: var(--green); }
.analytics-funnel-info {
  display: flex; justify-content: space-between; margin-top: 2px;
  font-size: 0.72rem;
}
.analytics-funnel-label { color: var(--text-dim); }
.analytics-funnel-count { font-weight: 600; color: var(--text); }

.analytics-error { padding: 8px 0; }
.analytics-error-msg { font-size: 0.78rem; color: var(--red); }
.analytics-skeleton-group { display: flex; flex-direction: column; gap: 8px; }
.analytics-skeleton-stat { height: 70px; }
.analytics-skeleton-bar { height: 8px; margin-top: 12px; border-radius: var(--radius-sm); }
.analytics-hint { font-size: 0.7rem; color: var(--text-dim); margin-top: 8px; }
.analytics-retry-btn { width: auto; padding: 6px 16px; margin-top: 10px; }
.analytics-sentiment-positive { color: var(--green); }
.analytics-sentiment-caution { color: var(--yellow); }
.analytics-sentiment-negative { color: var(--red); }
.analytics-divider-row { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 8px; }

@media (max-width: 700px) {
  .analytics-stat-boxes-4 { grid-template-columns: 1fr 1fr; }
  .analytics-row-2 { grid-template-columns: 1fr; }
  .analytics-row-equal { grid-template-columns: 1fr; }
  .analytics-filters { flex-direction: column; gap: 8px; }
}

/* ===== ACCOUNTS & CALLING TABLE (SettingsPanel) ===== */
.accounts-calling-table { display: flex; flex-direction: column; }
.accounts-calling-header, .accounts-calling-row {
  display: grid;
  grid-template-columns: 1fr 100px 90px;
  gap: 8px; align-items: center;
}
.accounts-calling-header {
  font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--text-dim); font-weight: 600;
  padding-bottom: 6px; border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}
.accounts-calling-row {
  font-size: 0.78rem; padding: 5px 0;
  border-bottom: 1px solid var(--border);
}
.accounts-calling-row:last-child { border-bottom: none; }
.accounts-col-name { color: var(--text); font-weight: 500; }
.accounts-col-cid { color: var(--text-muted); font-size: 0.72rem; }
.accounts-col-status { }

/* Twilio status badges */
.twilio-badge {
  font-size: 0.65rem; font-weight: 600; padding: 2px 7px;
  border-radius: var(--radius-lg);
}
.twilio-configured { background: var(--green-soft); color: var(--green); }
.twilio-not-configured { background: var(--surface-3); color: var(--text-dim); }

/* ===== PROMPT UPLOAD (SettingsPanel) ===== */
.prompt-candidate-list {
  display: flex; flex-direction: column; gap: 4px; margin-top: 6px;
}
.prompt-candidate-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); margin-bottom: 6px; transition: border-color 0.15s;
}
.prompt-candidate-row.active-prompt { border-color: var(--accent); background: var(--accent-soft); }
.prompt-candidate-icon { font-size: 0.9rem; flex-shrink: 0; color: var(--text-dim); }
.prompt-candidate-name {
  flex: 1; font-size: 0.78rem; color: var(--text); font-family: monospace;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.prompt-candidate-active-badge {
  font-size: 0.65rem; font-weight: 700; padding: 2px 7px; border-radius: var(--radius-lg);
  background: var(--accent-soft); color: var(--accent);
}
.prompt-candidate-apply-btn {
  padding: 4px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: transparent;
  font-size: 0.72rem; font-weight: 500; color: var(--text-muted);
  cursor: pointer; font-family: inherit; transition: all 0.15s;
}
.prompt-candidate-apply-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.prompt-candidate-apply-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.prompt-file-input {
  width: 100%; font-size: 0.78rem; color: var(--text-muted);
  margin-top: 6px;
}
.prompt-file-input::-webkit-file-upload-button {
  padding: 5px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); font-size: 0.75rem; font-family: inherit;
  cursor: pointer; margin-right: 8px;
}
.prompt-file-input::-webkit-file-upload-button:hover { background: var(--surface-3); }
.prompt-upload-msg {
  margin-top: 8px; font-size: 0.75rem; padding: 6px 10px;
  border-radius: var(--radius-sm);
}
.prompt-upload-success { background: var(--green-soft); color: var(--green); }
.prompt-upload-error { background: var(--red-soft); color: var(--red); }

/* ===== LOGIN PAGE ===== */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; width: 100vw;
  background: var(--bg);
}
.login-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 40px 36px;
  width: 100%; max-width: 400px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.15);
}
.login-logo {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 28px;
}
.login-logo-icon {
  width: 32px; height: 32px; background: var(--accent);
  border-radius: var(--radius-md); display: flex; align-items: center;
  justify-content: center; font-size: 16px;
}
.login-logo-text { font-size: 1.2rem; font-weight: 700; color: var(--text); }
.login-title { font-size: 1.1rem; font-weight: 700; color: var(--text); margin: 0 0 4px; }
.login-subtitle { font-size: 0.82rem; color: var(--text-dim); margin: 0 0 24px; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-field { display: flex; flex-direction: column; gap: 4px; }
.login-label { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); }
.login-input {
  padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); font-size: 0.88rem; font-family: inherit;
  outline: none; transition: border-color 0.15s;
}
.login-input:focus { border-color: var(--accent); }
.login-input::placeholder { color: var(--text-dim); }
.login-btn {
  padding: 10px 16px; border-radius: var(--radius-sm);
  background: var(--accent); color: #fff; font-weight: 600;
  font-size: 0.88rem; border: none; cursor: pointer;
  transition: opacity 0.15s; margin-top: 4px; font-family: inherit;
}
.login-btn:hover { opacity: 0.9; }
.login-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.login-error {
  font-size: 0.78rem; color: var(--red); background: var(--red-soft);
  padding: 8px 12px; border-radius: var(--radius-sm);
}
.login-success {
  font-size: 0.82rem; color: var(--green); background: var(--green-soft);
  padding: 10px 12px; border-radius: var(--radius-sm); text-align: center;
}

/* ===== SIDEBAR USER / CLIENT SWITCHER ===== */
.sidebar-user {
  padding: 12px 8px; border-top: 1px solid var(--border);
  margin-top: auto;
}
.sidebar-user-info {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.sidebar-user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: #fff; display: flex;
  align-items: center; justify-content: center; font-size: 0.7rem;
  font-weight: 700; flex-shrink: 0;
}
.sidebar-user-name { font-size: 0.78rem; color: var(--text); font-weight: 500; }
.sidebar-user-role { font-size: 0.65rem; color: var(--text-dim); text-transform: capitalize; }
.sidebar-client-name {
  font-size: 0.7rem; color: var(--text-muted); padding: 2px 0 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar-client-switcher {
  width: 100%; padding: 6px 8px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); font-size: 0.75rem; font-family: inherit;
  cursor: pointer; margin-bottom: 6px;
}
.sidebar-logout-btn {
  width: 100%; padding: 6px 8px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: transparent;
  color: var(--text-muted); font-size: 0.75rem; font-family: inherit;
  cursor: pointer; transition: all 0.15s;
}
.sidebar-logout-btn:hover { background: var(--surface-2); color: var(--text); }

/* ===== USER MANAGEMENT CARD ===== */
.user-mgmt-list { display: flex; flex-direction: column; gap: 8px; }
.user-mgmt-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.user-mgmt-row:last-child { border-bottom: none; }
.user-mgmt-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface-3); color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 600; flex-shrink: 0;
}
.user-mgmt-info { flex: 1; min-width: 0; }
.user-mgmt-name { font-size: 0.82rem; color: var(--text); font-weight: 500; }
.user-mgmt-email { font-size: 0.7rem; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; }
.user-mgmt-role {
  font-size: 0.65rem; font-weight: 600; text-transform: uppercase;
  padding: 2px 8px; border-radius: var(--radius-sm);
}
.user-mgmt-role.role-admin { background: var(--blue-soft, rgba(59,130,246,0.12)); color: var(--accent); }
.user-mgmt-role.role-operator { background: var(--green-soft); color: var(--green); }
.user-mgmt-role.role-superadmin { background: var(--yellow-soft); color: var(--yellow); }
.user-mgmt-status-inactive { opacity: 0.5; }
.user-mgmt-actions { display: flex; gap: 4px; }
.user-mgmt-action-btn {
  padding: 3px 8px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: transparent;
  color: var(--text-muted); font-size: 0.65rem; cursor: pointer;
  font-family: inherit; transition: all 0.15s;
}
.user-mgmt-action-btn:hover { background: var(--surface-2); color: var(--text); }
.user-mgmt-action-btn.deactivate:hover { color: var(--red); border-color: var(--red); }
.user-mgmt-action-btn.activate:hover { color: var(--green); border-color: var(--green); }

/* Add user form */
.user-add-form {
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px; background: var(--surface-2);
  border-radius: var(--radius-sm); margin-top: 8px;
}
.user-add-row { display: flex; gap: 8px; }
.user-add-row .settings-input, .user-add-row .settings-select {
  flex: 1; min-width: 0;
}
.settings-success {
  padding: 8px 12px; border-radius: var(--radius-sm);
  background: var(--green-soft); color: var(--green);
  font-size: 0.75rem; display: flex; align-items: center; gap: 8px;
}
.temp-password {
  font-family: monospace; font-size: 0.8rem; padding: 2px 6px;
  background: var(--surface); border-radius: var(--radius-sm);
  color: var(--text); user-select: all;
}
.copy-btn {
  padding: 2px 8px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text-dim); font-size: 0.65rem;
  cursor: pointer; font-family: inherit; transition: all 0.15s; flex-shrink: 0;
}
.copy-btn:hover { background: var(--surface-2); color: var(--text); }

/* ===== API KEYS CARD ===== */
.llm-key-status {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0; font-size: 0.82rem;
}
.llm-key-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.llm-key-dot.configured { background: var(--green); }
.llm-key-dot.missing { background: var(--text-dim); }
.llm-key-preview { font-size: 0.75rem; color: var(--text-dim); font-family: monospace; }

/* ===== ADMIN PANEL ===== */
.admin-panel {
  padding: 32px 40px; max-width: 800px; overflow-y: auto; height: 100%;
}
.admin-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 24px;
}
.admin-title {
  font-size: 1.25rem; font-weight: 700; color: var(--text); margin: 0;
}
.admin-subtitle {
  font-size: 0.8rem; color: var(--text-dim); margin: 4px 0 0;
}
.admin-section-label {
  font-size: 0.7rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-dim); padding: 0 0 8px;
}
.admin-loading { color: var(--text-dim); font-size: 0.82rem; padding: 16px 0; }
.admin-empty { color: var(--text-dim); font-size: 0.82rem; padding: 12px 0; font-style: italic; }
.admin-error {
  color: var(--red); font-size: 0.78rem; padding: 6px 0;
}
.admin-success {
  padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--green-soft); color: var(--green);
  font-size: 0.78rem; display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: 8px;
}

/* Buttons */
.admin-btn-primary {
  padding: 8px 16px; border-radius: var(--radius-sm); border: none;
  background: var(--accent); color: #fff; font-size: 0.82rem;
  font-weight: 600; cursor: pointer; font-family: inherit; transition: opacity 0.15s;
}
.admin-btn-primary:hover { opacity: 0.9; }
.admin-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.admin-btn-primary-sm {
  padding: 5px 12px; border-radius: var(--radius-sm); border: none;
  background: var(--accent); color: #fff; font-size: 0.75rem;
  font-weight: 600; cursor: pointer; font-family: inherit; transition: opacity 0.15s;
}
.admin-btn-primary-sm:hover { opacity: 0.9; }
.admin-btn-secondary {
  padding: 6px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: transparent; color: var(--text-muted); font-size: 0.78rem;
  cursor: pointer; font-family: inherit; transition: all 0.15s;
}
.admin-btn-secondary:hover { background: var(--surface-2); color: var(--text); }
.admin-btn-secondary-sm {
  padding: 4px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: transparent; color: var(--text-muted); font-size: 0.7rem;
  cursor: pointer; font-family: inherit; transition: all 0.15s;
}
.admin-btn-secondary-sm:hover { background: var(--surface-2); color: var(--text); }
.admin-btn-switch {
  padding: 4px 10px; border-radius: var(--radius-sm); border: 1px solid var(--accent);
  background: transparent; color: var(--accent); font-size: 0.7rem;
  font-weight: 600; cursor: pointer; font-family: inherit; transition: all 0.15s;
}
.admin-btn-switch:hover { background: var(--accent); color: #fff; }
.admin-btn-danger-sm {
  padding: 4px 10px; border-radius: var(--radius-sm); border: 1px solid var(--red);
  background: transparent; color: var(--red); font-size: 0.7rem;
  cursor: pointer; font-family: inherit; transition: all 0.15s;
}
.admin-btn-danger-sm:hover { background: var(--red); color: #fff; }
.admin-copy-btn {
  padding: 2px 8px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text-dim); font-size: 0.65rem;
  cursor: pointer; font-family: inherit; transition: all 0.15s; flex-shrink: 0;
}
.admin-copy-btn:hover { background: var(--surface-2); color: var(--text); }

/* Create client card */
.admin-create-card {
  padding: 16px; background: var(--surface-2); border-radius: var(--radius);
  margin-bottom: 20px;
}
.admin-create-title { font-size: 0.85rem; font-weight: 600; color: var(--text); margin-bottom: 10px; }
.admin-create-form { display: flex; gap: 8px; }
.admin-input {
  padding: 7px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 0.82rem;
  font-family: inherit; flex: 1; min-width: 0; outline: none; transition: border-color 0.15s;
}
.admin-input:focus { border-color: var(--accent); }
.admin-select {
  padding: 7px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 0.82rem;
  font-family: inherit; min-width: 120px; outline: none; cursor: pointer;
}
.admin-webhook-info {
  display: flex; align-items: center; gap: 6px; margin-top: 4px;
}
.admin-label { font-size: 0.72rem; color: var(--text-dim); font-weight: 600; }
.admin-code {
  font-family: monospace; font-size: 0.78rem; padding: 2px 8px;
  background: var(--surface); border-radius: var(--radius-sm);
  color: var(--text); user-select: all;
}

/* Client cards */
.admin-client-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 8px; overflow: hidden;
  transition: border-color 0.15s;
}
.admin-client-card:hover { border-color: var(--text-dim); }
.admin-client-expanded { border-color: var(--accent); }
.admin-client-current { border-left: 3px solid var(--accent); }
.admin-client-inactive { opacity: 0.6; }
.admin-client-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; cursor: pointer; gap: 12px;
}
.admin-client-info { flex: 1; min-width: 0; }
.admin-client-name {
  font-size: 0.88rem; font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.admin-client-meta {
  display: flex; gap: 16px; margin-top: 3px;
  font-size: 0.7rem; color: var(--text-dim);
}
.admin-client-actions {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0;
}
.admin-expand-icon {
  font-size: 0.65rem; color: var(--text-dim); margin-left: 4px;
}
.admin-badge-current {
  font-size: 0.6rem; font-weight: 700; text-transform: uppercase;
  padding: 1px 6px; border-radius: 3px;
  background: var(--accent); color: #fff; letter-spacing: 0.04em;
}
.admin-badge-inactive {
  font-size: 0.6rem; font-weight: 600; text-transform: uppercase;
  padding: 1px 6px; border-radius: 3px;
  background: var(--red-soft, rgba(239,68,68,0.12)); color: var(--red); letter-spacing: 0.04em;
}

/* Confirm bar */
.admin-confirm-bar {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  background: var(--red-soft, rgba(239,68,68,0.08));
  font-size: 0.78rem; color: var(--text);
}

/* Client body (expanded) */
.admin-client-body {
  padding: 0 16px 16px; border-top: 1px solid var(--border);
}
.admin-users-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0 8px;
}
.admin-users-title { font-size: 0.82rem; font-weight: 600; color: var(--text); }

/* Add user form */
.admin-add-user-form {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px; background: var(--surface-2); border-radius: var(--radius-sm);
  margin-bottom: 10px;
}
.admin-add-user-row { display: flex; gap: 8px; }
.admin-add-user-row .admin-input, .admin-add-user-row .admin-select { flex: 1; min-width: 0; }

/* User list within admin */
.admin-user-list { display: flex; flex-direction: column; gap: 6px; }
.admin-user-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.admin-user-row:last-child { border-bottom: none; }
.admin-user-inactive { opacity: 0.5; }
.admin-user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-soft, rgba(59,130,246,0.12));
  color: var(--accent); display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 700; flex-shrink: 0;
}
.admin-user-info { flex: 1; min-width: 0; }
.admin-user-name { font-size: 0.82rem; color: var(--text); font-weight: 500; }
.admin-user-email { font-size: 0.7rem; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; }
.admin-user-role {
  font-size: 0.6rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 2px 8px; border-radius: 3px;
}
.admin-user-role.role-admin { background: var(--blue-soft, rgba(59,130,246,0.12)); color: var(--accent); }
.admin-user-role.role-operator { background: var(--green-soft); color: var(--green); }
.admin-user-role.role-superadmin { background: var(--yellow-soft); color: var(--yellow); }
.admin-user-action-btn {
  padding: 3px 8px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: transparent;
  color: var(--text-muted); font-size: 0.65rem; cursor: pointer;
  font-family: inherit; transition: all 0.15s;
}
.admin-user-action-btn:hover { background: var(--surface-2); color: var(--text); }
.admin-user-action-btn.deactivate:hover { color: var(--red); border-color: var(--red); }
.admin-user-action-btn.activate:hover { color: var(--green); border-color: var(--green); }
