/* SW Bot: Wael's brand (black / gold / white / gray, Cairo + Montserrat). Shared by the app and the admin page. */
@font-face { font-family: Cairo; font-weight: 700; src: url("/fonts/cairo-arabic-700-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: Cairo; font-weight: 900; src: url("/fonts/cairo-arabic-900-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: Cairo; font-weight: 700; src: url("/fonts/cairo-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF; }
@font-face { font-family: Cairo; font-weight: 900; src: url("/fonts/cairo-latin-900-normal.woff2") format("woff2"); unicode-range: U+0000-00FF; }
@font-face { font-family: Montserrat; font-weight: 800; src: url("/fonts/montserrat-latin-800-normal.woff2") format("woff2"); }

:root { --bg: #0D0D0D; --card: #151515; --card2: #1C1C1C; --line: #2A2A2A; --gold: #F5B301; --white: #FFFFFF; --gray: #B6B6B6; --red: #FF5A4E; --green: #3DDC84; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--white); font: 700 16px/1.6 Cairo, system-ui, sans-serif; }
body { min-height: 100vh; min-height: 100dvh; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
a { color: var(--gold); }

.wrap { max-width: 560px; margin: 0 auto; padding: 0 16px calc(96px + env(safe-area-inset-bottom)); }
header.top { position: sticky; top: 0; z-index: 5; background: rgba(13,13,13,.94); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 0 10px; }
.brand { font-family: Montserrat, sans-serif; font-weight: 800; font-size: 20px; letter-spacing: .5px; direction: ltr; }
.brand b { color: var(--gold); }
.iconBtn { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 14px; height: 42px; padding: 0 14px; display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.badge { position: absolute; top: -6px; left: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 99px; background: var(--red); color: #fff; font-size: 12px; display: grid; place-items: center; font-family: Montserrat, sans-serif; }

h1 { font-size: 26px; font-weight: 900; margin: 6px 0 4px; line-height: 1.3; }
h2 { font-size: 19px; font-weight: 900; margin: 22px 0 10px; }
h3 { font-size: 17px; font-weight: 900; margin: 0 0 6px; }
.muted { color: var(--gray); font-size: 14px; }
.small { font-size: 12.5px; }
.gold { color: var(--gold); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px; margin: 12px 0; }
.card.goldLine { border-color: rgba(245,179,1,.45); }
.btn { display: block; width: 100%; border: 0; border-radius: 14px; padding: 13px; background: var(--gold); color: #0D0D0D; font-weight: 900; font-size: 16px; margin-top: 10px; text-align: center; text-decoration: none; }
.btn.ghost { background: transparent; color: var(--gold); border: 1px solid rgba(245,179,1,.5); }
.btn.dark { background: var(--card2); color: var(--white); border: 1px solid var(--line); }
.btn.red { background: transparent; color: var(--red); border: 1px solid rgba(255,90,78,.5); }
.btn:disabled { opacity: .5; cursor: default; }
.btnRow { display: flex; gap: 8px; flex-wrap: wrap; }
.btnRow .btn { flex: 1; min-width: 110px; }

label.f { display: block; margin-top: 12px; font-size: 14px; color: var(--gray); }
input[type=text], input[type=password], input[type=email], input[type=tel], input[type=url], textarea { width: 100%; background: #101010; border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-top: 6px; outline: none; }
textarea { resize: vertical; min-height: 80px; }
input:focus, textarea:focus { border-color: var(--gold); }
.ltr { direction: ltr; text-align: left; }
.err { color: var(--red); font-size: 14px; margin-top: 8px; min-height: 1em; }
.check { display: flex; gap: 10px; align-items: flex-start; margin-top: 16px; font-size: 14px; }
.check input { width: 22px; height: 22px; accent-color: var(--gold); flex: none; margin-top: 2px; }
.linkBtn { background: none; border: 0; color: var(--gold); text-decoration: underline; padding: 0; font-weight: 900; }

/* Bottom tabs */
nav.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; background: rgba(13,13,13,.97); border-top: 1px solid var(--line);
  display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom); }
nav.tabs .in { display: flex; width: 100%; max-width: 560px; }
nav.tabs button { flex: 1; background: none; border: 0; padding: 10px 4px 12px; color: var(--gray); font-size: 13px; display: flex; flex-direction: column; align-items: center; gap: 2px; position: relative; }
nav.tabs button .ic { font-size: 22px; line-height: 1.1; filter: grayscale(1); opacity: .7; }
nav.tabs button.on { color: var(--gold); }
nav.tabs button.on .ic { filter: none; opacity: 1; }
nav.tabs .badge { top: 4px; left: calc(50% - 26px); }

/* Popup */
.sheet { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.78); display: flex; align-items: flex-end; justify-content: center; padding: 0 12px; }
.sheet .box { width: 100%; max-width: 560px; background: var(--card); border: 1px solid rgba(245,179,1,.45); border-radius: 22px 22px 0 0; padding: 20px 18px calc(18px + env(safe-area-inset-bottom)); max-height: 88vh; overflow-y: auto; }
.sheet ul { padding-inline-start: 18px; margin: 10px 0; }
.sheet li { margin: 6px 0; }

/* Chat */
.chat { display: flex; flex-direction: column; gap: 8px; padding: 8px 0 12px; }
.msg { max-width: 84%; padding: 9px 13px; border-radius: 16px; white-space: pre-wrap; word-wrap: break-word; }
.msg.me { align-self: flex-start; background: var(--gold); color: #0D0D0D; border-start-start-radius: 4px; }
.msg.them { align-self: flex-end; background: var(--card2); border-start-end-radius: 4px; }
.msg time { display: block; font-size: 11px; opacity: .65; margin-top: 2px; }
.composer { display: flex; gap: 8px; position: sticky; bottom: calc(76px + env(safe-area-inset-bottom)); background: var(--bg); padding: 8px 0; }
.composer textarea { min-height: 48px; height: 48px; margin: 0; flex: 1; }
.composer button { width: 52px; flex: none; border: 0; border-radius: 14px; background: var(--gold); color: #0D0D0D; font-size: 20px; font-weight: 900; }
.empty { text-align: center; color: var(--gray); padding: 30px 10px; font-size: 14px; }

/* State screens */
.state { text-align: center; padding: 40px 10px 10px; }
.state .big { font-size: 64px; line-height: 1; margin-bottom: 10px; }

/* Course + training */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: s; display: flex; flex-direction: column; gap: 8px; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 34px 1fr; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.steps li::before { content: counter(s); font-family: Montserrat, sans-serif; font-weight: 800; font-size: 22px; color: var(--gold); text-align: center; line-height: 1.3; }
.steps.plain li { grid-template-columns: 1fr; }
.steps.plain li::before { content: none; }
.steps b { display: block; }
.steps span { color: var(--gray); font-size: 14px; display: block; }
.src { font-size: 12px; color: #8a7a4a; margin: 6px 0 0; }
.formula { background: var(--card2); border: 1px solid rgba(245,179,1,.45); border-radius: 12px; padding: 10px 12px; margin: 8px 0; color: var(--gold); text-align: center; }
.ex { border-radius: 12px; padding: 8px 12px; margin: 8px 0; font-size: 15px; }
.ex small { display: block; font-size: 12px; font-weight: 900; }
.ex.bad { background: #26140f; border: 1px solid #5a2f24; } .ex.bad small { color: var(--red); }
.ex.good { background: #10241a; border: 1px solid #24513a; } .ex.good small { color: var(--green); }
.extra { background: var(--card2); border-inline-start: 3px solid var(--gold); border-radius: 10px; padding: 8px 12px; margin: 8px 0; font-size: 14.5px; }
.lesson.done { border-color: rgba(61,220,132,.45); }
.lesson h3 small { float: left; color: var(--green); font-size: 13px; }
.quiz { border-top: 1px dashed var(--line); margin-top: 12px; padding-top: 12px; }
.opt { display: block; width: 100%; text-align: start; background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.opt:disabled { cursor: default; }
.opt.right { border-color: var(--green); background: #10241a; }
.opt.wrong { border-color: var(--red); background: #26140f; }
.why { font-size: 14px; color: var(--gray); margin: 6px 0; }
.said { background: var(--card2); border-radius: 16px; border-start-start-radius: 4px; padding: 10px 14px; margin: 10px 0 14px; font-size: 17px; }
.bar { height: 8px; border-radius: 99px; background: var(--card2); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--gold); border-radius: 99px; transition: width .4s; }
.pick { display: flex; justify-content: space-between; align-items: center; width: 100%; text-align: start; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 8px; }
.pick small { color: var(--gray); font-size: 13px; }
.score { font-family: Montserrat, sans-serif; font-weight: 800; font-size: 56px; color: var(--gold); line-height: 1.1; }

/* Admin */
.seg { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0 8px; }
/* Bot section menu: every part visible at once, as tiles (4 per row) */
.subnav { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0 6px; }
.subnav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 68px; padding: 8px 4px;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; color: var(--gray); font-size: 12.5px; line-height: 1.25; text-align: center; }
.subnav button .ic { font-size: 22px; line-height: 1; }
.subnav button.on { background: rgba(245,179,1,.12); border-color: var(--gold); color: var(--gold); }
@media (max-width: 340px) { .subnav { grid-template-columns: repeat(3, 1fr); } }
.seg button { flex: none; background: var(--card); border: 1px solid var(--line); border-radius: 99px; padding: 6px 14px; font-size: 14px; color: var(--gray); }
.seg button.on { color: #0D0D0D; background: var(--gold); border-color: var(--gold); }
.person .top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.person .user { font-family: Montserrat, Cairo, sans-serif; font-size: 13px; color: var(--gray); direction: ltr; }
.pill { font-size: 12px; padding: 1px 10px; border-radius: 99px; border: 1px solid var(--line); color: var(--gray); white-space: nowrap; }
.pill.pending { color: var(--gold); border-color: rgba(245,179,1,.5); }
.pill.active { color: var(--green); border-color: rgba(61,220,132,.5); }
.pill.suspended, .pill.rejected { color: var(--red); border-color: rgba(255,90,78,.5); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 4px; }
.stats div { background: var(--card2); border-radius: 12px; padding: 6px; text-align: center; font-size: 12px; color: var(--gray); }
.stats b { display: block; color: var(--white); font-size: 18px; font-family: Montserrat, sans-serif; }
.nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.nums div { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 10px; text-align: center; font-size: 13px; color: var(--gray); }
.nums b { display: block; font-size: 28px; color: var(--gold); font-family: Montserrat, sans-serif; line-height: 1.3; }
.linkBox { direction: ltr; text-align: left; background: #101010; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-family: Montserrat, sans-serif; font-size: 13px; word-break: break-all; }
.switchRow { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.switchRow:last-child { border-bottom: 0; }
.switch { width: 52px; height: 30px; border-radius: 99px; background: #333; border: 0; position: relative; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; border-radius: 50%; background: #888; transition: .2s; }
.switch.on { background: rgba(245,179,1,.3); }
.switch.on::after { right: 25px; background: var(--gold); }
.threadRow { display: flex; justify-content: space-between; align-items: center; width: 100%; text-align: start; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 8px; position: relative; }
.toast { position: fixed; bottom: calc(90px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); background: var(--white); color: #0D0D0D; padding: 8px 16px; border-radius: 99px; z-index: 40; font-size: 14px; }

/* 🧠 compact Gemini key line */
.keyLine { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.keyLine b { display: block; }
.keyChange { width: auto; flex: 0 0 auto; padding: 8px 16px; margin: 0; }
.subnav.two { grid-template-columns: repeat(2, 1fr); }
/* 📣 broadcast picker */
.pickTop { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.pickTop span { flex: 1; }
.pickRow { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); cursor: pointer; }
.pickRow input { width: 22px; height: 22px; flex: 0 0 auto; accent-color: var(--gold); margin: 0; }
.pickRow.off { opacity: .45; cursor: default; }
/* 📞 coming soon */
.soon { display: inline-block; background: var(--gold); color: #0D0D0D; font-weight: 900; font-size: 12px; border-radius: 99px; padding: 2px 10px; margin-bottom: 6px; }
.soonList { margin: 6px 0 0; padding-inline-start: 0; list-style: none; display: grid; gap: 8px; }
