:root {
  --bg-app: #0f172a;
  --bg-sidebar: #0b1120;
  --bg-surface: #1e293b;
  --bg-surface-hover: #273549;
  --bg-elevated: #162032;
  --bg-input: #0f172a;
  --border: #2c3a52;
  --border-subtle: #1e293b;
  --text-main: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --accent: #f59e0b;
  --danger: #ef4444;
  --success: #10b981;
  --user-bubble: #2563eb;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg-app);
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.6;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--text-secondary);
}

/* 按钮通用样式 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  color: var(--text-main);
  background: var(--bg-surface);
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12.5px;
}

.btn-block {
  width: 100%;
  padding: 10px 16px;
  font-size: 14px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--bg-surface);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg-surface-hover);
}

.btn-accent {
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.4);
}
.btn-accent:hover:not(:disabled) {
  background: rgba(245, 158, 11, 0.26);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.4);
}
.btn-danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.28);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg-surface);
  color: var(--text-main);
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
}
.icon-btn:hover {
  background: var(--bg-surface);
  color: var(--text-main);
}

/* 输入框通用 */
input[type="text"],
input[type="password"],
input[type="search"],
input[type="number"],
select,
textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

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

.field-tip {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* 登录/初始化页 */
.auth-view {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at top, #172554 0%, #0f172a 55%);
  overflow-y: auto;
}

.auth-card {
  width: 100%;
  max-width: 430px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.brand-logo {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.auth-brand h1 {
  font-size: 20px;
  font-weight: 700;
}

.announcement-box {
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #bfdbfe;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  margin-bottom: 16px;
}

.setup-badge {
  background: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(245, 158, 11, 0.38);
  color: #fcd34d;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
}

.auth-tabs {
  display: flex;
  background: var(--bg-app);
  padding: 4px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
}

.auth-tab {
  flex: 1;
  padding: 7px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
}

.auth-tab.active {
  background: var(--bg-surface);
  color: var(--text-main);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-hint {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.55;
}
.form-hint.center {
  text-align: center;
}

/* 主应用布局 */
.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

.sidebar {
  width: 276px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: margin-left 0.2s ease, transform 0.2s ease;
  z-index: 30;
}

.sidebar.collapsed {
  margin-left: -276px;
}

.sidebar-header {
  padding: 14px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
}

.brand-icon {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.btn-new-chat {
  width: 100%;
  justify-content: center;
  padding: 8px;
}

.sidebar-search {
  padding: 0 14px 10px;
}

.sidebar-notice {
  margin: 0 14px 10px;
  padding: 8px 10px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: #cbd5e1;
}

.conv-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.conv-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  transition: background 0.12s;
}

.conv-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.conv-item.active {
  background: var(--bg-surface);
  color: var(--text-main);
  font-weight: 500;
}

.conv-title-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.conv-actions {
  display: none;
  align-items: center;
  gap: 2px;
}

.conv-item:hover .conv-actions,
.conv-item.active .conv-actions {
  display: inline-flex;
}

.conv-act-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 12px;
}
.conv-act-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-quick-actions {
  display: flex;
  gap: 6px;
}
.sidebar-quick-actions .btn {
  flex: 1;
  position: relative;
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  display: inline-block;
}

.user-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  flex: 1;
  min-width: 0;
}
.user-info:hover {
  background: rgba(255, 255, 255, 0.05);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #93c5fd;
  flex-shrink: 0;
}

.user-meta {
  min-width: 0;
}

.user-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}

.user-name-row > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-badge {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 99px;
  background: #334155;
  color: #cbd5e1;
  flex-shrink: 0;
}
.role-badge.admin {
  background: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
}

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

/* 右侧聊天主界面 */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-app);
}

.chat-header {
  height: 54px;
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.conv-header-title {
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.conv-header-title:hover {
  color: #93c5fd;
}

.chat-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.model-picker-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
}

.model-select {
  width: auto;
  min-width: 155px;
  max-width: 240px;
  padding: 5px 10px;
  background: var(--bg-surface);
  font-weight: 500;
}

.upstream-banner {
  background: rgba(245, 158, 11, 0.14);
  border-bottom: 1px solid rgba(245, 158, 11, 0.35);
  padding: 9px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #fde68a;
  font-size: 13px;
}

/* 消息容器 */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 22px 18px 16px;
  scroll-behavior: auto;
}

.empty-welcome {
  max-width: 680px;
  margin: 7vh auto 0;
  text-align: center;
}

.welcome-icon {
  font-size: 40px;
  margin-bottom: 10px;
}

.empty-welcome h2 {
  font-size: 22px;
  margin-bottom: 6px;
}

.starter-grid {
  margin-top: 26px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  text-align: left;
}

.starter-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--text-main);
  transition: border-color 0.15s, background 0.15s;
}
.starter-card:hover {
  border-color: var(--primary);
  background: var(--bg-surface);
}
.starter-card strong {
  font-size: 13.5px;
}
.starter-card span {
  font-size: 12px;
  color: var(--text-secondary);
}

.messages-list {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.msg-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.msg-row.user {
  align-items: flex-end;
}

.msg-row.assistant {
  align-items: flex-start;
}

.msg-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.msg-bubble {
  max-width: 100%;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  word-break: break-word;
}

.msg-row.user .msg-bubble {
  max-width: 82%;
  background: var(--user-bubble);
  color: #fff;
  white-space: pre-wrap;
  border-bottom-right-radius: 3px;
}

.msg-row.assistant .msg-bubble {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
}

.msg-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.msg-att-file {
  background: rgba(0, 0, 0, 0.22);
  padding: 4px 9px;
  border-radius: 5px;
  font-size: 12px;
}

.msg-att-img {
  max-width: 220px;
  max-height: 180px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 思考过程折叠块 */
.reasoning-details {
  background: rgba(15, 23, 42, 0.65);
  border-left: 3px solid #6366f1;
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 12px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.reasoning-details summary {
  cursor: pointer;
  font-weight: 600;
  color: #a5b4fc;
  user-select: none;
}

.reasoning-body {
  margin-top: 8px;
  white-space: pre-wrap;
  line-height: 1.55;
}

/* Markdown 正文排版 */
.md-body p {
  margin-bottom: 10px;
}
.md-body p:last-child {
  margin-bottom: 0;
}
.md-body ul, .md-body ol {
  margin: 6px 0 10px 22px;
}
.md-body h1, .md-body h2, .md-body h3, .md-body h4 {
  margin: 14px 0 8px;
  line-height: 1.35;
}
.md-body code:not(pre code) {
  background: rgba(148, 163, 184, 0.16);
  padding: 2px 5px;
  border-radius: 4px;
  font-family: Consolas, "Cascadia Code", monospace;
  font-size: 0.92em;
}
.md-body blockquote {
  border-left: 3px solid var(--primary);
  padding-left: 12px;
  color: var(--text-secondary);
  margin: 8px 0;
}
.md-body table {
  border-collapse: collapse;
  width: 100%;
  margin: 10px 0;
  font-size: 13px;
}
.md-body th, .md-body td {
  border: 1px solid var(--border);
  padding: 6px 10px;
}
.md-body th {
  background: var(--bg-surface);
}
.md-body a {
  color: #60a5fa;
}

.code-block-wrap {
  margin: 10px 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #0b0f19;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 12px;
  background: #161e2e;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-secondary);
}

.copy-code-btn {
  background: transparent;
  border: none;
  color: #93c5fd;
  cursor: pointer;
  font-size: 12px;
}
.copy-code-btn:hover {
  text-decoration: underline;
}

.code-block-wrap pre {
  margin: 0;
  padding: 12px;
  overflow-x: auto;
  font-family: Consolas, "Cascadia Code", monospace;
  font-size: 13px;
  line-height: 1.5;
}

.msg-footer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.msg-link-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 12px;
}
.msg-link-btn:hover {
  color: var(--text-main);
}

.typing-cursor::after {
  content: "▋";
  display: inline-block;
  margin-left: 2px;
  color: var(--primary);
  animation: blink 0.9s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* 底部输入框 */
.composer-wrap {
  padding: 10px 18px 16px;
  flex-shrink: 0;
}

.composer-box {
  max-width: 860px;
  margin: 0 auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px 12px;
  transition: border-color 0.15s;
}
.composer-box:focus-within {
  border-color: var(--primary);
}

.attachment-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 8px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
}

.att-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
}

.att-chip img {
  width: 24px;
  height: 24px;
  object-fit: cover;
  border-radius: 3px;
}

.att-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
}
.att-remove:hover {
  color: var(--danger);
}

#chat-input {
  border: none;
  background: transparent;
  padding: 4px 2px;
  resize: none;
  max-height: 200px;
  min-height: 42px;
  font-size: 14px;
  line-height: 1.55;
}

.composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}

.composer-tools-left, .composer-tools-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.composer-hint {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* 弹窗 Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 100;
}

.modal-card {
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-lg {
  max-width: 680px;
}

.modal-xl {
  max-width: 980px;
  height: 86vh;
}

.modal-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 4px 0;
}

.section-subtitle {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.info-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 14px 0;
}

.field-label {
  display: block;
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.copy-row {
  display: flex;
  gap: 8px;
}

.static-code {
  margin-top: 6px;
  background: #0b0f19;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  overflow-x: auto;
  font-family: Consolas, monospace;
  font-size: 12.5px;
  color: #e2e8f0;
}

/* 队长后台专属样式 */
.admin-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 20px 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-sidebar);
  overflow-x: auto;
}

.admin-tab {
  padding: 9px 14px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-weight: 500;
  white-space: nowrap;
}

.admin-tab.active {
  color: #60a5fa;
  border-bottom-color: #3b82f6;
}

.admin-pane {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel-card {
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.highlight-card {
  border-color: rgba(59, 130, 246, 0.45);
  background: rgba(30, 58, 138, 0.15);
}

.panel-card h4 {
  font-size: 14px;
  margin-bottom: 12px;
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.panel-title-row h4 {
  margin-bottom: 0;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.tag-status {
  font-style: normal;
  font-size: 11.5px;
  color: #34d399;
  margin-left: 6px;
}

.proxy-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.switch-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 13.5px;
  white-space: nowrap;
}

.proxy-input {
  flex: 1;
  min-width: 220px;
}

.detect-box, .test-result-box {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
}

.test-result-box.ok {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
}

.test-result-box.err {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.add-model-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.scrollable-chips {
  max-height: 150px;
  overflow-y: auto;
  padding: 4px 0;
}

.model-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 99px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  font-size: 12px;
}

.model-chip.selectable {
  cursor: pointer;
}
.model-chip.selectable.selected {
  background: rgba(59, 130, 246, 0.25);
  border-color: var(--primary);
  color: #93c5fd;
}

.chip-del {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
}
.chip-del:hover {
  color: var(--danger);
}

.fetched-drawer {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  margin-bottom: 10px;
}

.fetched-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 12px;
}
.fetched-header input {
  max-width: 200px;
  padding: 4px 8px;
}

.admin-save-bar {
  display: flex;
  justify-content: flex-end;
}

.lan-url-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lan-url-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: Consolas, monospace;
  font-size: 13.5px;
  background: rgba(15, 23, 42, 0.7);
  padding: 8px 12px;
  border-radius: 6px;
}

.create-user-bar {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1.1fr 1fr auto;
  gap: 8px;
}

.table-wrap {
  overflow-x: auto;
}

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

.data-table th, .data-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
  white-space: nowrap;
}

.data-table th {
  color: var(--text-secondary);
  font-weight: 600;
  background: var(--bg-elevated);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-select {
  width: auto;
  min-width: 155px;
  padding: 5px 10px;
}

.apikey-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: Consolas, monospace;
  font-size: 12px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 6px;
  color: #cbd5e1;
}

.token-strong {
  font-weight: 700;
  color: #60a5fa;
  font-size: 13.5px;
}

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

.mini-model-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 270px;
  white-space: normal;
}

.mini-model-tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 99px;
  background: rgba(59, 130, 246, 0.14);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #bfdbfe;
  font-size: 11px;
  white-space: nowrap;
}

.stat-card {
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
}
.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-secondary);
}
.stat-card .stat-value {
  font-size: 22px;
  font-weight: 700;
  margin-top: 4px;
  color: #93c5fd;
}

/* Toast 通知 */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 10px 15px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-size: 13px;
}
.toast.error {
  border-color: var(--danger);
  color: #fecaca;
}
.toast.success {
  border-color: var(--success);
  color: #a7f3d0;
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
  }
  .sidebar.collapsed {
    transform: translateX(-100%);
    margin-left: 0;
  }
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 25;
  }
  .hide-mobile {
    display: none !important;
  }
  .starter-grid, .form-grid-2, .create-user-bar, .stats-grid {
    grid-template-columns: 1fr;
  }
  .msg-row.user .msg-bubble {
    max-width: 92%;
  }
}
