/* ============================================================
   Түүвэр — хадаг хөх загвар
   Хүйтэн цагаан цаас · кобальт хөх · Montserrat + Inter (unsh.online-ийн адил)
   ============================================================ */

:root {
  --bg: #f5f6fa;          /* цаас */
  --bg-soft: #eceff7;
  --dark: #161b33;        /* бэх */
  --dark-2: #1f2645;
  --text: #161b33;
  --text-soft: #3d4462;
  --muted: #7a809a;
  --line: #dde2ef;
  --green: #3fa66b;
  --blue: #2747c9;        /* accent — хадаг хөх */
  --blue-deep: #1c35a0;
  --orange: #e8a33a;      /* төлбөртэй */
  --red: #d8433b;
  --overlay: linear-gradient(to top, rgba(10, 12, 16, 0.92) 0%, rgba(10, 12, 16, 0.45) 55%, rgba(10, 12, 16, 0.15) 100%);

  --font-head: "Montserrat", "Arial", sans-serif;
  --font-ui: "Inter", system-ui, sans-serif;
  --font-body: "Montserrat", "Arial", sans-serif;

  --radius: 14px;
  --shell: 72rem;
}

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

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  /* Footer-ийг үргэлж хуудасны ёроолд байлгана */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Flex-ийн хүүхдүүд доторх өргөн агуулгаасаа болж дэлгэцээс хальж
   өргөсөхгүй — хүснэгтүүд өөрийн хайрцаг дотроо гүйлгэгдэнэ */
body > * { min-width: 0; }

.page,
.reader {
  flex: 1 0 auto;
  width: 100%;
}

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

a { color: var(--blue); }

button { font-family: var(--font-ui); cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---------- Лого + хайлт ---------- */

.site-head {
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 1.25rem;
}

.logo {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.45rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

/* Хуудас давхарласан ном — түүврийн тэмдэг */
.logo::before {
  content: "";
  width: 0.95rem;
  height: 1.15rem;
  border-radius: 2px 4px 4px 2px;
  background: var(--blue);
  box-shadow: 3px -3px 0 -1px var(--bg), 3px -3px 0 0 var(--blue);
}

.search-box input {
  font-family: var(--font-ui);
  font-size: 0.92rem;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.6rem 1.15rem;
  width: min(260px, 50vw);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-box input::placeholder { color: var(--muted); }

.search-box input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(39, 71, 201, 0.14);
}

.back-link {
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--text-soft);
}

.back-link:hover { color: var(--blue); }

/* ---------- Хуудасны их бие ---------- */

.page {
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0.5rem 1.25rem 4.5rem;
}

.section-title {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0;
  line-height: 1.2;
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 3.5rem 0 1.75rem;
}

.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ---------- Chips ---------- */

.chip {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  white-space: nowrap;
}

.chip-cat { background: #fff; border: 1px solid var(--line); color: var(--blue); }
.chip-paid { background: #fbecd2; color: #7a4a00; }
.chip-owned { background: #dcf1e4; color: #1d5a37; }
.chip-price-tag { background: var(--bg-soft); border: 1px solid var(--line); color: var(--text-soft); }

/* ---------- Мета мөр (зохиогч · хугацаа · үнэ) ---------- */

.meta-dot { margin: 0 0.45rem; opacity: 0.6; }
.meta-owned { color: var(--green); font-weight: 600; }

/* ---------- Онцлох нийтлэл — хөх хавтас ---------- */

.feat {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  text-decoration: none;
  color: #fff;
  background: var(--blue);
  border-radius: 22px;
  overflow: hidden;
  transition: background 0.25s ease;
}

.feat:hover { background: var(--blue-deep); }

.feat-img {
  width: 100%;
  height: 100%;
  min-height: 22rem;
  object-fit: cover;
}

.feat-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.9rem;
  padding: 2.75rem 2.75rem 2.5rem;
}

.feat-eyebrow {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
}

.feat-title {
  display: block;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: clamp(1.7rem, 3.6vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.feat-teaser {
  font-family: var(--font-body);
  font-size: 1.12rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.86);
}

.feat-meta {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
}

.feat .meta-owned { color: #9ff0bf; }

.feat-cta {
  align-self: flex-start;
  margin-top: 0.6rem;
  background: #fff;
  color: var(--blue);
  font-weight: 700;
  font-size: 0.92rem;
  border-radius: 999px;
  padding: 0.7rem 1.4rem;
  transition: transform 0.2s ease;
}

.feat:hover .feat-cta { transform: translateX(4px); }

.feed-chips {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ---------- Feed grid ---------- */

.feed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 2.5rem 1.75rem;
}

.feed-card {
  display: block;
  text-decoration: none;
  color: inherit;
}

.feed-img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feed-card:hover .feed-img {
  transform: translateY(-4px);
  box-shadow: 0 14px 30px rgba(22, 27, 51, 0.14);
}

.feed-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-top: 1.05rem;
}

.feed-title {
  display: block;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.08rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
  transition: color 0.2s ease;
}

.feed-card:hover .feed-title { color: var(--blue); }

.feed-teaser {
  font-family: var(--font-body);
  font-size: 0.98rem;
  line-height: 1.5;
  color: var(--text-soft);
}

.feed-meta {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

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

/* ---------- Footer ---------- */

.footer {
  background: var(--bg);
  border-top: 1px solid var(--line);
  color: var(--muted);
  text-align: center;
  font-size: 0.82rem;
  padding: 2rem 1.25rem;
  margin-top: auto;
  width: 100%;
}


/* ---------- Уншлагын хуудас ---------- */

.site-head--story {
  border-bottom: 1px solid var(--line);
}

.reader {
  max-width: 42rem;
  margin: 0 auto;
  padding: 3rem 1.25rem 5rem;
}

.story-head { text-align: left; }

.story-chips {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.story-title {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: clamp(1.7rem, 5vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-top: 1.1rem;
}

.story-byline {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  margin-top: 0.9rem;
  padding-bottom: 1.8rem;
}

.story-cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 2.5rem;
}

.story-body {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 1.12rem;
  line-height: 1.9;
  color: #262c47;
}

.story-body p { margin-bottom: 1.4rem; }

/* Эхний догол мөрийн эхний үсэг — номын хуудас шиг */
.story-body p:first-child::first-letter {
  font-family: var(--font-head);
  font-weight: 800;
  float: left;
  font-size: 3.3em;
  line-height: 0.9;
  margin: 0.08em 0.12em 0 0;
  color: var(--blue);
}

/* Өгүүллэгийн текстийг сонгож хуулахыг хүндрүүлнэ (утсан дээрх long-press цэс орно) */
.story-body,
.story-title {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* Хуулах extension илэрсэн үед */
.copy-locked .story-body,
.copy-locked .paywall { display: none !important; }

.copy-lock-notice {
  border: 1px solid var(--line);
  border-left: 3px solid var(--red);
  border-radius: var(--radius);
  background: var(--bg-soft);
  padding: 1.1rem 1.25rem;
  font-weight: 600;
  line-height: 1.6;
  margin: 1.5rem 0;
}

/* Хэвлэх / PDF болгон хадгалахад текст гарахгүй */
@media print {
  .story-body,
  .paywall { display: none !important; }
}

/* ---------- Paywall ---------- */

.paywall { position: relative; }

.paywall-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 22px;
  text-align: center;
  padding: 2.75rem 1.75rem 2.5rem;
  box-shadow: 0 18px 48px rgba(22, 27, 51, 0.1);
}

.paywall-lock {
  width: 64px;
  height: 64px;
  border-radius: 999px;
  background: #e4e9fb;
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
}

.paywall-lead {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.2rem;
}

.paywall-sub {
  font-size: 0.92rem;
  color: var(--muted);
  margin-top: 0.4rem;
}

.paywall-price {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 2.1rem;
  color: var(--text);
  margin-top: 0.9rem;
}

.btn-buy {
  margin-top: 1.3rem;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-size: 0.98rem;
  font-weight: 700;
  padding: 0.95rem 2.6rem;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.btn-buy:hover { background: var(--blue-deep); transform: translateY(-1px); }
.btn-buy:disabled { opacity: 0.6; cursor: wait; transform: none; }

.paywall-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 1.1rem;
}

/* ---------- Төлбөрийн цонх ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 23, 28, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  z-index: 50;
}

.modal {
  position: relative;
  background: var(--bg);
  border-radius: var(--radius);
  max-width: 24rem;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2.25rem 1.75rem 2rem;
  text-align: center;
  animation: modal-in 0.28s cubic-bezier(0.2, 1.2, 0.4, 1);
  box-shadow: 0 24px 60px rgba(10, 12, 16, 0.35);
}

@keyframes modal-in {
  from { transform: translateY(20px) scale(0.97); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-close {
  position: absolute;
  top: 0.8rem;
  right: 0.9rem;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  width: 32px;
  height: 32px;
  font-size: 1.1rem;
  color: var(--muted);
  line-height: 1;
}

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

.modal-title {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.2rem;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
}

.pay-amount {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.7rem;
  margin-bottom: 0.5rem;
}

.pay-caption {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.qr-img {
  width: 210px;
  height: 210px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px;
  margin: 0 auto 1.25rem;
  display: block;
}

.btn-check-dark {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.95rem 1rem;
  transition: opacity 0.2s ease;
}

.btn-check-dark:hover { background: var(--blue-deep); }
.btn-check-dark:disabled { opacity: 0.75; cursor: wait; }

.check-ic { flex-shrink: 0; }

.btn-check-dark.is-checking .check-ic {
  animation: spin 0.9s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .btn-check-dark.is-checking .check-ic { animation: none; }
}

.modal-note {
  font-size: 0.88rem;
  color: var(--text-soft);
  margin-bottom: 1.25rem;
}

.pay-status {
  margin-top: 1.1rem;
  background: #fdeded;
  border: 1px solid #f6caca;
  border-radius: 12px;
  color: #c43c35;
  font-size: 0.88rem;
  line-height: 1.6;
  padding: 0.9rem 1.1rem;
  text-align: center;
}

.pay-status:empty { display: none; }

.btn-check {
  background: none;
  border: 1.5px solid var(--orange);
  color: #b06f00;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.6rem 1.6rem;
  transition: background 0.2s ease;
}

.btn-check:hover { background: #f7a3251a; }

.bank-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  margin-top: 1.4rem;
  margin-bottom: 0.8rem;
}

.bank-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}

.bank-item {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.85rem 0;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.bank-item:hover {
  border-color: var(--muted);
  box-shadow: 0 4px 14px rgba(20, 23, 28, 0.08);
}

.bank-logo {
  width: 38px;
  height: 38px;
  object-fit: contain;
  border-radius: 9px;
}

.demo-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #b06f00;
  background: #f7a32519;
  border: 1px solid #f7a3255e;
  border-radius: 5px;
  padding: 0.25rem 0.7rem;
  margin-bottom: 1.1rem;
}

/* ---------- Toast мэдэгдэл ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 2rem;
  transform: translateX(-50%) translateY(1rem);
  background: var(--dark);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.8rem 1.5rem;
  box-shadow: 0 10px 30px rgba(10, 12, 16, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 100;
  max-width: min(90vw, 26rem);
  text-align: center;
}

.toast--show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Skeleton ачаалалт ---------- */

.skel {
  position: relative;
  overflow: hidden;
  background: #e3e7f2;
  border-radius: 8px;
  display: block;
}

.skel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.75), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.3s ease-in-out infinite;
}

@keyframes shimmer {
  to { transform: translateX(100%); }
}

/* Зургийн хэлбэртэй skeleton — feat-img/feed-img хэмжээг өвлөнө */
.skel.feat-img, .skel.feed-img { background: #e3e7f2; }
.skel.feat-img { min-height: 22rem; border-radius: 0; }
.feat:has(.skel) { background: var(--bg-soft); }

.skel-line {
  height: 0.85rem;
  width: 100%;
  margin-bottom: 0.6rem;
}

.skel--short { width: 55%; }

/* Уншлагын хуудасны skeleton */
.skel-chip { width: 110px; height: 26px; border-radius: 5px; margin-bottom: 1.1rem; }
.skel-title { height: 2.2rem; width: 92%; margin-bottom: 0.7rem; }
.skel-byline { height: 0.95rem; width: 42%; margin-bottom: 1.8rem; }

.skel-cover {
  width: 100%;
  aspect-ratio: 21 / 9;
  border-radius: var(--radius);
  margin-bottom: 2rem;
}

.skeleton .skel-line { margin-bottom: 1.1rem; }

@media (prefers-reduced-motion: reduce) {
  .skel::after { animation: none; }
}

/* ---------- Responsive / хөдөлгөөн ---------- */

@media (max-width: 860px) {
  .feat { grid-template-columns: 1fr; border-radius: 18px; }
  .feat-img, .skel.feat-img { min-height: 0; aspect-ratio: 16 / 10; }
  .feat-body { padding: 1.75rem 1.5rem 1.9rem; gap: 0.75rem; }
}

@media (max-width: 480px) {
  .site-head { padding: 1.1rem 1.25rem; }
  /* iOS дээр input дарахад автоматаар томрохоос сэргийлнэ */
  .search-box input,
  .admin-page .admin-input { font-size: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .modal { animation: none; }
  .feat, .feat-cta, .feat-img, .feed-img, .feat-title, .feed-title, .btn-buy { transition: none; }
  .feat:hover .feat-cta, .feed-card:hover .feed-img { transform: none; }
  html { scroll-behavior: auto; }
}

/* ============================================================
   Админ хэсэг — харанхуй CMS загвар
   ============================================================ */

.admin-page {
  /* Админ нь unsh.online-ийн адил Montserrat + Inter фонттой */
  --font-head: "Montserrat", "Arial", sans-serif;
  --font-ui: "Inter", system-ui, sans-serif;
  --font-body: "Montserrat", "Arial", sans-serif;

  --abg: #131417;
  --apanel: #1b1d22;
  --apanel-2: #222530;
  --aline: #2a2d36;
  --atext: #e7e8ec;
  --amuted: #8d93a0;
  --agreen: #2ecc71;
  --agreen-dim: #2ecc7120;
  --ared: #e5484d;
  --ablue: #5b8def;
  --aamber: #f5a623;

  background: var(--abg);
  color: var(--atext);
  min-height: 100vh;
  /* Огноо сонгогч зэрэг browser-ийн уугуул элементүүд харанхуй хэлбэрээр гарна */
  color-scheme: dark;
}

.admin-page .site-head--story { border-bottom: 1px solid var(--aline); }
.admin-page .logo { color: var(--atext); }

.admin-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--amuted);
  border: 1px solid var(--aline);
  border-radius: 6px;
  padding: 0.3rem 0.7rem;
}

/* Нэвтрэлт */

.admin-login {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
}

.login-card {
  width: min(22rem, 100%);
  background: var(--apanel);
  border: 1px solid var(--aline);
  border-radius: 14px;
  padding: 2.25rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.login-title {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.15rem;
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 0.4rem;
}

.login-error { color: var(--ared); font-size: 0.85rem; text-align: center; }

.login-remember { font-size: 0.82rem; color: var(--amuted); }

/* Ерөнхий байрлал */

.admin {
  width: 100%;
  max-width: 86rem;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 4rem;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
}

.admin-tabs { display: flex; gap: 0.4rem; align-items: center; flex: 1; }

/* Гарах товч мөрийнхөө баруун захад */
#btn-logout { margin-left: auto; }

.admin-tab {
  background: none;
  border: 1px solid var(--aline);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--amuted);
  padding: 0.5rem 1.3rem;
  transition: background 0.2s ease, color 0.2s ease;
}

.admin-tab:hover { color: var(--atext); }

.admin-tab.is-active {
  background: var(--atext);
  border-color: var(--atext);
  color: var(--abg);
}

.admin-warn {
  background: #f5a62314;
  border: 1px solid #f5a6234d;
  border-radius: 8px;
  color: #e8b45c;
  font-size: 0.85rem;
  padding: 0.7rem 1rem;
  margin-bottom: 1rem;
}

/* Панел + toolbar */

.panel {
  background: var(--apanel);
  border: 1px solid var(--aline);
  border-radius: 14px;
  overflow: hidden;
}

.panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--aline);
}

.toolbar-left { display: flex; align-items: center; gap: 0.6rem; }

.search-box--dark input {
  color: var(--atext);
  background: var(--apanel-2);
  border-color: var(--aline);
}

.search-box--dark input::placeholder { color: var(--amuted); }
.search-box--dark input:focus { border-color: var(--ablue); }

.admin-page .btn-primary {
  background: var(--apanel-2);
  color: var(--atext);
  border: 1px solid var(--aline);
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.6rem 1.3rem;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.admin-page .btn-primary:hover { border-color: var(--amuted); filter: none; }
.admin-page .btn-primary:disabled { opacity: 0.6; cursor: wait; }

.btn-danger {
  background: #e5484d1f;
  color: var(--ared);
  border: 1px solid #e5484d66;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 0.6rem 1.2rem;
}

.admin-page .btn-ghost {
  background: none;
  border: 1px solid var(--aline);
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--amuted);
  padding: 0.55rem 1.3rem;
}

.admin-page .btn-ghost:hover { color: var(--atext); border-color: var(--amuted); }

/* Хүснэгт */

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

.a-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

/* Зөвхөн нийтлэлийн том хүснэгт өргөн байх шаардлагатай */
#stories-table { min-width: 62rem; }
#tx-table { min-width: 26rem; }

.a-table th {
  text-align: left;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--atext);
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--aline);
  white-space: nowrap;
}

.a-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--aline);
  vertical-align: middle;
}

.a-table tbody tr { transition: background 0.15s ease; }
.a-table tbody tr:hover { background: #ffffff06; }

.col-check { width: 2.2rem; }
.col-num { text-align: right; }
.a-table th.col-num .th-sort { justify-content: flex-end; }
.col-center { text-align: center; }
.col-actions { text-align: right; white-space: nowrap; }

.th-sort {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: none;
  border: none;
  font: inherit;
  color: inherit;
  padding: 0;
}

.th-sort:hover { color: var(--ablue); }

/* Тооны багана: гарчиг нь тоонуудтайгаа ижил баруун зэрэгцээтэй байна */
.a-table th.col-num { text-align: right; }
.sort-ic { font-size: 0.75rem; color: var(--ablue); min-width: 0.7em; }

.a-table .cell-title { font-weight: 600; max-width: 34rem; }
.cell-teaser { color: var(--amuted); font-weight: 400; }
.cell-revenue { font-weight: 700; }
.row-draft .cell-title { color: var(--amuted); }

.a-table input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--ablue);
}

.badge-status {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--agreen);
  background: var(--agreen-dim);
  border: 1px solid #2ecc7159;
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  white-space: nowrap;
}

.badge-status--draft {
  color: var(--amuted);
  background: #8d93a01a;
  border-color: #8d93a04d;
}

/* Toggle дүрсүүд */

.tog {
  background: none;
  border: none;
  padding: 0.2rem;
  line-height: 0;
  border-radius: 999px;
  transition: transform 0.15s ease;
}

.tog:hover { transform: scale(1.15); }
.tog--on { color: var(--agreen); }
.tog--off { color: var(--ared); }

/* Мөрийн үйлдлүүд */

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: none;
  border: none;
  border-radius: 7px;
  color: var(--amuted);
  margin-left: 0.15rem;
  transition: background 0.15s ease, color 0.15s ease;
}

.icon-btn:hover { background: #ffffff0d; color: var(--atext); }
.icon-btn--green { color: #57c785; }
.icon-btn--green:hover { color: var(--agreen); }
.icon-btn--red:hover { color: var(--ared); }

/* Нийлбэр мөрүүд */

.sum-row td {
  background: #ffffff05;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--amuted);
}

.sum-row .col-num { color: var(--atext); }

/* Хуудаслалт */

.pager-bar {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.9rem 1.25rem;
  flex-wrap: wrap;
}

.pager-info { font-size: 0.85rem; color: var(--amuted); margin-right: auto; }

.per-page {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--amuted);
}

.per-page-select { width: auto; padding: 0.35rem 0.5rem; }

.pager { display: flex; align-items: center; gap: 0.3rem; }

.pager-btn {
  min-width: 32px;
  height: 32px;
  background: none;
  border: 1px solid var(--aline);
  border-radius: 7px;
  color: var(--amuted);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0 0.5rem;
}

.pager-btn:hover:not(:disabled) { color: var(--atext); border-color: var(--amuted); }
.pager-btn:disabled { opacity: 0.4; cursor: default; }

.pager-btn.is-active {
  background: var(--ablue);
  border-color: var(--ablue);
  color: #fff;
}

.pager-dots { color: var(--amuted); padding: 0 0.2rem; }

/* Форм */

.admin-page .editor {
  background: var(--apanel);
  border: 1px solid var(--aline);
  border-radius: 14px;
  padding: 1.75rem;
  margin-top: 1.25rem;
}

.admin-page .editor-title {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1rem;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
}

.editor-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--amuted);
}

.field-wide { grid-column: 1 / -1; }

.field-checks {
  flex-direction: row;
  gap: 1.75rem;
  align-items: center;
  padding: 0.4rem 0;
}

.check-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  color: var(--atext);
  cursor: pointer;
}

.check-label input { width: 15px; height: 15px; accent-color: var(--agreen); }

.admin-page .admin-input {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  color: var(--atext);
  background: var(--apanel-2);
  border: 1px solid var(--aline);
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  width: 100%;
  transition: border-color 0.2s ease;
}

.admin-page .admin-input:focus { outline: none; border-color: var(--ablue); }

textarea.admin-input { resize: vertical; line-height: 1.7; }

.editor-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.4rem;
}

.editor-status { font-size: 0.85rem; color: var(--amuted); }

/* Орлогын шүүлтүүр */

.income-filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.filter-presets { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.chip-filter {
  background: none;
  border: 1px solid var(--aline);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--amuted);
  padding: 0.45rem 1.1rem;
  transition: background 0.2s ease, color 0.2s ease;
}

.chip-filter:hover { color: var(--atext); }

.chip-filter.is-active {
  background: var(--atext);
  border-color: var(--atext);
  color: var(--abg);
}

.filter-dates {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-dates .admin-input { width: auto; padding: 0.45rem 0.7rem; font-size: 0.85rem; }

.filter-sep { color: var(--amuted); }

#income-panel .panel { margin-top: 1rem; }

.panel-title {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amuted);
  padding: 1rem 1.25rem 0;
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-right: 1.25rem;
}
.panel-title-row .panel-title { padding-right: 0; }

/* Статистик картууд */

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

.stat-card {
  background: var(--apanel);
  border: 1px solid var(--aline);
  border-radius: 14px;
  padding: 1.4rem 1.5rem;
}

.stat-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amuted);
}

.stat-value {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.7rem;
  margin-top: 0.4rem;
}

.row-demo td { color: var(--amuted); }

.admin-page .empty-note { color: var(--amuted); padding: 1.25rem; }

/* Орлогын дэлгэрэнгүй modal */

.admin-page .modal-backdrop {
  background: #0a0b0ecc;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.modal--rev {
  background: var(--apanel);
  border: 1px solid var(--aline);
  color: var(--atext);
  max-width: 34rem;
  text-align: left;
  box-shadow: 0 30px 80px #000000a6;
}

.admin-page .modal-close {
  background: var(--apanel-2);
  border: 1px solid var(--aline);
  color: var(--amuted);
}

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

.rev-title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.5;
  padding-right: 2rem;
  margin-bottom: 1.25rem;
}

.rev-price, .rev-last {
  background: var(--apanel-2);
  border: 1px solid var(--aline);
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
}

.rev-price-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--amuted);
}

.rev-price-value, .rev-last-value {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.3rem;
  margin-top: 0.15rem;
}

.rev-last-value { font-size: 1.05rem; }

.rev-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
  margin: 0.9rem 0;
}

.rev-card { border-radius: 10px; padding: 0.9rem 1.1rem; border: 1px solid; }

.rev-card-label { font-size: 0.75rem; font-weight: 600; }

.rev-card-value {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.25rem;
  margin-top: 0.15rem;
}

.rev-card--green { background: #2ecc7112; border-color: #2ecc7147; }
.rev-card--green .rev-card-label { color: var(--agreen); }
.rev-card--blue { background: #5b8def14; border-color: #5b8def4d; }
.rev-card--blue .rev-card-label { color: var(--ablue); }
.rev-card--amber { background: #f5a62312; border-color: #f5a6234d; }
.rev-card--amber .rev-card-label { color: var(--aamber); }

.modal--rev .btn-ghost { margin-top: 0.4rem; }

/* Баталгаажуулах цонх */

.modal--confirm {
  background: var(--apanel);
  border: 1px solid var(--aline);
  color: var(--atext);
  max-width: 24rem;
  text-align: center;
  box-shadow: 0 30px 80px #000000a6;
}

.confirm-text {
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.confirm-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}

/* Зураг байршуулах */

.upload-zone {
  border: 1.5px dashed var(--aline);
  border-radius: 12px;
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--amuted);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.upload-zone:hover { border-color: var(--amuted); color: var(--atext); }

.upload-label {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--atext);
  margin-top: 0.5rem;
}

.upload-hint { font-size: 0.78rem; margin-top: 0.2rem; }

.cover-preview {
  display: block;
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  border-radius: 8px;
}

.upload-status {
  font-size: 0.8rem;
  color: var(--agreen);
  margin-top: 0.6rem;
}

/* Тохиргоо */

.settings-form { max-width: 34rem; }

.settings-note {
  font-size: 0.85rem;
  color: var(--amuted);
  line-height: 1.7;
  margin: -0.5rem 0 1.25rem;
}

/* Засварын хуудас */

.editor-shell { max-width: 56rem; }

.editor-topbar { padding-bottom: 1rem; }

.back-link--dark { color: var(--amuted); }
.back-link--dark:hover { color: var(--atext); }

.admin-page .editor { margin-top: 0; }

.btn-save-green {
  background: var(--agreen);
  color: #0b2415;
  border: none;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 700;
  padding: 0.65rem 1.8rem;
  transition: filter 0.2s ease;
}

.btn-save-green:hover { filter: brightness(1.08); }
.btn-save-green:disabled { opacity: 0.6; cursor: wait; }

a.btn-ghost {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

@media (max-width: 720px) {
  .editor-grid { grid-template-columns: 1fr 1fr; }
  .rev-cards { grid-template-columns: 1fr; }
  .field-checks { flex-wrap: wrap; gap: 1rem; }
}

/* ---------- Админ: утасны хэмжээ ---------- */

@media (max-width: 640px) {
  .admin { padding: 1rem 0.75rem 3rem; }

  .admin-topbar { flex-wrap: wrap; gap: 0.6rem; }
  .admin-tab { padding: 0.38rem 0.7rem; font-size: 0.7rem; }
  .admin-page .btn-ghost { padding: 0.4rem 0.75rem; font-size: 0.74rem; }

  .panel-toolbar { flex-direction: column; align-items: stretch; gap: 0.6rem; }
  .search-box--dark input { width: 100%; }
  .toolbar-left { justify-content: space-between; }

  .a-table { font-size: 0.8rem; }
  .a-table th, .a-table td { padding: 0.55rem 0.5rem; }
  /* Танилцуулгыг нууж, гарчгийн баганыг богиносгоно */
  .cell-teaser { display: none; }
  #stories-table { min-width: 42rem; }
  #tx-table { min-width: 0; }

  /* Хурууны бай томсгоно */
  .icon-btn { width: 34px; height: 34px; }
  .tog { padding: 0.35rem; }

  .stat-grid { grid-template-columns: 1fr 1fr; gap: 0.6rem; }
  .stat-card { padding: 0.9rem 1rem; }
  .stat-label { font-size: 0.6rem; }
  .stat-value { font-size: 1.25rem; }

  .income-filter { flex-direction: column; align-items: stretch; }
  .filter-dates { justify-content: space-between; }
  .filter-dates .admin-input { flex: 1; min-width: 0; }

  .admin-page .editor { padding: 1.1rem 0.9rem; }
  .editor-grid { grid-template-columns: 1fr; gap: 0.8rem; }

  .pager-bar { padding: 0.75rem; gap: 0.6rem; }
}
