:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --bg-soft: #f8fafc;
  --panel: #ffffff;
  --panel-soft: #f9fafb;
  --fg: #111827;
  --fg-soft: #374151;
  --muted: #6b7280;
  --muted-soft: #9ca3af;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-soft: #eff6ff;
  --accent-ring: rgba(59, 130, 246, .28);
  --success: #10b981;
  --success-soft: #ecfdf5;
  --warning: #f59e0b;
  --warning-soft: #fffbeb;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-soft: #fef2f2;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-md: 0 10px 24px rgba(15, 23, 42, .08);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

:root.dark {
  color-scheme: dark;
  --bg: #0f172a;
  --bg-soft: #111827;
  --panel: #111827;
  --panel-soft: #1f2937;
  --fg: #f9fafb;
  --fg-soft: #d1d5db;
  --muted: #9ca3af;
  --muted-soft: #6b7280;
  --line: #334155;
  --line-strong: #475569;
  --accent: #60a5fa;
  --accent-hover: #3b82f6;
  --accent-soft: rgba(59, 130, 246, .16);
  --accent-ring: rgba(96, 165, 250, .3);
  --success-soft: rgba(16, 185, 129, .14);
  --warning-soft: rgba(245, 158, 11, .14);
  --danger-soft: rgba(239, 68, 68, .14);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .25);
  --shadow-md: 0 14px 32px rgba(0, 0, 0, .26);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(59, 130, 246, .08), transparent 28rem),
    var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  letter-spacing: 0;
}

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

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: 100%;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  width: min(100%, 1320px);
  margin: 0 auto;
  padding: 24px 24px 10px;
  background: transparent;
}

h1 {
  margin: 0;
  color: var(--fg);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.25;
}

#page-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.top-actions,
.editor-actions,
.upload-row,
.inline-form {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.workspace,
.admin-layout {
  display: grid;
  width: min(100%, 1320px);
  margin: 0 auto;
  padding: 14px 24px 28px;
  gap: 16px;
}

.workspace {
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  min-height: calc(100vh - 88px);
}

.admin-layout {
  grid-template-columns: minmax(290px, 360px) minmax(0, 1fr);
  align-items: stretch;
  height: calc(100vh - 120px);
  min-height: 640px;
}

.side-panel,
.admin-sidebar,
.content-panel,
.editor-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  box-shadow: var(--shadow-sm);
}

.side-panel,
.admin-sidebar {
  position: sticky;
  top: 14px;
  display: grid;
  gap: 16px;
  padding: 16px;
}

.side-panel {
  align-self: start;
}

.admin-sidebar {
  align-self: stretch;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  overflow: hidden;
  overflow-x: hidden;
  overflow-x: clip;
}

.side-panel > *,
.admin-sidebar > *,
.admin-sidebar section {
  min-width: 0;
  max-width: 100%;
}

.content-panel,
.editor-panel {
  padding: 18px;
}

.editor-panel {
  height: 100%;
  min-height: 0;
  padding-bottom: 16px;
  overflow-y: auto;
}

.access-panel {
  display: grid;
  min-height: calc(100vh - 88px);
  place-items: start center;
  padding: 18px 24px 28px;
}

.access-panel .empty-state {
  width: min(100%, 520px);
}

.hidden {
  display: none !important;
}

.field-label,
label span,
.panel-heading {
  display: block;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .01em;
}

.panel-heading {
  margin-top: 2px;
}

.text-input {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 7px 11px;
  background: var(--panel);
  color: var(--fg);
  box-shadow: 0 1px 0 rgba(15, 23, 42, .02);
  transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}

textarea.text-input {
  min-height: 72px;
  resize: vertical;
}

.text-input::placeholder {
  color: var(--muted-soft);
}

.text-input:focus,
button:focus-visible,
.article-row:focus-visible {
  border-color: var(--accent);
  outline: 0;
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.primary-button,
.ghost-button,
.danger-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  background: var(--panel);
  color: var(--fg-soft);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: transform .12s ease, border-color .16s ease, background-color .16s ease, color .16s ease, box-shadow .16s ease;
}

.icon-button:disabled {
  border-color: var(--line);
  background: var(--panel-soft);
  color: var(--muted);
  cursor: not-allowed;
  opacity: .48;
  transform: none;
}

.icon-button:disabled:hover {
  border-color: var(--line);
}

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

.danger-button {
  border-color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 45%, var(--line));
  background: var(--danger-soft);
  color: var(--danger);
}

.icon-button {
  flex: 0 0 36px;
  width: 36px;
  padding: 0;
  font-size: 18px;
}

.primary-button:hover,
.ghost-button:hover,
.danger-button:hover,
.icon-button:hover,
.chip:hover,
.article-row:hover,
.admin-row:hover,
.related-item:hover,
.suggestion-item:hover {
  border-color: var(--accent);
}

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

.danger-button:hover {
  border-color: var(--danger-hover);
  color: var(--danger-hover);
}

.primary-button:active,
.ghost-button:active,
.danger-button:active,
.icon-button:active,
.chip:active,
.article-row:active,
.admin-row:active {
  transform: translateY(1px);
}

.search-box {
  position: relative;
}

.suggestion-list {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  display: grid;
  gap: 4px;
  max-height: 280px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-md);
}

.suggestion-item {
  display: block;
  width: 100%;
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  background: transparent;
  color: var(--fg-soft);
  text-align: left;
  cursor: pointer;
}

.suggestion-item:hover {
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.chip-list {
  display: grid;
  gap: 6px;
}

.chip,
.article-row,
.admin-row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  padding: 8px 10px 8px 12px;
  color: var(--fg-soft);
  cursor: pointer;
  text-align: left;
  box-shadow: none;
  transition: border-color .16s ease, background-color .16s ease, color .16s ease, box-shadow .16s ease;
}

.chip.active {
  border-color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
  background: var(--accent-soft);
  color: var(--accent-hover);
  box-shadow: inset 3px 0 0 var(--accent);
}

.chip-label {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 600;
}

.chip-count {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-width: 48px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.chip-count svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chip.active .chip-count {
  color: var(--accent-hover);
}

.article-list {
  display: grid;
  gap: 10px;
}

.article-row {
  display: block;
  position: relative;
  padding: 15px 16px;
  color: inherit;
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform .12s ease, border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}

.article-row:hover {
  background: var(--accent-soft);
  background: color-mix(in srgb, var(--accent-soft) 36%, var(--panel));
  box-shadow: var(--shadow-md);
}

.article-row h2 {
  margin: 0 0 7px;
  color: var(--fg);
  font-size: 16px;
  font-weight: 650;
  line-height: 1.45;
}

.article-row p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

mark {
  border-radius: 5px;
  background: #fef3c7;
  color: inherit;
  padding: 0 2px;
}

.article-detail {
  width: min(100%, 920px);
  margin: 0 auto;
  padding: 26px 30px 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  line-height: 1.75;
  box-shadow: var(--shadow-sm);
}

.article-toolbar {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 18px;
}

.article-toolbar .ghost-button {
  min-height: 32px;
  padding: 6px 10px;
}

.article-header {
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.article-detail .article-title {
  margin: 0;
  color: var(--fg);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.35;
}

.article-detail .article-body.ql-editor {
  height: auto;
  min-height: 0;
  overflow: visible;
  padding: 0;
  color: var(--fg-soft);
  font-size: 15px;
  line-height: 1.78;
}

/* Historical articles copied from light pages may carry a fixed neutral text color. */
:root.dark .article-detail .article-body.ql-editor [style*="color:rgb(68, 68, 68)"],
:root.dark .article-detail .article-body.ql-editor [style*="color:rgb(68,68,68)"],
:root.dark .article-detail .article-body.ql-editor [style*="color:#444"] {
  color: var(--fg-soft) !important;
}

.article-detail .article-body.ql-editor > * {
  cursor: auto;
}

.article-detail .article-body.ql-editor > *:first-child {
  margin-top: 0;
}

.article-detail .article-body.ql-editor > *:last-child {
  margin-bottom: 0;
}

.article-detail .article-body.ql-editor .ql-ui {
  cursor: default;
}

.article-detail .article-body.ql-editor p {
  margin: 11px 0;
}

.article-detail .article-body.ql-editor h1,
.article-detail .article-body.ql-editor h2,
.article-detail .article-body.ql-editor h3,
.article-detail .article-body.ql-editor h4 {
  margin: 26px 0 12px;
  color: var(--fg);
  font-weight: 700;
  line-height: 1.35;
}

.article-detail .article-body.ql-editor h1 {
  font-size: 25px;
}

.article-detail .article-body.ql-editor h2 {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 21px;
}

.article-detail .article-body.ql-editor h3 {
  font-size: 18px;
}

.article-detail .article-body.ql-editor h4 {
  font-size: 16px;
}

.article-detail .article-body.ql-editor strong,
.article-detail .article-body.ql-editor b {
  color: var(--fg);
  font-weight: 700;
}

.article-detail .article-body.ql-editor em {
  color: var(--muted);
}

.article-detail .article-body.ql-editor a {
  color: var(--accent-hover);
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
}

.article-detail .article-body.ql-editor a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.article-detail .article-body.ql-editor blockquote {
  position: relative;
  margin: 18px 0;
  padding: 12px 15px 12px 18px;
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--accent-soft);
  color: var(--fg-soft);
}

.article-detail .article-body.ql-editor blockquote p {
  margin: 8px 0;
}

.article-detail .article-body.ql-editor ol,
.article-detail .article-body.ql-editor ul {
  margin: 14px 0;
  padding-left: 1.55em;
}

.article-detail .article-body.ql-editor li {
  margin: 7px 0;
  padding-left: .2em;
}

.article-detail .article-body.ql-editor ol li:not([data-list]),
.article-detail .article-body.ql-editor ul li:not([data-list]) {
  padding-left: .25em;
}

.article-detail .article-body.ql-editor ol li:not([data-list]) {
  list-style-type: decimal;
}

.article-detail .article-body.ql-editor ul li:not([data-list]) {
  list-style-type: disc;
}

.article-detail .article-body.ql-editor .ql-align-center {
  text-align: center;
}

.article-detail .article-body.ql-editor .ql-align-right {
  text-align: right;
}

.article-detail .article-body.ql-editor .ql-align-justify {
  text-align: justify;
}

.article-detail .article-body.ql-editor pre,
.article-detail .article-body.ql-editor code,
.article-detail .article-body.ql-editor .ql-code-block-container {
  font-family: var(--font-mono);
}

.article-detail .article-body.ql-editor pre,
.article-detail .article-body.ql-editor .ql-code-block-container {
  margin: 16px 0;
  padding: 14px 16px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  color: var(--fg-soft);
}

.article-detail .article-body.ql-editor code {
  border-radius: 6px;
  padding: 2px 6px;
  background: var(--panel-soft);
  color: #db2777;
  font-size: .92em;
}

.article-detail .article-body.ql-editor pre code,
.article-detail .article-body.ql-editor .ql-code-block-container code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.article-detail img,
.article-detail .article-image {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 18px auto;
  vertical-align: middle;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

.article-detail .article-media-block {
  margin: 18px 0 20px;
  text-align: center;
}

.article-detail .article-media-block img {
  margin-top: 0;
  margin-bottom: 0;
}

.article-detail .article-body.ql-editor hr {
  margin: 24px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.related-section {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.related-section h2,
.related-section h3 {
  margin: 0 0 10px;
  color: var(--fg);
  font-size: 15px;
  font-weight: 650;
}

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

.related-item {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--fg-soft);
  padding: 6px 11px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
}

.seo-topbar {
  align-items: center;
  padding-bottom: 10px;
}

.seo-topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.seo-brand {
  color: var(--fg);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.25;
  text-decoration: none;
}

.seo-brand:hover {
  color: var(--accent-hover);
}

.seo-article-layout,
.seo-status-layout {
  width: min(100%, 1320px);
  margin: 0 auto;
  padding: 14px 24px 32px;
}

.seo-status-layout {
  display: grid;
  min-height: calc(100vh - 88px);
  place-items: start center;
}

.seo-status-layout .empty-state {
  width: min(100%, 560px);
}

.seo-status-layout h1 {
  margin-bottom: 8px;
}

.seo-article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.empty-state,
.loading-state {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 30px;
  text-align: center;
  color: var(--muted);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

.empty-state p {
  margin: 0 0 12px;
}

.loading-state {
  border-style: solid;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  color: var(--fg-soft);
  font-weight: 600;
}

.switch input {
  display: none;
}

.switch span {
  position: relative;
  display: block;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background-color .16s ease;
}

.switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .24);
  transition: transform .16s ease;
}

.switch input:checked + span {
  background: var(--accent);
}

.switch input:checked + span::after {
  transform: translateX(18px);
}

.admin-tools {
  display: grid;
  margin: 0;
  min-width: 0;
  max-width: 100%;
}

.admin-tools .primary-button {
  width: 100%;
  max-width: 100%;
}

.admin-list {
  display: grid;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.admin-article-section {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 8px;
  min-height: 0;
}

.admin-article-section .panel-heading {
  margin-bottom: 0;
}

#admin-articles {
  align-content: start;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-gutter: stable;
}

.group-manager {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px 36px;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.group-combobox {
  position: relative;
  min-width: 0;
}

.group-combobox .text-input {
  padding-right: 36px;
}

.group-toggle-button {
  position: absolute;
  top: 1px;
  right: 1px;
  display: grid;
  width: 34px;
  height: 34px;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  place-items: center;
}

.group-toggle-button:hover,
.group-toggle-button:focus-visible {
  background: var(--panel-soft);
  color: var(--fg);
}

.group-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  z-index: 30;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  box-shadow: var(--shadow-md);
  scrollbar-gutter: stable;
}

.group-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  background: var(--panel);
  color: var(--fg-soft);
  cursor: pointer;
  text-align: left;
}

.group-option:last-child {
  border-bottom: 0;
}

.group-option:hover,
.group-option:focus-visible,
.group-option.active {
  background: var(--accent-soft);
}

.group-option.active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.group-option-name {
  overflow: hidden;
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-option-count {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.group-option-empty {
  padding: 12px 10px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.admin-row {
  position: relative;
  min-width: 0;
  max-width: 100%;
  padding: 11px 12px;
  cursor: pointer;
  transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease, transform .12s ease;
}

.admin-row:hover {
  background: var(--accent-soft);
  background: color-mix(in srgb, var(--accent-soft) 30%, var(--panel));
}

.admin-row.active {
  border-color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.admin-row strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--fg);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-row small {
  display: block;
  min-width: 0;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.admin-meta {
  display: inline;
  min-width: 0;
  overflow-wrap: anywhere;
}

.inline-form {
  width: 100%;
  max-width: 100%;
}

.inline-form .text-input {
  flex: 1 1 auto;
  width: auto;
}

.status-tag {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  margin-right: 6px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.2;
}

.status-tag.published {
  border-color: var(--success);
  border-color: color-mix(in srgb, var(--success) 36%, var(--line));
  background: var(--success-soft);
  color: var(--success);
}

.status-tag.draft {
  border-color: var(--warning);
  border-color: color-mix(in srgb, var(--warning) 42%, var(--line));
  background: var(--warning-soft);
  color: var(--warning);
}

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

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

.article-form > label,
.form-grid label {
  min-width: 0;
}

#editor {
  min-height: 340px;
  background: var(--panel);
}

.ql-toolbar.ql-snow {
  border-color: var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--panel-soft);
}

.ql-container.ql-snow {
  border-color: var(--line);
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--panel);
}

.ql-editor {
  min-height: 300px;
  color: var(--fg-soft);
  font-family: var(--font-sans);
}

.ql-snow .ql-stroke {
  stroke: var(--fg-soft);
}

.ql-snow .ql-fill,
.ql-snow .ql-stroke.ql-fill {
  fill: var(--fg-soft);
}

.ql-snow .ql-picker {
  color: var(--fg-soft);
}

.ql-snow .ql-picker-options {
  border-color: var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  box-shadow: var(--shadow-md);
}

.ql-snow .ql-picker.ql-expanded .ql-picker-label {
  border-color: var(--accent);
}

.ql-toolbar.ql-snow .ql-picker.ql-expanded .ql-picker-options {
  border-color: var(--line);
}

.upload-row {
  align-items: stretch;
  padding: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.upload-row #image-upload {
  min-height: 34px;
  align-content: center;
  color: var(--muted);
  font-size: 13px;
}

.editor-actions {
  justify-content: flex-end;
  padding-top: 2px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  max-width: 380px;
  padding: 11px 14px;
  border: 1px solid transparent;
  border: 1px solid color-mix(in srgb, var(--fg) 18%, transparent);
  border-radius: var(--radius);
  background: var(--fg);
  background: color-mix(in srgb, var(--fg) 92%, transparent);
  color: var(--panel);
  box-shadow: var(--shadow-md);
  font-size: 13px;
}

@media (max-width: 960px) {
  .topbar {
    align-items: flex-start;
    padding: 20px 16px 8px;
  }

  .workspace,
  .admin-layout,
  .seo-article-layout,
  .seo-status-layout {
    display: block;
    padding: 12px 16px 22px;
  }

  .admin-layout {
    height: auto;
    min-height: 0;
  }

  .side-panel,
  .admin-sidebar {
    position: static;
    margin-bottom: 14px;
  }

  .admin-sidebar {
    height: auto;
    overflow: visible;
  }

  #admin-articles {
    max-height: min(52vh, 480px);
  }

  .content-panel,
  .editor-panel {
    padding: 14px;
  }

  .editor-panel {
    height: auto;
    padding-bottom: 14px;
    overflow: visible;
  }

  .chip-list {
    grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
  }

  .chip {
    min-height: 38px;
  }

  .form-grid,
  .upload-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .editor-actions,
  .top-actions {
    flex-wrap: wrap;
  }

  .article-detail {
    padding: 21px 18px 24px;
    box-shadow: none;
  }

  .article-detail .article-title {
    font-size: 22px;
  }

  .article-detail .article-body.ql-editor {
    font-size: 15px;
    line-height: 1.76;
  }

  .article-detail .article-body.ql-editor h1 {
    font-size: 22px;
  }

  .article-detail .article-body.ql-editor h2 {
    font-size: 19px;
  }

  .article-detail .article-body.ql-editor h3 {
    font-size: 17px;
  }

  .article-detail .article-body.ql-editor blockquote {
    padding: 12px 13px;
  }
}

@media (max-width: 560px) {
  .topbar {
    display: block;
  }

  .top-actions {
    margin-top: 12px;
  }

  h1 {
    font-size: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
