/* article-platform 管理台样式：自成一体（不依赖外部 style.css），
   配色/组件语言照搬 geo-platform console.css 的深色科技风，裁剪至本平台实际用到的部分。 */

* { box-sizing: border-box; }

:root {
  --bg: #070C16;
  --ink: #0B1220;
  --surface: rgba(255, 255, 255, .04);
  --border: rgba(255, 255, 255, .09);
  --text: #E8ECF4;
  --muted: #8B94AC;
  --accent: #00E3A0;
  --accent-2: #4D9FFF;
  --accent-soft: rgba(0, 227, 160, .14);
  --warn: #F5A524;
  --danger: #FF5D68;
  --radius-card: 14px;
  --radius-btn: 10px;
  --gutter: clamp(20px, 4vw, 48px);
}

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  line-height: 1.6;
}

a { color: inherit; }
h1, h2, h3 { font-weight: 700; margin: 0 0 .5rem; color: #fff; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.1rem; }
p { margin: 0 0 .8rem; }
.muted { color: var(--muted); }

.container { width: 100%; padding: 0 var(--gutter); }
.container--narrow { max-width: 380px; margin: 4rem auto; padding: 0 20px; }

/* -------------------------------------------------------------
   卡片 / 表单 / 按钮 / 表格 / 徽章（复用一套通用组件）
   ------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 1.3rem 1.4rem;
  margin-bottom: 1.1rem;
}
.card h2 { margin: 0 0 .8rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; margin-bottom: .9rem; }
.card-head h2 { margin: 0; }

label { display: block; font-weight: 600; font-size: .82rem; margin: .9rem 0 .35rem; color: var(--text); }
input[type="text"], input[type="password"], select {
  width: 100%; padding: .58rem .7rem; border: 1px solid var(--border); border-radius: 9px;
  font-size: .92rem; font-family: inherit; background: rgba(255, 255, 255, .05); color: var(--text);
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0, 227, 160, .18); }
.field { margin-bottom: 1rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  background: linear-gradient(180deg, #0BEFAC 0%, #00CE90 100%);
  color: #05231A; border: 1px solid rgba(255, 255, 255, .14);
  border-radius: var(--radius-btn); padding: .6rem 1.3rem; font-size: .92rem; font-weight: 600;
  white-space: nowrap; /* 列窄时按钮文字曾一字一行断成「生／成」（2026-08-26 界面走查实见） */
  cursor: pointer; text-decoration: none; font-family: inherit;
}
.btn:hover { filter: brightness(1.06); }
.btn:disabled { background: rgba(255, 255, 255, .08); color: rgba(255, 255, 255, .35); cursor: not-allowed; }
.btn-sm { padding: .36rem .78rem; font-size: .82rem; border-radius: 8px; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: rgba(255, 255, 255, .06); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-full { width: 100%; }

.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .18rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.badge-active { background: var(--accent-soft); color: var(--accent); }
.badge-disabled { background: rgba(255, 93, 104, .16); color: var(--danger); }
/* 缺口已消失：不是错误也不是正常，是「需要人看一眼」——用中性偏警示的琥珀，别用红 */
.badge-stale { background: rgba(214, 160, 85, .18); color: #D6A055; }
/* 设置了但当前不生效的提示：比 muted 显眼，比 error 轻 */
.hint-warn { font-size: .78rem; color: #D6A055; }

table { width: 100%; border-collapse: collapse; margin: .5rem 0; }
th, td { padding: .55rem .6rem; text-align: left; font-size: .86rem; border-bottom: 1px solid var(--border); word-break: break-word; }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
tbody tr:hover { background: rgba(255, 255, 255, .04); }
.table-wrap { overflow-x: auto; }

.error-box { background: rgba(255, 93, 104, .12); color: var(--danger); border: 1px solid rgba(255, 93, 104, .3); border-radius: 10px; padding: .8rem 1rem; font-size: .88rem; }
.ok-box { background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(0, 227, 160, .3); border-radius: 10px; padding: .8rem 1rem; font-size: .88rem; }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; font-size: .88rem; }

.row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin: .5rem 0; }

/* -------------------------------------------------------------
   控制台布局：侧栏 + 主区
   ------------------------------------------------------------- */

.console { display: flex; align-items: stretch; min-height: 100vh; }

.console-side {
  flex: 0 0 200px; width: 200px; display: flex; flex-direction: column;
  background: var(--ink); border-right: 1px solid var(--border);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.console-logo { display: flex; align-items: center; gap: .5rem; padding: 1.1rem 1rem; color: #fff; font-weight: 700; font-size: .98rem; border-bottom: 1px solid var(--border); }
.console-logo svg { flex: none; color: var(--accent); }

.side-nav { flex: 1; display: flex; flex-direction: column; gap: .1rem; padding: .7rem .55rem; }
.side-nav-item {
  display: flex; align-items: center; gap: .5rem; padding: .55rem .65rem; border-radius: var(--radius-btn);
  border-left: 3px solid transparent; color: var(--muted); text-decoration: none; font-size: .86rem; font-weight: 600;
  background: none; border-top: none; border-right: none; border-bottom: none; width: 100%; text-align: left; cursor: pointer; font-family: inherit;
}
.side-nav-item:hover { background: var(--surface); color: var(--text); }
.side-nav-item.is-active { background: var(--accent-soft); color: var(--accent); border-left-color: var(--accent); }

.console-side-foot { display: flex; flex-direction: column; gap: .5rem; padding: 1rem; border-top: 1px solid var(--border); font-size: .84rem; }

.console-main { flex: 1; min-width: 0; padding: 1.8rem var(--gutter) 3rem; }
.console-panel { display: none; }
.console-panel.is-active { display: block; }

.page-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .8rem; margin-bottom: 1.4rem; }
.page-head h1 { margin: 0; }

.placeholder-panel { text-align: center; color: var(--muted); padding: 4rem 1rem; border: 1px dashed var(--border); border-radius: var(--radius-card); }

/* -------------------------------------------------------------
   登录页
   ------------------------------------------------------------- */
.login-card { text-align: center; }
.login-card h1 { font-size: 1.3rem; margin-bottom: 1.6rem; }

/* -------------------------------------------------------------
   API Key 一次性展示条
   ------------------------------------------------------------- */
.key-reveal { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; word-break: break-all; font-family: ui-monospace, monospace; font-size: .84rem; background: rgba(0, 227, 160, .08); border: 1px solid rgba(0, 227, 160, .3); border-radius: 9px; padding: .7rem .9rem; margin: .6rem 0; }

/* -------------------------------------------------------------
   面板通用：租户筛选、分页、详情展开、待后端就绪、质量门 findings、JSON 文本域
   ------------------------------------------------------------- */
.filter-bar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filter-bar select { width: auto; min-width: 10rem; }

.pending-box { background: rgba(77, 159, 255, .1); color: var(--accent-2); border: 1px solid rgba(77, 159, 255, .3); border-radius: 10px; padding: .8rem 1rem; font-size: .88rem; }

textarea {
  width: 100%; padding: .58rem .7rem; border: 1px solid var(--border); border-radius: 9px;
  font-size: .88rem; font-family: inherit; background: rgba(255, 255, 255, .05); color: var(--text);
  resize: vertical; min-height: 4.5rem;
}
textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0, 227, 160, .18); }
textarea.mono { font-family: ui-monospace, monospace; font-size: .82rem; }
.field-hint { color: var(--muted); font-size: .78rem; margin: .2rem 0 0; }

.pagination { display: flex; align-items: center; justify-content: center; gap: .8rem; margin-top: .8rem; font-size: .84rem; color: var(--muted); }

.detail-row td { background: rgba(255, 255, 255, .02); padding: 1rem 1.2rem; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .9rem 1.4rem; margin-bottom: .8rem; }
.detail-grid dt { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: .2rem; }
.detail-grid dd { margin: 0; font-size: .88rem; word-break: break-word; }

.lang-tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .7rem; }
.lang-tab { padding: .32rem .8rem; border-radius: 999px; border: 1px solid var(--border); background: transparent; color: var(--muted); font-size: .8rem; cursor: pointer; font-family: inherit; }
.lang-tab.is-active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.lang-body { border: 1px solid var(--border); border-radius: 10px; padding: .9rem 1rem; max-height: 22rem; overflow-y: auto; font-size: .86rem; }
.lang-body h4 { margin: 0 0 .5rem; color: #fff; }
.lang-body pre { white-space: pre-wrap; word-break: break-word; font-family: inherit; margin: 0; }

.finding-item { display: flex; align-items: flex-start; gap: .6rem; padding: .55rem 0; border-bottom: 1px solid var(--border); font-size: .86rem; }
.finding-item:last-child { border-bottom: none; }
.finding-badge { flex: none; padding: .1rem .55rem; border-radius: 999px; font-size: .74rem; font-weight: 700; }
.finding-pass { background: var(--accent-soft); color: var(--accent); }
.finding-fail { background: rgba(255, 93, 104, .16); color: var(--danger); }
.finding-dim { font-weight: 600; }
.finding-detail { color: var(--muted); margin-top: .15rem; }

.err-summary { color: var(--danger); font-size: .82rem; max-width: 22rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.hash-chip { display: inline-flex; align-items: center; gap: .4rem; }
.hash-chip code { font-family: ui-monospace, monospace; font-size: .84rem; }
.hash-chip .btn { padding: .18rem .55rem; font-size: .74rem; }

.finding-raw { margin-top: .3rem; }
.finding-raw summary { cursor: pointer; color: var(--accent-2); font-size: .78rem; }
.finding-raw pre { margin: .4rem 0 0; background: rgba(255, 255, 255, .03); border: 1px solid var(--border); border-radius: 8px; padding: .6rem .7rem; font-size: .78rem; white-space: pre-wrap; word-break: break-word; font-family: ui-monospace, monospace; }

/* -------------------------------------------------------------
   单列长表单（写作档案 / 发布目标编辑）：这类表单是 prompt 组装的唯一数据源，
   全宽表格行里嵌一个定宽居中的表单，避免多列窄格挤压，也避免单行输入被拉成整屏宽。
   ------------------------------------------------------------- */
.form-narrow { max-width: 760px; margin: 0 auto; }

/* P2：表单本体保持 760 定宽（单列阅读顺序），长 JSON 编辑区顺手放宽到 900，居中对齐同一根轴线 */
@media (min-width: 1300px) {
  .form-narrow textarea.field-json { width: 900px; max-width: 900px; margin-left: calc((760px - 900px) / 2); }
}

.field-group { margin: 0 0 1.5rem; padding-bottom: 1.3rem; border-bottom: 1px solid var(--border); }
.field-group-title {
  margin: 0 0 .9rem; font-size: .78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--accent-2);
}
details.field-group-collapsed { border: 1px solid var(--border); border-radius: 10px; padding: .8rem 1rem; }
details.field-group-collapsed summary.field-group-title { cursor: pointer; list-style: none; }
details.field-group-collapsed summary::-webkit-details-marker { display: none; }
details.field-group-collapsed summary::before { content: '▸ '; }
details.field-group-collapsed[open] summary::before { content: '▾ '; }
.field-group-body { margin-top: .9rem; }

textarea.field-json { min-height: 16rem; }
.field-error { color: var(--danger); font-size: .78rem; margin: .35rem 0 0; }
textarea.is-invalid, input.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(255, 93, 104, .16); }

.profile-form-actions { margin-top: .2rem; padding-top: 1rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; }

.unsaved-confirm {
  display: flex; align-items: center; gap: .7rem; flex-wrap: wrap;
  background: rgba(245, 165, 36, .12); color: var(--warn); border: 1px solid rgba(245, 165, 36, .35);
  border-radius: 10px; padding: .7rem 1rem; margin-bottom: 1rem; font-size: .86rem;
}

/* -------------------------------------------------------------
   正文渲染预览（P0-2）：iframe sandbox 隔离 LLM 产出的 HTML，脚本不执行，样式在 srcdoc 内联自带。
   ------------------------------------------------------------- */
.content-preview { width: 100%; height: 26rem; border: 1px solid var(--border); border-radius: 10px; background: #fff; }

/* -------------------------------------------------------------
   驳回内联理由表单（P0-1）：审核动作共用控件（lib/js/api.js bindApproveReject），不用原生 prompt。
   ------------------------------------------------------------- */
.reject-form { margin-top: .6rem; padding: .8rem; border: 1px solid var(--border); border-radius: 10px; background: rgba(255, 93, 104, .05); }
.reject-form .reject-reason { margin-bottom: .5rem; }

/* -------------------------------------------------------------
   数据表格 390 响应式（P0-3 / P1）：全站统一同一套策略——不做整表横滑，
   窄屏隐藏次要列，主标识列（标题/名称/选题/对象）省略号截断，完整值在 title 属性里。
   ------------------------------------------------------------- */
.table-wrap .col-status { width: 5rem; }
.table-wrap .col-time { width: 5.5rem; }
.table-wrap .col-action { width: 3.6rem; }
.table-wrap .col-action-wide { width: 8rem; }

/* 操作列此前直接把 .row（display:flex）当单元格用，单元格就不再随行高拉伸——
   行一换行变高，右侧按钮和左侧文字的分隔线立刻错位（2026-08-26 界面走查实见：
   租户列表里 UUID 和日期换行后，右侧分隔线整体上移半行）。还原成 table-cell 并
   垂直居中，按钮间距用 margin 补回 flex 的 gap。 */
.table-wrap td.col-action-wide.row { display: table-cell; vertical-align: middle; }
.table-wrap td.col-action-wide.row > * { margin-right: .6rem; }
.table-wrap td.col-action-wide.row > *:last-child { margin-right: 0; }

/* col-action-wide 装多个按钮（租户/员工列表的"操作"列）：8rem 在桌面宽度下不够 3 个按钮一行，
   会被 .row 的 flex-wrap 挤成竖排，撑出 ~250px 高的行。桌面（>480px，非移动紧凑布局）改为不限宽
   + 不换行，交给 table-layout:auto 按内容需要分配列宽；移动端维持原 8rem（该断点刻意不做整表横滑，
   见下方 390 响应式策略注释，不在本次改动范围）。 */
@media (min-width: 481px) {
  .table-wrap .col-action-wide { width: auto; white-space: nowrap; }
  .table-wrap td.col-action-wide.row { flex-wrap: nowrap; }
}

@media (max-width: 480px) {
  .table-wrap table { table-layout: fixed; }
  .table-wrap .col-optional { display: none; }
  .table-wrap .col-primary { width: 100%; max-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; word-break: normal; }
}

@media (max-width: 900px) {
  .console { flex-direction: column; min-height: auto; }
  .console-side { flex: none; position: sticky; top: 0; width: 100%; height: auto; border-right: none; border-bottom: 1px solid var(--border); z-index: 30; }
  .side-nav { flex: none; flex-direction: row; flex-wrap: wrap; padding: .5rem; gap: .3rem; }
  .side-nav-item { flex: none; width: auto; white-space: nowrap; border-left: none; border-bottom: 3px solid transparent; padding: .4rem .55rem; font-size: .8rem; }
  .side-nav-item.is-active { border-left-color: transparent; border-bottom-color: var(--accent); }
  .console-side-foot { flex-direction: row; align-items: center; justify-content: space-between; }
  .console-main { padding: 1.3rem 1rem 2.5rem; }
}
