:root {
  --bg: #0b0f14;
  --panel: #0f151b;
  --panel-2: #131a21;
  --line: #222b34;
  --text: #e6eaf0;
  --muted: #7f8b98;
  --accent: #43d3a2;
  --warn: #d8b45c;
  --danger: #e06c62;
  font-family: "DM Sans", "Noto Sans SC", -apple-system, system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }

body { margin: 0; min-width: 320px; }

.hidden { display: none !important; }

.topbar {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand .mark {
  width: 30px; height: 30px; border-radius: 7px;
  background: #153c35; color: var(--accent);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700; letter-spacing: .5px;
}
.brand strong { display: block; font-size: 13px; }
.brand small { display: block; color: var(--muted); font-size: 10px; margin-top: 2px; }

.topbar-right { display: flex; align-items: center; gap: 10px; }

.pill {
  font-size: 10.5px;
  padding: 5px 9px;
  border-radius: 4px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--panel);
  cursor: pointer;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pill.ok { color: var(--accent); border-color: #1e4d3d; background: #10251e; }

.view { max-width: 1280px; margin: 0 auto; padding: 22px 20px 60px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.login-card { max-width: 380px; margin: 42px auto 0; padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.login-card h1 { margin: 0; font-size: 16px; }
.hint { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }

label { display: flex; flex-direction: column; gap: 6px; font-size: 11px; color: #9aa6b2; }

input, select, textarea {
  font: inherit;
  font-size: 12px;
  color: var(--text);
  background: #0c1218;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 8px 10px;
  outline: none;
  width: 100%;
  resize: vertical;
}
input:focus, select:focus, textarea:focus { border-color: #2f6f5c; }
textarea { font-family: inherit; line-height: 1.65; }

button {
  font: inherit;
  font-size: 11.5px;
  border-radius: 5px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
}
button:disabled { opacity: .55; cursor: not-allowed; }
button.primary { background: #14453a; border-color: #1e5c4a; color: #a8efd4; }
button.primary:hover:not(:disabled) { background: #17564a; }
button.ghost:hover { border-color: #34414d; }
button.tiny { padding: 4px 8px; font-size: 10.5px; }
button.danger { color: #f0a49c; border-color: #4a2724; background: #1e1211; }
button.danger:hover { background: #2a1614; }

.error { color: #f0a49c; font-size: 11px; min-height: 15px; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.toolbar-left { display: flex; align-items: baseline; gap: 10px; }
.toolbar-left h2 { margin: 0; font-size: 15px; }
.toolbar-right { display: flex; align-items: center; gap: 8px; }
.toolbar-right select { width: 130px; }
.muted { color: var(--muted); font-size: 10.5px; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 14px; align-items: start; }
@media (max-width: 1080px) { .layout { grid-template-columns: 1fr; } }

.list-wrap { padding: 4px 4px 10px; overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
thead th {
  text-align: left;
  font-weight: 500;
  color: #6b7684;
  font-size: 10px;
  padding: 10px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td { padding: 10px; border-bottom: 1px solid #171f26; vertical-align: top; }
tbody tr:hover { background: #11171e; }
td strong { display: block; font-weight: 500; font-size: 12px; line-height: 1.4; }
td small { display: block; color: #5f6a76; font-size: 10px; margin-top: 3px; line-height: 1.5; max-width: 420px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.time { color: #6b7684; font-size: 10px; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.actions, th.actions { white-space: nowrap; display: flex; gap: 6px; }

.tag { font-size: 9.5px; padding: 2px 7px; border-radius: 3px; border: 1px solid var(--line); color: var(--muted); background: var(--panel-2); white-space: nowrap; }
.tag.published { color: var(--accent); border-color: #1e4d3d; background: #10251e; }
.tag.draft { color: #9aa6b2; }
.tag.size-large { color: var(--accent); border-color: #1e4d3d; }
.tag.size-medium { color: var(--warn); border-color: #4a3d1d; }
.tag.size-small { color: #8e9aa6; }

.empty { color: var(--muted); font-size: 11.5px; padding: 26px 14px; text-align: center; margin: 0; }

.side { display: flex; flex-direction: column; gap: 14px; }

.editor { padding: 16px; display: flex; flex-direction: column; gap: 12px; position: sticky; top: 74px; }
.editor h3, .audit h3 { margin: 0; font-size: 12.5px; }
.editor .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.actions-row { align-items: end; }
.actions-row button { width: 100%; }

.audit { padding: 14px 16px 16px; }
.audit ul { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 7px; max-height: 220px; overflow: auto; }
.audit li { display: flex; align-items: center; gap: 8px; font-size: 10.5px; color: var(--muted); }
.audit .action { color: #8fbfae; min-width: 62px; }
.audit .detail { flex: 1; color: #9aa6b2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit time { color: #4f5963; font-size: 9.5px; white-space: nowrap; }

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: #14332b;
  border: 1px solid #1e5c4a;
  color: #b7f0dc;
  font-size: 11.5px;
  padding: 9px 16px;
  border-radius: 5px;
  z-index: 50;
}
.toast.error { background: #2a1614; border-color: #4a2724; color: #f0a49c; }
