/* =====================================
   Tools & systems: the git sandbox
   ===================================== */

/* The terminal and the graph side by side, one under the other on a phone */
.sg-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
    gap: 14px;
    margin: 12px 0;
}

@media (max-width: 800px) {
    .sg-layout { grid-template-columns: minmax(0, 1fr); }
}

.sg-terminal {
    height: 280px;
    margin: 0 0 8px;
    padding: 10px 12px;
    overflow-y: auto;
    border-radius: 8px;
    background: #10151c;
    color: #d6dde6;
    font: 0.85rem/1.45 Consolas, Menlo, monospace;
    list-style: none;
}

.sg-terminal li { margin-bottom: 6px; }
.sg-line { color: #8fd18f; }
.sg-answer { white-space: pre-wrap; }
.sg-error .sg-answer { color: #ff9a8a; }

.sg-prompt {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sg-dollar {
    font-family: Consolas, Menlo, monospace;
    font-weight: bold;
}

.sg-prompt input {
    flex: 1;
    min-width: 0;
    font-family: Consolas, Menlo, monospace;
}

.sg-chips .ml-chip { font-family: Consolas, Menlo, monospace; }

.sg-graph { min-height: 160px; }
.sg-edge { fill: none; stroke: var(--text-muted); stroke-width: 2.5; }
.sg-commit { fill: var(--ml-train); stroke: var(--card-bg); stroke-width: 2; }
.sg-merge { fill: var(--ml-val); }
.sg-head { stroke: var(--ml-curve); stroke-width: 3.5; }

.sg-commit-id {
    fill: #fff;
    font: bold 11px Consolas, Menlo, monospace;
    text-anchor: middle;
}

.sg-faded { opacity: 0.3; }

.sg-label {
    fill: var(--text);
    font: bold 11px Consolas, Menlo, monospace;
    text-anchor: middle;
}

.sg-label-box { fill: var(--surface-2); stroke: var(--border); }
.sg-label-head { fill: var(--accent); }
.sg-label-head-box { fill: var(--card-bg); stroke: var(--accent); stroke-width: 1.5; }
.sg-label-tag { fill: var(--text-muted); }
.sg-label-tag-box { fill: var(--card-bg); stroke: var(--border); stroke-dasharray: 3 2; }

.sg-cheat {
    padding-left: 20px;
    font-size: 0.92rem;
}

.sg-cheat li { margin: 5px 0; }

/* =====================================
   Tools & systems: APIs and HTTP
   ===================================== */
#sa_body {
    width: 100%;
    margin-bottom: 8px;
    font-family: Consolas, Menlo, monospace;
}

.sa-wire {
    min-height: 140px;
    margin: 0;
    padding: 10px 12px;
    overflow-x: auto;
    border-radius: 8px;
    background: #10151c;
    color: #d6dde6;
    font: 0.82rem/1.45 Consolas, Menlo, monospace;
    white-space: pre-wrap;
}

/* The status line's colour follows the first digit: green for 2xx, red for 4xx */
.sa-wire[data-kind="2xx"]::first-line { color: #8fd18f; font-weight: bold; }
.sa-wire[data-kind="4xx"]::first-line { color: #ff9a8a; font-weight: bold; }
.sa-wire[data-kind="5xx"]::first-line { color: #ffcc66; font-weight: bold; }

.sa-codes {
    padding-left: 20px;
    font-size: 0.92rem;
}

.sa-codes li { margin: 4px 0; padding: 2px 6px; border-radius: 4px; }
.sa-codes li.sa-now { background: rgba(235, 104, 52, 0.18); font-weight: bold; }

/* =====================================
   Tools & systems: tools for language models, MCP
   ===================================== */
.smc-actor { stroke-width: 1.5; }
.smc-actor-user { fill: var(--surface-2); stroke: var(--text-muted); }
.smc-actor-app { fill: var(--card-bg); stroke: var(--accent); }
.smc-actor-model { fill: var(--card-bg); stroke: var(--ml-val); }
.smc-actor-server { fill: var(--card-bg); stroke: var(--ml-train); }

.smc-actor-name {
    fill: var(--text);
    font-size: 11px;
    font-weight: bold;
    text-anchor: middle;
}

.smc-lifeline { stroke: var(--border); stroke-dasharray: 4 4; }
.smc-arrow { stroke-width: 1.8; }
.smc-head { stroke: none; }
.smc-rpc { stroke: var(--ml-train); }
.smc-rpc.smc-head { fill: var(--ml-train); }
.smc-model { stroke: var(--ml-val); }
.smc-model.smc-head { fill: var(--ml-val); }
.smc-text { stroke: var(--text-muted); }
.smc-text.smc-head { fill: var(--text-muted); }
.smc-now { stroke-width: 3.5; }
.smc-later { opacity: 0.25; }

.smc-arrow-label {
    fill: var(--text);
    font: 10px Consolas, Menlo, monospace;
    text-anchor: middle;
}

/* The chat bubble: your question on the right, the model's answer on the left, as in a chat */
.smc-bubble {
    max-width: 90%;
    margin: 6px 0 10px;
    padding: 8px 12px;
    border-radius: 12px;
    background: var(--surface-2);
}

.smc-bubble[data-from="user"] { margin-left: auto; background: rgba(42, 120, 214, 0.15); }
.smc-bubble[data-from="app"] { border: 1px dashed var(--accent); }

/* The diagram needs the full width; the message goes under it */
.smc-layout {
    display: grid;
    gap: 14px;
    margin: 10px 0;
}

/* =====================================
   Tools & systems: SQL and databases
   ===================================== */
.ssq-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 14px;
    margin: 12px 0;
}

@media (max-width: 800px) {
    .ssq-layout { grid-template-columns: minmax(0, 1fr); }
}

#ssq_sql {
    width: 100%;
    margin: 4px 0 8px;
    font-family: Consolas, Menlo, monospace;
}

.ssq-table th,
.ssq-table td { text-align: left; white-space: nowrap; }
.ssq-table th { border-bottom: 1px solid var(--border); }
.ssq-null { color: var(--text-muted); font-style: italic; }

.ssq-schema { margin: 6px 0; }
.ssq-table-name { padding: 2px 8px; font-family: Consolas, Menlo, monospace; }

.ssq-history {
    max-height: 220px;
    overflow-y: auto;
    padding-left: 22px;
    font-size: 0.85rem;
}

.ssq-history li { margin: 4px 0; cursor: pointer; white-space: pre-wrap; }
.ssq-history li.ml-hint { list-style: none; cursor: default; }

/* =====================================
   Tools & systems: Docker in a sandbox
   ===================================== */
.sdk-dockerfile {
    margin: 6px 0;
    padding: 10px 12px 10px 34px;
    border-radius: 8px;
    background: #10151c;
    color: #d6dde6;
    font-size: 0.85rem;
}

.sdk-dockerfile li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin: 3px 0; }
.sdk-cached { color: #8fd18f; }
.sdk-built { color: #ffcc66; }

.sdk-images,
.sdk-containers { display: grid; gap: 10px; }

.sdk-image-name {
    margin-bottom: 4px;
    font: bold 0.85rem Consolas, Menlo, monospace;
    word-break: break-all;
}

/* A stack of layers: the newest on top, the base at the bottom */
.sdk-stack {
    margin: 0;
    padding: 0;
    list-style: none;
}

.sdk-layer {
    margin-top: 2px;
    padding: 3px 8px;
    border-radius: 4px;
    color: #fff;
    font: 0.78rem Consolas, Menlo, monospace;
}

.sdk-c0 { background: #2a78d6; }
.sdk-c1 { background: #1b8f66; }
.sdk-c2 { background: #b4561f; }
.sdk-c3 { background: #7a4fc4; }
.sdk-c4 { background: #a83a5c; }
.sdk-own { background: #5d6b75; }

.sdk-container {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-left-width: 5px;
    border-radius: 8px;
}

.sdk-running { border-left-color: #1baf7a; }
.sdk-exited { border-left-color: var(--text-muted); opacity: 0.8; }
.sdk-created { border-left-color: #eb6834; }

.sdk-status {
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--surface-2);
    font-size: 0.78rem;
    font-weight: bold;
}

.sdk-fact { margin-top: 3px; }
.sdk-containers + h3 { margin-top: 16px; }
