/*
 * RAH glass theme, phase 1: student pages.
 * Active only when <html> has the class "app-glass" (set by the layout for
 * signed-in students). Admin, mail and public pages are untouched.
 */
html.app-glass {
  --rg-ink: #0f172a;
  --rg-sub: #414b5a;
  --rg-accent: var(--brand-primary-ink, #27348f);
  --rg-accent-bright: #3a66e0;
  --rg-line: rgba(15, 23, 42, 0.07);
  --rg-glass-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.52));
  --rg-glass-border: 1px solid rgba(255, 255, 255, 0.85);
  --rg-glass-shadow: 0 16px 40px rgba(39, 52, 143, 0.1), 0 2px 6px rgba(39, 52, 143, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.95);
  --rg-blur: blur(30px) saturate(180%);
  --rg-radius: 26px;
}

html.app-glass body {
  background-color: #eef2fb;
  background-image:
    radial-gradient(560px 480px at 96% -4%, rgba(86, 130, 255, 0.42), rgba(86, 130, 255, 0) 72%),
    radial-gradient(520px 460px at -6% 44%, rgba(150, 132, 255, 0.26), rgba(150, 132, 255, 0) 72%),
    radial-gradient(540px 460px at 70% 104%, rgba(255, 190, 140, 0.3), rgba(255, 190, 140, 0) 72%);
  background-attachment: fixed;
  color: var(--rg-ink);
}

/* Shared glass surface */
html.app-glass .dashboard-quick-stat,
html.app-glass .dashboard-section,
html.app-glass .student-course-card,
html.app-glass .form-card,
html.app-glass .empty-state,
html.app-glass .settings-card,
html.app-glass .admin-form-panel {
  background: var(--rg-glass-bg) !important;
  -webkit-backdrop-filter: var(--rg-blur);
  backdrop-filter: var(--rg-blur);
  border: var(--rg-glass-border) !important;
  border-radius: var(--rg-radius) !important;
  box-shadow: var(--rg-glass-shadow) !important;
}

/* Devices that cannot blur get a solid, readable card instead */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  html.app-glass .dashboard-quick-stat,
  html.app-glass .dashboard-section,
  html.app-glass .student-course-card,
    html.app-glass .form-card,
  html.app-glass .app-tabbar,
  html.app-glass .mobile-topbar {
    background: rgba(255, 255, 255, 0.94) !important;
  }
}

/* Buttons */
html.app-glass .primary-button {
  background-image: linear-gradient(180deg, var(--rg-accent-bright), var(--rg-accent)) !important;
  border: 0 !important;
  border-radius: 999px !important;
  box-shadow: 0 12px 26px rgba(39, 52, 143, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
  color: #ffffff !important;
  min-height: 44px;
}

html.app-glass .primary-button:disabled {
  background-image: none !important;
  background-color: rgba(19, 107, 58, 0.12) !important;
  box-shadow: none !important;
  color: #136b3a !important;
}

html.app-glass .main-panel .secondary-button,
html.app-glass .main-panel .ghost-button,
html.app-glass .main-panel .app-back-button {
  background: var(--rg-glass-bg) !important;
  border: var(--rg-glass-border) !important;
  border-radius: 999px !important;
  box-shadow: 0 6px 16px rgba(39, 52, 143, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.95) !important;
  color: var(--rg-ink) !important;
  min-height: 44px;
}

@media (max-width: 899px) {
  /* Top bar: light glass instead of the dark strip */
  html.app-glass .mobile-topbar {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.5)) !important;
    -webkit-backdrop-filter: var(--rg-blur);
    backdrop-filter: var(--rg-blur);
    border-bottom: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 6px 20px rgba(39, 52, 143, 0.08);
    color: var(--rg-ink) !important;
  }

  html.app-glass .mobile-topbar .brand,
  html.app-glass .mobile-topbar .brand strong {
    color: var(--rg-ink) !important;
  }

  html.app-glass .mobile-topbar .brand small {
    color: var(--rg-sub) !important;
  }

  html.app-glass .mobile-topbar .menu-toggle,
  html.app-glass .mobile-topbar .topbar-notification {
    background: rgba(255, 255, 255, 0.85) !important;
    border: 1px solid rgba(255, 255, 255, 0.9) !important;
    border-radius: 50% !important;
    box-shadow: 0 4px 12px rgba(39, 52, 143, 0.12) !important;
    color: var(--rg-ink) !important;
    height: 44px !important;
    width: 44px !important;
  }

  html.app-glass .mobile-topbar .menu-toggle span {
    background: var(--rg-ink) !important;
  }

  html.app-glass .mobile-topbar .topbar-notification svg {
    fill: var(--rg-ink) !important;
  }

  /* Room for the floating tab bar */
  html.app-glass .main-panel {
    padding-bottom: 116px !important;
  }

  /* Course cards: one clean column (copy, then actions) */
  html.app-glass .student-course-card {
    display: flex !important;
    flex-direction: column !important;
    gap: 14px !important;
    min-height: 0 !important;
    padding: 18px !important;
  }

  html.app-glass .student-course-card .student-course-thumbnail {
    border-radius: 18px !important;
    order: 0;
    overflow: hidden;
  }

  html.app-glass .student-course-card .student-course-copy {
    flex: 0 0 auto !important;
    height: auto !important;
    min-height: 0 !important;
    order: 1;
    padding: 0 !important;
    text-align: start !important;
    width: 100% !important;
  }

  html.app-glass .student-course-card .student-course-meta {
    justify-content: flex-start !important;
  }

  html.app-glass .student-course-card .student-course-actions {
    display: flex !important;
    gap: 10px !important;
    order: 2;
    position: static !important;
    width: 100% !important;
  }

  html.app-glass .student-course-card .student-course-actions > * {
    border-radius: 999px !important;
    flex: 1 1 0 !important;
    height: auto !important;
    justify-content: center;
    min-height: 46px !important;
    white-space: nowrap;
    width: auto !important;
  }
}

/* Bottom tab bar (phones and small tablets only) */
html.app-glass .app-tabbar {
  display: none;
}

@media (max-width: 899px) {
  html.app-glass .app-tabbar {
    background: var(--rg-glass-bg);
    -webkit-backdrop-filter: var(--rg-blur);
    backdrop-filter: var(--rg-blur);
    border: var(--rg-glass-border);
    border-radius: 34px;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    box-shadow: var(--rg-glass-shadow);
    box-sizing: border-box;
    display: flex;
    gap: 2px;
    inset-inline: 14px;
    padding: 8px;
    position: fixed;
    z-index: 40;
  }

  html.app-glass .app-tab {
    align-items: center;
    border-radius: 26px;
    color: var(--rg-sub);
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    font-size: 13px; /* was 11px: too small to read on phones */
    font-weight: 600;
    gap: 2px;
    justify-content: center;
    line-height: 1.2;
    min-height: 52px;
    min-width: 0;
    padding: 4px 2px;
    text-align: center;
    text-decoration: none;
  }

  html.app-glass .app-tab span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  html.app-glass .app-tab.active {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 14px rgba(39, 52, 143, 0.16);
    color: var(--rg-accent);
    font-weight: 800;
  }

  html.app-glass .app-tab:focus-visible {
    outline: 2px solid var(--rg-accent-bright);
    outline-offset: 2px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  html.app-glass .app-tab,
  html.app-glass .primary-button,
  html.app-glass .secondary-button {
    transition: background-color 160ms ease, box-shadow 160ms ease, transform 120ms ease;
  }

  html.app-glass .primary-button:active,
  html.app-glass .secondary-button:active,
  html.app-glass .app-tab:active {
    transform: scale(0.97);
  }
}

/* Student dashboard header */
/* The banner keeps whatever the student chose (photo or colour); the theme
   only rounds it and gives it depth. */
html.app-glass .student-dashboard-banner {
  border: 1px solid rgba(255, 255, 255, 0.38) !important;
  border-radius: 28px !important;
  box-shadow: 0 24px 48px rgba(39, 52, 143, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
}

html.app-glass .student-dashboard-greeting {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.78)) !important;
  -webkit-backdrop-filter: var(--rg-blur);
  backdrop-filter: var(--rg-blur);
  border: var(--rg-glass-border) !important;
  border-radius: var(--rg-radius) !important;
  box-shadow: var(--rg-glass-shadow) !important;
  color: var(--rg-ink) !important;
}

html.app-glass .student-dashboard-greeting .profile-action-buttons > * {
  background: rgba(255, 255, 255, 0.9) !important;
  border: 1px solid rgba(15, 23, 42, 0.08) !important;
  box-shadow: 0 4px 12px rgba(39, 52, 143, 0.08) !important;
  color: var(--rg-ink) !important;
  min-height: 44px;
}

html.app-glass .dashboard-quick-stat::before,
html.app-glass .dashboard-quick-stat::after,
html.app-glass .student-course-card::before {
  display: none !important;
}

html.app-glass .main-panel h1 {
  font-weight: 800;
  letter-spacing: -0.4px;
}

/* ===================== Student dashboard, phase 2 ===================== */

/* Sidebar: light glass, readable, right side in RTL on desktop */
html.app-glass .sidebar {
  background: rgba(255, 255, 255, 0.62) !important;
  -webkit-backdrop-filter: var(--rg-blur);
  backdrop-filter: var(--rg-blur);
  border-inline-end: 1px solid rgba(255, 255, 255, 0.85) !important;
  box-shadow: 0 10px 40px rgba(39, 52, 143, 0.06);
  color: var(--rg-ink) !important;
  font-size: 15px !important;
  gap: 6px !important;
  padding: 18px 14px !important;
}

html.app-glass .sidebar .brand strong {
  color: var(--rg-ink) !important;
}

html.app-glass .sidebar .brand small {
  color: var(--rg-sub) !important;
  font-size: 13px !important;
}

html.app-glass .sidebar .drawer-close {
  color: var(--rg-ink) !important;
}

html.app-glass .sidebar .nav-list {
  gap: 4px !important;
}

html.app-glass .sidebar .nav-link {
  align-items: center;
  background: transparent !important;
  border: 0 !important;
  border-radius: 14px !important;
  box-shadow: none !important;
  color: var(--rg-sub) !important;
  display: flex !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  min-height: 44px;
  padding: 0 14px !important;
}

html.app-glass .sidebar .nav-link:hover {
  background: rgba(255, 255, 255, 0.7) !important;
  color: var(--rg-accent) !important;
}

html.app-glass .sidebar .nav-link.active {
  background: rgba(255, 255, 255, 0.95) !important;
  box-shadow: 0 4px 14px rgba(39, 52, 143, 0.14) !important;
  color: var(--rg-accent) !important;
  font-weight: 800 !important;
}

html.app-glass .sidebar .ghost-button {
  background: rgba(255, 255, 255, 0.55) !important;
  border: 1px solid rgba(255, 255, 255, 0.9) !important;
  border-radius: 14px !important;
  color: var(--rg-ink) !important;
  font-size: 14px !important;
  min-height: 44px;
}

/* Install / update sits low; sign-out is always the last item */
html.app-glass .sidebar .pwa-panel {
  margin-block-start: auto !important;
}

html.app-glass .sidebar .sidebar-logout {
  color: #b42318 !important;
  margin-block-start: 6px;
}

@media (min-width: 1024px) {
  html.app-glass[dir="rtl"] .app-shell {
    grid-template-columns: 264px minmax(0, 1fr) !important;
  }

  /* In a right-to-left grid, column 1 is the right-hand column */
  html.app-glass[dir="rtl"] .sidebar {
    grid-column: 1 !important;
    grid-row: 1 / span 2 !important;
  }

  html.app-glass[dir="rtl"] .main-panel {
    grid-column: 2 !important;
    grid-row: 2 !important;
  }

  /* Content keeps a comfortable reading width on large monitors */
  html.app-glass .main-panel > * {
    margin-inline: auto;
    max-width: 1200px;
  }
}

@media (max-width: 1023px) {
  html.app-glass .sidebar {
    background: rgba(248, 250, 255, 0.97) !important;
  }
}

/* Welcome banner: avatar and greeting card sit inside the banner */
@media (min-width: 900px) {
  html.app-glass .main-panel .student-dashboard-header {
    display: flex !important;
    flex-direction: column;
    gap: 20px !important;
  }

  html.app-glass .main-panel .student-dashboard-banner {
    align-items: center !important;
    block-size: auto !important;
    display: flex !important;
    min-height: 220px !important;
    padding: 28px !important;
  }

  html.app-glass .main-panel .student-dashboard-profile-row {
    align-items: center !important;
    display: flex !important;
    gap: 22px !important;
    margin: 0 !important;
    transform: none !important;
    width: 100% !important;
  }

  html.app-glass .main-panel .student-dashboard-profile-row > .student-dashboard-avatar {
    flex: 0 0 auto;
    height: 104px !important;
    inset: auto !important;
    position: relative !important;
    width: 104px !important;
  }

  html.app-glass .main-panel .student-dashboard-greeting-stack {
    display: block !important;
    flex: 1 1 auto;
    max-width: 680px;
    min-width: 0;
  }

  html.app-glass .main-panel .student-dashboard-greeting {
    display: grid !important;
    gap: 6px !important;
    padding: 20px 24px !important;
  }

  html.app-glass .main-panel .student-dashboard-greeting .profile-action-buttons {
    display: flex !important;
    flex-wrap: wrap;
    gap: 8px !important;
    margin-block-start: 10px !important;
  }

  html.app-glass .main-panel .student-dashboard-greeting .profile-action-buttons > * {
    min-height: 40px;
    width: auto !important;
  }

  html.app-glass .main-panel .dashboard-quick-stats {
    padding-block-start: 0 !important;
  }
}

/* Phones: avatar on top, greeting card below it, all inside the banner */
@media (max-width: 899px) {
  html.app-glass .main-panel .student-dashboard-header {
    display: flex !important;
    flex-direction: column;
    gap: 16px !important;
  }

  html.app-glass .main-panel .student-dashboard-banner {
    block-size: auto !important;
    display: block !important;
    min-height: 0 !important;
  }

  html.app-glass .main-panel .student-dashboard-profile-row {
    flex-direction: column !important;
    gap: 12px !important;
    margin: 0 !important;
    width: 100% !important;
  }

  html.app-glass .main-panel .student-dashboard-profile-row > .student-dashboard-avatar {
    inset: auto !important;
    margin: 0 !important;
    position: relative !important;
    transform: none !important;
  }

  html.app-glass .main-panel .student-dashboard-greeting-stack {
    display: block !important;
    width: 100%;
  }

  html.app-glass .main-panel .dashboard-quick-stats {
    padding-block-start: 0 !important;
  }

  html.app-glass .main-panel .dashboard-section {
    padding: 18px !important;
  }
}

/* Readable type on the dashboard */
html.app-glass .main-panel .student-dashboard-greeting p,
html.app-glass .main-panel .student-dashboard-greeting span {
  font-size: 15px !important;
}

html.app-glass .main-panel .student-dashboard-greeting h1 {
  font-size: clamp(22px, 2.2vw, 30px) !important;
}

html.app-glass .main-panel .dashboard-bio-text {
  font-style: normal !important;
}

html.app-glass .main-panel .dashboard-stat-label {
  color: var(--rg-sub) !important;
  font-size: 14px !important;
  font-weight: 700 !important;
}

html.app-glass .main-panel .dashboard-stat-subtitle {
  color: var(--rg-sub) !important;
  font-size: 13px !important;
}

/* Sections: inner spacing, titles inside the card, no stretched gaps */
html.app-glass .main-panel .dashboard-content-grid {
  align-items: start !important;
  gap: 20px !important;
}

html.app-glass .main-panel .dashboard-side-column {
  align-content: start;
  gap: 20px !important;
}

html.app-glass .main-panel .dashboard-section {
  align-content: start;
  gap: 14px !important;
  padding: 22px 24px !important;
}

html.app-glass .main-panel .dashboard-section h2 {
  font-size: 18px !important;
  line-height: 1.4;
  margin: 0 !important;
  padding: 0 !important;
}

html.app-glass .main-panel #dashboardCertificateMessage:empty {
  display: none;
}

/* Empty states: no box inside the card, a real icon, readable text */
html.app-glass .main-panel .dashboard-empty-state {
  align-items: center;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  display: flex !important;
  flex-wrap: wrap;
  gap: 14px !important;
  padding: 6px 0 !important;
}

html.app-glass .main-panel .dashboard-empty-state.is-wide {
  grid-column: 1 / -1;
  padding-block: 18px !important;
}

html.app-glass .main-panel .dashboard-empty-state .dashboard-empty-icon {
  align-items: center;
  background: rgba(58, 102, 224, 0.1) !important;
  border: 0 !important;
  border-radius: 14px !important;
  color: var(--rg-accent) !important;
  display: inline-flex !important;
  flex: 0 0 auto;
  height: 44px !important;
  justify-content: center;
  width: 44px !important;
}

html.app-glass .main-panel .dashboard-empty-state .dashboard-empty-icon svg {
  height: 22px;
  width: 22px;
}

html.app-glass .main-panel .dashboard-empty-state.warning-state .dashboard-empty-icon {
  background: rgba(220, 120, 20, 0.12) !important;
  color: #b45309 !important;
}

html.app-glass .main-panel .dashboard-empty-state p {
  color: var(--rg-sub) !important;
  flex: 1 1 200px;
  font-size: 15px !important;
  margin: 0 !important;
}

html.app-glass .main-panel .dashboard-empty-action {
  border-radius: 999px !important;
  min-height: 42px;
  padding-inline: 20px !important;
  text-decoration: none;
}

/* The portal shrinks every desktop page to 80% (html zoom), which made the
   student text tiny. Students get real 100% size. */
@media (min-width: 1200px) {
  html.app-glass {
    zoom: 1 !important;
  }

  html.app-glass .sidebar {
    height: 100vh !important;
  }
}

/* ============ One student menu for portal, Messages and Email ============
   Layout chosen from the Messages app: icon + label rows, no boxes, the
   current item as a white pill, the current section expanded under it. */
html.app-glass .app-student-nav,
html.app-glass .sidebar .nav-list {
  display: grid !important;
  gap: 2px !important;
}

html.app-glass .app-nav-item,
html.app-glass .sidebar .nav-link.app-nav-item,
html.app-glass .sidebar .notification-trigger,
html.app-glass .sidebar .pwa-panel .ghost-button,
html.app-glass .sidebar .sidebar-logout {
  align-items: center !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 12px !important;
  box-shadow: none !important;
  color: #13233a !important;
  cursor: pointer;
  display: flex !important;
  font: inherit;
  font-size: 14px !important;
  font-weight: 500 !important;
  gap: 11px !important;
  justify-content: flex-start !important;
  min-height: 44px !important;
  padding: 0 12px !important;
  text-align: start;
  text-decoration: none !important;
  width: 100%;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

html.app-glass .app-nav-item svg,
html.app-glass .sidebar .notification-trigger svg,
html.app-glass .sidebar .pwa-panel .ghost-button svg,
html.app-glass .sidebar .sidebar-logout svg {
  color: #5b6b85;
  flex: 0 0 20px;
  height: 20px;
  width: 20px;
}

html.app-glass .app-nav-item:hover,
html.app-glass .sidebar .notification-trigger:hover,
html.app-glass .sidebar .pwa-panel .ghost-button:hover {
  background: rgba(255, 255, 255, 0.6) !important;
}

html.app-glass .app-nav-item.active,
html.app-glass .app-nav-item[aria-current="page"],
html.app-glass .sidebar .nav-link.app-nav-item.active {
  background: rgba(255, 255, 255, 0.92) !important;
  box-shadow: 0 4px 14px rgba(39, 52, 143, 0.12) !important;
  color: var(--rg-accent, var(--brand-primary-ink, #27348f)) !important;
  font-weight: 700 !important;
}

html.app-glass .app-nav-item.active svg,
html.app-glass .app-nav-item[aria-current="page"] svg {
  color: var(--rg-accent, var(--brand-primary-ink, #27348f));
}

/* Sub-items of the open section (Messages: direct/groups/support,
   Email: write + folders) */
html.app-glass .app-nav-section {
  display: grid;
  gap: 2px;
  margin: 2px 0 8px;
  padding-inline-start: 16px;
}

html.app-glass .app-nav-section .app-nav-sub {
  min-height: 40px !important;
}

html.app-glass .app-nav-section .app-nav-sub.active,
html.app-glass .app-nav-section .app-nav-sub[aria-current="page"] {
  background: rgba(255, 255, 255, 0.7) !important;
  box-shadow: none !important;
}

html.app-glass .sidebar .sidebar-logout,
html.app-glass .sidebar .sidebar-logout svg {
  color: #b42318 !important;
}

html.app-glass .sidebar .notification-trigger .notification-badge {
  margin-inline-start: auto;
}

/* Brand row like the Messages app: logo + «راه ۱۴:۶» */
html.app-glass .sidebar .brand strong {
  font-size: 19px !important;
  font-weight: 800 !important;
}

/* ---------- Course cards: picture on top, text, then buttons ---------- */
html.app-glass .main-panel .student-course-grid {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
}

html.app-glass .main-panel .student-course-card {
  block-size: auto !important;
  display: flex !important;
  flex-direction: column !important;
  max-block-size: none !important;
  min-block-size: 0 !important;
  gap: 14px !important;
  padding: 14px !important;
}

html.app-glass .main-panel .student-course-card > .student-course-thumbnail {
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  height: auto !important;
  overflow: hidden;
  width: 100% !important;
}

html.app-glass .main-panel .student-course-card > .student-course-copy {
  block-size: auto !important;
  flex: 0 0 auto;
  min-block-size: 0 !important;
  display: flex !important;
  flex-direction: column;
  gap: 8px;
  padding-inline: 4px;
  width: auto !important;
}

html.app-glass .main-panel .student-course-card .student-course-title {
  font-size: 18px !important;
  margin: 0 !important;
}

html.app-glass .main-panel .student-course-card .student-course-description {
  color: var(--rg-sub) !important;
  font-size: 14px !important;
  margin: 0 !important;
}

html.app-glass .main-panel .student-course-card > .student-course-actions {
  display: flex !important;
  gap: 8px !important;
  margin-block-start: auto;
  padding-inline: 4px;
  width: auto !important;
}

html.app-glass .main-panel .student-course-card > .student-course-actions > * {
  flex: 1 1 0;
  justify-content: center;
}

/* ======================= Admin and staff pages =======================
   Same glass look as the student side: soft wallpaper, frosted cards with
   round corners, no cream/yellow surfaces. Layout of each page is unchanged. */
html.app-glass.app-glass-admin .main-panel .dashboard-hero,
html.app-glass.app-glass-admin .main-panel .dashboard-stat-card,
html.app-glass.app-glass-admin .main-panel .dashboard-quick-actions,
html.app-glass.app-glass-admin .main-panel .dashboard-activity-card,
html.app-glass.app-glass-admin .main-panel .dashboard-context-card,
html.app-glass.app-glass-admin .main-panel .admin-workspace-bar,
html.app-glass.app-glass-admin .main-panel .admin-toolbar,
html.app-glass.app-glass-admin .main-panel .table-panel,
html.app-glass.app-glass-admin .main-panel .panel,
html.app-glass.app-glass-admin .main-panel .card,
html.app-glass.app-glass-admin .main-panel [class$="-hero"],
html.app-glass.app-glass-admin .main-panel [class*="-hero "],
html.app-glass.app-glass-admin .main-panel [class$="-card"]:not(.dashboard-action-card),
html.app-glass.app-glass-admin .main-panel [class*="-panel"]:not(.main-panel) {
  background: var(--rg-glass-bg) !important;
  -webkit-backdrop-filter: var(--rg-blur);
  backdrop-filter: var(--rg-blur);
  border: var(--rg-glass-border) !important;
  border-radius: 22px !important;
  box-shadow: var(--rg-glass-shadow) !important;
}

/* Small cards inside a glass card stay light and simple (no glass on glass) */
html.app-glass.app-glass-admin .main-panel .dashboard-action-card,
html.app-glass.app-glass-admin .main-panel .dashboard-activity-empty,
html.app-glass.app-glass-admin .main-panel .dashboard-hero-badge {
  background: rgba(255, 255, 255, 0.7) !important;
  border: 1px solid rgba(255, 255, 255, 0.9) !important;
  border-radius: 16px !important;
  box-shadow: none !important;
}

html.app-glass.app-glass-admin .main-panel .dashboard-hero::before,
html.app-glass.app-glass-admin .main-panel .dashboard-hero::after {
  display: none !important;
}

/* Form fields: rounded, light, same accent focus ring */
html.app-glass .main-panel select,
html.app-glass .main-panel input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
html.app-glass .main-panel textarea {
  background: rgba(255, 255, 255, 0.85) !important;
  border: 1px solid rgba(15, 23, 42, 0.1) !important;
  border-radius: 12px !important;
}

html.app-glass .main-panel select:focus,
html.app-glass .main-panel input:focus,
html.app-glass .main-panel textarea:focus {
  border-color: var(--rg-accent-bright) !important;
  box-shadow: 0 0 0 3px rgba(58, 102, 224, 0.18) !important;
  outline: none;
}

html.app-glass.app-glass-admin .main-panel table th {
  color: var(--rg-sub) !important;
  font-size: 13px !important;
}

/* Small laptops and landscape tablets (900–1199px): the sidebar takes room,
   so dashboard sections stack instead of squeezing the course card. */
@media (min-width: 900px) and (max-width: 1199px) {
  html.app-glass .main-panel .dashboard-content-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  html.app-glass .main-panel .dashboard-side-column {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ===== Mixed languages: each text follows its own direction =====
   Course names, descriptions and other user-written text keep dir="auto",
   so a Dari title in the English interface sits on the right and an English
   title in the Dari interface sits on the left. */
html.app-glass .card-title-text[dir="auto"],
html.app-glass .card-description-text[dir="auto"],
html.app-glass .direct-message-bubble p[dir="auto"],
html.app-glass .admin-inbox-row-main [dir="auto"] {
  display: block;
  text-align: start;
  unicode-bidi: plaintext;
}

/* ---------- Admin polish ---------- */
/* Unread notifications and sound rows: light blue tint instead of cream */
html.app-glass .notification-item.unread {
  background: rgba(58, 102, 224, 0.08) !important;
  border-color: rgba(58, 102, 224, 0.18) !important;
}

html.app-glass .settings-sonic-row {
  background: rgba(255, 255, 255, 0.7) !important;
  border: 1px solid rgba(15, 23, 42, 0.08) !important;
  border-radius: 16px !important;
}

/* Users table: the Actions heading sits over its buttons */
html.app-glass .user-management-table th:last-child {
  text-align: end;
}

/* Text written by people (messages, previews, notifications, email rows)
   takes its direction from its own first letters: Dari reads right-to-left
   even in the English interface, English left-to-right in the Dari one. */
html.app-glass .admin-inbox-row-main h3,
html.app-glass .admin-inbox-row-main p,
html.app-glass .direct-message-bubble p,
html.app-glass .notification-item strong,
html.app-glass .notification-item span,
html.app-glass .email-row-sender,
html.app-glass .email-row-subject,
html.app-glass .email-row-snippet {
  text-align: start;
  unicode-bidi: plaintext;
}

html.app-glass .notification-item strong,
html.app-glass .notification-item span {
  display: block;
}

/* Download page: the phone card first, with the same glass look */
html.app-glass .dl-phone-card .dl-steps + .dl-steps {
  margin-block-start: 12px;
}

html.app-glass .dl-installed {
  color: #15803d;
  font-weight: 700;
}

/* Student pages polish: meetings, settings */
html.app-glass .main-panel select {
  min-height: 46px;
  padding-inline: 14px !important;
}

html.app-glass .main-panel .settings-card .form-message:empty,
html.app-glass .main-panel #meetingFeedback:empty {
  display: none;
}

html.app-glass .main-panel .settings-card .settings-card-header {
  margin-bottom: 0 !important;
}

html.app-glass .main-panel .meeting-filters {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 999px;
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  width: fit-content;
}

html.app-glass .main-panel .meeting-filters button {
  background: transparent !important;
  border: 0 !important;
  border-radius: 999px !important;
  box-shadow: none !important;
  color: var(--rg-sub) !important;
  min-height: 40px;
  outline: none !important;
}

html.app-glass .main-panel .meeting-filters button[aria-pressed="true"] {
  background: rgba(255, 255, 255, 0.95) !important;
  box-shadow: 0 4px 14px rgba(39, 52, 143, 0.12) !important;
  color: var(--rg-accent) !important;
  font-weight: 700;
}

html.app-glass .main-panel .meeting-list {
  margin-top: 18px;
}

html.app-glass .main-panel .meeting-card,
html.app-glass .main-panel .meeting-empty-state {
  background: var(--rg-glass-bg) !important;
  -webkit-backdrop-filter: var(--rg-blur);
  backdrop-filter: var(--rg-blur);
  border: var(--rg-glass-border) !important;
  border-radius: var(--rg-radius) !important;
  box-shadow: var(--rg-glass-shadow) !important;
}

html.app-glass .main-panel .meeting-empty-state {
  align-items: center;
  display: flex !important;
  gap: 14px;
  padding: 22px !important;
}

html.app-glass .main-panel .meeting-empty-icon {
  align-items: center;
  background: rgba(58, 102, 224, 0.1);
  border-radius: 14px;
  color: var(--rg-accent);
  display: inline-flex;
  flex: 0 0 auto;
  height: 44px;
  justify-content: center;
  width: 44px;
}

html.app-glass .main-panel .meeting-empty-icon svg {
  height: 22px;
  width: 22px;
}

html.app-glass .main-panel .meeting-empty-state p {
  color: var(--rg-sub);
  font-size: 15px;
  margin: 0;
}

html.app-glass .main-panel .meeting-card h2,
html.app-glass .main-panel .meeting-card p {
  text-align: start;
  unicode-bidi: plaintext;
}

@media (max-width: 760px) {
  html.app-glass .main-panel .meeting-filters {
    display: flex;
    width: 100%;
  }
}

/* Phones: page content no longer shows through the gap under the floating tab bar */
@media (max-width: 899px) {
  html.app-glass .app-tabbar::before {
    background: linear-gradient(to top, rgba(238, 241, 250, 0.97) 55%, rgba(238, 241, 250, 0));
    bottom: calc(-14px - env(safe-area-inset-bottom, 0px));
    content: "";
    inset-inline: -14px;
    pointer-events: none;
    position: absolute;
    top: -28px;
    z-index: -1;
  }
}

/* Sound names are English: show them whole, left-to-right */
html.app-glass .settings-sonic-choice select {
  direction: ltr;
  min-width: 0;
  text-align: left;
  text-overflow: ellipsis;
}

@media (max-width: 520px) {
  html.app-glass .settings-sonic-choice {
    display: grid !important;
    gap: 10px;
    grid-template-columns: 1fr;
  }

  html.app-glass .settings-sonic-choice select {
    width: 100%;
  }
}


/* Phones: the dashboard header is a profile card — cover photo strip, avatar
   overlapping its edge, name, bio and small actions — like a social profile. */
@media (max-width: 899px) {
  html.app-glass .main-panel .student-dashboard-banner {
    --rg-cover-h: clamp(118px, 34vw, 170px);
    background-color: rgba(255, 255, 255, 0.86) !important;
    background-position: center top !important;
    background-repeat: no-repeat !important;
    background-size: 100% var(--rg-cover-h) !important;
    border-radius: 28px !important;
    overflow: hidden;
    padding: 0 !important;
    position: relative;
  }

  html.app-glass .main-panel .student-dashboard-banner.dashboard-banner-custom {
    background-image: var(--dashboard-banner-image) !important;
    background-position: center top !important;
    background-size: 100% var(--rg-cover-h) !important;
  }

  html.app-glass .main-panel .student-dashboard-banner .dashboard-banner-edit {
    inset-block-start: 12px !important;
    inset-inline-end: 12px !important;
    inset-inline-start: auto !important;
    position: absolute !important;
  }

  html.app-glass .main-panel .student-dashboard-profile-row {
    align-items: stretch !important;
    display: block !important;
    padding: calc(var(--rg-cover-h) - 46px) 18px 18px !important;
    position: relative;
    transform: none !important;
  }

  html.app-glass .main-panel .student-dashboard-profile-row > .student-dashboard-avatar {
    border: 4px solid #fff !important;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18) !important;
    font-size: 24px !important;
    height: 92px !important;
    width: 92px !important;
  }

  html.app-glass .main-panel .student-dashboard-greeting-stack {
    margin-block-start: 10px;
  }

  html.app-glass .main-panel .student-dashboard-greeting {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    display: grid !important;
    gap: 4px !important;
    padding: 0 !important;
    text-align: start;
  }

  html.app-glass .main-panel .student-dashboard-greeting h1 {
    display: none !important;
  }

  html.app-glass .main-panel .student-dashboard-greeting > p:first-child {
    color: var(--rg-ink) !important;
    font-size: 22px !important;
    font-weight: 800 !important;
    line-height: 1.4;
    margin: 0 !important;
  }

  html.app-glass .main-panel .student-dashboard-greeting > p:first-child .dashboard-student-name {
    font-size: inherit !important;
  }

  html.app-glass .main-panel .student-dashboard-greeting > span {
    color: var(--rg-sub) !important;
    font-size: 13px !important;
  }

  html.app-glass .main-panel .student-dashboard-greeting .dashboard-bio-text {
    color: var(--rg-ink) !important;
    font-size: 15px !important;
    line-height: 1.7;
    margin: 6px 0 0 !important;
    unicode-bidi: plaintext;
  }

  html.app-glass .main-panel .student-dashboard-greeting .dashboard-bio-text.is-empty {
    display: none !important;
  }

  html.app-glass .main-panel .student-dashboard-greeting .profile-action-buttons {
    display: flex !important;
    align-items: center !important;
    flex-direction: row !important;
    flex-wrap: wrap;
    justify-content: flex-start !important;
    gap: 8px !important;
    margin-block-start: 12px !important;
  }

  html.app-glass .main-panel .student-dashboard-greeting .profile-action-buttons > * {
    min-width: 0 !important;
    align-items: center;
    display: inline-flex !important;
    flex: 0 0 auto !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    gap: 6px;
    height: 40px !important;
    min-height: 40px !important;
    padding: 0 16px !important;
    width: auto !important;
  }

  html.app-glass .main-panel .student-dashboard-greeting .profile-action-buttons span {
    font-size: 13px !important;
  }

  html.app-glass .main-panel .student-dashboard-greeting .dashboard-welcome-edit:first-child {
    background: linear-gradient(135deg, #3a66e0, var(--brand-primary-ink, #27348f)) !important;
    border: 0 !important;
    color: #fff !important;
  }

  html.app-glass .main-panel .student-dashboard-greeting .dashboard-message-link {
    display: none !important;
  }

  /* Four small stats in one row */
  html.app-glass .main-panel .dashboard-quick-stats {
    gap: 8px !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }

  html.app-glass .main-panel .dashboard-quick-stat {
    align-content: start;
    display: grid !important;
    gap: 2px !important;
    justify-items: center;
    min-height: 0 !important;
    padding: 12px 6px !important;
    text-align: center;
  }

  html.app-glass .main-panel .dashboard-quick-stat .dashboard-stat-icon {
    height: 30px !important;
    margin: 0 !important;
    position: static !important;
    width: 30px !important;
  }

  html.app-glass .main-panel .dashboard-quick-stat .dashboard-stat-value {
    font-size: 20px !important;
    line-height: 1.2;
    order: 2;
  }

  html.app-glass .main-panel .dashboard-quick-stat .dashboard-stat-label {
    font-size: 11px !important;
    line-height: 1.3;
    order: 3;
  }

  html.app-glass .main-panel .dashboard-quick-stat .dashboard-stat-icon {
    order: 1;
  }

  html.app-glass .main-panel .dashboard-quick-stat .dashboard-stat-subtitle,
  html.app-glass .main-panel .dashboard-quick-stat .dashboard-stat-mini-progress {
    display: none !important;
  }
}

/* Dashboard: next meeting card */
html.app-glass .main-panel .dashboard-next-meeting {
  align-items: center;
  color: var(--rg-ink) !important;
  display: grid !important;
  gap: 4px 14px;
  grid-template-columns: auto 1fr;
  text-decoration: none !important;
}

html.app-glass .main-panel .dashboard-next-meeting-icon {
  align-items: center;
  background: rgba(58, 102, 224, 0.1);
  border-radius: 14px;
  color: var(--rg-accent);
  display: inline-flex;
  grid-row: span 2;
  height: 46px;
  justify-content: center;
  width: 46px;
}

html.app-glass .main-panel .dashboard-next-meeting-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

html.app-glass .main-panel .dashboard-next-meeting-copy small {
  color: var(--rg-accent);
  font-size: 12px;
  font-weight: 700;
}

html.app-glass .main-panel .dashboard-next-meeting-copy strong {
  font-size: 16px;
  overflow: hidden;
  text-align: start;
  text-overflow: ellipsis;
  unicode-bidi: plaintext;
  white-space: nowrap;
}

html.app-glass .main-panel .dashboard-next-meeting-copy span {
  color: var(--rg-sub);
  font-size: 13px;
}

html.app-glass .main-panel .dashboard-next-meeting-more {
  color: var(--rg-accent);
  font-size: 13px;
  font-weight: 700;
  grid-column: 2;
}

/* "Messages | Calls | Email | Contacts" switch on portal pages (phones) */
html.app-glass .main-panel .app-convo-switch {
  display: none;
}

@media (max-width: 899px) {
  html.app-glass .main-panel .app-convo-switch {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 999px;
    box-shadow: 0 6px 18px rgba(39, 52, 143, 0.08);
    display: flex;
    gap: 2px;
    margin: 0 0 14px;
    padding: 4px;
  }

  html.app-glass .main-panel .app-convo-switch-item {
    align-items: center;
    border-radius: 999px;
    color: #475569;
    display: flex;
    flex: 1 1 0;
    font-size: 13px;
    font-weight: 700;
    justify-content: center;
    min-height: 40px;
    text-decoration: none;
  }

  html.app-glass .main-panel .app-convo-switch-item.active {
    background: #fff;
    box-shadow: 0 4px 14px rgba(39, 52, 143, 0.12);
    color: var(--brand-primary-ink, #27348f);
  }
}

/* Contacts page */
html.app-glass .main-panel .contacts-workspace {
  display: grid;
  gap: 16px;
  max-width: 760px;
}

html.app-glass .main-panel .contacts-card,
html.app-glass .main-panel .contacts-section {
  background: var(--rg-glass-bg);
  -webkit-backdrop-filter: var(--rg-blur);
  backdrop-filter: var(--rg-blur);
  border: var(--rg-glass-border);
  border-radius: var(--rg-radius);
  box-shadow: var(--rg-glass-shadow);
  padding: 18px;
}

html.app-glass .main-panel .contacts-me {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

html.app-glass .main-panel .contacts-me small,
html.app-glass .main-panel .contacts-add label {
  color: var(--rg-sub);
  display: block;
  font-size: 13px;
  font-weight: 700;
}

html.app-glass .main-panel .contacts-me strong {
  color: var(--rg-accent);
  display: block;
  font-size: 20px;
  margin: 2px 0;
  text-align: start;
}

html.app-glass .main-panel .contacts-me p {
  color: var(--rg-sub);
  font-size: 13px;
  margin: 0;
}

html.app-glass .main-panel .contacts-add-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

html.app-glass .main-panel .contacts-add-row input {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
}

html.app-glass .main-panel .contacts-add .form-message:empty {
  display: none;
}

html.app-glass .main-panel .contacts-add .form-message.is-success {
  color: #15803d;
}

html.app-glass .main-panel .contacts-section h2 {
  align-items: center;
  display: flex;
  font-size: 16px;
  gap: 8px;
  margin: 0 0 8px;
}

html.app-glass .main-panel .contacts-count {
  background: rgba(58, 102, 224, 0.12);
  border-radius: 999px;
  color: var(--rg-accent);
  font-size: 12px;
  padding: 2px 8px;
}

html.app-glass .main-panel .contacts-list {
  display: grid;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

html.app-glass .main-panel .contact-row {
  align-items: center;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
  display: flex;
  gap: 12px;
  padding: 10px 0;
}

html.app-glass .main-panel .contact-row:first-child {
  border-top: 0;
}

html.app-glass .main-panel .contact-avatar {
  align-items: center;
  background: linear-gradient(135deg, #dbe4ff, #eef1fa);
  border-radius: 50%;
  color: var(--rg-accent);
  display: inline-flex;
  flex: 0 0 auto;
  font-weight: 800;
  height: 44px;
  justify-content: center;
  overflow: hidden;
  width: 44px;
}

html.app-glass .main-panel .contact-avatar img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

html.app-glass .main-panel .contact-copy {
  display: grid;
  flex: 1 1 auto;
  min-width: 0;
}

html.app-glass .main-panel .contact-copy strong {
  overflow: hidden;
  text-align: start;
  text-overflow: ellipsis;
  unicode-bidi: plaintext;
  white-space: nowrap;
}

html.app-glass .main-panel .contact-copy small {
  color: var(--rg-sub);
  text-align: start;
}

html.app-glass .main-panel .contact-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

html.app-glass .main-panel .contact-action {
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 999px;
  color: var(--rg-ink);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  min-height: 36px;
  padding: 0 14px;
}

html.app-glass .main-panel .contact-action.is-primary {
  background: linear-gradient(135deg, #3a66e0, var(--brand-primary-ink, #27348f));
  border: 0;
  color: #fff;
}

html.app-glass .main-panel .contact-action.is-danger {
  color: #b91c1c;
}

html.app-glass .main-panel .contacts-empty {
  color: var(--rg-sub);
  margin: 0;
  padding: 8px 4px;
  text-align: center;
}

html.app-glass .main-panel .contacts-add-row .primary-button {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* Contacts: never wider than the screen, even with large phone fonts */
html.app-glass .main-panel .contacts-workspace {
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  width: 100%;
}

html.app-glass .main-panel .contacts-workspace > * {
  box-sizing: border-box;
  max-width: 100%;
  min-width: 0;
}

html.app-glass .main-panel .contacts-me > div {
  min-width: 0;
}

html.app-glass .main-panel .contacts-me strong {
  overflow-wrap: anywhere;
}

html.app-glass .main-panel .contacts-empty {
  overflow-wrap: anywhere;
}

@media (max-width: 560px) {
  html.app-glass .main-panel .contacts-me {
    align-items: flex-start;
    flex-direction: column;
  }

  html.app-glass .main-panel .contacts-add-row {
    flex-direction: column;
  }

  html.app-glass .main-panel .contacts-add-row .primary-button {
    width: 100%;
  }

  html.app-glass .main-panel .contact-row {
    flex-wrap: wrap;
  }

  html.app-glass .main-panel .contact-actions {
    justify-content: flex-start;
    padding-inline-start: 56px;
    width: 100%;
  }
}

/* ---------- Stories ---------- */
html.app-glass .main-panel .stories-bar {
  margin-bottom: 14px;
}

html.app-glass .stories-scroll {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 4px 2px 6px;
  scrollbar-width: none;
}

html.app-glass .stories-scroll::-webkit-scrollbar {
  display: none;
}

html.app-glass .story-bubble {
  align-items: center;
  display: grid;
  flex: 0 0 auto;
  gap: 4px;
  justify-items: center;
  position: relative;
  width: 72px;
}

html.app-glass .story-bubble small {
  color: var(--rg-ink);
  font-size: 12px;
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html.app-glass .story-ring {
  background: rgba(148, 163, 184, 0.45);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  height: 66px;
  padding: 3px;
  width: 66px;
}

html.app-glass .story-ring.is-unseen,
html.app-glass .story-ring.has-story {
  background: conic-gradient(from 210deg, #f59e0b, #ef4444, #8b5cf6, #3a66e0, #f59e0b);
}

html.app-glass .story-avatar {
  align-items: center;
  background: linear-gradient(135deg, #dbe4ff, #eef1fa);
  border: 3px solid #fff;
  border-radius: 50%;
  box-sizing: border-box;
  color: var(--brand-primary-ink, #27348f);
  display: flex;
  font-weight: 800;
  height: 100%;
  justify-content: center;
  overflow: hidden;
  width: 100%;
}

html.app-glass .story-avatar img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

html.app-glass .story-avatar.small {
  flex: 0 0 auto;
  height: 38px;
  width: 38px;
}

html.app-glass .story-avatar.tiny {
  border-width: 2px;
  display: inline-flex;
  font-size: 11px;
  height: 26px;
  width: 26px;
}

html.app-glass .story-add {
  align-items: center;
  background: linear-gradient(135deg, #3a66e0, var(--brand-primary-ink, #27348f));
  border: 2px solid #fff;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: flex;
  font-size: 18px;
  font-weight: 800;
  height: 24px;
  inset-block-start: 46px;
  inset-inline-end: 2px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  position: absolute;
  width: 24px;
}

html.app-glass .stories-hint {
  align-self: center;
  color: var(--rg-sub);
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
}

html.app-glass .main-panel .contact-action.is-star.is-starred {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}

html.app-glass .main-panel .contacts-star-hint {
  color: var(--rg-sub);
  font-size: 12px;
  margin: 8px 4px 0;
}

/* Admin: story reports */
html.app-glass .main-panel .story-reports-workspace {
  display: grid;
  gap: 14px;
  max-width: 820px;
}

html.app-glass .main-panel .story-reports-list {
  display: grid;
  gap: 14px;
}

html.app-glass .main-panel .story-report-card {
  background: var(--rg-glass-bg);
  border: var(--rg-glass-border);
  border-radius: var(--rg-radius);
  box-shadow: var(--rg-glass-shadow);
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
  padding: 16px;
}

html.app-glass .main-panel .story-report-preview {
  border-radius: 16px;
  color: #fff;
  display: grid;
  gap: 8px;
  min-height: 140px;
  padding: 14px;
}

html.app-glass .main-panel .story-report-preview p {
  font-weight: 700;
  margin: 0;
  overflow-wrap: anywhere;
  unicode-bidi: plaintext;
  white-space: pre-wrap;
}

html.app-glass .main-panel .story-report-media img,
html.app-glass .main-panel .story-report-media audio {
  border-radius: 12px;
  max-width: 100%;
}

html.app-glass .main-panel .story-report-media-button {
  background: rgba(255, 255, 255, 0.25);
  border: 0;
  border-radius: 999px;
  color: #fff;
  cursor: pointer;
  font: inherit;
  min-height: 34px;
}

html.app-glass .main-panel .story-report-meta {
  display: grid;
  gap: 6px;
  margin: 0;
}

html.app-glass .main-panel .story-report-meta div {
  display: flex;
  gap: 8px;
}

html.app-glass .main-panel .story-report-meta dt {
  color: var(--rg-sub);
  flex: 0 0 90px;
  font-size: 13px;
}

html.app-glass .main-panel .story-report-meta dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

html.app-glass .main-panel .story-report-actions,
html.app-glass .main-panel .story-report-status {
  grid-column: 1 / -1;
}

html.app-glass .main-panel .story-report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

html.app-glass .main-panel .story-report-actions input {
  flex: 1 1 220px;
  min-width: 0;
}

html.app-glass .main-panel .story-report-status {
  color: var(--rg-sub);
  margin: 0;
}

@media (max-width: 640px) {
  html.app-glass .main-panel .story-report-card {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Calls page */
html.app-glass .main-panel .call-button {
  align-items: center;
  display: inline-flex;
  gap: 6px;
}

html.app-glass .main-panel .call-button svg {
  flex: 0 0 auto;
}

html.app-glass .main-panel .call-row.is-missed .contact-copy strong,
html.app-glass .main-panel .call-row.is-missed .call-status {
  color: #dc2626;
}

html.app-glass .main-panel .call-meta {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
}

html.app-glass .main-panel .call-kind svg {
  height: 14px;
  vertical-align: -2px;
  width: 14px;
}

html.app-glass .main-panel .call-filters {
  margin-bottom: 8px;
}

html.app-glass .main-panel .contacts-count.is-red {
  background: #fee2e2;
  color: #b91c1c;
}

html.app-glass .main-panel .app-convo-switch-item {
  position: relative;
}

html.app-glass .app-missed-dot {
  background: #dc2626;
  border-radius: 999px;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 18px;
  min-width: 18px;
  padding: 0 5px;
  position: absolute;
  text-align: center;
  top: 2px;
  inset-inline-end: 8px;
}

@media (max-width: 560px) {
  html.app-glass .main-panel .call-button span {
    display: none;
  }

  html.app-glass .main-panel .calls-workspace .contact-row {
    flex-wrap: nowrap;
  }

  html.app-glass .main-panel .calls-workspace .contact-actions {
    padding-inline-start: 0;
    width: auto;
  }
}

/* Admin users: show each person's ID (needed to add them as a contact) */
html.app-glass .main-panel .user-id-chip {
  background: rgba(58, 102, 224, 0.08);
  border: 0;
  border-radius: 999px;
  color: var(--rg-accent);
  cursor: pointer;
  display: inline-block;
  font: inherit;
  font-size: 12px;
  margin-top: 4px;
  padding: 2px 10px;
  position: relative;
}

html.app-glass .main-panel .user-id-chip[data-copied]::after {
  background: #0f172a;
  border-radius: 8px;
  color: #fff;
  content: attr(data-copied);
  font-size: 11px;
  inset-block-end: 120%;
  inset-inline-start: 0;
  padding: 2px 8px;
  position: absolute;
  white-space: nowrap;
}

/* Contacts: QR */
html.app-glass .main-panel .contacts-me-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

html.app-glass .main-panel .contacts-add-prompt {
  align-items: center;
  display: grid;
  gap: 8px;
  border: 2px solid rgba(58, 102, 224, 0.35);
}

html.app-glass .main-panel .contacts-add-prompt p {
  margin: 0;
}

html.app-glass .main-panel .contacts-add-prompt strong {
  color: var(--rg-accent);
  font-size: 20px;
  text-align: start;
}

html.app-glass .contact-qr-layer {
  align-items: center;
  background: rgba(15, 23, 42, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 16px;
  position: fixed;
  z-index: 10050;
}

html.app-glass .contact-qr-card {
  align-items: center;
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.35);
  box-sizing: border-box;
  color: #0f172a;
  display: grid;
  gap: 10px;
  justify-items: center;
  max-width: 360px;
  padding: 20px;
  text-align: center;
  width: 100%;
}

html.app-glass .contact-qr-card strong {
  font-size: 18px;
}

html.app-glass .contact-qr-card b {
  color: var(--brand-primary-ink, #27348f);
  font-size: 18px;
}

html.app-glass .contact-qr-card p {
  color: #475569;
  font-size: 13px;
  line-height: 1.7;
  margin: 0;
}

html.app-glass .contact-qr-svg {
  border-radius: 16px;
  height: auto;
  max-width: 100%;
}

html.app-glass .contact-qr-video {
  aspect-ratio: 1;
  background: #0f172a;
  border-radius: 16px;
  object-fit: cover;
  width: 100%;
}

html.app-glass .contact-qr-card .contact-action {
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  min-height: 38px;
  padding: 0 14px;
}

html.app-glass .contact-qr-card .contact-action.is-primary {
  background: linear-gradient(135deg, #3a66e0, var(--brand-primary-ink, #27348f));
  border: 0;
  color: #fff;
}

html.app-glass .contact-qr-card .contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

/* Dashboard profile card on every screen size (phone, tablet, laptop):
   cover photo strip on top, avatar overlapping its lower edge, then name,
   bio and actions on a clean card. The cover image keeps its proportions
   (cover, not stretched) and nothing is drawn on top of it. */
html.app-glass .main-panel .student-dashboard-header .student-dashboard-banner {
  --rg-cover-h: clamp(118px, 34vw, 170px);
  align-items: stretch !important;
  background-color: rgba(255, 255, 255, 0.92) !important;
  background-position: center 35% !important;
  background-repeat: no-repeat !important;
  background-size: cover !important;
  block-size: auto !important;
  border-radius: 28px !important;
  display: block !important;
  min-height: 0 !important;
  overflow: hidden;
  padding: 0 !important;
  position: relative;
}

html.app-glass .main-panel .student-dashboard-header .student-dashboard-banner.dashboard-banner-custom {
  background-image: var(--dashboard-banner-image) !important;
  background-position: center 35% !important;
  background-size: cover !important;
}

html.app-glass .main-panel .student-dashboard-header .student-dashboard-profile-row {
  align-items: stretch !important;
  background: linear-gradient(
    to bottom,
    transparent 0,
    transparent var(--rg-cover-h),
    rgba(255, 255, 255, 0.97) var(--rg-cover-h)
  ) !important;
  display: block !important;
  gap: 0 !important;
  margin: 0 !important;
  padding: calc(var(--rg-cover-h) - 46px) 18px 18px !important;
  position: relative;
  transform: none !important;
  width: auto !important;
}

html.app-glass .main-panel .student-dashboard-header .student-dashboard-greeting-stack {
  max-width: none;
}

@media (min-width: 900px) {
  html.app-glass .main-panel .student-dashboard-header .student-dashboard-banner {
    --rg-cover-h: clamp(180px, 17vw, 230px);
  }

  /* Avatar sits on the cover edge; name, bio and buttons sit beside it. */
  html.app-glass .main-panel .student-dashboard-header .student-dashboard-profile-row {
    align-items: start !important;
    display: grid !important;
    column-gap: 22px !important;
    grid-template-columns: auto minmax(0, 1fr);
    padding: calc(var(--rg-cover-h) - 64px) 32px 24px !important;
    transform: none !important;
  }

  html.app-glass .main-panel .student-dashboard-header .student-dashboard-profile-row > .student-dashboard-avatar {
    border: 5px solid #fff !important;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18) !important;
    height: 128px !important;
    width: 128px !important;
  }

  html.app-glass .main-panel .student-dashboard-header .student-dashboard-greeting-stack {
    margin-block-start: 0;
    padding-block-start: 78px;
  }

  html.app-glass .main-panel .student-dashboard-header .student-dashboard-greeting {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    display: grid !important;
    gap: 4px !important;
    grid-template-columns: minmax(0, 1fr) !important;
    padding: 0 !important;
    text-align: start;
  }

  html.app-glass .main-panel .student-dashboard-header .student-dashboard-greeting h1 {
    display: none !important;
  }

  html.app-glass .main-panel .student-dashboard-header .student-dashboard-greeting > p:first-child {
    color: var(--rg-ink) !important;
    font-size: 26px !important;
    font-weight: 800 !important;
    line-height: 1.4;
    margin: 0 !important;
  }

  html.app-glass .main-panel .student-dashboard-header .student-dashboard-greeting > p:first-child .dashboard-student-name {
    font-size: inherit !important;
  }

  html.app-glass .main-panel .student-dashboard-header .student-dashboard-greeting .dashboard-bio-text {
    color: var(--rg-ink) !important;
    font-size: 15px !important;
    line-height: 1.7;
    margin: 2px 0 0 !important;
    unicode-bidi: plaintext;
  }

  html.app-glass .main-panel .student-dashboard-header .student-dashboard-greeting .dashboard-bio-text.is-empty {
    display: none !important;
  }

  html.app-glass .main-panel .student-dashboard-header .student-dashboard-greeting .profile-action-buttons {
    grid-column: 1 / -1;
    justify-content: flex-start !important;
    margin-block-start: 12px !important;
  }

  html.app-glass .main-panel .student-dashboard-header .student-dashboard-greeting .dashboard-welcome-edit:first-child {
    background: linear-gradient(135deg, #3a66e0, var(--brand-primary-ink, #27348f)) !important;
    border: 0 !important;
    color: #fff !important;
  }
}

/* Contact list: tapping a contact opens their profile sheet. */
html.app-glass .main-panel .contact-open {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 14px;
  color: inherit;
  cursor: pointer;
  display: flex;
  flex: 1 1 auto;
  font: inherit;
  gap: 12px;
  margin: -6px;
  min-width: 0;
  padding: 6px;
  text-align: start;
}

html.app-glass .main-panel .contact-open:hover,
html.app-glass .main-panel .contact-open:focus-visible {
  background: rgba(58, 102, 224, 0.08);
  outline: 0;
}

html.app-glass .contact-sheet .contact-sheet-avatar {
  align-items: center;
  background: #e8eefc;
  border-radius: 50%;
  color: var(--brand-primary-ink, #27348f);
  display: flex;
  font-size: 30px;
  font-weight: 800;
  height: 96px;
  justify-content: center;
  overflow: hidden;
  width: 96px;
}

html.app-glass .contact-sheet .contact-sheet-avatar img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

html.app-glass .contact-sheet .contact-sheet-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 8px 0 4px;
}

html.app-glass .contact-sheet .contact-sheet-action {
  align-items: center;
  color: var(--brand-primary-ink, #27348f);
  display: grid;
  font-size: 13px;
  font-weight: 700;
  gap: 6px;
  justify-items: center;
  min-width: 76px;
  padding: 10px 6px;
  border-radius: 16px;
  background: #eef2fd;
  text-decoration: none;
}

html.app-glass .contact-sheet .contact-sheet-action:hover,
html.app-glass .contact-sheet .contact-sheet-action:focus-visible {
  background: #dfe7fb;
  outline: 2px solid rgba(58, 102, 224, 0.4);
}

html.app-glass .contact-sheet .contact-sheet-action svg {
  fill: none;
  height: 22px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
  width: 22px;
}
