/* ══════════════════════════════════════════════════════════
   آپلودر امن — Design System v2
   Palette: indigo → violet, airy cards, RTL-first
   ══════════════════════════════════════════════════════════ */
@font-face {
  font-family: 'Vazirmatn';
  src: local('Vazirmatn'), local('Vazir'), local('Tahoma'), local('Arial');
  font-display: swap;
}

:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --border: #e6e8f0;
  --text: #1a2033;
  --muted: #6b7390;
  --primary: #6366f1;
  --primary-2: #6c5ce7;
  --primary-soft: #eef0ff;
  --danger: #e11d48;
  --danger-soft: #fff1f3;
  --success: #059669;
  --success-soft: #ecfdf5;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --radius: 14px;
}

/* Night mode — deep navy with violet accents. */
[data-theme="dark"] {
  --bg: #0b0f19;
  --surface: #0d1117;
  --border: #1f2735;
  --text: #f3f3f5;
  --muted: #9aa3b2;
  --primary-soft: rgba(99, 102, 241, 0.16);
  --danger-soft: rgba(225, 29, 72, 0.16);
  --success-soft: rgba(5, 150, 105, 0.16);
  --warning-soft: rgba(217, 119, 6, 0.16);
  --shadow-soft: 0 10px 30px -16px rgba(0, 0, 0, 0.9);
}

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

body {
  font-family: Vazirmatn, Tahoma, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  direction: rtl;
  line-height: 1.7;
  transition: background 0.3s ease, color 0.3s ease;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ── Layout ── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.main-wrap { max-width: 1100px; margin: 0 auto; padding: 34px 20px 80px; }
.main-wrap > * + * { margin-top: 0; }

/* ── Navbar ── */
.navbar {
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--border);
}
.navbar-inner {
  max-width: 1100px; margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 800; }
.brand .logo {
  width: 36px; height: 36px; border-radius: 11px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; display: grid; place-items: center; font-size: 15px; font-weight: 900;
}
.brand .brand-text {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.nav-links { display: flex; align-items: center; gap: 18px; }
.nav-link { font-size: 14px; font-weight: 700; color: var(--muted); transition: color 0.2s; }
.nav-link:hover { color: var(--primary); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px; border-radius: 12px; border: none;
  font-size: 14px; font-weight: 800; transition: all 0.2s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; box-shadow: 0 6px 18px rgba(79, 70, 229, 0.28);
}
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 8px 24px rgba(79, 70, 229, 0.36); }
.btn-ghost {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border: 1px solid transparent; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-success { background: var(--success-soft); color: var(--success); border: 1px solid transparent; }
.btn-success:hover { background: var(--success); color: #fff; }
.btn-sm { padding: 7px 14px; font-size: 12.5px; border-radius: 10px; }
.btn-icon { padding: 9px; border-radius: 10px; width: 38px; height: 38px; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

/* ── Cards ── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.card-lg { padding: 36px; border-radius: 18px; }
.card-hover { transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease; }
.card-hover:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
  box-shadow: 0 14px 32px -12px rgba(79, 70, 229, 0.22);
}

/* ── Forms ── */
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; font-weight: 800; margin-bottom: 7px; color: var(--text); }
.input, .select, .textarea {
  width: 100%; padding: 12px 14px;
  border: 1.5px solid var(--border); border-radius: 12px;
  background: var(--bg); color: var(--text); font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
/* selects: kill browser chrome, add custom chevron on the RIGHT (semantic start edge in Persian UI) */
.select {
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%236B7390' stroke-width='2' stroke-linecap='round' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center; /* Persian convention: arrow on the right */
  background-size: 12px 8px;
  padding-inline-end: 14px;
  padding-inline-start: 14px;
  padding-right: 38px; /* reserve space for the chevron */
  padding-left: 14px;
}
/* number & tel: digits are always LTR glyphs — keep the box normalized
   but DON'T invert cursor position: digits read left-to-right inside an RTL label. */
.input[type="number"], .input[type="tel"] {
  direction: ltr;
  text-align: left; /* digits start where the user expects (left) */
}
.input[type="number"]::-webkit-outer-spin-button,
.input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 14%, transparent);
}
/* explicitly-LTR fields (phone/password/URL) start cursor at left naturally */
.input[dir="ltr"] { text-align: left; }
.textarea { min-height: 90px; resize: vertical; }
.hint { font-size: 11.5px; color: var(--muted); margin-top: 5px; }

/* OTP boxes */
.otp-row { display: flex; gap: 10px; justify-content: center; direction: ltr; }
.otp-box {
  width: 54px; height: 62px; text-align: center;
  font-size: 26px; font-weight: 900;
  border: 2px solid var(--border); border-radius: 14px;
  background: var(--surface); color: var(--text);
  transition: border-color 0.15s, transform 0.15s;
}
.otp-box:focus { outline: none; border-color: var(--primary); transform: translateY(-2px); }

/* ── Alerts / Toast ── */
.alert {
  padding: 13px 16px; border-radius: 12px; font-size: 13.5px; font-weight: 700;
  margin-bottom: 16px; border: 1px solid transparent;
}
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert-success { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.alert-info { background: var(--primary-soft); color: var(--primary); border-color: color-mix(in srgb, var(--primary) 25%, transparent); }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 25%, transparent); }

#toast-container {
  position: fixed; top: 76px; left: 50%; transform: translateX(-50%);
  z-index: 500; width: min(92vw, 420px);
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 18px; border-radius: 13px; color: #fff;
  font-size: 14px; font-weight: 800;
  box-shadow: 0 12px 30px -8px rgba(15, 23, 42, 0.35);
  animation: toastIn 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--primary); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-16px) scale(0.96); } to { opacity: 1; transform: none; } }
.toast.out { opacity: 0; transform: translateY(-10px); transition: 0.35s; }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 12px; border-radius: 999px; font-size: 11.5px; font-weight: 800;
}
.badge-green { background: var(--success-soft); color: var(--success); }
.badge-red { background: var(--danger-soft); color: var(--danger); }
.badge-purple { background: var(--primary-soft); color: var(--primary); }
.badge-amber { background: var(--warning-soft); color: var(--warning); }

/* ── Stat card ── */
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 24px; position: relative; overflow: hidden;
}
.stat-card .icon {
  width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center;
  margin-bottom: 14px; font-size: 20px;
}
.stat-card .icon.ic-blue { background: var(--primary-soft); color: var(--primary); }
.stat-card .icon.ic-green { background: var(--success-soft); color: var(--success); }
.stat-card .icon.ic-rose { background: var(--danger-soft); color: var(--danger); }
.stat-card .icon.ic-amber { background: var(--warning-soft); color: var(--warning); }
.stat-card .label { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.stat-card .value { font-size: 30px; font-weight: 900; line-height: 1.2; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl thead th {
  padding: 13px 18px; text-align: right; font-size: 12px; font-weight: 800; color: var(--muted);
  background: color-mix(in srgb, var(--bg) 60%, var(--surface));
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tbl tbody td { padding: 13px 18px; border-bottom: 1px solid var(--border); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover { background: color-mix(in srgb, var(--primary-soft) 50%, transparent); }

/* ── Hero ── */
.hero { padding: 72px 0 48px; text-align: center; position: relative; overflow: hidden; }
.hero h1 {
  font-size: clamp(34px, 6vw, 58px); font-weight: 900; line-height: 1.25;
  margin: 0 0 18px; letter-spacing: -0.5px;
}
.hero h1 .grad {
  background: linear-gradient(135deg, var(--primary), var(--primary-2), #d946ef);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero p.lead { font-size: 18px; color: var(--muted); max-width: 640px; margin: 0 auto 32px; }
.hero-blob {
  position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.5; pointer-events: none;
}
.hero-blob.b1 { width: 380px; height: 380px; background: var(--primary); opacity: 0.13; top: -120px; left: -80px; }
.hero-blob.b2 { width: 300px; height: 300px; background: var(--primary-2); opacity: 0.12; top: 60px; right: -100px; }

/* ── Grids — fluid, consistent spacing, all pages ── */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
@media (max-width: 1020px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; gap: 16px; }
  .grid-auto { grid-template-columns: 1fr; }
}

/* ── Feature card (landing) ── */
.feat-icon {
  width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center;
  font-size: 24px; margin-bottom: 16px;
}
.feat-icon.ic-blue { background: var(--primary-soft); color: var(--primary); }
.feat-icon.ic-green { background: var(--success-soft); color: var(--success); }
.feat-icon.ic-rose { background: var(--danger-soft); color: var(--danger); }
.feat-icon.ic-amber { background: var(--warning-soft); color: var(--warning); }

/* ── File card (dashboard) ── */
.file-card { display: flex; flex-direction: column; gap: 0; overflow: hidden; }
.file-media { background: #0b1020; border-radius: 12px; overflow: hidden; min-height: 180px; display: grid; place-items: center; margin-bottom: 14px; }
.file-media video, .file-media audio { width: 100%; display: block; }
.file-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.file-head .f-icon {
  width: 42px; height: 42px; border-radius: 12px; background: var(--primary-soft);
  color: var(--primary); display: grid; place-items: center; font-size: 19px; flex-shrink: 0;
}
.file-name { font-weight: 800; font-size: 14.5px; word-break: break-all; direction: ltr; text-align: right; }
.file-meta { font-size: 11.5px; color: var(--muted); }
.file-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.meta-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; background: color-mix(in srgb, var(--bg) 70%, var(--surface));
  border: 1px solid var(--border); border-radius: 10px;
  font-size: 12px; font-weight: 700; margin-bottom: 8px;
}

/* Share chips */
.share-chip {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 12px; font-weight: 700; margin-top: 8px;
}
.share-chip code { direction: ltr; font-size: 11px; color: var(--primary); word-break: break-all; }

/* ── Dropzone ── */
.dropzone {
  border: 2px dashed var(--border); border-radius: 16px;
  padding: 40px 20px; text-align: center; cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: color-mix(in srgb, var(--bg) 55%, var(--surface));
}
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: var(--primary-soft); }
.dropzone .dz-icon {
  width: 64px; height: 64px; border-radius: 50%; background: var(--primary-soft);
  color: var(--primary); display: grid; place-items: center; margin: 0 auto 14px; font-size: 28px;
}
.progress-track { height: 10px; border-radius: 999px; background: color-mix(in srgb, var(--muted) 18%, var(--bg)); overflow: hidden; }
.progress-bar { height: 100%; width: 0%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--primary-2)); transition: width 0.25s ease; }

/* ── Modal ── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 200; display: none;
  align-items: center; justify-content: center; padding: 20px;
  background: rgba(8, 12, 28, 0.55); backdrop-filter: blur(6px);
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 30px; width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 28px 70px -20px rgba(8, 12, 28, 0.5);
  animation: modalIn 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(24px) scale(0.97); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-head h3 { margin: 0; font-size: 19px; font-weight: 900; }
.modal-close { background: none; border: none; font-size: 22px; color: var(--muted); padding: 4px 8px; border-radius: 8px; }
.modal-close:hover { background: var(--bg); color: var(--text); }

/* ── Admin layout ── */
.admin-wrap { display: flex; gap: 26px; align-items: flex-start; }
.admin-side {
  width: 218px; flex-shrink: 0; display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 86px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 10px;
}
.side-link {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 11px; font-size: 13.5px; font-weight: 800;
  color: var(--muted); transition: all 0.2s;
}
.side-link:hover { background: color-mix(in srgb, var(--primary-soft) 60%, transparent); color: var(--text); }
.side-link.active { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; box-shadow: 0 6px 16px rgba(79, 70, 229, 0.3); }
.admin-main { flex: 1; min-width: 0; }
@media (max-width: 800px) {
  .admin-wrap { flex-direction: column; gap: 16px; }
  .admin-side {
    width: 100%; position: static; flex-direction: row !important; align-items: center;
    overflow-x: auto; padding: 8px; scrollbar-width: none;
  }
  .admin-side::-webkit-scrollbar { display: none; }
  .side-link { white-space: nowrap; padding: 10px 14px; }
}
@media (max-width: 640px) {
  .admin-side { flex-direction: column !important; }
  .side-link { white-space: normal; }
}

/* ── Switch — knob side is driven ONLY by `checked`, never by direction.
   Layout: absolute positioning on both horizontal edges (top/bottom/left)
   plus a fixed width, so the knob can't be pushed around by floats or
   writing-mode quirks. Checked == ON by translating the knob toward the
   opposite edge with a small spring. */
.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}
.switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.switch .slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 30%, var(--bg));
  transition: background 0.25s ease;
  pointer-events: none;
}
.switch .slider::before {
  content: "";
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 23px; /* anchor at the RIGHT-edge position for a 46px track (46-20-3=23);
                 physical properties only, so direction/writing-mode can't shift it */
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  transition: transform 0.25s cubic-bezier(0.34, 1.5, 0.64, 1);
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translate3d(-20px, 0, 0); }
.switch input:focus-visible + .slider {
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 25%, transparent);
}

/* toggle row layout */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg) 55%, var(--surface));
}
.toggle-row .switch {
  margin-inline-start: auto;
  align-self: flex-start;
}
.toggle-row .label-wrap {
  min-width: 0;
}
.toggle-row .label-wrap .tt {
  display: block;
  font-size: 13.5px;
  font-weight: 800;
  margin-bottom: 3px;
}
.toggle-row .label-wrap .ts {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
}
@media (max-width: 480px) {
  .toggle-row {
    flex-direction: column;
    align-items: stretch;
  }
  .toggle-row .switch { margin-inline-start: 0; }
}

/* ── Photo grid (image files) ── */
.thumb-img { width: 100%; height: 220px; object-fit: cover; background: #0b1020; border-radius: 12px; display: block; }

/* ── Sparkline chart ── */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding-top: 10px; }
.bars .bar {
  flex: 1; border-radius: 6px 6px 0 0; min-height: 3px;
  background: linear-gradient(180deg, var(--primary-2), var(--primary));
  opacity: 0.85; transition: opacity 0.2s;
}
.bars .bar:hover { opacity: 1; }

/* ── Auth pages ── */
.auth-card { max-width: 420px; margin: 48px auto 0; }
.auth-head { text-align: center; margin-bottom: 26px; }
.auth-head h2 { margin: 0 0 6px; font-size: 26px; font-weight: 900; }
.auth-head p { margin: 0; color: var(--muted); font-size: 13.5px; }
.auth-alt { text-align: center; margin-top: 22px; font-size: 13.5px; color: var(--muted); }
.auth-alt a { color: var(--primary); font-weight: 800; }

/* Password strength */
.strength-track { height: 6px; border-radius: 999px; background: color-mix(in srgb, var(--muted) 18%, var(--bg)); overflow: hidden; margin-top: 8px; }
.strength-bar { height: 100%; width: 0; border-radius: 999px; transition: width 0.25s, background 0.25s; }

/* ── Footer ── */
.footer {
  border-top: 1px solid var(--border); padding: 38px 20px;
  text-align: center; color: var(--muted); font-size: 13px; margin-top: 70px;
}
.footer-inner { max-width: 1100px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.footer-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--text); font-size: 15px; }
.footer-brand .logo {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; display: grid; place-items: center; font-size: 13px;
}
.footer-note { margin: 0; font-size: 12.5px; }
.footer-copy { margin: 0; font-size: 11.5px; opacity: 0.75; }

/* ── Icons row helpers ── */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-1 { gap: 6px; } .gap-2 { gap: 10px; } .gap-3 { gap: 16px; }
.mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; } .mt-4 { margin-top: 30px; }
.mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 20px; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11.5px; }
.font-black { font-weight: 900; }
.text-center { text-align: center; }
.hidden { display: none !important; }
.w-full { width: 100%; }

/* ── Animations ── */
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.fade-up { animation: fadeUp 0.5s ease-out both; }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 42px; height: 42px; border-radius: 50%;
  border: 4px solid var(--primary-soft); border-top-color: var(--primary);
  animation: spin 0.8s linear infinite; margin: 0 auto 12px;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--muted) 40%, transparent); border-radius: 999px; }
::-webkit-scrollbar-track { background: transparent; }

/* ── Announcement bar ── */
.announce {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; text-align: center; font-size: 13px; font-weight: 800; padding: 9px 16px;
}

/* ══════════════════════════════════════════════════════════
   Design System v3 — Landing effects & components
   ══════════════════════════════════════════════════════════ */

/* ── Scroll progress bar ── */
#scroll-progress {
  position: fixed; top: 0; right: 0; height: 3px; width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--primary-2), #d946ef);
  z-index: 300; border-radius: 0 0 0 4px;
  transition: width 0.08s linear;
}

/* ── Shine / glow button ── */
.btn-shine { position: relative; overflow: hidden; }
.btn-shine::after {
  content: ""; position: absolute; top: 0; height: 100%; width: 40px;
  background: linear-gradient(105deg, transparent, rgba(255,255,255,0.45), transparent);
  left: -60px; transform: skewX(-20deg);
  animation: btnShine 3.2s ease-in-out infinite;
}
@keyframes btnShine { 0%, 60% { left: -60px; } 100% { left: 130%; } }

.btn-pulse { animation: btnPulse 2.4s ease-in-out infinite; }
@keyframes btnPulse {
  0%, 100% { box-shadow: 0 6px 18px rgba(79, 70, 229, 0.28); }
  50% { box-shadow: 0 6px 30px rgba(124, 58, 237, 0.55); }
}

/* ── Animated gradient text ── */
.grad-anim {
  background: linear-gradient(90deg, var(--primary), var(--primary-2), #d946ef, var(--primary));
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradFlow 6s linear infinite;
}
@keyframes gradFlow { to { background-position: 300% 0; } }

/* ── Typing cursor ── */
.typing-cursor {
  display: inline-block; width: 3px; height: 0.9em;
  background: var(--primary-2); margin-right: 3px; vertical-align: -0.1em;
  animation: blinkCursor 0.85s steps(1) infinite;
}
@keyframes blinkCursor { 50% { opacity: 0; } }

/* ── Reveal on scroll ── */
.reveal {
  opacity: 0; transform: translateY(26px);
  transition: opacity 0.7s cubic-bezier(0.2, 0.7, 0.3, 1), transform 0.7s cubic-bezier(0.2, 0.7, 0.3, 1);
  will-change: opacity, transform;
}
.reveal.in { opacity: 1; transform: none; }
.reveal-d1 { transition-delay: 0.1s; }
.reveal-d2 { transition-delay: 0.2s; }
.reveal-d3 { transition-delay: 0.3s; }
.reveal-d4 { transition-delay: 0.4s; }
.reveal-r { transform: translateX(-26px); translate: 0; }

/* ── Floating shapes ── */
@keyframes floatY { 0%, 100% { transform: translateY(0) rotate(var(--rot, 0deg)); } 50% { transform: translateY(-16px) rotate(var(--rot, 0deg)); } }
.float { animation: floatY 5s ease-in-out infinite; }
.float-d1 { animation-delay: 0.7s; }
.float-d2 { animation-delay: 1.4s; }

@keyframes blobDrift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(40px, -30px) scale(1.08); }
  66% { transform: translate(-30px, 24px) scale(0.94); }
}
.hero-blob { animation: blobDrift 14s ease-in-out infinite; }
.hero-blob.b2 { animation-delay: -7s; }

/* ── Hero mockup (fake app window) ── */
.mockup {
  max-width: 720px; margin: 56px auto 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; overflow: hidden; position: relative;
  box-shadow: 0 40px 90px -30px rgba(30, 27, 75, 0.4), 0 0 0 1px rgba(79, 70, 229, 0.06);
  transform: perspective(1200px) rotateX(4deg);
  transition: transform 0.5s ease;
}
.mockup:hover { transform: perspective(1200px) rotateX(0deg) translateY(-6px); }
.mockup-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; background: color-mix(in srgb, var(--bg) 70%, var(--surface));
  border-bottom: 1px solid var(--border);
}
.mockup-dot { width: 11px; height: 11px; border-radius: 50%; }
.mockup-url {
  flex: 1; margin-inline-start: 10px; padding: 5px 14px;
  background: var(--bg); border-radius: 8px; font-size: 11.5px; color: var(--muted);
  direction: ltr; text-align: left; font-family: monospace;
}
.mockup-body { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.mock-row { display: flex; gap: 14px; align-items: center; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); }
.mock-thumb {
  width: 52px; height: 40px; border-radius: 9px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 18px;
}
.mock-line { height: 9px; border-radius: 999px; background: color-mix(in srgb, var(--muted) 26%, transparent); }
.mock-line.w1 { width: 44%; } .mock-line.w2 { width: 70%; } .mock-line.w3 { width: 56%; }
.mock-progress { height: 6px; border-radius: 999px; background: color-mix(in srgb, var(--muted) 18%, transparent); overflow: hidden; flex: 1; }
.mock-progress i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--primary-2)); animation: mockFill 3.4s ease-in-out infinite; }
@keyframes mockFill { 0% { width: 12%; } 55% { width: 92%; } 80% { width: 100%; opacity: 1; } 100% { width: 100%; opacity: 0.25; } }

/* demo tiles inside mockup */
.tile-blue { background: var(--primary-soft); color: var(--primary); }
.tile-green { background: var(--success-soft); color: var(--success); }
.tile-rose { background: var(--danger-soft); color: var(--danger); }
.tile-amber { background: var(--warning-soft); color: var(--warning); }

/* ── Counters ── */
.counter { font-size: clamp(30px, 4.5vw, 44px); font-weight: 900; line-height: 1.15; }
.counter-suffix { color: var(--primary-2); }

/* ── Section header ── */
.sec-head { text-align: center; max-width: 640px; margin: 0 auto 20px; }
.sec-eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 16px; border-radius: 999px; font-size: 12px; font-weight: 800;
  background: var(--primary-soft); color: var(--primary); margin-bottom: 14px;
}
.sec-head h2 { font-size: clamp(24px, 4vw, 36px); font-weight: 900; margin: 0 0 10px; line-height: 1.35; }
.sec-head p { color: var(--muted); font-size: 15px; margin: 0; }

/* ── Steps ── */
.step-num {
  width: 44px; height: 44px; border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; display: grid; place-items: center; font-weight: 900; font-size: 18px;
  margin-bottom: 14px; box-shadow: 0 8px 18px rgba(79, 70, 229, 0.3);
}

/* ── Marquee ── */
.marquee-wrap {
  overflow: hidden; position: relative; padding: 14px 0;
  border-block: 1px solid var(--border); margin: 54px 0;
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.marquee { display: flex; gap: 44px; width: max-content; animation: marqueeMove 26s linear infinite; }
.marquee-wrap:hover .marquee { animation-play-state: paused; }
.marquee-item {
  display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 800; color: var(--muted);
  white-space: nowrap; transition: color 0.2s;
}
.marquee-item:hover { color: var(--primary); }
@keyframes marqueeMove { to { transform: translateX(50%); } }

/* ── Interactive demo (fake link box) ── */
.demo-box {
  display: flex; gap: 10px; align-items: center; max-width: 560px; margin: 0 auto;
  padding: 10px 10px 10px 16px; border: 1.5px solid var(--border); border-radius: 16px;
  background: var(--surface); box-shadow: 0 10px 30px -14px rgba(79, 70, 229, 0.25);
  direction: ltr;
}
.demo-box code { flex: 1; font-size: 13.5px; color: var(--primary); font-weight: 700; word-break: break-all; text-align: left; }

/* ── FAQ accordion ── */
.faq-item { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); overflow: hidden; transition: border-color 0.25s, box-shadow 0.25s; }
/* ── Filter bar with a proper input+search icon for admin tables ── */
.filter-bar .search-wrap { position: relative; flex: 1 1 220px; min-width: 200px; }

/* ── FAQ — boxed, elegant accordion with numbered questions ── */
.faq-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; max-width: 1000px; margin: 0 auto; align-items: start; }
.faq-grid > div { min-width: 0; }
.faq-grid .faq-item { margin-top: 0; }
@media (max-width: 760px) { .faq-grid { grid-template-columns: 1fr; } }
.faq-item + .faq-item { margin-top: 14px; }
.faq-q { transition: padding 0.25s; }
.faq-q .faq-qwrap { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.faq-q .faq-num {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  display: grid; place-items: center;
  font-size: 12.5px; font-weight: 900;
  background: var(--primary-soft); color: var(--primary);
  transition: all 0.25s;
}
.faq-item.open .faq-num {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  box-shadow: 0 6px 14px rgba(79, 70, 229, 0.3);
}
.faq-q .chev {
  transition: transform 0.3s; color: var(--primary); font-size: 14px; flex-shrink: 0;
  display: grid; place-items: center;
}
.faq-item.open .chev { transform: rotate(90deg); }
@media (max-width: 640px) {
  .faq-q { padding: 14px 16px; }
  .faq-a-inner { padding: 0 16px 16px; }
}
.faq-item.open { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); box-shadow: 0 10px 26px -14px rgba(79, 70, 229, 0.3); }
.faq-q {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 17px 20px; background: none; border: none; text-align: right;
  font-size: 14.5px; font-weight: 800; color: var(--text);
}
.faq-q .chev { transition: transform 0.3s; color: var(--primary); font-size: 15px; flex-shrink: 0; }
.faq-item.open .chev { transform: rotate(90deg); }
.faq-a { max-height: 0; overflow: hidden; transition: max-height 0.35s ease; }
.faq-a-inner { padding: 0 20px 18px; color: var(--muted); font-size: 13.5px; line-height: 1.9; }

/* ── Big CTA section ── */
.cta-band {
  position: relative; overflow: hidden; border-radius: 26px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2) 70%, #a21caf);
  color: #fff; text-align: center; padding: 56px 28px;
  box-shadow: 0 30px 70px -24px rgba(79, 70, 229, 0.55);
}
.cta-band h2 { font-size: clamp(24px, 4vw, 38px); font-weight: 900; margin: 0 0 12px; }
.cta-band p { opacity: 0.92; margin: 0 auto 28px; max-width: 520px; font-size: 15px; }
.cta-band .blob {
  position: absolute; border-radius: 50%; filter: blur(50px); opacity: 0.35; pointer-events: none;
  background: #fff;
}
.cta-band .cb1 { width: 260px; height: 260px; top: -110px; left: -60px; animation: blobDrift 12s ease-in-out infinite; }
.cta-band .cb2 { width: 200px; height: 200px; bottom: -90px; right: -40px; animation: blobDrift 12s ease-in-out infinite reverse; }
.btn-white {
  background: #fff; color: var(--primary); padding: 14px 34px; border-radius: 13px;
  font-weight: 900; font-size: 15px; display: inline-flex; gap: 8px; align-items: center;
  transition: transform 0.2s, box-shadow 0.2s; position: relative; z-index: 1;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.22);
}
.btn-white:hover { transform: translateY(-3px); box-shadow: 0 16px 34px rgba(15, 23, 42, 0.3); }

/* ── Tilt cards (mouse follow) ── */
.tilt { transition: transform 0.18s ease; transform-style: preserve-3d; }

/* ── Check list ── */
.check-list { display: flex; flex-direction: column; gap: 10px; }
.check-list li { display: flex; align-items: flex-start; gap: 10px; list-style: none; font-size: 13.5px; color: var(--muted); font-weight: 600; }
.check-list .ck {
  width: 22px; height: 22px; border-radius: 7px; background: var(--success-soft);
  color: var(--success); display: grid; place-items: center; font-size: 12px; font-weight: 900; flex-shrink: 0;
  margin-top: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .float, .hero-blob, .btn-shine::after, .marquee, .mock-progress i, .grad-anim { animation: none !important; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ══════════════════════════════════════════════════════════
   RTL hygiene & responsive fixes (v4.1)
   ══════════════════════════════════════════════════════════ */

/* ── No horizontal overflow, ever ── */
html, body { overflow-x: clip; }

/* ── Section spacing rhythm ── */
.sec-head { margin-bottom: 28px; }

/* ── Admin toolbar selects: keep consistent with filter-bar look ── */
.toolbar .select { padding-top: 10px; padding-bottom: 10px; font-size: 13px; }

/* ── Mixed Persian + Latin digits/urls: keep punctuation upright ── */
.file-name, .mockup-url, .demo-box code, .share-chip code {
  unicode-bidi: plaintext;
  text-align: right; /* entry point stays on the Persian side */
}

/* ── Admin sidebar: no clipping on tablets, static flow below 640px ── */
@media (max-width: 800px) {
  .admin-side {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .admin-side::-webkit-scrollbar { display: none; }
}
@media (max-width: 640px) {
  .admin-side { flex-direction: column; width: 100%; }
  .side-link { white-space: normal; }
}

/* ── Toolbar: chips wrap gracefully on small screens ── */
@media (max-width: 640px) {
  .toolbar .search-box { min-width: 100%; }
  .toolbar .chip { padding: 7px 11px; font-size: 12px; }
  .view-toggle { margin-inline-start: auto; }
}

/* ── Page header on mobile ── */
@media (max-width: 640px) {
  .page-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .page-head h1 { font-size: 22px; }
}

/* ── Tables: don't force scroll if content is short ── */
.table-wrap { -webkit-overflow-scrolling: touch; }

/* ── Buttons: min tap target (a11y) ── */
.btn { min-height: 40px; }
.btn-sm { min-height: 32px; }

/* ══════════════════════════════════════════════════════════
   Design System v4 — Charts, toolbars, sortable tables
   ══════════════════════════════════════════════════════════ */

/* ── Page header ── */
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px; flex-wrap: wrap; margin-bottom: 26px;
}
.page-head h1 {
  margin: 0 0 6px; font-size: clamp(24px, 3.4vw, 32px); font-weight: 900;
  letter-spacing: -0.4px;
}
.page-head .page-sub { margin: 0; color: var(--muted); font-size: 13.5px; }

/* ── Toolbar (search + sort chips + view toggle) ── */
.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 16px; margin-bottom: 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
}

/* ── Filter bar (admin tables) — one consistent look everywhere ── */
.filter-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 16px; margin-bottom: 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
}
.filter-bar .search-box { position: relative; flex: 1 1 220px; min-width: 0; }
.filter-bar .search-box input,
.filter-bar input.fsearch {
  width: 100%; padding: 10px 38px 10px 12px;
  border: 1.5px solid var(--border); border-radius: 11px;
  background: var(--bg); color: var(--text); font-size: 13.5px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.filter-bar .search-box input:focus,
.filter-bar input.fsearch:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 13%, transparent);
}
.filter-bar .search-box .search-ic {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 14px; pointer-events: none;
}
.filter-bar .select {
  flex: 0 1 auto; padding-top: 10px; padding-bottom: 10px; font-size: 13px;
}
.filter-bar .count { font-size: 12px; color: var(--muted); font-weight: 700; white-space: nowrap; }
.filter-bar .spacer { flex: 1; }
.toolbar .search-box {
  position: relative; flex: 1; min-width: 200px;
}
.toolbar .search-box input {
  width: 100%; padding: 10px 38px 10px 12px;
  border: 1.5px solid var(--border); border-radius: 11px;
  background: var(--bg); color: var(--text); font-size: 13.5px;
}
.toolbar .search-box input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 13%, transparent);
}
.toolbar .search-box .search-ic {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 14px; pointer-events: none;
}
.toolbar .search-box input { padding-right: 36px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 800;
  background: var(--bg); border: 1.5px solid var(--border); color: var(--muted);
  transition: all 0.2s; white-space: nowrap;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; border-color: transparent;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}
.view-toggle { display: flex; border: 1.5px solid var(--border); border-radius: 11px; overflow: hidden; }
.view-toggle button {
  padding: 9px 14px; border: none; background: var(--bg); color: var(--muted); font-size: 13px; font-weight: 800;
}
.view-toggle button.active { background: var(--primary-soft); color: var(--primary); }

/* ── Sortable table headers ── */
.tbl th.sortable { cursor: pointer; user-select: none; transition: color 0.15s; }
.tbl th.sortable:hover { color: var(--primary); }
.tbl th .sort-arr { opacity: 0.25; font-size: 10px; margin-inline-start: 4px; }
.tbl th.sorted-asc .sort-arr { opacity: 1; transform: none; }
.tbl th.sorted-desc .sort-arr { opacity: 1; transform: rotate(180deg); }
.tbl th .sort-arr { display: inline-block; transition: transform 0.2s; }

/* ── Stat mini row (dashboard) ── */
.stat-mini { display: flex; align-items: center; gap: 12px; }
.stat-mini .num { font-size: 22px; font-weight: 900; line-height: 1.2; }

/* ── Chart grid (2-col dashboard charts) ── */
.chart-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px;
}
@media (max-width: 820px) { .chart-grid { grid-template-columns: 1fr; } }

/* ── Donut chart ── */
.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.donut {
  width: 132px; height: 132px; border-radius: 50%; flex-shrink: 0;
  background: conic-gradient(var(--primary) 0turn, var(--primary) var(--p1, 0.3turn), var(--primary-2) var(--p1, 0.3turn), var(--primary-2) var(--p2, 0.6turn), #d946ef var(--p2, 0.6turn), #d946ef var(--p3, 0.9turn), color-mix(in srgb, var(--muted) 22%, var(--bg)) var(--p3, 0.9turn));
  display: grid; place-items: center;
  transform: rotate(-90deg);
}
.donut::before {
  content: ""; width: 78px; height: 78px; border-radius: 50%;
  background: var(--surface); transform: rotate(90deg);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
}
.donut-center {
  position: absolute; inset: 0; display: grid; place-items: center; transform: rotate(90deg);
}
.donut-center .big { font-size: 20px; font-weight: 900; }
.donut-center .small { font-size: 10.5px; color: var(--muted); font-weight: 700; }
.donut-legend { display: flex; flex-direction: column; gap: 9px; min-width: 150px; }
.donut-legend .li { display: flex; align-items: center; gap: 9px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.donut-legend .dot { width: 11px; height: 11px; border-radius: 4px; flex-shrink: 0; }
.donut-legend .val { margin-inline-start: auto; font-weight: 900; color: var(--text); }

/* ── Animated bar chart ── */
.bars-anim .bar {
  transform-origin: bottom; transform: scaleY(0);
  transition: transform 0.9s cubic-bezier(0.2, 0.7, 0.3, 1.05);
}
.bars-anim.in .bar { transform: scaleY(1); }
.bars-anim.in .bar:nth-child(1) { transition-delay: 0.02s; }
.bars-anim.in .bar:nth-child(2) { transition-delay: 0.05s; }
.bars-anim.in .bar:nth-child(3) { transition-delay: 0.08s; }
.bars-anim.in .bar:nth-child(4) { transition-delay: 0.11s; }
.bars-anim.in .bar:nth-child(n+5) { transition-delay: 0.14s; }
.bar-label {
  font-size: 9.5px; color: var(--muted); text-align: center; font-weight: 700;
}
.bars-cols { display: flex; gap: 6px; align-items: flex-end; height: 130px; padding-top: 10px; }
.bars-cols .bcol { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; }
.bars-cols .bcol .bar { width: 100%; }

/* ── Top-users leaderboard ── */
.leader-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 11px; border: 1px solid transparent;
  transition: background 0.2s;
}
.leader-row:hover { background: color-mix(in srgb, var(--primary-soft) 60%, transparent); }
.leader-row .rank {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 900; font-size: 12.5px;
  background: var(--bg); border: 1px solid var(--border); color: var(--muted);
}
.leader-row:nth-child(1) .rank { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #fff; border-color: transparent; }
.leader-row:nth-child(2) .rank { background: linear-gradient(135deg, #9ca3af, #6b7280); color: #fff; border-color: transparent; }
.leader-row:nth-child(3) .rank { background: linear-gradient(135deg, #d97706, #b45309); color: #fff; border-color: transparent; }
.leader-row .who { min-width: 0; flex: 1; }
.leader-row .who .ph { font-size: 13px; font-weight: 800; direction: ltr; text-align: right; }
.leader-row .who .info { font-size: 11px; color: var(--muted); }
.leader-row .bytes { font-size: 12.5px; font-weight: 900; color: var(--primary); white-space: nowrap; }
.leader-track {
  height: 6px; border-radius: 999px; background: color-mix(in srgb, var(--muted) 15%, var(--bg));
  margin-top: 4px; overflow: hidden;
}
.leader-track i {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  width: 0; transition: width 1s cubic-bezier(0.2, 0.7, 0.3, 1);
}

/* ── Dashboard files grid: keep 2 clean columns on desktop ── */
.files-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
@media (max-width: 900px) { .files-grid { grid-template-columns: 1fr; }
  .files-grid.list-view { grid-template-columns: 1fr; }
}
.files-grid.list-view {
  display: flex; flex-direction: column; gap: 10px;
}
.files-grid.list-view .file-card { flex-direction: row; align-items: center; padding: 12px 16px; flex-wrap: wrap; }
.files-grid.list-view .file-card .file-media { display: none; margin-bottom: 0; }
.files-grid.list-view .file-card .file-actions { margin: 0 0 0 auto; margin-top: 0; flex-wrap: nowrap; }
.files-grid.list-view .file-card .shares-box { width: 100%; }
.files-grid.list-view .file-card .file-head { margin: 0; flex: 1; min-width: 200px; }

/* expiry urgency colors */
.exp-warn { color: var(--warning); font-weight: 800; }
.exp-danger { color: var(--danger); font-weight: 800; animation: blinkCursor 1.4s infinite; }

/* ══ Design System v6 — bulk actions, lightbox, upload detail, share meta ══ */

/* Sort chips row (dashboard toolbar) */
.chips-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* Row of chips under the toolbar for multi-select */
.bulk-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 16px; margin: -8px 0 18px;
  background: var(--primary-soft); border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--border));
  border-radius: 14px;
}
.bulk-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 800; cursor: pointer; }
.bulk-count { font-size: 13px; font-weight: 900; color: var(--primary); }
.bulk-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-inline-start: auto; }

/* Per-card selection checkbox */
.pick { display: grid; place-items: center; flex-shrink: 0; cursor: pointer; }
.pick input {
  appearance: none; -webkit-appearance: none;
  width: 20px; height: 20px; margin: 0; cursor: pointer;
  border: 2px solid var(--border); border-radius: 6px; background: var(--surface);
  transition: all 0.15s;
}
.pick input:hover { border-color: var(--primary); }
.pick input:checked { background: var(--primary); border-color: var(--primary); }
.pick input:checked::after {
  content: "✓"; display: block; text-align: center; line-height: 16px;
  color: #fff; font-size: 12px; font-weight: 900;
}
.tbl input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }

/* Upload progress detail */
.dz-pct { font-size: 34px; font-weight: 900; color: var(--primary); line-height: 1.1; margin-bottom: 4px; }

/* Lightbox */
.lightbox-inner {
  position: relative; max-width: min(94vw, 1100px); max-height: 92vh;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.lightbox-inner img { max-width: 100%; max-height: 82vh; border-radius: 14px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.6); background: #0b1020; }
.lightbox-close {
  position: absolute; top: -46px; left: 0; color: #fff; font-size: 26px;
  background: rgba(255, 255, 255, 0.14); border-radius: 12px; padding: 2px 12px;
}
.lightbox-name { color: #fff; font-size: 13px; font-weight: 700; direction: ltr; word-break: break-all; text-align: center; }

/* Share page meta badges */
.share-meta { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 640px) {
  .bulk-actions { margin-inline-start: 0; width: 100%; }
  .bulk-actions .btn { flex: 1; }
  .chips-row { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
  .chips-row::-webkit-scrollbar { display: none; }
}

/* ════════════════ MediaShare additions (bilingual) ════════════════ */

/* Language switcher + LTR adjustments. all.css is authored RTL-first;
   these keep the Latin layout tidy without touching the core rules. */
html[dir="ltr"] body { text-align: left; }
html[dir="ltr"] .navbar-inner,
html[dir="ltr"] .footer-inner { direction: ltr; }
/* Nav row wraps instead of scrolling sideways on very narrow screens. */
.nav-links { flex-wrap: wrap; }

/* Phone / numeric inputs stay left-to-right in both languages */
.input[dir="ltr"], input[dir="ltr"] { direction: ltr; text-align: left; }
html[dir="rtl"] .input.text-center[dir="ltr"] { text-align: center; }

/* Inline language flag chips in the nav */
.lang-link { font-weight: 800; letter-spacing: .3px; }

/* Small helpers used across the rebuilt views */
.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.text-nowrap { white-space: nowrap; }
.dir-ltr { direction: ltr; }
.stack-2 { display: flex; flex-direction: column; gap: 8px; }

/* ════════════════ Plans & wallet components ════════════════ */
.plan-strip {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 18px; margin-bottom: 18px;
}
.plan-strip-main { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.plan-card {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 22px; display: flex; flex-direction: column; gap: 12px;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.plan-card:hover { transform: translateY(-4px); box-shadow: 0 16px 40px -22px rgba(0, 0, 0, .55); }
.plan-card.featured { border-color: color-mix(in srgb, var(--primary) 55%, var(--border)); }
.plan-card.current { border-color: var(--success); }
.plan-name { font-size: 18px; font-weight: 900; }
.plan-price { font-size: 27px; font-weight: 900; }
.plan-price small { font-size: 12.5px; color: var(--muted); font-weight: 700; margin-inline-start: 5px; }
.plan-feats { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.plan-feats li { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.plan-feats li b { color: var(--text); }
.plan-ribbon {
  position: absolute; top: 14px; inset-inline-end: 14px; font-size: 11px; font-weight: 800;
  padding: 4px 10px; border-radius: 999px; background: var(--primary-soft); color: var(--primary);
}

.wallet-balance {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; border-radius: 18px; padding: 24px;
}
.wallet-balance .amt { font-size: 34px; font-weight: 900; }
.wallet-balance .lbl { font-size: 13px; opacity: .92; font-weight: 700; }
.once-icon { font-size: 54px; }
.tx-plus { color: var(--success); font-weight: 900; }
.tx-minus { color: var(--danger); font-weight: 900; }

/* ════════════════ Header / footer icons (inline SVG) ════════════════ */
.ic { display: block; flex: none; width: 18px; height: 18px; }
.brand .logo .ic { width: 18px; height: 18px; stroke-width: 2.1; }
.footer-brand .logo .ic { width: 16px; height: 16px; stroke-width: 2.1; }
#theme-toggle .ic { width: 17px; height: 17px; }
#theme-toggle .ic-sun { display: none; }
html[data-theme="dark"] #theme-toggle .ic-moon { display: none; }
html[data-theme="dark"] #theme-toggle .ic-sun { display: block; }
.inline-form { display: inline; }

/* Footer: centred brand block + language switch (bilingual) */
.footer-lang {
  margin: 0; display: flex; align-items: center; justify-content: center;
  gap: 8px; font-size: 12px; font-weight: 700; color: var(--muted);
}
.footer-lang a { color: var(--muted); }
.footer-lang a:hover, .footer-lang a.on { color: var(--primary); }
.footer-lang .sep { opacity: .5; }

/* ════════════════ Forms: symmetric action rows ════════════════ */
/* A button column keeps a label + hint spacer so it aligns with input columns. */
.voucher-form { display: grid; grid-template-columns: 1.2fr 1fr 1.2fr; gap: 12px; align-items: start; }
.field-action > label { visibility: hidden; }
@media (max-width: 760px) { .voucher-form { grid-template-columns: 1fr; } .field-action > label, .field-action > .hint { display: none; } }

/* ════════════════ Support tickets ════════════════ */
.ticket-list { display: flex; flex-direction: column; gap: 10px; }
.ticket-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px;
  transition: border-color .18s ease, transform .18s ease;
}
.ticket-row:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }
.ticket-row-main { flex: 1; min-width: 180px; }
.ticket-subject { font-weight: 800; font-size: 14.5px; }
.ticket-meta { font-size: 12px; color: var(--muted); margin-top: 3px; display: flex; gap: 10px; flex-wrap: wrap; }
.ticket-actions { display: flex; align-items: center; gap: 8px; }

/* ── Support thread: flat, comment-style conversation (no bubbles) ── */
.thread-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }

/* Conversation bar */
.thread-top {
  display: flex; align-items: center; justify-content: space-between; gap: 10px 14px; flex-wrap: wrap;
  padding: 12px 18px; border-bottom: 1px solid var(--border); background: var(--surface);
}
.thread-top-info { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.thread-phone { font-variant-numeric: tabular-nums; opacity: .9; }

/* Scroll area: one full-width row per message, separated by hairlines */
.thread-viewport { position: relative; }
.thread {
  height: clamp(300px, 56vh, 640px); overflow-y: auto; overscroll-behavior: contain;
  padding-bottom: 10px; display: flex; flex-direction: column;
}
.thread:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.thread-empty {
  margin: auto; display: flex; flex-direction: column; align-items: center; gap: 9px;
  text-align: center; color: var(--muted); font-size: 13px; font-weight: 600;
}
.thread-empty .ic { width: 26px; height: 26px; opacity: .65; }

.thread-day {
  display: flex; align-items: center; gap: 10px;
  margin: 16px 18px 4px; color: var(--muted); font-size: 11px; font-weight: 800;
}
.thread-day::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.thread-day:first-child { margin-top: 10px; }

/* Two-sided conversation: user messages on one side, staff replies on the other. */
.msg {
  display: flex; align-items: flex-end; gap: 9px; padding: 5px 18px;
}
.msg + .msg { margin-top: 3px; }
.msg.mine { flex-direction: row-reverse; }
.msg-avatar {
  width: 34px; height: 34px; border-radius: 12px; display: grid; place-items: center;
  font-size: 13px; font-weight: 800; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border);
}
.msg.mine .msg-avatar { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; border-color: transparent; }
.msg:not(.mine) .msg-avatar { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 35%, var(--border)); }
.msg-main {
  min-width: 0; max-width: min(78%, 560px);
  padding: 8px 13px 9px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--border);
}
/* The counterpart's bubble is styled the same for everyone (admin and user),
   so the admin's reply view looks identical to the user's. */
.msg:not(.mine) .msg-main {
  background: color-mix(in srgb, var(--success-soft) 45%, var(--surface));
  border-end-start-radius: 5px;
}
.msg.mine .msg-main {
  background: color-mix(in srgb, var(--primary-soft) 70%, var(--surface));
  border-color: color-mix(in srgb, var(--primary) 32%, var(--border));
  border-end-end-radius: 5px;
}
.msg-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 2px; }
.msg-who { font-size: 12.5px; font-weight: 800; color: var(--text); }
.msg-time { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.msg-state { font-size: 11px; font-weight: 700; color: var(--muted); }
.msg-text { font-size: 14px; line-height: 1.7; color: var(--text); white-space: pre-wrap; word-break: break-word; }
.msg.pending .msg-main { opacity: .6; }
.msg.failed .msg-main { background: color-mix(in srgb, var(--danger-soft) 60%, var(--surface)); border-color: var(--danger); }
.msg.failed .msg-state { color: var(--danger); }
.msg-retry {
  border: 0; background: none; padding: 0; font: inherit; font-size: 11.5px; font-weight: 800;
  color: var(--primary); text-decoration: underline; cursor: pointer;
}

/* Image attached to a ticket message */
.msg-attach {
  display: inline-block; margin-top: 8px; border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden; background: var(--surface); max-width: 100%;
}
.msg-attach img { display: block; width: auto; max-width: min(320px, 100%); max-height: 240px; object-fit: cover; }
.msg.pending .msg-attach { opacity: .55; }

/* “new message” pill + typing row */
.thread-jump {
  position: absolute; inset-inline-start: 50%; transform: translateX(-50%); bottom: 14px;
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 15px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 12px; font-weight: 800; box-shadow: 0 12px 30px -14px rgba(0, 0, 0, .8);
}
.thread-jump:hover { border-color: var(--primary); color: var(--primary); }
.thread-jump[hidden] { display: none; }
.thread-typing { display: flex; align-items: center; gap: 9px; padding: 6px 18px 10px; font-size: 12px; color: var(--muted); font-weight: 700; }
.thread-typing[hidden] { display: none; }
.thread-typing b { color: var(--text); }
.typing-dots { display: inline-flex; align-items: flex-end; gap: 3px; }
.typing-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); animation: typingBounce 1.2s infinite ease-in-out; }
.typing-dots i:nth-child(2) { animation-delay: .15s; }
.typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .45; }
  30% { transform: translateY(-3px); opacity: 1; }
}

/* Composer: plain field + labelled send button, hint row underneath */
/* The hint row is a grid row of its own, so the form needs no extra wrapper. */
.composer {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: end; gap: 10px;
  padding: 12px 18px 0; border-top: 1px solid var(--border); background: var(--surface);
}
.composer > input[type="hidden"] { display: none; }
.composer > input[type="file"] { display: none; }
.composer-attach {
  height: 44px; width: 44px; flex: none; display: inline-grid; place-items: center;
  border: 1px solid var(--border); border-radius: 13px; background: var(--bg); color: var(--muted);
  cursor: pointer; transition: border-color .18s ease, color .18s ease;
}
.composer-attach:hover { border-color: var(--primary); color: var(--primary); }
.composer-attach .ic { width: 20px; height: 20px; }
.attach-preview {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; padding: 8px;
  border: 1px dashed var(--border); border-radius: 12px; background: var(--bg);
}
.attach-preview[hidden] { display: none; }
.attach-preview img { width: 44px; height: 44px; border-radius: 9px; object-fit: cover; border: 1px solid var(--border); }
.attach-name { flex: 1; min-width: 0; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-remove {
  flex: none; border: 0; background: none; padding: 2px 6px; border-radius: 8px;
  color: var(--muted); font-size: 15px; line-height: 1; cursor: pointer;
}
.attach-remove:hover { color: var(--danger); background: var(--danger-soft); }
.composer-input {
  width: 100%; min-height: 44px; max-height: 150px; padding: 10px 14px; resize: none;
  border: 1px solid var(--border); border-radius: 13px; background: var(--bg); color: var(--text);
  font: inherit; font-size: 14px; line-height: 1.7; outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.composer-input::placeholder { color: var(--muted); }
.composer-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.composer-send {
  height: 44px; flex: none; display: inline-flex; align-items: center; gap: 8px; padding: 0 18px;
  border: 0; border-radius: 13px; color: #fff; font: inherit; font-size: 13.5px; font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--primary-2)); cursor: pointer;
  transition: filter .18s ease, opacity .18s ease;
}
.composer-send .ic { width: 17px; height: 17px; }
.composer-send:hover:not(:disabled) { filter: brightness(1.08); }
.composer-send:disabled { opacity: .4; cursor: not-allowed; }
.composer-foot {
  grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 0 11px; font-size: 11.5px; color: var(--muted);
}
.composer-count { font-variant-numeric: tabular-nums; }
.composer-count.warn { color: var(--warning); font-weight: 800; }
.thread-locked {
  display: flex; align-items: center; justify-content: center; gap: 9px; flex-wrap: wrap;
  padding: 15px 18px; border-top: 1px solid var(--border); background: var(--surface);
  color: var(--muted); font-size: 12.5px; font-weight: 700; text-align: center;
}

.live-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 800; color: var(--muted); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.live-dot.on { background: var(--success); animation: blinkCursor 1.4s infinite; }

@media (max-width: 600px) {
  .thread { height: clamp(280px, 52vh, 480px); }
  .msg { gap: 8px; padding: 4px 13px; }
  .msg-main { max-width: 84%; }
  .msg-avatar { width: 30px; height: 30px; border-radius: 10px; font-size: 12px; }
  .thread-day { margin: 14px 13px 2px; }
  .thread-top, .composer { padding-inline: 13px; }
  .composer-send { padding: 0 14px; }
  .composer-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .typing-dots i { animation: none; }
}
