:root {
  --primary: #053BEE;
  --text: #0A1226;
  --muted: #667085;
  --rule: #E3E8EF;
  --bg: #F5F7FA;
  --white: #fff;
  --danger: #C0392B;
  --shadow: 0 1px 3px rgba(0, 10, 27, .08), 0 8px 24px rgba(0, 10, 27, .06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

a { color: var(--primary); }

.center-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.card {
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 32px;
  max-width: 440px;
  width: 100%;
}

.card h1 { font-size: 20px; margin: 0 0 6px; }
.card p.lead { color: var(--muted); font-size: 14px; margin: 0 0 20px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field input[type=text],
.field input[type=password],
.field input[type=email],
.field textarea {
  width: 100%;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
}
.field textarea { resize: vertical; }

.btn {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: var(--white); color: var(--text); border: 1px solid var(--rule); }
.btn.danger { background: var(--danger); }
.btn.small { padding: 6px 12px; font-size: 12.5px; }

.error-msg {
  background: #FDECEA;
  color: var(--danger);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 16px;
}
.notice-msg {
  background: #E7F0FF;
  color: var(--primary);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* ---------- Admin shell ---------- */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
}
.topbar .brand { font-weight: 700; color: var(--text); text-decoration: none; }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: 13px; color: var(--muted); }

.wrap { max-width: 980px; margin: 0 auto; padding: 28px 24px; }

table.simple { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; }
table.simple th, table.simple td { text-align: left; padding: 10px 14px; border-bottom: 1px solid #f0f2f7; font-size: 13.5px; }
table.simple th { background: var(--bg); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
table.simple tr:last-child td { border-bottom: none; }

.panel { background: #fff; border: 1px solid var(--rule); border-radius: 12px; padding: 20px 22px; box-shadow: var(--shadow); margin-bottom: 20px; }
.panel h2 { font-size: 16px; margin: 0 0 14px; }

.pill { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: #eef0f4; color: #5b6474; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ---------- Document chrome (iframe host) ---------- */
.doc-topbar {
  background: #0a1226;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  font-size: 13px;
  flex-wrap: wrap;
}
.doc-topbar .title { font-weight: 700; }
.doc-topbar .spacer { flex: 1; }
.doc-topbar select, .doc-topbar button, .doc-topbar a.btn-chrome {
  font-size: 12.5px;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.08);
  color: #fff;
  padding: 6px 10px;
  cursor: pointer;
  text-decoration: none;
}
.doc-topbar .version-banner {
  background: #EB5324;
  color: #fff;
  padding: 4px 12px;
  border-radius: 999px;
  font-weight: 600;
}

.doc-body-wrap { display: flex; height: calc(100vh - 46px); }
.doc-iframe-wrap { flex: 1; min-width: 0; }
.doc-iframe-wrap iframe { width: 100%; height: 100%; border: 0; display: block; }

.comments-panel {
  width: 360px;
  max-width: 90vw;
  border-left: 1px solid var(--rule);
  background: #fff;
  display: flex;
  flex-direction: column;
  transition: margin-right .15s;
}
.comments-panel.closed { margin-right: -360px; }
.comments-panel .head { padding: 14px 16px; border-bottom: 1px solid var(--rule); font-weight: 700; display:flex; align-items:center; justify-content: space-between; }
.comments-panel .thread { flex: 1; overflow-y: auto; padding: 14px 16px; }
.comment { margin-bottom: 14px; }
.comment .meta { font-size: 11.5px; color: var(--muted); margin-bottom: 3px; }
.comment .meta .author { font-weight: 700; color: var(--text); }
.comment .body { font-size: 13.5px; white-space: pre-wrap; }
.comment .reply-link { font-size: 11.5px; cursor: pointer; }
.comment .replies { margin-left: 18px; margin-top: 8px; border-left: 2px solid var(--rule); padding-left: 12px; }
.comments-panel form.new-comment { border-top: 1px solid var(--rule); padding: 12px 16px; }
.comments-panel form.new-comment textarea { height: 64px; margin-bottom: 8px; }

@media (max-width: 720px) {
  .doc-body-wrap { flex-direction: column; height: auto; }
  .doc-iframe-wrap { height: 70vh; }
  .comments-panel { width: 100%; max-width: none; border-left: 0; border-top: 1px solid var(--rule); }
  .comments-panel.closed { margin-right: 0; display: none; }
  .card { padding: 22px; }
}
