@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap");

@font-face {
  font-family: "Dana";
  src: url("/static/fonts/Dana/Dana-regular.woff2") format("woff2"),
    url("/static/fonts/Dana/Dana-regular.woff") format("woff"),
    url("/static/fonts/Dana/Dana-regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Dana";
  src: url("/static/fonts/Dana/Dana-medium.woff2") format("woff2"),
    url("/static/fonts/Dana/Dana-medium.woff") format("woff"),
    url("/static/fonts/Dana/Dana-medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Dana";
  src: url("/static/fonts/Dana/Dana-bold.woff2") format("woff2"),
    url("/static/fonts/Dana/Dana-bold.woff") format("woff"),
    url("/static/fonts/Dana/Dana-bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Dana FaNum";
  src: url("/static/fonts/Dana/Dana-regular-fanum.woff2") format("woff2"),
    url("/static/fonts/Dana/Dana-regular-fanum.woff") format("woff"),
    url("/static/fonts/Dana/Dana-regular-fanum.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Dana FaNum";
  src: url("/static/fonts/Dana/Dana-medium-fanum.woff2") format("woff2"),
    url("/static/fonts/Dana/Dana-medium-fanum.woff") format("woff"),
    url("/static/fonts/Dana/Dana-medium-fanum.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Dana FaNum";
  src: url("/static/fonts/Dana/Dana-bold-fanum.woff2") format("woff2"),
    url("/static/fonts/Dana/Dana-bold-fanum.woff") format("woff"),
    url("/static/fonts/Dana/Dana-bold-fanum.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-latin: "Space Grotesk", "Segoe UI", sans-serif;
  --font-fa: "Dana", "Segoe UI", sans-serif;
  --font-fa-num: "Dana FaNum", "Dana", "Segoe UI", sans-serif;
  color-scheme: light;
  --bg: #f7f6ff;
  --bg-2: #fdecef;
  --bg-3: #fff5e5;
  --text: #161616;
  --muted: #6b7280;
  --card: rgba(255, 255, 255, 0.7);
  --border: rgba(255, 255, 255, 0.5);
  --shadow: rgba(17, 24, 39, 0.12);
  --primary: #7c3aed;
  --primary-2: #ec4899;
  --accent: #f97316;
  --success: #22c55e;
  --danger: #ef4444;
  --editor-bg: rgba(255, 255, 255, 0.92);
  --editor-border: rgba(148, 163, 184, 0.35);
  --editor-toolbar-bg: rgba(255, 255, 255, 0.7);
  --editor-tool-bg: rgba(255, 255, 255, 0.85);
  --editor-tool-border: rgba(148, 163, 184, 0.3);
  --editor-media-bg: rgba(248, 250, 252, 0.9);
  --editor-media-border: rgba(148, 163, 184, 0.4);
  --editor-media-caption: #475569;
  --editor-focus: rgba(124, 58, 237, 0.3);
  --landing-bg: radial-gradient(circle at top, rgba(126, 34, 206, 0.4), transparent 55%),
    radial-gradient(circle at center, rgba(236, 72, 153, 0.35), transparent 60%),
    linear-gradient(135deg, #111827, #1f1143 60%, #000000);
}

html.dark {
  color-scheme: dark;
  --bg: #0f172a;
  --bg-2: #111827;
  --bg-3: #1f2937;
  --text: #f9fafb;
  --muted: #9ca3af;
  --card: rgba(15, 23, 42, 0.7);
  --border: rgba(148, 163, 184, 0.2);
  --shadow: rgba(0, 0, 0, 0.35);
  --editor-bg: rgba(15, 23, 42, 0.82);
  --editor-border: rgba(148, 163, 184, 0.3);
  --editor-toolbar-bg: rgba(15, 23, 42, 0.82);
  --editor-tool-bg: rgba(15, 23, 42, 0.9);
  --editor-tool-border: rgba(148, 163, 184, 0.3);
  --editor-media-bg: rgba(15, 23, 42, 0.9);
  --editor-media-border: rgba(148, 163, 184, 0.4);
  --editor-media-caption: #94a3b8;
  --editor-focus: rgba(124, 58, 237, 0.45);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

input,
textarea,
select,
button,
a,
.btn,
.icon-btn,
[contenteditable="true"],
#caption-text,
#hashtags-text,
.detail-content,
.detail-content.hashtags {
  user-select: text;
}

body {
  font-family: var(--font-latin);
  background: linear-gradient(135deg, var(--bg), var(--bg-2) 45%, var(--bg-3));
  color: var(--text);
  min-height: 100vh;
}

html.reduce-motion * {
  animation: none !important;
  transition: none !important;
}

.app {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
}

.logo-type {
  background-image: url(/static/images/logo-type.webp);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  display: block;
  width: 100%;
  height: 10vh;
}

.icon-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  position: relative;
  padding: 48px 20px 60px;
  color: #fff;
  background: var(--landing-bg);
  overflow: hidden;
}

.landing-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.landing-orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(80px);
  opacity: 0.7;
}

.orb-a {
  width: 360px;
  height: 360px;
  background: rgba(124, 58, 237, 0.5);
  top: 10%;
  left: 10%;
}

.orb-b {
  width: 300px;
  height: 300px;
  background: rgba(236, 72, 153, 0.5);
  bottom: 10%;
  right: 12%;
}

.orb-c {
  width: 680px;
  height: 680px;
  background: rgba(99, 102, 241, 0.15);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.landing-top {
  width: min(100%, 980px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 40px;
  z-index: 1;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 12px;
}

.landing-controls {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.select {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: inherit;
  padding: 6px 10px;
  border-radius: 10px;
  font-family: inherit;
}

.landing-content {
  z-index: 1;
  width: min(100%, 900px);
  display: grid;
  gap: 20px;
}

.landing-title {
  font-size: clamp(2.6rem, 5vw, 4.2rem);
  font-weight: 700;
  line-height: 1.1;
  background: linear-gradient(90deg, #fff, #e9d5ff, #fbcfe8);
  -webkit-background-clip: text;
  color: transparent;
  white-space: pre-line;
}

.landing-subtitle {
  color: #d1d5db;
  font-size: 1.1rem;
}

.landing-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.btn {
  border: none;
  padding: 10px 16px;
  border-radius: 14px;
  font-weight: 600;
  cursor: pointer;
  background: #fff;
  color: var(--text);
  border: 1px solid rgba(0, 0, 0, 0.05);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

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

.btn-bright {
  text-decoration: none;
  background: #fff;
  color: #4c1d95;
  padding: 12px 22px;
  border-radius: 999px;
  box-shadow: 0 20px 40px rgba(124, 58, 237, 0.25);
}

.btn-gradient {
  height: fit-content;
  background: linear-gradient(90deg, var(--primary), var(--primary-2), var(--accent));
  color: #fff;
  border: none;
}

.btn-block {
  width: 100%;
}

.btn.outline {
  background: transparent;
  color: inherit;
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.btn.ghost {
  background: transparent;
  border: none;
  justify-content: flex-start;
}

.btn.small {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-platform {
  border: none;
  color: #fff;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: 16px;
}

.btn-platform.instagram {
  background: linear-gradient(135deg, #f58529, #dd2a7b, #8134af, #515bd4);
}

.btn-platform.tiktok {
  background: linear-gradient(135deg, #00f2ea, #000000 45%, #ff0050);
}

.btn-platform.youtube {
  background: linear-gradient(135deg, #ff1a1a, #c00 60%, #7a0000);
}

.btn-platform.pinterest {
  background: linear-gradient(135deg, #e60023, #bd081c 60%, #8b0614);
}

.btn-platform.telegram {
  background: linear-gradient(135deg, #2aabee, #229ed9 60%, #1c7db6);
}

.landing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.mini-card {
  padding: 16px;
  display: grid;
  place-items: center;
  gap: 8px;
  color: #fff;
}

.landing-footer {
  position: absolute;
  bottom: 18px;
  font-size: 12px;
  color: #9ca3af;
}

.bg-orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(60px);
  opacity: 0.6;
  z-index: -1;
}

.admin .bg-orb {
  animation: none;
}

.orb-1 {
  width: 320px;
  height: 320px;
  background: #c4b5fd;
  top: -80px;
  left: -60px;
}

.orb-2 {
  width: 260px;
  height: 260px;
  background: #f9a8d4;
  top: 20%;
  right: -80px;
}

.orb-3 {
  width: 360px;
  height: 360px;
  background: #fdba74;
  bottom: -140px;
  left: 25%;
}

.layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.sidebar {
  width: 260px;
  padding: 28px 20px;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  backdrop-filter: blur(18px);
  background: rgba(255, 255, 255, 0.72);
  border-right: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

html.dark .sidebar {
  background: rgba(17, 24, 39, 0.75);
  border-right-color: rgba(148, 163, 184, 0.2);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 20px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: grid;
  place-items: center;
  color: #fff;
}

.brand-name {
  background: linear-gradient(90deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  color: transparent;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  transition: 0.2s ease;
}

.nav-item .icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  color: currentColor;
}

.nav-item.active {
  background: rgba(124, 58, 237, 0.1);
  color: var(--primary);
  font-weight: 600;
}

.nav-item.active .dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--primary);
  margin-left: auto;
}

.sidebar-footer {
  margin-top: auto;
}

.glass {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: 0 20px 40px var(--shadow);
  backdrop-filter: blur(16px);
}

.card {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: 0.2s ease;
  text-align: left;
}

.card:hover {
  transform: translateY(-2px);
}

.card h3 {
  text-align: initial;
  font-size: 18px;
  margin-bottom: 6px;
}

.card p {
  color: var(--muted);
  font-size: 13px;
}

.card-compact {
  padding: 18px;
}

.pro-mini {
  display: grid;
  gap: 12px;
}

.icon-btn {
  border: none;
  background: transparent;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

a {
  text-decoration: none;
}

.icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  fill: currentColor;
}

.text-pink {
  color: #ec4899;
}

.text-cyan {
  color: #22d3ee;
}

.text-red {
  color: #ef4444;
}

.main {
  flex: 1;
  margin-left: 260px;
}

.main-inner {
  padding: 7.5% 2.5% 0 2.5%;
  width: clamp(100px, 100%, 1100px);
  margin: 0 auto;
  min-height: 100vh;
}

.panel-header {
  margin-bottom: 24px;
}

.panel-header.split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-header.split .btn {
  white-space: nowrap;
}

@media (max-width: 720px) {
  .panel-header.split {
    flex-direction: column;
    align-items: flex-start;
  }
}

.panel-header.center {
  text-align: center;
}

.title-gradient {
  background: linear-gradient(90deg, var(--primary), var(--primary-2), var(--accent));
  -webkit-background-clip: text;
  color: transparent;
  font-size: 32px;
  font-weight: 700;
}

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

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

@media (min-width: 900px) {
  .card-grid {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
  }
}

.tools-grid .tool-card {
  border-radius: 26px;
}

.section-divider {
  margin: 18px 0 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.section-divider::before,
.section-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, transparent, rgba(124, 58, 237, 0.45), transparent);
}

.card-grid .card {
  animation: fadeIn 0.35s ease;
}

.card-icon {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  color: #fff;
}

.gradient-1 {
  background: linear-gradient(135deg, #8b5cf6, #ec4899, #f97316);
}

.gradient-2 {
  background: linear-gradient(135deg, #ec4899, #f43f5e, #f97316);
}

.gradient-3 {
  background: linear-gradient(135deg, #f97316, #f59e0b, #facc15);
}

.gradient-4 {
  background: linear-gradient(135deg, #22d3ee, #3b82f6, #6366f1);
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.stat {
  padding: 16px;
  text-align: center;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
}

.flow-step {
  display: none;
  animation: fadeIn 0.3s ease;
}

.flow-step.active {
  display: block;
}

.panel-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.panel-top.align-between {
  justify-content: space-between;
}

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

.form-card {
  padding: 20px;
  display: grid;
  gap: 14px;
}

.label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.category-select {
  width: 100%;
  height: 80px;
  margin: 5px 0;
}

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

.btn.danger {
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
}

.btn.danger:hover {
  background: rgba(239, 68, 68, 0.12);
}

.input,
.textarea {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  padding: 12px 14px;
  font-family: inherit;
  background: rgba(255, 255, 255, 0.7);
  color: inherit;
  transition: all .3s ease-in-out;
  outline: none;
}

select option,
.select option {
  color: #000;
}

#title-input:hover,
.textarea:hover {
  box-shadow: 0 0 0 .15vw rgba(135, 207, 235, 0.186);
}

#title-input:focus,
.textarea:focus {
  box-shadow: 0 0 0 .15vw skyblue;
}

html.dark .input,
html.dark .textarea {
  background: rgba(15, 23, 42, 0.7);
  border-color: rgba(148, 163, 184, 0.2);
}

.textarea {
  resize: vertical;
}

.hint {
  font-size: 12px;
  color: var(--muted);
}

.media-toggle {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.source-image-box,
.video-mode-wrap,
.video-quality-wrap,
.video-duration-wrap,
.frame-size-wrap {
  display: grid;
  gap: 8px;
}

.token-estimate {
  margin-top: 10px;
  margin-bottom: 10px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.token-estimate-icon {
  color: #f59e0b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.token-estimate-text {
  font-size: 13px;
  color: var(--muted);
}

.media-btn.active {
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  border: none;
  color: #fff;
}

.side-stack {
  display: grid;
  gap: 12px;
}

.info-card {
  padding: 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.info-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  display: grid;
  place-items: center;
  color: #fff;
}

.note {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: #1e3a8a;
  font-size: 12px;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.preview-grid.caption-only {
  grid-template-columns: 1fr;
}

.preview-grid.caption-only .preview-left {
  display: none;
}

.preview-card {
  padding: 12px;
}

.preview-media {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: 20px;
  overflow: hidden;
  background: #111827;
}

.preview-media img,
.preview-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-media-loading {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  text-align: center;
  color: #e5e7eb;
  background: rgba(3, 7, 18, 0.7);
  backdrop-filter: blur(1px);
  z-index: 1;
}

.preview-media.loading .preview-media-loading {
  display: flex;
}

.spinner.sm {
  width: 22px;
  height: 22px;
  border-width: 3px;
}

.preview-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 11px;
}

.preview-dots {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  justify-content: center;
}

.preview-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #d1d5db;
}

.preview-dot.active {
  width: 20px;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
}

.preview-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.detail-card {
  padding: 20px;
  display: grid;
  gap: 16px;
}

.detail-title {
  font-size: 18px;
}

.detail-block {
  display: grid;
  gap: 8px;
}

.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
}

.detail-content {
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  line-height: 1.5;
}

html.dark .detail-content {
  background: rgba(15, 23, 42, 0.7);
}

.detail-content.hashtags {
  color: #2563eb;
}

.detail-footer {
  padding-top: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  display: grid;
  gap: 10px;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.action-grid .btn {
  width: 100%;
}

.detail-card.tool-no-caption .action-grid {
  grid-template-columns: 1fr;
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.history-card {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 12px;
  padding: 14px;
  position: relative;
  animation: fadeIn 0.35s ease;
}

.history-delete {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  display: grid;
  place-items: center;
  z-index: 2;
}

.history-delete .icon,
.history-delete i {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  color: currentColor;
}

html:not(.dark) .history-delete {
  color: #b91c1c;
}

html.dark .history-delete {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.35);
}

.thumb {
  border-radius: 14px;
  background-size: cover;
  background-position: center;
  min-height: 120px;
}

.thumb-fallback {
  background: linear-gradient(120deg, #2f2b4a, #0f172a);
}

.thumb-image,
.thumb-video {
  width: 100%;
  min-height: inherit;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #0f172a;
}

.history-card .thumb-video {
  pointer-events: none;
}

.history-info {
  display: grid;
  gap: 8px;
}

.history-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.badge {
  padding: 4px 8px;
  border-radius: 999px;
  height: fit-content;
  background: transparent;
  font-size: 11px;
}

.badge.success {
  background: #dcfce7;
  color: #166534;
}

.badge-gradient {
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  color: #fff;
}

.meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.meta i {
  font-size: 13px;
  line-height: 1;
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.billing-tabs {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 0 0 16px;
}

.plan-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}

.plan-card button[disabled] {
  background: transparent;
  color: rgb(123, 123, 123);
}

.plan-card.popular {
  border: 2px solid rgba(124, 58, 237, 0.4);
}

.plan-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.plan-price {
  font-size: 24px;
  font-weight: 700;
}

.plan-list {
  list-style: none;
  display: grid;
  gap: 8px;
  font-size: 13px;
}

.hero-icon {
  width: 70px;
  height: 70px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2), var(--accent));
  display: grid;
  place-items: center;
  color: #fff;
  margin: 0 auto 12px;
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.profile-card,
.insta-card {
  padding: 20px;
  display: grid;
  gap: 14px;
}

.profile-top {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar {
  width: 70px;
  height: 70px;
  border-radius: 999px;
  background-size: cover;
  background-position: center;
  border: 2px solid rgba(124, 58, 237, 0.4);
}

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

.inline.small {
  font-size: 12px;
  gap: 6px;
}

.status {
  background: #dcfce7;
  color: #166534;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
}

.status.muted {
  background: #e5e7eb;
  color: #4b5563;
}

.insta-icon {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2), var(--accent));
  display: grid;
  place-items: center;
  color: #fff;
}

.insta-icon.dark {
  background: #111827;
}

.insta-icon.red {
  background: #dc2626;
}

.section-title {
  margin: 20px 0 12px;
}

.settings-block {
  margin-bottom: 22px;
}

.settings-block h3 {
  margin-bottom: 10px;
}

.settings-list {
  display: grid;
  gap: 0;
}

.settings-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

button.settings-item {
  width: 100%;
  border: none;
  background: transparent;
  font: inherit;
  color: inherit;
  text-align: inherit;
  cursor: pointer;
  appearance: none;
}

.settings-item:first-child {
  border-top: none;
}

.settings-item.destructive h4 {
  color: var(--danger);
}

.settings-history-clear {
  border-radius: 12px;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.settings-history-clear:hover {
  background: rgba(239, 68, 68, 0.08);
}

html.dark .settings-history-clear:hover {
  background: rgba(239, 68, 68, 0.14);
}

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

.item-icon {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.05);
  display: grid;
  place-items: center;
}

.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #e5e7eb;
  border-radius: 999px;
  transition: 0.2s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  top: 2px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
}

.switch input:checked+.slider {
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
}

.switch input:checked+.slider:before {
  transform: translateX(18px);
}

.app-info {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin-top: 24px;
}

.info-links {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 6px;
}

.info-links a {
  color: inherit;
  text-decoration: none;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: none;
  background: rgba(255, 255, 255, 0.9);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  backdrop-filter: blur(16px);
  padding: 10px 8px 16px;
  justify-content: space-around;
  z-index: 10;
}

html.dark .bottom-nav {
  background: rgba(15, 23, 42, 0.9);
}

.bottom-nav .nav-item {
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
}

.tab-panel {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-panel.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.rtl-flip {
  transition: transform 0.2s ease;
}

[dir="rtl"] .rtl-flip {
  transform: rotate(180deg);
}

[dir="rtl"] .sidebar {
  left: auto;
  right: 0;
  border-right: none;
  border-left: 1px solid rgba(0, 0, 0, 0.05);
}

[dir="rtl"] html.dark .sidebar {
  border-left-color: rgba(148, 163, 184, 0.2);
}

[dir="rtl"] .main {
  margin-left: 0;
  margin-right: 260px;
}

[dir="rtl"] .nav-item.active .dot {
  margin-left: 0;
  margin-right: auto;
}

[dir="rtl"] .preview-badge {
  right: auto;
  left: 12px;
}

[dir="rtl"] .landing-top {
  flex-direction: row-reverse;
}

[dir="rtl"] .landing-actions .btn {
  flex-direction: row-reverse;
}

[dir="rtl"] body,
[dir="rtl"] .app,
[dir="rtl"] .panel,
[dir="rtl"] .blog-page {
  text-align: right;
}

@media (max-width: 900px) {
  .sidebar {
    display: none;
  }

  .main {
    margin-left: 0;
    padding: 0 16px 110px;
  }

  [dir="rtl"] .main {
    margin-right: 0;
  }

  .bottom-nav {
    display: flex;
  }

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

@media (max-width: 700px) {
  .landing-top {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .landing-controls {
    justify-content: center;
  }
}

@media (max-width: 600px) {
  .title-gradient {
    font-size: 26px;
  }

  .card {
    flex-direction: column;
    align-items: flex-start;
  }
}

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

.modal.open {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 10, 20, 0.55);
  backdrop-filter: blur(6px);
}

.modal-card {
  background-color: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 20px;
  position: relative;
  z-index: 1;
  width: min(920px, 92vw);
  max-height: 85vh;
  overflow: auto;
  padding: 24px;
}

#app-dialog-modal .modal-backdrop {
  background: rgba(5, 10, 24, 0.62);
  backdrop-filter: blur(8px);
}

.app-dialog-card {
  border-radius: 22px;
  border: 1px solid rgba(148, 163, 184, 0.26);
  background: linear-gradient(160deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.9));
  color: #f8fafc;
  box-shadow: 0 24px 45px rgba(2, 6, 23, 0.45);
}

.app-dialog-card .muted {
  color: #cbd5e1;
}

.app-dialog-card .dialog-btn-cancel {
  border-color: rgba(148, 163, 184, 0.32);
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.03);
}

.app-dialog-card .dialog-btn-ok {
  min-width: 108px;
}

html:not(.dark) .app-dialog-card {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.98), rgba(241, 245, 249, 0.95));
  color: #0f172a;
  border-color: rgba(148, 163, 184, 0.35);
}

html:not(.dark) .app-dialog-card .muted {
  color: #475569;
}

html:not(.dark) .app-dialog-card .dialog-btn-cancel {
  color: #334155;
  border-color: rgba(148, 163, 184, 0.45);
  background: rgba(255, 255, 255, 0.75);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.modal-body {
  display: grid;
  gap: 16px;
}

.btn.small {
  padding: 8px 12px;
  font-size: 12px;
}

.history-variant {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 16px;
}

.history-variant .thumb {
  border-radius: 14px;
  background-size: cover;
  background-position: center;
  min-height: 160px;
}

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

.history-variant .meta-actions.tool-actions-vertical {
  flex-direction: column;
  align-items: stretch;
}

.history-variant .meta-actions.tool-actions-vertical .btn {
  width: 100%;
}

.history-variant.no-media {
  grid-template-columns: 1fr;
}

#history-modal .modal-card {
  width: min(980px, 92vw);
  border-radius: 22px;
  border: 1px solid rgba(148, 163, 184, 0.26);
  background: linear-gradient(160deg, rgba(15, 23, 42, 0.97), rgba(30, 41, 59, 0.92));
  color: #f8fafc;
}

#history-modal .modal-head {
  margin-bottom: 18px;
}

#history-modal .modal-head .muted {
  color: #cbd5e1;
}

#history-modal .history-variant {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.55);
  box-shadow: 0 10px 24px rgba(2, 6, 23, 0.25);
}

#history-modal .history-variant h4 {
  margin-bottom: 8px;
}

#history-modal .history-variant p {
  margin: 0 0 8px;
  line-height: 1.7;
}

#history-modal .history-variant .muted {
  color: #cbd5e1;
}

#history-modal .meta-actions .btn {
  min-height: 36px;
}

html:not(.dark) #history-modal .modal-card {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.98), rgba(241, 245, 249, 0.95));
  color: #0f172a;
  border-color: rgba(148, 163, 184, 0.35);
}

html:not(.dark) #history-modal .modal-head .muted {
  color: #475569;
}

html:not(.dark) #history-modal .history-variant {
  background: rgba(248, 250, 252, 0.95);
  border-color: rgba(148, 163, 184, 0.28);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

html:not(.dark) #history-modal .history-variant .muted {
  color: #64748b;
}

@media (max-width: 720px) {
  .history-variant {
    grid-template-columns: 1fr;
  }
}

.token-pill {
  margin: 12px 16px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  justify-content: space-between;
}

.token-pill .icon-btn {
  width: 28px;
  height: 28px;
}

.loader-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 12, 20, 0.55);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1300;
}

.loader-overlay.active {
  display: flex;
}

.loader-card {
  padding: 20px 28px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.dropzone {
  border: 2px dashed rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  padding: 18px;
  text-align: center;
  cursor: pointer;
  transition: border 0.2s ease, background 0.2s ease;
  position: relative;
}

.dropzone.dragover {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.04);
}

.drop-input {
  display: none;
}

.drop-content {
  display: grid;
  gap: 8px;
  justify-items: center;
}

.drop-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  font-weight: 700;
}


.upload-preview {
  width: min(240px, 90%);
  max-height: 180px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.15);
}

html.dark .upload-preview {
  border-color: rgba(148, 163, 184, 0.4);
  box-shadow: 0 16px 36px rgba(2, 6, 23, 0.45);
}

.admin-panel {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
  gap: 20px;
  padding: 24px;
}

.panel-sidebar {
  padding: 24px;
  border-radius: 20px;
  background: rgba(8, 12, 20, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: grid;
  gap: 12px;
  height: fit-content;
}

.panel-brand {
  font-weight: 700;
  margin-bottom: 24px;
}

.panel-nav {
  display: grid;
  gap: 10px;
}

.panel-link {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  text-decoration: none;
  color: inherit;
}

.panel-link.active {
  background: linear-gradient(120deg, rgba(168, 85, 247, 0.5), rgba(236, 72, 153, 0.5));
}

.panel-link.danger {
  color: #ff6b6b;
}

.panel-footer {
  margin-top: auto;
  display: grid;
  gap: 8px;
}

.panel-main {
  padding: 24px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.panel-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.panel-card {
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
}

.panel-value {
  font-size: 24px;
  font-weight: 700;
  margin-top: 6px;
}

.panel-section {
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
}

.panel-form {
  display: grid;
  gap: 12px;
}

.panel-list {
  display: grid;
  gap: 12px;
}

.panel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
}

.panel-reply {
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.ticket-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 16px;
}

.ticket-list {
  padding: 14px;
  display: grid;
  gap: 12px;
  max-height: 520px;
  overflow: auto;
}

.ticket-item {
  border: 0;
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  padding: 12px;
  border-radius: 14px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  text-align: left;
  animation: fadeIn 0.35s ease;
}

.ticket-item.active {
  outline: 2px solid rgba(147, 51, 234, 0.5);
}

.ticket-chat {
  padding: 16px;
  display: flex;
  gap: 12px;
  min-height: 420px;
  flex-direction: column;
  justify-content: space-between;
}

.ticket-panel {
  display: none;
  gap: 12px;
}

.ticket-panel.active {
  display: flex;
  height: 100%;
  flex-direction: column;
}

.ticket-chat-head {
  height: fit-content;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ticket-thread {
  display: block;
  height: 100%;
  max-height: 340px;
  overflow: auto;
}

.ticket-bubble {
  height: fit-content;
  max-width: 70%;
  padding: 10px 12px;
  border-radius: 14px;
  position: relative;
}

.ticket-bubble.me {
  justify-self: start;
  background: rgba(255, 255, 255, 0.08);
}

.ticket-bubble.them {
  justify-self: end;
  background: linear-gradient(120deg, rgba(168, 85, 247, 0.4), rgba(236, 72, 153, 0.4));
}

.ticket-edit {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 12px;
  opacity: 0.6;
  cursor: pointer;
  margin-top: 6px;
}

.ticket-composer {
  display: flex;
  height: fit-content;
  gap: 8px;
}

.ticket-compose {
  display: grid;
  gap: 8px;
  height: fit-content;
  padding-bottom: 10px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
}

.ticket-empty {
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  margin: auto;
}

html:not(.dark) .ticket-list,
html:not(.dark) .ticket-chat {
  background: #ffffff;
}

html:not(.dark) .ticket-item {
  background: #f7f8fd;
}

html:not(.dark) .ticket-bubble.me {
  background: #eef1ff;
}

html:not(.dark) .ticket-bubble.them {
  background: linear-gradient(120deg, rgba(168, 85, 247, 0.25), rgba(236, 72, 153, 0.25));
}

@media (max-width: 960px) {
  .admin-panel {
    grid-template-columns: 1fr;
  }

  .panel-sidebar {
    border-left: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }
}

@media (max-width: 900px) {
  .ticket-layout {
    grid-template-columns: 1fr;
  }
}

.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  margin-top: 18px;
}

.markdown-body p {
  line-height: 1.8;
}

.markdown-body ul {
  padding-left: 20px;
}

.markdown-body code {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 6px;
}

.markdown-body pre {
  background: rgba(12, 18, 30, 0.7);
  padding: 12px;
  border-radius: 10px;
  overflow: auto;
}

.blog-page {
  min-height: 100vh;
  padding: 32px;
  background: linear-gradient(135deg, var(--bg), var(--bg-2) 45%, var(--bg-3));
  color: var(--text);
}

.blog-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

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

.blog-filters {
  display: grid;
  grid-template-columns: 1fr 220px auto;
  gap: 12px;
  margin-bottom: 24px;
}

.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.blog-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 10px 24px var(--shadow);
}

.blog-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.blog-card-link:hover {
  transform: translateY(-3px);
  border-color: rgba(124, 58, 237, 0.45);
  box-shadow: 0 18px 36px var(--shadow);
}

.blog-article img,
.blog-card img,
.blog-media-img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 16px;
  margin: 16px 0;
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.18);
}

.blog-media-wrap {
  display: inline-block;
  max-width: 100%;
  margin: 16px 0;
}

.blog-media-wrap .blog-media-img {
  width: 100%;
  height: auto;
}

.blog-admin-page .blog-media-wrap {
  resize: both;
  overflow: auto;
}

.blog-page .blog-media-wrap {
  display: inline-block;
  resize: none;
  overflow: visible;
  vertical-align: top;
  margin: 8px;
  max-width: 100%;
}

.blog-page .blog-media-wrap .blog-media-img {
  margin: 0;
}

.blog-article figcaption {
  display: none;
}

html.dark .blog-article img,
html.dark .blog-card img,
html.dark .blog-media-img {
  border-color: rgba(148, 163, 184, 0.35);
  box-shadow: 0 18px 36px rgba(2, 6, 23, 0.55);
}

.blog-card h3 {
  margin: 0 0 8px 0;
}

.blog-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.blog-article {
  max-width: 860px;
  margin: 0 auto;
  padding: 24px;
  border-radius: 20px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: 0 10px 24px var(--shadow);
}

.blog-top-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.blog-carousel {
  max-width: 860px;
  margin: 22px auto 0;
}

.blog-carousel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.blog-carousel-track {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 6px;
  scroll-snap-type: x mandatory;
}

.blog-card-compact {
  min-width: 240px;
  max-width: 260px;
  flex: 0 0 auto;
  scroll-snap-align: start;
}

.blog-card-compact h4 {
  margin: 0 0 8px 0;
}

html:not(.dark) .panel-card,
html:not(.dark) .panel-section,
html:not(.dark) .panel-row {
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

html:not(.dark) .panel-sidebar {
  background: #f4f5fb;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

html:not(.dark) .panel-main {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

@media (max-width: 720px) {
  .blog-filters {
    grid-template-columns: 1fr;
  }
}

.editor-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.editor-toolbar button {
  background: rgba(255, 255, 255, 0.08);
  border: 0;
  color: inherit;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.rich-editor {
  min-height: 220px;
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}


html[lang="fa"] body {
  font-family: var(--font-fa-num);
}

.lang-toggle {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.lang-btn {
  border: none;
  background: transparent;
  color: inherit;
  padding: 6px 12px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.lang-btn.active {
  background: rgba(124, 58, 237, 0.18);
  color: #1f1143;
}

html.dark .lang-btn.active {
  background: rgba(236, 72, 153, 0.2);
  color: #f9fafb;
}

.fa-fw {
  width: 1.28571429em;
  text-align: center;
}

.fa-2x {
  font-size: 2em;
}

.icon.fa-2x {
  font-size: 18px;
}







/* Admin panel upgrades */
.panel-theme-fab {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: transparent;
  color: inherit;
  font-size: 20px;
  display: grid;
  place-items: center;
  box-shadow: none;
}

html.dark .panel-theme-fab {
  background: transparent;
  color: inherit;
  border-color: rgba(148, 163, 184, 0.25);
}

.panel-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(255, 255, 255, 0.04);
}

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

.panel-menu-toggle {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: transparent;
  color: inherit;
  display: none;
}

.panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.5);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1150;
}

.panel-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.admin-panel {
  align-items: start;
}

.panel-sidebar {
  z-index: 1200;
}

@media (max-width: 960px) {
  .panel-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .admin-panel {
    display: block;
    padding: 16px;
  }

  .panel-main {
    min-height: calc(100vh - 32px);
  }

  .panel-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: min(82vw, 320px);
    height: 100vh;
    border-radius: 0;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    overflow-y: auto;
  }

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

  [dir="rtl"] .panel-sidebar {
    left: auto;
    right: 0;
    transform: translateX(105%);
  }

  [dir="rtl"] .panel-sidebar.open {
    transform: translateX(0);
  }
}

/* Blog editor upgrade */
.blog-editor-shell {
  width: 100%;
  padding: 24px;
}

.blog-form-grid {
  margin: 10px 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.blog-form-grid.align-end {
  align-items: end;
}

.modern-toolbar {
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--editor-border);
  background: var(--editor-toolbar-bg);
}

.tool-btn {
  min-width: 38px;
  height: 38px;
  border: 1px solid var(--editor-tool-border);
  border-radius: 10px;
  background: var(--editor-tool-bg);
  color: inherit;
}

.modern-editor {
  min-height: 340px;
  border: 1px solid var(--editor-border);
  background: var(--editor-bg);
  border-radius: 16px;
  padding: 18px;
  line-height: 1.8;
}

.modern-editor:focus {
  outline: 2px solid var(--editor-focus);
}

.modern-editor .blog-media {
  display: inline-block;
  width: min(100%, 420px);
  min-width: 180px;
  resize: both;
  overflow: auto;
  border: 1px solid var(--editor-media-border);
  border-radius: 12px;
  padding: 8px;
  margin: 14px 0;
  background: var(--editor-media-bg);
}

.modern-editor .blog-media img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
}

.modern-editor .blog-media figcaption {
  font-size: 12px;
  color: var(--editor-media-caption);
  margin-top: 8px;
  border-top: 1px dashed var(--editor-media-border);
  padding-top: 6px;
}

.btn.danger {
  background: linear-gradient(90deg, #dc2626, #ef4444);
  color: #fff;
  border: none;
}

#app-dialog-input {
  margin-top: 10px;
}

@media (max-width: 760px) {
  .blog-form-grid {
    grid-template-columns: 1fr;
  }
}

/* Admin visual fixes */
.admin .panel-sidebar {
  background: rgba(8, 12, 20, 0.78);
  border-color: rgba(255, 255, 255, 0.16);
  min-height: calc(100vh - 48px);
}

.admin .panel-main {
  min-width: 0;
  background: rgba(255, 255, 255, 0.08);
}

html:not(.dark) .admin .panel-sidebar {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(15, 23, 42, 0.12);
}

html:not(.dark) .admin .panel-main {
  background: rgba(255, 255, 255, 0.92);
}

.admin .panel-link {
  font-weight: 600;
}

.admin .panel-row {
  background: rgba(255, 255, 255, 0.08);
}

html:not(.dark) .admin .panel-row {
  background: #fff;
}

.admin .modal-card {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

html.dark .admin .modal-card {
  background: #111827;
  color: #f9fafb;
  border-color: rgba(148, 163, 184, 0.26);
}

.admin .modal-card .label,
.admin .modal-card .muted {
  color: #64748b;
}

html.dark .admin .modal-card .label,
html.dark .admin .modal-card .muted {
  color: #94a3b8;
}

.admin-modal-card {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

html.dark .admin-modal-card {
  background: #111827;
  color: #f9fafb;
  border-color: rgba(148, 163, 184, 0.26);
}

.admin-modal-card .label,
.admin-modal-card .muted {
  color: #64748b;
}

html.dark .admin-modal-card .label,
html.dark .admin-modal-card .muted {
  color: #94a3b8;
}

.admin .btn.outline {
  border-color: rgba(15, 23, 42, 0.22);
  color: inherit;
}

html.dark .admin .btn.outline {
  border-color: rgba(148, 163, 184, 0.3);
}

.blog-admin-page {
  width: min(1220px, 96vw);
  margin: 0 auto;
  display: grid;
  gap: 20px;
}

.panel-duo {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

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

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

.blog-admin-page .panel-header {
  margin-bottom: 0;
}

.offline-lock {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 11, 30, 0.72);
  backdrop-filter: blur(8px);
}

.offline-lock.open {
  display: flex;
}

.offline-lock-card {
  width: min(460px, 100%);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(180deg, rgba(8, 20, 56, 0.98), rgba(9, 22, 62, 0.95));
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.45);
  padding: 22px;
  text-align: center;
}

.offline-lock-card h3 {
  margin: 0 0 8px;
  font-size: 1.25rem;
}

.offline-lock-card p {
  margin: 0 0 16px;
  color: rgba(225, 231, 246, 0.82);
}

body.offline-locked {
  overflow: hidden;
}
