/* ============================================================================
   土豆兄弟 · 云存档直写 —— 设计系统
   卡片 16px 圆角 / 1px 半透明描边 / 13px 正文 / 明暗双主题。
   ========================================================================== */

:root {
  --gh-radius-card: 16px;
  --gh-radius-ctl: 10px;
  --gh-gap: 14px;

  --gh-surface: #ffffff;
  --gh-surface-soft: rgba(148, 163, 184, 0.07);
  --gh-surface-strong: rgba(148, 163, 184, 0.12);
  --gh-border: rgba(148, 163, 184, 0.18);
  --gh-border-strong: rgba(148, 163, 184, 0.32);

  --gh-ink: #1f2937;
  --gh-ink-2: #4b5563;
  --gh-ink-3: #8a94a6;

  --gh-brand: #18a058;
  --gh-brand-soft: rgba(24, 160, 88, 0.08);
  --gh-brand-line: rgba(24, 160, 88, 0.35);
  --gh-mono: #33415c;

  --danger: #d03050;
  --warning: #c47f17;
  --info: #2080f0;

  --page-bg: #f5f6f8;
  --gh-shadow: 0 10px 26px rgba(15, 23, 42, 0.06);
  color-scheme: light;
}

html[data-theme="dark"] {
  --gh-surface: #1e1e24;
  --gh-surface-soft: rgba(148, 163, 184, 0.12);
  --gh-surface-strong: rgba(148, 163, 184, 0.18);
  --gh-border: rgba(148, 163, 184, 0.16);
  --gh-border-strong: rgba(148, 163, 184, 0.3);

  --gh-ink: rgba(255, 255, 255, 0.88);
  --gh-ink-2: rgba(255, 255, 255, 0.64);
  --gh-ink-3: rgba(255, 255, 255, 0.46);

  --gh-brand: #36ad6a;
  --gh-brand-soft: rgba(24, 160, 88, 0.16);
  --gh-brand-line: rgba(24, 160, 88, 0.5);
  --gh-mono: #d6e2f2;

  --danger: #e88080;
  --warning: #e0a44a;
  --info: #6aa8f0;

  --page-bg: #141418;
  --gh-shadow: 0 10px 26px rgba(0, 0, 0, 0.32);
  color-scheme: dark;
}

* { box-sizing: border-box; }

/* hidden 属性优先于组件的 display（否则 .boot-box{display:flex} 会盖掉 [hidden]） */
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--page-bg);
  color: var(--gh-ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 13px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }

/* ---------------------------------------------------------------- 骨架 */
.gh-root {
  display: flex;
  flex-direction: column;
  gap: var(--gh-gap);
  color: var(--gh-ink);
  font-size: 13px;
  line-height: 1.6;
}

.gh-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  border-radius: var(--gh-radius-card);
  border: 1px solid var(--gh-border);
  background: var(--gh-surface);
  padding: 12px 16px;
}

.gh-hero-main { min-width: 0; flex: 1; }
.gh-hero-title { margin: 0; font-size: 18px; font-weight: 600; }
.gh-hero-note { margin: 3px 0 0; font-size: 12px; line-height: 1.7; color: var(--gh-ink-3); }

.gh-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: var(--gh-gap);
  align-items: start;
}

.gh-col { display: flex; flex-direction: column; gap: var(--gh-gap); min-width: 0; }

/* ---------------------------------------------------------------- 卡片 */
.gh-card {
  border-radius: var(--gh-radius-card);
  border: 1px solid var(--gh-border);
  background: var(--gh-surface);
  padding: 16px 18px;
}

.gh-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.gh-card-title { margin: 0; font-size: 15px; font-weight: 600; }
.gh-card-extra { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.gh-card-hint { margin: -8px 0 12px; font-size: 12px; line-height: 1.7; color: var(--gh-ink-3); }

/* ---------------------------------------------------------------- 表单 */
.gh-field { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.gh-field:last-child { margin-bottom: 0; }
.gh-field-label { flex: 0 0 76px; font-size: 13px; color: var(--gh-ink-2); }
.gh-field-body { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.gh-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 0;
}
.gh-section:first-of-type { padding-top: 0; }
.gh-section + .gh-section { border-top: 1px solid var(--gh-border); }
.gh-section-title { margin: 0; font-size: 13px; font-weight: 600; }

.gh-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.gh-row-label { flex: 0 0 76px; font-size: 13px; color: var(--gh-ink-2); }

.gh-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px 12px; }

.gh-res-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px 14px;
}

.gh-res-item {
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 10px;
  background: var(--gh-surface-soft);
  padding: 6px 10px;
}

.gh-res-label { flex: 0 0 auto; min-width: 76px; font-size: 12px; color: var(--gh-ink-3); }

.gh-op-list { display: flex; flex-direction: column; gap: 10px; }

.gh-op-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-radius: 10px;
  background: var(--gh-surface-soft);
  padding: 8px 12px;
}

.gh-op-main { min-width: 0; flex: 1; }
.gh-op-label { margin: 0; font-size: 13px; font-weight: 500; }
.gh-op-desc { margin: 0; font-size: 11px; line-height: 1.6; color: var(--gh-ink-3); }

.gh-submit {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid var(--gh-border);
  margin-top: 12px;
  padding-top: 12px;
}

/* ---------------------------------------------------------------- 键值 / 日志 */
.gh-kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 14px; }
.gh-kv-item { min-width: 0; }
.gh-kv-label { margin: 0; font-size: 11px; color: var(--gh-ink-3); }
.gh-kv-value { margin: 1px 0 0; font-size: 13px; font-weight: 500; word-break: break-all; }

.gh-log {
  max-height: 240px;
  overflow-y: auto;
  border-radius: var(--gh-radius-ctl);
  border: 1px solid var(--gh-border);
  background: var(--gh-surface-soft);
  padding: 10px 12px;
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.7;
  color: var(--gh-mono);
}

.gh-log-line { white-space: pre-wrap; word-break: break-all; }
.gh-log-line.is-error { color: var(--danger); }
.gh-log-line.is-warn { color: var(--warning); }
.gh-log-line.is-success { color: var(--gh-brand); }

/* ---------------------------------------------------------------- 提示 / 空态 */
.gh-note { margin: 0; font-size: 12px; line-height: 1.8; color: var(--gh-ink-3); }
.gh-note-strong { color: var(--gh-ink-2); }
.gh-note.is-error { color: var(--danger); }
.gh-empty {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 26px 0; color: var(--gh-ink-3); font-size: 12px;
}
.gh-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.gh-divider { height: 1px; background: var(--gh-border); margin: 12px 0; border: 0; }
.gh-mono { font-family: ui-monospace, Consolas, monospace; }

/* ---------------------------------------------------------------- 套餐卡片 */
.gh-pkg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.gh-pkg {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  border: 1px solid var(--gh-border);
  background: var(--gh-surface);
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.gh-pkg:hover { border-color: rgba(100, 108, 255, 0.45); box-shadow: var(--gh-shadow); }
.gh-pkg.is-on { border-color: var(--gh-brand-line); background: var(--gh-brand-soft); }

.gh-pkg-name {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gh-pkg-desc { margin: 2px 0 0; font-size: 11px; color: var(--gh-ink-3); line-height: 1.7; }
.gh-pkg-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.gh-pkg-actions { display: flex; gap: 4px; margin-top: auto; padding-top: 8px; }

.gh-pkg-add {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; border-style: dashed; min-height: 112px; color: var(--gh-ink-3);
  background: transparent;
}
.gh-pkg-add:hover { color: var(--gh-brand); border-color: var(--gh-brand-line); }

/* ---------------------------------------------------------------- 任务列表 */
.gh-task-scroll {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100vh - 300px);
  min-height: 180px;
  overflow-y: auto;
}

.gh-task-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  border-radius: 12px;
  border: 1px solid var(--gh-border);
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.gh-task-item:hover,
.gh-task-item.is-active { border-color: var(--gh-border-strong); box-shadow: var(--gh-shadow); }

.gh-task-top { display: flex; align-items: center; gap: 8px; }
.gh-task-title {
  margin: 0; font-size: 13px; font-weight: 500; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gh-task-meta { font-size: 11px; color: var(--gh-ink-3); }

/* ---------------------------------------------------------------- 控件：按钮 */
.ui-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--gh-radius-ctl);
  border: 1px solid var(--gh-border-strong);
  background: var(--gh-surface);
  color: var(--gh-ink);
  font-family: inherit;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.ui-btn:hover:not(:disabled) { border-color: var(--gh-brand-line); color: var(--gh-brand); }
.ui-btn:active:not(:disabled) { transform: translateY(1px); }
.ui-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.ui-btn:focus-visible { outline: 2px solid var(--gh-brand-line); outline-offset: 2px; }

.ui-btn.is-primary { background: var(--gh-brand); border-color: var(--gh-brand); color: #fff; }
.ui-btn.is-primary:hover:not(:disabled) { color: #fff; filter: brightness(1.06); }

.ui-btn.is-warning { color: var(--warning); border-color: rgba(240, 160, 32, 0.45); background: rgba(240, 160, 32, 0.08); }
.ui-btn.is-danger { color: var(--danger); border-color: rgba(208, 48, 80, 0.4); background: transparent; }
.ui-btn.is-ghost { background: transparent; border-color: transparent; color: var(--gh-ink-3); }
.ui-btn.is-ghost:hover:not(:disabled) { background: var(--gh-surface-soft); border-color: var(--gh-border); color: var(--gh-ink); }

.ui-btn.is-sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.ui-btn.is-xs { height: 24px; padding: 0 8px; font-size: 11px; border-radius: 7px; }
.ui-btn.is-block { width: 100%; }

/* ---------------------------------------------------------------- 控件：输入 */
.ui-input {
  height: 34px;
  padding: 0 11px;
  border-radius: var(--gh-radius-ctl);
  border: 1px solid var(--gh-border-strong);
  background: var(--gh-surface);
  color: var(--gh-ink);
  font-family: inherit;
  font-size: 13px;
  min-width: 0;
  flex: 1 1 200px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ui-input:focus { border-color: var(--gh-brand); box-shadow: 0 0 0 3px var(--gh-brand-soft); }
.ui-input::placeholder { color: var(--gh-ink-3); }
.ui-input.is-sm { flex: 0 0 130px; width: 130px; }

.ui-num { flex: 1 1 auto; width: 100%; text-align: right; font-variant-numeric: tabular-nums; }
.ui-num::-webkit-outer-spin-button,
.ui-num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ui-num { -moz-appearance: textfield; appearance: textfield; }

/* ---------------------------------------------------------------- 控件：开关 */
.ui-switch {
  position: relative;
  flex: 0 0 auto;
  width: 40px;
  height: 22px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--gh-border-strong);
  background: var(--gh-surface-strong);
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.ui-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.28);
  transition: transform 0.18s ease;
}

.ui-switch.is-on { background: var(--gh-brand); border-color: var(--gh-brand); }
.ui-switch.is-on::after { transform: translateX(18px); }

/* ---------------------------------------------------------------- 控件：标签 */
.ui-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.ui-tag.is-neutral { color: var(--gh-ink-3); background: var(--gh-surface-strong); border-color: var(--gh-border); }
.ui-tag.is-success { color: var(--gh-brand); background: var(--gh-brand-soft); border-color: var(--gh-brand-line); }
.ui-tag.is-warn { color: var(--warning); background: rgba(240, 160, 32, 0.1); border-color: rgba(240, 160, 32, 0.35); }
.ui-tag.is-error { color: var(--danger); background: rgba(208, 48, 80, 0.1); border-color: rgba(208, 48, 80, 0.3); }
.ui-tag.is-info { color: var(--info); background: rgba(32, 128, 240, 0.1); border-color: rgba(32, 128, 240, 0.3); }

/* ---------------------------------------------------------------- 控件：进度条 */
.ui-progress {
  height: 5px;
  border-radius: 999px;
  background: var(--gh-surface-strong);
  overflow: hidden;
}

.ui-progress > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--gh-brand);
  transition: width 0.25s ease;
}

.ui-progress.is-error > i { background: var(--danger); }
.ui-progress.is-warn > i { background: var(--warning); }

/* ---------------------------------------------------------------- 详情折叠块 */
.ui-details { border-radius: var(--gh-radius-ctl); border: 1px dashed var(--gh-border); padding: 8px 12px; }
.ui-details > summary { cursor: pointer; font-size: 12px; color: var(--gh-ink-3); }
.ui-details > summary:hover { color: var(--gh-brand); }

/* ---------------------------------------------------------------- 弹窗 */
.ui-mask {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}

.ui-modal {
  display: flex;
  flex-direction: column;
  width: min(680px, 96vw);
  max-height: 86vh;
  border-radius: var(--gh-radius-card);
  border: 1px solid var(--gh-border);
  background: var(--gh-surface);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
  overflow: hidden;
}

.ui-modal.is-narrow { width: min(560px, 96vw); }

.ui-modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--gh-border);
}

.ui-modal-title { margin: 0; font-size: 15px; font-weight: 600; }
.ui-modal-head .ui-btn { margin-left: auto; }
.ui-modal-body { padding: 16px 18px; overflow-y: auto; }
.ui-modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--gh-border);
  background: var(--gh-surface-soft);
}

/* ---------------------------------------------------------------- 吐司 */
.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(380px, 90vw);
}

.toast {
  border-radius: 10px;
  border: 1px solid var(--gh-border);
  background: var(--gh-surface);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
  padding: 9px 13px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--gh-ink);
  animation: toast-in 0.16s ease-out;
  word-break: break-word;
}

.toast.is-success { border-color: var(--gh-brand-line); }
.toast.is-error { border-color: rgba(208, 48, 80, 0.45); color: var(--danger); }
.toast.is-warning { border-color: rgba(240, 160, 32, 0.45); color: var(--warning); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------------------------------------------------------------- 响应式 */
@media (max-width: 1100px) {
  .gh-layout { grid-template-columns: minmax(0, 1fr); }
  .gh-task-scroll { max-height: 420px; }
}

@media (max-width: 760px) {
  .gh-row { align-items: stretch; }
  .gh-row-label { flex: none; }
  .gh-input, .ui-input { flex: 1 1 100%; }
  .ui-input.is-sm { flex: 1 1 100%; width: 100%; }
  .gh-res-grid { grid-template-columns: minmax(0, 1fr); }
  .gh-card { padding: 14px; }
  .toast-stack { left: 12px; right: 12px; max-width: none; }
}
