/* LightRAG Medical Model Settings - Modern Dark UI */

/* Header right container width expansion so it never clips */
header nav,
header nav.justify-end,
header nav[class*="w-[200px]"] {
  width: auto !important;
  min-width: auto !important;
}

.lrm-model-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  color: #e4e4e7;
  background: rgba(255, 255, 255, 0.06);
  font: 500 12px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  user-select: none;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.lrm-model-button:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
  color: #ffffff;
  transform: translateY(-0.5px);
}

.lrm-model-button.is-fallback {
  position: fixed;
  top: 7px;
  right: 218px;
  z-index: 1200;
  height: 28px;
  background: rgba(30, 31, 36, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.lrm-model-button:focus-visible,
.lrm-settings-panel button:focus-visible,
.lrm-settings-panel input:focus-visible,
.lrm-settings-panel select:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.lrm-model-mark {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
}


.lrm-settings-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  background: rgba(10, 11, 15, 0.74);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: lrm-fade-in 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.lrm-settings-panel {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  width: min(1040px, calc(100vw - 48px));
  height: min(800px, calc(100vh - 48px));
  max-height: calc(100vh - 48px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  color: #f4f4f5;
  background: #18191c;
  box-shadow: 0 32px 80px -12px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.04);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  box-sizing: border-box;
  animation: lrm-scale-in 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes lrm-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes lrm-scale-in {
  from { opacity: 0; transform: scale(0.97) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.lrm-settings-sidebar {
  display: flex;
  flex-direction: column;
  padding: 26px 14px 20px;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  background: #131417;
  box-sizing: border-box;
  user-select: none;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
}

.lrm-settings-title {
  margin: 0 10px 22px;
  color: #ffffff;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.lrm-side-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  color: #9ca3af;
  background: transparent;
  font: 600 13.5px/1 inherit;
  text-align: left;
  cursor: pointer;
  transition: all 140ms ease;
}

.lrm-side-item:hover {
  color: #f3f4f6;
  background: rgba(255, 255, 255, 0.05);
}

.lrm-side-item.is-active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.lrm-side-icon {
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
  color: #60a5fa;
  font-size: 15px;
}

.lrm-settings-main {
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
  padding: 26px 30px 28px;
  background: #18191c;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

.lrm-settings-main::-webkit-scrollbar {
  width: 6px;
}
.lrm-settings-main::-webkit-scrollbar-track {
  background: transparent;
}
.lrm-settings-main::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
}
.lrm-settings-main::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.32);
}

.lrm-main-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.lrm-main-head h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: #f4f4f5;
  letter-spacing: -0.02em;
}

.lrm-main-head p {
  margin: 6px 0 0;
  color: #82838a;
  font-size: 13px;
  line-height: 1.4;
}

.lrm-close {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  color: #9ca3af;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: all 140ms ease;
}

.lrm-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.14);
}

.lrm-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  padding: 10px 14px;
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 10px;
  color: #93c5fd;
  background: rgba(30, 58, 138, 0.15);
  font-size: 12.5px;
  line-height: 1.45;
}

.lrm-notice.is-error {
  border-color: rgba(239, 68, 68, 0.28);
  color: #fca5a5;
  background: rgba(153, 27, 27, 0.18);
}

.lrm-role-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lrm-role-card {
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  background: #1e1f24;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
  overflow: hidden;
}

.lrm-role-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.lrm-role-card.is-expanded {
  border-color: rgba(59, 130, 246, 0.35);
  background: #202127;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(59, 130, 246, 0.2);
}

.lrm-role-summary {
  display: grid;
  grid-template-columns: minmax(180px, 1.1fr) minmax(200px, 1.4fr) auto;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
}

.lrm-role-name {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.lrm-status-dot {
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.15);
}

.lrm-status-dot.is-off {
  background: #64748b;
  box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.15);
}

.lrm-role-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.lrm-role-title {
  font-size: 14.5px;
  font-weight: 600;
  color: #f4f4f5;
  white-space: nowrap;
}

.lrm-role-desc {
  font-size: 11.5px;
  color: #71717a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lrm-role-model {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.lrm-model-badge {
  display: inline-block;
  padding: 3px 9px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12.5px;
  color: #e2e8f0;
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lrm-provider-tag {
  display: inline-block;
  padding: 2px 7px;
  background: rgba(59, 130, 246, 0.1);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  color: #60a5fa;
  white-space: nowrap;
}

.lrm-role-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.lrm-edit-area {
  display: none;
  padding: 0 18px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.12);
}

.lrm-edit-area.is-open {
  display: block;
}

.lrm-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
  padding-top: 16px;
}

.lrm-field {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.lrm-field.is-wide {
  grid-column: 1 / -1;
}

.lrm-field label {
  margin: 0 0 6px;
  color: #a1a1aa;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.lrm-field input,
.lrm-field select {
  width: 100%;
  height: 38px;
  box-sizing: border-box;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #f4f4f5;
  background: #141518;
  font-size: 13px;
  font-family: inherit;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.lrm-field input.is-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12.5px;
}

.lrm-field input::placeholder {
  color: #52525b;
}

.lrm-field input:focus,
.lrm-field select:focus {
  outline: none;
  border-color: #3b82f6;
  background: #111215;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

.lrm-field input:disabled,
.lrm-field select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.03);
}

.lrm-select-wrapper {
  position: relative;
  width: 100%;
}

.lrm-select-wrapper select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 32px;
  cursor: pointer;
}

.lrm-select-arrow {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #71717a;
  pointer-events: none;
}

.lrm-field-note {
  margin: 5px 0 0;
  color: #71717a;
  font-size: 11.5px;
  line-height: 1.35;
}

.lrm-card-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed rgba(255, 255, 255, 0.06);
}

.lrm-ghost-button,
.lrm-primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 16px;
  border-radius: 8px;
  font: 600 12.5px/1 inherit;
  cursor: pointer;
  transition: all 140ms ease;
  user-select: none;
}

.lrm-ghost-button {
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #d4d4d8;
  background: rgba(255, 255, 255, 0.03);
}

.lrm-ghost-button:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.lrm-primary-button {
  border: 1px solid transparent;
  color: #ffffff;
  background: #3b82f6;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.lrm-primary-button:hover {
  background: #2563eb;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
}

.lrm-primary-button:active {
  transform: translateY(1px);
}

.lrm-primary-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.lrm-btn-icon {
  flex: 0 0 auto;
}

.lrm-empty {
  padding: 35px 20px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  color: #9ca3af;
  text-align: center;
  font-size: 13px;
}

.lrm-loading {
  display: grid;
  min-height: 260px;
  place-items: center;
  color: #9ca3af;
  font-size: 13px;
}

@media (max-width: 760px) {
  .lrm-model-button {
    top: 52px;
    left: 16px;
    right: auto;
    height: 30px;
    padding: 0 10px;
  }

  .lrm-settings-backdrop {
    padding: 10px;
  }

  .lrm-settings-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: calc(100vh - 20px);
    border-radius: 16px;
  }

  .lrm-settings-sidebar {
    flex-direction: row;
    align-items: center;
    padding: 10px 14px;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    height: auto;
    overflow-x: auto;
  }

  .lrm-settings-title {
    display: none;
  }

  .lrm-side-item {
    height: 34px;
    padding: 0 12px;
    font-size: 12px;
  }

  .lrm-settings-main {
    padding: 18px 14px;
  }

  .lrm-role-summary {
    grid-template-columns: 1fr auto;
    gap: 10px;
    padding: 12px 14px;
  }

  .lrm-role-model {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .lrm-form-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lrm-settings-backdrop,
  .lrm-settings-panel,
  .lrm-model-button,
  .lrm-ghost-button,
  .lrm-primary-button {
    animation: none;
    transition: none;
  }
}

/* 隐藏顶部导航栏“无需登录”橙色徽章 */
div.ml-2.self-center.bg-amber-100,
div.bg-amber-100.text-amber-800,
div.dark\:bg-amber-900.dark\:text-amber-200,
[class*="bg-amber-100"][class*="text-amber-800"],
[class*="dark:bg-amber-900"][class*="dark:text-amber-200"],
.bg-amber-100,
.dark\:bg-amber-900 {
  display: none !important;
}

/* 同步通用 LLM 配置功能样式 */
.lrm-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.lrm-sync-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 13px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.28);
  cursor: pointer;
  transition: all 160ms cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.lrm-sync-button:hover {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.48);
  color: #7dd3fc;
  transform: translateY(-1px);
}

.lrm-btn-sync-inline {
  margin-right: auto;
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.25);
  background: rgba(56, 189, 248, 0.06);
}

.lrm-btn-sync-inline:hover {
  background: rgba(56, 189, 248, 0.14);
  border-color: rgba(56, 189, 248, 0.45);
  color: #7dd3fc;
}

.lrm-confirm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 11, 15, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  box-sizing: border-box;
  animation: lrm-fade-in 140ms ease;
}

.lrm-confirm-dialog {
  width: min(520px, calc(100% - 24px));
  background: #1c1d22;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  padding: 22px 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.05);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: lrm-scale-in 160ms cubic-bezier(0.16, 1, 0.3, 1);
}

.lrm-confirm-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.lrm-confirm-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.25);
  flex-shrink: 0;
}

.lrm-confirm-title {
  margin: 0 0 5px;
  font-size: 16px;
  font-weight: 700;
  color: #f4f4f5;
  letter-spacing: -0.01em;
}

.lrm-confirm-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: #9ca3af;
}

.lrm-confirm-preview {
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lrm-preview-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12.5px;
}

.lrm-preview-label {
  color: #71717a;
  font-weight: 500;
  min-width: 65px;
}

.lrm-preview-val {
  font-family: monospace;
  color: #38bdf8;
  font-weight: 600;
  font-size: 12.5px;
}

.lrm-preview-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.lrm-tag-sync {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 5px;
  font-size: 11px;
  background: rgba(56, 189, 248, 0.12);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.lrm-tag-keep {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 5px;
  font-size: 11px;
  background: rgba(34, 197, 94, 0.1);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.22);
}

.lrm-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.lrm-btn-warning {
  background: #f59e0b !important;
  color: #000000 !important;
  font-weight: 600 !important;
  border-color: #d97706 !important;
}

.lrm-btn-warning:hover {
  background: #fbbf24 !important;
  color: #000000 !important;
}

