:root {
  --admin-bg: #f5f3ee;
  --admin-panel: rgba(255, 255, 255, .82);
  --admin-panel-strong: #ffffff;
  --admin-ink: #172423;
  --admin-muted: #66736f;
  --admin-line: rgba(211, 207, 198, .9);
  --admin-green: #183833;
  --admin-green-soft: #234c46;
  --admin-gold: #ead3a7;
  --admin-red: #b44747;
  --admin-shadow: 0 18px 42px rgba(27, 36, 40, .08);
}

* {
  box-sizing: border-box;
}

.admin-shell {
  min-height: 100vh;
  margin: 0;
  display: flex;
  overflow-x: hidden;
  color: var(--admin-ink);
  background:
    radial-gradient(circle at top left, rgba(234, 211, 167, .22), transparent 34%),
    linear-gradient(180deg, #fbfaf7, var(--admin-bg));
  font-family: Aptos, Calibri, "Segoe UI", system-ui, sans-serif;
}

.admin-shell a {
  color: inherit;
  text-decoration: none;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 1001;
  width: 260px;
  height: 100vh;
  min-height: 100vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  color: rgba(255, 255, 255, .78);
  background:
    linear-gradient(180deg, rgba(24, 56, 51, .99), rgba(37, 58, 54, .98)),
    var(--admin-green);
  border-right: 1px solid rgba(255, 255, 255, .08);
  scrollbar-width: thin;
  scrollbar-color: rgba(234, 211, 167, .48) transparent;
}

.sidebar::-webkit-scrollbar {
  width: 8px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(234, 211, 167, .48);
  background-clip: padding-box;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 4px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .11);
}

.sidebar-logo {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  color: var(--admin-green);
  background: var(--admin-gold);
  box-shadow: 0 14px 26px rgba(0, 0, 0, .14);
}

.sidebar-logo svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar h2 {
  margin: 0;
  color: #fff;
  font-family: Poppins, Aptos, sans-serif;
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
}

.sidebar p {
  margin: 5px 0 0;
  color: rgba(255, 255, 255, .56);
  font-size: 12px;
}

.sidebar-user {
  margin: 16px 4px 14px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 8px;
  background: rgba(255, 255, 255, .05);
}

.sidebar-user span {
  display: block;
  margin-bottom: 4px;
  color: rgba(255, 255, 255, .5);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.sidebar-user b {
  display: block;
  color: #fff;
  font-size: 14px;
}

.menu {
  display: grid;
  gap: 6px;
}

.menu a {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 42px;
  padding: 9px 11px;
  border-radius: 8px;
  color: rgba(255, 255, 255, .72);
  font-size: 14px;
  font-weight: 700;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}

.menu a:hover {
  color: #fff;
  background: rgba(255, 255, 255, .07);
}

.menu a.active {
  color: var(--admin-green);
  background: var(--admin-gold);
  box-shadow: 0 12px 26px rgba(0, 0, 0, .16);
}

.menu-icon {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  font-size: 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  color: #fff;
  background: var(--admin-red);
  font-size: 11px;
  font-weight: 800;
}

.btn,
.btn-new-post,
.dashboard-btn,
.btn-newsletter,
.login-button,
.admin-shell button:not(.tox-button):not(.tox-tbtn):not(.admin-toggle) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 14px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--admin-green);
  font-family: Poppins, Aptos, sans-serif;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, box-shadow .18s ease;
}

.btn:hover,
.btn-new-post:hover,
.dashboard-btn:hover,
.btn-newsletter:hover,
.login-button:hover,
.admin-shell button:not(.tox-button):not(.tox-tbtn):not(.admin-toggle):hover {
  transform: translateY(-1px);
  background: var(--admin-green-soft);
  box-shadow: 0 12px 26px rgba(24, 56, 51, .16);
}

.btn-outline {
  border: 1px solid rgba(234, 211, 167, .34);
  color: var(--admin-gold);
  background: transparent;
}

.btn-danger {
  background: rgba(180, 71, 71, .96);
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 900;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--admin-line);
  background: rgba(255, 255, 255, .84);
  backdrop-filter: blur(16px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.admin-brand {
  margin-bottom: 4px;
  color: var(--admin-gold);
  font-family: Poppins, Aptos, sans-serif;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.page-title {
  color: var(--admin-ink);
  font-family: Poppins, Aptos, sans-serif;
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
}

.topbar-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.top-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  color: var(--admin-muted);
  background: rgba(255, 255, 255, .68);
  font-size: 13px;
  font-weight: 700;
}

.top-link:hover {
  color: var(--admin-green);
  background: #fff;
}

.top-link.logout {
  color: var(--admin-red);
}

.admin-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--admin-green);
  font-size: 19px;
  cursor: pointer;
}

.content {
  flex: 1;
  width: min(100%, 1320px);
  margin-inline: auto;
  padding: 28px;
}

.admin-footer {
  width: min(100%, 1320px);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 28px 24px;
  color: var(--admin-muted);
  border-top: 1px solid rgba(211, 207, 198, .76);
  font-size: 13px;
}

.admin-footer-brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.admin-footer-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 10px;
  color: var(--admin-green);
  background: var(--admin-gold);
  box-shadow: 0 12px 24px rgba(24, 56, 51, .1);
}

.admin-footer-mark svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.admin-footer strong {
  display: block;
  color: var(--admin-ink);
  font-family: Poppins, Aptos, sans-serif;
  font-size: 14px;
  font-weight: 800;
}

.admin-footer small {
  display: block;
  margin-top: 2px;
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-footer-meta {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px 12px;
  text-align: right;
  font-weight: 700;
}

.admin-footer-meta span + span {
  padding-left: 12px;
  border-left: 1px solid rgba(102, 115, 111, .22);
}

.dashboard-header,
.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

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

.stat-card,
.stat-box,
.quick-links,
.latest-posts,
.chart-card,
.table-card,
.category-add-card,
.contact-card,
.message-card,
.admin-card,
.login-box {
  border: 1px solid var(--admin-line);
  border-radius: 10px;
  background: var(--admin-panel);
  box-shadow: var(--admin-shadow);
}

.stat-card,
.stat-box {
  min-height: 112px;
  padding: 18px;
  display: grid;
  align-content: end;
  gap: 6px;
  overflow: hidden;
}

.stat-number,
.stat-box strong {
  color: var(--admin-ink);
  font-family: Poppins, Aptos, sans-serif;
  font-size: clamp(28px, 3vw, 38px);
  font-weight: 800;
  line-height: 1;
}

.stat-label,
.stat-box span {
  color: var(--admin-muted);
  font-size: 13px;
  font-weight: 700;
}

.quick-links,
.latest-posts,
.chart-card,
.table-card,
.category-add-card {
  padding: 18px;
  margin-bottom: 18px;
}

.quick-links h3,
.latest-posts h3,
.table-card h3 {
  margin: 0 0 14px;
  color: var(--admin-ink);
  font-family: Poppins, Aptos, sans-serif;
  font-size: 18px;
  font-weight: 800;
}

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

.quick-card {
  min-height: 86px;
  padding: 15px;
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .62);
}

.quick-card:hover {
  border-color: rgba(24, 56, 51, .26);
  background: #fff;
  box-shadow: 0 12px 26px rgba(27, 36, 40, .06);
}

.quick-title {
  margin-bottom: 5px;
  color: var(--admin-ink);
  font-family: Poppins, Aptos, sans-serif;
  font-weight: 800;
}

.quick-desc {
  color: var(--admin-muted);
  font-size: 13px;
}

.table-card {
  overflow: auto;
}

table,
.admin-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--admin-ink);
  font-size: 14px;
}

th,
.admin-table th {
  padding: 13px 12px;
  color: var(--admin-muted);
  border-bottom: 1px solid var(--admin-line);
  font-family: Poppins, Aptos, sans-serif;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-align: left;
  text-transform: uppercase;
  background: rgba(255, 255, 255, .58);
}

td,
.admin-table td {
  padding: 13px 12px;
  border-bottom: 1px solid rgba(211, 207, 198, .55);
  vertical-align: middle;
}

tr:hover td {
  background: rgba(255, 255, 255, .54);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: var(--admin-green);
  transition: background .18s ease, color .18s ease;
}

.icon-btn.delete {
  color: var(--admin-red);
}

.icon-btn:hover {
  background: rgba(24, 56, 51, .08);
}

.icon-btn.delete:hover {
  background: rgba(180, 71, 71, .1);
}

.field,
form,
.category-form,
.inline-edit-form {
  gap: 10px;
}

input,
select,
textarea,
.input,
.login-input {
  width: 100%;
  min-height: 42px;
  padding: 11px 12px;
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  outline: 0;
  color: var(--admin-ink);
  background: rgba(255, 255, 255, .82);
  font: inherit;
}

textarea {
  min-height: 130px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
.input:focus,
.login-input:focus {
  border-color: rgba(24, 56, 51, .44);
  box-shadow: 0 0 0 3px rgba(24, 56, 51, .08);
}

label,
.login-label {
  color: var(--admin-ink);
  font-family: Poppins, Aptos, sans-serif;
  font-size: 12px;
  font-weight: 700;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

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

.form-error,
.login-error {
  padding: 12px;
  border: 1px solid rgba(180, 71, 71, .18);
  border-radius: 8px;
  color: var(--admin-red);
  background: rgba(180, 71, 71, .08);
  font-size: 13px;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, .42);
}

.mini-bar-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mini-bar {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--admin-green), var(--admin-gold));
}

.unread-row td {
  background: rgba(234, 211, 167, .12);
}

.unread-text {
  font-weight: 800;
}

.unread-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--admin-gold);
}

.subject-cell {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.date-cell,
td.date,
td.views {
  color: var(--admin-muted);
  white-space: nowrap;
}

.yt-clean {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  cursor: pointer;
  overflow: hidden;
  border-radius: 14px;
  background: #000;
}

.yt-preview {
  position: absolute;
  inset: 0;
}

.yt-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}

.yt-clean:hover img {
  transform: scale(1.04);
}

.yt-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 74px;
  height: 52px;
  border-radius: 14px;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, .65);
  backdrop-filter: blur(6px);
}

.yt-play-btn::before {
  content: '';
  position: absolute;
  left: 28px;
  top: 16px;
  border-style: solid;
  border-width: 10px 0 10px 16px;
  border-color: transparent transparent transparent white;
}

.yt-title {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 12px;
  color: white;
  background: linear-gradient(to top, rgba(0,0,0,.72), transparent);
  font-size: 14px;
  font-weight: 700;
}

body:not(.admin-shell) {
  min-height: 100vh;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--admin-ink);
  background:
    radial-gradient(circle at top left, rgba(234, 211, 167, .24), transparent 34%),
    linear-gradient(180deg, #fbfaf7, var(--admin-bg));
  font-family: Aptos, Calibri, "Segoe UI", system-ui, sans-serif;
}

body:not(.admin-shell) .login-box {
  width: min(390px, calc(100% - 30px));
  padding: 34px;
  text-align: left;
}

body:not(.admin-shell) .login-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin: 0 0 18px;
  border-radius: 14px;
  color: var(--admin-green);
  background: var(--admin-gold);
  font-size: 24px;
}

body:not(.admin-shell) .login-title {
  color: var(--admin-ink);
  font-family: Poppins, Aptos, sans-serif;
  font-size: 24px;
  font-weight: 800;
}

body:not(.admin-shell) .login-sub {
  margin: 6px 0 22px;
  color: var(--admin-muted);
}

body:not(.admin-shell) .login-button {
  width: 100%;
  margin-top: 18px;
}

@media (max-width: 1180px) {
  .dashboard-grid,
  .stats-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 992px) {
  .admin-shell {
    display: block;
  }

  .admin-toggle {
    display: inline-grid;
    place-items: center;
  }

  .sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    width: 260px;
    height: 100dvh;
    overflow-y: auto;
    transition: left .28s ease;
    box-shadow: 0 0 34px rgba(0, 0, 0, .18);
  }

  .sidebar.active {
    left: 0;
  }

  .sidebar-overlay.active {
    display: block;
  }

  .content {
    padding: 20px;
  }
}

@media (max-width: 760px) {
  .topbar {
    min-height: auto;
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 18px;
  }

  .topbar-right {
    width: 100%;
  }

  .top-link {
    flex: 1;
    justify-content: center;
  }

  .dashboard-grid,
  .stats-row,
  .quick-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-header,
  .admin-topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .btn-new-post,
  .dashboard-btn {
    width: 100%;
  }

  .admin-footer {
    padding-inline: 20px;
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-footer-meta {
    justify-content: flex-start;
    text-align: left;
  }

  .admin-footer-meta span + span {
    padding-left: 0;
    border-left: 0;
  }
}

/* Stronger shared skin for pages with legacy inline styles */
.admin-shell .dashboard-grid,
.admin-shell .stats-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.admin-shell .dashboard-header,
.admin-shell .admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.admin-shell .dashboard-header h1,
.admin-shell .admin-topbar h1 {
  margin: 0;
  font-family: Poppins, Aptos, sans-serif;
  font-size: 24px;
  font-weight: 800;
}

.admin-shell .stat-card,
.admin-shell .stat-box,
.admin-shell .quick-links,
.admin-shell .latest-posts,
.admin-shell .chart-card,
.admin-shell .table-card,
.admin-shell .category-add-card,
.admin-shell .admin-card {
  border: 1px solid var(--admin-line);
  border-radius: 10px;
  background: var(--admin-panel);
  box-shadow: var(--admin-shadow);
}

.admin-shell .stat-card,
.admin-shell .stat-box {
  min-height: 112px;
  padding: 18px;
}

.admin-shell .stat-number {
  color: var(--admin-ink);
  font-family: Poppins, Aptos, sans-serif;
  font-size: clamp(28px, 3vw, 38px);
  font-weight: 800;
}

.admin-shell .stat-label {
  color: var(--admin-muted);
  font-size: 13px;
  font-weight: 700;
}

.admin-shell .quick-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.admin-shell .quick-card {
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .62);
}

.admin-shell .btn-new-post,
.admin-shell .dashboard-btn,
.admin-shell .btn-newsletter {
  color: #fff;
  background: var(--admin-green);
  border-radius: 8px;
  font-family: Poppins, Aptos, sans-serif;
  font-weight: 800;
}

.admin-shell .table-card {
  padding: 18px;
  overflow: auto;
}

.admin-shell table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.admin-shell th {
  padding: 13px 12px;
  color: var(--admin-muted);
  border-bottom: 1px solid var(--admin-line);
  font-family: Poppins, Aptos, sans-serif;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, .58);
}

.admin-shell td {
  padding: 13px 12px;
  border-bottom: 1px solid rgba(211, 207, 198, .55);
}

.admin-shell tr:hover {
  background: transparent;
}

.admin-shell tr:hover td {
  background: rgba(255, 255, 255, .54);
}

.admin-shell .icon-btn {
  border-radius: 8px;
  color: var(--admin-green);
}

.admin-shell .icon-btn.delete {
  color: var(--admin-red);
}

@media (max-width: 1180px) {
  .admin-shell .dashboard-grid,
  .admin-shell .stats-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .admin-shell .dashboard-grid,
  .admin-shell .stats-row,
  .admin-shell .quick-grid {
    grid-template-columns: 1fr;
  }

  .admin-shell .dashboard-header,
  .admin-shell .admin-topbar {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Refine 18: new post editor */
.admin-shell .post-editor-page {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.admin-shell .post-editor-header {
  margin-bottom: 18px;
  padding: 22px 24px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  border: 1px solid var(--admin-line);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(24, 56, 51, .95), rgba(35, 76, 70, .9)),
    var(--admin-green);
  color: #fff;
  box-shadow: var(--admin-shadow);
}

.admin-shell .editor-kicker {
  display: inline-flex;
  margin-bottom: 8px;
  color: var(--admin-gold);
  font-family: Poppins, Aptos, sans-serif;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.admin-shell .post-editor-header h1 {
  margin: 0;
  color: #fff;
  font-family: Poppins, Aptos, sans-serif;
  font-size: clamp(26px, 3vw, 38px);
  font-weight: 800;
  line-height: 1.05;
}

.admin-shell .post-editor-header p {
  max-width: 580px;
  margin: 8px 0 0;
  color: rgba(255, 255, 255, .74);
  font-size: 15px;
  line-height: 1.55;
}

.admin-shell .editor-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.admin-shell .editor-header-actions .dashboard-btn {
  min-width: auto;
  width: auto;
  padding: 11px 15px;
  color: var(--admin-green);
  background: var(--admin-gold);
  border: 1px solid rgba(255, 255, 255, .18);
}

.admin-shell .editor-header-actions .dashboard-btn.secondary {
  color: rgba(255, 255, 255, .86);
  background: rgba(255, 255, 255, .1);
}

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

.admin-shell .editor-main-card,
.admin-shell .editor-side-card {
  border: 1px solid var(--admin-line);
  border-radius: 12px;
  background: var(--admin-panel-strong);
  box-shadow: var(--admin-shadow);
}

.admin-shell .editor-main-card {
  padding: 22px;
}

.admin-shell .editor-side-panel {
  display: grid;
  gap: 14px;
}

.admin-shell .editor-side-card {
  padding: 18px;
}

.admin-shell .editor-card-title {
  margin-bottom: 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.admin-shell .editor-card-title span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 9px;
  color: var(--admin-green);
  background: rgba(234, 211, 167, .75);
  font-family: Poppins, Aptos, sans-serif;
  font-size: 12px;
  font-weight: 800;
}

.admin-shell .editor-card-title h2 {
  margin: 0;
  color: var(--admin-ink);
  font-family: Poppins, Aptos, sans-serif;
  font-size: 19px;
  font-weight: 800;
}

.admin-shell .editor-card-title p {
  margin: 4px 0 0;
  color: var(--admin-muted);
  font-size: 13px;
  line-height: 1.45;
}

.admin-shell .editor-card-title.compact {
  margin-bottom: 14px;
}

.admin-shell .editor-card-title.compact h2 {
  font-size: 16px;
}

.admin-shell .editor-field {
  margin-bottom: 16px;
}

.admin-shell .editor-field:last-child {
  margin-bottom: 0;
}

.admin-shell .editor-field label {
  display: block;
  margin-bottom: 7px;
  color: var(--admin-ink);
  font-family: Poppins, Aptos, sans-serif;
  font-size: 13px;
  font-weight: 800;
}

.admin-shell .editor-field input,
.admin-shell .editor-field textarea,
.admin-shell .editor-field select {
  width: 100%;
  margin: 0;
  padding: 13px 14px;
  border: 1px solid rgba(205, 200, 190, .95);
  border-radius: 9px;
  color: var(--admin-ink);
  background: rgba(255, 255, 255, .88);
  font: 15px/1.45 Aptos, Calibri, "Segoe UI", system-ui, sans-serif;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.admin-shell .editor-field textarea {
  min-height: 112px;
  resize: vertical;
}

.admin-shell .editor-content-field textarea {
  min-height: 440px;
}

.admin-shell .editor-field input:focus,
.admin-shell .editor-field textarea:focus,
.admin-shell .editor-field select:focus {
  border-color: rgba(24, 56, 51, .78);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(24, 56, 51, .09);
}

.admin-shell .editor-field small {
  display: block;
  margin-top: 6px;
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-shell .toggle-card {
  margin-top: 10px;
  padding: 13px;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 1px solid rgba(205, 200, 190, .9);
  border-radius: 10px;
  background: rgba(245, 243, 238, .58);
  cursor: pointer;
}

.admin-shell .toggle-card input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--admin-green);
}

.admin-shell .toggle-card b {
  display: block;
  color: var(--admin-ink);
  font-family: Poppins, Aptos, sans-serif;
  font-size: 13px;
  font-weight: 800;
}

.admin-shell .toggle-card small {
  display: block;
  margin-top: 2px;
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-shell .file-drop {
  min-height: 106px;
  padding: 18px;
  display: grid;
  place-items: center;
  text-align: center;
  border: 1px dashed rgba(24, 56, 51, .36);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(234, 211, 167, .16), rgba(255, 255, 255, .72)),
    #fff;
  cursor: pointer;
}

.admin-shell .file-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.admin-shell .file-drop span {
  color: var(--admin-green);
  font-family: Poppins, Aptos, sans-serif;
  font-size: 14px;
  font-weight: 800;
}

.admin-shell .file-drop small {
  margin-top: 4px;
}

.admin-shell .editor-actions {
  position: sticky;
  bottom: 14px;
}

.admin-shell .editor-actions button {
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: 10px;
  color: var(--admin-green);
  background: var(--admin-gold);
  box-shadow: 0 16px 30px rgba(24, 56, 51, .14);
  cursor: pointer;
  font-family: Poppins, Aptos, sans-serif;
  font-size: 14px;
  font-weight: 800;
}

.admin-shell .tox-tinymce {
  border-color: rgba(205, 200, 190, .95) !important;
  border-radius: 10px !important;
  overflow: hidden;
}

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

  .admin-shell .editor-actions {
    position: static;
  }
}

@media (max-width: 760px) {
  .admin-shell .post-editor-header {
    align-items: stretch;
    flex-direction: column;
    padding: 18px;
  }

  .admin-shell .editor-header-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-shell .editor-header-actions .dashboard-btn {
    width: 100%;
    justify-content: center;
  }

  .admin-shell .editor-main-card,
  .admin-shell .editor-side-card {
    padding: 16px;
  }

  .admin-shell .editor-content-field textarea {
    min-height: 340px;
  }
}

/* Refine 20: admin experience upgrades */
.admin-shell .admin-user-menu {
  position: relative;
}

.admin-shell .admin-user-button {
  min-height: 42px;
  padding: 5px 8px 5px 5px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--admin-line);
  border-radius: 10px;
  color: var(--admin-ink);
  background: rgba(255, 255, 255, .78);
  box-shadow: none;
  cursor: pointer;
  font-family: Poppins, Aptos, sans-serif;
  font-size: 13px;
  font-weight: 800;
}

.admin-shell .admin-user-button:hover {
  transform: none;
  color: var(--admin-green);
  background: #fff;
  box-shadow: 0 10px 24px rgba(27, 36, 40, .08);
}

.admin-shell .admin-user-avatar {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--admin-green);
  background: var(--admin-gold);
}

.admin-shell .admin-user-caret {
  color: var(--admin-muted);
  font-size: 14px;
}

.admin-shell .admin-user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 950;
  width: 190px;
  display: none;
  padding: 8px;
  border: 1px solid var(--admin-line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 20px 48px rgba(27, 36, 40, .14);
}

.admin-shell .admin-user-dropdown.active {
  display: block;
}

.admin-shell .admin-user-dropdown a {
  display: block;
  padding: 10px 11px;
  border-radius: 8px;
  color: var(--admin-ink);
  font-size: 13px;
  font-weight: 800;
}

.admin-shell .admin-user-dropdown a:hover {
  background: rgba(234, 211, 167, .28);
}

.admin-shell .admin-user-dropdown a.danger {
  color: var(--admin-red);
}

.admin-toast {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 2000;
  min-width: min(360px, calc(100vw - 36px));
  padding: 13px 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(234, 211, 167, .7);
  border-radius: 10px;
  color: #fff;
  background: rgba(24, 56, 51, .97);
  box-shadow: 0 22px 54px rgba(24, 56, 51, .2);
  animation: toastIn .24s ease both;
}

.admin-toast span {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--admin-green);
  background: var(--admin-gold);
  font-weight: 900;
}

.admin-toast strong {
  font-family: Poppins, Aptos, sans-serif;
  font-size: 13px;
}

.admin-toast.is-hiding {
  animation: toastOut .22s ease both;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}

.admin-shell .admin-page-desc {
  max-width: 620px;
  margin: 8px 0 0;
  color: var(--admin-muted);
  font-size: 15px;
  line-height: 1.55;
}

.admin-shell .section-heading {
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.admin-shell .section-heading h3 {
  margin: 0;
  color: var(--admin-ink);
  font-family: Poppins, Aptos, sans-serif;
  font-size: 18px;
  font-weight: 800;
}

.admin-shell .section-heading p {
  margin: 4px 0 0;
  color: var(--admin-muted);
  font-size: 13px;
}

.admin-shell .dashboard-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  margin-bottom: 18px;
}

.admin-shell .admin-insight-card {
  min-height: 100%;
  padding: 20px;
  border: 1px solid var(--admin-line);
  border-radius: 10px;
  color: #fff;
  background:
    linear-gradient(150deg, rgba(24, 56, 51, .96), rgba(35, 76, 70, .92)),
    var(--admin-green);
  box-shadow: var(--admin-shadow);
}

.admin-shell .admin-insight-card span {
  display: inline-flex;
  margin-bottom: 12px;
  color: var(--admin-gold);
  font-family: Poppins, Aptos, sans-serif;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.admin-shell .admin-insight-card h3 {
  margin: 0;
  color: #fff;
  font-family: Poppins, Aptos, sans-serif;
  font-size: 19px;
  font-weight: 800;
  line-height: 1.3;
}

.admin-shell .admin-insight-card p {
  margin: 10px 0 18px;
  color: rgba(255, 255, 255, .68);
}

.admin-shell .admin-insight-card a {
  display: inline-flex;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--admin-green);
  background: var(--admin-gold);
  font-family: Poppins, Aptos, sans-serif;
  font-size: 12px;
  font-weight: 800;
}

.admin-shell .quick-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-shell .quick-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  border-radius: 8px;
  color: var(--admin-green);
  background: rgba(234, 211, 167, .62);
  font-family: Poppins, Aptos, sans-serif;
  font-weight: 800;
}

.admin-shell .metric-pill,
.admin-shell .category-pill,
.admin-shell .status-chip,
.admin-shell .feature-dot {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 5px 9px;
  border-radius: 999px;
  font-family: Poppins, Aptos, sans-serif;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.admin-shell .metric-pill,
.admin-shell .category-pill {
  color: var(--admin-green);
  background: rgba(234, 211, 167, .38);
}

.admin-shell .status-chip.published,
.admin-shell .feature-dot.active {
  color: #fff;
  background: var(--admin-green);
}

.admin-shell .status-chip.draft,
.admin-shell .feature-dot {
  color: var(--admin-muted);
  background: rgba(102, 115, 111, .12);
}

.admin-shell .list-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.admin-shell .list-summary > div {
  padding: 15px 16px;
  border: 1px solid var(--admin-line);
  border-radius: 10px;
  background: var(--admin-panel);
  box-shadow: var(--admin-shadow);
}

.admin-shell .list-summary strong {
  display: block;
  color: var(--admin-ink);
  font-family: Poppins, Aptos, sans-serif;
  font-size: 24px;
  font-weight: 800;
}

.admin-shell .list-summary span {
  color: var(--admin-muted);
  font-size: 12px;
  font-weight: 800;
}

.admin-shell .admin-table .post-title-link {
  display: inline-block;
  color: var(--admin-ink);
  font-family: Poppins, Aptos, sans-serif;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
}

.admin-shell .admin-table small {
  display: block;
  margin-top: 4px;
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-shell .posts-table-card {
  padding: 0;
  overflow: hidden;
}

.admin-shell .posts-table th,
.admin-shell .posts-table td {
  vertical-align: middle;
}

.admin-shell .image-preview {
  display: none;
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid var(--admin-line);
  border-radius: 10px;
  background: rgba(245, 243, 238, .58);
}

.admin-shell .image-preview.is-visible {
  display: block;
}

.admin-shell .image-preview img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

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

  .admin-shell .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .admin-shell .topbar {
    align-items: stretch;
  }

  .admin-shell .topbar-right,
  .admin-shell .admin-user-menu,
  .admin-shell .admin-user-button {
    width: 100%;
  }

  .admin-shell .admin-user-button {
    justify-content: space-between;
  }

  .admin-shell .admin-user-dropdown {
    position: static;
    width: 100%;
    margin-top: 8px;
  }

  .admin-shell .list-summary,
  .admin-shell .quick-grid {
    grid-template-columns: 1fr;
  }

  .admin-shell .section-heading {
    flex-direction: column;
  }

  .admin-shell .table-card {
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
  }

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

  .admin-shell .admin-table tr:first-child {
    display: none;
  }

  .admin-shell .admin-table tr {
    margin-bottom: 12px;
    padding: 13px;
    border: 1px solid var(--admin-line);
    border-radius: 10px;
    background: var(--admin-panel-strong);
    box-shadow: var(--admin-shadow);
  }

  .admin-shell .admin-table td {
    padding: 9px 0;
    border-bottom: 1px solid rgba(211, 207, 198, .45);
  }

  .admin-shell .admin-table td:last-child {
    border-bottom: 0;
  }

  .admin-shell .admin-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 5px;
    color: var(--admin-muted);
    font-family: Poppins, Aptos, sans-serif;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
  }

  .admin-shell .admin-table td.actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
  }

  .admin-shell .admin-table td.actions::before {
    display: none;
  }
}

/* Refine 22: newsletter post picker */
.admin-shell .newsletter-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-shell .newsletter-actions form {
  margin: 0;
  display: inline-flex;
}

.admin-shell .btn-newsletter.main-send {
  min-height: 42px;
  padding-inline: 16px;
  background: var(--admin-green);
}

.admin-shell .btn-newsletter.main-send:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.newsletter-modal {
  position: fixed;
  inset: 0;
  z-index: 1900;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.newsletter-modal.active {
  display: flex;
}

.newsletter-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(23, 36, 35, .54);
  backdrop-filter: blur(6px);
}

.newsletter-modal-panel {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid rgba(234, 211, 167, .52);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 34px 90px rgba(0, 0, 0, .22);
}

.newsletter-modal-head {
  padding: 22px 22px 16px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--admin-line);
  background:
    linear-gradient(135deg, rgba(245, 243, 238, .8), #fff),
    #fff;
}

.newsletter-modal-head h3 {
  margin: 0;
  color: var(--admin-ink);
  font-family: Poppins, Aptos, sans-serif;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.1;
}

.newsletter-modal-head p {
  margin: 7px 0 0;
  color: var(--admin-muted);
  font-size: 14px;
  line-height: 1.5;
}

.modal-close {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border: 1px solid var(--admin-line);
  border-radius: 10px;
  color: var(--admin-ink);
  background: #fff;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.newsletter-picker-list {
  padding: 12px;
  overflow: auto;
  background: #fbfaf7;
}

.newsletter-picker-item {
  min-height: 76px;
  margin-bottom: 8px;
  padding: 13px 14px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(211, 207, 198, .8);
  border-radius: 10px;
  background: rgba(255, 255, 255, .92);
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.newsletter-picker-item:hover {
  transform: translateY(-1px);
  border-color: rgba(24, 56, 51, .28);
  background: #fff;
}

.newsletter-picker-item input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--admin-green);
}

.newsletter-picker-item b {
  display: block;
  color: var(--admin-ink);
  font-family: Poppins, Aptos, sans-serif;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
}

.newsletter-picker-item small {
  display: block;
  margin-top: 4px;
  color: var(--admin-muted);
  font-size: 12px;
}

.newsletter-modal-actions {
  padding: 14px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--admin-line);
  background: #fff;
}

@media (max-width: 760px) {
  .admin-shell .newsletter-actions,
  .admin-shell .newsletter-actions form,
  .admin-shell .newsletter-actions button {
    width: 100%;
  }

  .newsletter-modal {
    padding: 14px;
  }

  .newsletter-modal-head,
  .newsletter-modal-actions {
    flex-direction: column;
  }

  .newsletter-modal-actions button {
    width: 100%;
  }

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

  .admin-shell .admin-table tbody tr:first-child {
    display: block;
  }
}
