:root {
  --brand: #e74246;
  --brand-hover: #cf3a3e;
  --brand-soft: rgba(231, 66, 70, 0.12);
  --sidebar-bg: #0f1419;
  --sidebar-border: rgba(255, 255, 255, 0.06);
  --sidebar-text: rgba(255, 255, 255, 0.62);
  --sidebar-text-active: #fff;
  --sidebar-hover: rgba(255, 255, 255, 0.05);
  --sidebar-active: rgba(231, 66, 70, 0.18);
  --page-bg: #eef1f6;
  --surface: #fff;
  --surface-2: #f8fafc;
  --border: #e5e9f0;
  --border-light: #f0f3f8;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.12);
  --radius: 10px;
  --radius-lg: 14px;
  --sidebar-w: 248px;
  --sidebar-w-collapsed: 68px;
  --topbar-h: 64px;
  --font: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Segoe UI', 'Helvetica Neue', sans-serif;
}

* { box-sizing: border-box; }

html[data-theme='dark'] {
  --brand-soft: rgba(231, 66, 70, 0.2);
  --page-bg: #0b1120;
  --surface: #111827;
  --surface-2: #172033;
  --border: #263248;
  --border-light: #1f2937;
  --text: #e5e7eb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --shadow-sm: none;
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.24);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.32);
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--page-bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Login ── */
.login-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.login-brand {
  background: linear-gradient(145deg, #0f1419 0%, #1a2332 50%, #2d1f24 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  position: relative;
  overflow: hidden;
}

.login-brand::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 80%, rgba(231, 66, 70, 0.25), transparent),
    radial-gradient(ellipse 60% 50% at 80% 20%, rgba(99, 102, 241, 0.12), transparent);
  pointer-events: none;
}

.login-brand-inner {
  position: relative;
  max-width: 400px;
}

.login-brand-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--brand), #ff6b6b);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 28px;
  box-shadow: 0 8px 24px rgba(231, 66, 70, 0.35);
}

.login-brand h1 {
  font-size: 32px;
  font-weight: 700;
  margin: 0 0 12px;
  letter-spacing: -0.02em;
}

.login-brand p {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.65);
  margin: 0 0 32px;
  line-height: 1.6;
}

.login-features {
  list-style: none;
  margin: 0;
  padding: 0;
}

.login-features li {
  padding: 10px 0 10px 28px;
  position: relative;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.75);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.login-features li:last-child { border-bottom: none; }

.login-features li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
}

.login-form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
  background: var(--page-bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 40px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.login-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.login-sub {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 32px;
}

.login-hint { margin-top: 20px; line-height: 1.6; }

.login-extra {
  margin-top: 16px;
  text-align: center;
}

.link-btn {
  border: none;
  background: none;
  color: var(--brand);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
}

.link-btn:hover { text-decoration: underline; }

.recover-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.recover-tab {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
}

.recover-tab.active {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-soft);
}

.recover-code-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.recover-code-row input { min-width: 0; }

.success {
  margin-top: 12px;
  color: #15803d;
  font-size: 13px;
  line-height: 1.5;
}

/* ── Forms ── */
.field { margin-bottom: 18px; }

.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.field input,
.field select,
.field textarea,
select,
input[type="text"],
input[type="number"],
input[type="password"],
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
select:focus,
input:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.field textarea { min-height: 100px; resize: vertical; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.btn-primary:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
}

.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: var(--surface-2);
  border-color: #cbd5e1;
}

/* Action colors are shared by lists, toolbars and dialogs. Keep labels visible
   so the meaning never depends on color alone. Override legacy page colors. */
.btn {
  --action-bg: #1d4ed8;
  --action-hover: #1e40af;
  background: var(--action-bg) !important;
  border-color: var(--action-bg) !important;
  color: #fff !important;
  box-shadow: 0 1px 2px #0f172a1a;
}
.btn:is(.review-action-publish, .review-green, .release-green,
  [data-review-action="approve"], [data-review-action="publish"], [data-review-action="comment-restore"],
  [data-op="batch-approve"], [data-op="batch-publish"], [data-approve], [data-approve-wd], [data-publish],
  [data-user-status][data-status="active"], [data-form-status][data-status="done"],
  #auditDetailApprove, #btnCommentApproveSelected, #legalAdvisorModalComplete),
#ops-batch:has([name="reason"]) button[type="submit"],
#ops-batch:has([name="channelMode"]) button[type="submit"],
#ops-publish button[type="submit"] {
  --action-bg: #15803d;
  --action-hover: #166534;
}
.btn:is(.btn-danger, .review-action-offline, .release-red,
  [data-review-action="reject"], [data-review-action="offline"], [data-review-action="comment-hide"],
  [data-reject], [data-reject-wd], [data-offline], [data-hide], [data-hide-report],
  [data-delete], [data-remove], [data-del-ad], [data-admin-user-del], [data-user-status][data-status="banned"],
  #auditDetailReject, #btnCommentRejectSelected, #btnCommentHideSelected, #btnCrawlDisablePurge) {
  --action-bg: #b91c1c;
  --action-hover: #991b1b;
}
.btn:is([data-review-action="defer"], [data-review-action="settings-prompt-reset"],
  [data-op="restore"], [data-op="restore-confirm"]) {
  --action-bg: #b45309;
  --action-hover: #92400e;
}
.btn:is([data-op="pin"], [data-pin]), #ops-pin button[type="submit"] {
  --action-bg: #7e22ce;
  --action-hover: #6b21a8;
}
.btn:is([data-review-action="close"], [data-review-action="reset"],
  [data-review-action="previous"], [data-review-action="next"],
  [data-review-action$="-previous"], [data-review-action$="-next"],
  [data-review-action^="segments-scroll-"], [data-op="close"], [data-op="clear-selection"],
  [data-op="prev"], [data-op="next"], [data-release-action="close"],
  [data-release-action="previous"], [data-release-action="next"],
  #articleEditCancel, #formModalCancel, #legalAdvisorModalCancel, #auditDetailClose,
  #adminUserModalCancel, #pwdCancel, #uiDialogCancel) {
  --action-bg: #475569;
  --action-hover: #334155;
}
.btn:hover:not(:disabled) {
  background: var(--action-hover) !important;
  border-color: var(--action-hover) !important;
  box-shadow: 0 2px 5px #0f172a26;
}
.btn:focus-visible { outline: 3px solid #2563eb; outline-offset: 3px; }
.btn:disabled { opacity: .45 !important; cursor: not-allowed; box-shadow: none; }
html[data-theme="dark"] .btn { border-color: color-mix(in srgb, var(--action-bg), #fff 30%) !important; }
html[data-theme="dark"] .btn:focus-visible { outline-color: #93c5fd; }

/* Status tabs retain their selected state while using the same action colors. */
.review-tab { --tab-color: #1d4ed8; }
.review-tab:is([data-id="normal"], [data-id="published"]) { --tab-color: #15803d; }
.review-tab:is([data-id="failed"], [data-id="rejected"]) { --tab-color: #b91c1c; }
.review-tab[data-id="draft"] { --tab-color: #64748b; }
.review-tab[data-id="ready"] { --tab-color: #b45309; }
.review-tab[data-id="offline"] { --tab-color: #475569; }
.review-tab[data-id="deferred"] { --tab-color: #b45309; }
.review-tab {
  background: color-mix(in srgb, var(--tab-color) 9%, #fff) !important;
  color: var(--tab-color) !important;
  border-color: color-mix(in srgb, var(--tab-color) 40%, #fff) !important;
  font-weight: 600;
}
.review-tab:hover { background: color-mix(in srgb, var(--tab-color) 17%, #fff) !important; }
.review-tab.selected { background: var(--tab-color) !important; color: #fff !important; border-color: var(--tab-color) !important; }
html[data-theme="dark"] .review-tab:not(.selected) {
  background: color-mix(in srgb, var(--tab-color) 25%, #111827) !important;
  color: color-mix(in srgb, var(--tab-color) 30%, #fff) !important;
}
html[data-theme="dark"] .review-tab:not(.selected):hover { background: color-mix(in srgb, var(--tab-color) 45%, #111827) !important; }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.error { color: var(--brand); font-size: 13px; margin-top: 10px; }

/* ── App shell ── */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--page-bg);
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: #fff;
  flex-shrink: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--sidebar-border);
  transition: width 0.22s ease;
  overflow: hidden;
}

.sidebar.collapsed {
  width: var(--sidebar-w-collapsed);
}

.sidebar.collapsed .brand-text,
.sidebar.collapsed .user-meta {
  display: none;
}

.sidebar.collapsed .sidebar-brand,
.sidebar.collapsed .sidebar-user {
  justify-content: center;
  padding-left: 12px;
  padding-right: 12px;
}

.sidebar.collapsed .nav-group-label {
  height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  opacity: 0;
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 9px;
  gap: 0;
  font-size: 0;
}

.sidebar.collapsed .nav-icon {
  margin: 0;
}

.sidebar.collapsed .sidebar-nav {
  padding: 12px 8px;
}

.sidebar.collapsed .sidebar-foot {
  padding: 10px 8px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--sidebar-border);
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), #ff6b6b);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  flex-shrink: 0;
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 2px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--sidebar-border);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.user-meta { min-width: 0; flex: 1; }

.user-badge {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.nav-group { margin-bottom: 4px; }
.nav-group.hidden { display: none; }

.nav-tree-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 10px 12px;
  font-size: 11px;
  color: #8f9baa;
}

.nav-collapse-all {
  padding: 4px 6px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #b5c0ce;
  font: inherit;
  cursor: pointer;
}

.nav-collapse-all:hover { background: var(--sidebar-hover); color: #fff; }

.nav-group-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0;
  min-height: 42px;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #b8c3d0;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, color 0.12s;
}

.nav-group-toggle:hover {
  background: var(--sidebar-hover);
}

.nav-group-toggle:hover { color: #fff; }

.nav-group-toggle:focus-visible,
.nav-collapse-all:focus-visible,
.sidebar-nav .nav-item:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: -2px;
}

.nav-group-label {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  color: inherit;
  padding: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-group-chevron {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: #8f9baa;
  transition: transform 0.18s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-group-chevron svg {
  width: 14px;
  height: 14px;
  display: block;
}

.nav-group.collapsed > .nav-group-toggle .nav-group-chevron {
  transform: rotate(-90deg);
}

.nav-group-body {
  margin: 2px 0 6px 20px;
  padding: 0 0 0 10px;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.nav-group.collapsed > .nav-group-body,
.nav-group-body[hidden] {
  display: none;
}

.nav-group.has-active-page > .nav-group-toggle { color: #fff; }
.nav-group.has-active-page > .nav-group-toggle .nav-icon { color: #ff8a8d; }
.nav-group[data-nav-level="1"].has-active-page > .nav-group-toggle { background: rgba(255, 255, 255, 0.05); }

.sidebar-nav .nav-item[data-nav-level="2"] {
  position: relative;
  min-height: 36px;
  padding: 8px 10px;
  font-size: 13px;
}

.nav-item-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sidebar-nav .nav-item.active::before {
  position: absolute;
  content: '';
  left: -8px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 2px;
  background: #ff8a8d;
}

.sidebar.collapsed .nav-tree-tools,
.sidebar.collapsed .nav-group-body,
.sidebar.collapsed .nav-group-label,
.sidebar.collapsed .nav-group-chevron { display: none; }

.sidebar.collapsed .nav-group-toggle { justify-content: center; gap: 0; padding: 10px; }
.sidebar.collapsed .nav-group-toggle .nav-icon { color: #b8c3d0; }
.sidebar.collapsed .has-active-page > .nav-group-toggle .nav-icon { color: #ff8a8d; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  margin-bottom: 2px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  color: var(--sidebar-text);
  background: transparent;
  text-align: left;
  transition: background 0.12s, color 0.12s;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text-active);
}

.nav-item.active {
  background: var(--sidebar-active);
  color: #fff;
}

.nav-item.active .nav-icon { color: #ff8a8d; }

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-icon svg { width: 18px; height: 18px; display: block; }

.nav-item:hover .nav-icon { color: rgba(255, 255, 255, 0.75); }

.nav-item.hidden { display: none !important; }

.sidebar-foot {
  padding: 10px;
  border-top: 1px solid var(--sidebar-border);
}

.nav-logout {
  color: rgba(255, 138, 138, 0.85) !important;
}

.nav-logout:hover {
  background: rgba(231, 66, 70, 0.12) !important;
  color: #ff9a9d !important;
}

/* ── Main area ── */
.main-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.topbar {
  height: var(--topbar-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: visible;
}

.topbar-left {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.sidebar-toggle-btn:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: #cbd5e1;
}

.sidebar-toggle-btn svg {
  width: 18px;
  height: 18px;
  display: block;
  transition: transform 0.22s ease;
}

html[data-sidebar-collapsed="1"] .sidebar-toggle-btn svg {
  transform: rotate(180deg);
}

.topbar-left-meta {
  min-width: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

.topbar-crumb {
  margin: 0 0 2px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.topbar-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.topbar-pill {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 20px;
  line-height: 1.2;
}

.main {
  flex: 1;
  min-width: 0;
  padding: 24px 28px 32px;
  overflow-y: auto;
}

.page-title { display: none; }

#page-articles {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

#articlesListView,
#articlesEditView {
  width: 100%;
}

/* ── Cards ── */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s;
}

.card:hover { box-shadow: var(--shadow-md); }

.card-num {
  font-size: 28px;
  font-weight: 700;
  color: var(--brand);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.card-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
  font-weight: 500;
}

/* ── Panels ── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.panel h2 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 12px;
  color: var(--text);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  gap: 16px;
  flex-wrap: nowrap;
}

.panel-head h2 {
  margin: 0;
  flex-shrink: 0;
  white-space: nowrap;
}

.panel-head-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

.panel-filter-select {
  width: auto;
  min-width: 108px;
  padding: 6px 10px;
  font-size: 13px;
  flex-shrink: 0;
}

.panel-head-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 13px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Tables ── */
.table-wrap {
  overflow-x: auto;
  margin: 0 -4px;
  padding: 0 4px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th, td {
  padding: 11px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0.01em;
  background: var(--surface-2);
  white-space: nowrap;
}

th:first-child { border-radius: 8px 0 0 0; }
th:last-child { border-radius: 0 8px 0 0; }

tbody tr:hover td { background: #fafbfd; }
tbody tr:last-child td { border-bottom: none; }

.articles-table .col-title { width: auto; }
.articles-table .col-compact { width: 1%; white-space: nowrap; }
.articles-table .col-actions { width: 1%; white-space: nowrap; }

.articles-table td:nth-child(1) {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.articles-table td:nth-child(2),
.articles-table td:nth-child(3),
.articles-table td:nth-child(4),
.articles-table td:nth-child(5) {
  white-space: nowrap;
}

.articles-table td.col-actions,
.articles-table td.actions {
  white-space: nowrap;
  width: 1%;
}

/* ── Tags ── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  background: var(--surface-2);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.badge-user {
  background: #fff7ed;
  color: #c2410c;
  border-color: #fed7aa;
}

/* Status labels use a soft background, a dot and explicit text. Keep these
   non-interactive labels distinct from the solid action buttons. */
.tag, .review-badge, .release-status {
  --status-tone: #64748b;
  --status-text: #475569;
  --status-dark-text: #cbd5e1;
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  padding: 4px 10px !important;
  border-radius: 7px !important;
  border: 1px solid color-mix(in srgb, var(--status-tone) 26%, #fff) !important;
  background: color-mix(in srgb, var(--status-tone) 9%, #fff) !important;
  color: var(--status-text) !important;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  max-width: 260px;
  white-space: normal !important;
  overflow-wrap: anywhere;
  vertical-align: middle;
}
.tag::before, .review-badge::before, .release-status::before {
  content: '';
  flex: 0 0 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.tag-published, .review-badge.normal, .release-status.published {
  --status-tone: #15803d; --status-text: #166534; --status-dark-text: #86efac;
}
.tag-pending, .review-badge.pending {
  --status-tone: #2563eb; --status-text: #1d4ed8; --status-dark-text: #93c5fd;
}
.tag-warn, .review-badge.suspicious {
  --status-tone: #b45309; --status-text: #92400e; --status-dark-text: #fcd34d;
}
.tag-danger, .review-badge.high {
  --status-tone: #dc2626; --status-text: #b91c1c; --status-dark-text: #fca5a5;
}
.tag-pinned {
  --status-tone: #9333ea; --status-text: #7e22ce; --status-dark-text: #d8b4fe;
}
html[data-theme="dark"] :is(.tag, .review-badge, .release-status) {
  background: color-mix(in srgb, var(--status-tone) 20%, #111827) !important;
  border-color: color-mix(in srgb, var(--status-tone) 55%, #334155) !important;
  color: var(--status-dark-text) !important;
}
.review-status-summary { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; line-height: 1.8; }
.review-status-summary small { flex-basis: 100%; color: var(--text-secondary); }
.review-sheet td .review-badge + .review-badge { margin-left: 4px; }
.articles-table tr.row-pinned td { background: #f0fdf4; }
.pin-expiry { display:block; min-width:130px; margin-top:6px; font-size:12px; color:var(--text-muted,#64748b); }
.release-dialog.admin-role-dialog { width:min(820px,92vw); max-height:90vh; overflow:auto; }
.admin-role-dialog .perm-check-grid { margin:10px 0; }
.admin-role-dialog label:has(> input[name=enabled]) { display:flex; align-items:center; gap:8px; }
.role-description { display:block; color:var(--text-muted,#64748b); max-width:240px; white-space:normal; margin-top:6px; }
.role-modules { max-width:300px; white-space:normal; }
.content-revision-state { display:block; margin-top:6px; font-size:12px; color:var(--text-secondary); white-space:normal; min-width:130px; }
.content-empty { text-align:center; padding:36px!important; color:var(--text-secondary); }
#contentStatusTabs { margin-top:0; }
#contentSearch { width:200px; }
#page-articles .panel-head { flex-wrap:wrap; }
#page-articles .panel-head-tools { flex-wrap:wrap; }
.legal-advisor-messages {
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  background: #fafafa;
}
.legal-advisor-msg {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
}
.legal-advisor-msg.user { background: #fff; border: 1px solid #eceef2; }
.legal-advisor-msg.admin { background: #ecfdf5; border: 1px solid #bbf7d0; }
.legal-advisor-msg-meta { font-size: 11px; color: #94a3b8; }
.legal-advisor-msg-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.legal-advisor-msg-head .la-msg-delete { font-size: 11px; padding: 2px 8px; color: #dc2626; }
.legal-advisor-attach { margin-top: 6px; font-size: 12px; color: #2563eb; word-break: break-all; }

/* ── Misc ── */
.form-detail { font-size: 14px; }

.form-detail-row {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}

.form-detail-row:last-child { border-bottom: none; }

.form-detail-label { color: var(--text-muted); font-size: 13px; }
.form-detail-value { color: var(--text); white-space: pre-wrap; word-break: break-word; }

.actions {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  align-items: center;
}
.hidden { display: none !important; }

/* ── Modals ── */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  width: 520px;
  max-width: 100%;
  max-height: 90vh;
  overflow: auto;
  padding: 28px;
  box-shadow: var(--shadow-lg);
}

.modal h3 {
  margin: 0 0 20px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.modal-foot {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ── 通用对话框（替代 alert / confirm / prompt）── */
.ui-dialog-bg {
  z-index: 200;
  animation: ui-dialog-fade-in 0.18s ease;
}

.ui-dialog {
  width: 420px;
  max-width: calc(100vw - 48px);
  padding: 0;
  overflow: hidden;
  text-align: center;
  animation: ui-dialog-pop-in 0.22s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.ui-dialog-icon {
  width: 52px;
  height: 52px;
  margin: 28px auto 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ui-dialog-icon svg {
  width: 26px;
  height: 26px;
}

.ui-dialog-icon--info {
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
}

.ui-dialog-icon--success {
  background: rgba(34, 197, 94, 0.12);
  color: #16a34a;
}

.ui-dialog-icon--warn {
  background: rgba(245, 158, 11, 0.14);
  color: #d97706;
}

.ui-dialog-icon--danger {
  background: rgba(231, 66, 70, 0.12);
  color: var(--brand);
}

.ui-dialog h3 {
  margin: 16px 28px 0;
  font-size: 17px;
  font-weight: 700;
}

.ui-dialog-message {
  margin: 10px 28px 0;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
}

.ui-dialog-input {
  margin: 16px 28px 0;
  text-align: left;
}

.ui-dialog-input input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.ui-dialog-input input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.ui-dialog-foot {
  margin-top: 24px;
  padding: 16px 28px 24px;
  border-top: none;
  justify-content: center;
}

.ui-dialog-foot .btn {
  min-width: 96px;
}

.btn-danger {
  background: var(--brand);
  color: #fff;
  border: 1px solid var(--brand);
}

.btn-danger:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
}

@keyframes ui-dialog-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes ui-dialog-pop-in {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.perm-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px 12px;
  max-height: 240px;
  overflow: auto;
  padding: 10px 12px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: #fafafa;
}

.perm-check-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 13px;
  line-height: 1.4;
  cursor: pointer;
}

.perm-check-item input {
  margin-top: 3px;
}

.modal-article,
.article-edit-panel {
  width: 100%;
  max-width: none;
  max-height: none;
  padding: 24px 28px;
}

.article-edit-page {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--topbar-h) - 56px);
}

.article-edit-page .article-edit-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.article-edit-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.article-edit-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.article-edit-head .page-title {
  margin: 0;
  display: block;
  font-size: 20px;
  font-weight: 700;
}

.article-edit-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.field-body-editor {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin-bottom: 16px;
}

.field-body-editor > label {
  flex-shrink: 0;
}

.article-editor {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: min(520px, calc(100vh - 420px));
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius, 10px);
  overflow: hidden;
}

.article-editor .ql-toolbar {
  flex-shrink: 0;
  border: none;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2, #f8f9fb);
  padding: 8px 10px;
}

.article-editor .ql-container {
  flex: 1;
  border: none;
  font-size: 15px;
  line-height: 1.75;
  min-height: 0;
}

.article-editor .ql-editor {
  min-height: min(480px, calc(100vh - 460px));
  padding: 16px 18px;
}

.article-editor .ql-editor.ql-blank::before {
  color: var(--text-muted);
  font-style: normal;
}

.field-status {
  flex-shrink: 0;
}

.modal-article .field-body,
.article-edit-panel .field-body {
  margin-bottom: 12px;
}

.modal-article #editSummary,
.article-edit-panel #editSummary {
  min-height: 44px;
}

.modal-article #editCoverPreview,
.article-edit-panel #editCoverPreview {
  max-width: 280px;
  max-height: 160px;
}

.ch-enabled-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.ch-order-cell {
  white-space: nowrap;
}

.ch-order-cell .btn {
  min-width: 32px;
  padding: 4px 8px;
}

.audit-detail-body {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  min-height: 48px;
  max-height: 240px;
  overflow: auto;
  font-size: 14px;
  line-height: 1.65;
}

.audit-preview-thumb {
  width: 56px;
  height: 42px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  vertical-align: middle;
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 12px;
  line-height: 1.55;
}

.hint code {
  font-size: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--text-secondary);
}

.hint strong { color: var(--text-secondary); font-weight: 600; }

.auth-effective-box {
  margin: 10px 0 4px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  line-height: 1.7;
}

.auth-effective-box.warn {
  border-color: #fcd34d;
  background: #fffbeb;
  color: #92400e;
}

.auth-effective-box.ok {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
}

.auth-effective-box ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.feed-sort-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 320px;
  overflow: auto;
  background: var(--surface-2);
}

.feed-sort-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
  background: var(--surface);
}

.feed-sort-item:last-child { border-bottom: none; }
.feed-sort-title { flex: 1; }
.feed-sort-actions { display: flex; gap: 4px; }

/* ── Stats chart ── */
.stats-chart { margin-top: 12px; }

.stats-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 12px;
}

.stats-bar-label { width: 72px; color: var(--text-muted); flex-shrink: 0; }

.stats-bar-track {
  flex: 1;
  height: 24px;
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  overflow: hidden;
}

.stats-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff8a8d, var(--brand));
  border-radius: 5px;
  min-width: 2px;
}

.stats-bar-val { width: 48px; text-align: right; color: var(--text-secondary); flex-shrink: 0; }

.report-notify-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.report-notify-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
}
.report-notify-btn:hover { background: #f8fafc; color: var(--brand); }
.report-notify-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}
.report-notify-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  max-height: 360px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
  z-index: 120;
}
.report-notify-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.report-notify-list { padding: 6px; }
.report-notify-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}
.report-notify-item:hover { background: #f8fafc; }
.report-notify-item-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.report-notify-item-meta { margin-top: 4px; font-size: 12px; color: var(--text-secondary); }
.report-toast {
  position: fixed;
  top: 18px;
  right: 18px;
  width: 300px;
  padding: 16px;
  background: #fff;
  border: 1px solid #fecaca;
  border-left: 4px solid #ef4444;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16);
  z-index: 2000;
}
.report-toast.hidden { display: none; }
.report-toast-title { font-size: 15px; font-weight: 700; color: #b91c1c; margin-bottom: 6px; }
.report-toast-body { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; }
tr.row-highlight { background: #fff7ed !important; transition: background 0.3s ease; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .sidebar { width: 220px; }
  .main { padding: 16px; }
  .topbar { padding: 0 16px; }
  .row-2 { grid-template-columns: 1fr; }
  .panel-head { flex-wrap: wrap; }
  .panel-head-tools { flex-wrap: wrap; justify-content: flex-end; }
}

/* Private legal consultation attachments. */
#legalAdvisorModal .modal { width: 720px; height: min(900px, 94vh); max-height: 94vh; display: flex; flex-direction: column; }
#legalAdvisorModal .legal-advisor-messages { flex: 1 1 auto; min-height: 100px; max-height: none; }
#legalAdvisorModal .field, #legalAdvisorModal .modal-foot, #legalAdvisorModal h3 { flex-shrink: 0; }
#legalAdvisorModal .field { margin-bottom: 12px; }
#legalAdvisorModal .modal-foot { margin-top: 8px; padding-top: 12px; }
.legal-advisor-msg { overflow-wrap: anywhere; }
.la-media { margin: 12px 0 0; padding: 10px; border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; color: #334155; }
.la-media figcaption { margin-bottom: 8px; font-size: 12px; overflow-wrap: anywhere; }
.la-media-content:empty { display: none; }
.la-image-button { display: block; width: 100%; padding: 0; border: 0; background: #f1f5f9; border-radius: 6px; cursor: zoom-in; overflow: hidden; }
.la-image-button img { display: block; width: 100%; height: auto; max-height: 260px; object-fit: contain; }
.la-image-button:focus-visible { outline: 3px solid #2563eb; outline-offset: 2px; }
.la-media video { display: block; width: 100%; max-height: 300px; background: #111827; border-radius: 6px; }
.la-media-status { margin: 8px 0; color: #475569; font-size: 12px; }
.la-media-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.la-media-actions [hidden] { display: none !important; }
.la-image-dialog { width: min(1100px, 94vw); max-width: 94vw; max-height: 94vh; margin: auto; padding: 16px; border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; color: #1e293b; }
.la-image-dialog::backdrop { background: rgba(15, 23, 42, .75); }
.la-image-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.la-image-toolbar strong { overflow-wrap: anywhere; }
.la-image-toolbar > div { display: flex; flex-wrap: wrap; gap: 8px; }
.la-image-viewport { overflow: auto; max-height: 72vh; background: #f1f5f9; text-align: center; }
.la-image-viewport img { display: block; max-width: 100%; max-height: 72vh; width: auto; height: auto; margin: auto; }
@media (max-width: 600px) { #legalAdvisorModal { padding: 10px; } #legalAdvisorModal .modal { padding: 16px; } }

/* Permission matrix follows the two-level navigation. */
#adminUserPermList, #adminRolePermList { display:block; max-height:35vh; overflow:auto; }
.perm-group { border:1px solid var(--border,#dde3ea); border-radius:8px; padding:8px 14px; margin:0 0 12px; }
.perm-group legend { font-weight:700; padding:0 6px; }
.perm-module { display:grid; grid-template-columns:minmax(135px,1fr) 80px 80px; align-items:center; min-height:38px; border-bottom:1px solid #eee; }
.perm-module:last-child { border:0; }
.perm-check-item { display:flex; align-items:center; gap:7px; margin:0; }
.perm-check-item input[type=checkbox] { width:16px; height:16px; flex:0 0 16px; margin:0; }

#adminUserModal .modal { width:640px; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); column-gap:18px; }
#adminUserModal h3, #adminUserCustomField, #adminUserModal .modal-foot, #adminUserError { grid-column:1 / -1; }
#adminUserPermList .perm-check-item, #adminRolePermList .perm-check-item { display:flex; gap:8px; margin:0; }
#adminUserModal input[type=checkbox] { width:16px; height:16px; }
.la-copy-toolbar { margin-top:8px; display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.la-copy-toolbar .hint { flex-basis:100%; }
@media (max-width:600px) { #adminUserModal .modal { grid-template-columns:1fr; } }
