/* ==========================================================================
   ToSkool (تو سكول) — App UI (platform / admin / teacher / parent / student)
   Identity: "Soft learning space" — ToSkool teal family, soft teal-tinted canvas,
   large bubble cards (24px), El Messiri display headings, top app bar with the
   space switcher (school × role) as the hero + horizontal icon navigation.
   Builds on ../../../shared/css/base.css
   ========================================================================== */
@import url("https://fonts.googleapis.com/css2?family=El+Messiri:wght@600;700&family=Nunito:wght@700;800;900&display=swap");

:root {
  --brand: #4fb3b5;          /* teal — primary */
  --brand-600: #3a9a9c;
  --brand-700: #2b7f82;
  --brand-soft: #e6f4f5;
  --powder: #cfe6ea;         /* active nav pill */
  --powder-2: #bcd7de;
  --teal: #4fb3b5;
  --teal-soft: #e6f4f5;
  --slate: #4a5560;
  --slate-2: #5f6670;
  --ink: #2b3440;
  --yellow: #f4b740; --yellow-soft: #fdf3dc;
  --blue: #6aa7d8;   --blue-soft: #e8f1fa;
  --coral: #f08a7e;  --coral-soft: #fdecea;
  --violet: #8b7fd6; --violet-soft: #efedfa;
  --green: #5bbf8f;  --green-soft: #e4f5ec;
  --accent: #f4b740;
  --accent-soft: #fdf3dc;
  --sidebar: #ffffff;
  --sidebar-text: #4a5560;
  --bg: #f2f8f8;
  --surface-2: #f7fafb;
  --border: #e3ecee;
  --text: #2b3440;
  --text-2: #5c6773;
  --muted: #98a3ad;
  --success: #3a9a9c; --success-soft: #e0f2f2;
  --danger: #e2685b; --danger-soft: #fdecea;
  --warning: #d4952a; --warning-soft: #fdf3dc;
  --info: #4a8cc4; --info-soft: #e8f1fa;
  --sidebar-w: 0px;          /* no sidebar any more (top app bar) */
  --appbar-h: 68px;
  --nav-h: 54px;
  --header-h: calc(var(--appbar-h) + var(--nav-h) + 2px); /* full sticky header — pages use it for sticky offsets */
  --r-card: 24px;
  --shadow-soft: 0 1px 2px rgba(43,127,130,.04), 0 12px 30px -14px rgba(43,127,130,.18);
  --shadow-lg: 0 24px 60px rgba(43,52,64,.12);
  --gradient-brand: linear-gradient(135deg, #76c4c8 0%, #4fb3b5 50%, #3a9a9c 100%);
  --gradient-soft: linear-gradient(135deg, #eaf6f7 0%, #f4fafb 60%, #ffffff 100%);
  --font-latin: "Nunito", "Cairo", system-ui, sans-serif;
  --font-display: "El Messiri", "Cairo", system-ui, sans-serif;
}

body.app {
  overflow-x: hidden; color: var(--text); background-color: var(--bg);
  background-image: radial-gradient(900px 460px at 100% -8%, rgba(79,179,181,.17), transparent 70%), radial-gradient(760px 420px at -6% 4%, rgba(106,167,216,.11), transparent 70%), linear-gradient(180deg, #e8f4f5 0, var(--bg) 560px);
  background-repeat: no-repeat;
}
.hidden { display: none !important; }
svg.lucide { width: 18px; height: 18px; stroke-width: 2; flex-shrink: 0; }
h1, h2, h3, h4 { color: var(--ink); font-family: var(--font-display); font-weight: 700; letter-spacing: 0; }

/* ---------- Wordmark (toskool) ---------- */
.tk-logo { display: inline-flex; align-items: baseline; direction: ltr; font-family: var(--font-latin); font-weight: 900; font-size: 30px; letter-spacing: -.5px; line-height: 1; color: #5f6670; user-select: none; }
.tk-logo .to { color: #5bbcbf; }
.tk-logo .oo { display: inline-flex; gap: .04em; margin: 0 .03em; align-items: flex-end; height: .74em; }
.tk-logo .oo i { position: relative; display: inline-block; width: .5em; height: .56em; border-radius: 50% 50% 48% 48% / 56% 56% 44% 44%; background: #5f6670; }
.tk-logo .oo i:first-child::before { content: ""; position: absolute; left: 50%; top: -.2em; width: .5em; height: .26em; transform: translateX(-50%);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 12'%3E%3Cpath d='M12 6 3 1.2Q.6 6 3 10.8Z M12 6l9-4.8q2.4 4.8 0 9.6Z' fill='%235bbcbf'/%3E%3Ccircle cx='12' cy='6' r='2.4' fill='%233a9a9c'/%3E%3C/svg%3E") center/contain no-repeat; }
.tk-logo .oo i:last-child::before { content: ""; position: absolute; inset: -.06em .02em auto; height: .2em; border-radius: .3em .3em 0 0; border-top: .07em solid #5bbcbf; }
.tk-logo.sm { font-size: 22px; }
.tk-logo.lg { font-size: 42px; }
.tk-logo.light { color: #fff; }
.tk-logo.light .oo i { background: #fff; }
.tk-logo.light .to { color: #a7e3e5; }


/* ---------- Layout — "soft learning space": top app bar (no sidebar) ---------- */
.main { min-height: 100vh; display: flex; flex-direction: column; }
.content { padding: 30px 32px 44px; flex: 1; width: 100%; max-width: 1480px; margin-inline: auto; }

/* ---------- Top app bar ---------- */
.topbar-app {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255,255,255,.86); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid rgba(188,215,222,.55); box-shadow: 0 10px 30px -12px rgba(43,127,130,.16);
}
.appbar { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 16px; height: var(--appbar-h); padding: 0 28px; max-width: 1540px; margin-inline: auto; }
.appbar-start { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand { display: inline-flex; align-items: center; gap: 10px; }
.appbar .brand .tk-logo { font-size: 28px; }
.brand-mini { display: none; width: 38px; height: 38px; border-radius: 50%; place-items: center; background: var(--gradient-brand); color: #fff; font-family: var(--font-latin); font-weight: 900; font-size: 15px; box-shadow: 0 6px 14px rgba(79,179,181,.35); }
.brand-mark { width: 40px; height: 40px; border-radius: 13px; background: var(--gradient-brand); display: grid; place-items: center; color: #fff; box-shadow: 0 8px 18px rgba(79,179,181,.3); }
.brand-mark svg { width: 22px; height: 22px; color: #fff; }
.header-actions { display: flex; align-items: center; gap: 8px; justify-self: end; min-width: 0; }
.icon-btn.menu-toggle { display: none; }
.icon-btn.search-toggle { display: none; }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--border); background: #fff; display: grid; place-items: center; color: var(--slate); cursor: pointer; position: relative; transition: .15s; font: inherit; flex-shrink: 0; }
.icon-btn:hover { color: var(--brand-700); border-color: var(--powder-2); background: var(--brand-soft); }
.icon-btn .dot-count { position: absolute; top: -5px; inset-inline-end: -5px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--coral); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; }
.icon-btn.lang-btn { font-size: 12px; font-weight: 800; width: auto; padding: 0 14px; gap: 6px; display: inline-flex; align-items: center; border-radius: 999px; }
.user-btn { display: flex; align-items: center; gap: 10px; padding-block: 3px; padding-inline: 3px 12px; border-radius: 999px; border: 1px solid var(--border); background: #fff; cursor: pointer; font: inherit; text-align: start; }
.user-btn:hover { border-color: var(--powder-2); box-shadow: var(--shadow-soft); }
.user-btn .meta { min-width: 0; }
.user-btn .meta b { display: block; font-size: 13px; color: var(--ink); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.user-btn .meta small { font-size: 11px; color: var(--muted); white-space: nowrap; }
.user-btn > svg { color: var(--muted); width: 16px; }

/* Horizontal icon navigation (2nd row) */
.appnav { border-top: 1px solid rgba(227,236,238,.9); background: linear-gradient(180deg, rgba(234,246,247,.75), rgba(244,250,250,.55)); }
.appnav-inner { max-width: 1540px; margin-inline: auto; padding: 0 28px; height: var(--nav-h); display: flex; align-items: center; gap: 14px; }
.nav-scroll { flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; padding: 4px 2px; scroll-behavior: smooth; }
.nav-scroll::-webkit-scrollbar { display: none; }
.nav-scroll.ov { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%); mask-image: linear-gradient(90deg, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%); padding-inline: 18px; }
.nav-section { width: 1px; height: 22px; background: var(--powder-2); margin: 0 8px; flex-shrink: 0; border-radius: 1px; }
.nav-link { display: inline-flex; align-items: center; gap: 8px; padding-block: 4px; padding-inline: 4px 14px; border-radius: 999px; color: var(--slate); font-weight: 700; font-size: 13.5px; white-space: nowrap; flex-shrink: 0; transition: background .15s, color .15s; position: relative; }
.nav-link .nl-ic { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: #fff; color: #6b7681; box-shadow: inset 0 0 0 1px var(--border); transition: .15s; flex-shrink: 0; }
.nav-link .nl-ic svg { width: 16px; height: 16px; }
.nav-link:hover { background: rgba(207,230,234,.5); color: var(--ink); }
.nav-link:hover .nl-ic { color: var(--brand-700); box-shadow: inset 0 0 0 1px var(--powder-2); }
.nav-link.active { background: var(--powder); color: var(--ink); }
.nav-link.active .nl-ic { background: var(--brand); color: #fff; box-shadow: 0 5px 12px rgba(79,179,181,.38); }
.nav-link .count { background: var(--coral); color: #fff; font-size: 11px; font-weight: 700; padding: 0 7px; border-radius: 999px; line-height: 18px; }
.nav-link .count.soft { background: #fff; color: var(--brand-700); box-shadow: inset 0 0 0 1px var(--powder-2); }
.appnav-tools { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.global-search { position: relative; width: 250px; }
.global-search input { width: 100%; height: 38px; border: 1px solid var(--border); background: #fff; border-radius: 999px; padding-block: 0; padding-inline: 40px 42px; font: inherit; font-size: 13px; transition: .15s; color: var(--text); }
.global-search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.global-search > svg { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; }
.global-search kbd { position: absolute; inset-inline-end: 12px; top: 50%; transform: translateY(-50%); font: 600 11px var(--font); color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 0 6px; background: #fff; }
.search-results { position: absolute; top: calc(100% + 10px); inset-inline-end: 0; width: min(440px, calc(100vw - 24px)); z-index: 60; }

/* Footer (by المجرات) */
.app-foot { border-top: 1px solid rgba(188,215,222,.5); background: rgba(255,255,255,.5); }
.app-foot .af-inner { max-width: 1480px; margin-inline: auto; padding: 16px 32px; display: flex; align-items: center; justify-content: space-between; gap: 12px 18px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.af-brand { display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.af-brand .tk-logo { font-size: 20px; }
.af-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.af-link { display: inline-flex; align-items: center; gap: 6px; color: var(--slate); font-weight: 700; }
.af-link:hover { color: var(--brand-700); }
.af-link svg { width: 15px; height: 15px; }
.app-foot .lang-seg { width: 190px; }
.lang-seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.lang-seg button { border: 0; background: none; font: inherit; font-size: 12px; font-weight: 700; color: var(--text-2); padding: 6px 8px; border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.lang-seg button.active { background: #fff; color: var(--brand-700); box-shadow: 0 1px 3px rgba(43,52,64,.1); }
.lang-seg button svg { width: 14px; height: 14px; }
.by-almgrat { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.by-almgrat img { width: 18px; height: 18px; }

/* ---------- Space switcher — the hero of the header ---------- */
.space-switch { position: relative; min-width: 0; justify-self: center; max-width: 100%; }
.space-btn {
  display: inline-flex; align-items: center; gap: 10px; height: 54px; max-width: 100%; padding-block: 5px; padding-inline: 5px 8px;
  border-radius: 999px; border: 2px solid transparent; cursor: pointer; font: inherit; color: var(--ink); transition: box-shadow .18s, transform .18s;
  background: linear-gradient(#fff, #fff) padding-box, linear-gradient(120deg, #a7e0e2, #4fb3b5 45%, #6aa7d8 80%, #8b7fd6) border-box;
  box-shadow: 0 10px 26px -6px rgba(79,179,181,.32);
}
.space-btn:hover, .space-switch.open .space-btn { box-shadow: 0 0 0 5px rgba(79,179,181,.14), 0 14px 30px -6px rgba(79,179,181,.38); transform: translateY(-1px); }
.space-btn > .school-chip { width: 40px; height: 40px; border-radius: 50%; font-size: 13px; }
.space-btn .meta { min-width: 0; text-align: start; line-height: 1.15; display: flex; flex-direction: column; }
.space-btn .meta .sp-cap { font-size: 10px; font-weight: 700; color: var(--brand-600); letter-spacing: .2px; }
.space-btn .meta b { display: block; font-family: var(--font-display); font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.25; }
.space-btn .meta .sp-title { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
.space-btn .role-badge { flex-shrink: 0; }
.sp-others { display: inline-flex; align-items: center; padding-inline-start: 10px; border-inline-start: 1px solid var(--border); flex-shrink: 0; }
.sp-others .school-chip { width: 24px; height: 24px; border-radius: 50%; font-size: 9px; border: 2px solid #fff; margin-inline-start: -7px; box-shadow: 0 0 0 1px color-mix(in srgb, var(--sc) 30%, transparent); }
.sp-others .school-chip:first-child { margin-inline-start: 0; }
.sp-others em { font-style: normal; font-size: 11px; font-weight: 800; color: var(--brand-700); margin-inline-start: 4px; }
.space-btn kbd { font: 700 10px var(--font); color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 0 5px; flex-shrink: 0; }
.sp-chev { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-700); flex-shrink: 0; }
.sp-chev svg { width: 15px; height: 15px; }
.space-menu { position: absolute; top: calc(100% + 12px); left: 50%; margin-left: -215px; width: 430px; max-width: calc(100vw - 24px); z-index: 55; background: #fff; border: 1px solid var(--border); border-radius: 26px; box-shadow: var(--shadow-lg); padding: 8px; opacity: 0; visibility: hidden; transform: translateY(-6px); transition: .16s ease; }
.space-menu::before { content: ""; position: absolute; top: -7px; left: 50%; width: 14px; height: 14px; margin-left: -7px; background: #fff; border-top: 1px solid var(--border); border-left: 1px solid var(--border); transform: rotate(45deg); border-radius: 3px 0 0 0; }
.space-switch.open .space-menu { opacity: 1; visibility: visible; transform: none; }
.space-menu .sm-head { padding: 10px 12px 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.space-menu .sm-head b { font-size: 16px; }
.space-menu .sm-head small { color: var(--muted); font-size: 12px; }
.space-group { padding: 4px 0; }
.space-group + .space-group { border-top: 1px dashed var(--border); }
.space-group-title { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; color: var(--muted); padding: 8px 12px 4px; }
.space-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 18px; border: 0; background: none; cursor: pointer; font: inherit; text-align: start; color: var(--text); transition: .12s; }
.space-item:hover, .space-item:focus-visible { background: #f1f7f8; outline: none; }
.space-item.current { background: var(--brand-soft); }
.space-item .school-chip { border-radius: 50%; }
.space-item .meta { flex: 1; min-width: 0; }
.space-item .meta b { display: block; font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.space-item .meta small { display: block; font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.space-item .check-ic { width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; flex-shrink: 0; }
.space-item .check-ic svg { width: 14px; height: 14px; stroke-width: 3; }
.space-item .go-ic { color: var(--muted); width: 16px; }
.space-menu .sm-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 8px 4px 4px; border-top: 1px solid var(--border); margin-top: 4px; }
.space-menu .sm-foot a { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--slate); background: var(--surface-2); }
.space-menu .sm-foot a:hover { background: var(--powder); color: var(--ink); }
.space-menu .sm-hint { font-size: 11px; color: var(--muted); text-align: center; padding: 6px 0 2px; }

/* School chips (tenant logo) */
.school-chip { --sc: var(--brand); width: 38px; height: 38px; border-radius: 12px; display: inline-grid; place-items: center; flex-shrink: 0; font-weight: 800; font-size: 13px; color: var(--sc); background: color-mix(in srgb, var(--sc) 14%, #fff); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--sc) 30%, transparent); }
.school-chip.sm { width: 28px; height: 28px; border-radius: 9px; font-size: 11px; }
.school-chip.lg { width: 56px; height: 56px; border-radius: 18px; font-size: 18px; }
.school-chip.xl { width: 76px; height: 76px; border-radius: 24px; font-size: 24px; }
.school-chip.solid { background: var(--sc); color: #fff; box-shadow: 0 8px 18px color-mix(in srgb, var(--sc) 35%, transparent); }
.school-chip.platform { background: var(--gradient-brand); color: #fff; font-family: var(--font-latin); box-shadow: none; }
.school-tag { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.school-tag b { display: block; font-size: 14px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.school-tag small { display: block; font-size: 12px; color: var(--muted); }

/* Role badges */
.role-badge { --rc: var(--brand); display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; color: var(--rc); background: color-mix(in srgb, var(--rc) 13%, #fff); white-space: nowrap; }
.role-badge svg { width: 13px; height: 13px; }
.role-badge.lg { font-size: 13px; padding: 5px 12px; }
.r-platform { --rc: #2b7f82; }
.r-admin    { --rc: #7a6bd0; }
.r-teacher  { --rc: #3a9a9c; }
.r-parent   { --rc: #4a8cc4; }
.r-student  { --rc: #d08a1e; }

/* Transition overlay (switching spaces) */
.space-overlay { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; background: rgba(244,248,249,.82); backdrop-filter: blur(10px); opacity: 0; transition: opacity .25s ease; }
.space-overlay.show { opacity: 1; }
.space-overlay .so-card { text-align: center; padding: 34px 40px; border-radius: 28px; background: #fff; box-shadow: var(--shadow-lg); max-width: 420px; width: calc(100% - 32px); transform: translateY(10px) scale(.98); transition: transform .3s ease; }
.space-overlay.show .so-card { transform: none; }
.space-overlay .so-chip { margin: 0 auto 16px; position: relative; width: max-content; }
.space-overlay .so-chip::after { content: ""; position: absolute; inset: -8px; border-radius: 30px; border: 3px solid var(--brand-soft); border-top-color: var(--brand); animation: spin .8s linear infinite; }
.space-overlay h3 { font-size: 18px; margin-bottom: 4px; }
.space-overlay p { color: var(--text-2); font-size: 14px; margin: 0; }
.space-overlay .so-bar { height: 5px; border-radius: 5px; background: var(--brand-soft); overflow: hidden; margin-top: 18px; }
.space-overlay .so-bar span { display: block; height: 100%; width: 0; background: var(--gradient-brand); border-radius: inherit; animation: soBar .75s ease forwards; }
@keyframes soBar { to { width: 100%; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Dropdowns ---------- */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 10px); left: 0; min-width: 250px; z-index: 50;
  background: #fff; border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg);
  padding: 6px; opacity: 0; visibility: hidden; transform: translateY(-6px); transition: .16s ease;
}
.dropdown.open > .dropdown-menu, .dropdown-menu.show { opacity: 1; visibility: visible; transform: none; }
.dropdown-menu a, .dropdown-menu button.item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 11px; color: var(--text); font: inherit; font-size: 14px; font-weight: 500; background: none; border: 0; cursor: pointer; text-align: right; }
.dropdown-menu a:hover, .dropdown-menu button.item:hover { background: #f1f7f8; }
.dropdown-menu a svg, .dropdown-menu button.item svg { color: var(--muted); }
.dropdown-menu .danger, .dropdown-menu .danger svg { color: var(--danger); }
.dropdown-menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.dropdown-head { padding: 12px 12px 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dropdown-head b { font-size: 15px; }
.notif-menu { width: 380px; padding: 0; }
.notif-list { max-height: 380px; overflow-y: auto; }
.notif-item { display: flex; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--border); position: relative; }
.notif-item.unread { background: #f3fafa; }
.notif-item.unread::after { content: ""; position: absolute; left: 14px; top: 18px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.notif-item p { margin: 0; font-size: 13px; color: var(--text-2); line-height: 1.5; }
.notif-item b { font-size: 14px; display: block; }
.notif-item small { font-size: 12px; color: var(--muted); }
.notif-foot { display: block; text-align: center; padding: 12px; border-top: 1px solid var(--border); font-weight: 700; font-size: 14px; color: var(--brand-700); }

.search-panel { background: #fff; border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 8px; max-height: 440px; overflow-y: auto; }
.search-scope { display: flex; align-items: center; gap: 8px; padding: 6px 10px 8px; font-size: 12px; color: var(--text-2); border-bottom: 1px dashed var(--border); margin-bottom: 4px; }
.search-group { font-size: 11px; font-weight: 700; color: var(--muted); padding: 8px 10px 4px; }
.search-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; color: var(--text); }
.search-item:hover, .search-item.focus { background: var(--brand-soft); }
.search-item .sub { font-size: 12px; color: var(--muted); }
.search-item .tail { margin-right: auto; }
.search-empty { padding: 24px; text-align: center; color: var(--muted); font-size: 14px; }

/* ---------- Page header ---------- */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 6px; flex-wrap: wrap; }
.breadcrumb a { color: var(--text-2); }
.breadcrumb a:hover { color: var(--brand-700); }
.breadcrumb svg { width: 14px; height: 14px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; font-weight: 800; margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--text-2); font-size: 14px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Buttons (extend base) ---------- */
.btn { border-radius: 999px; padding: 9px 18px; font-size: 14px; }
.btn-sm { padding: 6px 13px; font-size: 13px; }
.btn-sm svg { width: 15px; height: 15px; }
.btn-lg { padding: 13px 24px; font-size: 15px; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(79,179,181,.28); }
.btn-primary:hover { background: var(--brand-600); color: #fff; }
.btn-soft { background: var(--brand-soft); color: var(--brand-700); }
.btn-soft:hover { background: var(--powder); color: var(--ink); }
.btn-outline { border-color: var(--border); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand-700); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #1f2630; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-accent { background: var(--yellow); color: #3d2f0b; font-weight: 700; }
.btn-accent:hover { filter: brightness(1.04); color: #3d2f0b; }
.btn-teal { background: var(--brand-700); color: #fff; }
.btn-teal:hover { background: #226a6d; color: #fff; }
.btn-icon { width: 34px; height: 34px; padding: 0; border-radius: 11px; border: 1px solid var(--border); background: #fff; color: var(--text-2); display: inline-grid; place-items: center; cursor: pointer; }
.btn-icon:hover { color: var(--brand-700); border-color: var(--powder-2); background: var(--brand-soft); }
.btn-icon svg { width: 16px; height: 16px; }
.btn-block { width: 100%; }
button:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Grid ---------- */
.grid { display: grid; gap: 20px; }
.grid > *, .stack > *, .row-between > *, .card { min-width: 0; } /* let wide tables scroll inside .table-wrap instead of stretching the page */
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.span-2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.text-muted { color: var(--muted); } .text-2 { color: var(--text-2); }
.text-success { color: var(--brand-700); } .text-gold { color: #c48a14; } .text-navy { color: var(--ink); } .text-danger { color: var(--danger); } .text-warning { color: var(--warning); } .text-brand { color: var(--brand-700); }
.fw-7 { font-weight: 700; } .fw-8 { font-weight: 800; }
.fs-12 { font-size: 12px; } .fs-13 { font-size: 13px; } .fs-14 { font-size: 14px; }
.nowrap { white-space: nowrap; }
.ltr { direction: ltr; unicode-bidi: embed; display: inline-block; }
.latin { font-family: var(--font-latin); }

/* ---------- Cards ---------- */
.card { border-radius: var(--r-card); border-color: var(--border); box-shadow: var(--shadow-soft); }
.card-pad { padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h3 { margin: 0; font-size: 16px; font-weight: 800; }
.card-head p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.card-body { padding: 20px 22px; }
.card-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--text-2); flex-wrap: wrap; }
.card.flat { box-shadow: none; }
a.card { color: inherit; transition: .18s ease; }
a.card:hover { transform: translateY(-2px); box-shadow: 0 16px 36px rgba(43,52,64,.08); border-color: var(--powder-2); }

/* KPI — icon in a soft square on the left (as in ToSkool) */
.kpi { padding: 20px; display: flex; flex-direction: column; gap: 12px; position: relative; overflow: hidden; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-icon { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; background: var(--c-soft, var(--brand-soft)); color: var(--c, var(--brand-700)); }
.kpi-icon svg { width: 22px; height: 22px; }
.kpi-label { font-size: 13px; color: var(--text-2); font-weight: 700; }
.kpi-value { font-size: 28px; font-weight: 800; line-height: 1; letter-spacing: -.3px; color: var(--ink); }
.kpi-value small { font-size: 14px; font-weight: 600; color: var(--muted); margin-right: 4px; }
.kpi-row { display: flex; align-items: center; gap: 14px; }
.kpi-row .kpi-icon { order: 2; margin-right: auto; }
.trend { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.trend svg { width: 13px; height: 13px; }
.trend.up { color: var(--brand-700); background: var(--brand-soft); }
.trend.down { color: var(--danger); background: var(--danger-soft); }
.trend.flat { color: var(--text-2); background: #eef3f5; }
.kpi-foot { font-size: 12px; color: var(--muted); }
.c-teal   { --c: #2b7f82; --c-soft: #e6f4f5; }
.c-green  { --c: #3f9e72; --c-soft: #e4f5ec; }
.c-blue   { --c: #4a8cc4; --c-soft: #e8f1fa; }
.c-amber  { --c: #c48a14; --c-soft: #fdf3dc; }
.c-gold   { --c: #c48a14; --c-soft: #fdf3dc; }
.c-red    { --c: #d4584b; --c-soft: #fdecea; }
.c-coral  { --c: #d4584b; --c-soft: #fdecea; }
.c-violet { --c: #6d60c4; --c-soft: #efedfa; }
.c-slate  { --c: #4a5560; --c-soft: #eef3f5; }
.c-navy   { --c: #2b3440; --c-soft: #eef3f5; }
.c-orange { --c: #d0782a; --c-soft: #fdeedf; }

/* Welcome banner (light & airy) */
.welcome {
  border-radius: 24px; padding: 26px 30px; position: relative; overflow: hidden; color: var(--ink);
  background: radial-gradient(70% 140% at 0% 0%, rgba(79,179,181,.22) 0%, rgba(79,179,181,0) 60%), linear-gradient(135deg, #e3f2f4 0%, #f2f9fa 55%, #ffffff 100%);
  border: 1px solid var(--border);
}
.welcome::after { content: ""; position: absolute; left: -50px; bottom: -90px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(79,179,181,.18), transparent 70%); pointer-events: none; }
.welcome::before { content: ""; position: absolute; left: 40px; top: 18px; width: 120px; height: 60px; background-image: radial-gradient(#bcd7de 1.5px, transparent 1.5px); background-size: 12px 12px; opacity: .8; pointer-events: none; }
.welcome h2 { font-size: 26px; font-weight: 800; margin-bottom: 4px; }
.welcome p { margin: 0; color: var(--text-2); }
.welcome .gold, .welcome .hl { color: var(--brand-700); font-weight: 700; }
.welcome > * { position: relative; z-index: 1; }

/* ---------- Badges ---------- */
.badge { font-size: 12px; padding: 3px 10px; gap: 6px; white-space: nowrap; }
.badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-slate { background: #eef3f5; color: #4a5560; }
.badge-violet { background: var(--violet-soft); color: #6d60c4; }
.badge-accent, .badge-gold, .badge-yellow { background: var(--yellow-soft); color: #a86f0c; }
.badge-navy { background: #e9eef1; color: var(--ink); }
.badge-success, .badge-teal { background: #e0f2f2; color: #2b7f82; }
.badge-brand { background: var(--brand-soft); color: var(--brand-700); }
.badge-info { background: var(--blue-soft); color: #3f7fb6; }
.badge-warning { background: var(--yellow-soft); color: #a86f0c; }
.badge-danger { background: var(--coral-soft); color: #c94d40; }
.badge-lg { font-size: 13px; padding: 5px 12px; }

/* ---------- Avatars (friendly, soft 3D) ---------- */
.avatar { width: 38px; height: 38px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 700; font-size: 14px; color: #fff; flex-shrink: 0;
  background: radial-gradient(circle at 32% 28%, rgba(255,255,255,.45), rgba(255,255,255,0) 46%), var(--av, var(--brand)); box-shadow: inset 0 -3px 6px rgba(0,0,0,.08), 0 3px 8px color-mix(in srgb, var(--av, var(--brand)) 28%, transparent); }
.avatar-sm { width: 30px; height: 30px; font-size: 12px; }
.avatar-lg { width: 56px; height: 56px; font-size: 20px; }
.avatar-xl { width: 96px; height: 96px; font-size: 34px; border: 4px solid #fff; }
.person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.person b { display: block; font-size: 14px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person small { display: block; font-size: 12px; color: var(--muted); }
a.person:hover b { color: var(--brand-700); }
.avatar-stack { display: flex; }
.avatar-stack .avatar { border: 2px solid #fff; margin-left: -10px; }

/* ---------- Tables ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; padding: 16px 22px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.toolbar .search-input { position: relative; flex: 1; min-width: 220px; max-width: 340px; }
.toolbar .search-input input { padding-right: 40px; }
.toolbar .search-input svg { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 17px; }
.toolbar .spacer { flex: 1; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: right; font-weight: 700; font-size: 12px; color: var(--text-2); background: #f7fafb; padding: 12px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid #edf3f4; vertical-align: middle; white-space: nowrap; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: #f6fbfb; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; }
.table .num { font-weight: 700; font-variant-numeric: tabular-nums; }
.table .code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; color: var(--text-2); direction: ltr; display: inline-block; }
.pagination { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pagination button { min-width: 32px; height: 32px; border-radius: 10px; border: 1px solid var(--border); background: #fff; font: inherit; font-size: 13px; cursor: pointer; color: var(--text-2); }
.pagination button.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-size: 13px; font-weight: 700; color: var(--text-2); }
.input, .select, .textarea {
  width: 100%; height: 44px; border: 1px solid var(--border); border-radius: 14px; padding: 0 14px;
  font: inherit; font-size: 14px; background: #fff; color: var(--text); transition: .15s;
}
.textarea { height: auto; min-height: 96px; padding: 10px 14px; resize: vertical; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2398a3ad' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 12px center; padding-left: 34px; }
.toolbar .select { width: auto; min-width: 140px; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.hint { font-size: 12px; color: var(--muted); }
.switch { position: relative; width: 44px; height: 24px; flex-shrink: 0; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cfd8dc; border-radius: 999px; cursor: pointer; transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 18px; height: 18px; right: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::before { transform: translateX(-20px); }
.check { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.choice { border: 1.5px solid var(--border); border-radius: 16px; padding: 16px; cursor: pointer; transition: .15s; background: #fff; position: relative; text-align: center; }
.choice:hover { border-color: var(--powder-2); }
.choice.selected { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px rgba(79,179,181,.16); }
.choice.selected::after { content: "✓"; position: absolute; top: 8px; left: 10px; width: 20px; height: 20px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 12px; display: grid; place-items: center; }
.choice .emoji { font-size: 30px; line-height: 1; margin-bottom: 8px; display: block; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 12px 16px; font: inherit; font-size: 14px; font-weight: 700; color: var(--text-2); background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--brand-700); border-bottom-color: var(--brand); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fade .2s ease; }
.seg { display: inline-flex; padding: 4px; background: #e9f1f3; border-radius: 999px; gap: 2px; }
.seg button { border: 0; background: none; font: inherit; font-size: 13px; font-weight: 700; color: var(--text-2); padding: 6px 14px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.seg button.active { background: #fff; color: var(--brand-700); box-shadow: 0 1px 3px rgba(43,52,64,.1); }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(43,52,64,.42); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; opacity: 0; transition: opacity .18s; }
.modal-backdrop.show { opacity: 1; }
.modal { background: #fff; border-radius: 24px; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 30px 80px rgba(43,52,64,.25); transform: translateY(12px) scale(.98); transition: transform .2s ease; }
.modal-backdrop.show .modal { transform: none; }
.modal.lg { max-width: 820px; }
.modal.sm { max-width: 420px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-body { padding: 22px 24px; overflow-y: auto; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-start; flex-wrap: wrap; }
.success-mark { width: 76px; height: 76px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-700); display: grid; place-items: center; margin: 4px auto 16px; animation: pop .35s ease; }
.success-mark svg { width: 38px; height: 38px; stroke-width: 2.5; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; bottom: 24px; left: 24px; z-index: 400; display: flex; flex-direction: column; gap: 10px; }
.toast { min-width: 280px; max-width: 380px; background: var(--ink); color: #fff; border-radius: 16px; padding: 14px 16px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow-lg); font-size: 14px; animation: toastIn .25s ease; }
.toast .t-icon { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: rgba(79,179,181,.25); color: #8fd6d8; flex-shrink: 0; }
.toast.error .t-icon { background: rgba(240,138,126,.25); color: #f6b0a7; }
.toast.info .t-icon { background: rgba(106,167,216,.25); color: #a9cdeb; }
.toast.warning .t-icon { background: rgba(244,183,64,.25); color: #f8d48a; }
.toast.hide { animation: toastOut .25s ease forwards; }

/* ---------- Lists / Feed ---------- */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--border); }
.feed li:last-child { border-bottom: 0; }
.feed .f-icon { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
.feed p { margin: 0; font-size: 14px; }
.feed small { color: var(--muted); font-size: 12px; }
.t-info { background: var(--blue-soft); color: #4a8cc4; }
.t-success { background: var(--brand-soft); color: var(--brand-700); }
.t-warning { background: var(--yellow-soft); color: #c48a14; }
.t-danger { background: var(--coral-soft); color: #d4584b; }
.t-brand { background: var(--powder); color: var(--ink); }
.t-violet { background: var(--violet-soft); color: #6d60c4; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid #edf3f4; }
.list-row:last-child { border-bottom: 0; }

/* Progress */
.progress { height: 8px; background: #e9f1f3; border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--c, var(--brand)); transition: width .6s ease; }
.ring { --p: 75; --c: var(--brand); width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--c) calc(var(--p) * 1%), #e9f1f3 0); position: relative; }
.ring::before { content: ""; position: absolute; inset: 12px; background: #fff; border-radius: 50%; }
.ring > * { position: relative; text-align: center; }
.ring b { font-size: 26px; font-weight: 800; display: block; line-height: 1; }
.ring small { font-size: 12px; color: var(--muted); }

/* Chart containers */
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 220px; }
.chart-box.lg { height: 340px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* Empty state */
.empty-state { padding: 48px 24px; }
.empty-state .empty-icon { background: var(--brand-soft); color: var(--brand-700); }

/* Info list */
.info-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; }
.info-list div small { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.info-list div b { font-size: 14px; font-weight: 600; }

/* Calendar (attendance) */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .dow { text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); padding: 4px 0; }
.cal .day { aspect-ratio: 1; border-radius: 10px; display: grid; place-items: center; font-size: 13px; font-weight: 600; background: #f4f8f9; color: var(--text-2); position: relative; }
.cal .day.p { background: var(--brand-soft); color: var(--brand-700); }
.cal .day.a { background: var(--coral-soft); color: #c94d40; }
.cal .day.l { background: var(--yellow-soft); color: #a86f0c; }
.cal .day.e { background: var(--blue-soft); color: #3f7fb6; }
.cal .day.today { outline: 2px solid var(--brand); outline-offset: 1px; }
.cal .day.future { background: transparent; color: #cbd5dc; }
.cal .day.empty { background: transparent; }

/* Lesson / session timeline */
.session { display: flex; gap: 14px; padding: 14px; border-radius: 16px; border: 1px solid var(--border); background: #fff; align-items: center; border-right: 4px solid var(--c, var(--brand)); }
.session .time { text-align: center; min-width: 64px; }
.session .time b { display: block; font-size: 16px; font-weight: 800; }
.session .time small { font-size: 12px; color: var(--muted); }
.session h4 { margin: 0 0 2px; font-size: 15px; }
.session .meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.session .meta span { display: inline-flex; align-items: center; gap: 4px; }
.session .meta svg { width: 14px; height: 14px; }
.session.live { background: linear-gradient(90deg, #fff, #f0f9f9); box-shadow: 0 0 0 3px var(--brand-soft); }
.live-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; color: #d4584b; }
.live-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #e2685b; box-shadow: 0 0 0 0 rgba(226,104,91,.5); animation: pulse 1.6s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(226,104,91,0); } 100% { box-shadow: 0 0 0 0 rgba(226,104,91,0); } }

/* Subject tile */
.subj-ic { --c: var(--brand); width: 40px; height: 40px; border-radius: 13px; display: inline-grid; place-items: center; flex-shrink: 0; color: var(--c); background: color-mix(in srgb, var(--c) 14%, #fff); }
.subj-ic svg { width: 19px; height: 19px; }
.subj-ic.sm { width: 30px; height: 30px; border-radius: 10px; }
.subj-ic.sm svg { width: 15px; height: 15px; }
.sport-tile { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 26px; background: color-mix(in srgb, var(--c, var(--brand)) 12%, #fff); flex-shrink: 0; }

/* Quick actions (like ToSkool dashboard bottom tiles) */
.quick-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.quick { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 18px 12px; border-radius: 18px; background: #fff; border: 1px solid var(--border); box-shadow: var(--shadow-soft); color: var(--ink); font-weight: 700; font-size: 14px; text-align: center; cursor: pointer; font-family: inherit; transition: .18s; }
.quick:hover { border-color: var(--powder-2); transform: translateY(-2px); }
.quick .q-ic { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-700); }

/* QR (pseudo) */
.qr { width: 132px; height: 132px; background: #fff; padding: 8px; border-radius: 14px; display: grid; grid-template-columns: repeat(21, 1fr); gap: 0; }
.qr i { display: block; aspect-ratio: 1; }
.qr i.on { background: var(--ink); }

/* Smart ID card */
.smart-card { border-radius: 22px; padding: 20px; color: #fff; position: relative; overflow: hidden; background: radial-gradient(90% 120% at 100% 0%, rgba(255,255,255,.22), transparent 55%), linear-gradient(135deg, #5bbcbf 0%, #3a9a9c 55%, #2b7f82 100%); box-shadow: 0 18px 40px rgba(43,127,130,.28); }
.smart-card::after { content: ""; position: absolute; width: 200px; height: 200px; left: -60px; bottom: -90px; border-radius: 50%; border: 30px solid rgba(255,255,255,.08); }
.smart-card .qr { width: 110px; height: 110px; padding: 6px; border-radius: 12px; }

/* Flashcard */
.flash { perspective: 1000px; cursor: pointer; }
.flash-inner { position: relative; min-height: 190px; transition: transform .5s ease; transform-style: preserve-3d; }
.flash.flipped .flash-inner { transform: rotateY(180deg); }
.flash-face { position: absolute; inset: 0; border-radius: 20px; padding: 22px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; backface-visibility: hidden; border: 1px solid var(--border); background: #fff; box-shadow: var(--shadow-soft); font-size: 17px; font-weight: 700; }
.flash-face.back { transform: rotateY(180deg); background: var(--brand-soft); color: var(--brand-700); }

/* Stat strip */
.stat-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stat-strip > div { background: #f7fafb; border: 1px solid var(--border); border-radius: 14px; padding: 12px; }
.stat-strip small { display: block; font-size: 12px; color: var(--muted); }
.stat-strip b { font-size: 18px; font-weight: 800; }

/* Health bar list */
.occ-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px 44px; gap: 12px; align-items: center; padding: 8px 0; font-size: 13px; }
.occ-row b { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Small category/icon chip */
.cat-ic { width: 26px; height: 26px; border-radius: 9px; display: inline-grid; place-items: center; background: var(--brand-soft); color: var(--brand-700); flex-shrink: 0; }
.cat-ic svg { width: 14px; height: 14px; }
.cat-ic.lg { width: 34px; height: 34px; border-radius: 11px; }
.cat-ic.lg svg { width: 17px; height: 17px; }

.money { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.money small { font-size: 11px; font-weight: 600; color: var(--muted); margin-right: 2px; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 28px 18px 0; }
.timeline li::before { content: ""; position: absolute; right: 7px; top: 6px; bottom: -6px; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; right: 2px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 3px solid var(--powder-2); }
.timeline li.done::after { border-color: var(--brand); background: var(--brand); }
.timeline b { display: block; font-size: 14px; }
.timeline small { color: var(--muted); font-size: 12px; }

/* Chat bubbles (messages) */
.bubble { max-width: 78%; padding: 10px 14px; border-radius: 18px; font-size: 14px; line-height: 1.6; background: #fff; border: 1px solid var(--border); }
.bubble.me { background: var(--brand); color: #fff; border-color: var(--brand); margin-right: auto; border-bottom-left-radius: 6px; }
.bubble.them { border-bottom-right-radius: 6px; }
.bubble small { display: block; font-size: 11px; opacity: .7; margin-top: 4px; }

/* Multi-membership insight */
.insight { border-radius: var(--r-card); padding: 22px; background: linear-gradient(135deg, #2b7f82, #3a9a9c 55%, #4fb3b5); color: #fff; position: relative; overflow: hidden; }
.insight h3, .insight h2 { color: #fff; }
.insight::after { content: ""; position: absolute; width: 220px; height: 220px; left: -70px; top: -80px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.18), transparent 70%); }
.insight > * { position: relative; z-index: 1; }

/* Animations */
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(12px); } }
.fade-in { animation: fade .3s ease both; }


/* ==========================================================================
   Soft learning space — component refinements (same classes, new personality)
   ========================================================================== */

/* Display typography */
.page-head h1 { font-size: 30px; font-weight: 700; line-height: 1.3; }
.page-head p { font-size: 14px; }
.card-head h3, .modal-head h3, .dropdown-head b, .space-menu .sm-head b, .space-overlay h3, .welcome h2, .insight h2, .insight h3 { font-family: var(--font-display); font-weight: 700; }
.breadcrumb { font-size: 12.5px; }

/* Bubble cards */
.card { border-radius: var(--r-card); border: 1px solid rgba(207,230,234,.85); box-shadow: var(--shadow-soft); }
.card-head { border-bottom: 1px dashed #d9eaec; padding: 18px 22px; }
.card-head h3 { font-size: 17px; }
.card-head h3::before { content: ""; display: inline-block; vertical-align: middle; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); margin-inline-end: 10px; position: relative; top: -2px; }
.card-foot { border-top: 1px dashed #d9eaec; }
a.card:hover { transform: translateY(-3px); box-shadow: 0 20px 40px -16px rgba(43,127,130,.28); border-color: var(--powder-2); }

/* KPI — icon bubbles on a soft colored blob */
.kpi { padding: 22px; gap: 14px; isolation: isolate; }
.kpi::before { content: ""; position: absolute; z-index: -1; width: 160px; height: 160px; border-radius: 50%; top: -70px; inset-inline-end: -56px; background: var(--c-soft, var(--brand-soft)); opacity: .75; pointer-events: none; }
.kpi::after { content: ""; position: absolute; z-index: -1; width: 14px; height: 14px; border-radius: 50%; top: 18px; inset-inline-end: 112px; background: var(--c-soft, var(--brand-soft)); pointer-events: none; }
.kpi-icon { width: 54px; height: 54px; border-radius: 50%; background: #fff; color: var(--c, var(--brand-700)); box-shadow: inset 0 0 0 6px var(--c-soft, var(--brand-soft)), 0 10px 20px -8px color-mix(in srgb, var(--c, #2b7f82) 45%, transparent); }
.kpi-icon svg { width: 22px; height: 22px; }
.kpi-label { font-size: 13px; }
.kpi-value { font-family: var(--font-display); font-size: 31px; font-weight: 700; letter-spacing: 0; line-height: 1.1; }
.trend { padding: 3px 9px; }

/* Welcome banner — friendlier shapes */
.welcome { border-radius: 30px; padding: 28px 32px; border-color: rgba(188,215,222,.7); box-shadow: var(--shadow-soft); }
.welcome h2 { font-size: 28px; font-weight: 700; }
.welcome::after { left: -40px; bottom: -110px; width: 280px; height: 280px; background: radial-gradient(circle, rgba(79,179,181,.22), transparent 68%); }

/* Pastel subject chips */
.subj-ic { border-radius: 15px; background: color-mix(in srgb, var(--c) 15%, #fff); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 22%, transparent); }
.subj-ic.sm { border-radius: 11px; }
.cat-ic { border-radius: 50%; }
.cat-ic.lg { border-radius: 13px; }

/* Lesson / class cards — colored top bands */
.session { border-radius: 20px; border-color: rgba(207,230,234,.9); }
body.app .cls-card, body.app .c-card { position: relative; overflow: hidden; border-radius: var(--r-card); }
body.app .cls-card::before, body.app .c-card::before { content: ""; position: absolute; top: 0; inset-inline: 0; height: 7px; background: var(--c, #4fb3b5); background-image: linear-gradient(90deg, rgba(255,255,255,.35), rgba(255,255,255,0) 60%); z-index: 1; }
body.app .c-card::before { background-color: transparent; background-image: var(--gradient-brand); }
body.app .cls-card .band { padding-top: 22px; }
body.app .c-card { padding-top: 24px; }

/* Smart flashcards — notebook paper + stacked deck */
.flash { position: relative; isolation: isolate; margin-bottom: 16px; }
.flash::before { content: ""; position: absolute; inset: 12px 18px -9px; border-radius: 26px; background: #dff0f1; transform: rotate(-1.6deg); z-index: 0; }
.flash::after { content: ""; position: absolute; inset: 20px 30px -16px; border-radius: 26px; background: #eef7f7; transform: rotate(1.4deg); z-index: -1; }
.flash-inner { z-index: 1; }
.flash-face { border-radius: 26px; border: 1.5px solid #d6ebed; overflow: hidden; box-shadow: 0 18px 36px -16px rgba(43,127,130,.32);
  background: repeating-linear-gradient(180deg, transparent 0 33px, rgba(79,179,181,.10) 33px 34px), #fff; }
.flash-face::before { content: ""; position: absolute; top: 0; inset-inline: 0; height: 8px; background: linear-gradient(90deg, #76c4c8, #4fb3b5 50%, #6aa7d8); }
.flash-face.back { background: radial-gradient(70% 90% at 100% 0%, rgba(255,255,255,.7), transparent 60%), linear-gradient(135deg, #e6f4f5, #d3ecee); border-color: #bfe0e3; }
.flash-face.back::before { background: linear-gradient(90deg, #f4b740, #f08a7e); }

/* Quick tiles, insight, smart card */
.quick { border-radius: 24px; border-color: rgba(207,230,234,.85); }
.quick .q-ic { border-radius: 50%; width: 50px; height: 50px; box-shadow: inset 0 0 0 5px rgba(255,255,255,.6); }
.insight { border-radius: 28px; }
.smart-card { border-radius: 26px; }

/* Friendly illustrated empty states (pure CSS shapes) */
.empty-state .empty-icon { position: relative; width: 92px; height: 92px; margin-bottom: 20px; border-radius: 46% 54% 50% 50% / 56% 46% 54% 44%;
  background: radial-gradient(circle at 30% 26%, rgba(255,255,255,.9) 0 9%, transparent 10%), linear-gradient(145deg, #e6f4f5, #cfe6ea); color: var(--brand-700); box-shadow: 0 14px 28px -12px rgba(43,127,130,.35); }
.empty-state .empty-icon svg { width: 34px; height: 34px; }
.empty-state .empty-icon::before { content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%; top: -6px; inset-inline-start: -12px; background: var(--yellow-soft); box-shadow: inset 0 0 0 3px #f5d88f; }
.empty-state .empty-icon::after { content: ""; position: absolute; width: 13px; height: 13px; border-radius: 4px; bottom: -2px; inset-inline-end: -14px; background: var(--violet-soft); box-shadow: inset 0 0 0 2.5px #c9c2f0, 10px -58px 0 -3px #fbdcd8; transform: rotate(18deg); }
.empty-state h3 { font-family: var(--font-display); }

/* Surfaces: modal, dropdowns, toast, tables, inputs */
.modal { border-radius: 28px; }
.dropdown-menu { border-radius: 22px; }
.dropdown-menu a, .dropdown-menu button.item { border-radius: 14px; }
.search-panel { border-radius: 22px; }
.toast { border-radius: 18px; }
.table th { background: #f3f9f9; }
.input, .select, .textarea { border-radius: 16px; }
.textarea { border-radius: 18px; }
.tab.active { border-bottom-width: 3px; }
.progress { background: #e4f0f2; }
.stat-strip > div { border-radius: 18px; }


/* ---------- English shell (dir=ltr on header + footer; logical properties do the rest) ---------- */
body.lang-en .space-item, body.lang-en .space-btn .meta, body.lang-en .user-btn, body.lang-en .dropdown-menu a, body.lang-en .dropdown-menu button.item { text-align: left; }
body.lang-en .dropdown-menu { left: auto; right: 0; }
body.lang-en .notif-item.unread::after { left: auto; right: 14px; }
body.lang-en .search-item .tail { margin-right: 0; margin-left: auto; }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .space-btn kbd { display: none; }
  .user-btn .meta { display: none; }
  .user-btn { padding-inline-end: 8px; }
  .global-search { width: 210px; }
}
@media (max-width: 1100px) {
  .grid-main { grid-template-columns: minmax(0, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .global-search { display: none; }
  .global-search.open { display: block; position: absolute; top: calc(100% + 6px); inset-inline: 12px; width: auto; max-width: none; z-index: 60; }
  .global-search.open input { height: 46px; box-shadow: var(--shadow-lg); }
  .global-search.open .search-results { inset-inline: 0; width: auto; }
  .icon-btn.search-toggle { display: grid; }
  .appnav-tools { display: contents; }
  .sp-others { display: none; }
}
@media (max-width: 1024px) {
  .appbar, .appnav-inner { padding-inline: 20px; }
  .content { padding: 24px 20px 36px; }
  .app-foot .af-inner { padding-inline: 20px; }
}
@media (max-width: 860px) {
  .space-btn .meta .sp-title { max-width: 130px; }
  .space-btn .role-badge span { display: none; }
  .space-btn .role-badge { padding: 4px; }
}
@media (max-width: 720px) {
  :root { --appbar-h: 60px; --nav-h: 50px; }
  .appbar { grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; padding-inline: 12px; }
  .appnav-inner { padding-inline: 8px; gap: 8px; }
  .appbar .brand .tk-logo { font-size: 21px; }
  .space-btn { height: 46px; gap: 7px; padding-inline: 4px 6px; }
  .space-btn > .school-chip { width: 34px; height: 34px; font-size: 11px; }
  .space-btn .meta .sp-cap, .space-btn .meta .sp-title { display: none; }
  .space-btn .meta b { font-size: 14px; }
  .space-btn .role-badge { display: none; }
  .sp-chev { width: 26px; height: 26px; }
  .space-menu { position: fixed; top: calc(var(--appbar-h) + 4px); left: 12px; right: 12px; width: auto; margin-left: 0; max-height: calc(100vh - var(--appbar-h) - 20px); overflow-y: auto; }
  .space-menu::before { display: none; }
  .nav-link { font-size: 12.5px; padding-inline: 3px 11px; gap: 6px; }
  .nav-link .nl-ic { width: 30px; height: 30px; }
  .nav-section { margin: 0 4px; }
  .stat-strip { grid-template-columns: minmax(0, 1fr); }
  .occ-row { grid-template-columns: minmax(0, 1fr) 80px 40px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-2 { grid-column: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .info-list { grid-template-columns: 1fr; }
  .content { padding: 20px 16px 32px; }
  .app-foot .af-inner { padding: 14px 16px; justify-content: center; text-align: center; }
  .af-brand, .af-tools { justify-content: center; }
  .page-head h1 { font-size: 23px; }
  .card-pad, .card-body { padding: 18px 16px; }
  .card-head, .toolbar, .card-foot { padding-inline: 16px; }
  .notif-menu { position: fixed; top: calc(var(--appbar-h) + 4px); left: 12px; right: 12px; width: auto; }
  .toast-wrap { left: 16px; right: 16px; bottom: 16px; }
  .toast { max-width: none; min-width: 0; }
  .welcome { padding: 22px 20px; }
  .welcome h2 { font-size: 23px; }
  .header-actions { gap: 6px; }
  .header-actions .hide-sm { display: none; }
  .hide-sm { display: none !important; }
  .icon-btn { width: 38px; height: 38px; }
  .bubble { max-width: 90%; }
  /* students & parents: floating bottom tab bar (rendered by their pages) */
  body.app .stu-tabbar, body.app .ptabs { left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); padding: 6px; border: 1px solid rgba(188,215,222,.7); border-radius: 24px; box-shadow: 0 14px 34px -8px rgba(43,127,130,.3); background: rgba(255,255,255,.95); }
  body.app .stu-tabbar a, body.app .ptabs a { border-radius: 18px; }
  body.app .stu-tabbar a.active, body.app .ptabs a.active { color: #fff; background: var(--gradient-brand); box-shadow: 0 6px 14px rgba(79,179,181,.35); }
  body.app .ptabs a.active em { border-color: var(--brand); }
  body[data-role="student"] .app-foot, body[data-role="parent"] .app-foot { padding-bottom: 84px; }
}
@media (max-width: 480px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .kpi { padding: 16px; }
  .kpi-value { font-size: 23px; }
  .kpi-icon { width: 42px; height: 42px; }
  .appbar .brand .tk-logo { display: none; }
  .brand-mini { display: grid; width: 36px; height: 36px; font-size: 14px; }
  .icon-btn.lang-btn { display: none !important; }
  .user-btn { padding: 2px; }
  .user-btn > svg { display: none; }
  .user-btn .avatar { width: 34px; height: 34px; font-size: 13px; }
  .icon-btn { width: 36px; height: 36px; }
}
@media print {
  .sidebar, .topbar-app, .app-foot, .page-actions, .toolbar, .toast-wrap, .stu-tabbar, .ptabs { display: none !important; }
  .main { margin: 0 !important; }
}

/* Segmented controls never widen the page on phones */
.seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex-shrink: 0; }
.page-actions { max-width: 100%; }
@media (max-width: 480px) {
  .kpi-row { flex-direction: column-reverse; align-items: flex-start; gap: 10px; }
  .kpi-row .kpi-icon { margin-right: 0; }
  .kpi .row-between { flex-wrap: wrap; gap: 6px; }
}

/* Nothing may widen the page; clip (unlike hidden) keeps the sticky header working */
html { overflow-x: clip; }

/* ToSkool logo image (wide wordmark — already contains the name) */
.brand-logo { display: block; width: auto; height: 34px; max-width: 100%; object-fit: contain; flex-shrink: 0; }
.brand-logo.sm { height: 26px; }
.brand-logo.lg { height: 56px; }
.brand-logo.light { background: #fff; padding: 3px 8px; border-radius: 10px; box-sizing: content-box; height: 22px; }
.appbar .brand .brand-logo { height: 36px; }
.af-brand .brand-logo { height: 26px; }
.logo-tk .brand-logo.login { height: 40px; }
.sw-top .brand-logo.sw { height: 36px; }
@media (max-width: 720px) { .appbar .brand .brand-logo { height: 30px; } }
@media (max-width: 480px) {
  .appbar .brand .brand-logo { height: 26px; }
  .appbar .brand .brand-mini { display: none; }
}
