:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #162033;
  --muted: #667085;
  --line: #e7ebf2;
  --blue: #2ea7e0;
  --blue-dark: #137bb0;
  --green: #12a67a;
  --orange: #f59e0b;
  --shadow: 0 18px 48px rgba(17, 24, 39, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 0%, rgba(46, 167, 224, 0.16), transparent 34rem),
    linear-gradient(180deg, #fbfdff 0%, var(--bg) 34rem);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", sans-serif;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }

.shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(18px);
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px 20px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  font-weight: 900;
  box-shadow: 0 12px 26px rgba(46, 167, 224, 0.28);
}

.brand-logo {
  width: 38px;
  height: 38px;
  object-fit: contain;
  flex: 0 0 auto;
}

.brand strong {
  display: block;
  font-size: 15px;
  letter-spacing: -0.02em;
}

.brand small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.nav-label {
  margin: 18px 10px 7px;
  color: #98a2b3;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.nav a {
  display: block;
  margin: 2px 0;
  padding: 9px 11px;
  border-radius: 11px;
  color: #344054;
  text-decoration: none;
  font-size: 13px;
  font-weight: 650;
}

.nav a:hover {
  background: #f0f7fc;
  color: var(--blue-dark);
}

.nav a.active {
  background: #e9f7fd;
  color: var(--blue-dark);
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 68px;
  padding: 14px 30px;
  border-bottom: 1px solid rgba(231, 235, 242, 0.8);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(18px);
}

.menu-button {
  display: none;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font-size: 18px;
}

.crumb {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.home,
.document {
  width: min(1080px, calc(100% - 56px));
  margin: 0 auto;
  padding: 34px 0 70px;
}

.hero {
  padding: 48px;
  border: 1px solid rgba(214, 234, 246, 0.95);
  border-radius: 30px;
  background:
    radial-gradient(circle at 92% 10%, rgba(46, 167, 224, 0.18), transparent 18rem),
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(244, 250, 254, 0.94));
  box-shadow: var(--shadow);
}

.eyebrow {
  display: inline-flex;
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--blue-dark);
  background: #eaf7fd;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.hero h1 {
  margin: 18px 0 14px;
  max-width: 820px;
  font-size: clamp(30px, 4.1vw, 48px);
  line-height: 1.18;
  letter-spacing: -0.035em;
  font-weight: 800;
}

.hero p {
  margin: 0;
  max-width: 720px;
  color: var(--muted);
  font-size: 16px;
  font-weight: 600;
}

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin: 36px 0 14px;
}

.section-title span {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.section-title small {
  color: var(--muted);
  font-size: 13px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.card-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.doc-card,
.quick-grid a {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 28px rgba(17, 24, 39, 0.06);
  text-decoration: none;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.doc-card {
  min-height: 176px;
  padding: 22px;
}

.doc-card:hover,
.quick-grid a:hover {
  transform: translateY(-3px);
  border-color: #a8dff4;
  box-shadow: 0 18px 38px rgba(17, 24, 39, 0.1);
}

.doc-card span {
  display: inline-flex;
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.doc-card strong {
  display: block;
  margin: 12px 0 8px;
  font-size: 21px;
  line-height: 1.35;
  letter-spacing: -0.03em;
}

.doc-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.accent-order { border-top: 4px solid var(--blue); }
.accent-purchase { border-top: 4px solid var(--green); }
.accent-master { border-top: 4px solid var(--orange); }
.accent-expense { border-top: 4px solid #0ea5a4; }
.accent-role { border-top: 4px solid #7c3aed; }
.accent-sfa { border-top: 4px solid #2563eb; }

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.quick-grid a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 62px;
  padding: 16px 18px;
  color: #1d2939;
  font-weight: 800;
}

.quick-grid a::after {
  content: "→";
  color: var(--blue);
}

.document {
  max-width: 1180px;
}

.doc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 22px;
  align-items: start;
}

.doc-body {
  min-width: 0;
  padding: 42px 48px 54px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: #fff;
  box-shadow: var(--shadow);
}

.doc-body h1,
.doc-body h2,
.doc-body h3 {
  scroll-margin-top: 92px;
}

.doc-body h1 {
  margin: 0 0 22px;
  font-size: 34px;
  line-height: 1.25;
  letter-spacing: -0.04em;
}

.doc-body h2 {
  margin: 42px 0 14px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  font-size: 25px;
  letter-spacing: -0.03em;
}

.doc-body h3 {
  margin: 28px 0 10px;
  font-size: 20px;
}

.doc-body p,
.doc-body li {
  color: #344054;
  font-size: 15px;
}

.doc-body a {
  color: var(--blue-dark);
  font-weight: 700;
}

.doc-body img {
  display: block;
  max-width: 100%;
  margin: 18px 0 26px;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(17, 24, 39, 0.08);
}

.doc-body table {
  width: 100%;
  margin: 18px 0 24px;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 14px;
  box-shadow: 0 0 0 1px var(--line);
}

.doc-body th,
.doc-body td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

.doc-body th {
  background: #f6f8fb;
  color: #344054;
  font-weight: 900;
}

.doc-body tr:last-child td {
  border-bottom: 0;
}

.doc-body code {
  padding: 2px 6px;
  border-radius: 7px;
  background: #f2f4f7;
  color: #344054;
  font-size: 0.92em;
}

.doc-body pre {
  overflow-x: auto;
  padding: 16px;
  border-radius: 14px;
  background: #101828;
  color: #f9fafb;
}

.doc-body pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.toc {
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 112px);
  overflow-y: auto;
  padding: 18px 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 10px 28px rgba(17, 24, 39, 0.06);
}

.toc-title {
  margin-bottom: 10px;
  color: #98a2b3;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.toc a {
  display: block;
  padding: 6px 0;
  color: #475467;
  text-decoration: none;
  font-size: 13px;
  line-height: 1.45;
  border-left: 2px solid transparent;
}

.toc a:hover {
  color: var(--blue-dark);
}

.toc .toc-level-3 {
  padding-left: 12px;
  color: #667085;
  font-size: 12px;
}

.loading,
.error {
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fff;
  box-shadow: var(--shadow);
}

.error {
  color: #b42318;
  background: #fff8f7;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(17, 24, 39, 0.35);
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: min(320px, 86vw);
    transform: translateX(-100%);
    transition: transform 0.18s ease;
  }

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

  .menu-button {
    display: inline-grid;
    place-items: center;
  }

  .home,
  .document {
    width: min(100% - 32px, 940px);
  }

  .hero {
    padding: 32px 24px;
  }

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

  .doc-body {
    padding: 28px 20px 36px;
  }

  .doc-layout {
    display: block;
  }

  .toc {
    display: none;
  }

  .topbar {
    padding: 12px 16px;
  }
}
