:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-muted: #475569;
  --text-subtle: #64748b;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --primary-border: #bfdbfe;

  --emerald: #059669;
  --emerald-soft: #ecfdf5;
  --emerald-border: #a7f3d0;

  --amber: #d97706;
  --amber-soft: #fffbeb;
  --amber-border: #fde68a;

  --rose: #e11d48;
  --rose-soft: #fff1f2;
  --rose-border: #fecdd3;

  --violet: #7c3aed;
  --violet-soft: #f5f3ff;
  --violet-border: #ddd6fe;

  --code-bg: #0f172a;
  --code-gutter: #1e293b;
  --code-text: #e2e8f0;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.07);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

code, pre, textarea.code-textarea {
  font-family: 'JetBrains Mono', Consolas, monospace;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text);
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.brand-title {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.brand-sub {
  font-size: 0.76rem;
  color: var(--text-subtle);
}

/* Container & Layout */
.container {
  max-width: 1340px;
  margin: 0 auto;
  padding: 1.5rem;
}

.container-narrow {
  max-width: 880px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
}

.card + .card {
  margin-top: 1.25rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.58rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  text-decoration: none;
  font-family: inherit;
}

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

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

.btn-success {
  background: var(--emerald);
  color: #fff;
}
.btn-success:hover:not(:disabled) {
  background: #047857;
}

.btn-danger {
  background: var(--rose);
  color: #fff;
}
.btn-danger:hover:not(:disabled) {
  background: #be123c;
}

.btn-outline {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-outline:hover:not(:disabled) {
  background: var(--surface-alt);
  border-color: #94a3b8;
}

.btn-soft {
  background: var(--primary-soft);
  border-color: var(--primary-border);
  color: var(--primary);
}
.btn-soft:hover:not(:disabled) {
  background: #dbeafe;
}

.btn-sm {
  padding: 0.38rem 0.72rem;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 0.75rem 1.35rem;
  font-size: 0.95rem;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.62rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge-blue { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-border); }
.badge-emerald { background: var(--emerald-soft); color: var(--emerald); border-color: var(--emerald-border); }
.badge-amber { background: var(--amber-soft); color: var(--amber); border-color: var(--amber-border); }
.badge-rose { background: var(--rose-soft); color: var(--rose); border-color: var(--rose-border); }
.badge-violet { background: var(--violet-soft); color: var(--violet); border-color: var(--violet-border); }
.badge-slate { background: #f1f5f9; color: #334155; border-color: #cbd5e1; }

/* Landing Grid */
.landing-hero {
  text-align: center;
  padding: 2rem 1rem 1.5rem;
}
.landing-hero h1 {
  font-size: 2rem;
  margin: 0.5rem 0;
  letter-spacing: -0.025em;
}
.landing-hero p {
  color: var(--text-muted);
  max-width: 680px;
  margin: 0 auto;
}

.role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-top: 1.75rem;
}

.role-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.75rem;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.role-card h2 {
  margin: 0.6rem 0 0.5rem;
  font-size: 1.25rem;
}

.role-card ul {
  padding-left: 1.2rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0.75rem 0 1.5rem;
}

.role-card li + li {
  margin-top: 0.35rem;
}

/* Inputs */
.input, .select, .textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.6;
}

.label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

/* Candidate Exam Layout */
.exam-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 1.5rem;
  align-items: start;
}

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

.sidebar-sticky {
  position: sticky;
  top: 76px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
}

.q-nav-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.q-nav-btn {
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.12s;
  position: relative;
}

.q-nav-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.q-nav-btn.answered {
  background: var(--emerald-soft);
  border-color: var(--emerald-border);
  color: var(--emerald);
}

.q-nav-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.3);
}

/* Prompt Formatting */
.prompt-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.25rem;
  font-size: 0.94rem;
  color: #1e293b;
  white-space: pre-wrap;
}

.prompt-box code {
  background: #e2e8f0;
  color: #0f172a;
  padding: 0.12rem 0.38rem;
  border-radius: 5px;
  font-size: 0.84em;
}

/* Code Editor */
.code-editor-wrap {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid #334155;
  background: var(--code-bg);
  margin-top: 0.75rem;
}

.code-editor-header {
  background: #1e293b;
  padding: 0.5rem 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #334155;
  color: #cbd5e1;
  font-size: 0.78rem;
  font-weight: 600;
}

.code-editor-body {
  display: flex;
  position: relative;
  min-height: 290px;
}

.code-line-numbers {
  background: var(--code-gutter);
  color: #64748b;
  padding: 0.9rem 0.65rem;
  text-align: right;
  user-select: none;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.84rem;
  line-height: 1.55;
  min-width: 44px;
  border-right: 1px solid #334155;
}

.code-textarea {
  flex: 1;
  background: transparent;
  color: var(--code-text);
  border: none;
  padding: 0.9rem 1rem;
  font-size: 0.84rem;
  line-height: 1.55;
  resize: vertical;
  min-height: 290px;
  outline: none;
  white-space: pre;
  overflow-x: auto;
  tab-size: 4;
}

.code-block-readonly {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 1rem 1.15rem;
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.55;
  margin: 0.5rem 0 0;
  border: 1px solid #334155;
}

/* Voice Recorder Box */
.recorder-box {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.25rem;
  margin-top: 1rem;
}

.recorder-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--rose);
  animation: pulseRec 1.1s infinite;
}

@keyframes pulseRec {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.45; }
}

.meter-bar-bg {
  flex: 1;
  min-width: 140px;
  height: 8px;
  background: #cbd5e1;
  border-radius: 999px;
  overflow: hidden;
}

.meter-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #10b981, #2563eb, #e11d48);
  transition: width 0.08s linear;
}

/* Tables (RECAP Sheet Style) */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  background: var(--surface);
}

table.data-table th {
  background: #f8fafc;
  color: #334155;
  font-weight: 700;
  text-align: left;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}

table.data-table td {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

table.data-table tr:last-child td {
  border-bottom: none;
}

table.data-table tr:hover td {
  background: #f8fafc;
}

/* Category Summary Grid */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.cat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.score-big {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* Rubric Radio Pills for Assessor */
.rubric-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-top: 0.5rem;
}

@media (max-width: 720px) {
  .rubric-selector {
    grid-template-columns: repeat(2, 1fr);
  }
}

.rubric-option {
  border: 1.5px solid var(--border-strong);
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.65rem;
  cursor: pointer;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.12s;
}

.rubric-option:hover {
  border-color: #64748b;
}

.rubric-option.selected-Incapable {
  background: var(--rose-soft);
  border-color: var(--rose);
  color: var(--rose);
}
.rubric-option.selected-Capable {
  background: var(--amber-soft);
  border-color: var(--amber);
  color: var(--amber);
}
.rubric-option.selected-Decent {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}
.rubric-option.selected-Proficient {
  background: var(--emerald-soft);
  border-color: var(--emerald);
  color: var(--emerald);
}

/* Split Comparison Grid inside Assessor Review */
.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 0.85rem;
}

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

.panel-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.panel-box-answerkey {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-md);
  padding: 1rem;
}

.panel-box-recommend {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-top: 0.85rem;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 90;
  padding: 1rem;
}

.modal-card {
  background: #fff;
  border-radius: var(--radius-lg);
  max-width: 560px;
  width: 100%;
  padding: 1.5rem;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.25);
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: #0f172a;
  color: #fff;
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
}
.toast.success { background: #065f46; }
.toast.error { background: #9f1239; }

/* Utilities */
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.flex-row { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.84rem; }
.text-xs { font-size: 0.76rem; }

