/* 论文工坊发布控制台：沿用软件主界面的纸张 + 松绿 + 印章红配色 */
:root {
  --kraft: #e7e0cf;
  --kraft-2: #ded5bf;
  --paper: #f7f2e6;
  --paper-2: #efe8d7;
  --ink: #24221c;
  --ink-2: #55523f;
  --muted: #8b8772;
  --line: #d6cbb4;
  --line-2: #c3b79c;
  --pine: #1f3d33;
  --pine-2: #2a4e41;
  --pine-3: #163028;
  --seal: #a8322a;
  --seal-soft: #c25a4f;
  --amber: #b07a1e;
  --ok: #2f6b4f;
  --mono: "Cascadia Mono", "JetBrains Mono", Consolas, "Courier New", monospace;
  --song: "Songti SC", "SimSun", "Source Han Serif SC", serif;
  --sans: "Microsoft YaHei UI", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  --shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 10px 26px rgba(46,40,26,.10);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--kraft);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: rgba(31,61,51,.16); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #c9bea6; border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #b3a68b; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------------------------------------------------------- 登录 */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background:
    radial-gradient(circle at 18% 12%, rgba(255,255,255,.55), transparent 42%),
    linear-gradient(160deg, #ece5d4, #e2dac6 60%, #dcd3bd);
}
.login-card {
  width: 100%;
  max-width: 392px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 1px 0 rgba(255,255,255,.7) inset, 0 18px 48px rgba(46,40,26,.18);
  padding: 34px 34px 26px;
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.login-seal {
  width: 42px; height: 42px; flex: none;
  border-radius: 9px;
  object-fit: contain;
  box-shadow: 0 2px 10px rgba(46,40,26,.18);
}
.login-brand b { display: block; font-family: var(--song); font-size: 19px; letter-spacing: 3px; }
.login-brand span { display: block; font-family: var(--mono); font-size: 9px; letter-spacing: 2.4px; color: var(--muted); margin-top: 3px; }
.login-card h1 { margin: 0 0 6px; font-size: 15px; font-weight: 500; letter-spacing: .5px; }
.login-card .lede { margin: 0 0 22px; font-size: 11.5px; line-height: 1.8; color: var(--muted); }
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 11px; color: var(--ink-2); margin-bottom: 7px; letter-spacing: .4px; }
.field input {
  width: 100%;
  padding: 10px 12px;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdf7;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus { border-color: #6f9e7d; box-shadow: 0 0 0 3px rgba(111,158,125,.16); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px;
  font-size: 12.5px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  background: #fffdf7;
  color: var(--ink-2);
  transition: .14s;
}
.btn:hover:not(:disabled) { background: #fff; border-color: var(--ink-2); color: var(--ink); }
.btn.solid { background: var(--pine); border-color: var(--pine); color: #f4efdf; }
.btn.solid:hover:not(:disabled) { background: var(--pine-2); border-color: var(--pine-2); color: #fff; }
.btn.danger { color: var(--seal); border-color: #e0c3bb; background: #fbf1ec; }
.btn.danger:hover:not(:disabled) { background: #f8e7e1; border-color: var(--seal-soft); }
.btn.xs { padding: 4px 9px; font-size: 11px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.block { width: 100%; padding: 11px; font-size: 13px; }
.login-error {
  margin: 0 0 14px;
  padding: 9px 12px;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--seal);
  background: #f9ece7;
  border: 1px solid #e6cbc2;
  border-radius: 6px;
}
.login-error[hidden] { display: none; }
.login-foot {
  margin-top: 22px;
  padding-top: 15px;
  border-top: 1px solid #e4dcc9;
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--muted);
  letter-spacing: .6px;
}

/* ------------------------------------------------------------ 控制台骨架 */
.shell { display: grid; grid-template-columns: 226px minmax(0, 1fr); height: 100vh; min-height: 0; }
.rail {
  background: linear-gradient(180deg, #f2ecdd, #eae2d0);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 15px 16px 13px; border-bottom: 1px solid var(--line); }
.brand .login-seal { width: 30px; height: 30px; border-radius: 7px; box-shadow: 0 1px 6px rgba(46,40,26,.16); }
.brand-t b { display: block; font-family: var(--song); font-size: 15px; letter-spacing: 2.4px; }
.brand-t span { display: block; font-family: var(--mono); font-size: 8px; letter-spacing: 2px; color: var(--muted); margin-top: 1px; }
.rail-h {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 16px 16px 6px; font-size: 9.5px; letter-spacing: 2px; color: var(--muted);
}
.nav { display: flex; flex-direction: column; gap: 2px; padding: 0 8px 8px; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border: 1px solid transparent; border-radius: 6px;
  background: none; color: var(--ink-2); font-size: 12.5px; text-align: left;
  position: relative; transition: .13s;
}
.nav-item:hover { background: rgba(255,255,255,.55); color: var(--ink); }
.nav-item.on { background: var(--paper); border-color: var(--line); color: var(--ink); box-shadow: 0 1px 0 rgba(255,255,255,.7) inset; }
.nav-item.on::before { content: ""; position: absolute; left: -1px; top: 7px; bottom: 7px; width: 2px; background: var(--pine); border-radius: 2px; }
.nav-item svg { width: 17px; height: 17px; flex: none; color: #789184; }
.nav-item.on svg, .nav-item:hover svg { color: var(--pine); }
.rail-foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--line); font-size: 10px; color: var(--muted); line-height: 1.7; }
.rail-foot b { display: block; color: var(--ink-2); font-weight: 500; font-size: 11px; margin-bottom: 3px; }

/* ------------------------------------------------------------------ 主区 */
.main { min-width: 0; overflow: auto; background: var(--kraft); }
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 26px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(247,242,230,.96), rgba(238,231,215,.94));
  backdrop-filter: blur(6px);
}
.topbar h2 { margin: 0; font-family: var(--song); font-size: 17px; letter-spacing: 1.6px; font-weight: 500; }
.topbar .sub { font-size: 11px; color: var(--muted); margin-top: 4px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.page { padding: 22px 26px 40px; max-width: 1240px; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 18px; }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 18px; border-bottom: 1px solid #e6ddc9; }
.panel-h h3 { margin: 0; font-size: 13px; font-weight: 500; letter-spacing: .6px; }
.panel-h .hint { font-size: 10.5px; color: var(--muted); }
.panel-b { padding: 16px 18px; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--paper); border: 1px solid var(--line); border-radius: 9px; padding: 16px 17px; box-shadow: var(--shadow); }
.kpi small { display: block; font-size: 10px; letter-spacing: 1.4px; color: var(--muted); margin-bottom: 9px; }
.kpi b { display: block; font-family: var(--mono); font-size: 24px; font-weight: 500; letter-spacing: -.5px; }
.kpi span { display: block; font-size: 10.5px; color: var(--muted); margin-top: 6px; }
.kpi.accent b { color: var(--pine); }

/* 表格 */
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th {
  text-align: left; font-weight: 500; font-size: 10px; letter-spacing: 1.2px;
  color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap; background: #f4eee0;
}
td { padding: 10px 12px; border-bottom: 1px solid #ebe3d1; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbf6e9; }
td.num, th.num { font-family: var(--mono); font-size: 11px; }
.mono { font-family: var(--mono); font-size: 11px; }
.empty { padding: 34px 12px; text-align: center; color: var(--muted); font-size: 12px; line-height: 1.9; }

/* 徽标 */
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 20px; font-size: 10px; letter-spacing: .3px; }
.tag.ok { color: var(--ok); background: #e7eee2; }
.tag.off { color: var(--muted); background: #ece7da; }
.tag.warn { color: var(--amber); background: #f6ecd0; }
.tag.bad { color: var(--seal); background: #f8e9e2; }
.tag.live { color: #f3eddd; background: var(--pine); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* 版本卡片 */
.release { padding: 15px 18px; border-bottom: 1px solid #ebe3d1; display: grid; grid-template-columns: 108px minmax(0,1fr) auto; gap: 16px; align-items: start; }
.release:last-child { border-bottom: 0; }
.release-ver { font-family: var(--mono); font-size: 15px; letter-spacing: -.3px; }
.release-ver small { display: block; font-family: var(--sans); font-size: 10px; color: var(--muted); margin-top: 6px; letter-spacing: .4px; }
.release-body p { margin: 0 0 8px; font-size: 11.5px; line-height: 1.8; color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.release-meta { display: flex; flex-wrap: wrap; gap: 10px; font-family: var(--mono); font-size: 10px; color: var(--muted); }
.release-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }

/* 表单 */
.form-grid { display: grid; grid-template-columns: 88px minmax(0,1fr); gap: 14px 16px; align-items: start; }
.form-grid > label { padding-top: 9px; }
.form-grid > label { font-size: 11.5px; color: var(--ink-2); }
.form-grid input[type=text], .form-grid input[type=password], .form-grid select, .form-grid textarea {
  width: 100%; padding: 9px 11px; font-size: 12.5px;
  border: 1px solid var(--line); border-radius: 6px; background: #fffdf7; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.form-grid textarea { min-height: 88px; resize: vertical; line-height: 1.7; }
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus {
  border-color: #6f9e7d; box-shadow: 0 0 0 3px rgba(111,158,125,.16);
}
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
.form-actions .status { font-size: 11px; color: var(--muted); }
.file-drop {
  display: block; border: 1px dashed var(--line-2); border-radius: 7px;
  background: rgba(255,255,255,.42); padding: 13px 14px;
  font-size: 11.5px; color: var(--muted); transition: .15s; cursor: pointer;
}
.file-drop:hover { background: #fff; border-color: var(--ink-2); color: var(--ink-2); }
.file-drop.has-file { border-style: solid; border-color: #a9c2ad; background: #f1f5ec; color: var(--pine); }
.file-drop input { display: none; }

/* 版本分布条 */
.dist { display: grid; gap: 9px; }
.dist-row { display: grid; grid-template-columns: 92px minmax(0,1fr) 84px; gap: 10px; align-items: center; font-size: 11px; }
.dist-row .mono { color: var(--ink-2); }
.dist-bar { height: 7px; border-radius: 999px; background: #e7e1d2; overflow: hidden; }
.dist-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #5f9e79, #2f6f3e); }
.dist-row b { font-family: var(--mono); font-size: 11px; font-weight: 500; text-align: right; white-space: nowrap; }

/* 弹层 */
.sheet-mask { position: fixed; inset: 0; background: rgba(36,34,28,.34); display: none; z-index: 40; }
.sheet-mask.on { display: block; }
.sheet {
  position: fixed; right: 0; top: 0; bottom: 0; width: 520px; max-width: 100vw;
  background: var(--paper); border-left: 1px solid var(--line);
  box-shadow: -14px 0 40px rgba(46,40,26,.22);
  transform: translateX(100%); transition: transform .22s ease;
  z-index: 41; display: flex; flex-direction: column;
}
.sheet.on { transform: none; }
.sheet header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.sheet header h3 { margin: 0; font-size: 14px; font-weight: 500; letter-spacing: .6px; }
.sheet .body { flex: 1; overflow: auto; padding: 18px 20px; }
.sheet .close { border: 0; background: none; font-size: 18px; color: var(--muted); line-height: 1; }
.kv { display: grid; grid-template-columns: 96px minmax(0,1fr); gap: 8px 14px; font-size: 11.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.timeline { margin: 16px 0 0; padding: 0; list-style: none; border-left: 1px solid var(--line); }
.timeline li { position: relative; padding: 0 0 14px 16px; font-size: 11.5px; line-height: 1.7; }
.timeline li::before { content: ""; position: absolute; left: -3.5px; top: 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--line-2); }
.timeline li.hot::before { background: var(--pine); }
.timeline time { display: block; font-family: var(--mono); font-size: 10px; color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px);
  background: var(--pine-3); color: #f2ecdc; font-size: 12px;
  padding: 10px 18px; border-radius: 7px; opacity: 0; pointer-events: none;
  transition: .2s; z-index: 60; box-shadow: 0 10px 30px rgba(22,48,40,.32);
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: #7d2019; }

@media (max-width: 1040px) {
  .shell { grid-template-columns: 180px minmax(0,1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .release { grid-template-columns: minmax(0,1fr); }
  .release-actions { flex-direction: row; justify-content: flex-start; }
}
@media (max-width: 720px) {
  .shell { grid-template-columns: 1fr; }
  .rail { display: none; }
  .page { padding: 16px; }
  .topbar { padding: 12px 16px; }
  .form-grid { grid-template-columns: 1fr; }
}
