/* ============================================================
 * AI 场景工具页引擎样式 V1.0（XT-AIGC-UPGRADE-20260910 · 任务 #876-878）
 * 适用：/acc/ai-finance.html、/dongtu/ai-tutor.html、/repair/ai-diagnose.html
 * CSP 合规：外链样式表（style-src 'self'），页面零内联样式
 * ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --at-accent: #2563eb;
  --at-ink: #0f172a;
  --at-sub: #475569;
  --at-line: #e2e8f0;
  --at-bg: #f6f8fb;
  --at-card: #ffffff;
  --at-ok: #16a34a;
}

html, body { height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--at-bg);
  color: var(--at-ink);
  line-height: 1.65;
}

/* ---------- 顶栏 ---------- */
.at-topbar {
  background: linear-gradient(120deg, var(--at-accent), #7c3aed);
  color: #fff;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.at-topbar .at-logo {
  width: 38px; height: 38px; border-radius: 10px;
  background: rgba(255, 255, 255, .18);
  display: flex; align-items: center; justify-content: center;
  font-size: 21px;
}
.at-topbar .at-tt { font-size: 17px; font-weight: 700; letter-spacing: .5px; }
.at-topbar .at-ss { font-size: 12px; opacity: .85; margin-top: 1px; }
.at-topbar .at-back {
  margin-left: auto; color: #fff; text-decoration: none;
  font-size: 13px; padding: 7px 14px; border-radius: 999px;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .25);
  white-space: nowrap;
}
.at-topbar .at-back:hover { background: rgba(255, 255, 255, .3); }

/* ---------- 布局 ---------- */
.at-wrap { max-width: 880px; margin: 0 auto; padding: 26px 16px 60px; }

.at-hero { text-align: center; margin-bottom: 22px; }
.at-hero h1 { font-size: 24px; font-weight: 800; }
.at-hero h1 em { font-style: normal; color: var(--at-accent); }
.at-hero p { color: var(--at-sub); font-size: 13.5px; margin-top: 6px; }
.at-hero .at-chips { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.at-chip {
  font-size: 12px; color: var(--at-accent);
  background: #fff; border: 1px solid var(--at-line);
  padding: 4px 12px; border-radius: 999px;
}

/* ---------- 表单卡片 ---------- */
.at-card {
  background: var(--at-card);
  border: 1px solid var(--at-line);
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, .04);
}
.at-card h2 {
  font-size: 15px; font-weight: 700; margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.at-card h2 .at-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--at-accent);
}

.at-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.at-field { display: flex; flex-direction: column; gap: 6px; }
.at-field.at-wide { grid-column: 1 / -1; }
.at-field label { font-size: 13px; font-weight: 600; color: var(--at-ink); }
.at-field label .at-req { color: #dc2626; margin-left: 2px; }
.at-field select,
.at-field input,
.at-field textarea {
  font: inherit; font-size: 14px;
  border: 1px solid var(--at-line); border-radius: 10px;
  padding: 10px 12px; background: #fff; color: var(--at-ink);
  outline: none; width: 100%;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.at-field textarea { min-height: 96px; resize: vertical; }
.at-field select:focus,
.at-field input:focus,
.at-field textarea:focus {
  border-color: var(--at-accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.at-examples { margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.at-example {
  font-size: 12px; color: var(--at-sub);
  border: 1px dashed var(--at-line); background: #fafbfd;
  padding: 5px 12px; border-radius: 999px;
  cursor: pointer;
}
.at-example:hover { color: var(--at-accent); border-color: var(--at-accent); }

.at-actions { margin-top: 18px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.at-btn {
  font: inherit; font-size: 15px; font-weight: 700;
  color: #fff; background: linear-gradient(120deg, var(--at-accent), #7c3aed);
  border: none; border-radius: 12px;
  padding: 12px 34px; cursor: pointer;
  box-shadow: 0 6px 18px rgba(37, 99, 235, .28);
  transition: transform .15s ease, box-shadow .15s ease;
}
.at-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(37, 99, 235, .36); }
.at-btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.at-hint { font-size: 12px; color: var(--at-sub); }

/* ---------- 结果区 ---------- */
.at-result-wrap { margin-top: 20px; display: none; }
.at-result-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px; flex-wrap: wrap;
}
.at-result-head h2 { font-size: 15px; font-weight: 700; }
.at-badge {
  font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px;
}
.at-badge.at-running { color: #b45309; background: #fef3c7; }
.at-badge.at-done { color: var(--at-ok); background: #dcfce7; }
.at-badge.at-err { color: #dc2626; background: #fee2e2; }
.at-mini {
  font: inherit; font-size: 12.5px; cursor: pointer;
  border: 1px solid var(--at-line); background: #fff;
  color: var(--at-sub); border-radius: 8px; padding: 5px 12px;
}
.at-mini:hover { color: var(--at-accent); border-color: var(--at-accent); }
.at-result {
  background: var(--at-card); border: 1px solid var(--at-line);
  border-radius: 16px; padding: 20px 22px;
  min-height: 120px;
  font-size: 14.5px;
  white-space: normal;
  word-break: break-word;
}
.at-result.at-busy { opacity: .75; }
.at-caret {
  display: inline-block; width: 8px; height: 16px;
  background: var(--at-accent); vertical-align: -2px;
  margin-left: 2px;
  animation: atBlink 1s steps(2) infinite;
}
@keyframes atBlink { 0%, 50% { opacity: 1; } 51%, 100% { opacity: 0; } }

/* 报告内 Markdown 元素（外链类名，替代内联样式） */
.at-result h3 { font-size: 15px; margin: 14px 0 6px; }
.at-result b { color: var(--at-accent); }
.at-result pre {
  margin: 8px 0; padding: 10px 12px;
  background: #0f172a; color: #e2e8f0;
  border-radius: 8px; overflow-x: auto;
  font-size: 12.5px; line-height: 1.6; white-space: pre-wrap;
}
.at-result code {
  background: rgba(37, 99, 235, .08);
  padding: 1px 5px; border-radius: 4px; font-size: 12.5px;
}
.at-result table { border-collapse: collapse; margin: 10px 0; width: 100%; }
.at-result th, .at-result td {
  border: 1px solid var(--at-line); padding: 6px 10px;
  font-size: 13px; text-align: left;
}
.at-result th { background: #f1f5f9; }
.at-result .at-hr { border-top: 1px solid var(--at-line); margin: 10px 0; height: 0; }
.at-result .at-tag-hi { color: #dc2626; font-weight: 700; }
.at-result .at-tag-mid { color: #b45309; font-weight: 700; }
.at-result .at-tag-low { color: var(--at-ok); font-weight: 700; }

/* ---------- 登录门禁遮罩 ---------- */
.at-gate {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(15, 23, 42, .55);
  display: none; align-items: center; justify-content: center;
}
.at-gate.at-show { display: flex; }
.at-gate-box {
  background: #fff; border-radius: 16px; padding: 30px 34px;
  text-align: center; max-width: 340px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, .3);
}
.at-gate-box .at-gi { font-size: 40px; }
.at-gate-box h3 { font-size: 17px; margin: 10px 0 6px; }
.at-gate-box p { font-size: 13px; color: var(--at-sub); margin-bottom: 18px; }
.at-gate-box .at-btn { width: 100%; padding: 11px 0; }

/* ---------- 页脚 ---------- */
.at-foot {
  text-align: center; color: #94a3b8; font-size: 12px;
  margin-top: 28px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .at-grid { grid-template-columns: 1fr; }
  .at-topbar .at-ss { display: none; }
  .at-hero h1 { font-size: 20px; }
  .at-result { padding: 14px; }
}
