/* 通鼎折弯件标注试用 · 入口页样式
   设计变量与主站 saas-mvp/styles.css 保持一致，保证品牌观感统一。 */

:root {
  --bg: #edf8fc;
  --surface: #ffffff;
  --surface-soft: #f2fbff;
  --surface-strong: #dff1f7;
  --ink: #0b2134;
  --muted: #4e6677;
  --subtle: #7390a1;
  --border: #c4dee8;
  --border-strong: #91bdce;
  --primary: #006cff;
  --primary-hover: #0052cc;
  --primary-soft: #dff0ff;
  --cyan: #009f91;
  --cyan-soft: #d9f8f2;
  --amber: #b96700;
  --amber-soft: #fff0c9;
  --red: #c9384b;
  --red-soft: #ffe7eb;
  --green: #0f7a52;
  --green-soft: #dcf5e9;
  --ink-deep: #081d2d;
  --radius: 6px;
  --shadow: 0 18px 45px rgba(0, 51, 82, .16);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Noto Sans SC", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.6;
}
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p, dl, dd, dt, ol { margin: 0; }
a { color: var(--primary); }
:focus-visible { outline: 3px solid rgba(0, 108, 255, .24); outline-offset: 2px; }
svg { width: 16px; height: 16px; }

/* ---------------- 顶栏 ---------------- */

.topbar {
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  padding: 12px 28px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { align-items: center; display: flex; gap: 11px; text-decoration: none; }
.brand img { background: #fff; border-radius: 5px; height: 34px; width: 34px; }
.brand strong { color: var(--ink); display: block; font-size: 16px; font-weight: 700; }
.brand small { color: var(--subtle); display: block; font-size: 11px; }
.brand span { display: block; }
.topbar-right { align-items: center; display: flex; gap: 10px; }
.engine-tag {
  background: var(--primary-soft);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 11px;
}

.icon-button {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  cursor: pointer;
  display: inline-flex;
  height: 32px;
  justify-content: center;
  width: 32px;
}
.icon-button:hover { background: var(--surface-soft); }
.icon-button svg { width: 15px; height: 15px; }

/* ---------------- 访问码 ---------------- */

.gate {
  align-items: center;
  background: var(--ink-deep);
  display: flex;
  justify-content: center;
  min-height: calc(100vh - 60px);
  padding: 24px;
}
.gate-card {
  background: var(--surface);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
  max-width: 420px;
  padding: 34px 32px;
  width: 100%;
}
.gate-card h1 { font-size: 20px; }
.gate-card p { color: var(--muted); font-size: 13px; }
.gate-card label, .field { display: grid; gap: 7px; }
.gate-card label { font-size: 12px; font-weight: 600; }
.gate-card input {
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  height: 40px;
  padding: 0 11px;
}

/* ---------------- 主体 ---------------- */

main { margin: 0 auto; max-width: 1440px; padding: 30px 28px 10px; }

.intro { margin-bottom: 24px; max-width: 900px; }
.eyebrow {
  color: var(--cyan);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.intro h1 { font-size: 28px; line-height: 1.25; margin: 8px 0 10px; }
.intro-sub { color: var(--muted); font-size: 14px; }
.facts {
  border-top: 1px solid var(--border);
  display: grid;
  gap: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 20px;
}
.facts > div {
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}
.facts dt { color: var(--subtle); font-size: 11px; }
.facts dd { font-size: 13px; font-weight: 600; }

.layout {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(300px, 340px) minmax(420px, 1fr) minmax(260px, 320px);
}
@media (max-width: 1180px) {
  .layout { grid-template-columns: minmax(300px, 360px) minmax(0, 1fr); }
  .panel-history { grid-column: 1 / -1; }
}
@media (max-width: 820px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .panel-history { grid-column: auto; }
  .facts { grid-template-columns: minmax(0, 1fr); }
  main { padding: 20px 16px 10px; }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 51, 82, .06);
  padding: 18px 18px 20px;
}
.panel-head {
  align-items: center;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 11px;
}
.panel-head h2 { font-size: 15px; }
.panel-live { min-height: 520px; }

/* ---------------- 表单 ---------------- */

.job-form { display: grid; gap: 14px; }

.drop {
  align-items: center;
  background: var(--surface-soft);
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  cursor: pointer;
  display: grid;
  gap: 4px;
  justify-items: center;
  padding: 18px 14px;
  text-align: center;
  transition: background .15s, border-color .15s;
}
.drop:hover, .drop.is-over { background: var(--primary-soft); border-color: var(--primary); }
.drop.has-file { background: var(--green-soft); border-color: var(--green); border-style: solid; }
.drop-optional { padding: 13px 14px; }
.drop-icon { color: var(--primary); }
.drop-icon svg { height: 22px; width: 22px; }
.drop.has-file .drop-icon { color: var(--green); }
.drop-title { font-size: 13px; font-weight: 600; }
.drop-hint { color: var(--subtle); font-size: 11px; line-height: 1.45; }

.field span { color: var(--muted); font-size: 12px; font-weight: 600; }
.field input, .field textarea {
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 9px 11px;
  resize: vertical;
  width: 100%;
}

button.primary {
  align-items: center;
  background: var(--primary);
  border: 0;
  border-radius: var(--radius);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font-weight: 600;
  gap: 7px;
  justify-content: center;
  padding: 10px 16px;
}
button.primary:hover { background: var(--primary-hover); }
button.primary:disabled { background: var(--subtle); cursor: not-allowed; }
button.secondary {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  cursor: pointer;
  display: inline-flex;
  font-weight: 600;
  gap: 6px;
  padding: 7px 12px;
}
button.secondary:hover { background: var(--surface-soft); }
.submit { width: 100%; }
.form-note { color: var(--subtle); font-size: 11px; text-align: center; }
.form-error {
  background: var(--red-soft);
  border-left: 3px solid var(--red);
  color: var(--red);
  font-size: 12px;
  padding: 9px 11px;
}

/* ---------------- 状态 ---------------- */

.status-chip {
  background: var(--surface-strong);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 11px;
}
.status-chip[data-status="running"] { background: var(--primary-soft); color: var(--primary); }
.status-chip[data-status="queued"] { background: var(--amber-soft); color: var(--amber); }
.status-chip[data-status="waiting_input"] { background: var(--amber-soft); color: var(--amber); }
.status-chip[data-status="done"] { background: var(--green-soft); color: var(--green); }
.status-chip[data-status="error"] { background: var(--red-soft); color: var(--red); }

.quiet-empty {
  align-items: center;
  color: var(--subtle);
  display: flex;
  font-size: 12.5px;
  justify-content: center;
  min-height: 120px;
  text-align: center;
}

.live-head {
  align-items: flex-start;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.live-head strong { display: block; font-size: 14px; word-break: break-all; }
.live-head small { color: var(--subtle); font-size: 11px; }

.progress { background: var(--surface-strong); border-radius: 999px; height: 4px; margin-bottom: 14px; overflow: hidden; }
.progress-bar {
  background: var(--primary);
  height: 100%;
  transition: width .4s ease;
  width: 12%;
}

.metrics {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  margin-bottom: 14px;
}
.metric {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 11px;
}
.metric b { display: block; font-size: 19px; line-height: 1.2; }
.metric span { color: var(--subtle); font-size: 10.5px; }
.metric.alert b { color: var(--red); }
.metric.ok b { color: var(--green); }

.ask {
  background: var(--amber-soft);
  border-left: 3px solid var(--amber);
  border-radius: var(--radius);
  margin-bottom: 14px;
  padding: 12px 14px;
}
.ask h3 { color: var(--amber); font-size: 12.5px; margin-bottom: 4px; }
.ask p { font-size: 12.5px; margin-bottom: 9px; }
.ask form { display: flex; gap: 8px; }
.ask input { border: 1px solid var(--border-strong); border-radius: 4px; flex: 1; padding: 8px 10px; }

.result { border-top: 1px solid var(--border); padding-top: 13px; }
.result h3 { font-size: 12.5px; margin-bottom: 9px; }
.artifacts { display: grid; gap: 8px; margin-bottom: 11px; }
.artifact {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 9px 11px;
  text-decoration: none;
}
.artifact:hover { border-color: var(--primary); }
.artifact-info { display: grid; gap: 1px; min-width: 0; }
.artifact-info strong { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.artifact-info small { color: var(--subtle); font-size: 10.5px; }
.artifact-kind {
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  text-transform: uppercase;
}
.artifact-kind[data-kind="dxf"] { background: var(--primary-soft); color: var(--primary); }
.artifact-kind[data-kind="xlsx"] { background: var(--green-soft); color: var(--green); }
.artifact-kind[data-kind="json"] { background: var(--surface-strong); color: var(--muted); }
.artifact-kind[data-kind="image"] { background: var(--cyan-soft); color: var(--cyan); }

.final-answer {
  background: var(--green-soft);
  border-left: 3px solid var(--green);
  border-radius: var(--radius);
  font-size: 12.5px;
  padding: 10px 12px;
  white-space: pre-wrap;
}
.job-error {
  background: var(--red-soft);
  border-left: 3px solid var(--red);
  border-radius: var(--radius);
  color: var(--red);
  font-size: 12.5px;
  margin-top: 10px;
  padding: 10px 12px;
}

.events { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 12px; }
.events summary { color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 600; }
.events summary span { color: var(--subtle); font-weight: 400; }
.event-list { display: grid; gap: 6px; list-style: none; margin-top: 10px; max-height: 300px; overflow-y: auto; padding: 0; }
.event-list li {
  border-left: 2px solid var(--border);
  color: var(--muted);
  display: grid;
  font-size: 11.5px;
  gap: 1px;
  padding: 2px 0 2px 9px;
}
.event-list li time { color: var(--subtle); font-size: 10px; }
.event-list li[data-kind="tool"] { border-color: var(--primary); }
.event-list li[data-kind="final"] { border-color: var(--green); }
.event-list li[data-kind="done"] { border-color: var(--green); }
.event-list li[data-kind="error"] { border-color: var(--red); color: var(--red); }
.event-list li[data-kind="warn"] { border-color: var(--amber); color: var(--amber); }
.event-list li[data-kind="question"] { border-color: var(--amber); }

/* ---------------- 历史 ---------------- */

.history-item {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  display: grid;
  gap: 2px;
  margin-bottom: 8px;
  padding: 9px 11px;
  text-align: left;
  width: 100%;
}
.history-item:hover { background: var(--surface-soft); border-color: var(--primary); }
.history-item strong { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-item small { color: var(--subtle); font-size: 10.5px; }
.history-item .dot {
  border-radius: 50%;
  display: inline-block;
  height: 7px;
  margin-right: 5px;
  width: 7px;
}
.dot[data-status="done"] { background: var(--green); }
.dot[data-status="error"] { background: var(--red); }
.dot[data-status="running"] { background: var(--primary); }
.dot[data-status="queued"] { background: var(--amber); }
.dot[data-status="waiting_input"] { background: var(--amber); }

.footer {
  align-items: center;
  color: var(--subtle);
  display: flex;
  font-size: 11px;
  gap: 16px;
  justify-content: space-between;
  margin: 0 auto;
  max-width: 1440px;
  padding: 22px 28px 30px;
}
@media (max-width: 820px) { .footer { flex-direction: column; gap: 4px; padding: 18px 16px 24px; text-align: center; } }
