/* 渐读 文章管理 — black/white/gray minimal direction */
:root {
  --bg: #ffffff;
  --side: #f7f7f7;
  --ink: #171717;
  --muted: #737373;
  --line: #e5e5e5;
  --ok: #137333;
  --warn: #b26a00;
  --bad: #b3261e;
  --radius: 8px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.55;
}
button, input, select, textarea { font: inherit; color: inherit; }

#topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px; border-bottom: 1px solid var(--line);
}
.brand { font-weight: 600; }
.stats { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 2px 10px; color: var(--muted); font-size: 12px; white-space: nowrap;
}
.chip b { color: var(--ink); font-weight: 600; }

#layout { display: flex; height: calc(100% - 49px); }
#side {
  width: 168px; padding: 16px 10px; background: var(--side);
  border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px;
}
.nav-item {
  text-align: left; padding: 8px 12px; border: 0; background: transparent;
  border-radius: var(--radius); cursor: pointer; color: var(--ink);
}
.nav-item:hover { background: #efefef; }
.nav-item.active { background: var(--bg); border: 1px solid var(--line); font-weight: 600; }

#center {
  width: 460px; min-width: 360px; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 16px; gap: 12px;
}
#list-head { display: flex; gap: 8px; align-items: center; }
#search { flex: 1; }
input[type="search"], input[type="text"], input[type="password"], select, textarea {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 7px 10px; background: var(--bg); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: #b8b8b8; }
input:disabled, button:disabled { opacity: .55; cursor: not-allowed; }

.list { flex: 1; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.row {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer;
}
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--side); }
.row.selected { background: var(--side); box-shadow: inset 2px 0 0 var(--ink); }
.row .title { font-weight: 600; }
.row .sub { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.row .num { font-variant-numeric: tabular-nums; }

#pager { display: flex; align-items: center; gap: 10px; justify-content: space-between; }

#detail { flex: 1; padding: 16px; overflow: auto; }
.empty { color: var(--muted); padding: 40px 0; text-align: center; }

.btn {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 7px 14px; background: var(--bg); cursor: pointer;
}
.btn:hover { background: var(--side); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #333; }
.btn.ghost { border-color: transparent; color: var(--muted); }
.btn.danger { color: var(--bad); border-color: #ecc8c4; }
.btn.small { padding: 3px 10px; font-size: 12px; }

.detail-head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.detail-head h2 { margin: 0; font-size: 18px; flex: 1; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 14px 0 12px; }
.tab {
  padding: 6px 12px; border: 0; background: none; cursor: pointer;
  color: var(--muted); border-bottom: 2px solid transparent;
}
.tab.active { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }

.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; word-break: break-all; }

.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: #bbb; display: inline-block; }
.status.ok .dot { background: var(--ok); }
.status.warn .dot { background: var(--warn); }
.status.bad .dot { background: var(--bad); }
.status.ok { color: var(--ok); }
.status.warn { color: var(--warn); }
.status.bad { color: var(--bad); }

.banner {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; margin: 10px 0; display: flex; gap: 10px; align-items: center;
}
.banner.bad { border-color: #ecc8c4; background: #fdf6f5; }
.banner.warn { border-color: #eedfbd; background: #fffaf0; }
.banner .msg { flex: 1; }

.editor { width: 100%; min-height: 320px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; resize: vertical; }
.field-error { color: var(--bad); font-size: 12px; margin-top: 4px; }
.hint { color: var(--muted); font-size: 12px; }

.preview p { margin: 0 0 10px; }
.preview .word { border-bottom: 1px solid var(--line); padding-bottom: 1px; }

table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td {
  text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line);
  font-size: 13px; vertical-align: top;
}
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }

.overlay {
  position: fixed; inset: 0; background: rgba(255,255,255,.92);
  display: flex; align-items: center; justify-content: center; z-index: 20;
}
.overlay[hidden] { display: none; }
.auth-card {
  width: 380px; border: 1px solid var(--line); border-radius: 12px;
  padding: 24px; background: var(--bg); display: flex; flex-direction: column; gap: 12px;
}
.auth-card h1 { font-size: 17px; margin: 0; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: #fff; border-radius: 999px;
  padding: 8px 18px; font-size: 13px; opacity: 0; pointer-events: none;
  transition: opacity .2s; z-index: 30; max-width: 80vw;
}
.toast.show { opacity: 1; }

@media (max-width: 900px) {
  #layout { flex-direction: column; height: auto; }
  #side { width: 100%; flex-direction: row; border-right: 0; border-bottom: 1px solid var(--line); }
  #center { width: 100%; border-right: 0; }
  .list { overflow-x: auto; }
}
