/* =========================
   Design tokens
   ========================= */
:root {
  --color-bg: #f6f5fb;
  --color-surface: #ffffff;

  /* Purple brand colours */
  --color-primary: #5500d2;
  --color-primary-soft: #efe6ff;
  --color-primary-dark: #3e00a0;

  /* Supporting colours */
  --color-accent: #7f3df2;
  --color-danger: #e63946;

  /* Neutrals tuned to purple */
  --color-border: #d8d3e6;
  --color-border-subtle: #e7e3f2;
  --color-text: #1a102a;
  --color-text-muted: #5b4f72;
  --color-text-soft: #8a7fa3;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --shadow-sm: 0 1px 2px rgba(26, 16, 42, 0.06);
  --shadow-md: 0 4px 10px rgba(26, 16, 42, 0.08);

  --font-sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --transition-fast: 150ms ease-out;
}

/* =========================
   Global reset & base
   ========================= */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

/* =========================
   Layout
   ========================= */
.app-shell {
  min-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
}

.app-header {
  background: #ffffff;
  border-bottom: 1px solid var(--color-border-subtle);
  box-shadow: var(--shadow-sm);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-header__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.app-header__brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--color-text);
}

.app-header__brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
}

.app-main {
  flex: 1;
  padding: 1.5rem;
  margin: 0 auto;
  width: 100%;
}

.app-footer {
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  color: var(--color-text-soft);
  border-top: 1px solid var(--color-border-subtle);
  background: #ffffff;
}

.credits-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(85, 0, 210, 0.16);
  background: linear-gradient(135deg, rgba(85, 0, 210, 0.08), rgba(127, 61, 242, 0.14));
  color: var(--color-text);
  cursor: default;
}

.credits-chip__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--color-primary);
  color: #ffffff;
  flex: 0 0 auto;
}

.credits-chip__icon svg {
  width: 16px;
  height: 16px;
}

.credits-chip__text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.credits-chip__text strong {
  font-size: 0.95rem;
}

.credits-chip__text span {
  font-size: 0.72rem;
  color: var(--color-text-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.credits-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 230px;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-subtle);
  background: #ffffff;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  z-index: 50;
}

.credits-chip:hover .credits-popover,
.credits-chip:focus-within .credits-popover {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.credits-popover__title {
  margin: 0 0 0.6rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.credits-popover__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 0.45rem;
}

.credits-popover__row span {
  color: var(--color-text-muted);
}

.credits-popover__hint {
  margin: 0.45rem 0 0;
  font-size: 0.78rem;
  color: var(--color-text-soft);
}

.credits-mobile {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.85rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(85, 0, 210, 0.16);
  background: linear-gradient(135deg, rgba(85, 0, 210, 0.08), rgba(127, 61, 242, 0.14));
}

.credits-mobile__top {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* =========================
   Typography
   ========================= */
h1,
h2,
h3,
h4,
h5 {
  margin: 0 0 0.5rem;
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

h1 {
  font-size: 1.9rem;
}

h2 {
  font-size: 1.45rem;
}

h3 {
  font-size: 1.2rem;
}

p {
  margin: 0 0 0.75rem;
  color: var(--color-text-muted);
}

.text-muted {
  color: var(--color-text-soft);
}

.text-danger {
  color: var(--color-danger);
}

/* =========================
   Cards & containers
   ========================= */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-subtle);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem 1.5rem;
  min-width: 0;
}

.card + .card {
  margin-top: 1rem;
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.card__title {
  font-size: 1.05rem;
  font-weight: 600;
}

/* =========================
   Buttons
   ========================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.48rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  background: #ffffff;
  color: var(--color-text);
  transition:
    background-color var(--transition-fast),
    color var(--transition-fast),
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    transform var(--transition-fast);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-primary {
  background: var(--color-primary);
  color: #ffffff;
  border-color: var(--color-primary);
  font-family: var(--font-sans);
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary-soft);
  font-family: var(--font-sans);
}

.btn-outline:hover:not(:disabled) {
  background: var(--color-primary-soft);
  border-color: var(--color-primary);
}

.btn-danger {
  background: transparent;
  color: var(--color-danger);
  border-color: var(--color-bg);
  font-family: var(--font-sans);
}

.btn-danger:hover:not(:disabled) {
  background: var(--color-danger);
  border-color: var(--color-danger);
  color: var(--color-bg)
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  border-color: transparent;
  font-family: var(--font-sans);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(26, 16, 42, 0.04);
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 999px;
}

/* The Spinning Animation */
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* The Spinner Icon */
.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-right-color: transparent; /* Creates the 3/4 circle look */
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

/* Visual feedback for disabled buttons */
.btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* =========================
   Forms
   ========================= */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.form-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text);
}

.form-hint {
  font-size: 0.8rem;
  color: var(--color-text-soft);
}

.input,
select,
textarea {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.48rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: #ffffff;
  color: var(--color-text);
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    background-color var(--transition-fast);
}

.input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px var(--color-primary-soft);
  background-color: #ffffff;
}

.input::placeholder,
textarea::placeholder {
  color: var(--color-text-soft);
}

.input--error {
  border-color: var(--color-danger);
}

.form-error {
  font-size: 0.8rem;
  color: var(--color-danger);
}

/* =========================
   Tables
   ========================= */
.table-wrapper {
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-subtle);
  overflow: hidden;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

thead {
  background: #f3f4f6;
}

th,
td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border-subtle);
}

th {
  font-weight: 600;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

tbody tr:hover {
  background: #f9fafb;
}

/* =========================
   Badges
   ========================= */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid transparent;
}

.badge-primary {
  background: var(--color-primary-soft);
  color: var(--color-primary-dark);
  border-color: rgba(85, 0, 210, 0.25);
}

.badge-outline {
  background: transparent;
  color: var(--color-text-muted);
  border-color: var(--color-border);
}

.badge-success {
  background: #ecfdf5;
  color: #047857;
  border-color: #bbf7d0;
}

.badge-danger {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

/* =========================
   Utility classes
   ========================= */
.stack-sm > * + * {
  margin-top: 0.5rem;
}

.stack-md > * + * {
  margin-top: 0.75rem;
}

.stack-lg > * + * {
  margin-top: 1.25rem;
}

.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gap-sm {
  gap: 0.5rem;
}

.gap-md {
  gap: 0.75rem;
}

.mt-sm {
  margin-top: 0.5rem;
}

.mt-md {
  margin-top: 1rem;
}

.mt-lg {
  margin-top: 1.5rem;
}

/* Sidebar layout */
.app-header {
    display: flex;
    height: 80px;
    overflow: visible;
}

.layout {
    display: flex;
    height: calc(100vh - 80px);     /* fixed height so internal scrolling works */
    overflow: hidden;  /* prevents page scroll */
}

.sidebar {
    width: 240px;
    background: #ffffff;
    border-right: 1px solid var(--color-border-subtle);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.sidebar button {
    width: 100%;
    text-align: left;
    font-family: var(--font-sans);
}

.content-area {
    flex: 1;
    overflow-y: auto;   /* internal scrolling */
    padding: 2rem;      /* desktop padding */
}


/* Hide inactive pages */
.page {
    display: none;
}

.page.active {
    display: block;
}

#sn.page.active {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 190px);
}

/* =========================
   Dashboard
   ========================= */

.dashboard-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.9fr);
    gap: 1rem;
    align-items: start;
}

.dashboard-grid > .card + .card {
    margin-top: 0;
}

.dashboard-card {
    height: 100%;
}

.dashboard-card--feature {
    background:
      radial-gradient(circle at top right, rgba(127, 61, 242, 0.12), transparent 38%),
      linear-gradient(180deg, rgba(239, 230, 255, 0.7), #ffffff 65%);
    border-color: rgba(85, 0, 210, 0.16);
}

.dashboard-card__intro {
    margin-bottom: 1rem;
}

.dashboard-card__intro h2 {
    margin-top: 0.65rem;
}

.dashboard-preview {
    margin-bottom: 1rem;
    color: var(--color-text-muted);
    line-height: 1.7;
}

.dashboard-link-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: auto;
}

.dashboard-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

.dashboard-summary-tile {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border-subtle);
    background: #ffffff;
}

.dashboard-summary-tile strong {
    font-size: 1.35rem;
}

.dashboard-summary-tile span {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.dashboard-summary-tile--accent {
    background: linear-gradient(180deg, rgba(85, 0, 210, 0.1), rgba(239, 230, 255, 0.75));
    border-color: rgba(85, 0, 210, 0.16);
}

.dashboard-task-list {
    display: grid;
    gap: 0.75rem;
}

.dashboard-task-row {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border-subtle);
    background: var(--color-bg);
}

.dashboard-task-row strong {
    display: block;
    margin-bottom: 0.45rem;
}

.dashboard-task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    color: var(--color-text-soft);
    font-size: 0.86rem;
}

.subject-card,
.task-record {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.subject-card__body,
.task-record__body {
    min-width: 0;
    flex: 1;
}

.subject-card__body strong,
.task-record__body strong {
    display: block;
}

.subject-card__meta,
.task-record__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    margin-top: 0.3rem;
    color: var(--color-text-muted);
    font-size: 0.92rem;
}

.task-record.is-complete {
    opacity: 0.68;
    background: var(--color-bg);
}

.task-record.is-complete .task-record__body {
    text-decoration: line-through;
}

.task-record__leading {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-width: 0;
    flex: 1;
}

.task-toggle {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--color-primary);
    flex: 0 0 auto;
}

.record-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-left: auto;
}

/* =========================
   Hamburger button
   ========================= */
.hamburger {
  display: none;
  background: none;
  border: none;
  font-size: 1.8rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
}

/* =========================
   Mobile slide-out menu
   ========================= */
.mobile-menu {
  position: fixed;
  top: 0;
  left: -260px;
  width: 260px;
  height: 100vh;
  background: #ffffff;
  border-right: 1px solid var(--color-border-subtle);
  box-shadow: var(--shadow-md);
  transition: left 0.25s ease;
  z-index: 9999;
  padding: 1rem;
}

.mobile-menu.open {
  left: 0;
}

.mobile-menu-inner {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.mobile-menu-section button,
.mobile-menu-section a {
  width: 100%;
}

.mobile-user {
  margin: 0;
  font-size: 0.95rem;
  color: var(--color-text-muted);
}

/* Close button inside mobile menu */
.close-menu {
  background: none;
  border: none;
  font-size: 1.6rem;
  cursor: pointer;
  align-self: flex-end;
  margin-bottom: 0.5rem;
}

/* Brand inside mobile menu */
.mobile-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

/* =========================
   Mobile behaviour
   ========================= */
@media (max-width: 768px) {

    /* Hide full header */
    .app-header {
        display: none;
    }

    /* Floating hamburger */
    .hamburger {
        display: block;
        position: fixed;
        top: 0.75rem;
        left: 0.75rem;
        z-index: 10000;
        background: #ffffff;
        border: 1px solid var(--color-border-subtle);
        border-radius: 6px;
        padding: 0.4rem 0.6rem;
        box-shadow: var(--shadow-sm);
    }

    /* Sidebar hidden */
    .sidebar {
        display: none;
    }

    /* Layout stays fixed height */
    .layout {
        flex-direction: column;
        height: 100vh;
        overflow: hidden;   /* prevents page scroll */
    }

    /* Content scrolls internally */
    .content-area {
        padding: 80px 1rem 1rem 1rem;   /* space for hamburger */
        height: calc(100vh - 80px);     /* fits exactly under hamburger */
        overflow-y: auto;               /* internal scrolling */
    }

    /* Flash messages also move down */
    .flash-container {
        margin-top: 80px;
    }
}

.account-wrapper {
    max-width: 480px;
    margin: 0 auto;
}

.switcher {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.switch {
    flex: 1;
    padding: 0.75rem;
    border: none;
    background: var(--color-bg);
    cursor: pointer;
    font-size: 1rem;
    font-family: var(--font-sans);
}

.switch.active {
    background: var(--color-primary);
    color: var(--color-bg);
}

.slider-container {
    overflow: hidden;
    width: 100%;
}

.slider {
    display: flex;
    width: 200%; /* two panels */
    transition: transform 0.4s ease;
}

.panel {
    width: 50%;
    padding: 1rem;
    box-sizing: border-box;
}

.notes-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.notes-board-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    justify-content: flex-end;
}

.notes-board-pill {
    border: 1px solid var(--color-border);
    background: #ffffff;
    color: var(--color-text-muted);
    border-radius: 999px;
    padding: 0.5rem 0.9rem;
    font: inherit;
    cursor: pointer;
    transition:
      background-color var(--transition-fast),
      border-color var(--transition-fast),
      color var(--transition-fast),
      transform var(--transition-fast);
}

.notes-board-pill:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.notes-board-pill.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #ffffff;
    transform: translateY(-1px);
}

.docs-shell {
    display: grid;
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
    gap: 1rem;
    min-height: calc(100vh - 270px);
    flex: 1;
}

.docs-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border-subtle);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.docs-panel__heading {
    padding: 1.1rem 1.1rem 0.8rem;
    border-bottom: 1px solid var(--color-border-subtle);
}

.docs-toolbar {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border-subtle);
}

.docs-content {
    flex: 1;
    min-height: 0;
}

.docs-tree {
    display: grid;
    gap: 0.5rem;
    padding: 1rem;
    overflow-y: auto;
}

.docs-item {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.85rem 0.9rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    text-align: left;
    color: var(--color-text);
    font: inherit;
}

.docs-item:hover {
    background: var(--color-primary-soft);
    border-color: rgba(85, 0, 210, 0.14);
}

.docs-item.is-active {
    background: linear-gradient(180deg, rgba(239, 230, 255, 0.95), rgba(255, 255, 255, 0.95));
    border-color: rgba(85, 0, 210, 0.18);
}

.docs-item__icon {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-soft);
}

.docs-item.folder .docs-item__label {
    font-weight: 600;
}

.docs-item__label {
    font-size: 0.98rem;
}

.docs-back {
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: #ffffff;
    color: var(--color-text);
    cursor: pointer;
    font: inherit;
}

.docs-back.is-disabled,
.docs-back:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.docs-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.92rem;
    min-width: 0;
}

.docs-breadcrumb__sep {
    color: var(--color-text-soft);
}

.crumb {
    border: none;
    background: none;
    color: var(--color-primary);
    padding: 0;
    cursor: pointer;
    font: inherit;
}

.crumb:hover {
    text-decoration: underline;
}

#docs-viewer {
    flex: 1;
    overflow-y: auto;
    padding: 1.35rem 1.4rem 1.5rem;
    color: var(--color-text);
    line-height: 1.8;
}

#docs-viewer h1,
#docs-viewer h2,
#docs-viewer h3 {
    margin-top: 0;
}

#docs-viewer p,
#docs-viewer li {
    color: var(--color-text);
}

#docs-viewer pre,
#docs-viewer code {
    font-family: "Cascadia Code", Consolas, monospace;
}

#docs-viewer pre {
    padding: 1rem;
    overflow-x: auto;
    border-radius: var(--radius-md);
    background: #f3f1fa;
}

#docs-viewer blockquote {
    margin: 1rem 0;
    padding-left: 1rem;
    border-left: 3px solid var(--color-primary-soft);
    color: var(--color-text-muted);
}

/* =========================
   Enhanced Timetable UI
   ========================= */

.calendar {
    display: grid;
    /* This creates 7 exactly equal columns */
    grid-template-columns: repeat(7, 1fr); 
    gap: 12px;
    margin-top: 20px;
    align-items: stretch;
}

.day {
    background: #ffffff;
    padding: 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: var(--shadow-sm);
    font-family: var(--font-sans);
}

.day h4 {
    text-align: center;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text);
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 2px solid var(--color-bg);
}

.slot {
    padding: 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    transition: all 0.2s ease;
    color: var(--color-text); /* Contrast for subject colors */
    font-family: var(--font-sans);
}

.slot:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.slot .time {
    font-weight: 600;
    font-size: 0.7rem;
    opacity: 0.9;
    margin-bottom: 2px;
}

.slot .subject {
    font-weight: 500;
    line-height: 1.2;
}

.slot.empty {
    background: var(--color-bg) !important;
    color: var(--color-text-soft);
    text-shadow: none;
    border: 1px dashed var(--color-border);
    justify-content: center;
    align-items: center;
    text-align: center;
    font-style: italic;
    opacity: 0.7;
    cursor: default;
}

.slot.empty:hover {
    transform: none;
    filter: none;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .calendar {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

@media (max-width: 1080px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-summary-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .notes-page-header {
        flex-direction: column;
    }

    .notes-board-filter {
        justify-content: flex-start;
    }

    .docs-shell {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .docs-panel--tree {
        max-height: 260px;
    }
}

@media (max-width: 640px) {
    #sn.page.active {
        min-height: auto;
    }

    .dashboard-hero {
        flex-direction: column;
        align-items: stretch;
    }

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

    .docs-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    #docs-viewer {
        padding: 1rem;
    }
}

/* =========================
   CRQ Layout Utilities
   ========================= */

/* Enforce Inter font on all form elements in the CRQ section */
#crq input, 
#crq select, 
#crq textarea {
    font-family: "Inter", system-ui, -apple-system, sans-serif;
}

/* Grid layouts for the mapped form design */
.crq-grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}

.crq-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
    align-items: center;
}

.crq-grid-1 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.analytics-summary-grid .card + .card,
.analytics-pagination .card + .card {
    margin-top: 0;
}

.analytics-summary-card {
    min-width: 0;
    height: 100%;
}

.analytics-summary-card--primary {
    background: linear-gradient(180deg, rgba(85, 0, 210, 0.08), rgba(239, 230, 255, 0.75));
    border-color: rgba(85, 0, 210, 0.18);
}

.analytics-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Better styling for MCQ option rows */
.mcq-option-row {
    display: flex;
    gap: 12px;
    align-items: center;
    background-color: var(--color-bg);
    padding: 10px 15px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border-subtle);
    transition: all 0.2s ease;
}

.mcq-option-row:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-soft);
}

.mcq-option-row input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
    cursor: pointer;
}

.mcq-optional-label {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-left: auto;
}
