/* ============================================================================
   GymPlus — Demo Design System
   تم باشگاهی مدرن · RTL · دارک/لایت · ریسپانسیو
   ============================================================================ */

/* ---------- Theme tokens ---------- */
:root {
  --accent:        #b8f23d;   /* electric lime — انرژی باشگاه */
  --accent-2:      #4ade80;   /* gradient end */
  --accent-ink:    #0b1208;   /* متن تیره روی accent */
  --accent-glow:   rgba(184, 242, 61, .35);

  --danger:  #ff5d5d;
  --warning: #ffb84d;
  --info:    #5db3ff;
  --gold:    #ffd24a;

  /* Dark theme (default) */
  --bg:        #0a0c11;
  --bg-2:      #0f1219;
  --surface:   #151922;
  --surface-2: #1c212d;
  --border:    #262d3a;
  --text:      #eef2f8;
  --text-dim:  #9aa6b8;
  --text-mute: #5e6b80;
  --shadow:    0 18px 40px -18px rgba(0,0,0,.65);
  --ring:      rgba(255,255,255,.06);
  --hero-img:  linear-gradient(135deg, rgba(184,242,61,.18), rgba(74,222,128,.06));
}

[data-theme="light"] {
  --accent:        #5fb800;
  --accent-2:      #2bbd6f;
  --accent-ink:    #ffffff;
  --accent-glow:   rgba(95,184,0,.22);

  --bg:        #eef1f6;
  --bg-2:      #e6eaf1;
  --surface:   #ffffff;
  --surface-2: #f4f6fa;
  --border:    #e2e7ef;
  --text:      #131722;
  --text-dim:  #5a6577;
  --text-mute: #98a2b3;
  --shadow:    0 18px 36px -20px rgba(40,55,80,.28);
  --ring:      rgba(20,30,50,.05);
  --hero-img:  linear-gradient(135deg, rgba(95,184,0,.16), rgba(43,189,111,.05));
}

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

html { scroll-behavior: smooth; overflow-x: hidden; }

body {
  font-family: 'Vazirmatn', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background .35s ease, color .35s ease;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
img { max-width: 100%; display: block; }
::selection { background: var(--accent); color: var(--accent-ink); }

/* scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 20px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-mute); }

/* ============================================================================
   App shell — sidebar + main
   ============================================================================ */
.app { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  background: var(--bg-2);
  border-inline-start: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 22px 16px;
  z-index: 40;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 22px; }
.brand-logo {
  width: 42px; height: 42px; border-radius: 13px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center; font-size: 22px;
  box-shadow: 0 8px 20px -6px var(--accent-glow);
}
.brand-name { font-weight: 800; font-size: 20px; letter-spacing: -.4px; }
.brand-name span { color: var(--accent); }
.brand-tag { font-size: 11px; color: var(--text-mute); margin-top: -3px; }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; overflow-y: auto; }
.nav-label { font-size: 11px; color: var(--text-mute); padding: 16px 12px 6px; font-weight: 700; letter-spacing: .5px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px; border-radius: 12px;
  color: var(--text-dim); font-size: 14.5px; font-weight: 600;
  transition: all .2s ease; position: relative;
}
.nav-item .ico { font-size: 19px; width: 22px; text-align: center; }
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active { background: var(--surface); color: var(--text); }
.nav-item.active::before {
  content: ''; position: absolute; inset-inline-start: -16px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 22px; border-radius: 0 4px 4px 0; background: var(--accent);
}
.nav-item .badge {
  margin-inline-start: auto; background: var(--accent); color: var(--accent-ink);
  font-size: 11px; font-weight: 800; padding: 1px 8px; border-radius: 20px;
}

.sidebar-foot { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 8px; }
.user-chip { display: flex; align-items: center; gap: 11px; padding: 8px; border-radius: 12px; }
.user-chip:hover { background: var(--surface); }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center; font-weight: 800; color: var(--accent-ink); font-size: 15px;
}
.user-chip .nm { font-size: 14px; font-weight: 700; }
.user-chip .rl { font-size: 11.5px; color: var(--text-mute); }

/* ---------- Main ---------- */
.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px;
  padding: 16px 28px;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.page-title h1 { font-size: 21px; font-weight: 800; letter-spacing: -.4px; }
.page-title p { font-size: 13px; color: var(--text-mute); }

.search {
  display: flex; align-items: center; gap: 9px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 9px 14px; min-width: 230px;
}
.search input { background: none; border: none; outline: none; color: var(--text); font-size: 14px; width: 100%; }
.search input::placeholder { color: var(--text-mute); }

.top-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border);
  display: grid; place-items: center; font-size: 18px; color: var(--text-dim);
  transition: all .2s; position: relative;
}
.icon-btn:hover { color: var(--text); border-color: var(--accent); }
.icon-btn .dot { position: absolute; top: 9px; inset-inline-end: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid var(--surface); }

.content { padding: 26px 28px 60px; flex: 1; }

/* mobile sidebar toggle */
.menu-btn { display: none; }
.scrim { display: none; }

/* ============================================================================
   Buttons
   ============================================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 12px; font-weight: 700; font-size: 14px;
  transition: transform .15s, box-shadow .2s, background .2s; white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink); box-shadow: 0 10px 24px -10px var(--accent-glow); }
.btn-primary:hover { box-shadow: 0 14px 30px -8px var(--accent-glow); }
.btn-ghost { background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); }
.btn.danger, .btn-ghost.danger { color: var(--danger); }
.btn.danger:hover, .btn-ghost.danger:hover { border-color: var(--danger); }
.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: 10px; }

/* ============================================================================
   Cards & grid
   ============================================================================ */
.grid { display: grid; gap: 18px; }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 20px; box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-head h3 { font-size: 16px; font-weight: 800; }
.card-head a { font-size: 13px; color: var(--accent); font-weight: 600; }

/* stat card */
.stat { display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden; }
.stat .ico-box {
  width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; font-size: 22px;
  background: var(--surface-2);
}
.stat .ico-box.g { background: var(--accent-glow); }
.stat .val { font-size: 28px; font-weight: 800; letter-spacing: -1px; }
.stat .lbl { font-size: 13px; color: var(--text-dim); }
.delta { font-size: 12.5px; font-weight: 700; display: inline-flex; align-items: center; gap: 3px; }
.delta.up { color: var(--accent-2); }
.delta.down { color: var(--danger); }

/* ============================================================================
   Charts (pure CSS)
   ============================================================================ */
.bars { display: flex; align-items: flex-end; gap: 14px; height: 180px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bar {
  width: 100%; max-width: 38px; border-radius: 8px 8px 4px 4px;
  background: linear-gradient(to top, var(--accent), var(--accent-2));
  transition: height .8s cubic-bezier(.2,.8,.2,1); min-height: 6px;
}
.bar.muted { background: var(--surface-2); }
.bar-col .cap { font-size: 11.5px; color: var(--text-mute); }

/* progress ring */
.ring { --p: 70; --size: 132px; width: var(--size); height: var(--size); position: relative; }
.ring svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.ring .track { stroke: var(--surface-2); }
.ring .fill { stroke: url(#grad); stroke-linecap: round; transition: stroke-dashoffset 1s ease; }
.ring .mid { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring .mid .big { font-size: 26px; font-weight: 800; }
.ring .mid .sm { font-size: 11px; color: var(--text-mute); }

/* linear progress */
.pbar { height: 9px; border-radius: 20px; background: var(--surface-2); overflow: hidden; }
.pbar > span { display: block; height: 100%; border-radius: 20px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

/* ============================================================================
   Lists / tables
   ============================================================================ */
.list { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 14px; padding: 13px 4px;
  border-bottom: 1px solid var(--border);
}
.row:last-child { border-bottom: none; }
.row .nm { font-weight: 700; font-size: 14.5px; }
.row .sub { font-size: 12.5px; color: var(--text-mute); }
.row .end { margin-inline-start: auto; text-align: end; }

.tag { font-size: 11.5px; font-weight: 700; padding: 3px 11px; border-radius: 20px; display: inline-block; }
.tag.ok    { background: var(--accent-glow); color: var(--accent-2); }
.tag.warn  { background: rgba(255,184,77,.16); color: var(--warning); }
.tag.bad   { background: rgba(255,93,93,.16); color: var(--danger); }
.tag.info  { background: rgba(93,179,255,.16); color: var(--info); }

table { width: 100%; border-collapse: collapse; }
th { text-align: start; font-size: 12px; color: var(--text-mute); font-weight: 700; padding: 10px 12px; }
td { padding: 13px 12px; border-top: 1px solid var(--border); font-size: 14px; }
tbody tr:hover { background: var(--surface-2); }

/* ============================================================================
   Theme toggle switch
   ============================================================================ */
.theme-toggle {
  display: flex; align-items: center; gap: 6px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 30px; padding: 4px;
}
.theme-toggle button { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; color: var(--text-mute); }
.theme-toggle button.on { background: var(--accent); color: var(--accent-ink); }

/* ============================================================================
   Hero / motivation (athlete)
   ============================================================================ */
.hero {
  border-radius: 22px; padding: 28px; position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
}
.hero::after {
  content: ''; position: absolute; inset: 0; background: var(--hero-img); pointer-events: none;
}
.hero > * { position: relative; z-index: 1; }
.hero .greet { font-size: 14px; color: var(--text-dim); }
.hero .big { font-size: 30px; font-weight: 800; letter-spacing: -.8px; margin: 4px 0 6px; }
.hero .quote { font-size: 14.5px; color: var(--text-dim); max-width: 460px; }

.streak-flame {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,93,93,.12); color: var(--danger);
  padding: 8px 16px; border-radius: 30px; font-weight: 800; font-size: 15px; margin-top: 16px;
}

/* badges */
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 14px; }
.badge-item { text-align: center; }
.badge-coin {
  width: 64px; height: 64px; margin: 0 auto 8px; border-radius: 50%;
  display: grid; place-items: center; font-size: 28px;
  background: linear-gradient(135deg, var(--gold), #ff9d3c); color: #3a2400;
  box-shadow: 0 8px 18px -6px rgba(255,157,60,.5);
}
.badge-coin.locked { background: var(--surface-2); color: var(--text-mute); box-shadow: none; filter: grayscale(1); opacity: .55; }
.badge-item .bn { font-size: 12px; font-weight: 700; }

/* workout exercise card */
.ex-card { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 14px; background: var(--surface-2); }
.ex-thumb { width: 54px; height: 54px; border-radius: 12px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); display: grid; place-items: center; font-size: 24px; flex-shrink: 0; }
.ex-card .meta { font-size: 12.5px; color: var(--text-mute); }
.check {
  width: 30px; height: 30px; border-radius: 9px; border: 2px solid var(--border);
  display: grid; place-items: center; margin-inline-start: auto; color: transparent; transition: all .2s;
}
.check.done { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* segmented control / chips */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 8px 16px; border-radius: 30px; background: var(--surface); border: 1px solid var(--border); font-size: 13.5px; font-weight: 600; color: var(--text-dim); }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ============================================================================
   Landing (index)
   ============================================================================ */
.landing { min-height: 100vh; display: flex; flex-direction: column; }
.land-nav { display: flex; align-items: center; padding: 22px 6vw; gap: 16px; }
.land-hero { flex: 1; display: grid; place-items: center; text-align: center; padding: 30px 6vw 60px; }
.land-hero .kicker { color: var(--accent); font-weight: 700; letter-spacing: 1px; font-size: 14px; }
.land-hero h1 { font-size: clamp(34px, 6vw, 62px); font-weight: 800; letter-spacing: -1.5px; line-height: 1.15; margin: 14px 0; }
.land-hero h1 span { background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.land-hero p { font-size: 17px; color: var(--text-dim); max-width: 560px; margin: 0 auto 32px; }

.role-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; max-width: 920px; width: 100%; margin: 20px auto 0; }
.role-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 22px;
  padding: 30px 24px; text-align: center; transition: all .25s; position: relative; overflow: hidden;
}
.role-card::after { content: ''; position: absolute; inset: 0 0 auto; height: 4px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transform: scaleX(0); transform-origin: center; transition: transform .3s; }
.role-card:hover { transform: translateY(-6px); border-color: var(--accent); box-shadow: var(--shadow); }
.role-card:hover::after { transform: scaleX(1); }
.role-ico { width: 70px; height: 70px; border-radius: 20px; margin: 0 auto 18px; display: grid; place-items: center; font-size: 34px; background: var(--hero-img); }
.role-card h3 { font-size: 21px; font-weight: 800; margin-bottom: 8px; }
.role-card p { font-size: 14px; color: var(--text-dim); margin-bottom: 20px; min-height: 44px; }

.feat-row { display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; margin-top: 50px; }
.feat { display: flex; align-items: center; gap: 9px; font-size: 14px; color: var(--text-dim); }
.feat .ico { color: var(--accent); font-size: 18px; }

/* ============================================================================
   Auth / login page
   ============================================================================ */
.auth-hero {
  flex: 1; display: grid; grid-template-columns: 1.1fr .9fr; align-items: center;
  gap: 48px; max-width: 1140px; width: 100%; margin: 0 auto; padding: 20px 6vw 70px;
}
.auth-intro .kicker { color: var(--accent); font-weight: 700; letter-spacing: 1px; font-size: 14px; }
.auth-intro h1 { font-size: clamp(30px, 4.4vw, 52px); font-weight: 800; letter-spacing: -1.2px; line-height: 1.15; margin: 12px 0; }
.auth-intro h1 span { background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-intro p { font-size: 16px; color: var(--text-dim); max-width: 480px; margin-bottom: 26px; }
.auth-intro .feat-row { justify-content: flex-start; margin-top: 0; }

.auth-card { padding: 30px 28px; max-width: 420px; width: 100%; justify-self: end; }
.auth-title { font-size: 23px; font-weight: 800; }
.auth-sub { font-size: 13.5px; color: var(--text-mute); margin-top: 4px; margin-bottom: 22px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--text-dim); }
.field input, .field select, .field textarea {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; font-family: inherit; font-size: 14.5px; color: var(--text); outline: none;
  transition: border-color .2s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.field input::placeholder { color: var(--text-mute); }
.btn-block { width: 100%; }
.form-error { color: var(--danger); font-size: 13px; font-weight: 600; min-height: 0; max-height: 0; overflow: hidden; transition: max-height .2s; }
.form-error.show { max-height: 60px; }

.auth-divider { display: flex; align-items: center; gap: 12px; margin: 22px 0 16px; color: var(--text-mute); font-size: 12.5px; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.quick-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quick-btn {
  display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 14px 6px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px;
  font-size: 13px; font-weight: 700; color: var(--text-dim); transition: all .2s;
}
.quick-btn:hover { border-color: var(--accent); color: var(--text); transform: translateY(-2px); }
.quick-btn .q-ico { font-size: 24px; }
.auth-hint { text-align: center; font-size: 12px; color: var(--text-mute); margin-top: 16px; }
.auth-hint code { background: var(--surface-2); padding: 2px 7px; border-radius: 6px; color: var(--accent-2); }

/* ============================================================================
   State blocks (loading / empty / error) + spinner + toast
   ============================================================================ */
.state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 36px 20px; color: var(--text-mute); font-size: 14px; text-align: center; }
.state-ico { font-size: 34px; opacity: .8; }
.state.error { color: var(--danger); }
.spinner { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: sk 1.3s ease infinite; border-radius: 8px; }
@keyframes sk { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

.toast-host { position: fixed; bottom: 22px; inset-inline-start: 22px; z-index: 999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--surface); border: 1px solid var(--border); border-inline-start: 4px solid var(--accent);
  color: var(--text); padding: 13px 18px; border-radius: 12px; box-shadow: var(--shadow);
  font-size: 14px; font-weight: 600; opacity: 0; transform: translateY(12px); transition: all .3s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-bad { border-inline-start-color: var(--danger); }
.toast-warn { border-inline-start-color: var(--warning); }

/* ============================================================================
   Modal
   ============================================================================ */
.modal-scrim { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 60; display: none; backdrop-filter: blur(4px); }
.modal-scrim.open { display: block; }
/* Each formModal call appends a .modal-layer that fills the scrim and centers its .modal.
   Stacked layers are visible behind the top one, giving a native modal-stack feel. */
.modal-layer { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow); width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; padding: 24px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-head h3 { font-size: 18px; font-weight: 800; }
.modal-close { width: 34px; height: 34px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; font-size: 18px; color: var(--text-dim); }
.modal-close:hover { color: var(--text); }

@media (max-width: 900px) {
  .auth-hero { grid-template-columns: 1fr; gap: 28px; padding-top: 10px; }
  .auth-card { justify-self: stretch; max-width: none; }
  .auth-intro { text-align: center; }
  .auth-intro .feat-row { justify-content: center; }
  .auth-intro p { margin-inline: auto; }
}

/* ============================================================================
   Panel views, tables, tiles, misc shared bits
   ============================================================================ */
.view { display: none; animation: fadein .25s ease; }
.view.active { display: block; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.link-action { font-size: 13px; color: var(--accent); font-weight: 700; cursor: pointer; }
.link-action:hover { text-decoration: underline; }

.mini-select, select.mini-select {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 8px 12px; font-family: inherit; font-size: 13.5px; font-weight: 600; outline: none;
}

.table-wrap { overflow-x: auto; }
.table-actions, .tile-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.tile-actions { margin-top: 12px; justify-content: flex-start; }
.cell-user { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }

.pos { color: var(--accent-2); } .neg { color: var(--danger); }

/* tiles (services / cards grid) */
.tile {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 16px; padding: 18px;
  display: flex; flex-direction: column; gap: 6px; transition: border-color .2s, transform .2s;
}
.tile:hover { border-color: var(--accent); transform: translateY(-3px); }
.tile-ico { font-size: 26px; }
.tile-name { font-weight: 800; font-size: 15px; }
.tile-price { margin-top: auto; font-weight: 800; color: var(--accent-2); font-size: 16px; padding-top: 8px; }

/* notification dropdown / bell list */
.notif-panel { position: absolute; top: 54px; inset-inline-end: 0; width: 320px; max-height: 420px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); z-index: 50; padding: 8px; display: none; }
.notif-panel.open { display: block; }
.notif-item { padding: 11px 12px; border-radius: 10px; display: flex; gap: 10px; }
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.notif-item .nico { font-size: 18px; }

/* segmented adherence bar */
.seg-bar { display: flex; height: 14px; border-radius: 20px; overflow: hidden; background: var(--surface-2); }
.seg-bar > span { display: block; transition: width .8s ease; }
.row .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* mini adherence ring (roster rows) */
.mini-ring { --p: 0; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-2) 0); }
.mini-ring > span { width: 28px; height: 28px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; }

/* tasks */
.task-row .task-ico, .row .task-ico { font-size: 20px; width: 26px; text-align: center; }
.icon-btn.sm { width: 32px; height: 32px; font-size: 15px; }

/* plan builder */
.day-block { background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.day-block .list { margin-top: 6px; }

/* modal large + dossier */
.modal-lg { max-width: 620px; }
.mb-1 { margin-bottom: 10px; }
.mini-stat { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 3px; }
.mini-stat > span { font-size: 12px; color: var(--text-mute); }
.mini-stat > b { font-size: 18px; }
.dossier-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.dossier-grid .sub { font-size: 12px; }
.section-title { font-size: 15px; font-weight: 800; margin: 4px 0 10px; }

/* profile / qr */
.profile-head { display: flex; align-items: center; gap: 14px; margin-top: 4px; }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }
.qr-code { display: grid; place-items: center; margin: 10px 0; }
.qr-fallback { width: 120px; height: 120px; border-radius: 16px; background: var(--surface-2); border: 2px dashed var(--border); display: grid; place-items: center; font-size: 40px; }
.invite-code { text-align: center; font-size: 26px; font-weight: 800; letter-spacing: 4px; color: var(--accent-2); background: var(--surface-2); border-radius: 12px; padding: 12px; direction: ltr; }

/* ring fill colour (presentation attrs can't read CSS vars, so set via CSS) */
.ring .fill { stroke: var(--accent); }
.ring .track { stroke: var(--surface-2); }

/* rings centered in cards */
.center-ring, .center-card { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 6px 0; }
.center-card { gap: 4px; }

/* line chart (weight) */
.linechart { width: 100%; }
.linechart svg { width: 100%; height: 170px; display: block; }
.chart-x { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-mute); margin-top: 6px; }

/* macros */
.macro-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.macro { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.macro-ring .ring { --size: 104px; }
.macro-lbl { font-size: 13px; color: var(--text-dim); font-weight: 600; }

@media (max-width: 1024px) { .cols-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px) { .grid.cols-3 { grid-template-columns: 1fr; } .dossier-grid { grid-template-columns: repeat(2, 1fr); } .macro-grid { grid-template-columns: repeat(2, 1fr); } }

/* ============================================================================
   Utilities
   ============================================================================ */
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 10px; } .mt-2 { margin-top: 18px; } .mt-3 { margin-top: 26px; }
.flex { display: flex; } .between { justify-content: space-between; } .center { align-items: center; }
.gap-1 { gap: 10px; } .gap-2 { gap: 18px; }
.muted { color: var(--text-mute); } .dim { color: var(--text-dim); }
.fw-8 { font-weight: 800; } .fz-sm { font-size: 13px; } .fz-lg { font-size: 18px; }
.section-title { font-size: 17px; font-weight: 800; margin: 4px 0 14px; }
.wrap { flex-wrap: wrap; }

/* ============================================================================
   Responsive
   ============================================================================ */
@media (max-width: 1024px) {
  .cols-4 { grid-template-columns: repeat(2, 1fr); }
  .role-cards { grid-template-columns: 1fr; max-width: 420px; }
}

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset-block: 0; inset-inline-start: 0; width: 280px;
    transform: translateX(100%); transition: transform .3s ease;
    box-shadow: var(--shadow);
  }
  /* در LTR منو از سمت چپ بسته می‌شود */
  [dir="ltr"] .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .menu-btn { display: grid; }
  .main { width: 100%; overflow-x: clip; }
  .scrim.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 35; }
  .search { display: none; }
  .topbar { padding: 14px 18px; }
  .content { padding: 18px 18px 90px; }
  .cols-2, .cols-3 { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .cols-4 { grid-template-columns: 1fr; }
  .hero .big { font-size: 24px; }
  .page-title p { display: none; }
  .modal { padding: 18px; border-radius: 16px; }
  /* rows with action buttons: wrap to two lines so buttons don't overflow */
  .row:has(.table-actions) { flex-wrap: wrap; }
  .row:has(.table-actions) .end { margin-inline-start: 0; width: 100%; justify-content: flex-end; }
  .table-actions { gap: 6px; justify-content: flex-end; }
  /* card heads with long titles: allow wrapping */
  .card-head { flex-wrap: wrap; gap: 8px; }
  /* quick-action buttons: slightly smaller on mobile */
  .quick-actions .btn { font-size: 13px; padding: 9px 14px; }
}
