/* ===== VEDC Hub — mobile ===== */
@font-face { font-family: "Plex Arabic"; src: url(core/fonts/PlexArabic-400.woff2) format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: "Plex Arabic"; src: url(core/fonts/PlexArabic-600.woff2) format("woff2"); font-weight: 600; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: "Plex Arabic"; src: url(core/fonts/PlexArabic-700.woff2) format("woff2"); font-weight: 700 900; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }

:root {
  --bg: #f5f6fb; --surface: #fff; --surface-2: #f3f5fa; --line: #e7eaf1; --line-2: #eef1f6;
  --text: #16181d; --dim: #5b6472; --mute: #8a93a3;
  --primary: #5b5bf0; --primary-700: #3a36c9; --primary-50: #eef0fe;
  --grad: linear-gradient(135deg, #6366f1 0%, #4f46e5 55%, #4338ca 100%);
  --teal: #0d9488; --teal-50: #e6f6f4;
  --ok: #15914b; --ok-50: #e7f6ee; --warn: #b7791f; --warn-50: #fff6e5; --warn-line: #ffd99a;
  --amber: #f59e0b; --danger: #dc2b3d; --danger-50: #fdeced; --susp: #7c3aed; --susp-50: #f3edff;
  --r: 16px; --r-lg: 20px;
  --sh: 0 1px 2px rgba(20,24,40,.05), 0 2px 8px rgba(20,24,40,.05);
  --sh-lg: 0 18px 50px rgba(28,32,60,.22);
  --ease: cubic-bezier(.3,.7,.2,1);
  --top: env(safe-area-inset-top, 0px); --bot: env(safe-area-inset-bottom, 0px);
  --tabs-h: 62px;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Inter, "Plex Arabic", sans-serif;
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
}
[dir=rtl] body { font-family: "Plex Arabic", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
bdi { unicode-bidi: isolate; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 6px;
  padding: calc(var(--top) + 8px) 12px 8px; min-height: calc(var(--top) + 58px);
  background: rgba(245,246,251,.86); backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
  border-bottom: 1px solid transparent; transition: border-color .2s;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.tb-title { flex: 1; min-width: 0; padding-inline-start: 4px; }
.tb-title small { display: block; font-size: 12.5px; font-weight: 600; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-title b { display: block; font-size: 25px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-back, .tb-btn {
  flex: none; width: 42px; height: 42px; border-radius: 14px; border: 0; background: transparent;
  display: grid; place-items: center; font-size: 30px; line-height: 1; color: var(--primary);
}
.tb-back { font-size: 36px; margin-inline-start: -8px; }
[dir=rtl] .tb-back { transform: scaleX(-1); }
.tb-btn { background: var(--surface); box-shadow: var(--sh); font-size: 20px; }
.tb-btn:active, .tb-back:active { transform: scale(.94); }
[dir=rtl] .tb-back:active { transform: scaleX(-1) scale(.94); }
.tb-btn.spin .tb-ic { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.statusline { margin: 0 16px 6px; font-size: 12.5px; font-weight: 600; color: var(--dim); display: flex; align-items: center; gap: 6px; }
.statusline::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--mute); flex: none; }
.statusline.ok::before { background: var(--ok); }
.statusline.warn { color: var(--warn); } .statusline.warn::before { background: var(--amber); }
.statusline.bad { color: var(--danger); } .statusline.bad::before { background: var(--danger); }

/* ---------- main ---------- */
main { padding: 4px 16px calc(var(--tabs-h) + var(--bot) + 28px); outline: none; max-width: 640px; margin: 0 auto; }
.view.enter > * { animation: rise .32s var(--ease) both; }
.view.enter > *:nth-child(2) { animation-delay: .03s; } .view.enter > *:nth-child(3) { animation-delay: .06s; }
.view.enter > *:nth-child(4) { animation-delay: .09s; } .view.enter > *:nth-child(n+5) { animation-delay: .12s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .view.enter > * { animation: none; } .tb-btn.spin .tb-ic { animation: none; } }

.sec { display: flex; align-items: center; gap: 8px; margin: 22px 4px 10px; }
.sec h2 { margin: 0; font-size: 13px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--mute); flex: 1; }
[dir=rtl] .sec h2 { letter-spacing: 0; font-size: 14px; }
.sec .count { font-size: 12px; font-weight: 800; color: var(--dim); background: var(--surface-2); border-radius: 999px; padding: 2px 9px; }
.sec .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.note { font-size: 13px; color: var(--dim); margin: -4px 4px 10px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); }
.pad { padding: 14px 16px; }
.empty { text-align: center; padding: 30px 20px; }
.empty .big { font-size: 38px; margin-bottom: 6px; }
.empty .t { font-size: 17px; font-weight: 800; }
.empty .d { color: var(--dim); margin: 6px 0 16px; font-size: 14px; }

/* ---------- buttons ---------- */
.btn {
  min-height: 46px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface);
  font-weight: 750; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .12s var(--ease), background .15s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; }
.btn.primary { background: var(--grad); color: #fff; border: 0; box-shadow: 0 8px 20px rgba(79,70,229,.3); }
.btn.danger { color: var(--danger); background: var(--danger-50); border-color: transparent; }
.btn.ghost { background: var(--surface-2); border-color: transparent; }
.btn.sm { min-height: 38px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.btn.block { width: 100%; }
.btnrow { display: flex; gap: 10px; flex-wrap: wrap; }
.btnrow .btn { flex: 1; }

/* ---------- now hero ---------- */
.hero {
  background: var(--grad); color: #fff; border-radius: var(--r-lg); padding: 18px 18px 16px;
  box-shadow: 0 14px 30px rgba(71,71,224,.32); position: relative; overflow: hidden;
}
.hero::after { content: ""; position: absolute; inset-inline-end: -40px; top: -60px; width: 180px; height: 180px; border-radius: 50%; background: rgba(255,255,255,.08); }
.hero.sub { background: linear-gradient(135deg, #f59e0b, #d97706); box-shadow: 0 14px 30px rgba(217,119,6,.3); }
.hero .lbl { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; opacity: .9; display: flex; align-items: center; gap: 8px; }
[dir=rtl] .hero .lbl { letter-spacing: 0; font-size: 13px; }
.hero .subj { font-size: 26px; font-weight: 850; letter-spacing: -.02em; margin: 6px 0 2px; line-height: 1.15; overflow-wrap: anywhere; }
.hero .meta { font-size: 14px; opacity: .92; }
.hero .chip { display: inline-block; margin-top: 10px; font-size: 12px; font-weight: 800; background: rgba(255,255,255,.18); border-radius: 8px; padding: 3px 9px; direction: ltr; }
.hero .bar { height: 7px; border-radius: 9px; background: rgba(255,255,255,.25); margin: 14px 0 7px; overflow: hidden; }
.hero .bar i { display: block; height: 100%; border-radius: 9px; background: #fff; transition: width .6s var(--ease); }
.hero .left { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; font-weight: 700; opacity: .95; }
.hero .left span:last-child { text-align: end; }
.hero-free { text-align: center; padding: 22px 16px; }
.hero-free .big { font-size: 34px; } .hero-free .t { font-size: 18px; font-weight: 800; margin-top: 4px; } .hero-free .d { color: var(--dim); font-size: 14px; }
.pill { font-size: 10.5px; font-weight: 850; border-radius: 999px; padding: 2px 8px; background: #fff; color: var(--primary-700); letter-spacing: .02em; }
.pill.sub { background: var(--amber); color: #fff; }
.pill.cov { background: var(--teal-50); color: var(--teal); }
.pill.done { background: var(--ok-50); color: var(--ok); }

/* ---------- timeline (Now + a day in Timetable) ---------- */
.tl { position: relative; padding-inline-start: 20px; }
.tl::before { content: ""; position: absolute; inset-inline-start: 6px; top: 14px; bottom: 14px; width: 2px; background: #e1e5ee; border-radius: 2px; }
.ti2 { position: relative; margin-bottom: 9px; }
.ti2 > .card { padding: 11px 13px 11px; display: flex; gap: 10px; align-items: flex-start; }
.ti2::before {
  content: ""; position: absolute; inset-inline-start: -19px; top: 16px; width: 12px; height: 12px; border-radius: 50%;
  background: #cfd5e2; border: 2.5px solid var(--bg); box-sizing: content-box; margin-inline-start: -1.5px;
}
.ti2.past > .card { opacity: .62; }
.ti2.past::before { background: var(--ok); }
.ti2.cur > .card { border: 2px solid var(--primary); box-shadow: 0 8px 22px rgba(91,91,240,.2); padding: 10px 12px; }
.ti2.cur::before { background: var(--primary); box-shadow: 0 0 0 5px rgba(91,91,240,.18); }
.ti2.sub > .card { background: var(--warn-50); border-color: var(--warn-line); }
.ti2.sub::before { background: var(--amber); }
.ti2.covered > .card { background: var(--teal-50); border-color: #bfe7e2; }
.ti2.covered::before { background: var(--teal); }
.ti2 .acc { width: 4px; align-self: stretch; border-radius: 4px; flex: none; }
.ti2 .bd { flex: 1; min-width: 0; }
.ti2 .top { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; font-weight: 800; color: var(--dim); }
.ti2 .top .p { color: var(--primary-700); }
.ti2.sub .top .p { color: var(--warn); }
.ti2 .nm { font-size: 16px; font-weight: 800; margin-top: 2px; overflow-wrap: anywhere; }
.ti2 .sm { font-size: 13px; color: var(--dim); margin-top: 1px; overflow-wrap: anywhere; }
.ti2 .who { font-size: 13px; font-weight: 700; color: var(--teal); margin-top: 3px; }
.ti2 .nt { font-size: 13px; color: var(--warn); margin-top: 3px; }
.ti2 .mini { height: 4px; border-radius: 9px; background: var(--primary-50); margin-top: 8px; overflow: hidden; }
.ti2 .mini i { display: block; height: 100%; background: var(--primary); border-radius: 9px; }
.ti2 .check { color: var(--ok); font-weight: 900; }
.brk { display: flex; align-items: center; gap: 8px; margin: 2px 0 11px; font-size: 12.5px; font-weight: 700; color: var(--mute); }
.brk.live { color: var(--teal); }
.brk::after { content: ""; flex: 1; height: 1px; background: repeating-linear-gradient(90deg, #d6dbe6 0 5px, transparent 5px 9px); }
.free-slot > .card { background: transparent; border-style: dashed; box-shadow: none; }
.free-slot .nm { color: var(--mute); font-weight: 700; font-size: 14px; }

/* tasks inside a lesson */
.tasks { margin-top: 8px; display: grid; gap: 6px; }
.task { display: flex; align-items: center; gap: 9px; font-size: 14px; }
.task .ck { width: 26px; height: 26px; border-radius: 8px; border: 2px solid #cdd3df; background: #fff; flex: none; display: grid; place-items: center; font-size: 14px; font-weight: 900; color: #fff; }
.task.done .ck { background: var(--ok); border-color: var(--ok); }
.task.done .tx { text-decoration: line-through; color: var(--mute); }
.task .tx { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.task .rp { color: var(--mute); font-size: 13px; }
.addtask { margin-top: 7px; border: 0; background: none; color: var(--primary); font-weight: 750; font-size: 13px; padding: 4px 0; }

/* ---------- day chips + filters ---------- */
.days { display: flex; gap: 6px; margin: 2px 0 12px; }
.day {
  flex: 1; min-height: 56px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-weight: 800; font-size: 14px;
}
.day small { font-size: 11px; font-weight: 700; color: var(--mute); }
.day.today small { color: var(--primary); }
.day.on { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(91,91,240,.3); }
.day.on small { color: rgba(255,255,255,.85); }
.filters { display: flex; gap: 8px; margin-bottom: 12px; }
.filters select { flex: 1; min-width: 0; }
.sel, .inp {
  width: 100%; min-height: 46px; border-radius: 13px; border: 1px solid var(--line); background: var(--surface);
  padding: 0 14px; font-size: 16px; /* 16px: iOS does not zoom the page on focus */
}
.sel { appearance: none; -webkit-appearance: none; padding-inline-end: 34px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238a93a3' stroke-width='2' fill='none'/%3E%3C/svg%3E") no-repeat right 14px center; }
[dir=rtl] .sel { background-position: left 14px center; }
.sel.on { border-color: var(--primary); color: var(--primary-700); font-weight: 700; }
.inp:focus, .sel:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.search { position: relative; margin-bottom: 12px; }
.search .inp { padding-inline-start: 40px; }
.search::before { content: "⌕"; position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-52%); font-size: 20px; color: var(--mute); }

/* ---------- whole-week overview grid ---------- */
.wg { display: grid; grid-template-columns: 38px repeat(3, minmax(0,1fr)) 4px repeat(3, minmax(0,1fr)) 4px repeat(2, minmax(0,1fr));
  gap: 3px; padding: 10px 8px; margin-bottom: 4px; align-items: stretch; }
.wg > i { display: block; }
.wg-h { font-size: 11px; font-weight: 800; color: var(--mute); text-align: center; padding-bottom: 2px; }
.wg-d { border: 0; background: none; padding: 0; font-weight: 800; font-size: 12.5px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; line-height: 1.1; color: var(--text); }
.wg-d small { font-size: 10.5px; font-weight: 700; color: var(--mute); }
.wg-d.today { color: var(--primary); } .wg-d.today small { color: var(--primary); }
.wg-d.sel { background: var(--primary); color: #fff; border-radius: 9px; padding-inline-start: 5px; }
.wg-d.sel small { color: rgba(255,255,255,.85); }
.wg-c { min-height: 38px; border-radius: 8px; border: 0; padding: 0; display: grid; place-items: center; font-size: 10px; font-weight: 800; letter-spacing: -.04em; white-space: nowrap; overflow: hidden; }
@media (max-width: 379px) { .wg-c { font-size: 9px; letter-spacing: -.05em; } .wg { grid-template-columns: 34px repeat(3, minmax(0,1fr)) 3px repeat(3, minmax(0,1fr)) 3px repeat(2, minmax(0,1fr)); } }
.wg-c.free { background: repeating-linear-gradient(135deg, #f3f5fa 0 5px, #eef1f6 5px 10px); }
.wg-c.none { background: transparent; }
.wg-c.now { box-shadow: 0 0 0 2px var(--primary); }
.wg-c.off { opacity: .16; }
.wg-c:active { transform: scale(.94); }
.fsum { display: flex; align-items: center; justify-content: space-between; margin: -2px 4px 10px; font-weight: 800; color: var(--primary-700); }
.row.wk { min-height: 60px; transition: background .3s; }
#wkSel .sec { margin-top: 16px; }
.row.wk.flash { animation: flash 1.6s var(--ease); }
@keyframes flash { 0%, 35% { background: var(--primary-50); box-shadow: inset 0 0 0 2px var(--primary); } 100% { background: transparent; box-shadow: none; } }
.wk-p { flex: none; width: 54px; border-inline-start: 4px solid var(--c); padding-inline-start: 8px; display: flex; flex-direction: column; }
.wk-p b { font-size: 13.5px; color: var(--primary-700); } .wk-p small { font-size: 11.5px; color: var(--dim); font-weight: 700; }

/* ---------- lists (More, teachers, classes, settings) ---------- */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 16px; min-height: 58px;
  border: 0; background: none; text-align: start; border-top: 1px solid var(--line-2);
}
.row:first-child { border-top: 0; }
button.row:active, a.row:active { background: var(--surface-2); }
.row .ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; font-size: 18px; flex: none; background: var(--primary-50); }
.row .bd { flex: 1; min-width: 0; }
.row .t, .row .d { display: block; }
.row .t { font-weight: 750; font-size: 15.5px; overflow-wrap: anywhere; }
.row .d { font-size: 13px; color: var(--dim); margin-top: 1px; overflow-wrap: anywhere; }
.row .chev { color: #c4cad6; font-size: 24px; flex: none; }
[dir=rtl] .chev { transform: scaleX(-1); display: inline-block; }
.row .end { flex: none; font-size: 13px; font-weight: 700; color: var(--dim); }
.av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 850; font-size: 16px; flex: none; background: var(--primary-50); color: var(--primary-700); }
.av.lg { width: 54px; height: 54px; font-size: 21px; }
.badge { display: inline-flex; align-items: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 12px; font-weight: 850; justify-content: center; }

.where { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--dim); margin-top: 2px; min-width: 0; }
.where i { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--mute); }
.where b { color: var(--text); font-weight: 700; white-space: nowrap; flex: none; max-width: 62%; overflow: hidden; text-overflow: ellipsis; }
.where span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.st-in i { background: var(--primary); } .st-free i { background: var(--ok); } .st-off i { background: var(--mute); } .st-done i { background: #c4cad6; }
.nowbox { display: flex; gap: 12px; align-items: center; padding: 14px 16px; margin-bottom: 12px; }
.nowbox .dotbig { width: 12px; height: 12px; border-radius: 50%; flex: none; background: var(--mute); }
.nowbox.st-in .dotbig { background: var(--primary); box-shadow: 0 0 0 6px rgba(91,91,240,.15); }
.nowbox.st-free .dotbig { background: var(--ok); box-shadow: 0 0 0 6px rgba(21,145,75,.13); }
.nowbox .t { font-weight: 800; font-size: 16px; } .nowbox .d { font-size: 13px; color: var(--dim); }
.whohead { display: flex; align-items: center; gap: 14px; margin: 4px 2px 14px; }
.whohead .t { font-size: 20px; font-weight: 850; letter-spacing: -.01em; overflow-wrap: anywhere; }
.whohead .d { color: var(--dim); font-size: 13.5px; }

.lvl { margin: 18px 4px 8px; display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 14px; }
.lvl i { width: 10px; height: 10px; border-radius: 3px; background: var(--lv); }
.lvl small { margin-inline-start: auto; color: var(--mute); font-weight: 700; }
.cgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ccard { text-align: start; padding: 12px 13px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--sh); border-inline-start: 4px solid var(--lv); min-width: 0; }
.ccard b { display: block; font-size: 15px; direction: ltr; text-align: start; overflow-wrap: anywhere; }
.ccard small { color: var(--dim); font-size: 12px; }
.ccard .fl { color: var(--warn); font-weight: 800; font-size: 12px; }
.lvltag { font-size: 11.5px; font-weight: 800; padding: 2px 8px; border-radius: 999px; color: var(--lv); background: color-mix(in srgb, var(--lv) 12%, white); }

/* ---------- cover ---------- */
.cv { padding: 12px 14px; margin-bottom: 9px; display: flex; gap: 12px; align-items: flex-start; }
.cv .p { flex: none; min-width: 46px; text-align: center; border-radius: 11px; padding: 7px 4px; font-weight: 850; font-size: 14px; background: var(--danger-50); color: var(--danger); }
.cv.away .p { background: var(--teal-50); color: var(--teal); }
.cv .p small { display: block; font-size: 10.5px; font-weight: 700; opacity: .85; }
.cv .bd { flex: 1; min-width: 0; }
.cv .nm { font-weight: 800; font-size: 15.5px; overflow-wrap: anywhere; }
.cv .sm { font-size: 13px; color: var(--dim); overflow-wrap: anywhere; }
.cv .who { font-size: 13px; font-weight: 700; color: var(--teal); margin-top: 3px; }
.cv .nt { font-size: 13px; color: var(--warn); margin-top: 3px; }
.grp { margin-bottom: 10px; overflow: hidden; }
.grp .gh { display: flex; align-items: center; gap: 10px; padding: 12px 14px; font-weight: 800; border-bottom: 1px solid var(--line-2); }
.grp .gh small { color: var(--dim); font-weight: 700; margin-inline-start: auto; font-size: 12.5px; }
.grp .gr { padding: 11px 14px; border-top: 1px solid var(--line-2); display: grid; gap: 4px; }
.grp .gr:first-of-type { border-top: 0; }
.grp .gr.mine { background: #fffbeb; }
.grp .l1 { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 14px; }
.grp .l1 b { font-weight: 850; }
.grp .l1 .tm { color: var(--dim); font-size: 12.5px; font-weight: 700; margin-inline-start: auto; }
.grp .l2 { font-size: 13.5px; }
.grp .l2 b { font-weight: 800; }
.tag { display: inline-block; font-size: 11.5px; font-weight: 800; border-radius: 7px; padding: 2px 7px; }
.tag.ok { background: var(--ok-50); color: var(--ok); }
.tag.bad { background: var(--danger-50); color: var(--danger); }
.tag.info { background: var(--primary-50); color: var(--primary-700); }
.tag.susp { background: var(--susp-50); color: var(--susp); }
.tag.you { background: var(--amber); color: #fff; }
.suspbar { padding: 11px 14px; margin-bottom: 10px; font-size: 13.5px; background: var(--susp-50); border-color: #e2d6ff; color: #4c1d95; }
.legend { display: grid; gap: 6px; font-size: 12.5px; color: var(--dim); margin: 4px 4px 0; }

/* ---------- cover (redesign) ---------- */
.cv-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 2px 0 4px; }
.cv-stat { border: 1px solid var(--line); background: var(--surface); border-radius: 16px; padding: 11px 8px 10px; box-shadow: var(--sh);
  display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; min-width: 0; }
.cv-stat b { font-size: 26px; font-weight: 900; line-height: 1.1; }
.cv-stat span { font-size: 11.5px; font-weight: 750; color: var(--dim); line-height: 1.25; }
.cv-stat.red b { color: var(--danger); } .cv-stat.teal b { color: var(--teal); } .cv-stat.grey b { color: var(--text); }
.cv-stat.red:not(.zero) { background: var(--danger-50); border-color: #f7cdd2; }
.cv-stat.zero b { color: #c4cad6; }
.cv-stat:active { transform: scale(.97); }
.cv2 { padding: 14px 16px; margin-bottom: 10px; border-inline-start: 5px solid var(--danger); }
.cv2.away { border-inline-start-color: var(--teal); }
.cv2.live { box-shadow: 0 0 0 2px var(--danger), 0 10px 26px rgba(220,43,61,.16); }
.cv2.away.live { box-shadow: 0 0 0 2px var(--teal), var(--sh); }
.cv2.done { opacity: .6; }
.cv-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cv-when { display: flex; align-items: baseline; gap: 8px; }
.cv-when b { font-size: 20px; font-weight: 900; color: var(--danger); }
.cv2.away .cv-when b { color: var(--teal); }
.cv-when span { font-size: 14px; font-weight: 750; color: var(--dim); }
.cvs { font-size: 12px; font-weight: 850; border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
.cvs.now { background: var(--danger); color: #fff; }
.cvs.soon { background: var(--warn-50); color: var(--warn); }
.cvs.done { background: var(--ok-50); color: var(--ok); }
.cv-date { font-size: 13px; font-weight: 800; color: var(--warn); margin-top: 4px; }
.cv-class { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin-top: 8px; font-size: 18px; font-weight: 850; }
.cv-room { font-size: 13px; font-weight: 750; color: var(--dim); background: var(--surface-2); border-radius: 8px; padding: 3px 8px; }
.cv-subj { font-size: 14.5px; color: var(--dim); margin-top: 2px; overflow-wrap: anywhere; }
.cv-for { margin-top: 8px; font-size: 13.5px; color: var(--dim); }
.cv-for b { color: var(--text); }
.cv-for.away b { color: var(--teal); }
.cv-note { margin-top: 8px; font-size: 13px; color: var(--warn); background: var(--warn-50); border-radius: 10px; padding: 7px 10px; overflow-wrap: anywhere; }
.cv-bar { height: 6px; border-radius: 9px; background: var(--danger-50); margin-top: 12px; overflow: hidden; }
.cv-bar i { display: block; height: 100%; background: var(--danger); border-radius: 9px; }
.cv2.away .cv-bar { background: var(--teal-50); } .cv2.away .cv-bar i { background: var(--teal); }
.cv-left { font-size: 12.5px; font-weight: 800; color: var(--dim); margin-top: 5px; }
.cv-link { margin-top: 10px; border: 0; background: none; padding: 6px 0 0; color: var(--primary); font-weight: 750; font-size: 13.5px;
  border-top: 1px solid var(--line-2); width: 100%; text-align: start; display: flex; justify-content: space-between; }
.cv-none { display: flex; gap: 12px; align-items: center; padding: 14px 16px; }
.cv-none span { font-size: 26px; } .cv-none b { display: block; } .cv-none small { color: var(--dim); font-size: 13px; }
.grp2 { margin-bottom: 8px; overflow: hidden; }
.grp2 summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 11px 14px; min-height: 60px; cursor: pointer; }
.grp2 summary::-webkit-details-marker { display: none; }
.grp2 summary .av { width: 36px; height: 36px; font-size: 14px; color: var(--text); }
.grp2 summary .bd { flex: 1; min-width: 0; }
.grp2 summary .t { display: block; font-weight: 800; font-size: 15.5px; overflow-wrap: anywhere; }
.grp2 summary .d { display: block; font-size: 12.5px; color: var(--dim); }
.grp2 summary .chev { color: #c4cad6; font-size: 22px; transition: transform .2s var(--ease); }
.grp2[open] summary .chev { transform: rotate(90deg); }
[dir=rtl] .grp2[open] summary .chev { transform: rotate(90deg); }
.grp2[open] summary { border-bottom: 1px solid var(--line-2); }
.clashdot { width: 20px; height: 20px; border-radius: 50%; background: var(--danger-50); color: var(--danger); font-weight: 900; font-size: 12px; display: grid; place-items: center; flex: none; }
.gr2 { display: flex; gap: 12px; padding: 11px 14px; border-top: 1px solid var(--line-2); }
.gr2:first-of-type { border-top: 0; }
.gr2.mine { background: #fffbeb; }
.gr2.done { opacity: .55; }
.gp { flex: none; width: 46px; display: flex; flex-direction: column; }
.gp b { font-size: 15px; font-weight: 900; } .gp small { font-size: 11.5px; color: var(--dim); font-weight: 700; }
.gb { flex: 1; min-width: 0; display: grid; gap: 4px; }
.g1 { font-size: 14px; font-weight: 800; overflow-wrap: anywhere; } .g1 span { font-weight: 600; color: var(--dim); }
.g2 { font-size: 14px; }
.legend2 { margin: 6px 4px 0; }
.legend2 summary { font-size: 13px; font-weight: 750; color: var(--primary); cursor: pointer; list-style: none; padding: 6px 0; }
.legend2 summary::-webkit-details-marker { display: none; }

/* ---------- notices ---------- */
.nt { padding: 15px 16px 14px; margin-bottom: 10px; position: relative; overflow: hidden; }
.nt.new { border-color: #d9dcfb; }
.nt.new::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 5px; background: var(--primary); }
.nt-meta { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 750; color: var(--mute); flex-wrap: wrap; }
.nt-new { font-size: 10.5px; font-weight: 900; color: #fff; background: var(--primary); border-radius: 6px; padding: 2px 7px; letter-spacing: .03em; }
.nt-edit { color: var(--warn); }
.nt h3 { margin: 6px 0 0; font-size: 18px; font-weight: 850; line-height: 1.3; letter-spacing: -.01em; overflow-wrap: anywhere; }
.nt-body { margin-top: 8px; font-size: 15.5px; line-height: 1.6; color: #2b2f38; overflow-wrap: anywhere; max-height: 9.6em; overflow: hidden; position: relative; }
.nt-body.short, .nt-body.open { max-height: none; }
.nt-body.folded:not(.open)::after { content: ""; position: absolute; inset-inline: 0; bottom: 0; height: 2.4em; background: linear-gradient(transparent, var(--surface)); }
.nt-body p { margin: 0 0 8px; } .nt-body p:last-child { margin-bottom: 0; }
.nt-body ul, .nt-body ol { margin: 0 0 8px; padding-inline-start: 22px; }
.nt-more { margin-top: 6px; border: 0; background: none; padding: 4px 0; color: var(--primary); font-weight: 800; font-size: 14px; }
.nt-chip { display: inline-block; margin-top: 10px; font-size: 12.5px; font-weight: 800; color: var(--dim); background: var(--surface-2); border-radius: 999px; padding: 4px 10px; }
.nt-chip.soon { color: var(--warn); background: var(--warn-50); }

/* ---------- absence ---------- */
.rq { padding: 14px 16px; border-top: 1px solid var(--line-2); display: grid; gap: 10px; }
.rq:first-child { border-top: 0; }
.rq .h { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.rq .h b { font-size: 16px; font-weight: 850; } .rq .h span { color: var(--dim); font-size: 14px; }
.rqtag { font-size: 13px; font-weight: 800; border-radius: 10px; padding: 7px 11px; }
.rqtag.pending { background: var(--warn-50); color: var(--warn); }
.rqtag.approved { background: var(--ok-50); color: var(--ok); }
.rqtag.declined { background: var(--danger-50); color: var(--danger); }
.msg { font-size: 13.5px; font-weight: 700; margin: 10px 4px 0; }
.msg.bad { color: var(--danger); } .msg.ok { color: var(--ok); }
.opts { display: grid; gap: 8px; margin: 4px 0 12px; }
.opt { display: flex; gap: 12px; align-items: center; padding: 13px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); }
.opt input { width: 22px; height: 22px; accent-color: var(--primary); flex: none; margin: 0; }
.opt b { display: block; } .opt small { color: var(--dim); font-size: 13px; }
.opt:has(input:checked) { border-color: var(--primary); background: var(--primary-50); }
.lessons { display: grid; gap: 6px; opacity: .45; transition: opacity .2s; }
.lessons.on { opacity: 1; }
.lessons .opt { padding: 10px 12px; }
.lessons .pp { font-weight: 850; color: var(--primary-700); min-width: 34px; }
.lessons .tt { margin-inline-start: auto; font-size: 12.5px; color: var(--dim); font-weight: 700; white-space: nowrap; }

/* ---------- More hub + sub screens ---------- */
.grp-l { margin: 22px 6px 8px; font-size: 12.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--mute); }
[dir=rtl] .grp-l { letter-spacing: 0; font-size: 13.5px; }
.card.me { width: 100%; display: flex; align-items: center; gap: 14px; padding: 16px; text-align: start;
  background: linear-gradient(135deg, #eef0fe, #fff 70%); border-color: #dcdffb; }
.card.me .av { background: var(--grad); color: #fff; }
.card.me .bd { flex: 1; min-width: 0; }
.card.me .t { display: block; font-size: 19px; font-weight: 850; overflow-wrap: anywhere; }
.card.me .st { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--dim); margin-top: 2px; }
.card.me .st i { width: 8px; height: 8px; border-radius: 50%; background: var(--mute); }
.card.me .st.ok i { background: var(--ok); } .card.me .st.warn i { background: var(--amber); }
.card.me .st.bad { color: var(--danger); } .card.me .st.bad i { background: var(--danger); }
.card.me .chev { color: #b9c0cd; font-size: 24px; }
.row-end { flex: none; font-size: 12.5px; font-weight: 800; color: var(--dim); background: var(--surface-2); border-radius: 999px; padding: 4px 9px; white-space: nowrap; }
.row-end.ok { color: var(--ok); background: var(--ok-50); } .row-end.warn { color: var(--warn); background: var(--warn-50); }
.row-end.pri { color: var(--primary-700); background: var(--primary-50); }
.steps { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 12px; }
.steps li { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; }
.steps li > span { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--primary-50); color: var(--primary-700); font-weight: 900; display: grid; place-items: center; }
/* absence */
.ab { padding: 15px 16px; margin-bottom: 12px; display: grid; gap: 12px; }
.ab.pending { border-color: var(--warn-line); } .ab.approved { border-color: #bfe5cf; }
.ab-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.ab-h b { display: block; font-size: 19px; font-weight: 850; } .ab-h span { font-size: 13.5px; color: var(--dim); }
.ab-st { font-size: 12px; font-weight: 850; border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
.ab-st.pending { background: var(--warn-50); color: var(--warn); } .ab-st.approved { background: var(--ok-50); color: var(--ok); }
.ab-st.declined { background: var(--danger-50); color: var(--danger); }
.ab-ps { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ab-p { font-size: 13px; font-weight: 850; color: var(--primary-700); background: var(--primary-50); border-radius: 9px; padding: 5px 9px; }
.ab-p.hit { background: var(--warn-50); color: var(--warn); box-shadow: inset 0 0 0 1.5px var(--warn-line); }
.ab.approved .ab-p.hit { background: var(--ok-50); color: var(--ok); box-shadow: inset 0 0 0 1.5px #bfe5cf; }
.ab-n { font-size: 12.5px; font-weight: 700; color: var(--mute); margin-inline-start: 4px; }
.ab-line { margin: 0; font-size: 14px; color: var(--warn); } .ab-line.ok { color: var(--ok); }
.how { padding: 0 16px; margin-top: 4px; }
.how summary { list-style: none; cursor: pointer; padding: 13px 0; font-weight: 750; font-size: 14px; color: var(--dim); }
.how summary::-webkit-details-marker { display: none; }
.how p { margin: 0 0 14px; font-size: 14px; color: var(--dim); line-height: 1.5; }
/* find: filter chips + status dot on the avatar */
.chips { display: flex; gap: 6px; margin: -2px 0 12px; }
.chip { flex: 1 1 auto; min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 40px; padding: 0 6px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 750; font-size: 13.5px; color: var(--dim); white-space: nowrap; }
.chip b { font-size: 11.5px; font-weight: 900; background: var(--surface-2); border-radius: 999px; padding: 1px 6px; color: var(--text); }
.chip.on { background: var(--text); color: #fff; border-color: var(--text); }
.chip.on b { background: rgba(255,255,255,.2); color: #fff; }
.chip.c-free.on { background: var(--ok); border-color: var(--ok); } .chip.c-in.on { background: var(--primary); border-color: var(--primary); }
.chip.c-away.on { background: #6b7280; border-color: #6b7280; }
.av { position: relative; }
.avdot { position: absolute; bottom: -1px; inset-inline-end: -1px; width: 13px; height: 13px; border-radius: 50%; border: 2.5px solid #fff; background: var(--mute); }
.avdot.k-in { background: var(--primary); } .avdot.k-free { background: var(--ok); } .avdot.k-away { background: var(--danger); } .avdot.k-other { background: #c4cad6; }
/* tasks */
.tk-today { padding: 14px 16px 6px; margin-top: 12px; }
.tk-h { display: flex; justify-content: space-between; align-items: baseline; }
.tk-h b { font-size: 17px; font-weight: 850; } .tk-h span { font-size: 13px; font-weight: 750; color: var(--dim); }
.tk-bar { height: 6px; border-radius: 9px; background: var(--ok-50); margin: 10px 0 6px; overflow: hidden; }
.tk-bar i { display: block; height: 100%; background: var(--ok); border-radius: 9px; transition: width .4s var(--ease); }
.tk-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-2); }
.tk-row:first-of-type { border-top: 0; }
.tk-row .ck { width: 28px; height: 28px; border-radius: 9px; border: 2px solid #cdd3df; background: #fff; flex: none; display: grid; place-items: center; font-weight: 900; color: #fff; }
.tk-row.done .ck { background: var(--ok); border-color: var(--ok); }
.tk-p { flex: none; font-size: 12.5px; font-weight: 850; color: var(--primary-700); background: var(--primary-50); border-radius: 8px; padding: 3px 7px; }
.tk-t { flex: 1; min-width: 0; font-size: 15px; overflow-wrap: anywhere; }
.tk-row.done .tk-t { text-decoration: line-through; color: var(--mute); }

/* ---------- settings ---------- */
.seg { display: flex; background: var(--surface-2); border-radius: 13px; padding: 4px; gap: 4px; }
.seg button { flex: 1; min-height: 40px; border: 0; border-radius: 10px; background: none; font-weight: 750; color: var(--dim); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--sh); }
.setrow { padding: 14px 16px; border-top: 1px solid var(--line-2); display: grid; gap: 10px; }
.setrow:first-child { border-top: 0; }
.setrow .t { font-weight: 800; } .setrow .d { color: var(--dim); font-size: 13.5px; }
.okpill { display: inline-block; font-size: 12px; font-weight: 800; color: var(--ok); background: var(--ok-50); border-radius: 999px; padding: 3px 10px; }
.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 12.5px; font-weight: 800; color: var(--dim); text-transform: uppercase; letter-spacing: .04em; }
[dir=rtl] .field label { letter-spacing: 0; }
textarea.inp { padding: 12px 14px; min-height: 84px; resize: vertical; line-height: 1.4; }
.maprow { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.maprow code { flex: 0 1 44%; min-width: 0; font: 700 13px/1.3 ui-monospace, Menlo, monospace; background: var(--surface-2); border-radius: 9px; padding: 8px 9px; overflow-wrap: anywhere; }
.maprow .inp { flex: 1; min-width: 0; }

/* ---------- install guide ---------- */
.install { padding: 14px 16px; margin-bottom: 14px; display: flex; gap: 12px; align-items: flex-start; background: linear-gradient(135deg, #eef0fe, #f5f3ff); border-color: #dcdffb; }
.install .ic { font-size: 26px; flex: none; }
.install .t { font-weight: 850; } .install .d { font-size: 13.5px; color: var(--dim); margin-top: 2px; }
.install .x { margin-inline-start: auto; border: 0; background: none; font-size: 22px; color: var(--mute); width: 34px; height: 34px; flex: none; }
.share-ic { display: inline-block; width: 16px; height: 18px; vertical-align: -3px; background: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 20' fill='none' stroke='%235b5bf0' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 1v12M4 5l4-4 4 4M3 9H1.5v9.5h13V9H13'/%3E%3C/svg%3E"); }

/* ---------- bottom tabs ---------- */
/* Inline SVG icons, each in a fixed 56x30 box, label on its own line: the icon and
   its name share one centre line on every phone. (CSS-mask icons drifted left in
   iOS Safari.) The selected tab gets a pill behind the icon. */
.tabs {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 7px 4px max(env(safe-area-inset-bottom, 0px), 8px);
  background: rgba(255,255,255,.94);
  backdrop-filter: saturate(1.6) blur(20px); -webkit-backdrop-filter: saturate(1.6) blur(20px);
  border-top: 1px solid var(--line);
}
.tab {
  border: 0; background: none; padding: 0; margin: 0; min-width: 0; min-height: 50px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 3px;
  color: #7c8595; font-size: 11px; font-weight: 650; line-height: 1.2; letter-spacing: .01em;
}
.tab .tic {
  position: relative; width: 56px; height: 30px; border-radius: 15px;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.tab svg { width: 24px; height: 24px; display: block; flex: none; }
.tab .tab-l { display: block; width: 100%; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tab.on { color: var(--primary-700); }
.tab.on .tic { background: var(--primary-50); color: var(--primary); }
.tab.on svg { stroke-width: 2.3; }
.tab.on .tab-l { font-weight: 800; }
.tab:active .tic { transform: scale(.94); }
.tdot {
  position: absolute; top: 0; inset-inline-start: 34px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--danger); color: #fff; border: 2px solid #fff;
  font-size: 10.5px; font-weight: 850; line-height: 14px; font-style: normal; text-align: center; box-sizing: border-box;
}
.tdot:empty { min-width: 12px; width: 12px; height: 12px; top: 2px; padding: 0; }
:root { --tabs-h: 66px; }

/* ---------- bottom sheet ---------- */
.sheet-bg { position: fixed; inset: 0; z-index: 50; background: rgba(15,18,30,.42); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s both; }
.sheet {
  width: 100%; max-width: 640px; max-height: calc(100dvh - var(--top) - 24px); overflow: auto; overscroll-behavior: contain;
  background: var(--surface); border-radius: 24px 24px 0 0; padding: 8px 18px calc(var(--bot) + 18px);
  box-shadow: var(--sh-lg); animation: up .28s var(--ease) both;
}
.sheet .grab { width: 40px; height: 5px; border-radius: 9px; background: #d9dde6; margin: 2px auto 12px; }
.sheet h3 { margin: 0 0 4px; font-size: 20px; font-weight: 850; }
.sheet .sub { margin: 0 0 14px; color: var(--dim); font-size: 14px; }
.sheet .foot { display: flex; gap: 10px; margin-top: 16px; position: sticky; bottom: calc(-1 * (var(--bot) + 18px)); background: var(--surface); padding: 10px 0 calc(var(--bot) + 6px); }
.sheet .foot .btn { flex: 1; }
@keyframes fade { from { opacity: 0; } } @keyframes up { from { transform: translateY(40px); opacity: 0; } }
.pick { max-height: 50dvh; overflow: auto; margin: 0 -4px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabs-h) + var(--bot) + 16px); z-index: 60; transform: translate(-50%, 16px);
  background: #16181d; color: #fff; font-weight: 700; font-size: 14px; padding: 11px 16px; border-radius: 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .25s var(--ease); max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { margin-inline-start: 10px; border: 0; background: #fff; color: var(--primary-700); font-weight: 800; border-radius: 9px; padding: 5px 10px; }

.muted { color: var(--dim); }
.ltr { direction: ltr; unicode-bidi: isolate; }
.spinner { display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid currentColor; border-top-color: transparent; animation: spin .8s linear infinite; vertical-align: -3px; }
@media (min-width: 700px) { main { padding-top: 12px; } }
