:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --brand: #ff4b26;
  --brand-dark: #e03a1d;
  --brand-soft: #fff5f2;
  --accent: #ff4b26;
  --accent-soft: #fff5f2;
  --code-bg: #0f172a;
  --code-text: #e2e8f0;
  --success: #059669;
  --success-soft: #ecfdf5;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --sidebar-w: 268px;
  --radius: 10px;
  --font: "Google Sans", system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "Fira Code", monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-optical-sizing: auto;
  font-variation-settings: "GRAD" 0;
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
}

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

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

.brand {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
  color: var(--brand);
}

.brand-sub {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.env-switch {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
  background: var(--bg);
  padding: 0.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.env-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0.45rem 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted);
}

.env-btn.active {
  background: var(--surface);
  color: var(--brand);
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

.env-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  margin-left: 0.35rem;
  vertical-align: middle;
}

.env-badge.prod { background: #dcfce7; color: #166534; }
.env-badge.uat { background: #fef3c7; color: #92400e; }

.nav-group {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 1.1rem 0 0.4rem 0.5rem;
}

.nav-group:first-of-type { margin-top: 0; }

.sidebar a {
  display: block;
  padding: 0.4rem 0.65rem;
  color: var(--text);
  text-decoration: none;
  font-size: 0.88rem;
  border-radius: 6px;
}

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

.sidebar a.nav-home {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
  padding-left: 0.5rem;
}

.sidebar a.nav-home:hover { color: var(--brand); }

.sidebar a.nav-star::after {
  content: ' ★';
  color: var(--brand);
  font-size: 0.75rem;
}

.content {
  flex: 1;
  max-width: 920px;
  padding: 2rem 2.5rem 4rem;
}

h1 {
  font-size: 1.85rem;
  margin: 0 0 0.5rem;
  line-height: 1.25;
}

.lead {
  color: var(--muted);
  font-size: 1.05rem;
  margin-bottom: 1.5rem;
}

h2 {
  font-size: 1.35rem;
  margin: 2.5rem 0 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

h2:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }

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

h4 {
  font-size: 0.95rem;
  margin: 1.25rem 0 0.4rem;
  color: var(--text);
}

p { margin: 0.75rem 0; }

ul, ol { margin: 0.5rem 0 1rem; padding-left: 1.35rem; }

li { margin: 0.35rem 0; }

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

.card-scenario { border-left: 4px solid var(--brand); }
.card-marketplace { border-left: 4px solid var(--warning); }
.card-info { border-left: 4px solid #3b82f6; background: #f8fafc; }
.card-success { border-left: 4px solid var(--success); background: var(--success-soft); }

.step-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--brand);
  background: var(--brand-soft);
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  margin-bottom: 0.35rem;
}

.checklist {
  list-style: none;
  padding-left: 0;
  margin: 0.75rem 0 1rem;
}

.checklist li {
  padding: 0.35rem 0 0.35rem 1.6rem;
  position: relative;
}

.checklist li::before {
  content: '☐';
  position: absolute;
  left: 0;
  color: var(--muted);
}

.download-box {
  background: var(--brand-soft);
  border: 1px solid rgba(255, 75, 38, 0.25);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  margin: 1.25rem 0;
}

.download-box h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  color: var(--text);
}

.btn-download {
  display: inline-block;
  margin: 0.5rem 0;
  padding: 0.55rem 1.1rem;
  background: var(--brand);
  color: #fff !important;
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
  border-radius: 8px;
}

.btn-download:hover { background: var(--brand-dark); }

.arch-diagram {
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.45;
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  overflow-x: auto;
  white-space: pre;
  margin: 1rem 0;
}

.compare-table td:first-child { font-weight: 600; width: 28%; }

.tip {
  font-size: 0.88rem;
  color: var(--muted);
  border-left: 3px solid var(--border);
  padding-left: 0.85rem;
  margin: 0.75rem 0;
}

.url-box {
  font-family: var(--mono);
  font-size: 0.82rem;
  background: var(--accent-soft);
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  word-break: break-all;
  margin: 0.5rem 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin: 1rem 0;
}

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

th { background: var(--bg); font-weight: 600; }

code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: #f1f5f9;
  padding: 0.12rem 0.35rem;
  border-radius: 4px;
}

pre {
  position: relative;
  background: var(--code-bg);
  color: var(--code-text);
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.5;
  margin: 0.75rem 0 1.25rem;
}

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

.copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  border: 1px solid #475569;
  background: #1e293b;
  color: #e2e8f0;
  font-size: 0.72rem;
  padding: 0.25rem 0.55rem;
  border-radius: 5px;
  cursor: pointer;
}

.copy-btn:hover { background: #334155; }

.flow {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 1rem 0;
  font-size: 0.85rem;
}

.flow-step {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
}

.flow-arrow { color: var(--muted); }

@media (max-width: 860px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
  }
  .content { padding: 1.25rem 1rem 3rem; }
}

.docs-shell {
  padding-bottom: 0;
  margin-bottom: 0;
}

.docs-shell + .layout {
  min-height: calc(100vh - 5rem);
}
