/* SmartFarm EDU 2028 — Premium EdTech Design System */
:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --emerald: #059669;
  --emerald-soft: #ecfdf5;
  --indigo-soft: #eef2ff;
  --amber: #d97706;
  --amber-soft: #fffbeb;
  --rose: #e11d48;
  --rose-soft: #fff1f2;
  --blue: #2563eb;
  --blue-soft: #eff6ff;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.hidden {
  display: none !important;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* Mobile Header */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: #0f172a;
  color: #fff;
  padding: 0 14px;
  align-items: center;
  justify-content: space-between;
  z-index: 40;
}

.mobile-brand {
  font-weight: 700;
  font-size: 15px;
}

/* Sidebar */
.sidebar {
  width: 264px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #0f172a 0%, #16223b 100%);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 30;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #10b981, #4f46e5);
  display: grid;
  place-items: center;
  font-size: 20px;
}

.brand-title {
  font-weight: 800;
  font-size: 17px;
  color: #fff;
  letter-spacing: -0.3px;
}

.brand-sub {
  font-size: 11.5px;
  color: #94a3b8;
}

.dday-widget {
  margin: 14px 4px;
  padding: 14px;
  border-radius: 12px;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.dday-label {
  font-size: 11px;
  color: #a7f3d0;
}

.dday-value {
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  line-height: 1.25;
}

.dday-target {
  font-size: 12px;
  color: #cbd5e1;
  margin-top: 4px;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #cbd5e1;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nav-item.active {
  background: linear-gradient(90deg, #4f46e5, #059669);
  color: #fff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

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

.sidebar-footer {
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.ts-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.06);
  padding: 8px 10px;
  border-radius: 8px;
}

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

.dot-green {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.dot-red {
  background: #f43f5e;
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 24px 28px 48px;
  max-width: 1480px;
  width: 100%;
  margin: 0 auto;
}

.tab-panel {
  display: none;
  flex-direction: column;
  gap: 20px;
  animation: fadeIn 0.2s ease;
}

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

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

/* Hero Card */
.hero-card {
  background: linear-gradient(125deg, #065f46 0%, #0f766e 40%, #3730a3 100%);
  color: #fff;
  border-radius: 18px;
  padding: 26px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  box-shadow: 0 10px 28px rgba(15, 118, 110, 0.22);
}

.hero-eyebrow {
  font-size: 12.5px;
  font-weight: 700;
  color: #a7f3d0;
  margin-bottom: 6px;
}

.hero-card h1 {
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 1.3;
}

.hero-desc {
  margin: 0 0 16px;
  color: #e2e8f0;
  font-size: 14px;
  max-width: 680px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-side-stat {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 14px;
  padding: 16px 18px;
  min-width: 240px;
  text-align: center;
}

.hero-stat-label {
  font-size: 12px;
  color: #cbd5e1;
}

.hero-ts-url {
  font-family: monospace;
  font-size: 14px;
  font-weight: 700;
  margin: 6px 0 10px;
  word-break: break-all;
}

/* Cards & Grids */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.highlight-card {
  border: 1.5px solid #c7d2fe;
  background: linear-gradient(180deg, #ffffff 0%, #f8faff 100%);
}

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

.card-header h3, .card h3 {
  margin: 0;
  font-size: 16.5px;
  font-weight: 700;
}

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

.section-header h2 {
  margin: 0 0 4px;
  font-size: 21px;
  font-weight: 800;
}

.muted {
  color: var(--text-muted);
  font-size: 13px;
  margin: 2px 0 0;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.kpi-label {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.kpi-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  margin: 4px 0;
}

.kpi-sub {
  font-size: 12px;
  color: var(--emerald);
  font-weight: 600;
}

.two-col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.stack-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.workspace-split {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 20px;
  align-items: start;
}

.scroll-pane {
  max-height: 76vh;
  overflow-y: auto;
}

.pane-title {
  margin: 0 0 12px;
  font-size: 15px;
}

/* Buttons & Chips */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

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

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

.btn-secondary {
  background: #f1f5f9;
  color: #334155;
  border-color: #cbd5e1;
}
.btn-secondary:hover { background: #e2e8f0; }

.btn-danger {
  background: var(--rose-soft);
  color: var(--rose);
  border-color: #fecdd3;
}
.btn-danger:hover { background: #ffe4e6; }

.btn-outline-light {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
}
.btn-outline-light:hover { background: rgba(255, 255, 255, 0.24); }

.btn-sm { padding: 7px 12px; font-size: 12.5px; }
.btn-xs { padding: 4px 9px; font-size: 12px; border-radius: 7px; }

.icon-btn {
  background: transparent;
  border: none;
  color: inherit;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: #475569;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.chip.active, .chip:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
}
.badge-emerald { background: var(--emerald-soft); color: var(--emerald); }
.badge-indigo { background: var(--indigo-soft); color: var(--primary); }
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-rose { background: var(--rose-soft); color: var(--rose); }
.badge-slate { background: #f1f5f9; color: #475569; }

/* Inputs & Forms */
.input, .textarea {
  width: 100%;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px solid #cbd5e1;
  background: #fff;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text);
}
.input:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}
.input-sm {
  width: auto;
  padding: 6px 10px;
  font-size: 12.5px;
}

.inline-form {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.form-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 700;
  color: #334155;
}
.form-divider {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--primary);
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}
.mini-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mini-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mini-grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }

/* Tasks & Lists */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.task-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-alt);
}
.task-item.done .task-title {
  text-decoration: line-through;
  color: var(--text-muted);
}
.task-title {
  flex: 1;
  font-size: 13.5px;
  font-weight: 600;
}

.prescription-list, .roi-mini-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.prescription-item {
  padding: 12px;
  border-radius: 10px;
  background: var(--surface-alt);
  border-left: 4px solid var(--primary);
}
.prescription-item strong {
  font-size: 14px;
}
.prescription-books {
  font-size: 13px;
  font-weight: 700;
  color: var(--emerald);
  margin: 4px 0 2px;
}
.prescription-tip {
  font-size: 12.5px;
  color: var(--text-muted);
}

.item-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.list-card {
  padding: 13px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  background: #fff;
}
.list-card:hover { border-color: #a5b4fc; background: #fafbff; }
.list-card.selected {
  border-color: var(--primary);
  background: var(--indigo-soft);
}
.list-card-title {
  font-size: 14px;
  font-weight: 700;
  margin: 6px 0 4px;
}
.progress-bar-bg {
  height: 6px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 8px;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--emerald), var(--primary));
  border-radius: 999px;
}

/* Video & Textbook Detail */
.detail-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.detail-title {
  margin: 6px 0 4px;
  font-size: 18px;
}
.detail-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.video-stage {
  border-radius: 12px;
  overflow: hidden;
  background: #0f172a;
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}
.video-stage video, .video-stage iframe {
  width: 100%;
  height: 390px;
  border: none;
  background: #000;
}
.external-video-card {
  padding: 36px 24px;
  text-align: center;
  color: #e2e8f0;
  max-width: 520px;
}
.player-controls-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border-radius: 10px;
  background: var(--surface-alt);
  margin-bottom: 14px;
}
.control-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.speed-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
}
.notes-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.align-right {
  display: flex;
  justify-content: flex-end;
}

.textbook-viewer-area iframe {
  width: 100%;
  height: 620px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.empty-state {
  text-align: center;
  padding: 64px 20px;
  color: var(--text-muted);
}
.empty-icon {
  font-size: 42px;
  margin-bottom: 10px;
}

/* Charts & Tables */
.chart-wrap {
  position: relative;
  height: 290px;
  margin-top: 10px;
}
.table-responsive {
  overflow-x: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th, .data-table td {
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
.data-table th {
  background: var(--surface-alt);
  font-weight: 700;
  color: #334155;
  white-space: nowrap;
}
.data-table.compact td {
  font-size: 12.5px;
  padding: 9px 8px;
}

/* Past Exam Practice Cards */
.exam-card-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.exam-card {
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  background: #fff;
}
.exam-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.exam-problem-text {
  font-size: 14.5px;
  line-height: 1.75;
  padding: 12px 14px;
  background: var(--surface-alt);
  border-radius: 10px;
  margin-bottom: 12px;
  white-space: pre-wrap;
}
.exam-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.choice-btn {
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: #fff;
  text-align: left;
  font-family: inherit;
  font-size: 13.5px;
  cursor: pointer;
  transition: all 0.15s;
}
.choice-btn:hover { border-color: var(--primary); background: var(--indigo-soft); }
.choice-btn.correct { border-color: var(--emerald); background: var(--emerald-soft); font-weight: 700; }
.choice-btn.wrong { border-color: var(--rose); background: var(--rose-soft); }

.exam-solution-box {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #f8faff;
  border: 1px solid #c7d2fe;
}
.trap-box {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--amber-soft);
  border-left: 4px solid var(--amber);
  font-size: 13px;
}

/* AI Tutor Layout */
.tutor-layout {
  display: grid;
  grid-template-columns: 1fr 310px;
  gap: 18px;
  align-items: start;
}
.tutor-chat-pane {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 150px);
  min-height: 620px;
  padding: 16px;
}
.tutor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.toolbar-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.toolbar-group label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}
.context-pill-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--indigo-soft);
  color: var(--primary);
  padding: 7px 12px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 700;
  margin-top: 8px;
}
.prompt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 0;
}
.prompt-chip {
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: #334155;
}
.prompt-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--indigo-soft);
}
.chat-feed {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 10px 4px;
}
.msg-bubble {
  max-width: 94%;
  border-radius: 14px;
  padding: 14px 16px;
}
.msg-user {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
}
.msg-assistant {
  align-self: flex-start;
  background: #f8fafc;
  border: 1px solid var(--border);
  width: 100%;
}
.msg-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11.5px;
  margin-bottom: 8px;
  opacity: 0.85;
}
.msg-img {
  max-width: 280px;
  border-radius: 10px;
  margin-bottom: 8px;
  display: block;
}
.msg-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.chat-composer {
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.image-preview-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface-alt);
  border-radius: 10px;
  margin-bottom: 8px;
}
.image-preview-bar img {
  height: 44px;
  border-radius: 6px;
}
.composer-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.upload-img-btn {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px dashed #94a3b8;
  background: var(--surface-alt);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.upload-img-btn:hover { border-color: var(--primary); color: var(--primary); }
.composer-input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1.5px solid #cbd5e1;
  font-family: inherit;
  font-size: 13.5px;
  resize: none;
}
.composer-input:focus { outline: none; border-color: var(--primary); }

.tutor-library-pane {
  max-height: calc(100vh - 150px);
  overflow-y: auto;
}
.small-note { font-size: 12px; margin-bottom: 10px; }
.guide-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.guide-item {
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-alt);
  cursor: pointer;
}
.guide-item:hover { border-color: var(--primary); background: var(--indigo-soft); }

/* Careers Grid */
.aptitude-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.slider-item {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-alt);
}
.slider-top {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
}
.slider-top strong { color: var(--primary); font-size: 15px; }

.career-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}
.career-card {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.career-card.top-rank {
  border-color: var(--emerald);
  box-shadow: 0 6px 20px rgba(5, 150, 105, 0.12);
}
.career-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.match-pill {
  background: linear-gradient(135deg, #059669, #4f46e5);
  color: #fff;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}
.career-metrics {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.career-detail-box {
  background: var(--surface-alt);
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 13px;
}
.career-detail-box ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

/* Tailscale & Remote */
.ts-info-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: var(--surface-alt);
  border-radius: 12px;
  border: 1px solid var(--border);
}
.ts-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.copy-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.copy-row code {
  background: #0f172a;
  color: #34d399;
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 12.5px;
}
.qr-section {
  display: flex;
  gap: 18px;
  align-items: center;
  margin-top: 16px;
  padding: 14px;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
}
.qr-box {
  padding: 8px;
  background: #fff;
  border-radius: 10px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.step-list {
  margin: 6px 0 0;
  padding-left: 18px;
  font-size: 13px;
  color: #334155;
}
.step-list li { margin-bottom: 5px; }

.peer-list, .engine-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.peer-row, .engine-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  font-size: 13px;
}

/* Markdown & Mermaid Rich Rendering */
.markdown-body {
  font-size: 14px;
  line-height: 1.75;
  color: #1e293b;
}
.markdown-body h1, .markdown-body h2, .markdown-body h3 {
  margin-top: 16px;
  margin-bottom: 8px;
  color: #0f172a;
}
.markdown-body h2 {
  font-size: 16px;
  padding-bottom: 5px;
  border-bottom: 1.5px solid #e2e8f0;
}
.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 13px;
}
.markdown-body th, .markdown-body td {
  border: 1px solid #cbd5e1;
  padding: 7px 10px;
}
.markdown-body th { background: #f1f5f9; }
.markdown-body code {
  background: #eef2ff;
  color: #3730a3;
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 12.5px;
}
.markdown-body pre code {
  display: block;
  padding: 12px;
  background: #0f172a;
  color: #e2e8f0;
  overflow-x: auto;
}
.markdown-body details {
  background: var(--emerald-soft);
  border: 1px solid #a7f3d0;
  border-radius: 10px;
  padding: 10px 14px;
  margin: 10px 0;
}
.markdown-body summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--emerald);
}
.mermaid-container, .mermaid {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin: 12px 0;
  text-align: center;
  overflow-x: auto;
}

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
}
.modal-dialog {
  position: relative;
  z-index: 61;
  width: 100%;
  max-width: 580px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-lg { max-width: 860px; }
.modal-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.scroll-modal-body { max-height: 70vh; overflow-y: auto; }

/* Loading Spinner */
.loading-dots {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--primary);
}
.spinner {
  width: 16px;
  height: 16px;
  border: 2.5px solid #c7d2fe;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 99;
}

/* Responsive */
@media (max-width: 1120px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col-grid, .career-grid, .workspace-split, .tutor-layout { grid-template-columns: 1fr; }
  .aptitude-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 820px) {
  .mobile-header { display: flex; }
  .sidebar {
    position: fixed;
    left: -280px;
    top: 56px;
    height: calc(100vh - 56px);
    transition: left 0.2s ease;
  }
  .sidebar.open { left: 0; }
  .main-content { padding: 72px 14px 36px; }
  .hero-card { flex-direction: column; align-items: stretch; }
  .aptitude-grid, .mini-grid-5, .mini-grid-3 { grid-template-columns: 1fr; }
  .qr-section { flex-direction: column; align-items: flex-start; }
}

/* Login Gate & Auth Controls */
.login-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: radial-gradient(circle at top left, #065f46 0%, #0f172a 55%, #1e1b4b 100%);
}
.login-card {
  width: 100%;
  max-width: 430px;
  background: #ffffff;
  border-radius: 20px;
  padding: 30px 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.login-desc {
  font-size: 13px;
  color: #475569;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  margin: 0 0 18px;
}
.login-error {
  background: #fff1f2;
  color: #e11d48;
  border: 1px solid #fecdd3;
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 700;
}
.user-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  padding: 0 2px;
}
.user-footer-name {
  font-size: 12.5px;
  font-weight: 700;
  color: #e2e8f0;
}

/* Analytics, Curriculum & Daily Trends */
.alloc-bar-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.week-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.week-card {
  background: #fff;
  border: 1px solid var(--border);
  border-top: 4px solid var(--primary);
  border-radius: 12px;
  padding: 13px;
  font-size: 12.5px;
}
.week-card h4 {
  margin: 0 0 6px;
  font-size: 13.5px;
  color: var(--primary);
}
.headline-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 260px;
  overflow-y: auto;
}
.headline-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  font-size: 12.5px;
  text-decoration: none;
  color: var(--text);
}
.headline-item:hover {
  border-color: var(--primary);
  background: var(--indigo-soft);
}
.trend-rec-card {
  padding: 14px 16px;
  border-radius: 12px;
  background: #fff;
  border: 1.5px solid var(--border);
  border-left-width: 5px;
}
.trend-rec-card.rose { border-left-color: var(--rose); }
.trend-rec-card.amber { border-left-color: var(--amber); }
.trend-rec-card.emerald { border-left-color: var(--emerald); }

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


