/* SemperControl: one stylesheet, no external fonts or assets. */

:root {
  --ink: #17212b;
  --muted: #5a6573;
  --line: #dde2e8;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --head: #13202c;
  --head-ink: #e8eef4;
  --accent: #0d6b6b;
  --accent-soft: #e3f1f0;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --warn: #9a4a07;
  --warn-soft: #fff4e5;
  --ok: #067647;
  --ok-soft: #e8f6ee;
  --radius: 6px;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

h1 { font-size: 1.45rem; margin: 0 0 .4rem; font-weight: 650; }
h2 { font-size: 1.1rem; margin: 1.4rem 0 .6rem; font-weight: 650; }
h3 { font-size: .95rem; margin: 1rem 0 .4rem; font-weight: 650; }
p { margin: .3rem 0 .8rem; }
h2.first, h3:first-child { margin-top: 0; }

.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: .9em; }
.loading { color: var(--muted); padding: 2rem; }

/* ---- Header ---- */

.top {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0 1.25rem;
  min-height: 52px;
  background: var(--head);
  color: var(--head-ink);
  border-bottom: 3px solid var(--accent);
}

.brand { font-weight: 700; letter-spacing: .02em; color: var(--head-ink); text-decoration: none; font-size: 1.05rem; }
.brand span { color: #7fd1c9; }

.top nav { display: flex; gap: .25rem; flex: 1; }
.top nav a {
  color: var(--head-ink);
  text-decoration: none;
  padding: .35rem .7rem;
  border-radius: var(--radius);
  opacity: .85;
}
.top nav a:hover { background: rgba(255, 255, 255, .08); opacity: 1; }
.top nav a.active { background: rgba(255, 255, 255, .14); opacity: 1; }

.who { display: flex; align-items: center; gap: .6rem; font-size: .9rem; }
.who .role { font-size: .75rem; padding: .05rem .45rem; border: 1px solid rgba(255, 255, 255, .35); border-radius: 999px; }
.who button { background: transparent; color: var(--head-ink); border: 1px solid rgba(255, 255, 255, .3); }
.who button:hover { background: rgba(255, 255, 255, .1); }

/* ---- Layout ---- */

main { padding: 1.5rem 1.25rem 3rem; max-width: 1280px; margin: 0 auto; }
main:focus { outline: none; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  margin-bottom: 1rem;
}
.card.narrow { max-width: 460px; margin: 2.5rem auto; }
.card.wide { max-width: 720px; margin: 2rem auto; }

.split { display: grid; grid-template-columns: 280px 1fr; gap: 1rem; align-items: start; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .8rem; }
.crumbs { font-size: .88rem; color: var(--muted); margin-bottom: .2rem; }
.crumbs a { color: var(--muted); }

.stats { display: flex; gap: .5rem; flex-wrap: wrap; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .35rem .75rem; font-size: .88rem; }
.stat b { font-size: 1rem; }

/* ---- Forms ---- */

form { margin: 0; }
.field { display: block; margin: 0 0 .9rem; }
.field > span { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .25rem; }
.field small { display: block; margin-top: .25rem; }

input[type=text], input[type=email], input[type=password], select {
  width: 100%;
  font: inherit;
  padding: .5rem .6rem;
  border: 1px solid #c4ccd5;
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
}
input.code { font-family: var(--mono); font-size: 1.3rem; letter-spacing: .18em; text-align: center; }

button {
  font: inherit;
  font-weight: 600;
  padding: .45rem .9rem;
  border-radius: var(--radius);
  border: 1px solid #c4ccd5;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}
button:hover { background: #f0f3f6; }
button:disabled { opacity: .55; cursor: progress; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: #0a5858; }
button.danger { color: var(--danger); border-color: #e7b4ae; }
button.danger:hover { background: var(--danger-soft); }
button.small { padding: .2rem .55rem; font-size: .85rem; font-weight: 500; }
button.link { border: 0; background: none; color: var(--accent); padding: 0; font-weight: 500; text-decoration: underline; }

.actions { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-top: .4rem; }
.form-error:empty { display: none; }
.form-error, .alert { padding: .6rem .8rem; border-radius: var(--radius); margin: 0 0 .9rem; }
.form-error, .alert.error { background: var(--danger-soft); color: var(--danger); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.info { background: var(--accent-soft); color: #0b4f4f; }

.inline-form { display: flex; gap: .5rem; flex-wrap: wrap; align-items: flex-end; }
.inline-form .field { margin: 0; flex: 1; min-width: 180px; }

/* ---- Lists and tables ---- */

.list { list-style: none; margin: 0; padding: 0; }
.list li a {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  padding: .5rem .6rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
}
.list li a:hover { background: #eef2f5; }
.list li a.active { background: var(--accent-soft); color: #0b4f4f; font-weight: 600; }
.count { color: var(--muted); font-size: .85rem; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: .45rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f7f9fb; font-weight: 600; position: sticky; top: 0; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.null { color: #9aa4af; font-style: italic; }
.preview td { white-space: nowrap; max-width: 28rem; overflow: hidden; text-overflow: ellipsis; }
.preview-wrap { max-height: 65vh; }

.tag { display: inline-block; font-size: .75rem; padding: .05rem .45rem; border-radius: 999px; background: #eef1f4; color: var(--muted); font-weight: 600; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.danger { background: var(--danger-soft); color: var(--danger); }

.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin: 1rem 0; }
.tabs a { padding: .5rem .9rem; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; }
.tabs a.active { color: var(--ink); border-bottom-color: var(--accent); }

/* ---- Sign-in specifics ---- */

.secret {
  font-family: var(--mono);
  font-size: 1.1rem;
  letter-spacing: .06em;
  background: #f3f5f7;
  border: 1px dashed #b9c2cc;
  border-radius: var(--radius);
  padding: .6rem .8rem;
  word-break: break-all;
  user-select: all;
}
.qr { display: block; width: 216px; height: 216px; margin: .6rem 0; border: 1px solid #d5dbe1; border-radius: var(--radius); background: #fff; image-rendering: pixelated; }
ol.steps { padding-left: 1.2rem; }
ol.steps > li { margin-bottom: 1rem; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: .4rem .9rem; font-family: var(--mono); font-size: 1.05rem; background: #f3f5f7; padding: .8rem 1rem; border-radius: var(--radius); margin: .6rem 0 1rem; list-style: none; }
.check { display: flex; gap: .5rem; align-items: flex-start; margin: .6rem 0; }

/* ---- Upload ---- */

.drop {
  border: 2px dashed #b9c2cc;
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  color: var(--muted);
  background: #fafbfc;
}
.drop.over { border-color: var(--accent); background: var(--accent-soft); color: #0b4f4f; }
.drop input[type=file] { display: none; }

.footer-note { margin-top: 2rem; font-size: .8rem; color: var(--muted); text-align: center; }

/* ---- Menu counts ---- */

.badge { display: inline-block; min-width: 1.3em; margin-left: .35rem; padding: 0 .35rem; border-radius: 999px; background: #7fd1c9; color: var(--head); font-size: .75rem; font-weight: 700; text-align: center; line-height: 1.35; }
.badge[hidden] { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---- Shared ---- */

input[type=search], input[type=number], input[type=date], textarea {
  width: 100%;
  font: inherit;
  padding: .5rem .6rem;
  border: 1px solid #c4ccd5;
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
}
textarea { resize: vertical; }
textarea:focus-visible, input[type=search]:focus-visible, input[type=number]:focus-visible, input[type=date]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
textarea.sql, .json-editor, pre.code { font-family: var(--mono); font-size: .85rem; }
pre.code { white-space: pre-wrap; background: #f6f8fa; border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .8rem; margin: 0 0 .6rem; overflow-x: auto; }
.json-editor { min-height: 340px; line-height: 1.45; }
.small { font-size: .85rem; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.section-head p { margin: 0; flex: 1; min-width: 260px; }
.section-head h2 { margin-bottom: .6rem; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { padding: .2rem 0; }
ul.changes { margin: 0; padding-left: 1rem; }
.sev { display: inline-flex; align-items: center; gap: .35rem; font-size: .82rem; font-weight: 600; white-space: nowrap; }
.sev svg { flex: none; }
.pager { display: flex; gap: .5rem; margin-top: .6rem; }
button.link.sort { color: inherit; text-decoration: none; font-weight: 600; }
button.link.sort:hover { text-decoration: underline; }

/* ---- Pipelines ---- */

.lineage { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: .8rem; }
.lineage svg { display: block; }
.lineage-node:hover rect { stroke-width: 2.5; }
.lineage-node:focus { outline: none; }
.lineage-node:focus-visible rect { stroke: var(--accent); stroke-width: 3; }
.input-row { display: grid; grid-template-columns: 1fr 2fr auto; gap: .6rem; align-items: end; }
.input-row .field { margin-bottom: .6rem; }
.input-row button { margin-bottom: .7rem; }
.edit-row { border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .8rem; margin-bottom: .6rem; background: #fbfcfd; }
.edit-row-head { display: flex; gap: .5rem; align-items: center; }
.edit-row-head select { width: auto; max-width: 60%; }
.row-tools { margin-left: auto; display: flex; gap: .3rem; }
.edit-row-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 .8rem; margin-top: .6rem; }
.edit-row-fields .field { margin-bottom: .5rem; }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: .7rem 0; border-top: 1px solid var(--line); z-index: 3; }

/* ---- Objects ---- */

.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.type-card { display: flex; flex-direction: column; gap: .25rem; padding: .9rem 1rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); }
.type-card:hover { border-color: var(--accent); }
.type-card b { font-size: 1rem; }
.type-count { font-size: .9rem; }
.explorer-controls { padding: .9rem 1rem; }
.filter-row { display: flex; gap: .5rem; align-items: center; margin-bottom: .5rem; flex-wrap: wrap; }
.filter-row input, .filter-row select { width: auto; flex: 1; min-width: 140px; }
.filter-row button { flex: none; }
.profile { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1rem; align-items: start; }
@media (max-width: 960px) { .profile { grid-template-columns: 1fr; } }
table.props th { width: 40%; background: none; position: static; color: var(--muted); font-weight: 500; white-space: normal; }
.action-form { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: .8rem; }
.link-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .8rem; }
.link-group { margin-bottom: 0; }
.link-group h3 { margin-top: 0; }

/* ---- Dashboards ---- */

.dash-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.widget { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; min-width: 0; }
.widget.w2 { grid-column: span 2; }
.widget.w3 { grid-column: span 3; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } .widget.w2, .widget.w3 { grid-column: auto; } }
.widget-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .6rem; }
.widget-head h3 { margin: 0; font-size: .95rem; }
.stat-tile .stat-label { font-size: .88rem; color: var(--muted); font-weight: 600; }
.stat-tile .stat-value { font-size: 1.9rem; font-weight: 650; margin: .2rem 0 .3rem; letter-spacing: -.01em; line-height: 1.15; }
.stat-target { display: flex; align-items: center; gap: .4rem; font-size: .85rem; }
.stat-foot { font-size: .8rem; margin-top: .35rem; }
.chart { position: relative; }
.chart svg { display: block; overflow: visible; }
.chart svg text { font-family: inherit; }
.chart-tip { position: absolute; pointer-events: none; background: #fff; border: 1px solid var(--line); box-shadow: 0 2px 10px rgba(16, 24, 40, .14); border-radius: var(--radius); padding: .35rem .55rem; font-size: .8rem; display: flex; flex-direction: column; gap: .05rem; z-index: 5; white-space: nowrap; }
.chart-tip[hidden] { display: none; }
.chart-tip b { font-size: .9rem; }
.chart-tip small { color: var(--muted); }
.chart-note { font-size: .8rem; margin: .5rem 0 0; }
.bar-row { cursor: default; }
.bar-row:focus { outline: none; }
.bar-row:focus-visible .bar-mark { stroke: var(--ink); stroke-width: 1.5; }
.chart-overlay:focus { outline: none; }
.chart-overlay:focus-visible { stroke: var(--accent); stroke-width: 2; }

/* ---- Inbox and approvals ---- */

.inbox-item { display: flex; gap: .9rem; align-items: flex-start; padding: .8rem 1rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: .5rem; }
.inbox-item.unread { border-left: 3px solid var(--accent); }
.inbox-item .grow { flex: 1; min-width: 0; }
.inbox-item p { margin: .15rem 0 .2rem; }
.inbox-item .actions { margin-top: 0; flex: none; }
.inbox-item.unread .inbox-title { font-weight: 650; }
.run-card ul.changes { margin: .3rem 0 .8rem; }

/* A question asked next to the control that asked it (instead of a browser dialog). */
.ask { margin: .5rem 0; padding: .75rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); max-width: 32rem; }
.ask p { margin: 0 0 .5rem; }
.ask .field { margin-bottom: .5rem; }
.ask .actions { margin-top: .25rem; }
td .ask { min-width: 16rem; }
