:root {
  --admin-primary: #77206e;
  --admin-primary-dark: #5b1856;
  --admin-primary-light: #f3e8f1;
  --admin-bg: #f4f3f6;
  --admin-text: #20232a;
  --admin-muted: #6b7280;
  --admin-border: #e2e0e8;
  --admin-white: #ffffff;
  --admin-sidebar-width: 230px;
  --admin-topbar-height: 56px;
  --admin-radius: 10px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body, button, input, select, textarea {
  font-family: 'Poppins', system-ui, sans-serif;
}

body {
  margin: 0;
  background: var(--admin-bg);
  color: var(--admin-text);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--admin-primary); }

img { max-width: 100%; }

/* --- Shell layout ----------------------------------------------- */

.admin-shell { display: flex; min-height: 100vh; }

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

.admin-sidebar {
  width: var(--admin-sidebar-width);
  flex-shrink: 0;
  background: var(--admin-primary-dark);
  color: #fff;
  padding: 20px 0;
  display: flex;
  flex-direction: column;
}

.admin-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 16px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,.15);
}

.admin-sidebar .brand {
  display: block;
  line-height: 0;
}

.admin-sidebar .brand img {
  display: block;
  height: 40px;
  width: auto;
  max-width: 170px;
}

.admin-sidebar .sidebar-close {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

.admin-sidebar nav { flex: 1; }

.admin-sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  color: rgba(255,255,255,.82);
  text-decoration: none;
  font-size: .92rem;
  border-left: 3px solid transparent;
  transition: background .15s ease, color .15s ease;
}

.admin-sidebar nav a i { width: 16px; text-align: center; opacity: .85; }

.admin-sidebar nav a:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
}

.admin-sidebar nav a.is-active {
  background: rgba(255,255,255,.14);
  color: #fff;
  border-left-color: #fff;
}

.admin-sidebar .logout {
  margin-top: 16px;
  border-top: 1px solid rgba(255,255,255,.15);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-sidebar .logout form { margin: 0; }

.admin-sidebar .logout button {
  width: 100%;
  background: none;
  border: 0;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}

.admin-sidebar .logout button:hover { color: #fff; }

.admin-sidebar .logout a,
.admin-sidebar .logout button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 20px;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  font-size: .86rem;
}

.admin-sidebar .logout a:hover { color: #fff; }

.admin-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 15, 25, .5);
  z-index: 40;
}

.admin-sidebar-overlay.is-open { display: block; }

/* --- Topbar (mobile only) ----------------------------------------- */

.admin-topbar {
  display: none;
  align-items: center;
  gap: 14px;
  height: var(--admin-topbar-height);
  padding: 0 16px;
  background: var(--admin-white);
  border-bottom: 1px solid var(--admin-border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.menu-toggle {
  background: none;
  border: none;
  font-size: 1.15rem;
  color: var(--admin-text);
  cursor: pointer;
  padding: 8px;
  margin: -8px;
  line-height: 1;
}

.admin-topbar-title {
  font-weight: 600;
  font-size: .95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Main content --------------------------------------------------- */

.admin-main { flex: 1; padding: 66px 84px; width: 100%; }

.admin-main h1 { margin-top: 0; font-size: 1.5rem; }

.admin-card {
  background: var(--admin-white);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  padding: 20px 24px;
  margin-bottom: 20px;
}

/* Lay a group of panel cards (page sections, project cards, etc.) out
   two per row instead of stacking them full-width. */
.admin-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

.admin-card-grid .admin-card { margin-bottom: 0; }

.admin-flash {
  background: #e6f6ec;
  border: 1px solid #b4e3c4;
  color: #1a6b3c;
  padding: 10px 16px;
  border-radius: 8px;
  margin-bottom: 18px;
  font-size: .9rem;
}

.admin-flash.is-error {
  background: #fbe8e8;
  border-color: #f0b7b7;
  color: #9b2020;
}

.admin-field { margin-bottom: 16px; }
.admin-field label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: 6px; }
.admin-field .hint { color: var(--admin-muted); font-size: .78rem; margin-top: 4px; }

input[type=text], input[type=email], input[type=password], input[type=url], input[type=file], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  font-family: inherit;
  font-size: .95rem;
  background: #fff;
  color: var(--admin-text);
}

input[type=text]:focus, input[type=email]:focus, input[type=password]:focus,
input[type=url]:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 3px var(--admin-primary-light);
}

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

input[type=checkbox] { width: 17px; height: 17px; vertical-align: middle; accent-color: var(--admin-primary); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  min-height: 40px;
  border-radius: 8px;
  border: none;
  background: var(--admin-primary);
  color: #fff;
  font-weight: 600;
  font-size: .88rem;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s ease;
}

.btn:hover { background: var(--admin-primary-dark); }
.btn.btn-secondary { background: #e5e3ec; color: var(--admin-text); }
.btn.btn-secondary:hover { background: #d8d5e3; }
.btn.btn-danger { background: #c0392b; }
.btn.btn-danger:hover { background: #a02e22; }
.btn.btn-small { padding: 7px 14px; min-height: 32px; font-size: .78rem; }

/* --- Tables: horizontal scroll on narrow screens -------------------- */

.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

table.admin-table { width: 100%; border-collapse: collapse; min-width: 480px; }
.admin-table th, .admin-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--admin-border); font-size: .88rem; vertical-align: top; }
.admin-table th { color: var(--admin-muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.admin-table td input[type=text] { min-width: 110px; }

.card-row {
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
  background: #fbfbfd;
}

.card-row-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.card-row-grid .full { grid-column: 1 / -1; }

.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--admin-bg);
  padding: 20px;
}

.login-box {
  background: #fff;
  border-radius: 16px;
  padding: 36px 32px;
  width: min(100%, 380px);
  box-shadow: 0 20px 60px rgba(69,43,80,.12);
}

.login-box h1 { margin-top: 0; font-size: 1.3rem; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.media-grid figure { margin: 0; border: 1px solid var(--admin-border); border-radius: 8px; overflow: hidden; background: #fff; }
.media-grid img { width: 100%; height: 100px; object-fit: cover; display: block; }
.media-grid figcaption { padding: 6px 8px; font-size: .72rem; word-break: break-all; }

/* ==================================================================
   Responsive: tablet and below - sidebar becomes an off-canvas drawer
   ================================================================== */

@media (max-width: 860px) {
  .admin-topbar { display: flex; }

  .admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,.2);
  }

  .admin-sidebar.is-open { transform: translateX(0); }

  .admin-sidebar .sidebar-close { display: inline-flex; }

  .admin-main { padding: 28px 22px; }

  .admin-main h1 { font-size: 1.3rem; }

  .admin-card { padding: 16px; }

  .card-row-grid { grid-template-columns: 1fr; }
  .admin-card-grid { grid-template-columns: 1fr; }

  .login-box { padding: 28px 22px; }
}

@media (max-width: 480px) {
  .btn { width: 100%; }
  .row-actions .btn,
  .row-actions form { flex: 1; }
  .row-actions form .btn { width: 100%; }
}

/* --- Modals ---------------------------------------------------------- */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 15, 25, .55);
  z-index: 200;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
}

.modal-overlay.is-open { display: flex; }

.modal {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 640px;
  padding: 28px;
  position: relative;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .3);
  margin: auto 0;
}

.modal h2 { margin-top: 0; font-size: 1.15rem; padding-right: 32px; }

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  color: var(--admin-muted);
  padding: 6px;
}

.modal-close:hover { color: var(--admin-text); }

.modal-small { max-width: 420px; text-align: center; }
.modal-wide { max-width: 900px; }

.modal-confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 22px;
}

/* Compact list rows used as the "closed" state for things that open
   into an edit modal (projects, nav items, sections, settings). */
.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--admin-border);
}

.summary-row:last-child { border-bottom: none; }

.summary-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.summary-main i { color: var(--admin-primary); width: 18px; text-align: center; flex-shrink: 0; font-size: 1.1rem; }

.summary-text strong { display: block; font-size: .92rem; }
.summary-text span {
  display: block;
  font-size: .8rem;
  color: var(--admin-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 420px;
}

.summary-actions { display: flex; gap: 6px; flex-shrink: 0; }

@media (max-width: 860px) {
  .modal { padding: 20px; }
  .summary-row { flex-wrap: wrap; }
  .summary-text span { max-width: 220px; }
}


/* --- Entity grid (the standard list view for every admin entity) ------- */

.entity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.entity-grid-empty { grid-column: 1 / -1; color: var(--admin-muted); margin: 0; }

.entity-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--admin-white);
  border: 1px solid var(--admin-border);
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 1px 2px rgba(32, 35, 42, .04);
  transition: box-shadow .2s ease, border-color .2s ease, transform .2s ease;
}

.entity-card:hover {
  border-color: #d6c9da;
  box-shadow: 0 10px 28px rgba(69, 43, 80, .09);
  transform: translateY(-2px);
}

.entity-card.has-thumb { padding-top: 0; }

.entity-thumb {
  margin: 0 -22px 4px;
  aspect-ratio: 16 / 9;
  background: var(--admin-primary-light);
  border-radius: 14px 14px 0 0;
  overflow: hidden;
}

.entity-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.thumb-field { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.thumb-preview {
  width: 128px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--admin-border);
  background: var(--admin-primary-light);
}

.thumb-preview[hidden],
.check-row[hidden] { display: none; }

.check-row { display: flex; align-items: center; gap: 8px; font-size: .85rem; cursor: pointer; }
.thumb-field-controls { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 8px; }

.entity-head { display: flex; align-items: center; gap: 14px; min-width: 0; }

.entity-icon {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--admin-primary-light);
  color: var(--admin-primary);
  display: grid;
  place-items: center;
  font-size: 1.1rem;
}

.entity-title { min-width: 0; }
.entity-title strong { display: block; font-size: 1rem; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.entity-title small { display: block; color: var(--admin-muted); font-size: .76rem; margin-top: 3px; overflow-wrap: anywhere; }

.entity-text {
  margin: 0;
  color: var(--admin-muted);
  font-size: .84rem;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.entity-meta { display: flex; flex-wrap: wrap; gap: 6px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #f0eef4;
  color: var(--admin-muted);
  font-size: .7rem;
  font-weight: 600;
}

.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }

.badge.is-ok { background: #e6f6ec; color: #1a6b3c; }
.badge.is-off { background: #fbe8e8; color: #9b2020; }

/* Footer: hairline divider, quiet outline buttons instead of solid blocks */
.entity-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid #efedf3;
}

.entity-actions form { display: flex; flex: 1; margin: 0; }
.entity-actions > .btn { flex: 1; }
.entity-actions form .btn { width: 100%; }

.entity-actions .btn {
  background: transparent;
  border: 1px solid var(--admin-border);
  color: var(--admin-text);
  font-weight: 500;
}

.entity-actions .btn:hover { background: var(--admin-primary-light); border-color: #d9c3d6; color: var(--admin-primary); }
.entity-actions .btn.btn-danger { color: #b3261e; }
.entity-actions .btn.btn-danger:hover { background: #fdecea; border-color: #f1c4c0; color: #9b1c15; }
.entity-actions .btn i { font-size: .8em; opacity: .85; }

@media (max-width: 480px) {
  .entity-grid { grid-template-columns: 1fr; gap: 16px; }
  .entity-card { padding: 18px; }
  .entity-card.has-thumb { padding-top: 0; }
  .entity-thumb { margin: 0 -18px 4px; }
}

/* --- Sortable list view (menu items) -------------------------------- */

.sort-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }

.list-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--admin-white);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  padding: 12px 16px;
}

.list-row:hover { border-color: #cfc3d4; }

.drag-handle { cursor: grab; color: var(--admin-muted); padding: 6px 4px; touch-action: none; }
.drag-handle:active { cursor: grabbing; }

.list-order {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--admin-primary-light);
  color: var(--admin-primary);
  font-size: .75rem;
  font-weight: 600;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.list-main { flex: 1; min-width: 0; }
.list-main strong { display: block; font-size: .95rem; }
.list-main small { display: block; color: var(--admin-muted); font-size: .78rem; overflow-wrap: anywhere; }

.sortable-ghost { opacity: .4; border-style: dashed; border-color: var(--admin-primary); }

@media (max-width: 640px) {
  .list-row { flex-wrap: wrap; }
  .list-main { flex-basis: calc(100% - 100px); }
  .list-row .entity-actions { width: 100%; }
}

/* --- Page header component -------------------------------------------- */

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.page-header-main { min-width: 0; }
.page-header h1 { margin: 0; font-size: 1.6rem; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.page-header-hint { margin: 6px 0 0; color: var(--admin-muted); font-size: .88rem; max-width: 640px; }
.page-header-back { display: inline-block; margin-bottom: 8px; font-size: .82rem; text-decoration: none; }
.page-header-back:hover { text-decoration: underline; }
.page-header-actions { display: flex; gap: 10px; flex-wrap: wrap; }

@media (max-width: 860px) {
  .page-header { margin-bottom: 20px; }
  .page-header h1 { font-size: 1.35rem; }
  .page-header-actions { width: 100%; }
  .page-header-actions .btn { flex: 1; }
}

/* --- Auth shell (login) -------------------------------------------- */

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1000px 500px at 85% -10%, rgba(119, 32, 110, .22), transparent 60%),
    radial-gradient(800px 500px at -10% 110%, rgba(119, 32, 110, .14), transparent 60%),
    var(--admin-bg);
}

.auth-card {
  width: min(100%, 420px);
  background: var(--admin-white);
  border: 1px solid var(--admin-border);
  border-radius: 20px;
  padding: 40px 36px 32px;
  box-shadow: 0 30px 80px rgba(69, 43, 80, .14);
}

.auth-logo { display: block; margin: 0 auto 22px; height: 54px; width: auto; max-width: 100%; }
.auth-card h1 { margin: 0 0 6px; font-size: 1.35rem; text-align: center; }
.auth-sub { margin: 0 0 26px; text-align: center; color: var(--admin-muted); font-size: .86rem; }

.auth-input { position: relative; }
.auth-input > i.fa-solid:first-child {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--admin-muted); font-size: .9rem; pointer-events: none;
}
.auth-input input { padding-left: 40px; padding-right: 42px; min-height: 46px; }
.auth-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--admin-muted); cursor: pointer; padding: 8px 10px;
}
.auth-toggle:hover { color: var(--admin-text); }

.auth-submit { width: 100%; min-height: 46px; margin-top: 6px; font-size: .95rem; }
.auth-back { display: block; text-align: center; margin-top: 22px; font-size: .82rem; color: var(--admin-muted); text-decoration: none; }
.auth-back:hover { color: var(--admin-primary); }

@media (max-width: 480px) {
  .auth-card { padding: 30px 22px 26px; border-radius: 16px; }
}

.section-title { font-size: 1.1rem; margin: 8px 0 14px; }

/* --- Analytics, dashboard and comments -------------------------------- */

.muted { color: var(--admin-muted); }
.sub-title { margin: 22px 0 10px; font-size: .85rem; font-weight: 600; color: var(--admin-muted); text-transform: uppercase; letter-spacing: .04em; }

.nav-badge {
  margin-left: auto;
  min-width: 20px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #e0457b;
  color: #fff;
  font-size: .7rem;
  font-weight: 600;
  text-align: center;
}

.admin-sidebar nav a { align-items: center; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.tabs-inline { margin-bottom: 0; }

.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--admin-white);
  border: 1px solid var(--admin-border);
  color: var(--admin-text);
  font-size: .85rem;
  font-weight: 500;
  text-decoration: none;
}

.tab:hover { border-color: #d6c9da; color: var(--admin-primary); }
.tab.is-active { background: var(--admin-primary); border-color: var(--admin-primary); color: #fff; }
.tab-count { padding: 0 8px; border-radius: 999px; background: rgba(0, 0, 0, .08); font-size: .75rem; }
.tab.is-active .tab-count { background: rgba(255, 255, 255, .22); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 20px; }

.stat-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 18px;
  background: var(--admin-white);
  border: 1px solid var(--admin-border);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(32, 35, 42, .04);
}

.stat-icon {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--admin-primary-light);
  color: var(--admin-primary);
}

.stat-label { display: block; color: var(--admin-muted); font-size: .78rem; }
.stat-value { display: block; font-size: 1.6rem; line-height: 1.2; font-weight: 600; }
.stat-delta { display: inline-block; margin-top: 2px; font-size: .75rem; font-weight: 600; }
.stat-delta.is-up { color: #1a6b3c; }
.stat-delta.is-down { color: #b3261e; }
.stat-delta.is-flat { color: var(--admin-muted); }
.stat-prev { display: block; color: var(--admin-muted); font-size: .7rem; }

.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-bottom: 8px; align-items: start; }
.chart-card h3 { margin: 0 0 14px; font-size: 1rem; }
.chart-box { position: relative; height: 280px; }
.chart-box-sm { height: 200px; }
.big-number { margin: 6px 0; font-size: 2.6rem; font-weight: 600; color: var(--admin-primary); line-height: 1.1; }
.dash-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.dash-head .section-title { margin-bottom: 0; }

.admin-table td.muted { white-space: nowrap; }

.bar-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.bar-head { display: flex; justify-content: space-between; gap: 12px; font-size: .85rem; margin-bottom: 5px; }
.bar-track { height: 8px; border-radius: 999px; background: #efedf3; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--admin-primary), #b34ba8); }

.activity-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.activity-list li { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid #efedf3; font-size: .88rem; }
.activity-list li:last-child { border-bottom: 0; }
.activity-list small { color: var(--admin-muted); }
.activity-text { color: var(--admin-muted); margin: 2px 0; }
.activity-icon { flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; }
.activity-icon.like { background: #fde7ef; color: #e0457b; }
.activity-icon.comment { background: #e3f4ec; color: #2f9e6f; }

.notice-card { display: flex; gap: 20px; align-items: center; justify-content: space-between; flex-wrap: wrap; border-left: 4px solid var(--admin-primary); }
.notice-card h3 { margin: 0 0 6px; }
.notice-card p { margin: 0; color: var(--admin-muted); max-width: 640px; }

.entity-card.is-comment .entity-text { -webkit-line-clamp: 8; }
.entity-actions { flex-wrap: wrap; }
.entity-actions > .btn, .entity-actions form { flex: 1 1 96px; }
.comment-quote { margin: 0 0 16px; padding: 12px 16px; border-left: 3px solid var(--admin-primary); background: var(--admin-primary-light); border-radius: 0 8px 8px 0; font-size: .9rem; }

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

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

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .chart-box { height: 240px; }
}

/* --- Visitors page and consent strip ------------------------------------------------------------ */

.consent-strip { display: flex; align-items: center; gap: 16px; padding: 16px 20px; margin-bottom: 20px; }
.consent-strip > i { font-size: 1.3rem; color: var(--admin-primary); }
.consent-strip strong { margin-inline-end: 8px; }
.consent-link { margin-inline-start: 14px; font-size: .85rem; font-weight: 600; text-decoration: none; }
.pager { display: flex; align-items: center; justify-content: center; gap: 16px; padding-top: 18px; }
.admin-table code { padding: 2px 6px; border-radius: 6px; background: var(--admin-primary-light); color: var(--admin-primary); font-size: .8rem; }

.reset-card form { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.reset-card .btn-danger { background: #c0392b; }

.entity-thumb.is-contain { background: #fff; border-bottom: 1px solid #efedf3; }
.entity-thumb.is-contain img { object-fit: contain; padding: 18px 28px; }
.thumb-preview.thumb-contain { object-fit: contain; background: #fff; padding: 6px; }

/* --- Empty state card (ui_empty_state) ------------------------------------------------------------ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 48px 24px;
  text-align: center;
  background: var(--admin-white);
  border: 1.5px dashed #d9d3e0;
  border-radius: 14px;
  color: var(--admin-muted);
}

.empty-state-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 4px;
  border-radius: 50%;
  background: var(--admin-primary-light);
  color: var(--admin-primary);
  font-size: 1.5rem;
}

.empty-state h3 { margin: 4px 0 0; font-size: 1.05rem; font-weight: 600; color: var(--admin-text); }
.empty-state p { max-width: 46ch; margin: 0; font-size: .9rem; line-height: 1.6; }
.empty-state-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 12px; }

.empty-state.is-success { border-color: #bfe3cc; background: #f6fbf8; }
.empty-state.is-success .empty-state-icon { background: #e6f6ec; color: #1a6b3c; }

.empty-state.is-compact { padding: 24px 16px; gap: 4px; border-width: 1px; }
.empty-state.is-compact .empty-state-icon { width: 44px; height: 44px; font-size: 1.1rem; }
.empty-state.is-compact h3 { font-size: .95rem; }
.empty-state.is-compact p { font-size: .82rem; }

/* Inside grids and lists the card spans the full width. */
.entity-grid > .empty-state,
.sort-list > .empty-state { grid-column: 1 / -1; width: 100%; }

/* Inside tables and cards it drops its own frame. */
td.empty-cell { padding: 0; border-bottom: 0; }
.admin-card .empty-state.is-compact,
td.empty-cell .empty-state { border: 0; background: transparent; }
.media-grid > .empty-state { grid-column: 1 / -1; }

/* --- Blog post editor window ------------------------------------------------------------------------------ */

.modal-editor { max-width: 1040px; padding: 26px 30px 0; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.title-input {
  width: 100%;
  padding: 10px 2px;
  border: 0;
  border-bottom: 2px solid var(--admin-border);
  border-radius: 0;
  background: transparent;
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: -.02em;
}

.title-input:focus { outline: none; border-bottom-color: var(--admin-primary); box-shadow: none; }
.title-input::placeholder { color: #b9b2c2; font-weight: 500; }

.editor-status { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; font-size: .8rem; color: var(--admin-muted); }

.post-details { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 8px; }

.link-btn { margin-left: 8px; padding: 0; border: 0; background: none; color: var(--admin-primary); font: inherit; font-size: .78rem; font-weight: 600; cursor: pointer; text-decoration: underline; }

.post-advanced { margin: 4px 0 20px; border: 1px solid var(--admin-border); border-radius: 10px; }
.post-advanced summary { padding: 12px 16px; cursor: pointer; font-weight: 600; font-size: .9rem; }
.post-advanced summary small { margin-left: 8px; font-weight: 400; color: var(--admin-muted); }
.advanced-body { padding: 4px 16px 4px; display: grid; gap: 4px; }
.admin-field label small { font-weight: 400; color: var(--admin-muted); }

.restore-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding: 12px 16px;
  background: #fff7e0;
  border: 1px solid #f0d98a;
  border-radius: 10px;
  font-size: .88rem;
  color: #6b5200;
}

.restore-bar[hidden] { display: none; }
.restore-actions { display: flex; gap: 8px; }

/* Buttons stay visible while scrolling through a long post. */
.modal-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 -30px;
  padding: 14px 30px;
  background: #fff;
  border-top: 1px solid var(--admin-border);
  border-radius: 0 0 14px 14px;
}

.modal-actions-spacer { flex: 1; }
.modal-actions .btn[hidden] { display: none; }

.tox-tinymce { border-radius: 10px !important; border-color: var(--admin-border) !important; }

@media (max-width: 860px) {
  .modal-editor { padding: 20px 16px 0; }
  .post-details { grid-template-columns: 1fr; gap: 0; }
  .modal-actions { margin: 0 -16px; padding: 12px 16px; flex-wrap: wrap; }
  .title-input { font-size: 1.3rem; }
}


.post-details.is-single { grid-template-columns: 1fr; }
