/* GradePilot AI - Clean & Modern Somhi Design System */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@500;600;700;800&family=Caveat:wght@600;700&display=swap');

:root {
  /* Somhi Brand Palette (https://somhi.now/) */
  --text-main: #1F252E;
  --text-secondary: #5F6B7A;
  --text-muted: #8C9BAE;
  --text-inverse: #FFFFFF;

  --background-color: #F5F7F9;
  --card-background: #FFFFFF;
  --input-bg: #FFFFFF;
  --border-color: #E2E8F0;
  --border-focus: #00a991;

  /* Accent Colors */
  --color-primary: #00a991;
  --color-primary-hover: #009882;
  --color-primary-light: #e6f7f5;
  --color-primary-shadow: rgba(0, 169, 145, 0.25);

  --color-secondary-btn: #e0e4e9;
  --color-secondary-btn-hover: #d1d7dd;

  --color-emerald: #10b981;
  --color-emerald-light: #d1fae5;
  --color-emerald-dark: #065f46;

  --color-amber: #f59e0b;
  --color-amber-light: #fef3c7;
  --color-amber-dark: #92400e;

  --color-rose: #e11d48;
  --color-rose-light: #ffe4e6;
  --color-rose-dark: #9f1239;

  --color-blue: #3b82f6;
  --color-blue-light: #eff6ff;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-display: 'Plus Jakarta Sans', var(--font-sans);
  --font-handwriting: 'Caveat', cursive, sans-serif;

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.08);

  --header-height: 60px;
}

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

html, body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

body {
  font-family: var(--font-sans);
  background-color: var(--background-color);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   App Header (Somhi Minimalist Top Bar)
   ========================================================================== */
.app-header {
  height: var(--header-height);
  background: var(--card-background);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
}

.brand-logo-badge {
  width: 36px;
  height: 36px;
  background: white;
  border: 1.5px solid #BAC7D5;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  padding: 3px;
}

.crow-mascot-icon {
  width: 26px;
  height: 26px;
  display: block;
}

.brand-text h1 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-main);
}

.brand-tag {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-primary);
  background: var(--color-primary-light);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Nav Tabs */
.header-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--background-color);
  padding: 3px;
  border-radius: 10px;
}

.nav-tab {
  background: transparent;
  border: none;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
}

.nav-tab:hover {
  color: var(--text-main);
}

.nav-tab.active {
  background: var(--card-background);
  color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

/* Header Right Actions */
.header-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.header-credits-badge {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: #e6f7f5;
  color: #007a68;
  border: 1px solid #b3ebe4;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.header-credits-badge.unlimited {
  background: #f0fdf4;
  color: #15803d;
  border-color: #bbf7d0;
}

.header-credits-badge.low {
  background: #fef3c7;
  color: #b45309;
  border-color: #fde68a;
}

.header-credits-badge.zero {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fecaca;
}

.header-api-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: #f1f5f9;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.header-api-badge.live {
  background: var(--color-emerald-light);
  color: var(--color-emerald-dark);
}

.header-stat-pill {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--background-color);
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-full);
}

/* Auth & Account Dropdown */
.auth-header-container {
  display: flex;
  align-items: center;
}

.btn-google-login {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.32rem 0.7rem;
  border-radius: var(--radius-full);
  background: white;
  border: 1px solid #BAC7D5;
  color: var(--text-main);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-google-login:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.user-menu-wrapper {
  position: relative;
}

.user-avatar-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: white;
  border: 1px solid #BAC7D5;
  border-radius: var(--radius-full);
  padding: 2px 8px 2px 3px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  transition: all 0.15s ease;
}

.user-avatar-trigger:hover {
  border-color: var(--color-primary);
  box-shadow: 0 2px 8px rgba(0,169,145,0.15);
}

.user-avatar-img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  background: #e2e8f0;
}

.user-name-text {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-main);
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-caret {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.account-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 260px;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.5rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: dropdownFadeIn 0.15s ease-out;
}

@keyframes dropdownFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.dropdown-user-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem;
}

.dropdown-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.dropdown-name {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.dropdown-email {
  font-size: 0.72rem;
  color: var(--text-muted);
  word-break: break-all;
}

.dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: 0.35rem 0;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.55rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  text-align: left;
  cursor: pointer;
  transition: all 0.12s ease;
}

.dropdown-item:hover {
  background: #f1f5f9;
  color: var(--color-primary);
}

.dropdown-item.item-highlight {
  background: #e6f7f5;
  color: #065f46;
  font-weight: 700;
}

.dropdown-item.item-highlight:hover {
  background: #ccfbf1;
}

.dropdown-item.item-danger {
  color: #e11d48;
}

.dropdown-item.item-danger:hover {
  background: #ffe4e6;
}

/* Pricing Grid */
.pricing-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-top: 1rem;
}

.pricing-card {
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
  background: white;
  transition: all 0.2s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.pricing-card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 4px 12px var(--color-primary-shadow);
  transform: translateY(-2px);
}

.pricing-card.popular {
  border-color: var(--color-primary);
  background: #fafdfc;
}

.pricing-badge-popular {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-primary);
  color: white;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  letter-spacing: 0.04em;
}

.pricing-pack-name {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.pricing-pack-scans {
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--color-primary);
  margin-bottom: 0.25rem;
}

.pricing-pack-price {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.pricing-pack-rate {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}

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

/* Install Web App Guide Modal */
.install-guide-box {
  background: #f8fafc;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: left;
}

.install-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.install-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.install-tab-btn.active {
  background: #e6f7f5;
  color: #065f46;
}

.install-step-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-main);
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.install-step-row:last-child {
  margin-bottom: 0;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-primary);
  color: white;
  font-weight: 800;
  font-size: 0.75rem;
  flex-shrink: 0;
}

/* ==========================================================================
   Buttons & Form Controls (Somhi Style)
   ========================================================================== */
button {
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s, box-shadow 0.2s;
}

.btn {
  border-radius: var(--radius-sm);
  border: none;
  padding: 0.6rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

.btn-primary {
  background-color: var(--color-primary);
  color: white;
  box-shadow: 0 2px 4px var(--color-primary-shadow);
}

.btn-primary:hover {
  background-color: var(--color-primary-hover);
  box-shadow: 0 4px 8px var(--color-primary-shadow);
}

.btn-primary:active {
  transform: translateY(1px);
  box-shadow: none;
}

.btn-secondary {
  background-color: var(--color-secondary-btn);
  color: var(--text-main);
  box-shadow: none;
}

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

.btn-secondary:active {
  transform: translateY(1px);
}

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

.btn-outline:hover {
  background: var(--background-color);
  color: var(--text-main);
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  border-radius: 6px;
}

.btn-lg {
  padding: 0.85rem 1.5rem;
  font-size: 1rem;
  border-radius: var(--radius-md);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

.btn-icon-subtle {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

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

.btn-text-subtle {
  background: transparent;
  border: none;
  color: var(--color-primary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.btn-text-subtle:hover {
  background: var(--color-primary-light);
}

/* Inputs & Selects */
input, textarea, select {
  font-family: var(--font-sans);
  border: 1px solid #BAC7D5;
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  font-size: 0.95rem;
  color: var(--text-main);
  background-color: var(--input-bg);
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(0, 169, 145, 0.15);
}

.input-control {
  width: 100%;
}

.input-select {
  cursor: pointer;
  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='%235F6B7A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.2rem;
  appearance: none;
}

/* ==========================================================================
   Main Layout Container
   ========================================================================== */
.main-container {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.view-section {
  width: 100%;
}

/* ==========================================================================
   Step Cards & Grading Flow
   ========================================================================== */
.grading-flow-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  width: 100%;
}

.step-card {
  background: var(--card-background);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: all 0.2s ease;
}

.step-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.step-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.step-number-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-size: 0.85rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-title-group h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.2px;
}

.step-title-group p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Step 1: Question Selector Row */
.question-selector-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.select-wrapper {
  flex: 1;
  min-width: 260px;
}

.question-dropdown {
  font-weight: 600;
  color: var(--text-main);
  background-color: #f8fafc;
}

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

.pill {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.pill-score {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.pill-expand {
  background: var(--background-color);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.15s ease;
}

.pill-expand:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

/* Criteria Quick Preview */
.criteria-quick-preview {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  margin-top: 0.25rem;
  animation: fadeIn 0.2s ease;
}

.criteria-preview-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.criteria-preview-item {
  font-size: 0.82rem;
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.criteria-preview-item strong {
  color: var(--text-main);
  white-space: nowrap;
}

/* ==========================================================================
   Modals (Somhi Style)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.15s ease;
}

.modal-card {
  background: var(--card-background);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalScale 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
}

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-header {
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-body {
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 75vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 1rem 1.5rem;
  background: var(--background-color);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Sample Papers Modal Grid */
.sample-papers-modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.sample-modal-card {
  background: #f8fafc;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: all 0.15s ease;
  text-align: left;
}

.sample-modal-card:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  transform: translateY(-2px);
}

.sample-modal-card.selected {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  box-shadow: 0 0 0 1px var(--color-primary);
}

.sample-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sample-card-roll {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-primary);
}

.sample-card-score {
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
}

.sample-card-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.sample-card-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.3;
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
.app-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  color: white;
  background: var(--text-main);
  box-shadow: var(--shadow-lg);
  z-index: 999;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-toast.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.app-toast.toast-success { background: var(--color-emerald); }
.app-toast.toast-error { background: var(--color-rose); }
.app-toast.toast-info { background: var(--color-primary); }

/* ==========================================================================
   Responsive Styles (Mobile Optimization)
   ========================================================================== */
@media (max-width: 768px) {
  .app-header {
    height: auto;
    padding: 0.5rem 0.75rem;
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    grid-template-areas: 
      "brand actions"
      "nav nav";
    row-gap: 0.45rem;
    column-gap: 0.5rem;
    align-items: center;
  }

  .brand-group {
    grid-area: brand;
    min-width: 0;
  }

  .brand-text h1 {
    font-size: 1.12rem;
  }

  .brand-logo-badge {
    width: 32px;
    height: 32px;
  }

  .brand-logo-badge svg {
    width: 22px;
    height: 22px;
  }

  .header-right {
    grid-area: actions;
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-left: 0;
  }

  .header-credits-badge {
    padding: 0.22rem 0.5rem;
    font-size: 0.72rem;
    font-weight: 700;
  }

  .header-api-badge {
    display: none; /* Keep clean on small mobile screens */
  }

  .header-nav {
    grid-area: nav;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 2px;
  }

  .nav-tab {
    padding: 0.4rem 0.2rem;
    font-size: 0.78rem;
    justify-content: center;
  }

  .main-container {
    padding: 0.75rem 0.75rem 3rem;
    gap: 0.75rem;
  }

  .step-card {
    padding: 1rem;
    gap: 0.75rem;
  }

  .question-selector-row {
    flex-direction: column;
    align-items: stretch;
  }

  .rubric-meta-pills {
    justify-content: space-between;
  }

  .sample-papers-modal-grid {
    grid-template-columns: 1fr;
  }
}

/* App Footer & Legal Compliance Links */
.app-footer {
  margin-top: 3rem;
  border-top: 1px solid var(--border-color);
  padding: 1.75rem 1rem 2rem;
  background: white;
  text-align: center;
}

.footer-content {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}

.footer-brand {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text-main);
}

.footer-links {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-link-btn {
  background: none;
  border: none;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 2px 4px;
  transition: color 0.15s ease;
  text-decoration: underline;
  text-decoration-color: #cbd5e1;
}

.footer-link-btn:hover {
  color: var(--color-primary);
  text-decoration-color: var(--color-primary);
}

.footer-copyright {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
