/* ============================================================
   ئەسەرجان — باشقۇرۇش سۇپىسى  (RTL · Alkatip Tor Tom)
   ============================================================ */

@font-face {
  font-family: 'Alkatip Tor Tom';
  src: url('https://cdn.jsdelivr.net/gh/UyCode/uyfonts@main/ALKATIP%20Tor%20Tom.ttf') format('truetype');
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --primary: #0fb893;
  --primary-dark: #0a9376;
  --primary-light: #e6f8f3;
  --gold: #c9942c;
  --gold-light: #fbf3e0;
  --red: #f53f3f;
  --red-light: #fdeaea;
  --orange: #ff8f1f;
  --blue: #2f7cf6;
  --purple: #7c5cff;
  --text-1: #1d2129;
  --text-2: #4e5969;
  --text-3: #86909c;
  --border: #e5e9ee;
  --bg: #f3f8f7;
  --card: #ffffff;
  --sidebar: #0f2420;
  --sidebar-2: #14302a;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(15, 80, 66, 0.08);
}

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

html, body {
  height: 100%;
  direction: rtl;
  font-family: 'Alkatip Tor Tom', 'ALKATIP Tor Tom', -apple-system, BlinkMacSystemFont,
    'Segoe UI', Roboto, 'PingFang SC', sans-serif;
  color: var(--text-1);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.6;
}

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ================= كىرىش بېتى ================= */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #0fb893 0%, #0a7a63 55%, #0a4d40 100%);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 20px;
  padding: 40px 34px 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
  text-align: center;
}
.login-logo { margin-bottom: 14px; }
.logo-mark {
  display: inline-flex;
  width: 68px;
  height: 68px;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: linear-gradient(135deg, #12c79f, #0a8a6e);
  color: #fff;
  font-size: 34px;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(15, 184, 147, 0.4);
}
.login-title { font-size: 22px; font-weight: 700; }
.login-sub { color: var(--text-3); font-size: 13px; margin: 6px 0 26px; }
.login-form { text-align: right; }
.login-error { color: var(--red); font-size: 13px; min-height: 20px; margin-bottom: 6px; }
.login-hint { margin-top: 18px; color: var(--text-3); font-size: 12px; }

/* ================= قۇرۇلما ================= */
.admin-app { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  right: 0;
  width: 238px;
  background: var(--sidebar);
  color: #cfe3dd;
  display: flex;
  flex-direction: column;
  z-index: 50;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.sidebar-logo .logo-mark { width: 40px; height: 40px; font-size: 21px; border-radius: 11px; box-shadow: none; }
/* تەڭشەكتىن يۈكلەنگەن ئەپ لوگوسى — سول تەرەپ باشتىكى بەلگە ئورنىدا */
.sidebar-logo .logo-mark.logo-img { object-fit: cover; background: none; padding: 0; }
.sidebar-logo b { color: #fff; font-size: 18px; }
.sidebar-logo small { display: block; color: #7fa39a; font-size: 11px; }
.nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 14px;
  margin-bottom: 4px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #b8d2cb;
  font-size: 14.5px;
  text-align: right;
  transition: 0.15s;
}
.nav-item svg { width: 19px; height: 19px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(15, 184, 147, 0.9), rgba(15, 184, 147, 0.55));
  color: #fff;
  font-weight: 700;
}
.nav-badge {
  margin-right: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sidebar-foot {
  padding: 14px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  color: #7fa39a;
  font-size: 11.5px;
}

.main { margin-right: 238px; min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  height: 62px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar-title { font-size: 18px; font-weight: 700; }
.topbar-right { margin-right: auto; display: flex; align-items: center; gap: 12px; }
.admin-chip { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-2); }
/* باش سۈرەت كونۇپكىسى — چەككەندە ھېسابات تەڭشىكى كۆزنىكى ئېچىلىدۇ */
.account-btn {
  display: flex; align-items: center; gap: 8px;
  font-size: 13.5px; color: var(--text-2); font-family: inherit;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  height: 36px; padding: 0 12px; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.account-btn:hover { background: var(--bg-soft); border-color: var(--border); }
.account-btn .account-ic { width: 20px; height: 20px; color: var(--primary-dark); flex: none; }
/* باش سۈرەت لەيلىمە تىزىملىكى — كونۇپكىنىڭ ئۇدۇل ئاستىدا چىقىدۇ */
.account-wrap { position: relative; }
.account-menu {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 60;
  min-width: 240px; padding: 14px;
  background: var(--card-bg, #fff); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, .14);
  display: flex; flex-direction: column; gap: 10px;
}
/* hidden بولغاندا display:flex نىڭ بېسىپ چۈشۈشىنىڭ ئالدىنى ئالىدۇ */
.account-menu[hidden] { display: none; }
[data-theme="dark"] .account-menu { background: var(--card-bg-dark, #1f2937); box-shadow: 0 12px 32px rgba(0, 0, 0, .4); }
.account-menu .am-title { font-size: 14px; font-weight: 700; color: var(--text-1); }
.account-menu .am-label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--text-2); }
.account-menu .am-label input {
  height: 36px; padding: 0 10px; font-size: 13px; font-family: inherit;
  border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--text-1);
}
.account-menu .am-label input:focus { outline: none; border-color: var(--primary); }
.admin-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary-dark);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700;
}
.menu-btn { display: none; background: none; border: none; color: var(--text-1); }

/* ================= topbar ماشىنا ئادەم ================= */
.topbar-robot {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 39px;
  pointer-events: none;
}
.topbar-robot svg { display: block; width: 100%; height: 100%; transition: transform .18s ease-out; }
/* كۆزلەرنىڭ سۈرۈلۈشى يۇمشاق بولسۇن */
.robot-eyes { transition: transform .12s ease-out; }
/* مەركەزگە قايتىش — ئاستا ۋە تەبىئىي */
.topbar-robot.returning svg { transition-duration: .5s; transition-timing-function: cubic-bezier(.22, 1, .36, 1); }
.topbar-robot.returning .robot-eyes { transition-duration: .5s; transition-timing-function: cubic-bezier(.22, 1, .36, 1); }
/* چىمچىقلاش — ھەر كۆز ئۆز مەركىزىدە بويىغا يېپىلىپ ئېچىلىدۇ */
.robot-eye {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform .08s ease-in-out;
}

.content { padding: 24px; flex: 1; }

/* ================= كارتا / تېز ئۇچۇر ================= */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 14px;
}
.stat-ic {
  width: 48px; height: 48px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-ic svg { width: 24px; height: 24px; }
.stat-info b { display: block; font-size: 22px; line-height: 1.25; }
.stat-info span { color: var(--text-3); font-size: 12.5px; }
.ic-green { background: var(--primary-light); color: var(--primary-dark); }
.ic-gold { background: var(--gold-light); color: var(--gold); }
.ic-blue { background: #eaf2ff; color: var(--blue); }
.ic-red { background: var(--red-light); color: var(--red); }
.ic-purple { background: #f0edff; color: var(--purple); }
.ic-orange { background: #fff1e2; color: var(--orange); }

.panel-row { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; margin-bottom: 20px; }
.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.panel-head h3 { font-size: 16px; font-weight: 700; }
.panel-head span { color: var(--text-3); font-size: 12.5px; }

/* chart */
.chart {
  height: 210px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding-top: 10px;
}
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.chart-bars { display: flex; align-items: flex-end; gap: 4px; height: 150px; }
.bar { width: 14px; border-radius: 5px 5px 0 0; min-height: 4px; transition: 0.4s; position: relative; }
.bar.b1 { background: linear-gradient(180deg, #19cfa7, #0fb893); }
.bar.b2 { background: linear-gradient(180deg, #ffce85, var(--orange)); }
.bar:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: 105%;
  right: 50%;
  transform: translateX(50%);
  background: #1d2129;
  color: #fff;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
}
.chart-label { font-size: 11.5px; color: var(--text-3); }
.chart-legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-2); }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: 5px; }

/* dashboard mini lists */
.rank-list { display: flex; flex-direction: column; gap: 12px; }
.rank-item { display: flex; align-items: center; gap: 12px; }
.rank-no {
  width: 22px; height: 22px; border-radius: 7px;
  background: var(--primary-light); color: var(--primary-dark);
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.rank-no.top { background: var(--gold); color: #fff; }
.rank-cover { width: 38px; height: 50px; border-radius: 6px; object-fit: cover; background: #eef2f1; flex-shrink: 0; }
.rank-meta { flex: 1; min-width: 0; }
.rank-meta b { font-size: 13.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-meta span { font-size: 12px; color: var(--text-3); }

.mini-orders { display: flex; flex-direction: column; }
.mini-order {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13px;
}
.mini-order:last-child { border-bottom: none; }
.mini-order .who { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-order .when { color: var(--text-3); font-size: 11.5px; }

/* ================= قورال بالداق / جەدۋەل ================= */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.toolbar .spacer { flex: 1; }
.search-input {
  display: flex; align-items: center; gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 12px;
  height: 38px;
  width: 240px;
}
.search-input input { border: none; outline: none; flex: 1; background: transparent; }
.search-input svg { width: 16px; height: 16px; color: var(--text-3); }

.table-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* كۆپ تاللاش مەشغۇلات بالدىقى */
.batch-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: -4px 0 14px;
  padding: 10px 14px;
  background: linear-gradient(180deg, #f0faf7, #ecf7f3);
  border: 1px solid #b9e4d8;
  border-radius: 12px;
}
.batch-bar[hidden] { display: none; }
.batch-info { font-size: 13px; color: var(--text-2); margin-left: 4px; }
.batch-info b { color: var(--primary-dark); font-size: 15px; margin: 0 2px; }
.batch-bar .btn { white-space: nowrap; }
.batch-clear {
  margin-right: auto;
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 12.5px;
  cursor: pointer;
  text-decoration: underline;
}
.batch-clear:hover { color: var(--danger); }

/* تاللاش ستونى */
.col-check { width: 42px; text-align: center !important; }
.col-check input[type='checkbox'] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
  vertical-align: middle;
}
.tbl tr.row-picked td { background: #f0faf7; }

.table-scroll { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; min-width: 760px; }
/* ئەسەرلەر جەدىۋىلى كومپاكت — ئىستونلار ئوراش كەڭلىكىگە سىغىدۇ */
table.tbl-compact th, table.tbl-compact td { padding: 9px 4px; }
table.tbl-compact .book-cell { gap: 10px; }
table.tbl-compact .book-cell img { width: 58px; height: 80px; border-radius: 8px; }
table.tbl-compact .book-cell b { font-size: 12.5px; }
table.tbl-compact .book-cell small { font-size: 11px; }
table.tbl-compact .book-cell small.bk-chapters,
table.tbl-compact .book-cell small.bk-meta { font-size: 10.5px; }
table.tbl-compact .row-actions { gap: 4px; }
table.tbl-compact .row-actions .btn-sm { padding: 0 8px; }
table.tbl-compact .col-check { width: 34px; }
.tbl th, .tbl td { padding: 13px 14px; text-align: right; font-size: 13.5px; }
.tbl th {
  background: #f7faf9;
  color: var(--text-2);
  font-weight: 700;
  font-size: 12.5px;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.tbl td { border-bottom: 1px solid #f0f3f2; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: #fafdfc; }

.book-cell { display: flex; align-items: center; gap: 12px; }
.book-cell img { width: 42px; height: 58px; border-radius: 7px; object-fit: cover; background: #eef2f1; }
.book-cell b { font-size: 13.5px; display: block; }
.book-cell small { color: var(--text-3); font-size: 12px; }

/* نەخلەش جەدۋىلىدىكى ئۈندىدار قوبۇل قىلىش كودى كىچىك رەسىمى */
.wd-qr {
  width: 46px;
  height: 46px;
  border-radius: 7px;
  object-fit: contain;
  border: 1px solid #e6ecea;
  background: #fff;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.wd-qr:hover { transform: scale(1.08); border-color: var(--primary, #0fb893); }
.book-cell small.series-mini { color: var(--primary-dark); background: var(--primary-light); padding: 1px 7px; border-radius: 9px; display: inline-block; margin-top: 3px; font-size: 11px; }
.book-cell small.bk-zh { display: block; color: var(--text-3); font-size: 11.5px; direction: ltr; text-align: right; margin-top: 1px; }
.book-cell small.bk-chapters { display: block; margin-top: 2px; font-size: 11.5px; color: var(--primary, #0fb893); direction: rtl; text-align: right; white-space: nowrap; }
.book-cell small.bk-meta { display: flex; align-items: center; justify-content: flex-start; gap: 5px; margin-top: 2px; font-size: 11.5px; color: var(--text-3, #8a8a93); white-space: nowrap; }
.book-cell .m-sep { color: #d0d3d8; }
.book-cell .m-views { display: inline-flex; align-items: center; gap: 3px; }
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--primary-light); }
.user-cell b { font-size: 13.5px; display: block; }
.user-cell small { color: var(--text-3); font-size: 11.5px; }

/* بەلگىلەر */
.tag {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}
.tag-audio { background: #fff1e2; color: var(--orange); }
.tag-text { background: #eaf2ff; color: var(--blue); }
.tag-vip { background: var(--gold-light); color: var(--gold); }
.tag-free { background: var(--primary-light); color: var(--primary-dark); }
.tag-online { background: var(--primary-light); color: var(--primary-dark); }
.tag-offline { background: #f2f3f5; color: var(--text-3); }
.tag-paid { background: var(--primary-light); color: var(--primary-dark); }
.tag-pending { background: var(--gold-light); color: var(--gold); }
.tag-approved { background: var(--primary-light); color: var(--primary-dark); }
.tag-rejected { background: var(--red-light); color: var(--red); }
.tag-ban { background: var(--red-light); color: var(--red); }
.muted { color: var(--text-3); font-size: 12.5px; }
.money { font-weight: 700; color: var(--red); white-space: nowrap; }

/* كۇنۇپكىلار */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 700;
  transition: 0.15s;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-gold { background: linear-gradient(135deg, #e0ac47, var(--gold)); color: #fff; }
.btn-danger { background: var(--red-light); color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
/* رامكىلىق خەتەرلىك مەشغۇلات كونۇپكىسى (تىزىمدىن چېكىنىش قاتارلىق) */
.btn-danger-ghost { background: transparent; border-color: var(--red-light); color: var(--red); }
.btn-danger-ghost:hover { background: var(--red-light); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-2); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary-dark); }
.btn-ok { background: var(--primary-light); color: var(--primary-dark); }
.btn-no { background: var(--red-light); color: var(--red); }
.btn-sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn + .btn { margin-right: 8px; }
.row-actions { display: flex; gap: 6px; flex-wrap: nowrap; }

/* تەۋسىيە ئالماشتۇرغۇچ (toggle) — يېشىل: تەۋسىيە، كۈلرەڭ: ئادەتتىكى */
.rec-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  direction: ltr;
  min-width: 64px;
  height: 24px;
  padding: 2px 8px 2px 3px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 700;
  transition: background 0.25s, box-shadow 0.25s;
}
.rec-toggle .rec-knob {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
  transition: transform 0.25s;
}
.rec-toggle.on { background: var(--primary, #0fb893); color: #fff; flex-direction: row; box-shadow: 0 1px 6px rgba(15, 184, 147, 0.35); }
.rec-toggle.on .rec-txt { color: #fff; }
.rec-toggle.off { background: #e8e9ed; color: #8a8a93; flex-direction: row-reverse; padding: 2px 3px 2px 8px; box-shadow: none; }
.rec-toggle.off .rec-txt { color: #77777f; }
.rec-toggle:disabled { opacity: 0.55; cursor: wait; }
/* جەدۋەل كاتەكچىسىدە مەركەزلەشتۈرۈش — ئىستون قىسىلغاندا سولغا ئېقىپ كەتمەسلىك ئۈچۈن */
.tbl td .rec-toggle { display: flex; width: fit-content; margin-inline: auto; }

.filter-select {
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 12px;
  background: var(--card);
  color: var(--text-1);
  outline: none;
}

/* بەتكە ئايرىش */
.pager { display: flex; align-items: center; gap: 8px; justify-content: center; margin-top: 18px; }
.pager button { min-width: 34px; height: 34px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--border); background: #fff; color: var(--text-2); }
.pager button:disabled { opacity: .45; }
.pager .pg-info { color: var(--text-3); font-size: 12.5px; margin: 0 6px; }

/* tabs */
.tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  padding: 8px 20px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-2);
  font-size: 13.5px;
}
.tab.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 700; }
.tab .n {
  display: inline-block;
  margin-right: 6px;
  min-width: 18px;
  padding: 0 5px;
  height: 18px;
  line-height: 18px;
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.08);
  font-size: 11px;
}
.tab.active .n { background: rgba(255, 255, 255, 0.25); }

/* ================= Modal / form ================= */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(10, 30, 25, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  z-index: 100;
  overflow-y: auto;
}
.modal {
  width: 100%;
  max-width: 560px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  animation: pop 0.18s ease;
}
.modal.modal-sm { max-width: 400px; }
.modal.modal-lg { max-width: 860px; }
@keyframes pop { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 17px; }
.modal-close {
  border: none; background: #f2f3f5; width: 30px; height: 30px;
  border-radius: 8px; color: var(--text-2); font-size: 16px;
}
.modal-body { padding: 20px 22px; max-height: 66vh; overflow-y: auto; }
.modal-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-start;
  gap: 10px;
}

.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; font-weight: 700; }
.field-label .req { color: var(--red); margin-left: 3px; }

/* پارول كۆزنىكى + كۆز سىنبەلگىسى (RTL: input ئوڭدا، سىنبەلگە سولدا) */
.pass-wrap { position: relative; display: block; }
.field .pass-wrap input[type="password"],
.field .pass-wrap input[type="text"] { padding-left: 40px; }
.pass-eye {
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  border-radius: 6px;
}
.pass-eye:hover { color: var(--primary); background: rgba(15, 184, 147, 0.08); }
.pass-eye .eye-slash { display: none; }
.pass-eye.is-visible .eye-open { display: none; }
.pass-eye.is-visible .eye-slash { display: inline; }
.field input[type="text"],
.field input[type="number"],
.field input[type="password"],
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
  background: #fff;
  color: var(--text-1);
  transition: 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15, 184, 147, 0.12); }
.field textarea { resize: vertical; min-height: 84px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ئەسەر قوشۇش/تەھرىرلەش كۆزنىكى — كىچىكرەك خەت ۋە رامكىلار */
.bk-form .field { margin-bottom: 10px; }
.bk-form .field-label { font-size: 12px; margin-bottom: 4px; }
.bk-form .field input[type='text'],
.bk-form .field input[type='number'],
.bk-form .field select,
.bk-form .field textarea {
  font-size: 13px;
  padding: 7px 10px;
  border-radius: 8px;
}
.bk-form .field textarea { min-height: 60px; }
.bk-form .field-row { gap: 10px; }
.bk-form .field-hint { font-size: 12px; }

/* لوگو رەسىم تاللىغۇچى — پەقەت ھۆججەت يۈكلەش */
.logo-picker {
  width: 84px; height: 84px; border-radius: 10px;
  border: 1.5px dashed var(--border); background: var(--card);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; overflow: hidden; color: var(--text-3);
}
.logo-picker:hover { border-color: var(--primary); color: var(--primary); }
.logo-picker img { width: 100%; height: 100%; object-fit: contain; }
.logo-add svg { width: 30px; height: 30px; display: block; }
.field-hint { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }

.seg { display: flex; gap: 8px; }
.seg label {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 0;
  text-align: center;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-2);
}
.seg input { display: none; }
.seg input:checked + span { color: #fff; }
.seg label:has(input:checked) { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 700; }

.cover-preview {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.cover-preview img { width: 72px; height: 100px; object-fit: cover; border-radius: 9px; background: #eef2f1; border: 1px solid var(--border); }
.cover-preview .muted { font-size: 12px; }

/* رەسىم تاللىغۇچ */
.img-picker { display: flex; gap: 8px; }
.img-picker .img-url { flex: 1; min-width: 0; }
.img-pick-btn { white-space: nowrap; flex-shrink: 0; display: inline-flex; align-items: center; gap: 5px; }
.img-pick-btn svg { width: 15px; height: 15px; }
.img-hint { font-size: 11.5px; margin-top: 6px; }

/* توك ئاچقۇ */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0;
  background: #c9cdd4; border-radius: 999px; transition: .2s;
}
.slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  top: 3px; right: 3px;
  transition: .2s;
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(-20px); }
.switch-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; }
.switch-row b { font-size: 13.5px; }
.switch-row span { display: block; font-size: 12px; color: var(--text-3); font-weight: 400; }

/* toast */
.toast-root { position: fixed; top: 24px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: #1d2129;
  color: #fff;
  padding: 11px 20px;
  border-radius: 10px;
  font-size: 13.5px;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  animation: pop .2s ease;
}
.toast.ok { background: var(--primary-dark); }
.toast.err { background: var(--red); }

/* بوش ھالەت */
.empty {
  padding: 60px 0;
  text-align: center;
  color: var(--text-3);
}
.empty svg { width: 56px; height: 56px; opacity: .35; margin-bottom: 10px; }
.loading-mask { padding: 70px 0; text-align: center; color: var(--text-3); }
.spinner {
  width: 30px; height: 30px;
  border: 3px solid var(--primary-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 12px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* banner grid */
.banner-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.banner-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.banner-card img.bn-img { width: 100%; height: 150px; object-fit: cover; background: #eef2f1; }
.banner-body { padding: 14px; flex: 1; }
.banner-body h4 { font-size: 14.5px; margin-bottom: 6px; }
.banner-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
}

/* settings */
/* ئىككى ئىستونلۇق masonry — كارتىلار ئىستون بويىچە ئۈستىگە يىغىلىپ تۇرىدۇ،
   قۇر بويىچە سېلىشتۇرما بولمىغاچقا ئارىدا بوش ئورۇن قالمايدۇ */
.settings-grid { columns: 2; column-gap: 16px; }
.settings-grid .settings-section { break-inside: avoid; margin-bottom: 16px; }
.plan-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 1fr 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}
.plan-row input { height: 36px; border: 1px solid var(--border); border-radius: 8px; padding: 0 10px; width: 100%; }
.settings-section h4 { font-size: 15px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.settings-section h4::before { content: ''; width: 6px; height: 18px; border-radius: 3px; background: var(--primary); }

/* تەڭشەك كارتىلىرىنىڭ ئۈستى-ئاستىدىكى بىكار بوشلۇقنى ئەمەلدىن قالدۇرۇش —
   مەزمۇن كارتىنىڭ ئۈستىگە چاپلىشىپ تۇرىدۇ، ئەڭ ئاستىدىكى field نىڭ مارجىنى تۇڭگۇزۇلىدۇ */
.settings-section { padding-top: 12px; padding-bottom: 6px; }
.settings-section > .field:last-child { margin-bottom: 6px; }

/* responsive */
@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .panel-row { grid-template-columns: 1fr; }
  .settings-grid { columns: 1; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(100%); transition: .25s; }
  .sidebar.open { transform: none; }
  .main { margin-right: 0; }
  .menu-btn { display: inline-flex; }
  .banner-grid { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .plan-row { grid-template-columns: 1fr 1fr; }
}

/* review-mode panel */
.review-panel { border: 1px dashed var(--border); }

/* ئاسراش ھالىتى تاختىسى */
.maintenance-section { border: 1px solid #f4d4d0; background: #fff8f7; }
.danger-title { color: #e74c3c !important; }
.settings-section .img-picker { margin-bottom: 6px; }
.settings-section .cover-preview { max-width: 220px; }

/* تەشۋىقات رەسىم گالېرېياسى — ئىخچام تىزمىلانغان كىچىك كارتىلار */
.promo-gallery { display: flex; flex-wrap: wrap; gap: 10px; }
.pg-slot { position: relative; width: 88px; height: 88px; border-radius: 10px; overflow: hidden; }
.pg-filled img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pg-del {
  position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: rgba(0,0,0,.62); color: #fff;
  font-size: 14px; line-height: 20px; text-align: center; cursor: pointer;
}
.pg-del:hover { background: var(--red, #e74c3c); }
.pg-empty {
  border: 1.5px dashed var(--border); background: var(--card);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3); font-size: 26px; cursor: pointer;
}
.pg-empty:hover { border-color: var(--primary); color: var(--primary); }
.review-panel .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #c2c7cc;
  display: inline-block;
}
.review-panel .dot-on { background: #e74c3c; box-shadow: 0 0 0 4px rgba(231, 76, 60, 0.15); }
.review-desc { font-size: 13px; line-height: 1.9; margin: 8px 0 14px; }
.review-panel .btn svg { width: 17px; height: 17px; margin-left: 6px; }

/* chapters */
.ch-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: var(--bg-page, #f6f7fa);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 14px;
}
.ch-cover { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.ch-head-meta { flex: 1; min-width: 0; }
.ch-head-meta h4 { font-size: 16px; margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-head-tags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ch-list { display: flex; flex-direction: column; gap: 8px; }
.ch-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  transition: border-color .15s;
}
.ch-row:hover { border-color: var(--primary); }
.ch-no {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 13px;
}
.ch-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ch-main b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-main small { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-dur {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 56px;
  justify-content: center;
}
.ch-dur svg { width: 14px; height: 14px; }
.ch-row .tag { flex-shrink: 0; }
.ch-acts { flex-shrink: 0; }
.ch-acts .btn[disabled] { opacity: .35; cursor: not-allowed; }
.modal-lg .modal-body { max-height: 72vh; }

/* ئېلان باشقۇرۇش بېتى — ئىچكى تابلا */
.ads-tabs { display: inline-flex; gap: 6px; margin-bottom: 16px; background: var(--card); padding: 6px; border-radius: var(--radius); box-shadow: var(--shadow); }
.ads-tab { border: none; background: transparent; padding: 9px 20px; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; color: var(--text-2); font-family: inherit; transition: all .18s; }
.ads-tab:hover { color: var(--primary-dark); }
.ads-tab.active { background: var(--primary); color: #fff; }
/* سىيرىپ تەرتىپ ئالماشتۇرۇش — تۇتۇپ سولغا/ئوڭغا سىيرىلىدۇ */
.ads-tab[draggable="true"] { cursor: grab; user-select: none; }
.ads-tab[draggable="true"]:active { cursor: grabbing; }
.ads-tab.dragging { opacity: .45; transform: scale(.96); }
.marquee-grid .bn-img { height: 90px; }
/* كىچىك ئايلانما ئېلان جەدۋىلىدىكى رەسىم كىچىك كۆرۈنۈشى */
.mq-thumb { width: 72px; height: 48px; object-fit: cover; border-radius: 6px; background: #eef2f1; display: block; }

/* ================= كۈندۈز / كېچە ھالەت ئالماشتۇرغۇچ ================= */
.theme-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: 0.18s;
}
.theme-btn:hover { border-color: var(--primary); color: var(--primary); }
.theme-btn svg { width: 19px; height: 19px; display: block; }
/* يورۇق ھالەتتە ئاي (كېچىگە ئۆتۈش)، قاراڭغۇ ھالەتتە قۇياش كۆرۈنىدۇ */
.theme-btn .ic-sun { display: none; }
[data-theme='dark'] .theme-btn .ic-moon { display: none; }
[data-theme='dark'] .theme-btn .ic-sun { display: block; }

/* ================= قاراڭغۇ (كېچە) ھالەت ================= */
[data-theme='dark'] {
  --primary: #16d3a9;
  --primary-dark: #0fb893;
  --primary-light: #12332b;
  --gold: #e0ac47;
  --gold-light: #372e1d;
  --red: #ff6b6b;
  --red-light: #3a2427;
  --orange: #ffa254;
  --blue: #64a0ff;
  --purple: #a892ff;
  --text-1: #e7edf3;
  --text-2: #a7b3c0;
  --text-3: #788592;
  --border: #29333d;
  --bg: #0f151b;
  --card: #171f27;
  --sidebar: #0a1016;
  --sidebar-2: #0e161d;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.38);
}

/* ئاق تەگلىكلىك ئېلېمېنتلارنى قاراڭغۇغا ماسلاشتۇرۇش */
[data-theme='dark'] .tbl th { background: #1c252e; }
[data-theme='dark'] .tbl td { border-bottom-color: #232d37; }
[data-theme='dark'] .tbl tr:hover td { background: #1c252e; }
[data-theme='dark'] .tbl tr.row-picked td { background: #14322a; }
[data-theme='dark'] .book-cell img,
[data-theme='dark'] .rank-cover,
[data-theme='dark'] .cover-preview img,
[data-theme='dark'] .banner-card img.bn-img { background: #232d37; }
[data-theme='dark'] .wd-qr { background: var(--card); border-color: var(--border); }
[data-theme='dark'] .pager button { background: var(--card); }
[data-theme='dark'] .modal { background: var(--card); }
[data-theme='dark'] .modal-close { background: #232d37; color: var(--text-2); }
[data-theme='dark'] .field input,
[data-theme='dark'] .field select,
[data-theme='dark'] .field textarea { background: #111920; color: var(--text-1); }
[data-theme='dark'] .field select option { background: #111920; color: var(--text-1); }
[data-theme='dark'] .search-input input { color: var(--text-1); }
[data-theme='dark'] .banner-card,
[data-theme='dark'] .ch-row,
[data-theme='dark'] .ch-head { background: var(--card); }
[data-theme='dark'] .slider { background: #3a444f; }
[data-theme='dark'] .rec-toggle.off { background: #2c3540; }
[data-theme='dark'] .rec-toggle.off .rec-txt { color: var(--text-2); }
[data-theme='dark'] .batch-bar {
  background: linear-gradient(180deg, #16302a, #132a25);
  border-color: #1f5a49;
}
[data-theme='dark'] .tag-audio,
[data-theme='dark'] .ic-orange { background: #33261a; }
[data-theme='dark'] .tag-text,
[data-theme='dark'] .ic-blue { background: #1b2b40; }
[data-theme='dark'] .ic-purple { background: #251f3c; }
[data-theme='dark'] .tag-offline { background: #232d37; }
[data-theme='dark'] .maintenance-section { background: #2a1b1b; border-color: #4a2a2a; }
[data-theme='dark'] .tab .n { background: rgba(255, 255, 255, 0.1); }
[data-theme='dark'] .pg-empty { background: var(--card); }
[data-theme='dark'] .login-card { background: var(--card); }
[data-theme='dark'] .login-title { color: var(--text-1); }
[data-theme='dark'] .login-hint { color: rgba(255, 255, 255, 0.75); }

/* باش بەت ئۇقتۇرۇشى — قۇر شەكلىدىكى تىزىملىك */
.tbl-notices .nt-text { max-width: 520px; word-break: break-all; }
.tbl-notices .nt-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  border-radius: 50%;
  vertical-align: -2px;
}

/* تۈر باشقۇرۇشتا سۆرەپ تەرتىپلەش */
.tbl tr[draggable='true'] { cursor: grab; transition: background-color 0.15s ease; }
.tbl tr[draggable='true']:active { cursor: grabbing; }
.tbl tr[draggable='true']:hover { background: rgba(19, 206, 102, 0.04); }
.tbl tr.dragging {
  opacity: 0.5;
  background: rgba(19, 206, 102, 0.12);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}
