:root {
  --bg: #f6f5fa; --surface: #fff; --text: #1d1b20; --muted: #6b6775;
  --primary: #6750a4; --on-primary: #fff; --border: #e4e0ec; --nav-h: 64px;
  --font: Vazirmatn, "Segoe UI", Tahoma, "Noto Sans Arabic", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #141218; --surface: #1d1b20; --text: #e6e0e9; --muted: #a9a3b3; --primary: #d0bcff; --on-primary: #381e72; --border: #322f38; }
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.8; min-height: 100vh; }
.shell { display: flex; flex-direction: column; min-height: 100vh; }
.content { flex: 1; padding: 24px 16px calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); max-width: 880px; width: 100%; margin: 0 auto; }
h1 { font-size: 1.4rem; margin-bottom: 8px; }
.muted { color: var(--muted); }
.btn { display: inline-block; margin-top: 16px; padding: 10px 20px; border-radius: 999px; background: var(--primary); color: var(--on-primary); text-decoration: none; min-height: 44px; }
.brand { font-weight: 700; font-size: 1.2rem; padding: 8px 12px 16px; }

/* Mobile first: bottom navigation bar, hidden on the login screen */
.side { position: fixed; inset-inline: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); z-index: 10; }
.side .brand { display: none; }
#nav { display: flex; height: var(--nav-h); }
#nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); text-decoration: none; font-size: .8rem; }
#nav a.active { color: var(--primary); font-weight: 700; }
#nav .ico { width: 22px; height: 22px; border-radius: 50%; background: currentColor; opacity: .35; }
#nav a.active .ico { opacity: 1; }
body[data-screen="login"] .side { display: none; }
body[data-screen="login"] .content { padding-bottom: 24px; }

/* Desktop: right-hand sidebar (RTL), wider content */
@media (min-width: 900px) {
  .shell { flex-direction: row; }
  .side { position: sticky; top: 0; height: 100vh; inset-inline: auto; width: 240px; border-top: 0; border-inline-end: 1px solid var(--border); padding: 16px 8px; }
  .side .brand { display: block; }
  #nav { flex-direction: column; height: auto; gap: 4px; }
  #nav a { flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 10px 12px; border-radius: 12px; font-size: 1rem; }
  #nav a.active { background: color-mix(in srgb, var(--primary) 14%, transparent); }
  .content { padding: 32px; margin: 0; max-width: 960px; }
  body[data-screen="login"] .side { display: block; }
  body[data-screen="login"] #nav { display: none; }
  body[data-screen="login"] .content { margin: 0 auto; }
}
