/* ==========================================================================
   Portals (student · counsellor · admin) + auth screens
   Dark sidebar, light canvas. Mobile: top bar + bottom tab bar + drawer.
   ========================================================================== */
.app { display: grid; grid-template-columns: 272px minmax(0, 1fr); min-height: 100svh; background: var(--paper); }
.side { position: sticky; top: 0; height: 100svh; overflow-y: auto; background: var(--night); color: var(--night-text); display: flex; flex-direction: column; padding: 1.1rem .8rem; z-index: 60; scrollbar-width: thin; scrollbar-color: var(--night-3) transparent; }
.side__brand { display: flex; align-items: center; justify-content: space-between; padding: .3rem .6rem 1rem; }
.side__brand img { height: 26px; width: auto; }
.side__role { margin: 0 .6rem; padding: .35em .8em; border-radius: var(--r-pill); background: rgba(65,197,244,.14); color: var(--cyan); font: 800 .66rem/1 var(--f-body); letter-spacing: .12em; text-transform: uppercase; align-self: flex-start; }
.side__group { margin-top: 1.4rem; } .side__group h6 { margin: 0 0 .45rem .7rem; font: 800 .62rem/1 var(--f-body); letter-spacing: .16em; text-transform: uppercase; color: #6c8197; }
.side__link { position: relative; display: flex; align-items: center; gap: .75rem; padding: .62rem .8rem; margin-bottom: 2px; border-radius: 12px; color: var(--night-text); text-decoration: none; font: 600 .9rem/1.2 var(--f-body); transition: background .2s, color .2s; }
.side__link:hover { background: var(--night-2); color: #fff; }
.side__link[aria-current="page"] { background: linear-gradient(90deg, rgba(65,197,244,.18), rgba(65,197,244,.04)); color: #fff; }
.side__link[aria-current="page"]::before { content: ""; position: absolute; left: -.8rem; top: 22%; bottom: 22%; width: 3px; border-radius: 3px; background: var(--cyan); }
.side__link .ico { width: 19px; height: 19px; opacity: .9; }
.side__count { margin-left: auto; min-width: 22px; height: 22px; padding: 0 .45em; border-radius: var(--r-pill); background: var(--cyan); color: var(--night); font: 800 .7rem/22px var(--f-body); text-align: center; }
.side__foot { margin-top: auto; padding: 1rem .7rem .4rem; border-top: 1px solid var(--night-line); }
.side__user { display: flex; gap: .7rem; align-items: center; } .side__user b { color: #fff; font-size: .88rem; display: block; } .side__user small { color: #8197ad; }
.side__foot .btn { --bg: var(--night-2); --bd: var(--night-line); width: 100%; margin-top: .8rem; }
.main { min-width: 0; display: flex; flex-direction: column; }
.scrim { display: none; }
.topbar { position: sticky; top: 0; z-index: 50; height: 68px; display: flex; align-items: center; gap: .8rem; padding: 0 clamp(1rem, .5rem + 1.5vw, 2rem); background: rgba(250,248,243,.86); backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4); border-bottom: 1px solid var(--line); }
.topbar__menu { display: none; }
.topbar .search { flex: 1; max-width: 440px; } .topbar .search .input { min-height: 44px; border-radius: var(--r-pill); background: var(--surface); }
.topbar__ai { display: none; color: var(--brand); } .topbar__bell { position: relative; } .topbar__bell .dot { position: absolute; top: 8px; right: 9px; width: 10px; height: 10px; border-radius: 50%; background: var(--coral); border: 2px solid var(--paper); }
.topbar__brand { display: none; flex: none; } .topbar__brand img { height: 36px; width: auto; max-width: min(120px, 36vw); object-fit: contain; object-position: left center; }
.canvas { width: 100%; max-width: 1400px; margin: 0 auto; padding: clamp(1.2rem, .8rem + 1.6vw, 2.4rem) clamp(1rem, .5rem + 1.5vw, 2rem) 6.5rem; overflow-wrap: break-word; animation: rise .45s var(--ease) both; }
.phead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.8rem; }
.phead h1 { font-size: clamp(1.7rem, 1.3rem + 1.4vw, 2.5rem); margin: 0 0 .2rem; } .phead p { margin: 0; color: var(--muted); }
.banner-verify { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; justify-content: space-between; padding: .7rem clamp(1rem, .5rem + 1.5vw, 2rem); background: var(--sun-2); color: var(--warn); font-size: var(--t-sm); border-bottom: 1px solid #efd8a6; }

/* Dashboard blocks */
.hello { position: relative; overflow: hidden; border-radius: var(--r-xl); color: #fff; padding: clamp(1.4rem, 1rem + 2vw, 2.6rem); isolation: isolate; min-height: 260px; display: flex; align-items: flex-end; }
.hello img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 75%; z-index: -2; }
.hello::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(5,24,42,.9), rgba(5,24,42,.45)); }
.hello h2 { color: #fff; font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.6rem); margin-bottom: .4rem; } .hello h2 em { color: var(--cyan); }
.hello__grid { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1.5rem; align-items: end; }
.hello .ring::before { background: rgba(5,24,42,.85); } .hello .ring b { color: #fff; } .hello .ring { background: conic-gradient(var(--cyan) calc(var(--p) * 1%), rgba(255,255,255,.15) 0); }
.trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.trio h4 { display: flex; gap: .5rem; align-items: center; font-size: .95rem; } .trio .t-done h4 { color: var(--ok); } .trio .t-pend h4 { color: var(--warn); } .trio .t-next h4 { color: var(--brand); }
.list { list-style: none; padding: 0; margin: 0; display: grid; gap: .55rem; font-size: var(--t-sm); } .list li { display: flex; gap: .6rem; align-items: flex-start; margin: 0; } .list .ico { margin-top: .2em; flex: none; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .8rem; }
.dash { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.app--staff .card, .app--admin .card { border-radius: var(--r-md); }
.app--staff .stat, .app--admin .stat { border-radius: var(--r-md); padding: 1.1rem 1.2rem; } .app--staff .stat .v, .app--admin .stat .v { font-size: 1.9rem; }
.table td .row { gap: .4rem; }
.mini-form { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; } .mini-form .select, .mini-form .input { min-height: 38px; padding: .4em .8em; border-radius: 10px; font-size: .85rem; width: auto; }
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: .8rem; overflow-x: auto; padding-bottom: .6rem; scroll-snap-type: x proximity; }
.kcol { background: var(--paper-2); border-radius: var(--r-md); padding: .8rem; scroll-snap-align: start; min-height: 200px; }
.kcol h5 { display: flex; justify-content: space-between; margin: 0 0 .7rem; font: 800 .7rem/1 var(--f-body); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.kcard { display: block; padding: .8rem .9rem; margin-bottom: .5rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink-2); font-size: var(--t-sm); transition: transform .25s var(--ease), box-shadow .25s; }
.kcard:hover { transform: translateY(-2px); box-shadow: var(--sh-2); color: var(--ink-2); } .kcard b { display: block; color: var(--ink); }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.cal__dow { background: #fcfbf7; padding: .5rem; text-align: center; font: 700 .7rem/1 var(--f-body); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.cal__day { background: var(--surface); min-height: 108px; padding: .45rem; font-size: .75rem; } .cal__day.is-off { background: #faf8f4; color: var(--faint); } .cal__day.is-today { box-shadow: inset 0 0 0 2px var(--brand); }
.cal__ev { display: block; margin-top: 4px; padding: 3px 7px; border-radius: 6px; background: var(--info-2); color: var(--brand-3); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.cal__ev--requested { background: var(--warn-2); color: var(--warn); } .cal__ev--confirmed { background: var(--ok-2); color: var(--ok); } .cal__ev--cancelled { background: var(--paper-2); color: var(--faint); text-decoration: line-through; }
.doc-item { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; gap: .9rem; align-items: center; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.doc-item + .doc-item { margin-top: .6rem; }
.doc-item__ic { width: 46px; height: 56px; border-radius: 8px; background: var(--paper-2); display: grid; place-items: center; font: 800 .62rem/1 var(--f-body); color: var(--muted); letter-spacing: .05em; }
.doc-item__ic--missing { background: var(--danger-2); color: var(--danger); } .doc-item__ic--approved { background: var(--ok-2); color: var(--ok); }
.thread { display: flex; flex-direction: column; gap: .7rem; padding: 1.2rem; max-height: 560px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.inbox { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 1rem; align-items: start; }
.inbox__list { display: grid; gap: .3rem; } .inbox__item { display: flex; gap: .7rem; padding: .75rem; border-radius: 12px; text-decoration: none; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); } .inbox__item[aria-current="page"], .inbox__item:hover { border-color: var(--brand); color: var(--ink-2); }
.setting { display: flex; justify-content: space-between; gap: 1.5rem; align-items: center; padding: 1rem 0; border-bottom: 1px solid var(--line-2); } .setting:last-child { border-bottom: 0; }
.perm td, .perm th { text-align: center; } .perm td:first-child, .perm th:first-child { text-align: left; }
.writing { display: grid; grid-template-columns: 250px minmax(0, 1fr) 280px; gap: 1rem; align-items: start; }
.chip-row { display: flex; flex-wrap: wrap; gap: .4rem; }

/* Mobile bottom tab bar for portals */
.tabbar { display: none; }

/* Auth screens */
.auth-body { background: var(--paper); }
.auth { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100svh; }
.auth__art { position: relative; overflow: hidden; color: #fff; display: flex; flex-direction: column; justify-content: flex-end; padding: clamp(2rem, 1rem + 3vw, 4rem); isolation: isolate; background: var(--night); }
.auth__art > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 40% 80%; z-index: -2; animation: pan 40s linear infinite alternate; --pan: -6%; }
.auth__art::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(5,20,35,.45), rgba(5,20,35,.88)); }
.auth__logo { position: absolute; top: 2rem; left: clamp(2rem, 1rem + 3vw, 4rem); } .auth__logo img { height: 28px; width: auto; }
.auth__quote h2 { color: #fff; font-size: clamp(2rem, 1.2rem + 2.6vw, 3.6rem); max-width: 14ch; } .auth__quote h2 em { color: var(--cyan); }
.auth__list { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: .6rem; color: rgba(255,255,255,.88); } .auth__list li { display: flex; gap: .6rem; margin: 0; } .auth__list .ico { color: var(--cyan); }
.auth__main { display: flex; flex-direction: column; justify-content: center; padding: clamp(1.5rem, 1rem + 3vw, 4rem); }
.auth__brand { display: none; margin: 0 auto 1.5rem; } .auth__brand img { height: 30px; width: auto; }
.auth__card { width: min(520px, 100%); margin: 0 auto; }

@media (max-width: 1100px) {
  .dash, .writing { grid-template-columns: minmax(0, 1fr); }
  .inbox { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); transform: translateX(-104%); transition: transform .45s var(--ease); box-shadow: var(--sh-3); }
  .nav-open .side { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(8,19,31,.5); opacity: 0; pointer-events: none; transition: opacity .35s; } .nav-open .scrim { opacity: 1; pointer-events: auto; }
  .topbar__menu { display: inline-grid; } .topbar__brand { display: flex; align-items: center; } .topbar .search { display: none; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; height: calc(64px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: rgba(255,255,255,.94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
  .tabbar a { display: grid; place-items: center; align-content: center; gap: .2rem; color: var(--muted); text-decoration: none; font: 700 .64rem/1 var(--f-body); position: relative; }
  .tabbar a .ico { width: 22px; height: 22px; } .tabbar a[aria-current="page"] { color: var(--brand); }
  .tabbar a[aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand); }
  .tabbar .side__count { position: absolute; top: 6px; left: 54%; min-width: 18px; height: 18px; line-height: 18px; font-size: .6rem; }
  .canvas { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
  .toasts { bottom: calc(80px + env(safe-area-inset-bottom)); }
  .auth { grid-template-columns: minmax(0, 1fr); } .auth__art { display: none; } .auth__brand { display: block; }
}
@media (max-width: 760px) {
  .trio { grid-template-columns: minmax(0, 1fr); }
  .hello__grid { grid-template-columns: minmax(0, 1fr); }
  .cal__day { min-height: 64px; } .cal__ev { font-size: 0; height: 7px; padding: 0; }
  .phead .btn { flex: 1 1 auto; }
  .doc-item { grid-template-columns: 40px minmax(0, 1fr); } .doc-item > :last-child { grid-column: 1 / -1; }
  .table--cards thead { display: none; } .table--cards, .table--cards tbody, .table--cards tr, .table--cards td { display: block; width: 100%; }
  .table--cards tr { padding: .8rem 1rem; border-bottom: 1px solid var(--line-2); } .table--cards td { padding: .2rem 0; border: 0; }
  .table--cards td[data-l]::before { content: attr(data-l) ": "; font-weight: 700; color: var(--muted); font-size: .75rem; }
}

/* Portals and auth screens have no public dock */
@media (max-width: 900px) { :root { --dock-h: 0px; } }

.prio { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; } .prio--high { background: var(--danger); } .prio--med { background: var(--sun); } .prio--low { background: var(--ok); }

@media (max-width: 760px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpis .stat .v { font-size: 1.7rem; } }

/* ---------- Staff/admin + student portals on phones: compact, consistent spacing ---------- */
@media (max-width: 960px) {
  .topbar { height: 60px; gap: .55rem; padding: 0 .85rem; }
  .topbar .btn-circle { width: 42px; height: 42px; }
  .topbar .btn--sm { min-height: 42px; padding-inline: .8rem; }
  .tabbar a { min-width: 0; padding: 0 2px; white-space: nowrap; }
  .side__user > div { min-width: 0; } .side__user b { overflow-wrap: anywhere; }
}
@media (max-width: 760px) {
  .canvas { padding-top: 1rem; padding-inline: .9rem; }
  .phead { gap: .8rem; margin-bottom: 1.2rem; } .phead h1 { font-size: 1.5rem; line-height: 1.15; } .phead p { font-size: .9rem; line-height: 1.5; }
  .phead > .row { width: 100%; gap: .5rem; }
  .canvas .card { padding: 1.05rem 1rem; } .canvas .card h3 { font-size: 1.08rem; margin-bottom: .7rem; }
  .canvas .grid { gap: .8rem; } .canvas .mt-3 { margin-top: 1rem; } .canvas .mb-2 { margin-bottom: 1rem; }
  .kpis { gap: .6rem; } .app--staff .stat, .app--admin .stat, .canvas .stat { padding: .85rem .9rem; } .kpis .stat .k { font-size: .64rem; } .kpis .stat .d { font-size: .7rem; line-height: 1.35; }
  .setting { gap: 1rem; padding: .85rem 0; } .setting > div { min-width: 0; }
  .canvas .empty { padding: 1.8rem 1.1rem; }
  .list li > span, .canvas td { overflow-wrap: anywhere; min-width: 0; }
  .mini-form .select, .mini-form .input { font-size: 16px; } /* below 16px, iOS zooms the page on focus */
  .banner-verify { font-size: .8rem; } .banner-verify span { min-width: 0; overflow-wrap: anywhere; }
}
@media (max-width: 420px) {
  .seg > .chip { min-height: 40px; padding: .4em .8em; font-size: .85rem; }
  .seg { gap: .35rem; }
}
@media (max-width: 350px) { .seg > .chip { padding-inline: .7em; font-size: .8rem; } .seg { gap: .3rem; } }

/* Portals on phones: the assistant lives in the top bar instead of floating over content (desktop keeps the floating button) */
@media (max-width: 960px) {
  .topbar__ai { display: inline-grid; }
  .app ~ .assist .assist__launchers { display: none; }
}
@media (max-width: 480px) { .topbar .btn--ghost.btn--sm { display: none; } /* the website link stays in the menu (logo) */ }
