/* 粒方技能中心 — 共享样式 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #1B6B5A;
  --primary-dark: #145244;
  --primary-light: #E6F4F0;
  --accent: #5B4B8A;
  --accent-light: #EFEDF7;
  --bg: #F4F6F9;
  --surface: #FFFFFF;
  --text: #1A2332;
  --text-secondary: #5A6B7F;
  --text-tertiary: #93A1B2;
  --border: #E2E8F0;
  --border-strong: #CDD7E3;
  --danger: #C0392B;
  --danger-light: #FDECEA;
  --warn: #B7791F;
  --warn-light: #FDF6E7;
  --ok: #1B6B5A;
  --ok-light: #E6F4F0;
  --shadow-sm: 0 1px 3px rgba(26, 35, 50, .06);
  --shadow-md: 0 4px 16px rgba(26, 35, 50, .08);
  --shadow-lg: 0 8px 32px rgba(27, 107, 90, .14);
  --radius: 12px;
  --radius-lg: 16px;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }

/* ===== 登录页 ===== */
.login-screen {
  position: fixed; inset: 0; z-index: 100;
  background: linear-gradient(135deg, #1B6B5A 0%, #145244 60%, #0D3B32 100%);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-card {
  background: #fff; border-radius: 20px; padding: 44px 40px;
  width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
.login-brand { text-align: center; margin-bottom: 30px; }
.login-brand .logo {
  width: 64px; height: 64px; margin: 0 auto 14px;
  background: var(--primary-light); border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 700; color: var(--primary);
}
.login-brand h1 { font-size: 22px; font-weight: 700; letter-spacing: .5px; }
.login-brand p { font-size: 13px; color: var(--text-secondary); margin-top: 6px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: #3A4A5E; margin-bottom: 6px; font-weight: 500; }
.field input {
  width: 100%; height: 46px; padding: 0 14px;
  border: 1.5px solid var(--border); border-radius: 10px;
  font-size: 15px; outline: none; transition: border-color .15s;
}
.field input:focus { border-color: var(--primary); }

.btn-primary {
  width: 100%; height: 46px; border-radius: 10px;
  background: var(--primary); color: #fff; font-size: 15px; font-weight: 500;
  transition: background .15s;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.form-error {
  background: var(--danger-light); color: var(--danger);
  padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px;
}
.login-hint { margin-top: 20px; font-size: 12px; color: var(--text-tertiary); text-align: center; line-height: 1.8; }

/* ===== 顶部栏 ===== */
.topbar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 24px;
  height: 64px; display: flex; align-items: center; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; flex-shrink: 0; }
.brand .mark {
  width: 34px; height: 34px; border-radius: 9px; background: var(--primary);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700;
}
.search-wrap { flex: 1; max-width: 420px; position: relative; }
.search-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); opacity: .4; }
.search-wrap input {
  width: 100%; height: 40px; padding: 0 14px 0 38px;
  border: 1.5px solid var(--border); border-radius: 10px;
  background: var(--bg); outline: none; transition: border-color .15s, background .15s;
}
.search-wrap input:focus { border-color: var(--primary); background: #fff; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.user-chip {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px;
  background: var(--bg); border-radius: 20px; font-size: 13px;
}
.user-chip .avatar {
  width: 26px; height: 26px; border-radius: 50%; background: var(--primary-light);
  color: var(--primary); display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
}
.btn-ghost {
  padding: 7px 14px; border-radius: 8px; font-size: 13px;
  color: var(--text-secondary); border: 1px solid var(--border); transition: all .15s;
}
.btn-ghost:hover { border-color: var(--border-strong); color: var(--text); }
.link-btn { color: var(--primary); font-size: 13px; font-weight: 500; }
.link-btn:hover { text-decoration: underline; }

/* ===== 内容区 ===== */
.wrap { max-width: 1180px; margin: 0 auto; padding: 28px 24px 60px; }
.page-head { margin-bottom: 20px; }
.page-head h2 { font-size: 20px; font-weight: 700; }
.page-head p { color: var(--text-secondary); font-size: 13px; margin-top: 4px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.chip {
  padding: 7px 15px; border-radius: 20px; font-size: 13px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-secondary); transition: all .15s;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 500; }
.chip .count { opacity: .65; margin-left: 5px; font-size: 12px; }

.section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 600; margin: 28px 0 14px;
}
.section-title:first-of-type { margin-top: 0; }
.section-title .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }

/* ===== 技能网格 ===== */
.grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
}
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px; display: flex; flex-direction: column; gap: 12px;
  transition: transform .16s, box-shadow .16s, border-color .16s;
  position: relative; cursor: pointer; text-align: left;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.card.soon { cursor: default; opacity: .78; }
.card.soon:hover { transform: none; box-shadow: var(--shadow-sm); }
.card-top { display: flex; align-items: flex-start; gap: 12px; }
.card-icon {
  width: 44px; height: 44px; border-radius: 11px; background: var(--primary-light);
  display: flex; align-items: center; justify-content: center; font-size: 21px; flex-shrink: 0;
}
.card-icon.ai { background: var(--accent-light); }
.card-title-wrap { flex: 1; min-width: 0; }
.card h3 { font-size: 15px; font-weight: 600; line-height: 1.4; }
.card .cat { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }
.card .summary {
  font-size: 13px; color: var(--text-secondary); line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-foot { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 4px; }

.tag {
  font-size: 11px; padding: 3px 8px; border-radius: 6px; font-weight: 500;
  white-space: nowrap;
}
.tag.live { background: var(--ok-light); color: var(--ok); }
.tag.beta { background: var(--warn-light); color: var(--warn); }
.tag.soon { background: #EEF1F5; color: var(--text-tertiary); }
.tag.engine-ai { background: var(--accent-light); color: var(--accent); }
.tag.grade { background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border); }

.star {
  position: absolute; top: 16px; right: 16px; width: 30px; height: 30px;
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: var(--text-tertiary); transition: all .15s; line-height: 1;
}
.star:hover { background: var(--bg); color: var(--warn); }
.star.on { color: #E8A33D; }

/* ===== 空状态 ===== */
.empty {
  background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius-lg);
  padding: 56px 24px; text-align: center; color: var(--text-secondary);
}
.empty .big { font-size: 32px; margin-bottom: 12px; opacity: .5; }
.empty h3 { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty p { font-size: 13px; }

/* ===== 技能运行页 ===== */
.run-head {
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.run-head-inner {
  max-width: 1680px; margin: 0 auto; padding: 12px 24px 14px;
  display: flex; align-items: center; gap: 16px;
}
.back-link {
  display: flex; align-items: center; gap: 6px; font-size: 13px;
  color: var(--text-secondary); padding: 7px 12px; border-radius: 8px;
  border: 1px solid var(--border); transition: all .15s; flex-shrink: 0;
}
.back-link:hover { border-color: var(--primary); color: var(--primary); }
.run-title { flex: 1; min-width: 0; }
.run-title h1 { font-size: 16px; font-weight: 600; }
.run-title .meta { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }
.run-meta { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.frame-wrap { max-width: 1680px; margin: 0 auto; padding: 16px 20px 28px; }
.frame-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-sm);
}
iframe { width: 100%; height: calc(100vh - 122px); min-height: 520px; border: none; display: block; }
.notice {
  padding: 14px 18px; background: var(--warn-light); color: var(--warn);
  font-size: 13px; border-bottom: 1px solid var(--border);
}
.notice strong { font-weight: 600; }
.iframe-loading {
  padding: 60px 24px; text-align: center; color: var(--text-tertiary); font-size: 13px;
}

/* ===== 管理后台 ===== */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 24px; overflow-x: auto; }
.tab {
  padding: 11px 18px; font-size: 14px; color: var(--text-secondary);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.stat-row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 24px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px;
}
.stat .label { font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.stat .value { font-size: 26px; font-weight: 700; line-height: 1.2; }
.stat .value small { font-size: 13px; font-weight: 400; color: var(--text-secondary); margin-left: 3px; }

.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; margin-bottom: 24px;
}
.panel-head {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.panel-head h3 { font-size: 14px; font-weight: 600; }
.panel-head .sub { font-size: 12px; color: var(--text-tertiary); }
.panel-head .spacer { margin-left: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; padding: 11px 20px; background: #FAFBFC;
  font-weight: 500; color: var(--text-secondary); font-size: 12px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
td { padding: 12px 20px; border-bottom: 1px solid #F1F4F8; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #FAFBFC; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--text-secondary); }
.muted { color: var(--text-tertiary); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

.mini-btn {
  padding: 5px 11px; border-radius: 7px; font-size: 12px;
  border: 1px solid var(--border); color: var(--text-secondary); transition: all .15s;
}
.mini-btn:hover { border-color: var(--primary); color: var(--primary); }
.mini-btn.danger:hover { border-color: var(--danger); color: var(--danger); }
.mini-btn.on { background: var(--primary); border-color: var(--primary); color: #fff; }

.bar-track { background: #EDF1F6; border-radius: 4px; height: 6px; overflow: hidden; width: 100%; min-width: 60px; }
.bar-fill { height: 100%; background: var(--primary); border-radius: 4px; }

.modal-mask {
  position: fixed; inset: 0; background: rgba(20, 30, 45, .45); z-index: 60;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: #fff; border-radius: var(--radius-lg); padding: 26px;
  width: 100%; max-width: 440px; box-shadow: 0 24px 60px rgba(0, 0, 0, .28);
}
.modal h3 { font-size: 16px; font-weight: 700; margin-bottom: 18px; }
.modal .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }
.hint-box {
  background: var(--bg); border-radius: 8px; padding: 11px 14px;
  font-size: 12px; color: var(--text-secondary); line-height: 1.7; margin-top: 6px;
}

.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: #23303F; color: #fff; padding: 11px 22px; border-radius: 10px;
  font-size: 13px; z-index: 90; box-shadow: var(--shadow-lg);
}
.toast.err { background: var(--danger); }

.loading { padding: 60px; text-align: center; color: var(--text-tertiary); font-size: 13px; }

@media (max-width: 720px) {
  .topbar-inner { flex-wrap: wrap; height: auto; padding: 12px 16px; gap: 10px; }
  .search-wrap { order: 3; max-width: none; width: 100%; flex-basis: 100%; }
  .wrap { padding: 20px 16px 48px; }
  .run-head-inner { flex-wrap: wrap; }
  iframe { height: calc(100vh - 104px); min-height: 440px; }
  table { font-size: 12px; }
  th, td { padding: 10px 12px; }
}
