/*
Theme Name: helpdesk
Theme URI: https://appnestdigital.com
Author: AppNest Digital
Author URI: https://appnestdigital.com
Description: Secure multi-theme support portal with Envato purchase verification for ThemeForest products.
Version: 1.5.7
Requires at least: 6.4
Tested up to: 6.6
Requires PHP: 8.0
Text Domain: helpdesk
*/

:root {
  --hd-bg: #0b1120;
  --hd-bg-soft: #111827;
  --hd-surface: rgba(255, 255, 255, 0.88);
  --hd-surface-strong: #ffffff;
  --hd-surface-dark: #0f172a;
  --hd-primary: #5b7cff;
  --hd-primary-strong: #3558f5;
  --hd-accent: #13c4a3;
  --hd-accent-2: #f97316;
  --hd-forum: #8b5cf6;
  --hd-kb: #0ea5e9;
  --hd-docs: #22c55e;
  --hd-ticket: #ef4444;
  --hd-faq: #f59e0b;
  --hd-text: #0f172a;
  --hd-muted: #5b6474;
  --hd-border: rgba(148, 163, 184, 0.22);
  --hd-border-strong: rgba(148, 163, 184, 0.35);
  --hd-success: #16a34a;
  --hd-danger: #dc2626;
  --hd-warning: #d97706;
  --hd-shadow: 0 22px 70px rgba(15, 23, 42, 0.14);
  --hd-shadow-soft: 0 12px 30px rgba(15, 23, 42, 0.08);
  --hd-radius: 24px;
  --hd-radius-sm: 16px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--hd-text);
  background:
    radial-gradient(circle at 0% 0%, rgba(91, 124, 255, 0.22), transparent 30%),
    radial-gradient(circle at 100% 10%, rgba(19, 196, 163, 0.18), transparent 25%),
    linear-gradient(180deg, #eef4ff 0%, #f8fbff 42%, #eef2f7 100%);
  min-height: 100vh;
}
body.admin-bar .hd-site-shell { min-height: calc(100vh - 32px); }
a { color: var(--hd-primary-strong); }
a:hover { color: #1d4ed8; }
img { max-width: 100%; height: auto; }

.hd-site-shell {
  position: relative;
  overflow: hidden;
}
.hd-site-shell::before,
.hd-site-shell::after {
  content: "";
  position: fixed;
  inset: auto;
  width: 380px;
  height: 380px;
  border-radius: 999px;
  filter: blur(70px);
  pointer-events: none;
  opacity: 0.35;
  z-index: 0;
}
.hd-site-shell::before {
  top: -120px;
  left: -100px;
  background: rgba(91, 124, 255, 0.28);
}
.hd-site-shell::after {
  right: -140px;
  bottom: -150px;
  background: rgba(19, 196, 163, 0.22);
}

.hd-wrap {
  position: relative;
  z-index: 1;
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 24px;
}


body.hd-layout-boxed .hd-wrap {
  max-width: 1240px;
}

body.hd-layout-fullwidth .hd-wrap {
  max-width: none;
  width: 100%;
  padding-left: 32px;
  padding-right: 32px;
}

body.hd-layout-fullwidth .hd-grid.themes.theme-count-1 {
  grid-template-columns: minmax(280px, 360px);
  justify-content: center;
}

body.hd-layout-fullwidth .hd-grid.themes.theme-count-2 {
  grid-template-columns: repeat(2, minmax(260px, 340px));
  justify-content: center;
}

body.hd-layout-fullwidth .hd-grid.themes.theme-count-3 {
  grid-template-columns: repeat(3, minmax(220px, 300px));
  justify-content: center;
}

body.hd-layout-fullwidth .hd-grid.themes.theme-count-4,
body.hd-layout-fullwidth .hd-grid.themes.theme-count-many {
  grid-template-columns: repeat(auto-fit, minmax(220px, 280px));
  justify-content: center;
}

body.hd-layout-fullwidth .hd-site-shell {
  width: 100%;
}

body.hd-layout-fullwidth .hd-wrap {
  max-width: none;
  width: 100%;
  padding-left: clamp(18px, 3vw, 40px);
  padding-right: clamp(18px, 3vw, 40px);
}

body.hd-layout-fullwidth .hd-panel,
body.hd-layout-fullwidth .entry-content,
body.hd-layout-fullwidth .hd-single-entry,
body.hd-layout-fullwidth .hd-front-page-content,
body.hd-layout-fullwidth .hd-front-page-content > .elementor,
body.hd-layout-fullwidth .hd-front-page-content .elementor-section-wrap,
body.hd-layout-fullwidth .hd-front-page-content .elementor-widget-wrap {
  max-width: none;
  width: 100%;
}

body.hd-layout-fullwidth .hd-single-entry {
  margin: 0;
}

body.hd-layout-fullwidth .hd-home-hero,
body.hd-layout-fullwidth .hd-grid-2,
body.hd-layout-fullwidth .hd-grid-3,
body.hd-layout-fullwidth .hd-library-grid {
  width: 100%;
}

body.hd-layout-fullwidth .elementor-section.elementor-section-boxed > .elementor-container,
body.hd-layout-fullwidth .elementor-container {
  max-width: none !important;
  width: 100% !important;
}

body.hd-layout-fullwidth .elementor-top-section {
  padding-left: 0;
  padding-right: 0;
}

.hd-card {
  background: var(--hd-surface);
  backdrop-filter: blur(18px);
  border: 1px solid var(--hd-border);
  border-radius: var(--hd-radius);
  padding: 24px;
  box-shadow: var(--hd-shadow-soft);
}

.hd-panel {
  background: var(--hd-surface-strong);
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 22px;
  padding: 26px;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.05);
}

.hd-grid { display: grid; gap: 20px; }
.hd-grid.themes {
  align-items: stretch;
  justify-content: center;
  grid-auto-rows: 1fr;
}
.hd-grid.themes.theme-count-1 {
  grid-template-columns: minmax(280px, 360px);
  justify-content: center;
}
.hd-grid.themes.theme-count-2 {
  grid-template-columns: repeat(2, minmax(280px, 360px));
  justify-content: center;
}
.hd-grid.themes.theme-count-3,
.hd-grid.themes.theme-count-4,
.hd-grid.themes.theme-count-many {
  grid-template-columns: repeat(auto-fit, minmax(260px, 320px));
  justify-content: center;
}
.hd-grid-2 { display: grid; gap: 20px; grid-template-columns: 1.4fr .9fr; }
.hd-grid-3 { display: grid; gap: 18px; grid-template-columns: repeat(3, minmax(0, 1fr)); }

.hd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  font-weight: 700;
  letter-spacing: .01em;
  color: #fff;
  background: linear-gradient(135deg, var(--hd-primary), var(--hd-primary-strong));
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(53, 88, 245, 0.25);
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}
.hd-btn:hover { transform: translateY(-1px); box-shadow: 0 14px 28px rgba(53, 88, 245, 0.32); color:#fff; }
.hd-btn.secondary {
  color: var(--hd-text);
  background: #fff;
  border: 1px solid rgba(203, 213, 225, 0.9);
  box-shadow: none;
}
.hd-btn.secondary:hover { box-shadow: var(--hd-shadow-soft); }
.hd-btn.ghost {
  color: #fff;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.18);
  box-shadow: none;
}
.hd-btn.ghost:hover { background: rgba(255,255,255,.14); }

.hd-input,
.hd-select,
.hd-textarea {
  width: 100%;
  min-height: 50px;
  padding: 13px 15px;
  border: 1px solid rgba(203, 213, 225, 0.95);
  border-radius: 16px;
  background: #fff;
  color: var(--hd-text);
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.hd-input:focus,
.hd-select:focus,
.hd-textarea:focus {
  border-color: rgba(91, 124, 255, 0.55);
  box-shadow: 0 0 0 4px rgba(91, 124, 255, 0.12);
}
.hd-textarea { min-height: 140px; resize: vertical; }
.hd-form-row { margin-bottom: 14px; }
.hd-form-grid { display:grid; gap:14px; grid-template-columns: repeat(2,minmax(0,1fr)); }

.hd-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}
.hd-badge.active { background: linear-gradient(135deg, #22c55e, #16a34a); }
.hd-badge.expired { background: linear-gradient(135deg, #ef4444, #dc2626); }
.hd-badge.extended { background: linear-gradient(135deg, #14b8a6, #0f766e); }
.hd-badge.neutral { color: var(--hd-text); background: #e2e8f0; }

.hd-alert {
  border-radius: 18px;
  padding: 14px 16px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.hd-alert.error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.hd-alert.success { background: #ecfdf5; color: #166534; border-color: #bbf7d0; }
.hd-alert.info { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }

.hd-site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 22px;
  margin-top: 8px;
  background: rgba(15, 23, 42, 0.82);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.hd-brand { display:flex; align-items:center; gap:14px; min-width:0; }
.hd-brand-logo {
  width: 48px; height: 48px; border-radius: 16px; overflow:hidden; display:grid; place-items:center;
  background: rgba(255,255,255,.08); border:1px solid rgba(255,255,255,.12);
}
.hd-brand-logo img { width:100%; height:100%; object-fit:cover; display:block; }
.hd-brand-mark {
  width: 48px; height: 48px; border-radius: 16px;
  background: linear-gradient(135deg, var(--hd-primary), var(--hd-accent));
  display:grid; place-items:center; color:#fff; font-weight:800; box-shadow:0 12px 26px rgba(19,196,163,.22);
}
.hd-brand-text strong { display:block; font-size:1.05rem; color:#fff; }
.hd-brand-text span { display:block; color: rgba(255,255,255,.72); font-size:.92rem; }
.hd-header-actions { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }

.hd-nav { display: flex; align-items: center; }
.hd-menu {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  list-style: none; margin: 0; padding: 0;
}
.hd-menu li { margin: 0; }
.hd-menu a {
  display:inline-flex; align-items:center; min-height:42px; padding:0 14px;
  border-radius:999px; color: rgba(255,255,255,.86); text-decoration:none; font-weight:600;
}
.hd-menu a:hover,
.hd-menu a:focus,
.current-menu-item > a,
.current_page_item > a {
  color: #fff;
  background: rgba(255, 255, 255, 0.11);
}

.hd-hero {
  position: relative;
  overflow: hidden;
  padding: 34px;
  border-radius: 30px;
  color: #fff;
  background: linear-gradient(135deg, #0f172a 0%, #172554 48%, #1e3a8a 100%);
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.18);
}
.hd-hero::before {
  content: "";
  position: absolute;
  inset: auto -40px -70px auto;
  width: 240px;
  height: 240px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  filter: blur(6px);
}
.hd-hero > * { position: relative; z-index:1; }
.hd-hero h1, .hd-hero h2 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 3vw, 3.4rem);
  line-height: 1.02;
}
.hd-hero p {
  margin: 0;
  max-width: 760px;
  color: rgba(255,255,255,.82);
  font-size: 1.04rem;
}
.hd-hero-meta {
  margin-top: 20px;
  display:flex; flex-wrap:wrap; gap:10px;
}
.hd-pill {
  display:inline-flex; align-items:center; gap:8px;
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(255,255,255,.1);
  border:1px solid rgba(255,255,255,.12);
  color:#fff; font-weight:600;
}
.hd-section-forum { background: linear-gradient(135deg, #2e1065 0%, #5b21b6 50%, #7c3aed 100%); }
.hd-section-kb { background: linear-gradient(135deg, #082f49 0%, #0369a1 50%, #0ea5e9 100%); }
.hd-section-docs { background: linear-gradient(135deg, #052e16 0%, #166534 50%, #22c55e 100%); }
.hd-section-ticket { background: linear-gradient(135deg, #450a0a 0%, #991b1b 50%, #ef4444 100%); }
.hd-section-faq { background: linear-gradient(135deg, #451a03 0%, #b45309 50%, #f59e0b 100%); }
.hd-section-dashboard { background: linear-gradient(135deg, #111827 0%, #1d4ed8 55%, #06b6d4 100%); }

.hd-home-hero {
  display:grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr);
  gap: 26px;
  align-items: center;
}
.hd-home-stats { display:grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap:14px; margin-top:22px; }
.hd-stat {
  padding: 16px;
  border-radius: 20px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
}
.hd-stat strong { display:block; font-size:1.4rem; margin-bottom:4px; }
.hd-hero-card {
  padding: 24px;
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(255,255,255,.14), rgba(255,255,255,.04));
  border: 1px solid rgba(255,255,255,.12);
}
.hd-hero-card ul { margin: 0; padding-left: 18px; color: rgba(255,255,255,.85); }
.hd-hero-card li + li { margin-top: 10px; }

.hd-section-title { display:flex; justify-content:space-between; align-items:end; gap:20px; margin-bottom:16px; }
.hd-section-title h2, .hd-section-title h3 { margin:0; font-size:1.9rem; }
.hd-section-title p { margin:6px 0 0; color: var(--hd-muted); }

.hd-theme-card {
  overflow: hidden;
  padding: 0;
  width: 100%;
  max-width: none;
  min-width: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  align-self: stretch;
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.96));
}
.hd-theme-media {
  position: relative;
  aspect-ratio: 4 / 3;
  min-height: 210px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  background: linear-gradient(135deg, #0f172a, #111827 60%, #0b1120);
}
.hd-theme-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  border-radius: 16px;
  background: transparent;
}
.hd-theme-overlay {
  position:absolute; inset:auto 10px 10px 10px;
  display:flex; justify-content:flex-start; align-items:end; gap:8px;
  flex-wrap: wrap;
}
.hd-theme-chip {
  padding:7px 10px; border-radius:999px; background:rgba(15,23,42,.74); color:#fff; font-size:12px; font-weight:700;
  backdrop-filter: blur(8px);
}
.hd-theme-chip.alt { background: rgba(30, 64, 175, 0.86); }
.hd-theme-body { padding: 16px; display:flex; flex-direction:column; gap:10px; flex:1; }
.hd-theme-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:auto; padding-top:10px; }
.hd-theme-actions .hd-btn { min-height: 40px; padding: 0 13px; font-size: 13px; }
.hd-theme-desc {
  color: var(--hd-muted);
  line-height: 1.55;
  flex: 1;
  margin: 0;
  font-size: .95rem;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  overflow: hidden;
}
.hd-muted-note { margin: 12px 0 0; color: var(--hd-muted); }

.hd-library-grid { display:grid; gap:16px; }
.hd-library-item {
  position:relative;
  overflow:hidden;
  border-radius: 24px;
  background: linear-gradient(180deg, #fff, #f8fbff);
  border: 1px solid rgba(226, 232, 240, 1);
  padding: 24px;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.04);
}
.hd-library-item::before {
  content:"";
  position:absolute;
  inset:0 auto 0 0;
  width: 5px;
  background: linear-gradient(180deg, var(--hd-primary), var(--hd-accent));
}
.hd-library-item.forum::before { background: linear-gradient(180deg, var(--hd-forum), #c084fc); }
.hd-library-item.knowledge-base::before { background: linear-gradient(180deg, var(--hd-kb), #38bdf8); }
.hd-library-item.docs::before { background: linear-gradient(180deg, var(--hd-docs), #4ade80); }
.hd-library-item.faq::before { background: linear-gradient(180deg, var(--hd-faq), #fbbf24); }
.hd-library-item.ticket::before { background: linear-gradient(180deg, var(--hd-ticket), #fb7185); }
.hd-library-meta {
  display:flex; flex-wrap:wrap; gap:10px; margin: 10px 0 14px; color: var(--hd-muted); font-size: .95rem;
}
.hd-library-tag {
  display:inline-flex; align-items:center; gap:8px; padding:7px 11px; border-radius:999px; background:#eef2ff; color:#3730a3; font-size:13px; font-weight:700;
}
.hd-library-item.forum .hd-library-tag { background:#f3e8ff; color:#6d28d9; }
.hd-library-item.knowledge-base .hd-library-tag { background:#e0f2fe; color:#0369a1; }
.hd-library-item.docs .hd-library-tag { background:#dcfce7; color:#166534; }
.hd-library-item.faq .hd-library-tag { background:#fef3c7; color:#b45309; }
.hd-library-item.ticket .hd-library-tag { background:#fee2e2; color:#b91c1c; }
.hd-library-actions { display:flex; flex-wrap:wrap; gap:10px; margin-top:18px; }

.hd-filter-bar {
  display:grid;
  grid-template-columns: 220px minmax(0,1fr) auto;
  gap: 12px;
  margin-top: 20px;
}

.hd-empty {
  padding: 18px 20px;
  border-radius: 20px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  color: var(--hd-muted);
}

.hd-ticket-list { display:grid; gap:14px; }
.hd-ticket-item { display:grid; grid-template-columns: minmax(0,1fr) auto; gap:14px; align-items:start; }
.hd-ticket-status { display:inline-flex; gap:8px; align-items:center; padding:8px 12px; border-radius:999px; font-weight:700; background:#eef2ff; color:#3730a3; }
.hd-ticket-status.waiting_customer { background:#fef3c7; color:#b45309; }
.hd-ticket-status.in_progress { background:#dbeafe; color:#1d4ed8; }
.hd-ticket-status.resolved,
.hd-ticket-status.closed { background:#dcfce7; color:#166534; }
.hd-thread { display:grid; gap:16px; }
.hd-reply {
  border-radius: 22px; padding: 20px; background:#fff; border:1px solid rgba(226,232,240,1);
}
.hd-reply.staff { background: linear-gradient(180deg, #f8fbff, #eff6ff); }
.hd-reply.private { border-color:#fecaca; background: linear-gradient(180deg, #fff7f7, #fff); }
.hd-reply-head { display:flex; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-bottom:10px; }
.hd-attachment-list { display:grid; gap:10px; }
.hd-attachment { display:flex; justify-content:space-between; gap:12px; align-items:center; padding:12px 14px; border-radius:16px; background:#f8fafc; border:1px solid #e2e8f0; }
.hd-attachment > div { display:flex; align-items:center; gap:10px; min-width:0; flex-wrap:wrap; }
.hd-attachment a { word-break: break-word; }
.hd-privacy-choice { display:grid; gap:6px; }

.hd-footer {
  padding-top: 4px;
}
.hd-footer-card {
  display:grid; grid-template-columns: 1.2fr .8fr; gap:18px; align-items:start;
  background: linear-gradient(135deg, rgba(15,23,42,.96), rgba(30,41,59,.92));
  color:#fff;
}
.hd-footer-card p,
.hd-footer-card small { color: rgba(255,255,255,.72); }
.hd-footer-card .hd-menu a { color: rgba(255,255,255,.8); }
.hd-footer-card .hd-menu a:hover { background: rgba(255,255,255,.1); color:#fff; }

.page-template-default .entry-content > *:first-child,
.page .entry-content > *:first-child { margin-top:0; }
.page-template-default .entry-content > *:last-child,
.page .entry-content > *:last-child { margin-bottom:0; }



/* Portal page rendering guardrails */
.page .hd-wrap > .hd-wrap {
  max-width: 100%;
  margin: 0;
  padding: 0;
}
.page .hd-wrap > .hd-wrap .hd-hero:first-child {
  margin-top: 0;
}
.hd-hero + .hd-panel {
  margin-top: 20px;
}
.hd-library-item h3,
.hd-theme-card h3 {
  margin: 0 0 6px;
  line-height: 1.2;
  font-size: 1.1rem;
}
.hd-library-item p:last-child,
.hd-theme-desc:last-child {
  margin-bottom: 0;
}

@media (max-width: 1120px) {
  .hd-grid.themes.theme-count-2,
  .hd-grid.themes.theme-count-3,
  .hd-grid.themes.theme-count-4,
  .hd-grid.themes.theme-count-many {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }
}

@media (max-width: 980px) {
  .hd-home-hero,
  .hd-grid-2,
  .hd-footer-card { grid-template-columns: 1fr; }
  .hd-home-stats,
  .hd-grid-3,
  .hd-form-grid,
  .hd-grid.themes,
  .hd-grid.themes.theme-count-1,
  .hd-grid.themes.theme-count-2,
  .hd-grid.themes.theme-count-3,
  .hd-grid.themes.theme-count-4,
  .hd-grid.themes.theme-count-many { grid-template-columns: 1fr; }
  .hd-filter-bar { grid-template-columns: 1fr; }
  .hd-site-header { align-items:flex-start; }
}

@media (max-width: 720px) {
  body.admin-bar .hd-site-shell { min-height: calc(100vh - 46px); }
  .hd-wrap { padding: 18px 14px; }
  body.hd-layout-fullwidth .hd-wrap { padding-left: 14px; padding-right: 14px; }
  .hd-card, .hd-panel { padding: 18px; border-radius: 20px; }
  .hd-site-header { padding: 16px; }
  .hd-brand { width:100%; }
  .hd-brand-mark { width:42px; height:42px; border-radius:14px; }
  .hd-menu { width:100%; }
  .hd-menu a { padding: 0 12px; min-height: 40px; }
  .hd-hero { padding: 24px; }
  .hd-hero h1, .hd-hero h2 { font-size: 2rem; }
  .hd-ticket-item { grid-template-columns: 1fr; }
}

.hd-builder-home {
  padding-top: 18px;
}

.hd-library-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.hd-library-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hd-library-thumb-wrap {
  display: block;
  border-radius: 18px;
  overflow: hidden;
  background: #eef2ff;
}

.hd-library-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.hd-library-card h3 a {
  color: inherit;
  text-decoration: none;
}

.hd-library-card h3 a:hover {
  color: var(--hd-primary-strong);
}

.hd-single-wrap {
  padding-top: 18px;
}

.hd-single-entry {
  max-width: 920px;
  margin: 0 auto;
}

.hd-single-thumb {
  margin: -6px -6px 22px;
  overflow: hidden;
  border-radius: 20px;
}

.hd-single-thumb img {
  display: block;
  width: 100%;
  height: auto;
}

.hd-single-meta {
  margin-bottom: 18px;
}

@media (max-width: 980px) {
  .hd-library-grid {
    grid-template-columns: 1fr;
  }
}


.hd-front-page-content > .elementor,
.hd-front-page-content .elementor-section-wrap,
.hd-front-page-content .elementor-widget-wrap { max-width: 100%; }


/* Balanced layout refinements */
body.hd-layout-fullwidth .hd-wrap {
  max-width: min(1560px, calc(100vw - 24px));
  width: auto;
  margin-left: auto;
  margin-right: auto;
  padding-left: clamp(18px, 2.2vw, 28px);
  padding-right: clamp(18px, 2.2vw, 28px);
}

.hd-grid.themes {
  width: 100%;
  margin: 0 auto;
}

.hd-grid.themes.theme-count-1,
body.hd-layout-fullwidth .hd-grid.themes.theme-count-1 {
  max-width: 440px;
  grid-template-columns: minmax(0, 440px);
}

.hd-grid.themes.theme-count-2,
body.hd-layout-fullwidth .hd-grid.themes.theme-count-2 {
  max-width: 1080px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hd-grid.themes.theme-count-3,
body.hd-layout-fullwidth .hd-grid.themes.theme-count-3 {
  max-width: 1320px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.hd-grid.themes.theme-count-4,
.hd-grid.themes.theme-count-many,
body.hd-layout-fullwidth .hd-grid.themes.theme-count-4,
body.hd-layout-fullwidth .hd-grid.themes.theme-count-many {
  max-width: 1360px;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
}

.hd-theme-card {
  border-radius: 26px;
}

.hd-theme-media {
  aspect-ratio: 16 / 10;
  min-height: 0;
  padding: 14px;
  background: linear-gradient(180deg, #0f172a 0%, #0b1120 100%);
}

.hd-theme-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
}

.hd-theme-body {
  padding: 18px 18px 16px;
  gap: 12px;
}

.hd-theme-desc {
  -webkit-line-clamp: 4;
}

.hd-theme-actions {
  gap: 10px;
}

.hd-theme-actions .hd-btn {
  min-height: 38px;
  padding: 0 14px;
}

@media (max-width: 1120px) {
  .hd-grid.themes.theme-count-2,
  .hd-grid.themes.theme-count-3,
  .hd-grid.themes.theme-count-4,
  .hd-grid.themes.theme-count-many,
  body.hd-layout-fullwidth .hd-grid.themes.theme-count-2,
  body.hd-layout-fullwidth .hd-grid.themes.theme-count-3,
  body.hd-layout-fullwidth .hd-grid.themes.theme-count-4,
  body.hd-layout-fullwidth .hd-grid.themes.theme-count-many {
    max-width: 100%;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }
}

@media (max-width: 980px) {
  .hd-grid.themes.theme-count-1,
  .hd-grid.themes.theme-count-2,
  .hd-grid.themes.theme-count-3,
  .hd-grid.themes.theme-count-4,
  .hd-grid.themes.theme-count-many,
  body.hd-layout-fullwidth .hd-grid.themes.theme-count-1,
  body.hd-layout-fullwidth .hd-grid.themes.theme-count-2,
  body.hd-layout-fullwidth .hd-grid.themes.theme-count-3,
  body.hd-layout-fullwidth .hd-grid.themes.theme-count-4,
  body.hd-layout-fullwidth .hd-grid.themes.theme-count-many {
    max-width: 100%;
    grid-template-columns: 1fr;
  }
}
