:root {
  --primary: #1e3a8a;
  --primary-hover: #1d4ed8;
  --accent: #d97706;
  --accent-hover: #b45309;
  --accent-light: #fef3c7;
  --dark: #0f172a;
  --slate: #334155;
  --slate-light: #64748b;
  --border: #e2e8f0;
  --bg-light: #f8fafc;
  --white: #ffffff;
  --success: #059669;
  --success-bg: #ecfdf5;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius: 8px;
  --radius-lg: 12px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--dark);
  background-color: var(--bg-light);
  line-height: 1.6;
  font-size: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover {
  color: var(--accent);
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--dark);
}
.logo-badge {
  background: linear-gradient(135deg, #ea580c, #d97706);
  color: var(--white);
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: 0.5px;
}
.nav-links {
  display: flex;
  gap: 24px;
  align-items: center;
}
.nav-link {
  font-weight: 600;
  color: var(--slate);
  font-size: 0.95rem;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
}
.nav-link:hover, .nav-link.active {
  color: var(--accent);
  border-color: var(--accent);
}
.nav-btn {
  background: var(--accent);
  color: var(--white);
  padding: 8px 16px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9rem;
}
.nav-btn:hover {
  background: var(--accent-hover);
  color: var(--white);
}

/* Hero Section */
.hero {
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  padding: 48px 0 36px;
  border-bottom: 1px solid var(--border);
}
.hero-title {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--dark);
  line-height: 1.25;
  margin-bottom: 12px;
}
.hero-title span {
  color: var(--accent);
}
.hero-desc {
  font-size: 1.125rem;
  color: var(--slate-light);
  max-width: 780px;
  margin-bottom: 24px;
}

/* Search Box */
.search-wrapper {
  position: relative;
  max-width: 720px;
  margin-bottom: 20px;
}
.search-input {
  width: 100%;
  padding: 16px 20px 16px 48px;
  font-size: 1.05rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--white);
  color: var(--dark);
  box-shadow: var(--shadow);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.15);
}
.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--slate-light);
  width: 20px;
  height: 20px;
  pointer-events: none;
}
.search-results-box {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 6px;
  box-shadow: var(--shadow-lg);
  max-height: 400px;
  overflow-y: auto;
  z-index: 100;
  display: none;
}
.search-result-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.search-result-item:hover {
  background: var(--bg-light);
}

/* Matching Tool Widget */
.matching-widget {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 36px;
}
.widget-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.widget-subtitle {
  color: var(--slate-light);
  font-size: 0.95rem;
  margin-bottom: 20px;
}
.matcher-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.select-group label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--slate);
  margin-bottom: 6px;
}
.form-select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  font-size: 0.95rem;
  color: var(--dark);
  outline: none;
}
.matcher-results {
  background: var(--bg-light);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 16px;
  min-height: 100px;
}
.badge-code {
  display: inline-block;
  padding: 3px 8px;
  background: var(--accent-light);
  color: var(--accent-hover);
  font-weight: 700;
  border-radius: 4px;
  font-size: 0.875rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.badge-kvr {
  background: #dbeafe;
  color: #1e40af;
}

/* Section Grids */
.section-block {
  padding: 36px 0;
}
.section-header {
  margin-bottom: 24px;
}
.section-title {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 6px;
}
.section-subtitle {
  color: var(--slate-light);
  font-size: 0.95rem;
}
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  display: flex;
  flex-direction: column;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: #cbd5e1;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.card-code {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 8px;
  line-height: 1.35;
}
.card-meta {
  font-size: 0.85rem;
  color: var(--slate-light);
  margin-top: auto;
}

/* Tables */
.table-container {
  overflow-x: auto;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.95rem;
}
.data-table th {
  background: #f1f5f9;
  padding: 12px 16px;
  font-weight: 700;
  color: var(--slate);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.data-table tr:hover {
  background-color: #f8fafc;
}

/* Breadcrumbs */
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 0.875rem;
  color: var(--slate-light);
  padding: 16px 0 8px;
}
.breadcrumbs a {
  color: var(--slate-light);
}
.breadcrumbs a:hover {
  color: var(--primary);
}
.breadcrumb-sep {
  color: #cbd5e1;
}

/* Detail Card */
.detail-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow);
  margin-bottom: 32px;
}
.detail-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 20px;
  margin-bottom: 24px;
}
.detail-code-badge {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  font-family: ui-monospace, SFMono-Regular, monospace;
}
.copy-btn {
  background: var(--bg-light);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--slate);
  cursor: pointer;
  transition: all 0.15s;
}
.copy-btn:hover {
  background: var(--border);
}
.detail-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--dark);
  margin-top: 8px;
  line-height: 1.3;
}
.detail-desc-box {
  background: #f8fafc;
  border-left: 4px solid var(--accent);
  padding: 16px 20px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 24px;
  font-size: 1.05rem;
  line-height: 1.7;
}

/* Downloads Section */
.download-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-bottom: 36px;
}
.download-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  box-shadow: var(--shadow-sm);
}
.file-icon {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--white);
  flex-shrink: 0;
}
.icon-xlsx { background: #059669; }
.icon-docx { background: #2563eb; }
.icon-pdf { background: #dc2626; }
.download-meta {
  flex: 1;
}
.download-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 4px;
  color: var(--dark);
}
.download-desc {
  font-size: 0.85rem;
  color: var(--slate-light);
  margin-bottom: 10px;
}
.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary);
  background: #eff6ff;
  padding: 6px 12px;
  border-radius: 6px;
}
.download-btn:hover {
  background: #dbeafe;
}

/* Footer */
.site-footer {
  margin-top: auto;
  background: var(--dark);
  color: #94a3b8;
  padding: 48px 0 24px;
  border-top: 1px solid #1e293b;
  font-size: 0.9rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 36px;
}
.footer-title {
  color: var(--white);
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 14px;
}
.footer-links {
  list-style: none;
}
.footer-links li {
  margin-bottom: 8px;
}
.footer-links a {
  color: #94a3b8;
}
.footer-links a:hover {
  color: var(--white);
}
.footer-bottom {
  border-top: 1px solid #1e293b;
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

/* Mobile Menu */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.mobile-menu-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  cursor: pointer;
  color: var(--slate);
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.mobile-menu-btn:hover {
  background: var(--bg-light);
  color: var(--dark);
}
.mobile-menu-btn svg {
  display: block;
}
.mobile-menu {
  display: none;
  background: var(--white);
  border-bottom: 2px solid var(--border);
  padding: 12px 20px 16px;
  box-shadow: var(--shadow);
}
.mobile-menu.active {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mobile-nav-link {
  padding: 10px 14px;
  border-radius: 6px;
  font-weight: 600;
  color: var(--slate);
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  font-size: 0.95rem;
}
.mobile-nav-link:hover, .mobile-nav-link.active {
  background: #f1f5f9;
  color: var(--primary);
}

/* Grids and Responsive Nav */
.combination-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 24px;
}
.prev-next-nav {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.prev-next-card {
  display: block;
  padding: 14px 18px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.prev-next-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

@media (max-width: 768px) {
  .hero-title { font-size: 1.75rem; }
  .matcher-form { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .nav-links { display: none; }
  .mobile-menu-btn { display: inline-flex; }
  .header-inner { height: 60px; }
  .combination-grid { grid-template-columns: 1fr; }
  .prev-next-nav { grid-template-columns: 1fr; }
  .detail-title { font-size: 1.5rem; }
  .table-container { -webkit-overflow-scrolling: touch; }
}

@media (max-width: 480px) {
  .container { padding: 0 14px; }
  .hero { padding: 32px 0 24px; }
  .hero-title { font-size: 1.45rem; }
  .logo span:last-child { display: none; }
  .card-code { font-size: 1.1rem; }
  .detail-code-badge { font-size: 1.15rem; }
}
