:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --nav: #111820;
  --nav-soft: #1d2833;
  --panel: #ffffff;
  --line: #e1e6ec;
  --text: #18212b;
  --muted: #6d7784;
  --accent: #0f8f8a;
  --accent-strong: #0b6f6b;
  --danger: #c24135;
  --shadow: 0 20px 50px rgb(18 28 40 / 7%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
  letter-spacing: 0;
}

body.editor-fullscreen {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

.admin-shell {
  display: grid;
  grid-template-columns: 256px minmax(0, 1fr);
  min-height: 100vh;
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 22px;
  background: var(--nav);
  color: #dbe5ee;
}

.admin-brand,
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-brand img,
.login-brand img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
}

.admin-brand strong,
.login-brand strong {
  display: block;
  font-size: 18px;
}

.admin-brand small,
.login-brand small {
  display: block;
  margin-top: 4px;
  color: #8fa0af;
  font-size: 12px;
}

.admin-nav nav {
  display: grid;
  gap: 6px;
}

.admin-nav nav a,
.admin-nav-footer a {
  display: block;
  padding: 11px 12px;
  border-radius: 8px;
  color: #aab7c4;
  font-size: 14px;
}

.admin-nav nav a.active,
.admin-nav nav a:hover,
.admin-nav-footer a:hover {
  background: var(--nav-soft);
  color: #ffffff;
}

.admin-nav-footer {
  display: grid;
  gap: 6px;
  margin-top: auto;
}

.admin-main {
  min-width: 0;
  padding: 28px;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.admin-topbar h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
}

.admin-topbar p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.button,
button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
}

.button.primary,
button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.button.primary:hover,
button.primary:hover {
  background: var(--accent-strong);
}

.notice,
.alert {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
}

.notice {
  background: #e3f6f3;
  color: #0c6964;
}

.alert {
  background: #fff0ec;
  color: var(--danger);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stats-grid article,
.admin-panel,
.media-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.stats-grid article {
  display: grid;
  gap: 8px;
  padding: 18px;
}

.stats-grid span {
  color: var(--muted);
  font-size: 13px;
}

.stats-grid strong {
  font-size: 32px;
  line-height: 1;
}

.admin-panel {
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.panel-head h2,
.admin-panel h2 {
  margin: 0;
  font-size: 18px;
}

.panel-head a {
  color: var(--accent);
  font-size: 14px;
}

.content-table {
  width: 100%;
  border-collapse: collapse;
}

.content-table th,
.content-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

.content-table th {
  color: var(--muted);
  font-weight: 600;
}

.content-table td strong {
  display: block;
  margin-bottom: 4px;
}

.content-table td small,
.muted {
  color: var(--muted);
}

.page-title-cell {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.page-title-cell.is-child {
  padding-left: 18px;
}

.child-page-marker {
  flex: 0 0 auto;
  width: 16px;
  color: var(--muted);
  line-height: 1.35;
  text-align: center;
}

.child-page-row td:first-child {
  background: #f8fafc;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 9px;
  background: #eef2f5;
  color: var(--muted);
  font-size: 12px;
}

.status.published {
  background: #e3f6f3;
  color: #0c6964;
}

.status.pending {
  background: #fff5df;
  color: #926300;
}

.status.hidden {
  margin-left: 6px;
  background: #f3e6e6;
  color: #9a3b32;
}

.state-form,
.inline-cat-form,
.inline-menu-form {
  margin: 0;
}

.inline-cat-form input,
.inline-cat-form select,
.inline-menu-form input,
.inline-menu-form select {
  width: 100%;
  min-width: 120px;
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.inline-menu-form {
  display: grid;
  grid-template-columns: minmax(112px, 0.9fr) minmax(132px, 1.1fr) 72px;
  gap: 6px;
  align-items: center;
}

.inline-menu-form input {
  min-width: 64px;
}

.inline-pin-form {
  margin: 0;
}

.pin-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  cursor: pointer;
}

.pin-toggle input {
  width: auto;
  min-width: 0;
  min-height: 0;
}

.state-select {
  min-height: 32px;
  padding: 0 26px 0 10px;
  border-radius: 999px;
  font-size: 13px;
}

.state-select.state-published {
  border-color: #b6e3da;
  background: #e3f6f3;
  color: #0c6964;
}

.state-select.state-draft {
  border-color: var(--line);
  background: #eef2f5;
  color: var(--muted);
}

.state-select.state-private {
  border-color: #e6c9a8;
  background: #fbeeda;
  color: #8a5a16;
}

.cover-field {
  display: grid;
  gap: 6px;
}

.cover-label {
  font-size: 13px;
  color: var(--muted);
}

.cover-preview {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #eef2f5;
}

.cover-preview img {
  display: block;
  width: 100%;
  max-height: 160px;
  object-fit: contain;
}

.cover-actions {
  display: flex;
  gap: 8px;
}

.cover-actions .button {
  min-height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

.cover-hint {
  color: var(--muted);
}

.cover-picker .editor-media-grid {
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  max-height: 220px;
}

.status.approved {
  background: #e3f6f3;
  color: #0c6964;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.table-actions a {
  color: var(--accent);
}

.table-actions a.delete-link {
  color: var(--danger);
}

.table-actions form {
  display: inline;
}

.table-actions button {
  min-height: 0;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--danger);
}

.delete-confirm-panel {
  max-width: 720px;
}

.delete-confirm-panel h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

.delete-confirm-panel strong {
  font-size: 18px;
}

.delete-confirm-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-table-scroll {
  overflow-x: auto;
}

.user-table input,
.user-table select {
  width: 100%;
  min-width: 88px;
  min-height: 32px;
  padding: 0 8px;
  font-size: 13px;
}

.user-table .user-notes input {
  min-width: 120px;
}

.perm-inline {
  display: grid;
  gap: 2px;
  min-width: 150px;
}

.perm-inline label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.perm-inline input {
  width: auto;
  min-width: 0;
  min-height: 0;
}

.table-actions button.user-save {
  min-height: 32px;
  border: 1px solid var(--accent);
  padding: 0 12px;
  background: var(--accent);
  color: #ffffff;
}

.table-actions button.user-save:hover {
  background: var(--accent-strong);
}

.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.form-panel,
.editor-main,
.editor-side,
.settings-form {
  display: grid;
  gap: 14px;
}

.editor-side-section {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  outline: 0;
  background: #ffffff;
  color: var(--text);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(15 143 138 / 12%);
}

textarea {
  resize: vertical;
}

.code-area {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.65;
}

.markdown-workbench {
  display: grid;
  gap: 12px;
}

.editor-layout[data-content-mode="link"] .markdown-workbench,
.editor-layout[data-content-mode="link"] [data-markdown-field],
.editor-layout[data-content-mode="none"] .markdown-workbench,
.editor-layout[data-content-mode="none"] [data-markdown-field],
.editor-layout[data-content-mode="none"] [data-link-field],
.editor-layout[data-content-mode="markdown"] [data-link-field],
.editor-layout[data-content-mode="html"] [data-link-field] {
  display: none;
}

.markdown-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.markdown-toolbar h2 {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.mode-switch {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f3f6f8;
}

.mode-switch button {
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  padding: 0 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.mode-switch button.active {
  background: #ffffff;
  color: var(--accent);
  box-shadow: 0 1px 6px rgb(18 28 40 / 8%);
}

.fullscreen-toggle[aria-pressed="true"] {
  border-color: var(--accent);
  background: #e8f6f4;
  color: var(--accent);
}

.markdown-workbench.is-fullscreen {
  position: fixed;
  inset: 14px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgb(18 28 40 / 22%);
}

.markdown-workbench.is-fullscreen .markdown-toolbar {
  flex: 0 0 auto;
}

.markdown-workbench.is-fullscreen .editor-media-drawer {
  flex: 0 0 auto;
  max-height: 28vh;
  overflow: hidden;
}

.markdown-workbench.is-fullscreen .editor-media-grid {
  max-height: 20vh;
}

.markdown-workbench.is-fullscreen .markdown-grid {
  flex: 1 1 auto;
  min-height: 0;
}

.markdown-workbench.is-fullscreen .markdown-toc-panel,
.markdown-workbench.is-fullscreen .markdown-source-pane,
.markdown-workbench.is-fullscreen .markdown-preview-pane {
  min-height: 0;
}

.markdown-workbench.is-fullscreen .markdown-source-pane,
.markdown-workbench.is-fullscreen .markdown-preview-pane {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.markdown-workbench.is-fullscreen[data-mode="source"] .markdown-preview-pane,
.markdown-workbench.is-fullscreen[data-mode="preview"] .markdown-source-pane {
  display: none;
}

.markdown-workbench.is-fullscreen .source-code-shell,
.markdown-workbench.is-fullscreen .markdown-preview {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
}

.editor-media-drawer {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.editor-media-drawer[hidden] {
  display: none;
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.drawer-head strong {
  font-size: 14px;
}

.editor-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(138px, 1fr));
  gap: 10px;
  max-height: 270px;
  overflow: auto;
}

.editor-media-item {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.editor-media-item img,
.editor-media-item video {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  object-fit: cover;
  background: #eef2f5;
}

.editor-media-item strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-media-item .button {
  min-height: 30px;
  font-size: 12px;
}

.markdown-grid {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  min-height: 610px;
}

.markdown-workbench[data-mode="source"] .markdown-grid {
  grid-template-columns: 180px minmax(0, 1fr);
}

.markdown-workbench[data-mode="preview"] .markdown-grid {
  grid-template-columns: 180px minmax(0, 1fr);
}

.markdown-workbench[data-mode="source"] .markdown-preview-pane,
.markdown-workbench[data-mode="preview"] .markdown-source-pane {
  display: none;
}

.markdown-toc-panel,
.markdown-source-pane,
.markdown-preview-pane {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.markdown-toc-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.markdown-toc-panel h3,
.pane-head {
  margin: 0;
  border-bottom: 1px solid var(--line);
  background: #f8fafb;
}

.markdown-toc-panel h3 {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
}

.markdown-toc {
  display: grid;
  align-content: start;
  gap: 3px;
  overflow: auto;
  padding: 8px;
}

.markdown-toc button {
  min-height: 28px;
  border: 0;
  border-radius: 6px;
  padding: 4px 7px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-align: left;
}

.markdown-toc button:hover,
.markdown-toc button.active {
  background: #e8f6f4;
  color: var(--accent);
}

.markdown-toc .toc-empty {
  padding: 7px;
  color: var(--muted);
  font-size: 12px;
}

.pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 39px;
  padding: 0 12px;
}

.pane-head strong {
  color: var(--text);
  font-size: 13px;
}

.pane-head span {
  color: var(--muted);
  font-size: 12px;
}

.pane-head .source-tools {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.html-convert-btn {
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

.html-convert-btn[hidden] {
  display: none;
}

.source-code-shell {
  position: relative;
  height: 570px;
  overflow: hidden;
  border-radius: 0 0 8px 8px;
  background: #fbfcfd;
}

.markdown-source,
.markdown-highlight {
  position: absolute;
  inset: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  padding: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.65;
  tab-size: 2;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.markdown-highlight {
  overflow: hidden;
  color: #1f2933;
  pointer-events: none;
}

.markdown-source {
  resize: none;
  background: transparent;
  color: transparent;
  caret-color: var(--text);
  overflow: auto;
}

.markdown-source::selection {
  background: rgb(15 143 138 / 20%);
}

.md-heading {
  color: #0b6f6b;
  font-weight: 800;
}

.md-strong {
  color: #111820;
  font-weight: 800;
}

.md-em {
  color: #7258b7;
  font-style: italic;
}

.md-code {
  color: #a34517;
}

.md-link {
  color: #0b78b6;
}

.md-math {
  color: #0f766e;
  font-weight: 700;
}

.md-list,
.md-quote,
.md-rule {
  color: #788491;
}

.markdown-preview {
  height: 570px;
  overflow: auto;
  padding: 18px 22px;
  border-radius: 0 0 8px 8px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.78;
}

.markdown-preview h1,
.markdown-preview h2,
.markdown-preview h3,
.markdown-preview h4 {
  scroll-margin-top: 18px;
}

.markdown-preview p,
.markdown-preview ul,
.markdown-preview ol,
.markdown-preview blockquote,
.markdown-preview pre {
  margin-bottom: 1em;
}

.markdown-preview blockquote {
  margin-left: 0;
  border-left: 3px solid var(--accent);
  padding-left: 12px;
  color: var(--muted);
}

.markdown-preview code {
  border-radius: 5px;
  padding: 2px 5px;
  background: #eef2f5;
  color: #a34517;
}

.markdown-preview pre {
  overflow: auto;
  border-radius: 8px;
  padding: 14px;
  background: #111820;
  color: #e7eef4;
}

.markdown-preview pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.markdown-preview .MathJax,
.markdown-preview mjx-container {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
}

.markdown-preview table {
  width: 100%;
  border-collapse: collapse;
}

.markdown-preview img,
.markdown-preview video {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 10px 0 16px;
  border-radius: 8px;
  background: #eef2f5;
}

.markdown-preview iframe,
.embedded-inline-frame iframe {
  display: block;
  max-width: 100%;
  margin: 12px 0 16px;
  border-radius: 8px;
  background: #eef2f5;
}

.embedded-inline-frame {
  display: block;
  max-width: 100%;
}

.markdown-preview th,
.markdown-preview td {
  border: 1px solid var(--line);
  padding: 8px;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.checkbox input {
  width: auto;
}

.split-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 18px;
}

.term-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.term-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.term-edit {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.term-edit .term-type {
  flex: none;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef2f5;
  color: var(--muted);
  font-size: 12px;
}

.term-edit input[name="name"] {
  flex: 1;
  min-width: 0;
}

.term-edit .term-count {
  flex: none;
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.button.danger,
button.danger {
  border-color: var(--danger);
  color: var(--danger);
  background: #ffffff;
}

.button.danger:hover,
button.danger:hover {
  background: var(--danger);
  color: #ffffff;
}

.upload-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 260px) auto;
  gap: 10px;
  margin-top: 14px;
}

.template-fields {
  display: flex;
  align-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  background: #fbfcfd;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.4;
}

.template-upload-row {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 360px) auto;
}

.halo-import-panel {
  margin-bottom: 18px;
}

.halo-upload-row {
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px) auto;
}

.users-list-head {
  align-items: flex-start;
}

.admin-search-form {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  min-width: min(100%, 440px);
}

.admin-search-form input {
  width: min(100%, 260px);
}

.admin-search-form .button,
.admin-search-form button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.comments-panel {
  overflow-x: auto;
}

.comments-table .comment-content {
  max-width: 460px;
  color: var(--text);
  line-height: 1.55;
  white-space: pre-wrap;
}

.user-template-panel,
.users-panel {
  margin-bottom: 18px;
}

.users-panel {
  overflow-x: auto;
}

.user-table td:first-child {
  width: 72px;
  color: var(--muted);
}

.user-table .user-notes {
  min-width: 160px;
  max-width: 260px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.role-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 9px;
  background: #eef2f5;
  color: var(--muted);
  font-size: 12px;
}

.role-pill.admin {
  background: #e8f1fb;
  color: #246aa5;
}

.role-pill.super_admin {
  background: #e3f6f3;
  color: #0c6964;
}

.user-form {
  max-width: 640px;
}

.profile-password-section {
  display: grid;
  gap: 14px;
  margin-top: 4px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.permissions-field {
  display: grid;
  gap: 10px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.permissions-field legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.permissions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.form-actions .button {
  display: inline-flex;
  align-items: center;
}

.media-cleanup {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.media-cleanup .panel-head {
  margin-bottom: 0;
}

.unused-media-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.unused-media-list span {
  padding: 7px 9px;
  border-radius: 999px;
  background: #eef2f5;
  color: var(--text);
  font-size: 13px;
}

.unused-media-list em {
  color: var(--muted);
  font-style: normal;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.media-grid article {
  display: grid;
  gap: 9px;
  padding: 12px;
}

.media-grid img,
.media-grid video,
.file-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  object-fit: cover;
  background: #eef2f5;
}

.media-path-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.media-grid code {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--accent);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-btn {
  flex: none;
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

.copy-btn.copied {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.media-grid small {
  color: var(--muted);
}

.login-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 20px;
}

.login-card {
  display: grid;
  gap: 18px;
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-card form {
  display: grid;
  gap: 14px;
}

.login-card button {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

@media (max-width: 980px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-nav {
    position: static;
  }

  .admin-nav nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .editor-layout,
  .split-layout,
  .upload-row,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .markdown-workbench.is-fullscreen {
    inset: 0;
    border-radius: 0;
    padding: 10px;
  }

  .markdown-workbench.is-fullscreen .markdown-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .markdown-workbench.is-fullscreen[data-mode="split"] .markdown-grid {
    grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  }

  .markdown-workbench.is-fullscreen .markdown-toc-panel {
    display: none;
  }
}

/* 列表分页控件 */
.list-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin: 12px 0;
}
.list-pager .per-page-form {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}
.list-pager .per-page-form label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}
.list-pager .per-page-form select {
  width: auto;
  padding: 4px 8px;
}
.list-pager .pager-info {
  color: #888;
  font-size: 13px;
}
.list-pager .pager-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.list-pager .pager-nav .button {
  padding: 4px 10px;
  min-width: 32px;
  text-align: center;
}
