:root {
  --bg: #f8f9fb;
  --surface: #ffffff;
  --text: #1a1d26;
  --text-muted: #5c6370;
  --border: #e2e6ee;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --nav-width: 260px;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
}

.layout {
  display: flex;
  min-height: 100vh;
}

nav.sidebar {
  width: var(--nav-width);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

nav.sidebar h1 {
  font-size: 0.95rem;
  margin: 0 0 0.25rem;
  color: var(--text);
}

nav.sidebar .project-name {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

nav.sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

nav.sidebar li {
  margin-bottom: 0.25rem;
}

nav.sidebar a {
  display: block;
  padding: 0.45rem 0.65rem;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
}

nav.sidebar a:hover {
  background: var(--accent-soft);
}

nav.sidebar a.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

main.content {
  flex: 1;
  padding: 2rem 2.5rem 3rem;
  max-width: 960px;
}

.doc-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

h1.page-title {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
  line-height: 1.3;
}

h2 {
  margin: 2rem 0 0.75rem;
  font-size: 1.25rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--accent-soft);
}

h3 {
  margin: 1.5rem 0 0.5rem;
  font-size: 1.05rem;
}

p {
  margin: 0.75rem 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  font-size: 0.9rem;
}

th,
td {
  border: 1px solid var(--border);
  padding: 0.6rem 0.75rem;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f1f5f9;
  font-weight: 600;
}

ul,
ol {
  margin: 0.75rem 0;
  padding-left: 1.5rem;
}

li {
  margin: 0.35rem 0;
}

.note {
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  padding: 0.85rem 1rem;
  margin: 1rem 0;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.expert-tip {
  background: #f5f3ff;
  border-left: 4px solid #7c3aed;
  padding: 0.85rem 1rem;
  margin: 1rem 0;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.expert-tip-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: #6d28d9;
  margin-bottom: 0.4rem;
}

.knowledge-section h3 {
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.knowledge-section h3:first-of-type {
  margin-top: 0;
}

.timeline-step {
  margin: 0.5rem 0;
  padding-left: 0.75rem;
  border-left: 3px solid var(--border);
}

.checklist {
  list-style: none;
  padding-left: 0;
}

.checklist li::before {
  content: "☐ ";
  color: var(--text-muted);
}

.diagram {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1rem 0;
  overflow-x: auto;
  box-shadow: var(--shadow);
}

.mermaid {
  text-align: center;
}

code {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.88em;
  background: #f1f5f9;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

pre {
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.5;
}

pre code {
  background: none;
  padding: 0;
}

.log-entry {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  margin: 1rem 0;
  box-shadow: var(--shadow);
}

.log-entry h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.log-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
}

.log-type {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  margin-right: 0.35rem;
}

.log-type-decision { background: #dbeafe; color: #1d4ed8; }
.log-type-change { background: #fef3c7; color: #b45309; }
.log-type-progress { background: #dcfce7; color: #15803d; }
.log-type-issue { background: #fee2e2; color: #b91c1c; }
.log-type-note { background: #f1f5f9; color: #475569; }

.status-done { color: #16a34a; font-weight: 600; }
.status-active { color: #2563eb; font-weight: 600; }
.status-planned { color: #64748b; }
.status-partial { color: #ca8a04; font-weight: 600; }

@media (max-width: 768px) {
  .layout {
    flex-direction: column;
  }

  nav.sidebar {
    width: 100%;
    height: auto;
    position: static;
  }

  main.content {
    padding: 1.25rem;
  }
}
