:root {
  --brand-blue: #274E9C;
  --brand-olive: #AFAB0E;
  --brand-orange: #FF9901;
  --brand-red: #A80606;
  --bg: #F7F8FA;
  --surface: #FFFFFF;
  --text: #1A1F2E;
  --text-muted: #5A6172;
  --border: #E4E7EE;
  --blue-soft: rgba(39, 78, 156, 0.10);
  --olive-soft: rgba(175, 171, 14, 0.14);
  --orange-soft: rgba(255, 153, 1, 0.14);
  --shadow: 0 1px 2px rgba(26, 31, 46, 0.04), 0 4px 16px rgba(26, 31, 46, 0.05);
  --sidebar-w: 280px;
  --header-h: 72px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface);
  border-bottom: 3px solid var(--brand-blue);
  box-shadow: var(--shadow);
  overflow: visible;
}

.site-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.site-logo {
  height: 52px;
  width: auto;
  object-fit: contain;
}

.site-brand {
  flex: 1;
  min-width: 160px;
}

.site-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.site-subtitle {
  margin: 2px 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.btn-menu {
  display: none;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 8px 12px;
  font: inherit;
  cursor: pointer;
  color: var(--text);
}

.search-wrap {
  position: relative;
  width: min(320px, 100%);
}

.search-wrap input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: var(--bg);
}

.search-wrap input:focus {
  outline: 2px solid var(--blue-soft);
  border-color: var(--brand-blue);
}

.search-results {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 360px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 50;
}

.search-results.open { display: block; }

.search-results a {
  display: block;
  padding: 10px 14px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  text-decoration: none;
}

.search-results a:last-child { border-bottom: 0; }
.search-results a:hover { background: var(--blue-soft); }
.search-results .sr-title { font-weight: 600; }
.search-results .sr-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.search-results .sr-empty {
  padding: 14px;
  color: var(--text-muted);
}

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  max-width: 1280px;
  margin: 0 auto;
  min-height: calc(100vh - 160px);
}

.sidebar {
  padding: 20px 12px 40px;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, #fff 0%, #f9fafc 100%);
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 18px;
}

.nav-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 4px 10px 8px;
}

.sidebar a {
  display: block;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.94rem;
}

.sidebar a:hover { background: var(--blue-soft); text-decoration: none; }
.sidebar a.active {
  background: var(--blue-soft);
  color: var(--brand-blue);
  font-weight: 600;
}

.content {
  padding: 28px 28px 64px;
  max-width: 820px;
}

.breadcrumb {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

h1 {
  margin: 0 0 8px;
  font-size: 1.9rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.lead {
  margin: 0 0 24px;
  color: var(--text-muted);
  font-size: 1.05rem;
}

h2 {
  margin: 36px 0 12px;
  font-size: 1.35rem;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--olive-soft);
  scroll-margin-top: 90px;
}

h3 {
  margin: 24px 0 8px;
  font-size: 1.1rem;
  color: var(--brand-blue);
  scroll-margin-top: 90px;
}

p { margin: 0 0 14px; }

ul, ol { margin: 0 0 16px; padding-left: 1.3rem; }
li { margin-bottom: 6px; }

.note, .tip, .warn {
  padding: 12px 14px;
  border-radius: 10px;
  margin: 16px 0;
  border: 1px solid var(--border);
  background: var(--surface);
}

.note { border-left: 4px solid var(--brand-blue); }
.tip { border-left: 4px solid var(--brand-olive); background: var(--olive-soft); }
.warn { border-left: 4px solid var(--brand-orange); background: var(--orange-soft); }

.howto {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 18px;
}

.howto span {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--blue-soft);
  color: var(--brand-blue);
  font-size: 0.88rem;
  font-weight: 600;
}

.howto .sep { background: transparent; color: var(--text-muted); padding: 4px 2px; font-weight: 400; }

.kbd {
  display: inline-block;
  padding: 1px 7px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: #fff;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.85em;
}

.figure {
  margin: 18px 0 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.figure img {
  display: block;
  width: 100%;
  height: auto;
  background: #eef1f6;
  min-height: 80px;
}

.figure figcaption {
  padding: 10px 14px;
  font-size: 0.88rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.figure.missing img {
  display: none;
}

.figure.missing::before {
  content: attr(data-placeholder);
  display: block;
  padding: 36px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.92rem;
  background: repeating-linear-gradient(
    -45deg,
    #f3f5f9,
    #f3f5f9 10px,
    #eef1f6 10px,
    #eef1f6 20px
  );
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  font-size: 0.95rem;
}

th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  background: var(--blue-soft);
  color: var(--brand-blue);
  font-weight: 600;
}

tr:last-child td { border-bottom: 0; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin: 20px 0;
}

.card {
  display: block;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease;
}

.card:hover {
  border-color: var(--brand-blue);
  text-decoration: none;
}

.card h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 28px 20px;
  margin-top: 0;
}

.site-footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-logo {
  height: 36px;
  width: auto;
  object-fit: contain;
}

.footer-copy {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-copy a {
  color: var(--brand-blue);
  font-weight: 600;
  text-decoration: none;
}

.footer-copy a:hover {
  text-decoration: underline;
}

.accent-bar {
  height: 4px;
  background: linear-gradient(90deg, var(--brand-blue), var(--brand-olive), var(--brand-orange), var(--brand-red));
}

.dl-term {
  margin: 18px 0;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.dl-term dt {
  font-weight: 700;
  color: var(--brand-blue);
  margin-bottom: 4px;
}

.dl-term dd { margin: 0; color: var(--text); }

@media (max-width: 900px) {
  .btn-menu { display: inline-block; }
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(var(--sidebar-w), 86vw);
    z-index: 60;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow);
    height: 100vh;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(26, 31, 46, 0.35);
    z-index: 55;
  }
  .sidebar-backdrop.open { display: block; }
  .content { padding: 20px 16px 48px; }
  .search-wrap { width: 100%; order: 5; }
}
