/* ==================== SETTINGS MODAL ==================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: var(--color-bg-elevated);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow:
    var(--shadow-lg),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  position: relative;
}

.modal-content::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--gradient-glossy);
  pointer-events: none;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.settings-modal {
  width: 520px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border-subtle);
  background: rgba(0, 0, 0, 0.1);
}

.modal-header h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
  margin: 0;
}

.modal-close {
  background: var(--color-bg-glass);
  border: 1px solid var(--color-border-subtle);
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.modal-close:hover {
  background: var(--color-bg-glass-hover);
  border-color: var(--color-border);
  color: var(--color-text);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-top: 1px solid var(--color-border-subtle);
  gap: 12px;
  background: rgba(0, 0, 0, 0.1);
}

.modal-footer-right {
  display: flex;
  gap: 12px;
}

.settings-loading {
  text-align: center;
  padding: 40px;
  color: var(--color-text-muted);
}

.settings-section {
  margin-bottom: 24px;
}

.settings-section:last-child {
  margin-bottom: 0;
}

.settings-section h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 8px;
}

.settings-description {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 12px;
  line-height: 1.5;
}

.settings-form-grid {
  display: grid;
  gap: 16px;
}

.settings-form-grid.two-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-form-grid .settings-field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 0;
}

.settings-form-grid .settings-field > span {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.settings-form-grid .settings-field > small {
  display: block;
  min-height: 1.4em;
  color: var(--color-text-muted);
  font-size: 11px;
  line-height: 1.4;
}

@media (max-width: 720px) {
  .settings-form-grid.two-columns {
    grid-template-columns: 1fr;
  }
}

/* Menu bar / system tray settings — label + description stack; toggle on the right */
.tray-settings-options {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 4px;
}

.tray-settings-option {
  margin: 0;
}

.tray-settings-option-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.tray-settings-option-text {
  min-width: 0;
  flex: 1;
}

.tray-settings-option-title {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-primary);
  line-height: 1.4;
}

.tray-settings-option-desc {
  margin: 6px 0 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--color-text-muted);
}

.tray-settings .settings-toggle.tray-settings-toggle {
  flex-shrink: 0;
  margin-top: 2px;
}

.tray-settings-features {
  margin-top: 8px;
}

.settings-combined-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings-combined-section {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-bg-tertiary);
  overflow: hidden;
}

.settings-combined-section:last-child {
  border-bottom: 1px solid var(--color-border);
}

.settings-combined-section-header {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 18px 20px;
  border-bottom: 1px solid var(--color-border-subtle);
  background: color-mix(in srgb, var(--color-bg-secondary) 72%, transparent);
}

.settings-combined-section-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  background: var(--color-bg-secondary);
  color: var(--color-accent);
}

.settings-combined-section-copy {
  min-width: 0;
}

.settings-combined-section-copy .settings-description {
  margin: 4px 0 0;
  max-width: 760px;
}

.settings-combined-body {
  padding: 18px 20px 20px;
}

.settings-combined-heading {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  margin: 0;
}

.system-security-panel-header {
  padding-bottom: 2px;
}

.system-security-panel-header h2 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text);
}

.system-security-panel-header .settings-description {
  margin: 0;
  max-width: 760px;
}

.system-security-panel .settings-combined-body > .settings-section,
.system-security-panel .settings-combined-body > .tray-settings,
.system-security-panel .settings-combined-body > .settings-panel {
  margin: 0;
}

.system-security-section--tray .tray-settings > .settings-section,
.system-security-section--safety .settings-combined-body > .settings-section,
.system-security-section--permissions .settings-subsection,
.system-security-section--admin .settings-panel > .settings-section {
  padding: 14px;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  background: var(--color-bg-secondary);
}

.system-security-section--profiles .settings-card {
  background: var(--color-bg-secondary);
}

.system-security-panel .settings-card {
  border-color: var(--color-border-subtle);
}

.system-security-section--profiles .settings-description:first-child,
.system-security-section--permissions
  .settings-combined-body
  > .settings-section
  > .settings-description:first-of-type,
.system-security-section--admin
  .settings-panel
  > .settings-description:first-of-type {
  margin-top: -2px;
  margin-bottom: 16px;
}

.system-security-section--tray
  .tray-settings
  > .settings-section:first-child
  > h3:first-child,
.system-security-section--permissions
  .settings-combined-body
  > .settings-section
  > .settings-section-header:first-child,
.system-security-section--admin .settings-panel > h2:first-child {
  display: none;
}

.system-security-section--tray .tray-settings-options,
.system-security-section--permissions .settings-section,
.system-security-section--admin .settings-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.system-security-section--tray .tray-settings-option,
.system-security-section--tray .tray-settings-features,
.system-security-section--safety .settings-combined-body > .settings-section,
.system-security-section--permissions .settings-subsection,
.system-security-section--admin .settings-panel > .settings-section {
  margin: 0;
}

.system-security-panel .settings-section-header,
.system-security-panel .tray-settings-option-inner {
  gap: 14px;
}

.system-security-panel .settings-section-header h3,
.system-security-panel .settings-section h3,
.system-security-panel .settings-section h4,
.system-security-panel .settings-subsection h4 {
  margin: 0;
  font-size: 13px;
  line-height: 1.35;
}

.system-security-panel .settings-description,
.system-security-panel .settings-hint,
.system-security-panel .tray-settings-option-desc,
.system-security-panel .ap-hint {
  line-height: 1.45;
}

.system-security-panel .settings-description {
  margin-bottom: 12px;
}

.system-security-panel .settings-hint {
  margin: 0;
}

.system-security-panel .settings-inline-input {
  align-items: center;
  gap: 10px;
  margin-top: 0;
}

.system-security-panel .settings-inline-input label,
.system-security-panel .settings-label,
.system-security-panel .ap-label {
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 600;
}

.system-security-panel .settings-actions,
.system-security-panel .ap-actions {
  margin-top: 6px;
  padding-top: 14px;
  border-top-color: var(--color-border-subtle);
  flex-wrap: wrap;
}

.system-security-panel .ap-row {
  gap: 12px;
}

.system-security-panel .ap-toggle-row {
  min-height: 34px;
  padding: 6px 0;
}

.system-security-panel .settings-callout,
.system-security-panel .settings-warning {
  margin: 0;
}

.theme-light .settings-combined-section {
  background: rgba(255, 255, 255, 0.58);
  border-color: rgba(0, 0, 0, 0.12);
}

.theme-light .settings-combined-section-header,
.theme-light .settings-combined-section-icon,
.theme-light .system-security-section--tray .tray-settings > .settings-section,
.theme-light .system-security-section--safety .settings-combined-body > .settings-section,
.theme-light .system-security-section--permissions .settings-subsection,
.theme-light .system-security-section--admin .settings-panel > .settings-section,
.theme-light .system-security-section--profiles .settings-card {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
  .settings-combined-section-header,
  .settings-combined-body {
    padding: 16px;
  }

  .settings-combined-section-icon {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
  }

  .system-security-section--tray .tray-settings-option-inner,
  .system-security-panel .settings-section-header,
  .system-security-panel .ap-row {
    align-items: stretch;
    flex-direction: column;
  }

  .system-security-panel .settings-inline-input {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Usage Insights panel */
.insights-panel {
  animation: insights-fade-in 0.6s ease-out;
  background: transparent !important;
}

@keyframes insights-fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Insights: Header ── */
.insights-header {
  margin-bottom: 24px;
}

.insights-header h2 {
  margin: 0 0 8px;
  font-family: var(--font-ui);
  font-size: 22px;
  font-weight: 600;
  color: var(--color-text);
}

.insights-header-left {
  display: flex;
  flex-direction: column;
}

.insights-header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.insights-workspace-select {
  padding: 4px 8px;
  font-size: 12px;
  font-family: var(--font-ui);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  max-width: 180px;
}

.insights-period-filter {
  display: flex;
  gap: 2px;
  align-items: center;
  flex-wrap: wrap;
}

.insights-period-btn {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.insights-period-btn:hover {
  background: var(--color-bg-hover);
  color: var(--color-text);
}

.insights-period-btn.active {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
  font-weight: 600;
}

.insights-period-custom-wrap {
  position: relative;
}

.insights-custom-picker {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  min-width: 220px;
  background: var(--color-bg-elevated, var(--color-bg));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg, 12px);
  box-shadow: var(--shadow-lg, 0 8px 24px rgba(0, 0, 0, 0.18));
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}

.insights-custom-picker-label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-muted);
}

.insights-custom-picker-input {
  padding: 5px 8px;
  font-size: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text);
  outline: none;
}

.insights-custom-picker-input:focus {
  border-color: var(--color-accent);
}

.insights-custom-picker-apply {
  margin-top: 2px;
  align-self: stretch;
  text-align: center;
}

/* ── Insights: Hero Stats ── */
.insights-hero {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.insights-hero-card {
  background: linear-gradient(135deg, var(--color-bg-elevated) 0%, var(--color-bg-glass) 100%);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  text-align: center;
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  transition: all 0.3s ease;
}

.insights-hero-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.1;
}

.insights-hero-label {
  font-size: 11px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 4px;
}

.insights-hero-sub {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 2px;
  opacity: 0.7;
}

.insights-hero-rate-bar {
  height: 4px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--color-bg-glass) 80%, white 20%);
  margin-top: 8px;
  overflow: hidden;
}

.insights-hero-rate-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* ── Insights: Overview (stat grid + heatmap) ── */
.insights-overview {
  padding: 8px 0 26px;
  margin-bottom: 22px;
  background: transparent;
  border: 0;
}

.insights-overview-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  width: min(100%, 980px);
  margin: 0 auto 56px;
  overflow: hidden;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--color-bg-elevated) 66%, transparent);
}

.insights-overview-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  min-height: 86px;
  padding: 14px 18px;
  text-align: center;
}

.insights-overview-stat + .insights-overview-stat {
  border-left: 1px solid var(--color-border-subtle);
}

.insights-overview-stat-label {
  order: 2;
  font-size: 16px;
  color: var(--color-text-muted);
  letter-spacing: 0;
  line-height: 1.15;
}

.insights-overview-stat-value {
  order: 1;
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.insights-overview-stat-value--small {
  font-size: 14px;
  font-weight: 600;
}

.insights-token-activity {
  width: min(100%, 1040px);
  margin: 0 auto;
}

.insights-token-activity-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.insights-token-activity-header h3 {
  margin: 0;
  color: var(--color-text);
  font-family: var(--font-ui);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.2;
}

.insights-token-activity-title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
}

.insights-token-activity-range {
  color: var(--color-text-muted);
  font-size: 12px;
  line-height: 1.2;
}

.insights-token-activity-tabs {
  display: inline-flex;
  align-items: center;
  gap: 24px;
}

.insights-token-activity-tab {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-text-muted);
  font-family: var(--font-ui);
  font-size: 18px;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  transition: color 0.15s ease;
}

.insights-token-activity-tab:hover,
.insights-token-activity-tab.active {
  color: var(--color-text);
}

.insights-overview-heatmap {
  display: block;
  padding: 0 0 4px;
  overflow-x: auto;
}

.insights-overview-heatmap-grid {
  display: flex;
  gap: 5px;
  min-width: max-content;
}

.insights-overview-heatmap-col {
  display: grid;
  grid-template-rows: repeat(7, 16px);
  gap: 5px;
}

.insights-overview-heatmap-cell {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--color-bg-elevated) 88%, var(--color-text) 4%);
}

.insights-overview-heatmap-cell.out-of-range {
  opacity: 0.35;
}

.insights-overview-heatmap-cell-l1 {
  background: color-mix(in srgb, var(--color-accent, #60a5fa) 25%, transparent);
}
.insights-overview-heatmap-cell-l2 {
  background: color-mix(in srgb, var(--color-accent, #60a5fa) 50%, transparent);
}
.insights-overview-heatmap-cell-l3 {
  background: color-mix(in srgb, var(--color-accent, #60a5fa) 75%, transparent);
}
.insights-overview-heatmap-cell-l4 {
  background: var(--color-accent, #60a5fa);
}

.insights-overview-heatmap-months {
  display: grid;
  gap: 5px;
  min-width: max-content;
  margin-top: 16px;
  color: var(--color-text-muted);
  font-size: 16px;
  line-height: 1.2;
}

.insights-overview-heatmap-months span {
  min-width: 0;
}

.insights-overview-caption {
  width: min(100%, 1040px);
  margin: 16px auto 0;
  font-size: 12px;
  color: var(--color-text-muted);
}

.insights-overview-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: min(100%, 1040px);
  margin: 0 auto 18px;
  color: var(--color-text-muted);
  font-size: 13px;
}

.insights-overview-status-btn {
  padding: 4px 10px;
  border: 1px solid var(--color-border-subtle);
  border-radius: 6px;
  background: var(--color-bg-elevated);
  color: var(--color-text);
  font: inherit;
  cursor: pointer;
}

.insights-overview-status-btn:hover {
  background: var(--color-bg-glass);
}

@media (max-width: 900px) {
  .insights-overview-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .insights-overview-stat:nth-child(odd) {
    border-left: 0;
  }

  .insights-overview-stat:nth-child(n + 3) {
    border-top: 1px solid var(--color-border-subtle);
  }
}

@media (max-width: 640px) {
  .insights-overview {
    padding-top: 0;
  }

  .insights-overview-stat-label,
  .insights-token-activity-tab,
  .insights-overview-heatmap-months {
    font-size: 14px;
  }

  .insights-token-activity-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .insights-token-activity-tabs {
    gap: 18px;
  }

  .insights-overview-stats {
    grid-template-columns: 1fr;
    margin-bottom: 34px;
  }

  .insights-overview-stat + .insights-overview-stat {
    border-left: 0;
    border-top: 1px solid var(--color-border-subtle);
  }
}

/* ── Insights: Two-Column Layout ── */
.insights-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.insights-two-col.single {
  grid-template-columns: 1fr;
}

/* ── Insights: Card (used in two-col and standalone) ── */
.insights-card {
  background: linear-gradient(135deg, var(--color-bg-elevated) 0%, var(--color-bg-glass) 100%);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  transition: all 0.3s ease;
}

.insights-card-header {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.insights-card-header-sub {
  font-weight: 400;
  color: var(--color-text-muted);
  margin-left: 8px;
  text-transform: none;
  letter-spacing: 0;
}

/* ── Insights: Cost Section ── */
.insights-cost-hero {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}

.insights-cost-amount {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text);
}

.insights-cost-tokens {
  font-size: 12px;
  color: var(--color-text-muted);
}

.insights-cost-split {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--color-border-subtle);
}

.insights-cost-split-item {
  display: flex;
  gap: 6px;
  font-size: 12px;
}

.insights-cost-split-label {
  color: var(--color-text-muted);
}

.insights-cost-split-value {
  color: var(--color-text-secondary);
  font-weight: 500;
}

.insights-runtime-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.insights-runtime-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 6px;
  background: color-mix(in srgb, var(--color-bg-glass) 90%, white 10%);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-subtle);
  transition: all 0.3s ease;
}

.insights-runtime-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}

.insights-runtime-label {
  font-size: 10px;
  color: var(--color-text-muted);
}

.insights-runtime-note {
  font-size: 11px;
  color: var(--color-text-muted);
  margin: -2px 0 8px;
}

.insights-runtime-section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  margin: 4px 0 4px;
}

.insights-model-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* ── Insights: AWU Section ── */
.insights-card-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.insights-card-header-group {
  min-width: 0;
}

.insights-card-header-row .insights-card-header {
  margin-bottom: 4px;
}

.insights-awu-chart-subtitle {
  font-size: 11px;
  line-height: 1.4;
  color: var(--color-text-muted);
  max-width: 30rem;
}

.insights-awu-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--color-border-subtle);
  background: color-mix(in srgb, var(--color-bg-glass) 88%, white 12%);
  flex-shrink: 0;
}

.insights-awu-toggle-btn {
  border: 0;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.insights-awu-toggle-btn:hover {
  color: var(--color-text);
}

.insights-awu-toggle-btn.active {
  background: var(--color-accent);
  color: white;
}

.insights-awu-hero {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
}

.insights-awu-count {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-accent);
}

.insights-awu-label {
  font-size: 12px;
  color: var(--color-text-muted);
}

.insights-awu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.insights-awu-metric {
  text-align: center;
  padding: 10px 6px;
  background: color-mix(in srgb, var(--color-bg-glass) 90%, white 10%);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-subtle);
  transition: all 0.3s ease;
}

.insights-awu-metric-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
}

.insights-awu-metric-label {
  font-size: 10px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.insights-awu-comparison {
  font-size: 11px;
  color: var(--color-text-muted);
  opacity: 0.8;
}

.insights-awu-chart-wrap {
  height: 300px;
  margin-top: 10px;
}

/* ── Insights: Bar Charts ── */
.insights-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 12px;
}

.insights-bar-label {
  min-width: 32px;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.insights-bar-track {
  height: 6px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--color-bg-glass) 80%, white 20%);
  overflow: hidden;
  flex: 1;
}

.insights-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--color-accent);
  transition: width 0.3s ease;
}

.insights-bar-value {
  min-width: 20px;
  text-align: right;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

/* ── Insights: Hour Chart ── */
.insights-hour-chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  flex: 1;
  min-height: 90px;
}

.insights-hour-bar {
  flex: 1;
  border-radius: 2px 2px 0 0;
  transition: height 0.3s ease;
}

.insights-hour-bar.has-data {
  background: var(--color-accent);
}

.insights-hour-bar.no-data {
  background: color-mix(in srgb, var(--color-bg-glass) 80%, white 20%);
  opacity: 0.3;
}

.insights-hour-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* ── Insights: Model Rows ── */
.insights-model-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
  font-size: 12px;
}

.insights-model-name {
  min-width: 80px;
  font-family: var(--font-mono);
  color: var(--color-text-secondary);
  flex-shrink: 0;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100px;
}

.insights-model-cost {
  min-width: 54px;
  text-align: right;
  color: var(--color-text-secondary);
  flex-shrink: 0;
  font-size: 11px;
}

.insights-model-calls {
  min-width: 32px;
  text-align: right;
  color: var(--color-text-muted);
  flex-shrink: 0;
  font-size: 11px;
}

/* ── Insights: Trend Indicator ── */
.insights-trend {
  display: block;
  font-size: 11px;
  margin-top: 2px;
  font-weight: 500;
}

.insights-trend.good {
  color: var(--color-success, #22c55e);
}

.insights-trend.bad {
  color: var(--color-error, #ef4444);
}

.insights-trend.neutral {
  color: var(--color-text-muted);
}

/* ── Insights: Light theme overrides ── */
.theme-light .insights-hero-card,
.theme-light .insights-card {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.08);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.theme-light .insights-awu-metric,
.theme-light .insights-runtime-metric {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.08);
}

.theme-light .insights-awu-toggle {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.08);
}

.theme-light .insights-bar-track,
.theme-light .insights-hero-rate-bar {
  background: rgba(0, 0, 0, 0.06);
}

.theme-light .insights-hour-bar.no-data {
  background: rgba(0, 0, 0, 0.06);
}

.theme-light .insights-period-btn {
  border-color: rgba(0, 0, 0, 0.12);
}

.theme-light .insights-period-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

.theme-light .insights-period-btn.active {
  color: #fff;
}

.theme-light .insights-custom-picker {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.theme-light .insights-custom-picker-input {
  background: #fff;
}

.theme-light .insights-workspace-select {
  background: transparent;
  border-color: rgba(0, 0, 0, 0.12);
}

@media (max-width: 980px) {
  .insights-hero {
    grid-template-columns: repeat(2, 1fr);
  }

  .insights-two-col {
    grid-template-columns: 1fr;
  }

  .insights-runtime-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .insights-header-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .insights-workspace-select {
    max-width: 100%;
  }

  .insights-period-filter {
    gap: 6px;
  }
}

/* Usage Insights — LLM analytics (Recharts) */
.insights-llm-section {
  margin-top: 20px;
  margin-bottom: 16px;
}

.insights-llm-section-title {
  margin: 0 0 6px;
  font-family: var(--font-ui);
  font-size: 1.05rem;
  font-weight: 600;
}

.insights-llm-section-hint {
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--color-text-muted, #888);
  line-height: 1.4;
  max-width: 52rem;
}

.insights-llm-empty-banner {
  margin-bottom: 16px;
  padding: 16px 20px;
  background: var(--color-bg-glass, rgba(255, 255, 255, 0.04));
  border: 1px dashed var(--color-border-subtle, rgba(255, 255, 255, 0.12));
  border-radius: var(--radius-lg, 12px);
}

.insights-llm-empty-title {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
}

.insights-llm-empty-body {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--color-text-muted, #888);
}

.insights-llm-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.insights-llm-kpi-card {
  min-height: 88px;
}

.insights-chart-row {
  margin-bottom: 12px;
}

.insights-chart-card .insights-card-header-sub {
  margin-top: 2px;
}

.insights-chart-wrap {
  width: 100%;
  height: 260px;
  margin-top: 8px;
}

.insights-chart-wrap-tall {
  height: 320px;
}

.insights-chart-empty {
  margin: 0;
  padding: 48px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--color-text-muted, #888);
}

.insights-model-table-card {
  margin-top: 4px;
}

.insights-table-wrap {
  overflow-x: auto;
  margin-top: 8px;
}

.insights-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.insights-data-table th,
.insights-data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--color-border-subtle, rgba(255, 255, 255, 0.08));
}

.insights-data-table th {
  font-weight: 600;
  color: var(--color-text-muted, #888);
  white-space: nowrap;
}

.insights-data-table th.num,
.insights-data-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.insights-table-model {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 980px) {
  .insights-llm-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .insights-card-header-row {
    flex-direction: column;
  }

  .insights-awu-toggle {
    width: fit-content;
  }
}

/* Onboarding section in Settings */
.settings-section.onboarding-section {
  padding: 16px;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-subtle);
}

.settings-section.onboarding-section h3 {
  margin-bottom: 6px;
}

.settings-section.onboarding-section .settings-description {
  margin-bottom: 14px;
}

.onboarding-completed-info {
  color: var(--color-text-secondary);
}

.show-onboarding-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
}

.show-onboarding-btn svg {
  opacity: 0.8;
}

.provider-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.provider-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--color-bg-glass);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.provider-option::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: var(--gradient-glossy);
  pointer-events: none;
}

.provider-option:hover {
  background: var(--color-bg-glass-hover);
  border-color: var(--color-border-light);
  transform: translateY(-1px);
}

.provider-option.selected {
  border-color: var(--color-accent);
  background: var(--color-accent-subtle);
  box-shadow:
    0 0 0 1px var(--color-accent) inset,
    var(--shadow-glow);
}

.provider-option input[type="radio"] {
  margin-top: 2px;
  accent-color: var(--color-accent);
}

.provider-option-content {
  flex: 1;
}

.provider-option-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 4px;
}

.provider-option-description {
  font-size: 12px;
  color: var(--color-text-muted);
  line-height: 1.4;
}

.provider-option-description code {
  background: var(--color-bg-input);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11px;
}

.provider-configured {
  font-size: 11px;
  font-weight: 400;
  color: var(--color-success, #22c55e);
  margin-left: 8px;
}

.settings-select {
  width: 100%;
  padding: 10px 12px;
  background: var(--color-bg-input);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: 13px;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.settings-select:hover {
  border-color: var(--color-border-light);
  background: rgba(0, 0, 0, 0.3);
}

.settings-select:focus {
  border-color: var(--color-accent);
}

/* Searchable Select Component */
.searchable-select {
  position: relative;
  width: 100%;
}

.searchable-select-trigger {
  width: 100%;
  padding: 10px 12px;
  background: var(--color-bg-input);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: 13px;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.searchable-select-trigger:hover {
  border-color: var(--color-border-light);
  background: rgba(0, 0, 0, 0.3);
}

.searchable-select-trigger:focus {
  border-color: var(--color-accent);
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.1),
    0 0 0 3px var(--color-accent-subtle);
}

.searchable-select-trigger.open {
  border-color: var(--color-accent);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.searchable-select-value {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.searchable-select-arrow {
  flex-shrink: 0;
  opacity: 0.6;
  transition: transform 0.2s ease;
}

.searchable-select-trigger.open .searchable-select-arrow {
  transform: rotate(180deg);
}

.searchable-select-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-accent);
  border-top: none;
  border-bottom-left-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
  z-index: 1000;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  overflow: hidden;
}

.searchable-select-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border);
  background: rgba(0, 0, 0, 0.2);
}

.searchable-select-search svg {
  flex-shrink: 0;
  opacity: 0.5;
}

.searchable-select-search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--color-text);
  font-size: 13px;
}

.searchable-select-search input::placeholder {
  color: var(--color-text-muted);
}

.searchable-select-options {
  max-height: 240px;
  overflow-y: auto;
}

.searchable-select-option {
  padding: 10px 12px;
  cursor: pointer;
  transition: background 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.searchable-select-option:hover,
.searchable-select-option.highlighted {
  background: var(--color-bg-hover);
}

.searchable-select-option.selected {
  background: var(--color-accent-subtle);
}

.searchable-select-option.selected.highlighted {
  background: var(--color-accent-subtle);
}

.searchable-select-option-label {
  font-size: 13px;
  color: var(--color-text);
}

.searchable-select-option-desc {
  font-size: 11px;
  color: var(--color-text-muted);
}

.searchable-select-no-results {
  padding: 16px 12px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 13px;
}

.settings-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--color-bg-input);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: 13px;
  outline: none;
  transition: all 0.2s ease;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.settings-input:hover {
  border-color: var(--color-border-light);
  background: rgba(0, 0, 0, 0.3);
}

.settings-input:focus {
  border-color: var(--color-accent);
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.1),
    0 0 0 3px var(--color-accent-subtle);
}

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

.settings-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  margin-bottom: 12px;
}

.settings-checkbox input[type="checkbox"] {
  accent-color: var(--color-accent);
}

.settings-checkbox span {
  font-size: 13px;
  color: var(--color-text-secondary);
}

.settings-subsection {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-left: 24px;
}

/* Profile-Based Routing section: spacing, alignment, contrast */
.profile-routing-section .settings-description {
  margin-bottom: 16px;
  color: var(--color-text-secondary);
}

.profile-routing-section .profile-routing-enable {
  margin-bottom: 20px;
}

.profile-routing-section .profile-routing-content {
  margin-top: 4px;
}

.profile-routing-section .profile-routing-models {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 20px;
}

.profile-routing-section .profile-routing-models .settings-subsection {
  padding-left: 0;
  gap: 8px;
}

.profile-routing-section .profile-routing-sync {
  padding-left: 0;
  margin-bottom: 20px;
}

.profile-routing-section .profile-routing-sync .button-small {
  margin-top: 0;
}

.profile-routing-section .profile-routing-prefer {
  margin-bottom: 12px;
}

.profile-routing-section .settings-hint {
  margin-top: 12px;
}

.routing-runtime-panel {
  padding-left: 0;
  gap: 12px;
}

.routing-runtime-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.routing-runtime-header h4 {
  margin: 0;
}

.routing-runtime-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.routing-runtime-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--color-bg-glass);
  border: 1px solid var(--color-border-subtle);
}

.routing-runtime-item span {
  color: var(--color-text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.routing-runtime-item strong {
  color: var(--color-text-primary);
  font-size: 13px;
  word-break: break-word;
}

.routing-runtime-fallbacks {
  display: flex;
  flex-direction: column;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.routing-runtime-fallbacks li {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: rgba(96, 165, 250, 0.08);
  border: 1px solid rgba(96, 165, 250, 0.16);
  color: var(--color-text-secondary);
  font-size: 12px;
  line-height: 1.5;
}

.test-result {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  overflow-wrap: break-word;
  word-break: break-word;
}

.test-result svg {
  flex-shrink: 0;
  margin-top: 2px;
}

.test-result.success {
  background: rgba(34, 197, 94, 0.1);
  color: var(--color-success);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.test-result.error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--color-error);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* OAuth Authentication Styles */
.auth-status-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--color-bg-glass);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  gap: 16px;
}

.auth-status-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.auth-status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
}

.auth-status-badge.success {
  color: var(--color-success, #22c55e);
}

.auth-status-badge svg {
  flex-shrink: 0;
}

.auth-email {
  font-size: 12px;
  color: var(--color-text-secondary);
}

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

.auth-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.oauth-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
}

.oauth-button svg {
  flex-shrink: 0;
}

.button-small {
  padding: 6px 12px;
  font-size: 12px;
}

.auth-error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-md);
  color: var(--color-error);
  font-size: 12px;
  margin-top: 12px;
}

.auth-error svg {
  flex-shrink: 0;
}

.settings-divider {
  display: flex;
  align-items: center;
  margin: 20px 0;
  color: var(--color-text-muted);
  font-size: 12px;
}

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

.settings-divider span {
  padding: 0 12px;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Auth Method Tabs for OAuth vs API Key */
.auth-method-tabs {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.auth-method-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--color-bg-glass);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-method-tab:hover {
  background: var(--color-bg-glass-hover);
  border-color: var(--color-border-light);
  color: var(--color-text);
}

.auth-method-tab.active {
  background: var(--color-accent-subtle);
  border-color: var(--color-accent);
  color: var(--color-text);
  box-shadow: 0 0 0 1px var(--color-accent) inset;
}

.auth-method-tab svg {
  opacity: 0.7;
}

.auth-method-tab.active svg {
  opacity: 1;
}

/* OAuth Connected Status */
.oauth-connected {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.oauth-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-success, #22c55e);
  font-size: 14px;
  font-weight: 500;
}

.oauth-status svg {
  flex-shrink: 0;
}

/* OAuth Login Section */
.oauth-login {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.oauth-login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
}

.oauth-login-btn .spinner {
  animation: spin 0.8s linear infinite;
}

/* Settings Tabs */
.settings-tabs {
  display: flex;
  gap: 4px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--color-border-subtle);
  margin-bottom: 16px;
}

.settings-tab {
  padding: 8px 16px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--color-text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
}

.settings-tab:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-secondary);
}

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

/* Telegram Settings */
.telegram-settings {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings-field {
  margin-bottom: 16px;
}

.settings-field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
}

.settings-hint {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 6px;
}

.settings-info-box {
  padding: 12px 16px;
  background: var(--color-accent-subtle);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-top: 16px;
  font-size: 12px;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.settings-info-box strong {
  color: var(--color-text);
}

.settings-checkbox-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--color-text);
  user-select: none;
}

.channel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.channel-info h3 {
  margin: 0 0 4px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.bot-username {
  font-size: 12px;
  font-weight: 400;
  color: var(--color-text-muted);
}

.channel-status {
  font-size: 12px;
  color: var(--color-text-muted);
}

.channel-status.connected {
  color: var(--color-success);
}

.channel-status.error {
  color: var(--color-error);
}

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

.button-danger {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--color-error);
}

.button-danger:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.5);
}

.button-small {
  padding: 4px 8px;
  font-size: 11px;
}

.pairing-form {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.pairing-form .settings-input {
  flex: 1;
}

.pairing-code-display {
  padding: 12px;
  background: var(--color-bg-glass);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  text-align: center;
}

.pairing-code {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 600;
  color: var(--color-accent);
  letter-spacing: 4px;
}

.users-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--color-bg-glass);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-name {
  font-size: 13px;
  color: var(--color-text);
}

.user-username {
  font-size: 12px;
  color: var(--color-text-muted);
}

.user-status {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.user-status.allowed {
  background: rgba(34, 197, 94, 0.1);
  color: var(--color-success);
}

.user-status.pending {
  background: rgba(234, 179, 8, 0.1);
  color: var(--color-warning, #eab308);
}

/* Search Settings */
.search-settings {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.provider-setup-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 16px 0;
}

.provider-setup-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px;
  background: var(--color-bg-glass);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
}

.provider-setup-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.provider-setup-info .provider-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
}

.provider-setup-info .provider-description {
  font-size: 11px;
  color: var(--color-text-muted);
}

.provider-setup-info .provider-types {
  font-size: 10px;
  color: var(--color-text-muted);
  font-style: italic;
}

.provider-status {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.provider-status.configured {
  background: rgba(34, 197, 94, 0.1);
  color: var(--color-success);
}

.provider-status.not-configured {
  background: rgba(156, 163, 175, 0.1);
  color: var(--color-text-muted);
}

.settings-hint-box {
  padding: 16px;
  background: var(--color-bg-glass);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  margin-top: 16px;
}

.settings-hint-box h4 {
  margin: 0 0 8px 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text);
}

.settings-hint-box p {
  margin: 0 0 12px 0;
  font-size: 12px;
  color: var(--color-text-muted);
}

.settings-hint-box pre {
  background: rgba(0, 0, 0, 0.3);
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--color-text-secondary);
  overflow-x: auto;
  margin: 0;
}

.settings-hint-box code {
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 11px;
}

.provider-option-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.provider-option .provider-types {
  font-size: 10px;
  color: var(--color-text-muted);
  font-style: italic;
  margin-top: 4px;
}

.test-result-inline {
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  overflow-wrap: break-word;
  word-break: break-word;
}

.test-result-inline.success {
  background: rgba(34, 197, 94, 0.1);
  color: var(--color-success);
}

.test-result-inline.error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--color-error);
}

.providers-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.provider-summary-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--color-bg-glass);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-sm);
}

.provider-summary-item .provider-name {
  font-size: 12px;
  color: var(--color-text);
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 16px;
  border-top: 1px solid var(--color-border-subtle);
  margin-top: 8px;
}

/* Provider Config List (with expandable API key input) */
.provider-config-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0;
}

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

.provider-config-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--color-bg-glass);
  cursor: pointer;
  transition: background 0.15s ease;
}

.provider-config-header:hover {
  background: var(--color-bg-glass-hover);
}

.provider-config-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.provider-config-info .provider-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
}

.provider-expand-icon {
  font-size: 10px;
  color: var(--color-text-muted);
  transition: transform 0.15s ease;
}

.provider-config-form {
  padding: 16px;
  background: var(--color-bg-secondary);
  border-top: 1px solid var(--color-border-subtle);
}

.provider-config-panel .provider-config-form {
  padding: 16px;
  background: transparent;
  border-top: none;
}

.provider-config-form .provider-description {
  font-size: 12px;
  color: var(--color-text-muted);
  margin: 0 0 8px 0;
}

.provider-config-form .provider-types {
  font-size: 11px;
  color: var(--color-text-muted);
  font-style: italic;
  margin: 0 0 16px 0;
}

.provider-config-form .settings-field {
  margin-bottom: 12px;
}

.provider-config-form .settings-field label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.provider-config-form .settings-hint {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 6px;
}

.provider-config-form .settings-hint a {
  color: var(--color-accent);
  text-decoration: none;
}

.provider-config-form .settings-hint a:hover {
  text-decoration: underline;
}

.provider-config-form .button-small {
  margin-top: 8px;
}
