/* HIE proxy admin. No framework, no external fonts. Colour carries meaning: green working, amber watch, red act.
   Motion only where something is moving (messages flowing, numbers changing); it stops with reduced motion. */
:root {
  --ink: #17212d;
  --muted: #5b6878;
  --line: #e1e6ec;
  --bg: #eef2f6;
  --panel: #ffffff;
  --navy: #0d2a45;
  --navy2: #164a73;
  --accent: #1769aa;
  --teal: #0f9d9a;
  --in: #1769aa;
  --out: #0f9d9a;
  --ok: #17803d;
  --ok-bg: #e7f6ec;
  --warn: #a15c00;
  --warn-bg: #fff4de;
  --bad: #c0261c;
  --bad-bg: #fdecea;
  --shadow: 0 1px 2px rgba(16, 32, 48, .06), 0 4px 14px rgba(16, 32, 48, .06);
  --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--ink); background: var(--bg); }

/* ---- header ---- */
.top { display: flex; align-items: center; gap: 1.2rem; padding: .7rem 1.4rem .3rem; flex-wrap: wrap; row-gap: .5rem;
  background: linear-gradient(120deg, var(--navy) 0%, var(--navy2) 70%, #1b6a8f 100%); color: #fff; }
.brand { font-weight: 800; font-size: 1.1rem; letter-spacing: .2px; display: flex; align-items: center; gap: .55rem; }
.brand::before { content: ""; width: 1.4rem; height: 1.4rem; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 35%, #7fe0d9 0 22%, var(--teal) 23% 55%, #0a6f6c 56%); box-shadow: 0 0 0 3px rgba(255, 255, 255, .12); }
.stage { font-weight: 600; font-size: .72rem; text-transform: uppercase; letter-spacing: .8px; padding: .1rem .45rem; border-radius: 999px;
  background: rgba(255, 255, 255, .16); color: #dff3ff; }
.search { display: flex; gap: .35rem; flex: 1 1 26rem; max-width: 44rem; }
.search input { max-width: none; border: none; border-radius: 999px; padding: .45rem .9rem; background: rgba(255, 255, 255, .95); }
.search button { margin: 0; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .5); background: transparent; color: #fff; }
.who { margin-left: auto; color: #cfe3f3; font-size: .9rem; }
.who .link { color: #fff; }
nav { flex-basis: 100%; display: flex; gap: .2rem; flex-wrap: wrap; margin-top: .2rem; }
nav a { color: #cfe3f3; text-decoration: none; padding: .45rem .75rem; border-radius: 8px 8px 0 0; font-weight: 600; font-size: .92rem; }
nav a:hover { color: #fff; background: rgba(255, 255, 255, .08); }
nav a.active { color: var(--navy); background: var(--bg); }

main { padding: 1.4rem; max-width: 1360px; margin: 0 auto; }
h1 { font-size: 1.6rem; margin: .1rem 0 .9rem; letter-spacing: -.2px; }
h2 { font-size: 1.12rem; margin: 1.6rem 0 .65rem; }
.lead { color: var(--muted); margin: -.5rem 0 1.1rem; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.banner { padding: .6rem 1.4rem; background: var(--warn-bg); border-bottom: 1px solid #f0c36d; color: #5c3c00; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; margin-bottom: 1rem; box-shadow: var(--shadow); }

/* ---- tables ---- */
table { border-collapse: separate; border-spacing: 0; width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
th, td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #f7fafc; }
th { font-weight: 700; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .5px; background: #f8fafc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td a { color: var(--accent); font-weight: 600; text-decoration: none; }
td a:hover { text-decoration: underline; }
code, pre, .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .88rem; }
pre { background: #f0f3f6; padding: .7rem; border-radius: 6px; overflow: auto; max-height: 28rem; white-space: pre-wrap; word-break: break-all; }

/* ---- badges: status pills with a dot ---- */
.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .1rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 600;
  border: 1px solid var(--line); background: #f1f4f7; color: var(--muted); margin-right: .25rem; white-space: nowrap; }
.badge::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.ok, .badge.s-ok { color: var(--ok); border-color: #b5e2c3; background: var(--ok-bg); }
.badge.warn, .badge.yellow, .badge.amber, .badge.s-warn { color: var(--warn); border-color: #f3d08b; background: var(--warn-bg); }
.badge.bad, .badge.red, .badge.expired, .badge.s-bad { color: var(--bad); border-color: #f3b4ae; background: var(--bad-bg); }
.badge.s-bad::before { animation: blink 1.4s ease-in-out infinite; }
.badge.s-neutral { color: var(--muted); }

/* ---- controls ---- */
button { font: inherit; font-weight: 600; padding: .45rem .95rem; border: 1px solid var(--accent); background: var(--panel); color: var(--accent);
  border-radius: 8px; cursor: pointer; margin: 0 .3rem .3rem 0; transition: transform .08s ease, box-shadow .15s ease, background .15s ease; }
button:hover:not(:disabled) { box-shadow: 0 2px 8px rgba(23, 105, 170, .18); }
button:active:not(:disabled) { transform: translateY(1px); }
button.primary { background: linear-gradient(180deg, #1f7cc4, var(--accent)); border-color: var(--accent); color: #fff; }
button.danger { border-color: var(--bad); color: var(--bad); }
button.link { border: none; padding: 0; margin: 0; background: none; color: var(--accent); text-decoration: underline; font-weight: 400; box-shadow: none; }
button:disabled { opacity: .45; cursor: not-allowed; }
label { display: block; margin: .5rem 0 .2rem; font-weight: 700; font-size: .88rem; }
input, select, textarea { font: inherit; padding: .45rem .55rem; border: 1px solid #cdd5de; border-radius: 8px; width: 100%; max-width: 36rem; background: #fff; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(23, 105, 170, .15); }
textarea { min-height: 4.5rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: .2rem 1.2rem; }
.row { display: flex; gap: .8rem; align-items: flex-end; flex-wrap: wrap; }
.row > div { flex: 1 1 12rem; }
.errors { color: var(--bad); }
.warnings { color: var(--warn); }
.what { color: var(--muted); font-size: .88rem; }
.hint { color: var(--muted); font-size: .78rem; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.act { display: flex; align-items: baseline; gap: .7rem; margin: .3rem 0; flex-wrap: wrap; }
.act button { margin: 0; min-width: 13.5rem; }
.setting { margin-bottom: .9rem; }
.setting .help { color: var(--muted); font-size: .88rem; margin: .15rem 0 0; }
.inline { display: inline-flex; align-items: center; gap: .4rem; }
.inline input { width: 6rem; }
.sentence { background: #eef6fc; border: 1px solid #c6dcec; border-radius: 8px; padding: .6rem .8rem; }
.refused { border: 1px solid #f1a7a1; background: #fdf3f2; padding: .6rem; border-radius: 8px; }
.receipt { border: 1px solid #9fd3b0; background: #f4fbf6; }

/* ---- dialog ---- */
.backdrop { position: fixed; inset: 0; background: rgba(13, 26, 40, .5); display: flex; align-items: flex-start; justify-content: center; padding-top: 6vh; z-index: 10; animation: fade .15s ease; }
.dialog { background: var(--panel); border-radius: 14px; width: min(46rem, 94vw); max-height: 88vh; overflow: auto; padding: 1.3rem 1.5rem; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); animation: rise .2s ease; }
.dialog h2 { margin-top: 0; }
.steps { padding-left: 1.2rem; }
.steps li { margin-bottom: .3rem; }
.steps li.done { color: var(--ok); }
.steps li.now { font-weight: 700; }
.progress li { margin-bottom: .45rem; }
.progress .st { display: inline-block; min-width: 5.5rem; font-size: .78rem; font-weight: 800; text-transform: uppercase; }
.progress .running .st { color: var(--accent); }
.progress .done .st { color: var(--ok); }
.progress .failed .st { color: var(--bad); }
.progress .skipped .st, .progress .waiting .st { color: var(--muted); }

/* ---- tiles and big numbers ---- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); gap: .8rem; margin-bottom: 1.1rem; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; text-decoration: none; color: var(--ink);
  box-shadow: var(--shadow); transition: transform .12s ease, box-shadow .12s ease; display: flex; flex-direction: column; gap: .3rem; }
a.tile:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(16, 32, 48, .12); }
.tile b { display: block; font-size: 1.7rem; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(12.5rem, 1fr)); gap: .9rem; margin-bottom: 1rem; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem .7rem; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.kpi::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--kpi, var(--accent)); }
.kpi .label { color: var(--muted); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.kpi .value { font-size: 2.2rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.15; margin: .15rem 0; }
.kpi .unit { font-size: .95rem; font-weight: 600; color: var(--muted); margin-left: .25rem; }
.kpi .sub { color: var(--muted); font-size: .82rem; }
.kpi.in { --kpi: var(--in); }
.kpi.out { --kpi: var(--out); }
.kpi.wait { --kpi: #7a5af5; }
.kpi .value-text { font-size: 20px; font-weight: 700; color: var(--ink); line-height: 1.6; }
.kpi.age { --kpi: var(--warn); }
.kpi.good { --kpi: var(--ok); }
.kpi.badk { --kpi: var(--bad); }
.kpi svg { display: block; width: 100%; height: 38px; margin-top: .3rem; }
.bump { animation: bump .5s ease; }
.stat { display: inline-block; min-width: 8rem; margin: 0 1rem .6rem 0; }
.stat b { display: block; font-size: 1.3rem; }

/* ---- live indicator ---- */
.live { display: inline-flex; align-items: center; gap: .4rem; font-size: .78rem; font-weight: 800; color: var(--ok); text-transform: uppercase; letter-spacing: .6px; }
.live::before { content: ""; width: .6rem; height: .6rem; border-radius: 50%; background: var(--ok); animation: pulse 1.6s ease-out infinite; }
.live.stale { color: var(--muted); }
.live.stale::before { background: var(--muted); animation: none; }
.titlebar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.titlebar h1 { margin-right: auto; }

/* ---- the flow picture ---- */
.flow { background: linear-gradient(180deg, #0f2f4d, #12395c); border-radius: 14px; padding: 1.1rem 1.2rem .9rem; color: #e8f3ff; box-shadow: var(--shadow); margin-bottom: 1rem; }
.flow h2 { margin: 0 0 .5rem; color: #fff; }
.flow svg { width: 100%; height: auto; display: block; }
.flow .node rect { fill: rgba(255, 255, 255, .08); stroke: rgba(255, 255, 255, .28); }
.flow .node.hot rect { stroke: #7fe0d9; }
.flow .node text { fill: #fff; font-weight: 700; font-size: 14px; }
.flow .node .small { fill: #bcd6ee; font-weight: 500; font-size: 12px; }
.flow .pipe { stroke: rgba(255, 255, 255, .18); stroke-width: 6; stroke-linecap: round; }
.flow .dot { fill: #7fe0d9; }
.flow .dot.in { fill: #8cc8ff; }
.flow .rate { fill: #fff; font-size: 13px; font-weight: 700; }
.flow .legend { color: #bcd6ee; font-size: .82rem; margin-top: .4rem; }

/* ---- small charts ---- */
.spark { display: inline-block; vertical-align: middle; }
.spark path.line { fill: none; stroke-width: 1.8; }
.spark path.area { opacity: .14; }
.chart { width: 100%; height: 190px; display: block; }
.chart .grid line { stroke: #e7ecf1; }
.chart text { fill: var(--muted); font-size: 11px; }
.chart path.in { stroke: var(--in); fill: none; stroke-width: 2.2; }
.chart path.out { stroke: var(--out); fill: none; stroke-width: 2.2; stroke-dasharray: 5 3; }
.chart path.area-in { fill: var(--in); opacity: .08; }
.keyline { display: inline-flex; align-items: center; gap: .35rem; margin-right: 1rem; font-size: .85rem; color: var(--muted); }
.keyline i { width: 1.4rem; height: 3px; display: inline-block; border-radius: 2px; }
.keyline i.in { background: var(--in); }
.keyline i.out { background: var(--out); }
.bar { height: .5rem; border-radius: 999px; background: #edf1f5; overflow: hidden; min-width: 5rem; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #7a5af5, #a68bff); transition: width .6s ease; }
.bar.warn > span { background: linear-gradient(90deg, #e08a00, #f5b041); }
.bar.bad > span { background: linear-gradient(90deg, #c0261c, #ea5a4f); }
.cellnum { font-variant-numeric: tabular-nums; font-weight: 700; }
.cellsub { color: var(--muted); font-size: .78rem; }
.feedname b { display: block; }
.donut text { font-weight: 800; fill: var(--ink); }
.split { display: grid; grid-template-columns: minmax(16rem, 1fr) 2fr; gap: 1rem; }

/* ---- status card, attention, engines ---- */
.attention { border-left: 5px solid var(--bad); }
.attention h3 { margin: 0 0 .3rem; font-size: 1rem; }
.attention p { margin: .2rem 0; }
.allgood { display: flex; align-items: center; gap: .8rem; border-left: 5px solid var(--ok); }
.allgood .tick { width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--ok-bg); color: var(--ok); display: grid; place-items: center; font-weight: 900; font-size: 1.2rem; }
.status-card { border-left: 6px solid var(--line); }
.status-card.s-ok { border-left-color: var(--ok); }
.status-card.s-bad { border-left-color: var(--bad); }
.status-card.s-warn { border-left-color: var(--warn); }
.status-card h2 { margin-top: 0; }
.engines { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: .9rem; }
.engine { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; box-shadow: var(--shadow); border-top: 4px solid var(--line); }
.engine.s-ok { border-top-color: var(--ok); }
.engine.s-warn { border-top-color: var(--warn); }
.engine.s-bad { border-top-color: var(--bad); }
.engine h3 { margin: 0 0 .35rem; font-size: 1rem; }
.engine .meta { color: var(--muted); font-size: .85rem; margin: .3rem 0; }

/* ---- load test ---- */
.ltbanner { display: flex; align-items: center; gap: .8rem; padding: .55rem 1.4rem; color: #fff; font-weight: 600;
  background: linear-gradient(90deg, #6d3fd6, #1769aa, #0f9d9a, #6d3fd6); background-size: 300% 100%; animation: slide 6s linear infinite; }
.ltbanner a { color: #fff; }
.ltbanner .num { font-variant-numeric: tabular-nums; background: rgba(255, 255, 255, .18); padding: .05rem .5rem; border-radius: 999px; }
.meter { height: .9rem; border-radius: 999px; background: #e6ebf1; overflow: hidden; }
.meter > span { display: block; height: 100%; background: linear-gradient(90deg, var(--in), var(--out)); background-size: 200% 100%; animation: slide 2s linear infinite; transition: width .8s ease; }
.verdict-pass { color: var(--ok); font-weight: 800; }
.verdict-fail { color: var(--bad); font-weight: 800; }

.pager { display: flex; gap: .6rem; align-items: center; margin: .7rem 0; }
.wizard { display: grid; grid-template-columns: 14rem 1fr; gap: 1.2rem; }
.wizard ol { margin: 0; padding-left: 1.2rem; }
.wizard li { margin-bottom: .35rem; color: var(--muted); }
.wizard li.now { color: var(--ink); font-weight: 700; }
.wizard li.done { color: var(--ok); }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 .8rem; }
legend { font-weight: 600; font-size: .9rem; }
.radio { display: flex; gap: .5rem; align-items: baseline; font-weight: 400; margin: .3rem 0; }
.radio input { width: auto; }
.fadein { animation: fade .35s ease; }

@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(23, 128, 61, .55); } 100% { box-shadow: 0 0 0 .7rem rgba(23, 128, 61, 0); } }
@keyframes blink { 50% { opacity: .25; } }
@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.06); } 100% { transform: scale(1); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes slide { from { background-position: 0% 0; } to { background-position: 300% 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (max-width: 860px) { .wizard, .split { grid-template-columns: 1fr; } }
.ltbanner .live { color: #fff; }
.ltbanner .live::before { background: #7fe0d9; }
h2.first { margin-top: 0; }
