/* ============================================================
   SurgMentor — Design System
   Palette:
     Deep Navy   #0D1B2A
     Navy Mid    #142233
     Navy Card   #1A2B3C
     Steel Blue  #1E6091
     Blue Light  #2680B8
     Surg Green  #2ECC8F
     Green Dim   #25A872
     Text Primary  #F0F4F8
     Text Muted    #8BA3BC
     Text Dimmer   #4D6680
     Border        rgba(255,255,255,0.07)
     Border Mid    rgba(255,255,255,0.12)
   ============================================================ */

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

:root {
  --navy:         #0D1B2A;
  --navy-mid:     #142233;
  --navy-card:    #1A2B3C;
  --navy-raised:  #1F3347;
  --steel:        #1E6091;
  --steel-light:  #2680B8;
  --steel-dim:    #164D72;
  --green:        #2ECC8F;
  --green-dim:    #25A872;
  --green-glow:   rgba(46, 204, 143, 0.18);
  --red:          #E05260;
  --red-dim:      #B83F4C;
  --amber:        #F0A530;

  --text:         #F0F4F8;
  --text-muted:   #8BA3BC;
  --text-dimmer:  #4D6680;

  --border:       rgba(255, 255, 255, 0.07);
  --border-mid:   rgba(255, 255, 255, 0.12);
  --border-green: rgba(46, 204, 143, 0.30);

  --radius-sm:    6px;
  --radius:       10px;
  --radius-lg:    16px;
  --radius-xl:    22px;

  --shadow-sm:  0 2px 8px rgba(0,0,0,0.25);
  --shadow:     0 4px 20px rgba(0,0,0,0.35);
  --shadow-lg:  0 8px 40px rgba(0,0,0,0.5);

  --font:       'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:  'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  --sidebar-w: 260px;
  --header-h:  60px;
  --transition: 0.2s ease;
}

html { font-size: 15px; }

body {
  font-family: var(--font);
  background: var(--navy);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--steel-light); text-decoration: none; }
a:hover { color: var(--green); }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.12);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.22); }

/* ── Typography ──────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
}
h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 0.95rem; }

.text-muted  { color: var(--text-muted); }
.text-dimmer { color: var(--text-dimmer); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-amber  { color: var(--amber); }
.text-sm     { font-size: 0.85rem; }
.text-xs     { font-size: 0.75rem; }
.text-mono   { font-family: var(--font-mono); }

/* ── Layout Shell ─────────────────────────────────────────── */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--navy-mid);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo .logo-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--steel), var(--green));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(46,204,143,0.3);
}

.sidebar-logo .logo-text {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--text);
}
.sidebar-logo .logo-text span {
  color: var(--green);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dimmer);
  padding: 10px 10px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-item:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text);
}
.nav-item.active {
  background: rgba(46,204,143,0.1);
  color: var(--green);
  border: 1px solid var(--border-green);
}
.nav-item .nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.75;
}
.nav-item.active .nav-icon { opacity: 1; }

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ── Main Content Area ───────────────────────────────────── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--navy);
}

/* ── Top Header ──────────────────────────────────────────── */
.top-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--navy-mid);
  flex-shrink: 0;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 0.95rem;
}
.header-title .badge {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 100px;
  background: rgba(46,204,143,0.12);
  color: var(--green);
  border: 1px solid var(--border-green);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.865rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1;
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

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

.btn-green {
  background: var(--green);
  color: var(--navy);
  border-color: var(--green);
  font-weight: 600;
}
.btn-green:hover:not(:disabled) {
  background: var(--green-dim);
  border-color: var(--green-dim);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border-mid);
}
.btn-ghost:hover:not(:disabled) {
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border-color: rgba(255,255,255,0.2);
}

.btn-danger {
  background: transparent;
  color: var(--red);
  border-color: rgba(224,82,96,0.35);
}
.btn-danger:hover:not(:disabled) {
  background: rgba(224,82,96,0.1);
  border-color: var(--red);
}

.btn-icon {
  padding: 7px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover {
  background: rgba(255,255,255,0.07);
  color: var(--text);
  border-color: var(--border-mid);
}

.btn-sm {
  padding: 5px 11px;
  font-size: 0.8rem;
}
.btn-lg {
  padding: 11px 22px;
  font-size: 0.95rem;
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-body {
  padding: 20px;
}

.card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.12);
}

/* ── Stat Cards ──────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.stat-card {
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-card .stat-label {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dimmer);
}

.stat-card .stat-value {
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
  letter-spacing: -0.03em;
}

.stat-card .stat-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.stat-card.accent-green { border-color: rgba(46,204,143,0.25); }
.stat-card.accent-green .stat-value { color: var(--green); }

.stat-card.accent-blue { border-color: rgba(30,96,145,0.4); }
.stat-card.accent-blue .stat-value { color: var(--steel-light); }

/* ── Page Layout ─────────────────────────────────────────── */
.page-container {
  flex: 1;
  min-height: 0;        /* override flex min-height:auto so overflow-y:auto fires */
  overflow-y: auto;
  padding: 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-header-left h1 {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 3px;
}
.page-header-left p {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ── Chat Layout ─────────────────────────────────────────── */
.chat-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

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

/* ── Message Bubbles ─────────────────────────────────────── */
.msg-row {
  display: flex;
  gap: 12px;
  max-width: 820px;
  width: 100%;
}

.msg-row.user {
  flex-direction: row-reverse;
  margin-left: auto;
}

.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.msg-row.assistant .msg-avatar {
  background: linear-gradient(135deg, var(--steel-dim), var(--steel));
  border: 1px solid var(--border-mid);
}

.msg-row.user .msg-avatar {
  background: var(--navy-raised);
  border: 1px solid var(--border-mid);
  color: var(--text-muted);
}

.msg-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: calc(100% - 44px);
}

.msg-meta {
  font-size: 0.72rem;
  color: var(--text-dimmer);
  display: flex;
  align-items: center;
  gap: 6px;
}
.msg-row.user .msg-meta { justify-content: flex-end; }

.msg-sender {
  font-weight: 500;
  color: var(--text-muted);
}

.msg-bubble {
  padding: 11px 16px;
  border-radius: var(--radius-lg);
  font-size: 0.9rem;
  line-height: 1.65;
}

.msg-row.assistant .msg-bubble {
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-top-left-radius: var(--radius-sm);
  color: var(--text);
}

.msg-row.user .msg-bubble {
  background: var(--steel-dim);
  border: 1px solid rgba(30,96,145,0.6);
  border-top-right-radius: var(--radius-sm);
  color: var(--text);
}

/* Markdown in messages */
.msg-bubble p { margin-bottom: 0.6em; }
.msg-bubble p:last-child { margin-bottom: 0; }
.msg-bubble ul, .msg-bubble ol {
  margin: 0.5em 0 0.5em 1.4em;
}
.msg-bubble li { margin-bottom: 0.25em; }
.msg-bubble code {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: rgba(0,0,0,0.3);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--green);
}
.msg-bubble pre {
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  overflow-x: auto;
  margin: 0.6em 0;
}
.msg-bubble pre code {
  background: none;
  padding: 0;
  font-size: 0.85em;
  color: var(--text);
}
.msg-bubble strong { color: var(--text); font-weight: 600; }
.msg-bubble em { color: var(--text-muted); }

/* ── Typing Indicator ─────────────────────────────────────── */
.typing-indicator {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 12px 16px;
}
.typing-indicator span {
  width: 7px;
  height: 7px;
  background: var(--text-dimmer);
  border-radius: 50%;
  animation: typingDot 1.3s infinite ease-in-out;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.15s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%            { transform: translateY(-5px); opacity: 1; }
}

/* ── Chat Input Area ──────────────────────────────────────── */
.chat-input-area {
  border-top: 1px solid var(--border);
  background: var(--navy-mid);
  padding: 14px 20px;
  flex-shrink: 0;
}

.input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--navy-card);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-lg);
  padding: 8px 8px 8px 16px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input-wrapper:focus-within {
  border-color: var(--steel);
  box-shadow: 0 0 0 3px rgba(30,96,145,0.15);
}

.chat-textarea {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  resize: none;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.5;
  min-height: 22px;
  max-height: 180px;
  padding: 2px 0;
  overflow-y: auto;
}
.chat-textarea::placeholder { color: var(--text-dimmer); }

.send-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--steel);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition), transform var(--transition);
}
.send-btn:hover:not(:disabled) {
  background: var(--steel-light);
  transform: scale(1.05);
}
.send-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.input-hint {
  font-size: 0.72rem;
  color: var(--text-dimmer);
  text-align: right;
  margin-top: 6px;
}

/* ── Empty State ─────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 12px;
  padding: 48px;
  text-align: center;
}

.empty-state .empty-icon {
  width: 56px;
  height: 56px;
  background: var(--navy-raised);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.empty-state h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

.empty-state p {
  font-size: 0.875rem;
  color: var(--text-muted);
  max-width: 320px;
  line-height: 1.55;
}

/* ── OSCE Interface ──────────────────────────────────────── */

/* Full-width layout — no sidebar, system assigns cases */
.osce-full-layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Legacy two-column layout kept for reference but no longer used */
.osce-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.osce-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Case Selection Card */
.case-select-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
}
.case-select-card:hover {
  border-color: var(--border-mid);
  background: var(--navy-raised);
}
.case-select-card.selected {
  border-color: var(--green);
  background: rgba(46,204,143,0.07);
}
.case-select-card .case-icon {
  width: 36px;
  height: 36px;
  background: var(--steel-dim);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.case-select-card.selected .case-icon {
  background: rgba(46,204,143,0.15);
}
.case-select-card .case-info h4 {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
  line-height: 1.3;
}
.case-select-card .case-info p {
  font-size: 0.74rem;
  color: var(--text-muted);
}

/* OSCE Status Bar */
.osce-status-bar {
  background: var(--navy-mid);
  border-bottom: 1px solid var(--border);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.osce-status-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.osce-status-item .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-dimmer);
}
.osce-status-item .dot.active { background: var(--green); box-shadow: 0 0 6px var(--green); }
.osce-status-item .dot.warning { background: var(--amber); }
.osce-status-item strong { color: var(--text); font-weight: 600; }

/* OSCE Result Panel */
.osce-result-panel {
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 16px;
}

.osce-result-header {
  padding: 18px 22px;
  background: rgba(0,0,0,0.15);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 1.1rem;
  font-weight: 700;
  flex-shrink: 0;
}
.score-badge.pass {
  background: rgba(46,204,143,0.15);
  border: 2px solid var(--green);
  color: var(--green);
}
.score-badge.fail {
  background: rgba(224,82,96,0.15);
  border: 2px solid var(--red);
  color: var(--red);
}

.osce-result-body {
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.feedback-section h4 {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dimmer);
  margin-bottom: 6px;
}
.feedback-section p,
.feedback-section ul {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
}
.feedback-section ul {
  padding-left: 1.3em;
}
.feedback-section li { margin-bottom: 4px; }

/* ── Pill / Tag ──────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 500;
  border: 1px solid transparent;
}
.pill-green {
  background: rgba(46,204,143,0.1);
  color: var(--green);
  border-color: var(--border-green);
}
.pill-blue {
  background: rgba(30,96,145,0.15);
  color: var(--steel-light);
  border-color: rgba(30,96,145,0.4);
}
.pill-red {
  background: rgba(224,82,96,0.1);
  color: var(--red);
  border-color: rgba(224,82,96,0.3);
}
.pill-amber {
  background: rgba(240,165,48,0.1);
  color: var(--amber);
  border-color: rgba(240,165,48,0.3);
}
.pill-neutral {
  background: rgba(255,255,255,0.05);
  color: var(--text-muted);
  border-color: var(--border);
}

/* ── Tables ──────────────────────────────────────────────── */
.data-table-wrap {
  overflow-x: auto;
  overflow-y: auto;       /* allow vertical scroll when rows overflow */
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table thead {
  background: rgba(0,0,0,0.2);
  border-bottom: 1px solid var(--border);
}

.data-table th {
  padding: 11px 16px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-dimmer);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 16px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tr:first-child td { border-top: none; }

.data-table tbody tr {
  transition: background var(--transition);
}
.data-table tbody tr:hover {
  background: rgba(255,255,255,0.03);
}

.data-table .td-primary {
  color: var(--text);
  font-weight: 500;
}

/* ── Forms ───────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
}

.form-control {
  background: var(--navy-card);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 9px 13px;
  font-size: 0.88rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}
.form-control:focus {
  border-color: var(--steel);
  box-shadow: 0 0 0 3px rgba(30,96,145,0.15);
}
.form-control::placeholder { color: var(--text-dimmer); }

textarea.form-control {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%234D6680' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  cursor: pointer;
}

.form-hint {
  font-size: 0.76rem;
  color: var(--text-dimmer);
}
.form-error {
  font-size: 0.76rem;
  color: var(--red);
}

/* ── Progress Bar ────────────────────────────────────────── */
.progress-bar {
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}
.progress-bar-fill.green  { background: var(--green); }
.progress-bar-fill.blue   { background: var(--steel-light); }
.progress-bar-fill.amber  { background: var(--amber); }
.progress-bar-fill.red    { background: var(--red); }

/* ── Divider ─────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* ── Alert / Banners ─────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 0.875rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.5;
}
.alert-icon { flex-shrink: 0; margin-top: 1px; }

.alert-info {
  background: rgba(30,96,145,0.1);
  border-color: rgba(30,96,145,0.3);
  color: #8fc5e8;
}
.alert-success {
  background: rgba(46,204,143,0.08);
  border-color: rgba(46,204,143,0.25);
  color: var(--green);
}
.alert-warning {
  background: rgba(240,165,48,0.08);
  border-color: rgba(240,165,48,0.25);
  color: var(--amber);
}
.alert-danger {
  background: rgba(224,82,96,0.08);
  border-color: rgba(224,82,96,0.25);
  color: var(--red);
}

/* ── Modal ───────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.modal-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--navy-card);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  transform: translateY(12px) scale(0.98);
  transition: transform var(--transition);
  overflow: hidden;
}
.modal-backdrop.open .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 1rem; font-weight: 600; }

.modal-body { padding: 20px 22px; }

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* ── Login Page ──────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--navy-card);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 28px;
}

.login-logo .logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--steel), var(--green));
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: 0 4px 16px rgba(46,204,143,0.3);
}

.login-logo .logo-text {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.login-logo .logo-text span { color: var(--green); }

.login-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 26px;
  line-height: 1.5;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Student login: Telegram deep-link button ─────────────── */
.telegram-login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 13px 20px;
  background: #2AABEE;           /* Telegram brand blue */
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius);
  text-decoration: none;
  transition: background var(--transition), transform 120ms ease,
              box-shadow var(--transition);
  box-shadow: 0 4px 16px rgba(42, 171, 238, 0.35);
  margin-bottom: 10px;
}

.telegram-login-btn:hover {
  background: #1E96D4;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(42, 171, 238, 0.45);
}

.telegram-login-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(42, 171, 238, 0.3);
}

/* ── "or follow these steps manually" divider ─────────────── */
.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 20px;
  color: var(--text-dimmer);
  font-size: 0.75rem;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Student login: step-by-step instructions ─────────────── */
.student-login-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 20px;
}

.step-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.step-num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.step-text {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.step-text strong { color: var(--text-primary); }

.inline-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  background: var(--surface-2);
  color: var(--green);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* ── Toast Notifications ─────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--navy-raised);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  padding: 11px 16px;
  font-size: 0.855rem;
  color: var(--text);
  box-shadow: var(--shadow);
  min-width: 240px;
  max-width: 360px;
  pointer-events: all;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastIn 0.25s ease forwards;
}
.toast.removing {
  animation: toastOut 0.25s ease forwards;
}

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

.toast.success .toast-dot { background: var(--green); }
.toast.error   .toast-dot { background: var(--red); }
.toast.info    .toast-dot { background: var(--steel-light); }
.toast.warning .toast-dot { background: var(--amber); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(16px); }
}

/* ── Loading States ──────────────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.12);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  flex-shrink: 0;
}
.spinner-sm {
  width: 14px;
  height: 14px;
  border-width: 2px;
}
.spinner-lg {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

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

.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0.04) 25%,
    rgba(255,255,255,0.08) 50%,
    rgba(255,255,255,0.04) 75%
  );
  background-size: 200% 100%;
  animation: skeletonPulse 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeletonPulse {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Section Divider Label ───────────────────────────────── */
.section-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 6px 0;
}
.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.section-divider span {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-dimmer);
  white-space: nowrap;
}

/* ── History Item (session list) ─────────────────────────── */
.history-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
}
.history-item:hover {
  background: rgba(255,255,255,0.04);
  border-color: var(--border);
}
.history-item.active {
  background: rgba(30,96,145,0.12);
  border-color: rgba(30,96,145,0.35);
}
.history-item .hi-title {
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-item .hi-meta {
  font-size: 0.72rem;
  color: var(--text-dimmer);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── Score Ring (stats) ──────────────────────────────────── */
.score-ring-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.score-ring {
  position: relative;
  width: 80px;
  height: 80px;
}

.score-ring svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.score-ring circle {
  fill: none;
  stroke-width: 7;
}

.score-ring .track {
  stroke: rgba(255,255,255,0.08);
}

.score-ring .fill {
  stroke: var(--green);
  stroke-linecap: round;
  transition: stroke-dashoffset 0.8s ease;
}

.score-ring .ring-value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

/* ══════════════════════════════════════════════════════════
   MOBILE TOPBAR  (visible only on mobile)
   ══════════════════════════════════════════════════════════ */
.mobile-topbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 54px;
  background: var(--navy-mid);
  border-bottom: 1px solid var(--border);
  z-index: 200;
  padding: 0 16px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mobile-topbar .logo-area {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.mobile-topbar .logo-text {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.mobile-topbar .logo-text span { color: var(--green); }

.mobile-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hamburger-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: transparent;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.hamburger-btn:hover {
  background: var(--navy-raised);
  color: var(--text);
  border-color: var(--border-mid);
}

/* ── Sidebar overlay (mobile backdrop) ──────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 290;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.sidebar-overlay.visible {
  display: block;
}

/* ── Sidebar close button (mobile only) ─────────────────── */
.sidebar-close-btn {
  display: none;
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}

.sidebar-close-btn:hover {
  background: var(--navy-raised);
  color: var(--text);
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  /* Show mobile topbar */
  .mobile-topbar {
    display: flex;
  }

  /* Sidebar becomes off-canvas drawer */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 270px;
    z-index: 300;
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-lg);
  }

  .sidebar.drawer-open {
    transform: translateX(0);
  }

  .sidebar-close-btn {
    display: flex;
  }

  /* Push main content below topbar */
  .main-content {
    margin-left: 0 !important;
    padding-top: 54px;
  }

  /* ── Stats / Admin pages: break out of fixed-height shell ──
     Chat and OSCE need the fixed 100vh shell so the input bar
     stays pinned at the bottom. But stats and admin pages are
     plain document-flow pages — their content must grow freely.
     We use :has(.page-container) to target only those pages
     without touching chat/OSCE layouts.
  ─────────────────────────────────────────────────────────── */
  .app-shell:has(.page-container) {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .app-shell:has(.page-container) .main-content {
    overflow: visible;
    height: auto;
  }

  /* Allow page-container itself to grow naturally */
  .app-shell:has(.page-container) .page-container {
    flex: none;
    overflow-y: visible;
    height: auto;
  }

  /* Page content padding */
  .page-container {
    padding: 20px 16px;
  }

  .page-header {
    padding: 16px 16px 0;
    flex-wrap: wrap;
    gap: 10px;
  }

  .page-header h1 {
    font-size: 1.15rem;
  }

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

  /* Chat input area */
  .chat-input-area {
    padding: 12px 14px;
  }

  /* Tables scroll horizontally */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 560px;
  }


  /* Admin table helper */
  .admin-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -2px;
  }

  /* On mobile, remove fixed max-heights from admin inner blocks —
     the document scrolls naturally so inner scroll containers
     aren't needed and would create double-scroll confusion. */
  #admin-students-body ~ * .data-table-wrap,
  .data-table-wrap {
    max-height: none;
  }
  #admin-detail-body {
    max-height: none;
    overflow-y: visible;
  }

  /* Card header row */
  .card-header {
    flex-wrap: wrap;
    gap: 10px;
  }

  /* Card header: heading always gets its own full row so text is never clipped */
  .card-header h3,
  .card-header h2 {
    width: 100%;
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
  }

  /* Section header actions go below title on narrow screens */
  .section-header {
    flex-wrap: wrap;
    gap: 10px;
  }
}

@media (max-width: 600px) {
  :root {
    --header-h: 52px;
  }

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

  .modal {
    width: calc(100vw - 32px);
    max-width: 100%;
    margin: 16px;
    border-radius: var(--radius-lg);
  }

  .modal-backdrop {
    align-items: flex-end;
  }

  .login-card {
    padding: 28px 22px;
  }

  /* Topbar logo icon smaller */
  .mobile-topbar .logo-icon {
    width: 28px;
    height: 28px;
  }

  /* Chat bubbles narrower on small screens */
  .msg-bubble {
    max-width: 90%;
  }

  /* OSCE control bar wraps */
  .osce-controls {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Stat card numbers slightly smaller */
  .stat-value {
    font-size: 1.5rem;
  }

  /* Recent OSCE table — hide date column */
  .recent-osce-date {
    display: none;
  }

  /* Feedback grid single col */
  .osce-feedback-grid {
    grid-template-columns: 1fr;
  }

  /* Page container tighter */
  .page-container {
    padding: 16px 12px;
  }

  /* Section heading smaller */
  .section-heading {
    font-size: 0.9rem;
  }

  /* Pills wrap better */
  .pill { font-size: 0.72rem; padding: 3px 8px; }

  /* Buttons in header don't overflow */
  .page-header .btn {
    font-size: 0.78rem;
    padding: 6px 12px;
  }

  /* Progress bar thinner */
  .progress-bar { height: 5px; }

  /* ── Top header: allow wrapping on small phones ───────────
     The fixed height forces title + badge + buttons into one
     line which causes overflow/cramping. On mobile we remove
     the fixed height, hide the supplementary badge, tighten
     padding, and let actions sit cleanly alongside the title.
  ─────────────────────────────────────────────────────────── */
  .top-header {
    height: auto;
    min-height: var(--header-h);
    padding: 8px 14px;
    flex-wrap: wrap;
    gap: 6px 10px;
  }

  /* Hide the badge text — it's supplementary info not needed on mobile */
  .header-title .badge {
    display: none;
  }

  /* Title can shrink so it never crowds the buttons */
  .header-title {
    flex: 1;
    min-width: 0;
    font-size: 0.88rem;
    gap: 7px;
  }

  /* Keep the icon from shrinking */
  .header-title svg {
    flex-shrink: 0;
  }

  /* Action area: no shrink, buttons stay at their natural size */
  .header-actions {
    flex-shrink: 0;
    gap: 6px;
  }

  /* Trim button padding just enough to save space without looking cramped */
  .header-actions .btn {
    padding: 6px 11px;
    font-size: 0.8rem;
  }

  /* The ephemeral notice on the chat page is non-essential on mobile */
  .ephemeral-notice {
    display: none;
  }
}

/* ── Utilities ───────────────────────────────────────────── */
.flex         { display: flex; }
.flex-col     { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4        { gap: 4px; }
.gap-8        { gap: 8px; }
.gap-12       { gap: 12px; }
.gap-16       { gap: 16px; }
.gap-20       { gap: 20px; }
.gap-24       { gap: 24px; }
.w-full       { width: 100%; }
.min-w-0      { min-width: 0; }
.flex-1       { flex: 1; }
.overflow-hidden { overflow: hidden; }
.overflow-auto   { overflow: auto; }
.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mt-4   { margin-top: 4px; }
.mt-8   { margin-top: 8px; }
.mt-12  { margin-top: 12px; }
.mt-16  { margin-top: 16px; }
.mb-4   { margin-bottom: 4px; }
.mb-8   { margin-bottom: 8px; }
.mb-12  { margin-bottom: 12px; }
.mb-16  { margin-bottom: 16px; }
.p-0    { padding: 0; }
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════
   ADDITIONS — OSCE, Stats, Admin polish
   ═══════════════════════════════════════════════════════════ */

/* ── OSCE: improved result panel ─────────────────────────── */
/* Override old flat pass/fail badge with ring-based display */
.osce-result-panel {
  background: var(--navy-card);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 16px;
  box-shadow: var(--shadow-sm);
}

.osce-result-header {
  padding: 20px 24px;
  background: rgba(0,0,0,0.18);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 18px;
}

.osce-result-header h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.osce-result-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ── Score ring (SVG-based, used in OSCE result) ─────────── */
.score-ring {
  position: relative;
  width: 72px;
  height: 72px;
  flex-shrink: 0;
}
.score-ring svg {
  width: 72px;
  height: 72px;
  transform: rotate(-90deg);
}
.score-ring .ring-bg {
  fill: none;
  stroke: rgba(255,255,255,0.07);
  stroke-width: 6;
}
.score-ring .ring-fill {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 188.5;
  transition: stroke-dashoffset 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}
.score-ring .ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
}
.score-ring .ring-num   { font-size: 1.3rem; font-weight: 700; letter-spacing: -0.03em; }
.score-ring .ring-denom { font-size: 0.62rem; color: var(--text-dimmer); }

/* Score semantic color classes */
.score-excellent    { color: #2ECC8F !important; }
.score-good         { color: #63d471 !important; }
.score-satisfactory { color: #F0A530 !important; }
.score-poor         { color: #f07033 !important; }
.score-fail         { color: #E05260 !important; }

/* Feedback grid (2-col inside result panel) */
.osce-feedback-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 640px) {
  .osce-feedback-grid { grid-template-columns: 1fr; }
}
.feedback-box {
  background: rgba(0,0,0,0.14);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.feedback-box.full-width { grid-column: 1 / -1; }
.feedback-box h4 {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-dimmer);
  margin-bottom: 8px;
}
.feedback-box p,
.feedback-box ul {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
}
.feedback-box ul { padding-left: 1.2em; }
.feedback-box li { margin-bottom: 3px; }

/* ── OSCE: timer pill in status bar ──────────────────────── */
.osce-timer {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 100px;
  letter-spacing: 0.06em;
  transition: color var(--transition), border-color var(--transition);
}
.osce-timer.running {
  color: var(--green);
  border-color: var(--border-green);
  background: rgba(46,204,143,0.06);
}
.osce-timer.urgent {
  color: var(--amber);
  border-color: rgba(240,165,48,0.35);
  background: rgba(240,165,48,0.06);
}

/* ── OSCE: case skeleton cards ───────────────────────────── */
.case-skeleton {
  height: 64px;
  border-radius: var(--radius);
  background: var(--navy-card);
  border: 1px solid var(--border);
}

/* ── OSCE: quick-action chips on empty state ─────────────── */
.osce-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 10px;
}
.osce-chip {
  padding: 6px 14px;
  border-radius: 100px;
  background: var(--navy-card);
  border: 1px solid var(--border-mid);
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}
.osce-chip:hover {
  border-color: var(--steel);
  color: var(--text);
  background: var(--navy-raised);
}

/* ── OSCE: case icon uses SVG now (no emoji) ─────────────── */
.case-select-card .case-icon {
  width: 36px;
  height: 36px;
  background: var(--steel-dim);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: rgba(255,255,255,0.7);
  transition: background var(--transition);
}
.case-select-card.selected .case-icon {
  background: rgba(46,204,143,0.18);
  color: var(--green);
}

/* ── Stats: score bar in stat cards ──────────────────────── */
.stat-card .progress-bar {
  margin-top: 6px;
}

/* Score pip dot (admin + stats tables) */
.score-pip {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  vertical-align: middle;
}

/* Score cell layout wrapper */
.score-badge-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
}

/* Score mini bar (stats table) */
.score-bar-wrap {
  display: inline-block;
  width: 100%;
  max-width: 80px;
  height: 4px;
  background: rgba(255,255,255,0.07);
  border-radius: 2px;
  overflow: hidden;
  vertical-align: middle;
}
.score-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s ease;
}

/* ── Admin: skeleton table rows ──────────────────────────── */
.admin-skeleton-cell {
  height: 13px;
  border-radius: 3px;
}
.admin-skeleton-row td { padding: 14px 16px; }

/* ── Admin: student detail meta strip ────────────────────── */
.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.detail-meta-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 14px;
  background: rgba(0,0,0,0.15);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-width: 110px;
}
.detail-meta-item .dmeta-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-dimmer);
  font-weight: 600;
}
.detail-meta-item .dmeta-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.detail-section { margin-bottom: 16px; }
.detail-section h4 {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-dimmer);
  font-weight: 600;
  margin-bottom: 10px;
}
.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ── Stats: alert with icon alignment fix ────────────────── */
.alert.alert-info,
.alert.alert-success,
.alert.alert-warning,
.alert.alert-danger {
  align-items: flex-start;
}
.alert a { font-weight: 600; text-decoration: underline; }

/* ── Top header: improved icon+title gap ─────────────────── */
.header-title svg { flex-shrink: 0; }

/* ── Misc button refinements ─────────────────────────────── */
.btn svg { flex-shrink: 0; }

/* ── Feedback expand/collapse (stats table) ──────────────── */
.feedback-preview { color: var(--text-muted); font-size: 0.82rem; line-height: 1.5; }
.feedback-full    { color: var(--text-muted); font-size: 0.82rem; line-height: 1.55; margin-top: 4px; }
.feedback-toggle  {
  font-size: 0.72rem;
  color: var(--steel-light);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  margin-left: 4px;
}
.feedback-toggle:hover { text-decoration: underline; }

/* ── Stats search row ────────────────────────────────────── */
.stats-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Score cell (inline display with pip) ────────────────── */
.score-cell {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
}

/* ── Finish modal footer alignment ───────────────────────── */
#finish-confirm-modal .modal-footer {
  gap: 10px;
  justify-content: flex-end;
}

/* ══════════════════════════════════════════════════════════
   LANDING PAGE
   ══════════════════════════════════════════════════════════ */

.landing-page {
  background: var(--navy);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Landing Nav ─────────────────────────────────────────── */
.landing-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 48px;
  height: 64px;
  background: rgba(13, 27, 42, 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.landing-nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.landing-nav-logo .logo-text {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.landing-nav-logo .logo-text span { color: var(--green); }

.landing-nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── Hero ────────────────────────────────────────────────── */
.landing-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 24px 60px;
  position: relative;
  overflow: hidden;
}

.landing-hero::before {
  content: '';
  position: absolute;
  top: -160px;
  left: 50%;
  transform: translateX(-50%);
  width: 700px;
  height: 700px;
  background: radial-gradient(ellipse at center,
    rgba(46, 204, 143, 0.09) 0%,
    rgba(30, 96, 145, 0.07) 40%,
    transparent 70%);
  pointer-events: none;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 14px;
  border-radius: 100px;
  border: 1px solid var(--border-green);
  background: rgba(46, 204, 143, 0.08);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--green);
  letter-spacing: 0.04em;
  margin-bottom: 28px;
  text-transform: uppercase;
}

.hero-badge .badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.7); }
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--text);
  max-width: 720px;
  margin-bottom: 20px;
}

.hero-title .accent {
  background: linear-gradient(135deg, var(--green) 0%, var(--steel-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 540px;
  line-height: 1.65;
  margin-bottom: 36px;
}

.hero-actions {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

.hero-note {
  margin-top: 20px;
  font-size: 0.78rem;
  color: var(--text-dimmer);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Feature cards ───────────────────────────────────────── */
.landing-section {
  padding: 72px 24px;
  max-width: 1080px;
  margin: 0 auto;
  width: 100%;
}

.section-label {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--green);
  margin-bottom: 10px;
}

.section-title {
  text-align: center;
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 10px;
}

.section-desc {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.96rem;
  max-width: 520px;
  margin: 0 auto 52px;
  line-height: 1.65;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.feature-card {
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 26px;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.feature-card:hover {
  border-color: var(--border-mid);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.feature-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius);
  background: var(--steel-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  color: var(--green);
  transition: background var(--transition);
}

.feature-card:hover .feature-icon {
  background: rgba(46, 204, 143, 0.15);
}

.feature-card h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.feature-card p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.65;
}

/* ── How It Works ────────────────────────────────────────── */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  position: relative;
}

.steps-grid::before {
  content: '';
  position: absolute;
  top: 22px;
  left: calc(16.66% + 16px);
  right: calc(16.66% + 16px);
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--border-mid) 20%,
    var(--border-mid) 80%,
    transparent 100%);
  pointer-events: none;
}

.step-item {
  text-align: center;
  padding: 0 16px;
}

.step-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--navy-card);
  border: 2px solid var(--border-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--green);
  margin: 0 auto 18px;
  position: relative;
  z-index: 1;
}

.step-item h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.step-item p {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.65;
}

/* ── Stats Banner ────────────────────────────────────────── */
.landing-stats-bar {
  background: var(--navy-card);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 36px 24px;
}

.landing-stats-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 64px;
  max-width: 760px;
  margin: 0 auto;
  flex-wrap: wrap;
}

.landing-stat {
  text-align: center;
}

.landing-stat .lstat-num {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--green);
  line-height: 1;
  margin-bottom: 6px;
}

.landing-stat .lstat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ── CTA ─────────────────────────────────────────────────── */
.landing-cta {
  background: linear-gradient(135deg,
    rgba(30, 96, 145, 0.2) 0%,
    rgba(46, 204, 143, 0.08) 100%);
  border-top: 1px solid var(--border);
  padding: 80px 24px;
  text-align: center;
}

.cta-inner {
  max-width: 560px;
  margin: 0 auto;
}

.landing-cta h2 {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text);
  margin-bottom: 14px;
}

.landing-cta p {
  color: var(--text-muted);
  font-size: 0.97rem;
  line-height: 1.65;
  margin-bottom: 32px;
}

/* ── Footer ──────────────────────────────────────────────── */
.landing-footer {
  background: var(--navy-mid);
  border-top: 1px solid var(--border);
  padding: 24px 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.landing-footer p {
  font-size: 0.78rem;
  color: var(--text-dimmer);
}

/* ── Landing page responsive ─────────────────────────────── */
@media (max-width: 900px) {
  .landing-nav {
    padding: 0 24px;
  }

  .features-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .steps-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .steps-grid::before { display: none; }

  .step-item {
    display: flex;
    align-items: flex-start;
    text-align: left;
    gap: 18px;
    padding: 0;
  }

  .step-circle {
    margin: 0;
    flex-shrink: 0;
  }

  .landing-stats-inner {
    gap: 40px;
  }

  .landing-footer {
    padding: 20px 24px;
    justify-content: center;
    text-align: center;
  }
}

@media (max-width: 600px) {
  .landing-hero {
    padding: 60px 20px 48px;
  }

  .landing-section {
    padding: 52px 20px;
  }

  .hero-actions {
    flex-direction: column;
    width: 100%;
  }

  .hero-actions .btn {
    width: 100%;
    max-width: 320px;
    justify-content: center;
  }

  .landing-stats-inner {
    gap: 28px;
  }

  .landing-nav-actions .btn-outline {
    display: none;
  }
}


/* ══════════════════════════════════════════════════════════════
   OSCE GUIDE PAGE
   ══════════════════════════════════════════════════════════════ */

/* ── Mindset grid ────────────────────────────────────────────── */
.guide-mindset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.guide-mindset-card {
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 22px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  transition: border-color var(--transition), transform var(--transition);
}

.guide-mindset-card:hover {
  border-color: var(--border-mid);
  transform: translateY(-2px);
}

.guide-mindset-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.guide-mindset-card h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.guide-mindset-card p {
  font-size: 0.855rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin: 0;
}

/* ── 4-step approach list ────────────────────────────────────── */
.guide-steps-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.guide-step-row {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 28px;
  transition: border-color var(--transition);
}

.guide-step-row:hover {
  border-color: var(--border-mid);
}

.guide-step-number {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--steel-dim);
  border: 2px solid rgba(30, 96, 145, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--green);
  flex-shrink: 0;
}

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

.guide-step-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.guide-step-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.guide-step-body > p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 14px;
}

.guide-step-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

/* ── Good / bad comparison ───────────────────────────────────── */
.guide-compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.guide-compare-card {
  border-radius: var(--radius-lg);
  padding: 26px;
  border: 1px solid;
}

.guide-compare-bad {
  background: rgba(224, 82, 96, 0.05);
  border-color: rgba(224, 82, 96, 0.25);
}

.guide-compare-good {
  background: rgba(46, 204, 143, 0.04);
  border-color: rgba(46, 204, 143, 0.25);
}

.guide-compare-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
  padding: 4px 12px;
  border-radius: 100px;
}

.guide-compare-label-bad {
  background: rgba(224, 82, 96, 0.12);
  color: var(--red);
  border: 1px solid rgba(224, 82, 96, 0.25);
}

.guide-compare-label-good {
  background: rgba(46, 204, 143, 0.1);
  color: var(--green);
  border: 1px solid rgba(46, 204, 143, 0.25);
}

.guide-compare-context {
  font-size: 0.8rem;
  color: var(--text-dimmer);
  font-style: italic;
  margin-bottom: 10px;
  line-height: 1.5;
}

.guide-compare-response {
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 18px;
}

.guide-compare-response.bad {
  background: rgba(224, 82, 96, 0.08);
  border-left: 3px solid var(--red);
}

.guide-compare-response.good {
  background: rgba(46, 204, 143, 0.06);
  border-left: 3px solid var(--green);
}

.guide-compare-response p {
  font-size: 0.875rem;
  color: var(--text);
  line-height: 1.6;
  margin: 0;
  font-style: italic;
}

.guide-compare-notes {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.guide-compare-notes li {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
  padding-left: 18px;
  position: relative;
}

.guide-compare-bad .guide-compare-notes li::before {
  content: '✕';
  position: absolute;
  left: 0;
  color: var(--red);
  font-size: 0.72rem;
  top: 2px;
}

.guide-compare-good .guide-compare-notes li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--green);
  font-size: 0.72rem;
  top: 2px;
}

/* ── Common mistakes grid ────────────────────────────────────── */
.guide-mistake-card {
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: border-color var(--transition), transform var(--transition);
}

.guide-mistake-card:hover {
  border-color: rgba(224, 82, 96, 0.3);
  transform: translateY(-2px);
}

.guide-mistake-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  background: rgba(224, 82, 96, 0.1);
  color: var(--red);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.guide-mistake-card h4 {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 7px;
}

.guide-mistake-card p {
  font-size: 0.855rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin: 0;
}

/* ── Scoring rubric table ────────────────────────────────────── */
.guide-score-table {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 20px;
}

.guide-score-row {
  display: grid;
  grid-template-columns: 80px 120px 1fr;
  align-items: center;
  gap: 0;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.guide-score-row:last-child {
  border-bottom: none;
}

.guide-score-row:hover {
  background: rgba(255,255,255,0.02);
}

.guide-score-band {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-family: var(--font-mono);
}

.guide-score-label {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  border-radius: 100px;
  display: inline-block;
  text-align: center;
}

.guide-score-desc {
  font-size: 0.855rem;
  color: var(--text-muted);
  line-height: 1.55;
  padding-left: 16px;
  border-left: 1px solid var(--border);
}

.guide-score-excellent .guide-score-band { color: var(--green); }
.guide-score-excellent .guide-score-label {
  background: rgba(46,204,143,0.12); color: var(--green);
}

.guide-score-good .guide-score-band { color: #52d4a8; }
.guide-score-good .guide-score-label {
  background: rgba(82,212,168,0.1); color: #52d4a8;
}

.guide-score-satisfactory .guide-score-band { color: var(--steel-light); }
.guide-score-satisfactory .guide-score-label {
  background: rgba(38,128,184,0.15); color: var(--steel-light);
}

.guide-score-poor .guide-score-band { color: var(--amber); }
.guide-score-poor .guide-score-label {
  background: rgba(240,165,48,0.12); color: var(--amber);
}

.guide-score-fail .guide-score-band { color: var(--red); }
.guide-score-fail .guide-score-label {
  background: rgba(224,82,96,0.12); color: var(--red);
}

.guide-score-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--text-dimmer);
  line-height: 1.6;
  padding: 14px 16px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ── OSCE Guide onboarding banner (used on osce.html) ────────── */
.osce-guide-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(30, 96, 145, 0.1);
  border: 1px solid rgba(30, 96, 145, 0.25);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 0 0 0 0;
}

.osce-guide-banner p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}

.osce-guide-banner a {
  color: var(--steel-light);
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.osce-guide-banner a:hover { color: var(--green); }

/* ── Guide responsive ────────────────────────────────────────── */
@media (max-width: 900px) {
  .guide-mindset-grid  { grid-template-columns: 1fr; }
  .guide-compare-grid  { grid-template-columns: 1fr; }

  .guide-step-row {
    flex-direction: column;
    gap: 14px;
    padding: 20px;
  }

  .guide-score-row {
    grid-template-columns: 60px 100px 1fr;
    padding: 12px 16px;
    gap: 0;
  }

  .guide-score-desc {
    font-size: 0.8rem;
    padding-left: 12px;
  }
}

@media (max-width: 600px) {
  .guide-score-row {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
  }

  .guide-score-desc {
    border-left: none;
    padding-left: 0;
    border-top: 1px solid var(--border);
    padding-top: 8px;
  }

  .guide-step-number {
    width: 38px;
    height: 38px;
    font-size: 0.95rem;
  }
}

/* ══════════════════════════════════════════════════════════════
   PWA MOBILE — App-Like Experience
   All rules below add to (never override) existing desktop CSS.
   Desktop breakpoint: > 900 px — completely unaffected.
   ══════════════════════════════════════════════════════════════ */

/* ── Missing .btn-outline variant (used in landing.html nav) ── */
.btn-outline {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-mid);
}
.btn-outline:hover:not(:disabled) {
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border-color: rgba(255,255,255,0.22);
}

/* ── Eliminate 300 ms tap delay on all interactive elements ─── */
a, button, [role="button"],
input[type="button"], input[type="submit"],
input[type="reset"], label[for],
.nav-item, .suggest-btn, .send-btn,
.hamburger-btn, .btn, .btn-icon {
  touch-action: manipulation;
}

/* ── iOS momentum scrolling on all scroll containers ─────────── */
.chat-messages,
.page-container,
.sidebar-nav,
.data-table-wrap,
.admin-table-wrap,
.table-wrap {
  -webkit-overflow-scrolling: touch;
}

/* ── Safe-area insets (iPhone notch / Dynamic Island) ────────── */
@supports (padding: env(safe-area-inset-bottom)) {
  .mobile-topbar {
    padding-left:  max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    padding-top:   env(safe-area-inset-top);
  }

  @media (max-width: 900px) {
    .chat-input-area {
      padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
    .sidebar {
      padding-bottom: max(16px, env(safe-area-inset-bottom));
    }
    #toast-container {
      bottom: max(76px, calc(60px + env(safe-area-inset-bottom)));
    }
  }
}

/* ════════════════════════════════════════════════════════════
   @media (max-width: 900px)  —  tablet + mobile
   ════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {

  /* ── Fix iOS input auto-zoom (Safari zooms any input < 16 px) ── */
  input:not([type="range"]),
  input:not([type="checkbox"]):not([type="radio"]),
  textarea,
  select,
  .form-control,
  .chat-textarea {
    font-size: 16px !important;
  }
  /* Re-apply letter-spacing for code inputs after font-size reset */
  .form-control.code-input {
    font-size: 1.25rem !important;
    letter-spacing: 0.18em;
  }

  /* ── Touch targets — Apple HIG minimum 44 × 44 px ─────────── */
  .hamburger-btn {
    width:  44px;
    height: 44px;
  }

  .send-btn {
    width:  44px;
    height: 44px;
  }

  .nav-item {
    min-height: 44px;
    padding: 10px 14px;
  }

  .btn-icon {
    width:  40px;
    height: 40px;
  }

  /* ── App shell uses small viewport height (no iOS bar jump) ── */
  .app-shell {
    height: 100svh;
    min-height: 100svh;
  }
  /* Restore document flow for stats/admin pages */
  .app-shell:has(.page-container) {
    height: auto;
    min-height: 100svh;
  }

  /* ── Hide keyboard-only hints on touch screens ─────────────── */
  .input-hint {
    display: none;
  }

  /* ── Chat input area — ergonomic bottom bar ─────────────────── */
  .input-wrapper {
    padding: 10px 10px 10px 14px;
    gap: 8px;
  }
  .chat-input-area {
    padding: 10px 12px 14px;
  }

  /* ── OSCE status bar — compact single row ───────────────────── */
  .osce-status-bar {
    padding: 6px 12px;
    gap: 12px;
    min-height: 38px;
  }
  .osce-status-item {
    font-size: 0.74rem;
    gap: 5px;
  }

  /* ── Login page — stay above soft keyboard ──────────────────── */
  .login-page {
    align-items: flex-start;
    padding: 32px 20px 60px;
    min-height: 100svh;
  }
  .login-card {
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
  }

  /* ── Modal — bottom-sheet on mobile ────────────────────────── */
  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }
  .modal {
    width: 100%;
    max-width: 100%;
    margin: 0;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    transform: translateY(100%);
  }
  .modal-backdrop.open .modal {
    transform: translateY(0);
  }

  /* ── Toast — sit above pinned input bar ─────────────────────── */
  #toast-container {
    bottom: 76px;
    right: 12px;
    left: 12px;
  }
  .toast {
    min-width: 0;
    max-width: 100%;
  }

  /* ── Cards — tighter padding on mobile ─────────────────────── */
  .card-body   { padding: 14px 16px; }
  .card-footer { padding: 10px 16px; }

  /* ── Stat grid — tighter gap ────────────────────────────────── */
  .stat-grid {
    gap: 10px;
  }

  /* ── OSCE result panel — flush edges on mobile ──────────────── */
  .osce-result-panel {
    margin: 10px 0;
    border-radius: var(--radius);
  }

  /* ── Detail meta items — 2-up on tablet, stack on phone ─────── */
  .detail-meta-item {
    min-width: calc(50% - 5px);
    flex: 1 1 calc(50% - 5px);
  }
}

/* ════════════════════════════════════════════════════════════
   @media (max-width: 600px)  —  phone only
   ════════════════════════════════════════════════════════════ */
@media (max-width: 600px) {

  /* ── Landing nav — tighten up ───────────────────────────────── */
  .landing-nav {
    padding: 0 16px;
    height: 56px;
  }
  .landing-nav-logo .logo-text {
    font-size: 1rem;
  }

  /* ── Landing hero — less vertical padding ───────────────────── */
  .landing-hero {
    padding: 48px 16px 40px;
  }

  /* ── Landing stats — 2-column grid on narrow screens ────────── */
  .landing-stats-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px 32px;
  }

  /* ── Suggest grid — single column to avoid truncation ────────── */
  .suggest-grid {
    grid-template-columns: 1fr;
  }
  .suggest-btn {
    padding: 14px 16px;
    font-size: 0.85rem;
  }

  /* ── Student login steps — compact ─────────────────────────── */
  .student-login-steps {
    padding: 12px;
    gap: 10px;
  }

  /* ── OSCE chip row — tighter wrapping ───────────────────────── */
  .osce-chip-row {
    gap: 6px;
  }

  /* ── Detail meta — full-width stack ────────────────────────── */
  .detail-meta-item {
    min-width: 100%;
    flex: 1 1 100%;
  }
}
