:root {
  /* ============================================================
     设计系统 v2.0 令牌 (Design Tokens) — 暗色·精致现代
     · 新增 v2.0 命名：--bg-base / --bg-surface / --text-1 / --r-md ...
     · 旧命名（--bg-card / --accent / --radius / --border-color ...）
       已重映射为新配色与形状，所有页面本地样式零改动即套用新视觉。
     ============================================================ */

  /* —— 背景分层：从最底到最浅，营造纵深 —— */
  --bg-base:      #0e1016;            /* 页面最底 */
  --bg-sidebar:   #0b0d12;
  --bg-primary:   #0e1016;            /* 旧名 → 新配色 */
  --bg-secondary: #161a22;            /* 旧名 → surface */
  --bg-surface:   #161a22;
  --bg-surface-2: #1d222c;
  --bg-card:      #161a22;            /* 旧名 → surface */
  --bg-input:     #0f131a;
  --bg-hover:     #232a35;

  /* —— 描边 —— */
  --border:        #252b36;
  --border-color:  #252b36;           /* 旧名 */
  --border-strong: #323a47;

  /* —— 文本三档（对比度 ≥ 4.5:1，WCAG AA） —— */
  --text-1:       #eef2f8;
  --text-primary:   #eef2f8;          /* 旧名 */
  --text-2:       #9aa6b8;
  --text-secondary:#9aa6b8;           /* 旧名 */
  --text-3:       #697486;
  --text-muted:     #697486;          /* 旧名 */

  /* —— 品牌主色（沿用蓝，提升明度与层次） —— */
  --accent:        #5b8def;
  --accent-strong: #7aa3f2;
  --accent-hover:  #7aa3f2;           /* 旧名 */
  --accent-weak:   rgba(91,141,239,0.14);
  --accent-soft:   rgba(91,141,239,0.14); /* 旧名 */
  --accent-ring:   rgba(91,141,239,0.45);

  /* —— 语义色 —— */
  --success:      #3ecf8e;  --success-weak: rgba(62,207,142,0.14);  --success-soft: rgba(62,207,142,0.14);
  --warning:      #f5a623;  --warning-weak: rgba(245,166,35,0.14);  --warning-soft: rgba(245,166,35,0.14);
  --danger:       #f76d7d;  --danger-weak:  rgba(247,109,125,0.14); --danger-soft:  rgba(247,109,125,0.14);
  --danger-hover: #ff7188;
  --info:         #5b8def;  --info-weak:    rgba(91,141,239,0.14);

  /* —— 圆角（4 档） —— */
  --r-sm: 8px;  --r-md: 12px;  --r-lg: 16px;  --r-xl: 22px;  --r-pill: 999px;
  --radius-sm: 8px;   --radius: 12px;   --radius-lg: 16px;   /* 旧名 → 新值 */

  /* —— 阴影（暗色下克制、聚焦） —— */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.40);
  --shadow-md: 0 6px 18px rgba(0,0,0,0.35);
  --shadow-lg: 0 18px 40px rgba(0,0,0,0.45);
  --shadow: 0 6px 18px rgba(0,0,0,0.35);   /* 旧名 */

  /* —— 聚焦环 —— */
  --ring: 0 0 0 3px var(--accent-ring);

  /* —— 间距（4px 基准节奏） —— */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px;
  --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px; --s-16: 64px;

  /* —— 字体 —— */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", Consolas, monospace;

  /* —— 动效 —— */
  --ease: 200ms cubic-bezier(.4,0,.2,1);
  --transition: 180ms cubic-bezier(.4,0,.2,1);   /* 旧名 */
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* 全局基础增强：字体平滑、选中色、统一聚焦环 */
html { -webkit-text-size-adjust: 100%; }
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--accent-soft); color: var(--text-primary); }

:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--radius-sm);
}

/* 自定义滚动条更精致 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); background-clip: padding-box; }

/* ========== Layout ========== */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 320px;
  min-width: 320px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-header h2 {
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
}

.sidebar-header .nav-link {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.sidebar-header .nav-link:hover {
  color: var(--accent);
  text-decoration: none;
}

.sidebar-nav {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-nav .sidebar-nav-item {
  display: block;
  padding: 8px 20px;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: all var(--transition);
}

.sidebar-nav .sidebar-nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  text-decoration: none;
}

.sidebar-nav .sidebar-nav-item.active {
  background: var(--bg-hover);
  border-left-color: var(--accent);
  color: var(--text-primary);
}

.sidebar-nav .sidebar-section-title {
  padding: 14px 20px 4px 20px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.sidebar-separator {
  height: 1px;
  background: var(--border-color);
  margin: 4px 20px;
  opacity: 0.3;
}

.admin-nav-separator {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: 8px 16px;
}


.sidebar-search {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-search input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition);
}

.sidebar-search input:focus {
  border-color: var(--accent);
}

.sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.sidebar-item {
  padding: 12px 20px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-item:hover {
  background: var(--bg-hover);
}

.sidebar-item.active {
  background: var(--bg-hover);
  border-left-color: var(--accent);
}

.sidebar-item .item-icon {
  width: 20px;
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.sidebar-item .item-info {
  flex: 1;
  min-width: 0;
}

.sidebar-item .item-title {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-item .item-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.sidebar-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

/* 用户信息区 */
.sidebar-user {
  margin-top: auto;
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
}
.sidebar-user .user-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.sidebar-user .user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}
.sidebar-user .user-name {
  font-size: 13px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-user .user-actions {
  display: flex;
  gap: 6px;
}
.btn-user-action {
  flex: 1;
  padding: 6px 8px;
  font-size: 11px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn-user-action:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--accent);
}

/* 模板选择卡片 */
.template-cards {
  padding: 12px 16px;
}
.template-cards-title {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 12px;
  line-height: 1.5;
}
.template-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 10px;
  transition: border-color 0.2s;
}
.template-card:hover {
  border-color: var(--primary);
}
.template-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.template-card-icon {
  font-size: 24px;
  line-height: 1;
}
.template-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.template-card-count {
  font-size: 12px;
  color: var(--text-muted);
}
.template-card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 10px;
}
.template-import-btn {
  width: 100%;
}

/* ========== Main Content ========== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ========== Editor Panel ========== */
.editor-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.toolbar .spacer {
  flex: 1;
}

.toolbar .status {
  font-size: 12px;
  color: var(--text-muted);
}

/* ====== Button 组件 ====== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: all var(--transition);
  text-decoration: none;
}
.btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
  text-decoration: none;
}
.btn:focus-visible {
  box-shadow: var(--ring);
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled,
.btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  pointer-events: none;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.btn-primary:focus-visible {
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn-danger {
  border-color: var(--danger);
  color: var(--danger);
}
.btn-danger:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn-danger:focus-visible {
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--bg-hover);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.btn-outline {
  background: transparent;
  border-color: var(--accent);
  color: var(--accent);
}
.btn-outline:hover {
  background: var(--accent);
  color: #fff;
}

.btn-accent {
  background: linear-gradient(135deg, #5b8def, #7c5ce7);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
}
.btn-accent:hover {
  background: linear-gradient(135deg, #4a7de0, #6a4de0);
}
.btn-accent:focus-visible {
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn-sm {
  min-height: 28px;
  padding: 3px 10px;
  font-size: 12px;
  border-radius: 6px;
}

.btn-lg {
  min-height: 44px;
  padding: 10px 24px;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius);
}

/* ====== Input / Textarea / Select 基础组件 ====== */
.input,
input[type="text"].input,
input[type="password"].input,
input[type="email"].input,
input[type="url"].input,
input[type="number"].input,
input[type="search"].input {
  width: 100%;
  padding: 9px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  line-height: 1.5;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input:focus,
input[type="text"].input:focus,
input[type="password"].input:focus,
input[type="email"].input:focus {
  border-color: var(--accent);
  box-shadow: var(--ring);
}
.input::placeholder,
input.input::placeholder {
  color: var(--text-muted);
}
.input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

textarea.input {
  min-height: 80px;
  resize: vertical;
}

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239aa6b8'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.editor-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.editor-area .placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 15px;
}

.editor-header {
  margin-bottom: 16px;
}

.editor-header input {
  width: 100%;
  padding: 10px 14px;
  font-size: 18px;
  font-weight: 600;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition);
}

.editor-header input:focus {
  border-color: var(--accent);
}

.editor-header .meta-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

/* Entry group select */
#entry-group {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  padding: 2px 6px;
  outline: none;
}

/* ========== EasyMDE Overrides (Dark Theme) ========== */
.CodeMirror {
  background: var(--bg-input) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-sm) !important;
  font-size: 14px !important;
  line-height: 1.7 !important;
  min-height: 400px !important;
}

.CodeMirror-gutters {
  background: var(--bg-card) !important;
  border-right: 1px solid var(--border-color) !important;
}

.CodeMirror-cursor {
  border-left-color: var(--text-primary) !important;
}

.editor-toolbar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  opacity: 1 !important;
}

.editor-toolbar button {
  color: var(--text-secondary) !important;
}

.editor-toolbar button:hover,
.editor-toolbar button.active {
  background: var(--bg-hover);
  border-color: var(--border-color);
}

.editor-toolbar i.separator {
  border-left: 1px solid var(--border-color);
}

.editor-statusbar {
  color: var(--text-muted) !important;
  font-size: 12px !important;
  padding: 8px 10px !important;
}

.editor-preview {
  background: var(--bg-card) !important;
}

.editor-preview,
.editor-preview-side {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
}

/* ========== Chat Page ========== */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 800px;
  margin: 0 auto;
}

.chat-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-header h1 {
  font-size: 18px;
  font-weight: 600;
}

.chat-header .back-link {
  font-size: 13px;
  color: var(--text-secondary);
  margin-left: auto;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.chat-message {
  margin-bottom: 20px;
  display: flex;
  gap: 12px;
}

.chat-message.user {
  flex-direction: row-reverse;
}

.chat-message .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  font-weight: 600;
}

.chat-message.assistant .avatar {
  background: var(--accent);
  color: #fff;
}

.chat-message.user .avatar {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.chat-message .bubble {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
}

.chat-message.user .bubble {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-message.assistant .bubble {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 4px;
}

.chat-message .bubble p { margin: 0 0 8px; }
.chat-message .bubble p:last-child { margin-bottom: 0; }
.chat-message .bubble pre {
  background: var(--bg-primary);
  padding: 10px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: 13px;
}
.chat-message .bubble code {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 13px;
}

.chat-input-area {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
  display: flex;
  gap: 8px;
}

.chat-input-area textarea {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  min-height: 44px;
  max-height: 120px;
  transition: border-color var(--transition);
}

.chat-input-area textarea:focus {
  border-color: var(--accent);
}

.chat-input-area .btn {
  align-self: flex-end;
  padding: 10px 20px;
}

.chat-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 15px;
}

/* ========== Toast ========== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: #fff;
  animation: slideIn 0.3s ease;
  box-shadow: var(--shadow);
  max-width: 360px;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--accent); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ========== Modal ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 24px;
  min-width: 360px;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalIn {
  from { transform: translateY(8px) scale(0.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal h3 {
  margin-bottom: 12px;
  font-size: 16px;
}

.modal p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ========== Scrollbar ========== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ========== Dropdown ========== */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  min-width: 160px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  z-index: 100;
  overflow: hidden;
}

.dropdown-menu.show {
  display: block;
}

.dropdown-item {
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--transition);
  white-space: nowrap;
}

.dropdown-item:hover {
  background: var(--bg-hover);
  color: var(--accent);
}

/* ========== Test Panel ========== */
.test-panel {
  width: 380px;
  min-width: 320px;
  border-left: 1px solid var(--border-color);
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.3s ease, min-width 0.3s ease;
}

.test-panel.collapsed {
  width: 40px;
  min-width: 40px;
}

.test-panel.collapsed .test-panel-body {
  display: none;
}

.test-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  min-height: 49px;
}

.test-panel.collapsed .test-panel-header {
  flex-direction: column;
  padding: 10px 0;
  gap: 8px;
  justify-content: flex-start;
}

.test-panel-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.test-panel.collapsed .test-panel-title {
  writing-mode: vertical-rl;
  font-size: 13px;
  letter-spacing: 2px;
}

.test-panel-toggle {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  line-height: 1;
}

.test-panel-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.test-panel.collapsed .test-panel-toggle {
  transform: rotate(180deg);
}

.test-panel-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.test-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.test-messages::-webkit-scrollbar { width: 4px; }
.test-messages::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }

.test-welcome {
  align-self: center;
  text-align: center;
  margin: auto;
  padding: 32px 16px;
  color: var(--text-muted);
}

.test-welcome-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-card);
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.test-welcome p {
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
}

.test-welcome-sub {
  font-size: 12px !important;
  color: var(--text-muted);
  margin-top: 4px !important;
}

.test-msg-row {
  display: flex;
  gap: 8px;
  max-width: 88%;
  animation: testFadeIn 0.25s ease;
}

.test-msg-row.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.test-msg-row.ai {
  align-self: flex-start;
}

.test-msg-bubble {
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
}

.test-msg-row.user .test-msg-bubble {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.test-msg-row.ai .test-msg-bubble {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 4px;
}

.test-msg-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  padding: 0 4px;
}

.test-msg-row.user .test-msg-time { text-align: right; }

.test-typing {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}

.test-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: testBounce 1.2s infinite;
}

.test-typing span:nth-child(2) { animation-delay: 0.15s; }
.test-typing span:nth-child(3) { animation-delay: 0.3s; }

.test-input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.test-input-area textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 13px;
  line-height: 1.5;
  font-family: inherit;
  outline: none;
  max-height: 100px;
  min-height: 36px;
  transition: border-color var(--transition);
  background: var(--bg-input);
  color: var(--text-primary);
}

.test-input-area textarea:focus {
  border-color: var(--accent);
}

.test-input-area .btn-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s, transform 0.15s;
  font-size: 16px;
  padding: 0;
}

.test-input-area .btn-send:hover { opacity: 0.9; }
.test-input-area .btn-send:active { transform: scale(0.94); }
.test-input-area .btn-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

@keyframes testFadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes testBounce { 0%,60%,100% { transform: translateY(0); } 30% { transform: translateY(-6px); } }

/* ========== Group Tabs ========== */
.group-tabs {
  display: flex;
  gap: 2px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.group-tabs::-webkit-scrollbar { height: 0; }

.group-tab {
  flex: 0 0 auto;
  padding: 6px 10px;
  font-size: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  text-align: center;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  min-height: 32px;
}

.group-tab:hover { color: var(--text-secondary); }
.group-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ========== Interview / 快速建库 ========== */
.interview-container {
  padding: 24px;
  height: 100%;
  overflow-y: auto;
}

.interview-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 700px;
}

.interview-card h3 {
  font-size: 18px;
  margin-bottom: 4px;
}

.interview-desc {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 20px;
}

.interview-step h4 {
  font-size: 14px;
  margin-bottom: 12px;
  color: var(--text-secondary);
}

/* 行业选择卡片 */
.industry-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.industry-card {
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-primary);
  min-height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.industry-card:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
}

.industry-icon {
  font-size: 32px;
  margin-bottom: 8px;
  display: block;
}

.industry-name {
  font-size: 14px;
  font-weight: 500;
}

/* 问答进度条 */
.qa-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.progress-bar-bg {
  flex: 1;
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.4s ease;
  width: 0%;
}

.progress-text {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  min-width: 36px;
  text-align: right;
}

/* 问答历史 */
.qa-history {
  max-height: 220px;
  overflow-y: auto;
  margin-bottom: 16px;
  padding-right: 4px;
}

.qa-pair {
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 8px;
}

.qa-q {
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 4px;
}

.qa-a {
  font-size: 13px;
  color: var(--text-primary);
}

/* 当前问答 */
.qa-current {
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
}

.qa-question {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.qa-input-row {
  display: flex;
  gap: 8px;
}

.qa-answer-input {
  flex: 1;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 15px;
  min-height: 48px;
  outline: none;
  transition: border-color var(--transition);
}

.qa-answer-input:focus {
  border-color: var(--accent);
}

/* FAQ 预览列表 */
.faq-review-list {
  margin: 12px 0;
  max-height: 400px;
  overflow-y: auto;
}

.faq-review-item {
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 8px;
  overflow: hidden;
}

.faq-review-group {
  font-size: 11px;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.faq-review-title {
  width: 100%;
  background: none;
  border: 1px solid transparent;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  padding: 4px 0;
  outline: none;
  margin-bottom: 4px;
  box-sizing: border-box;
}

.faq-review-title:focus {
  border-bottom-color: var(--accent);
}

.faq-review-content {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  padding: 8px;
  resize: vertical;
  outline: none;
  font-family: inherit;
  box-sizing: border-box;
  max-width: 100%;
}

.faq-review-content:focus {
  border-color: var(--accent);
}

.interview-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

/* Step progress indicator (desktop + mobile) */
.step-progress-wrap {
  margin-bottom: 16px;
}
.step-progress-bar {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 4px;
  padding: 0 4px;
}
.step-dots-row {
  display: flex;
  align-items: center;
  gap: 0;
}
.step-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all 0.3s;
}
.step-dot.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.step-dot.done {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
.step-line {
  flex: 1;
  height: 2px;
  background: var(--border-color);
  min-width: 24px;
  transition: all 0.3s;
}
.step-line.done {
  background: var(--success);
}
.step-label-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-muted);
  padding: 0 2px;
}

/* Previous step button */
.btn-prev-step {
  min-height: 36px;
  font-size: 13px;
  padding: 6px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.btn-prev-step:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--accent);
}

/* Larger interview inputs */
.faq-review-content {
  min-height: 80px;
}
.faq-review-title {
  min-height: 36px;
}

/* ========== Health Panel ========== */
.health-panel {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 16px 24px;
}

.health-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.health-score {
  font-size: 36px;
  font-weight: 700;
}

.health-label {
  font-size: 14px;
  color: var(--text-secondary);
  flex: 1;
}

.health-close {
  color: var(--text-muted);
}

.health-body {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.health-section h5 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.health-item {
  font-size: 12px;
  padding: 4px 0;
  padding-left: 12px;
  border-left: 3px solid transparent;
}

.health-item.danger { border-left-color: var(--danger); color: var(--danger); }
.health-item.warn { border-left-color: #e8a640; color: #e8a640; }
.health-item.ok { border-left-color: var(--success); color: var(--success); }
.health-item.info { border-left-color: var(--accent); color: var(--accent); }

/* ========== Responsive - Tablet (≤1024px) ========== */
@media (max-width: 1024px) {
  .sidebar { width: 280px; min-width: 280px; }
  .toolbar { padding: 12px 16px; }
  .editor-area { padding: 18px; }
  .test-panel { width: 340px; min-width: 300px; }
  .chat-container { max-width: 100%; }
}

/* ========== Responsive - Mobile (≤768px) ========== */
@media (max-width: 768px) {
  /* --- Global --- */
  body { font-size: 14px; }
  a, button, .btn, .btn-primary, .btn-danger, .btn-accent, .btn-sm {
    min-height: 44px;
    font-size: 14px;
    padding: 10px 16px;
  }
  .btn-sm { min-height: 36px; padding: 6px 12px; font-size: 13px; }

  /* --- Layout --- */
  .app-layout {
    flex-direction: column;
    position: relative;
  }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    min-width: 280px;
    height: 100vh;
    z-index: 999;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 998;
  }
  .sidebar-overlay.show { display: block; }
  .sidebar-header { padding: 12px 16px; }
  .sidebar-nav .sidebar-nav-item { padding: 10px 16px; font-size: 14px; }
  .sidebar-search { padding: 8px 12px; }
  .sidebar-search input { font-size: 14px; padding: 10px 12px; }
  .sidebar-item { padding: 10px 16px; }
  .sidebar-item .item-title { font-size: 14px; }

  .main-content {
    flex-direction: column;
  }

  /* --- Group Tabs: horizontal scroll --- */
  .group-tabs {
    gap: 0;
    padding: 6px 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .group-tabs::-webkit-scrollbar { height: 0; }
  .group-tab {
    flex: 0 0 auto;
    padding: 8px 12px;
    font-size: 13px;
    min-height: 44px;
    white-space: nowrap;
  }

  /* --- Mobile header bar --- */
  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 52px;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    z-index: 997;
    padding: 0 16px;
  }
  .mobile-logo {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
  }
  .app-layout {
    padding-top: 52px;
  }
  /* push fixed-positioned sidebar below mobile header */
  .sidebar {
    top: 52px;
    height: calc(100vh - 52px);
  }
  .sidebar-overlay {
    top: 52px;
  }

  /* --- Mobile menu button --- */
  .mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 1;
  }

  /* --- Editor Panel --- */
  .editor-panel { min-width: 0; }
  .toolbar {
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 12px;
  }
  .toolbar .btn { flex: 0 0 auto; }
  .toolbar .spacer { display: none; }
  .editor-area { padding: 12px; }
  .editor-header input { font-size: 16px; padding: 10px 12px; width: 100%; }
  .editor-header .meta-row { flex-wrap: wrap; gap: 8px; font-size: 12px; }
  .editor-form input, .editor-form textarea { font-size: 14px; }
  #content-editor + .CodeMirror { min-height: 250px !important; }
  .dropdown-menu { position: fixed; left: 12px; right: 12px; top: auto; min-width: 0; }

  /* --- Test Panel --- */
  .test-panel {
    width: 100% !important;
    min-width: 100% !important;
    max-height: 40vh;
    border-left: none;
    border-top: 1px solid var(--border-color);
  }
  .test-panel.collapsed {
    width: 100% !important;
    min-width: 100% !important;
    max-height: 48px;
  }

  /* --- Chat --- */
  .chat-container { max-width: 100%; }
  .chat-messages { padding: 16px; }
  .chat-message .bubble { max-width: 85%; font-size: 14px; }
  .chat-input-area { padding: 12px 16px; }
  .chat-input-area textarea { font-size: 14px; min-height: 44px; }

  /* --- Table horizontal scroll --- */
  .table-responsive {
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
  }
  th, td {
    font-size: 13px;
    padding: 10px 12px;
    white-space: nowrap;
  }

  /* --- Modal --- */
  .modal {
    min-width: 0;
    width: calc(100vw - 32px);
    max-height: 90vh;
    overflow-y: auto;
  }

  /* --- Toast --- */
  .toast-container {
    left: 12px;
    right: 12px;
    top: 12px;
  }
  .toast { max-width: 100%; font-size: 14px; }

  /* --- Stats grid --- */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .stat-card { padding: 14px; }
  .stat-card .stat-value { font-size: 22px; }

  /* --- Interview: full-width modal card --- */
  .interview-container {
    padding: 12px;
  }
  .interview-card {
    max-width: 100%;
    padding: 16px;
  }
  .interview-card h3 {
    font-size: 16px;
  }

  /* Industry cards: 2 columns, bigger touch area */
  .industry-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .industry-card {
    padding: 16px 10px;
    min-height: 90px;
  }
  .industry-icon { font-size: 28px; }
  .industry-name { font-size: 13px; }

  /* QA input: stack on very narrow screens */
  .qa-input-row {
    flex-direction: column;
    gap: 8px;
  }
  .qa-answer-input {
    font-size: 15px;
    padding: 10px 12px;
  }
  .qa-input-row .btn {
    align-self: flex-end;
    min-height: 48px;
  }

  .qa-question { font-size: 14px; }
  .qa-history { max-height: 180px; }
  .progress-text { min-width: 30px; font-size: 12px; }

  /* FAQ review list: prevent horizontal overflow */
  .faq-review-list {
    max-height: 300px;
  }
  .faq-review-item {
    padding: 8px 10px;
  }
  .faq-review-title {
    font-size: 13px;
    max-width: 100%;
    box-sizing: border-box;
  }
  .faq-review-content {
    font-size: 12px;
    max-width: 100%;
    box-sizing: border-box;
  }
  .interview-actions {
    flex-wrap: wrap;
    gap: 8px;
  }
  .interview-actions .btn {
    flex: 1 1 auto;
    min-height: 44px;
    justify-content: center;
  }

  /* === Mobile: sticky user section at sidebar bottom === */
  .sidebar {
    display: flex;
    flex-direction: column;
  }
  .sidebar-list {
    flex: 1;
    overflow-y: auto;
  }
  .sidebar-user {
    flex-shrink: 0;
    margin-top: 0;
  }

  /* === Step progress: mobile overrides === */
  .step-progress-wrap { margin-bottom: 12px; }
  .step-dot { width: 28px; height: 28px; font-size: 12px; }
  .step-line { min-width: 20px; }
  .step-label-row { font-size: 11px; margin-bottom: 6px; }
  .btn-prev-step { min-height: 44px; font-size: 14px; }

  /* --- Health panel: single column, key info first --- */
  .health-panel {
    padding: 12px;
  }
  .health-header {
    gap: 8px;
  }
  .health-score {
    font-size: 28px;
  }
  .health-label {
    font-size: 13px;
  }
  .health-body {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .health-section h5 {
    font-size: 12px;
  }
  .health-item {
    font-size: 12px;
  }
  .health-close {
    min-height: 44px;
    min-width: 44px;
  }

  /* --- Template cards --- */
  .template-cards {
    padding: 8px 12px;
  }
  .template-card {
    padding: 12px;
  }
  .template-card-name { font-size: 13px; }
  .template-import-btn {
    min-height: 44px;
  }
}

/* ============================================================
   设计系统 v2.0 · 共享组件类库（命名空间 .u-，按需复用，不覆盖现有类）
   所有视觉均由 :root 令牌驱动；应用升级时复用这些类即可保持一致。
   ============================================================ */
.u-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-6);
  box-shadow: var(--shadow-sm);
  transition: all var(--ease);
}
.u-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }

.u-stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  transition: all var(--ease);
}
.u-stat-card:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.u-stat-card .k { font-size: 13px; color: var(--text-2); }
.u-stat-card .v { font-size: 30px; font-weight: 700; margin: var(--s-2) 0; letter-spacing: -.02em; }
.u-stat-card .delta { font-size: 12px; }
.u-stat-card .delta.up { color: var(--success); }
.u-stat-card .delta.down { color: var(--danger); }
.u-stat-card .bar { height: 4px; border-radius: var(--r-pill); background: var(--accent-weak); margin-top: var(--s-3); overflow: hidden; }
.u-stat-card .bar > i { display: block; height: 100%; background: var(--accent); border-radius: var(--r-pill); }

.u-table-wrap { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.u-table-wrap table { width: 100%; border-collapse: collapse; font-size: 14px; }
.u-table-wrap thead th {
  text-align: left; font-weight: 600; font-size: 12px; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .05em; padding: var(--s-4); border-bottom: 1px solid var(--border);
}
.u-table-wrap tbody td { padding: var(--s-4); border-bottom: 1px solid var(--border); color: var(--text-1); }
.u-table-wrap tbody tr:last-child td { border-bottom: none; }
.u-table-wrap tbody tr { transition: background var(--ease); }
.u-table-wrap tbody tr:hover { background: var(--bg-surface-2); }

.u-badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: var(--r-pill); border: 1px solid transparent;
}
.u-badge-ok   { background: var(--success-weak); color: var(--success); }
.u-badge-warn { background: var(--warning-weak); color: var(--warning); }
.u-badge-err  { background: var(--danger-weak);  color: var(--danger); }
.u-badge-info { background: var(--info-weak);    color: var(--info); }
.u-badge-neutral { background: var(--bg-surface-2); color: var(--text-2); border-color: var(--border); }

.u-toast {
  display: inline-flex; align-items: center; gap: var(--s-2); padding: 12px 16px;
  border-radius: var(--r-md); font-size: 14px; border: 1px solid var(--border);
  background: var(--bg-surface); box-shadow: var(--shadow-md);
}
.u-toast .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.u-toast.ok  { border-color: rgba(62,207,142,.4); }   .u-toast.ok .dot  { background: var(--success); }
.u-toast.err { border-color: rgba(247,109,125,.4); }  .u-toast.err .dot { background: var(--danger); }

.u-switch { position: relative; width: 46px; height: 26px; display: inline-block; }
.u-switch input { opacity: 0; width: 0; height: 0; }
.u-switch .track {
  position: absolute; inset: 0; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--r-pill); transition: var(--ease);
}
.u-switch .track::before {
  content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px;
  background: var(--text-3); border-radius: 50%; transition: var(--ease);
}
.u-switch input:checked + .track { background: var(--accent); border-color: var(--accent); }
.u-switch input:checked + .track::before { transform: translateX(20px); background: #fff; }
.u-switch input:focus-visible + .track { box-shadow: var(--ring); }

.u-empty { text-align: center; padding: var(--s-10) var(--s-4); color: var(--text-3); }
.u-empty .e-ico { font-size: 36px; opacity: .5; margin-bottom: var(--s-3); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
