/* «مشاور ریتم»: Ritm's «Midnight Forest» look, made for a phone first. No outside fonts or scripts. */
@font-face { font-family: Vazirmatn; src: url(fonts/Vazirmatn-Regular.ttf) format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url(fonts/Vazirmatn-Bold.ttf) format("truetype"); font-weight: 700; font-display: swap; }
:root {
  --bg: #06100C; --bg2: #0B1A14; --card: rgba(255, 255, 255, .05); --line: rgba(255, 255, 255, .1);
  --text: #E8F3EE; --muted: #93AFA3; --accent: #34D399; --accent-dim: rgba(52, 211, 153, .16); --amber: #F5B942; --red: #F87171;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.7 Vazirmatn, Tahoma, sans-serif; -webkit-text-size-adjust: 100%; }
body { min-height: 100dvh; background: radial-gradient(120% 60% at 100% 0%, rgba(52, 211, 153, .12), transparent 60%), var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
#app { max-width: 760px; margin: 0 auto; padding: max(12px, env(safe-area-inset-top)) 14px calc(84px + env(safe-area-inset-bottom)); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.pad { padding: 32px 0; }
h1 { font-size: 22px; margin: 6px 0 12px; }
h2 { font-size: 17px; margin: 18px 0 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 14px; margin-bottom: 10px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.btn { border: 0; border-radius: 14px; padding: 10px 16px; min-height: 44px; background: var(--accent); color: #04140D; font-weight: 700; cursor: pointer; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--red); border: 1px solid rgba(248, 113, 113, .4); }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.btn.block { width: 100%; }
.field { display: grid; gap: 4px; margin-bottom: 12px; }
.field label { font-size: 14px; color: var(--muted); }
.input { width: 100%; background: rgba(0, 0, 0, .25); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; min-height: 44px; }
.input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.ltr { direction: ltr; text-align: left; }
.code-input { letter-spacing: .5em; text-align: center; font-size: 22px; }
.brand { display: flex; gap: 10px; align-items: center; margin: 28px 0 18px; }
.brand img { width: 52px; height: 52px; border-radius: 14px; }
.brand b { font-size: 22px; display: block; }
.top { display: flex; align-items: center; gap: 10px; margin: 4px 0 10px; }
.top .back { background: none; border: 0; color: var(--text); font-size: 22px; padding: 6px 8px; cursor: pointer; }
.top h1 { margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
nav.tabs { position: fixed; inset: auto 0 0 0; display: flex; justify-content: center; background: rgba(6, 16, 12, .92); backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); z-index: 5; }
nav.tabs a { flex: 1; max-width: 200px; text-align: center; color: var(--muted); text-decoration: none; padding: 8px 4px; border-radius: 12px; font-size: 14px; }
nav.tabs a.on { color: var(--accent); background: var(--accent-dim); font-weight: 700; }
.student { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; text-decoration: none; color: inherit; }
.student .name { font-weight: 700; }
.student .spark { grid-row: span 2; align-self: center; }
.flag { color: var(--amber); }
.off { opacity: .7; }
.badge { display: inline-block; font-size: 12px; border-radius: 999px; padding: 1px 8px; background: var(--accent-dim); color: var(--accent); }
.badge.warn { background: rgba(245, 185, 66, .14); color: var(--amber); }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 10px; }
@media (min-width: 560px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; }
.tile b { display: block; font-size: 20px; }
.seg { display: flex; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 4px; margin-bottom: 10px; }
.seg button { flex: 1; background: none; border: 0; border-radius: 10px; padding: 8px; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--accent-dim); color: var(--accent); font-weight: 700; }
.chart { width: 100%; height: auto; display: block; }
.bars { display: grid; gap: 6px; }
.bar { display: grid; grid-template-columns: minmax(70px, 30%) 1fr auto; gap: 8px; align-items: center; font-size: 14px; }
.bar .track { height: 10px; border-radius: 6px; background: rgba(255, 255, 255, .06); overflow: hidden; }
.bar .fill { height: 100%; border-radius: 6px; background: var(--accent); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: start; }
th { color: var(--muted); font-weight: 400; }
.key-grid { display: grid; gap: 4px; max-height: 50vh; overflow: auto; }
.key-row { display: grid; grid-template-columns: 34px repeat(5, 1fr); gap: 4px; align-items: center; }
.key-row span { text-align: center; color: var(--muted); font-size: 13px; }
.key-row button { min-height: 34px; border-radius: 10px; border: 1px solid var(--line); background: transparent; cursor: pointer; }
.key-row button.on { background: var(--accent); color: #04140D; border-color: var(--accent); font-weight: 700; }
.key-row button.x.on { background: var(--muted); border-color: var(--muted); }
.check { display: flex; gap: 8px; align-items: center; padding: 6px 0; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; }
.switch input { width: 46px; height: 26px; accent-color: var(--accent); }
.progress { height: 8px; background: rgba(255, 255, 255, .08); border-radius: 6px; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
#toast { position: fixed; inset: auto 16px calc(90px + env(safe-area-inset-bottom)) 16px; margin: auto; max-width: 420px; background: #13261D; border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; text-align: center; z-index: 10; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); }
.note { border-color: rgba(245, 185, 66, .4); }
.empty { text-align: center; color: var(--muted); padding: 24px 8px; }
