:root {
    --bg: #f5f6f8;
    --panel: #ffffff;
    --border: #d9dce1;
    --text: #1c2430;
    --muted: #6b7280;
    --accent: #1d4ed8;
    --error: #b91c1c;
    --warning: #b45309;
    --info: #2563eb;
    --ok: #15803d;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 10px 20px;
    background: #101828;
    color: #fff;
}
.topbar .brand { color: #fff; font-weight: 700; text-decoration: none; font-size: 16px; }
.topbar nav a { color: #cbd5e1; text-decoration: none; margin-right: 16px; font-size: 13px; white-space: nowrap; display: inline-block; }
.topbar nav a:hover { color: #fff; }
.topbar .project-switch { margin-left: auto; color: #fde68a; text-decoration: none; font-size: 13px; white-space: nowrap; }
.topbar .project-switch:hover { color: #fff; }
.topbar .model-revision { margin-left: 10px; color: #cbd5e1; font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }

.content { padding: 20px 28px; max-width: 1200px; margin: 0 auto; }

h1 { font-size: 20px; margin: 0 0 12px; }
h2 { font-size: 16px; margin: 24px 0 8px; }
h3 { font-size: 14px; margin: 16px 0 6px; }

a { color: var(--accent); }

table { border-collapse: collapse; width: 100%; background: var(--panel); margin-bottom: 16px; }
th, td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; vertical-align: top; }
th { background: #eef1f5; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
tr:hover td { background: #fafbfc; }

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 16px; margin-bottom: 16px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card { background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 12px 14px; }
.stat-card .num { font-size: 24px; font-weight: 700; }
.stat-card .label { font-size: 12px; color: var(--muted); }
.stat-card.error .num { color: var(--error); }
.stat-card.warning .num { color: var(--warning); }

form.inline { display: inline; }
label { display: block; font-size: 12px; color: var(--muted); margin: 8px 0 2px; }
input, select, textarea {
    width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: 4px;
    font-family: inherit; font-size: 13px; background: #fff; color: var(--text);
}
textarea { min-height: 80px; }
button, .btn {
    display: inline-block; padding: 6px 14px; border-radius: 4px; border: 1px solid var(--accent);
    background: var(--accent); color: #fff; cursor: pointer; font-size: 13px; text-decoration: none;
}
button.secondary, .btn.secondary { background: #fff; color: var(--text); border-color: var(--border); }
button.danger, .btn.danger { background: #fff; color: var(--error); border-color: var(--error); }

.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; border: 1px solid var(--border); }
.badge.approved { background: #dcfce7; border-color: #86efac; color: #166534; }
.badge.draft { background: #f1f5f9; color: #475569; }
.badge.in_review { background: #fef9c3; border-color: #fde047; color: #854d0e; }
.badge.rejected { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.badge.obsolete { background: #e5e7eb; color: #6b7280; }

.finding { padding: 8px 12px; border-left: 4px solid var(--border); margin-bottom: 6px; background: var(--panel); }
.finding.error { border-color: var(--error); }
.finding.warning { border-color: var(--warning); }
.finding.info { border-color: var(--info); }
.finding .tag { font-weight: 700; font-size: 11px; text-transform: uppercase; margin-right: 6px; }
.finding.error .tag { color: var(--error); }
.finding.warning .tag { color: var(--warning); }
.finding.info .tag { color: var(--info); }

.flash { padding: 8px 12px; border-radius: 4px; margin-bottom: 12px; }
.flash.info { background: #dbeafe; color: #1e3a8a; }
.flash.error { background: #fee2e2; color: #991b1b; }
.flash.success { background: #dcfce7; color: #166534; }

.filters { display: flex; gap: 10px; margin-bottom: 12px; align-items: flex-end; }
.filters > div { flex: 1; }

.trace-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.tree { list-style: none; padding-left: 18px; }
.tree li { margin: 4px 0; }

#cy, .cy-graph { width: 100%; height: 560px; border: 1px solid var(--border); border-radius: 6px; background: #fff; }

.embedded .topbar { display: none; }
.embedded .content { padding: 12px 14px; max-width: none; }
.embedded .page-intro { display: none; }
.embedded #fta-graph { height: calc(100vh - 150px); }

.content.wide { max-width: none; }
.split-view { display: flex; height: calc(100vh - 150px); min-height: 420px; }
.split-left { flex: 0 0 60%; min-width: 240px; display: flex; flex-direction: column; }
.split-left .cy-graph { flex: 1; height: auto; min-height: 0; }
.split-divider { flex: 0 0 8px; cursor: col-resize; background: var(--border); border-radius: 4px; margin: 0 6px; }
.split-divider:hover, .split-divider.dragging { background: var(--accent); }
.split-right { flex: 1; min-width: 240px; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); position: relative; }
.split-right-bar { display: flex; gap: 12px; align-items: center; padding: 6px 10px; border-bottom: 1px solid var(--border); font-size: 12px; }
.split-right-bar .spacer { flex: 1; }
.split-right iframe { flex: 1; width: 100%; border: 0; }
.split-placeholder { position: absolute; inset: 40px 0 0 0; display: flex; align-items: center; justify-content: center; color: var(--muted); text-align: center; padding: 20px; }
.split-placeholder[hidden] { display: none; }
.split-view.dragging iframe { pointer-events: none; }

.context-menu { position: absolute; z-index: 20; min-width: 170px; max-height: 60vh; overflow-y: auto; padding: 4px 0; background: #fff; border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 6px 18px rgba(16, 24, 40, .16); }
.context-menu[hidden] { display: none; }
.context-menu-header { padding: 4px 12px 6px; font-size: 11px; color: var(--muted); font-family: Consolas, monospace; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.context-menu .context-menu-item { display: block; width: 100%; text-align: left; background: none; border: 0; border-radius: 0; color: var(--text); padding: 6px 12px; font-size: 13px; }
.context-menu .context-menu-item:hover { background: #eef1f5; }
.context-menu .context-menu-item.danger { color: var(--error); }


code.id { font-family: Consolas, monospace; background: #eef1f5; padding: 1px 4px; border-radius: 3px; }

/* Guided tour (static/js/tour.js): dimmed page, one spotlit target, a bubble of text. */
.tour-root[hidden] { display: none; }
.tour-spot {
    position: absolute; z-index: 60; border-radius: 8px; pointer-events: none;
    box-shadow: 0 0 0 9999px rgba(16, 24, 40, .55); border: 2px solid var(--accent);
    transition: left .15s ease, top .15s ease, width .15s ease, height .15s ease;
}
.tour-spot[hidden] { display: none; }
.tour-root > .tour-spot[hidden] ~ .tour-bubble { box-shadow: 0 0 0 9999px rgba(16, 24, 40, .55), 0 10px 30px rgba(16, 24, 40, .25); }
.tour-bubble {
    position: absolute; z-index: 61; width: 360px; max-width: calc(100vw - 32px);
    background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
    padding: 16px 18px; box-shadow: 0 10px 30px rgba(16, 24, 40, .25);
}
.tour-bubble .tour-step-count { margin: 0 0 4px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.tour-bubble h3 { margin: 0 0 6px; font-size: 15px; }
.tour-bubble .tour-text { margin: 0 0 14px; font-size: 13px; line-height: 1.5; color: var(--text); }
.tour-buttons { display: flex; gap: 8px; align-items: center; }
.tour-offer {
    position: fixed; right: 16px; bottom: 16px; z-index: 55; display: flex; gap: 10px; align-items: center;
    background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px;
    box-shadow: 0 6px 18px rgba(16, 24, 40, .16); font-size: 13px;
}
.embedded .tour-offer, .embedded .tour-root { display: none; }

/* "fill" pages (SFM-125, FTA views): the graph takes the whole window below the top bar;
   the page help folds into a "How to use" line. */
body:has(> main.content.fill) { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
main.content.fill { max-width: none; width: 100%; box-sizing: border-box; flex: 1; min-height: 0;
    display: flex; flex-direction: column; padding: 8px 12px 10px; }
main.content.fill > h1 { font-size: 18px; margin: 0 0 2px; flex: none; }
main.content.fill > .flash { flex: none; }
.page-help { color: var(--muted); font-size: 12px; margin: 0 0 6px; flex: none; }
.page-help summary { cursor: pointer; color: var(--accent); width: max-content; }
.page-help p { margin: 4px 0 0; max-height: 30vh; overflow-y: auto; }
main.content.fill .fill-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; margin-bottom: 0; padding: 8px; }
main.content.fill .fill-panel > .filters { flex: none; margin-bottom: 8px; }
main.content.fill .fill-panel > .flash { flex: none; }
main.content.fill .fill-graph { position: relative; flex: 1; min-height: 0; }
main.content.fill .fill-graph > .cy-graph { position: absolute; inset: 0; width: auto; height: auto; }

/* brand: icon + product name (SFM-175) */
.topbar .brand { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.topbar .brand-icon { width: 22px; height: 22px; }
.topbar .brand-name { display: inline-flex; flex-direction: column; line-height: 1.05; white-space: nowrap; font-size: 13px; }
.topbar .brand-name small { font-size: 8.5px; font-weight: 500; opacity: .8; letter-spacing: .02em; }
/* keep the top bar at two rows at 1280 px: the views size themselves to 100vh minus a fixed bar height */
