:root {
  --g-50: #f0fdf4;
  --g-100: #dcfce7;
  --g-200: #bbf7d0;
  --g-400: #4ade80;
  --g-600: #16a34a;
  --g-700: #15803d;
  --g-900: #14532d;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --border: #e2e8f0;
  --border-2: #cbd5e1;
  --text-1: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  --danger: #dc2626;
  --warn: #d97706;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-drop: 0 4px 16px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
  --surface: #0d1117;
  --surface-2: #161b22;
  --surface-3: #1c2333;
  --border: #30363d;
  --border-2: #484f58;
  --text-1: #e6edf3;
  --text-2: #848d97;
  --text-3: #6e7681;
  --g-600: #22c55e;
  --g-100: #052e16;
  --shadow-card: none;
  --shadow-drop: none;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 14px;
  color: var(--text-1);
  background: var(--surface-2);
  min-height: 100vh;
}

a {
  color: var(--g-600);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  display: block;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 150ms;
}

.btn-primary {
  background: var(--g-600);
  color: var(--surface);
  border-color: var(--g-600);
}

.btn-primary:hover {
  background: var(--g-700);
  border-color: var(--g-700);
}

.btn-secondary {
  background: transparent;
  color: var(--text-1);
  border-color: var(--border-2);
}

.btn-secondary:hover {
  background: var(--surface-3);
}

.btn-danger {
  background: var(--danger);
  color: var(--surface);
  border-color: var(--danger);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}

.form-input {
  padding: 8px 12px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--text-1);
  background: var(--surface);
  transition: border-color 150ms;
}

.form-input:focus {
  outline: none;
  border-color: var(--g-600);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.12);
}

textarea.form-input {
  resize: vertical;
  min-height: 100px;
  font-family: inherit;
}

select.form-input {
  cursor: pointer;
}

.form-input::placeholder {
  color: var(--text-3);
}

.card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 20px 24px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 500;
}

.badge-green {
  background: var(--g-100);
  color: var(--g-900);
}

.badge-gray {
  background: var(--surface-3);
  color: var(--text-2);
}

.badge-red {
  background: #fef2f2;
  color: #991b1b;
}

.badge-amber {
  background: #fffbeb;
  color: #92400e;
}

.upload-zone {
  border: 2px dashed var(--border-2);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 150ms;
  background: var(--surface);
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--g-600);
  background: var(--g-50);
}

.upload-zone p {
  color: var(--text-3);
  font-size: 13px;
  margin-top: 8px;
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 0.5px solid var(--border);
}

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

thead {
  background: var(--surface-2);
}

thead th {
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  border-bottom: 0.5px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

tbody td {
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text-1);
  border-bottom: 0.5px solid var(--border);
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--surface-2);
}

.alert-success {
  background: var(--g-50);
  border: 1px solid var(--g-200);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  color: var(--g-900);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  color: #991b1b;
  font-size: 14px;
}

.alert-warn {
  background: #fffbeb;
  border: 1px solid #fed7aa;
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  color: #92400e;
  font-size: 14px;
}

.container {
  width: min(960px, 92%);
  margin: 0 auto;
}

.site-main {
  min-height: calc(100vh - 64px - 86px);
  padding: 24px 0 48px;
}

.site-header {
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface);
  border-bottom: 0.5px solid var(--border);
}

.nav-wrap {
  display: flex;
  height: 100%;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--g-700);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.main-nav a {
  color: var(--text-2);
  font-size: 14px;
}

.main-nav a:hover {
  color: var(--text-1);
}

.main-nav .nav-cta {
  background: var(--g-600);
  color: var(--surface);
  border-radius: 9999px;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 500;
}

.hero {
  background: linear-gradient(135deg, var(--g-50) 0%, var(--surface) 100%);
  padding: 80px 24px;
  border-radius: var(--radius-xl);
  margin-bottom: 28px;
}

.hero-inner {
  max-width: 960px;
  margin: 0 auto;
}

.hero-badge {
  font-size: 11px;
  letter-spacing: 0.08em;
  margin-bottom: 14px;
}

.hero h1 {
  font-size: 42px;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.2;
  max-width: 600px;
  margin-bottom: 16px;
}

.hero p {
  font-size: 16px;
  color: var(--text-2);
  max-width: 500px;
  margin-bottom: 32px;
}

.hero-actions {
  display: flex;
  gap: 12px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) 300px;
  gap: 20px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.post-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  overflow: hidden;
  transition: transform 200ms, box-shadow 200ms;
}

.post-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-drop);
}

.post-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-1);
  margin: 8px 0 6px;
}

.post-card .muted {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-meta {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 12px;
}

.read-more {
  font-size: 13px;
  color: var(--g-600);
  font-weight: 500;
  margin-top: 8px;
}

.site-footer {
  background: var(--surface-2);
  border-top: 0.5px solid var(--border);
  margin-top: 32px;
}

.site-footer-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px;
}

.site-footer-row {
  display: flex;
  justify-content: space-between;
  color: var(--text-2);
}

.site-footer-tagline {
  margin-top: 10px;
  color: var(--text-3);
  font-size: 13px;
  text-align: center;
}

.admin-app {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  background: var(--surface-3);
}

.admin-topbar {
  background: var(--surface);
  border-bottom: 0.5px solid var(--border);
  height: 64px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
}

.admin-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-shell {
  display: flex;
}

.admin-sidebar {
  width: 240px;
  flex: 0 0 240px;
  min-height: calc(100vh - 64px);
  background: var(--surface-2);
  border-right: 0.5px solid var(--border);
  padding: 16px 12px;
  position: sticky;
  top: 64px;
  overflow-y: auto;
}

.section-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-3);
  margin: 16px 0 8px;
  padding: 0 12px;
}

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

.admin-sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--text-2);
  cursor: pointer;
  transition: all 100ms;
  text-decoration: none;
}

.nav-icon {
  width: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-icon i {
  font-size: 14px;
}

.admin-sidebar-nav a:hover {
  background: var(--surface-3);
  color: var(--text-1);
}

.admin-sidebar-nav a.active {
  background: var(--g-50);
  color: var(--g-700);
  font-weight: 500;
  border-left: 3px solid var(--g-600);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.admin-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.admin-main {
  overflow-y: auto;
  padding: 28px;
  background: var(--surface-3);
  min-height: calc(100vh - 64px);
}

.page-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 4px;
}

.breadcrumb {
  font-size: 13px;
  color: var(--text-3);
  margin-bottom: 14px;
}

.admin-sidebar-overlay {
  display: none;
}

.admin-menu-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-1);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.muted {
  color: var(--text-2);
}

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

.form {
  display: grid;
  gap: 16px;
}

.form label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--text-2);
}

.form input,
.form textarea,
.form select {
  padding: 8px 12px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--text-1);
  background: var(--surface);
}

.link-list {
  list-style: none;
  display: grid;
  gap: 10px;
}

.link-list a {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-1);
}

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

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.publish-bar {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  border-top: 0.5px solid var(--border);
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (max-width: 1024px) {
  .admin-sidebar {
    width: 64px;
  }

  .admin-sidebar .nav-label,
  .admin-sidebar .section-label {
    display: none;
  }
}

@media (max-width: 768px) {
  .admin-menu-toggle {
    display: inline-flex;
  }

  .admin-sidebar {
    position: fixed;
    left: -240px;
    top: 64px;
    width: 240px;
    z-index: 100;
    transition: left 200ms;
    box-shadow: var(--shadow-drop);
  }

  .admin-sidebar.open {
    left: 0;
  }

  .admin-sidebar-overlay {
    display: block;
    position: fixed;
    inset: 64px 0 0 0;
    background: rgba(0, 0, 0, 0.2);
    opacity: 0;
    pointer-events: none;
    transition: opacity 150ms;
    z-index: 99;
  }

  .admin-sidebar-overlay.open {
    opacity: 1;
    pointer-events: auto;
  }

  .admin-main {
    margin-left: 0;
    padding: 18px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .form-grid-2 {
    grid-template-columns: 1fr;
  }

  .table-wrap {
    overflow-x: auto;
  }

  .modal {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0;
  }

  .layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  .publish-bar {
    flex-direction: column;
    gap: 8px;
  }
}

/* === precise ui fix overrides === */
*,
*::before,
*::after {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

code, pre, textarea.monospace, .mono {
  font-family: "JetBrains Mono", "Fira Code", "Courier New", monospace;
}

body { margin: 0; display: flex; flex-direction: column; min-height: 100vh; }

.admin-topbar {
  position: fixed; top: 0; left: 0; right: 0; height: 60px; z-index: 200;
  background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 20px;
}

.topbar-logo { font-size: 16px; font-weight: 700; color: var(--g-700); text-decoration: none; letter-spacing: -0.3px; }
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--g-600); color: var(--surface);
  font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center;
}
.dm-toggle {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border); background: transparent;
  cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--text-2);
}
.dm-toggle:hover { background: var(--surface-3); }
.sidebar-toggle {
  width: 34px; height: 34px; border: none; background: transparent; cursor: pointer; border-radius: 6px;
  color: var(--text-2); align-items: center; justify-content: center; display: none;
}
.sidebar-toggle:hover { background: var(--surface-3); }

.admin-shell { display: flex; margin-top: 60px; min-height: calc(100vh - 60px); }
.admin-sidebar {
  width: 220px; flex-shrink: 0; position: fixed; top: 60px; left: 0; bottom: 0; overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--border); padding: 20px 12px; z-index: 100;
}
.admin-main { flex: 1; margin-left: 220px; padding: 32px 36px; background: var(--surface-2); min-height: calc(100vh - 60px); }
.admin-sidebar-overlay { display: none; }

.nav-section-label {
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-3); padding: 0 8px; margin: 20px 0 6px;
}
.nav-section-label:first-child { margin-top: 0; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px;
  font-size: 14px; font-weight: 400; color: var(--text-2); text-decoration: none; margin-bottom: 2px; line-height: 1;
}
.nav-item:hover { background: var(--surface-3); color: var(--text-1); text-decoration: none; }
.nav-item.active {
  background: var(--g-50); color: var(--g-700); font-weight: 500;
  border-left: 3px solid var(--g-600); padding-left: 7px; border-radius: 0 8px 8px 0;
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; stroke-width: 1.75; }
.sidebar-divider { height: 1px; background: var(--border); margin: 12px 0; }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 28px; gap: 16px; }
.page-breadcrumb { font-size:12px; color:var(--text-3); margin-bottom:4px; }
.page-desc { font-size:14px; color:var(--text-2); }
h1, .page-title { font-size: 22px; font-weight: 600; }
h2 { font-size: 16px; font-weight: 500; }
.muted, .helper-text { font-size: 12px; color: var(--text-3); }

.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 20px; }
.form-label { font-size: 13px; font-weight: 500; color: var(--text-1); }
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }

.form-input, input[type="text"], input[type="email"], input[type="password"], input[type="url"], input[type="search"], select, textarea {
  width: 100%; height: 40px; padding: 0 12px; font-size: 14px; color: var(--text-1); background: var(--surface);
  border: 1px solid var(--border-2); border-radius: 8px; outline: none; transition: border-color 150ms, box-shadow 150ms;
  appearance: none; -webkit-appearance: none;
}
textarea { height: auto; min-height: 100px; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.form-input:focus, input:focus, select:focus, textarea:focus { border-color: var(--g-600); box-shadow: 0 0 0 3px rgba(22,163,74,.12); }
.form-input::placeholder, input::placeholder, textarea::placeholder { color: var(--text-3); }
.form-input.error, input.error, select.error, textarea.error { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(220,38,38,.10); }
.form-error { font-size: 12px; color: var(--danger); display: flex; align-items: center; gap: 4px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }

.site-header {
  position: sticky; top: 0; z-index: 100; background: var(--surface); border-bottom: 1px solid var(--border);
  height: 64px; display: flex; align-items: center;
}
.site-header-inner { max-width: 1100px; width: 100%; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; }
.site-logo { font-size: 17px; font-weight: 700; color: var(--g-700); text-decoration: none; letter-spacing: -.3px; }
.site-nav { display: flex; align-items: center; gap: 4px; }
.site-nav-link { font-size: 14px; color: var(--text-2); padding: 6px 12px; border-radius: 6px; text-decoration: none; }
.site-nav-link:hover { background: var(--surface-3); color: var(--text-1); text-decoration: none; }
.site-nav-btn { font-size: 13px; font-weight: 500; color: var(--surface); background: var(--g-600); padding: 7px 16px; border-radius: 9999px; text-decoration: none; }
.hero { background: linear-gradient(160deg, var(--g-50) 0%, var(--surface-2) 60%); padding: 80px 24px; border-bottom: 1px solid var(--border); border-radius: 0; }
.hero-inner { max-width: 680px; margin: 0 auto; }
.hero-badge { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .1em; color: var(--g-700); background: var(--g-100); padding: 4px 10px; border-radius: 9999px; margin-bottom: 20px; }
.hero-title { font-size: 40px; font-weight: 700; color: var(--text-1); line-height: 1.2; margin-bottom: 16px; letter-spacing: -.5px; }
.hero-sub { font-size: 16px; color: var(--text-2); line-height: 1.7; margin-bottom: 32px; max-width: 520px; }
.btn-hero-primary { padding: 11px 24px; background: var(--g-600); color: var(--surface); border-radius: 8px; font-size: 14px; font-weight: 500; text-decoration: none; }
.btn-hero-ghost { padding: 11px 24px; background: transparent; color: var(--text-1); border: 1px solid var(--border-2); border-radius: 8px; font-size: 14px; font-weight: 500; text-decoration: none; }

.insight-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; transition: transform 200ms, box-shadow 200ms; cursor: pointer; }
.insight-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.insight-type { font-size: 11px; font-weight: 600; letter-spacing: .08em; color: var(--g-700); background: var(--g-100); padding: 3px 8px; border-radius: 9999px; display: inline-block; margin-bottom: 10px; }
.insight-title { font-size: 16px; font-weight: 600; color: var(--text-1); margin-bottom: 8px; line-height: 1.4; }
.insight-excerpt { font-size: 14px; color: var(--text-2); line-height: 1.6; margin-bottom: 16px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.insight-meta { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--text-3); border-top: 1px solid var(--surface-3); padding-top: 12px; }

.site-footer { background: var(--surface-2); border-top: 1px solid var(--border); padding: 40px 24px; }
.site-footer-inner { max-width: 1100px; margin: 0 auto; text-align: center; }

.login-shell { min-height: 100vh; display: flex; }
.login-brand { width: 420px; flex-shrink: 0; background: var(--g-700); display: flex; align-items: center; justify-content: center; padding: 48px; }
.login-brand-inner { max-width: 300px; }
.login-logo { font-size: 22px; font-weight: 700; color: #fff; letter-spacing: -0.5px; margin-bottom: 16px; }
.login-tagline { font-size: 16px; color: rgba(255,255,255,.75); line-height: 1.6; margin-bottom: 32px; }
.login-feat { font-size: 14px; color: rgba(255,255,255,.85); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.login-form-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 36px; box-shadow: 0 4px 24px rgba(0,0,0,.06); }

@media (max-width: 768px) {
  .sidebar-toggle { display: inline-flex; }
  .admin-sidebar { left: -220px; transition: left 200ms ease; box-shadow: 4px 0 20px rgba(0,0,0,.08); }
  .admin-sidebar.open { left: 0; }
  .admin-main { margin-left: 0; padding: 20px 16px; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .login-brand { display: none; }
}

/* --- SaaS UI Refresh --- */
:root {
  --container-max: 1200px;
  --space-page: clamp(24px, 3vw, 32px);
  --surface-bg: #f8fafc;
  --border-soft: #e5e7eb;
}

body {
  font-size: 15px;
  background: var(--surface-bg);
  line-height: 1.6;
}

.container {
  width: min(var(--container-max), calc(100% - (var(--space-page) * 2)));
  margin: 0 auto;
}

.site-main {
  padding: var(--space-page) 0 56px;
}

.site-main h1,
.admin-main h1 {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
}

.site-main h2,
.admin-main h2,
.section-title {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.3;
}

.admin-app,
.admin-main {
  background: var(--surface-bg);
}

.admin-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1200;
  height: 68px;
  border-bottom: 1px solid var(--border-soft);
  padding: 0 var(--space-page);
}

.admin-shell {
  margin-top: 68px;
  min-height: calc(100vh - 68px);
}

.admin-sidebar {
  width: 240px;
  flex: 0 0 240px;
  top: 68px;
  background: #fff;
  border-right: 1px solid var(--border-soft);
  padding: 20px 14px;
}

.admin-main {
  margin-left: 240px;
  padding: var(--space-page);
}

.admin-main > section {
  margin-bottom: 28px;
}

.card,
.insight-card,
.post-card {
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.card {
  padding: 22px 24px;
}

.btn {
  min-height: 40px;
  font-weight: 600;
  transition: all 180ms ease;
}

.btn:focus-visible,
.site-nav-link:focus-visible,
.site-nav-btn:focus-visible,
.btn-hero-primary:focus-visible,
.btn-hero-ghost:focus-visible,
.form-input:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.18);
}

.btn-primary {
  background: var(--g-600);
  border-color: var(--g-600);
}

.btn-primary:hover {
  transform: translateY(-1px);
}

.btn-secondary {
  background: #fff;
  border-color: var(--border-soft);
}

.btn-secondary:hover {
  background: #f8fafc;
}

.btn-loading {
  opacity: 0.8;
  cursor: wait;
}

.site-header {
  border-bottom: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
}

.site-header-inner {
  max-width: var(--container-max);
  padding: 0 var(--space-page);
}

.site-nav {
  gap: 10px;
}

.site-nav-link {
  padding: 8px 12px;
  transition: background 160ms ease, color 160ms ease;
}

.hero {
  border: none;
  background: linear-gradient(180deg, #f0fdf4 0%, #f8fafc 78%);
  padding: 88px var(--space-page) 76px;
}

.hero-inner {
  max-width: 780px;
  text-align: center;
}

.hero-title {
  margin: 0 auto 18px;
  max-width: 760px;
}

.hero-sub {
  margin: 0 auto 30px;
  max-width: 640px;
}

.hero-actions {
  justify-content: center;
}

.section-spacing {
  margin-top: 28px;
  padding: 0 32px;
}

.section-head {
  margin-bottom: 18px;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

.site-main .section-head {
  text-align: center;
}

.site-main .section-head h2 {
  font-size: 34px;
  line-height: 1.2;
  margin-bottom: 4px;
}

.latest-insights-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

/* Header/footer library: full-width stacked rows (form → preview → list). */
.layout-partials-stack,
.layout-partials-admin-grid,
.footer-admin-grid {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
  max-width: 100%;
}
.layout-partials-right,
.footer-admin-right {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
}

.layout-partials-stack h2.card-subhead,
.layout-partials-admin-grid h2.card-subhead {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-1);
  line-height: 1.35;
}

.layout-code {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  word-break: break-word;
  overflow-wrap: anywhere;
  background: var(--surface-3);
  padding: 2px 6px;
  border-radius: 4px;
}

.layout-code-ellipsis {
  display: inline-block;
  max-width: 14rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.layout-preview-wrap,
.footer-preview-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  background: var(--surface);
  min-height: 160px;
  max-height: 360px;
  overflow: auto;
}

.layout-preview-thumb {
  max-height: 84px;
  min-height: 52px;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 6px 8px;
  font-size: 11px;
  line-height: 1.35;
  background: var(--surface-2);
  contain: layout;
}

.layout-preview-thumb img {
  max-height: 40px;
  max-width: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  vertical-align: middle;
}

.layout-partials-actions {
  display: inline-flex !important;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.admin-main .layout-partials-actions .btn,
.admin-main .layout-partials-actions .btn-sm {
  width: auto;
  flex: 0 0 auto;
}

.layout-inline-form {
  display: inline-flex;
  margin: 0;
  flex: 0 0 auto;
  align-items: center;
}

.layout-inline-form button {
  vertical-align: middle;
}

.upload-zone {
  border: 2px dashed #cbd5e1;
  border-radius: 14px;
  padding: 26px;
  background: #f8fafc;
  display: grid;
  gap: 6px;
  justify-items: center;
}

.upload-zone-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: #dcfce7;
  color: #166534;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.upload-file-name {
  color: #64748b;
  font-size: 12px;
  margin-top: 2px;
}

.empty-state {
  border: 1px dashed var(--border-soft);
  border-radius: 12px;
  background: #f8fafc;
  min-height: 140px;
  display: grid;
  place-items: center;
  gap: 10px;
  text-align: center;
  padding: 20px;
}

.empty-state i {
  color: #94a3b8;
}

form.is-submitting {
  opacity: 0.92;
}

@media (max-width: 1024px) {
  .latest-insights-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .admin-sidebar {
    left: -240px;
    width: 240px;
  }

  .admin-main {
    margin-left: 0;
    padding: 20px 16px 28px;
  }

  .latest-insights-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 72px 18px 56px;
  }

  .hero-title {
    font-size: 34px;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-actions a {
    width: 100%;
    text-align: center;
  }

  .site-main h1,
  .admin-main h1 {
    font-size: 30px;
  }

  .site-main h2,
  .admin-main h2,
  .section-title {
    font-size: 22px;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  /* Keep header/footer library table actions on one row (global .btn is full-width on mobile). */
  .admin-main .layout-partials-actions .btn,
  .admin-main .layout-partials-actions .btn-sm {
    width: auto !important;
    flex: 0 0 auto;
  }
}

/* --- Admin full-width SaaS layout refinements --- */
.admin-app,
.admin-shell,
.admin-content,
.admin-main {
  width: 100%;
  max-width: none;
}

.admin-shell {
  display: flex;
  align-items: stretch;
}

.admin-sidebar {
  width: 240px;
  flex: 0 0 240px;
  position: sticky;
  top: 68px;
  height: calc(100vh - 68px);
}

.admin-sidebar-nav {
  gap: 8px;
}

.nav-item {
  padding: 10px 12px;
  gap: 12px;
}

.nav-item.active {
  background: #dcfce7;
  color: #166534;
  border-left: 3px solid #16a34a;
}

.admin-main {
  padding: 24px 32px;
}

.admin-main .card,
.admin-main .page-header {
  width: 100%;
  max-width: none;
}

.admin-main > .card + .card,
.admin-main > .page-header + .card {
  margin-top: 24px;
}

.table-wrap {
  width: 100%;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  overflow-x: auto;
}

table {
  width: 100%;
}

thead {
  background: #f8fafc;
}

table th,
table td {
  padding: 16px 20px;
  text-align: left;
  vertical-align: middle;
}

tbody tr {
  transition: background-color 150ms ease;
}

tbody tr:hover {
  background: #f8fafc;
}

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

.btn {
  padding: 10px 16px;
  border-radius: 8px;
  transition: all 180ms ease;
}

.btn-sm {
  padding: 10px 16px;
  font-size: 13px;
}

.btn-secondary {
  background: #fff;
  border: 1px solid #d1d5db;
}

.status {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.status.published {
  background: #dcfce7;
  color: #166534;
}

.status.draft {
  background: #f1f5f9;
  color: #475569;
}

/* Top nav alignment and spacing */
.site-header-inner {
  max-width: none;
  width: 100%;
  padding: 0 32px;
}

.site-nav {
  margin-left: auto;
  gap: 12px;
}

.site-nav-link,
.site-nav-btn {
  transition: all 160ms ease;
}

.site-nav-link:hover {
  background: #f1f5f9;
}

@media (max-width: 768px) {
  .admin-main {
    padding: 24px 16px;
  }

  .admin-sidebar {
    position: fixed;
    top: 68px;
    left: -240px;
    height: calc(100vh - 68px);
  }

  .admin-sidebar.open {
    left: 0;
  }

  .table-wrap {
    overflow-x: auto;
  }

  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .actions .btn {
    width: 100%;
    justify-content: center;
  }

  .site-header-inner {
    padding: 0 16px;
  }
}

/* --- Final production layout overrides --- */
.admin-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.admin-shell {
  margin-top: 68px;
  min-height: calc(100vh - 68px);
  width: 100%;
  display: flex;
  align-items: stretch;
}

.admin-sidebar {
  width: 240px;
  flex: 0 0 240px;
  position: sticky;
  top: 68px;
  left: auto;
  height: calc(100vh - 68px);
  margin: 0;
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  z-index: 100;
}

.admin-sidebar-nav.top {
  margin-top: 0;
}

.admin-sidebar-nav.bottom {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}

.admin-content,
.admin-main {
  width: 100%;
  max-width: none;
}

.admin-main {
  margin-left: 0;
  padding: 24px 32px;
}

.admin-main > .card + .card,
.admin-main > .page-header + .card {
  margin-top: 24px;
}

.publish-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
}

.publish-preview {
  margin-top: 12px;
  padding: 16px;
}

.site-main {
  width: 100%;
  max-width: none;
  padding: 24px 32px 56px;
}

.container {
  width: 100%;
  max-width: none;
  margin: 0;
}

.latest-insights-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.latest-insights-grid.single-item {
  grid-template-columns: minmax(0, 1fr);
  max-width: 760px;
  margin: 0 auto;
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  align-items: stretch;
}

.dashboard-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  align-items: stretch;
}

.dashboard-stats > .card,
.dashboard-grid-2 > .card {
  margin-top: 0 !important;
  height: 100%;
}

.stat-card {
  padding: 22px 24px;
}

.stat-label {
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 34px;
  line-height: 1.1;
  margin-bottom: 4px;
}

.hero {
  background: linear-gradient(180deg, #ecfdf3 0%, #f8fafc 82%);
}

.site-header {
  background: #ffffff;
}

.insight-card {
  border-color: #dbe4ef;
  background: #ffffff;
}

.insight-type {
  background: #dcfce7;
  color: #166534;
}

.main-nav a,
.site-nav a {
  transition: all 0.2s ease;
}

@media (max-width: 768px) {
  .sidebar-toggle {
    display: inline-flex;
  }

  .admin-sidebar .nav-label,
  .admin-sidebar .nav-section-label {
    display: inline;
  }

  .admin-sidebar {
    position: fixed;
    top: 68px;
    left: -240px;
    height: calc(100vh - 68px);
    transition: left 0.2s ease;
    box-shadow: var(--shadow-drop);
  }

  .admin-sidebar.open {
    left: 0;
  }

  .admin-sidebar-overlay {
    display: block;
    position: fixed;
    inset: 68px 0 0 0;
    background: rgba(2, 6, 23, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 99;
  }

  .admin-sidebar-overlay.open {
    opacity: 1;
    pointer-events: auto;
  }

  .admin-main {
    padding: 24px 16px;
  }

  .publish-grid,
  .latest-insights-grid,
  .dashboard-stats,
  .dashboard-grid-2 {
    grid-template-columns: 1fr;
  }

  .section-spacing {
    padding: 0 16px;
  }

  .site-main .section-head h2 {
    font-size: 28px;
  }

  .form-grid-2 {
    grid-template-columns: 1fr;
  }
}

/* --- Admin dark mode: final polish (admin only) --- */
[data-theme="dark"] .is-admin,
[data-theme="dark"] .is-admin body {
  background: #0b1220;
  color: #e6edf3;
}

[data-theme="dark"] .is-admin .admin-app,
[data-theme="dark"] .is-admin .admin-shell,
[data-theme="dark"] .is-admin .admin-main {
  background: #0b1220;
}

[data-theme="dark"] .is-admin .admin-topbar {
  background: #111827;
  border-bottom: 1px solid #253046;
}

[data-theme="dark"] .is-admin .admin-sidebar {
  background: #0f172a;
  border-right: 1px solid #253046;
}

[data-theme="dark"] .is-admin .topbar-logo,
[data-theme="dark"] .is-admin .page-title,
[data-theme="dark"] .is-admin h1,
[data-theme="dark"] .is-admin h2,
[data-theme="dark"] .is-admin th,
[data-theme="dark"] .is-admin td {
  color: #e6edf3;
}

[data-theme="dark"] .is-admin .page-desc,
[data-theme="dark"] .is-admin .page-breadcrumb,
[data-theme="dark"] .is-admin .muted,
[data-theme="dark"] .is-admin .helper-text,
[data-theme="dark"] .is-admin .stat-label {
  color: #9aa7b8;
}

[data-theme="dark"] .is-admin .card,
[data-theme="dark"] .is-admin .table-wrap,
[data-theme="dark"] .is-admin .publish-preview,
[data-theme="dark"] .is-admin .footer-preview-wrap {
  background: #111827;
  border: 1px solid #253046;
  box-shadow: none;
}

[data-theme="dark"] .is-admin thead {
  background: #0f172a;
}

[data-theme="dark"] .is-admin tbody tr:hover {
  background: #1a2436;
}

[data-theme="dark"] .is-admin table th,
[data-theme="dark"] .is-admin table td {
  border-color: #253046;
}

[data-theme="dark"] .is-admin .form-label {
  color: #c7d2de;
}

[data-theme="dark"] .is-admin .form-input,
[data-theme="dark"] .is-admin input[type="text"],
[data-theme="dark"] .is-admin input[type="email"],
[data-theme="dark"] .is-admin input[type="password"],
[data-theme="dark"] .is-admin input[type="url"],
[data-theme="dark"] .is-admin input[type="search"],
[data-theme="dark"] .is-admin select,
[data-theme="dark"] .is-admin textarea {
  background: #0f172a;
  color: #e6edf3;
  border: 1px solid #334155;
}

[data-theme="dark"] .is-admin .form-input::placeholder,
[data-theme="dark"] .is-admin input::placeholder,
[data-theme="dark"] .is-admin textarea::placeholder {
  color: #7f8ea3;
}

[data-theme="dark"] .is-admin .form-input:focus,
[data-theme="dark"] .is-admin input:focus,
[data-theme="dark"] .is-admin select:focus,
[data-theme="dark"] .is-admin textarea:focus {
  border-color: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

[data-theme="dark"] .is-admin .btn-secondary {
  background: #0f172a;
  color: #e6edf3;
  border-color: #334155;
}

[data-theme="dark"] .is-admin .btn-secondary:hover {
  background: #1a2436;
}

[data-theme="dark"] .is-admin .nav-item {
  color: #a9b7c7;
}

[data-theme="dark"] .is-admin .nav-item:hover {
  background: #1a2436;
  color: #e6edf3;
}

[data-theme="dark"] .is-admin .nav-item.active {
  background: rgba(34, 197, 94, 0.14);
  color: #86efac;
  border-left-color: #22c55e;
}

[data-theme="dark"] .is-admin .admin-sidebar-nav.bottom {
  border-top-color: #253046;
}

/* Assets submenu + library table */
.nav-asset-group {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft, var(--border));
}

.nav-section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 4px 8px 8px;
}

.nav-item.nav-subitem {
  padding-left: 28px;
  font-size: 13px;
}

.assets-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.assets-table th,
.assets-table td {
  border: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
}

.assets-table th {
  background: var(--surface-3);
  font-weight: 600;
}

.assets-preview-cell {
  width: 88px;
}

.assets-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.assets-icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
}

.assets-url-field {
  font-size: 12px;
  width: 100%;
  min-width: 240px;
}

.publish-step1 {
  border-left: 3px solid var(--g-600);
}

/* Admin list polish: full-width tables, popovers, pagination */
.table-wrap,
.assets-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.admin-list-table {
  width: 100%;
  min-width: 980px;
  table-layout: fixed;
  border-collapse: collapse;
}

.admin-list-table th,
.admin-list-table td {
  vertical-align: middle;
  border-bottom: 1px solid var(--border, #e2e8f0);
  padding-top: 12px;
  padding-bottom: 12px;
}

.admin-list-table thead th {
  border-bottom: 1px solid var(--border, #e2e8f0);
}

.admin-list-table tbody tr:last-child td {
  border-bottom: 0;
}

.admin-list-table td:last-child,
.admin-list-table th:last-child {
  width: 120px;
  text-align: right;
}

.admin-list-table.layout-partials-table {
  min-width: 100%;
  width: 100%;
  table-layout: auto;
}

.admin-list-table.layout-partials-table td:last-child,
.admin-list-table.layout-partials-table th:last-child {
  width: 200px;
  min-width: 200px;
  white-space: nowrap;
  vertical-align: middle;
}

.admin-list-table.layout-partials-table td:nth-child(1),
.admin-list-table.layout-partials-table th:nth-child(1) {
  min-width: 140px;
  max-width: 220px;
  vertical-align: middle;
}

.admin-list-table.layout-partials-table td.layout-partials-name-cell strong {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
  font-weight: 600;
}

.admin-list-table.layout-partials-table td:nth-child(2),
.admin-list-table.layout-partials-table th:nth-child(2) {
  min-width: 9rem;
  max-width: 15rem;
  vertical-align: middle;
}

.admin-list-table.layout-partials-table td:nth-child(3),
.admin-list-table.layout-partials-table th:nth-child(3) {
  min-width: 6.5rem;
  max-width: 9rem;
  vertical-align: middle;
}

.admin-list-table.layout-partials-table td.layout-partials-date-cell {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
}

.admin-list-table.layout-partials-table td:nth-child(6),
.admin-list-table.layout-partials-table th:nth-child(6) {
  min-width: 140px;
  max-width: 200px;
  vertical-align: middle;
}

.page-actions-menu {
  position: relative;
  display: inline-block;
}

.page-actions-menu summary {
  list-style: none;
  cursor: pointer;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface, #fff);
  font-size: 20px;
  line-height: 1;
}

.page-actions-menu summary::-webkit-details-marker {
  display: none;
}

.page-actions-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 180px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  background: var(--surface, #fff);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
  padding: 8px;
  z-index: 30;
}

.page-actions-popover a,
.page-actions-popover button {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  border-radius: 8px;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  display: block;
}

.page-actions-popover a:hover,
.page-actions-popover button:hover {
  background: var(--surface-2, #f8fafc);
}

.page-actions-popover .danger {
  color: #dc2626;
}

.admin-pagination {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-pagination .page-link {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  background: var(--surface, #fff);
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.admin-pagination .page-link.active {
  border-color: var(--g-600, #16a34a);
  background: var(--g-50, #f0fdf4);
  color: var(--g-700, #15803d);
}

.admin-pagination .page-link.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.pages-list-card {
  min-height: calc(100vh - 170px);
  display: flex;
  flex-direction: column;
}

.pages-list-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.pages-list-card .table-wrap {
  flex: 1;
}

.pages-list-card .admin-pagination {
  margin-top: 16px;
}

.posts-list-card {
  min-height: calc(100vh - 170px);
  display: flex;
  flex-direction: column;
}

.posts-list-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.posts-list-card .table-wrap {
  flex: 1;
}

.posts-list-card .admin-pagination {
  margin-top: 16px;
}

.action-menu-item {
  width: 100%;
  border: 1px solid var(--border, #e2e8f0);
  background: var(--surface, #fff);
  min-height: 34px;
}

.action-menu-item + .action-menu-item {
  margin-top: 6px;
}

@media (max-width: 768px) {
  .pages-list-head,
  .posts-list-head {
    flex-direction: column;
    align-items: stretch;
  }

  .pages-list-card,
  .posts-list-card {
    min-height: auto;
  }

  .admin-list-table {
    min-width: 0;
    table-layout: auto;
  }

  .admin-list-table thead {
    display: none;
  }

  .admin-list-table,
  .admin-list-table tbody,
  .admin-list-table tr,
  .admin-list-table td {
    display: block;
    width: 100%;
  }

  .admin-list-table tbody tr {
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 10px;
    padding: 8px 12px;
    margin-bottom: 10px;
    background: var(--surface, #fff);
  }

  .admin-list-table td {
    border-bottom: 1px dashed var(--border, #e2e8f0);
    padding: 8px 0;
    text-align: left !important;
  }

  .admin-list-table td:last-child {
    width: 100%;
    border-bottom: 0;
  }

  .admin-list-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-3);
    margin-bottom: 3px;
  }

  .page-actions-menu {
    width: 100%;
  }

  .page-actions-menu summary {
    margin-left: auto;
  }

  .page-actions-popover {
    left: 0;
    right: auto;
    width: min(100%, 260px);
  }

  .admin-list-table.layout-partials-table td .layout-partials-actions {
    display: flex !important;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
  }

  .admin-list-table.layout-partials-table td .layout-code-ellipsis {
    max-width: 100%;
  }
}
