﻿/* ==========================================================================
   SunTeam Design System v2 — "Sunlit"
   Shared by the public site and the user panel.
   ========================================================================== */

/* ---------- Fonts (local, no CDN) ---------- */
@font-face { font-family: "Vazir"; src: url("../fonts/Vazir-Light-FD.woff2") format("woff2"); font-weight: 300; font-display: swap; }
@font-face { font-family: "Vazir"; src: url("../fonts/Vazir-FD.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Vazir"; src: url("../fonts/Vazir-Medium-FD.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Vazir"; src: url("../fonts/Vazir-Bold-FD.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Vazir"; src: url("../fonts/Vazir-Black-FD.woff2") format("woff2"); font-weight: 900; font-display: swap; }

/* ---------- Tokens ---------- */
:root {
  /* brand */
  --sun-50: #FFFCEB;
  --sun-100: #FFF6C7;
  --sun-200: #FFEC8A;
  --sun-300: #FFE14D;
  --sun-400: #FFD400;   /* brand yellow */
  --sun-500: #F2C200;
  --sun-600: #D4A300;
  --sun-700: #9E7700;

  --ink-950: #0A0B0E;
  --ink-900: #111318;
  --ink-800: #1B1E25;
  --ink-700: #2A2E37;
  --ink-600: #474D58;
  --ink-500: #6B717C;
  --ink-400: #9A9FA8;
  --ink-300: #C8CBD1;
  --ink-200: #E4E5E8;
  --ink-100: #EFEFEC;
  --ink-50:  #F7F6F2;

  --mint: #12B76A;   --mint-soft: #E7F8EF;
  --sky: #2E90FA;    --sky-soft: #E8F2FF;
  --rose: #F04438;   --rose-soft: #FEECEB;
  --violet: #7A5AF8; --violet-soft: #F0ECFF;
  --amber-soft: #FFF6D6;

  /* semantic (light) */
  --bg: #F6F5F1;
  --bg-elev: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #F9F8F5;
  --surface-sunk: #F1F0EB;
  --line: rgba(17, 19, 24, .08);
  --line-strong: rgba(17, 19, 24, .14);
  --text: #111318;
  --text-2: #474D58;
  --text-3: #8A8F98;
  --on-sun: #111318;
  --accent: var(--sun-400);
  --accent-ink: var(--sun-700);
  --glass: rgba(255, 255, 255, .72);
  --glass-line: rgba(255, 255, 255, .6);

  /* shape & depth */
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 30px;
  --r-pill: 999px;
  --sh-1: 0 1px 2px rgba(17,19,24,.04), 0 1px 1px rgba(17,19,24,.03);
  --sh-2: 0 6px 20px -8px rgba(17,19,24,.12), 0 2px 6px -2px rgba(17,19,24,.05);
  --sh-3: 0 24px 60px -24px rgba(17,19,24,.25), 0 8px 20px -10px rgba(17,19,24,.10);
  --sh-sun: 0 12px 32px -10px rgba(242,194,0,.55);

  /* type */
  --font: "Vazir", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --fs-xs: .75rem;
  --fs-sm: .8125rem;
  --fs-md: .9375rem;
  --fs-lg: 1.0625rem;
  --fs-xl: 1.25rem;
  --fs-2xl: clamp(1.15rem, 1rem + .5vw, 1.35rem);
  --fs-3xl: clamp(1.25rem, 1rem + .9vw, 1.6rem);
  --fs-display: clamp(1.45rem, 1.05rem + 1.5vw, 2.25rem);

  --ease: cubic-bezier(.2, .8, .2, 1);
  --container: 1240px;
  --gutter: clamp(16px, 3vw, 32px);
}

[data-theme="dark"] {
  --bg: #0B0C0F;
  --bg-elev: #14161B;
  --surface: #14161B;
  --surface-2: #191C22;
  --surface-sunk: #0F1115;
  --line: rgba(255,255,255,.07);
  --line-strong: rgba(255,255,255,.13);
  --text: #F2F2EF;
  --text-2: #B9BCC3;
  --text-3: #80858F;
  --accent-ink: var(--sun-300);
  --glass: rgba(20,22,27,.72);
  --glass-line: rgba(255,255,255,.06);
  --mint-soft: rgba(18,183,106,.14);
  --sky-soft: rgba(46,144,250,.14);
  --rose-soft: rgba(240,68,56,.14);
  --violet-soft: rgba(122,90,248,.16);
  --amber-soft: rgba(255,212,0,.12);
  --sh-1: 0 1px 2px rgba(0,0,0,.4);
  --sh-2: 0 8px 24px -10px rgba(0,0,0,.6);
  --sh-3: 0 30px 60px -20px rgba(0,0,0,.7);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  direction: rtl;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  transition: background .3s var(--ease), color .3s var(--ease);
}
img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
a:hover { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4, h5 { margin: 0; line-height: 1.35; font-weight: 800; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
::selection { background: var(--sun-300); color: var(--ink-900); }
:focus-visible { outline: 2.5px solid var(--sun-500); outline-offset: 2px; border-radius: 6px; }

.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ic-sm { width: 16px; height: 16px; }
.ic-lg { width: 24px; height: 24px; }
.ic-xl { width: 28px; height: 28px; }
.flip { transform: scaleX(-1); }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-feature-settings: "tnum"; }
.muted { color: var(--text-3); }
.text-2 { color: var(--text-2); }
.hrow { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: flex; flex-direction: column; }
.grow { flex: 1; min-width: 0; }
.hide-sm { }
@media (max-width: 760px) { .hide-sm { display: none !important; } }
@media (min-width: 761px) { .show-sm { display: none !important; } }
@media (min-width: 1081px) { .show-md { display: none !important; } }

/* ---------- Typography helpers ---------- */
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; width: fit-content; max-width: 100%;
  font-size: var(--fs-sm); font-weight: 700; color: var(--accent-ink);
  background: var(--amber-soft); padding: 6px 14px; border-radius: var(--r-pill);
}
.eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--sun-500); box-shadow: 0 0 0 4px rgba(255,212,0,.25); }
.h-display { font-size: var(--fs-display); font-weight: 900; line-height: 1.4; }
.h-1 { font-size: var(--fs-3xl); font-weight: 900; }
.h-2 { font-size: var(--fs-2xl); font-weight: 800; }
.h-3 { font-size: var(--fs-xl); font-weight: 800; }
.lead { font-size: var(--fs-lg); color: var(--text-2); line-height: 2; }
.hl { position: relative; white-space: nowrap; z-index: 0; }
.hl::after {
  content: ""; position: absolute; inset-inline: -.08em; bottom: .08em; height: .38em;
  background: var(--sun-400); border-radius: .2em; z-index: -1; transform: skewX(-8deg);
}

/* ---------- Buttons ---------- */
.btn {
  --h: 46px;
  border: 0; line-height: 1.2; padding-block: 0; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--h); padding-inline: 20px; border-radius: var(--r-pill);
  font-weight: 700; font-size: var(--fs-md); white-space: nowrap;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease), color .2s;
}
.btn:active { transform: scale(.97); }
.btn-sm { --h: 38px; padding-inline: 14px; font-size: var(--fs-sm); }
.btn-lg { --h: 56px; padding-inline: 28px; font-size: var(--fs-lg); }
.btn-sun { background: var(--sun-400); color: var(--on-sun); box-shadow: var(--sh-sun); }
.btn-sun:hover { background: var(--sun-300); transform: translateY(-1px); }
.btn-ink { background: var(--ink-900); color: #fff; }
.btn-ink:hover { background: var(--ink-700); transform: translateY(-1px); }
[data-theme="dark"] .btn-ink { background: #fff; color: var(--ink-900); }
.btn-ghost { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }
.btn-ghost:hover { box-shadow: inset 0 0 0 1px var(--text-3); }
.btn-soft { background: var(--surface-sunk); color: var(--text); }
.btn-soft:hover { background: var(--ink-200); }
[data-theme="dark"] .btn-soft:hover { background: var(--ink-700); }
.btn-glass { background: rgba(255,255,255,.12); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.22); backdrop-filter: blur(10px); }
.btn-glass:hover { background: rgba(255,255,255,.2); }
.btn-icon { --h: 44px; width: var(--h); padding: 0; }
.btn-icon.btn-sm { width: 38px; }
.btn .arrow { transition: transform .25s var(--ease); }
.btn:hover .arrow { transform: translateX(-4px); }

.icon-btn {
  position: relative; display: grid; place-items: center;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--line);
  transition: background .2s, transform .2s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); transform: translateY(-1px); }
.icon-btn .badge-dot {
  position: absolute; top: 9px; inset-inline-end: 10px; width: 9px; height: 9px;
  background: var(--rose); border-radius: 50%; box-shadow: 0 0 0 2.5px var(--surface);
}
.icon-btn .count {
  position: absolute; top: -3px; inset-inline-end: -3px; min-width: 20px; height: 20px; padding: 0 5px;
  display: grid; place-items: center; border-radius: var(--r-pill);
  background: var(--sun-400); color: var(--ink-900); font-size: 11px; font-weight: 800;
  box-shadow: 0 0 0 2.5px var(--surface);
}

/* ---------- Segmented control / kbd ---------- */
.seg { display: inline-flex; padding: 4px; border-radius: var(--r-pill); background: var(--surface-sunk); gap: 2px; }
.seg button { height: 38px; padding-inline: 16px; border-radius: var(--r-pill); font-weight: 700; font-size: var(--fs-sm); color: var(--text-3); transition: all .2s; }
.seg button.is-active { background: var(--surface); color: var(--text); box-shadow: var(--sh-1); }
.seg-sm button { height: 32px; padding-inline: 12px; }
.kbd { margin-inline-start: auto; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 8px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--text-3); direction: ltr; }

/* ---------- Chips / badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding-inline: 14px;
  border-radius: var(--r-pill); font-size: var(--fs-sm); font-weight: 600;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); color: var(--text-2);
  transition: all .2s var(--ease); white-space: nowrap;
}
.chip:hover { color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }
.chip.is-active { background: var(--ink-900); color: #fff; box-shadow: none; }
[data-theme="dark"] .chip.is-active { background: #fff; color: var(--ink-900); }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 700; }
.tag-sun { background: var(--sun-400); color: var(--ink-900); }
.tag-mint { background: var(--mint-soft); color: var(--mint); }
.tag-rose { background: var(--rose-soft); color: var(--rose); }
.tag-sky { background: var(--sky-soft); color: var(--sky); }
.tag-violet { background: var(--violet-soft); color: var(--violet); }
.tag-ink { background: var(--ink-900); color: #fff; }
.tag-soft { background: var(--surface-sunk); color: var(--text-2); }

/* ---------- Cards ---------- */
.card {
  border: 0; background: var(--surface); border-radius: var(--r-lg);
  box-shadow: var(--sh-1), inset 0 0 0 1px var(--line);
  padding: 22px;
}
.card-hover { transition: transform .3s var(--ease), box-shadow .3s var(--ease); }
.card-hover:hover { transform: translateY(-3px); box-shadow: var(--sh-3), inset 0 0 0 1px var(--line); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.card-title { font-size: var(--fs-lg); font-weight: 800; display: flex; align-items: center; gap: 10px; }
.card-link { font-size: var(--fs-sm); font-weight: 700; color: var(--text-3); display: inline-flex; align-items: center; gap: 4px; }
.card-link:hover { color: var(--text); }

.glass {
  background: var(--glass);
  backdrop-filter: saturate(1.6) blur(18px);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
  box-shadow: inset 0 0 0 1px var(--glass-line), var(--sh-2);
}

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: var(--fs-sm); font-weight: 700; color: var(--text-2); }
.input {
  height: 50px; width: 100%; padding-inline: 16px; border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--line-strong); outline: none;
  transition: border .2s, box-shadow .2s, background .2s;
}
.input:focus { border-color: var(--sun-500); box-shadow: 0 0 0 4px rgba(255,212,0,.25); background: var(--surface); }
.input-group { position: relative; }
.input-group .ic { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.input-group .input { padding-inline-start: 44px; }

/* ---------- Avatars ---------- */
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--sun-100); flex: none; display: grid; place-items: center; font-weight: 800; color: var(--accent-ink); font-size: var(--fs-sm); }
.avatar-lg { width: 56px; height: 56px; }
.avatar-stack { display: flex; }
.avatar-stack > * { margin-inline-start: -10px; box-shadow: 0 0 0 3px var(--surface); }
.avatar-stack > *:first-child { margin-inline-start: 0; }

/* ---------- Progress ---------- */
.progress { height: 8px; border-radius: var(--r-pill); background: var(--surface-sunk); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--sun-300), var(--sun-500)); }
.ring {
  --p: 60; --size: 132px; --w: 12px;
  width: var(--size); height: var(--size); border-radius: 50%;
  background: conic-gradient(var(--sun-400) calc(var(--p) * 1%), var(--surface-sunk) 0);
  display: grid; place-items: center; position: relative;
}
.ring::before { content: ""; position: absolute; inset: var(--w); border-radius: 50%; background: var(--surface); }
.ring > * { position: relative; }

/* ---------- Tables ---------- */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-sm); }
.tbl th { text-align: start; font-weight: 700; color: var(--text-3); padding: 10px 14px; background: var(--surface-2); white-space: nowrap; }
.tbl th:first-child { border-start-start-radius: var(--r-sm); border-end-start-radius: var(--r-sm); }
.tbl th:last-child { border-start-end-radius: var(--r-sm); border-end-end-radius: var(--r-sm); }
.tbl td { padding: 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .15s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl-wrap { overflow-x: auto; margin-inline: -6px; padding-inline: 6px; }

/* ---------- Status dots ---------- */
.status { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: var(--fs-xs); }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-ok { color: var(--mint); }
.status-wait { color: var(--sun-600); }
.status-bad { color: var(--rose); }
.status-info { color: var(--sky); }

/* ---------- Product card ---------- */
.p-card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-lg);
  box-shadow: inset 0 0 0 1px var(--line); overflow: hidden;
  transition: transform .35s var(--ease), box-shadow .35s var(--ease);
}
.p-card:hover { transform: translateY(-4px); box-shadow: var(--sh-3), inset 0 0 0 1px var(--line); }
.p-media { position: relative; aspect-ratio: 1 / 1; background: #fff; display: grid; place-items: center; overflow: hidden; }
.p-media img { width: 88%; height: 88%; object-fit: contain; transition: transform .6s var(--ease); }
.p-card:hover .p-media img { transform: scale(1.06); }
.p-badges { position: absolute; top: 12px; inset-inline-start: 12px; display: flex; flex-direction: column; gap: 6px; z-index: 1; }
.p-fav { position: absolute; top: 10px; inset-inline-end: 10px; z-index: 1; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.85); backdrop-filter: blur(8px); color: var(--ink-600); opacity: 0; transform: translateY(-4px); transition: all .25s var(--ease); }
.p-card:hover .p-fav { opacity: 1; transform: none; }
.p-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.p-cat { font-size: var(--fs-xs); color: var(--text-3); font-weight: 600; }
.p-title { font-size: var(--fs-md); font-weight: 700; line-height: 1.7; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 3.4em; }
.p-foot { margin-top: auto; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.price { display: flex; flex-direction: column; line-height: 1.4; }
.price del { font-size: var(--fs-xs); color: var(--text-3); }
.price strong { font-size: var(--fs-lg); font-weight: 900; }
.price small { font-size: var(--fs-xs); font-weight: 500; color: var(--text-3); margin-inline-start: 2px; }
.add-btn {
  width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; flex: none;
  background: var(--ink-900); color: #fff; transition: all .25s var(--ease);
}
.add-btn:hover { background: var(--sun-400); color: var(--ink-900); transform: rotate(-90deg); }
[data-theme="dark"] .add-btn { background: #fff; color: var(--ink-900); }
.pv { display: inline-flex; gap: 6px; font-size: var(--fs-xs); color: var(--text-3); }
.pv b { color: var(--text-2); font-weight: 700; }

/* ---------- Grids ---------- */
.grid { display: grid; gap: 20px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 860px)  { .grid-4, .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid { gap: 14px; } }
@media (max-width: 560px)  { .grid-2, .grid-3.stack-sm { grid-template-columns: 1fr; } }

/* ---------- Horizontal scroller ---------- */
.rail { display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding-bottom: 4px; }
.rail::-webkit-scrollbar { display: none; }
.rail > * { scroll-snap-align: start; flex: none; }

/* ---------- Marquee ---------- */
.marquee { overflow: hidden; mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.marquee-track { display: flex; gap: 48px; width: max-content; animation: marquee 40s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(50%); } }

/* ---------- Motion ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes spin-slow { to { transform: rotate(360deg); } }
@keyframes pulse-ring { 0% { box-shadow: 0 0 0 0 rgba(255,212,0,.6); } 100% { box-shadow: 0 0 0 14px rgba(255,212,0,0); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- Toast ---------- */
.sun-toast {
  position: fixed; inset-inline: 0; bottom: 96px; margin-inline: auto; width: max-content; max-width: calc(100% - 32px);
  display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: var(--r-pill);
  background: var(--ink-900); color: #fff; font-weight: 600; box-shadow: var(--sh-3); z-index: 100;
  transform: translateY(20px); opacity: 0; pointer-events: none; transition: all .35s var(--ease);
}
.sun-toast.show { transform: none; opacity: 1; }
.sun-toast .ic { color: var(--sun-400); }

/* ---------- Mobile tab bar ---------- */
.tabbar {
  position: fixed; inset-inline: 12px; bottom: 12px; z-index: 60;
  display: none; justify-content: space-around; align-items: center;
  height: 68px; border-radius: 24px; padding-inline: 6px;
}
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 700; color: var(--text-3); padding: 6px 10px; border-radius: 16px; position: relative; }
.tabbar a.is-active { color: var(--text); }
.tabbar a.is-active::before { content: ""; position: absolute; top: -6px; width: 22px; height: 4px; border-radius: 4px; background: var(--sun-400); }
.tabbar .tab-cta { width: 54px; height: 54px; margin-top: -26px; border-radius: 20px; background: var(--sun-400); color: var(--ink-900); display: grid; place-items: center; box-shadow: var(--sh-sun); padding: 0; }
@media (max-width: 860px) { .tabbar { display: flex; } body { padding-bottom: 92px; } }

/* ===== branded dialog (sunDialog / sunConfirm / data-confirm / alert) ===== */
.sun-dlg { width: min(400px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 28px; background: var(--surface); color: var(--text); box-shadow: 0 40px 100px -30px rgba(0,0,0,.55); overflow: visible; }
.sun-dlg[open] { animation: sd-in .28s var(--ease); }
.sun-dlg.closing { animation: sd-out .16s ease-in forwards; }
.sun-dlg::backdrop { background: rgba(10,11,14,.55); backdrop-filter: blur(5px); animation: sd-fade .25s ease; }
.sd-box { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 30px 24px 22px; }
.sd-ico { width: 64px; height: 64px; margin-top: -62px; margin-bottom: 4px; border-radius: 22px; display: grid; place-items: center; background: #111318; color: var(--sun-400); box-shadow: 0 0 0 6px var(--surface), 0 16px 30px -12px rgba(17,19,24,.5); }
.sd-ico .ic { width: 30px; height: 30px; }
.sun-dlg.tone-warn .sd-ico { background: var(--sun-400); color: #111318; }
.sun-dlg.tone-danger .sd-ico { background: #F04438; color: #fff; }
.sun-dlg.tone-ok .sd-ico { background: #12B76A; color: #fff; }
.sun-dlg.tone-heart .sd-ico { background: #E5486F; color: #fff; }
.sd-title { font-size: var(--fs-lg); font-weight: 900; }
.sd-msg { margin: 0; color: var(--text-2); line-height: 2; font-size: var(--fs-sm); white-space: pre-line; }
.sd-actions { display: flex; gap: 10px; width: 100%; margin-top: 12px; }
.sd-actions .btn { flex: 1; justify-content: center; }
.sd-actions .sd-cancel[hidden] { display: none; }
.btn-danger { background: #F04438; color: #fff; }
.btn-danger:hover { background: #D92D20; }
@keyframes sd-in { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes sd-out { to { opacity: 0; transform: translateY(8px) scale(.97); } }
@keyframes sd-fade { from { opacity: 0; } }

/* ---- graphical file input (built by sun.js) ---- */
.sun-drop { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.sun-drop .fz-input { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0 !important; pointer-events: none; }
.fz-zone { position: relative; display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 20px; cursor: pointer; background: linear-gradient(135deg, var(--surface), var(--surface-2, #FAF9F5)); border: 2px dashed var(--line-strong); transition: border-color .2s, background .2s, transform .2s; outline: none; }
.fz-zone:hover, .fz-zone:focus-visible { border-color: var(--sun-500, #F2C200); background: color-mix(in srgb, #FFD400 8%, var(--surface)); }
.sun-drop.is-over .fz-zone { border-color: var(--sun-500, #F2C200); background: color-mix(in srgb, #FFD400 16%, var(--surface)); transform: scale(1.01); }
.fz-art { flex: none; width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: #111318; }
.fz-art svg { width: 40px; height: 40px; }
.fz-art .p1 { fill: #474D58; }
.fz-art .p2 { fill: #FFD400; transition: transform .3s; }
.fz-art .ar { fill: none; stroke: #111318; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.fz-zone:hover .p2, .sun-drop.is-over .p2 { transform: translateY(-3px); }
.fz-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.fz-txt b { font-size: var(--fs-sm); font-weight: 800; }
.fz-txt u { text-decoration: none; color: var(--accent-ink, #8A6A00); border-bottom: 2px solid var(--sun-400, #FFD400); }
.fz-txt small { font-size: var(--fs-xs); color: var(--text-3); }
.fz-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.fz-list:empty { display: none; }
.fz-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 14px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); animation: sd-in .3s var(--ease, ease) both; }
@keyframes sd-in { from { opacity: 0; transform: translateY(-4px); } }
.fz-thumb { position: relative; flex: none; width: 42px; height: 42px; border-radius: 10px; overflow: hidden; display: grid; place-items: center; background: var(--amber-soft, #FFF6D6); color: var(--accent-ink, #8A6A00); }
.fz-thumb i { font-style: normal; font-size: 10px; font-weight: 900; letter-spacing: .5px; }
.fz-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.fz-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fz-meta b { font-size: var(--fs-sm); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: ltr; text-align: right; }
.fz-meta small { font-size: var(--fs-xs); color: var(--text-3); direction: ltr; text-align: right; }
.fz-rm { flex: none; width: 32px; height: 32px; border: 0; border-radius: 10px; background: var(--rose-soft, #FDE7E4); color: var(--rose, #C4320A); font-size: 20px; line-height: 1; cursor: pointer; }
.sun-drop.has-file .fz-zone { padding-block: 10px; }
.sun-drop.has-file .fz-art { width: 40px; height: 40px; border-radius: 12px; }
.sun-drop.has-file .fz-art svg { width: 28px; height: 28px; }

/* ---- Jalali date picker (built by sun.js) ---- */
.jdp-wrap { position: relative; display: block; width: 100%; }
.jdp-view { width: 100%; cursor: pointer; padding-inline-start: 42px !important; direction: rtl; text-align: right; }
.jdp-ic { position: absolute; top: 50%; inset-inline-start: 14px; width: 18px; height: 18px; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.jdp-pop { position: absolute; z-index: 1200; width: 290px; padding: 12px; border-radius: 20px; background: var(--surface); box-shadow: 0 24px 60px -18px rgba(17,19,24,.45), inset 0 0 0 1px var(--line); direction: rtl; font-size: var(--fs-sm); animation: jdp-in .18s ease both; }
@keyframes jdp-in { from { opacity: 0; transform: translateY(-4px); } }
.jdp-pop.is-sheet { position: fixed; inset: auto 0 0 0; width: auto; border-radius: 24px 24px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); animation: jdp-up .25s ease both; }
@keyframes jdp-up { from { transform: translateY(100%); } }
.jdp-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 8px; }
.jdp-head > button { width: 34px; height: 34px; border: 0; border-radius: 10px; background: var(--surface-sunk); font-size: 1.3rem; line-height: 1; cursor: pointer; color: var(--text); }
.jdp-title { display: flex; gap: 6px; }
.jdp-title select { height: 34px; padding: 0 8px; border: 0; border-radius: 10px; background: var(--surface-sunk); font: inherit; font-weight: 800; color: var(--text); cursor: pointer; }
.jdp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.jdp-grid .jdp-w { display: grid; place-items: center; height: 28px; font-size: 11px; font-weight: 800; color: var(--text-3); }
.jdp-grid button { aspect-ratio: 1; border: 0; border-radius: 10px; background: none; font: inherit; font-variant-numeric: tabular-nums; cursor: pointer; color: var(--text); }
.jdp-grid button:hover { background: var(--surface-sunk); }
.jdp-grid button.is-today { box-shadow: inset 0 0 0 1.5px var(--sun-400); font-weight: 900; }
.jdp-grid button.is-sel { background: #111318; color: var(--sun-400); font-weight: 900; }
.jdp-time { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 10px; padding: 8px; border-radius: 12px; background: var(--surface-sunk); }
.jdp-time span { font-size: var(--fs-xs); font-weight: 700; color: var(--text-3); margin-inline-end: 6px; }
.jdp-time input { width: 56px; height: 34px; border: 0; border-radius: 10px; background: var(--surface); text-align: center; font: inherit; font-weight: 800; direction: ltr; }
.jdp-foot { display: flex; gap: 6px; margin-top: 10px; }
.jdp-foot button { flex: 1; height: 36px; border: 0; border-radius: 12px; background: var(--surface-sunk); font: inherit; font-size: var(--fs-xs); font-weight: 800; cursor: pointer; color: var(--text); }
.jdp-foot button.ok { background: #111318; color: var(--sun-400); }

/* ---- theme switch (whole site) ---- */
.theme-label-light, .theme-ic-light { display: none !important; }
[data-theme="dark"] .theme-label-light { display: inline !important; }
[data-theme="dark"] .theme-ic-light { display: inline-block !important; }
[data-theme="dark"] .theme-label-dark, [data-theme="dark"] .theme-ic-dark { display: none !important; }
.theme-btn .theme-ic-dark, .theme-btn .theme-ic-light { transition: transform .4s var(--ease); }
.theme-btn:hover .ic { transform: rotate(-20deg); }
html.theme-anim, html.theme-anim *, html.theme-anim *::before, html.theme-anim *::after { transition: background-color .35s var(--ease), color .35s var(--ease), border-color .35s var(--ease), box-shadow .35s var(--ease), fill .35s var(--ease) !important; }

/* button text colour must survive the global `a:hover { color: inherit }` (link buttons) */
a.btn-ink:hover, a.btn-ink:focus-visible { color: #fff; }
a.btn-sun:hover, a.btn-sun:focus-visible { color: var(--on-sun); }
a.btn-ghost:hover, a.btn-soft:hover { color: var(--text); }
[data-theme="dark"] a.btn-ink:hover, [data-theme="dark"] .btn-ink:hover { background: #E8E8E3; color: var(--ink-900); }
.btn-ink:hover .ic, .btn-sun:hover .ic { color: inherit; }
a.btn-glass:hover, a.btn-danger:hover { color: #fff; }
[data-theme="dark"] a.btn-ink:focus-visible { color: var(--ink-900); }

/* ===================== dark mode: component fixes ===================== */
/* logo: dark wordmark → light, sun mark stays yellow */
[data-theme="dark"] .brand img, [data-theme="dark"] .auth-logo img, [data-theme="dark"] .side-brand img, [data-theme="dark"] .ptop-brand img { filter: invert(1) hue-rotate(180deg) saturate(1.3); opacity: 1; }
/* auth pages */
[data-theme="dark"] .auth-bg { background: radial-gradient(rgba(255,255,255,.05) 1px, transparent 1px) 0 0 / 24px 24px, #0B0C0F; }
[data-theme="dark"] .auth-bg::after { background: linear-gradient(180deg, transparent 60%, #0B0C0F); }
[data-theme="dark"] .orb { opacity: .16; }
[data-theme="dark"] .auth-card { background: rgba(20,22,27,.82); box-shadow: 0 40px 80px -40px rgba(0,0,0,.8), inset 0 0 0 1px rgba(255,255,255,.07); }
[data-theme="dark"] .auth-switch a.is-active { background: var(--surface-2); color: var(--text); }
[data-theme="dark"] .auth-form .input, [data-theme="dark"] .input { background: var(--surface-sunk); color: var(--text); border-color: var(--line-strong); }
[data-theme="dark"] .input::placeholder { color: var(--text-3); }
/* site search / inquiry pills */
[data-theme="dark"] .inquiry, [data-theme="dark"] .sl-search { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-strong), 0 20px 50px -20px rgba(0,0,0,.8); }
[data-theme="dark"] .inquiry input, [data-theme="dark"] .sl-search input { color: var(--text); background: transparent; }
/* icon tiles that used a plain white chip */
[data-theme="dark"] .sc-ico { background: var(--surface-2); }
[data-theme="dark"] .f-badges a { background: #fff; }   /* trust badges keep white for the seal images */
/* generic: white form controls and selects */
[data-theme="dark"] select, [data-theme="dark"] textarea { color: var(--text); }
[data-theme="dark"] .sb-rank { -webkit-text-stroke-color: rgba(255,255,255,.55); }
[data-theme="dark"] .sl-best li:nth-child(-n+3) .sb-rank { -webkit-text-stroke-color: #111318; }
[data-theme="dark"] .lt-cell { text-shadow: 0 1px 0 rgba(255,255,255,.35); }
/* panel components */
[data-theme="dark"] .me-rk-t > b { color: color-mix(in srgb, var(--rk1) 70%, #fff); }
[data-theme="dark"] .rp-path.must { background: rgba(14,165,233,.12); }
[data-theme="dark"] .legs-alert { background: rgba(240,68,56,.12); color: var(--text); }
[data-theme="dark"] .an-al.rose { background: rgba(240,68,56,.14); color: #FDA29B; }
[data-theme="dark"] .an-al.amber { background: rgba(255,212,0,.12); color: #FDE68A; }
[data-theme="dark"] .an-al.mint { background: rgba(18,183,106,.14); color: #6EE7B7; }
[data-theme="dark"] .od-st, [data-theme="dark"] .tk-st { background: color-mix(in srgb, var(--c) 22%, var(--surface)); color: color-mix(in srgb, var(--c) 40%, #fff); }
[data-theme="dark"] .tr-kicker { color: var(--accent-ink); }
[data-theme="dark"] .flag.stalled { background: rgba(240,68,56,.16); color: #FDA29B; }
[data-theme="dark"] .flag.new { background: rgba(14,165,233,.16); color: #7DD3FC; }
[data-theme="dark"] .comp-trip { background: linear-gradient(135deg, rgba(14,165,233,.14), var(--surface)); }
[data-theme="dark"] .mp-ago.bad, [data-theme="dark"] .dr-buy.bad, [data-theme="dark"] .dr-buy.never, [data-theme="dark"] .dr-docs .n, [data-theme="dark"] .sm-warn, [data-theme="dark"] .tr-p-chips .bad, [data-theme="dark"] .lv-chips .bad { background: rgba(240,68,56,.16); color: #FDA29B; }
[data-theme="dark"] .pr .chip3 { background: rgba(124,58,237,.2); color: #C4B5FD; }
[data-theme="dark"] .mp-rank { background: var(--surface-sunk); color: var(--text-2); }
[data-theme="dark"] .rp-ico { background: rgba(255,212,0,.14); }
[data-theme="dark"] .nc-ann details { background: linear-gradient(135deg, rgba(255,212,0,.08), var(--surface) 70%); box-shadow: inset 0 0 0 1px rgba(255,212,0,.2); }
[data-theme="dark"] .an-tr-big, [data-theme="dark"] .mp-hero, [data-theme="dark"] .sm-pkg.hot, [data-theme="dark"] .dr::before { background-image: none; }

/* ===================== PWA ===================== */
.pwa-card { position: fixed; z-index: 1100; inset-inline: 12px; bottom: calc(86px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 12px; max-width: 460px; margin-inline: auto; padding: 12px; border-radius: 22px; background: #111318; color: #fff; box-shadow: 0 24px 60px -18px rgba(0,0,0,.6), inset 0 0 0 1px rgba(255,255,255,.08); transform: translateY(140%); opacity: 0; transition: transform .45s var(--ease), opacity .3s; }
.pwa-card.show { transform: none; opacity: 1; }
.pwa-ico { flex: none; width: 48px; height: 48px; border-radius: 14px; overflow: hidden; background: #FFD400; }
.pwa-ico img { width: 100%; height: 100%; object-fit: cover; }
.pwa-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pwa-txt b { font-size: var(--fs-sm); font-weight: 900; }
.pwa-txt small { font-size: 11px; color: rgba(255,255,255,.62); line-height: 1.7; }
.pwa-acts { display: flex; align-items: center; gap: 4px; }
.pwa-x { width: 32px; height: 32px; border: 0; border-radius: 10px; background: rgba(255,255,255,.08); color: #fff; font-size: 20px; cursor: pointer; }
@media (min-width: 900px) { .pwa-card { bottom: 24px; inset-inline-start: auto; inset-inline-end: 24px; } }
.pwa-note { position: fixed; z-index: 1200; top: calc(12px + env(safe-area-inset-top)); inset-inline: 12px; max-width: 420px; margin-inline: auto; padding: 12px 16px; border-radius: 16px; background: #111318; color: #fff; font-size: var(--fs-sm); font-weight: 700; text-align: center; box-shadow: 0 18px 40px -16px rgba(0,0,0,.6); transform: translateY(-160%); transition: transform .4s var(--ease); }
.pwa-note.show { transform: none; }
.pwa-note.warn { background: #B42318; } .pwa-note.ok { background: #067647; }
/* installed app: native feel */
html.is-app { -webkit-tap-highlight-color: transparent; }
html.is-app body { overscroll-behavior-y: none; -webkit-user-select: none; user-select: none; }
html.is-app input, html.is-app textarea, html.is-app [contenteditable], html.is-app p, html.is-app .rich, html.is-app code { -webkit-user-select: text; user-select: text; }
html.is-app .topbar { display: none; }
html.is-app .site-header, html.is-app .ptop { padding-top: env(safe-area-inset-top); }
html.is-offline body::before { content: "آفلاین"; position: fixed; z-index: 1150; top: 0; inset-inline: 0; height: 3px; background: repeating-linear-gradient(90deg, #F04438 0 14px, transparent 14px 22px); font-size: 0; }
