:root {
  --navy: #1a2744;
  --navy-light: #243352;
  --navy-mid: #1e2d47;
  --accent: #f7941d;
  --accent-hover: #e8850f;
  --accent-light: rgba(247, 148, 29, 0.08);
  --bg: #f3f5f9;
  --card: #ffffff;
  --text: #2d3748;
  --text-light: #718096;
  --text-muted: #a0aec0;
  --border: #e2e8f0;
  --success: #38a169;
  --success-light: rgba(56, 161, 105, 0.1);
  --danger: #e53e3e;
  --danger-light: rgba(229, 62, 62, 0.08);
  --info: #3182ce;
  --info-light: rgba(49, 130, 206, 0.08);
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.08);
  --sidebar-width: 280px;
  --header-height: 64px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ========== HEADER ========== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
  border-bottom: 3px solid var(--accent);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-logo {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: white;
  font-size: 18px;
}

.header-title {
  color: white;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.header-title span {
  color: var(--accent);
  font-weight: 700;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 20px;
  color: rgba(255,255,255,0.6);
  font-size: 13px;
}

.header-badge {
  background: var(--accent);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
}

/* ========== SIDEBAR ========== */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--navy);
  overflow-y: auto;
  z-index: 90;
  padding: 20px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--navy-light) transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--navy-light); border-radius: 4px; }

.sidebar-label {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 0 20px;
  margin-bottom: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s;
  border-left: 3px solid transparent;
  cursor: pointer;
}

.nav-item:hover {
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.04);
}

.nav-item.active {
  color: white;
  background: rgba(247, 148, 29, 0.1);
  border-left-color: var(--accent);
}

.nav-num {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.nav-item.active .nav-num {
  background: var(--accent);
  color: white;
}

.nav-count {
  margin-left: auto;
  background: rgba(255,255,255,0.08);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  color: rgba(255,255,255,0.4);
}

.nav-item.active .nav-count {
  background: rgba(247, 148, 29, 0.2);
  color: var(--accent);
}

/* ========== MAIN CONTENT ========== */
.main {
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  padding: 32px;
  max-width: 960px;
}

.section {
  margin-bottom: 48px;
  scroll-margin-top: calc(var(--header-height) + 24px);
}

.section-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
}

.section-number {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  flex-shrink: 0;
}

.section-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.5px;
}

.section-desc {
  color: var(--text-light);
  font-size: 14px;
  margin-bottom: 20px;
  padding-left: 50px;
}

/* ========== STATS TABLE ========== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -1px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* ========== CONTEXT CALLOUT ========== */
.callout {
  background: var(--accent-light);
  border: 1px solid rgba(247, 148, 29, 0.2);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 24px;
  font-size: 14px;
  line-height: 1.7;
}

.callout strong { color: var(--navy); }

.callout-info {
  background: var(--info-light);
  border-color: rgba(49, 130, 206, 0.2);
  border-left-color: var(--info);
}

.callout-danger {
  background: var(--danger-light);
  border-color: rgba(229, 62, 62, 0.2);
  border-left-color: var(--danger);
}

.callout-success {
  background: var(--success-light);
  border-color: rgba(56, 161, 105, 0.2);
  border-left-color: var(--success);
}

/* ========== CHECKLIST ========== */
.checklist {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.checklist-group-title {
  background: var(--bg);
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  border-top: 1px solid var(--border);
}

.checklist-group-title:first-child { border-top: none; }

.check-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
  cursor: pointer;
}

.check-item:last-child { border-bottom: none; }

.check-item:hover { background: rgba(0,0,0,0.01); }

.check-item.checked { background: var(--success-light); }

.check-item.checked .check-text { text-decoration: line-through; color: var(--text-light); }

.check-box {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 5px;
  flex-shrink: 0;
  margin-top: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  cursor: pointer;
}

.check-item.checked .check-box {
  background: var(--success);
  border-color: var(--success);
}

.check-box svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: white;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  transition: opacity 0.15s;
}

.check-item.checked .check-box svg { opacity: 1; }

.check-text {
  font-size: 14px;
  line-height: 1.6;
  flex: 1;
}

.check-text strong {
  color: var(--navy);
  font-weight: 600;
}

.check-text code {
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--danger);
}

/* ========== DATA TABLES ========== */
.data-table {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  border-collapse: separate;
  border-spacing: 0;
}

.data-table th {
  background: var(--navy);
  color: white;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: left;
}

.data-table td {
  padding: 10px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

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

.data-table tr:hover td { background: rgba(0,0,0,0.01); }

.data-table .highlight {
  color: var(--accent);
  font-weight: 700;
}

.data-table .tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.tag-warn { background: #fef3cd; color: #856404; }
.tag-danger { background: #f8d7da; color: #721c24; }
.tag-info { background: #d1ecf1; color: #0c5460; }
.tag-empty { background: #e2e8f0; color: #718096; }

/* ========== DISCUSSION ITEMS ========== */
.discussion-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}

.discussion-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.discussion-num {
  width: 28px;
  height: 28px;
  background: var(--navy);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.discussion-text {
  font-size: 14px;
  line-height: 1.6;
}

.discussion-text strong { color: var(--navy); }

/* ========== COMMENT THREAD ========== */
.comment-section {
  margin-top: 24px;
  border-top: 2px solid var(--border);
  padding-top: 20px;
}

.comment-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  transition: all 0.15s;
  width: 100%;
}

.comment-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.comment-toggle .count-badge {
  background: var(--accent);
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  margin-left: auto;
}

.comment-toggle .count-badge.empty {
  background: var(--border);
  color: var(--text-muted);
}

.comment-thread { display: none; margin-top: 16px; }

.comment-thread.open { display: block; }

.comment-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.comment-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
}

.comment-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.comment-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--navy);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

.comment-author {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
}

.comment-time {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: auto;
}

.comment-body {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  padding-left: 36px;
}

.comment-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  margin-left: 36px;
  padding: 6px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  color: var(--info);
  text-decoration: none;
  transition: all 0.15s;
}

.comment-file:hover {
  border-color: var(--info);
  background: var(--info-light);
}

.comment-file svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

/* ========== COMMENT FORM ========== */
.comment-form {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.form-field {
  flex: 1;
}

.form-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.form-field input,
.form-field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  transition: border-color 0.15s;
  background: var(--bg);
}

.form-field input:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: white;
}

.form-field textarea {
  resize: vertical;
  min-height: 80px;
}

.file-upload {
  display: flex;
  align-items: center;
  gap: 10px;
}

.file-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-light);
  transition: all 0.15s;
}

.file-upload-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.file-upload-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.file-upload input[type="file"] { display: none; }

.file-name {
  font-size: 12px;
  color: var(--text-light);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.btn {
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover { background: var(--accent-hover); }

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

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

.btn-ghost:hover {
  border-color: var(--text-light);
}

/* ========== NO COMMENTS ========== */
.no-comments {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ========== TOAST ========== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--navy);
  color: white;
  padding: 14px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s;
}

.toast.show { transform: translateY(0); opacity: 1; }

.toast.error { background: var(--danger); }

/* ========== FOOTER ========== */
.footer {
  margin-left: var(--sidebar-width);
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  border-top: 1px solid var(--border);
}

.footer a { color: var(--accent); text-decoration: none; }
.footer a:hover { text-decoration: underline; }

/* ========== PROGRESS BAR ========== */
.progress-bar-container {
  padding: 16px 20px 8px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255,255,255,0.4);
}

.progress-track {
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.4s ease;
  width: 0%;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
  }

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

  .main {
    margin-left: 0;
    padding: 20px;
  }

  .footer { margin-left: 0; }

  .menu-toggle { display: block; }

  .header-meta { display: none; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  .form-row { flex-direction: column; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .section-title { font-size: 18px; }
  .section-desc { padding-left: 0; }
}
