@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-Medium.ttf) format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url(/fonts/Vazirmatn-Bold.ttf) format("truetype"); font-weight: 700; font-display: swap; }

:root {
  color-scheme: light dark;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --fg: #15181d;
  --muted: #5b6470;
  --line: #dde1e6;
  --accent: #2f6fed;
  --on-accent: #ffffff;
  --danger: #c4302b;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116;
    --surface: #161a21;
    --fg: #e7eaee;
    --muted: #97a0ab;
    --line: #262c35;
    --accent: #5b8cff;
    --on-accent: #0b0e13;
    --danger: #ff6b66;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.7 Vazirmatn, system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
code { font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; padding: 1px 5px; border: 1px solid var(--line); border-radius: 6px; }

/* ---------- login and enroll ---------- */
.screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
}
.card { width: min(360px, 100%); display: grid; gap: 14px; }
.stack { display: grid; gap: 14px; }
.logo { width: 56px; height: 56px; border-radius: 14px; }
h1 { margin: 0; font-size: 22px; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--muted); }
.msg { color: var(--danger); font-size: 14px; }
.note-inline { font-size: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
input {
  font: inherit;
  font-size: 16px;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  min-height: 46px;
}
#code { text-align: center; letter-spacing: .25em; text-transform: uppercase; }
.btn {
  appearance: none;
  border: 0;
  border-radius: 10px;
  min-height: 46px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 500;
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
}
.btn:disabled { opacity: .5; cursor: default; }
.link {
  appearance: none;
  justify-self: start;
  border: 0;
  background: none;
  padding: 6px 0;
  font: inherit;
  color: var(--accent);
  cursor: pointer;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- app ---------- */
#app {
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
}
.bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(env(safe-area-inset-top) + 6px) max(12px, env(safe-area-inset-right)) 6px max(12px, env(safe-area-inset-left));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; min-width: 36px; }
.tabs {
  display: flex;
  margin-inline: auto;
  padding: 2px;
  gap: 2px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.tab {
  appearance: none;
  border: 0;
  background: none;
  border-radius: 8px;
  padding: 5px 16px;
  font: inherit;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
}
.tab[aria-selected="true"] { background: var(--surface); color: var(--fg); box-shadow: 0 0 0 1px var(--line); }
.icon-btn {
  appearance: none;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--fg);
  cursor: pointer;
}
.menu {
  position: absolute;
  top: calc(100% + 6px);
  inset-inline-end: 8px;
  z-index: 10;
  min-width: 180px;
  display: grid;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgb(0 0 0 / .18);
}
.menu-head { padding: 6px 10px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu button {
  appearance: none;
  border: 0;
  background: none;
  text-align: start;
  padding: 8px 10px;
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  color: var(--fg);
  cursor: pointer;
}
.menu button:hover { background: var(--bg); }
.pane { position: relative; min-height: 0; padding-bottom: env(safe-area-inset-bottom); background: #000; }
.pane iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.note {
  height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  background: var(--bg);
}
