/* ===== RSHB-inspired design tokens ===== */
:root {
  --brand-500: #2e7d32;
  --brand-600: #256428;
  --orange: #f57c00;
  --gray-25: #fcfcfd;
  --gray-50: #f9fafb;
  --gray-100: #f2f4f7;
  --gray-300: #d0d5dd;
  --gray-600: #475467;
  --gray-700: #344054;
  --gray-800: #1d2939;
  --gray-900: #101828;
  --gray-950: #0c111d;
  --white: #ffffff;
  --violet: #5b21b6;
  --red-500: #ef4444;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 40px;
  --shadow-popup: 0 4px 24px rgba(0,0,0,.08);
}

/* ===== Reset & base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--gray-950);
  background: var(--gray-100);
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--brand-500); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* ===== Layout ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 32px; }
.page-header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-300);
  padding: 16px 0;
  position: sticky; top: 0; z-index: 10;
}
.page-header .container { display: flex; align-items: center; gap: 16px; }
.page-header .logo { font-size: 20px; font-weight: 700; color: var(--gray-950); text-decoration: none; }
.page-header .logo:hover { text-decoration: none; }
.page-header .logo span { font-weight: 400; color: var(--gray-600); }
.page-header nav { display: flex; gap: 8px; margin-left: auto; }
.page-header nav a {
  padding: 6px 14px; border-radius: var(--radius-lg); font-size: 14px;
  color: var(--gray-700); transition: background .15s;
}
.page-header nav a:hover { background: var(--gray-100); text-decoration: none; }
.page-header nav a.active { background: var(--brand-500); color: var(--white); }

/* ===== Cards / Sections ===== */
.card {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 48px;
  margin-top: 8px;
}
.card h2 { font-size: 28px; line-height: 36px; font-weight: 700; }
.card .subtitle {
  font-size: 20px; line-height: 28px;
  color: var(--gray-600); margin-top: 16px;
}

/* Banner */
.banner {
  background: var(--violet);
  border-radius: var(--radius-xl);
  padding: 52px 72px;
  color: var(--white);
  margin: 16px 0;
  position: relative; overflow: hidden;
}
.banner h1 { font-size: 28px; line-height: 36px; font-weight: 700; }
.banner p { font-size: 16px; line-height: 24px; margin-top: 16px; max-width: 560px; }

/* Info box (dark) */
.info-box {
  display: flex; align-items: flex-start; gap: 16px;
  background: var(--gray-900);
  color: var(--gray-50);
  padding: 24px; border-radius: var(--radius-lg);
  font-size: 14px; line-height: 20px;
  margin-top: 16px;
}
.info-box .icon-warn { color: var(--orange); flex-shrink: 0; width: 24px; height: 24px; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px; border-radius: var(--radius-md); border: none;
  font-size: 16px; font-weight: 600; cursor: pointer;
  transition: background .15s, opacity .15s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand-500); color: var(--white); }
.btn-primary:hover:not(:disabled) { background: var(--brand-600); }
.btn-secondary { background: var(--gray-100); color: var(--gray-950); }
.btn-secondary:hover:not(:disabled) { background: var(--gray-300); }
.btn-sm { padding: 8px 16px; font-size: 14px; }
.btn-icon {
  width: 40px; height: 40px; padding: 0;
  border-radius: var(--radius-sm); background: var(--gray-100); border: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn-icon:hover { background: var(--gray-300); }

/* ===== Form controls ===== */
.form-group { margin-bottom: 24px; }
.form-group label { display: block; font-size: 20px; font-weight: 700; margin-bottom: 12px; }
select, input[type="text"], textarea {
  width: 100%; padding: 12px 16px;
  border: 1px solid var(--gray-300); border-radius: var(--radius-md);
  font-size: 16px; background: var(--white);
  color: var(--gray-950); outline: none;
  transition: border-color .15s;
}
select:focus, input[type="text"]:focus, textarea:focus { border-color: var(--brand-500); }
textarea { resize: vertical; min-height: 80px; }

/* ===== Two-column layout (sidebar + main) ===== */
.layout-sidebar { display: flex; gap: 24px; min-height: 600px; }
.sidebar {
  width: 280px; flex-shrink: 0;
  background: var(--white); border-radius: var(--radius-lg);
  padding: 16px; overflow-y: auto;
}
.sidebar-item {
  display: block; padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: 14px; color: var(--gray-700); cursor: pointer;
  border: none; background: none; width: 100%; text-align: left;
  transition: background .15s;
}
.sidebar-item:hover { background: var(--gray-100); text-decoration: none; }
.sidebar-item.active { background: var(--brand-500); color: var(--white); font-weight: 600; }
.main-content { flex: 1; min-width: 0; }

/* ===== Field renderer ===== */
.field { margin-bottom: 16px; }
.field-bold { font-size: 20px; font-weight: 700; }
.field-text { font-size: 16px; line-height: 24px; }
.field-link a { color: var(--brand-500); font-weight: 500; }
.field-bullet { padding-left: 24px; position: relative; }
.field-bullet::before { content: '\2022'; position: absolute; left: 8px; color: var(--brand-500); font-weight: 700; }
.field-bullet-bold { padding-left: 24px; position: relative; font-weight: 700; }
.field-bullet-bold::before { content: '\2022'; position: absolute; left: 8px; color: var(--brand-500); font-weight: 700; }
.field-note {
  background: var(--gray-50); border-left: 4px solid var(--brand-500);
  padding: 16px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 14px; color: var(--gray-700);
}
.field-collapsible summary {
  cursor: pointer; font-weight: 600; padding: 12px 0;
  list-style: none; display: flex; align-items: center; gap: 8px;
}
.field-collapsible summary::before { content: '\25B6'; font-size: 10px; transition: transform .2s; }
.field-collapsible[open] summary::before { transform: rotate(90deg); }
.field-collapsible .collapsible-body { padding: 8px 0 16px 24px; }
.field-image { max-width: 100%; border-radius: var(--radius-sm); }
.field-checkmark {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--gray-50); border-radius: var(--radius-sm);
}
.field-checkmark input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--brand-500); }
.field-button-doc, .field-button-pres {
  display: flex; align-items: center; gap: 12px;
  padding: 16px; background: var(--gray-50); border-radius: var(--radius-md);
  cursor: pointer; transition: background .15s;
}
.field-button-doc:hover, .field-button-pres:hover { background: var(--gray-100); }
.field-button-doc .doc-icon, .field-button-pres .pres-icon { font-size: 24px; }
.field-button-doc .doc-check { margin-left: auto; }

/* ===== Pack stat widgets ===== */
.pack-stats {
  display: flex; gap: 16px; flex-wrap: wrap;
}
.pack-stat {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--gray-50); border-radius: var(--radius-md);
  padding: 14px 20px; min-width: 160px;
}
.pack-stat-label { font-size: 12px; color: var(--gray-600); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
.pack-stat-value { font-size: 22px; font-weight: 700; color: var(--gray-950); }

/* ===== Document preview ===== */
.doc-preview { text-align: center; }
.doc-preview img { max-width: 100%; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); }
.doc-actions { display: flex; gap: 12px; margin-top: 24px; justify-content: center; }

/* ===== Presentation editor ===== */
.slide-preview {
  border: 1px solid var(--gray-300); border-radius: var(--radius-sm);
  overflow: hidden; margin-bottom: 24px; background: var(--white);
}
.slide-preview img { width: 100%; display: block; }
.slide-fields { display: flex; flex-direction: column; gap: 16px; }
.slide-field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--gray-700); }

/* Table editor */
.table-editor { width: 100%; border-collapse: collapse; font-size: 14px; }
.table-editor th {
  background: var(--gray-100); padding: 10px 12px;
  text-align: left; font-weight: 600; border: 1px solid var(--gray-300);
}
.table-editor td { padding: 4px; border: 1px solid var(--gray-300); }
.table-editor input {
  width: 100%; padding: 8px; border: none; font-size: 14px;
  background: transparent; outline: none;
}
.table-editor input:focus { background: var(--gray-50); }
.table-add-row {
  margin-top: 8px; font-size: 14px; color: var(--brand-500);
  cursor: pointer; background: none; border: none; font-weight: 600;
}

/* ===== Test quiz ===== */
.quiz-card {
  max-width: 640px; margin: 40px auto;
  background: var(--white); border-radius: var(--radius-xl);
  padding: 48px; text-align: center;
}
.quiz-card .question { font-size: 24px; line-height: 32px; font-weight: 600; margin-bottom: 32px; }
.quiz-card .quiz-buttons { display: flex; gap: 16px; justify-content: center; }
.quiz-card .result { font-size: 18px; line-height: 28px; margin-top: 16px; }
.quiz-progress { font-size: 14px; color: var(--gray-600); margin-bottom: 16px; }

/* ===== Pack list on start page ===== */
.pack-list { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.pack-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; background: var(--gray-50);
  border-radius: var(--radius-md); transition: background .15s;
}
.pack-item:hover { background: var(--gray-100); }
.pack-item .pack-name { font-weight: 600; }
.pack-item .pack-status { font-size: 14px; display: flex; align-items: center; gap: 8px; }
.pack-item .status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ===== Dropdown row ===== */
.dropdown-row { display: flex; gap: 24px; margin-bottom: 24px; flex-wrap: wrap; }
.dropdown-row .form-group { flex: 1; min-width: 240px; }

/* ===== Loading / Error states ===== */
.loading { text-align: center; padding: 40px; color: var(--gray-600); }
.error { text-align: center; padding: 40px; color: var(--red-500); }

/* ===== Back link ===== */
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; color: var(--gray-600); margin-bottom: 16px;
}
.back-link:hover { color: var(--gray-950); text-decoration: none; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .container { padding: 0 16px; }
  .card { padding: 24px; border-radius: var(--radius-lg); }
  .banner { padding: 32px 24px; border-radius: var(--radius-lg); }
  .layout-sidebar { flex-direction: column; }
  .sidebar { width: 100%; }
  .dropdown-row { flex-direction: column; }
  .quiz-card { margin: 16px; padding: 24px; }
}
