@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600;700&family=Nunito:wght@400;600;700;800&display=swap');

/* ══════════════════════════════════════════
   DESIGN TOKENS
══════════════════════════════════════════ */
:root {
  color-scheme: light;

  /* Surfaces */
  --bg:          #F1F5F9;
  --surface:     #FFFFFF;
  --surface-2:   #F8FAFC;
  --surface-3:   #F1F5F9;

  /* Sidebar */
  --sidebar-bg:     #0B1E3A;
  --sidebar-ring:   rgba(255,255,255,0.06);
  --nav-text:       #94A3B8;
  --nav-hover-text: #CBD5E1;
  --nav-hover-bg:   rgba(255,255,255,0.06);
  --nav-active-text:#FFFFFF;
  --nav-active-bg:  rgba(127,29,63,0.28);
  --nav-active-bar: #5A102D;

  /* Text */
  --text:    #0F172A;
  --text-2:  #1E293B;
  --muted:   #64748B;
  --faint:   #94A3B8;

  /* Borders */
  --border:   #E2E8F0;
  --border-2: #CBD5E1;

  /* Primary — Navy/Wine */
  --primary:        #0B1E3A;
  --primary-dark:   #08152C;
  --primary-light:  #EAF0FF;
  --primary-border: #B8C8E8;
  --primary-ring:   rgba(11,30,58,0.24);

  /* Status */
  --green:        #16A34A;
  --green-bg:     #F0FDF4;
  --green-border: #BBF7D0;
  --amber:        #5A102D;
  --amber-bg:     #F9E3EC;
  --amber-border: #EAB3C7;
  --red:          #DC2626;
  --red-bg:       #FEF2F2;
  --red-border:   #FECACA;
  --blue:         #2563EB;
  --blue-bg:      #EFF6FF;
  --blue-border:  #BFDBFE;
  --purple:       #7C3AED;
  --purple-bg:    #F5F3FF;
  --purple-border:#DDD6FE;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(15,23,42,0.05);
  --shadow-sm: 0 1px 3px rgba(15,23,42,0.06), 0 4px 12px rgba(15,23,42,0.04);
  --shadow-md: 0 4px 20px rgba(15,23,42,0.08), 0 1px 3px rgba(15,23,42,0.06);
  --shadow-lg: 0 12px 48px rgba(15,23,42,0.12), 0 4px 16px rgba(15,23,42,0.06);

  /* Radii */
  --r-sm:  6px;
  --r:     10px;
  --r-lg:  14px;
  --r-xl:  20px;
  --r-2xl: 28px;

  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "cv02","cv03","cv04","cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ══════════════════════════════════════════
   RESET
══════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }
[hidden] { display: none !important; }

/* ══════════════════════════════════════════
   BODY — PORTAL LAYOUT
══════════════════════════════════════════ */
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
}

body.settings-focus {
  grid-template-columns: minmax(0, 1fr);
}

body.settings-focus .sidebar {
  display: none;
}

.login-body { display: block; }

/* ══════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════ */
.sidebar {
  background: var(--sidebar-bg);
  color: var(--nav-text);
  min-height: 100vh;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  padding: 20px 12px 24px;
  gap: 6px;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 20px;
  border-bottom: 1px solid var(--sidebar-ring);
  margin-bottom: 8px;
  flex-shrink: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, #818CF8, #6366F1);
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 900;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(99,102,241,0.45);
}

.brand strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: #F1F5F9;
  letter-spacing: -0.01em;
}

.brand small {
  display: block;
  font-size: 11px;
  color: var(--nav-text);
  margin-top: 1px;
  font-weight: 400;
}

/* Nav */
.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  color: var(--nav-text);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 140ms ease, color 140ms ease;
  position: relative;
  border: 1px solid transparent;
}

.nav a svg { flex-shrink: 0; opacity: 0.8; }

.nav a:hover {
  background: var(--nav-hover-bg);
  color: var(--nav-hover-text);
}
.nav a:hover svg { opacity: 1; }

.nav a.active {
  background: var(--nav-active-bg);
  color: var(--nav-active-text);
  font-weight: 600;
}
.nav a.active svg { opacity: 1; }
.nav a.active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--nav-active-bar);
}

/* Sidebar divider */
.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #475569;
  padding: 14px 10px 6px;
}

/* Sidebar bottom area */
.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--sidebar-ring);
}

/* ══════════════════════════════════════════
   APP SHELL & TOPBAR
══════════════════════════════════════════ */
.app-shell {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  flex-shrink: 0;
}

.eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
  margin: 0 0 2px;
}

h1 {
  font-size: clamp(1.25rem, 2.5vw, 1.6rem);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.03em;
}

h2 { font-size: 1rem; font-weight: 600; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════
   CONTENT WRAPPER
══════════════════════════════════════════ */
.content-area {
  padding: 28px 32px 48px;
  flex: 1;
}

/* Views */
.view { display: none; }
.view.active { display: block; }

/* ══════════════════════════════════════════
   STATUS PILLS & BADGES
══════════════════════════════════════════ */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  height: 32px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: var(--shadow-xs);
  white-space: nowrap;
}

#user-status {
  color: var(--primary);
  border-color: var(--primary-border);
  background: var(--primary-light);
  font-weight: 600;
}

.status-pill.live {
  color: var(--green);
  border-color: var(--green-border);
  background: var(--green-bg);
}
.status-pill.mock {
  color: var(--amber);
  border-color: var(--amber-border);
  background: var(--amber-bg);
}

/* ══════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════ */
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  background: var(--primary);
  color: #fff;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  box-shadow: 0 1px 3px rgba(99,102,241,0.3), 0 4px 10px rgba(99,102,241,0.15);
  transition: background 140ms ease, transform 130ms ease, box-shadow 140ms ease;
  white-space: nowrap;
  cursor: pointer;
}
.primary-button:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(99,102,241,0.35), 0 6px 16px rgba(99,102,241,0.2);
}
.primary-button:active { transform: translateY(0); }

.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  background: var(--surface);
  color: var(--text-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-xs);
  transition: background 140ms, border-color 140ms, color 140ms;
  cursor: pointer;
  white-space: nowrap;
}
.ghost-button:hover { background: var(--surface-2); border-color: var(--border-2); color: var(--text); }

.text-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  padding: 0 10px;
  background: none;
  color: var(--primary);
  border: none;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 600;
  transition: background 140ms;
  cursor: pointer;
}
.text-button:hover { background: var(--primary-light); }

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 1.1rem;
  box-shadow: var(--shadow-xs);
  transition: background 140ms, border-color 140ms, color 140ms;
  cursor: pointer;
}
.icon-button:hover { background: var(--surface-2); color: var(--text); }

/* ══════════════════════════════════════════
   SETUP ALERT
══════════════════════════════════════════ */
.setup-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  border-left: 4px solid var(--amber);
  border-radius: var(--r);
  padding: 14px 18px;
  margin-bottom: 24px;
}
.setup-alert[hidden] { display: none; }
.setup-alert p, .config-callout p {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
  margin-top: 4px;
}

.app-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding: 12px 14px;
  color: #244f3f;
  background: #e7f8f1;
  border: 1px solid #a8e2cd;
  border-radius: var(--r);
  box-shadow: var(--shadow-xs);
  font-size: 13.5px;
  font-weight: 700;
}
.app-notice[hidden] { display: none; }
.app-notice.is-error {
  color: #9f342a;
  background: #fdecea;
  border-color: #f5b9b2;
}
.app-notice.is-warning {
  color: #80590b;
  background: var(--amber-bg);
  border-color: var(--amber-border);
}
.app-notice-icon {
  color: var(--amber);
  font-size: 16px;
  flex: 0 0 auto;
}
.app-notice > span:nth-child(2) { flex: 1; }
.app-notice button {
  border: 0;
  background: transparent;
  color: currentColor;
  padding: 2px 6px;
  border-radius: 7px;
  font: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.app-notice button:hover { background: rgba(16, 26, 60, .08); }

/* ══════════════════════════════════════════
   METRICS GRID
══════════════════════════════════════════ */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px 20px 18px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: box-shadow 200ms ease, transform 200ms ease;
}
.metric:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.metric::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.metric:nth-child(1)::after { background: linear-gradient(90deg, var(--blue), #60A5FA); }
.metric:nth-child(2)::after { background: linear-gradient(90deg, var(--amber), #FCD34D); }
.metric:nth-child(3)::after { background: linear-gradient(90deg, var(--purple), #A78BFA); }
.metric:nth-child(4)::after { background: linear-gradient(90deg, var(--green), #4ADE80); }

.metric span {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 2.2rem;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
}

/* ══════════════════════════════════════════
   SECTION BAND
══════════════════════════════════════════ */
.section-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

/* ══════════════════════════════════════════
   PANEL / CARD
══════════════════════════════════════════ */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.action-panel {
  background: var(--surface-2);
  box-shadow: none;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.action-row { margin-bottom: 16px; }

/* ══════════════════════════════════════════
   STACK LIST ITEMS
══════════════════════════════════════════ */
.stack-list { display: grid; gap: 8px; }

.item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--r);
  padding: 12px 14px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow 150ms, transform 150ms;
}
.item:hover { box-shadow: var(--shadow-sm); transform: translateX(2px); }

.item[data-todo-draggable="1"],
.calendar-chip[draggable="true"] { cursor: grab; }
.item.is-dragging,
.calendar-chip.is-dragging { opacity: 0.5; cursor: grabbing; }

.item.lesson    { border-left-color: var(--blue); }
.item.reminder  { border-left-color: var(--amber); }
.item.cancelled { border-left-color: var(--faint); opacity: 0.65; }

.item h3 {
  font-size: 13.5px;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--text-2);
}
.item p {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
}

.item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.mini-button {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--border-2);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--primary);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 140ms, border-color 140ms;
}
.mini-button:hover { background: var(--primary-light); border-color: var(--primary-border); }
.mini-button-dev {
  background: #fff9e6;
  border-color: #e6d59a;
  color: #8a6d1f;
}
.mini-button-dev:hover {
  background: #fff4cc;
  border-color: #d8be73;
}
.mini-button:disabled {
  opacity: 0.5;
  color: var(--faint);
  border-color: var(--border);
  background: var(--surface-3);
  cursor: not-allowed;
}
.mini-button-dev:disabled {
  opacity: 0.75;
  background: #fff9e6;
  border-color: #e6d59a;
  color: #b19a56;
}

.status-btn-active {
  background: var(--primary-light);
  border-color: var(--primary-border);
  color: var(--primary-dark);
}

.recruit-status-btn {
  transition: transform 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
}

.recruit-status-invited {
  border-color: #fca5a5;
  color: #991b1b;
  background: #fff1f2;
}

.recruit-status-interviewed {
  border-color: #facc15;
  color: #111827;
  background: #fef9c3;
}

.recruit-status-selected {
  border-color: #c4b5fd;
  color: #5b21b6;
  background: #f5f3ff;
}

.recruit-status-btn.status-btn-active {
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.18);
  transform: translateY(-1px);
}

.recruit-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.recruit-tag-filter {
  display: inline-flex;
  gap: 6px;
}

.recruit-tag-filter .mini-button.active {
  background: var(--primary-light);
  border-color: var(--primary-border);
}

.recruit-track-stem {
  border-color: var(--blue-border);
  color: var(--blue);
  background: var(--blue-bg);
}

.recruit-track-tutor {
  border-color: var(--amber-border);
  color: var(--amber);
  background: var(--amber-bg);
}

.recruit-track-intern {
  border-color: #bbf7d0;
  color: #15803d;
  background: #f0fdf4;
}

.recruit-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
}

.recruit-chip.stem {
  color: var(--blue);
  border-color: var(--blue-border);
  background: var(--blue-bg);
}

.recruit-chip.tutor {
  color: var(--amber);
  border-color: var(--amber-border);
  background: var(--amber-bg);
}

.recruit-chip.intern {
  color: #15803d;
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.recruit-ai-dashboard {
  overflow: hidden;
  border-color: color-mix(in srgb, var(--primary) 32%, var(--border));
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--primary-light) 65%, transparent), transparent 34%),
    var(--surface);
}

.recruit-ai-heading {
  align-items: flex-start;
}

.recruit-ai-heading h2 {
  margin-top: 2px;
  font-size: 20px;
}

.recruit-ai-heading .helper-text {
  margin-top: 5px;
}

.recruit-ai-count {
  flex: 0 0 auto;
  border: 1px solid var(--primary-border);
  border-radius: 999px;
  padding: 6px 11px;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
}

.recruit-ai-controls {
  padding: 16px 0 4px;
}

.recruit-ai-controls > label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 700;
}

.recruit-ai-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.recruit-ai-input-row input {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 11px 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.recruit-ai-input-row input:focus {
  outline: 3px solid color-mix(in srgb, var(--primary) 18%, transparent);
  border-color: var(--primary);
}

.recruit-ai-progress {
  margin-top: 12px;
}

.recruit-ai-progress-copy {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  font-size: 12px;
}

.recruit-ai-progress-track {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-3);
}

.recruit-ai-progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), #8b5cf6);
  transition: width 180ms ease;
}

.recruit-ai-success,
.recruit-ai-warning {
  border-radius: var(--r-sm);
  padding: 9px 11px;
  font-size: 12px;
}

.recruit-ai-success { color: #166534; background: #f0fdf4; }
.recruit-ai-warning { color: #92400e; background: #fffbeb; }

.recruit-ai-results {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.recruit-ai-empty {
  border: 1px dashed var(--border);
  border-radius: var(--r-sm);
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.recruit-ai-result {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
}

.recruit-ai-result > summary {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  cursor: pointer;
  list-style: none;
}

.recruit-ai-result > summary::-webkit-details-marker { display: none; }

.recruit-ai-rank {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.recruit-ai-result-main {
  min-width: 0;
}

.recruit-ai-result-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.recruit-ai-result-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recruit-ai-result-meta {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.recruit-ai-score {
  min-width: 105px;
  text-align: right;
}

.recruit-ai-score strong {
  display: block;
  color: var(--primary-dark);
  font-size: 20px;
}

.recruit-ai-score small {
  color: var(--muted);
  font-size: 10.5px;
}

.recruit-ai-result-body {
  padding: 0 12px 12px 58px;
}

.recruit-ai-result-body > p {
  color: var(--muted);
  font-size: 13px;
}

.recruit-ai-result-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

article.recruit-ai-result {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
}

.recruit-ai-result-pending { border-color: #fde68a; background: #fffbeb; }
.recruit-ai-result-failed { border-color: #fecaca; background: #fff1f2; }

.ai-screening {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}

.ai-screening-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.ai-screening-heading span {
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--surface);
  font-size: 11.5px;
  font-weight: 700;
}

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

.ai-screening ul {
  margin: 5px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.ai-screening small {
  display: block;
  margin-top: 10px;
  color: var(--faint);
}

.ai-keyword-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.ai-keyword-controls input {
  min-width: 0;
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  background: var(--surface);
  color: var(--text);
}

.ai-keyword-controls input:focus {
  outline: 2px solid color-mix(in srgb, var(--primary) 22%, transparent);
  border-color: var(--primary);
}

.ai-keyword-summary {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.ai-keyword-results {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.ai-keyword-result {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
}

.ai-keyword-result > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ai-keyword-result span {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 700;
}

.ai-keyword-result p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.ai-keyword-matched span { color: #166534; background: #dcfce7; }
.ai-keyword-partial span { color: #92400e; background: #fef3c7; }
.ai-keyword-not_found span { color: #991b1b; background: #fee2e2; }

.ai-screening-strong_match { border-color: #86efac; background: #f0fdf4; }
.ai-screening-review, .ai-screening-pending { border-color: #fde68a; background: #fffbeb; }
.ai-screening-not_a_match, .ai-screening-failed { border-color: #fecaca; background: #fff1f2; }

@media (max-width: 760px) {
  .ai-screening-grid { grid-template-columns: 1fr; }
  .ai-keyword-controls { align-items: stretch; flex-direction: column; }
  .recruit-ai-heading { gap: 10px; }
  .recruit-ai-count { align-self: flex-start; }
  .recruit-ai-input-row { grid-template-columns: 1fr; }
  .recruit-ai-result > summary { grid-template-columns: 30px minmax(0, 1fr); }
  .recruit-ai-score { grid-column: 2; text-align: left; }
  .recruit-ai-result-body { padding-left: 12px; }
}

/* ══════════════════════════════════════════
   FORMS
══════════════════════════════════════════ */
.quick-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.record-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.record-form input,
.record-form select,
.quick-form input,
.quick-form select {
  height: 36px;
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  padding: 0 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  min-width: 0;
  transition: border-color 150ms, box-shadow 150ms;
}

.record-form input:focus,
.record-form select:focus,
.quick-form input:focus,
.quick-form select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.record-form .primary-button { width: 100%; }

.helper-text {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
  margin: 10px 0 0;
}

/* ══════════════════════════════════════════
   CALENDAR
══════════════════════════════════════════ */
.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 10px 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-xs);
}

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

.calendar-weekdays {
  margin-bottom: 8px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.calendar-weekdays span { padding: 0 6px; }

.day {
  min-height: 120px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 8px;
  display: grid;
  align-content: start;
  gap: 4px;
  transition: border-color 140ms, background 140ms;
}
.day:hover { border-color: var(--border-2); }

.day.selected-day {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: inset 0 0 0 1px var(--primary-ring), 0 7px 18px rgba(91,124,250,.12);
}

.day.selected-day .day-number {
  color: #FFFFFF;
  background: var(--primary);
}

.day.outside {
  background: var(--bg);
  border-color: transparent;
}
.day.outside.selected-day {
  border-color: var(--primary);
  background: var(--primary-light);
}
.day.outside .day-number { color: var(--faint); }

.day-number {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
}

.calendar-chip {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 4px;
  padding: 3px 7px;
  background: var(--purple-bg);
  color: var(--purple);
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid var(--purple-border);
}
.calendar-chip.reminder {
  background: var(--amber-bg);
  color: var(--amber);
  border-color: var(--amber-border);
}
.calendar-chip.cancelled {
  background: var(--surface-2);
  color: var(--faint);
  border-color: var(--border);
  text-decoration: line-through;
}

.day.drop-target {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: inset 0 0 0 1px var(--primary-ring);
}

/* ══════════════════════════════════════════
   TODO BOARD
══════════════════════════════════════════ */
.todo-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.todo-column {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px;
  min-height: 240px;
  transition: border-color 140ms, background 140ms;
}

.todo-column h3 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.todo-column.drop-target {
  border-color: var(--primary);
  background: var(--primary-light);
}

/* ══════════════════════════════════════════
   SETTINGS
══════════════════════════════════════════ */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.config-callout {
  border: 1px solid var(--amber-border);
  border-radius: var(--r);
  background: var(--amber-bg);
  margin-bottom: 16px;
  padding: 14px 16px;
}
.config-callout.success {
  border-color: var(--primary-border);
  background: var(--primary-light);
}
.config-callout h3 { font-size: 14px; font-weight: 700; color: var(--text-2); }

.settings-grid div {
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px;
  background: var(--surface);
}
.settings-grid strong { display: block; font-size: 14px; font-weight: 600; margin-top: 5px; }
.settings-grid span   { display: block; font-size: 12.5px; color: var(--muted); }

/* ══════════════════════════════════════════
   STUDENTS MANAGER
══════════════════════════════════════════ */
.students-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.students-toolbar input,
.students-toolbar select {
  height: 36px;
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  padding: 0 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  min-width: 0;
}

.students-toolbar input:focus,
.students-toolbar select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.students-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.metric-mini {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px;
  box-shadow: var(--shadow-xs);
}

.metric-mini span {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.metric-mini strong {
  display: block;
  margin-top: 6px;
  font-size: 1.4rem;
  line-height: 1;
  font-weight: 800;
  color: var(--text);
}

/* ══════════════════════════════════════════
   LOGIN PAGE
══════════════════════════════════════════ */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--bg);
  padding: 24px;
  background-image:
    radial-gradient(circle at 20% 50%, rgba(90,16,45,0.11) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(11,30,58,0.08) 0%, transparent 40%);
}

.login-layout {
  width: min(960px, 100%);
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-radius: var(--r-2xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

/* Left panel — dark */
.login-aside {
  background: var(--sidebar-bg);
  padding: 52px 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

/* Subtle grid pattern */
.login-aside::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

/* Glow blob */
.login-aside::after {
  content: "";
  position: absolute;
  top: -80px;
  right: -80px;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(90,16,45,0.3) 0%, transparent 70%);
  pointer-events: none;
}

.login-aside-top { position: relative; z-index: 1; }

.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 40px;
}

.login-logo-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #5A102D, #7A143E);
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 900;
  color: #fff;
  box-shadow: 0 4px 14px rgba(90,16,45,0.45);
}

.login-logo-text strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: #F1F5F9;
  letter-spacing: -0.01em;
}
.login-logo-text span {
  display: block;
  font-size: 12px;
  color: #64748B;
  margin-top: 1px;
}

.login-aside h1 {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  color: #F8FAFC;
  margin-bottom: 14px;
}

.login-copy {
  font-size: 14px;
  color: #94A3B8;
  line-height: 1.65;
}

.login-points {
  list-style: none;
  padding: 0;
  margin: 28px 0 0;
  display: grid;
  gap: 10px;
}

.login-points li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13.5px;
  color: #94A3B8;
  line-height: 1.5;
}

.login-points li::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #7A143E;
  flex-shrink: 0;
  margin-top: 7px;
}

.login-aside-bottom {
  position: relative;
  z-index: 1;
  font-size: 12px;
  color: #475569;
}

/* Right panel — white form */
.login-card {
  background: var(--surface);
  padding: 52px 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-card .eyebrow { margin-bottom: 6px; }

.login-card h2 {
  font-size: clamp(1.4rem, 2.5vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
  margin-bottom: 6px;
}

.login-form {
  display: grid;
  gap: 16px;
  margin-top: 28px;
}

.login-form label {
  display: grid;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.login-form input {
  height: 44px;
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  padding: 0 14px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 14.5px;
  transition: border-color 150ms, box-shadow 150ms, background 150ms;
}
.login-form input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.login-error {
  font-size: 13px;
  color: var(--red);
  font-weight: 500;
}

.login-form .primary-button {
  height: 44px;
  font-size: 14.5px;
  font-weight: 700;
  border-radius: var(--r);
  box-shadow: 0 2px 8px rgba(90,16,45,0.3), 0 8px 20px rgba(90,16,45,0.15);
}

.report-link {
  display: inline-block;
  margin-top: 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
}
.report-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ══════════════════════════════════════════
   RESPONSIVE — TABLET
══════════════════════════════════════════ */
@media (max-width: 1024px) {
  body { grid-template-columns: 1fr; }

  .sidebar {
    min-height: auto;
    height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    padding: 0 16px;
    height: 54px;
    gap: 0;
    overflow-x: auto;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }

  .brand {
    padding: 0 16px 0 0;
    border-bottom: none;
    border-right: 1px solid var(--sidebar-ring);
    margin-bottom: 0;
    margin-right: 8px;
    flex-shrink: 0;
    height: 100%;
    align-items: center;
  }

  .nav {
    flex-direction: row;
    gap: 2px;
    overflow-x: auto;
    flex: 1;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }

  .nav a::before { display: none; }

  .nav-section-label,
  .sidebar-footer,
  .brand small { display: none; }

  .topbar { height: 56px; padding: 0 18px; }

  .content-area { padding: 20px 18px 40px; }

  .metrics-grid,
  .split-layout,
  .todo-board,
  .record-form,
  .settings-grid { grid-template-columns: 1fr; }

  .students-toolbar { grid-template-columns: 1fr; }
  .students-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body .fee-calculator-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .calendar-grid { gap: 4px; }
  .day { min-height: 80px; padding: 6px; }

  .login-layout { grid-template-columns: 1fr; }
  .login-aside {
    padding: 36px 32px;
    display: block;
  }
  .login-aside::after { display: none; }
  .login-aside h1 { font-size: 1.5rem; }
  .login-points { display: none; }
  .login-aside-bottom { display: none; }
  .login-card { padding: 36px 32px; }
}

/* ══════════════════════════════════════════
   RESPONSIVE — MOBILE
══════════════════════════════════════════ */
@media (max-width: 640px) {
  .topbar { flex-direction: column; height: auto; padding: 12px 16px; gap: 10px; align-items: flex-start; }
  .topbar-actions { flex-wrap: wrap; }
  .section-band { flex-direction: column; align-items: flex-start; }
  .setup-alert { flex-direction: column; align-items: flex-start; }
  .quick-form { display: grid; grid-template-columns: 1fr; width: 100%; }
  .students-metrics { grid-template-columns: 1fr; }
  body .fee-calculator-form { grid-template-columns: 1fr; }
  body .selected-lesson-dates,
  body .fee-result-card { align-items: flex-start; flex-direction: column; }
  body .fee-result-total { text-align: left; }
  .login-shell { padding: 16px; }
  .login-aside, .login-card { padding: 28px 24px; }
}

/* ══════════════════════════════════════════
   FULL PORTAL — STARRY THEME
   Visual layer only. Existing DOM hooks and backend behaviours stay intact.
══════════════════════════════════════════ */
body {
  --bg: #F5F7FC;
  --surface: #FFFFFF;
  --surface-2: #FBFCFE;
  --surface-3: #F1F3F9;
  --text: #232B4A;
  --text-2: #232B4A;
  --muted: #68708F;
  --faint: #9BA2BC;
  --border: #E3E7F2;
  --border-2: #D5DAE8;
  --primary: #0B1E3A;
  --primary-dark: #08152C;
  --primary-light: #EAF0FF;
  --primary-border: #B8C8E8;
  --primary-ring: rgba(11,30,58,.24);
  --amber: #5A102D;
  --amber-bg: #F9E3EC;
  --amber-border: #EAB3C7;
  --green: #2FB98A;
  --green-bg: #E7F8F1;
  --green-border: #B8EBD9;
  --purple: #7B4FC2;
  --purple-bg: #F3EDFC;
  --purple-border: #DFD1F5;
  --shadow-sm: 0 10px 30px rgba(16,26,60,.08);
  --shadow-md: 0 14px 34px rgba(16,26,60,.12);
  display: grid;
  grid-template-columns: 1fr;
  font-family: "Nunito", ui-sans-serif, system-ui, sans-serif;
  background:
    radial-gradient(900px 420px at 92% 8%, rgba(90,16,45,.14), transparent 65%),
    var(--bg);
}

body h1,
body h2,
body h3,
body .brand strong {
  font-family: "Fredoka", "Nunito", sans-serif;
}

body .brand strong span { color: #EAB3C7; }

body .sidebar {
  min-height: 76px;
  height: 76px;
  width: 100%;
  position: sticky;
  top: 0;
  z-index: 30;
  overflow: visible;
  flex-direction: row;
  align-items: center;
  padding: 0 max(24px, calc((100vw - 1280px) / 2));
  gap: 20px;
  background:
    radial-gradient(900px 260px at 80% -90%, #354681 0%, #101A3C 65%);
  border-bottom: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 8px 28px rgba(16,26,60,.18);
}

body .sidebar::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .45;
  background-image:
    radial-gradient(circle at 17% 27%, white 0 1px, transparent 1.6px),
    radial-gradient(circle at 43% 72%, white 0 1px, transparent 1.5px),
    radial-gradient(circle at 69% 24%, white 0 1.3px, transparent 1.8px),
    radial-gradient(circle at 86% 67%, white 0 1px, transparent 1.5px),
    radial-gradient(circle at 94% 18%, white 0 1px, transparent 1.5px);
}

body .brand {
  position: relative;
  z-index: 1;
  min-width: max-content;
  height: 100%;
  margin: 0;
  padding: 0 22px 0 0;
  border: 0;
  border-right: 1px solid rgba(255,255,255,.1);
}

body .brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: linear-gradient(135deg, #5A102D, #7A143E);
  color: #F8FAFC;
  box-shadow: 0 6px 16px rgba(90,16,45,.35);
  font-size: 0;
}

body .brand-mark::before {
  content: "";
  font-size: 23px;
}

body .brand strong {
  color: #FFFFFF;
  font-size: 18px;
  font-weight: 600;
}

body .brand small {
  color: #B9C2E4;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .65px;
  text-transform: uppercase;
}

body .nav {
  position: relative;
  z-index: 1;
  flex: 1;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

body .nav a {
  flex: 0 0 auto;
  padding: 9px 15px;
  border-radius: 999px;
  color: #C6CDEB;
  font-size: 13.5px;
  font-weight: 800;
}

body .nav a:hover {
  color: #FFFFFF;
  background: rgba(255,255,255,.1);
}

body .nav a.active {
  color: #FFD98A;
  background: rgba(246,185,59,.18);
  border-color: rgba(246,185,59,.4);
}

body .nav a.active::before { display: none; }
body .nav a svg { width: 15px; height: 15px; }

body .app-shell { min-height: calc(100vh - 76px); }

body .topbar {
  height: auto;
  min-height: 72px;
  padding: 13px max(24px, calc((100vw - 1280px) / 2));
  background: rgba(255,255,255,.86);
  backdrop-filter: blur(14px);
  border-bottom-color: var(--border);
}

body .topbar .eyebrow {
  color: var(--primary);
  font-size: 10.5px;
  letter-spacing: .1em;
}

body #page-title {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -.02em;
}

body #user-status {
  height: 36px;
  padding: 0 14px;
  color: #9A6A08;
  border-color: #F5D789;
  background: #FDF3DC;
  border-radius: 999px;
  font-weight: 800;
}

body #api-status {
  height: 36px;
  border-radius: 999px;
  font-weight: 800;
}

body #logout-button {
  height: 36px;
  border-radius: 999px;
  color: var(--muted);
}

body .content-area {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 24px 24px 64px;
}

.student-welcome { display: none; }

body .student-welcome {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 150px;
  margin-bottom: 24px;
  padding: 28px 34px;
  overflow: hidden;
  color: #FFFFFF;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 22px;
  background:
    radial-gradient(520px 210px at 82% -20%, #354681 0%, transparent 65%),
    linear-gradient(135deg, #101A3C, #1A2650);
  box-shadow: 0 18px 42px rgba(16,26,60,.16);
}

body .student-welcome::before,
body .student-welcome::after {
  content: "";
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: white;
  box-shadow: 64px 32px 0 rgba(255,255,255,.55), 138px -12px 0 rgba(255,255,255,.4), 216px 43px 0 rgba(255,255,255,.65), 292px 4px 0 rgba(255,255,255,.35);
  opacity: .7;
}

body .student-welcome::before { right: 350px; top: 30px; }
body .student-welcome::after { right: 210px; bottom: 26px; transform: scale(.7); }

body .student-welcome-copy { position: relative; z-index: 2; max-width: 670px; }

body .student-welcome-kicker {
  display: inline-block;
  margin-bottom: 8px;
  color: #FFD98A;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .7px;
  text-transform: uppercase;
}

body .student-welcome h2 {
  color: white;
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 600;
}

body .student-welcome p {
  margin-top: 5px;
  color: #B9C2E4;
  font-size: 14.5px;
  font-weight: 600;
}

body .student-welcome-orbit {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  flex: 0 0 92px;
  border: 1px solid rgba(127,29,63,.34);
  border-radius: 50%;
  box-shadow: inset 0 0 28px rgba(127,29,63,.08), 0 0 36px rgba(11,30,58,.14);
}

body .student-welcome-orbit span {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  color: #F8FAFC;
  background: linear-gradient(135deg, #7F1D3F, #9F2A52);
  border-radius: 17px;
  font-size: 27px;
  transform: rotate(5deg);
  box-shadow: 0 9px 24px rgba(127,29,63,.3);
}

body .student-welcome-orbit i {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #FFFFFF;
}
body .student-welcome-orbit i:nth-of-type(1) { left: -3px; top: 42px; }
body .student-welcome-orbit i:nth-of-type(2) { right: 9px; top: 6px; width: 5px; height: 5px; }
body .student-welcome-orbit i:nth-of-type(3) { right: 7px; bottom: 8px; width: 4px; height: 4px; }

body .section-band { margin-bottom: 16px; }
body .section-band .eyebrow { color: var(--primary); font-weight: 800; }
body .section-band h2 { font-family: "Fredoka", sans-serif; font-size: 22px !important; font-weight: 600 !important; }

body .panel {
  padding: 22px;
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}

body .panel-heading h2 { font-size: 17px; font-weight: 600; }

body .ghost-button,
body .icon-button {
  border-radius: 11px;
  font-weight: 800;
}

body .mini-button {
  min-height: 30px;
  padding: 0 12px;
  color: var(--primary-dark);
  border-color: var(--primary-border);
  background: var(--primary-light);
  font-weight: 800;
}

body .item {
  border-width: 1.5px;
  border-left-width: 4px;
  border-radius: 14px;
  padding: 15px 16px;
  box-shadow: none;
}

body .item:hover {
  border-color: var(--primary-border);
  box-shadow: 0 8px 22px rgba(91,124,250,.11);
  transform: translateY(-1px);
}

body .item-link {
  display: block;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

body .item-link:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}

body .item-link-action {
  display: inline-block;
  margin-top: 8px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
}

body .item h3 { font-family: "Fredoka", sans-serif; font-size: 15px; font-weight: 600; }
body .item p { font-size: 13px; }

body #materials-view .panel { background: transparent; border: 0; padding: 0; box-shadow: none; }
body #materials-status { margin: 0 0 13px; }

body #materials-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

body #materials-list .item {
  min-height: 190px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 72px 17px 17px;
  border-left-width: 1.5px;
  position: relative;
}

body #materials-list .item::before {
  content: "DOC";
  position: absolute;
  left: 17px;
  top: 16px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  color: white;
  background: linear-gradient(135deg, #5B7CFA, #7E96FF);
  box-shadow: 0 6px 14px rgba(91,124,250,.22);
  font: 600 10px "Fredoka", sans-serif;
  letter-spacing: .5px;
}

body #materials-list .item .item-actions { margin-top: auto; }

body #reports-view .split-layout { grid-template-columns: 1fr; }
body #reports-view .panel { background: transparent; border: 0; padding: 0; box-shadow: none; }
body #reports-view .panel-heading { border: 0; padding: 0; }
body #reports-list { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }

body #reports-list .item {
  position: relative;
  min-height: 132px;
  padding: 18px 18px 18px 72px;
  border-left-width: 1.5px;
  background: linear-gradient(145deg, #FFFFFF, #FBFCFF);
}

body #reports-list .item::before {
  content: "";
  position: absolute;
  left: 17px;
  top: 17px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  color: #F8FAFC;
  background: linear-gradient(135deg, #7F1D3F, #9F2A52);
  box-shadow: 0 6px 14px rgba(127,29,63,.25);
  font-size: 19px;
}

body .calendar-toolbar {
  padding: 15px 18px;
  border-radius: 16px;
  background: linear-gradient(180deg, #FBFCFF, #F5F7FC);
  box-shadow: var(--shadow-sm);
}

body #calendar-title {
  font-family: "Fredoka", sans-serif;
  font-size: 21px !important;
  font-weight: 600 !important;
}

body .calendar-weekdays {
  margin: 12px 0 7px;
  color: var(--muted);
  text-align: center;
}

body .calendar-weekdays span { padding: 5px; }

body .day {
  min-height: 105px;
  padding: 8px;
  border-width: 1.5px;
  border-radius: 13px;
  background: #FBFCFE;
}

body .day:hover {
  border-color: var(--primary);
  box-shadow: 0 7px 18px rgba(91,124,250,.12);
}

body .day-number {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 8px;
  font-family: "Fredoka", sans-serif;
  font-size: 13px;
  font-weight: 600;
}

body .calendar-chip {
  padding: 4px 7px;
  border: 0;
  border-left: 3px solid #9B6BE0;
  border-radius: 7px;
  background: #F3EDFC;
  color: #6B3FB0;
  font-size: 10.5px;
  font-weight: 800;
}

body .calendar-chip.reminder {
  border-left-color: #5A102D;
  background: #FCE7F3;
  color: #5A102D;
}

/* Starry controls and shared content components */
body .nav {
  overflow-x: auto;
  scrollbar-width: none;
}
body .nav::-webkit-scrollbar { display: none; }

body .primary-button {
  min-height: 40px;
  height: auto;
  padding: 10px 18px;
  border: 0;
  border-radius: 12px;
  color: #F8FAFC;
  background: linear-gradient(135deg, #5A102D, #7A143E);
  box-shadow: 0 6px 16px rgba(90,16,45,.35);
  font-family: "Fredoka", "Nunito", sans-serif;
  font-size: 14px;
  font-weight: 600;
}

body .primary-button:hover {
  color: #F8FAFC;
  background: linear-gradient(135deg, #430A22, #5A102D);
  box-shadow: 0 10px 22px rgba(90,16,45,.42);
}

body .text-button { color: #3D5BD9; font-weight: 800; border-radius: 10px; }

body input,
body select,
body textarea {
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: 11px;
  background: #FBFCFE;
}

body input:focus,
body select:focus,
body textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(91,124,250,.16);
}

body .record-form input,
body .record-form select,
body .quick-form input,
body .quick-form select,
body .students-toolbar input,
body .students-toolbar select {
  min-height: 42px;
  height: 42px;
  border-width: 1.5px;
  border-radius: 11px;
  background: #FBFCFE;
}

body .action-panel {
  background: linear-gradient(180deg, #FFFFFF, #FBFCFE);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

body .panel-heading {
  border-bottom-style: dashed;
  border-bottom-width: 1.5px;
}

body .panel-heading h2::before {
  content: "";
  margin-right: 8px;
  color: #7F1D3F;
  font-size: .8em;
}

body .metrics-grid { gap: 14px; }

body .metric {
  min-height: 128px;
  padding: 20px;
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}

body .metric::after { height: 4px; }
body .metric:nth-child(1)::after { background: linear-gradient(90deg, #5B7CFA, #8AA1FF); }
body .metric:nth-child(2)::after { background: linear-gradient(90deg, #5A102D, #7A143E); }
body .metric:nth-child(3)::after { background: linear-gradient(90deg, #9B6BE0, #B78EF0); }
body .metric:nth-child(4)::after { background: linear-gradient(90deg, #2FB98A, #55D1A8); }

body .metric span { color: var(--muted); font-weight: 800; }
body .metric strong { color: var(--text); font-family: "Fredoka", sans-serif; font-weight: 600; }

body .setup-alert,
body .config-callout {
  border-radius: 15px;
  border-width: 1.5px;
  box-shadow: 0 8px 22px rgba(246,185,59,.09);
}

body .todo-column {
  border-width: 1.5px;
  border-radius: 16px;
  background: rgba(255,255,255,.7);
  box-shadow: var(--shadow-sm);
}

body .todo-column h3 {
  font-family: "Fredoka", sans-serif;
  color: var(--text);
  font-size: 13px;
  letter-spacing: .04em;
}

body .students-toolbar {
  padding: 2px;
  gap: 10px;
}

body .students-metrics { gap: 12px; margin-top: 16px; }

body .metric-mini {
  position: relative;
  overflow: hidden;
  min-height: 92px;
  padding: 17px;
  border: 1.5px solid var(--border);
  border-radius: 15px;
  background: #FFFFFF;
  box-shadow: 0 7px 20px rgba(16,26,60,.06);
}

body .metric-mini::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, #5B7CFA, #9B6BE0);
}

body .metric-mini:nth-child(2)::after { background: linear-gradient(90deg, #2FB98A, #55D1A8); }
body .metric-mini:nth-child(3)::after { background: linear-gradient(90deg, #5A102D, #7A143E); }
body .metric-mini:nth-child(4)::after { background: linear-gradient(90deg, #EE6C5C, #F28B7D); }
body .metric-mini span { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
body .metric-mini strong { margin-top: 8px; color: var(--text); font: 600 28px "Fredoka", sans-serif; }

body #student-form {
  gap: 11px;
}

body .selected-lesson-dates {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 10px 14px;
  border: 1.5px dashed var(--primary-border);
  border-radius: 12px;
  color: var(--text-2);
  background: var(--primary-light);
  font-size: 13px;
  font-weight: 700;
}

body .schedule-builder {
  display: grid;
  gap: 14px;
}

body .lesson-form-section {
  display: grid;
  gap: 9px;
  padding: 14px;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: #FBFCFE;
}

body .lesson-form-section > h3,
body .lesson-schedule-preview-heading h3 {
  color: var(--text);
  font: 600 15px "Fredoka", sans-serif;
}

body .lesson-form-section h3 small,
body .form-field span small {
  color: var(--muted);
  font: 700 11px "Nunito", sans-serif;
}

body .lesson-form-grid {
  display: grid;
  gap: 10px;
}

body .lesson-form-grid.two-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body .lesson-form-grid.three-columns {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

body .form-field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

body .form-field[hidden] {
  display: none;
}

body .form-field > span {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 800;
}

body .schedule-builder input,
body .schedule-builder select {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 0 12px;
  border: 1.5px solid var(--border);
  border-radius: 11px;
  color: var(--text);
  background: #FFFFFF;
}

body .lesson-schedule-preview {
  overflow: hidden;
  border: 1.5px solid var(--primary-border);
  border-radius: 14px;
  background: #FFFFFF;
}

body .lesson-schedule-preview-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--primary-light);
}

body .lesson-schedule-preview-heading span {
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 900;
}

body #lesson-schedule-preview-list {
  display: grid;
  max-height: 290px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

body #lesson-schedule-preview-list li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
}

body #lesson-schedule-preview-list li > span {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 8px;
  color: var(--primary-dark);
  background: var(--primary-light);
  font-size: 11px;
  font-weight: 900;
}

body #lesson-schedule-preview-list li strong {
  color: var(--text-2);
  font-size: 13px;
}

body #lesson-schedule-preview-list li small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

body #lesson-schedule-preview-list li.is-empty {
  display: block;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
}

body .fee-calculator {
  margin-top: 16px;
}

body .fee-calculator .panel-heading p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12.5px;
}

body .fee-calculator-form {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) repeat(3, minmax(0, 1fr));
  gap: 10px;
}

body .fee-calculator-form input,
body .fee-calculator-form select {
  min-width: 0;
  min-height: 42px;
  padding: 0 12px;
  border: 1.5px solid var(--border);
  border-radius: 11px;
  color: var(--text);
  background: #FBFCFE;
}

body .fee-results {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

body .fee-result-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 17px;
  border: 1.5px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 14px;
  background: #FFFFFF;
}

body .fee-result-card h3 {
  color: var(--text);
  font: 600 16px "Fredoka", sans-serif;
}

body .fee-result-card p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12.5px;
}

body .fee-result-total {
  flex: 0 0 auto;
  text-align: right;
}

body .fee-result-total strong,
body .fee-result-total span {
  display: block;
}

body .fee-result-total strong {
  color: var(--text);
  font: 600 20px "Fredoka", sans-serif;
}

body .fee-result-total span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

body .student-form-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
}

body .student-form-actions .primary-button {
  flex: 1;
}

body #students-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 12px;
}

body #students-list .item {
  min-height: 150px;
  padding: 18px;
  border-left-color: #5B7CFA;
  background:
    radial-gradient(180px 90px at 105% -10%, rgba(91,124,250,.09), transparent 70%),
    #FFFFFF;
}

body #students-list .item h3 {
  font-size: 17px;
}

body .recruit-ai-dashboard,
body .recruit-ai-card,
body .recruit-filter-panel,
body .settings-grid > div {
  border-radius: 16px;
}

body .recruit-status-btn,
body .recruit-filter,
body .status-pill,
body .mini-button {
  font-family: "Nunito", sans-serif;
}

body .helper-text { color: var(--muted); font-weight: 600; }

body .section-band {
  padding: 2px 2px 0;
}

body .section-band::after {
  content: "✦";
  margin-left: auto;
  color: rgba(90,16,45,.7);
  font-size: 20px;
}

body .section-band > .item-actions,
body .section-band > .primary-button {
  position: relative;
  z-index: 1;
}

/* Staff Accounts view: keep actions dark red, no yellow */
body #settings-view .primary-button,
body #settings-view .mini-button,
body #settings-view [data-staff-submit] {
  color: #ffffff !important;
  border-color: #5A102D !important;
  background: linear-gradient(135deg, #5A102D, #7A143E) !important;
}

body #settings-view .primary-button:hover,
body #settings-view .mini-button:hover,
body #settings-view [data-staff-submit]:hover {
  color: #ffffff !important;
  border-color: #430A22 !important;
  background: linear-gradient(135deg, #430A22, #5A102D) !important;
}

body footer { color: var(--muted); }

@media (max-width: 760px) {
  body .sidebar {
    height: auto;
    min-height: 0;
    position: sticky;
    display: flex;
    flex-wrap: wrap;
    padding: 11px 14px 9px;
    gap: 7px;
  }

  body .brand {
    width: 100%;
    height: auto;
    padding: 0 0 9px;
    border-right: 0;
    border-bottom: 1px solid rgba(255,255,255,.1);
  }

  body .brand-mark { width: 36px; height: 36px; border-radius: 11px; }
  body .brand strong { font-size: 16px; }
  body .brand small { display: block; }
  body .nav { justify-content: flex-start; overflow-x: auto; }
  body .nav a { padding: 8px 12px; font-size: 12.5px; }
  body .topbar { padding: 12px 14px; }
  body .topbar > div:first-child { display: none; }
  body .topbar-actions { width: 100%; justify-content: space-between; }
  body #user-status { max-width: calc(100vw - 126px); overflow: hidden; text-overflow: ellipsis; }
  body .content-area { padding: 14px 14px 44px; }
  body .student-welcome { min-height: 0; padding: 22px; }
  body .student-welcome-orbit { display: none; }
  body .student-welcome h2 { font-size: 24px; }
  body #materials-list,
  body #reports-list { grid-template-columns: 1fr; }
  body .day { min-height: 68px; padding: 5px; }
  body .calendar-chip { font-size: 0; width: 8px; height: 8px; padding: 0; border: 0; border-radius: 50%; }
}

@media (prefers-reduced-motion: reduce) {
  body *,
  body *::before,
  body *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* ══════════════════════════════════════════
   TARGET MATERIALS VIEW
══════════════════════════════════════════ */
.visually-hidden {
  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;
}

body .sidebar {
  padding-left: 21px;
  padding-right: 30px;
}

body .nav { min-width: 0; }

.portal-actions {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.portal-actions #api-status { display: none; }

.portal-actions #user-status {
  height: 42px;
  padding: 0 16px;
  color: #FFD98A;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  background: rgba(255,255,255,.09);
  box-shadow: none;
  font-size: 13px;
  font-weight: 800;
}

.portal-signout {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  color: #C6CDEB;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 50%;
  background: rgba(255,255,255,.06);
}

.portal-signout:hover { color: #FFFFFF; background: rgba(255,255,255,.12); }

body .student-welcome { display: none !important; }

body .content-area {
  min-height: calc(100vh - 132px);
  padding: 29px 21px 76px;
}

.materials-page-head { margin-bottom: 27px; }

.materials-page-head h2 {
  color: #232B4A;
  font-family: "Fredoka", sans-serif;
  font-size: clamp(24px, 2.5vw, 29px);
  font-weight: 600;
  line-height: 1.2;
}

.materials-page-head p {
  margin-top: 5px;
  color: #68708F;
  font-size: 14.5px;
  font-weight: 600;
}

.materials-layout {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.materials-aside { min-width: 0; }

.materials-side-card {
  margin-bottom: 20px;
  padding: 21px;
  border: 1px solid #E3E7F2;
  border-radius: 18px;
  background: #FFFFFF;
  box-shadow: 0 10px 30px rgba(16,26,60,.07);
}

.materials-side-card h3 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 13px;
  color: #232B4A;
  font-family: "Fredoka", sans-serif;
  font-size: 16px;
  font-weight: 600;
}

.materials-library-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 13px;
}

.materials-library-head h3 { margin: 0; }

.materials-folder-add {
  min-height: 32px;
  padding: 5px 9px;
  color: #3D5BD9;
  border: 1.5px solid #C9D5FF;
  border-radius: 9px;
  background: #EEF2FF;
  font-size: 11.5px;
  font-weight: 800;
}

.materials-folder-add:hover { border-color: #5B7CFA; background: #E3EAFF; }

.materials-folders {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.materials-folders button {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 43px;
  padding: 9px 12px;
  color: #68708F;
  border: 0;
  border-radius: 11px;
  background: transparent;
  font-size: 14px;
  font-weight: 800;
  text-align: left;
}

.materials-folders button:hover { color: #3D5BD9; background: #F5F7FC; }

.materials-folders button.active {
  color: #3D5BD9;
  background: #EEF2FF;
}

.materials-folders button span {
  min-width: 22px;
  margin-left: auto;
  padding: 2px 7px;
  color: inherit;
  border-radius: 999px;
  background: #EDF0F8;
  font-size: 11px;
  text-align: center;
}

.materials-folders button.active span { background: #DDE6FF; }

.materials-library-folder-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1.5px dashed #E3E7F2;
}

.materials-library-folder {
  position: relative;
  overflow: hidden;
  border: 1.5px solid #E3E7F2;
  border-radius: 13px;
  background: linear-gradient(145deg, #FBFCFF, #F5F7FC);
  transition: border-color .15s, box-shadow .15s, transform .12s;
}

.materials-library-folder:hover,
.materials-library-folder.active {
  border-color: #5B7CFA;
  box-shadow: 0 7px 16px rgba(91,124,250,.12);
  transform: translateY(-1px);
}

.materials-library-folder-open {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  grid-template-rows: auto auto;
  width: 100%;
  min-height: 72px;
  padding: 11px 35px 11px 11px;
  color: #232B4A;
  border: 0;
  background: transparent;
  text-align: left;
}

.materials-library-folder-icon {
  display: grid;
  grid-column: 1;
  grid-row: 1 / 3;
  place-items: center;
  align-self: center;
  width: 32px;
  height: 32px;
  color: #9A6A08;
  border-radius: 10px;
  background: #FDF3DC;
  font-size: 16px;
}

.materials-library-folder-name {
  grid-column: 2;
  overflow: hidden;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
  text-overflow: ellipsis;
}

.materials-library-folder-meta {
  grid-column: 2;
  align-self: start;
  color: #8A90AC;
  font-size: 10.5px;
  font-weight: 700;
}

.materials-library-folder-remove {
  position: absolute;
  top: 7px;
  right: 7px;
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  padding: 0;
  color: #A5ACC3;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 18px;
}

.materials-library-folder-remove:hover { color: #B23E30; background: #FDEEEC; }

.materials-library-empty {
  margin: 0;
  color: #8A90AC;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.materials-drive-card p {
  margin: 0 0 16px;
  color: #68708F;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.55;
}

.materials-outline-button {
  min-height: 40px;
  padding: 8px 13px;
  color: #68708F;
  border: 1.5px solid #DCE1EE;
  border-radius: 10px;
  background: #FFFFFF;
  font-size: 13px;
  font-weight: 800;
}

.materials-outline-button:hover { color: #3D5BD9; border-color: #5B7CFA; }

.materials-main { min-width: 0; }

.materials-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 130px 82px 105px;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

.materials-search { position: relative; }

.materials-search svg {
  position: absolute;
  left: 13px;
  top: 50%;
  width: 17px;
  height: 17px;
  color: #8A90AC;
  transform: translateY(-50%);
  pointer-events: none;
}

body .materials-search input,
body #materials-sort {
  width: 100%;
  height: 45px;
  min-height: 45px;
  border: 1.5px solid #E3E7F2;
  border-radius: 11px;
  background: #FBFCFE;
  color: #232B4A;
  font-size: 14px;
}

body .materials-search input { padding: 0 13px 0 39px; }
body #materials-sort { padding: 0 12px; }

.materials-view-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 45px;
  overflow: hidden;
  border: 1.5px solid #DCE1EE;
  border-radius: 11px;
  background: #FFFFFF;
}

.materials-view-toggle button {
  display: grid;
  place-items: center;
  padding: 0;
  color: #8A90AC;
  border: 0;
  background: transparent;
}

.materials-view-toggle button + button { border-left: 1px solid #E3E7F2; }
.materials-view-toggle button:hover { color: #3D5BD9; background: #F5F7FC; }
.materials-view-toggle button.active { color: #FFFFFF; background: #5B7CFA; }
.materials-view-toggle svg { width: 17px; height: 17px; }

.materials-upload {
  height: 45px;
  padding: 0 14px;
  color: #F8FAFC;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #5A102D, #7A143E);
  box-shadow: 0 7px 18px rgba(90,16,45,.34);
  font-family: "Fredoka", sans-serif;
  font-size: 14px;
  font-weight: 600;
}

.materials-folder-add:disabled, .materials-upload:disabled { cursor: wait; opacity: .6; }

.materials-subbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 27px;
  margin-bottom: 11px;
}

body #materials-status {
  margin: 0;
  color: #232B4A;
  font-size: 13.5px;
  font-weight: 600;
}

body #materials-status strong { font-weight: 800; }

body #materials-list.materials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 14px;
}

.material-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 242px;
  padding: 16px;
  border: 1.5px solid #E3E7F2;
  border-radius: 16px;
  background: #FFFFFF;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .12s;
}

.material-card:hover {
  border-color: #5B7CFA;
  box-shadow: 0 10px 24px rgba(91,124,250,.14);
  transform: translateY(-2px);
}

.material-card:focus-visible {
  outline: 3px solid rgba(91,124,250,.32);
  outline-offset: 2px;
  border-color: #5B7CFA;
}

.material-file-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 11px;
  color: #FFFFFF;
  border-radius: 13px;
  background: linear-gradient(135deg, #5B7CFA, #7E96FF);
  box-shadow: 0 6px 14px rgba(91,124,250,.2);
  font-family: "Fredoka", sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .3px;
}

.material-file-pdf { background: linear-gradient(135deg, #EE6C5C, #F28B7D); }
.material-file-ppt { background: linear-gradient(135deg, #F6A03B, #FCBE5C); }
.material-file-xls { background: linear-gradient(135deg, #2FB98A, #55D1A8); }
.material-file-img, .material-file-vid { background: linear-gradient(135deg, #9B6BE0, #B78EF0); }

.material-favorite {
  position: absolute;
  right: 13px;
  top: 11px;
  padding: 0;
  color: #C8CDDE;
  border: 0;
  background: transparent;
  font-size: 25px;
  line-height: 1;
}

.material-favorite:hover,
.material-favorite.active { color: #7A143E; }

.material-card h3 {
  margin: 0 29px 8px 0;
  color: #232B4A;
  font-family: "Nunito", sans-serif;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
}

.material-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 9px;
}

.material-tags span {
  padding: 3px 9px;
  color: #68708F;
  border-radius: 999px;
  background: #F1F3F9;
  font-size: 10.5px;
  font-weight: 800;
}

.material-tags .material-subject-english { color: #3D5BD9; background: #EEF2FF; }
.material-tags .material-subject-math { color: #9A6A08; background: #FDF3DC; }
.material-tags .material-subject-science { color: #14724F; background: #E7F8F1; }
.material-tags .material-subject-chinese { color: #B23E30; background: #FDEEEC; }

.material-updated,
.material-description {
  margin: 0;
  color: #68708F;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
}

.material-description {
  display: -webkit-box;
  margin-top: 5px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.material-actions {
  display: flex;
  gap: 7px;
  margin-top: auto;
  padding-top: 13px;
}

.material-actions a,
.material-actions button {
  display: inline-flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 7px 10px;
  color: #68708F;
  border: 1.5px solid #DCE1EE;
  border-radius: 10px;
  background: #FBFCFE;
  font-size: 12.5px;
  font-weight: 800;
  text-decoration: none;
}

.material-actions a:hover,
.material-actions button:hover { color: #3D5BD9; border-color: #5B7CFA; }

.material-card-open-hint {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: auto;
  padding-top: 13px;
  color: #5B7CFA;
  font-size: 12px;
  font-weight: 800;
}

.material-admin-actions {
  display: flex;
  gap: 6px;
  margin-top: 7px;
}

.material-admin-actions button {
  flex: 1;
  min-height: 28px;
  padding: 4px 8px;
  color: #68708F;
  border: 0;
  border-radius: 8px;
  background: #F1F3F9;
  font-size: 11px;
  font-weight: 800;
}

.material-admin-actions button:hover { color: #3D5BD9; background: #EEF2FF; }
.material-admin-actions button.danger:hover { color: #B23E30; background: #FDEEEC; }

body #materials-list.materials-grid.materials-list-view {
  grid-template-columns: 1fr;
  gap: 8px;
}

.materials-list-view .material-card {
  display: grid;
  grid-template-columns: 46px minmax(180px, 1fr) minmax(110px, auto) minmax(115px, auto) minmax(150px, 190px) 30px;
  grid-template-rows: auto auto;
  column-gap: 13px;
  row-gap: 4px;
  align-items: center;
  min-height: 76px;
  padding: 11px 13px;
  border-radius: 14px;
}

.materials-list-view .material-file-icon {
  grid-column: 1;
  grid-row: 1 / 3;
  width: 42px;
  height: 42px;
  margin: 0;
  border-radius: 12px;
}

.materials-list-view .material-card h3 {
  grid-column: 2;
  grid-row: 1;
  align-self: end;
  margin: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.materials-list-view .material-tags {
  grid-column: 3;
  grid-row: 1 / 3;
  margin: 0;
}

.materials-list-view .material-updated {
  grid-column: 4;
  grid-row: 1 / 3;
  white-space: nowrap;
}

.materials-list-view .material-description {
  grid-column: 2;
  grid-row: 2;
  align-self: start;
  min-width: 0;
  margin: 0;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.materials-list-view .material-actions {
  grid-column: 5;
  grid-row: 1;
  margin: 0;
  padding: 0;
}

.materials-list-view .material-card-open-hint {
  grid-column: 5;
  grid-row: 1 / 3;
  justify-self: end;
  margin: 0;
  padding: 0 10px;
}

.materials-list-view .material-admin-actions {
  grid-column: 5;
  grid-row: 2;
  margin: 0;
}

.materials-list-view .material-actions a,
.materials-list-view .material-actions button { min-height: 36px; }

.materials-list-view .material-favorite {
  position: static;
  grid-column: 6;
  grid-row: 1 / 3;
  justify-self: center;
  font-size: 22px;
}

.materials-empty {
  grid-column: 1 / -1;
  padding: 48px 20px;
  color: #68708F;
  border: 1.5px dashed #DCE1EE;
  border-radius: 16px;
  background: #FFFFFF;
  text-align: center;
}

.materials-empty span { display: block; margin-bottom: 8px; font-size: 34px; }
.materials-empty strong { display: block; color: #232B4A; font-family: "Fredoka", sans-serif; }
.materials-empty p { margin: 3px 0 0; }

body.material-preview-open { overflow: hidden; }

.material-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 180;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(8, 16, 43, .76);
  backdrop-filter: blur(7px);
}

.material-preview-modal[hidden] { display: none; }

.material-preview-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1180px, 96vw);
  height: min(900px, 92vh);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 22px;
  background: #F5F7FC;
  box-shadow: 0 28px 80px rgba(5, 12, 34, .48);
}

.material-preview-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 76px;
  padding: 14px 18px;
  color: #FFFFFF;
  background: radial-gradient(700px 220px at 76% -80%, #2A3A78 0%, #101A3C 66%);
}

.material-preview-head::after {
  position: absolute;
  top: 13px;
  right: 42%;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 72px 20px rgba(255,255,255,.45), -96px 29px rgba(255,255,255,.35), 136px -3px rgba(246,185,59,.8);
  content: "";
}

.material-preview-heading {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.material-preview-star {
  display: grid;
  flex: 0 0 42px;
  place-items: center;
  width: 42px;
  height: 42px;
  color: #F8FAFC;
  border-radius: 13px;
  background: linear-gradient(135deg, #5A102D, #7A143E);
  box-shadow: 0 6px 16px rgba(90,16,45,.3);
  font-size: 20px;
}

.material-preview-heading h3 {
  margin: 0;
  overflow: hidden;
  color: #FFFFFF;
  font-family: "Fredoka", sans-serif;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.material-preview-heading p {
  margin: 3px 0 0;
  color: #B9C2E4;
  font-size: 11.5px;
  font-weight: 700;
}

.material-preview-actions {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.material-preview-print,
.material-preview-download,
.material-preview-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.material-preview-print {
  padding: 8px 13px;
  color: #DCE3FF;
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(255,255,255,.09);
}

.material-preview-print:hover { color: #FFFFFF; border-color: rgba(90,16,45,.55); background: rgba(90,16,45,.12); }

.material-preview-download {
  padding: 8px 14px;
  color: #F8FAFC;
  background: linear-gradient(135deg, #5A102D, #7A143E);
  box-shadow: 0 6px 14px rgba(90,16,45,.25);
}

.material-preview-close {
  width: 40px;
  padding: 0;
  color: #D7DCF1;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.08);
  font-size: 24px;
  font-weight: 500;
}

.material-preview-close:hover { color: #FFFFFF; background: rgba(255,255,255,.15); }

.material-preview-stage {
  position: relative;
  min-height: 0;
  padding: 14px;
  background: #E9EDF6;
}

.material-preview-stage iframe {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 12px;
  background: #FFFFFF;
  box-shadow: 0 5px 20px rgba(16,26,60,.08);
}

.material-preview-loading {
  position: absolute;
  inset: 14px;
  z-index: 2;
  display: grid;
  place-content: center;
  gap: 8px;
  color: #68708F;
  border-radius: 12px;
  background: #FFFFFF;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.material-preview-loading[hidden] { display: none; }
.material-preview-loading span { color: #7A143E; font-size: 30px; }

.portal-footer {
  padding: 19px 24px 34px;
  color: #68708F;
  background: #F5F7FC;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

@media (max-width: 1040px) {
  .materials-layout { grid-template-columns: 250px minmax(0, 1fr); }
  body #materials-list.materials-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

@media (max-width: 920px) {
  .materials-list-view .material-card {
    grid-template-columns: 42px minmax(140px, 1fr) minmax(110px, auto) 145px 28px;
  }
  .materials-list-view .material-tags { grid-column: 3; }
  .materials-list-view .material-updated { display: none; }
  .materials-list-view .material-actions { grid-column: 4; }
  .materials-list-view .material-admin-actions { grid-column: 4; }
  .materials-list-view .material-favorite { grid-column: 5; }
}

@media (max-width: 760px) {
  body .lesson-form-grid.two-columns,
  body .lesson-form-grid.three-columns {
    grid-template-columns: 1fr;
  }
  body #lesson-schedule-preview-list li {
    grid-template-columns: 28px minmax(0, 1fr);
  }
  body #lesson-schedule-preview-list li small {
    grid-column: 2;
  }
  body .sidebar { padding-left: 14px; padding-right: 14px; }
  .portal-actions { position: absolute; right: 14px; top: 12px; }
  .portal-actions #user-status { max-width: 145px; height: 36px; overflow: hidden; text-overflow: ellipsis; }
  .portal-signout { width: 34px; height: 34px; }
  body .content-area { padding: 20px 14px 48px; }
  .materials-layout { grid-template-columns: 1fr; }
  .materials-aside { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .materials-side-card { margin: 0; }
  .materials-toolbar { grid-template-columns: minmax(0, 1fr) 120px; }
  .materials-view-toggle { grid-column: 1; }
  .materials-upload { grid-column: 2; }
  .materials-list-view .material-card {
    grid-template-columns: 42px minmax(0, 1fr) 100px 26px;
  }
  .materials-list-view .material-tags { grid-column: 2; grid-row: 2; }
  .materials-list-view .material-actions { grid-column: 3; }
  .materials-list-view .material-card-open-hint { grid-column: 3; }
  .materials-list-view .material-admin-actions { grid-column: 3; }
  .materials-list-view .material-favorite { grid-column: 4; }
}

@media (max-width: 520px) {
  .materials-aside { grid-template-columns: 1fr; }
  .materials-toolbar { grid-template-columns: 1fr; }
  .materials-view-toggle, .materials-upload { grid-column: auto; }
  body #materials-list.materials-grid { grid-template-columns: 1fr; }
  .materials-list-view .material-card {
    grid-template-columns: 42px minmax(0, 1fr) 27px;
  }
  .materials-list-view .material-actions { grid-column: 2 / 4; grid-row: 3; margin-top: 7px; }
  .materials-list-view .material-card-open-hint { grid-column: 2 / 4; grid-row: 3; justify-self: start; padding: 0; }
  .materials-list-view .material-admin-actions { grid-column: 2 / 4; grid-row: 4; margin-top: 0; }
  .materials-list-view .material-favorite { grid-column: 3; }
  .material-preview-modal { padding: 0; }
  .material-preview-panel { width: 100vw; height: 100dvh; border: 0; border-radius: 0; }
  .material-preview-head { min-height: 68px; padding: 11px 12px; }
  .material-preview-star { display: none; }
  .material-preview-heading p { display: none; }
  .material-preview-print { min-height: 38px; padding: 7px 9px; font-size: 0; }
  .material-preview-print::before { content: "▣"; font-size: 16px; }
  .material-preview-download { min-height: 38px; padding: 7px 10px; font-size: 12px; }
  .material-preview-close { width: 38px; min-height: 38px; }
  .material-preview-stage { padding: 8px; }
  .material-preview-loading { inset: 8px; }
}
