:root {
  --primary: #7B2B77;
  --primary-dark: #4F174D;
  --primary-light: #A85AA3;
  --secondary: #D2AD36;
  --secondary-dark: #A47C0C;
  --secondary-light: #F4DE91;
  --background: #F9F7FA;
  --surface: #FFFFFF;
  --surface-soft: #F4EDF4;
  --text: #241F25;
  --text-secondary: #6D6470;
  --border: #E8E0E8;
  --rose: #C76575;
  --rose-soft: #FFF0F2;
  --mint: #34856A;
  --mint-soft: #EAF7F1;
  --blue: #397A9B;
  --blue-soft: #EAF3F8;
  --danger: #B7485A;
  --shadow-sm: 0 8px 24px rgba(79, 23, 77, .06);
  --shadow-md: 0 18px 50px rgba(79, 23, 77, .10);
  --shadow-lg: 0 34px 90px rgba(41, 16, 39, .18);
  --radius-sm: 14px;
  --radius-md: 20px;
  --radius-lg: 28px;
  --radius-xl: 36px;
  --sidebar-width: 268px;
  --topbar-height: 84px;
  --ease: cubic-bezier(.2,.8,.2,1);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
  background: var(--background);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 0%, rgba(168,90,163,.06), transparent 28rem),
    var(--background);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

[hidden],
.is-hidden {
  display: none !important;
}

[data-i18n-lines] {
  white-space: pre-line;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0,0,0,0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.noscript {
  position: fixed;
  inset: 16px 16px auto;
  z-index: 9999;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.noscript strong,
.noscript span {
  display: block;
}

.noscript span {
  margin-top: 4px;
  color: var(--text-secondary);
}

/* ---------- Icon system ---------- */

.ui-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  line-height: 0;
}

.ui-icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
}

.brand-mark {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(145deg, var(--primary-light), var(--primary-dark));
  box-shadow: 0 8px 20px rgba(79,23,77,.2);
  font-size: 20px;
  font-weight: 950;
  letter-spacing: -.04em;
}

.brand-mark-lg {
  width: 62px;
  height: 62px;
  border-radius: 20px;
  font-size: 28px;
}

.brand-link,
.sidebar-brand,
.mobile-brand,
.mobile-login-brand,
.login-brand-lockup,
.boot-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
}

.brand-copy,
.sidebar-brand > div,
.mobile-brand > div,
.mobile-login-brand > div,
.login-brand-lockup > div,
.boot-brand > div {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand-copy strong,
.sidebar-brand strong,
.mobile-brand strong,
.mobile-login-brand strong,
.login-brand-lockup strong,
.boot-brand strong {
  font-size: 17px;
  font-weight: 950;
  letter-spacing: .05em;
}

.brand-copy small,
.sidebar-brand small,
.mobile-brand small,
.mobile-login-brand small {
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .22em;
}

.login-brand-lockup strong,
.boot-brand strong {
  color: #fff;
  font-size: 24px;
}

.login-brand-lockup span,
.boot-brand span:not(.brand-mark) {
  margin-top: 5px;
  color: rgba(255,255,255,.7);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .28em;
}

/* ---------- Shared controls ---------- */

.primary-button,
.secondary-button,
.gold-button,
.glass-button,
.quiet-button,
.back-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 15px;
  cursor: pointer;
  transition:
    transform .2s var(--ease),
    box-shadow .2s var(--ease),
    background .2s var(--ease),
    border-color .2s var(--ease);
}

.primary-button {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 12px 24px rgba(123,43,119,.2);
  font-weight: 850;
}

.primary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(123,43,119,.25);
}

.primary-button.compact {
  min-height: 42px;
  padding-inline: 16px;
  border-radius: 14px;
}

.primary-button.full,
.glass-button.full {
  width: 100%;
}

.primary-button.large,
.gold-button.large {
  min-height: 56px;
  padding-inline: 24px;
}

.secondary-button {
  color: var(--primary);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  font-weight: 800;
}

.secondary-button:hover {
  border-color: rgba(123,43,119,.3);
  background: var(--surface-soft);
}

.gold-button {
  color: var(--primary-dark);
  background: linear-gradient(135deg, var(--secondary-light), var(--secondary));
  box-shadow: 0 14px 30px rgba(210,173,54,.22);
  font-weight: 900;
}

.gold-button:hover {
  transform: translateY(-2px);
}

.glass-button,
.quiet-button,
.back-button {
  color: #fff;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.1);
  backdrop-filter: blur(12px);
  font-weight: 800;
}

.quiet-button.dark-text {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface);
}

.back-button {
  align-self: flex-start;
  min-height: 42px;
}

.icon-button,
.input-action,
.viewer-button {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 14px;
  color: var(--primary);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: .2s var(--ease);
}

.icon-button:hover,
.input-action:hover {
  background: var(--surface-soft);
  transform: translateY(-1px);
}

button:disabled,
a.is-disabled {
  cursor: not-allowed !important;
  opacity: .5;
  pointer-events: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(210,173,54,.48);
  outline-offset: 3px;
}

.eyebrow,
.section-kicker,
.dialog-kicker {
  display: inline-block;
  color: var(--primary);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.eyebrow.light,
.section-kicker.light {
  color: var(--secondary-light);
}

.page-width {
  width: min(1180px, calc(100% - 40px));
  margin-inline: auto;
}

/* ---------- Boot splash ---------- */

.boot-splash {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(145deg, rgba(168,90,163,.2), transparent 48%),
    linear-gradient(135deg, #6E286C 0%, #4F174D 58%, #361034 100%);
  transition: opacity .45s var(--ease), visibility .45s;
}

.boot-splash.is-leaving {
  opacity: 0;
  visibility: hidden;
}

.boot-brand {
  position: relative;
  z-index: 2;
  transform: translateY(-34px);
  animation: bootIn .8s var(--ease) both;
}

.boot-splash > p {
  position: absolute;
  bottom: max(42px, env(safe-area-inset-bottom));
  margin: 0;
  color: rgba(255,255,255,.65);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .02em;
}

.boot-loader {
  position: absolute;
  top: calc(50% + 52px);
  width: 116px;
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.12);
}

.boot-loader span {
  display: block;
  width: 46%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--secondary-light), var(--secondary));
  animation: bootLoader 1.1s ease-in-out infinite;
}

.boot-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(1px);
}

.boot-orb-one {
  width: 420px;
  height: 420px;
  top: -210px;
  right: -120px;
  background: rgba(255,255,255,.06);
}

.boot-orb-two {
  width: 330px;
  height: 330px;
  bottom: -180px;
  left: -80px;
  background: rgba(210,173,54,.1);
}

@keyframes bootIn {
  from { opacity: 0; transform: translateY(-22px) scale(.96); }
  to { opacity: 1; transform: translateY(-34px) scale(1); }
}

@keyframes bootLoader {
  0% { transform: translateX(-130%); }
  100% { transform: translateX(260%); }
}

/* ---------- Welcome ---------- */

.welcome-view {
  min-height: 100vh;
  background: var(--background);
}

.welcome-nav {
  position: relative;
  z-index: 20;
  display: flex;
  min-height: 82px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.welcome-nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.welcome-nav .quiet-button {
  color: var(--text-secondary);
  border-color: var(--border);
  background: rgba(255,255,255,.74);
}

.welcome-hero {
  position: relative;
  overflow: hidden;
  min-height: 610px;
  padding: 68px 0 0;
  color: #fff;
  background:
    radial-gradient(circle at 80% 20%, rgba(244,222,145,.12), transparent 24rem),
    linear-gradient(135deg, #7B2B77 0%, #591C56 47%, #421440 100%);
}

.welcome-hero-grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, .95fr);
  gap: 64px;
  align-items: center;
}

.welcome-hero-copy h1 {
  max-width: 700px;
  margin: 15px 0 18px;
  font-size: clamp(42px, 5.2vw, 72px);
  line-height: .98;
  letter-spacing: -.045em;
  font-weight: 950;
}

.welcome-hero-copy > p {
  max-width: 610px;
  margin: 0;
  color: rgba(255,255,255,.76);
  font-size: clamp(16px, 1.5vw, 20px);
  line-height: 1.65;
  font-weight: 550;
}

.welcome-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.glass-link {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  gap: 9px;
  padding: 0 17px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 15px;
  color: rgba(255,255,255,.86);
  background: rgba(255,255,255,.07);
  font-weight: 800;
}

.welcome-glow {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.welcome-glow-one {
  width: 540px;
  height: 540px;
  top: -300px;
  right: 5%;
  border: 1px solid rgba(255,255,255,.08);
}

.welcome-glow-two {
  width: 360px;
  height: 360px;
  left: -180px;
  bottom: -90px;
  background: rgba(210,173,54,.07);
}

.welcome-visual {
  position: relative;
  min-height: 400px;
}

.visual-orbit {
  position: absolute;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 50%;
}

.orbit-one {
  width: 360px;
  height: 360px;
  inset: 20px 0 0 auto;
}

.orbit-two {
  width: 260px;
  height: 260px;
  inset: 72px 52px auto auto;
}

.visual-card {
  position: absolute;
  border: 1px solid rgba(255,255,255,.13);
  background: rgba(255,255,255,.095);
  box-shadow: 0 26px 70px rgba(19,6,18,.24);
  backdrop-filter: blur(18px);
}

.visual-main {
  width: min(330px, 76%);
  min-height: 236px;
  top: 75px;
  right: 35px;
  padding: 28px;
  border-radius: 34px;
  transform: rotate(-3deg);
}

.visual-main .visual-label {
  display: block;
  color: var(--secondary-light);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: .18em;
}

.visual-main strong {
  display: block;
  margin-top: 28px;
  max-width: 240px;
  font-size: 28px;
  line-height: 1.1;
}

.visual-lines {
  display: grid;
  gap: 9px;
  margin-top: 28px;
}

.visual-lines span {
  height: 7px;
  border-radius: 99px;
  background: rgba(255,255,255,.13);
}

.visual-lines span:nth-child(2) { width: 80%; }
.visual-lines span:nth-child(3) { width: 57%; }

.visual-mini {
  z-index: 2;
  display: flex;
  width: 175px;
  min-height: 78px;
  align-items: center;
  gap: 11px;
  padding: 14px;
  border-radius: 22px;
}

.visual-mini .ui-icon {
  width: 30px;
  height: 30px;
  color: var(--secondary-light);
}

.visual-mini small {
  font-size: 12px;
  line-height: 1.35;
  font-weight: 850;
}

.visual-mini-one {
  top: 32px;
  left: 0;
  transform: rotate(3deg);
}

.visual-mini-two {
  right: 0;
  bottom: 48px;
  transform: rotate(2deg);
}

.welcome-stats {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  margin-top: 52px;
  border-top: 1px solid rgba(255,255,255,.11);
}

.welcome-stats > div {
  display: flex;
  min-height: 100px;
  align-items: center;
  gap: 13px;
  padding: 18px 0;
}

.welcome-stats > div:not(:last-child) {
  border-inline-end: 1px solid rgba(255,255,255,.11);
}

.welcome-stats strong {
  min-width: 52px;
  font-size: 30px;
  font-weight: 950;
}

.welcome-stats span {
  max-width: 120px;
  color: rgba(255,255,255,.66);
  font-size: 12px;
  line-height: 1.4;
  font-weight: 700;
}

.welcome-section {
  padding-top: 92px;
}

.section-intro {
  max-width: 780px;
}

.section-intro h2,
.programme-panel h2,
.welcome-cta h2 {
  margin: 10px 0 15px;
  font-size: clamp(30px, 3.8vw, 48px);
  line-height: 1.06;
  letter-spacing: -.035em;
  font-weight: 950;
}

.section-intro p,
.programme-panel p,
.welcome-cta p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1.75;
  font-weight: 520;
}

.welcome-learning {
  margin-top: 92px;
  padding: 90px 0;
  background: #F2EDF3;
}

.pillar-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 14px;
  margin-top: 34px;
}

.pillar-card {
  position: relative;
  min-height: 300px;
  padding: 24px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: 0 12px 34px rgba(79,23,77,.045);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}

.pillar-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
}

.pillar-number {
  position: absolute;
  top: 16px;
  right: 18px;
  color: rgba(123,43,119,.12);
  font-size: 42px;
  font-weight: 950;
}

html[dir="rtl"] .pillar-number {
  right: auto;
  left: 18px;
}

.feature-icon,
.quick-icon,
.summary-icon,
.heading-icon,
.dialog-icon {
  display: inline-grid;
  place-items: center;
  border-radius: 16px;
}

.feature-icon {
  width: 50px;
  height: 50px;
  margin-top: 34px;
}

.feature-icon.purple,
.quick-icon.purple,
.summary-icon.purple,
.heading-icon.purple,
.dialog-icon.purple {
  color: var(--primary);
  background: var(--surface-soft);
}

.feature-icon.gold,
.quick-icon.gold,
.summary-icon.gold,
.heading-icon.gold {
  color: var(--secondary-dark);
  background: #FBF4DC;
}

.feature-icon.mint,
.quick-icon.mint,
.summary-icon.mint {
  color: var(--mint);
  background: var(--mint-soft);
}

.feature-icon.rose,
.summary-icon.rose,
.heading-icon.rose {
  color: var(--rose);
  background: var(--rose-soft);
}

.heading-icon.blue,
.summary-icon.blue {
  color: var(--blue);
  background: var(--blue-soft);
}

.pillar-card h3 {
  margin: 24px 0 10px;
  font-size: 19px;
  font-weight: 900;
}

.pillar-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.7;
}

.programme-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0,1.25fr) minmax(300px,.75fr);
  gap: 42px;
  overflow: hidden;
  padding: 46px;
  border-radius: 34px;
  color: #fff;
  background:
    radial-gradient(circle at 90% -20%, rgba(244,222,145,.15), transparent 22rem),
    linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: var(--shadow-lg);
}

.programme-panel h2 {
  max-width: 650px;
}

.programme-panel p {
  color: rgba(255,255,255,.72);
}

.programme-chips {
  display: grid;
  align-content: center;
  gap: 10px;
}

.programme-chips span {
  display: flex;
  min-height: 58px;
  align-items: center;
  padding: 0 18px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 17px;
  background: rgba(255,255,255,.08);
  font-weight: 800;
}

.location-grid {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 14px;
  margin-top: 32px;
}

.location-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 15px;
  min-height: 220px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.flag-dot {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 14px;
  color: var(--primary-dark);
  background: #FBF4DC;
  font-size: 10px;
  font-weight: 950;
}

.location-card h3 {
  margin: 0 0 3px;
  font-size: 18px;
}

.location-card strong {
  color: var(--primary);
  font-size: 11px;
}

.location-card p {
  grid-column: 1 / -1;
  margin: 8px 0 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.75;
}

.welcome-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 36px;
  padding: 44px 48px;
  border-radius: 32px;
  color: #fff;
  background: linear-gradient(120deg, #552053, #351033);
}

.welcome-cta > div {
  max-width: 700px;
}

.welcome-cta p {
  color: rgba(255,255,255,.68);
}

.welcome-footer {
  display: flex;
  min-height: 120px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 70px;
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 650;
}

.reveal {
  animation: revealUp .75s var(--ease) both;
}

.delay-one { animation-delay: .12s; }
.delay-two { animation-delay: .23s; }

@keyframes revealUp {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Login ---------- */

.login-view {
  min-height: 100vh;
  background: var(--background);
}

.login-layout {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(420px, .92fr) minmax(520px, 1.08fr);
}

.login-brand-panel {
  position: relative;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: 34px clamp(30px, 5vw, 72px);
  color: #fff;
  background:
    radial-gradient(circle at 82% 12%, rgba(244,222,145,.14), transparent 22rem),
    radial-gradient(circle at -20% 84%, rgba(255,255,255,.08), transparent 24rem),
    linear-gradient(145deg, var(--primary), var(--primary-dark));
}

.login-brand-panel::after {
  content: "";
  position: absolute;
  width: 380px;
  height: 380px;
  right: -180px;
  bottom: 8%;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 50%;
}

.login-brand-content {
  position: relative;
  z-index: 2;
  max-width: 600px;
}

.login-brand-lockup {
  margin-bottom: 72px;
}

.login-brand-content h1 {
  max-width: 570px;
  margin: 14px 0 18px;
  font-size: clamp(40px, 4vw, 60px);
  line-height: 1;
  letter-spacing: -.045em;
  font-weight: 950;
}

.login-brand-content > p {
  max-width: 540px;
  margin: 0;
  color: rgba(255,255,255,.7);
  font-size: 15px;
  line-height: 1.7;
}

.login-feature-list {
  display: grid;
  gap: 12px;
  margin-top: 30px;
}

.login-feature-list > span {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255,255,255,.84);
  font-size: 12px;
  font-weight: 700;
}

.login-feature-list .ui-icon {
  width: 18px;
  height: 18px;
  color: var(--secondary-light);
}

.login-brand-panel > small {
  position: relative;
  z-index: 2;
  color: rgba(255,255,255,.52);
  font-size: 10px;
  font-weight: 700;
}

.login-form-panel {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 70px 28px;
}

.login-top-actions {
  position: absolute;
  top: 26px;
  right: 30px;
}

html[dir="rtl"] .login-top-actions {
  right: auto;
  left: 30px;
}

.login-card {
  width: min(100%, 490px);
  padding: 42px;
  border: 1px solid var(--border);
  border-radius: 30px;
  background: rgba(255,255,255,.88);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(18px);
}

.mobile-login-brand {
  display: none;
  margin-bottom: 34px;
}

.login-card h2 {
  margin: 10px 0 9px;
  font-size: 32px;
  line-height: 1.08;
  letter-spacing: -.035em;
  font-weight: 950;
}

.login-card > p {
  margin: 0 0 28px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.6;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 17px;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.input-shell,
.search-shell {
  display: flex;
  min-height: 52px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  transition: border-color .2s, box-shadow .2s;
}

.input-shell:focus-within,
.search-shell:focus-within {
  border-color: rgba(123,43,119,.42);
  box-shadow: 0 0 0 4px rgba(123,43,119,.07);
}

.input-shell input,
.search-shell input,
.chat-composer textarea {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

.input-shell input {
  height: 50px;
  padding: 0;
}

.input-icon {
  margin-inline-start: 15px;
  color: var(--primary);
}

.input-action {
  width: 38px;
  height: 38px;
  margin-inline-end: 6px;
  border: 0;
  box-shadow: none;
}

.field-error {
  min-height: 0;
  color: var(--danger);
  font-size: 10px;
  font-weight: 700;
}

.form-alert {
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid rgba(183,72,90,.18);
  border-radius: 14px;
  color: var(--danger);
  background: var(--rose-soft);
  font-size: 11px;
  line-height: 1.5;
  font-weight: 750;
}

.button-spinner {
  display: none;
  width: 17px;
  height: 17px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.is-loading .button-spinner {
  display: inline-block;
}

.is-loading .button-label + .button-spinner {
  margin-inline-start: -3px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.login-help {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 7px;
  margin-top: 20px !important;
  color: var(--text-secondary) !important;
  text-align: center;
  font-size: 10.5px !important;
}

.login-help .ui-icon {
  width: 16px;
  height: 16px;
  color: var(--secondary-dark);
}

.developed-by {
  position: absolute;
  bottom: 22px;
  margin: 0;
  color: var(--text-secondary);
  font-size: 9.5px;
}

.developed-by a {
  color: var(--primary);
  font-weight: 850;
}

/* ---------- Authenticated layout ---------- */

.portal {
  min-height: 100vh;
  background: var(--background);
}

.sidebar {
  position: fixed;
  z-index: 60;
  top: 0;
  bottom: 0;
  left: 0;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  padding: 26px 18px 22px;
  border-inline-end: 1px solid var(--border);
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(20px);
}

html[dir="rtl"] .sidebar {
  left: auto;
  right: 0;
}

.sidebar-brand {
  padding: 2px 8px 28px;
}

.desktop-nav {
  display: grid;
  gap: 7px;
}

.nav-item {
  position: relative;
  display: flex;
  min-height: 50px;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  border-radius: 16px;
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
  text-align: start;
  font-size: 12px;
  font-weight: 750;
  transition: color .2s, background .2s, transform .2s;
}

.nav-item:hover {
  color: var(--primary);
  background: var(--surface-soft);
  transform: translateX(2px);
}

html[dir="rtl"] .nav-item:hover {
  transform: translateX(-2px);
}

.nav-item.is-active {
  color: var(--primary);
  background: linear-gradient(90deg, var(--surface-soft), rgba(244,237,244,.5));
  font-weight: 900;
}

.nav-item.is-active::before {
  content: "";
  position: absolute;
  inset-block: 10px;
  left: -18px;
  width: 4px;
  border-radius: 0 99px 99px 0;
  background: var(--primary);
}

html[dir="rtl"] .nav-item.is-active::before {
  left: auto;
  right: -18px;
  border-radius: 99px 0 0 99px;
}

.nav-item .ui-icon {
  width: 21px;
  height: 21px;
}

.nav-item-chat .ui-icon {
  color: var(--secondary-dark);
}

.sidebar-student-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  margin-top: auto;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 19px;
  background: var(--background);
}

.student-avatar,
.profile-avatar {
  display: inline-grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, var(--primary-light), var(--primary-dark));
  font-weight: 950;
  letter-spacing: -.02em;
}

.student-avatar {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  font-size: 12px;
}

.student-avatar.small {
  width: 38px;
  height: 38px;
}

.sidebar-student-card strong,
.sidebar-student-card small {
  display: block;
  max-width: 130px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sidebar-student-card strong {
  font-size: 11px;
  font-weight: 850;
}

.sidebar-student-card small {
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: 8.5px;
  font-weight: 650;
}

.sidebar-student-card .icon-button {
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
}

.portal-workspace {
  min-height: 100vh;
  margin-inline-start: var(--sidebar-width);
}

.portal-topbar {
  position: sticky;
  z-index: 50;
  top: 0;
  display: flex;
  min-height: var(--topbar-height);
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px clamp(20px,3vw,42px);
  border-bottom: 1px solid rgba(232,224,232,.82);
  background: rgba(249,247,250,.88);
  backdrop-filter: blur(22px);
}

.mobile-brand {
  display: none;
}

.topbar-context {
  display: flex;
  flex-direction: column;
}

.topbar-context > span {
  color: var(--text-secondary);
  font-size: 8.5px;
  font-weight: 850;
  letter-spacing: .14em;
}

.topbar-context > strong {
  margin-top: 3px;
  font-size: 18px;
  font-weight: 950;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-profile {
  display: flex;
  min-width: 220px;
  min-height: 52px;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 17px;
  background: var(--surface);
  cursor: pointer;
  text-align: start;
  box-shadow: 0 5px 16px rgba(79,23,77,.04);
}

.topbar-profile-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}

.topbar-profile-copy strong,
.topbar-profile-copy small {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.topbar-profile-copy strong {
  font-size: 11px;
  font-weight: 850;
}

.topbar-profile-copy small {
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 8.5px;
  font-weight: 650;
}

.topbar-profile > .ui-icon {
  width: 15px;
  height: 15px;
  color: var(--text-secondary);
}

.marquee-bar {
  position: relative;
  z-index: 40;
  display: grid;
  grid-template-columns: auto minmax(0,1fr);
  min-height: 42px;
  align-items: center;
  overflow: hidden;
  border-bottom: 1px solid rgba(210,173,54,.2);
  color: #6A4F05;
  background: #FFF9E7;
}

.marquee-label {
  z-index: 2;
  display: flex;
  height: 100%;
  align-items: center;
  gap: 7px;
  padding: 0 15px 0 clamp(20px,3vw,42px);
  color: var(--primary-dark);
  background: #F9EDBF;
  font-size: 9px;
  font-weight: 900;
  white-space: nowrap;
}

html[dir="rtl"] .marquee-label {
  padding: 0 clamp(20px,3vw,42px) 0 15px;
}

.marquee-window {
  min-width: 0;
  overflow: hidden;
}

.marquee-window p {
  width: max-content;
  min-width: 100%;
  margin: 0;
  padding-inline: 24px;
  font-size: 10.5px;
  line-height: 42px;
  font-weight: 700;
  white-space: nowrap;
}

.marquee-window.is-scrolling p {
  animation: marquee 22s linear infinite;
}

html[dir="rtl"] .marquee-window.is-scrolling p {
  animation-name: marqueeRtl;
}

@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@keyframes marqueeRtl {
  from { transform: translateX(0); }
  to { transform: translateX(50%); }
}

.portal-content {
  width: 100%;
  max-width: none;
  margin-inline: 0;
  padding: 28px clamp(20px, 2.2vw, 36px) 70px;
}

.portal-page {
  display: none;
  animation: pageIn .32s var(--ease) both;
}

.portal-page.is-active {
  display: block;
}

@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.mobile-bottom-nav {
  display: none;
}

/* ---------- Shared authenticated cards ---------- */

.hero-panel {
  position: relative;
  overflow: hidden;
  min-height: 238px;
  padding: clamp(24px,3vw,36px);
  border-radius: 32px;
  color: #fff;
  background:
    radial-gradient(circle at 90% 5%, rgba(244,222,145,.13), transparent 20rem),
    linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 22px 52px rgba(79,23,77,.16);
}

.hero-shape {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.hero-shape-one {
  width: 260px;
  height: 260px;
  top: -140px;
  right: -50px;
  border: 1px solid rgba(255,255,255,.1);
}

.hero-shape-two {
  width: 180px;
  height: 180px;
  left: -70px;
  bottom: -110px;
  background: rgba(210,173,54,.08);
}

html[dir="rtl"] .hero-shape-one {
  right: auto;
  left: -50px;
}

html[dir="rtl"] .hero-shape-two {
  left: auto;
  right: -70px;
}

.hero-copy {
  position: relative;
  z-index: 2;
  max-width: 850px;
}

.home-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
}

.home-hero h1,
.page-hero h1,
.profile-hero h1 {
  margin: 12px 0 10px;
  font-size: clamp(34px,4vw,50px);
  line-height: 1;
  letter-spacing: -.04em;
  font-weight: 950;
}

.home-hero p,
.page-hero p,
.profile-hero p {
  margin: 0;
  color: rgba(255,255,255,.72);
  font-size: 13px;
  line-height: 1.55;
  font-weight: 600;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.hero-meta > span {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 999px;
  color: rgba(255,255,255,.84);
  background: rgba(255,255,255,.08);
  font-size: 10px;
  font-weight: 750;
}

.hero-meta .ui-icon {
  width: 15px;
  height: 15px;
  color: var(--secondary-light);
}

.hero-date-card {
  position: relative;
  z-index: 2;
  display: grid;
  min-width: 118px;
  height: 140px;
  place-items: center;
  align-content: center;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 28px;
  background: rgba(255,255,255,.09);
  backdrop-filter: blur(15px);
}

.hero-date-card span,
.hero-date-card small {
  color: rgba(255,255,255,.68);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.hero-date-card strong {
  margin: 3px 0;
  color: var(--secondary-light);
  font-size: 48px;
  line-height: 1;
  font-weight: 950;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 12px;
  margin-top: 16px;
}

.quick-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  min-height: 88px;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 22px;
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  text-align: start;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s;
}

.quick-card:hover {
  transform: translateY(-3px);
  border-color: rgba(123,43,119,.2);
  box-shadow: var(--shadow-md);
}

.quick-icon {
  width: 48px;
  height: 48px;
}

.quick-icon .ui-icon {
  width: 23px;
  height: 23px;
}

.quick-card strong,
.quick-card small {
  display: block;
}

.quick-card strong {
  font-size: 12px;
  font-weight: 900;
}

.quick-card small {
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 9.5px;
  font-weight: 650;
}

.quick-arrow {
  width: 16px;
  height: 16px;
  color: var(--primary);
}

html[dir="rtl"] .quick-arrow,
html[dir="rtl"] [data-icon="arrow"] svg {
  transform: rotate(180deg);
}

.content-card {
  border: 1px solid var(--border);
  border-radius: 26px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.gallery-card {
  margin-top: 16px;
  padding: 19px;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-heading > div:nth-child(2) {
  min-width: 0;
  flex: 1;
}

.heading-icon {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
}

.section-heading h2 {
  margin: 2px 0 2px;
  font-size: 16px;
  letter-spacing: -.02em;
  font-weight: 950;
}

.section-heading p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 600;
}

.count-pill {
  display: inline-flex;
  min-width: 34px;
  height: 28px;
  align-items: center;
  justify-content: center;
  padding: 0 9px;
  border-radius: 999px;
  color: var(--primary);
  background: var(--surface-soft);
  font-size: 10px;
  font-weight: 900;
}

.gallery-preview {
  display: grid;
  grid-template-columns: repeat(5,minmax(0,1fr));
  gap: 9px;
  margin-top: 15px;
}

.gallery-thumb {
  position: relative;
  min-height: 130px;
  overflow: hidden;
  border: 0;
  border-radius: 18px;
  background: var(--surface-soft);
  cursor: pointer;
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .35s var(--ease);
}

.gallery-thumb:hover img {
  transform: scale(1.04);
}

.gallery-thumb::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 42%;
  background: linear-gradient(transparent, rgba(24,10,23,.42));
  opacity: 0;
  transition: opacity .2s;
}

.gallery-thumb:hover::after {
  opacity: 1;
}

.gallery-empty,
.loading-card,
.status-card {
  display: flex;
  min-height: 120px;
  align-items: center;
  justify-content: center;
  gap: 11px;
  color: var(--text-secondary);
  border: 1px dashed var(--border);
  border-radius: 18px;
  background: var(--background);
  text-align: center;
  font-size: 11px;
  font-weight: 650;
}

.loading-pulse {
  animation: pulse 1.2s ease-in-out infinite alternate;
}

@keyframes pulse {
  from { opacity: .45; }
  to { opacity: .9; }
}

/* ---------- Learning hub ---------- */

.learning-section {
  margin-top: 28px;
}

.learning-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 14px;
}

.learning-heading h2 {
  margin: 4px 0;
  font-size: 26px;
  letter-spacing: -.035em;
  font-weight: 950;
}

.learning-heading p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.5;
}

.search-shell {
  min-height: 46px;
  padding-inline: 13px;
}

.search-shell .ui-icon {
  width: 18px;
  height: 18px;
  color: var(--text-secondary);
}

.search-shell input {
  height: 44px;
  font-size: 11px;
}

.resource-search {
  width: min(330px,100%);
}

.resource-groups {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 14px;
}

.resource-group {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.resource-group-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 11px;
  align-items: center;
  width: 100%;
  padding: 15px;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  text-align: start;
}

.resource-group-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(145deg, var(--primary-light), var(--primary-dark));
}

.resource-group-icon .ui-icon {
  width: 21px;
  height: 21px;
}

.resource-group-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 950;
}

.resource-group-header p {
  margin: 3px 0 0;
  color: var(--text-secondary);
  font-size: 9.5px;
  line-height: 1.35;
  font-weight: 600;
}

.resource-count {
  min-width: 38px;
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--primary);
  background: var(--surface-soft);
  text-align: center;
  font-size: 9px;
  font-weight: 900;
}

.resource-body {
  display: grid;
  gap: 9px;
  padding: 0 13px 13px;
}

.resource-category {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 17px;
  background: var(--background);
}

.resource-category-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 11px;
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  font-weight: 900;
}

.resource-category-title .ui-icon {
  width: 16px;
  height: 16px;
  color: var(--primary);
}

.resource-link-list {
  display: grid;
}

.resource-link {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 9px;
  min-height: 62px;
  padding: 8px 10px;
  transition: background .18s;
}

.resource-link + .resource-link {
  border-top: 1px solid var(--border);
}

.resource-link:hover {
  background: var(--surface);
}

.resource-link-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--primary);
  background: var(--surface);
}

.resource-link-icon .ui-icon {
  width: 15px;
  height: 15px;
}

.resource-link strong {
  display: block;
  font-size: 10.5px;
  font-weight: 850;
}

.resource-link small {
  display: -webkit-box;
  margin-top: 2px;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 8.5px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.resource-link > .ui-icon {
  width: 14px;
  height: 14px;
  color: var(--primary);
}

/* ---------- News ---------- */

.page-hero.compact-hero {
  display: flex;
  min-height: 190px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.large-hero-icon {
  position: relative;
  z-index: 2;
  display: grid;
  width: 82px;
  height: 82px;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 25px;
  background: rgba(255,255,255,.09);
}

.large-hero-icon .ui-icon {
  width: 38px;
  height: 38px;
}

.toolbar-row {
  display: flex;
  gap: 10px;
  margin: 16px 0;
}

.search-shell.wide {
  min-width: 0;
  flex: 1;
  background: var(--surface);
}

.news-grid {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 13px;
}

.news-card {
  display: flex;
  min-height: 250px;
  flex-direction: column;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  text-align: start;
  transition: transform .22s var(--ease), box-shadow .22s var(--ease);
}

.news-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.news-card-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.news-icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 15px;
  color: var(--primary);
  background: var(--surface-soft);
}

.news-card time {
  color: var(--text-secondary);
  font-size: 9px;
  font-weight: 700;
}

.news-card h2 {
  margin: 5px 0 0;
  font-size: 16px;
  line-height: 1.25;
  letter-spacing: -.02em;
  font-weight: 950;
}

.news-card .undertitle {
  margin: 15px 0 0;
  padding: 9px 11px;
  border-radius: 12px;
  color: #6B520A;
  background: #FBF4DC;
  font-size: 10px;
  line-height: 1.45;
  font-weight: 750;
}

.news-excerpt {
  display: -webkit-box;
  margin: 14px 0 0;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 10.5px;
  line-height: 1.65;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.news-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 16px;
}

.scope-pill {
  display: inline-flex;
  max-width: 72%;
  min-height: 26px;
  align-items: center;
  padding: 0 9px;
  overflow: hidden;
  border-radius: 999px;
  color: var(--primary);
  background: var(--surface-soft);
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 8.5px;
  font-weight: 800;
}

.read-more {
  color: var(--primary);
  font-size: 9px;
  font-weight: 900;
}

.news-grid > .status-card {
  grid-column: 1 / -1;
  min-height: 260px;
  flex-direction: column;
  border-style: solid;
  background: var(--surface);
}

/* ---------- Chat ---------- */

.assistant-layout {
  display: grid;
  grid-template-columns: minmax(270px, .36fr) minmax(0, .64fr);
  gap: 16px;
  height: calc(100vh - var(--topbar-height) - 56px);
  min-height: 610px;
}

.assistant-intro-card {
  position: relative;
  display: flex;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  padding: 27px;
  border-radius: 30px;
  color: #fff;
  background:
    radial-gradient(circle at 100% 0%, rgba(244,222,145,.15), transparent 18rem),
    linear-gradient(145deg, var(--primary), var(--primary-dark));
  box-shadow: var(--shadow-md);
}

.assistant-intro-card::after {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  right: -110px;
  bottom: -100px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 50%;
}

.assistant-orb {
  display: grid;
  width: 62px;
  height: 62px;
  place-items: center;
  margin-bottom: 30px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 20px;
  color: var(--secondary-light);
  background: rgba(255,255,255,.1);
}

.assistant-orb .ui-icon {
  width: 30px;
  height: 30px;
}

.assistant-intro-card h1 {
  margin: 10px 0 12px;
  font-size: 34px;
  line-height: 1.02;
  letter-spacing: -.04em;
  font-weight: 950;
}

.assistant-intro-card > p {
  margin: 0;
  color: rgba(255,255,255,.7);
  font-size: 12px;
  line-height: 1.65;
}

.assistant-context {
  display: grid;
  gap: 9px;
  margin-top: 26px;
}

.assistant-context > span {
  display: flex;
  align-items: center;
  gap: 9px;
  color: rgba(255,255,255,.76);
  font-size: 9.5px;
  font-weight: 700;
}

.assistant-context .ui-icon {
  width: 16px;
  height: 16px;
  color: var(--secondary-light);
}

.assistant-intro-card .glass-button {
  position: relative;
  z-index: 2;
  margin-top: auto;
}

.chat-card {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: auto auto 1fr auto auto auto;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 30px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.chat-header {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}

.chat-header > div {
  display: flex;
  align-items: center;
  gap: 11px;
}

.assistant-avatar {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 15px;
  color: #fff;
  background: linear-gradient(145deg, var(--primary-light), var(--primary-dark));
}

.assistant-avatar .ui-icon {
  width: 22px;
  height: 22px;
}

.chat-header strong,
.chat-header small {
  display: block;
}

.chat-header strong {
  font-size: 12px;
  font-weight: 900;
}

.chat-header small {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 8.5px;
  font-weight: 700;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--secondary);
  box-shadow: 0 0 0 4px rgba(210,173,54,.13);
}

.status-dot.ready {
  background: var(--mint);
  box-shadow: 0 0 0 4px rgba(52,133,106,.12);
}

.status-dot.offline {
  background: var(--rose);
  box-shadow: 0 0 0 4px rgba(199,101,117,.12);
}

.suggestion-row {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}

.suggestion-row::-webkit-scrollbar {
  display: none;
}

.suggestion-chip {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--primary);
  background: var(--background);
  cursor: pointer;
  font-size: 8.5px;
  font-weight: 800;
}

.suggestion-chip:hover {
  border-color: rgba(123,43,119,.25);
  background: var(--surface-soft);
}

.suggestion-chip .ui-icon {
  width: 14px;
  height: 14px;
}

.chat-messages {
  min-height: 0;
  overflow-y: auto;
  padding: 18px;
  scroll-behavior: smooth;
}

.chat-message {
  display: flex;
  gap: 9px;
  max-width: min(80%, 720px);
  margin-bottom: 12px;
}

.chat-message.user {
  margin-inline-start: auto;
  flex-direction: row-reverse;
}

.message-avatar {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 10px;
  color: var(--primary);
  background: var(--surface-soft);
}

.chat-message.user .message-avatar {
  color: #fff;
  background: var(--primary);
}

.message-avatar .ui-icon {
  width: 15px;
  height: 15px;
}

.message-bubble {
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 5px 16px 16px 16px;
  color: var(--text);
  background: var(--background);
  font-size: 10.5px;
  line-height: 1.6;
  white-space: pre-wrap;
}

html[dir="rtl"] .message-bubble {
  border-radius: 16px 5px 16px 16px;
}

.chat-message.user .message-bubble {
  border-color: var(--primary);
  border-radius: 16px 5px 16px 16px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

html[dir="rtl"] .chat-message.user .message-bubble {
  border-radius: 5px 16px 16px 16px;
}

.typing-bubble {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 56px;
}

.typing-bubble i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-secondary);
  animation: typing 1s ease-in-out infinite;
}

.typing-bubble i:nth-child(2) { animation-delay: .12s; }
.typing-bubble i:nth-child(3) { animation-delay: .24s; }

@keyframes typing {
  0%,100% { transform: translateY(0); opacity: .4; }
  50% { transform: translateY(-3px); opacity: 1; }
}

.human-help {
  display: inline-flex;
  margin-top: 8px;
  align-items: center;
  gap: 6px;
  color: var(--primary);
  font-size: 9px;
  font-weight: 900;
}

.chat-inline-error {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 14px 9px;
  padding: 9px 11px;
  border: 1px solid rgba(183,72,90,.15);
  border-radius: 12px;
  color: var(--danger);
  background: var(--rose-soft);
  font-size: 9px;
  font-weight: 700;
}

.chat-inline-error span:nth-child(2) {
  flex: 1;
}

.chat-inline-error button {
  color: var(--danger);
  background: transparent;
  cursor: pointer;
  font-size: 9px;
  font-weight: 900;
}

.chat-composer {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  margin: 0 14px;
  padding: 8px 8px 8px 13px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--background);
}

html[dir="rtl"] .chat-composer {
  padding: 8px 13px 8px 8px;
}

.chat-composer textarea {
  min-height: 38px;
  max-height: 120px;
  resize: none;
  padding: 10px 0 7px;
  line-height: 1.45;
  font-size: 10.5px;
}

.chat-composer button {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(145deg, var(--primary), var(--primary-dark));
  cursor: pointer;
}

.chat-composer button:disabled {
  opacity: .4;
}

.chat-disclaimer {
  display: block;
  padding: 8px 16px 12px;
  color: var(--text-secondary);
  text-align: center;
  font-size: 7.5px;
  line-height: 1.45;
}

.chat-new-mobile {
  display: none;
}

/* ---------- Calendar ---------- */

.calendar-summary-grid {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 11px;
  margin: 15px 0;
}

.summary-card {
  display: flex;
  min-height: 86px;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.summary-icon {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
}

.summary-card strong,
.summary-card small {
  display: block;
}

.summary-card strong {
  font-size: 20px;
  font-weight: 950;
}

.summary-card small {
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 9px;
  line-height: 1.25;
  font-weight: 700;
}

.calendar-toolbar {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
}

.calendar-toolbar > div {
  text-align: center;
}

.calendar-toolbar > div span {
  display: block;
  color: var(--text-secondary);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: .14em;
}

.calendar-toolbar > div strong {
  display: block;
  margin-top: 2px;
  font-size: 14px;
  font-weight: 950;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 12px 2px;
  color: var(--text-secondary);
  font-size: 9px;
  font-weight: 700;
}

.calendar-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 3px;
}

.legend-dot.holiday { background: var(--rose); }
.legend-dot.event { background: var(--mint); }
.legend-dot.weekend { background: #E8A6AF; }

.calendar-card {
  padding: 16px;
}

.calendar-head {
  display: grid;
  grid-template-columns: repeat(7,minmax(0,1fr));
  gap: 6px;
  margin-bottom: 7px;
}

.calendar-head span {
  padding: 7px 0;
  color: var(--text-secondary);
  text-align: center;
  font-size: 9px;
  font-weight: 850;
}

.calendar-days {
  display: grid;
  grid-template-columns: repeat(7,minmax(0,1fr));
  gap: 6px;
}

.calendar-day {
  position: relative;
  display: flex;
  min-height: 76px;
  flex-direction: column;
  justify-content: space-between;
  padding: 9px;
  border: 1px solid transparent;
  border-radius: 15px;
  color: var(--text);
  background: transparent;
  cursor: default;
  text-align: start;
}

.calendar-day.has-detail {
  cursor: pointer;
}

.calendar-day:disabled {
  opacity: 1;
  pointer-events: none;
}

.calendar-day:hover.has-detail {
  filter: brightness(.985);
}

.calendar-day.is-empty {
  visibility: hidden;
}

.calendar-day.is-weekend {
  color: #9D5963;
  border-color: rgba(232,166,175,.35);
  background: #FFF1F3;
}

.calendar-day.has-holiday {
  color: var(--danger);
  border-color: rgba(183,72,90,.2);
  background: #FFE8EC;
}

.calendar-day.has-event {
  color: var(--mint);
  border-color: rgba(52,133,106,.2);
  background: #E6F5EE;
}

.calendar-day.has-both {
  color: var(--text);
  border-color: rgba(168,90,163,.25);
  background: var(--surface-soft);
}

.calendar-day.is-today {
  box-shadow: inset 0 0 0 2px var(--secondary);
}

.calendar-day .day-number {
  font-size: 12px;
  font-weight: 850;
}

.calendar-day.has-detail .day-number {
  font-weight: 950;
}

.calendar-markers {
  display: flex;
  gap: 4px;
}

.calendar-markers i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.calendar-markers .holiday { background: var(--rose); }
.calendar-markers .event { background: var(--mint); }

.calendar-day .day-mini-label {
  display: -webkit-box;
  overflow: hidden;
  font-size: 7.5px;
  line-height: 1.3;
  font-weight: 700;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ---------- Profile ---------- */

.profile-hero {
  display: flex;
  min-height: 230px;
  align-items: center;
  gap: 24px;
}

.profile-avatar {
  position: relative;
  z-index: 2;
  width: 104px;
  height: 104px;
  flex: 0 0 auto;
  border: 4px solid rgba(255,255,255,.15);
  border-radius: 32px;
  font-size: 29px;
}

.profile-hero-copy {
  position: relative;
  z-index: 2;
  min-width: 0;
}

.profile-hero-copy h1 {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.profile-summary-grid {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 11px;
  margin: 15px 0;
}

.profile-summary-grid article {
  display: grid;
  min-height: 110px;
  align-content: center;
  grid-template-columns: auto 1fr;
  column-gap: 11px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 21px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.profile-summary-grid .summary-icon {
  grid-row: 1 / 3;
  align-self: center;
}

.profile-summary-grid small {
  align-self: end;
  color: var(--text-secondary);
  font-size: 9px;
  font-weight: 700;
}

.profile-summary-grid strong {
  align-self: start;
  margin-top: 3px;
  overflow: hidden;
  font-size: 13px;
  font-weight: 950;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.profile-columns {
  display: grid;
  grid-template-columns: minmax(0,1.4fr) minmax(300px,.6fr);
  gap: 15px;
}

.profile-main-column {
  display: grid;
  gap: 14px;
}

.info-section {
  padding: 18px;
}

.info-list {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 0 18px;
  margin: 15px 0 0;
}

.info-row {
  display: grid;
  grid-template-columns: auto minmax(0,1fr);
  grid-template-rows: auto auto;
  column-gap: 9px;
  min-height: 62px;
  align-content: center;
  border-top: 1px solid var(--border);
}

.info-row dt {
  grid-column: 2;
  color: var(--text-secondary);
  font-size: 8.5px;
  font-weight: 700;
}

.info-row dd {
  grid-column: 2;
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  font-size: 10.5px;
  font-weight: 850;
}

.info-row .ui-icon {
  grid-row: 1 / 3;
  width: 17px;
  height: 17px;
  align-self: center;
  color: var(--primary);
}

.notes-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
}

.notes-card > div span {
  font-size: 11px;
  font-weight: 900;
}

.notes-card p {
  margin: 4px 0 0;
  color: var(--text-secondary);
  font-size: 10px;
  line-height: 1.6;
}

.profile-side-column {
  display: grid;
  align-content: start;
  gap: 14px;
}

.support-card,
.account-card {
  padding: 18px;
}

.support-card h2,
.account-card h2 {
  margin: 4px 0 12px;
  font-size: 18px;
  letter-spacing: -.02em;
  font-weight: 950;
}

.support-card > strong {
  display: block;
  margin-bottom: 13px;
  font-size: 11px;
}

.support-actions {
  display: grid;
  gap: 8px;
}

.support-action,
.settings-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  min-height: 58px;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 15px;
  color: var(--text);
  background: var(--background);
  text-align: start;
  transition: background .18s, border-color .18s;
}

.support-action:hover,
.settings-row:hover {
  border-color: rgba(123,43,119,.2);
  background: var(--surface-soft);
}

.support-action > .ui-icon,
.settings-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 11px;
  color: var(--primary);
  background: var(--surface-soft);
}

.support-action strong,
.support-action small,
.settings-row strong,
.settings-row small {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.support-action strong,
.settings-row strong {
  font-size: 9.5px;
  font-weight: 850;
}

.support-action small,
.settings-row small {
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 7.8px;
  font-weight: 650;
}

.account-card {
  display: grid;
  gap: 8px;
}

.account-card .section-kicker,
.account-card h2 {
  margin-bottom: 0;
}

.settings-row {
  cursor: pointer;
}

.settings-row > .ui-icon {
  width: 14px;
  height: 14px;
  color: var(--text-secondary);
}

.logout-row {
  color: var(--danger);
}

.logout-row .settings-icon {
  color: var(--danger);
  background: var(--rose-soft);
}

.developer-credit {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border-radius: 16px;
  color: var(--text-secondary);
  transition: background .18s;
}

.developer-credit:hover {
  background: var(--surface-soft);
}

.madlab-mark {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #1F1D22;
  font-size: 12px;
  font-weight: 950;
}

.developer-credit small,
.developer-credit strong {
  display: block;
}

.developer-credit small {
  font-size: 7.5px;
}

.developer-credit strong {
  margin-top: 1px;
  color: var(--text);
  font-size: 9.5px;
}

/* ---------- Dialogs ---------- */

dialog {
  padding: 0;
  border: 0;
  background: transparent;
}

dialog::backdrop {
  background: rgba(36,31,37,.52);
  backdrop-filter: blur(7px);
}

.app-dialog {
  width: min(620px, calc(100% - 28px));
  max-height: min(88vh, 820px);
  overflow: visible;
}

.dialog-shell {
  position: relative;
  max-height: 88vh;
  overflow-y: auto;
  padding: 28px;
  border: 1px solid rgba(255,255,255,.6);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
}

html[dir="rtl"] .dialog-close {
  right: auto;
  left: 14px;
}

.dialog-icon {
  width: 52px;
  height: 52px;
  margin-bottom: 16px;
}

.dialog-shell h2 {
  margin: 5px 0 8px;
  padding-inline-end: 38px;
  font-size: 26px;
  line-height: 1.12;
  letter-spacing: -.025em;
  font-weight: 950;
}

.dialog-subtitle {
  margin: 0 0 17px;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.6;
}

.dialog-body {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.75;
  white-space: pre-wrap;
}

.article-dialog .scope-pill {
  max-width: 100%;
  margin-top: 18px;
}

.calendar-dialog-items {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.calendar-detail {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  padding: 13px;
  border-radius: 17px;
}

.calendar-detail.holiday {
  color: var(--danger);
  background: #FFE8EC;
}

.calendar-detail.event {
  color: var(--mint);
  background: #E6F5EE;
}

.calendar-detail.weekend {
  color: #9D5963;
  background: #FFF1F3;
}

.calendar-detail > .ui-icon {
  width: 20px;
  height: 20px;
}

.calendar-detail strong,
.calendar-detail small,
.calendar-detail p {
  display: block;
}

.calendar-detail strong {
  color: var(--text);
  font-size: 11px;
  font-weight: 900;
}

.calendar-detail small {
  margin-top: 2px;
  font-size: 8.5px;
  font-weight: 750;
}

.calendar-detail p {
  grid-column: 2;
  margin: 2px 0 0;
  color: var(--text-secondary);
  font-size: 9.5px;
  line-height: 1.55;
}

.password-dialog-shell {
  width: min(100%, 520px);
  margin-inline: auto;
}

.password-dialog-shell .field {
  margin-top: 13px;
  margin-bottom: 0;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 15px 0;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 700;
}

.check-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.gallery-dialog {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
}

.gallery-dialog::backdrop {
  background: rgba(13,10,14,.92);
}

.gallery-viewer {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: rgba(15,12,16,.96);
}

.gallery-viewer header {
  position: absolute;
  z-index: 3;
  top: max(16px, env(safe-area-inset-top));
  left: 50%;
  display: grid;
  grid-template-columns: auto minmax(80px,1fr) auto;
  width: min(560px, calc(100% - 32px));
  align-items: center;
  gap: 9px;
  padding: 7px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 18px;
  color: #fff;
  background: rgba(0,0,0,.38);
  backdrop-filter: blur(14px);
  transform: translateX(-50%);
}

.gallery-viewer header > span {
  text-align: center;
  font-size: 10px;
  font-weight: 850;
}

.viewer-button {
  border-color: rgba(255,255,255,.1);
  color: #fff;
  background: rgba(255,255,255,.08);
}

.gallery-viewer img {
  max-width: min(92vw, 1400px);
  max-height: 88vh;
  object-fit: contain;
  user-select: none;
}

.gallery-nav {
  position: absolute;
  z-index: 3;
  top: 50%;
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 16px;
  color: #fff;
  background: rgba(255,255,255,.08);
  cursor: pointer;
  backdrop-filter: blur(12px);
  transform: translateY(-50%);
}

.gallery-prev { left: 18px; }
.gallery-next { right: 18px; }

html[dir="rtl"] .gallery-prev { left: auto; right: 18px; }
html[dir="rtl"] .gallery-next { right: auto; left: 18px; }

/* ---------- Toast ---------- */

.toast-region {
  position: fixed;
  z-index: 12000;
  right: 20px;
  bottom: 20px;
  display: grid;
  width: min(380px, calc(100% - 40px));
  gap: 8px;
  pointer-events: none;
}

html[dir="rtl"] .toast-region {
  right: auto;
  left: 20px;
}

.toast {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 9px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  animation: toastIn .28s var(--ease) both;
  pointer-events: auto;
}

.toast .ui-icon {
  color: var(--primary);
}

.toast.error .ui-icon {
  color: var(--danger);
}

.toast span {
  font-size: 10px;
  line-height: 1.45;
  font-weight: 750;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
  :root {
    --sidebar-width: 224px;
  }

  .sidebar {
    padding-inline: 14px;
  }

  .nav-item.is-active::before {
    left: -14px;
  }

  html[dir="rtl"] .nav-item.is-active::before {
    left: auto;
    right: -14px;
  }

  .sidebar-student-card strong,
  .sidebar-student-card small {
    max-width: 92px;
  }

  .welcome-hero-grid {
    gap: 28px;
  }

  .pillar-grid {
    grid-template-columns: repeat(2,minmax(0,1fr));
  }
}

@media (max-width: 980px) {
  .welcome-hero-grid {
    grid-template-columns: 1fr;
  }

  .welcome-visual {
    display: none;
  }

  .welcome-hero {
    min-height: auto;
  }

  .welcome-stats {
    margin-top: 64px;
  }

  .programme-panel {
    grid-template-columns: 1fr;
  }

  .location-grid {
    grid-template-columns: 1fr;
  }

  .login-layout {
    grid-template-columns: 1fr;
  }

  .login-brand-panel {
    display: none;
  }

  .mobile-login-brand {
    display: inline-flex;
  }

  .login-form-panel {
    background:
      radial-gradient(circle at 20% 0%, rgba(168,90,163,.10), transparent 25rem),
      var(--background);
  }

  .sidebar {
    display: none;
  }

  .portal-workspace {
    margin-inline-start: 0;
  }

  .mobile-brand {
    display: inline-flex;
  }

  .topbar-context {
    display: none;
  }

  .topbar-profile {
    min-width: 0;
  }

  .topbar-profile-copy,
  .topbar-profile > .ui-icon {
    display: none;
  }

  .portal-content {
    padding-bottom: 112px;
  }

  .mobile-bottom-nav {
    position: fixed;
    z-index: 90;
    right: 14px;
    bottom: max(12px, env(safe-area-inset-bottom));
    left: 14px;
    display: grid;
    grid-template-columns: repeat(5,minmax(0,1fr));
    height: 76px;
    padding: 7px;
    border: 1px solid rgba(232,224,232,.9);
    border-radius: 25px;
    background: rgba(255,255,255,.95);
    box-shadow: 0 18px 50px rgba(79,23,77,.15);
    backdrop-filter: blur(20px);
  }

  .mobile-nav-item {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 3px;
    border-radius: 16px;
    color: var(--text-secondary);
    background: transparent;
    cursor: pointer;
  }

  .mobile-nav-item > .ui-icon {
    width: 21px;
    height: 21px;
  }

  .mobile-nav-item small {
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 8px;
    font-weight: 750;
  }

  .mobile-nav-item.is-active:not(.mobile-nav-primary) {
    color: var(--primary);
    background: var(--surface-soft);
  }

  .mobile-nav-primary {
    justify-content: flex-end;
    padding-bottom: 4px;
  }

  .mobile-primary-icon {
    display: grid;
    width: 40px;
    height: 40px;
    margin-top: -18px;
    place-items: center;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(145deg, var(--primary), var(--primary-dark));
    box-shadow: 0 10px 20px rgba(123,43,119,.25);
  }

  .mobile-nav-primary.is-active .mobile-primary-icon {
    color: var(--primary-dark);
    background: linear-gradient(145deg, var(--secondary-light), var(--secondary));
  }

  .resource-groups {
    grid-template-columns: 1fr;
  }

  .profile-columns {
    grid-template-columns: 1fr;
  }

  .assistant-layout {
    grid-template-columns: 1fr;
    height: calc(100dvh - var(--topbar-height) - 135px);
    min-height: 560px;
  }

  .assistant-intro-card {
    display: none;
  }

  .chat-new-mobile {
    display: inline-grid;
  }

  .news-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  :root {
    --topbar-height: 70px;
  }

  .page-width {
    width: min(100% - 28px, 1180px);
  }

  .welcome-nav {
    min-height: 72px;
  }

  .welcome-nav-actions .quiet-button span:last-child {
    display: none;
  }

  .welcome-nav-actions .quiet-button {
    width: 42px;
    padding: 0;
  }

  .welcome-nav .primary-button.compact {
    min-height: 40px;
    padding-inline: 13px;
  }

  .welcome-hero {
    padding-top: 44px;
  }

  .welcome-hero-copy h1 {
    font-size: clamp(38px, 12vw, 54px);
  }

  .welcome-actions {
    display: grid;
  }

  .welcome-actions > * {
    width: 100%;
  }

  .welcome-stats {
    grid-template-columns: 1fr;
    margin-top: 48px;
  }

  .welcome-stats > div {
    min-height: 74px;
  }

  .welcome-stats > div:not(:last-child) {
    border-inline-end: 0;
    border-bottom: 1px solid rgba(255,255,255,.11);
  }

  .welcome-section {
    padding-top: 65px;
  }

  .welcome-learning {
    margin-top: 65px;
    padding: 65px 0;
  }

  .pillar-grid {
    grid-template-columns: 1fr;
  }

  .pillar-card {
    min-height: 260px;
  }

  .programme-panel,
  .welcome-cta {
    padding: 28px 22px;
    border-radius: 26px;
  }

  .welcome-cta {
    display: grid;
  }

  .welcome-cta .gold-button {
    width: 100%;
  }

  .welcome-footer {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
  }

  .login-form-panel {
    padding: 76px 14px 60px;
  }

  .login-card {
    padding: 25px 18px;
    border-radius: 25px;
  }

  .login-card h2 {
    font-size: 27px;
  }

  .login-top-actions {
    top: 15px;
    right: 14px;
  }

  html[dir="rtl"] .login-top-actions {
    right: auto;
    left: 14px;
  }

  .developed-by {
    bottom: 12px;
  }

  .portal-topbar {
    padding: 10px 14px;
  }

  .mobile-brand .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }

  .mobile-brand > div {
    display: none;
  }

  .language-icon-button {
    width: 40px;
    height: 40px;
  }

  .topbar-profile {
    width: 46px;
    min-height: 46px;
    padding: 3px;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .topbar-profile .student-avatar {
    width: 40px;
    height: 40px;
  }

  .marquee-bar {
    grid-template-columns: auto minmax(0,1fr);
  }

  .marquee-label {
    width: 44px;
    padding: 0;
    justify-content: center;
  }

  .marquee-label span:last-child {
    display: none;
  }

  .portal-content {
    padding: 14px 14px 108px;
  }

  .hero-panel {
    border-radius: 25px;
  }

  .home-hero {
    min-height: 235px;
    align-items: flex-start;
    padding: 24px 20px;
  }

  .home-hero h1,
  .page-hero h1,
  .profile-hero h1 {
    font-size: 32px;
  }

  .hero-date-card {
    position: absolute;
    right: 18px;
    bottom: 18px;
    min-width: 76px;
    width: 76px;
    height: 82px;
    border-radius: 20px;
  }

  html[dir="rtl"] .hero-date-card {
    right: auto;
    left: 18px;
  }

  .hero-date-card strong {
    font-size: 30px;
  }

  .hero-date-card span,
  .hero-date-card small {
    font-size: 7px;
  }

  .hero-meta {
    max-width: calc(100% - 80px);
  }

  .quick-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .quick-card {
    min-height: 72px;
  }

  .gallery-card {
    padding: 14px;
    border-radius: 22px;
  }

  .gallery-preview {
    grid-template-columns: repeat(2,minmax(0,1fr));
  }

  .gallery-thumb {
    min-height: 120px;
  }

  .gallery-thumb:nth-child(n+5) {
    display: none;
  }

  .learning-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .resource-search {
    width: 100%;
  }

  .resource-group {
    border-radius: 21px;
  }

  .resource-group-header {
    padding: 12px;
  }

  .page-hero.compact-hero {
    min-height: 170px;
    padding: 23px 20px;
  }

  .large-hero-icon {
    width: 60px;
    height: 60px;
    border-radius: 18px;
  }

  .large-hero-icon .ui-icon {
    width: 28px;
    height: 28px;
  }

  .toolbar-row {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-row .secondary-button {
    width: 100%;
  }

  .news-card {
    min-height: 235px;
  }

  .assistant-layout {
    height: calc(100dvh - var(--topbar-height) - 115px);
    min-height: 520px;
  }

  #page-chatbot {
    margin: -14px -14px -108px;
  }

  #page-chatbot .assistant-layout {
    height: calc(100dvh - var(--topbar-height) - 78px);
  }

  .chat-card {
    border-inline: 0;
    border-bottom: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .chat-header {
    min-height: 67px;
  }

  .suggestion-row {
    padding-block: 9px;
  }

  .chat-messages {
    padding: 14px;
  }

  .chat-message {
    max-width: 90%;
  }

  .chat-composer {
    margin-inline: 10px;
  }

  .calendar-summary-grid {
    gap: 7px;
  }

  .summary-card {
    min-height: 90px;
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
    padding: 10px;
  }

  .summary-icon {
    width: 34px;
    height: 34px;
    border-radius: 11px;
  }

  .summary-card strong {
    font-size: 17px;
  }

  .summary-card small {
    font-size: 7.5px;
  }

  .calendar-toolbar {
    grid-template-columns: auto 1fr auto;
  }

  .calendar-refresh {
    grid-column: 1 / -1;
    width: 100%;
  }

  .calendar-card {
    padding: 9px;
    overflow-x: auto;
  }

  .calendar-head,
  .calendar-days {
    min-width: 560px;
  }

  .calendar-day {
    min-height: 68px;
    padding: 7px;
  }

  .profile-hero {
    display: block;
    min-height: 275px;
    padding: 22px;
  }

  .profile-avatar {
    width: 76px;
    height: 76px;
    border-radius: 24px;
    font-size: 21px;
  }

  .profile-hero-copy {
    margin-top: 18px;
  }

  .profile-hero-copy h1 {
    white-space: normal;
  }

  .profile-summary-grid {
    gap: 7px;
  }

  .profile-summary-grid article {
    min-height: 125px;
    align-content: start;
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .profile-summary-grid .summary-icon {
    grid-row: auto;
    margin-bottom: 11px;
  }

  .profile-summary-grid strong {
    white-space: normal;
    font-size: 10.5px;
  }

  .info-section {
    padding: 14px;
  }

  .info-list {
    grid-template-columns: 1fr;
  }

  .info-row {
    min-height: 58px;
  }

  .mobile-bottom-nav {
    right: 9px;
    bottom: max(8px, env(safe-area-inset-bottom));
    left: 9px;
    height: 70px;
    border-radius: 23px;
  }

  .mobile-nav-item small {
    font-size: 7.2px;
  }

  .mobile-primary-icon {
    width: 38px;
    height: 38px;
  }

  .app-dialog {
    width: calc(100% - 20px);
  }

  .dialog-shell {
    padding: 22px 17px;
    border-radius: 24px;
  }

  .dialog-shell h2 {
    font-size: 22px;
  }

  .gallery-nav {
    width: 42px;
    height: 42px;
  }

  .gallery-prev { left: 8px; }
  .gallery-next { right: 8px; }

  html[dir="rtl"] .gallery-prev { right: 8px; }
  html[dir="rtl"] .gallery-next { left: 8px; }

  .toast-region {
    right: 12px;
    bottom: 92px;
    width: calc(100% - 24px);
  }

  html[dir="rtl"] .toast-region {
    right: auto;
    left: 12px;
  }
}

@media (max-width: 420px) {
  .calendar-summary-grid {
    grid-template-columns: 1fr;
  }

  .summary-card {
    min-height: 68px;
    align-items: center;
    flex-direction: row;
  }

  .profile-summary-grid {
    grid-template-columns: 1fr;
  }

  .profile-summary-grid article {
    min-height: 78px;
    align-content: center;
    grid-template-columns: auto 1fr;
  }

  .profile-summary-grid .summary-icon {
    grid-row: 1 / 3;
    margin-bottom: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

@media (prefers-contrast: more) {
  :root {
    --border: #D2C5D2;
  }

  .content-card,
  .news-card,
  .resource-group,
  .quick-card {
    border-width: 2px;
  }
}

/* =========================================================
   LWIS TYPOGRAPHY ENHANCEMENT
   Increased general portal/menu readability by ~20–25%.
   Keeps large hero typography intentionally restrained.
   ========================================================= */

/* Navigation + shell */
.nav-item {
  font-size: 14.5px;
}

.sidebar-student-card strong {
  font-size: 13px;
}

.sidebar-student-card small {
  font-size: 10.5px;
}

.topbar-context > span {
  font-size: 10px;
}

.topbar-context > strong {
  font-size: 21px;
}

.topbar-profile-copy strong {
  font-size: 13px;
}

.topbar-profile-copy small {
  font-size: 10px;
}

.marquee-label {
  font-size: 11px;
}

.marquee-window p {
  font-size: 12.5px;
}

/* Home hero supporting text */
.home-hero p,
.page-hero p,
.profile-hero p {
  font-size: 15px;
}

.hero-meta > span {
  font-size: 12px;
}

.hero-date-card span,
.hero-date-card small {
  font-size: 11px;
}

/* Quick actions */
.quick-card strong {
  font-size: 14.5px;
}

.quick-card small {
  font-size: 11.5px;
}

/* Section headings */
.section-kicker,
.eyebrow,
.dialog-kicker {
  font-size: 11.5px;
}

.section-heading h2 {
  font-size: 19px;
}

.section-heading p {
  font-size: 12px;
}

.count-pill {
  font-size: 11.5px;
}

.learning-heading h2 {
  font-size: 29px;
}

.learning-heading p {
  font-size: 13px;
}

.search-shell input {
  font-size: 13px;
}

/* Learning Hub */
.resource-group-header h3 {
  font-size: 16.5px;
}

.resource-group-header p {
  font-size: 11.5px;
}

.resource-count {
  font-size: 10.5px;
}

.resource-category-title {
  font-size: 12px;
}

.resource-link strong {
  font-size: 12.5px;
}

.resource-link small {
  font-size: 10.5px;
}

/* News */
.news-card time {
  font-size: 10.5px;
}

.news-card h2 {
  font-size: 19px;
}

.news-card .undertitle {
  font-size: 12px;
}

.news-excerpt {
  font-size: 12.5px;
}

.scope-pill {
  font-size: 10px;
}

.read-more {
  font-size: 11px;
}

/* Chatbot */
.assistant-intro-card > p {
  font-size: 14px;
}

.assistant-context > span {
  font-size: 11px;
}

.chat-header strong {
  font-size: 14px;
}

.chat-header small {
  font-size: 10.5px;
}

.suggestion-chip {
  font-size: 10.5px;
}

.message-bubble {
  font-size: 12.5px;
}

.human-help {
  font-size: 10.5px;
}

.chat-inline-error,
.chat-inline-error button {
  font-size: 10.5px;
}

.chat-composer textarea {
  font-size: 12.5px;
}

.chat-disclaimer {
  font-size: 9px;
}

/* Calendar */
.summary-card small {
  font-size: 10.5px;
}

.calendar-toolbar > div span {
  font-size: 9px;
}

.calendar-toolbar > div strong {
  font-size: 16.5px;
}

.calendar-legend {
  font-size: 11px;
}

.calendar-head span {
  font-size: 11px;
}

.calendar-day .day-number {
  font-size: 14px;
}

.calendar-day .day-mini-label {
  font-size: 9px;
}

/* Profile */
.profile-summary-grid small {
  font-size: 10.5px;
}

.profile-summary-grid strong {
  font-size: 15.5px;
}

.info-row dt {
  font-size: 10.5px;
}

.info-row dd {
  font-size: 12.5px;
}

.notes-card > div span {
  font-size: 13px;
}

.notes-card p {
  font-size: 12px;
}

.support-card > strong {
  font-size: 13px;
}

.support-action strong,
.settings-row strong {
  font-size: 11.5px;
}

.support-action small,
.settings-row small {
  font-size: 9.5px;
}

.developer-credit small {
  font-size: 9px;
}

.developer-credit strong {
  font-size: 11px;
}

/* Login readability */
.login-card > p {
  font-size: 14.5px;
}

.field {
  font-size: 13.5px;
}

.login-help {
  font-size: 12px !important;
}

/* Dialog readability */
.dialog-subtitle {
  font-size: 13px;
}

.dialog-body {
  font-size: 14px;
}

.calendar-detail strong {
  font-size: 13px;
}

.calendar-detail small {
  font-size: 10px;
}

.calendar-detail p {
  font-size: 11.5px;
}

/* Mobile navigation */
.mobile-nav-item small {
  font-size: 9.5px;
  font-weight: 800;
}

/* Responsive fine tuning */
@media (max-width: 680px) {
  .mobile-nav-item small {
    font-size: 8.8px;
  }

  .quick-card strong {
    font-size: 14px;
  }

  .quick-card small {
    font-size: 11px;
  }

  .resource-group-header h3 {
    font-size: 15.5px;
  }

  .resource-group-header p {
    font-size: 10.8px;
  }

  .resource-category-title {
    font-size: 11.5px;
  }

  .resource-link strong {
    font-size: 12px;
  }

  .resource-link small {
    font-size: 10px;
  }

  .news-card h2 {
    font-size: 18px;
  }

  .news-excerpt {
    font-size: 12px;
  }

  .message-bubble {
    font-size: 12px;
  }

  .calendar-head span {
    font-size: 10px;
  }

  .calendar-day .day-number {
    font-size: 13px;
  }

  .calendar-day .day-mini-label {
    font-size: 8.5px;
  }

  .profile-summary-grid small {
    font-size: 10px;
  }

  .profile-summary-grid strong {
    font-size: 13px;
  }

  .info-row dt {
    font-size: 10px;
  }

  .info-row dd {
    font-size: 12px;
  }
}

/* =========================================================
   COMPACT HOME GALLERY + DEDICATED GALLERY PAGE
   ========================================================= */

.gallery-card-compact {
  padding: 16px;
}

.gallery-heading-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
}

.gallery-view-all {
  min-height: 38px;
  padding-inline: 13px;
  border-radius: 13px;
  font-size: 11px;
}

.gallery-view-all .ui-icon {
  width: 15px;
  height: 15px;
}

.gallery-preview-compact {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 9px;
  margin-top: 12px;
}

.gallery-preview-compact .gallery-thumb {
  width: 100%;
  height: 108px;
  min-height: 0;
  aspect-ratio: auto;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-soft);
}

.gallery-preview-compact .gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-thumb-overlay {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 9px;
  color: #fff;
  background: rgba(31, 20, 31, .54);
  opacity: 0;
  backdrop-filter: blur(8px);
  transition: opacity .2s var(--ease), transform .2s var(--ease);
  transform: translateY(3px);
}

html[dir="rtl"] .gallery-thumb-overlay {
  right: auto;
  left: 8px;
}

.gallery-thumb-overlay .ui-icon {
  width: 14px;
  height: 14px;
}

.gallery-thumb:hover .gallery-thumb-overlay,
.gallery-thumb:focus-visible .gallery-thumb-overlay {
  opacity: 1;
  transform: translateY(0);
}

.gallery-preview-compact .gallery-empty {
  grid-column: 1 / -1;
  min-height: 84px;
}

/* Dedicated gallery page */

.gallery-page-hero {
  min-height: 180px;
}

.gallery-page-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 15px 0;
  padding: 14px 16px;
}

.gallery-toolbar-copy {
  min-width: 0;
}

.gallery-toolbar-copy strong,
.gallery-toolbar-copy small {
  display: block;
}

.gallery-toolbar-copy strong {
  margin-top: 3px;
  font-size: 16px;
  font-weight: 950;
  letter-spacing: -.015em;
}

.gallery-toolbar-copy small {
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.45;
  font-weight: 600;
}

.gallery-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
}

.gallery-view-switch {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--background);
}

.gallery-view-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  border-radius: 11px;
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
  font-size: 10.5px;
  font-weight: 850;
  transition: color .18s, background .18s, box-shadow .18s;
}

.gallery-view-button .ui-icon {
  width: 16px;
  height: 16px;
}

.gallery-view-button.is-active {
  color: var(--primary);
  background: var(--surface);
  box-shadow: 0 4px 12px rgba(79,23,77,.07);
}

.gallery-library {
  min-height: 220px;
}

.gallery-library.is-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
  gap: 13px;
}

.gallery-library.is-list {
  display: grid;
  gap: 10px;
}

.gallery-library > .status-card {
  grid-column: 1 / -1;
  min-height: 220px;
  flex-direction: column;
  border-style: solid;
  background: var(--surface);
}

.gallery-library-item {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform .22s var(--ease), box-shadow .22s var(--ease), border-color .22s;
}

.gallery-library.is-grid .gallery-library-item:hover {
  transform: translateY(-3px);
  border-color: rgba(123,43,119,.18);
  box-shadow: var(--shadow-md);
}

.gallery-library-image {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: var(--surface-soft);
  cursor: pointer;
}

.gallery-library.is-grid .gallery-library-image {
  height: 190px;
}

.gallery-library-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .34s var(--ease);
}

.gallery-library-item:hover .gallery-library-image img {
  transform: scale(1.025);
}

.gallery-fullscreen-hint {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: inline-flex;
  min-height: 31px;
  align-items: center;
  gap: 6px;
  padding: 0 9px;
  border: 1px solid rgba(255,255,255,.17);
  border-radius: 10px;
  color: #fff;
  background: rgba(24,15,24,.58);
  opacity: 0;
  backdrop-filter: blur(9px);
  transform: translateY(4px);
  transition: opacity .2s var(--ease), transform .2s var(--ease);
  font-size: 9px;
  font-weight: 850;
}

html[dir="rtl"] .gallery-fullscreen-hint {
  right: auto;
  left: 10px;
}

.gallery-fullscreen-hint .ui-icon {
  width: 14px;
  height: 14px;
}

.gallery-library-image:hover .gallery-fullscreen-hint,
.gallery-library-image:focus-visible .gallery-fullscreen-hint {
  opacity: 1;
  transform: translateY(0);
}

.gallery-library-details {
  display: flex;
  min-height: 70px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 11px;
}

.gallery-library-copy {
  min-width: 0;
  flex: 1;
}

.gallery-library-copy strong,
.gallery-library-copy small {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.gallery-library-copy strong {
  font-size: 12.5px;
  font-weight: 900;
}

.gallery-library-copy small {
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: 9.5px;
  font-weight: 650;
}

.gallery-item-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
}

.gallery-item-action {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--primary);
  background: var(--background);
  cursor: pointer;
  font-size: 9px;
  font-weight: 850;
  transition: background .18s, border-color .18s, transform .18s;
}

.gallery-item-action:hover {
  border-color: rgba(123,43,119,.22);
  background: var(--surface-soft);
  transform: translateY(-1px);
}

.gallery-item-action .ui-icon {
  width: 14px;
  height: 14px;
}

/* List mode */

.gallery-library.is-list .gallery-library-item {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  min-height: 142px;
}

.gallery-library.is-list .gallery-library-image {
  height: 142px;
}

.gallery-library.is-list .gallery-library-details {
  min-width: 0;
  min-height: 142px;
  padding: 16px 18px;
}

.gallery-library.is-list .gallery-library-copy strong {
  font-size: 15px;
}

.gallery-library.is-list .gallery-library-copy small {
  margin-top: 5px;
  font-size: 11px;
}

/* Full-screen viewer actions */

.gallery-viewer header {
  grid-template-columns: auto minmax(80px, 1fr) auto;
}

.gallery-viewer-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.gallery-viewer-actions .viewer-button {
  flex: 0 0 auto;
}

/* Tablet */

@media (max-width: 980px) {
  .gallery-preview-compact .gallery-thumb {
    height: 94px;
  }

  .gallery-library.is-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }

  .gallery-library.is-list .gallery-library-item {
    grid-template-columns: 200px minmax(0, 1fr);
  }
}

/* Mobile */

@media (max-width: 680px) {
  .gallery-card-compact {
    padding: 13px;
  }

  .gallery-card-compact .section-heading {
    align-items: flex-start;
  }

  .gallery-heading-actions {
    align-items: flex-end;
    flex-direction: column;
  }

  .gallery-view-all {
    min-height: 34px;
    padding-inline: 10px;
    font-size: 9px;
  }

  .gallery-preview-compact {
    grid-template-columns: repeat(5, 150px);
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 3px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .gallery-preview-compact::-webkit-scrollbar {
    display: none;
  }

  .gallery-preview-compact .gallery-thumb {
    display: block !important;
    height: 92px;
    scroll-snap-align: start;
  }

  .gallery-thumb-overlay {
    display: none;
  }

  .gallery-page-toolbar {
    align-items: stretch;
    flex-direction: column;
    padding: 13px;
  }

  .gallery-toolbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .gallery-view-switch {
    flex: 1;
  }

  .gallery-view-button {
    flex: 1;
  }

  .gallery-library.is-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .gallery-library.is-grid .gallery-library-image {
    height: 145px;
  }

  .gallery-library-details {
    min-height: 82px;
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    padding: 9px;
  }

  .gallery-item-actions {
    width: 100%;
  }

  .gallery-item-action {
    flex: 1;
  }

  .gallery-item-action span:not(.ui-icon) {
    display: none;
  }

  .gallery-library.is-list .gallery-library-item {
    grid-template-columns: 118px minmax(0, 1fr);
    min-height: 105px;
  }

  .gallery-library.is-list .gallery-library-image {
    height: 105px;
  }

  .gallery-library.is-list .gallery-library-details {
    min-height: 105px;
    padding: 10px;
    align-items: stretch;
    flex-direction: column;
  }

  .gallery-library.is-list .gallery-library-copy strong {
    font-size: 12.5px;
  }

  .gallery-library.is-list .gallery-library-copy small {
    font-size: 9.5px;
  }

  .gallery-fullscreen-hint {
    display: none;
  }

  .gallery-viewer header {
    width: calc(100% - 20px);
  }
}

@media (max-width: 420px) {
  .gallery-heading-actions .count-pill {
    display: none;
  }

  .gallery-library.is-grid {
    grid-template-columns: 1fr 1fr;
  }

  .gallery-library.is-grid .gallery-library-image {
    height: 128px;
  }

  .gallery-toolbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .gallery-view-switch,
  .gallery-toolbar-actions > .secondary-button {
    width: 100%;
  }
}

