/* ============================================================================
   Studyfin — unified dashboard design layer.

   One consistent "platform" look across every role workspace (student, school
   teacher, school admin, tutor): a gradient hero header, calm roomy cards, and
   consistent section headings. Mirrors the student dashboard aesthetic.

   SCOPED to `body.sf-dash` so public/marketing pages are never affected, and
   uses theme tokens (var(--surface)/var(--border)) so dark mode still works.
   ========================================================================== */

/* ServiceNow-style typeface (Lato) — @import must lead the file. */
@import url('https://fonts.googleapis.com/css2?family=Lato:wght@300;400;700;900&display=swap');

/* ---- Premier type system (ServiceNow feel): Lato, confident headings, roomy
   line-height, clear tracking — so facts read crisply and the platform feels
   premium. Scoped to sf-dash (every page) without touching dark-mode tokens. */
body.sf-dash {
  font-family: 'Lato', 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  font-size: 23px;   /* extra-large, kid-readable base for the app (student/parent/school) */
}
body.sf-dash h1, body.sf-dash h2, body.sf-dash h3 { font-weight: 900; letter-spacing: -.02em; line-height: 1.12; }
body.sf-dash h4, body.sf-dash h5, body.sf-dash .section-title { font-weight: 700; letter-spacing: -.01em; }
/* Bigger body copy on dashboards. Bare element selectors stay low-specificity so
   component rules still win; this only lifts otherwise-unstyled text. */
body.sf-dash p, body.sf-dash li { font-size: 20px; line-height: 1.7; }
body.sf-dash .subtle { line-height: 1.7; }

/* ---- Calm, roomy cards everywhere ---- */
body.sf-dash .card {
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: 0 6px 24px rgba(2, 6, 23, .05);
  padding: 24px;
}
body.sf-dash .card.tight { padding: 18px; }

/* ---- Gradient hero header ----
   Works for the standard `.dash-header` (school, tutor dashboards) and an
   explicit `.dash-hero` we add to pages that lacked a header. */
body.sf-dash .dash-header,
body.sf-dash .dash-hero {
  background: linear-gradient(120deg, #7c5cff, #22d3ee);
  border: none;
  border-radius: 22px;
  padding: 22px 26px;
  margin: 18px 0 24px;
  color: #fff;
  box-shadow: 0 14px 36px rgba(124, 92, 255, .24);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  position: relative;
  overflow: hidden;
}
/* soft light bloom in the corner */
body.sf-dash .dash-header::after,
body.sf-dash .dash-hero::after {
  content: "";
  position: absolute;
  right: -40px; top: -40px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(255, 255, 255, .16), transparent 70%);
  pointer-events: none;
}
body.sf-dash .dash-header > *,
body.sf-dash .dash-hero > * { position: relative; z-index: 1; }

body.sf-dash .dash-header h1,
body.sf-dash .dash-hero h1 {
  color: #fff;
  font-size: clamp(22px, 3vw, 28px);
  margin: 0;
  letter-spacing: -.02em;
  font-weight: 800;
}
body.sf-dash .dash-header .subtle,
body.sf-dash .dash-hero .subtle { color: rgba(255, 255, 255, .92); }

body.sf-dash .dash-head-main { display: flex; align-items: center; gap: 14px; }
body.sf-dash .dash-avatar {
  width: 60px; height: 60px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .2);
  padding: 5px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .3);
}

/* Pills + ghost buttons sitting on the hero stay legible (glassy/white). */
body.sf-dash .dash-header .pill,
body.sf-dash .dash-hero .pill {
  background: rgba(255, 255, 255, .22);
  color: #fff !important;
  border: 1px solid rgba(255, 255, 255, .3);
  font-weight: 700;
}
body.sf-dash .dash-header .btn-ghost,
body.sf-dash .dash-hero .btn-ghost {
  color: #fff;
  border-color: rgba(255, 255, 255, .45);
}
body.sf-dash .dash-header .btn-ghost:hover,
body.sf-dash .dash-hero .btn-ghost:hover { background: rgba(255, 255, 255, .14); }

/* ---- Consistent section headings ----
   `.section-title` gets a quiet gradient accent bar (matches the student page's
   h2 treatment); plain h2/h3 just get the confident tracking. */
body.sf-dash h2 { letter-spacing: -.01em; }
body.sf-dash .section-title {
  font-weight: 800;
  letter-spacing: -.01em;
  display: flex;
  align-items: center;
  gap: 10px;
}
body.sf-dash .section-title::before {
  content: "";
  flex: none;
  width: 5px; height: 20px;
  border-radius: 999px;
  background: linear-gradient(180deg, #7c5cff, #22d3ee);
}

/* ---- Motion: "flow as you scroll" (ServiceNow-style) ----
   Gated on html.sf-anim, which theme.js only adds when JS runs AND motion is
   allowed — so content is NEVER hidden without JS or under reduced-motion. */
html.sf-anim .sf-reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .6s cubic-bezier(.2,.6,.2,1), transform .6s cubic-bezier(.2,.6,.2,1);
  will-change: opacity, transform;
}
html.sf-anim .sf-reveal.sf-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html.sf-anim .sf-reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
}

/* ---- Polish: smooth, considered motion + breathing room ---- */
body.sf-dash .btn { transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease, border-color .15s ease; }
body.sf-dash .btn:hover { transform: translateY(-1px); }
body.sf-dash .card { transition: transform .18s ease, box-shadow .2s ease; }
/* Anchored sections clear the sticky nav when jumped to. */
body.sf-dash section[id], body.sf-dash .help-cat[id], body.sf-dash .help-article[id] { scroll-margin-top: 84px; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ---- Tabbed dashboard (shared across role portals) ----
   KPI band + tabs that show one focused section at a time. Pages opt in with
   .pdash-kpis / .pdash-tabs (.ptab[data-view]) / .pview[data-view], and tag any
   block with data-ptab="<view>"; assets/dash-tabs.js relocates + wires them. */
body.sf-dash .pdash-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 4px 0 20px; }
body.sf-dash .pkpi { background: var(--surface, #fff); border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px; box-shadow: 0 4px 16px rgba(2,6,23,.05); }
body.sf-dash .pkpi .v { font-size: 26px; font-weight: 900; letter-spacing: -.02em; line-height: 1.05; }
body.sf-dash .pkpi .l { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
body.sf-dash .pdash-tabs { display: flex; gap: 2px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-bottom: 22px; }
body.sf-dash .ptab { padding: 10px 16px; border: 0; background: none; font: inherit; font-size: 16px; font-weight: 700; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; border-radius: 8px 8px 0 0; }
body.sf-dash .ptab:hover { color: var(--ink); background: rgba(124,92,255,.06); }
body.sf-dash .ptab.active { color: var(--brand-1); border-bottom-color: var(--brand-1); }
body.sf-dash .pview { display: none; }
body.sf-dash .pview.active { display: block; }
/* Prominent, always-tappable login button (no hover dropdown). */
body.sf-dash .nav .nav-login { min-height: 42px; display: inline-flex; align-items: center; }

/* Generic card-tiling grid for dashboards (fills width, stacks on mobile). */
body.sf-dash .pdash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 18px; align-items: start; }
body.sf-dash .pdash-grid > .card, body.sf-dash .pdash-grid > section { max-width: none !important; margin: 0 !important; height: 100%; }
@media (max-width: 720px) { body.sf-dash .pdash-grid { grid-template-columns: 1fr; } }

/* ---- iOS safe areas (notch / Dynamic Island / home indicator) ----
   With viewport-fit=cover, backgrounds go edge-to-edge; these insets keep
   content out of the unsafe zones. env() resolves to 0 on devices without a
   notch, so these are no-ops everywhere else. */
.topbar { padding-top: max(9px, env(safe-area-inset-top)); }
.nav { padding-top: max(18px, env(safe-area-inset-top)); }
.topbar + .nav { padding-top: 18px; }   /* the promo bar already cleared the top */
@media (orientation: landscape) {
  body.sf-dash { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
}
/* Floating/fixed UI clears the home indicator (and notch side in landscape). */
.sf-prefs   { bottom: calc(14px + env(safe-area-inset-bottom)); }
.sf-toasts  { bottom: calc(22px + env(safe-area-inset-bottom)); }
.finn-fx    { bottom: calc(18px + env(safe-area-inset-bottom)); }
.finn-buddy { bottom: calc(84px + env(safe-area-inset-bottom)); }

/* ---- Responsive safety: renders correctly on phone / tablet / desktop ----
   Fluid by default; these guards stop any single element from forcing horizontal
   scroll or clipping content, at any width. */
html { overflow-x: clip; }                              /* no horizontal page scroll (position:sticky-safe) */
body.sf-dash img, body.sf-dash video { max-width: 100%; }
body.sf-dash .eyebrow { max-width: 100%; }              /* long badge text wraps instead of forcing page width */
body.sf-dash td, body.sf-dash th, body.sf-dash .feed-row { overflow-wrap: break-word; }
/* A card containing a wide table scrolls inside itself at ANY width (the table
   keeps its real layout; the page never overflows). */
body.sf-dash .card:has(> table),
body.sf-dash .card:has(> div > table) { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---- Tablet (iPad portrait ~768–1024) ---- */
@media (max-width: 1024px) {
  body.sf-dash .ov-cols { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 820px) {
  body.sf-dash .ov-cols { grid-template-columns: 1fr; }   /* stack the two-up command-center columns */
  body.sf-dash .dash-header h1, body.sf-dash .dash-hero h1 { font-size: clamp(20px, 4vw, 26px); }
}

/* ---- Mobile ---- */
@media (max-width: 640px) {
  body.sf-dash .dash-header,
  body.sf-dash .dash-hero { padding: 18px; gap: 12px; }
  body.sf-dash .dash-header h1,
  body.sf-dash .dash-hero h1 { font-size: 21px; }
  body.sf-dash .card { padding: 18px; }

  /* Tighter, less-wrappy nav on phones. */
  body.sf-dash .nav { padding: 12px 16px; }
  body.sf-dash .nav .btn,
  body.sf-dash .nav .pill { padding: 6px 10px; font-size: 13px; }
  body.sf-dash .brand { font-size: 19px; }
  /* …but Login stays a big, obvious tap target (don't shrink it). */
  body.sf-dash .nav .nav-login { padding: 11px 18px !important; font-size: 16.5px !important; }

  /* Wide tables: only the card holding a table scrolls horizontally, so the
     table keeps its real layout and nothing else is affected (:has scoping). */
  body.sf-dash .card:has(> table),
  body.sf-dash .card:has(> div > table) { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  body.sf-dash table { min-width: max-content; }

  /* Common wide grids collapse to one column on small screens. */
  body.sf-dash .search-row { flex-direction: column; align-items: stretch; }
  body.sf-dash .search-row input,
  body.sf-dash .search-row select { width: 100%; }
}
