/* آینه‌ی فکری — مینی‌اپ تلگرام
   رنگ‌ها از متغیرهای تم تلگرام می‌آیند تا با تم کاربر (روشن/تیره) بخواند. */

@font-face {
  font-family: 'Vazirmatn';
  src: url('/static/Vazirmatn-Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/static/Vazirmatn-Bold.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg:        var(--tg-theme-bg-color, #17212b);
  --bg2:       var(--tg-theme-secondary-bg-color, #232e3c);
  --fg:        var(--tg-theme-text-color, #e9edf2);
  --hint:      var(--tg-theme-hint-color, #8a9aab);
  --link:      var(--tg-theme-link-color, #5ab0f0);
  --btn:       var(--tg-theme-button-color, #5ab0f0);
  --btn-fg:    var(--tg-theme-button-text-color, #ffffff);
  --section:   var(--tg-theme-section-bg-color, var(--bg2));
  --sep:       color-mix(in srgb, var(--hint) 18%, transparent);
  --radius:    18px;
  --tap:       44px;
  --safe-b:    env(safe-area-inset-bottom, 0px);
  --safe-t:    env(safe-area-inset-top, 0px);

  /* ارتفاع نوارها — محتوا با همین مقدار از زیرشان رد می‌شود */
  --topbar-h:  calc(52px + var(--safe-t));
  --tabbar-h:  calc(58px + var(--safe-b));

  /* --- شیشه ---
     مقادیر تیره پیش‌فرض‌اند؛ بلوک [data-scheme=light] پایین بازنویسی می‌کند. */
  --glass-tint:   rgba(255, 255, 255, 0.07);
  --glass-blur:   22px;
  --glass-sat:    170%;
  --glass-edge:   rgba(255, 255, 255, 0.13);  /* لبه‌ی روشن — نور روی شیشه */
  --glass-shade:  rgba(0, 0, 0, 0.24);
  --orb-a: #5AB0F0;
  --orb-b: #7C6FF0;
  --orb-op: 0.16;

  /* منحنی‌ها: پیش‌فرض بدون فراجهش؛ بازگشتی فقط برای حرکتِ دارای تکانه */
  --ease:        cubic-bezier(0.32, 0.72, 0, 1);
  --ease-out:    cubic-bezier(0.22, 1, 0.36, 1);
}

:root[data-scheme="light"] {
  --glass-tint:  rgba(255, 255, 255, 0.62);
  --glass-blur:  20px;
  --glass-sat:   180%;
  --glass-edge:  rgba(255, 255, 255, 0.85);
  --glass-shade: rgba(0, 0, 0, 0.07);
  --orb-op: 0.13;
}

/* شیشه فقط برای لایه‌ی «کروم» — نوار بالا، نوار تب، کادر نوشتن.
   هرگز روی محتوا. شیشه روی شیشه هم ممنوع. */
.glass {
  background: var(--glass-tint);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
}

/* اگر مرورگر backdrop-filter ندارد، به‌جای شیشه‌ی بی‌اثر، سطح جامد بده */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: var(--bg); }
}

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

html, body {
  margin: 0; padding: 0; height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
  font-size: 15px;
  line-height: 1.7;
  direction: rtl;
}

.hidden { display: none !important; }

button, input, textarea {
  font-family: inherit; font-size: inherit; color: inherit;
}

/* ---------- بوت و دروازه ---------- */

.boot {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.spinner {
  width: 32px; height: 32px; border-radius: 50%;
  border: 3px solid var(--sep);
  border-top-color: var(--link);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.gate {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 32px 28px; gap: 4px;
}
.gate-icon { font-size: 46px; margin-bottom: 10px; line-height: 1; }
.gate h2 { margin: 0 0 6px; font-size: 21px; letter-spacing: -0.02em; line-height: 1.3; }
.gate p { margin: 0 0 20px; color: var(--hint); max-width: 340px; }
.diag {
  display: block; margin-top: 12px; padding: 12px 14px;
  background: var(--bg2); border-radius: 12px;
  font-family: ui-monospace, Menlo, monospace; font-size: 11.5px;
  line-height: 1.6; text-align: start; direction: ltr;
  white-space: pre-wrap; word-break: break-all; color: var(--fg);
  max-height: 40vh; overflow: auto;
}

/* ---------- چیدمان ---------- */

.app { position: relative; height: 100%; overflow: hidden; }

/* --- لایه‌ی محیطی ---
   شیشه بدون چیزی برای شکستن، فقط یک لکه‌ی تار است. این دو هاله
   عمق ملایمی می‌سازند؛ حرکت واقعیِ پشت شیشه از اسکرول محتوا می‌آید. */
.ambient {
  position: absolute; inset: 0; overflow: hidden;
  pointer-events: none; z-index: 0;
}
.orb {
  position: absolute; display: block;
  width: 62vw; height: 62vw; max-width: 340px; max-height: 340px;
  border-radius: 50%; filter: blur(64px); opacity: var(--orb-op);
}
.orb-a { background: var(--orb-a); top: -12%; inset-inline-end: -18%; }
.orb-b { background: var(--orb-b); bottom: 4%;  inset-inline-start: -22%; }

/* --- نوار بالا (شیشه) --- */
.topbar {
  position: absolute; inset-inline: 0; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  height: var(--topbar-h);
  padding: var(--safe-t) 16px 0;
  /* لبه‌ی پایین به‌جای خط ۱ پیکسلی: محو تدریجی */
  box-shadow: 0 1px 0 var(--glass-edge), 0 8px 24px -18px var(--glass-shade);
}
.topbar-title {
  font-weight: 700; font-size: 17px; letter-spacing: -0.01em;
}

.credits {
  display: inline-flex; align-items: center; gap: 6px;
  background: color-mix(in srgb, var(--fg) 8%, transparent);
  border: 1px solid var(--glass-edge);
  border-radius: 999px;
  padding: 5px 11px; font-size: 13px; color: var(--fg); cursor: pointer;
  transition: transform 120ms var(--ease-out);
}
.credits:active { transform: scale(0.94); }
.credits { font-variant-numeric: tabular-nums; font-weight: 700; }
.credits-ico { display: grid; place-items: center; color: #4fc3a1; }
.credits-ico .ico { width: 14px; height: 14px; }
.credits.low   .credits-ico { color: #f0a25a; }
.credits.empty .credits-ico { color: #e8556a; }

/* --- ناحیه‌ی محتوا ---
   محتوا از زیر نوارها رد می‌شود. همین چیزی است که شیشه را
   معنادار می‌کند: پشتش واقعاً چیزی حرکت می‌کند. */
.view {
  position: absolute; inset: 0; z-index: 10;
  display: flex; flex-direction: column;
  overflow: hidden;
  padding-top: var(--topbar-h);
  padding-bottom: var(--tabbar-h);
}

/* --- نوار تب (شیشه) --- */
.tabbar {
  position: absolute; inset-inline: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: var(--tabbar-h);
  padding-bottom: var(--safe-b);
  /* لبه‌ی بالایی روشن = نوری که روی شیشه می‌افتد */
  box-shadow: 0 -1px 0 var(--glass-edge), 0 -8px 24px -18px var(--glass-shade);
}
.tab {
  position: relative;
  background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 3px;
  color: var(--hint); font-size: 10.5px; letter-spacing: 0.01em;
  min-height: var(--tap);
  transition: color 180ms var(--ease-out);
}
.tab-ico {
  display: grid; place-items: center; line-height: 0;
  transition: transform 260ms var(--ease-out);
}
.tab-ico .ico { width: 22px; height: 22px; }
.tab:active .tab-ico { transform: scale(0.86); }
.tab.active { color: var(--link); }
.tab.active .tab-ico { transform: translateY(-1px); }

/* هاله‌ی نرم پشت تب فعال — نشانه‌ی جایگاه، بدون شلوغی */
.tab-pill {
  position: absolute; top: 4px; inset-inline: 50%;
  width: 46px; height: 30px; margin-inline-start: -23px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--link) 16%, transparent);
  opacity: 0; transform: scale(0.7);
  transition: opacity 240ms var(--ease-out), transform 320ms var(--ease);
  pointer-events: none;
}
.tab.active .tab-pill { opacity: 1; transform: scale(1); }

/* --- آیکون‌ها --- */
.ico { display: block; flex: 0 0 auto; }
h3 .ico, h4 .ico { display: inline-block; vertical-align: -2px; margin-inline-end: 5px; }

/* --- نقطه‌ی رنگیِ الگو --- */
.pdot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--h, var(--link));
  flex: 0 0 auto;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--h, var(--link)) 20%, transparent);
}

/* ---------- چت ---------- */

.messages {
  flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 12px 14px 10px;
  display: flex; flex-direction: column; gap: 12px;
  /* جایی که محتوا زیر کروم می‌رود محو می‌شود، نه اینکه با خط قطع شود */
  -webkit-mask-image: linear-gradient(to bottom,
      transparent 0, #000 18px, #000 calc(100% - 6px), transparent 100%);
  mask-image: linear-gradient(to bottom,
      transparent 0, #000 18px, #000 calc(100% - 6px), transparent 100%);
}

.msg { max-width: 88%; animation: rise .22s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

/* در چیدمان راست‌به‌چپ، پیام خودِ کاربر سمت چپ می‌نشیند */
.msg.me  { align-self: flex-end; }
.msg.bot { align-self: flex-start; }

.bubble {
  padding: 10px 14px; border-radius: var(--radius);
  background: var(--bg2); white-space: pre-wrap; word-break: break-word;
}
.msg.me .bubble {
  background: var(--btn); color: var(--btn-fg);
  border-bottom-left-radius: 5px;
}
.msg.bot .bubble { border-bottom-right-radius: 5px; }

.bubble.typing { display: flex; gap: 4px; padding: 14px 16px; }
.bubble.typing i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--hint);
  animation: blink 1.2s infinite;
}
.bubble.typing i:nth-child(2) { animation-delay: .2s; }
.bubble.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,60%,100% { opacity: .25 } 30% { opacity: 1 } }

/* کارت تحلیل */
.card {
  background: var(--bg2); border-radius: var(--radius);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 12px;
}
.card-quote {
  color: var(--hint); font-style: italic; font-size: 14px;
  border-inline-start: 3px solid var(--sep); padding-inline-start: 10px;
}
.card h4 {
  margin: 0; font-size: 13px; color: var(--hint);
  font-weight: 400; letter-spacing: .2px;
}

.dist {
  position: relative;
  background: color-mix(in srgb, var(--h, var(--link)) 7%, transparent);
  border: 1px solid color-mix(in srgb, var(--h, var(--link)) 22%, transparent);
  border-radius: 13px;
  padding: 11px 13px; display: flex; flex-direction: column; gap: 6px;
  overflow: hidden;
}
/* نوار رنگی در لبه‌ی شروع — هویت الگو بدون خواندن متن */
.dist::before {
  content: ''; position: absolute; inset-block: 0; inset-inline-start: 0;
  width: 3px; background: var(--h, var(--link));
}
.dist-head {
  display: flex; align-items: center; gap: 8px; font-weight: 700;
}
.dist-conf {
  margin-inline-start: auto; font-size: 11.5px; font-weight: 400;
  color: var(--hint); white-space: nowrap;
  font-variant-numeric: tabular-nums;
  background: color-mix(in srgb, var(--fg) 7%, transparent);
  border-radius: 7px; padding: 2px 7px;
}
.dist-ev {
  font-size: 14px; color: var(--hint);
  border-inline-start: 2px solid color-mix(in srgb, var(--h, var(--link)) 50%, transparent);
  padding-inline-start: 8px;
}
.dist-why { font-size: 14px; }

.reframe {
  background: color-mix(in srgb, var(--link) 12%, transparent);
  border-radius: 12px; padding: 10px 12px;
}
.socratic { font-weight: 700; }

.meta {
  display: flex; gap: 8px; flex-wrap: wrap;
  font-size: 12px; color: var(--hint);
  border-top: 1px solid var(--sep); padding-top: 10px;
}
.disclaimer { font-size: 12px; color: var(--hint); font-style: italic; }

.crisis {
  background: color-mix(in srgb, #e8556a 14%, transparent);
  border: 1px solid color-mix(in srgb, #e8556a 40%, transparent);
  border-radius: var(--radius); padding: 14px 16px;
}
.crisis a { color: var(--link); font-weight: 700; text-decoration: none; }
.crisis .tel { display: block; margin: 6px 0; font-size: 17px; }

.notice {
  background: color-mix(in srgb, #f0a25a 14%, transparent);
  border-radius: var(--radius); padding: 12px 14px; font-size: 14px;
}
.notice p { margin: 8px 0 0; }
.notice.medical {
  background: color-mix(in srgb, #57B8C9 14%, transparent);
  border: 1px solid color-mix(in srgb, #57B8C9 32%, transparent);
}

.composer {
  flex: 0 0 auto; display: flex; gap: 8px; align-items: flex-end;
  padding: 9px 12px;
  box-shadow: 0 -1px 0 var(--glass-edge);
}
.composer textarea {
  flex: 1; resize: none; max-height: 130px;
  background: color-mix(in srgb, var(--fg) 7%, transparent);
  border: 1px solid var(--glass-edge);
  border-radius: 21px;
  padding: 10px 16px; outline: none; line-height: 1.6;
  transition: border-color 160ms var(--ease-out);
}
.composer textarea:focus {
  border-color: color-mix(in srgb, var(--link) 55%, transparent);
}
.send {
  flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%;
  background: var(--btn); color: var(--btn-fg);
  border: none; cursor: pointer;
  display: grid; place-items: center;
  box-shadow: 0 2px 12px -4px var(--btn);
  transition: transform 130ms var(--ease-out), opacity 130ms linear;
}
.send:active { transform: scale(0.9); }
.send:disabled { opacity: .35; cursor: default; transform: none; }
.send .ico { width: 19px; height: 19px; margin-inline-end: 2px; }

/* ---------- فهرست افکار ---------- */

.filters {
  flex: 0 0 auto; padding: 12px 14px 8px;
  display: flex; flex-direction: column; gap: 10px;
  border-bottom: 1px solid var(--sep);
}
.search-wrap { position: relative; display: flex; align-items: center; }
.search-ico {
  position: absolute; inset-inline-start: 13px;
  color: var(--hint); pointer-events: none; display: grid; place-items: center;
}
.search-ico .ico { width: 17px; height: 17px; }
.search-wrap input[type=search] {
  background: var(--bg2); border: 1px solid transparent; border-radius: 13px;
  padding: 10px 14px; padding-inline-start: 40px; outline: none; width: 100%;
  transition: border-color 160ms var(--ease-out);
  -webkit-appearance: none;
}
.search-wrap input[type=search]:focus {
  border-color: color-mix(in srgb, var(--link) 45%, transparent);
}
.chips { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg2); border: 1px solid transparent;
  border-radius: 999px; padding: 6px 12px; font-size: 13px;
  cursor: pointer; white-space: nowrap; color: var(--fg);
  transition: transform 130ms var(--ease-out),
              background 180ms var(--ease-out),
              border-color 180ms var(--ease-out);
}
.chip b { color: var(--hint); font-weight: 400; font-variant-numeric: tabular-nums; }
.chip:active { transform: scale(0.94); }
.chip.on {
  background: color-mix(in srgb, var(--h, var(--link)) 18%, var(--bg2));
  border-color: color-mix(in srgb, var(--h, var(--link)) 55%, transparent);
}
.chip.on b { color: var(--fg); }

.list {
  flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 12px 14px 16px; display: flex; flex-direction: column; gap: 10px;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 14px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 14px);
}

.item {
  background: var(--bg2); border-radius: var(--radius);
  padding: 12px 14px; display: flex; flex-direction: column; gap: 8px;
  cursor: pointer;
  transition: transform 130ms var(--ease-out);
}
.item:active { transform: scale(0.978); }
.item { animation: item-in 320ms var(--ease-out) both; animation-delay: var(--d, 0ms); }
@keyframes item-in { from { opacity: 0; transform: translateY(8px); } }
.item-theme { margin-inline-start: auto; }
.item-top {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--hint);
}
.item-text { line-height: 1.65; }
.item-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; background: var(--bg);
  border: 1px solid color-mix(in srgb, var(--h, var(--hint)) 28%, transparent);
  border-radius: 9px; padding: 4px 9px; color: var(--fg);
}
.tag.muted { color: var(--hint); border-color: var(--sep); }
.tag .pdot { width: 7px; height: 7px; box-shadow: none; }

.empty {
  text-align: center; color: var(--hint);
  padding: 56px 24px; line-height: 1.9;
}
.empty-ico {
  display: grid; place-items: center; margin: 0 auto 14px;
  width: 72px; height: 72px; border-radius: 22px;
  background: color-mix(in srgb, var(--hint) 12%, transparent);
  color: var(--hint);
}

.load-more { margin: 0 14px 16px; }

/* ---------- آمار ---------- */

#view-stats, #view-more { overflow-y: auto; -webkit-overflow-scrolling: touch; }
#statsBody, #moreBody { padding: 16px 14px calc(20px + var(--safe-b)); }

.panel {
  background: var(--bg2); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px;
}
.panel h3 { margin: 0 0 12px; font-size: 15.5px; letter-spacing: -0.01em; }

.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.kpi { background: var(--bg); border-radius: 12px; padding: 12px; }
.kpi b { display: block; font-size: 23px; line-height: 1.25; letter-spacing: -0.02em; }
.kpi span { font-size: 12px; color: var(--hint); }

.bar-row {
  margin-bottom: 13px;
  animation: item-in 340ms var(--ease-out) both; animation-delay: var(--d, 0ms);
}
.bar-row[data-key] { cursor: pointer; }
.bar-row[data-key]:active { transform: scale(0.985); }
.bar-row:last-child { margin-bottom: 0; }
.bar-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; margin-bottom: 6px;
}
.bar-count {
  margin-inline-start: auto; color: var(--hint); font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.bar-track {
  height: 7px; background: var(--bg); border-radius: 999px; overflow: hidden;
}
.bar-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg,
      color-mix(in srgb, var(--h) 72%, transparent), var(--h));
  transition: width 700ms var(--ease);
}

.gauge-wrap { display: flex; align-items: center; gap: 16px; margin: 4px 0 12px; }
.ring { flex: 0 0 auto; }
.ring circle:last-of-type {
  transition: stroke-dasharray 900ms var(--ease);
}
.gauge-side b {
  display: block; font-size: 26px; line-height: 1.2;
  letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
}
.gauge-side span { font-size: 13.5px; color: var(--hint); }

.spark { width: 100%; height: 68px; display: block; }

.insight-block { margin-bottom: 14px; }
.insight-block:last-child { margin-bottom: 0; }
.insight-block h4 {
  margin: 0 0 5px; font-size: 13px; color: var(--hint); font-weight: 400;
}
.insight-block p { margin: 0; }
.insight-block ul { margin: 0; padding-inline-start: 18px; }
.insight-block li { margin-bottom: 5px; }

/* ---------- بیشتر ---------- */

.row {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg2); border-radius: 14px;
  padding: 13px 14px; margin-bottom: 8px;
  cursor: pointer; border: none; width: 100%; text-align: start;
  min-height: var(--tap);
  transition: transform 130ms var(--ease-out);
}
.row:active { transform: scale(0.982); }
.row-ico {
  flex: 0 0 auto; display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 10px;
  background: color-mix(in srgb, var(--link) 14%, transparent);
  color: var(--link);
}
.row-txt { flex: 1; }
.row-txt small { display: block; color: var(--hint); font-size: 12px; }
.row-arrow { color: var(--hint); display: grid; place-items: center; opacity: .65; }
.row { animation: item-in 320ms var(--ease-out) both; animation-delay: var(--d, 0ms); }

.pattern {
  background: var(--bg2); border-radius: var(--radius);
  padding: 14px; margin-bottom: 10px;
}
.pattern {
  border-inline-start: 3px solid var(--h, var(--link));
}
.pattern-head { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.pattern-en { font-size: 12px; color: var(--hint); font-weight: 400; }
.pattern p { margin: 8px 0 0; font-size: 14px; }
.pattern .ex { color: var(--hint); font-style: italic; }
.pattern .q { color: var(--link); }

/* ---------- دکمه‌ها و شیت ---------- */

.btn {
  border: none; border-radius: 14px; padding: 12px 18px;
  cursor: pointer; font-weight: 700; min-height: var(--tap);
  transition: transform 130ms var(--ease-out);
}
.btn:active { transform: scale(0.97); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.primary {
  background: var(--btn); color: var(--btn-fg);
  box-shadow: 0 4px 16px -8px var(--btn);
}
.btn-spin {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--btn-fg) 35%, transparent);
  border-top-color: var(--btn-fg);
  animation: spin .7s linear infinite; flex: 0 0 auto;
}
.btn.ghost   { background: var(--bg2); color: var(--fg); }
.btn.block   { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }

.sheet { position: fixed; inset: 0; z-index: 40; }
.sheet-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.45);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  opacity: 1; transition: opacity 220ms var(--ease-out);
}
/* شیت لایه‌ی دومِ شیشه است — پس خودش جامد می‌ماند تا شیشه‌روی‌شیشه نشود */
.sheet-body {
  position: absolute; inset-inline: 0; bottom: 0;
  background: var(--bg);
  border-top: 1px solid var(--glass-edge);
  border-radius: 22px 22px 0 0;
  padding: 6px 16px calc(20px + var(--safe-b));
  max-height: 88vh; overflow-y: auto;
  box-shadow: 0 -12px 40px -12px var(--glass-shade);
  will-change: transform;
  touch-action: pan-y;
}
/* ورود: مصالح باید «شکل بگیرند»، نه فقط محو شوند */
.sheet-body.entering {
  animation: sheet-in 340ms var(--ease) both;
}
@keyframes sheet-in {
  from { transform: translateY(100%) scale(0.97); }
  to   { transform: translateY(0)    scale(1); }
}
.sheet-handle {
  width: 38px; height: 5px; border-radius: 3px;
  background: color-mix(in srgb, var(--hint) 45%, transparent);
  margin: 6px auto 14px;
  cursor: grab;
}
.sheet-grab { touch-action: none; }
.sheet h3 { margin: 0 0 12px; }
.sheet textarea {
  width: 100%; min-height: 120px; resize: vertical;
  background: var(--bg2); border: none; border-radius: 12px;
  padding: 12px 14px; outline: none; line-height: 1.7;
}

.hours { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.hour {
  background: var(--bg2); border: none; border-radius: 12px;
  padding: 12px 4px; cursor: pointer; min-height: var(--tap);
}
.hour.on { background: var(--btn); color: var(--btn-fg); }

.toast {
  position: fixed; inset-inline: 0; bottom: calc(84px + var(--safe-b));
  margin: 0 auto; width: max-content; max-width: 84%; z-index: 50;
  background: var(--bg2); border-radius: 999px;
  padding: 10px 20px; font-size: 14px;
  box-shadow: 0 6px 24px rgba(0,0,0,.35);
  animation: rise .2s ease-out;
}

/* --- دسترس‌پذیری ---
   سه سیگنال مستقل. «حرکت کمتر» یعنی بازخورد ملایم‌تر، نه حذف بازخورد. */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .sheet-body.entering { animation: none; }
}

/* شفافیت کمتر: شیشه مات‌تر می‌شود و تاری برداشته می‌شود */
@media (prefers-reduced-transparency: reduce) {
  .glass {
    background: var(--bg);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .ambient { display: none; }
  .sheet-backdrop {
    -webkit-backdrop-filter: none; backdrop-filter: none;
    background: rgba(0,0,0,.62);
  }
}

/* کنتراست بیشتر: سطوح تقریباً جامد با لبه‌ی مشخص */
@media (prefers-contrast: more) {
  :root { --glass-edge: var(--fg); --sep: var(--fg); }
  .glass { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .ambient { display: none; }
  .dist, .item, .row, .panel { border: 1px solid var(--fg); }
}

/* ---------- پنل ادمین ---------- */

#view-admin { overflow-y: auto; -webkit-overflow-scrolling: touch; }
#adminBody { padding: 14px 14px calc(20px + var(--safe-b)); }

.admin-tabs { margin-bottom: 12px; }
.admin-count { font-size: 12.5px; color: var(--hint); margin: 0 2px 10px; }
.admin-loading { text-align: center; color: var(--hint); padding: 40px 0; }
.muted { color: var(--hint); }

.ev {
  background: var(--bg2); border-radius: 14px;
  border-inline-start: 3px solid var(--h, var(--link));
  padding: 11px 13px; margin-bottom: 9px;
}
.ev-top {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; margin-bottom: 7px;
}
.ev-meta { color: var(--hint); font-size: 11.5px; }
.ev-time { margin-inline-start: auto; color: var(--hint); font-size: 11.5px; }
.ev-user {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  background: none; border: none; padding: 0 0 7px; cursor: pointer;
  color: var(--link); font-size: 12.5px; text-align: start; width: 100%;
}
.ev-text {
  font-size: 14px; line-height: 1.65;
  background: var(--bg); border-radius: 10px; padding: 8px 11px;
  white-space: pre-wrap; word-break: break-word;
}
.ev-text.muted { font-style: italic; font-size: 13px; }
.ev-line { padding: 7px 0; border-bottom: 1px solid var(--sep); font-size: 13.5px; }
.ev-line:last-child { border-bottom: none; }
.ev-line .ev-text { margin-top: 6px; }

.urow {
  display: block; width: 100%; text-align: start; cursor: pointer;
  background: var(--bg2); border: none; border-radius: 14px;
  padding: 11px 13px; margin-bottom: 8px;
  transition: transform 130ms var(--ease-out);
}
.urow:active { transform: scale(0.982); }
.urow-main { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.urow-at { color: var(--hint); font-size: 12.5px; }
.urow-sub {
  display: flex; gap: 12px; flex-wrap: wrap;
  color: var(--hint); font-size: 12px; margin-top: 5px;
}
.badge {
  font-size: 11px; background: color-mix(in srgb, var(--link) 18%, transparent);
  color: var(--link); border-radius: 7px; padding: 2px 7px;
}
.badge.danger {
  background: color-mix(in srgb, #E8556A 20%, transparent); color: #E8556A;
}

.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 10px 0; }
.kv > div {
  background: var(--bg2); border-radius: 11px; padding: 9px 11px;
}
.kv span { display: block; font-size: 11.5px; color: var(--hint); }
.kv b { font-size: 14px; }

.asec {
  margin: 20px 0 10px; font-size: 13px; color: var(--hint); font-weight: 400;
  border-top: 1px solid var(--sep); padding-top: 14px;
}

.atht {
  background: var(--bg2); border-radius: 13px;
  padding: 11px 13px; margin-bottom: 9px;
}
.atht-top {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 11.5px; color: var(--hint); margin-bottom: 7px;
}
.atht-text { font-size: 14px; line-height: 1.7; margin-bottom: 8px; }
.atht-re {
  font-size: 13px; color: var(--hint); margin-top: 8px;
  background: var(--bg); border-radius: 10px; padding: 8px 11px;
}
