:root {
  /* Extension Light Academic Theme Tokens */
  --primary: #18181b;
  --primary-hover: #27272a;
  --primary-light: #f4f4f5;
  --primary-border: #e4e4e7;
  
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-hover: #f4f4f5;
  --surface-border: #e4e4e7;
  --surface-border-strong: #d4d4d8;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;

  --danger: #18181b;
  --danger-light: #f4f4f5;
  --danger-border: #e4e4e7;

  --warning: #71717a;
  --warning-light: #f4f4f5;
  /* The stats row keeps its colours: red for urgent, amber for this week */
  --stat-urgent: #ef4444;
  --stat-week: #f59e0b;

  --success: #18181b;
  --success-light: #f4f4f5;
  --success-border: #e4e4e7;

  /* Permanent Course Colors */
  --course-intro-eng: #7c7c7c;
  --course-calc: #dc2626;
  --course-physics: #4b99d2;
  --course-english: #525252;
  --course-islamic: #489160;

  --radius-sm: 0px;
  --radius-md: 0px;
  --radius-lg: 0px;
  --radius-xl: 0px;
  --radius-full: 0px;

  --shadow-sm: 0 0 0 0 transparent;
  --shadow-md: 0 0 0 0 transparent;
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.12);

  --font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --accent: #18181b;
  --accent-hover: #27272a;
  --on-accent: #ffffff;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 32px;
  --font-display: "Inter Tight", "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

[data-theme="dark"] {
  --primary: #f4f4f6;
  --primary-hover: #ffffff;
  --primary-light: rgba(255, 255, 255, 0.08);
  --primary-border: rgba(255, 255, 255, 0.16);

  --bg: #121215;
  --surface: #1a1a1f;
  --surface-hover: #24242b;
  --surface-border: #2c2c36;
  --surface-border-strong: #3f3f4c;

  --text-main: #f4f4f6;
  --text-muted: #a1a1aa;
  --text-subtle: #71717a;

  --danger: #f4f4f6;
  --danger-light: rgba(113, 113, 122, 0.15);
  --danger-border: rgba(113, 113, 122, 0.3);

  --warning: #a1a1aa;
  --warning-light: rgba(113, 113, 122, 0.15);
  --stat-urgent: #f87171;
  --stat-week: #fbbf24;

  --success: #f4f4f6;
  --success-light: rgba(255, 255, 255, 0.08);
  --success-border: rgba(255, 255, 255, 0.16);

  --shadow-sm: 0 0 0 0 transparent;
  --shadow-md: 0 0 0 0 transparent;
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.65);
  --accent: #f4f4f6;
  --accent-hover: #ffffff;
  --on-accent: #121215;
}

/* Dark theme specific component overrides for mobile web */
[data-theme="dark"] * {
  scrollbar-color: #3f3f4c transparent;
}
[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: #3f3f4c;
}
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: #525260;
}

[data-theme="dark"] .app-header {
  background: var(--surface);
  border-bottom-color: var(--surface-border);
}

[data-theme="dark"] .btn-icon {
  background: #24242b;
  border-color: #3f3f4c;
  color: var(--text-muted);
}
[data-theme="dark"] .btn-icon:hover {
  background: #2c2c34;
  color: var(--text-main);
  border-color: #525260;
}

[data-theme="dark"] .app-nav {
  background: #141417;
  border: 1px solid var(--surface-border);
}
[data-theme="dark"] .nav-item {
  color: var(--text-muted);
}
[data-theme="dark"] .nav-item:hover {
  color: var(--text-main);
}
[data-theme="dark"] .nav-item.active {
  background: #24242b;
  color: #f4f4f6;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
[data-theme="dark"] .nav-item.active .nav-icon {
  color: #f4f4f6;
}
[data-theme="dark"] .badge-count {
  background: rgba(255, 255, 255, 0.1);
  color: #f4f4f6;
}

/* Calendar Grid & Day Cells in Dark Mode */
[data-theme="dark"] .calendar-grid {
  background: var(--surface-border);
  border-color: var(--surface-border);
}
[data-theme="dark"] .cal-day-cell {
  background: var(--surface);
  color: var(--text-main);
}
[data-theme="dark"] .cal-day-cell:hover,
[data-theme="dark"] .cal-day-cell:active {
  background: var(--surface-hover);
  box-shadow: inset 0 0 0 1.5px var(--surface-border-strong);
}
[data-theme="dark"] .cal-day-cell.other-month {
  background: #141417;
  opacity: 0.35;
}
[data-theme="dark"] .cal-day-cell.other-month .day-number {
  color: #71717a;
}
[data-theme="dark"] .cal-day-cell.other-month:hover,
[data-theme="dark"] .cal-day-cell.other-month:active {
  background: #18181d;
  opacity: 0.7;
}
[data-theme="dark"] .cal-day-cell.is-today {
  background: var(--surface-hover);
  box-shadow: inset 0 0 0 2px var(--primary) !important;
}
[data-theme="dark"] .cal-day-cell.is-today .day-number {
  color: var(--text-main);
  font-weight: 800;
}
[data-theme="dark"] .cal-day-cell.is-selected {
  background: var(--surface-hover);
  box-shadow: inset 0 0 0 2px var(--primary) !important;
}
[data-theme="dark"] .cal-day-cell.is-selected .day-number {
  color: var(--text-main);
  font-weight: 800;
}

[data-theme="dark"] .cal-nav-btn,
[data-theme="dark"] .btn-today {
  background: var(--surface-hover);
  border-color: var(--surface-border);
  color: var(--text-muted);
}
[data-theme="dark"] .cal-nav-btn:hover,
[data-theme="dark"] .cal-nav-btn:active,
[data-theme="dark"] .btn-today:hover,
[data-theme="dark"] .btn-today:active {
  background: #2c2c34;
  color: var(--text-main);
  border-color: var(--surface-border-strong);
}

[data-theme="dark"] .legend-chip {
  background: var(--surface-hover);
  border-color: var(--surface-border);
  color: var(--text-main);
}

[data-theme="dark"] .selected-day-container {
  background: var(--surface);
  border-color: var(--surface-border);
}
[data-theme="dark"] .selected-day-header {
  border-bottom-color: var(--surface-border);
}

[data-theme="dark"] .settings-card {
  background: var(--surface);
  border-color: var(--surface-border);
}

/* Task Cards & States in Dark Mode */
[data-theme="dark"] .deadline-mobile-card,
[data-theme="dark"] .task-card {
  background: var(--surface);
  border-color: var(--surface-border);
}
[data-theme="dark"] .deadline-mobile-card:hover,
[data-theme="dark"] .task-card:hover {
  border-color: var(--surface-border-strong);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
[data-theme="dark"] .task-card.is-active-reading {
  background: #24242b !important;
  border-color: #525260 !important;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.12);
}
[data-theme="dark"] .task-card.is-completed,
[data-theme="dark"] .task-card.status-completed,
[data-theme="dark"] .deadline-mobile-card.status-completed {
  background: rgba(26, 26, 31, 0.6) !important;
  opacity: 0.65;
}

/* Category Type Pills in Dark Mode */
[data-theme="dark"] .type-quiz {
  background: rgba(113, 113, 122, 0.2);
  color: #a1a1aa;
  border: 1px solid rgba(113, 113, 122, 0.35);
}
[data-theme="dark"] .type-assignment {
  background: rgba(255, 255, 255, 0.08);
  color: #f4f4f6;
  border: 1px solid rgba(255, 255, 255, 0.16);
}
[data-theme="dark"] .type-exam {
  background: rgba(113, 113, 122, 0.2);
  color: #f4f4f6;
  border: 1px solid rgba(113, 113, 122, 0.35);
}
[data-theme="dark"] .type-project {
  background: rgba(168, 85, 247, 0.2);
  color: #a1a1aa;
  border: 1px solid rgba(168, 85, 247, 0.35);
}
[data-theme="dark"] .type-lab {
  background: var(--surface-hover);
  color: var(--text-main);
  border: 1px solid var(--surface-border);
}
[data-theme="dark"] .type-meeting {
  background: rgba(255, 255, 255, 0.08);
  color: #f4f4f6;
  border: 1px solid rgba(255, 255, 255, 0.16);
}
[data-theme="dark"] .type-other {
  background: #24242b;
  color: #a1a1aa;
  border: 1px solid #3f3f4c;
}

/* Urgency Badges in Dark Mode */
[data-theme="dark"] .urgency-badge.overdue {
  background: rgba(113, 113, 122, 0.2);
  color: #d4d4d8;
  border: 1px solid rgba(113, 113, 122, 0.4);
}
[data-theme="dark"] .urgency-badge.today {
  background: rgba(113, 113, 122, 0.2);
  color: #d4d4d8;
  border: 1px solid rgba(113, 113, 122, 0.4);
}
[data-theme="dark"] .urgency-badge.tomorrow {
  background: rgba(113, 113, 122, 0.2);
  color: #d4d4d8;
  border: 1px solid rgba(113, 113, 122, 0.4);
}
[data-theme="dark"] .urgency-badge.soon {
  background: var(--surface-hover);
  color: var(--text-main);
  border: 1px solid var(--surface-border-strong);
}
[data-theme="dark"] .urgency-badge.future {
  background: #24242b;
  color: #a1a1aa;
  border: 1px solid #3f3f4c;
}
[data-theme="dark"] .urgency-badge.completed {
  background: var(--surface-hover);
  color: var(--text-main);
  border: 1px solid var(--surface-border-strong);
}

/* Weight & Meta Pills in Dark Mode */
[data-theme="dark"] .task-weight-pill {
  background: var(--surface-hover);
  color: var(--text-main);
  border-color: var(--surface-border);
}
[data-theme="dark"] .task-weight-pill.weight-major {
  background: var(--surface-hover);
  color: var(--text-main);
  border-color: var(--surface-border-strong);
}
[data-theme="dark"] .task-weight-pill.weight-medium {
  background: var(--surface-hover);
  color: var(--text-muted);
  border-color: var(--surface-border);
}

.task-target-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 0 !important;
  font-size: 10.5px;
  font-weight: 600;
  background: var(--surface-hover);
  color: var(--text-main);
  border: 1px solid var(--surface-border);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
[data-theme="dark"] .task-target-pill {
  background: var(--surface-hover);
  color: var(--text-main);
  border-color: var(--surface-border);
}
[data-theme="dark"] .meta-pill {
  background: var(--surface-hover);
  color: var(--text-muted);
  border: 1px solid var(--surface-border);
}
[data-theme="dark"] .meta-pill.time-class {
  background: var(--surface-hover);
  color: var(--text-main);
  border: 1px solid var(--surface-border);
}

/* Day Sheet Drawer in Dark Mode */
[data-theme="dark"] .day-sheet-drawer {
  background: var(--surface);
  border-color: var(--surface-border);
}
[data-theme="dark"] .day-sheet-header {
  border-bottom-color: var(--surface-border);
}
[data-theme="dark"] .drag-pill {
  background: #3f3f4c;
}
[data-theme="dark"] .btn-icon-close,
[data-theme="dark"] .btn-modal-close {
  background: var(--surface-hover);
  border-color: var(--surface-border);
  color: var(--text-muted);
}
[data-theme="dark"] .btn-icon-close:hover,
[data-theme="dark"] .btn-modal-close:hover {
  background: #2c2c34;
  color: var(--text-main);
}
[data-theme="dark"] .day-sheet-item {
  background: var(--surface);
  border-color: var(--surface-border);
}
[data-theme="dark"] .day-sheet-item:hover {
  background: var(--surface-hover);
  border-color: var(--surface-border-strong);
}
[data-theme="dark"] .btn-day-add {
  background: var(--surface-hover);
  border-color: var(--surface-border-strong);
  color: var(--text-main);
}
[data-theme="dark"] .btn-day-add:hover {
  background: #2c2c34;
}
[data-theme="dark"] .btn-add-action {
  background: var(--surface-hover);
  border-color: var(--surface-border-strong);
  color: var(--text-main);
}
[data-theme="dark"] .btn-add-action:hover {
  background: #2c2c34;
  border-color: var(--text-muted);
}
[data-theme="dark"] .btn-secondary-action {
  background: var(--surface-hover);
  border-color: var(--surface-border);
  color: var(--text-main);
}
[data-theme="dark"] .btn-secondary-action:hover {
  background: #2c2c34;
}

/* Schedule & Syllabus Rows in Dark Mode */
[data-theme="dark"] .toggle-control-row {
  background: #141417;
  border-color: var(--surface-border);
}
[data-theme="dark"] .notification-timing-notes {
  background: #141417;
  border-color: var(--surface-border);
  color: var(--text-main);
}
[data-theme="dark"] .feed-url-display {
  background: #141417;
  border-color: var(--surface-border);
}
[data-theme="dark"] .feed-url-code {
  color: var(--text-main);
}
[data-theme="dark"] .sync-metrics {
  background: #141417;
  border-color: var(--surface-border);
}
[data-theme="dark"] .reading-meta-section {
  background: var(--surface);
  border-color: var(--surface-border);
}
[data-theme="dark"] .reading-box-content {
  --quote-fade-bg: #141417;
  background: #141417;
  border-color: #2c2c36;
  color: var(--text-main);
}
[data-theme="dark"] .btn-copy-announcement {
  background: var(--surface-hover);
  border-color: var(--surface-border);
  color: var(--text-muted);
}
[data-theme="dark"] .btn-copy-announcement:hover {
  background: #2c2c34;
  color: var(--text-main);
  border-color: var(--surface-border-strong);
}

/* Extractor Modals & Result Badges in Dark Mode */
[data-theme="dark"] .extract-result-item {
  background: var(--surface);
  border-color: var(--surface-border);
}
[data-theme="dark"] .extract-result-item:hover {
  border-color: var(--surface-border-strong);
}
[data-theme="dark"] .extract-status-pill.loading {
  background: var(--surface-hover);
  border-color: var(--surface-border-strong);
  color: var(--text-main);
}
[data-theme="dark"] .extract-status-pill.success {
  background: var(--surface-hover);
  border: 1px solid var(--surface-border-strong);
  color: var(--text-main);
}
[data-theme="dark"] .extract-status-pill.rejected {
  background: rgba(113, 113, 122, 0.18);
  border-color: rgba(113, 113, 122, 0.35);
  color: #d4d4d8;
}
[data-theme="dark"] .extract-status-pill.error {
  background: rgba(113, 113, 122, 0.18);
  border-color: rgba(113, 113, 122, 0.35);
  color: #d4d4d8;
}
[data-theme="dark"] .badge-type-tag {
  background: var(--surface-hover);
  color: var(--text-main);
}
[data-theme="dark"] .badge-weight-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 0;
  background: var(--surface-hover);
  color: var(--text-main);
  border: 1px solid var(--surface-border);
}
[data-theme="dark"] .badge-room-tag {
  background: var(--surface-hover);
  border-color: var(--surface-border);
  color: #d4d4d8;
}

[data-theme="dark"] .selected-day-container {
  background: var(--surface);
  border-color: var(--surface-border);
}
[data-theme="dark"] .selected-day-item {
  background: var(--surface);
  border-color: var(--surface-border);
}
[data-theme="dark"] .selected-day-item:hover {
  background: var(--surface-hover);
  border-color: var(--surface-border-strong);
}
[data-theme="dark"] .btn-xs-add,
[data-theme="dark"] .btn-xs-sheet {
  background: var(--surface-hover);
  border-color: var(--surface-border-strong);
  color: var(--text-main);
}
[data-theme="dark"] .btn-xs-add:hover,
[data-theme="dark"] .btn-xs-sheet:hover {
  background: #2c2c34;
}
[data-theme="dark"] .btn-sel-action {
  background: var(--surface-hover);
  border-color: var(--surface-border);
  color: #d4d4d8;
}
[data-theme="dark"] .btn-sel-action:hover {
  background: #2c2c34;
  color: #ffffff;
}

[data-theme="dark"] .mobile-input,
[data-theme="dark"] .mobile-select,
[data-theme="dark"] .mobile-textarea,
[data-theme="dark"] .form-input,
[data-theme="dark"] .form-select,
[data-theme="dark"] .form-textarea {
  background-color: #1a1a1f;
  border-color: #3f3f4c;
  color: #f4f4f6;
}
[data-theme="dark"] .mobile-select,
[data-theme="dark"] .form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
[data-theme="dark"] .mobile-input::placeholder,
[data-theme="dark"] .mobile-textarea::placeholder,
[data-theme="dark"] .form-input::placeholder,
[data-theme="dark"] .form-textarea::placeholder {
  color: #71717a;
}
[data-theme="dark"] .mobile-input:focus,
[data-theme="dark"] .mobile-select:focus,
[data-theme="dark"] .mobile-textarea:focus,
[data-theme="dark"] .form-input:focus,
[data-theme="dark"] .form-select:focus,
[data-theme="dark"] .form-textarea:focus {
  border-color: #a1a1aa;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .modal-content,
[data-theme="dark"] .modal-sheet,
[data-theme="dark"] .modal-card,
[data-theme="dark"] .reading-sheet-mobile {
  background: var(--surface);
  border-color: var(--surface-border);
}

[data-theme="dark"] .btn-outline-action {
  background: var(--surface-hover);
  border-color: var(--surface-border);
  color: var(--text-main);
}
[data-theme="dark"] .btn-outline-action:hover {
  background: #2c2c34;
  border-color: var(--surface-border-strong);
}

[data-theme="dark"] .btn-card-action {
  background: var(--surface-hover);
  border-color: var(--surface-border);
  color: var(--text-main);
}
[data-theme="dark"] .btn-card-action:hover {
  background: #2c2c34;
  border-color: var(--surface-border-strong);
}

[data-theme="dark"] .doctor-quote-box,
[data-theme="dark"] .reading-announcement-box,
[data-theme="dark"] .reading-box-content {
  --quote-fade-bg: #141417;
  background: #141417;
  border-color: #2c2c36;
  color: var(--text-main);
}

[data-theme="dark"] .quote-label {
  color: #d4d4d8;
}

[data-theme="dark"] .student-notes-box,
[data-theme="dark"] .reading-notes-box {
  background: var(--surface-hover) !important;
  border-color: var(--surface-border-strong) !important;
  border-left-color: var(--surface-border-strong) !important;
}

[data-theme="dark"] .student-notes-header {
  color: var(--text-main) !important;
}

[data-theme="dark"] .grade-tracker-widget {
  background: var(--surface);
  border-color: var(--surface-border);
}

[data-theme="dark"] .grade-course-stat-card {
  background: #141417;
  border-color: var(--surface-border);
}

[data-theme="dark"] .grade-progress-bar-bg {
  background: #3f3f4c;
}

[data-theme="dark"] .course-badge-main {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}
[data-theme="dark"] .course-name-text {
  color: #f8fafc !important;
}

[data-theme="dark"] .stat-summary-card,
[data-theme="dark"] .stat-card {
  background: var(--surface);
  border-color: var(--surface-border);
}

[data-theme="dark"] .filter-chip {
  background: transparent;
  border-color: var(--surface-border);
  color: var(--text-muted);
}
[data-theme="dark"] .filter-chip:hover {
  background: var(--surface-hover);
  border-color: var(--surface-border-strong);
  color: var(--text-main);
}
[data-theme="dark"] .filter-chip.active {
  background: #f4f4f6;
  border-color: #f4f4f6;
  color: #111114;
  box-shadow: none;
}

[data-theme="dark"] .room-preset-btn {
  background: #1e1e24;
  border-color: #3f3f4c;
  color: var(--text-main);
}
[data-theme="dark"] .room-preset-btn:hover {
  background: #272730;
  border-color: #525260;
}
[data-theme="dark"] .room-preset-btn.is-active {
  background: #2c2c36;
  border-color: #f4f4f6;
  color: #ffffff;
}

[data-theme="dark"] .toast {
  background: #1e1e24;
  color: #f4f4f6;
  border: 1px solid #3f3f4c;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}


* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

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

/* Scalable Vector SVG Icons (Feather/Lucide standard) */
.ui-icon {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: -0.15em;
  stroke-width: 2;
  stroke: currentColor;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* Custom Scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}
::-webkit-scrollbar-corner {
  background: transparent;
}
::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

/* Horizontal sliding bars (Course legend & Quick links) */
.course-legend-bar::-webkit-scrollbar,
.quick-links-chips-row::-webkit-scrollbar {
  height: 4px;
}

/* Inline icon margin spacing utility */
.mr-1 {
  margin-right: 5px;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg);
  color: var(--text-main);
  line-height: 1.55;
  font-size: 13.5px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  padding-bottom: calc(24px + var(--safe-bottom));
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--surface-border);
  padding-top: var(--safe-top);
  box-shadow: var(--shadow-sm);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 8px;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.brand-bolt {
  width: 30px;
  height: 30px;
  background: #18181b;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .brand-bolt {
  background: #24242b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.brand-title {
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 4px;
}

.brand-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  background: var(--surface-hover);
  color: var(--text-main);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-full);
}

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

.wifi-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: var(--success-light);
  color: var(--text-main);
  border: 1px solid var(--success-border);
  min-height: 28px;
}

.wifi-status-badge.offline {
  background: var(--warning-light);
  color: #71717a;
  border-color: #d4d4d8;
}

.wifi-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: currentColor;
}

.btn-icon {
  width: 32px;
  height: 32px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  touch-action: manipulation;
}

.btn-icon::after {
  content: '';
  position: absolute;
  inset: -6px;
}

.btn-icon:hover, .btn-icon:active {
  background: var(--bg);
  color: var(--text-main);
  border-color: var(--surface-border-strong);
}

.btn-header-add {
  color: var(--primary) !important;
  background: var(--primary-light) !important;
  border-color: var(--surface-border-strong) !important;
}

.btn-header-add:hover, .btn-header-add:active {
  background: var(--primary) !important;
  color: #ffffff !important;
  border-color: var(--primary) !important;
}

[data-theme="dark"] .btn-header-add {
  background: var(--surface-hover) !important;
  color: var(--text-main) !important;
  border-color: var(--surface-border-strong) !important;
}

[data-theme="dark"] .btn-header-add:hover, [data-theme="dark"] .btn-header-add:active {
  background: #f4f4f6 !important;
  color: #111114 !important;
  border-color: #f4f4f6 !important;
}

.header-action-desktop {
  display: none;
}

.refresh-icon {
  font-size: 14px;
  display: inline-block;
}

.refresh-spinning {
  animation: spin 0.8s linear infinite;
}

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

#sync-banner-text {
  font-size: 10.5px;
  color: var(--text-muted);
  display: block;
  white-space: normal;
  line-height: 1.25;
  word-break: break-word;
  overflow: visible;
}

/* Main Navigation Tabs: Segmented Control (Hybrid 5 tabs mobile / 2 tabs desktop) */
.app-nav {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 3px;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 9px;
  margin: 8px auto 10px;
  max-width: 640px;
  width: calc(100% - 24px);
}

.nav-item {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 38px;
  padding: 6px 2px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.nav-item:active {
  background: rgba(0, 0, 0, 0.04);
}

.nav-item.active {
  background: var(--surface);
  color: var(--text-main);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.nav-icon svg {
  width: 14px;
  height: 14px;
}

.nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.badge-count {
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: var(--radius-full);
  background: var(--surface-hover);
  color: var(--text-main);
  border: 1px solid var(--surface-border);
  margin-left: 2px;
  flex-shrink: 0;
}

/* Responsive Hybrid Navigation Rules */
@media (max-width: 640px) {
  .header-action-desktop {
    display: none !important;
  }
  .nav-label-desktop {
    display: none !important;
  }
  .nav-label-mobile {
    display: inline !important;
  }
  .nav-item-mobile-only {
    display: flex !important;
  }
  .btn-setup-guide .setup-guide-label {
    display: none !important;
  }
  .btn-setup-guide {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    padding: 0 !important;
    justify-content: center !important;
    border-radius: 6px !important;
  }

  /* Header: only the wifi dot, add, and refresh (Schedule and Settings are bottom tabs). */
  .wifi-status-badge {
    padding: 0 !important;
    width: 28px !important;
    height: 28px !important;
    min-height: 28px !important;
    justify-content: center !important;
    border-radius: 50% !important;
  }
  #wifi-status-text {
    display: none !important;
  }

  /* Fixed Apple Liquid Glass WhatsApp footer (squared geometry) */
  .app-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    width: auto;
    max-width: none;
    margin: 0;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
    border: 0;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 0 !important;
    background: var(--surface);
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(24px) saturate(190%);
    -webkit-backdrop-filter: blur(24px) saturate(190%);
    box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.65), 0 -4px 16px rgba(0, 0, 0, 0.03);
    display: grid;
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 4px;
    transform: translateZ(0);
    will-change: transform;
    contain: layout paint;
  }

  [data-theme="dark"] .app-nav {
    background: #141417;
    background: rgba(14, 14, 18, 0.82);
    border-top: 1px solid rgba(255, 255, 255, 0.09);
    box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.06), 0 -4px 20px rgba(0, 0, 0, 0.35);
  }

  .nav-item {
    flex-direction: column;
    gap: 3px;
    font-size: 10px;
    font-weight: 600;
    min-height: 48px;
    padding: 4px 2px;
    position: relative;
    border-radius: 0 !important;
    background: transparent;
    color: var(--text-muted);
    opacity: 0.82;
    transition: color 0.15s ease, opacity 0.15s ease, background-color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .nav-item:hover {
    opacity: 1;
    color: var(--text-main);
  }

  .nav-item:active {
    transform: scale(0.96);
  }

  .nav-item .nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
  }

  .nav-item .nav-label {
    font-size: inherit;
    letter-spacing: -0.01em;
  }

  /* Liquid Glass squared active tab indicator */
  .nav-item.active {
    background: rgba(0, 0, 0, 0.04);
    color: var(--primary);
    opacity: 1;
    box-shadow: inset 0 2px 0 0 var(--primary);
    border-radius: 0 !important;
  }

  [data-theme="dark"] .nav-item.active {
    background: rgba(255, 255, 255, 0.06);
    color: var(--primary);
    box-shadow: inset 0 2px 0 0 var(--primary);
    border-radius: 0 !important;
  }

  .nav-item.active .nav-icon {
    color: var(--primary);
  }

  #badge-deadlines-count {
    position: absolute;
    top: 2px;
    right: 22%;
    margin-left: 0;
    font-size: 9px;
    padding: 1px 4px;
    border-radius: 0 !important;
  }
}

@media (max-width: 540px) {
  .header-content {
    padding: 8px 12px 6px;
  }
  .header-actions {
    gap: 4px;
  }
}

@media (max-width: 380px) {
  .header-content {
    padding: 7px 8px 5px;
  }
  .header-actions {
    gap: 3px;
  }
  .btn-icon, .btn-setup-guide {
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
  }
  .brand-title {
    font-size: 13.5px;
  }
  .brand-bolt {
    width: 26px;
    height: 26px;
  }
  .brand-badge {
    font-size: 9px;
    padding: 1px 4px;
  }
}

@media (min-width: 641px) {
  .header-action-desktop {
    display: inline-flex !important;
  }
  .nav-label-desktop {
    display: inline !important;
    font-size: 12px !important;
  }
  .nav-label-mobile {
    display: none !important;
  }
  .nav-item-mobile-only {
    display: none !important;
  }
  .app-nav {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 4px;
    padding: 4px;
    border-radius: 10px;
    width: calc(100% - 24px);
    max-width: 496px;
  }
  .btn-icon.active {
    background: var(--text-main);
    color: var(--bg);
    border-color: var(--text-main);
  }
  [data-theme="dark"] .btn-icon.active {
    background: #f4f4f6;
    color: #141417;
    border-color: #f4f4f6;
  }
  .nav-item {
    min-height: 40px;
    padding: 8px 14px;
    font-size: 12.5px;
    gap: 6px;
  }
  #btn-open-day-sheet {
    display: none !important;
  }
}

/* ==========================================================================
   Main Content Layout
   ========================================================================== */
.app-main {
  flex: 1;
  padding: 8px 12px 20px;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
}

@media (max-width: 640px) {
  .app-main {
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  }
}

.view-section {
  display: none;
}

.view-section.active {
  display: block;
  animation: sectionFadeIn 0.14s cubic-bezier(0.16, 1, 0.3, 1);
}

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

@media (prefers-reduced-motion: reduce) {
  .view-section.active {
    animation: none !important;
  }
}

/* ==========================================================================
   VIEW 1: Monthly Calendar (matches extension)
   ========================================================================== */
.calendar-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.month-title-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.month-heading {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-main);
  min-width: auto;
}

.cal-nav-btn {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  position: relative;
  transition: all 0.12s;
  touch-action: manipulation;
}

.cal-nav-btn::after {
  content: '';
  position: absolute;
  inset: -6px;
}

.cal-nav-btn:hover, .cal-nav-btn:active {
  background: #f1f5f9;
  color: var(--text-main);
}

.btn-today {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0 10px;
  height: 30px;
  min-height: 30px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.12s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  touch-action: manipulation;
}

.btn-today::after {
  content: '';
  position: absolute;
  inset: -6px;
}

.btn-today:hover, .btn-today:active {
  background: #f1f5f9;
  color: var(--primary);
  border-color: var(--surface-border-strong);
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  text-align: center;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-subtle);
  padding-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: repeat(var(--cal-rows, 5), minmax(0, 1fr));
  width: 100%;
  height: 356px;
  min-height: 356px;
  max-height: 356px;
  box-sizing: border-box;
  gap: 3px;
  background: var(--surface-border);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--surface-border);
  margin-bottom: 10px;
}

.cal-day-cell {
  background: var(--surface);
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
  padding: 4px 3px;
  border-radius: 5px;
  display: flex;
  flex-direction: column;
  transition: all 0.12s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  user-select: none;
}

.cal-day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 2px;
}

/* 6-row months (42 cells) tighten inner cell spacing so 2 chips fit cleanly inside each 1/6th row */
.calendar-grid.is-six-rows .cal-day-cell {
  padding: 3px 3px;
}

.calendar-grid.is-six-rows .cal-day-header {
  margin-bottom: 1px;
}

.calendar-grid.is-six-rows .day-number {
  font-size: 10px;
}

.calendar-grid.is-six-rows .cal-event-chips-container {
  gap: 1.5px;
  margin-top: 1px;
}

.calendar-grid.is-six-rows .cal-event-chip {
  font-size: 9px;
  line-height: 1.15;
  padding: 1px 4px;
}

.cal-day-cell:hover, .cal-day-cell:active {
  background: var(--surface-hover);
  box-shadow: inset 0 0 0 1.5px var(--surface-border-strong);
}

.cal-day-cell.other-month {
  background: var(--surface-hover);
  opacity: 0.55;
}

.cal-day-cell.other-month .day-number {
  color: var(--text-subtle);
}

.cal-day-cell.other-month:hover, .cal-day-cell.other-month:active {
  opacity: 0.9;
  background: var(--surface-border);
}

.cal-day-cell.is-today {
  box-shadow: inset 0 0 0 2px var(--primary) !important;
  background: var(--primary-light);
}

.cal-day-cell.is-today .day-number {
  font-weight: 800;
  color: var(--primary);
}

.cal-day-cell.is-selected {
  box-shadow: inset 0 0 0 2px var(--primary) !important;
  background: var(--surface-hover);
}

.day-number {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1;
}

/* Event Chips inside calendar cells (matches extension + mobile icon-only mode) */
.cal-event-chips-container {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 2px;
  overflow: hidden;
}

.cal-event-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.25;
  padding: 2px 5px;
  border-radius: 4px;
  color: white;
  border-left: 2px solid rgba(0, 0, 0, 0.25);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-event-chip .chip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cal-event-chip .chip-icon svg {
  width: 11px;
  height: 11px;
  stroke: currentColor;
}

.cal-event-chip.is-completed {
  background-color: #f4f4f5 !important;
  color: #52525b !important;
  border-left-width: 2.5px;
  border-left-style: solid;
  text-decoration: line-through;
  opacity: 0.88;
  box-shadow: none;
}

.cal-event-chip.is-completed .chip-icon,
.cal-event-chip.is-completed .chip-svg-icon,
.cal-event-chip.is-completed .ui-icon {
  stroke: var(--text-muted) !important;
  color: var(--text-muted) !important;
}

.cal-event-chip.is-completed .chip-text {
  color: #52525b !important;
}

[data-theme="dark"] .cal-event-chip.is-completed {
  background-color: #24242b !important;
  color: #f4f4f6 !important;
  border-left-width: 2.5px;
  border-left-style: solid;
  opacity: 0.88;
}

[data-theme="dark"] .cal-event-chip.is-completed .chip-icon,
[data-theme="dark"] .cal-event-chip.is-completed .chip-svg-icon,
[data-theme="dark"] .cal-event-chip.is-completed .ui-icon {
  stroke: var(--text-muted) !important;
  color: var(--text-muted) !important;
}

[data-theme="dark"] .cal-event-chip.is-completed .chip-text {
  color: #f1f5f9 !important;
}

.cal-event-chip.is-class {
  background: var(--surface-hover);
  border: 1px solid var(--surface-border);
  border-left-width: 3px !important;
  color: var(--text-main);
  font-weight: 500;
}

.cal-event-chip.is-class .chip-icon,
.cal-event-chip.is-class .ui-icon {
  width: 9px;
  height: 9px;
  color: var(--text-muted);
}

.cal-event-more {
  font-size: 8.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-align: right;
  padding-right: 2px;
}

.cal-event-more-dots {
  display: none;
}

/* On mobile / narrow screens (<640px): Status dots and mobile calendar layout */
@media (max-width: 640px) {
  .legend-header {
    display: none !important;
  }

  .calendar-grid {
    height: 260px;
    min-height: 260px;
    max-height: 260px;
  }

  .cal-day-cell {
    height: 100%;
    min-height: 0;
    align-items: center;
    justify-content: space-between;
    padding: 6px 2px;
  }

  .calendar-grid.is-six-rows .cal-day-cell {
    height: 100%;
    min-height: 0;
    padding: 4px 2px;
  }

  .cal-day-header {
    justify-content: center;
    margin-bottom: 0;
  }

  .cal-event-more-head {
    display: none;
  }

  .cal-event-more-dots {
    display: inline;
  }

  .cal-event-chips-container {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 3.5px;
    width: 100%;
    padding-bottom: 2px;
  }

  .cal-event-chip {
    width: 6.5px;
    height: 6.5px;
    min-width: 6.5px;
    padding: 0;
    border-radius: 50%;
    font-size: 0;
    box-shadow: none;
    border: none;
  }

  .cal-event-chip .chip-icon,
  .cal-event-chip .chip-text {
    display: none !important;
  }

  .cal-event-chip.is-completed {
    background-color: transparent !important;
    border-width: 1.75px !important;
    border-style: solid !important;
    border-color: inherit;
    opacity: 0.55;
  }

  .cal-event-more {
    font-size: 8.5px;
    line-height: 1;
    color: var(--text-muted);
    font-weight: 700;
  }

  /* Exclusively use slide-up drawer on mobile */
  #selected-day-container {
    display: none !important;
  }

  .calendar-tip {
    display: none !important;
  }

  /* 2-Column Mobile Grid for Quick Links */
  .quick-links-chips-row {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    overflow: visible !important;
    padding-bottom: 0 !important;
  }

  .ql-chip {
    width: 100% !important;
    min-width: 0 !important;
    padding: 8px 10px !important;
    justify-content: flex-start !important;
    box-sizing: border-box !important;
  }

  .ql-chip span,
  .ql-chip .ql-chip-label {
    display: inline !important;
    font-size: 12px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    flex: 1 !important;
    min-width: 0 !important;
  }
}

/* On wider screens (>=641px): Display text alongside icons, hide compact mobile up-next agenda */
@media (min-width: 641px) {
  #up-next-container,
  .up-next-card {
    display: none !important;
  }

  .cal-event-chip .chip-text {
    display: inline;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* Course Legend Bar (matches extension) */
.course-legend-panel {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm, 0px);
  margin-bottom: 8px;
  position: relative;
  overflow: hidden;
}

.legend-header {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-subtle);
  text-transform: uppercase;
  flex-shrink: 0;
  letter-spacing: 0.03em;
}

.legend-items {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  min-width: 0;
  padding: 2px 0;
}

.legend-items::-webkit-scrollbar {
  display: none;
}

.legend-scroll-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 24px;
  flex-shrink: 0;
  background: var(--surface-hover);
  border: 1px solid var(--surface-border);
  border-radius: 0 !important;
  color: var(--text-main);
  cursor: pointer;
  padding: 0;
  transition: background-color 0.12s ease, border-color 0.12s ease;
  z-index: 2;
  user-select: none;
}

.legend-scroll-btn:hover {
  background: var(--surface-border);
  border-color: var(--surface-border-strong);
}

.legend-scroll-btn .ui-icon {
  width: 12px;
  height: 12px;
}

[data-theme="dark"] .legend-scroll-btn {
  background: var(--surface-hover);
  border-color: var(--surface-border);
  color: var(--text-main);
}

[data-theme="dark"] .legend-scroll-btn:hover {
  background: var(--surface-border);
  border-color: var(--surface-border-strong);
}

.course-legend-panel.has-overflow-right {
  box-shadow: inset -4px 0 0 0 var(--surface-border-strong, rgba(128, 128, 128, 0.4));
}

.course-legend-panel.has-overflow-left {
  box-shadow: inset 4px 0 0 0 var(--surface-border-strong, rgba(128, 128, 128, 0.4));
}

.course-legend-panel.has-overflow-left.has-overflow-right {
  box-shadow: inset 4px 0 0 0 var(--surface-border-strong, rgba(128, 128, 128, 0.4)), inset -4px 0 0 0 var(--surface-border-strong, rgba(128, 128, 128, 0.4));
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--surface-hover);
  border: 1px solid var(--surface-border);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.legend-chip:hover {
  background: var(--surface-hover);
  border-color: var(--surface-border-strong);
}

.legend-chip.is-active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--text-main);
  font-weight: 600;
}

.legend-items.has-active-filter .legend-chip:not(.is-active) {
  opacity: 0.65;
}

.legend-color-box {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.calendar-tip {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  padding: 4px 8px;
  margin-top: 2px;
}

/* ==========================================================================
   Selected Day Deadlines Container (Matches Extension Layout)
   ========================================================================== */
.selected-day-container {
  margin-top: 10px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 10px;
}

.selected-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--surface-border);
  gap: 8px;
}

.selected-day-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.selected-day-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-xs-add,
.btn-xs-sheet {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-main);
  background: var(--surface-hover);
  border: 1px solid var(--surface-border-strong);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  transition: all 0.15s ease;
  position: relative;
  touch-action: manipulation;
}

.btn-xs-add::after,
.btn-xs-sheet::after {
  content: '';
  position: absolute;
  inset: -6px;
}

.btn-xs-add:hover,
.btn-xs-sheet:hover {
  background: var(--surface-border);
}

.selected-day-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 250px;
  overflow-y: auto;
}

.selected-day-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--surface-border);
  border-left-width: 4px;
  transition: all 0.12s;
  cursor: pointer;
}

.selected-day-item:hover {
  border-color: var(--surface-border-strong);
  background: var(--surface-hover);
}

.selected-day-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.selected-day-course {
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-theme="dark"] .selected-day-course {
  color: #f8fafc !important;
}

.selected-day-item-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.selected-day-item.status-completed .selected-day-item-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

.selected-day-meta-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.selected-day-time {
  display: inline-flex;
  align-items: center;
}

.selected-day-weight {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 0;
  background: var(--surface-hover);
  color: var(--text-main);
  border: 1px solid var(--surface-border);
}

.selected-day-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.btn-sel-action {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  padding: 4px 7px;
  font-size: 11px;
  border-radius: 5px;
  cursor: pointer;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  transition: all 0.12s;
  position: relative;
  touch-action: manipulation;
}

.btn-sel-action::after {
  content: '';
  position: absolute;
  inset: -5px;
}

.btn-sel-action:hover {
  background: var(--surface-hover);
  color: var(--text-main);
  border-color: var(--surface-border-strong);
}

.selected-day-empty {
  text-align: center;
  padding: 14px 8px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ==========================================================================
   Up Next Agenda Card (Compact Agenda Below Calendar)
   ========================================================================== */
.up-next-card {
  margin: 10px 0;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.up-next-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.up-next-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 5px;
}

.up-next-subtitle {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-hover);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--surface-border);
}

.up-next-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.up-next-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  background: var(--surface-hover);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  transition: background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease, transform 0.1s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  user-select: none;
  content-visibility: auto;
  contain-intrinsic-size: 0 54px;
}

.up-next-item:active {
  transform: scale(0.99);
}

.up-next-item:hover {
  border-color: var(--surface-border-strong);
}

.up-next-checkbox {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: 50%;
  border: 1.5px solid var(--surface-border-strong);
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all 0.15s ease;
  color: #fff;
  flex-shrink: 0;
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.up-next-checkbox::after {
  content: '';
  position: absolute;
  inset: -6px;
}

.up-next-checkbox svg {
  width: 13px;
  height: 13px;
  stroke-width: 2.5;
  stroke: currentColor;
  opacity: 0;
  transform: scale(0.6);
  pointer-events: none;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

@media (hover: hover) and (pointer: fine) {
  .up-next-checkbox:hover {
    border-color: var(--success);
    background: var(--surface-hover);
  }
}

.up-next-checkbox.is-checked,
.up-next-checkbox.checked {
  background: var(--success) !important;
  border-color: var(--success) !important;
  color: #ffffff !important;
}

.up-next-checkbox.is-checked svg,
.up-next-checkbox.checked svg {
  opacity: 1 !important;
  transform: scale(1) !important;
}

.up-next-item-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.up-next-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.up-next-course-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 600;
  padding: 1.5px 6px;
  border-radius: 999px;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.up-next-course-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.up-next-course-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.up-next-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.up-next-badge.badge-today {
  background: #f4f4f5;
  color: #18181b;
  border: 1px solid rgba(113, 113, 122, 0.2);
}

.up-next-badge.badge-tomorrow {
  background: #f4f4f5;
  color: #71717a;
  border: 1px solid rgba(113, 113, 122, 0.2);
}

.up-next-badge.badge-future {
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--surface-border);
}

.up-next-badge.badge-overdue {
  background: #f4f4f5;
  color: #18181b;
  border: 1px solid #f4f4f6;
}

.up-next-item-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.up-next-item-time {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.up-next-room-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 6px;
  padding-left: 6px;
  border-left: 1px solid var(--surface-border);
  color: var(--text-subtle);
}

.up-next-empty {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 6px 4px;
}

/* Dark mode for Up Next */
[data-theme="dark"] .up-next-card {
  background: var(--surface);
  border-color: var(--surface-border);
}

[data-theme="dark"] .up-next-item {
  background: var(--surface-hover);
  border-color: var(--surface-border);
}

[data-theme="dark"] .up-next-checkbox {
  background: var(--surface);
  border-color: var(--surface-border-strong);
}

[data-theme="dark"] .up-next-checkbox.is-checked,
[data-theme="dark"] .up-next-checkbox.checked {
  background: var(--success) !important;
  border-color: var(--success) !important;
  color: #ffffff !important;
}

[data-theme="dark"] .up-next-checkbox.is-checked svg,
[data-theme="dark"] .up-next-checkbox.checked svg {
  opacity: 1 !important;
  transform: scale(1) !important;
}

[data-theme="dark"] .up-next-badge.badge-today {
  background: rgba(113, 113, 122, 0.15);
  color: #f4f4f6;
  border-color: rgba(113, 113, 122, 0.3);
}

[data-theme="dark"] .up-next-badge.badge-tomorrow {
  background: rgba(113, 113, 122, 0.15);
  color: #a1a1aa;
  border-color: rgba(113, 113, 122, 0.3);
}

[data-theme="dark"] .up-next-badge.badge-future {
  background: var(--surface);
  color: var(--text-muted);
  border-color: var(--surface-border);
}

@media (min-width: 641px) {
  #up-next-container,
  .up-next-card {
    display: none !important;
  }
}

/* ==========================================================================
   VIEW 2: Deadlines List & Filters (matches extension)
   ========================================================================== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.stat-pill {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
}

.stat-num {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}

.stat-txt {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 2px;
}

.stat-urgent .stat-num { color: var(--stat-urgent); }
.stat-week .stat-num { color: var(--stat-week); }
.stat-total .stat-num { color: var(--success); }

/* Grade Tracker Progress Card */
.grade-tracker-widget {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
  transition: border-color 0.15s ease;
}

.grade-tracker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  min-height: 26px;
}

.grade-tracker-breakdown {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.grade-course-stat-card {
  background: var(--bg);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  padding: 8px 10px;
}

.search-toolbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.search-input-box {
  position: relative;
  width: 100%;
}

.search-field {
  width: 100%;
  min-height: 40px;
  padding: 7px 12px 7px 34px;
  font-size: 12.5px;
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-main);
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s;
}

.search-field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  color: var(--text-subtle);
  pointer-events: none;
}

.filter-chips {
  display: flex;
  gap: 6px;
}

.filter-chip {
  padding: 6px 14px;
  min-height: 34px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: var(--radius-full);
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #64748b;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.1s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.filter-chip:active {
  transform: scale(0.96);
}

.filter-chip:hover {
  background: #f1f5f9;
  color: #1e293b;
  border-color: #cbd5e1;
}

.filter-chip.active {
  background: #18181b;
  color: #ffffff;
  border-color: #18181b;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.filter-dropdowns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 0;
}

.mobile-select {
  width: 100%;
  min-height: 38px;
  padding: 6px 32px 6px 10px;
  font-size: 12px;
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px 14px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  color: var(--text-main);
  outline: none;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.mobile-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

/* Action Bar */
.deadlines-action-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.deadlines-action-bar .btn-primary-action,
.deadlines-action-bar .btn-add-action {
  min-height: 40px;
  padding: 8px 10px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

/* Task Cards (matches extension) */
.deadlines-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  transition: background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease, transform 0.1s cubic-bezier(0.16, 1, 0.3, 1);
  border-left-width: 4px;
  cursor: pointer;
  content-visibility: auto;
  contain-intrinsic-size: 0 88px;
}

.task-card:active {
  transform: scale(0.99);
}

.task-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--surface-border-strong);
}

.task-card.is-active-reading {
  background: var(--primary-light);
  border-top-color: var(--primary);
  border-right-color: var(--primary);
  border-bottom-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light), var(--shadow-sm);
}

.task-card.is-completed {
  opacity: 0.65;
  background: var(--surface-hover);
}

/* Course Banner with Permanent Subject Color */
.task-course-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 2px;
}

.course-badge-main {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3.5px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  max-width: 78%;
  min-width: 0;
  flex: 1;
  border: 1px solid transparent;
}

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

.course-emoji {
  font-size: 11px;
  flex-shrink: 0;
}

.course-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}


.task-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Type Pills */
.type-pill {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.type-quiz { background: #f4f4f5; color: #52525b; }
.type-assignment { background: var(--surface-hover); color: var(--text-main); border: 1px solid var(--surface-border-strong); }
.type-exam { background: #f4f4f5; color: #18181b; }
.type-project { background: #f4f4f5; color: #18181b; }
.type-lab { background: #f4f4f5; color: #18181b; }
.type-meeting { background: var(--surface-hover); color: var(--text-main); border: 1px solid var(--surface-border-strong); }
.type-other { background: #f1f5f9; color: #475569; }


.task-title-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.status-checkbox-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--surface-border-strong);
  background: transparent;
  color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-top: 0;
  flex-shrink: 0;
  position: relative;
  transition: all 0.15s;
  touch-action: manipulation;
}

.status-checkbox-btn::after {
  content: '';
  position: absolute;
  inset: -8px;
}

.status-checkbox-btn:hover {
  border-color: var(--success);
}

.status-checkbox-btn.checked {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
  font-size: 12px;
}

.task-title-text {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.45;
  flex: 1;
}

.task-card.is-completed .task-title-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-due-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  margin-top: 2px;
}

/* Urgency Badges */
.urgency-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3.5px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
}

.urgency-badge.overdue { background: var(--danger-light); color: var(--danger); border: 1px solid var(--danger-border); }
.urgency-badge.today { background: var(--danger-light); color: var(--danger); border: 1px solid var(--danger-border); }
.urgency-badge.tomorrow { background: var(--warning-light); color: #52525b; border: 1px solid #d4d4d8; }
.urgency-badge.soon { background: var(--surface-hover); color: var(--text-main); border: 1px solid var(--surface-border-strong); }
.urgency-badge.future { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.urgency-badge.completed { background: var(--success-light); color: var(--success); border: 1px solid var(--success-border); }

.task-weight-pill {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 0 !important;
  background: var(--surface-hover);
  color: var(--text-main);
  border: 1px solid var(--surface-border);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  letter-spacing: -0.01em;
}

.task-weight-pill.weight-major {
  background: var(--surface-hover);
  color: var(--text-main);
  border-color: var(--surface-border-strong);
  font-weight: 700;
}

.task-weight-pill.weight-medium {
  background: var(--surface-hover);
  color: var(--text-muted);
  border-color: var(--surface-border);
}

.meta-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  background: #f1f5f9;
  color: var(--text-muted);
}

.meta-pill.time-class {
  background: var(--surface-hover);
  color: var(--text-main);
  border: 1px solid var(--surface-border);
}

/* Submission & Graded Badges */
.task-grade-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2.5px 7px;
  border-radius: 4px;
  background: rgba(113, 113, 122, 0.12);
  color: #71717a;
  border: 1px solid rgba(113, 113, 122, 0.3);
}

[data-theme="dark"] .task-grade-pill {
  background: rgba(113, 113, 122, 0.2);
  color: #a1a1aa;
  border-color: rgba(113, 113, 122, 0.4);
}

.task-submitted-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2.5px 7px;
  border-radius: 0;
  background: var(--surface-hover);
  color: var(--text-main);
  border: 1px solid var(--surface-border);
}

[data-theme="dark"] .task-submitted-pill {
  background: var(--surface-hover);
  color: var(--text-main);
  border-color: var(--surface-border);
}

/* Doctor's announcement quote (expandable, antislop craft) */
.doctor-quote-box {
  --quote-fade-bg: #f8fafc;
  background: #f8fafc;
  border: 1px solid var(--surface-border);
  border-left: 3px solid var(--surface-border-strong);
  border-radius: 0 !important;
  padding: 6px 9px;
  margin-top: 4px;
  transition: background-color 0.15s ease;
}

.quote-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.quote-label {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 3px;
  letter-spacing: 0.02em;
}

.quote-body {
  font-size: 11.5px;
  font-style: italic;
  color: var(--text-main);
  line-height: 1.4;
  white-space: pre-line;
  word-break: break-word;
  transition: max-height 0.2s ease;
}

.quote-body.clamped {
  max-height: 4.5em;
  overflow: hidden;
  position: relative;
}

.quote-body.clamped::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 20px;
  background: linear-gradient(to bottom, transparent, var(--quote-fade-bg, #f8fafc));
  pointer-events: none;
}

.quote-body.expanded {
  max-height: none;
  overflow: visible;
}

.btn-toggle-quote {
  background: transparent;
  border: none;
  color: var(--primary);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 2px;
  margin-top: 4px;
  min-height: 30px;
}

.btn-toggle-quote:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

.btn-inspect-quote {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 5px;
}

.btn-inspect-quote:hover {
  color: var(--text-main);
}

/* Student Notes Box */
.student-notes-box {
  margin-top: 4px;
  padding: 8px 10px;
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  border-left: 3.5px solid var(--primary);
  border-radius: 0 8px 8px 0;
}

.student-notes-header {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 2px;
}

.student-notes-body {
  font-size: 12px;
  color: var(--text-main);
  white-space: pre-wrap;
  line-height: 1.45;
}

/* Card Action Buttons */
.task-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--surface-border);
}

.btn-card-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s;
  min-height: 32px;
}

.btn-card-action:hover, .btn-card-action:active {
  background: #f1f5f9;
  color: var(--text-main);
  border-color: var(--surface-border-strong);
}

.btn-card-action.btn-gcal {
  color: var(--text-main);
  background: var(--surface-hover);
  border-color: var(--surface-border-strong);
}

.btn-card-action.btn-gcal:hover {
  background: var(--surface-border);
}

/* ==========================================================================
   VIEW 3: Schedule & Syllabus Cards (matches extension)
   ========================================================================== */
.info-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}

.info-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.info-card-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-icon {
  font-size: 16px;
}

.info-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.info-badge {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 0 !important;
}

.info-badge.green {
  background: var(--surface-hover);
  color: var(--text-main);
  border: 1px solid var(--surface-border);
}

.info-badge.blue {
  background: var(--surface-hover);
  color: var(--text-main);
  border: 1px solid var(--surface-border);
}

.settings-pill {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.4;
  padding: 1px 6px;
  border-radius: 0 !important;
  white-space: nowrap;
  border: 1px solid var(--surface-border);
  background: var(--surface-hover);
  color: var(--text-muted);
}
.settings-pill.pill-green {
  color: var(--text-main);
  background: var(--surface-hover);
  border-color: var(--surface-border-strong, var(--text-muted));
}
.settings-pill.pill-blue {
  color: var(--text-main);
  background: var(--surface-hover);
  border-color: var(--surface-border);
}
.settings-pill.pill-gray {
  color: var(--text-muted);
  background: var(--surface-hover);
  border-color: var(--surface-border);
}
.settings-pill.pill-orange {
  color: var(--text-main);
  background: var(--surface-hover);
  border-color: var(--surface-border);
}
[data-theme="dark"] .settings-pill.pill-blue { color: #f4f4f6; background: rgba(113, 113, 122, 0.18); }
[data-theme="dark"] .settings-pill.pill-green { color: var(--text-main); background: var(--surface-hover); border-color: var(--surface-border); }
[data-theme="dark"] .settings-pill.pill-gray { color: var(--text-muted); background: var(--surface-hover); border-color: var(--surface-border); }
[data-theme="dark"] .settings-pill.pill-orange { color: #d4d4d8; background: rgba(113, 113, 122, 0.18); }

.info-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 10px;
}

/* ==========================================================================
   VIEW 4: Cloud Settings, Push Alerts & WebCal
   ========================================================================== */
/* Settings groups: Sync, Calendar, Alerts, General (one shown at a time) */
.settings-group-nav {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 8px 0;
  margin-bottom: 4px;
  background: var(--bg);
}

.settings-group-nav .filter-chip {
  padding: 6px 4px;
  min-height: 40px;
  font-size: 12px;
  white-space: nowrap;
}

/* Six sections: two rows of three on small phones, one row when there is room */
@media (min-width: 440px) {
  .settings-group-nav {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

.settings-group[hidden] {
  display: none !important;
}

.settings-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}

.settings-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

.settings-icon-title {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.settings-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.settings-card-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.settings-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 10px;
}

/* Toggle Switch */
.toggle-control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-hover);
  border: 1px solid var(--surface-border);
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 10px;
  min-height: 48px;
}

.toggle-text-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toggle-main-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-main);
}

.toggle-status-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: .2s ease;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

input:checked + .slider {
  background-color: var(--primary);
}

input:checked + .slider:before {
  transform: translateX(18px);
}

.slider.round {
  border-radius: 24px;
}

.slider.round:before {
  border-radius: 50%;
}

[data-theme="dark"] .slider {
  background-color: #3f3f4c;
}

[data-theme="dark"] input:checked + .slider {
  background-color: #f4f4f6;
}

[data-theme="dark"] input:checked + .slider:before {
  background-color: #111114;
}

.notification-timing-notes {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-main);
  background: var(--surface-hover);
  border: 1px solid var(--surface-border);
  padding: 10px 12px;
  border-radius: 0;
  margin-bottom: 10px;
}

.timing-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.45;
}

.timing-bullet {
  font-size: 11.5px;
  flex-shrink: 0;
}

/* Action Buttons */
.card-action-bar {
  display: flex;
  gap: 8px;
}

.calendar-action-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.btn-primary-action:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary-action {
  min-height: 40px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--primary);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  transition: all 0.15s ease;
}

[data-theme="dark"] .btn-primary-action {
  background: #f4f4f6;
  color: #111114;
  border-color: transparent;
  box-shadow: none;
}

.btn-primary-action:hover, .btn-primary-action:active {
  background: var(--primary-hover);
  transform: translateY(-1px);
}
[data-theme="dark"] .btn-primary-action:hover,
[data-theme="dark"] .btn-primary-action:active {
  background: #ffffff;
}

.btn-add-action {
  min-height: 40px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--surface-border-strong);
  border-radius: 8px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
  transition: all 0.15s ease;
}

.btn-add-action:hover, .btn-add-action:active {
  background: var(--surface-hover);
  border-color: var(--text-muted);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  background: var(--primary);
  color: #ffffff;
  border: 1px solid transparent;
  border-radius: 8px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-primary:hover, .btn-primary:active {
  background: var(--primary-hover);
}

[data-theme="dark"] .btn-primary {
  color: #111114;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  background: var(--surface);
  color: var(--text-main);
  border: 1px solid var(--surface-border-strong);
  border-radius: 0;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-secondary:hover, .btn-secondary:active {
  background: var(--surface-hover);
}

.btn-outline-action {
  min-height: 40px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  color: var(--text-main);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-outline-action:hover, .btn-outline-action:active {
  background: var(--surface-hover);
  border-color: var(--surface-border-strong);
}

.feed-url-display {
  background: var(--surface-hover);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.feed-url-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-subtle);
  display: block;
  margin-bottom: 4px;
}

.feed-url-code {
  font-size: 11px;
  font-family: monospace;
  color: var(--primary);
  word-break: break-all;
  line-height: 1.4;
}

.instructions-details {
  border-top: 1px solid var(--surface-border);
  padding-top: 8px;
  margin-top: 8px;
}

.instructions-summary {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  padding: 5px 0;
}

.instructions-content {
  padding: 6px 0;
  font-size: 11.5px;
  color: var(--text-muted);
}

.steps-list {
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  line-height: 1.45;
}

.sync-metrics {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface-hover);
  border: 1px solid var(--surface-border);
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 10px;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
}

.metric-label {
  color: var(--text-muted);
}

.metric-val {
  font-weight: 600;
  color: var(--text-main);
}

/* ==========================================================================
   DAY DRAWER (Bottom Sheet)
   ========================================================================== */
.day-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  z-index: 90;
  transition: opacity 0.2s ease;
}

.day-sheet-backdrop.hidden {
  display: none;
  opacity: 0;
}

.day-sheet-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 580px;
  margin: 0 auto;
  background: var(--surface);
  border-top: 1px solid var(--surface-border);
  border-radius: 18px 18px 0 0;
  z-index: 100;
  padding: 14px 16px calc(20px + var(--safe-bottom));
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: translate3d(0, 0, 0);
  will-change: transform;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.day-sheet-drawer.hidden {
  display: none;
  transform: translate3d(0, 100%, 0);
}

.day-sheet-drag-handle {
  display: flex;
  justify-content: center;
  padding-bottom: 8px;
}

.drag-pill {
  width: 36px;
  height: 4px;
  background: var(--surface-border-strong);
  border-radius: 2px;
}

.day-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--surface-border);
  padding-bottom: 8px;
}

.day-sheet-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.day-sheet-count {
  font-size: 11.5px;
  color: var(--text-muted);
  display: block;
  margin-top: 1px;
}

.btn-icon-close {
  width: 28px;
  height: 28px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-hover);
  border: 1px solid var(--surface-border);
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
  touch-action: manipulation;
}

.btn-icon-close::after {
  content: '';
  position: absolute;
  inset: -7px;
}

.btn-icon-close:hover {
  background: var(--surface-border);
  color: var(--text-main);
}

.day-sheet-items {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
}

/* Empty, Loading, Error States */
.state-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
}

.state-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.state-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.state-desc {
  font-size: 12px;
  color: var(--text-muted);
  max-width: 280px;
  line-height: 1.4;
}

/* Toast Alerts */
.toast-container {
  position: fixed;
  bottom: calc(20px + var(--safe-bottom));
  left: 16px;
  right: 16px;
  max-width: 380px;
  margin: 0 auto;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

@media (max-width: 640px) {
  .toast-container {
    bottom: calc(76px + var(--safe-bottom));
  }
}

.toast {
  background: #18181b;
  border: 1px solid #3f3f46;
  color: #f4f4f6;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  animation: toastIn 0.2s ease-out;
}

.toast-btn-action {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #f4f4f6;
  font-weight: 700;
  font-size: 11.5px;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.toast-btn-action:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

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

/* ==========================================================================
   Action Bars & Modals (Bi-directional editing)
   ========================================================================== */
.day-sheet-action-row {
  margin-bottom: 10px;
}

.btn-day-add {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--surface-hover);
  border: 1px solid var(--surface-border-strong);
  border-radius: 8px;
  color: var(--text-main);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-day-add:hover {
  background: var(--surface-border);
}

.btn-card-action.btn-card-edit {
  color: #475569;
}

.btn-card-action.btn-card-edit:hover {
  background: #f1f5f9;
  color: #0f172a;
}

[data-theme="dark"] .btn-card-action.btn-card-edit {
  color: var(--text-main);
  background: var(--surface-hover);
  border-color: var(--surface-border);
}

[data-theme="dark"] .btn-card-action.btn-card-edit:hover {
  background: #2c2c34;
  color: #ffffff;
  border-color: var(--surface-border-strong);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  padding-top: calc(12px + var(--safe-top));
  padding-bottom: calc(12px + var(--safe-bottom));
}

.modal-backdrop.hidden {
  display: none;
}

.modal-card {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 18px 18px calc(20px + var(--safe-bottom));
  animation: modalIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--surface-border);
}

.modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.btn-modal-close {
  width: 28px;
  height: 28px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  border: 1px solid var(--surface-border);
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
  touch-action: manipulation;
}

.btn-modal-close::after {
  content: '';
  position: absolute;
  inset: -8px;
}

.btn-modal-close:hover {
  background: var(--surface-hover);
  color: var(--text-main);
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 520px) {
  .form-row-2 {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-main);
}

.form-input, .form-select, .form-textarea {
  min-height: 38px;
  padding: 7px 10px;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--text-main);
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s;
}

.form-select {
  padding-right: 32px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px 14px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  cursor: pointer;
}

.form-textarea {
  min-height: 65px;
  resize: vertical;
  line-height: 1.45;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--surface-border);
}

.modal-footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

@media (max-width: 480px) {
  .modal-footer {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 8px;
  }
  .modal-footer-right {
    display: flex;
    gap: 8px;
    width: 100%;
  }
  .modal-footer-right .btn-secondary-action,
  .modal-footer-right .btn-save-action {
    flex: 1;
    justify-content: center;
    min-height: 42px;
  }
  .modal-footer .btn-danger-action {
    width: 100%;
    justify-content: center;
    min-height: 40px;
  }
}

.btn-save-action {
  min-height: 38px;
  padding: 0 16px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  transition: all 0.15s ease;
}

.btn-save-action:hover {
  background: var(--primary-hover);
}

[data-theme="dark"] .btn-save-action {
  background: #f4f4f6;
  color: #111114 !important;
  box-shadow: none;
}

[data-theme="dark"] .btn-save-action:hover,
[data-theme="dark"] .btn-save-action:active {
  background: #ffffff;
}

.btn-secondary-action {
  min-height: 38px;
  padding: 0 14px;
  background: #f1f5f9;
  color: var(--text-main);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-secondary-action:hover {
  background: var(--surface-hover);
}

.btn-danger-action {
  min-height: 38px;
  padding: 0 12px;
  background: #f4f4f5;
  color: #18181b;
  border: 1px solid #e4e4e7;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-danger-action:hover {
  background: #e4e4e7;
}

/* ==========================================================================
   Room Pill & Quick Selector
   ========================================================================== */
.room-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--surface-hover);
  color: var(--text-main);
  border: 1px solid var(--surface-border-strong);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  min-height: 30px;
  transition: all 0.15s ease;
}

.room-pill-btn:hover, .room-pill-btn:focus-visible {
  background: var(--surface-border);
  color: var(--text-main);
  border-color: var(--text-muted);
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.room-edit-hint {
  font-size: 10px;
  opacity: 0.8;
}

/* ==========================================================================
   Deadlines Layout
   ========================================================================== */
.deadlines-split-layout {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

.deadlines-reading-col {
  display: none !important;
}

/* Reading Pane Styling */
.reading-pane-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 0 !important;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.reading-pane-card.is-empty {
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 36px 20px;
  color: var(--text-muted);
}

.reading-pane-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.reading-course-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  background: var(--surface-hover);
  border: 1px solid var(--surface-border);
  color: var(--text-main);
  font-size: 11px;
  font-weight: 600;
  border-radius: 0 !important;
  max-width: 260px;
  min-width: 0;
}

.reading-course-badge .course-color-dot {
  width: 8px;
  height: 8px;
  border-radius: 0 !important;
  flex-shrink: 0;
  display: inline-block;
}

.reading-course-badge .course-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reading-sheet-modal-card .type-pill,
.reading-pane-card .type-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: var(--surface-hover);
  border: 1px solid var(--surface-border);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 0 !important;
}

.reading-pane-title {
  font-family: "Inter Tight", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--text-main);
  margin: 0;
  word-break: break-word;
}

.reading-meta-section {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 2px;
  margin-bottom: 2px;
}

.reading-meta-section .urgency-badge,
.reading-meta-section .room-pill-btn,
.reading-meta-section .task-weight-pill,
.reading-meta-section .task-target-pill,
.reading-meta-section .task-grade-pill,
.reading-meta-section .task-submitted-pill,
.reading-meta-section .high-priority-tag {
  height: 24px;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 0 !important;
  box-sizing: border-box;
  letter-spacing: -0.01em;
  line-height: 1;
}

.reading-meta-section .urgency-badge {
  background: var(--surface-hover);
  border: 1px solid var(--surface-border);
  color: var(--text-main);
}

.reading-meta-section .urgency-badge.overdue {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-accent);
}

.reading-meta-section .room-pill-btn {
  background: var(--surface-hover);
  border: 1px solid var(--surface-border);
  color: var(--text-main);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: all 0.12s ease;
}

.reading-meta-section .room-pill-btn:hover {
  background: var(--surface);
  border-color: var(--surface-border-strong);
}

.reading-meta-section .room-edit-hint {
  opacity: 0.6;
  font-size: 10px;
  margin-left: 2px;
}

.reading-meta-section .task-weight-pill {
  background: var(--surface-hover) !important;
  border: 1px solid var(--surface-border) !important;
  color: var(--text-main) !important;
  font-weight: 600 !important;
}

.reading-meta-section .task-target-pill,
.reading-meta-section .task-grade-pill,
.reading-meta-section .task-submitted-pill {
  background: var(--surface-hover);
  border: 1px solid var(--surface-border);
  color: var(--text-main);
}

.reading-meta-section .high-priority-tag {
  background: var(--surface-hover);
  border: 1px solid var(--surface-border-strong);
  color: var(--text-main);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.reading-announcement-box {
  background: var(--bg);
  border: 1px solid var(--surface-border);
  border-radius: 0 !important;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-top: 4px;
}

.reading-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--surface-hover);
  border-bottom: 1px solid var(--surface-border);
}

.reading-box-title {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.btn-copy-announcement {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  padding: 3px 8px;
  height: 26px;
  border-radius: 0 !important;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: none !important;
  appearance: none;
  -webkit-appearance: none;
  transition: all 0.12s ease;
}

.btn-copy-announcement:hover {
  background: var(--surface-hover);
  color: var(--text-main);
  border-color: var(--surface-border-strong);
}

.reading-box-content {
  padding: 12px 14px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-main);
  background: transparent;
  white-space: pre-line;
  word-break: break-word;
  max-height: 48vh;
  overflow-y: auto;
}

.reading-notes-box {
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--surface-border);
  border-left: 3px solid var(--primary);
  border-radius: 0 !important;
}

.reading-notes-header {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 4px;
}

.reading-notes-content {
  font-size: 12px;
  color: var(--text-main);
  white-space: pre-wrap;
  line-height: 1.45;
}

.reading-actions-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--surface-border);
}

.reading-actions-bar .modal-reading-toggle-btn,
.reading-actions-bar .reading-toggle-status-btn {
  flex: 1;
  min-height: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 14px;
  background: var(--primary);
  color: var(--on-accent);
  border: 1px solid var(--primary);
  border-radius: 0 !important;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: none !important;
  appearance: none;
  -webkit-appearance: none;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.reading-actions-bar .modal-reading-toggle-btn:hover,
.reading-actions-bar .reading-toggle-status-btn:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.reading-actions-bar .modal-reading-share-btn,
.reading-actions-bar .modal-reading-gcal-btn,
.reading-actions-bar .modal-reading-edit-btn,
.reading-actions-bar .reading-share-btn,
.reading-actions-bar .reading-edit-btn,
.reading-actions-bar .btn-outline-action,
.reading-actions-bar .btn-card-action {
  height: 38px;
  min-height: 38px;
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--text-main);
  border: 1px solid var(--surface-border);
  border-radius: 0 !important;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: none !important;
  appearance: none;
  -webkit-appearance: none;
  text-decoration: none;
  box-sizing: border-box;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.reading-actions-bar .modal-reading-share-btn:hover,
.reading-actions-bar .modal-reading-gcal-btn:hover,
.reading-actions-bar .modal-reading-edit-btn:hover,
.reading-actions-bar .reading-share-btn:hover,
.reading-actions-bar .reading-edit-btn:hover,
.reading-actions-bar .btn-outline-action:hover,
.reading-actions-bar .btn-card-action:hover {
  background: var(--surface-hover);
  border-color: var(--surface-border-strong);
  color: var(--text-main);
}

@media (max-width: 480px) {
  .reading-actions-bar {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }
  .reading-actions-bar .modal-reading-toggle-btn,
  .reading-actions-bar .reading-toggle-status-btn {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    min-height: 42px !important;
    height: 42px !important;
    font-size: 13px !important;
    justify-content: center !important;
  }
  .reading-actions-bar .modal-reading-share-btn,
  .reading-actions-bar .modal-reading-gcal-btn,
  .reading-actions-bar .modal-reading-edit-btn,
  .reading-actions-bar .reading-share-btn,
  .reading-actions-bar .reading-edit-btn,
  .reading-actions-bar a.btn-outline-action,
  .reading-actions-bar .btn-outline-action {
    min-height: 38px !important;
    height: 38px !important;
    justify-content: center !important;
    font-size: 12px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
}

/* Mobile Reading Sheet */
#modal-reading-sheet {
  contain: layout style;
}

.reading-sheet-modal-card {
  max-width: 440px;
  width: 100%;
  border-radius: 0 !important;
  transform: translateZ(0);
  will-change: transform;
}

.reading-sheet-modal-card .modal-close-btn {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 0 !important;
  font-size: 13px;
  line-height: 1;
  padding: 0;
  transition: all 0.12s ease;
}

.reading-sheet-modal-card .modal-close-btn:hover {
  background: var(--surface-hover);
  border-color: var(--surface-border);
  color: var(--text-main);
}

.reading-modal-badge-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.reading-modal-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

/* Room Picker Modal */
.room-picker-modal-card {
  max-width: 460px;
  width: 100%;
}

.room-picker-instruction {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.room-presets-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.room-preset-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  min-height: 40px;
  transition: all 0.15s ease;
}

.room-preset-btn:hover {
  background: var(--surface-hover);
  border-color: var(--surface-border-strong);
}

.room-preset-btn.is-active {
  background: var(--surface-hover);
  border-color: var(--primary);
  color: var(--text-main);
  font-weight: 700;
}

.room-preset-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.room-preset-code {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.room-preset-course {
  font-size: 11px;
  color: var(--text-muted);
}

.room-custom-wrapper {
  padding-top: 10px;
  border-top: 1px solid var(--surface-border);
}

.room-custom-input-row {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.room-custom-input-row .form-input {
  flex: 1;
}

/* ==========================================================================
   AI / Jev Announcement Extractor & Auto-Weight Styles
   ========================================================================== */
.extract-modal-card {
  max-width: 540px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
}

.extract-status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.4;
}

.extract-status-pill.loading {
  background: var(--surface-hover);
  border: 1px solid var(--surface-border-strong);
  color: var(--text-main);
}

.extract-status-pill.success {
  background: var(--surface-hover);
  border: 1px solid var(--surface-border-strong);
  color: var(--text-main);
}

.extract-status-pill.rejected {
  background: #f4f4f5;
  border: 1px solid #d4d4d8;
  color: #52525b;
}

.extract-status-pill.error {
  background: #f4f4f5;
  border: 1px solid #e4e4e7;
  color: #18181b;
}

.extract-result-item {
  background: #ffffff;
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease;
}

.extract-result-item:hover {
  border-color: var(--surface-border-strong);
}

.extract-result-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.extract-result-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.extract-result-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.extract-result-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

.badge-type-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: var(--surface-hover);
  color: var(--text-main);
  border: 1px solid var(--surface-border);
}

.badge-weight-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 0;
  background: var(--surface-hover);
  color: var(--text-main);
  border: 1px solid var(--surface-border);
}

.badge-room-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: var(--surface-hover);
  border: 1px solid var(--surface-border);
  color: var(--text-muted);
}

/* ==========================================================================
   Mobile Icon-Only & Responsive Text Rules
   ========================================================================== */
.calendar-grid {
  touch-action: pan-y pinch-zoom;
  user-select: none;
}

/* Responsive Action Bar & Card Buttons Rules */
.btn-action-text-mobile {
  display: none;
}
.btn-action-text-desktop {
  display: inline;
}

@media (max-width: 480px) {
  .btn-action-text-mobile {
    display: inline;
  }
  .btn-action-text-desktop {
    display: none;
  }
  .deadlines-action-bar {
    gap: 6px;
  }
  .deadlines-action-bar .btn-primary-action,
  .deadlines-action-bar .btn-add-action {
    padding: 8px 8px !important;
    font-size: 12px !important;
    min-height: 42px !important;
  }
  .task-card-footer {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
  }
  .btn-card-action {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 7px 8px !important;
    font-size: 11.5px !important;
    min-height: 38px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .btn-card-action .btn-responsive-label {
    display: inline !important;
  }
}

@media (max-width: 380px) {
  .deadlines-action-bar .btn-primary-action,
  .deadlines-action-bar .btn-add-action {
    padding: 8px 4px !important;
    font-size: 11.5px !important;
  }
  .btn-card-action {
    padding: 6px 4px !important;
    font-size: 11px !important;
    gap: 3px !important;
  }
}

/* ==========================================================================
   Academic Quick Links (Bar, Chips, Cards, Modal)
   ========================================================================== */
.calendar-quick-links-bar {
  margin: 12px 0;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.quick-links-bar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.quick-links-bar-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 5px;
}

.btn-xs-manage-links {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-main);
  background: var(--surface-hover);
  border: 1px solid var(--surface-border-strong);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  transition: all 0.15s ease;
  min-height: 28px;
  touch-action: manipulation;
}

.btn-xs-manage-links:hover {
  background: var(--surface-border);
}

.quick-links-chips-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.ql-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  background: var(--surface-hover);
  border: 1px solid var(--surface-border);
  border-radius: 9999px;
  padding: 6px 12px;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  min-height: 32px;
  touch-action: manipulation;
}

.ql-chip:hover {
  background: var(--surface-hover);
  border-color: var(--surface-border-strong);
  color: var(--text-main);
  transform: translateY(-1px);
}

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

.ql-chip-external-icon {
  width: 12px;
  height: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
  opacity: 0.7;
}

.ql-chip span,
.ql-chip .ql-chip-label {
  display: inline !important;
  font-size: 12px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  flex: 1 !important;
  min-width: 0 !important;
}

@media (max-width: 640px) {
  .quick-links-chips-row {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    overflow: visible !important;
    padding-bottom: 0 !important;
  }

  .ql-chip {
    width: 100% !important;
    min-width: 0 !important;
    padding: 8px 10px !important;
    justify-content: flex-start !important;
    box-sizing: border-box !important;
  }
}

/* Category tokens */
.ql-cat-attendance { --cat-color: var(--text-main); --cat-bg: var(--surface-hover); }
.ql-cat-study_plan { --cat-color: var(--text-main); --cat-bg: var(--surface-hover); }
.ql-cat-marks { --cat-color: var(--text-main); --cat-bg: var(--surface-hover); }
.ql-cat-portal { --cat-color: var(--text-main); --cat-bg: var(--surface-hover); }
.ql-cat-other { --cat-color: var(--text-main); --cat-bg: var(--surface-hover); }

.quick-links-modal-card {
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.ql-item-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  transition: all 0.15s ease;
}

.ql-item-card:hover {
  border-color: var(--surface-border-strong);
  background: var(--surface-hover);
}

.ql-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.ql-item-icon-box {
  width: 34px;
  height: 34px;
  border-radius: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 15px;
}

.ql-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.ql-item-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
  flex: 1;
}

.ql-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.35;
}

.ql-category-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.ql-item-url {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: monospace;
}

.ql-item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

@media (max-width: 520px) {
  .ql-item-card {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 11px 12px;
  }
  .ql-item-actions {
    justify-content: flex-end;
    padding-top: 8px;
    border-top: 1px solid var(--surface-border);
    width: 100%;
  }
}

.btn-ql-open {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  transition: all 0.12s ease;
  min-height: 32px;
}

.btn-ql-open:hover {
  background: var(--primary-hover);
}

[data-theme="dark"] .btn-ql-open {
  background: #f4f4f6;
  color: #111114 !important;
}

[data-theme="dark"] .btn-ql-open:hover,
[data-theme="dark"] .btn-ql-open:active {
  background: #ffffff;
}

.btn-ql-action {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.12s ease;
  touch-action: manipulation;
}

.btn-ql-action:hover {
  background: var(--surface-hover);
  color: var(--text-main);
  border-color: var(--surface-border-strong);
}

.btn-ql-action.delete:hover {
  color: var(--danger);
  border-color: #d4d4d8;
  background: #f4f4f5;
}

/* Quick Links Reorder Controls & Drag and Drop */
.ql-move-group {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.btn-ql-move {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  border-radius: 0 !important;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.12s ease;
}

.btn-ql-move:hover:not(:disabled),
.btn-ql-move:active:not(:disabled) {
  background: var(--surface-hover);
  color: var(--text-main);
  border-color: var(--surface-border-strong);
}

.btn-ql-move:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.ql-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 28px;
  cursor: grab;
  color: var(--text-muted);
  opacity: 0.55;
  user-select: none;
  font-size: 13px;
  letter-spacing: -1px;
}

.ql-drag-handle:hover {
  opacity: 1;
  color: var(--text-main);
}

.ql-item-card.is-dragging {
  opacity: 0.45;
  background: var(--surface-hover);
  border: 1px dashed var(--text-muted);
}

.ql-item-card.drag-over-top {
  border-top: 2px solid var(--text-main) !important;
}

.ql-item-card.drag-over-bottom {
  border-bottom: 2px solid var(--text-main) !important;
}

/* Quick Links Icon Library Picker Grid */
.ql-icon-picker-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  padding: 8px;
  border-radius: 0 !important;
  max-height: 190px;
  overflow-y: auto;
}

.ql-icon-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 2px;
  min-height: 46px;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 0 !important;
  transition: all 0.12s ease;
  user-select: none;
  touch-action: manipulation;
}

.ql-icon-tile:hover {
  background: var(--surface-hover);
  color: var(--text-main);
  border-color: var(--surface-border-strong);
}

.ql-icon-tile.is-selected {
  background: var(--surface-hover);
  color: var(--text-main);
  border-color: var(--text-main);
  box-shadow: inset 0 0 0 1px var(--text-main);
}

.ql-icon-tile svg {
  width: 17px;
  height: 17px;
  stroke-width: 2;
}

.ql-icon-tile-label {
  font-size: 9px;
  line-height: 1.1;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Dark mode overrides */
[data-theme="dark"] .calendar-quick-links-bar {
  background: var(--surface);
  border-color: var(--surface-border);
}
[data-theme="dark"] .btn-xs-manage-links {
  background: #24242b;
  border-color: var(--surface-border-strong);
  color: var(--text-main);
}
[data-theme="dark"] .btn-xs-manage-links:hover {
  background: #2c2c34;
}
[data-theme="dark"] .ql-chip {
  background: var(--surface);
  border-color: var(--surface-border);
  color: var(--text-main);
}
[data-theme="dark"] .ql-chip:hover {
  background: var(--surface-hover);
  border-color: var(--surface-border-strong);
  color: #ffffff;
}
[data-theme="dark"] .ql-item-card {
  background: var(--surface);
  border-color: var(--surface-border);
}
[data-theme="dark"] .ql-item-card:hover {
  background: var(--surface-hover);
  border-color: var(--surface-border-strong);
}
[data-theme="dark"] .btn-ql-action {
  background: var(--surface-hover);
  border-color: var(--surface-border);
  color: var(--text-muted);
}
[data-theme="dark"] .btn-ql-action:hover {
  background: #2c2c34;
  border-color: var(--surface-border-strong);
  color: #ffffff;
}
[data-theme="dark"] .btn-ql-action.delete:hover {
  background: rgba(113, 113, 122, 0.2);
  color: #f4f4f6;
  border-color: rgba(113, 113, 122, 0.4);
}

/* ==========================================================================
   Setup Guide & Onboarding Walkthrough Modal
   ========================================================================== */
.btn-setup-guide {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--surface-hover);
  color: var(--text-main);
  border: 1px solid var(--surface-border);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-setup-guide:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-setup-guide .ui-icon {
  width: 14px;
  height: 14px;
  color: var(--primary);
}

@media (max-width: 640px) {
  .btn-setup-guide .setup-guide-label {
    display: none;
  }
  .btn-setup-guide {
    width: 32px;
    height: 32px;
    padding: 0;
    justify-content: center;
    border-radius: 6px;
    position: relative;
    touch-action: manipulation;
  }
  .btn-setup-guide::after {
    content: '';
    position: absolute;
    inset: -6px;
  }
}

.onboarding-modal-card {
  max-width: 580px;
  width: 100%;
}

.onboarding-header {
  border-bottom: 1px solid var(--surface-border);
  padding-bottom: 12px;
  margin-bottom: 14px;
}

.onboarding-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(113, 113, 122, 0.12);
  color: var(--primary);
  padding: 2.5px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 4px;
}

.onboarding-badge .ui-icon {
  width: 12px;
  height: 12px;
}

.onboarding-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 8px 12px;
  background: var(--surface-hover);
  border-radius: 10px;
  border: 1px solid var(--surface-border);
  margin-bottom: 16px;
}

.step-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.step-indicator:hover {
  color: var(--text-main);
}

.step-indicator.active {
  color: var(--primary);
  background: rgba(113, 113, 122, 0.12);
}

.step-indicator.completed {
  color: var(--text-main);
}

.step-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  font-weight: 700;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  color: inherit;
}

.step-indicator.active .step-num {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.step-indicator.completed .step-num {
  background: var(--text-muted);
  color: #ffffff;
  border-color: var(--text-muted);
}

.step-divider {
  flex: 1;
  height: 1px;
  background: var(--surface-border);
  min-width: 6px;
}

.onboarding-step-pane {
  display: none;
}

.onboarding-step-pane.active {
  display: block;
  animation: fadeIn 0.18s ease;
}

.onboarding-step-hero {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--surface-border);
}

.step-hero-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(113, 113, 122, 0.1);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-hero-icon .ui-icon {
  width: 20px;
  height: 20px;
}

.step-hero-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 3px;
}

.step-hero-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0;
}

.onboarding-instructions-list {
  padding-left: 20px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-main);
}

.onboarding-instructions-list li {
  margin: 0;
}

.onboarding-instructions-list code {
  background: var(--surface-hover);
  border: 1px solid var(--surface-border);
  padding: 1.5px 5.5px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 11px;
  color: var(--primary);
}

.onboarding-note-box {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  background: var(--surface-hover);
  border: 1px solid var(--surface-border);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--text-main);
}

.onboarding-note-box .ui-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: var(--primary);
  margin-top: 1px;
}

.onboarding-pairing-card {
  background: var(--surface-hover);
  border: 1px solid var(--surface-border);
  padding: 14px;
  border-radius: 10px;
  margin-bottom: 14px;
}

.onboarding-inline-pair-form {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.onboarding-pairing-status {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
  min-height: 16px;
}

.onboarding-feature-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.onboarding-feature-item {
  background: var(--surface-hover);
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  padding: 12px 14px;
}

.feature-item-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

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

.onboarding-feature-item p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0;
}

.onboarding-footer {
  display: flex;
  align-items: center;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--surface-border);
  gap: 8px;
}

[data-theme="dark"] .onboarding-badge {
  background: rgba(113, 113, 122, 0.2);
}

[data-theme="dark"] .step-hero-icon {
  background: rgba(113, 113, 122, 0.2);
}

@media (max-width: 480px) {
  .onboarding-stepper {
    padding: 6px 8px;
    gap: 3px;
  }
  .step-indicator {
    padding: 4px 6px;
    gap: 4px;
    font-size: 11px;
  }
  .step-indicator:not(.active) .step-name {
    display: none;
  }
  .step-indicator.active .step-name {
    display: inline;
    font-weight: 700;
  }
  .onboarding-step-hero {
    gap: 10px;
    margin-bottom: 12px;
  }
  .step-hero-icon {
    width: 34px;
    height: 34px;
  }
  .step-hero-title {
    font-size: 13.5px;
  }
  .step-hero-desc {
    font-size: 11.5px;
  }
}

@media (max-width: 360px) {
  .onboarding-stepper .step-name {
    display: none !important;
  }
  .step-indicator {
    padding: 4px 6px;
  }
}



/* In-app update prompt */
.app-update-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10000;
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  background: #18181b; color: #fff; font-size: 13px; font-weight: 600;
}
.app-update-banner[hidden] { display: none; }
.app-update-banner span { flex: 1; min-width: 0; }
.app-update-banner button {
  border: 0; border-radius: 8px; padding: 6px 12px; font-weight: 700; cursor: pointer;
  background: #fff; color: #27272a;
}
.app-update-banner button#btn-update-banner-dismiss { background: transparent; color: #fff; }

/* Swiss Grid Design System - Geometric 0px Borders & Flat Structure */
*, *::before, *::after {
  border-radius: 0 !important;
}


/* Bigger tap area for the small header and calendar buttons without changing how they look */
.btn-icon::after,
.btn-today::after,
.btn-xs-manage-links::after {
  content: '';
  position: absolute;
  inset: -6px;
}
.btn-today,
.btn-xs-manage-links {
  position: relative;
}

/* ==========================================================================
   Design system (docs/DESIGN_SYSTEM.md), shared with the companion and the landing page:
   two-tone colours, Inter Tight / Inter, 0px corners, no gradients, and one primary
   action per screen (--accent: black in light mode, white in dark mode).
   ========================================================================== */
@font-face {
  font-family: "Inter";
  src: url("fonts/inter.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter Tight";
  src: url("fonts/inter-tight.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

h1, h2, h3 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

.btn-scan-main,
.btn-primary,
.btn-primary-action,
.btn-save-action,
[data-theme="dark"] .btn-scan-main,
[data-theme="dark"] .btn-primary,
[data-theme="dark"] .btn-primary-action,
[data-theme="dark"] .btn-save-action {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.btn-scan-main:hover,
.btn-primary:hover,
.btn-primary-action:hover,
.btn-save-action:hover,
[data-theme="dark"] .btn-scan-main:hover,
[data-theme="dark"] .btn-primary:hover,
[data-theme="dark"] .btn-primary-action:hover,
[data-theme="dark"] .btn-save-action:hover,
[data-theme="dark"] .btn-primary-action:active,
[data-theme="dark"] .btn-save-action:active {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--on-accent);
}

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

/* Overdue stands out by inverting the two tones, since the interface has no red */
.urgency-badge.overdue,
[data-theme="dark"] .urgency-badge.overdue {
  background: var(--primary);
  color: var(--on-accent);
  border-color: var(--primary);
}

/* ==========================================================================
   Tablet & Desktop viewports:
   - 641px-899px: compact 520px single-column extension silhouette (496x356 grid).
   - 900px+: 2-column dashboard on Calendar keeping the exact 496x356 calendar
     shape on the left beside sticky Deadlines on the right, with the 4-tab
     sections bar across the top.
   ========================================================================== */
@media (min-width: 641px) {
  .header-content,
  .app-main {
    max-width: 520px;
  }
  .app-nav {
    max-width: 496px;
  }
}

@media (min-width: 900px) {
  .header-content,
  .app-main {
    max-width: 1020px;
  }
  .app-nav {
    max-width: 996px;
  }

  .app-main.is-dashboard {
    display: grid;
    grid-template-columns: 496px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
  }
  .app-main.is-dashboard > #view-calendar,
  .app-main.is-dashboard > #view-deadlines {
    display: block;
  }
  .app-main.is-dashboard > #view-deadlines {
    position: sticky;
    top: 132px;
    max-height: calc(100vh - 148px);
    overflow-y: auto;
    padding-right: 2px;
  }

  /* In 2-column dashboard, Up Next + Quick Links sit under the calendar and date clicks open the centered sheet */
  .app-main.is-dashboard #selected-day-container {
    display: none !important;
  }
  .app-main.is-dashboard #up-next-container,
  .app-main.is-dashboard .up-next-card {
    display: block !important;
  }

  /* Single-column tabs (Deadlines, Marks, Courses, Settings) stay comfortably centered */
  .app-main:not(.is-dashboard) > .view-section.active {
    max-width: 760px;
    margin-left: auto;
    margin-right: auto;
  }

  /* Day sheet opens as a centred dialog when triggered */
  .day-sheet-drawer {
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
    border: 1px solid var(--surface-border);
    max-height: 70vh;
  }
  .day-sheet-drawer.hidden {
    transform: translateY(-50%);
  }
}

/* Marks list (shared markup from src/utils/marks.ts) */
.marks-empty { font-size: 12px; color: var(--text-muted); padding: 8px 2px; }
.marks-course { border: 1px solid var(--surface-border, var(--border)); padding: 5px 8px; display: flex; flex-direction: column; gap: 2px; }
.marks-course-head { display: flex; align-items: center; gap: 6px; margin-bottom: 1px; }
.marks-dot { width: 8px; height: 8px; flex: 0 0 8px; }
.marks-course-name { font-size: 12px; font-weight: 700; color: var(--text-main); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.marks-course-total { font-size: 11px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.marks-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; font-size: 11px; color: var(--text-main); padding: 2px 0; border-top: 1px solid var(--surface-border, var(--border)); }
.marks-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.marks-weight { grid-column: 1; grid-row: 2; font-size: 9.5px; color: var(--text-muted); line-height: 1.2; }
.marks-right { grid-column: 2; grid-row: 1 / span 2; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn-delete-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  margin-left: 2px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 0;
  opacity: 0.72;
  flex-shrink: 0;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}
.btn-delete-mark:hover,
.btn-delete-mark:focus-visible {
  opacity: 1;
  color: var(--danger, #e53e3e);
  border-color: var(--danger, #e53e3e);
  background: rgba(229, 62, 62, 0.08);
  outline: none;
}
.btn-enter-mark-score {
  font-family: inherit;
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 6px;
  min-height: 18px;
  border: 1px solid var(--surface-border-strong);
  background: var(--surface);
  color: var(--text-main);
  cursor: pointer;
  border-radius: 0;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.btn-enter-mark-score:hover,
.btn-enter-mark-score:focus-visible {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--surface-hover);
  outline: none;
}
.marks-score { font-weight: 700; font-variant-numeric: tabular-nums; }
.marks-pct { font-size: 10.5px; color: var(--text-muted); min-width: 38px; text-align: right; font-variant-numeric: tabular-nums; }
.marks-awaiting { font-size: 10.5px; color: var(--text-muted); }
.marks-awaiting.waiting {
  background: var(--surface-hover);
  color: var(--text-muted);
  border: 1px solid var(--surface-border-strong);
  padding: 1px 5px;
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  border-radius: 0;
}

/* Syllabus Progress bars (shared markup from src/utils/syllabusProgress.ts) */
.syl-bar { display: flex; width: 100%; height: 6px; background: var(--surface-border); overflow: hidden; margin: 2px 0; }
.syl-done { background: var(--text-main); height: 100%; }
.syl-pending { background: var(--text-muted); opacity: 0.55; height: 100%; }
.syl-legend { display: flex; justify-content: space-between; gap: 6px; font-size: 10.5px; color: var(--text-muted); }

/* GPA card */
.gpa-head { display: flex; align-items: baseline; gap: 10px; padding: 2px 2px 8px; border-bottom: 1px solid var(--surface-border); }
.gpa-value { font-family: 'Inter Tight', var(--font-sans, sans-serif); font-size: 26px; font-weight: 800; color: var(--text-main); line-height: 1; }
.gpa-caption { font-size: 11px; color: var(--text-muted); }
.gpa-letter { display: inline-block; min-width: 26px; padding: 1px 5px; margin-left: 6px; text-align: center; font-size: 11px; font-weight: 800; background: var(--text-main); color: var(--bg); }
.gpa-detail { font-size: 10.5px; color: var(--text-muted); padding-left: 14px; }
.gpa-note { font-size: 10px; color: var(--text-muted); padding: 6px 2px 0; border-top: 1px solid var(--surface-border); }

/* GPA Target Grade & Exam Score Calculator */
.gpa-target-wrap { margin-top: 6px; padding: 6px 8px; background: var(--surface-hover); border: 1px solid var(--surface-border); }
.gpa-target-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.gpa-target-label { font-weight: 700; font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.gpa-target-chips { display: flex; gap: 3px; }
.target-chip { border: 1px solid var(--surface-border); background: var(--surface); color: var(--text-muted); font-size: 10px; font-weight: 700; padding: 1px 5px; cursor: pointer; border-radius: 0 !important; font-family: inherit; }
.target-chip:hover { color: var(--text-main); border-color: var(--text-main); }
.target-chip.is-active { background: var(--text-main); color: var(--bg); border-color: var(--text-main); }
.target-chip.is-unattainable { opacity: 0.35; cursor: not-allowed; text-decoration: line-through; }
.target-chip.is-guaranteed { border-color: var(--text-main); font-weight: 800; }
.gpa-target-desc { font-size: 10.5px; color: var(--text-muted); line-height: 1.35; }
.target-highlight { color: var(--text-main); font-weight: 700; }

/* Courses tab: Grades and Syllabus Progress cards (same markup in both apps) */
.grade-tracker-widget.course-summary-card { background: var(--surface); border: 1px solid var(--surface-border); padding: 0; margin: 0 0 10px; box-shadow: none; }
.course-summary-card .grade-tracker-header { width: 100%; min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; background: transparent; border: 0; color: var(--text-main); font: inherit; text-align: left; cursor: pointer; }
.course-summary-card .grade-tracker-header:focus-visible { outline: 2px solid var(--text-main); outline-offset: -2px; }
.course-summary-title { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.course-summary-right { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; }
.course-summary-right .info-badge { font-size: 11px; }
.course-summary-arrow { width: 14px; height: 14px; transition: transform 0.2s; }
.course-summary-card .grade-tracker-header[aria-expanded="true"] .course-summary-arrow { transform: rotate(90deg); }
.course-summary-card .grade-tracker-breakdown { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0 12px 12px; }
.course-summary-card .grade-tracker-breakdown[hidden] { display: none; }
.course-summary-card .marks-row { margin-left: 0; }

/* Marks Tab: Standalone Full-Width Structure */
#view-marks #mobile-grades-tracker {
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0 0 8px;
  box-shadow: none;
}
#view-marks #mobile-grades-tracker-toggle-btn {
  display: none !important;
}
#view-marks #mobile-grades-tracker-breakdown {
  display: flex !important;
  flex-direction: column;
  gap: 6px;
  padding: 0;
}

/* Dual-Column GPA Overview */
.marks-gpa-overview {
  margin-bottom: 8px;
}
.gpa-head-dual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
@media (max-width: 360px) {
  .gpa-head-dual {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}
.marks-gpa-stat-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: nowrap;
  white-space: nowrap;
}
.marks-gpa-stat-label {
  font-size: 10.5px;
  color: var(--text-muted);
  line-height: 1.25;
  white-space: nowrap;
}
.marks-gpa-col {
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 0 !important;
  display: flex;
  flex-direction: column;
}
.marks-gpa-col-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.marks-gpa-big {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
  font-family: "Inter Tight", -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1;
}
.marks-gpa-big.is-target {
  color: var(--primary);
}
.marks-gpa-cgpa-row {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 2px;
}
.marks-gpa-cgpa-val {
  color: var(--text-main);
  font-weight: 700;
}
.marks-gpa-goal-bar {
  margin-top: 6px;
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 0 !important;
}
.target-rounding-note {
  margin-top: 6px;
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.35;
  padding: 4px 6px;
  background: var(--surface-hover);
  border: 1px solid var(--surface-border);
  border-radius: 0 !important;
}
.target-rounding-title {
  color: var(--text-main);
  font-weight: 600;
  display: block;
}
.target-rounding-sub {
  display: block;
  font-size: 9.5px;
  margin-top: 2px;
}
.target-plan-unattainable {
  margin-top: 6px;
  padding: 6px 8px;
  background: var(--surface-hover);
  border: 1px solid var(--surface-border);
  font-size: 10.5px;
  line-height: 1.35;
  border-radius: 0 !important;
}
.target-unattainable-title {
  color: var(--text-main);
  font-weight: 700;
  display: block;
}
.target-unattainable-sub {
  display: block;
  color: var(--text-muted);
  font-size: 10px;
  margin-top: 2px;
}
.btn-target-chip-val {
  padding: 1px 6px;
  font-size: 10px;
  height: 22px;
  min-height: 22px;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 0 !important;
  font-family: inherit;
}
.btn-target-chip-val:hover {
  color: var(--text-main);
  border-color: var(--text-main);
}
.btn-target-chip-val.is-active {
  background: var(--text-main) !important;
  color: var(--bg) !important;
  border-color: var(--text-main) !important;
  font-weight: 700;
}
.btn-set-max-gpa,
.btn-set-max-cgpa {
  border-radius: 0 !important;
  font-family: inherit;
  margin-top: 4px;
  font-size: 10px;
  padding: 2px 6px;
  border: 1px solid var(--surface-border);
  color: var(--text-main);
  cursor: pointer;
}
.marks-goal-mode-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--surface-border);
  flex-wrap: wrap;
}
.marks-mode-toggle {
  display: inline-flex;
  border: 1px solid var(--surface-border);
  background: var(--surface-hover);
  border-radius: 0 !important;
}
.btn-goal-mode {
  border-radius: 0 !important;
  transition: background 0.12s ease, color 0.12s ease;
}
.btn-goal-mode.is-active {
  background: var(--text-main) !important;
  color: var(--bg) !important;
  font-weight: 700 !important;
}
.gpa-guide-panel {
  border-radius: 0 !important;
  animation: fadeIn 0.15s ease-out;
}
.gpa-guide-step {
  margin-bottom: 8px;
}
.gpa-guide-step:last-child {
  margin-bottom: 0;
}
.gpa-guide-step-title {
  font-weight: 700;
  color: var(--text-main);
  font-size: 11px;
  margin-bottom: 2px;
}
.gpa-guide-step-body {
  font-size: 10.5px;
  color: var(--text-muted);
  line-height: 1.4;
}
.gpa-guide-step-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  padding: 1px 4px;
}
.semester-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  margin-bottom: 8px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 0 !important;
  flex-wrap: wrap;
}
.semester-bar .form-select {
  min-height: 28px !important;
  height: 28px !important;
  font-size: 11.5px !important;
  padding: 2px 26px 2px 8px !important;
  background-position: right 6px center !important;
  background-size: 12px 12px !important;
  border-radius: 0 !important;
}
.semester-bar .btn-xs-manage-links {
  min-height: 28px !important;
  height: 28px !important;
  font-size: 11px !important;
  padding: 2px 8px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 0 !important;
}
.btn-add-course-bonus,
.btn-add-bonus-trigger {
  min-height: 20px !important;
  height: 20px !important;
  width: auto !important;
  padding: 1px 7px !important;
  font-size: 10px !important;
  line-height: 18px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 0 !important;
}
.marks-row-bonus {
  background: rgba(34, 197, 94, 0.05);
  border-left: 2px solid var(--text-main);
  padding-left: 4px;
}
[data-theme="dark"] .marks-row-bonus {
  background: rgba(255, 255, 255, 0.04);
  border-left-color: var(--primary);
}
.marks-course {
  border-radius: 0 !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.marks-course:hover {
  border-color: var(--surface-border-strong);
}
.marks-grade-badge-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.marks-course-pct {
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-main);
  background: var(--surface-hover);
  border: 1px solid var(--surface-border);
  padding: 2px 6px;
  border-radius: 0 !important;
}
.marks-course-letter {
  font-size: 11px;
  font-weight: 800;
  color: var(--bg);
  background: var(--text-main);
  padding: 2px 7px;
  min-width: 18px;
  text-align: center;
  border-radius: 0 !important;
}
.marks-course-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 5px;
  border-top: 1px dashed var(--surface-border);
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}
.marks-drop-notice {
  font-size: 10px;
  color: var(--warning, #e6a23c);
  background: var(--surface-hover);
  padding: 3px 6px;
  border-left: 2px solid var(--warning, #e6a23c);
  border-radius: 0 !important;
}

/* Target Grade Breakdown & Course Cards */
.target-breakdown-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 0 !important;
  margin-top: 10px;
  margin-bottom: 8px;
  box-shadow: none;
}
.target-breakdown-header {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: transparent;
  border: 0;
  color: var(--text-main);
  font: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 0 !important;
}
.target-breakdown-header:focus-visible {
  outline: 2px solid var(--text-main);
  outline-offset: -2px;
}
.target-breakdown-header[aria-expanded="true"] .course-summary-arrow {
  transform: rotate(90deg);
}
.target-breakdown-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0 10px 10px;
}
.target-breakdown-content[hidden] {
  display: none !important;
}
.marks-section-wrap {
  margin-top: 10px;
  margin-bottom: 8px;
}
.target-course-card {
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  margin-bottom: 6px;
  border-radius: 0 !important;
}
.target-course-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.target-trend-pill {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border: 1px solid var(--surface-border);
  background: var(--surface-hover);
  color: var(--text-muted);
  border-radius: 0 !important;
}
.target-trend-pill[data-trend="improving"] {
  color: var(--text-main);
  font-weight: 700;
}
.target-trend-pill[data-trend="needs-focus"] {
  color: var(--text-muted);
  border-style: dashed;
}
.trajectory-graph-wrap {
  margin-top: 6px;
  padding: 4px 6px;
  background: var(--surface-hover);
  border: 1px solid var(--surface-border);
  border-radius: 0 !important;
}
.trajectory-bar-track {
  position: relative;
  height: 6px;
  background: var(--surface-border);
  width: 100%;
  border-radius: 0 !important;
}
.trajectory-bar-earned {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: var(--primary);
  border-radius: 0 !important;
}
.trajectory-bar-needed {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--text-muted);
  opacity: 0.65;
  border-radius: 0 !important;
}
.target-task-list {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
}
.target-task-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  padding: 3px 0;
  border-top: 1px solid var(--surface-border);
}
.target-task-name {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  flex: 1;
}
.target-task-score {
  font-weight: 700;
  color: var(--text-main);
  font-size: 11px;
  flex-shrink: 0;
}

/* Pairing QR scanner */
.qr-scan-trigger { display: inline-flex; align-items: center; justify-content: center; gap: 6px; margin-top: 8px; }
#btn-scan-pairing-qr { width: 100%; padding: 8px 12px; font-size: 12px; }
.qr-scan-overlay { position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--bg); }
.qr-scan-overlay[hidden] { display: none !important; }
.qr-scan-box { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 12px; }
.qr-scan-title { margin: 0; font-size: 16px; font-weight: 800; color: var(--text-main); }
.qr-scan-frame { position: relative; width: 100%; aspect-ratio: 1; background: var(--surface); border: 2px solid var(--text-main); overflow: hidden; }
.qr-scan-frame video { width: 100%; height: 100%; object-fit: cover; display: block; }
.qr-scan-status { margin: 0; font-size: 12.5px; line-height: 1.4; color: var(--text-muted); min-height: 2.8em; }

/* Quick Link icons: line icons in the text colour, no category colours */
.ql-chip-icon { width: 13px; height: 13px; flex-shrink: 0; color: var(--text-main); display: inline-block; vertical-align: middle; }
.ql-item-icon-box { background: var(--surface-hover); color: var(--text-main); border: 1px solid var(--surface-border); border-radius: 0 !important; }
.ql-item-icon-box .ql-icon { width: 16px; height: 16px; display: inline-block; vertical-align: middle; flex-shrink: 0; }
.ql-category-badge { background: var(--surface-hover); color: var(--text-muted); }

/* My Courses editor (Schedule tab) */
.user-courses-list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.user-course-empty { font-size: 12px; color: var(--text-muted); padding: 12px 4px; }
.user-course-card { border: 1px solid var(--surface-border); border-left-width: 4px; border-radius: 0 !important; padding: 10px 12px; background: var(--surface); display: flex; flex-direction: column; gap: 6px; }
.user-course-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.user-course-name { font-size: 13.5px; font-weight: 700; color: var(--text-main); }
.user-course-code { font-size: 11px; color: var(--text-muted); }
.user-course-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.user-course-badge { font-size: 10.5px; padding: 2px 7px; border: 1px solid var(--surface-border); border-radius: 0 !important; color: var(--text-main); }
.user-course-none { font-size: 11px; font-style: italic; color: var(--text-muted); }
.user-course-total { font-size: 10.5px; color: var(--text-muted); }
.user-course-total.is-full { color: var(--text-main); font-weight: 700; }
.form-optional { font-weight: normal; color: var(--text-muted); }
.course-color-row { display: flex; align-items: center; gap: 8px; }
.course-color-row input[type="color"] { width: 38px; height: 38px; padding: 0; border: 1px solid var(--surface-border); border-radius: 0 !important; background: transparent; flex-shrink: 0; }
.course-editor-section { border-top: 1px solid var(--surface-border); padding-top: 10px; margin-top: 12px; }
.course-editor-section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.course-editor-rows { display: flex; flex-direction: column; gap: 8px; }
.course-editor-row { border: 1px solid var(--surface-border); border-radius: 0 !important; padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.course-editor-row-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.course-editor-row-top .form-input { flex: 1; min-width: 0; }
.course-editor-row-fields { display: flex; gap: 6px; }
.course-editor-row-fields label { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 10px; color: var(--text-muted); }
.course-row-remove { border: none; background: transparent; color: var(--text-muted); font-size: 14px; width: 32px; height: 32px; flex-shrink: 0; cursor: pointer; }
.day-pills-row { display: flex; flex-wrap: wrap; gap: 4px; }
.day-pill-btn { border: 1px solid var(--surface-border); background: transparent; color: var(--text-main); border-radius: 0 !important; font-size: 11px; padding: 6px 8px; min-width: 38px; cursor: pointer; }
.day-pill-btn.selected { background: var(--text-main); color: var(--surface); border-color: var(--text-main); }
.course-weight-total { margin-top: 8px; font-size: 11px; font-weight: 700; color: var(--text-muted); text-align: right; }
.course-weight-total.is-full { color: var(--text-main); }
.course-editor-row-fields input, .course-editor-row-fields select { padding: 8px 6px; font-size: 12px; min-width: 0; }

/* Your University card: grading scale editor (same classes as the extension) */
.grade-scale-editor { display: flex; flex-direction: column; gap: 6px; }
.grade-scale-row { display: flex; align-items: center; gap: 6px; }
.grade-scale-row .form-input { padding: 6px 8px; min-height: 40px; }
.grade-scale-letter { width: 56px; flex: 0 0 56px; font-weight: 700; }
.grade-scale-min, .grade-scale-points { width: 72px; flex: 0 0 72px; }
.grade-scale-unit { font-size: 12px; color: var(--text-muted); }
.grade-scale-remove { margin-left: auto; background: none; border: 1px solid var(--border-color, var(--surface-border)); color: var(--text-muted); cursor: pointer; width: 36px; height: 36px; padding: 0; }
.grade-scale-remove:disabled { visibility: hidden; }
.grade-scale-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

/* Classes list (src/core/classSchedule.ts todaysClassesHtml), shared by both apps */
.selected-day-classes { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.selected-day-classes[hidden] { display: none; }
.selected-day-classes-title { font-size: 10.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.classes-empty { font-size: 12px; color: var(--text-muted); padding: 4px 0; }
.class-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--surface-border, var(--border-color)); font-size: 12px; }
.class-row.is-done { opacity: 0.55; }
.class-row.is-live, .class-row.is-next { border-color: var(--text-main); }
.class-time { display: flex; flex-direction: column; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 40px; line-height: 1.2; }
.class-time-end { font-weight: 400; font-size: 10.5px; color: var(--text-muted); }
.class-main { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.25; }
.class-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.class-room { font-size: 11px; color: var(--text-muted); }
.class-state { font-size: 11px; font-weight: 700; white-space: nowrap; }
.class-row.is-live .class-state { background: var(--text-main); color: var(--bg-main, var(--surface)); padding: 1px 6px; }

/* Course import (syllabus or schedule file): same classes in the popup and the phone app */
.import-intro { font-size: 11.5px; color: var(--text-muted); margin: 0 0 8px; line-height: 1.45; }
.import-file-drop { display: flex; align-items: center; gap: 8px; padding: 12px; margin-bottom: 8px; border: 1px dashed var(--text-muted); cursor: pointer; font-size: 12px; font-weight: 600; }
.import-file-drop:hover, .import-file-drop:focus-within { border-style: solid; border-color: var(--text-main); }
.import-file-drop input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.import-file-drop span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-ai-row { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 11.5px; cursor: pointer; }
.import-ai-row[hidden] { display: none; }
.import-status { font-size: 11.5px; margin-top: 6px; min-height: 1em; color: var(--text-main); }
.import-status:empty { display: none; }
.import-review-title { font-size: 12px; font-weight: 700; margin: 12px 0 4px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.courses-card-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.ci-list { display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow-y: auto; }
.ci-card { border: 1px solid var(--surface-border, var(--border-color)); padding: 8px 10px; font-size: 11.5px; }
.ci-keep-row { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 12px; cursor: pointer; }
.ci-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 6px; }
.ci-field { display: flex; flex-direction: column; gap: 2px; font-size: 10.5px; color: var(--text-muted); min-width: 0; }
.ci-field input, .ci-field select { width: 100%; box-sizing: border-box; font-size: 12px; }
.ci-field-wide { grid-column: 1 / -1; }
.ci-found { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 3px; line-height: 1.4; }
.ci-found .is-missing, .ci-found .ci-note { color: var(--text-muted); }
.ci-warn { font-weight: 700; }
.ci-keep, .import-ai-row input { accent-color: var(--text-main); }

/* Student Academic Profile Identity (Companion & Courses Tab) */
.student-profile-card { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--surface-border); border-radius: 0 !important; margin-bottom: 10px; }
.student-profile-avatar { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; background: var(--primary); color: var(--bg); font-weight: 700; font-size: 13px; border-radius: 0 !important; flex: none; }
[data-theme="dark"] .student-profile-avatar { background: var(--primary-hover); color: var(--bg); }
.student-profile-info { display: flex; flex-direction: column; min-width: 0; }
.student-profile-name-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.student-profile-name { font-size: 12px; font-weight: 700; color: var(--text-main); }
.student-profile-id { font-size: 10.5px; font-weight: 600; background: var(--surface-hover); color: var(--text-muted); padding: 1px 5px; border: 1px solid var(--surface-border); border-radius: 0 !important; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.student-profile-uni { font-size: 10.5px; color: var(--text-muted); margin-top: 1px; }
.student-identity-banner { display: flex; align-items: center; justify-content: space-between; border-radius: 0 !important; }
