/* AI老板工具箱 —— 手机优先设计系统 */
:root {
  --primary: #e8541e;
  --primary-dark: #c74414;
  --primary-soft: #fdeee6;
  --ink: #1f1a17;
  --ink-2: #6b625c;
  --bg: #f7f5f2;
  --card: #ffffff;
  --line: #ece7e1;
  --ok: #1a9e5c;
  --warn: #d97706;
  --err: #dc2626;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(31, 26, 23, .06), 0 4px 16px rgba(31, 26, 23, .05);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .logo { font-size: 1.1rem; font-weight: 800; letter-spacing: .5px; }
.topbar .logo em { color: var(--primary); font-style: normal; }
.topbar .spacer { flex: 1; }
.topbar a.plain { color: var(--ink-2); font-size: .9rem; }

.wrap { max-width: 720px; margin: 0 auto; padding: 16px; }

/* 首页 */
.hero { padding: 22px 4px 8px; }
.hero h1 { font-size: 1.5rem; margin: 0 0 6px; }
.hero p { color: var(--ink-2); margin: 0; font-size: .95rem; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
@media (max-width: 420px) { .grid { grid-template-columns: 1fr; } }
.tool-card {
  display: block; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow);
  transition: transform .12s ease, box-shadow .12s ease; color: inherit;
}
.tool-card:active { transform: scale(.98); }
.tool-card .icon { font-size: 1.6rem; }
.tool-card h3 { margin: 8px 0 4px; font-size: 1rem; }
.tool-card p { margin: 0; color: var(--ink-2); font-size: .82rem; line-height: 1.5; }
.tool-card .cost { display: inline-block; margin-top: 8px; font-size: .72rem; color: var(--warn);
  background: #fdf3e2; border-radius: 999px; padding: 2px 8px; }
.tool-card .cost.free { color: var(--ok); background: #e7f6ee; }

/* 卡片与表单 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.card h2 { font-size: 1.05rem; margin: 0 0 12px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .9rem; font-weight: 600; margin-bottom: 6px; }
.field .hint { font-size: .78rem; color: var(--ink-2); margin-top: 4px; }
input[type=text], input[type=number], input[type=password], textarea, select {
  width: 100%; padding: 11px 12px; font-size: 1rem; border: 1.5px solid var(--line);
  border-radius: 10px; background: #fbfaf8; color: var(--ink); outline: none;
  transition: border-color .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--primary); }
textarea { min-height: 110px; resize: vertical; }
input[type=file] { width: 100%; font-size: .9rem; }
.file-previews { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.file-previews .fp { position: relative; width: 74px; height: 74px; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line); background: #f2efeb; display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; }
.file-previews .fp img { width: 100%; height: 100%; object-fit: cover; }
.file-previews .fp .nm { position: absolute; bottom: 0; left: 0; right: 0; font-size: .6rem;
  background: rgba(0,0,0,.55); color: #fff; padding: 2px 4px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; padding: 13px 18px; font-size: 1.02rem; font-weight: 700; color: #fff;
  background: var(--primary); border: none; border-radius: 12px; cursor: pointer;
  transition: background .15s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { background: #d8cfc8; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--ink); border: 1.5px solid var(--line); }
.btn.small { width: auto; padding: 7px 14px; font-size: .85rem; border-radius: 9px; }

/* 进度 */
.progress-box { display: none; }
.progress-box.show { display: block; }
.pbar { height: 10px; background: #efeae4; border-radius: 999px; overflow: hidden; }
.pbar > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--primary), #f2844f);
  border-radius: 999px; transition: width .4s ease; }
.pstep { font-size: .9rem; color: var(--ink-2); margin-top: 8px; }

/* 状态/提示 */
.tag { display: inline-block; font-size: .75rem; padding: 2px 9px; border-radius: 999px; font-weight: 600; }
.tag.done { color: var(--ok); background: #e7f6ee; }
.tag.running { color: var(--warn); background: #fdf3e2; }
.tag.failed { color: var(--err); background: #fdeaea; }
.alert { padding: 11px 13px; border-radius: 10px; font-size: .9rem; margin: 10px 0; }
.alert.err { background: #fdeaea; color: #a32222; }
.alert.info { background: #eef4fd; color: #1d4fa1; }

/* 结果 */
.result-box h2 { display: flex; align-items: center; gap: 8px; }
.kv { display: flex; gap: 8px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: .93rem; }
.kv:last-child { border-bottom: none; }
.kv .k { flex: 0 0 92px; color: var(--ink-2); }
.kv .v { flex: 1; word-break: break-word; }
.score { font-size: 2rem; font-weight: 800; color: var(--primary); }
.score small { font-size: .9rem; color: var(--ink-2); font-weight: 400; }
.bar-row { margin: 8px 0; }
.bar-row .bl { display: flex; justify-content: space-between; font-size: .85rem; margin-bottom: 3px; }
.bar-row .pbar { height: 7px; }
.copyable { background: #fbf7f2; border: 1px dashed #e5d9cb; border-radius: 10px; padding: 10px 12px;
  font-size: .92rem; white-space: pre-wrap; word-break: break-word; margin: 6px 0; }
.copy-btn { font-size: .75rem; color: var(--primary); background: var(--primary-soft);
  border: none; border-radius: 6px; padding: 2px 8px; cursor: pointer; }
.list-item { padding: 10px 2px; border-bottom: 1px dashed var(--line); font-size: .92rem; }
.list-item:last-child { border-bottom: none; }
.badge { display: inline-block; font-size: .7rem; padding: 1px 7px; border-radius: 6px; margin-right: 6px;
  background: #f0ece7; color: var(--ink-2); vertical-align: 1px; }
.badge.high { background: #fdeaea; color: var(--err); }
.badge.mid { background: #fdf3e2; color: var(--warn); }
.badge.low { background: #e7f6ee; color: var(--ok); }

/* 产物网格 */
.artifacts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; }
@media (max-width: 420px) { .artifacts { grid-template-columns: repeat(2, 1fr); } }
.art { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fbfaf8; }
.art img, .art video { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: #111; }
.art video { aspect-ratio: auto; }
.art .cap { font-size: .75rem; padding: 6px 8px; color: var(--ink-2); display: flex;
  justify-content: space-between; align-items: center; gap: 4px; }
.art .cap span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.art.tall img { aspect-ratio: 9/16; object-fit: contain; background: #111; }

/* 表格 */
table.tb { width: 100%; border-collapse: collapse; font-size: .85rem; }
table.tb th, table.tb td { padding: 7px 6px; border-bottom: 1px solid var(--line); text-align: left;
  vertical-align: top; }
table.tb th { color: var(--ink-2); font-weight: 600; white-space: nowrap; }

/* 历史 */
.hist { font-size: .85rem; }
.hist .h-item { display: flex; gap: 8px; align-items: center; padding: 9px 2px;
  border-bottom: 1px dashed var(--line); cursor: pointer; }
.hist .h-item:hover { background: #fbf7f2; }
.hist .t { color: var(--ink-2); font-size: .78rem; }

/* toast */
#toast { position: fixed; left: 50%; bottom: 12vh; transform: translateX(-50%);
  background: rgba(31,26,23,.9); color: #fff; padding: 9px 18px; border-radius: 999px;
  font-size: .9rem; opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 99; }
#toast.show { opacity: 1; }

/* 登录页 */
.login-wrap { min-height: 90vh; display: flex; flex-direction: column; justify-content: center; padding: 24px; }
.login-card { max-width: 380px; margin: 0 auto; width: 100%; }
.login-card h1 { text-align: center; font-size: 1.4rem; }
.login-card .sub { text-align: center; color: var(--ink-2); font-size: .9rem; margin-bottom: 20px; }
.footer { text-align: center; color: var(--ink-2); font-size: .78rem; padding: 24px 0 30px; }
