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

:root {
  --primary: #1a56db;
  --primary-dark: #1341a8;
  --primary-light: #e8f0fe;
  --secondary: #059669;
  --secondary-light: #d1fae5;
  --accent: #d97706;
  --accent-light: #fef3c7;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --white: #ffffff;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
  --radius: 8px;
  --radius-lg: 12px;
  --sidebar-width: 280px;
  --header-height: 60px;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--gray-800);
  line-height: 1.6;
  background: var(--gray-50);
  display: flex;
  min-height: 100vh;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--white);
  border-right: 1px solid var(--gray-200);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform .3s ease;
}

.sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
}

.sidebar-header h1 {
  font-size: 1.25rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-header h1 svg {
  width: 28px;
  height: 28px;
}

.sidebar-header .subtitle {
  font-size: .75rem;
  color: var(--gray-500);
  margin-top: 2px;
}

.sidebar-search {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
}

.sidebar-search input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: .875rem;
  background: var(--gray-50) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%239ca3af' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E") no-repeat 12px center;
  outline: none;
  transition: border-color .2s;
}

.sidebar-search input:focus {
  border-color: var(--primary);
  background-color: var(--white);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.sidebar-nav::-webkit-scrollbar {
  width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 3px;
}

.nav-section {
  margin-bottom: 4px;
}

.nav-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  font-size: .813rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .05em;
  cursor: pointer;
  user-select: none;
  transition: color .2s;
}

.nav-section-title:hover {
  color: var(--gray-700);
}

.nav-section-title svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: .6;
}

.nav-section-title .arrow {
  margin-left: auto;
  transition: transform .2s;
}

.nav-section-title .arrow.open {
  transform: rotate(90deg);
}

.nav-items {
  list-style: none;
  overflow: hidden;
  max-height: 0;
  transition: max-height .3s ease;
}

.nav-items.open {
  max-height: 1000px;
}

.nav-items li a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 20px 6px 44px;
  font-size: .875rem;
  color: var(--gray-600);
  border-left: 3px solid transparent;
  transition: all .15s;
}

.nav-items li a:hover {
  color: var(--primary);
  background: var(--primary-light);
  border-left-color: var(--primary);
  text-decoration: none;
}

.nav-items li a.active {
  color: var(--primary);
  background: var(--primary-light);
  border-left-color: var(--primary);
  font-weight: 500;
}

/* Main Content */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 0 32px;
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 16px;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--gray-600);
  cursor: pointer;
  padding: 4px;
}

.top-bar .breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .875rem;
  color: var(--gray-500);
}

.top-bar .breadcrumb a {
  color: var(--gray-500);
}

.top-bar .breadcrumb a:hover {
  color: var(--primary);
}

.top-bar .breadcrumb span {
  color: var(--gray-800);
  font-weight: 500;
}

.content-area {
  padding: 32px;
  max-width: 960px;
}

/* Hero section */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, #2563eb 100%);
  color: var(--white);
  padding: 48px 40px;
  border-radius: var(--radius-lg);
  margin-bottom: 32px;
}

.hero h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.hero p {
  font-size: 1.125rem;
  opacity: .9;
  text-align: justify;
}

.hero .stats {
  display: flex;
  gap: 32px;
  margin-top: 24px;
}

.hero .stats div {
  text-align: center;
}

.hero .stats .num {
  font-size: 1.5rem;
  font-weight: 700;
}

.hero .stats .label {
  font-size: .813rem;
  opacity: .8;
}

.hero-image {
  text-align: center;
  margin-top: 32px;
  margin-bottom: 32px;
}
.hero-image img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
}

/* Cards Grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 24px;
  transition: all .2s;
  cursor: pointer;
}

.card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card .icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  font-size: 1.25rem;
}

.card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--gray-800);
}

.card p {
  font-size: .875rem;
  color: var(--gray-500);
  line-height: 1.5;
}

/* Section pages */
.doc-section {
  display: none;
}

.doc-section.active {
  display: block;
}

.section-header {
  margin-bottom: 32px;
}

.section-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 8px;
}

.section-header p {
  font-size: 1rem;
  color: var(--gray-500);
}

.section-header .meta {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  font-size: .875rem;
  color: var(--gray-400);
}

.content-block {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

.content-block h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--gray-100);
}

.content-block h3 {
  font-size: 1.063rem;
  font-weight: 600;
  color: var(--gray-800);
  margin: 20px 0 8px;
}

.content-block h4 {
  font-size: .938rem;
  font-weight: 600;
  color: var(--gray-700);
  margin: 16px 0 6px;
}

.content-block p {
  margin-bottom: 12px;
  color: var(--gray-600);
}

.content-block ul, .content-block ol {
  margin: 8px 0 16px;
  padding-left: 24px;
  color: var(--gray-600);
}

.content-block li {
  margin-bottom: 6px;
}

.content-block strong {
  color: var(--gray-800);
}

.content-block em {
  color: var(--gray-600);
}

/* Tips, warnings, info boxes */
.tip, .warning, .info, .important {
  padding: 16px;
  border-radius: var(--radius);
  margin: 16px 0;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.tip {
  background: var(--secondary-light);
  border-left: 4px solid var(--secondary);
}

.warning {
  background: #fef2f2;
  border-left: 4px solid #dc2626;
}

.info {
  background: var(--primary-light);
  border-left: 4px solid var(--primary);
}

.important {
  background: var(--accent-light);
  border-left: 4px solid var(--accent);
}

.tip .icon, .warning .icon, .info .icon, .important .icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  margin-top: 2px;
}

/* Steps / procedure */
.steps {
  counter-reset: step-counter;
  list-style: none;
  padding: 0;
}

.steps li {
  counter-increment: step-counter;
  padding: 12px 16px 12px 48px;
  position: relative;
  margin-bottom: 8px;
  background: var(--gray-50);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
}

.steps li::before {
  content: counter(step-counter);
  position: absolute;
  left: 12px;
  top: 12px;
  width: 26px;
  height: 26px;
  background: var(--primary);
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .813rem;
  font-weight: 600;
}

/* Table styles */
.table-wrap {
  overflow-x: auto;
  margin: 16px 0;
}

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

table th {
  background: var(--gray-50);
  font-weight: 600;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 2px solid var(--gray-200);
  color: var(--gray-700);
}

table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-600);
}

table tr:hover td {
  background: var(--gray-50);
}

/* Button */
.btn {
  display: inline-block;
  padding: 10px 24px;
  background: var(--primary);
  color: var(--white);
  border-radius: var(--radius);
  font-weight: 500;
  font-size: .875rem;
  transition: background .2s, transform .1s;
  cursor: pointer;
  border: none;
  text-decoration: none;
}
.btn:hover {
  background: var(--primary-dark);
  text-decoration: none;
  transform: translateY(-1px);
}

/* Tag / badges */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: .75rem;
  font-weight: 500;
}

.badge-blue {
  background: var(--primary-light);
  color: var(--primary);
}

.badge-green {
  background: var(--secondary-light);
  color: var(--secondary);
}

.badge-yellow {
  background: var(--accent-light);
  color: var(--accent);
}

.badge-red {
  background: #fef2f2;
  color: #dc2626;
}

/* Keyboard shortcut */
kbd {
  display: inline-block;
  padding: 2px 6px;
  font-size: .75rem;
  font-family: inherit;
  background: var(--gray-100);
  border: 1px solid var(--gray-300);
  border-radius: 4px;
  box-shadow: 0 1px 0 var(--gray-300);
}

/* Print styles */
@media print {
  .sidebar, .top-bar, .menu-toggle { display: none; }
  .main-content { margin-left: 0; }
  .content-area { padding: 0; }
  .hero { background: #1a56db !important; -webkit-print-color-adjust: exact; }
}

/* Mobile styles */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

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

  .menu-toggle {
    display: block;
  }

  .main-content {
    margin-left: 0;
  }

  .top-bar {
    padding: 0 16px;
  }

  .content-area {
    padding: 16px;
  }

  .hero {
    padding: 32px 24px;
  }

  .hero h1 {
    font-size: 1.5rem;
  }

  .hero .stats {
    flex-wrap: wrap;
    gap: 16px;
  }

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

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 24px;
}
.modal-overlay.open {
  display: flex;
}
.modal-content {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 16px;
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
  position: relative;
}
.modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  font-size: 1.75rem;
  cursor: pointer;
  color: var(--text);
  line-height: 1;
}
.modal-close:hover {
  color: var(--primary);
}
