/*
 * К Исламу — стили.
 * Палитра — премиальный «исламский» стиль: глубокий тёмно-зелёный фон,
 * карточки с тонкой золотой обводкой, тёплое золото как акцент.
 * Контраст (WCAG): тёмно-зелёный на золоте ≈ 6:1, #F5F0E8 на фоне ≈ 14:1,
 * muted #8FA599 на карточке ≈ 5:1 — всё проходит AA.
 * Приложение: верхняя панель + экран + нижняя панель вкладок (как в нативных приложениях).
 * В конце файла — стили админки (admin.html использует этот же файл).
 */
:root {
  color-scheme: dark;
  --bg: #0d231c;          /* середина фонового градиента (для затуханий) */
  --bg-2: #0a1512;
  --bg-grad: linear-gradient(180deg, #0f2d24 0%, #0a1512 100%);
  --surface: #16332a;
  --surface-2: #1c3d33;
  --surface-3: #24493d;
  --border: rgba(201, 162, 75, .25);      /* золотая обводка карточек */
  --border-strong: rgba(201, 162, 75, .55);
  --border-soft: rgba(201, 162, 75, .14);
  --text: #f5f0e8;        /* тёплый белый */
  --text-2: #dcd5c7;
  --muted: #8fa599;       /* серо-зелёный */
  --accent: #c9a24b;      /* золото */
  --accent-light: #d4b36a;
  --accent-pale: #e8d5a8;
  --accent-deep: #a8843a;
  --on-accent: #0f2d24;   /* текст на золотой заливке */
  --accent-grad: linear-gradient(135deg, #c9a24b 0%, #d4b36a 100%);
  --hero-grad: linear-gradient(145deg, #1d4a3b 0%, #16392e 50%, #0f2d24 100%);
  --ok: #5fd3a4;
  --warn: #f0c060;
  --danger: #ff8f8f;
  --radius: 18px;
  --radius-lg: 20px;
  --shadow: 0 6px 20px rgba(0, 0, 0, .28);
  --appbar-h: 56px;
  --tabbar-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  background: var(--bg-2);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}
body { min-height: 100vh; min-height: 100dvh; background: var(--bg-grad) fixed, var(--bg-2); }

a { color: var(--accent); text-decoration: none; }
[hidden] { display: none !important; }
img { max-width: 100%; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

h1 { font-size: 1.55rem; line-height: 1.25; margin: 4px 0 12px; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; line-height: 1.3; margin: 0; }
.muted { color: var(--muted); }
.error { color: var(--danger); }
.status { color: var(--muted); text-align: center; padding: 32px 0; }

/* ---------- верхняя панель приложения ---------- */

.appbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 6px;
  min-height: calc(var(--appbar-h) + var(--safe-top));
  padding: var(--safe-top) 8px 0;
  background: rgba(13, 35, 28, .86);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border-soft);
}
.appbar-title {
  flex: 1; min-width: 0;
  padding: 0 8px;
  font-size: 1.12rem; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.appbar .brand { padding-left: 6px; }
.appbar-actions { display: flex; gap: 2px; }

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 1.2rem; font-weight: 800; letter-spacing: .01em;
  color: var(--text);
}
.brand-mark {
  flex-shrink: 0;
  width: 32px; height: 32px; border-radius: 10px;
  background: var(--accent-grad);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--on-accent); font-size: 1rem; font-weight: 900;
  box-shadow: 0 4px 12px rgba(201, 162, 75, .4);
}
.brand-text {
  background: var(--accent-grad);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}

.icon-btn {
  position: relative; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  border: 0; border-radius: 50%;
  background: transparent; color: var(--text);
  cursor: pointer; transition: background .15s;
}
.icon-btn:hover, .icon-btn:active { background: var(--surface-2); }
.icon-btn svg { width: 24px; height: 24px; }

.offline-bar {
  position: sticky; top: calc(var(--appbar-h) + var(--safe-top)); z-index: 19;
  padding: 7px 14px;
  font-size: .85rem; text-align: center;
  background: #3a3218; color: var(--warn);
  border-bottom: 1px solid rgba(240, 192, 96, .25);
}

/* ---------- нижняя панель вкладок ---------- */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding: 0 4px var(--safe-bottom);
  background: rgba(10, 21, 18, .94);
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-top: 1px solid var(--border-soft);
}
.tab-link {
  position: relative;
  flex: 1; max-width: 120px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted);
  font-size: .72rem; font-weight: 600; letter-spacing: .01em;
  transition: color .2s;
}
.tab-link svg { width: 25px; height: 25px; transition: transform .2s; }
.tab-link .tab-pill {
  display: flex; align-items: center; justify-content: center;
  width: 58px; height: 30px; border-radius: 999px;
  transition: background .25s;
}
.tab-link.active { color: var(--accent-light); }
.tab-link.active .tab-pill { background: rgba(201, 162, 75, .16); }
.tab-link:active svg { transform: scale(.9); }
.tab-link .dot {
  position: absolute; top: 9px; left: calc(50% + 10px);
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--warn); box-shadow: 0 0 0 2px var(--bg-2);
}

/* ---------- экран ---------- */

.view {
  max-width: 860px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--tabbar-h) + var(--safe-bottom) + 28px);
}
.view.enter { animation: view-in .28s cubic-bezier(.2, .8, .2, 1); }
@keyframes view-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.section { margin-top: 28px; }
.section:first-child { margin-top: 4px; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin-bottom: 14px;
}
.section-head a, .link-btn {
  font-size: .92rem; font-weight: 600; color: var(--accent);
  background: none; border: 0; padding: 0; cursor: pointer; white-space: nowrap;
}
.section-sub { color: var(--muted); font-size: .92rem; margin-top: 2px; }

/* ---------- главная: баннер ---------- */

/* силуэт мечети с минаретами — лёгкий inline SVG полупрозрачным золотом, слоем поверх градиента */
.hero {
  position: relative; overflow: hidden;
  padding: 22px 20px 20px;
  border-radius: var(--radius-lg);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 120'%3E%3Cg fill='%23C9A24B' fill-opacity='.14' fill-rule='evenodd'%3E%3Cpath d='M30 120V38h-2l7-24 7 24h-2v82z'/%3E%3Ccircle cx='35' cy='11' r='2.5'/%3E%3Cpath d='M200 120V38h-2l7-24 7 24h-2v82z'/%3E%3Ccircle cx='205' cy='11' r='2.5'/%3E%3Cpath d='M82 80q0-38 38-50 38 12 38 50z'/%3E%3Cpath d='M119 30V16h2v14z'/%3E%3Ccircle cx='120' cy='13' r='3'/%3E%3Cpath d='M56 80q0-17 14-21 14 4 14 21zM156 80q0-17 14-21 14 4 14 21z'/%3E%3Cpath d='M52 80h136v40H52zM110 120v-16q10-14 20 0v16zM70 104v-8q5-7 10 0v8zM160 104v-8q5-7 10 0v8z'/%3E%3C/g%3E%3C/svg%3E") no-repeat right -8px bottom -2px / auto 92%,
    var(--hero-grad);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.hero::after {
  content: ""; position: absolute; right: -60px; top: -60px;
  width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 162, 75, .18), transparent 70%);
  pointer-events: none;
}
.hero-kicker { font-size: .8rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.hero-title { font-size: 1.5rem; font-weight: 800; line-height: 1.25; margin: 6px 0 4px; color: var(--text); }
.hero-sub { color: var(--text-2); font-size: .95rem; }
.hero-search {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 10px;
  margin-top: 18px; padding: 13px 16px;
  border-radius: 999px;
  background: rgba(245, 240, 232, .96); color: #4f6258;
  font-size: 1rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
}
.hero-search svg { width: 20px; height: 20px; color: var(--accent-deep); flex-shrink: 0; }

/* ---------- чипы и горизонтальные ленты ---------- */

.hscroll {
  display: flex; gap: 10px;
  overflow-x: auto; scroll-snap-type: x proximity;
  margin: 0 -16px; padding: 2px 16px 6px;
  scrollbar-width: none;
}
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * { scroll-snap-align: start; flex-shrink: 0; }

.chip {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 40px; padding: 8px 15px;
  border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-2); font-size: .92rem; font-weight: 600;
  white-space: nowrap; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.chip:hover { border-color: var(--border-strong); }
.chip .chip-emoji { font-size: 1.1rem; line-height: 1; }
.chip .chip-count { color: var(--muted); font-weight: 500; font-size: .85rem; }
.chip.active, .chip[aria-pressed="true"] {
  background: rgba(201, 162, 75, .16); border-color: var(--accent); color: var(--accent);
}
.chip.small { min-height: 32px; padding: 5px 12px; font-size: .85rem; }

/* ---------- карточки материалов ---------- */

.mgrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
@media (min-width: 640px) { .mgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; } }

.mcard {
  display: flex; flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.mcard:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.mcard:active { transform: scale(.975); }

.cover {
  position: relative; overflow: hidden;
  aspect-ratio: 16 / 10;
  background: var(--hero-grad);
}
.cover img {
  display: block; width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0; transition: opacity .35s;
}
.cover img.loaded { opacity: 1; }
.cover .cover-fallback {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.2rem;
}
.cover img.loaded + .cover-fallback { display: none; }

.mcard-badges {
  position: absolute; left: 8px; bottom: 8px;
  display: flex; gap: 5px;
}
.mbadge {
  display: inline-flex; align-items: center; gap: 3px;
  height: 24px; padding: 0 8px;
  border-radius: 999px;
  background: rgba(10, 21, 18, .78);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  color: var(--text); font-size: .72rem; font-weight: 700; letter-spacing: .02em;
}
.mbadge svg { width: 13px; height: 13px; }
.mcard-saved {
  position: absolute; right: 8px; top: 8px;
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(10, 21, 18, .78); color: var(--accent);
}
.mcard-saved svg { width: 16px; height: 16px; }

.mcard-body { display: flex; flex-direction: column; gap: 6px; padding: 11px 12px 14px; }
.mcard-cat {
  font-size: .74rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mcard-title {
  font-size: .98rem; font-weight: 650; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
mark { background: rgba(201, 162, 75, .32); color: inherit; border-radius: 3px; padding: 0 1px; }

/* мини-карточки для горизонтальной ленты */
.mcard.mini { width: 172px; }
.mcard.mini .mcard-title { -webkit-line-clamp: 2; font-size: .92rem; }

/* ---------- строки списка (сохранённые, подразделы) ---------- */

.rows { display: flex; flex-direction: column; gap: 10px; }
.row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text);
  transition: background .15s;
}
a.row:hover { background: var(--surface-2); }
.row-thumb {
  flex-shrink: 0; overflow: hidden;
  width: 72px; height: 54px; border-radius: 10px;
  aspect-ratio: auto;
}
.row-icon {
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 12px;
  background: rgba(201, 162, 75, .12); font-size: 1.35rem;
}
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 650; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row-sub { font-size: .85rem; color: var(--muted); margin-top: 3px; }
.row-end { flex-shrink: 0; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.row-end svg { width: 20px; height: 20px; }
.row .icon-btn { width: 40px; height: 40px; color: var(--muted); }
.row .icon-btn:hover { color: var(--danger); }

/* ---------- разделы (категории) ---------- */

.cat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 640px) { .cat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.cat-tile {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between; gap: 18px;
  min-height: 138px; padding: 16px 14px 14px;
  border-radius: var(--radius-lg);
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  color: var(--text);
  transition: transform .18s, border-color .18s;
}
.cat-tile:hover { border-color: var(--border-strong); }
.cat-tile:active { transform: scale(.97); }
.cat-tile::after {
  content: ""; position: absolute; right: -30px; bottom: -30px;
  width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 162, 75, .14), transparent 70%);
}
.cat-icon {
  display: flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; border-radius: 14px;
  background: rgba(201, 162, 75, .14); font-size: 1.6rem;
}
.cat-name { font-weight: 700; line-height: 1.3; font-size: 1rem; }
.cat-meta { font-size: .82rem; color: var(--muted); margin-top: 4px; }

.cat-header {
  display: flex; align-items: center; gap: 16px;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--hero-grad);
  border: 1px solid var(--border);
  color: var(--text);
}
.cat-header .cat-icon { width: 60px; height: 60px; font-size: 2rem; background: rgba(201, 162, 75, .16); }
.cat-header h1 { margin: 0; font-size: 1.35rem; color: var(--text); }
.cat-header .cat-meta { color: var(--text-2); font-size: .9rem; }

.breadcrumbs {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px;
  margin: 0 0 14px; font-size: .88rem; color: var(--muted);
}
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs .sep { opacity: .55; }
.breadcrumbs .current { color: var(--text-2); font-weight: 600; }

/* ---------- поиск ---------- */

.search-sticky {
  position: sticky; top: calc(var(--appbar-h) + var(--safe-top)); z-index: 10;
  margin: -16px -16px 0; padding: 12px 16px 12px;
  background: rgba(13, 35, 28, .94);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.search-field { position: relative; }
.search-field > svg { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); width: 21px; height: 21px; color: var(--muted); pointer-events: none; }
.search-input {
  width: 100%; height: 52px;
  padding: 0 48px 0 46px;
  border-radius: 999px;
  border: 1.5px solid var(--border); background: var(--surface);
  color: var(--text); font: inherit; font-size: 1.05rem;
  outline: none; transition: border-color .15s;
  -webkit-appearance: none; appearance: none;
}
.search-input::-webkit-search-cancel-button { display: none; }
.search-input:focus { border-color: var(--accent); }
.search-clear { position: absolute; right: 4px; top: 4px; }

.filters-block { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.filter-label { font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; }
.select {
  width: 100%; height: 46px; padding: 0 40px 0 14px;
  border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238FA599' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 20px;
  color: var(--text); font: inherit; font-size: .98rem;
  -webkit-appearance: none; appearance: none; outline: none;
}
.select:focus { border-color: var(--accent); }
.segmented {
  display: inline-flex; padding: 4px; gap: 4px;
  border-radius: 12px; background: var(--bg-2); border: 1px solid var(--border-soft);
}
.segmented button {
  min-height: 36px; padding: 6px 14px;
  border: 0; border-radius: 9px;
  background: transparent; color: var(--muted);
  font-weight: 650; font-size: .92rem; cursor: pointer;
  transition: background .2s, color .2s;
}
.segmented button.active { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .25); }
.segmented.full { display: flex; }
.segmented.full button { flex: 1; }
.filters-split { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; justify-content: space-between; }
.filters-split > :first-child { flex: 1 1 220px; }
.results-info {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 20px 0 14px; color: var(--muted); font-size: .92rem;
}

/* ---------- экран материала ---------- */

.detail-cover {
  margin: -16px -16px 0;
  aspect-ratio: 16 / 9; max-height: 46vh; width: calc(100% + 32px);
  border-radius: 0;
}
.detail-cover::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 45%;
  background: linear-gradient(to bottom, transparent, var(--bg));
}
@media (min-width: 700px) {
  .detail-cover { margin: 0; width: 100%; border-radius: var(--radius-lg); }
  .detail-cover::after { display: none; }
}
.detail-head { position: relative; margin-top: -26px; z-index: 1; }
@media (min-width: 700px) { .detail-head { margin-top: 20px; } }
.detail-head h1 { font-size: 1.6rem; margin: 10px 0 8px; }
.detail-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; color: var(--muted); font-size: .9rem; }
.detail-meta .breadcrumbs { margin: 0; }

.actions { display: flex; gap: 10px; margin: 20px 0 6px; }
.action {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-weight: 650; font-size: .98rem; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
}
.action:active { transform: scale(.97); }
.action svg { width: 21px; height: 21px; }
.action.primary { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.action.primary:hover { background: var(--accent-light); }
.action.on { background: rgba(201, 162, 75, .14); border-color: var(--accent); color: var(--accent); }
.action.on svg path { fill: currentColor; }
.action:disabled { opacity: .6; }

.files { display: flex; flex-direction: column; gap: 10px; }
.file {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text);
}
.file:hover { border-color: var(--border-strong); }
.file-icon {
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 12px;
  font-size: .72rem; font-weight: 800; letter-spacing: .03em;
}
.file-icon svg { width: 22px; height: 22px; }
.file-icon.pdf { background: rgba(255, 143, 128, .15); color: #ff9f8a; }
.file-icon.epub { background: rgba(169, 189, 255, .15); color: #a9bdff; }
.file-icon.audio { background: rgba(201, 162, 75, .15); color: var(--accent); }
.file-name { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; line-height: 1.35; }
.file-name small { display: block; color: var(--muted); font-weight: 500; font-size: .82rem; margin-top: 2px; }
.file .row-end svg { color: var(--accent); }

.tracks { display: flex; flex-direction: column; gap: 10px; }
.track {
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
}
.track-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.track-num {
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(201, 162, 75, .14); color: var(--accent);
  font-size: .8rem; font-weight: 700;
}
.track-name { flex: 1; min-width: 0; font-size: .9rem; color: var(--text-2); overflow-wrap: anywhere; }
.track-dl { color: var(--muted); display: flex; }
.track-dl svg { width: 20px; height: 20px; }
.track audio { width: 100%; height: 40px; }

.prose {
  font-size: 1.1rem; line-height: 1.8;
  color: var(--text);
  overflow-wrap: break-word; hyphens: auto;
}
.prose p { margin: 0 0 1.05em; }
.prose .basmala { text-align: center; font-size: 2rem; line-height: 1.4; color: var(--accent-light); margin: .4em 0 .8em; }

.divider { height: 1px; background: var(--border-soft); margin: 28px 0; border: 0; }

/* ---------- профиль ---------- */

.profile-card {
  position: relative; overflow: hidden;
  padding: 22px 20px;
  border-radius: var(--radius-lg);
  background: var(--hero-grad);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: var(--shadow);
}
.profile-top { display: flex; align-items: center; gap: 16px; }
.avatar {
  flex-shrink: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  width: 68px; height: 68px; border-radius: 50%;
  background: rgba(201, 162, 75, .16); border: 2px solid var(--border-strong);
  font-size: 1.8rem; font-weight: 800; color: var(--accent-pale);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-name { font-size: 1.3rem; font-weight: 800; line-height: 1.25; overflow-wrap: anywhere; }
.profile-handle { color: var(--text-2); font-size: .95rem; overflow-wrap: anywhere; }
.method-badge {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 6px; padding: 3px 10px; border-radius: 999px;
  background: rgba(201, 162, 75, .16); color: var(--accent-pale); font-size: .78rem; font-weight: 700;
}
.stats-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.stat-pill { padding: 10px 14px; border-radius: 16px; background: rgba(10, 21, 18, .25); }
.stat-pill b { display: block; font-size: 1.35rem; line-height: 1.2; }
.stat-pill span { font-size: .82rem; color: var(--text-2); }
.stat-pill b { color: var(--accent-pale); }

.auth-hero { text-align: center; padding: 10px 8px 4px; }
.auth-hero .avatar { margin: 0 auto 14px; width: 84px; height: 84px; font-size: 2.4rem; background: var(--hero-grad); border-color: var(--border); }
.auth-hero h1 { margin-bottom: 6px; }
.auth-hero p { color: var(--muted); margin: 0 auto; max-width: 380px; }

.panel {
  padding: 20px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.auth-panel { max-width: 460px; margin: 20px auto 0; }
.tg-box { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; padding: 8px 0; }
.tg-logo {
  display: flex; align-items: center; justify-content: center;
  width: 64px; height: 64px; border-radius: 50%;
  background: #229ED9; color: #fff;
}
.tg-logo svg { width: 34px; height: 34px; }
.tg-widget { min-height: 48px; display: flex; justify-content: center; }
.small-print { color: var(--muted); font-size: .85rem; line-height: 1.5; }

.form { display: flex; flex-direction: column; gap: 14px; max-width: 520px; }
.form.wide { max-width: none; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: .88rem; color: var(--muted); font-weight: 650; }
.field input, .field textarea, .field select {
  width: 100%; min-height: 50px;
  padding: 12px 14px;
  font: inherit; font-size: 1rem;
  color: var(--text); background: var(--bg-2);
  border: 1px solid var(--border); border-radius: 12px;
  outline: none; transition: border-color .15s;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); }
.field textarea { min-height: 130px; resize: vertical; line-height: 1.55; }
.field small { color: var(--muted); font-size: .8rem; }

.btn, .more-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 18px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); color: var(--text);
  font: inherit; font-weight: 650; cursor: pointer;
  text-decoration: none;
  transition: border-color .15s, background .15s, transform .1s;
}
.btn:hover, .more-btn:hover { border-color: var(--border-strong); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: default; }
.btn svg { width: 20px; height: 20px; }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.btn.primary:hover { background: var(--accent-light); border-color: transparent; }
.btn.danger { color: var(--danger); background: transparent; border-color: rgba(255, 143, 143, .35); }
.btn.link { background: transparent; border-color: transparent; color: var(--accent); padding-left: 4px; padding-right: 4px; min-height: 40px; }
.btn.block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.more-btn { width: 100%; margin-top: 16px; }
.sentinel { height: 1px; }

.hint {
  padding: 12px 14px; margin: 10px 0;
  border-radius: 16px;
  background: rgba(201, 162, 75, .08); border: 1px solid rgba(201, 162, 75, .28);
  font-size: .92rem; line-height: 1.5;
}
.hint.error { background: rgba(255, 143, 143, .08); border-color: rgba(255, 143, 143, .35); color: var(--danger); }
.hint.ok { background: rgba(95, 211, 164, .08); border-color: rgba(95, 211, 164, .35); color: var(--ok); }

.tabs { display: flex; gap: 4px; margin-bottom: 18px; padding: 4px; background: var(--bg-2); border-radius: 12px; }
.tab {
  flex: 1; min-height: 40px; padding: 8px; border: 0; border-radius: 9px;
  background: transparent; color: var(--muted);
  font: inherit; font-weight: 650; cursor: pointer;
}
.tab.active { background: var(--surface-3); color: var(--text); }

/* ---------- обращения в поддержку ---------- */

.card {
  display: block;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
}
.list { display: flex; flex-direction: column; gap: 10px; }
.card-title { font-weight: 650; line-height: 1.35; }
.card-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; font-size: .85rem; color: var(--muted); }
.ticket-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.ticket-msg { margin-top: 10px; white-space: pre-line; overflow-wrap: anywhere; color: var(--text-2); }
.ticket-reply {
  margin-top: 12px; padding: 12px 14px;
  border-left: 3px solid var(--accent);
  background: rgba(201, 162, 75, .07);
  border-radius: 0 10px 10px 0;
  white-space: pre-line; overflow-wrap: anywhere;
}
.ticket-reply b { display: block; color: var(--accent); font-size: .85rem; margin-bottom: 4px; }
.st { flex-shrink: 0; font-size: .75rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.st.open { color: var(--warn); }
.st.answered { color: var(--ok); }
.st.closed { color: var(--muted); }
details.new-ticket > summary { list-style: none; cursor: pointer; }
details.new-ticket > summary::-webkit-details-marker { display: none; }
details.new-ticket[open] > summary { margin-bottom: 14px; }

/* ---------- пустые состояния ---------- */

.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 40px 20px;
}
.empty-emoji {
  display: flex; align-items: center; justify-content: center;
  width: 92px; height: 92px; margin-bottom: 16px; border-radius: 50%;
  background: var(--surface); font-size: 2.8rem;
}
.empty-title { font-size: 1.15rem; font-weight: 700; margin-bottom: 6px; }
.empty-text { color: var(--muted); max-width: 340px; }
.empty .btn { margin-top: 18px; }
.empty.compact { padding: 24px 12px; }
.empty.compact .empty-emoji { width: 68px; height: 68px; font-size: 2rem; }

/* ---------- скелетоны ---------- */

.sk {
  position: relative; overflow: hidden;
  background: var(--surface-2);
  border-radius: 8px;
}
.sk::after {
  content: ""; position: absolute; inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .07), transparent);
  animation: shimmer 1.3s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
.sk-line { height: 13px; margin-top: 8px; }
.sk-line.w40 { width: 40%; } .sk-line.w60 { width: 60%; } .sk-line.w80 { width: 80%; } .sk-line.w90 { width: 90%; }
.sk-title { height: 26px; width: 85%; margin: 14px 0 10px; }
.sk-hero { height: 190px; border-radius: var(--radius-lg); }
.sk-chip { width: 120px; height: 40px; border-radius: 999px; }
.sk-card { border-radius: var(--radius); overflow: hidden; background: var(--surface); border: 1px solid var(--border); }
.sk-card .sk-cover { aspect-ratio: 16 / 10; border-radius: 0; }
.sk-card .sk-body { padding: 11px 12px 16px; }
.sk-tile { min-height: 138px; border-radius: var(--radius-lg); }

/* ---------- всплывающее уведомление ---------- */

.toast {
  position: fixed; left: 50%; z-index: 50;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px);
  width: max-content; max-width: calc(100% - 32px);
  padding: 12px 18px; text-align: center;
  border-radius: 16px;
  background: var(--accent-pale); color: var(--on-accent);
  font-weight: 600; font-size: .95rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 380px) {
  .view { padding-left: 12px; padding-right: 12px; }
  .mgrid { gap: 10px; }
  .hscroll { margin: 0 -12px; padding-left: 12px; padding-right: 12px; }
  .search-sticky { margin: -16px -12px 0; padding-left: 12px; padding-right: 12px; }
  .detail-cover { margin: -16px -12px 0; width: calc(100% + 24px); }
  .mcard-title { font-size: .93rem; }
  .tab-link .tab-pill { width: 50px; }
}

/* ---------- админка (admin.html) ---------- */

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 4px;
  padding: 8px 12px;
  padding-top: calc(8px + env(safe-area-inset-top));
  background: rgba(13, 35, 28, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar .brand { flex: 1; }
.container {
  max-width: 820px;
  margin: 0 auto;
  padding: 16px 12px calc(40px + env(safe-area-inset-bottom));
}
.admin-container { max-width: 1000px; }
.admin-container h1 { font-size: 1.4rem; }
.admin-container h2 { font-size: .95rem; color: var(--muted); font-weight: 600; margin: 22px 0 8px; text-transform: uppercase; letter-spacing: .05em; }
.admin-container .panel { border-radius: 16px; }
.admin-container .btn { min-height: 42px; }
.admin-container .field input, .admin-container .field textarea, .admin-container .field select { background: var(--surface); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.stat { padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.stat-label { font-size: .85rem; color: var(--muted); }
.stat-value { font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: 2px; }
.stat-sub { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.filters .tab { flex: 0 0 auto; padding: 6px 12px; background: var(--surface); }
.filters .tab.active { background: var(--surface-2); color: var(--accent); }
