@import url('../js/vendor/ui/css/tokens.css');
@import url('../js/vendor/ui/css/bridge.css');
@import url('../js/vendor/ui/css/components.css');
@import url('../js/vendor/ui/css/shell.css');
@import url('../js/vendor/ui/css/primitives.css');
@import url('../js/vendor/ui/css/workspace.css');

/* Ontology — accent overrides (teal) */
:root {
    --accent: #0f766e;
    --accent-dim: #115e59;
    --accent-glow: rgba(15, 118, 110, 0.10);
    --accent-surface: rgba(15, 118, 110, 0.08);
}
[data-theme="dark"] {
    --accent: #2dd4bf;
    --accent-dim: #14b8a6;
    --accent-glow: rgba(45, 212, 191, 0.14);
    --accent-surface: rgba(45, 212, 191, 0.10);
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]):not([data-theme="dark"]) {
        --accent: #2dd4bf;
        --accent-dim: #14b8a6;
        --accent-glow: rgba(45, 212, 191, 0.14);
        --accent-surface: rgba(45, 212, 191, 0.10);
    }
}

.login-sub {
    margin: -0.25rem 0 0.75rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}

/* ============================================================
   Shared bits
   ============================================================ */
.gm-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85em; }
.gm-help { font-size: 0.72rem; color: var(--text-muted); margin: 0.25rem 0 0; }
.gm-sep { border-top: 1px solid var(--border-light); margin: 0.9rem 0; }
.gm-err { color: var(--danger); font-weight: 600; }
.gm-footer-status { font-size: 0.78rem; color: var(--text-muted); }
.gm-row-end { display: flex; justify-content: flex-end; gap: 0.4rem; margin-top: 0.5rem; }
.gm-row-desc { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.1rem; max-width: 40rem; }
.gm-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem 0.6rem; }
.gm-field { margin-bottom: 0.6rem; min-width: 0; }
.gm-field .form-input, .gm-field .form-select { width: 100%; }
.gm-x {
    border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
    border-radius: 6px; width: 1.6rem; height: 1.6rem; line-height: 1; cursor: pointer; flex: none;
}
.gm-x:hover { color: var(--danger); border-color: var(--danger); }
.gm-switch { margin: 0.25rem 0 0.75rem; }
.gm-ol-dot { display: inline-block; width: 0.55rem; height: 0.55rem; border-radius: 50%; margin-right: 0.4rem; vertical-align: middle; }

/* ============================================================
   Graphs page
   ============================================================ */
.gm-empty {
    max-width: 34rem; margin: 3rem auto; text-align: center; padding: 0 1rem;
}
.gm-empty h3 { font-size: 1.1rem; font-weight: 600; color: var(--text); margin-bottom: 0.4rem; }
.gm-empty p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.2rem; }
.gm-empty-actions { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; }
.gm-new-graph { padding: 0.75rem 0.75rem 0.25rem; }

/* ============================================================
   Map editor layout
   ============================================================ */
.page-graph .ws-columns { height: 100%; }
.gm-canvas-col { position: relative; padding: 0; overflow: hidden; }
.gm-canvas-host { position: absolute; inset: 0; background: var(--bg); }
.gm-canvas-host.is-connecting { cursor: crosshair; }
.gc-svg { width: 100%; height: 100%; display: block; touch-action: none; outline: none; cursor: grab; }
.gc-svg:active { cursor: grabbing; }
.gm-canvas-host.is-connecting .gc-svg { cursor: crosshair; }
.gc-hud {
    position: absolute; right: 0.6rem; bottom: 0.6rem; display: flex; gap: 0.3rem;
}
.gc-hud-btn {
    width: 1.9rem; height: 1.9rem; border-radius: 6px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text); font-size: 0.95rem; cursor: pointer; line-height: 1;
}
.gc-hud-btn:hover { border-color: var(--accent); color: var(--accent); }
.gc-hint {
    position: absolute; top: 0.6rem; left: 50%; transform: translateX(-50%);
    background: var(--accent); color: #fff; font-size: 0.75rem; padding: 0.3rem 0.7rem; border-radius: 999px;
    pointer-events: none;
}

/* nodes */
.gc-node { cursor: pointer; }
.gc-node-box {
    fill: var(--surface); stroke: var(--border); stroke-width: 1.25;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.06));
}
.gc-node:hover .gc-node-box { stroke: var(--gc-type); }
.gc-node.is-selected .gc-node-box { stroke: var(--accent); stroke-width: 2.5; }
.gc-node.is-connect-from .gc-node-box { stroke: var(--accent); stroke-dasharray: 5 3; stroke-width: 2.5; }
.gc-node.is-unencoded .gc-node-box { stroke-dasharray: 4 3; fill: var(--bg); }
.gc-node.is-unencoded .gc-node-label { fill: var(--text-muted); }
.gc-node-bar { fill: var(--gc-type); }
.gc-node-type { font-size: 9px; font-weight: 700; letter-spacing: 0.06em; fill: var(--gc-type); font-family: Inter, sans-serif; }
.gc-node-label { font-size: 13px; font-weight: 600; fill: var(--text); font-family: Inter, sans-serif; }
.gc-node text, .gc-edge text { user-select: none; pointer-events: none; }

/* edges */
.gc-edge { cursor: pointer; }
.gc-edge-hit { fill: none; stroke: transparent; stroke-width: 14; }
.gc-edge-line { fill: none; stroke: var(--text-muted); stroke-width: 1.5; opacity: 0.75; }
.gc-edge.is-transacts .gc-edge-line { stroke-width: 2.25; }
.gc-edge:hover .gc-edge-line, .gc-edge.is-touch .gc-edge-line { stroke: var(--text); opacity: 1; }
.gc-edge.is-selected .gc-edge-line { stroke: var(--accent); stroke-width: 2.5; opacity: 1; }
.gc-edge-label rect { fill: var(--bg); stroke: var(--border-light); stroke-width: 1; }
.gc-edge.is-selected .gc-edge-label rect { stroke: var(--accent); }
.gc-edge-label text { font-size: 10px; fill: var(--text-muted); font-family: Inter, sans-serif; }
.gc-edge.is-selected .gc-edge-label text, .gc-edge.is-touch .gc-edge-label text { fill: var(--text); }
.gc-clip circle { fill: var(--accent); }
.gc-clip text { font-size: 9px; font-weight: 700; fill: #fff; font-family: Inter, sans-serif; }

/* outline */
.gm-back { font-size: 0.72rem; color: var(--text-muted); text-decoration: none; }
.gm-back:hover { color: var(--accent); }
.gm-graph-title { overflow-wrap: anywhere; }
.gm-outline-search { padding: 0 0.75rem 0.5rem; }
.gm-outline-search .form-input { width: 100%; font-size: 0.8rem; padding: 0.3rem 0.5rem; }
.gm-outline { padding-top: 0; }
.gm-ol-group { margin-bottom: 0.6rem; }
.gm-ol-head {
    display: flex; align-items: center; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.05em;
    text-transform: uppercase; color: var(--text-muted); padding: 0.35rem 0.25rem 0.2rem;
}
.gm-ol-count { margin-left: auto; font-weight: 500; color: var(--text-subtle); font-size: 0.7rem; letter-spacing: 0; text-transform: none; }
.gm-ol-item {
    display: block; width: 100%; text-align: left; border: 0; background: transparent; color: var(--text);
    font-size: 0.82rem; padding: 0.28rem 0.5rem; border-radius: 6px; cursor: pointer; overflow-wrap: anywhere;
}
.gm-ol-item:hover { background: var(--accent-surface); }
.gm-ol-item.is-active { background: var(--accent-glow); color: var(--accent); font-weight: 600; }
.gm-ol-item.is-unencoded { color: var(--text-muted); font-style: italic; }
.gm-ol-edge { display: flex; flex-direction: column; gap: 0.05rem; }
.gm-ol-edge-ends { font-size: 0.72rem; color: var(--text-muted); }
.gm-ol-item.is-active .gm-ol-edge-ends { color: var(--accent); opacity: 0.8; }
.gm-ol-edge-label { font-size: 0.8rem; }
.gm-ol-empty { font-size: 0.75rem; color: var(--text-muted); padding: 0.2rem 0.5rem; }
.gm-ol-issue {
    display: flex; gap: 0.4rem; width: 100%; text-align: left; border: 0; background: transparent;
    font-size: 0.74rem; padding: 0.25rem 0.5rem; border-radius: 6px; color: var(--text-muted); cursor: pointer; line-height: 1.35;
}
.gm-ol-issue:hover { background: var(--accent-surface); color: var(--text); }
.gm-ol-issue-lvl { flex: none; }
.gm-ol-issue.is-error .gm-ol-issue-lvl { color: var(--danger); }
.gm-ol-issue.is-warn .gm-ol-issue-lvl { color: var(--warning); }

/* inspector */
.gm-inspector { padding: 0.9rem 1rem 1.5rem; }
.gm-insp-head { margin-bottom: 0.8rem; }
.gm-insp-kind {
    font-size: 0.66rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted);
}
.gm-insp-kind-type { color: var(--gc-type); }
.gm-insp-title { font-size: 1.05rem; font-weight: 700; color: var(--text); margin: 0.1rem 0 0.2rem; overflow-wrap: anywhere; }
.gm-insp-sub { font-size: 0.75rem; color: var(--text-muted); margin: 0; line-height: 1.4; }
.gm-insp-h4 { font-size: 0.78rem; font-weight: 700; color: var(--text); margin: 0 0 0.35rem; display: flex; align-items: center; gap: 0.5rem; }
.gm-tips { font-size: 0.78rem; color: var(--text-muted); padding-left: 1.1rem; line-height: 1.55; }
.gm-tips b { color: var(--text); font-weight: 600; }
.gm-details { margin: 0.5rem 0; }
.gm-details summary { font-size: 0.76rem; font-weight: 600; color: var(--text-muted); cursor: pointer; margin-bottom: 0.3rem; }
.gm-details .form-input { width: 100%; }
.gm-edge-ends { display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; }
.gm-endlink { border: 0; background: transparent; color: var(--text); font: inherit; cursor: pointer; padding: 0; text-align: left; }
.gm-endlink:hover { color: var(--accent); text-decoration: underline; }
.gm-swap { border: 1px solid var(--border); background: var(--surface); border-radius: 6px; font-size: 0.85rem; padding: 0 0.35rem; cursor: pointer; color: var(--text-muted); }
.gm-swap:hover { color: var(--accent); border-color: var(--accent); }

.gm-list { display: flex; flex-direction: column; gap: 0.15rem; }
.gm-list-item {
    display: grid; grid-template-columns: auto 1fr; gap: 0 0.5rem; align-items: baseline; width: 100%; text-align: left;
    border: 1px solid var(--border-light); background: var(--surface); border-radius: 6px; padding: 0.35rem 0.5rem; cursor: pointer;
}
.gm-list-item:hover { border-color: var(--accent); }
.gm-list-dir { color: var(--text-muted); font-size: 0.8rem; grid-row: 1 / span 2; align-self: center; }
.gm-list-main { font-size: 0.82rem; font-weight: 600; color: var(--text); }
.gm-list-sub { font-size: 0.72rem; color: var(--text-muted); grid-column: 2; }

/* job lifecycle */
.gm-job { margin: 0.75rem 0; padding: 0.7rem 0.75rem; border: 1px solid var(--border-light); border-radius: 8px; background: var(--surface); }
.gm-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; }
.gm-chip {
    display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.75rem; padding: 0.15rem 0.3rem 0.15rem 0.55rem;
    border: 1px solid var(--border); border-radius: 999px; background: var(--bg); color: var(--text); font-family: ui-monospace, Menlo, monospace;
}
.gm-chip.is-initial { border-color: var(--accent); color: var(--accent); }
.gm-chip button { border: 0; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 0.85rem; line-height: 1; padding: 0 0.15rem; }
.gm-chip button:hover { color: var(--danger); }
.gm-chip-input { width: 7.5rem !important; font-size: 0.75rem !important; padding: 0.2rem 0.45rem !important; }
.gm-trans { display: flex; flex-direction: column; gap: 0.45rem; align-items: flex-start; }
.gm-tr { width: 100%; border: 1px solid var(--border-light); border-radius: 6px; padding: 0.4rem 0.5rem; background: var(--bg); }
.gm-tr-row { display: flex; align-items: center; gap: 0.35rem; }
.gm-tr-row .form-select { flex: 1 1 0; min-width: 0; font-size: 0.78rem; padding: 0.25rem 0.4rem; }
.gm-tr-arrow { color: var(--text-muted); flex: none; }
.gm-tr-roles { display: flex; flex-wrap: wrap; gap: 0.25rem 0.7rem; margin-top: 0.35rem; }
.gm-role-chk { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.75rem; color: var(--text); cursor: pointer; }

/* artifacts */
.gm-arts { display: flex; flex-direction: column; gap: 0.35rem; margin: 0.4rem 0 0.5rem; }
.gm-art { border: 1px solid var(--border-light); border-radius: 8px; background: var(--surface); overflow: hidden; }
.gm-art.is-open { border-color: var(--accent); }
.gm-art-head {
    display: grid; grid-template-columns: auto 1fr auto; gap: 0.5rem; align-items: center; width: 100%; text-align: left;
    border: 0; background: transparent; padding: 0.45rem 0.6rem; cursor: pointer; color: var(--text);
}
.gm-art-head:hover { background: var(--accent-surface); }
.gm-art-kind {
    font-size: 0.62rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent);
    border: 1px solid var(--accent); border-radius: 4px; padding: 0.05rem 0.3rem;
}
.gm-art-name { font-size: 0.82rem; font-weight: 600; overflow-wrap: anywhere; }
.gm-art-meta { font-size: 0.7rem; color: var(--text-muted); white-space: nowrap; }
.gm-art-body { padding: 0.5rem 0.6rem 0.7rem; border-top: 1px solid var(--border-light); }
.gm-fields { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.4rem; }
.gm-fld { display: grid; grid-template-columns: 1.3fr 0.9fr auto 1.4fr auto; gap: 0.3rem; align-items: center; }
.gm-fld .form-input, .gm-fld .form-select { font-size: 0.75rem; padding: 0.25rem 0.4rem; width: 100%; min-width: 0; }
.gm-fld-req { display: inline-flex; align-items: center; gap: 0.2rem; font-size: 0.68rem; color: var(--text-muted); white-space: nowrap; }
.gm-file { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; margin-bottom: 0.35rem; }
.gm-file-name { font-weight: 600; overflow-wrap: anywhere; }
.gm-file-size { color: var(--text-muted); font-size: 0.72rem; margin-right: auto; }
.gm-file-input { font-size: 0.75rem; color: var(--text-muted); width: 100%; }

@media (max-width: 900px) {
    .gm-fld { grid-template-columns: 1fr 1fr; }
    .gm-fld .gm-x { grid-column: 2; justify-self: end; }
}
