/* Control panel shell: a sidebar menu beside the page. Only the control panel loads this file. */
body.console { --sidebar: #111827; --sidebar-muted: #9ca3af; --sidebar-hover: #1f2937; }
.shell { display: grid; grid-template-columns: 15.5rem minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 1.25rem; padding: 1.1rem .85rem; background: var(--sidebar); color: #f9fafb; overflow-y: auto; }
.sidebar-brand { display: flex; align-items: center; gap: .7rem; padding: .25rem .4rem; color: inherit; text-decoration: none; }
.sidebar-brand .logo { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; flex: none; border-radius: 9px; background: var(--accent); font-weight: 700; font-size: .85rem; letter-spacing: .02em; }
.sidebar-brand strong { display: block; font-size: .95rem; line-height: 1.2; }
.sidebar-brand small { color: var(--sidebar-muted); font-size: .75rem; }
.menu { display: grid; gap: 1.1rem; flex: 1; align-content: start; }
.menu-section { display: grid; gap: .15rem; }
.menu-label { margin: 0 0 .25rem; padding: 0 .65rem; color: var(--sidebar-muted); font-size: .7rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.menu-item { display: flex; align-items: center; gap: .65rem; padding: .5rem .65rem; border-radius: 8px; color: #d1d5db; text-decoration: none; font-size: .92rem; transition: background .12s, color .12s; }
.menu-item:hover { background: var(--sidebar-hover); color: #fff; }
.menu-item.active { background: color-mix(in srgb, var(--accent) 22%, transparent); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.menu-item svg, .icon-button svg { width: 1.1rem; height: 1.1rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-user { display: flex; align-items: center; gap: .6rem; padding: .7rem .5rem 0; border-top: 1px solid var(--sidebar-hover); }
.sidebar-user .avatar { display: grid; place-items: center; width: 2rem; height: 2rem; flex: none; border-radius: 50%; background: #374151; font-weight: 600; font-size: .85rem; }
.sidebar-user .who { display: grid; min-width: 0; flex: 1; line-height: 1.25; }
.sidebar-user .who strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.sidebar-user .who small { color: var(--sidebar-muted); font-size: .75rem; }
.sidebar-user form { margin: 0; }
.icon-button { display: grid; place-items: center; padding: .45rem; background: transparent; color: var(--sidebar-muted); border-radius: 8px; }
.icon-button:hover { background: var(--sidebar-hover); color: #fff; }
main.content { max-width: 80rem; width: 100%; margin: 0 auto; padding: 2rem 1.75rem; display: grid; gap: 1.25rem; align-content: start; }
main.content > .card, main.content > section { margin: 0; min-width: 0; overflow-x: auto; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: sticky; z-index: 10; height: auto; flex-direction: row; align-items: center; gap: .75rem; padding: .6rem .75rem; overflow-x: auto; }
  .sidebar-brand > span:last-child, .menu-label, .sidebar-user .who { display: none; }
  .menu { display: flex; gap: .25rem; }
  .menu-section { display: flex; gap: .15rem; }
  .menu-item { white-space: nowrap; padding: .45rem .6rem; }
  .menu-item.active { box-shadow: inset 0 -2px 0 var(--accent); }
  .sidebar-user { border: 0; padding: 0; }
  main.content { padding: 1.25rem 1rem; }
}

/* Guide pages: rendered Markdown with an outline beside it. */
.guide { display: grid; grid-template-columns: minmax(0, 1fr) 15rem; gap: 1.5rem; align-items: start; }
.guide-outline { position: sticky; top: 1.5rem; max-height: calc(100vh - 3rem); overflow-y: auto; font-size: .85rem; }
.guide-outline p { margin: 0 0 .5rem; color: var(--muted); font-size: .7rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.guide-outline ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; }
.guide-outline ul ul { padding-left: .8rem; margin: .1rem 0 .35rem; border-left: 1px solid var(--border); }
.guide-outline a { display: block; padding: .2rem .4rem; border-radius: 6px; color: var(--muted); text-decoration: none; }
.guide-outline a:hover { background: #eef2ff; color: var(--accent); }
.prose { line-height: 1.65; padding: 2rem 2.25rem; overflow-wrap: anywhere; }
@media (max-width: 860px) { .prose { padding: 1.25rem 1rem; } }
.prose > :first-child { margin-top: 0; }
.prose h1 { font-size: 1.8rem; line-height: 1.25; margin: 0 0 1rem; }
.prose h2 { font-size: 1.35rem; margin: 2.5rem 0 .75rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }
.prose h3 { font-size: 1.08rem; margin: 1.75rem 0 .5rem; }
.prose h2, .prose h3 { scroll-margin-top: 1.5rem; }
.prose a { color: var(--accent); }
.prose code { padding: .1rem .35rem; border-radius: 5px; background: #f3f4f6; font-size: .86em; }
.prose pre { overflow-x: auto; padding: .9rem 1rem; border-radius: 8px; background: #111827; color: #e5e7eb; font-size: .85rem; }
.prose pre code { padding: 0; background: none; color: inherit; }
.prose pre.mermaid { margin: 0; padding: 0; background: none; text-align: center; color: var(--text); cursor: zoom-in; }
.prose figure.diagram { position: relative; margin: 1.25rem 0; padding: 2.9rem 1.25rem 1.25rem; background: #fff; border: 1px solid var(--border); border-radius: 8px; }
.diagram-open { position: absolute; top: .6rem; right: .6rem; padding: .3rem .7rem; font-size: .8rem; }
.diagram-viewer { width: 96vw; height: 92vh; max-width: none; max-height: none; padding: 0; border: 0; border-radius: 12px; box-shadow: 0 20px 60px rgb(0 0 0 / .35); }
.diagram-viewer::backdrop { background: rgb(17 24 39 / .7); }
.diagram-viewer[open] { display: flex; flex-direction: column; }
.viewer-bar { display: flex; align-items: center; gap: .5rem; padding: .6rem .9rem; border-bottom: 1px solid var(--border); }
.viewer-bar button { min-width: 2.4rem; }
.viewer-hint { margin-right: auto; padding-left: .5rem; color: var(--muted); font-size: .85rem; }
.viewer-canvas { flex: 1; overflow: auto; padding: 1.5rem; background: var(--bg); text-align: center; }
.viewer-canvas svg { height: auto; max-width: none; background: #fff; border-radius: 8px; padding: 1rem; }
.prose table { width: 100%; margin: 1rem 0; border-collapse: collapse; font-size: .9rem; display: block; overflow-x: auto; }
.prose th, .prose td { padding: .5rem .65rem; border: 1px solid var(--border); text-align: left; vertical-align: top; }
.prose th { background: var(--bg); }
.prose li { margin: .2rem 0; }
@media (max-width: 1100px) { .guide { grid-template-columns: minmax(0, 1fr); } .guide-outline { display: none; } }
