:root {
  --bg: #0c121c;
  --bg-2: #111827;
  --surface: #172033;
  --surface-2: #1e2a40;
  --line: #2a3950;
  --text: #e8edf5;
  --muted: #8b97ab;
  --accent: #4f6d8c;
  --accent-2: #6b849e;
  --ok: #7a9e8a;
  --err: #c17b74;
  --warn: #c4a46a;
  --shadow: none;
  --radius: 14px;
  --font: "Outfit", "IBM Plex Sans Arabic", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  letter-spacing: 0.01em;
}
body.rtl { direction: rtl; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }

.app-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--bg-2);
  border-inline-end: 1px solid var(--line);
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.brand {
  display: flex; align-items: center; gap: 12px; padding: 6px 8px 16px;
}
.brand-mark {
  width: 48px; height: 48px; border-radius: 10px;
  object-fit: contain; background: transparent; flex-shrink: 0;
}
.brand small { display: block; color: var(--muted); font-size: 12px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px; color: var(--muted);
}
.nav a.active, .nav a:hover { background: var(--surface); color: var(--text); }
.nav .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-2); opacity: 0.45; }
.nav-count {
  margin-inline-start: auto; font-size: 11px; min-width: 18px; height: 18px;
  border-radius: 999px; background: var(--surface-2); color: var(--text);
  display: inline-grid; place-items: center; padding: 0 5px;
}
.nav a.active .dot { opacity: 1; }

.main { min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
  backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 20;
}
.lang-switch {
  display: flex; background: var(--surface); border-radius: 999px; padding: 4px;
  border: 1px solid var(--line);
}
.lang-switch button {
  border: 0; background: transparent; color: var(--muted);
  padding: 6px 12px; border-radius: 999px; cursor: pointer; font-weight: 600;
}
.lang-switch button.on { background: var(--accent); color: var(--text); }
.icon-btn, .btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 12px; padding: 10px 14px; cursor: pointer;
}
.btn.primary { background: var(--accent); color: var(--text); border-color: transparent; font-weight: 700; }
.btn.ghost { background: transparent; }
.btn.danger { background: #c44b4b; color: #fff; border-color: transparent; }
.btn:hover { transform: translateY(-1px); transition: transform 160ms ease; }
.content { padding: 22px; animation: rise 420ms ease; }
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

h1, h2, h3 { font-weight: 650; margin: 0 0 8px; }
.muted { color: var(--muted); }
.grid { display: grid; gap: 14px; }
.grid.stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dash { display: flex; flex-direction: column; gap: 16px; }
.dash-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat small { font-size: 14px; font-weight: 650; color: var(--muted); }
.stat-sub { margin-top: 6px; color: var(--muted); font-size: 12px; }
.dash-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px;
}
.dash-row:last-child { border-bottom: 0; }
.dash-row .portrait { width: 28px; height: 28px; }
.dash h3 { font-size: 13px; color: var(--muted); margin: 16px 0 10px; }
.bars {
  display: flex; align-items: flex-end; gap: 8px; height: 160px;
  padding-top: 8px;
}
.bar-col {
  flex: 1; min-width: 0; height: 100%;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px;
}
.bar-col i {
  display: block; width: 100%; max-width: 36px;
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
}
.bar-col span, .bar-col small { font-size: 11px; }
.heat { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin: 8px 0 18px; }
.heat-cell {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 6px; text-align: center; display: flex; flex-direction: column; gap: 4px; align-items: center;
}
.heat-cell.on { border-color: var(--accent-2); }
.heat-cell i {
  display: block; width: 70%; border-radius: 6px;
  background: rgba(127, 184, 140, 0.85);
}
.mix { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--bg-2); }
.mix b { display: block; height: 100%; }
.mix b.completed { background: #6b7a8c; }
.mix b.scheduled { background: #5aa06e; }
.mix b.cancelled { background: #c44b4b; }
.mix-legend { margin: 10px 0 0; font-size: 12px; }
.mix-legend .dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-inline-end: 4px;
}
.mix-legend .dot.completed { background: #6b7a8c; }
.mix-legend .dot.scheduled { background: #5aa06e; }
.mix-legend .dot.cancelled { background: #c44b4b; }
.hbar { display: grid; grid-template-columns: 88px 1fr 28px; gap: 8px; align-items: center; margin: 6px 0; font-size: 13px; }
.hbar-track { height: 8px; background: var(--bg-2); border-radius: 999px; overflow: hidden; }
.hbar-track b { display: block; height: 100%; background: var(--accent-2); border-radius: 999px; }
.grid.two { grid-template-columns: 1.2fr 0.8fr; }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.stat .value { font-size: 28px; font-weight: 700; }
.stat .label { color: var(--muted); font-size: 13px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: start; padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); font-weight: 600; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 8px; }
input, select, textarea {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line);
  color: var(--text); border-radius: 10px; padding: 12px 14px; min-height: 44px;
  line-height: 1.4;
}
select { cursor: pointer; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent-2);
}
.day-head {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: nowrap;
}
.day-head .day-title { flex: 1; min-width: 0; width: auto; }
.day-head .day-group { width: auto; min-width: 160px; flex: 0 0 auto; }
.day-head .remove-day { flex: 0 0 auto; white-space: nowrap; }
textarea { min-height: 110px; resize: vertical; }
.choice { display: flex; flex-wrap: wrap; gap: 8px; }
.choice label { margin: 0; }
.choice span {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; cursor: pointer;
  background: var(--bg-2); color: var(--text); font-size: 13px;
}
.choice label:has(input:checked) span { border-color: var(--accent-2); background: var(--surface-2); }
.choice input { width: auto; min-height: 0; }
.file-field {
  border: 1px dashed var(--line); border-radius: 10px; padding: 14px;
  background: var(--bg-2);
}
.file-field input[type="file"] { min-height: 0; padding: 0; border: 0; background: transparent; }
.avatar-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px;
}
.avatar-grid label { margin: 0; cursor: pointer; }
.avatar-grid img {
  width: 100%; aspect-ratio: 1; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--line); display: block; background: var(--bg);
}
.avatar-grid input { display: none; }
.avatar-grid input:checked + img { border-color: var(--accent-2); }
.portrait {
  width: 36px; height: 36px; border-radius: 50%; object-fit: cover;
  vertical-align: middle; border: 1px solid var(--line); background: var(--bg-2);
}
.portrait.lg { width: 88px; height: 88px; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs a {
  padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted);
}
.tabs a.on { background: var(--accent); color: var(--text); border-color: transparent; }

.flash {
  margin: 0 22px 0; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface);
}
.flash.ok { border-color: #355c3e; }
.flash.err { border-color: #6c3a34; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.photo-grid img, .inbody-shot { width: 100%; border-radius: 14px; aspect-ratio: 3/4; object-fit: cover; background: #111; }

.suggest-box {
  position: absolute; z-index: 30; min-width: 260px; max-height: 240px; overflow: auto;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow);
}
.suggest-box button {
  display: block; width: 100%; text-align: start; background: transparent; border: 0;
  color: var(--text); padding: 8px 12px; cursor: pointer;
}
.suggest-box button:hover, .suggest-box button.active { background: var(--surface); }
.suggest-box small { color: var(--muted); }

.chat { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow: auto; }
.bubble { max-width: 78%; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); }
.bubble.me { margin-inline-start: auto; background: var(--accent); }
.empty-state { text-align: center; padding: 18px 8px; }
.empty-state p { margin: 0 0 12px; }
.inbox-layout { display: grid; grid-template-columns: minmax(240px, 0.9fr) minmax(0, 1.3fr); gap: 14px; }
.thread-list { padding: 14px; }
.thread {
  display: block; padding: 10px 12px; border-radius: 12px; margin: 0 -4px 6px;
  border: 1px solid transparent;
}
.thread:hover, .thread.on { background: var(--surface-2); border-color: var(--line); }
.thread-top { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.thread-preview { font-size: 13px; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-time { font-size: 12px; margin-top: 2px; }
.thread-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.thread-head h2 { margin: 0; }
.week-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.week-day {
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 8px; min-height: 92px;
  background: var(--bg-2);
}
.week-day.on { border-color: var(--accent-2); background: var(--surface-2); }
.week-pill {
  display: block; font-size: 12px; margin-top: 6px; padding: 4px 6px; border-radius: 8px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  pointer-events: none;
}
.week-pill.scheduled { background: rgba(90, 160, 110, 0.22); color: #8fd4a0; }
.week-pill.completed { background: var(--surface-2); color: var(--muted); }
.week-pill.cancelled { background: rgba(196, 75, 75, 0.22); color: #e08b86; }
.week-pill.noshow { background: var(--surface-2); color: var(--muted); }
.when-picker { cursor: pointer; }
.range { accent-color: var(--accent-2); width: 100%; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.search-bar { max-width: 320px; }
.floor-ex { font-size: 28px; font-weight: 650; margin: 0 0 6px; }
.timer {
  font-variant-numeric: tabular-nums; font-size: 56px; font-weight: 700;
  letter-spacing: 0.04em; color: var(--text);
}
.kbd {
  font-size: 11px; border: 1px solid var(--line); border-radius: 6px;
  padding: 1px 6px; color: var(--muted);
}
.nav-section { color: var(--muted); font-size: 11px; letter-spacing: 0.08em;
  text-transform: uppercase; padding: 10px 12px 4px; }
.data-table th a { color: var(--muted); }
.data-table th a:hover { color: var(--text); }
.package-remain {
  margin-top: 4px;
}
.remain-text {
  width: 6ch; min-height: 0; padding: 0; border: 0; background: transparent;
  color: var(--muted); font-size: 13px; outline: none;
}
.pkg-ledger { display: flex; flex-direction: column; gap: 16px; }
.pkg-client-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  margin-bottom: 14px;
}
.pkg-client-head h2 { margin: 0 0 4px; }
.pkg-kpis {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px;
  margin-bottom: 16px;
}
.pkg-kpi {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px;
}
.pkg-kpi strong { display: block; font-size: 22px; font-weight: 700; }
.pkg-kpi span { color: var(--muted); font-size: 12px; }
.pkg-spent { opacity: 0.55; }

.login-wrap {
  min-height: 100vh; display: flex; padding: 24px;
}
.login-card { width: min(420px, 100%); margin: auto; }
.login-top { display: flex; justify-content: flex-end; }
.login-logo {
  display: block; width: auto; max-width: 100%; max-height: 280px;
  margin: 6px auto 10px; border-radius: 12px;
}
.password-wrap { position: relative; }
.password-wrap input { padding-inline-end: 44px; }
.password-toggle {
  position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; border: 0; background: transparent; color: var(--muted);
  border-radius: 8px; display: grid; place-items: center; cursor: pointer; padding: 0;
}
.password-toggle:hover { color: var(--text); }
.password-toggle svg { width: 18px; height: 18px; display: block; }
.password-toggle .eye-off { display: none; }
.password-toggle.is-visible .eye { display: none; }
.password-toggle.is-visible .eye-off { display: block; }
.remember {
  display: flex; align-items: center; gap: 8px; margin: 2px 0 4px;
  color: var(--text); font-weight: 500; cursor: pointer;
}
.remember input {
  width: 16px; height: 16px; min-height: 0; padding: 0; margin: 0;
  accent-color: var(--accent-2); cursor: pointer;
}

.plan-table input { padding: 8px; }
.day-card { margin-bottom: 14px; }
.menu-toggle { display: none; }

.badge {
  display: inline-flex; padding: 3px 8px; border-radius: 999px; font-size: 12px;
  background: var(--surface-2); color: var(--muted);
}
.badge.ok { color: var(--ok); }
.badge.scheduled { color: #8fd4a0; background: rgba(90, 160, 110, 0.18); }
.badge.completed { color: var(--muted); }
.badge.cancelled { color: #e08b86; background: rgba(196, 75, 75, 0.2); }
.badge.noshow { color: var(--muted); }
.confirm-dialog {
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
  color: var(--text); padding: 20px; max-width: 420px;
}
.confirm-dialog::backdrop { background: rgba(8, 12, 20, 0.65); }
.confirm-dialog p { margin: 0 0 16px; }
.saved-plans-dialog { max-width: 520px; width: min(520px, 92vw); }

.assess-form { max-width: 980px; display: flex; flex-direction: column; gap: 14px; }
.assess-form .card h2 { font-size: 16px; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.assess-emo { font-size: 20px; line-height: 1; }
.assess-step { display: none; }
.assess-step.on {
  display: block;
  animation: assess-in 280ms ease;
}
.assess-form form.dir-prev .assess-step.on { animation-name: assess-in-prev; }
@keyframes assess-in {
  from { opacity: 0; transform: translateX(28px); }
  to { opacity: 1; transform: none; }
}
@keyframes assess-in-prev {
  from { opacity: 0; transform: translateX(-28px); }
  to { opacity: 1; transform: none; }
}
body.rtl .assess-form form.dir-next .assess-step.on { animation-name: assess-in-prev; }
body.rtl .assess-form form.dir-prev .assess-step.on { animation-name: assess-in; }
.assess-nums {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px;
}
.assess-tests {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px;
}
.assess-yesno { display: flex; flex-direction: column; }
.assess-yesno-row {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.assess-yesno-row:last-child { border-bottom: 0; padding-bottom: 0; }
.assess-yesno-row:first-child { padding-top: 0; }
.assess-yesno-row > span { margin: 0; color: var(--text); font-weight: 500; font-size: 14px; }
.assess-actions {
  position: sticky; bottom: 12px; margin: 4px 0 0;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 16px;
}
.assess-view .assess-step { display: block; animation: none; }
.assess-view fieldset { pointer-events: none; }
.assess-sheet-wrap { max-width: 820px; }
.assess-sheet {
  background: #eef2f7;
  color: #141b24;
  padding: 40px 44px 48px;
  border-radius: 6px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
.assess-sheet .sheet-head { text-align: center; margin-bottom: 28px; }
.assess-sheet .sheet-head h1 { margin: 6px 0 8px; font-size: 24px; color: #141b24; }
.assess-sheet .sheet-head .muted { color: #5c6778; }
.assess-sheet section { margin-bottom: 22px; }
.assess-sheet h2 {
  font-size: 14px; margin: 0 0 12px; padding-bottom: 8px;
  border-bottom: 1px solid #c9d2de; color: #141b24;
  display: flex; align-items: center; gap: 8px;
}
.sheet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 28px; }
.sheet-five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.sheet-cell .muted, .sheet-cell > span {
  display: block; font-size: 11px; letter-spacing: 0.05em;
  text-transform: uppercase; color: #6a7584; margin-bottom: 4px; font-weight: 600;
}
.sheet-cell strong { font-size: 15px; font-weight: 650; color: #141b24; }
.sheet-note { margin: 0; white-space: pre-wrap; line-height: 1.6; color: #141b24; }
.assess-sheet table th, .assess-sheet table td { color: #141b24; border-bottom-color: #c9d2de; }
.assess-sheet table th { color: #6a7584; }

@media (max-width: 1200px) {
  .dash-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(280px, 86vw);
    transform: translateX(-105%); z-index: 40; transition: transform 220ms ease;
  }
  body.rtl .sidebar { inset: 0 0 0 auto; transform: translateX(105%); }
  .sidebar.open, body.rtl .sidebar.open { transform: none; }
  .menu-toggle { display: inline-flex; }
  .assess-nums, .assess-tests, .sheet-grid, .sheet-five, .dash-kpis, .pkg-kpis, .grid.two, .grid.three { grid-template-columns: 1fr; }
  .assess-yesno-row { flex-direction: column; align-items: flex-start; }
}
