/* ==========================================================
   设计 Token：颜色、圆角、阴影都在这里改，深色模式只重写颜色
   ========================================================== */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --surface-hover: #f8f9fb;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --text: #101828;
  --text-2: #344054;
  --muted: #667085;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --accent-text: #ffffff;
  --success: #079455;
  --success-soft: #ecfdf3;
  --warning: #b54708;
  --warning-soft: #fffaeb;
  --danger: #d92d20;
  --danger-soft: #fef3f2;
  --info: #175cd3;
  --info-soft: #eff8ff;
  --code-bg: #0f1420;
  --code-text: #d0d5dd;
  --overlay: rgba(16, 24, 40, .45);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-md: 0 4px 12px -2px rgba(16, 24, 40, .08), 0 2px 4px -2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 20px 40px -8px rgba(16, 24, 40, .18);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --sidebar-width: 236px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0e13;
    --surface: #14171e;
    --surface-2: #1b1f28;
    --surface-hover: #191d25;
    --border: #262b36;
    --border-strong: #353b48;
    --text: #eef0f3;
    --text-2: #c9ced8;
    --muted: #8b93a3;
    --accent: #818cf8;
    --accent-hover: #a5b4fc;
    --accent-soft: rgba(129, 140, 248, .14);
    --accent-text: #0c0e13;
    --success: #47cd89;
    --success-soft: rgba(71, 205, 137, .12);
    --warning: #fdb022;
    --warning-soft: rgba(253, 176, 34, .12);
    --danger: #f97066;
    --danger-soft: rgba(249, 112, 102, .12);
    --info: #53b1fd;
    --info-soft: rgba(83, 177, 253, .12);
    --code-bg: #090b10;
    --overlay: rgba(0, 0, 0, .6);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, .4);
    --shadow-lg: 0 20px 40px -8px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c0e13;
  --surface: #14171e;
  --surface-2: #1b1f28;
  --surface-hover: #191d25;
  --border: #262b36;
  --border-strong: #353b48;
  --text: #eef0f3;
  --text-2: #c9ced8;
  --muted: #8b93a3;
  --accent: #818cf8;
  --accent-hover: #a5b4fc;
  --accent-soft: rgba(129, 140, 248, .14);
  --accent-text: #0c0e13;
  --success: #47cd89;
  --success-soft: rgba(71, 205, 137, .12);
  --warning: #fdb022;
  --warning-soft: rgba(253, 176, 34, .12);
  --danger: #f97066;
  --danger-soft: rgba(249, 112, 102, .12);
  --info: #53b1fd;
  --info-soft: rgba(83, 177, 253, .12);
  --code-bg: #090b10;
  --overlay: rgba(0, 0, 0, .6);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, .4);
  --shadow-lg: 0 20px 40px -8px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

/* ========================= 基础 ========================= */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
img, video { display: block; max-width: 100%; }
svg.icon { flex-shrink: 0; display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono, code, pre, kbd { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ========================= 整体框架：侧边栏 + 主区域 ========================= */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width); flex-shrink: 0;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 14px; color: var(--text); font-weight: 700; font-size: 15px;
}
.sidebar-brand:hover { color: var(--text); }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, #6366f1, #8b5cf6 55%, #ec4899); color: #fff;
  box-shadow: 0 4px 10px -2px rgba(99, 102, 241, .45);
}
.sidebar-nav { flex: 1; overflow-y: auto; padding: 4px 10px 12px; }
.nav-group-title {
  font-size: 11px; font-weight: 600; letter-spacing: .04em; color: var(--muted);
  padding: 14px 10px 6px;
}
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 13.5px; font-weight: 500;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--accent-soft); color: var(--accent); }
.nav-link .icon { color: var(--muted); }
.nav-link.active .icon, .nav-link:hover .icon { color: inherit; }
.sidebar-footer {
  border-top: 1px solid var(--border); padding: 10px; display: flex; gap: 6px;
}
.sidebar-footer .btn { flex: 1; justify-content: center; }

.shell-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: none; align-items: center; gap: 10px;
  height: 54px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
}
.topbar .sidebar-brand { padding: 0; }
.content { width: 100%; max-width: 1180px; margin: 0 auto; padding: 28px 32px 48px; }
.content.narrow { max-width: 860px; }
.sidebar-backdrop { display: none; }

@media (max-width: 900px) {
  .topbar { display: flex; }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 50; height: 100%;
    transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 40; background: var(--overlay); }
  .content { padding: 20px 16px 40px; }
}

/* ========================= 页面头部 ========================= */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-head h1 { font-size: 22px; line-height: 1.3; margin: 0; letter-spacing: -.01em; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 30px 0 12px; }
.section-head h2 { font-size: 15px; margin: 0; }

/* ========================= 按钮 ========================= */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid transparent; font: inherit; font-size: 13.5px; font-weight: 500;
  cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s;
  background: var(--accent); color: var(--accent-text);
}
.btn:hover { background: var(--accent-hover); color: var(--accent-text); }
.btn.secondary { background: var(--surface); color: var(--text-2); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn.secondary:hover { background: var(--surface-hover); color: var(--text); }
.btn.ghost { background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger-ghost { background: transparent; color: var(--danger); }
.btn.danger-ghost:hover { background: var(--danger-soft); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.lg { height: 42px; padding: 0 18px; font-size: 14.5px; }
.btn.block { width: 100%; justify-content: center; }
.btn.icon-only { width: 36px; padding: 0; justify-content: center; }
.btn.icon-only.sm { width: 30px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ========================= 卡片 ========================= */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.card-pad { padding: 18px 20px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
}
.card-head h2, .card-head h3 { font-size: 14px; margin: 0; }
.card-body { padding: 18px 20px; }

/* ========================= 表单 ========================= */
.form-stack { display: flex; flex-direction: column; gap: 16px; }
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row > label, .form-label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.form-hint { font-size: 12px; color: var(--muted); }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.input, .select, .textarea {
  width: 100%; min-width: 0; height: 38px; padding: 0 12px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font: inherit; font-size: 13.5px; transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 112px; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.select {
  appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: .8; }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; }

/* 分段选择（比例、服务商等） */
.segmented { display: flex; flex-wrap: wrap; gap: 6px; }
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface);
  font-size: 13px; color: var(--text-2); transition: all .15s;
}
.segmented label:hover span { border-color: var(--accent); }
.segmented input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.ratio-box { display: inline-block; border: 1.6px solid currentColor; border-radius: 2px; opacity: .8; }

/* 拖拽上传区 */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 22px 16px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius);
  background: var(--surface-2); color: var(--muted); text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.dragging { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.dropzone strong { color: var(--text-2); font-weight: 600; }
.dropzone input { display: none; }

/* 选中的参考图 */
.picked-image {
  display: flex; align-items: center; gap: 10px; padding: 8px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2);
}
.picked-image img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; background: var(--border); }
.picked-image .picked-text { flex: 1; min-width: 0; font-size: 13px; }
.picked-image .picked-text small { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ========================= 徽章 / 提示 ========================= */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge.succeeded, .badge.ok { background: var(--success-soft); color: var(--success); }
.badge.failed, .badge.error { background: var(--danger-soft); color: var(--danger); }
.badge.processing, .badge.generating { background: var(--info-soft); color: var(--info); }
.badge.processing::before, .badge.generating::before { animation: pulse 1.2s ease-in-out infinite; }
.badge.soon { background: var(--surface-2); color: var(--muted); }
@keyframes pulse { 50% { opacity: .3; } }

.alert {
  display: none; align-items: flex-start; gap: 10px;
  padding: 11px 14px; border-radius: var(--radius); font-size: 13px; margin-bottom: 16px;
  border: 1px solid transparent; word-break: break-word;
}
.alert.show { display: flex; }
.alert.ok { background: var(--success-soft); color: var(--success); }
.alert.error { background: var(--danger-soft); color: var(--danger); }
.alert.info { background: var(--info-soft); color: var(--info); }

/* 右上角轻提示 */
.toast-stack { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 10px; max-width: 380px;
  padding: 11px 14px; border-radius: var(--radius); background: var(--surface); color: var(--text);
  border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-size: 13px;
  animation: toast-in .18s ease-out;
}
.toast .icon { color: var(--success); }
.toast.error .icon { color: var(--danger); }
.toast.info .icon { color: var(--info); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

/* 加载动画 */
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--border-strong); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 空状态 */
.empty {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 48px 20px; color: var(--muted); text-align: center;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-lg);
}
.empty .icon { color: var(--border-strong); }

/* ========================= 首页 ========================= */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 8px; }
.stat { padding: 16px 18px; }
.stat-label { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat-value { font-size: 26px; font-weight: 700; margin-top: 6px; letter-spacing: -.02em; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.search-box { position: relative; width: 280px; max-width: 100%; }
.search-box .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-box .input { padding-left: 34px; }

.tool-group { margin-top: 26px; }
.tool-group h2 { font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 0 12px; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.tool-card {
  display: flex; gap: 14px; align-items: flex-start; padding: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  color: var(--text); box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s, transform .15s;
}
a.tool-card:hover { border-color: var(--accent); box-shadow: var(--shadow-md); transform: translateY(-1px); color: var(--text); }
.tool-icon {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent);
}
.tool-card.soon { box-shadow: none; background: transparent; border-style: dashed; }
.tool-card.soon .tool-icon { background: var(--surface-2); color: var(--muted); }
.tool-card.soon .tool-name { color: var(--muted); }
.tool-name { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tool-desc { color: var(--muted); font-size: 12.5px; margin-top: 3px; line-height: 1.55; }

.service-list { overflow: hidden; }
.service-row {
  display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-top: 1px solid var(--border);
}
.service-row:first-child { border-top: none; }
.service-row .service-name { font-weight: 600; font-size: 13.5px; }
.service-row .service-info { flex: 1; min-width: 0; }
.service-row .service-result { font-size: 12px; color: var(--muted); margin-top: 2px; word-break: break-all; }
.service-row .service-result.ok { color: var(--success); }
.service-row .service-result.error { color: var(--danger); }

/* ========================= 工作区：左表单 + 右结果 ========================= */
.workspace { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 24px; align-items: start; }
.workspace .panel { position: sticky; top: 24px; }
@media (max-width: 1100px) {
  .workspace { grid-template-columns: 1fr; }
  .workspace .panel { position: static; }
}

/* 作品墙 */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.media-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow-sm);
}
.media-thumb {
  position: relative; aspect-ratio: 1 / 1; background: var(--surface-2);
  display: grid; place-items: center; color: var(--muted); font-size: 12px; overflow: hidden;
}
.media-thumb img, .media-thumb video { width: 100%; height: 100%; object-fit: cover; }
.media-thumb.clickable { cursor: zoom-in; }
/* 图片文件失效（被删、链接过期）时的占位 */
.img-broken { position: relative; cursor: default; }
.img-broken img { visibility: hidden; }
.img-broken::after {
  content: "图片已失效"; position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--muted); font-size: 12px; background: var(--surface-2);
}
.media-thumb.clickable img { transition: transform .25s ease; }
.media-thumb.clickable:hover img { transform: scale(1.03); }
.media-thumb .thumb-badge { position: absolute; top: 8px; left: 8px; }
.media-thumb .thumb-state { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px; text-align: center; }
.media-meta { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.media-title { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 12.5px; }
.media-title b { font-weight: 600; }
.media-sub { font-size: 12px; color: var(--muted); }
.media-prompt {
  font-size: 12.5px; color: var(--text-2); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.media-error { font-size: 12px; color: var(--danger); word-break: break-word; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.media-actions { display: flex; gap: 4px; margin-top: 6px; }
.media-actions .btn { flex: 1; justify-content: center; }
.media-actions .btn.icon-only { flex: 0 0 30px; }

/* ========================= 弹窗 ========================= */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 80; background: var(--overlay);
  display: grid; place-items: center; padding: 20px; animation: fade-in .15s ease-out;
}
@keyframes fade-in { from { opacity: 0; } }
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 980px; max-height: calc(100vh - 40px);
  display: flex; flex-direction: column; overflow: hidden;
}
.modal.sm { max-width: 640px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 14px; }
.modal-body { overflow: auto; }
.viewer { display: grid; grid-template-columns: minmax(0, 1fr) 300px; min-height: 0; }
.viewer-media { background: #0b0d12; display: grid; place-items: center; min-height: 320px; max-height: calc(100vh - 110px); }
.viewer-media img, .viewer-media video { max-width: 100%; max-height: calc(100vh - 110px); object-fit: contain; }
.viewer-side { padding: 16px; display: flex; flex-direction: column; gap: 14px; border-left: 1px solid var(--border); overflow-y: auto; }
.viewer-side .kv { display: grid; grid-template-columns: 70px 1fr; gap: 6px 10px; font-size: 12.5px; }
.viewer-side .kv dt { color: var(--muted); }
.viewer-side .kv dd { margin: 0; word-break: break-all; }
.viewer-prompt { font-size: 13px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.viewer-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 760px) {
  .viewer { grid-template-columns: 1fr; }
  .viewer-side { border-left: none; border-top: 1px solid var(--border); }
}
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; padding: 16px; }
.picker-item { border: 2px solid transparent; border-radius: var(--radius); overflow: hidden; cursor: pointer; background: var(--surface-2); padding: 0; position: relative; }
.picker-item:hover { border-color: var(--accent); }
.picker-item img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.picker-item span { position: absolute; left: 6px; bottom: 6px; font-size: 11px; background: rgba(0,0,0,.6); color: #fff; padding: 0 6px; border-radius: 4px; }

/* ========================= 配置页 ========================= */
.settings-group { margin-bottom: 18px; }
.setting-row { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--border); }
.setting-row:first-of-type { border-top: none; }
.setting-key { font-size: 12.5px; color: var(--text-2); word-break: break-all; }
.setting-key small { display: block; color: var(--muted); font-family: inherit; margin-top: 1px; }
.save-bar {
  position: sticky; bottom: 0; z-index: 20; margin-top: 20px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
}
.save-bar .form-hint { flex: 1; min-width: 200px; }
@media (max-width: 760px) {
  .setting-row { grid-template-columns: 1fr; gap: 6px; }
}

/* ========================= 日志页 ========================= */
.terminal {
  background: var(--code-bg); color: var(--code-text); border-radius: var(--radius-lg);
  height: calc(100vh - 230px); min-height: 360px; overflow: auto; padding: 14px 16px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; line-height: 1.65;
  border: 1px solid var(--border);
}
.terminal .line { white-space: pre-wrap; word-break: break-all; }
.terminal .line.error { color: #fda29b; }
.terminal .line.warning { color: #fec84b; }
.terminal .line.request { color: #98a2b3; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; user-select: none; }
.toggle input { width: 16px; height: 16px; accent-color: var(--accent); }

/* ========================= API 文档 ========================= */
.doc-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 22px; }
.doc-section { margin-bottom: 22px; }
.doc-section .card-body > p { color: var(--text-2); line-height: 1.7; margin: 0 0 12px; }
.endpoint-list { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 14px; }
.endpoint { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 10px; padding: 10px 14px; border-top: 1px solid var(--border); align-items: baseline; }
.endpoint:first-child { border-top: none; }
.endpoint code { background: none; padding: 0; font-size: 12.5px; color: var(--text); word-break: break-all; }
.endpoint .endpoint-desc { grid-column: 2; font-size: 12.5px; color: var(--muted); }
.method { font-family: ui-monospace, Menlo, monospace; font-size: 11px; font-weight: 700; padding: 2px 0; border-radius: 4px; text-align: center; }
.method.get { background: var(--success-soft); color: var(--success); }
.method.post { background: var(--info-soft); color: var(--info); }
.method.delete { background: var(--danger-soft); color: var(--danger); }
.param-table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-bottom: 14px; }
.param-table th, .param-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.param-table th { color: var(--muted); font-weight: 500; }
code { background: var(--surface-2); color: var(--text); padding: 1px 6px; border-radius: 4px; font-size: 12px; }
.code-block { position: relative; }
.code-block pre {
  margin: 0; background: var(--code-bg); color: var(--code-text); padding: 14px 16px; border-radius: var(--radius);
  overflow-x: auto; font-size: 12.5px; line-height: 1.6;
}
.code-block .btn { position: absolute; top: 8px; right: 8px; background: rgba(255,255,255,.08); color: #d0d5dd; border-color: transparent; }
.code-block .btn:hover { background: rgba(255,255,255,.16); color: #fff; }
.table-wrap { overflow-x: auto; }

/* ========================= 登录页 ========================= */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background:
  radial-gradient(900px 500px at 10% -10%, var(--accent-soft), transparent 60%),
  radial-gradient(700px 400px at 110% 110%, var(--accent-soft), transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 380px; padding: 30px 28px; }
.auth-card .brand-mark { width: 42px; height: 42px; border-radius: 12px; margin-bottom: 18px; }
.auth-card h1 { margin: 0; font-size: 20px; }
.auth-card p { margin: 4px 0 22px; color: var(--muted); }

@media (max-width: 760px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid-2 { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 20px; }
  .search-box { width: 100%; }
  .toast-stack { left: 16px; right: 16px; }
}
