/* Admin guide (/admin/guide): how Forge works, with diagrams. Each tone is where something runs. */
.guide-page {
    --g-forge: #fff4ea;      --g-forge-line: #f0b98c;    --g-forge-ink: #a04400;
    --g-azure: #edf5fd;     --g-azure-line: #a9cbee;   --g-azure-ink: #0b5cad;
    --g-m365: #f3effc;      --g-m365-line: #c7b8ec;    --g-m365-ink: #5b3fb0;
    --g-outside: #f3f4f6;   --g-outside-line: #cfd4da; --g-outside-ink: #495057;
    --g-person: #ecf7f0;    --g-person-line: #b5dcc4;  --g-person-ink: #146c43;
    --g-neutral: #ffffff;   --g-neutral-line: #d5d9de; --g-neutral-ink: #343a40;
    --g-edge: #8a9199;
    --g-on: var(--forge-orange);
}

/* Layout: rail of topics, then the topic */
.guide-search { margin: 0.25rem 0.25rem 0.5rem; }
.guide-rail-group + .guide-rail-group { margin-top: 0.35rem; }
.guide-topic-head { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem; }
.guide-topic-icon {
    flex: none; width: 3rem; height: 3rem; border-radius: 0.8rem; display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--forge-orange-light), var(--forge-orange-dark)); color: #fff; font-size: 1.35rem;
    box-shadow: 0 6px 18px rgba(204, 85, 0, 0.25);
}
.guide-topic-head h2 { font-size: 1.45rem; font-weight: 700; margin: 0 0 0.2rem; color: var(--forge-charcoal); }
.guide-topic-head p { margin: 0; color: #495057; max-width: 62rem; }
.guide-kicker { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: #8a9199; font-weight: 700; }
.guide-prose { max-width: 62rem; color: #343a40; }
.guide-prose p { margin-bottom: 0.75rem; }
.guide-h { font-size: 1.05rem; font-weight: 700; color: var(--forge-charcoal); margin: 1.75rem 0 0.75rem; display: flex; align-items: center; gap: 0.5rem; }
.guide-h i { color: var(--forge-orange); }
.guide-pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2rem; padding-top: 1rem; border-top: 1px solid #e5e7eb; }
.guide-pager a { display: flex; flex-direction: column; text-decoration: none; padding: 0.6rem 0.9rem; border-radius: 0.6rem; border: 1px solid #e5e7eb; background: #fff; min-width: 12rem; }
.guide-pager a:hover { border-color: var(--forge-orange-light); }
.guide-pager a span { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: #8a9199; }
.guide-pager a.next { text-align: right; margin-left: auto; }

/* Home: topic cards */
.guide-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 0.85rem; }
.guide-card {
    display: flex; gap: 0.8rem; padding: 0.95rem 1rem; border-radius: 0.8rem; background: #fff; border: 1px solid #e5e7eb;
    text-decoration: none; color: inherit; transition: border-color 0.12s, box-shadow 0.12s;
}
.guide-card:hover { border-color: var(--forge-orange-light); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06); color: inherit; }
.guide-card > i { flex: none; width: 2.3rem; height: 2.3rem; border-radius: 0.6rem; display: inline-flex; align-items: center; justify-content: center; background: var(--forge-orange-tint); color: var(--forge-orange); font-size: 1.1rem; }
.guide-card-title { font-weight: 700; color: var(--forge-charcoal); }
.guide-card-text { font-size: 0.85rem; color: #6c757d; }

/* Fact tiles and tables */
.guide-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.75rem; margin-bottom: 1.25rem; }
.guide-fact { background: #fff; border: 1px solid #e5e7eb; border-left: 4px solid var(--g-neutral-line); border-radius: 0.7rem; padding: 0.75rem 0.9rem; font-size: 0.88rem; }
.guide-fact strong { display: block; color: var(--forge-charcoal); margin-bottom: 0.15rem; }
.guide-fact.forge { border-left-color: var(--g-forge-line); }
.guide-fact.azure { border-left-color: var(--g-azure-line); }
.guide-fact.m365 { border-left-color: var(--g-m365-line); }
.guide-fact.person { border-left-color: var(--g-person-line); }
.guide-fact.warn { border-left-color: #f0ad00; background: #fffbef; }
.guide-table { font-size: 0.86rem; background: #fff; }
.guide-table th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: #6c757d; font-weight: 700; }
.guide-status { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.75rem; font-weight: 600; padding: 0.1rem 0.5rem; border-radius: 1rem; white-space: nowrap; }
.guide-status.done { background: #e7f5ec; color: #146c43; }
.guide-status.partly { background: #fff6e0; color: #8a5a00; }
.guide-status.todo { background: #f1f3f5; color: #6c757d; }
.guide-status.off { background: #fdecee; color: #b02a37; }

/* A diagram card */
.guide-diagram { background: #fff; border: 1px solid #e5e7eb; border-radius: 0.9rem; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04); margin-bottom: 1.25rem; overflow: hidden; }
.guide-diagram-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; padding: 0.8rem 1.1rem; border-bottom: 1px solid #eef0f3; }
.guide-diagram-head h3 { font-size: 1rem; font-weight: 700; margin: 0; display: flex; align-items: center; gap: 0.5rem; }
.guide-diagram-head h3 i { color: var(--forge-orange); }
.guide-legend { display: flex; flex-wrap: wrap; gap: 0.35rem 0.9rem; font-size: 0.76rem; color: #6c757d; }
.guide-legend-item { display: inline-flex; align-items: center; gap: 0.35rem; }
.guide-legend-line { stroke: var(--g-edge); stroke-width: 2; }
.guide-legend-line.dashed { stroke-dasharray: 6 4; }
.guide-legend-line.dotted { stroke-dasharray: 2 4; stroke-linecap: round; }
.guide-swatch { display: inline-block; width: 0.8rem; height: 0.8rem; border-radius: 0.25rem; border: 1.5px solid var(--g-neutral-line); background: var(--g-neutral); flex: none; }

.guide-diagram-body { display: grid; grid-template-columns: minmax(0, 1fr); }
.guide-diagram-body.with-detail { grid-template-columns: minmax(0, 1fr) 300px; }
@media (max-width: 1499.98px) { .guide-diagram-body.with-detail { grid-template-columns: minmax(0, 1fr); } }
.guide-canvas { padding: 0.75rem; background: #fbfbfc; overflow-x: auto; min-width: 0; }
.guide-svg { width: 100%; height: auto; display: block; font-family: var(--bs-body-font-family); }
.guide-caption { font-size: 0.8rem; color: #6c757d; padding: 0.4rem 0.35rem 0; }

.guide-detail { border-left: 1px solid #eef0f3; padding: 1rem 1.1rem; font-size: 0.88rem; background: #fff; }
@media (max-width: 1499.98px) { .guide-detail { border-left: 0; border-top: 1px solid #eef0f3; } }
.guide-detail-title { font-weight: 700; font-size: 1rem; color: var(--forge-charcoal); display: flex; gap: 0.45rem; align-items: center; }
.guide-detail-title i { color: var(--forge-orange); }
.guide-detail-where { display: flex; align-items: center; gap: 0.4rem; font-size: 0.78rem; color: #6c757d; margin: 0.25rem 0 0.6rem; }
.guide-detail-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.07em; color: #8a9199; font-weight: 700; margin-bottom: 0.2rem; }
.guide-code { display: block; font-size: 0.78rem; white-space: pre-wrap; word-break: break-word; background: #f6f7f9; border-radius: 0.4rem; padding: 0.4rem 0.55rem; color: #6f2c00; }

/* Tones, on zones, nodes, swatches and fact tiles */
.guide-swatch.forge, .guide-zone.forge rect, .guide-node.forge .guide-shape { fill: var(--g-forge); background: var(--g-forge); stroke: var(--g-forge-line); border-color: var(--g-forge-line); }
.guide-swatch.azure, .guide-zone.azure rect, .guide-node.azure .guide-shape { fill: var(--g-azure); background: var(--g-azure); stroke: var(--g-azure-line); border-color: var(--g-azure-line); }
.guide-swatch.m365, .guide-zone.m365 rect, .guide-node.m365 .guide-shape { fill: var(--g-m365); background: var(--g-m365); stroke: var(--g-m365-line); border-color: var(--g-m365-line); }
.guide-swatch.outside, .guide-zone.outside rect, .guide-node.outside .guide-shape { fill: var(--g-outside); background: var(--g-outside); stroke: var(--g-outside-line); border-color: var(--g-outside-line); }
.guide-swatch.person, .guide-zone.person rect, .guide-node.person .guide-shape { fill: var(--g-person); background: var(--g-person); stroke: var(--g-person-line); border-color: var(--g-person-line); }
.guide-node.neutral .guide-shape { fill: #fff; stroke: var(--g-neutral-line); }

.guide-zone rect { fill-opacity: 0.55; stroke-width: 1.5; stroke-dasharray: 7 5; }
.guide-zone-title { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.guide-zone.forge .guide-zone-title { fill: var(--g-forge-ink); }
.guide-zone.azure .guide-zone-title { fill: var(--g-azure-ink); }
.guide-zone.m365 .guide-zone-title { fill: var(--g-m365-ink); }
.guide-zone.outside .guide-zone-title { fill: var(--g-outside-ink); }
.guide-zone.person .guide-zone-title { fill: var(--g-person-ink); }
.guide-zone.neutral rect { fill: #f8f9fa; stroke: var(--g-neutral-line); }
.guide-zone.neutral .guide-zone-title { fill: #6c757d; }

.guide-node { cursor: pointer; outline: none; transition: opacity 0.15s; }
.guide-node .guide-shape { stroke-width: 1.5; filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.07)); transition: stroke 0.12s, stroke-width 0.12s; }
.guide-node .guide-shape-line { fill: none; stroke-width: 1.5; stroke: inherit; }
.guide-node.store .guide-shape-line { stroke: var(--g-neutral-line); }
.guide-node.azure .guide-shape-line { stroke: var(--g-azure-line); }
.guide-node.forge .guide-shape-line { stroke: var(--g-forge-line); }
.guide-node.m365 .guide-shape-line { stroke: var(--g-m365-line); }
.guide-node:hover .guide-shape, .guide-node:focus-visible .guide-shape { stroke: var(--forge-orange-light); stroke-width: 2; }
.guide-node.selected .guide-shape, .guide-node.on .guide-shape { stroke: var(--g-on); stroke-width: 2.5; }
.guide-node.on .guide-shape { filter: drop-shadow(0 0 6px rgba(204, 85, 0, 0.35)); }
.guide-node.dim { opacity: 0.28; }
.guide-node.decision .guide-shape { fill: #fffaf0; stroke: #e7b65c; }
.guide-node.terminal.neutral .guide-shape { fill: var(--forge-charcoal); stroke: var(--forge-charcoal); }
.guide-node.terminal.neutral .guide-node-title, .guide-node.terminal.neutral i { color: #fff; }

.guide-node-text {
    width: 100%; height: 100%; display: flex; align-items: center; gap: 0.45rem; padding: 0.3rem 0.6rem;
    font-size: 12.5px; line-height: 1.2; overflow: hidden; pointer-events: none;
}
.guide-node-text.decision { justify-content: center; text-align: center; padding: 0.4rem 1.6rem; }
.guide-node-text.stacked { justify-content: center; }
.guide-node-text i { font-size: 1.05rem; flex: none; }
.guide-node.forge i { color: var(--g-forge-ink); }
.guide-node.azure i { color: var(--g-azure-ink); }
.guide-node.m365 i { color: var(--g-m365-ink); }
.guide-node.outside i { color: var(--g-outside-ink); }
.guide-node.person i { color: var(--g-person-ink); }
.guide-node.neutral i { color: #6c757d; }
.guide-node-title { font-weight: 700; color: var(--forge-charcoal); }
.guide-node-sub { font-size: 10.5px; color: #6c757d; margin-top: 1px; }

.guide-edge { transition: opacity 0.15s; }
.guide-edge path { fill: none; stroke: var(--g-edge); stroke-width: 1.6; }
.guide-edge.dashed path { stroke-dasharray: 7 5; }
.guide-edge.dotted path { stroke-dasharray: 1.5 4.5; stroke-linecap: round; stroke-width: 2; }
.guide-edge.on path { stroke: var(--g-on); stroke-width: 2.6; stroke-dasharray: 8 6; animation: guide-flow 0.9s linear infinite; }
.guide-edge.dim { opacity: 0.12; }
.guide-arrowhead { fill: var(--g-edge); }
.guide-arrowhead.on { fill: var(--g-on); }
.guide-edge-label { font-size: 10.5px; fill: #495057; text-anchor: middle; paint-order: stroke; stroke: #fbfbfc; stroke-width: 4px; stroke-linejoin: round; font-weight: 500; }
.guide-edge.on .guide-edge-label { fill: var(--forge-orange-dark); font-weight: 700; }

@keyframes guide-flow { to { stroke-dashoffset: -14; } }
@media (prefers-reduced-motion: reduce) { .guide-edge.on path { animation: none; } }

/* Walkthrough */
.guide-steps { border-top: 1px solid #eef0f3; padding: 0.75rem 1.1rem 0.9rem; }
.guide-step-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.guide-step-chips { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.guide-step-chip {
    width: 1.75rem; height: 1.75rem; border-radius: 50%; border: 1.5px solid #d5d9de; background: #fff; font-size: 0.75rem; font-weight: 700; color: #6c757d;
    display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.guide-step-chip:hover { border-color: var(--forge-orange-light); color: var(--forge-orange-dark); }
.guide-step-chip.done { background: var(--forge-orange-tint); border-color: #f3c7a4; color: var(--forge-orange-dark); }
.guide-step-chip.active { background: var(--forge-orange); border-color: var(--forge-orange); color: #fff; }
.guide-step-text { display: flex; gap: 0.75rem; margin-top: 0.75rem; padding: 0.75rem 0.9rem; border-radius: 0.6rem; background: var(--forge-orange-tint); font-size: 0.9rem; color: #343a40; }
.guide-step-num { flex: none; width: 1.9rem; height: 1.9rem; border-radius: 50%; background: var(--forge-orange); color: #fff; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.guide-step-title { font-weight: 700; color: var(--forge-charcoal); margin-bottom: 0.15rem; }
.guide-actor { font-size: 0.72rem; font-weight: 600; color: var(--forge-orange-dark); background: #fff; border: 1px solid #f3c7a4; border-radius: 1rem; padding: 0.05rem 0.5rem; margin-left: 0.4rem; white-space: nowrap; }
.guide-step-hint { font-size: 0.82rem; color: #6c757d; margin-top: 0.5rem; }

/* Sequence diagrams */
.guide-sequence-canvas .guide-svg { min-width: 640px; }
.guide-lifeline { stroke: #ced4da; stroke-width: 1.5; stroke-dasharray: 4 4; }
.guide-phase line { stroke: #e3e6ea; stroke-width: 1; }
.guide-phase rect { fill: #f1f3f5; stroke: #e3e6ea; }
.guide-phase text { font-size: 11px; font-weight: 700; fill: #6c757d; letter-spacing: 0.03em; }
.guide-message { cursor: pointer; transition: opacity 0.15s; }
.guide-message-hit { fill: transparent; }
.guide-message:hover .guide-message-hit { fill: rgba(204, 85, 0, 0.05); }
.guide-message.on .guide-message-hit { fill: rgba(204, 85, 0, 0.08); }
.guide-message.dim { opacity: 0.3; }
.guide-message-line { stroke: #5f6b76; stroke-width: 1.6; }
.guide-message.reply .guide-message-line { stroke-dasharray: 6 4; }
.guide-message.on .guide-message-line { stroke: var(--g-on); stroke-width: 2.4; }
.guide-message-label { font-size: 11.5px; fill: #343a40; text-anchor: middle; paint-order: stroke; stroke: #fbfbfc; stroke-width: 4px; stroke-linejoin: round; }
.guide-message.on .guide-message-label { fill: var(--forge-orange-dark); font-weight: 700; }
.guide-message-label.note { font-size: 11px; }
.guide-note { fill: #fffaf0; stroke: #e7b65c; }
.guide-message-num { fill: #fff; stroke: #5f6b76; stroke-width: 1.2; }
.guide-message.on .guide-message-num { fill: var(--g-on); stroke: var(--g-on); }
.guide-message-num-text { font-size: 9.5px; font-weight: 700; text-anchor: middle; fill: #5f6b76; }
.guide-message.on .guide-message-num-text { fill: #fff; }

/* Layers: stacked bands for logical layouts */
.guide-layers { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1.25rem; }
.guide-layer { display: grid; grid-template-columns: 190px minmax(0, 1fr); border-radius: 0.8rem; border: 1.5px solid var(--g-neutral-line); overflow: hidden; background: #fff; }
.guide-layer-name { padding: 0.8rem 0.9rem; font-weight: 700; font-size: 0.9rem; display: flex; flex-direction: column; gap: 0.15rem; }
.guide-layer-name small { font-weight: 400; color: #6c757d; font-size: 0.75rem; }
.guide-layer-items { display: flex; flex-wrap: wrap; gap: 0.45rem; padding: 0.7rem; align-items: center; }
.guide-layer-item { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.35rem 0.65rem; border-radius: 0.5rem; background: #fff; border: 1px solid #e3e6ea; font-size: 0.83rem; }
.guide-layer.forge { border-color: var(--g-forge-line); } .guide-layer.forge .guide-layer-name { background: var(--g-forge); color: var(--g-forge-ink); }
.guide-layer.azure { border-color: var(--g-azure-line); } .guide-layer.azure .guide-layer-name { background: var(--g-azure); color: var(--g-azure-ink); }
.guide-layer.m365 { border-color: var(--g-m365-line); } .guide-layer.m365 .guide-layer-name { background: var(--g-m365); color: var(--g-m365-ink); }
.guide-layer.person { border-color: var(--g-person-line); } .guide-layer.person .guide-layer-name { background: var(--g-person); color: var(--g-person-ink); }
.guide-layer.outside { border-color: var(--g-outside-line); } .guide-layer.outside .guide-layer-name { background: var(--g-outside); color: var(--g-outside-ink); }
@media (max-width: 767.98px) { .guide-layer { grid-template-columns: minmax(0, 1fr); } }

/* Glossary */
.guide-glossary dt { font-weight: 700; color: var(--forge-charcoal); margin-top: 0.75rem; }
.guide-glossary dd { margin: 0.1rem 0 0; color: #495057; font-size: 0.9rem; }
.guide-glossary .guide-also { font-size: 0.78rem; color: #8a9199; }
