/* ============================================
   Canvas Buddy — Notion-like Dark Mode
   Clean, productive workspace design
   ============================================ */

/* --- Global hidden override (prevents display:flex/inline-flex from overriding [hidden]) --- */
[hidden] { display: none !important; }

/* --- Auth state via body class (bulletproof, no hidden-attribute dependency) --- */
#topbarAvatar { display: none; }
body.cb-auth #authSignInBtn { display: none !important; }
body.cb-auth #topbarAvatar { display: flex !important; }

/* --- CSS Custom Properties --- */
:root {
  --bg-base: #191919;
  --bg-elevated: #222222;
  --bg-overlay: #2A2A2A;
  --bg-hover: #333333;
  --bg-active: rgba(35, 131, 226, 0.15);

  --accent: #2383E2;
  --accent-hover: #1B6BBF;
  --success: #44AC44;
  --warning: #CB8825;
  --danger: #D44C4C;

  --text-primary: #EBEBEB;
  --text-secondary: #999999;
  --text-tertiary: #666666;

  --border: #333333;
  --border-hover: #444444;
  --border-active: #2383E2;
  --border-subtle: #2A2A2A;
  --border-medium: #444444;

  --surface: #222222;
  --text-muted: #777777;

  --accent-cyan: #22D3EE;
  --accent-amber: #F59E0B;
  --accent-emerald: #34D399;
  --accent-rose: #FB7185;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.5);

  --transition: 0.15s ease-out;

  --max-width: 1280px;
  --nav-height: 80px;
  --sidebar-width: 220px;
  --sidebar-collapsed: 64px;
  --topbar-height: 46px;
  --mobile-tabbar-height: 60px;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', system-ui, sans-serif;
  background-color: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.65;
  overflow-x: hidden;
  position: relative;
}

body.is-scroll-locked {
  overflow: hidden !important;
}

.skip-link {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1000;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-150%);
  transition: transform var(--transition);
}

.skip-link:focus-visible {
  transform: translateY(0);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent) !important;
  outline-offset: 2px;
}

/* --- Typography --- */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.75rem, 7vw, 5.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

h2 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
}

h3 {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
}

h4 {
  font-size: clamp(1.25rem, 2vw, 1.75rem);
}

p {
  color: var(--text-secondary);
}

/* --- Layout Components (for non-app pages) --- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 32px;
  position: relative;
  z-index: 1;
}

.section {
  padding: 140px 0;
  position: relative;
}

.section--compact {
  padding: 100px 0;
}

.section-header {
  text-align: center;
  max-width: 800px;
  margin: 0 auto 80px;
}

.section-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  border-radius: 100px;
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 24px;
  transition: transform var(--transition);
}

.section-badge:hover {
  transform: translateY(-2px);
}

.section-badge--cyan {
  color: var(--accent);
  border-color: var(--accent);
}

.section-badge--amber {
  color: var(--warning);
  border-color: var(--warning);
}

.text-gradient-cyan {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-gradient-prismatic {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent), var(--accent-rose));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-header h2 {
  margin-bottom: 20px;
}

.section-header p {
  font-size: 1.25rem;
  color: var(--text-tertiary);
  line-height: 1.7;
}

/* ============================================
   APP SHELL LAYOUT
   ============================================ */

.app-body {
  overflow-x: hidden;
  overflow-y: auto;
  height: 100vh;
  height: 100dvh;
}

.app {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow-x: hidden;
}

/* --- Sidebar --- */
.app__sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-base);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width var(--transition), min-width var(--transition);
  z-index: 100;
}

.sidebar-brand {
  padding: 12px 16px;
  border-bottom: none;
  flex-shrink: 0;
}

.sidebar-brand .navbar__logo {
  gap: 8px;
  font-size: 0.9375rem;
}

.sidebar-brand .navbar__logo-icon {
  width: 28px;
  height: 28px;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.sidebar-section-label {
  padding: 20px 16px 4px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 4px 12px 0;
  gap: 2px;
}

.sidebar-nav--secondary {
  padding-bottom: 16px;
}

.sidebar-nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
  white-space: nowrap;
}

.sidebar-nav__item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-nav__item.is-active {
  background: var(--bg-active);
  color: var(--accent);
}

.sidebar-nav__icon {
  font-size: 1.125rem;
  flex-shrink: 0;
  width: 22px;
  text-align: center;
}

.sidebar-nav__icon--text {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-tertiary);
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border-radius: var(--radius-sm);
  border: none;
}

.sidebar-nav__item.is-active .sidebar-nav__icon--text {
  background: transparent;
  color: var(--accent);
  border-color: transparent;
}

.sidebar-nav__label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-divider {
  height: 0;
  background: none;
  margin: 2px 0;
  flex-shrink: 0;
}

/* --- Main Area --- */
.app__main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* --- Top Bar --- */
.app__topbar {
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  background: var(--bg-base);
  border-bottom: none;
  z-index: 50;
}

.topbar__sidebar-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}

.topbar__sidebar-toggle span {
  width: 20px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all var(--transition);
}

.topbar__title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  flex: 1;
}

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

/* --- Avatar --- */
.topbar__avatar {
  position: relative;
}

.avatar-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  background: var(--accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity var(--transition);
}

.avatar-btn:hover {
  opacity: 0.85;
}

.avatar-btn__initial {
  font-size: 0.6875rem;
  font-weight: 700;
  color: #fff;
}

.avatar-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-lg);
  z-index: 200;
}

.avatar-dropdown__name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.avatar-dropdown__email {
  font-size: 0.875rem;
  color: var(--text-tertiary);
}

.avatar-dropdown__divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

.avatar-dropdown__item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.avatar-dropdown__item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* --- Content Area --- */
.app__content {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  background: var(--bg-base);
  position: relative;
  display: flex;
  flex-direction: column;
}

/* --- Tool Panels --- */
.tool-panel {
  display: none;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.tool-panel.is-active {
  display: block;
}

.tool-panel--chat.is-active {
  display: flex;
  overflow: hidden;
}

.tool-panel__inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px;
}

/* ============================================
   CHAT PANEL
   ============================================ */

.chat-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-width: 940px;
  margin: 0 auto;
  position: relative;
}

.topbar__chat-actions {
  position: relative;
  display: flex;
  gap: 8px;
  border-left: 1px solid var(--border);
  padding-left: 12px;
}

.chat-export-wrap {
  position: relative;
}

.chat-export-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 50;
  min-width: 120px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  margin-top: 4px;
  padding: 4px 0;
}

.chat-export-option {
  display: block;
  width: 100%;
  padding: 8px 14px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.8rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}

.chat-export-option:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.chat-history-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 50;
  width: 320px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  max-height: 360px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  margin-top: 4px;
}

.chat-history-list {
  padding: 4px 0;
}

.chat-history-empty {
  padding: 24px 16px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

.chat-history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  cursor: pointer;
  transition: background 0.1s;
}

.chat-history-item:hover {
  background: var(--surface-hover);
}

.chat-history-item__title {
  flex: 1;
  min-width: 0;
  font-size: 0.825rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-history-item__date {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  white-space: nowrap;
  flex-shrink: 0;
}

.chat-history-item__delete {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 1rem;
  padding: 0 4px;
  line-height: 1;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.1s, color 0.1s;
}

.chat-history-item:hover .chat-history-item__delete {
  opacity: 1;
}

.chat-history-item__delete:hover {
  color: var(--danger, #ef4444);
}

.format-panel {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 0;
}

.format-converter {
  margin: 0;
  padding: 16px 18px 18px;
  border-radius: 16px;
  border: 1px solid rgba(35, 131, 226, 0.35);
  background:
    radial-gradient(120% 120% at 0% 0%, rgba(35, 131, 226, 0.18), rgba(35, 131, 226, 0) 55%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0)),
    var(--surface-elevated);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 16px 34px rgba(0, 0, 0, 0.24);
}

.format-converter__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.format-converter__headline {
  min-width: 0;
}

.format-converter__eyebrow {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(35, 131, 226, 0.85);
}

.format-converter__title {
  margin: 4px 0 2px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.format-converter__desc {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

.format-converter__autofill {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.6);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  padding: 9px 12px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  flex-shrink: 0;
}

.format-converter__autofill:hover {
  border-color: rgba(35, 131, 226, 0.6);
  color: var(--text-primary);
  background: rgba(35, 131, 226, 0.16);
}

.format-converter__autofill:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

.format-converter__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.format-converter__field span {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.format-converter__field--title {
  grid-column: span 2;
}

.format-converter__field--course {
  grid-column: span 2;
}

.format-converter__control {
  height: 38px;
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(7, 12, 22, 0.72);
  color: var(--text-primary);
  padding: 0 11px;
  font-size: 0.82rem;
  font-family: inherit;
}

.format-converter__control::placeholder {
  color: var(--text-tertiary);
}

.format-converter__control:focus {
  outline: none;
  border-color: rgba(35, 131, 226, 0.88);
  box-shadow: 0 0 0 3px rgba(35, 131, 226, 0.2);
}

.format-converter__field--body {
  grid-column: 1 / -1;
}
.format-converter__body {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 0.88rem;
  color: var(--text-primary);
  font-family: inherit;
  line-height: 1.5;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.format-converter__body::placeholder { color: var(--text-tertiary); }
.format-converter__body:focus {
  outline: none;
  border-color: rgba(35, 131, 226, 0.88);
  box-shadow: 0 0 0 3px rgba(35, 131, 226, 0.2);
}
.format-converter__or-line {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 0.77rem;
  color: var(--text-tertiary);
  position: relative;
  margin: 4px 0;
}
.format-converter__or-line::before,
.format-converter__or-line::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 50px);
  height: 1px;
  background: var(--border-primary);
}
.format-converter__or-line::before { left: 0; }
.format-converter__or-line::after { right: 0; }
.format-converter__file-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
}
.format-converter__file-btn {
  padding: 6px 14px;
  font-size: 0.82rem;
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.format-converter__file-btn:hover { background: var(--bg-hover); }
.format-converter__file-name {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.format-converter__footer {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.format-converter__meta {
  margin: 0;
  font-size: 0.77rem;
  color: var(--text-tertiary);
  line-height: 1.45;
}

.format-converter__generate {
  border: 1px solid rgba(35, 131, 226, 0.65);
  border-radius: 11px;
  background: linear-gradient(145deg, rgba(35, 131, 226, 0.95), rgba(26, 97, 181, 0.95));
  color: #fff;
  font-size: 0.79rem;
  font-weight: 700;
  padding: 10px 14px;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s, filter 0.15s, opacity 0.15s;
}

.format-converter__generate:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.format-converter__generate:disabled {
  opacity: 0.45;
  transform: none;
  cursor: not-allowed;
}

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding-top: 16px;
}

.chat-suggestion {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.chat-suggestion:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 28px 36px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.chat-welcome {
  margin: auto;
  text-align: center;
  max-width: 480px;
  padding: 48px 24px;
}

.chat-welcome__icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.chat-welcome__title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.chat-welcome__desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.chat-welcome__tips {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  text-align: left;
  display: inline-block;
}

.chat-welcome__tips li {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  padding: 3px 0;
}

.chat-welcome__tips li::before {
  content: '\b7\a0';
}

.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 84%;
}

.chat-msg--user {
  align-self: flex-end;
  align-items: flex-end;
}

.chat-msg--ai {
  align-self: flex-start;
  align-items: flex-start;
}

.chat-msg__bubble {
  padding: 13px 17px;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-msg--user .chat-msg__bubble {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-msg--ai .chat-msg__bubble {
  background: var(--surface-elevated);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.chat-msg__bubble.is-streaming::after {
  content: '▋';
  animation: blink 0.8s step-start infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* Typing indicator - bouncing dots while streaming and empty */
.chat-msg__bubble.is-streaming:empty::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-tertiary);
  animation: dotBounce 0.6s ease-in-out infinite alternate;
  box-shadow: 12px 0 var(--text-tertiary), 24px 0 var(--text-tertiary);
  margin: 7px 12px 7px 0;
}

@keyframes dotBounce {
  0% { transform: translateY(0); box-shadow: 12px 0 var(--text-tertiary), 24px 0 var(--text-tertiary); }
  33% { transform: translateY(-6px); box-shadow: 12px 0 var(--text-tertiary), 24px 0 var(--text-tertiary); }
  66% { transform: translateY(0); box-shadow: 12px -6px var(--text-tertiary), 24px 0 var(--text-tertiary); }
  100% { transform: translateY(0); box-shadow: 12px 0 var(--text-tertiary), 24px -6px var(--text-tertiary); }
}

/* Markdown in AI chat bubbles */
.chat-msg--ai .chat-msg__bubble { white-space: normal; }
.chat-msg--ai .chat-msg__bubble p { margin: 0 0 10px; }
.chat-msg--ai .chat-msg__bubble p:last-child { margin-bottom: 0; }
.chat-msg--ai .chat-msg__bubble h3,
.chat-msg--ai .chat-msg__bubble h4 { font-size: 0.9375rem; font-weight: 700; margin: 16px 0 6px; color: var(--text-primary); }
.chat-msg--ai .chat-msg__bubble h3:first-child,
.chat-msg--ai .chat-msg__bubble h4:first-child { margin-top: 0; }
.chat-msg--ai .chat-msg__bubble strong { font-weight: 700; color: var(--text-primary); }
.chat-msg--ai .chat-msg__bubble em { font-style: italic; }
.chat-msg--ai .chat-msg__bubble code {
  background: rgba(0,0,0,0.3);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.8125rem;
}
.chat-msg--ai .chat-msg__bubble pre {
  background: rgba(0,0,0,0.35);
  border-radius: 6px;
  padding: 12px;
  margin: 8px 0;
  overflow-x: auto;
}
.chat-msg--ai .chat-msg__bubble pre code {
  background: none;
  padding: 0;
}

/* highlight.js background override to match existing theme */
.chat-msg--ai .chat-msg__bubble pre code.hljs {
  background: rgba(0, 0, 0, 0.35);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 0.8125rem;
  line-height: 1.5;
}
.chat-msg--ai .chat-msg__bubble ul,
.chat-msg--ai .chat-msg__bubble ol {
  margin: 8px 0;
  padding-left: 20px;
}
.chat-msg--ai .chat-msg__bubble li {
  margin: 4px 0;
}
.chat-msg--ai .chat-msg__bubble hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 14px 0;
}

.chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 14px 24px 22px;
  border-top: 1px solid var(--border);
}

.chat-input {
  flex: 1;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 0.9rem;
  color: var(--text-primary);
  resize: none;
  max-height: 120px;
  overflow-y: auto;
  font-family: inherit;
  line-height: 1.5;
}

.chat-input:focus {
  outline: none;
  border-color: var(--accent);
}

.chat-send-btn {
  background: var(--accent);
  border: none;
  border-radius: 10px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.15s;
}

.chat-send-btn:hover {
  opacity: 0.85;
}

.chat-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

@media (max-width: 1200px) {
  .chat-panel {
    max-width: 860px;
  }

  .format-panel {
    padding: 16px 0;
  }

  .format-converter {
    padding: 14px;
  }

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

  .format-converter__field--title {
    grid-column: span 2;
  }

  .format-converter__field--course {
    grid-column: span 2;
  }

  .chat-messages {
    padding-inline: 24px;
  }

  .chat-msg {
    max-width: 86%;
  }
}

@media (max-width: 760px) {
  .format-converter__header {
    flex-direction: column;
    align-items: stretch;
  }

  .format-converter__autofill {
    width: 100%;
  }

  .format-converter__grid {
    grid-template-columns: 1fr;
  }

  .format-converter__field--title {
    grid-column: auto;
  }

  .format-converter__field--course {
    grid-column: auto;
  }

  .format-converter__footer {
    flex-direction: column;
    align-items: stretch;
  }

  .format-converter__generate {
    width: 100%;
  }
}

/* Chat file attachments */
.chat-attachments {
  padding: 0 20px;
  border-top: 1px solid var(--border-subtle);
}

.chat-attachments__list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 0;
}

.chat-attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 10px;
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  max-width: 200px;
}

.chat-attachment-chip.is-loading {
  opacity: 0.6;
}

.chat-attachment-chip.is-error {
  border-color: var(--danger);
  color: var(--danger);
}

.chat-attachment-chip__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-attachment-chip__status {
  font-size: 0.6875rem;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.chat-attachment-chip__thumb {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

.chat-attachment-chip__remove {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 0.875rem;
  padding: 0 2px;
  line-height: 1;
  flex-shrink: 0;
}

.chat-attachment-chip__remove:hover {
  color: var(--text-primary);
}

/* Tool-calling status animation */
.chat-status-text {
  color: var(--text-secondary);
  font-style: italic;
  font-size: 0.85rem;
}

.chat-status-text::after {
  content: '';
  animation: statusDots 1.2s steps(4, end) infinite;
}

@keyframes statusDots {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
}

/* Drag & Drop overlay */
.chat-panel.is-dragover {
  position: relative;
}

.chat-panel.is-dragover::after {
  content: 'Drop files here';
  position: absolute;
  inset: 0;
  background: rgba(35, 131, 226, 0.12);
  border: 2px dashed var(--accent);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  z-index: 10;
  pointer-events: none;
}

.chat-attach-btn {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}

.chat-attach-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.chat-fill-btn {
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.6);
  color: var(--text-secondary);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
}

.chat-fill-btn:hover {
  background: rgba(35, 131, 226, 0.16);
  border-color: rgba(35, 131, 226, 0.55);
  color: var(--text-primary);
}

.chat-fill-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.fill-btn-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.fill-btn-wrap .chat-fill-btn { border-radius: 10px 0 0 10px; }
.fill-settings-toggle {
  border: 1px solid var(--border);
  border-left: 0;
  background: rgba(15, 23, 42, 0.6);
  color: var(--text-secondary);
  border-radius: 0 10px 10px 0;
  padding: 8px 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: background 0.15s, color 0.15s;
}
.fill-settings-toggle:hover { background: rgba(35, 131, 226, 0.16); color: var(--text-primary); }
.fill-settings-toggle:disabled { opacity: 0.45; cursor: not-allowed; }
.fill-settings-toggle.is-open svg { transform: rotate(180deg); }

.fill-settings-panel {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  min-width: 220px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 50;
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
}
.fill-settings-panel[hidden] { display: none; }

.fill-setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}
.fill-setting span { flex-shrink: 0; }
.fill-setting select,
.fill-setting input {
  flex: 1;
  min-width: 0;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 0.75rem;
}
.fill-setting input::placeholder { color: var(--text-tertiary); }

/* Assignment modal module files */
.assignment-modal__files {
  margin-bottom: 16px;
}

.assignment-modal__files-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.assignment-modal__files-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.assignment-modal__file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  background: var(--bg-base);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
}

.assignment-modal__file-name {
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* ============================================
   DASHBOARD PANEL
   ============================================ */

.dash {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Welcome */
.dash__welcome {
  padding: 8px 0 4px;
}

.dash__greeting {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.dash__name {
  color: var(--accent);
}

.dash__date {
  color: var(--text-tertiary);
  font-size: 0.9375rem;
  margin-top: 4px;
}

.dash__streak {
  display: inline-block;
  margin-top: 8px;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border-radius: 12px;
}

/* PWA Install Banner */
.pwa-install-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  background: rgba(35, 131, 226, 0.1);
  border-bottom: 1px solid rgba(35, 131, 226, 0.2);
}

.pwa-install-banner__body {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pwa-install-banner__icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  background: var(--accent);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
}

.pwa-install-banner__title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.pwa-install-banner__desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.pwa-install-banner__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .pwa-install-banner {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .pwa-install-banner__actions {
    justify-content: flex-end;
  }
}

/* Connect Banner */
.dash__connect-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: rgba(35, 131, 226, 0.08);
  border: 1px solid rgba(35, 131, 226, 0.25);
  border-radius: var(--radius-lg);
}

.dash__connect-banner[hidden] {
  display: none;
}

.dash__connect-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  background: rgba(35, 131, 226, 0.2);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: rgba(35, 131, 226, 0.9);
}

.dash__connect-body {
  flex: 1;
}

.dash__connect-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.dash__connect-desc {
  font-size: 0.875rem;
  color: var(--text-tertiary);
  line-height: 1.5;
}

@media (max-width: 600px) {
  .dash__connect-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

/* Today's Focus Widget */
.dash__focus {
  margin-bottom: 4px;
}

.dash__focus-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.dash__focus-item {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition);
}

.dash__focus-item:hover {
  border-color: var(--border-hover);
}

.dash__focus-bar {
  width: 4px;
  align-self: stretch;
  flex-shrink: 0;
}

.dash__focus-item--urgent .dash__focus-bar,
.dash__focus-item--overdue .dash__focus-bar { background: var(--danger); }
.dash__focus-item--warning .dash__focus-bar { background: var(--warning); }
.dash__focus-item--ok .dash__focus-bar { background: var(--success); }

.dash__focus-body {
  flex: 1;
  padding: 12px 16px;
  min-width: 0;
}

.dash__focus-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dash__focus-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash__focus-status {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

.dash__focus-status--submitted {
  background: rgba(68, 172, 68, 0.15);
  color: var(--success);
}

.dash__focus-status--unsubmitted {
  background: rgba(212, 76, 76, 0.15);
  color: var(--danger);
}

.dash__focus-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

.dash__focus-course {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash__focus-time {
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.dash__focus-time--urgent,
.dash__focus-time--overdue { color: var(--danger); }
.dash__focus-time--warning { color: var(--warning); }
.dash__focus-time--ok { color: var(--success); }

.dash__focus-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  flex-shrink: 0;
  align-self: stretch;
  color: var(--text-tertiary);
  text-decoration: none;
  font-size: 1rem;
  transition: color var(--transition), background var(--transition);
}

.dash__focus-link:hover {
  color: var(--accent);
  background: rgba(35, 131, 226, 0.08);
}

.dash__focus-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.875rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

/* Stats Cards */
.dash__stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.dash__card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color var(--transition);
}

.dash__card:hover {
  border-color: var(--border-hover);
}

.dash__card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dash__card-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  text-transform: uppercase;
}

.dash__card-icon {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
}

.dash__card-icon--courses {
  background: rgba(212, 76, 76, 0.15);
  color: rgba(212, 76, 76, 0.9);
}

.dash__card-icon--assignments {
  background: rgba(35, 131, 226, 0.15);
  color: rgba(35, 131, 226, 0.9);
}

.dash__card-icon--grade {
  background: rgba(68, 172, 68, 0.15);
  color: rgba(68, 172, 68, 0.9);
}

.dash__card-icon--overdue {
  background: rgba(203, 136, 37, 0.15);
  color: rgba(203, 136, 37, 0.9);
}

.dash__card-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.dash__card-sub {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  margin-top: -4px;
}

/* Row Layout */
.dash__row {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 16px;
}

/* Sections */
.dash__section {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  min-width: 0;
  overflow: hidden;
}

.dash__section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.dash__empty {
  color: var(--text-tertiary);
  font-size: 0.9375rem;
  padding: 16px 0;
}

/* Dashboard customize button */
.dash__customize-btn {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  margin-left: 8px;
  transition: color 0.15s;
}

.dash__customize-btn:hover {
  color: var(--text-primary);
}

/* Dashboard edit bar */
.dash__edit-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.dash__edit-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  flex: 1;
}

/* Dashboard widget edit controls */
.dash__widget--hidden {
  opacity: 0.35;
}

.dash--editing .dash__widget {
  border: 1px dashed var(--border-hover);
  border-radius: var(--radius-md);
  padding-top: 4px;
  margin-bottom: 8px;
  transition: opacity 0.15s;
}

.dash__widget--dragging {
  opacity: 0.4;
}

.dash__widget-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.dash__widget-handle {
  cursor: grab;
  user-select: none;
  font-size: 0.9rem;
}

.dash__widget-label {
  flex: 1;
}

.dash__widget-vis {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1rem;
  padding: 2px 4px;
}

.dash__widget-vis:hover {
  color: var(--text-primary);
}

/* Assignment List */
.dash__assignment-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.dash__assignment-item:last-child {
  border-bottom: none;
}

.dash__assignment-indicator {
  width: 4px;
  height: 40px;
  border-radius: 2px;
  flex-shrink: 0;
}

.dash__assignment-indicator--red {
  background: var(--danger);
}

.dash__assignment-indicator--blue {
  background: var(--accent);
}

.dash__assignment-indicator--green {
  background: var(--success);
}

.dash__assignment-indicator--yellow {
  background: var(--warning);
}

.dash__assignment-info {
  flex: 1;
  min-width: 0;
}

.dash__assignment-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash__assignment-meta {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.dash__badge {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.dash__badge--ai {
  background: rgba(35, 131, 226, 0.15);
  color: var(--accent);
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: background 0.15s;
}

.dash__badge--ai:hover {
  background: rgba(35, 131, 226, 0.25);
}

.dash__assignment-item[data-assignment-id]:hover {
  background: var(--bg-hover);
  border-radius: var(--radius-md);
}

.dash__badge--due {
  background: rgba(212, 76, 76, 0.15);
  color: var(--danger);
}

.dash__badge--soon {
  background: rgba(203, 136, 37, 0.15);
  color: var(--warning);
}

.dash__badge--ok {
  background: rgba(68, 172, 68, 0.15);
  color: var(--success);
}

/* Grade List */
.dash__grade-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}

.dash__grade-item:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

.dash__grade-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dash__grade-dot--green {
  background: var(--success);
}

.dash__grade-dot--blue {
  background: var(--accent);
}

.dash__grade-dot--yellow {
  background: var(--warning);
}

.dash__grade-dot--red {
  background: var(--danger);
}

.dash__grade-dot--gray {
  background: var(--text-tertiary);
}

.dash__grade-name {
  flex: 1;
  font-size: 0.9375rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash__grade-pct {
  font-size: 0.9375rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 48px;
  text-align: right;
}

.dash__grade-pct--high {
  color: var(--success);
}

.dash__grade-pct--mid {
  color: var(--accent);
}

.dash__grade-pct--low {
  color: var(--warning);
}

.dash__grade-pct--fail {
  color: var(--danger);
}

.dash__grade-pct--na {
  color: var(--text-tertiary);
}

/* Notification List */
.dash__notif-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
}

.dash__notif-item:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

.dash__notif-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.dash__notif-icon--assignment {
  background: rgba(35, 131, 226, 0.15);
  color: var(--accent);
}

.dash__notif-icon--grade {
  background: rgba(68, 172, 68, 0.15);
  color: var(--success);
}

.dash__notif-icon--alert {
  background: rgba(212, 76, 76, 0.15);
  color: var(--danger);
}

.dash__notif-body {
  flex: 1;
  min-width: 0;
}

.dash__notif-text {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.dash__notif-text strong {
  color: var(--text-primary);
  font-weight: 600;
}

.dash__notif-time {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* Dashboard panel — fill available width */
#panel-dashboard .tool-panel__inner {
  max-width: none;
}

/* Data-heavy panels: remove card boxing */
#panel-courses .feature-live-demo,
#panel-settings .feature-live-demo,
#panel-announcements .feature-live-demo,
#panel-notes .feature-live-demo {
  background: none;
  border: none;
  padding: 0;
  border-radius: 0;
}

/* Data-heavy panels: wider layout */
#panel-courses .tool-panel__inner,
#panel-settings .tool-panel__inner,
#panel-announcements .tool-panel__inner,
#panel-notes .tool-panel__inner {
  max-width: 900px;
}

#panel-formatter .tool-panel__inner {
  max-width: 980px;
}

/* Dashboard Responsive */
@media (max-width: 768px) {
  .dash__stats {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .dash__greeting {
    font-size: 1.375rem;
  }

  .dash__card-value {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  .dash__stats {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .dash__card {
    padding: 14px;
  }

  .dash__card-icon {
    width: 32px;
    height: 32px;
    font-size: 1.125rem;
  }
}

/* --- Auth Modal --- */
.auth-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.auth-modal-overlay[hidden] {
  display: none;
}

.auth-modal {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideInUp 0.2s ease-out;
}

.auth-modal__close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 1.75rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
  z-index: 10;
  line-height: 1;
}

.auth-modal__close:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* --- Mobile Bottom Tab Bar --- */
.mobile-tabbar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--mobile-tabbar-height);
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  z-index: 100;
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.mobile-tabbar__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-tertiary);
  text-decoration: none;
  font-size: 0.6875rem;
  font-weight: 500;
  transition: color var(--transition);
}

.mobile-tabbar__item.is-active {
  color: var(--accent);
}

.mobile-tabbar__item:hover {
  color: var(--text-primary);
}

.mobile-tabbar__icon {
  font-size: 1.25rem;
}

.mobile-tabbar__icon--text {
  font-size: 0.625rem;
  font-weight: 700;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-overlay);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.mobile-tabbar__item.is-active .mobile-tabbar__icon--text {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.mobile-tabbar__label {
  line-height: 1;
}

/* --- Mobile More Drawer --- */
.mobile-drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 199;
}

.mobile-drawer-overlay[hidden] {
  display: none;
}

.mobile-drawer {
  display: none;
  position: fixed;
  bottom: var(--mobile-tabbar-height);
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 16px 16px 24px;
  z-index: 200;
  transform: translateY(100%);
  transition: transform 0.2s ease-out;
}

.mobile-drawer.is-open {
  transform: translateY(0);
}

.mobile-drawer__title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-bottom: 12px;
  padding: 0 4px;
}

.mobile-drawer__items {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mobile-drawer__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  transition: all var(--transition);
}

.mobile-drawer__item:hover,
.mobile-drawer__item.is-active {
  background: var(--bg-active);
  color: var(--accent);
}

.mobile-drawer__item-icon {
  font-size: 0.625rem;
  font-weight: 700;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-overlay);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.mobile-drawer__item.is-active .mobile-drawer__item-icon {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* --- Button icon/label pattern (for responsive buttons) --- */
.btn__icon {
  display: none;
  font-size: 1rem;
  line-height: 1;
}

.btn__label {
  /* shown by default */
}


/* ============================================
   NAVIGATION (for non-app pages)
   ============================================ */

.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  z-index: 1000;
  transition: all var(--transition);
}

.navbar::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  opacity: 0;
  transition: opacity var(--transition);
}

.navbar.scrolled::before {
  opacity: 1;
}

.navbar__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 max(32px, env(safe-area-inset-right)) 0 max(32px, env(safe-area-inset-left));
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 1;
}

.navbar__logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.02em;
  transition: opacity var(--transition);
}

.navbar__logo:hover {
  opacity: 0.85;
  color: var(--text-primary);
}

.navbar__logo-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  transition: opacity var(--transition);
}

.navbar__nav {
  display: flex;
  align-items: center;
  gap: 40px;
}

.navbar__link {
  color: var(--text-tertiary);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  position: relative;
  transition: color var(--transition);
  padding: 8px 0;
}

.navbar__link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width var(--transition);
}

.navbar__link:hover,
.navbar__link.active {
  color: var(--text-primary);
}

.navbar__link:hover::after,
.navbar__link.active::after {
  width: 100%;
}

.navbar__link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 4px;
}

.navbar__actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.navbar__hamburger {
  display: none;
}

.mobile-menu {
  display: none;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
  touch-action: manipulation;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
}

.btn--primary:hover {
  background: var(--accent-hover);
  color: #fff;
}

.btn--secondary {
  background: var(--bg-overlay);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn--secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn--ghost:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

.btn--danger {
  background: var(--danger);
  color: #fff;
}

.btn--danger:hover {
  opacity: 0.85;
  color: #fff;
}

.btn--lg {
  padding: 14px 28px;
  font-size: 1rem;
  border-radius: var(--radius-lg);
}

.btn--xs {
  padding: 2px 8px;
  font-size: 0.6875rem;
}

.btn--sm {
  padding: 6px 14px;
  font-size: 0.8125rem;
}

/* ============================================
   FEATURE LIVE DEMO COMPONENTS (shared)
   ============================================ */

.feature-live-demo {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.feature-live-demo__title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.0625rem;
  font-weight: 600;
}

.feature-live-demo__title span {
  font-size: 1.125rem;
}

.feature-live-demo__label {
  display: grid;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  font-weight: 500;
}

.feature-live-demo__input {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-base);
  color: var(--text-primary);
  color-scheme: dark;
  padding: 10px 12px;
  font-size: 0.9375rem;
  font-family: inherit;
  min-height: 40px;
  transition: border var(--transition);
}

select.feature-live-demo__input {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

select.feature-live-demo__input option {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.feature-live-demo__input:focus {
  outline: none;
  border-color: var(--border-active);
}

.feature-live-demo__input--textarea {
  resize: vertical;
  min-height: 120px;
}

.feature-live-demo__grid {
  display: grid;
  gap: 12px;
}

.feature-live-demo__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.feature-live-demo__output {
  margin-top: 4px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.7;
  white-space: pre-wrap;
  min-height: 100px;
}

.feature-live-demo__hint {
  color: var(--text-tertiary);
  font-size: 0.8125rem;
  line-height: 1.6;
}

.feature-live-demo__result {
  margin-top: 0;
}

.feature-live-demo__result--success {
  border-color: rgba(68, 172, 68, 0.4);
  color: var(--text-secondary);
}

.feature-live-demo__result--streaming {
  border-color: var(--accent);
  color: var(--text-secondary);
  min-height: 100px;
}

.feature-live-demo__result--streaming::after {
  content: '▋';
  display: inline-block;
  color: var(--accent);
  animation: blink-cursor 0.8s step-end infinite;
}

@keyframes blink-cursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.feature-live-demo__result--warning {
  border-color: rgba(203, 136, 37, 0.4);
  color: var(--warning);
}

.feature-live-demo__result--error {
  border-color: rgba(212, 76, 76, 0.4);
  color: var(--danger);
}

/* ============================================
   COURSES PANEL
   ============================================ */

.courses-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.courses-form {
  display: grid;
  gap: 12px;
}

.courses-form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.courses-form label {
  display: grid;
  gap: 4px;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
}

.courses-form input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 0.9375rem;
  font-family: inherit;
  transition: border var(--transition);
}

.courses-form input:focus {
  outline: none;
  border-color: var(--border-active);
}

.courses-gpa {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.courses-gpa__value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.courses-gpa__label {
  color: var(--text-tertiary);
  font-size: 0.8125rem;
  font-weight: 500;
}

.courses-gpa__details {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.courses-search {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg-base);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 0.8125rem;
  transition: border-color var(--transition);
  position: sticky;
  top: 0;
  z-index: 2;
  margin-bottom: 12px;
}

.courses-search:focus-visible {
  outline: none;
  border-color: var(--border-active);
}

.courses-list {
  display: grid;
  gap: 12px;
  width: 100%;
  min-width: 0;
}

.course-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color var(--transition);
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.course-card:hover {
  border-color: var(--border-hover);
}

.course-card__header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.course-card__info {
  flex: 1;
  min-width: 0;
}

.course-card__name {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 2px;
}

.course-card__meta {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.course-card__grade {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.course-card__grade-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.course-card__grade-value--na {
  color: var(--text-tertiary);
  font-size: 0.875rem;
}

.course-card__progress {
  width: 80px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.course-card__progress-bar {
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
  transition: width var(--transition);
}

.course-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 4px;
  border-top: 1px solid var(--border-subtle);
}

.course-card__actions .btn--sm {
  padding: 5px 12px;
  font-size: 0.75rem;
}

.course-card__actions .btn--ghost[data-action^="toggle-"][aria-pressed="true"],
.course-card__actions .btn--ghost[data-action^="toggle-"].is-active {
  color: var(--text-primary);
  background: var(--bg-active);
  border-color: var(--border-active);
  box-shadow: inset 0 0 0 1px rgba(35, 131, 226, 0.18);
}

.course-card__actions .btn--ghost[data-action^="toggle-"][aria-pressed="true"]:hover,
.course-card__actions .btn--ghost[data-action^="toggle-"].is-active:hover {
  color: var(--text-primary);
  background: rgba(35, 131, 226, 0.22);
  border-color: var(--border-active);
}

/* Course assignments drill-down */
.course-assignments {
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.course-assignments__loading,
.course-assignments__empty {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  padding: 6px 0;
  text-align: center;
}

.course-assignments__submitted-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-subtle);
}

.course-assignments__submitted-note {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.course-assignments__submitted-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.assignment-item {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--bg-secondary);
  transition: background var(--transition);
  width: 100%;
  min-width: 0;
}

.assignment-item:hover {
  background: var(--bg-hover);
}

.assignment-item__info[data-action="toggle-desc"] {
  cursor: pointer;
}

.assignment-item__detail {
  grid-column: 1 / -1;
  padding: 8px 0 4px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

.assignment-item__desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.7;
  word-break: break-word;
  max-height: 480px;
  overflow-y: auto;
}

.assignment-item__desc h1,
.assignment-item__desc h2,
.assignment-item__desc h3,
.assignment-item__desc h4,
.assignment-item__desc h5,
.assignment-item__desc h6 {
  color: var(--text-primary);
  font-weight: 700;
  margin: 14px 0 6px;
  font-size: 0.875rem;
}

.assignment-item__desc h1:first-child,
.assignment-item__desc h2:first-child,
.assignment-item__desc h3:first-child {
  margin-top: 0;
}

.assignment-item__desc p {
  margin: 0 0 10px;
}

.assignment-item__desc p:last-child {
  margin-bottom: 0;
}

.assignment-item__desc strong,
.assignment-item__desc b {
  color: var(--text-primary);
  font-weight: 600;
}

.assignment-item__desc ul,
.assignment-item__desc ol {
  margin: 6px 0 10px 20px;
  padding: 0;
}

.assignment-item__desc ul {
  list-style: disc;
}

.assignment-item__desc ol {
  list-style: decimal;
}

.assignment-item__desc li {
  margin-bottom: 4px;
}

.assignment-item__desc a {
  color: var(--accent);
  text-decoration: none;
}

.assignment-item__desc a:hover {
  text-decoration: underline;
}

.assignment-item__desc blockquote {
  border-left: 3px solid var(--border);
  margin: 8px 0;
  padding: 4px 12px;
  color: var(--text-tertiary);
}

.assignment-item__desc table {
  border-collapse: collapse;
  margin: 8px 0;
  font-size: 0.8125rem;
}

.assignment-item__desc th,
.assignment-item__desc td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: left;
}

.assignment-item__desc th {
  background: var(--bg-secondary);
  font-weight: 600;
  color: var(--text-primary);
}

.assignment-item__files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.assignment-item__file {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--text-primary);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 6px;
  text-decoration: none;
  transition: background var(--transition);
}

.assignment-item__file:hover {
  background: var(--bg-hover);
  color: var(--accent);
}

.assignment-item__link {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--accent);
}

.assignment-item--expanded {
  background: var(--bg-hover);
}

.assignment-item__info {
  flex: 1;
  min-width: 0;
}

.assignment-item__name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.assignment-item__meta {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.assignment-check {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.assignment-item--done .assignment-item__name {
  text-decoration: line-through;
  opacity: 0.5;
}

.assignment-item--done .assignment-item__meta {
  opacity: 0.5;
}

.assignment-item__right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
  min-width: 156px;
  align-self: center;
}

.assignment-status {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
  min-width: 74px;
  text-align: center;
}

.assignment-status--missing { background: rgba(239,68,68,0.15); color: #ef4444; }
.assignment-status--late { background: rgba(249,115,22,0.15); color: #f97316; }
.assignment-status--graded { background: rgba(139,92,246,0.15); color: #8b5cf6; }
.assignment-status--submitted { background: rgba(34,197,94,0.15); color: #22c55e; }
.assignment-status--upcoming { background: rgba(251,191,36,0.12); color: #f59e0b; }
.assignment-status--default { background: rgba(148,163,184,0.1); color: var(--text-tertiary); }

/* Teacher comment on assignment */
.assignment-comment {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 4px;
  padding: 4px 8px;
  background: var(--bg-overlay);
  border-radius: var(--radius);
  border-left: 2px solid var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  min-width: 0;
}
.assignment-comment__author {
  font-weight: 600;
  color: var(--text-primary);
}

/* Quiz items */
.quiz-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--bg-secondary);
  transition: background var(--transition);
}
.quiz-item:hover { background: var(--bg-hover); }
.quiz-item__info { flex: 1; min-width: 0; }
.quiz-item__name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.quiz-item__meta {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}
.quiz-item__right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Discussion items */
.discussion-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--bg-secondary);
  transition: background var(--transition);
}
.discussion-item:hover { background: var(--bg-hover); }
.discussion-item__info { flex: 1; min-width: 0; }
.discussion-item__title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.discussion-item__meta {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}
.discussion-item__right {
  flex-shrink: 0;
}
.course-quizzes, .course-discussions {
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.assignment-item .btn--xs {
  padding: 2px 8px;
  font-size: 0.6875rem;
}

/* Module files drill-down */
.course-files {
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.module-group-header {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 8px 2px 4px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

.module-group-header:first-child {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius);
  background: var(--bg-secondary);
  transition: background var(--transition);
}

.file-item:hover {
  background: var(--bg-hover);
}

.file-type-badge {
  font-size: 0.5625rem;
  font-weight: 800;
  padding: 3px 5px;
  border-radius: 4px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  min-width: 34px;
  text-align: center;
}

.file-type-badge--pdf  { background: rgba(239,68,68,0.15);  color: #ef4444; }
.file-type-badge--docx { background: rgba(59,130,246,0.15); color: #3b82f6; }
.file-type-badge--pptx { background: rgba(249,115,22,0.15); color: #f97316; }
.file-type-badge--txt  { background: rgba(100,116,139,0.15); color: #94a3b8; }

.file-item__info {
  flex: 1;
  min-width: 0;
}

.file-item__name {
  font-size: 0.875rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-item__actions {
  flex-shrink: 0;
}

/* ============================================
   NOTES PANEL
   ============================================ */

.notes-panel {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 16px;
  height: calc(100vh - 160px);
  min-height: 400px;
}

.notes-sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-right: 1px solid var(--border);
  padding-right: 16px;
}

.notes-sidebar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.notes-sidebar__actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.notes-sidebar__title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
}

.notes-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  flex: 1;
}

.notes-search {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg-base);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 0.8125rem;
  transition: border-color var(--transition);
}

.notes-search:focus-visible {
  outline: none;
  border-color: var(--border-active);
}

.notes-list__item {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}

.notes-list__item:hover {
  background: var(--bg-hover);
}

.notes-list__item.is-active {
  background: var(--bg-active);
}

.notes-list__item-title {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notes-list__item-date {
  font-size: 0.6875rem;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.notes-editor {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.notes-editor__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-tertiary);
  font-size: 0.75rem;
}

.notes-editor__textarea {
  flex: 1;
  min-height: 200px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 0.9375rem;
  font-family: inherit;
  line-height: 1.7;
  resize: vertical;
  transition: border var(--transition);
}

.notes-editor__textarea:focus {
  outline: none;
  border-color: var(--border-active);
}

.notes-editor__preview {
  flex: 1;
  min-height: 200px;
  padding: 14px;
  overflow-y: auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.9rem;
  line-height: 1.7;
}
.notes-editor__preview h1,
.notes-editor__preview h2,
.notes-editor__preview h3 { margin: 0.8em 0 0.4em; font-weight: 600; }
.notes-editor__preview code { background: var(--bg-tertiary); padding: 1px 5px; border-radius: 3px; font-size: 0.85em; }
.notes-editor__preview pre { background: var(--bg-tertiary); padding: 10px; border-radius: var(--radius); overflow-x: auto; }
.notes-editor__preview ul,
.notes-editor__preview ol { padding-left: 1.4em; }

.notes-editor__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

#notesSaveStatus.is-saving {
  color: var(--accent);
}

#notesSaveStatus.is-error {
  color: var(--danger);
}

.notes-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  font-size: 0.9375rem;
  padding: 40px;
}

/* ============================================
   AUTH PAGES
   ============================================ */

.auth-shell {
  min-height: calc(100vh - var(--nav-height));
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 140px;
  text-align: left;
}

.auth-card {
  max-width: 520px;
  width: min(100%, 520px);
  margin: 0 auto;
  padding: 38px;
  border-radius: var(--radius-xl);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.auth-title {
  font-size: clamp(1.75rem, 4vw, 2.4rem);
  margin: 18px 0 12px;
}

.auth-description {
  color: var(--text-tertiary);
  margin-bottom: 24px;
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  background: #fff;
  color: #3c4043;
  border: 1px solid #dadce0;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, box-shadow 0.15s;
  margin-bottom: 16px;
}
.btn-google:hover {
  background: #f8f9fa;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  color: var(--text-muted);
  font-size: 13px;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-tabs {
  display: inline-flex;
  gap: 4px;
  background: var(--bg-base);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 20px;
}

.auth-tab {
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.auth-tab.is-active {
  background: var(--bg-overlay);
  color: var(--text-primary);
}

.auth-form {
  display: none;
  gap: 16px;
}

.auth-form.is-active {
  display: grid;
}

.auth-field label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.875rem;
}

.auth-field input,
.auth-field select,
.auth-field textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg-base);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 0.9375rem;
  font-family: inherit;
  transition: border var(--transition);
}

.auth-field select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
  color-scheme: dark;
}

.auth-field select option {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.auth-field input:focus-visible,
.auth-field select:focus-visible,
.auth-field textarea:focus-visible {
  outline: none;
  border-color: var(--border-active);
}

.auth-field textarea {
  resize: vertical;
}

.auth-message {
  margin-bottom: 16px;
  min-height: 1.5rem;
  font-size: 0.9375rem;
}

.auth-message--error {
  color: var(--danger);
}

.auth-message--success {
  color: var(--success);
}

.dashboard-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ============================================
   NON-APP PAGE STYLES (hero, features grid, pricing, etc.)
   ============================================ */

.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 160px 0 100px;
  position: relative;
  overflow: hidden;
}

.hero--compact {
  min-height: 60vh;
  padding: 180px 0 100px;
}

.hero__background {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.hero__orb {
  display: none;
}

.hero__content {
  position: relative;
  z-index: 1;
  max-width: 900px;
}

.hero__title {
  margin-bottom: 28px;
}

.hero__subtitle {
  font-size: clamp(1.125rem, 2.5vw, 1.5rem);
  color: var(--text-tertiary);
  max-width: 700px;
  margin: 0 auto 48px;
  line-height: 1.8;
}

/* Feature Cards Grid */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.features-grid--two-col {
  grid-template-columns: repeat(2, 1fr);
}

.feature-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
  cursor: pointer;
}

.feature-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-overlay);
}

.feature-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.feature-card__icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 20px;
  position: relative;
  z-index: 1;
}

.feature-card__icon--cyan {
  background: rgba(35, 131, 226, 0.15);
}

.feature-card__icon--amber {
  background: rgba(203, 136, 37, 0.15);
}

.feature-card__icon--emerald {
  background: rgba(68, 172, 68, 0.15);
}

.feature-card__icon--rose {
  background: rgba(212, 76, 76, 0.15);
}

.feature-card__title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
}

.feature-card__description {
  color: var(--text-tertiary);
  line-height: 1.7;
  font-size: 0.9375rem;
  position: relative;
  z-index: 1;
}

.feature-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  position: relative;
  z-index: 1;
}

.feature-tag {
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--bg-base);
  color: var(--text-tertiary);
  border: 1px solid var(--border);
}

/* --- Pricing --- */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  align-items: start;
}

.pricing-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px 32px;
  position: relative;
  transition: all var(--transition);
}

.pricing-card:hover {
  border-color: var(--border-hover);
}

.pricing-card--featured {
  border-color: var(--accent);
}

.pricing-card__badge {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 20px;
  border-radius: 100px;
  background: var(--accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.pricing-card__name {
  font-size: 1.375rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.pricing-card__description {
  color: var(--text-tertiary);
  font-size: 0.9375rem;
  margin-bottom: 28px;
}

.pricing-card__price {
  margin-bottom: 32px;
}

.pricing-card__amount {
  font-size: 3.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}

.pricing-card__period {
  color: var(--text-tertiary);
  font-size: 1rem;
  font-weight: 500;
}

.pricing-card__features {
  margin-bottom: 32px;
}

.pricing-feature {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

.pricing-feature__icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.pricing-feature__icon--check {
  background: var(--success);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 900;
}

.pricing-feature__icon--cross {
  background: var(--bg-overlay);
  color: var(--text-tertiary);
  font-size: 0.75rem;
  opacity: 0.5;
}

.pricing-card .btn {
  width: 100%;
}

/* --- CTA Section --- */
.cta-section {
  text-align: center;
  position: relative;
  overflow: hidden;
}

.cta-section__content h2 {
  margin-bottom: 20px;
}

.cta-section__content p {
  font-size: 1.25rem;
  color: var(--text-tertiary);
  max-width: 600px;
  margin: 0 auto 48px;
}

/* --- Footer --- */
.footer {
  border-top: 1px solid var(--border);
  padding: 80px 0 40px;
  background: var(--bg-elevated);
}

.footer__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 60px;
  margin-bottom: 60px;
}

.footer__brand .navbar__logo {
  margin-bottom: 20px;
}

.footer__brand p {
  color: var(--text-tertiary);
  line-height: 1.8;
  max-width: 350px;
}

.footer__heading {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.footer__links {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.footer__link {
  color: var(--text-tertiary);
  font-size: 0.9375rem;
  text-decoration: none;
  transition: color var(--transition);
}

.footer__link:hover {
  color: var(--text-primary);
}

.footer__link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.footer__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 40px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 20px;
}

.footer__copyright {
  color: var(--text-tertiary);
  font-size: 0.875rem;
}

.footer__socials {
  display: flex;
  gap: 12px;
}

.footer__social {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--bg-base);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  transition: all var(--transition);
  text-decoration: none;
}

.footer__social:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.footer__social:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --- FAQ (pricing page) --- */
.faq-section {
  max-width: 800px;
  margin: 0 auto;
}

.faq-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 12px;
  overflow: hidden;
  transition: all var(--transition);
}

.faq-item.active {
  border-color: var(--accent);
}

.faq-item__question {
  width: 100%;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: color var(--transition);
}

.faq-item__question:hover {
  color: var(--accent);
}

.faq-item__question:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.faq-item__icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 700;
  transition: transform var(--transition);
}

.faq-item.active .faq-item__icon {
  transform: rotate(45deg);
  background: var(--accent);
  color: #fff;
}

.faq-item__answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.faq-item__answer-inner {
  padding: 0 24px 24px;
  color: var(--text-tertiary);
  font-size: 0.9375rem;
  line-height: 1.8;
}

.faq-item__answer a {
  color: var(--accent);
  text-decoration: underline;
}

.faq-item__answer a:hover {
  opacity: 0.8;
}

/* --- Comparison Table (pricing page) --- */
.comparison-table {
  width: 100%;
  border-collapse: collapse;
  margin: 48px 0;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.comparison-table th,
.comparison-table td {
  padding: 16px 20px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.comparison-table th {
  background: var(--bg-base);
  font-weight: 700;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
}

.comparison-table td {
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

.comparison-table tr:hover td {
  background: var(--bg-overlay);
}

.comparison-table .check {
  color: var(--success);
  font-weight: 900;
  font-size: 1rem;
}

.comparison-table .cross {
  color: var(--text-tertiary);
  opacity: 0.4;
}

.guarantee-box {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 28px 32px;
  border-radius: var(--radius-lg);
  background: rgba(68, 172, 68, 0.08);
  border: 1px solid rgba(68, 172, 68, 0.2);
  max-width: 600px;
  margin: 60px auto;
}

.guarantee-box__icon {
  font-size: 2.5rem;
  flex-shrink: 0;
}

.guarantee-box h4 {
  font-size: 1.125rem;
  color: var(--success);
  margin-bottom: 6px;
}

.guarantee-box p {
  font-size: 0.9375rem;
  color: var(--text-tertiary);
  line-height: 1.6;
}

/* --- Blog Page --- */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.blog-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
  text-decoration: none;
  display: block;
}

.blog-card:hover {
  border-color: var(--border-hover);
}

.blog-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.blog-card__image {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  border-bottom: 1px solid var(--border);
}

.blog-card__content {
  padding: 28px;
}

.blog-card__meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
  font-size: 0.8125rem;
  color: var(--text-tertiary);
}

.blog-card__category {
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.blog-card__date {
  display: flex;
  align-items: center;
  gap: 6px;
}

.blog-card__title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-primary);
  line-height: 1.3;
}

.blog-card__excerpt {
  color: var(--text-tertiary);
  line-height: 1.7;
  font-size: 0.9375rem;
  margin-bottom: 16px;
}

.blog-card__read-more {
  color: var(--accent);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9375rem;
}

/* ============================================
   SETTINGS PANEL
   ============================================ */

.settings-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Settings Overview Cards */
.settings-overview {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.settings-overview__card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color var(--transition);
  user-select: none;
}

.settings-overview__card:hover {
  border-color: var(--border-hover);
}

.settings-overview__card.is-active {
  background: rgba(99, 102, 241, 0.08);
  border-color: var(--accent);
}

.settings-overview__card.is-connected {
  border-color: var(--success);
}

.settings-overview__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-tertiary);
}

.settings-overview__card.is-connected .settings-overview__dot {
  background: var(--success);
  box-shadow: 0 0 6px rgba(68, 172, 68, 0.4);
}

.settings-overview__label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.settings-overview__status {
  font-size: 0.6875rem;
  color: var(--text-tertiary);
  margin-left: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Settings Tabs */
.settings-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
}

.settings-tab {
  padding: 8px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-tertiary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}

.settings-tab:hover {
  color: var(--text-secondary);
}

.settings-tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Settings Tab Panels */
.settings-tab-panel {
  display: none;
}

.settings-tab-panel.is-active {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Settings Subsection Titles (Telegram categories) */
.settings-subsection-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 12px 14px 0;
  margin: 0;
}

/* Override: telegram-advanced-settings as flat container (no longer <details>) */
.telegram-advanced-settings {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-base);
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

@media (max-width: 600px) {
  .settings-overview {
    grid-template-columns: repeat(2, 1fr);
  }
  .settings-tab {
    padding: 8px 10px;
    font-size: 0.8125rem;
  }
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.settings-section__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.settings-section__desc {
  color: var(--text-tertiary);
  font-size: 0.875rem;
  line-height: 1.6;
}

.settings-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-base);
  border: 1px solid var(--border);
}

.settings-status__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.settings-status--connected {
  background: var(--success);
  box-shadow: 0 0 6px rgba(68, 172, 68, 0.4);
}

.settings-status--disconnected {
  background: var(--text-tertiary);
}

.settings-status__text {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.settings-form {
  display: grid;
  gap: 14px;
}

.settings-hint {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  line-height: 1.5;
}

.telegram-offset-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.telegram-offset-preset {
  position: relative;
  cursor: pointer;
  user-select: none;
}

.telegram-offset-preset input[type='checkbox'] {
  position: absolute;
  opacity: 0;
  width: 0.5px;
  height: 0.5px;
  overflow: hidden;
  pointer-events: none;
}

.telegram-offset-preset span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  min-width: 56px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-base);
  color: var(--text-tertiary);
  font-size: 0.8125rem;
  font-weight: 600;
  transition: all var(--transition);
}

.telegram-offset-preset span:hover {
  border-color: var(--border-hover);
  color: var(--text-secondary);
}

.telegram-offset-preset input[type='checkbox']:checked + span {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(35, 131, 226, 0.14);
  box-shadow: inset 0 0 0 1px rgba(35, 131, 226, 0.35);
}

.telegram-offset-preset input[type='checkbox']:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.telegram-advanced-settings {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-base);
  margin-top: 4px;
}

/* Telegram advanced toggle button */
#telegramAdvancedToggle::before {
  content: '\25B6';
  display: inline-block;
  margin-right: 6px;
  font-size: 0.65em;
  transition: transform 0.15s ease;
}
#telegramAdvancedToggle.is-expanded::before {
  transform: rotate(90deg);
}

.telegram-advanced-body {
  display: grid;
  gap: 14px;
  padding: 0 14px 14px;
}

.telegram-toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.telegram-toggle-row input[type='checkbox'] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.telegram-toggle-row select {
  flex: 1;
  min-width: 80px;
}

.telegram-toggle-sep {
  color: var(--text-tertiary);
  font-size: 0.875rem;
}

.telegram-course-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
  padding: 4px 0;
}

.telegram-course-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.telegram-course-item input[type='checkbox'] {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
  cursor: pointer;
}

.telegram-test-types {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.telegram-test-types .settings-hint {
  margin: 0;
  font-size: 0.75rem;
}

.btn--xs {
  padding: 2px 8px;
  font-size: 0.6875rem;
  border-radius: 4px;
}

.settings-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

.settings-connected-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.settings-connected-info__user {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-primary);
}

.settings-connected-info__synced {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
}

/* ============================================
   CANVAS DATA SECTIONS
   ============================================ */

.canvas-data-section {
  margin-bottom: 16px;
}

.canvas-data-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.canvas-data-section__title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
}

.canvas-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(35, 131, 226, 0.12);
  color: var(--accent);
  border: 1px solid rgba(35, 131, 226, 0.25);
}

.course-card--canvas {
  border-left: 3px solid var(--accent);
}

/* ============================================
   CANVAS TODO CARDS
   ============================================ */
.canvas-todo-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.canvas-todo-card__course {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.canvas-todo-card__title {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
}
.canvas-todo-card__meta {
  font-size: 11px;
  color: var(--text-secondary);
}

/* ============================================
   CANVAS DASHBOARD (AI Assistant)
   ============================================ */

.canvas-dashboard {
  display: grid;
  gap: 16px;
  margin-bottom: 20px;
}

.canvas-dashboard__section {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.canvas-dashboard__heading {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-bottom: 10px;
}

.canvas-dashboard__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.canvas-dashboard__item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.canvas-dashboard__item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.canvas-dashboard__item-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
}

.canvas-dashboard__item-meta {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.canvas-dashboard__empty {
  color: var(--text-tertiary);
  font-size: 0.8125rem;
}

.canvas-dashboard__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.canvas-dashboard__stat {
  text-align: center;
  padding: 12px 8px;
  background: var(--bg-base);
  border-radius: var(--radius-md);
}

.canvas-dashboard__stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.canvas-dashboard__stat-label {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.fade-in-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.fade-in-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

.fade-in-scroll--delay-1 {
  transition-delay: 0.1s;
}

.fade-in-scroll--delay-2 {
  transition-delay: 0.2s;
}

.fade-in-scroll--delay-3 {
  transition-delay: 0.3s;
}

/* --- Utility Classes --- */
.text-center {
  text-align: center;
}

.mt-8 {
  margin-top: 32px;
}

.mt-12 {
  margin-top: 48px;
}

.mb-8 {
  margin-bottom: 32px;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.gap-4 {
  gap: 16px;
}

.gap-6 {
  gap: 24px;
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* Background for non-app pages — subtle dot grid */
body:not(.app-body)::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, var(--border) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.3;
}

/* Tablet: sidebar collapse to icon-only */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: var(--sidebar-collapsed);
  }

  .app__sidebar {
    width: var(--sidebar-collapsed);
    min-width: var(--sidebar-collapsed);
  }

  .sidebar-brand__text {
    display: none;
  }

  .sidebar-nav__label {
    display: none;
  }

  .sidebar-section-label {
    display: none;
  }

  .sidebar-nav__item {
    justify-content: center;
    padding: 10px;
  }

  .features-grid,
  .pricing-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

/* Mobile: hide sidebar, show bottom tab bar */
@media (max-width: 768px) {
  :root {
    --nav-height: 70px;
  }

  .container {
    padding: 0 20px;
  }

  .section {
    padding: 80px 0;
  }

  .section--compact {
    padding: 60px 0;
  }

  /* App shell adjustments */
  .app__sidebar {
    display: none;
  }

  .app__main {
    width: 100%;
  }

  .app__content {
    padding-bottom: var(--mobile-tabbar-height);
  }

  .topbar__sidebar-toggle {
    display: flex;
  }

  .mobile-tabbar {
    display: flex;
  }

  .mobile-drawer-overlay {
    display: block;
  }

  .mobile-drawer {
    display: block;
    visibility: hidden;
  }

  .mobile-drawer.is-open {
    visibility: visible;
  }

  .tool-panel__inner {
    padding: 20px 16px;
  }

  .chat-panel {
    max-width: none;
  }

  .format-panel {
    padding: 10px 0;
  }

  .format-converter {
    padding: 12px;
    border-radius: 14px;
  }

  .chat-messages {
    padding: 18px 14px;
    gap: 16px;
  }

  .chat-msg {
    max-width: 92%;
  }

  .chat-input-row {
    gap: 6px;
    padding: 10px 12px 12px;
  }

  /* Notes panel responsive */
  .notes-panel {
    grid-template-columns: 1fr;
    gap: 12px;
    min-height: auto;
  }

  .notes-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding-right: 0;
    padding-bottom: 12px;
    max-height: 200px;
    overflow-y: auto;
  }

  /* Courses form responsive */
  .courses-form__row {
    grid-template-columns: 1fr;
  }

  .assignment-item {
    grid-template-columns: 16px minmax(0, 1fr);
  }

  .assignment-item__right {
    grid-column: 2;
    min-width: 0;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  /* Chat input: stack fill button behind attach or smaller */
  .chat-input-row {
    flex-wrap: wrap;
  }

  .fill-btn-wrap {
    order: -1;
    width: 100%;
    display: flex;
  }

  .chat-fill-btn {
    flex: 1;
    font-size: 0.75rem;
    padding: 6px 8px;
  }

  /* Attachment chips: smaller on mobile */
  .chat-attachment-chip {
    max-width: 150px;
    padding: 3px 6px 3px 8px;
  }

  .chat-attachment-chip__thumb {
    width: 28px;
    height: 28px;
  }

  /* Dashboard stats: horizontal scroll strip */
  .dash__stats {
    display: flex;
    overflow-x: auto;
    gap: 10px;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    padding-bottom: 4px;
  }

  .dash__stats .dash__card {
    min-width: 155px;
    flex-shrink: 0;
    scroll-snap-align: start;
  }

  .dash__card-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: calc(100% - 36px);
  }

  .dash__card-icon {
    width: 28px;
    height: 28px;
  }

  /* Settings tabs: horizontal scroll for 5+ tabs */
  .settings-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .settings-tab {
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* Touch targets: min 44px for small buttons */
  .btn--sm {
    min-height: 44px;
  }

  /* Safe area insets for notch/dynamic island */
  .app__topbar {
    padding-top: env(safe-area-inset-top, 0);
  }

  .mobile-tabbar {
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .chat-input-row {
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0));
  }

  /* Non-app page nav */
  .navbar__nav {
    display: none;
  }

  .navbar__hamburger {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
  }

  .navbar__hamburger span {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all var(--transition);
  }

  .navbar__hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
  }

  .navbar__hamburger.active span:nth-child(2) {
    opacity: 0;
  }

  .navbar__hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
  }

  .mobile-menu {
    display: none;
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-elevated);
    z-index: 999;
    padding: 40px max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
    flex-direction: column;
    gap: 24px;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .mobile-menu.open {
    display: flex;
  }

  .mobile-menu a {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    transition: color var(--transition);
  }

  .mobile-menu a:hover {
    color: var(--text-primary);
  }

  .features-grid,
  .pricing-grid,
  .blog-grid {
    grid-template-columns: 1fr;
  }

  .features-grid--two-col {
    grid-template-columns: 1fr;
  }

  .footer__grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .guarantee-box {
    flex-direction: column;
    text-align: center;
    padding: 24px;
  }

  .comparison-table {
    font-size: 0.875rem;
  }

  .comparison-table th,
  .comparison-table td {
    padding: 12px 10px;
  }

  /* --- Topbar: compact on mobile --- */
  .app__topbar {
    padding: 0 12px;
    gap: 8px;
  }

  .topbar__chat-actions {
    gap: 4px;
    padding-left: 8px;
  }

  .topbar__chat-actions .btn__label {
    display: none;
  }

  .topbar__chat-actions .btn__icon {
    display: inline;
  }

  .topbar__chat-actions .btn--sm {
    padding: 6px 10px;
    min-height: 36px;
    min-width: 36px;
    justify-content: center;
  }

  /* --- Chat history dropdown: prevent overflow --- */
  .chat-history-dropdown {
    width: calc(100vw - 24px);
    max-width: 320px;
    right: -12px;
  }

  /* --- Avatar dropdown: prevent overflow --- */
  .avatar-dropdown {
    min-width: 180px;
    right: -4px;
  }

  /* --- Toast: position above mobile tabbar --- */
  .toast-container {
    bottom: calc(var(--mobile-tabbar-height) + 12px + env(safe-area-inset-bottom, 0px));
    right: 12px;
    left: 12px;
  }

  .toast {
    min-width: 0;
    max-width: none;
    width: 100%;
  }

  /* --- Hide scrollbars on horizontal scroll areas --- */
  .dash__stats {
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .dash__stats::-webkit-scrollbar {
    display: none;
  }

  .settings-tabs {
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .settings-tabs::-webkit-scrollbar {
    display: none;
  }

  /* --- Connect banner: full-width button --- */
  .dash__connect-banner .btn {
    width: 100%;
    text-align: center;
    justify-content: center;
  }
}

/* --- Mobile sidebar overlay (toggled by JS) --- */
.app__sidebar.is-open {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 240px;
  min-width: 240px;
  z-index: 200;
  display: flex;
  box-shadow: var(--shadow-lg);
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 199;
}

.sidebar-overlay[hidden] {
  display: none;
}

/* Offline banner */
.offline-banner {
  padding: 8px 16px;
  background: var(--bg-overlay);
  border: 1px solid var(--warning);
  border-radius: var(--radius-md);
  color: var(--warning);
  font-size: 0.8rem;
  text-align: center;
  margin-bottom: 16px;
}

/* --- Accessibility: Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  html {
    scroll-behavior: auto;
  }
}

/* Feature section layout (for features page / other pages) */
.feature-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: center;
  margin-bottom: 140px;
}

.feature-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.feature-list__item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
  color: var(--text-secondary);
}

.feature-list__check {
  color: var(--success);
  font-weight: 700;
  flex-shrink: 0;
}

.feature-section__description {
  font-size: 1rem;
  color: var(--text-tertiary);
  line-height: 1.7;
  margin-bottom: 20px;
}

@media (max-width: 768px) {
  .feature-section {
    grid-template-columns: 1fr;
    gap: 40px;
    margin-bottom: 80px;
  }
}

/* Dashboard shell for standalone dashboard.html (backwards compat) */
.dashboard-shell-wrap {
  min-height: calc(100vh - var(--nav-height));
  padding-top: 140px;
}

.dashboard-shell {
  margin: 0 auto;
  max-width: 980px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
}

.dashboard-shell__header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-end;
  margin-bottom: 28px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.metric-card {
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.metric-card__label {
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.metric-card__value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
}

.dashboard-section h2 {
  margin-bottom: 14px;
}

.dashboard-section__description {
  color: var(--text-tertiary);
  margin-bottom: 16px;
}

.profile-form {
  display: grid;
  gap: 16px;
  margin-bottom: 28px;
}

.dashboard-feature-list {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.dashboard-feature-list li {
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: var(--text-secondary);
}

#mobileSignOut {
  margin-top: 24px;
  text-align: center;
}

@media (max-width: 768px) {
  .dashboard-shell__header {
    flex-direction: column;
    align-items: flex-start;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }
}
/* ============================================
   Onboarding Wizard
   ============================================ */

.onboarding-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 24px;
}

.onboarding-overlay[hidden] {
  display: none;
}

.onboarding-step[hidden] {
  display: none !important;
}

/* Canvas token guide */
.token-guide {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.token-guide[hidden] {
  display: none;
}

.token-guide__link {
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
}

.token-guide__link:hover {
  text-decoration: underline;
}

.token-guide__steps {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.token-guide__steps li {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.onboarding-wizard {
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 440px;
  overflow: hidden;
}

.onboarding-progress {
  height: 3px;
  background: var(--border-subtle);
}

.onboarding-progress__bar {
  height: 100%;
  background: var(--accent);
  transition: width 0.35s ease;
  width: 33%;
}

.onboarding-step {
  padding: 40px 36px 36px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.onboarding-step__icon {
  width: 48px;
  height: 48px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin-bottom: 4px;
}

.onboarding-step__icon--done {
  background: var(--success);
}

.onboarding-step__title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.onboarding-step__desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

.onboarding-hint {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  line-height: 1.6;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
}

.onboarding-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 4px;
}

.onboarding-step__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

@media (max-width: 480px) {
  .onboarding-step {
    padding: 28px 24px 24px;
  }
}

/* ============================================
   ANNOUNCEMENTS
   ============================================ */

.empty-state {
  color: var(--text-tertiary);
  font-size: 0.875rem;
  padding: 8px 0;
  margin: 0;
}

.announcements-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.announcements-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.announcement-summary {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 12px;
}

.announcement-summary__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.announcement-summary__title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary);
}

.announcement-summary__status {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.announcement-summary__content {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.announcement-summary__content h2,
.announcement-summary__content h3,
.announcement-summary__content h4 {
  color: var(--text-primary);
  font-weight: 700;
  margin: 16px 0 6px;
  font-size: 0.875rem;
}

.announcement-summary__content h2:first-child,
.announcement-summary__content h3:first-child,
.announcement-summary__content h4:first-child {
  margin-top: 0;
}

.announcement-summary__content strong {
  color: var(--text-primary);
}

.announcement-summary__content p {
  margin: 0 0 8px;
}

.announcement-summary__content p:last-child {
  margin-bottom: 0;
}

.announcement-summary__content ul,
.announcement-summary__content ol {
  margin: 6px 0 10px 18px;
  list-style: disc;
}

.announcement-summary__content ol {
  list-style: decimal;
}

.announcement-summary__content li {
  margin-bottom: 4px;
}

.announcement-summary__content li:last-child {
  margin-bottom: 0;
}

.announcement-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  transition: border-color var(--transition);
}

.announcement-card:hover {
  border-color: var(--border-hover);
}

.announcement-card__course {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.announcement-card__date {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.announcement-card__title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.announcement-card__body {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.5;
}


/* Assignment Detail Modal */
.assignment-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.assignment-modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  max-width: 520px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
}

.assignment-modal__close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.assignment-modal__close:hover {
  color: var(--text-primary);
}

.assignment-modal__content {
  padding: 28px 24px;
}

.assignment-modal__course {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 8px;
}

.assignment-modal__title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  line-height: 1.3;
}

.assignment-modal__meta {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.assignment-modal__desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 20px;
  padding: 12px;
  background: var(--bg-base);
  border-radius: var(--radius-md);
  max-height: 200px;
  overflow-y: auto;
}

.assignment-modal__actions {
  display: flex;
  gap: 8px;
}

/* ==========================================================================
   Command Palette
   ========================================================================== */

.cmd-palette-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
}

.cmd-palette-overlay.is-open {
  display: flex;
}

.cmd-palette-modal {
  width: 100%;
  max-width: 500px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.cmd-palette-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
}

.cmd-palette-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.9375rem;
  font-family: inherit;
  padding: 14px 0;
  caret-color: var(--accent);
}

.cmd-palette-input::placeholder {
  color: var(--text-secondary);
}

.cmd-palette-shortcut-hint {
  font-size: 0.6875rem;
  color: var(--text-secondary);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: ui-monospace, 'SF Mono', 'Cascadia Code', monospace;
  white-space: nowrap;
  flex-shrink: 0;
}

.cmd-palette-results {
  list-style: none;
  margin: 0;
  padding: 4px 0;
  max-height: 320px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.cmd-palette-results:empty {
  display: none;
}

.cmd-palette-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background var(--transition);
  border-radius: 0;
}

.cmd-palette-item:hover,
.cmd-palette-item.is-selected {
  background: var(--bg-hover);
}

.cmd-palette-item__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
  letter-spacing: 0;
}

.cmd-palette-item__label {
  font-size: 0.875rem;
  color: var(--text-primary);
  flex: 1;
}

.cmd-palette-empty {
  padding: 20px 16px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  text-align: center;
}

/* Topbar hint button */
.cmd-palette-topbar-btn {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cmd-palette-topbar-btn__label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.cmd-palette-topbar-btn__kbd {
  font-size: 0.6875rem;
  color: var(--text-secondary);
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: ui-monospace, 'SF Mono', 'Cascadia Code', monospace;
}

@media (max-width: 600px) {
  .cmd-palette-topbar-btn {
    display: none;
  }

  .cmd-palette-overlay {
    padding-top: 10vh;
    padding-left: 12px;
    padding-right: 12px;
  }
}

/* ============================================
   SKELETON LOADING
   ============================================ */

@keyframes skeleton-pulse {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  border-radius: var(--radius-md);
  background: linear-gradient(
    90deg,
    var(--bg-elevated) 25%,
    var(--bg-hover) 50%,
    var(--bg-elevated) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.skeleton-text {
  height: 14px;
  width: 65%;
  border-radius: var(--radius-sm);
  background: linear-gradient(
    90deg,
    var(--bg-elevated) 25%,
    var(--bg-hover) 50%,
    var(--bg-elevated) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.skeleton-card {
  width: 100%;
  height: 80px;
  border-radius: var(--radius-md);
  background: linear-gradient(
    90deg,
    var(--bg-elevated) 25%,
    var(--bg-hover) 50%,
    var(--bg-elevated) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.skeleton-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  background: linear-gradient(
    90deg,
    var(--bg-elevated) 25%,
    var(--bg-hover) 50%,
    var(--bg-elevated) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

/* ============================================
   PANEL TRANSITIONS
   ============================================ */

@keyframes panel-fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tool-panel.is-active {
  animation: panel-fade-in 0.15s ease-out both;
}

/* ============================================
   BUTTON & NAV MICRO-INTERACTIONS
   ============================================ */

.btn:active {
  transform: scale(0.97);
}

.sidebar-nav__item:active {
  transform: scale(0.97);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

@keyframes toast-slide-in {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toast-fade-out {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(16px);
  }
}

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 240px;
  max-width: 360px;
  padding: 12px 16px;
  background: var(--bg-overlay);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--accent);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  color: var(--text-primary);
  line-height: 1.4;
  animation: toast-slide-in 0.2s ease-out both;
}

.toast--success {
  border-left-color: var(--success);
}

.toast--error {
  border-left-color: var(--danger);
}

.toast--info {
  border-left-color: var(--accent);
}

.toast--warning {
  border-left-color: var(--warning);
}

.toast.is-hiding {
  animation: toast-fade-out 0.2s ease-out both;
}

/* ===== Dashboard Enhancements (worker-4) ===== */

/* Grade Sparklines */
.dash__grade-sparkline {
  flex-shrink: 0;
  opacity: 0.85;
  margin: 0 8px;
}

/* Assignment Status Dots */
.assignment-status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  flex-shrink: 0;
}

.assignment-status-dot--submitted {
  background: var(--success);
}

.assignment-status-dot--overdue {
  background: var(--danger);
}

.assignment-status-dot--pending {
  background: var(--text-muted, #555);
}

/* Today's Focus Priority Borders — handled by .dash__focus-bar inside each item */

/* Weekly Progress Card */
.dash__card-icon--week {
  background: rgba(35, 131, 226, 0.12);
  color: var(--accent);
}

.dash__week-progress {
  margin-top: 8px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.dash__week-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.4s ease;
  min-width: 0%;
  max-width: 100%;
}

/* ============================================
   CALENDAR PANEL
   ============================================ */

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.calendar-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.calendar-month-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 180px;
  text-align: center;
}

.calendar-actions {
  display: flex;
  gap: 6px;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.calendar-week-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.calendar-day {
  background: var(--bg-base);
  min-height: 90px;
  padding: 6px;
  position: relative;
  cursor: default;
}

.calendar-week-cell {
  min-height: 200px;
}

.calendar-day.is-other-month {
  opacity: 0.35;
}

.calendar-day.is-today .calendar-day__num {
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.calendar-day__num {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.calendar-pill {
  font-size: 0.625rem;
  color: #fff;
  padding: 1px 5px;
  border-radius: 3px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  line-height: 1.5;
}

.calendar-pill:hover {
  opacity: 0.85;
}

.calendar-more {
  font-size: 0.625rem;
  color: var(--text-secondary);
  padding: 1px 5px;
}

.calendar-popover {
  position: absolute;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  min-width: 200px;
  max-width: 280px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  z-index: 100;
}

.calendar-empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

@media (max-width: 768px) {
  .calendar-day {
    min-height: 60px;
    padding: 3px;
  }
  .calendar-day__num {
    font-size: 0.6875rem;
  }
  .calendar-pill {
    font-size: 0.5625rem;
    padding: 1px 3px;
  }
  .calendar-month-title {
    font-size: 0.9375rem;
    min-width: 140px;
  }
  .calendar-week-cell {
    min-height: 120px;
  }
}

@media (max-width: 480px) {
  .calendar-day {
    min-height: 44px;
    padding: 2px;
  }
  .calendar-pill {
    font-size: 0.5rem;
  }
}

/* ============================================
   GRADE WHAT-IF CALCULATOR
   ============================================ */

.grade-calc-summary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 16px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 12px;
}

.grade-calc-current,
.grade-calc-projected {
  text-align: center;
}

.grade-calc-label {
  display: block;
  font-size: 0.6875rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.grade-calc-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.grade-calc-value--accent {
  color: var(--accent);
}

.grade-calc-arrow {
  font-size: 1.25rem;
  color: var(--text-secondary);
}

.grade-calc-group {
  margin-bottom: 16px;
}

.grade-calc-group__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}

.grade-calc-group__name {
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--text-primary);
}

.grade-calc-group__weight {
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: var(--bg-base);
  padding: 2px 8px;
  border-radius: 4px;
}

.grade-calc-row {
  display: grid;
  grid-template-columns: 1fr auto 72px;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 0.8125rem;
}

.grade-calc-row__name {
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.grade-calc-row__score {
  color: var(--text-secondary);
  font-size: 0.75rem;
  min-width: 60px;
  text-align: right;
}

.grade-calc-row__input {
  width: 72px;
  padding: 4px 6px;
  font-size: 0.75rem;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-primary);
  text-align: center;
}

.grade-calc-row__input:focus {
  border-color: var(--accent);
  outline: none;
}

.grade-calc-row__input::placeholder {
  color: var(--text-muted, #555);
}

@media (max-width: 480px) {
  .grade-calc-row {
    grid-template-columns: 1fr 56px;
  }
  .grade-calc-row__score {
    display: none;
  }
  .grade-calc-row__input {
    width: 56px;
  }
}

/* ============================================
   DEADLINE COUNTDOWN STRIP
   ============================================ */
.dash__countdown-strip {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.dash__countdown-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.dash__countdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
}
.dash__countdown-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.dash__countdown-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash__countdown-course {
  font-size: 11px;
  color: var(--text-tertiary);
}
.dash__countdown-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 100px;
  white-space: nowrap;
  flex-shrink: 0;
}
.dash__countdown-badge--danger { background: rgba(212, 76, 71, 0.15); color: #D44C47; }
.dash__countdown-badge--warn   { background: rgba(203, 145, 47, 0.15); color: #CB912F; }
.dash__countdown-badge--ok     { background: rgba(68, 131, 97, 0.15);  color: #448361; }

/* ============================================
   GRADE TREND CHART
   ============================================ */
.dash__section--trend {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.dash__trend-chart-wrap {
  margin-top: 12px;
  position: relative;
  height: 180px;
}
.dash__trend-chart-wrap canvas {
  width: 100% !important;
}

/* ============================================
   ASSIGNMENT FILTER BUTTONS
   ============================================ */
.dash__assignment-filters {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.dash__filter-btn {
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}
.dash__filter-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}
.dash__filter-btn.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ============================================
   COURSE FILES
   ============================================ */
.courses-toolbar {
  display: flex;
  justify-content: flex-end;
  padding: 0 0 10px;
}
.course-download-btn {
  font-size: 11px;
}
.course-files-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.course-file-link {
  font-size: 11px;
  color: var(--accent);
  text-decoration: none;
  background: var(--bg-secondary);
  padding: 3px 8px;
  border-radius: var(--radius);
  white-space: nowrap;
  overflow: hidden;
  max-width: 180px;
  text-overflow: ellipsis;
  display: block;
}
.course-file-link:hover { text-decoration: underline; }

/* ============================================
   STUDY TIMER WIDGET
   ============================================ */
.dash__study-widget {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.dash__study-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding-top: 12px;
}
.dash__study-display {
  font-size: 42px;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  line-height: 1;
}
.dash__study-controls {
  display: flex;
  gap: 8px;
}
.dash__study-history {
  font-size: 12px;
  color: var(--text-tertiary);
  min-height: 16px;
}

/* ============================================
   COURSE RATINGS & NOTES
   ============================================ */
.course-meta-user {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.course-rating {
  display: flex;
  gap: 4px;
}
.course-rating__dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid var(--text-tertiary);
  background: transparent;
  cursor: pointer;
  transition: all 0.15s;
  padding: 0;
}
.course-rating__dot.is-filled {
  background: var(--accent);
  border-color: var(--accent);
}
.course-rating__dot:hover {
  border-color: var(--accent);
}
.course-note {
  font-size: 12px;
  color: var(--text-primary);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 8px;
  resize: none;
  font-family: inherit;
  transition: border-color 0.15s;
}
.course-note:focus {
  outline: none;
  border-color: var(--accent);
}

/* ============================================
   LOADING SKELETONS
   ============================================ */
@keyframes skeleton-shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}
.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.06) 50%,
    transparent 100%
  );
  background-size: 800px 100%;
  animation: skeleton-shimmer 1.5s infinite linear;
}
.skeleton-line {
  height: 14px;
  margin-bottom: 8px;
  border-radius: 4px;
}
.skeleton-line--short { width: 40%; }
.skeleton-line--medium { width: 65%; }
.skeleton-line--full   { width: 100%; }
.skeleton-block {
  width: 100%;
  height: 60px;
  border-radius: var(--radius);
}

/* ============================================
   ERROR STATE CARDS
   ============================================ */
.error-state-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(212, 76, 71, 0.07);
  border: 1px solid rgba(212, 76, 71, 0.25);
  border-left: 3px solid #D44C47;
  border-radius: var(--radius);
  margin-top: 8px;
}
.error-state-card__msg {
  font-size: 13px;
  color: var(--text-secondary);
  flex: 1;
}
.error-state-card__retry {
  flex-shrink: 0;
}

/* ============================================
   RESPONSIVE — MOBILE
   ============================================ */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    width: 100%;
    height: auto;
    flex-direction: row;
    padding: 6px 8px;
    border-right: none;
    border-top: 1px solid var(--border);
    z-index: 200;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .sidebar__nav {
    flex-direction: row;
    flex: 1;
    gap: 4px;
  }
  .sidebar__item {
    flex-direction: column;
    padding: 6px 8px;
    min-width: 48px;
    text-align: center;
    font-size: 10px;
    gap: 2px;
  }
  .sidebar__icon {
    width: 28px;
    height: 28px;
    font-size: 10px;
  }
  .sidebar__label {
    display: none;
  }
  .main-content {
    margin-left: 0;
    margin-bottom: 64px;
    padding-bottom: 16px;
  }
  .dash__stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .dash__row {
    flex-direction: column;
  }
  .format-converter__grid {
    grid-template-columns: 1fr;
  }
  .calendar-grid {
    font-size: 11px;
  }
  .chat-panel,
  .chat-container {
    padding: 8px;
  }
}

@media (max-width: 480px) {
  .dash__stats {
    grid-template-columns: 1fr 1fr;
  }
  .dash__card-value {
    font-size: 24px;
  }
  .dash__study-display {
    font-size: 32px;
  }
  .dash__countdown-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}

/* ============================================
   Statistics Panel
   ============================================ */
.stats-panel {
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* --- Entrance animation --- */
@keyframes statsFadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.stats-fadein {
  opacity: 0;
  animation: statsFadeUp 0.4s ease-out forwards;
  animation-delay: calc(var(--delay, 0) * 0.07s);
}

@media (prefers-reduced-motion: reduce) {
  .stats-fadein { animation: none; opacity: 1; }
}

/* --- Shimmer skeleton loading --- */
@keyframes statsShimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.stats-skeleton { display: flex; flex-direction: column; gap: 20px; }

.stats-kpi--skeleton,
.stats-card--skeleton {
  overflow: hidden;
  pointer-events: none;
}

.skeleton-line,
.skeleton-rect {
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--bg-overlay) 25%, rgba(255,255,255,0.06) 50%, var(--bg-overlay) 75%);
  background-size: 800px 100%;
  animation: statsShimmer 1.6s ease-in-out infinite;
}

.skeleton-line--sm { height: 10px; width: 60%; margin-bottom: 10px; }
.skeleton-line--lg { height: 24px; width: 40%; }
.skeleton-rect     { height: 180px; width: 100%; border-radius: var(--radius-md); }

/* --- Empty / Error State --- */
.stats-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 24px;
  gap: 12px;
}

.stats-empty__icon {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-overlay);
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.stats-empty__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.stats-empty__desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin: 0;
  max-width: 320px;
  line-height: 1.5;
}

/* --- KPI Summary Strip --- */
.stats-kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.stats-kpi {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.stats-kpi::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px;
  height: 100%;
  border-radius: 3px 0 0 3px;
}

.stats-kpi--emerald::before { background: var(--accent-emerald); }
.stats-kpi--blue::before    { background: var(--accent); }
.stats-kpi--amber::before   { background: var(--accent-amber); }
.stats-kpi--cyan::before    { background: var(--accent-cyan); }

.stats-kpi:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
}

.stats-kpi__icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  margin-bottom: 2px;
}

.stats-kpi--emerald .stats-kpi__icon { background: rgba(52,211,153,0.12); color: var(--accent-emerald); }
.stats-kpi--blue .stats-kpi__icon    { background: rgba(35,131,226,0.12); color: var(--accent); }
.stats-kpi--amber .stats-kpi__icon   { background: rgba(245,158,11,0.12); color: var(--accent-amber); }
.stats-kpi--cyan .stats-kpi__icon    { background: rgba(34,211,238,0.12); color: var(--accent-cyan); }

.stats-kpi__label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
}

.stats-kpi__value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

/* --- Chart Grid --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.stats-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.stats-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
}

.stats-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.stats-card__title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0;
}

.stats-card__subtitle {
  font-size: 0.6875rem;
  color: var(--text-tertiary);
}

.stats-card__badge {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  line-height: 1.4;
}

.stats-card__badge--green {
  background: rgba(52, 211, 153, 0.15);
  color: var(--accent-emerald);
}

.stats-card__badge--blue {
  background: rgba(35, 131, 226, 0.15);
  color: var(--accent);
}

.stats-card__badge--amber {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
}

.stats-card__badge--rose {
  background: rgba(251, 113, 133, 0.15);
  color: var(--accent-rose);
}

.stats-card__chart {
  flex: 1;
  position: relative;
  min-height: 200px;
}

.stats-card__chart canvas {
  width: 100% !important;
  max-height: 240px;
}

/* Completion card: doughnut centered */
.stats-card--completion .stats-card__chart {
  display: flex;
  align-items: center;
  justify-content: center;
}

.stats-card--completion .stats-card__chart canvas {
  max-width: 220px;
  max-height: 220px;
}

/* --- Stats responsive --- */
@media (max-width: 768px) {
  .stats-kpi-strip {
    grid-template-columns: repeat(2, 1fr);
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .stats-card__chart canvas {
    max-height: 200px;
  }
}

@media (max-width: 480px) {
  .stats-kpi-strip {
    grid-template-columns: 1fr;
  }
  .stats-panel {
    padding: 16px;
  }
}

/* ============================================
   Note Assignment Badge & Link Bar
   ============================================ */
.note-assignment-badge {
  display: inline-block;
  background: rgba(35, 131, 226, 0.15);
  color: var(--accent);
  font-size: 0.6875rem;
  padding: 2px 7px;
  border-radius: 10px;
  margin-top: 3px;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

.notes-editor__link-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-overlay);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.notes-link-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.notes-link-select {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 6px;
  font-size: 0.75rem;
  max-width: 260px;
  cursor: pointer;
}

.notes-link-select:focus {
  outline: none;
  border-color: var(--accent);
}

/* Dashboard Note Badge */
.dash__badge--note {
  background: rgba(52, 211, 153, 0.12);
  color: var(--accent-emerald);
  border: 1px solid rgba(52, 211, 153, 0.25);
  font-size: 0.6875rem;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
  transition: background 0.15s;
}

.dash__badge--note:hover {
  background: rgba(52, 211, 153, 0.22);
}

/* Study Plan Button */
#dashStudyPlanBtn {
  font-size: 0.75rem;
}

/* Assignment item Note button */
.assignment-item__right .btn--xs {
  font-size: 0.6875rem;
  padding: 2px 8px;
}

/* ============================================================
   FEATURE A — Command Palette: Category Badge
   ============================================================ */

.cmd-palette-item__category {
  margin-left: auto;
  font-size: 0.6875rem;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255,255,255,0.07);
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ============================================================
   FEATURE C — Kanban Board
   ============================================================ */

.dash__section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.dash__section-header .dash__section-title {
  margin-bottom: 0;
}

.dash__view-toggle {
  display: flex;
  gap: 2px;
  background: var(--bg-secondary);
  border-radius: 6px;
  padding: 2px;
}

.dash__view-btn {
  padding: 3px 10px;
  font-size: 0.75rem;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.dash__view-btn.is-active {
  background: var(--bg-card);
  color: var(--text-primary);
}

.dash__view-btn:hover:not(.is-active) {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.dash__kanban {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 8px;
}

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

.kanban-col {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 8px;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kanban-col__header {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 2px 4px 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 2px;
}

.kanban-col__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: rgba(255,255,255,0.08);
  border-radius: 9px;
  font-size: 0.6875rem;
  font-weight: 500;
}

.kanban-col__cards {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  transition: background 0.15s;
  border-radius: 6px;
  min-height: 40px;
  padding: 2px;
}

.kanban-col--dragover > .kanban-col__cards,
.kanban-col__cards.kanban-col--dragover {
  background: rgba(99, 102, 241, 0.08);
  outline: 2px dashed rgba(99, 102, 241, 0.4);
  outline-offset: -2px;
}

.kanban-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
  user-select: none;
}

.kanban-card:hover {
  background: var(--bg-hover);
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.kanban-card--dragging {
  opacity: 0.5;
  transform: scale(0.97);
}

.kanban-card__title {
  font-size: 0.8125rem;
  color: var(--text-primary);
  font-weight: 500;
  line-height: 1.35;
  margin-bottom: 4px;
}

.kanban-card__meta {
  font-size: 0.6875rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.kanban-card__badge {
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.625rem;
  font-weight: 600;
}

.kanban-card__badge--due {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.kanban-card__badge--soon {
  background: rgba(234, 179, 8, 0.15);
  color: #fbbf24;
}

.kanban-card__badge--ok {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
}

/* ============================================================
   FEATURE D — Grade Weight Calculator
   ============================================================ */

.course-grades {
  padding: 0;
}

.grade-breakdown {
  padding: 12px 0 4px;
}

.grade-breakdown__loading,
.grade-breakdown__empty {
  padding: 12px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.grade-breakdown__groups {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.grade-breakdown__row {
  display: grid;
  grid-template-columns: 1fr 100px 52px;
  gap: 10px;
  align-items: center;
  padding: 4px 0;
}

.grade-breakdown__group-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.grade-breakdown__group-name {
  font-size: 0.8125rem;
  color: var(--text-primary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.grade-breakdown__group-meta {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.grade-breakdown__bar-wrap {
  height: 6px;
  background: rgba(255,255,255,0.07);
  border-radius: 3px;
  overflow: hidden;
}

.grade-breakdown__bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
  min-width: 2px;
}

.grade-breakdown__bar--high { background: #4ade80; }
.grade-breakdown__bar--mid  { background: #60a5fa; }
.grade-breakdown__bar--low  { background: #fbbf24; }
.grade-breakdown__bar--ok   { background: var(--text-muted); }

.grade-breakdown__pct {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: right;
}

.grade-breakdown__total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid var(--border-color);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.grade-breakdown__total strong {
  font-size: 1rem;
  color: var(--text-primary);
}

.grade-breakdown__calc {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 4px;
}

.grade-breakdown__calc-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.grade-breakdown__calc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.grade-breakdown__calc-row label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  flex: 1;
}

.grade-breakdown__calc-input {
  width: 80px;
  padding: 4px 8px;
  background: var(--bg-input, var(--bg-card));
  border: 1px solid var(--border-color);
  border-radius: 5px;
  color: var(--text-primary);
  font-size: 0.8125rem;
  text-align: right;
}

.grade-breakdown__calc-input:focus {
  outline: none;
  border-color: var(--accent-color, #6366f1);
}

.grade-breakdown__calc-result {
  margin-top: 8px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  padding: 6px 8px;
  background: rgba(255,255,255,0.04);
  border-radius: 5px;
  line-height: 1.4;
}

.grade-breakdown__calc-result strong {
  color: var(--text-primary);
}

/* ============================================================
   FEATURE I — Flashcard Generator
   ============================================================ */

.flashcard-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.flashcard-modal {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  width: 100%;
  max-width: 540px;
  overflow: hidden;
}

.flashcard-modal__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
}

.flashcard-modal__title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.flashcard-modal__progress {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.flashcard-modal__close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
}

.flashcard-modal__close:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.flashcard-modal__body {
  padding: 24px 20px;
}

.flashcard-loading {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
  padding: 24px 0;
}

.flashcard-error {
  text-align: center;
  color: var(--text-error, #f87171);
  font-size: 0.875rem;
  padding: 16px 0;
}

.flashcard-deck {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* 3D flip card */
.flashcard {
  width: 100%;
  height: 220px;
  perspective: 1000px;
  cursor: pointer;
}

.flashcard__inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 10px;
}

.flashcard.is-flipped .flashcard__inner {
  transform: rotateY(180deg);
}

.flashcard__front,
.flashcard__back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 24px;
  text-align: center;
  font-size: 0.9375rem;
  line-height: 1.5;
}

.flashcard__front {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-weight: 500;
}

.flashcard__back {
  background: rgba(35, 131, 226, 0.1);
  border: 1px solid rgba(35, 131, 226, 0.3);
  color: var(--text-primary);
  transform: rotateY(180deg);
}

.flashcard-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  justify-content: space-between;
}

.flashcard-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ============================================
   ONBOARDING OVERLAY
   ============================================ */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.onboarding-overlay[hidden] { display: none; }
.onboarding-modal {
  background: #161b27;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 40px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}
.onboarding-step__header { text-align: center; margin-bottom: 28px; }
.onboarding-logo {
  width: 56px; height: 56px;
  background: #2383e2;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 20px; color: #fff;
  margin: 0 auto 16px;
}
.onboarding-step__title { font-size: 20px; font-weight: 600; color: #e8eaf0; margin: 0 0 8px; }
.onboarding-step__desc { font-size: 14px; color: #8b95a8; margin: 0; line-height: 1.6; }
.onboarding-features {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; margin-bottom: 28px;
}
.onboarding-feature {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,0.04);
  border-radius: 8px; padding: 10px 12px;
  font-size: 13px; color: #c8cdd6;
}
.onboarding-feature__icon {
  width: 28px; height: 28px;
  background: #2383e2;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.onboarding-step__actions {
  display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.onboarding-step__actions .btn--primary { width: 100%; justify-content: center; }
.onboarding-progress {
  display: flex; gap: 6px; justify-content: center; margin-bottom: 20px;
}
.onboarding-progress__dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  transition: background 0.2s;
}
.onboarding-progress__dot.is-done { background: #2383e2; }
.onboarding-progress__dot.is-active { background: #5ba4f5; }
.onboarding-canvas-guide { margin-bottom: 20px; display: flex; flex-direction: column; gap: 10px; }
.onboarding-guide-step {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 13px; color: #c8cdd6; line-height: 1.5;
}
.onboarding-guide-step__num {
  width: 22px; height: 22px;
  background: rgba(35,131,226,0.2);
  color: #5ba4f5;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  flex-shrink: 0; margin-top: 1px;
}
.onboarding-canvas-form { margin-bottom: 8px; }
.onboarding-canvas-form__status {
  font-size: 13px; padding: 8px 12px;
  border-radius: 6px; margin-top: 8px;
}
.onboarding-canvas-form__status[hidden] { display: none; }
.onboarding-canvas-form__status.is-error { background: rgba(239,68,68,0.1); color: #f87171; }
.onboarding-canvas-form__status.is-success { background: rgba(34,197,94,0.1); color: #4ade80; }
.onboarding-done-icon {
  width: 56px; height: 56px;
  background: rgba(34,197,94,0.15);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; color: #4ade80;
  margin: 0 auto 16px;
}
.onboarding-next-actions { display: flex; gap: 10px; margin-bottom: 24px; }
.onboarding-action-card {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px; padding: 16px 8px;
  cursor: pointer; transition: background 0.15s, border-color 0.15s;
  color: #c8cdd6; font-size: 12px; text-align: center;
}
.onboarding-action-card:hover { background: rgba(255,255,255,0.08); border-color: rgba(35,131,226,0.4); }
.onboarding-action-card__icon {
  width: 32px; height: 32px;
  background: #2383e2; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
}
.onboarding-action-card__label { font-size: 11px; color: #8b95a8; }

/* ============================================
   SIDEBAR CANVAS STATUS
   ============================================ */
.sidebar-canvas-status {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  margin-top: auto;
  border-top: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;
  transition: background 0.15s;
}
.sidebar-canvas-status:hover { background: rgba(255,255,255,0.04); }
.sidebar-canvas-status__dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  flex-shrink: 0;
  transition: background 0.3s;
}
.sidebar-canvas-status__dot.is-connected { background: #4ade80; }
.sidebar-canvas-status__label {
  font-size: 11px; color: #6b7585;
  white-space: nowrap; overflow: hidden;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 2000;
  pointer-events: none;
}
.toast {
  background: #1e2535;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px; color: #e8eaf0;
  max-width: 320px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: auto;
}
.toast--visible { opacity: 1; transform: translateY(0); }
.toast--success { border-left: 3px solid #4ade80; }
.toast--error { border-left: 3px solid #f87171; }
.toast--info { border-left: 3px solid #5ba4f5; }
}

/* QUIZ GENERATOR */
/* ============================================
   QUIZ GENERATOR PANEL
   ============================================ */

/* Layout: side-by-side on desktop, stacked on mobile */
.quiz-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  min-height: 0;
}

.tool-panel__inner--wide {
  max-width: 960px;
}

/* --- Config panel --- */
.quiz-config {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-self: start;
  position: sticky;
  top: 24px;
}

.quiz-config__eyebrow {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  margin-bottom: 2px;
}

.quiz-config__title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.quiz-config__desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.quiz-config__header {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

/* --- Field group --- */
.quiz-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.quiz-field__label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
}

.quiz-field__control {
  height: 38px;
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-base);
  color: var(--text-primary);
  padding: 0 11px;
  font-size: 0.8125rem;
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  cursor: pointer;
  transition: border-color var(--transition);
}

.quiz-field__control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(35, 131, 226, 0.15);
}

/* --- Chip buttons (toggle selectors) --- */
.quiz-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.quiz-chip {
  padding: 5px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.quiz-chip:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.quiz-chip.is-active {
  background: rgba(35, 131, 226, 0.12);
  color: var(--accent);
  border-color: rgba(35, 131, 226, 0.4);
}

/* --- Checkbox group --- */
.quiz-check-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.quiz-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  user-select: none;
}

.quiz-check input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.quiz-check__box {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 1.5px solid var(--border-hover);
  background: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}

.quiz-check input:checked + .quiz-check__box {
  background: var(--accent);
  border-color: var(--accent);
}

.quiz-check input:checked + .quiz-check__box::after {
  content: '';
  width: 4px;
  height: 7px;
  border: solid #fff;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg) translateY(-1px);
}

.quiz-check input:checked ~ .quiz-check__text {
  color: var(--text-primary);
}

/* --- Generate button --- */
.quiz-config__generate {
  width: 100%;
  margin-top: 4px;
  justify-content: center;
}

.quiz-config__generate-spinner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* --- Quiz display area --- */
.quiz-display {
  min-height: 300px;
  display: flex;
  flex-direction: column;
}

/* Empty state */
.quiz-display__empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
  min-height: 280px;
}

.quiz-display__empty-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-tertiary);
  margin-bottom: 16px;
}

.quiz-display__empty-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.quiz-display__empty-desc {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  line-height: 1.5;
  max-width: 280px;
}

/* --- Score / progress bar --- */
.quiz-score {
  margin-bottom: 16px;
}

.quiz-score__progress {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 10px;
}

.quiz-score__progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
  transition: width 0.4s ease;
}

.quiz-score__stats {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
}

.quiz-score__label {
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.quiz-score__value {
  color: var(--text-primary);
  font-weight: 700;
}

.quiz-score__value--correct {
  color: var(--success);
}

.quiz-score__divider {
  width: 1px;
  height: 12px;
  background: var(--border);
}

/* --- Quiz cards --- */
.quiz-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quiz-card {
  display: flex;
  gap: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  transition: border-color var(--transition);
}

.quiz-card[data-answered="true"] {
  opacity: 0.85;
}

.quiz-card__number {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
  padding-top: 2px;
  flex-shrink: 0;
  min-width: 24px;
}

.quiz-card__body {
  flex: 1;
  min-width: 0;
}

.quiz-card__question {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.5;
  margin-bottom: 12px;
}

/* --- Options (multiple choice / true-false) --- */
.quiz-card__options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.quiz-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: all var(--transition);
  width: 100%;
}

.quiz-option:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

.quiz-option__marker {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: var(--bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.quiz-option__text {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.45;
  padding-top: 2px;
}

/* Selected states */
.quiz-option.is-selected {
  border-color: rgba(35, 131, 226, 0.5);
  background: rgba(35, 131, 226, 0.08);
}

.quiz-option.is-selected .quiz-option__marker {
  background: var(--accent);
  color: #fff;
}

.quiz-option.is-selected .quiz-option__text {
  color: var(--text-primary);
}

/* Correct / Incorrect after answer reveal */
.quiz-option.is-correct {
  border-color: rgba(68, 172, 68, 0.5);
  background: rgba(68, 172, 68, 0.08);
}

.quiz-option.is-correct .quiz-option__marker {
  background: var(--success);
  color: #fff;
}

.quiz-option.is-correct .quiz-option__text {
  color: var(--text-primary);
}

.quiz-option.is-incorrect {
  border-color: rgba(212, 76, 76, 0.4);
  background: rgba(212, 76, 76, 0.06);
}

.quiz-option.is-incorrect .quiz-option__marker {
  background: var(--danger);
  color: #fff;
}

/* Disabled options after answering */
.quiz-option.is-disabled {
  pointer-events: none;
  cursor: default;
}

/* --- Fill-in-the-blank input --- */
.quiz-card__blank-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color var(--transition);
}

.quiz-card__blank-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(35, 131, 226, 0.15);
}

.quiz-card__blank-submit {
  margin-top: 8px;
}

/* --- Feedback after answering --- */
.quiz-card__feedback {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.quiz-card__feedback-status {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.quiz-card__feedback-status--correct {
  color: var(--success);
}

.quiz-card__feedback-status--incorrect {
  color: var(--danger);
}

.quiz-card__explanation {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* --- Results summary --- */
.quiz-results {
  text-align: center;
  padding: 40px 24px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-top: 16px;
}

.quiz-results__score {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  margin-bottom: 4px;
}

.quiz-results__score-num {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}

.quiz-results__score-sep {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-tertiary);
}

.quiz-results__score-total {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.quiz-results__label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.quiz-results__pct {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
}

.quiz-results__actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .quiz-layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .quiz-config {
    position: static;
  }

  .quiz-display__empty {
    min-height: 200px;
    padding: 24px 16px;
  }
}

/* ASSIGNMENT PLANNER */
/* ============================================
   ASSIGNMENT PLANNER PANEL
   ============================================ */

/* Header */
.planner__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.planner__title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.planner__subtitle {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

/* Filters */
.planner__filters {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.planner__filter {
  padding: 5px 14px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--transition);
}

.planner__filter:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.planner__filter.is-active {
  color: var(--accent);
  background: rgba(35, 131, 226, 0.1);
  border-color: rgba(35, 131, 226, 0.25);
}

/* Assignment list */
.planner__list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* --- Planner item --- */
.planner-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  transition: background var(--transition);
  position: relative;
}

.planner-item:hover {
  background: var(--bg-hover);
}

/* Urgency bar: thin left-edge color strip */
.planner-item__urgency-bar {
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 2px;
}

.planner-item__urgency-bar--high {
  background: var(--danger);
}

.planner-item__urgency-bar--medium {
  background: var(--warning);
}

.planner-item__urgency-bar--low {
  background: var(--border-hover);
}

/* Checkbox */
.planner-item__check {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.planner-item__checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.planner-item__checkmark {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1.5px solid var(--border-hover);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.planner-item__checkbox:checked + .planner-item__checkmark {
  background: var(--success);
  border-color: var(--success);
}

.planner-item__checkbox:checked + .planner-item__checkmark::after {
  content: '';
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translateY(-1px);
}

/* Completed item styling */
.planner-item.is-done {
  opacity: 0.5;
}

.planner-item.is-done .planner-item__name {
  text-decoration: line-through;
  color: var(--text-tertiary);
}

/* Body */
.planner-item__body {
  flex: 1;
  min-width: 0;
}

.planner-item__top-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

/* Course abbreviation badge */
.planner-item__course-badge {
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 2px 6px;
  border-radius: 3px;
  flex-shrink: 0;
  text-transform: uppercase;
}

/* Assignment name */
.planner-item__name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

/* Priority badges */
.planner-item__priority {
  font-size: 0.625rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.planner-item__priority--urgent {
  background: rgba(212, 76, 76, 0.15);
  color: var(--danger);
}

.planner-item__priority--important {
  background: rgba(203, 136, 37, 0.15);
  color: var(--warning);
}

.planner-item__priority--normal {
  background: rgba(102, 102, 102, 0.15);
  color: var(--text-tertiary);
}

/* Meta row */
.planner-item__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.planner-item__dot {
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: var(--text-tertiary);
  flex-shrink: 0;
}

.planner-item__due-relative {
  color: var(--text-secondary);
  font-weight: 600;
}

.planner-item__due-absolute {
  color: var(--text-tertiary);
  margin-left: 2px;
}

.planner-item__points {
  color: var(--text-tertiary);
}

.planner-item__weight {
  color: var(--text-tertiary);
}

/* Due today / overdue relative text coloring */
.planner-item__due-relative.is-overdue {
  color: var(--danger);
}

.planner-item__due-relative.is-today {
  color: var(--warning);
}

.planner-item__due-relative.is-tomorrow {
  color: var(--warning);
}

/* Expand toggle */
.planner-item__expand {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  flex-shrink: 0;
}

.planner-item__expand:hover {
  color: var(--text-primary);
  background: var(--bg-overlay);
}

.planner-item__expand[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

/* Detail expansion */
.planner-item__detail {
  padding: 0 14px 12px 56px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.planner-item__detail[hidden] {
  display: none;
}

.planner-item__desc-content {
  margin-bottom: 10px;
  max-height: 240px;
  overflow-y: auto;
}

.planner-item__canvas-link {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.planner-item__canvas-link:hover {
  text-decoration: underline;
}

/* Empty state */
.planner__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
}

.planner__empty-icon {
  color: var(--success);
  margin-bottom: 16px;
}

.planner__empty-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.planner__empty-desc {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
}

/* Skeleton loading */
.planner-item--skeleton {
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.planner-item--skeleton .skeleton-line--lg {
  width: 60%;
  height: 14px;
  background: var(--bg-hover);
  border-radius: 4px;
  animation: shimmer 1.5s infinite;
}

.planner-item--skeleton .skeleton-line--sm {
  width: 35%;
  height: 10px;
  background: var(--bg-hover);
  border-radius: 4px;
  animation: shimmer 1.5s infinite;
  animation-delay: 0.15s;
}

@keyframes shimmer {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* --- Responsive --- */
@media (max-width: 600px) {
  .planner-item__top-row {
    flex-wrap: wrap;
  }

  .planner-item__detail {
    padding-left: 14px;
  }

  .planner-item__weight {
    display: none;
  }
}

/* GRADE GOAL CALCULATOR */
/* ============================================
   GRADE GOAL CALCULATOR (inside grade modal)
   ============================================ */

.goal-calc {
  margin-top: 8px;
}

.goal-calc__divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0 20px;
}

.goal-calc__header {
  margin-bottom: 14px;
}

.goal-calc__title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.goal-calc__desc {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  line-height: 1.5;
}

/* Inputs */
.goal-calc__inputs {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}

.goal-calc__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.goal-calc__label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
}

.goal-calc__target-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.goal-calc__input {
  width: 72px;
  height: 34px;
  padding: 0 8px;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  text-align: center;
  -moz-appearance: textfield;
}

.goal-calc__input::-webkit-outer-spin-button,
.goal-calc__input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.goal-calc__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(35, 131, 226, 0.15);
}

.goal-calc__input-suffix {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-tertiary);
}

/* Letter grade quick-pick buttons */
.goal-calc__letter-btns {
  display: flex;
  gap: 4px;
  margin-left: 4px;
}

.goal-calc__letter {
  padding: 4px 8px;
  font-size: 0.625rem;
  font-weight: 700;
  font-family: inherit;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.goal-calc__letter:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.goal-calc__letter.is-active {
  background: rgba(35, 131, 226, 0.12);
  color: var(--accent);
  border-color: rgba(35, 131, 226, 0.4);
}

/* Assignment selector */
.goal-calc__select {
  width: 100%;
  height: 34px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-base);
  color: var(--text-primary);
  padding: 0 28px 0 10px;
  font-size: 0.8125rem;
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  cursor: pointer;
}

.goal-calc__select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(35, 131, 226, 0.15);
}

/* Calculate button */
.goal-calc__btn {
  width: 100%;
  justify-content: center;
  margin-bottom: 12px;
}

/* --- Result cards --- */
.goal-calc__result-card {
  padding: 16px;
  border-radius: var(--radius-lg);
  border: 1px solid;
}

.goal-calc__result-card[hidden] {
  display: none;
}

/* Achievable: blue accent */
.goal-calc__result-card--achievable {
  background: rgba(35, 131, 226, 0.06);
  border-color: rgba(35, 131, 226, 0.25);
}

.goal-calc__result-card--achievable .goal-calc__result-number {
  color: var(--accent);
}

/* Warning: amber */
.goal-calc__result-card--warning {
  background: rgba(203, 136, 37, 0.06);
  border-color: rgba(203, 136, 37, 0.25);
}

.goal-calc__result-card--warning .goal-calc__result-number {
  color: var(--warning);
}

/* Impossible: red */
.goal-calc__result-card--impossible {
  background: rgba(212, 76, 76, 0.06);
  border-color: rgba(212, 76, 76, 0.25);
}

.goal-calc__result-card--impossible .goal-calc__result-label {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--danger);
}

/* Shared result styles */
.goal-calc__result-main {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 8px;
}

.goal-calc__result-number {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1;
}

.goal-calc__result-unit {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.goal-calc__result-text {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.goal-calc__result-text strong {
  color: var(--text-primary);
  font-weight: 700;
}

/* --- Responsive --- */
@media (max-width: 480px) {
  .goal-calc__letter-btns {
    flex-wrap: wrap;
    margin-left: 0;
    margin-top: 6px;
  }

  .goal-calc__target-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .goal-calc__input {
    width: 100%;
  }
}

/* ============================================
   QUIZ GENERATOR — Notes Input & Content Summary
   ============================================ */

.quiz-notes-input {
  width: 100%;
  min-height: 148px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 0.8125rem;
  font-family: inherit;
  line-height: 1.65;
  resize: vertical;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.quiz-notes-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(35, 131, 226, 0.15);
}

.quiz-notes-input::placeholder {
  color: var(--text-tertiary);
  line-height: 1.65;
  white-space: pre-wrap;
}

.quiz-notes-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 5px;
  font-size: 0.6875rem;
  color: var(--text-tertiary);
}

.quiz-notes-meta__hint {
  color: var(--warning);
  font-weight: 600;
}

/* Content summary chip — shown after quiz generation */
.quiz-content-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: rgba(35, 131, 226, 0.06);
  border: 1px solid rgba(35, 131, 226, 0.18);
  border-radius: var(--radius-md);
  margin-bottom: 14px;
}

.quiz-content-summary__icon {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-sm);
  background: rgba(35, 131, 226, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.5625rem;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.quiz-content-summary__text {
  font-size: 0.6875rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Phase-based loading text in spinner */
.quiz-spinner-text {
  margin-left: 8px;
  font-size: 0.8125rem;
}

/* ===== QUIZ HISTORY ===== */
.quiz-history-overlay {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 16px;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(2px);
}
.quiz-history-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 360px;
  max-height: calc(100% - 32px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.quiz-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.quiz-history-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.quiz-history-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
}
.quiz-history-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.quiz-history-body { flex: 1; overflow-y: auto; padding: 12px; }
.quiz-history-empty { color: var(--text-muted); font-size: 13px; text-align: center; padding: 24px 0; margin: 0; }
.quiz-history-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.quiz-history-item {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.quiz-history-item:hover { border-color: var(--accent); }
.quiz-history-item__score { font-size: 14px; font-weight: 700; min-width: 40px; text-align: center; }
.quiz-history-item__score--high { color: var(--accent-emerald); }
.quiz-history-item__score--mid { color: var(--accent-amber); }
.quiz-history-item__score--low { color: var(--accent-rose); }
.quiz-history-item__info { flex: 1; min-width: 0; }
.quiz-history-item__course { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quiz-history-item__meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.quiz-history-item__review { font-size: 11px; color: var(--accent); white-space: nowrap; flex-shrink: 0; }

/* ===== AI PLANNER MODAL ===== */
.planner-ai-modal {
  position: absolute;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.planner-ai-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(2px);
}
.planner-ai-modal__content {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 500px;
  max-width: 100%;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.planner-ai-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.planner-ai-modal__title { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.planner-ai-modal__close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 2px 8px;
  border-radius: 4px;
}
.planner-ai-modal__close:hover { background: var(--bg-hover); color: var(--text-primary); }
.planner-ai-modal__body { flex: 1; overflow-y: auto; padding: 20px; }
.planner-ai-loading { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 32px 0; }
.planner-ai-plan-container { display: flex; flex-direction: column; gap: 10px; }
.planner-ai-day {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
}
.planner-ai-day__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.planner-ai-day__label { font-size: 13px; font-weight: 600; color: var(--accent); }
.planner-ai-day__time { font-size: 11px; color: var(--text-muted); }
.planner-ai-day__tasks { list-style: disc; padding-left: 18px; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.planner-ai-day__task { font-size: 13px; color: var(--text-secondary); }
.planner-ai-error { color: var(--accent-rose); font-size: 13px; text-align: center; padding: 20px 0; }
.planner-item__ai-btn {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: none;
  color: var(--accent);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
  flex-shrink: 0;
}
.planner-item__ai-btn:hover { background: rgba(35,131,226,0.12); }

/* ===== DASHBOARD QUIZ STATS ===== */
.dash__quiz-stats { margin-top: 0; }
.dash__quiz-history-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.dash__quiz-history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 13px;
}
.dash__quiz-score { font-weight: 700; min-width: 44px; font-size: 13px; }
.dash__quiz-score--high { color: var(--accent-emerald); }
.dash__quiz-score--mid { color: var(--accent-amber); }
.dash__quiz-score--low { color: var(--accent-rose); }
.dash__quiz-course { flex: 1; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash__quiz-date { color: var(--text-muted); font-size: 11px; white-space: nowrap; }
.dash__quiz-stats-empty { color: var(--text-muted); font-size: 13px; margin: 0; padding: 8px 0; }
