:root {
  /* Kells Theme Colors */
  --gold: #d4a726;
  --gold-light: #f0d78a;
  --gold-glow: rgba(212, 167, 38, 0.4);
  --green-900: #071a0e;
  --green-800: #0d2818;
  --green-700: #143d24;
  --green-600: #1a5231;
  --glass: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.08);
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.65);
  --text-muted: rgba(255, 255, 255, 0.4);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Cormorant Garamond', Georgia, serif;
  background: var(--green-900);
  color: var(--text-primary);
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* Kells background effects */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, var(--green-700) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(212, 167, 38, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse 50% 30% at 10% 80%, var(--green-600) 0%, transparent 40%);
  z-index: -2;
  pointer-events: none;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: url('../kells/book_of_kells_1.jpg') center/cover no-repeat;
  opacity: 0.04;
  filter: grayscale(40%) brightness(0.7);
  z-index: -1;
  pointer-events: none;
}

/* Form Elements */
.form-group {
  margin-bottom: 1rem;
}

label {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--gold);
  font-weight: 600;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 0.6rem 0.8rem;
  font-family: inherit;
  font-size: 1rem;
  border-radius: 8px;
  border: 1px solid rgba(212,175,55,0.4);
  background: rgba(0,0,0,0.3);
  color: var(--gold-light);
}

input:focus {
  outline: none;
  border-color: var(--gold);
}

.btn {
  padding: 0.6rem 1.2rem;
  font-family: inherit;
  font-size: 1rem;
  border-radius: 8px;
  border: 1px solid rgba(212,175,55,0.5);
  background: rgba(7, 26, 14, 0.85);
  color: var(--gold-light);
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(135deg, rgba(180,145,40,0.85), rgba(230,205,120,0.85));
  color: var(--green-900);
  font-weight: 600;
}

.btn-group {
  display: flex;
  gap: 0.5rem;
}

.card {
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(212,175,55,0.3);
  border-radius: 12px;
  padding: 1.5rem;
}

.card h2 {
  font-family: 'Cinzel Decorative', serif;
  color: var(--gold);
  margin-bottom: 0.5rem;
}

.status-message {
  padding: 0.75rem;
  border-radius: 8px;
  font-size: 0.9rem;
}

.status-error {
  background: rgba(248, 113, 113, 0.15);
  border: 1px solid #f87171;
  color: #f87171;
}

/* Home Button */
.home-btn {
  position: fixed;
  top: 1rem;
  left: 1rem;
  padding: 0.5rem 1rem;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--gold);
  border-radius: 10px;
  color: var(--gold-light);
  text-decoration: none;
  z-index: 1000;
  font-family: 'Cormorant Garamond', serif;
  transition: all 0.2s ease;
}

.home-btn:hover {
  background: rgba(212, 175, 55, 0.2);
}

/* Login Container */
.login-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.login-container .card {
  max-width: 400px;
  width: 100%;
}

.demo-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding: 0.75rem 1.25rem;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.4);
  border-radius: 8px;
  color: #86efac;
  text-decoration: none;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.demo-link:hover {
  background: rgba(34, 197, 94, 0.2);
  border-color: #22c55e;
  transform: translateY(-1px);
}

.demo-link svg {
  width: 18px;
  height: 18px;
}

/* Portal Layout */
.portal-container {
  display: none;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.portal-header {
  background: rgba(0, 0, 0, 0.4);
  border-bottom: 1px solid rgba(212, 175, 55, 0.4);
  padding: 1rem 1rem 1rem 5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  min-height: 50px;
}

.portal-header h1 {
  font-size: 1.4rem;
  margin: 0;
  font-family: 'Cinzel Decorative', serif;
  color: var(--gold);
}

.portal-header .header-right {
  position: absolute;
  right: 1rem;
  display: flex;
  align-items: center;
}

.portal-header .user-info {
  color: var(--gold-light);
  font-size: 0.95rem;
}

.logout-btn {
  background: rgba(248, 113, 113, 0.2);
  border: 1px solid #f87171;
  color: #f87171;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  margin-left: 1rem;
}

.logout-btn:hover {
  background: rgba(248, 113, 113, 0.3);
}

.portal-body {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 50px);
}

/* Sidebar - collapses on mobile */
.sidebar {
  width: 100%;
  min-width: 100%;
  max-height: 160px;
  background: rgba(0, 0, 0, 0.4);
  border-right: none;
  border-bottom: 1px solid rgba(212, 175, 55, 0.3);
  overflow-y: auto;
  padding: 0.5rem;
}

.sidebar h2 {
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid rgba(212, 175, 55, 0.3);
}

.activity-list {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.activity-item {
  background: rgba(13, 40, 24, 0.5);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 4px;
  padding: 0.5rem 0.6rem;
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1;
  min-width: 140px;
  min-height: 44px;
}

.activity-item:hover {
  background: rgba(212, 175, 55, 0.15);
  border-color: rgba(212, 175, 55, 0.5);
}

.activity-item.loading {
  background: rgba(212, 175, 55, 0.3);
  border-color: var(--gold);
  pointer-events: none;
}

.activity-item.loading .activity-name {
  color: var(--gold);
}

.activity-item .activity-name {
  font-weight: 600;
  color: var(--gold-light);
  font-size: 0.75rem;
  line-height: 1.3;
}

.activity-item .activity-meta {
  display: none;
}

.activity-item .activity-count {
  background: var(--gold);
  color: var(--green-900);
  padding: 0.05rem 0.35rem;
  border-radius: 8px;
  font-size: 0.65rem;
  font-weight: 700;
  float: right;
  margin-left: 0.25rem;
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Tabs */
.tabs-container {
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(212, 175, 55, 0.3);
  display: flex;
  overflow-x: auto;
  min-height: 32px;
}

.tab {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  background: rgba(13, 40, 24, 0.5);
  border-right: 1px solid rgba(212, 175, 55, 0.2);
  color: var(--gold-light);
  cursor: pointer;
  white-space: nowrap;
  font-size: 0.8rem;
}

.tab:hover {
  background: rgba(212, 175, 55, 0.1);
}

.tab.active {
  background: rgba(212, 175, 55, 0.15);
  border-bottom: 2px solid var(--gold);
}

.tab-close {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--gold-light);
  cursor: pointer;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tab-close:hover {
  background: rgba(248, 113, 113, 0.3);
  color: #f87171;
}

/* Tab Panels */
.tab-panels {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.tab-panel {
  display: none;
  position: absolute;
  inset: 0;
  overflow: auto;
  padding: 0.5rem;
}

.tab-panel.active {
  display: block;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--gold-light);
  opacity: 0.6;
}

.empty-state p {
  font-size: 1.1rem;
}

/* Submissions Table - Excel-like */
.submissions-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.submissions-table th,
.submissions-table td {
  padding: 0.4rem 0.75rem;
  text-align: left;
  border: 1px solid rgba(212, 175, 55, 0.15);
}

.submissions-table th {
  background: rgba(0, 0, 0, 0.5);
  color: var(--gold);
  font-weight: 600;
  position: sticky;
  top: 0;
  white-space: nowrap;
}

.submissions-table tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.15);
}

.submissions-table tr:hover {
  background: rgba(212, 175, 55, 0.1);
}

.submissions-table td {
  color: var(--gold-light);
}

.view-link {
  color: var(--gold);
  text-decoration: none;
  cursor: pointer;
}

.view-link:hover {
  text-decoration: underline;
}

.delete-link {
  color: #f87171;
  text-decoration: none;
  cursor: pointer;
  margin-left: 0.75rem;
  opacity: 0.6;
  font-size: 0.9rem;
}

.delete-link:hover {
  opacity: 1;
}

/* Download buttons */
.download-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  align-items: center;
}

.download-bar span {
  font-size: 0.85rem;
  color: var(--gold);
  margin-right: 0.5rem;
}

.download-btn {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  background: rgba(13, 40, 24, 0.8);
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: 6px;
  color: var(--gold-light);
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.download-btn:hover {
  background: rgba(212, 175, 55, 0.2);
  border-color: var(--gold);
}

.score-badge {
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
}

.score-badge.not-scored {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.5);
}

.score-badge.scored {
  background: rgba(74, 222, 128, 0.2);
  color: #4ade80;
}

.score-badge.ai-score {
  background: rgba(124, 58, 237, 0.2);
  color: #c4b5fd;
}

.score-badge.ai-score.range {
  background: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
}

.score-badge.teacher-override {
  background: rgba(74, 222, 128, 0.25);
  color: #86efac;
  border: 1px solid #4ade80;
}

.score-badge.teacher-adjust {
  background: rgba(212, 175, 55, 0.25);
  color: var(--gold-light);
  border: 1px solid var(--gold);
}

.score-badge.pending {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.4);
  font-style: italic;
}

.ai-processing-indicator {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(124, 58, 237, 0.3);
  border-top-color: #a855f7;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 0.3rem;
}

/* Submission Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 10000;
  justify-content: center;
  align-items: flex-start;
  padding: 2rem;
  overflow-y: auto;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: linear-gradient(135deg, #071a0e, #0d2818);
  border: 2px solid var(--gold);
  border-radius: 16px;
  width: 95%;
  max-width: 1100px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(212, 175, 55, 0.3);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.3rem;
}

.modal-close {
  background: none;
  border: none;
  color: var(--gold-light);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
}

.modal-close:hover {
  color: var(--gold);
}

.btn-download-pdf {
  background: var(--dark-green);
  border: 1px solid var(--gold-light);
  color: var(--gold-light);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  margin-right: 0.5rem;
  transition: all 0.2s ease;
}

.btn-download-pdf:hover {
  background: var(--gold);
  color: var(--dark-green);
  border-color: var(--gold);
}

.modal-body {
  padding: 1.5rem;
}

.submission-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
}

.meta-item label {
  display: block;
  font-size: 0.8rem;
  color: var(--gold);
  margin-bottom: 0.25rem;
}

.meta-item span {
  color: var(--gold-light);
}

.score-entry {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.score-select {
  padding: 0.4rem 0.6rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: 6px;
  color: var(--gold-light);
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.score-select:focus {
  outline: none;
  border-color: var(--gold);
}

.btn-save-score {
  padding: 0.4rem 0.75rem;
  background: rgba(74, 222, 128, 0.2);
  border: 1px solid #4ade80;
  border-radius: 6px;
  color: #4ade80;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-save-score:hover {
  background: rgba(74, 222, 128, 0.3);
}

.btn-save-score:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.submission-section {
  margin-bottom: 1.5rem;
}

.submission-section h3 {
  font-size: 1rem;
  color: var(--gold);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
}

.submission-response {
  background: #ffffff;
  color: #1a1a1a;
  padding: 1rem;
  border-radius: 8px;
  line-height: 1.7;
  white-space: pre-wrap;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
}

.source-item {
  background: rgba(0, 0, 0, 0.2);
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 0.75rem;
}

.source-item strong {
  color: var(--gold);
}

.source-item p {
  margin-top: 0.5rem;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Rubric Styles */
.rubric-section {
  background: rgba(212, 175, 55, 0.05);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 8px;
  padding: 1rem;
}

.rubric-criteria {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.rubric-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
}

.rubric-score {
  background: var(--gold);
  color: var(--green-900);
  font-weight: 700;
  font-size: 1.1rem;
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
}

.rubric-details {
  flex: 1;
}

.rubric-details strong {
  color: var(--gold);
  display: block;
  margin-bottom: 0.25rem;
}

.rubric-details p {
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0;
}

/* AI Feedback Styles */
.ai-feedback-section {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: rgba(212, 175, 55, 0.08);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 12px;
}

.ai-feedback-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.ai-feedback-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--gold);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ai-badge {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-ai-feedback {
  padding: 0.6rem 1rem;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.3), rgba(168, 85, 247, 0.3));
  border: 1px solid rgba(168, 85, 247, 0.5);
  border-radius: 8px;
  color: #e9d5ff;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-ai-feedback:hover {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.5), rgba(168, 85, 247, 0.5));
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3);
}

.btn-ai-feedback:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-ai-feedback .spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.btn-ai-feedback.loading .spinner {
  display: inline-block;
}

.btn-ai-feedback.loading .btn-text {
  display: none;
}

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

.ai-feedback-content {
  display: none;
}

.ai-feedback-content.visible {
  display: block;
}

.ai-suggested-score {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
}

.ai-suggested-score.needs-review {
  border: 2px solid rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.1);
}

.ai-score-badges {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.ai-score-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  min-width: 60px;
}

.ai-score-badge.rubric {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
}

.ai-score-badge.gradebook {
  background: rgba(74, 222, 128, 0.2);
  border: 1px solid #4ade80;
}

.ai-score-badge .score-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: white;
}

.ai-score-badge.gradebook .score-value {
  color: #4ade80;
}

.ai-score-badge .score-type {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.85;
  color: white;
}

.ai-score-badge.gradebook .score-type {
  color: #86efac;
}

.ai-suggested-score .score-label {
  font-size: 0.85rem;
  color: var(--gold-light);
  flex: 1;
}

.ai-suggested-score .score-label strong {
  display: block;
  font-size: 0.95rem;
  color: #e9d5ff;
}

.ai-suggested-score.needs-review .score-label strong {
  color: #fcd34d;
}

.review-badge {
  display: inline-block;
  background: rgba(245, 158, 11, 0.3);
  border: 1px solid #f59e0b;
  color: #fcd34d;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  margin-left: 0.5rem;
  text-transform: uppercase;
}

.btn-apply-score {
  padding: 0.5rem 1rem;
  background: rgba(74, 222, 128, 0.2);
  border: 1px solid #4ade80;
  border-radius: 6px;
  color: #4ade80;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-apply-score:hover {
  background: rgba(74, 222, 128, 0.3);
}

.ai-rationale {
  background: rgba(0, 0, 0, 0.2);
  padding: 1rem;
  border-radius: 8px;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--gold-light);
}

.ai-rationale h4 {
  color: var(--gold);
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.ai-rationale ul {
  margin: 0.5rem 0 0 1.25rem;
  padding: 0;
}

.ai-rationale li {
  margin-bottom: 0.4rem;
}

.ai-disclaimer {
  margin-top: 1rem;
  padding: 0.75rem;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 6px;
  font-size: 0.8rem;
  color: #fcd34d;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.ai-disclaimer .icon {
  flex-shrink: 0;
}

.ai-error {
  padding: 1rem;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: 8px;
  color: #fca5a5;
  font-size: 0.9rem;
}

/* Source verification alert */
.ai-source-alert {
  margin-bottom: 1rem;
  padding: 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
}

.ai-source-alert.valid {
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid rgba(74, 222, 128, 0.3);
  color: #86efac;
}

.ai-source-alert.invalid {
  background: rgba(248, 113, 113, 0.15);
  border: 2px solid #f87171;
  color: #fca5a5;
}

.ai-source-alert h4 {
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ai-source-alert.invalid h4 {
  color: #f87171;
  font-size: 1rem;
}

.ai-source-alert ul {
  margin: 0.5rem 0 0 1.25rem;
  padding: 0;
}

.ai-source-alert li {
  margin-bottom: 0.3rem;
}

.ai-prompt-alignment {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--gold-light);
}

.ai-prompt-alignment strong {
  color: var(--gold);
}

/* Teacher Override Section */
.teacher-override-section {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: rgba(74, 222, 128, 0.08);
  border: 1px solid rgba(74, 222, 128, 0.3);
  border-radius: 12px;
}

.teacher-override-section h3 {
  color: #4ade80;
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.override-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.override-row {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.override-row .form-group {
  flex: 1;
}

.override-row .form-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--gold);
  margin-bottom: 0.4rem;
}

.override-select {
  width: 100%;
  padding: 0.6rem 0.8rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(74, 222, 128, 0.4);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
}

.override-select:focus {
  outline: none;
  border-color: #4ade80;
}

.override-textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(74, 222, 128, 0.4);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  resize: vertical;
  min-height: 60px;
}

.override-textarea:focus {
  outline: none;
  border-color: #4ade80;
}

.override-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.btn-save-override {
  padding: 0.6rem 1.25rem;
  background: rgba(74, 222, 128, 0.2);
  border: 1px solid #4ade80;
  border-radius: 6px;
  color: #4ade80;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-save-override:hover {
  background: rgba(74, 222, 128, 0.3);
}

.btn-save-override:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-clear-override {
  padding: 0.6rem 1rem;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-clear-override:hover {
  border-color: #f87171;
  color: #f87171;
}

.current-override {
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid rgba(74, 222, 128, 0.3);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.current-override .override-score {
  font-size: 1.2rem;
  font-weight: 700;
  color: #4ade80;
}

.current-override .override-gradebook {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.current-override .override-rationale {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-style: italic;
}

/* Architect Controls Section */
.architect-controls-section {
  background: rgba(139, 69, 19, 0.2);
  border: 1px solid rgba(139, 69, 19, 0.4);
  border-radius: 8px;
  padding: 1rem;
  margin-top: 1rem;
}

.architect-controls-section h3 {
  color: #cd853f;
  margin: 0 0 1rem 0;
  font-size: 1rem;
}

.architect-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn-rerun-ai {
  background: rgba(139, 69, 19, 0.3) !important;
  border-color: rgba(205, 133, 63, 0.5) !important;
  color: #deb887 !important;
}

.btn-rerun-ai:hover {
  background: rgba(139, 69, 19, 0.5) !important;
  border-color: #cd853f !important;
}

.btn-retry-ai {
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.5);
  color: #93c5fd;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.btn-retry-ai:hover {
  background: rgba(59, 130, 246, 0.3);
  border-color: #3b82f6;
}

.btn-remove-submission {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: #fca5a5;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.btn-remove-submission:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: #ef4444;
}

/* Responsive */
/* ======================================================
   Responsive — Mobile-First Breakpoints
====================================================== */

/* Tablet (768px+) */
@media (min-width: 768px) {
  .modal-content {
    width: 90%;
  }
}

/* Desktop (900px+) — sidebar becomes fixed column */
@media (min-width: 900px) {
  .portal-body {
    flex-direction: row;
  }

  .sidebar {
    width: 180px;
    min-width: 180px;
    max-width: 180px;
    max-height: none;
    border-right: 1px solid rgba(212, 175, 55, 0.3);
    border-bottom: none;
  }

  .activity-list {
    flex-direction: column;
  }

  .activity-item {
    flex: initial;
    min-width: initial;
  }
}

/* Clean Modal Sections */
.modal-section {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.modal-section:last-child {
  margin-bottom: 0;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.section-header h3 {
  margin: 0;
  font-size: 0.95rem;
  color: var(--gold);
}

.meta-pills {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.pill {
  background: rgba(212, 175, 55, 0.15);
  border: 1px solid rgba(212, 175, 55, 0.3);
  padding: 0.25rem 0.6rem;
  border-radius: 12px;
  font-size: 0.75rem;
  color: var(--gold-light);
}

.pill.warning {
  background: rgba(248, 113, 113, 0.15);
  border-color: rgba(248, 113, 113, 0.4);
  color: #fca5a5;
}

.pill-btn {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.4);
  padding: 0.25rem 0.6rem;
  border-radius: 12px;
  font-size: 0.75rem;
  color: #93c5fd;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pill-btn:hover {
  background: rgba(59, 130, 246, 0.25);
}

.student-response-text {
  background: rgba(255, 255, 255, 0.03);
  border-left: 3px solid var(--gold);
  padding: 1rem;
  font-size: 0.95rem;
  line-height: 1.6;
  white-space: pre-wrap;
  max-height: 300px;
  overflow-y: auto;
}

/* AI Result Display */
.ai-badge-sm {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  margin-right: 0.25rem;
}

.ai-result {
  padding: 0.75rem;
  background: rgba(139, 92, 246, 0.1);
  border-radius: 6px;
}

.ai-result-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.ai-score-display {
  background: linear-gradient(135deg, #4ade80, #22c55e);
  color: #000;
  font-weight: 700;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  font-size: 1.1rem;
}

.ai-score-display.range {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
}

.ai-gradebook {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ER score display */
.er-scores {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.er-divider {
  color: var(--text-secondary);
  opacity: 0.5;
}

.ai-score-display.er-dim {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: white;
  font-size: 0.95rem;
}

.ai-rationale {
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.5;
}

.ai-component {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.4rem;
}

.ai-warning {
  background: rgba(248, 113, 113, 0.15);
  border: 1px solid rgba(248, 113, 113, 0.3);
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  font-size: 0.8rem;
  color: #fca5a5;
  margin-top: 0.5rem;
}

.ai-mixed-response {
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.3);
  padding: 0.6rem;
  border-radius: 6px;
  margin-top: 0.5rem;
}

.ai-mixed-response .mixed-header {
  font-weight: 600;
  color: #fbbf24;
  margin-bottom: 0.4rem;
}

.ai-mixed-response .mixed-best {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.3rem;
}

.ai-mixed-response .mixed-incorrect {
  font-size: 0.85rem;
  color: #fca5a5;
  margin-top: 0.3rem;
}

/* Rubric Breakdown */
.rubric-breakdown {
  margin: 0.8rem 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  overflow: hidden;
}

.rubric-item {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.8rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.85rem;
}

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

.rubric-item.status-correct {
  background: rgba(34, 197, 94, 0.1);
}

.rubric-item.status-incorrect {
  background: rgba(239, 68, 68, 0.1);
}

.rubric-item.status-vague {
  background: rgba(251, 191, 36, 0.1);
}

.rubric-icon {
  width: 1.5rem;
  font-size: 1rem;
}

.rubric-item.status-correct .rubric-icon {
  color: #86efac;
}

.rubric-item.status-incorrect .rubric-icon {
  color: #fca5a5;
}

.rubric-item.status-vague .rubric-icon {
  color: #fbbf24;
}

.rubric-label {
  flex: 1;
  color: var(--text);
}

.rubric-status {
  font-size: 0.75rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  text-transform: capitalize;
}

.rubric-item.status-correct .rubric-status {
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
}

.rubric-item.status-incorrect .rubric-status {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.rubric-item.status-vague .rubric-status {
  background: rgba(251, 191, 36, 0.2);
  color: #fbbf24;
}

.rubric-item.status-mentioned {
  border-left-color: #60a5fa;
}

.rubric-item.status-mentioned .rubric-icon {
  color: #60a5fa;
}

.rubric-item.status-mentioned .rubric-status {
  background: rgba(96, 165, 250, 0.2);
  color: #93c5fd;
}

.rubric-detail {
  padding: 0.3rem 0.8rem 0.5rem 2.3rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.rubric-detail.rubric-issue {
  background: rgba(239, 68, 68, 0.1);
  border-left: 3px solid #ef4444;
  color: #fca5a5;
}

/* Student Feedback Preview */
.student-feedback-preview {
  margin-top: 0.8rem;
  padding: 0.8rem;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 6px;
}

.student-feedback-preview .preview-header {
  font-size: 0.8rem;
  font-weight: 600;
  color: #93c5fd;
  margin-bottom: 0.5rem;
}

.student-feedback-preview .preview-content {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Content Accuracy */
.ai-content-accuracy {
  background: rgba(100, 116, 139, 0.15);
  border: 1px solid rgba(100, 116, 139, 0.3);
  padding: 0.6rem;
  border-radius: 6px;
  margin-top: 0.6rem;
}

.ai-content-accuracy .content-correct {
  font-size: 0.85rem;
  color: #86efac;
  margin-bottom: 0.3rem;
}

.ai-content-accuracy .content-incorrect {
  font-size: 0.85rem;
  color: #fca5a5;
}

/* Readability Alert */
.ai-readability-alert {
  background: rgba(251, 146, 60, 0.15);
  border: 1px solid rgba(251, 146, 60, 0.3);
  padding: 0.6rem;
  border-radius: 6px;
  margin-bottom: 0.8rem;
  color: #fdba74;
}

.ai-readability-alert .unclear-sections {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.3rem;
  font-style: italic;
}

/* Student Feedback Preview */
.ai-student-feedback-preview {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 0.8rem;
  border-radius: 6px;
  margin-top: 0.8rem;
}

.ai-student-feedback-preview h4 {
  color: #93c5fd;
  margin: 0 0 0.5rem 0;
  font-size: 0.9rem;
}

.ai-student-feedback-preview .student-score-message {
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.4rem;
}

.ai-student-feedback-preview .student-primary-issue,
.ai-student-feedback-preview .student-clarity,
.ai-student-feedback-preview .student-content,
.ai-student-feedback-preview .student-revision {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.3rem;
}

.ai-student-feedback-preview .student-revision {
  color: #93c5fd;
  font-style: italic;
}

.ai-pending {
  text-align: center;
  padding: 0.5rem;
}

/* Compact Override Form */
.override-form-compact {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.override-form-compact .override-select {
  padding: 0.5rem;
  font-size: 0.9rem;
}

.override-textarea-compact {
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(74, 222, 128, 0.3);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  resize: vertical;
  min-height: 60px;
}

.override-buttons {
  display: flex;
  gap: 0.5rem;
}

.override-buttons .btn-save-override,
.override-buttons .btn-clear-override {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

.current-override-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Score Adjustment Section */
.adjustment-section {
  margin-bottom: 0.75rem;
}

.adjustment-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.adjustment-note {
  font-size: 0.75rem;
  color: var(--text-secondary);
  opacity: 0.8;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.adjustment-buttons {
  display: flex;
  gap: 0.5rem;
}

.btn-adjust {
  flex: 1;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  font-family: inherit;
  border-radius: 6px;
  border: 1px solid rgba(212, 175, 55, 0.3);
  background: rgba(0, 0, 0, 0.3);
  color: var(--gold-light);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-adjust:hover:not(:disabled) {
  background: rgba(212, 175, 55, 0.2);
  border-color: var(--gold);
}

.btn-adjust.active {
  background: rgba(212, 175, 55, 0.3);
  border-color: var(--gold);
  color: var(--gold);
  font-weight: 600;
}

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

.adjustment-result {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: var(--gold);
}

.adjustment-rationale {
  display: none;
  margin-top: 0.5rem;
}

.adjustment-rationale.show {
  display: block;
}

/* ER Edit Controls */
.er-edit-section {
  margin-bottom: 0.75rem;
}

.er-score-dropdowns {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.er-dropdown-group {
  flex: 1;
}

.er-dropdown-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.er-dropdown-group select {
  width: 100%;
  padding: 0.5rem;
  font-size: 0.9rem;
  font-family: inherit;
  border-radius: 6px;
  border: 1px solid rgba(212, 175, 55, 0.3);
  background: rgba(0, 0, 0, 0.3);
  color: var(--gold-light);
  cursor: pointer;
}

.er-dropdown-group select:focus {
  outline: none;
  border-color: var(--gold);
}

.er-gradebook-display {
  font-size: 0.8rem;
  color: var(--gold);
  margin-top: 0.25rem;
}

.er-feedback-textarea {
  width: 100%;
  min-height: 120px;
  padding: 0.75rem;
  font-family: inherit;
  font-size: 0.85rem;
  line-height: 1.5;
  border-radius: 8px;
  border: 1px solid rgba(212, 175, 55, 0.3);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-primary);
  resize: vertical;
  box-sizing: border-box;
}

.er-feedback-textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.1);
}

.no-ai-message {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-style: italic;
  padding: 0.5rem 0;
}

.current-adjustment-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.adjustment-badge {
  background: rgba(212, 175, 55, 0.3);
  color: var(--gold);
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
}

.adjustment-by {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Student Feedback Form */
.student-feedback-form {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.feedback-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.feedback-field label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.feedback-field label .optional {
  font-weight: 400;
  opacity: 0.7;
}

.feedback-select,
.feedback-input,
.feedback-textarea {
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
}

.feedback-select:focus,
.feedback-input:focus,
.feedback-textarea:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.6);
}

.feedback-textarea {
  resize: vertical;
  min-height: 50px;
}

.feedback-textarea-large {
  width: 100%;
  padding: 0.6rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  resize: vertical;
  min-height: 150px;
  line-height: 1.5;
}

.feedback-textarea-large:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.6);
}

.feedback-buttons {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.3rem;
}

.btn-save-feedback {
  padding: 0.5rem 1rem;
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: 6px;
  color: #93c5fd;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.btn-save-feedback:hover {
  background: rgba(59, 130, 246, 0.3);
}

.btn-release-score {
  padding: 0.5rem 1rem;
  background: rgba(34, 197, 94, 0.2);
  border: 1px solid rgba(34, 197, 94, 0.4);
  border-radius: 6px;
  color: #86efac;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-release-score:hover {
  background: rgba(34, 197, 94, 0.3);
}

.btn-release-score.released {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.3);
}

.teacher-feedback-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.teacher-feedback-textarea {
  width: 100%;
  min-height: 80px;
  padding: 0.6rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 8px;
  color: var(--gold-light);
  font-family: inherit;
  font-size: 0.95rem;
  resize: vertical;
}

.teacher-feedback-textarea:focus {
  outline: none;
  border-color: var(--gold);
}

.teacher-feedback-textarea::placeholder {
  color: var(--text-muted);
}

.released-badge {
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.unreleased-badge {
  background: rgba(100, 116, 139, 0.2);
  color: var(--text-secondary);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
}

.override-badge {
  background: linear-gradient(135deg, #4ade80, #22c55e);
  color: #000;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
}

.override-by {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Architect Section */
.architect-section {
  background: rgba(139, 69, 19, 0.15);
  border-color: rgba(139, 69, 19, 0.3);
}

.architect-section h3 {
  color: #cd853f;
}

.architect-buttons {
  display: flex;
  gap: 0.5rem;
}

.architect-buttons button {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
}
