/*
  ITEK student portal — the look. Colours, sizes and shapes copied from
  Claude Design's 5 Nov 2026 mockup (colour option B). Nothing here is
  loaded from another website: the phone's own fonts only.

  Colours are named once, as "tokens" (--accent, --card, …), and used
  everywhere by name. Dark mode just gives the same names other values, so
  no screen can be left white on a dark phone.
*/

:root {
  --page:#eceff2; --card:#ffffff; --card2:#f2f4f6; --input:#ffffff;
  --line:#dfe3e7; --line2:#cbd2d8; --text:#141a1f; --muted:#58626b;
  --accent:#17834a; --onAccent:#ffffff; --accentText:#126b3c;
  --accentSoft:#e5f3ea; --accentLine:#bfe0cc;
  --warnBg:#fbf3e3; --warnLine:#ecd9b0; --warnText:#5c4210; --warnSolid:#b7791f;
  --errBg:#fbeee6; --errLine:#efcfbd; --errText:#8a3a18;
  --overlay:rgba(12,20,16,.45); --handle:#cbd2d8;
  --brand:#17834a; --onBrand:#ffffff; --brandMuted:#ffffff; /* 85% white was 3.9:1 on this green; full white is 4.8:1 */
  --brandBtn:rgba(255,255,255,.18);
  --shadow:0 1px 2px rgba(16,24,32,.05), 0 6px 16px rgba(16,24,32,.06);
  --mono:ui-monospace,'SF Mono',Menlo,Consolas,'Roboto Mono',monospace;
  color-scheme: light;
}
/* Dark: when the phone asks for it (unless the student chose light), or
   when the student chose dark with the switch. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page:#0e1215; --card:#161b20; --card2:#1c232a; --input:#12171b;
    --line:#262e35; --line2:#36404a; --text:#e7ebee; --muted:#9aa4ad;
    --accent:#3bb873; --onAccent:#04140b; --accentText:#66d497;
    --accentSoft:#143322; --accentLine:#1f4d33;
    --warnBg:#2a2213; --warnLine:#4d3c18; --warnText:#f0d49c; --warnSolid:#e0a63a;
    --errBg:#2c1913; --errLine:#57301f; --errText:#f4b8a2;
    --overlay:rgba(0,0,0,.6); --handle:#36404a;
    --brand:#103d27; --onBrand:#e8f5ed; --brandMuted:rgba(232,245,237,.75);
    --brandBtn:rgba(255,255,255,.09); --shadow:none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --page:#0e1215; --card:#161b20; --card2:#1c232a; --input:#12171b;
  --line:#262e35; --line2:#36404a; --text:#e7ebee; --muted:#9aa4ad;
  --accent:#3bb873; --onAccent:#04140b; --accentText:#66d497;
  --accentSoft:#143322; --accentLine:#1f4d33;
  --warnBg:#2a2213; --warnLine:#4d3c18; --warnText:#f0d49c; --warnSolid:#e0a63a;
  --errBg:#2c1913; --errLine:#57301f; --errText:#f4b8a2;
  --overlay:rgba(0,0,0,.6); --handle:#36404a;
  --brand:#103d27; --onBrand:#e8f5ed; --brandMuted:rgba(232,245,237,.75);
  --brandBtn:rgba(255,255,255,.09); --shadow:none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--page); color: var(--text); }
body {
  font-family: system-ui,-apple-system,'Segoe UI',Roboto,'Helvetica Neue',Arial,sans-serif;
  font-size: 15px; line-height: 1.4;
}
a { color: var(--accentText); }
[hidden] { display: none !important; }
/* Present for screen readers, invisible on screen. */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
           overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
button { font-family: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }

.app { max-width: 480px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }

/* ---- Header ---- */
.top { background: var(--brand); color: var(--onBrand); border-radius: 0 0 24px 24px;
       padding: 18px 16px; display: flex; flex-direction: column; gap: 14px; }
.top-row { display: flex; align-items: center; gap: 10px; }
.round { width: 44px; height: 44px; flex-shrink: 0; border-radius: 999px; border: none;
         background: var(--brandBtn); color: var(--onBrand); display: flex;
         align-items: center; justify-content: center; padding: 0; font-size: 22px; line-height: 1; }
.brand { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.brand-name { display: flex; align-items: baseline; gap: 6px; }
.brand-name b { font-weight: 800; font-size: 20px; letter-spacing: -0.02em; }
.brand-name span, .brand-site { font-size: 13px; color: var(--brandMuted); }
.brand-site { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-title h1 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.top-title div { color: var(--brandMuted); }
.icon-sun, .icon-moon { display: none; }
.show-sun .icon-sun, .show-moon .icon-moon { display: block; }

/* ---- Screens ---- */
main { flex: 1; }
.screen { padding: 18px 16px 24px; display: flex; flex-direction: column; gap: 14px; }
.screen h1 { margin: 0; font-size: 26px; letter-spacing: -0.02em; }
.head { display: flex; flex-direction: column; gap: 4px; }
.sub, .muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.mono { font-family: var(--mono); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.pad { padding: 18px 16px; }
.list { display: flex; flex-direction: column; gap: 1px; background: var(--line);
        border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); overflow: hidden; }
.row-btn { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 64px;
           padding: 12px 12px 12px 16px; background: var(--card); border: none; text-align: left; }
.row-btn.off { opacity: .5; cursor: default; }
.plan-size { width: 80px; flex-shrink: 0; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.plan-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.plan-price { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-weight: 700; font-size: 16px; }
.badge { font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 999px;
         background: var(--accent); color: var(--onAccent); letter-spacing: .03em; }
.buy-pill { height: 38px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--accentLine);
            background: var(--accentSoft); color: var(--accentText); font-weight: 700; font-size: 14px;
            display: flex; align-items: center; flex-shrink: 0; }
.sold { font-size: 13px; font-weight: 700; color: var(--muted); padding: 0 6px; flex-shrink: 0; }

.details { padding: 2px 16px; }
.details div { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0;
               border-bottom: 1px solid var(--line); }
.details div:last-child { border-bottom: none; }
.details span:first-child { color: var(--muted); }
.details span:last-child { font-weight: 600; text-align: right; }

.big-ref { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 20px 16px; }
.big-ref .mono { font-size: 22px; font-weight: 600; letter-spacing: .04em; word-break: break-all; text-align: center; }
.code-box { padding: 20px 16px 16px; display: flex; flex-direction: column; align-items: center; gap: 12px;
            border-bottom: 1px dashed var(--line2); }
.code-big { font-family: var(--mono); font-size: 38px; font-weight: 650; letter-spacing: .1em; padding-left: .1em; }

.note { border-radius: 16px; padding: 12px 14px; font-size: 14px; line-height: 1.45; }
.warn { background: var(--warnBg); border: 1px solid var(--warnLine); color: var(--warnText); }
.err  { background: var(--errBg);  border: 1px solid var(--errLine);  color: var(--errText); }

/* ---- Buttons ---- */
.btn { height: 54px; border-radius: 999px; border: none; background: var(--accent); color: var(--onAccent);
       font-size: 16px; font-weight: 700; width: 100%; flex-shrink: 0; display: flex;
       align-items: center; justify-content: center; text-decoration: none; }
.btn:disabled { opacity: .7; }
.btn2 { height: 48px; border-radius: 999px; border: 1px solid var(--line2); background: var(--card);
        color: var(--text); font-size: 15px; font-weight: 600; width: 100%; flex-shrink: 0; }
.chip { height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line2);
        background: var(--card2); font-size: 14px; font-weight: 600; }
.link { min-height: 44px; background: none; border: none; color: var(--accentText);
        font-size: 15px; font-weight: 600; padding: 0 8px; align-self: center; }
.link.left { align-self: flex-start; padding: 0; font-size: 14px; }
.danger { color: var(--errText); background: none; border: none; height: 44px; padding: 0 16px;
          font-size: 14px; font-weight: 600; }

/* ---- Forms ---- */
label.field { display: flex; flex-direction: column; gap: 6px; }
label.field > span { font-size: 14px; font-weight: 600; }
input { height: 52px; border-radius: 14px; border: 1px solid var(--line2); background: var(--input);
        color: var(--text); font-family: inherit; font-size: 17px; padding: 0 16px; width: 100%; }
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
input.code-in { font-family: var(--mono); font-size: 18px; letter-spacing: .06em; text-transform: uppercase; }
input.ref-in { font-family: var(--mono); font-size: 16px; text-transform: uppercase; }

/* ---- Confirming ---- */
.wait { padding: 64px 24px 24px; align-items: center; text-align: center; gap: 18px; }
.spinner { width: 48px; height: 48px; border-radius: 50%; border: 4px solid var(--line);
           border-top-color: var(--accent); animation: itekspin .9s linear infinite; }
@keyframes itekspin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

/* ---- Result: plain states ---- */
.tag { font-size: 13px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.plain-msg { font-size: 22px; font-weight: 650; line-height: 1.3; }

/* ---- Connect ---- */
.steps { padding: 6px 16px; }
.step { display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; }
.step-n { width: 30px; height: 30px; flex-shrink: 0; border-radius: 999px; background: var(--accentSoft);
          color: var(--accentText); border: 1px solid var(--accentLine); font-weight: 700; font-size: 14px;
          display: flex; align-items: center; justify-content: center; }
.step-t { padding-top: 4px; font-size: 16px; }
.tip { background: var(--card2); border: 1px solid var(--line); border-radius: 16px; padding: 14px;
       display: flex; flex-direction: column; gap: 4px; }
.code-row { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px; border-radius: 16px; }

/* ---- Balance ---- */
.bal-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.pill { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.pill.active { background: var(--accentSoft); color: var(--accentText); }
.pill.low { background: var(--warnBg); color: var(--warnText); }
.pill.up, .pill.refunded { background: var(--errBg); color: var(--errText); }
.pill.plain, .pill.owed { background: var(--card2); color: var(--muted); }
.bal-left { font-size: 40px; font-weight: 750; letter-spacing: -0.03em; }
.bar { height: 12px; border-radius: 999px; background: var(--card2); border: 1px solid var(--line); overflow: hidden; }
.bar > div { height: 100%; background: var(--accent); border-radius: 999px; }
.bar.low > div { background: var(--warnSolid); }
.bal-foot { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; flex-wrap: wrap; }
.stale { color: var(--warnText); font-weight: 700; }
.saved-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.saved-chips button { height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line2);
                      background: var(--card); font-family: var(--mono); font-size: 14px; }

/* ---- History ---- */
.month-head { display: flex; justify-content: space-between; padding: 6px 4px 0; font-size: 14px; }
.purchase { background: var(--card); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.p-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.p-masked { display: flex; gap: 12px; font-family: var(--mono); font-size: 12px; color: var(--muted); flex-wrap: wrap; }

/* ---- Bottom tabs ---- */
.tabs { position: sticky; bottom: 0; display: flex; border-top: 1px solid var(--line);
        background: var(--card); padding: 0 8px 14px; }
.tabs button { flex: 1; height: 58px; background: none; border: none; font-size: 14px; font-weight: 500;
               color: var(--muted); display: flex; flex-direction: column; align-items: center;
               justify-content: center; gap: 5px; }
.tabs button::before { content: ""; width: 22px; height: 4px; border-radius: 999px; background: transparent; }
.tabs button.on { color: var(--accentText); font-weight: 700; }
.tabs button.on::before { background: var(--accent); }

/* ---- Bottom sheets ---- */
.sheet-wrap { position: fixed; inset: 0; z-index: 20; background: var(--overlay); display: flex;
              flex-direction: column; justify-content: flex-end; }
.sheet { background: var(--card); border-top: 1px solid var(--line); border-radius: 26px 26px 0 0;
         padding: 10px 18px 22px; display: flex; flex-direction: column; gap: 14px; max-height: 92%;
         overflow-y: auto; width: 100%; max-width: 480px; margin: 0 auto; }
.handle { width: 40px; height: 5px; border-radius: 999px; background: var(--handle); align-self: center; flex-shrink: 0; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sheet-head span { font-size: 20px; font-weight: 700; }
.sheet .details { background: var(--card2); border: 1px solid var(--line); border-radius: 16px; padding: 2px 14px; }
.amount-big { font-size: 22px !important; font-weight: 750 !important; }

/* Muse, 28 Nov 2026: per-GB price that stands out */
.per-gb { color: var(--accentText); font-weight: 700; }

/* Muse, 28 Nov 2026: icon tab bar (icon above label, like banking apps) */
.tabs button { height: 64px; gap: 4px; font-size: 13px; }
.tabs button::before { display: none; }
.tabs .ti { width: 26px; height: 26px; }
.tabs button.on .ti { stroke-width: 1.8; }

/* Admin shortcut: stop 3 quick taps on the logo selecting/copying text (Muse, 29 Nov) */
.brand-name { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

/* Get the ITEK app (Muse, 29 Nov): gentle swing so students notice it */
.app-cta { border: 1px solid var(--accentLine); }
.app-cta-icon { width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
                transform-origin: 50% 0; animation: itekswing 4s ease-in-out infinite; }
@keyframes itekswing { 0%, 70%, 100% { transform: rotate(0); } 76% { transform: rotate(12deg); }
                       82% { transform: rotate(-10deg); } 88% { transform: rotate(6deg); } 94% { transform: rotate(-3deg); } }
@media (prefers-reduced-motion: reduce) { .app-cta-icon { animation: none; } }
#a2-chrome .btn { display: flex; align-items: center; justify-content: center; margin-top: 10px; text-decoration: none; }
.app-pop-icon { display: block; width: 72px; height: 72px; margin: 6px auto 10px; border-radius: 18px;
                transform-origin: 50% 0; animation: itekswing 2.6s ease-in-out infinite; }
#app-pop .btn { width: 100%; margin-top: 16px; }
#app-pop .link { width: 100%; }
@media (prefers-reduced-motion: reduce) { .app-pop-icon { animation: none; } }
#app-pop .sheet-head { justify-content: center; text-align: center; }

/* ---- New ITEK logo (Muse, 29 Nov): white "itek" wordmark with lime i-dot ---- */
.brand-name { align-items: center; }
.brand-name .wm { height: 30px; width: auto; color: #fff; display: block; }
.app-cta-icon, .app-pop-icon { box-shadow: 0 0 0 1px var(--line), 0 2px 6px rgba(0,0,0,.08); }

/* ---- Friend codes (referrals, 29 Nov 2026) ---- */
.ok { background: var(--accentSoft); border: 1px solid var(--accentLine); color: var(--accentText); }
.ref-card { display: flex; flex-direction: column; gap: 10px; }
.ref-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.ref-code { font-family: var(--mono); font-size: 30px; font-weight: 650; letter-spacing: .08em; text-align: center;
            padding: 12px; border: 1px dashed var(--accentLine); border-radius: 14px;
            background: var(--accentSoft); color: var(--accentText); }
.ref-link { text-align: center; font-family: var(--mono); word-break: break-all; }
.ref-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
a.chip { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; color: var(--text); }
.chip.wa { background: var(--accent); border-color: var(--accent); color: var(--onAccent); }
.ref-free { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.reward-code { display: flex; justify-content: space-between; align-items: center; gap: 10px;
               font-family: var(--mono); font-size: 18px; font-weight: 650; letter-spacing: .06em; }
.reward-code .chip { height: 34px; padding: 0 14px; font-size: 13px; letter-spacing: 0; font-family: inherit; }
.code-big.bonus { font-size: 32px; }
.bonus-sub { padding: 0 16px 16px; }
.ref-actions .chip { padding: 0 10px; white-space: nowrap; }

/* Invite card on "You're set" (29 Nov 2026 evening) — sits under the code */
.inv-card { gap: 8px; }
.inv-card .ref-code { font-size: 24px; }
.inv-actions { grid-template-columns: 3fr 2fr; }

/* Invite on Home (30 Nov 2026) — slim card under "Your codes are saved" */
.home-inv { border: 1px solid var(--accentLine); }
a.buy-pill { text-decoration: none; }
