/* AURA admin panel. One file, no build step. */
:root {
  --bg: #f5f6f8; --panel: #ffffff; --ink: #1c2330; --muted: #5d6778; --line: #dfe3ea;
  --brand: #2f6fb0; --brand-ink: #ffffff; --ok: #1f7a4d; --ok-bg: #e3f4ea; --warn: #8a5a00; --warn-bg: #fdf1d8;
  --bad: #b3261e; --bad-bg: #fbe5e3; --info-bg: #e6eef8; --code-bg: #f0f2f5; --shadow: 0 1px 2px rgba(20,30,50,.06);
  --radius: 8px; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11151b; --panel: #1a2029; --ink: #e5e9f0; --muted: #9aa4b4; --line: #2c3440;
    --brand: #5b9bd5; --brand-ink: #0c1117; --ok: #6fd19b; --ok-bg: #16301f; --warn: #f0c060; --warn-bg: #33290f;
    --bad: #ff8a80; --bad-bg: #3a1a18; --info-bg: #1b2a3c; --code-bg: #232a35; --shadow: none;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.35rem; margin: 0 0 .25rem; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
h3 { font-size: .95rem; margin: 1rem 0 .5rem; }
p { margin: .4rem 0; }
code, .mono { font-family: var(--mono); font-size: .86em; }
code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; }
small, .muted { color: var(--muted); }

/* Layout */
.shell { display: grid; grid-template-columns: 210px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 16px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; }
/* The AURA mark. It carries its own shape and transparency, so no plate behind it. */
.brand-mark { width: 30px; height: 30px; object-fit: contain; display: block; }
.brand b { display: block; letter-spacing: .08em; }
.brand small { display: block; font-size: .72rem; line-height: 1.1; }
.nav a { display: flex; gap: 10px; align-items: center; padding: 7px 10px; border-radius: 6px; color: var(--ink); }
.nav a:hover { background: var(--bg); text-decoration: none; }
.nav a.on { background: var(--info-bg); color: var(--brand); font-weight: 600; }
.nav .sep { margin: 12px 10px 4px; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.main { min-width: 0; }
.top { display: flex; align-items: center; gap: 12px; padding: 10px 24px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.top .spacer { flex: 1; }
.content { padding: 20px 24px 48px; max-width: 1200px; }
.page-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .spacer { flex: 1; }

/* Status */
.status { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px; border-radius: 999px; font-weight: 600; font-size: .85rem; background: var(--code-bg); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); display: inline-block; }
.status.running .dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.status.paused .dot { background: var(--warn); }
.status.emergency_stop { background: var(--bad-bg); color: var(--bad); }
.status.emergency_stop .dot { background: var(--bad); }
.activity { color: var(--muted); max-width: 46ch; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Cards and grids */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card + .card { margin-top: 16px; }
.grid .card + .card { margin-top: 0; }
.grid + .card, .card + .grid, .grid + .grid, .callout + .grid, .callout + .card { margin-top: 16px; }
.actions select { width: auto; max-width: 100%; }
.stat { font-size: 1.5rem; font-weight: 650; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Badges */
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--code-bg); color: var(--muted); white-space: nowrap; }
.badge.ok, .badge.succeeded, .badge.finished, .badge.done, .badge.delivered { background: var(--ok-bg); color: var(--ok); }
.badge.running, .badge.recording, .badge.in_progress, .badge.claimed, .badge.submitted, .badge.queued, .badge.requested { background: var(--info-bg); color: var(--brand); }
.badge.failed, .badge.stopped, .badge.needs_reconciliation, .badge.report_failed { background: var(--bad-bg); color: var(--bad); }
.badge.skipped, .badge.cancelled, .badge.needs_attention, .badge.waiting_payee, .badge.no_wait, .badge.late { background: var(--warn-bg); color: var(--warn); }

/* Messages */
.msgs { list-style: none; padding: 0; margin: 0 0 16px; }
.msg { padding: 10px 14px; border-radius: 6px; margin-bottom: 8px; background: var(--info-bg); }
.msg.success { background: var(--ok-bg); color: var(--ok); }
.msg.error { background: var(--bad-bg); color: var(--bad); }
.msg.warning { background: var(--warn-bg); color: var(--warn); }
.callout { padding: 10px 14px; border-radius: 6px; background: var(--info-bg); margin: 8px 0; }
.callout.warn { background: var(--warn-bg); color: var(--warn); }
.callout.bad { background: var(--bad-bg); color: var(--bad); }
.callout.ok { background: var(--ok-bg); color: var(--ok); }

/* Forms */
form.inline { display: inline; }
label { display: block; font-weight: 600; margin: 10px 0 4px; }
.check label, label.check { display: flex; gap: 8px; align-items: center; font-weight: normal; }
input[type=text], input[type=password], input[type=url], input[type=number], input[type=email], input:not([type]), select, textarea {
  width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); font: inherit;
}
textarea { font-family: var(--mono); font-size: .88rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
.helptext, .help { display: block; color: var(--muted); font-size: .82rem; margin-top: 2px; font-weight: normal; }
.errorlist { color: var(--bad); list-style: none; padding: 0; margin: 4px 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 16px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; align-items: center; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { text-decoration: none; border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.danger.solid { background: var(--bad); color: #fff; }
.btn.small { padding: 3px 9px; font-size: .82rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* Auth pages */
.auth { max-width: 380px; margin: 10vh auto; }
.auth .card { padding: 24px; }
.qr svg { width: 220px; height: 220px; background: #fff; padding: 8px; border-radius: 8px; }

/* Step editor */
.editor-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.steps { list-style: none; margin: 0; padding: 0; }
.step { border: 1px solid var(--line); border-radius: 6px; margin: 6px 0; background: var(--panel); }
.step-head { display: flex; align-items: center; gap: 8px; padding: 6px 8px; cursor: pointer; }
.step-num { font-family: var(--mono); color: var(--muted); min-width: 2.2em; }
.step-type { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 1px 6px; border-radius: 4px; background: var(--code-bg); color: var(--muted); }
.step-type.checkpoint { background: var(--info-bg); color: var(--brand); }
.step-type.wait_otp, .step-type.fail { background: var(--warn-bg); color: var(--warn); }
.step-desc { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-tools { display: flex; gap: 2px; }
.step-tools button { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 2px 6px; border-radius: 4px; font: inherit; }
.step-tools button:hover { background: var(--bg); color: var(--ink); }
.step-body { padding: 4px 12px 12px; border-top: 1px solid var(--line); display: none; }
.step.open > .step-body { display: block; }
.step-body .fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 12px; }
.branch { margin: 8px 0 0 14px; padding-left: 10px; border-left: 3px solid var(--line); }
.branch > .branch-label { font-size: .75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.problems { margin: 0; padding-left: 18px; color: var(--bad); }
.save-state { color: var(--muted); font-size: .85rem; }
.live-steps { font-family: var(--mono); font-size: .85rem; max-height: 260px; overflow: auto; background: var(--code-bg); padding: 8px; border-radius: 6px; }
.shot { max-width: 100%; border: 1px solid var(--line); border-radius: 6px; margin-top: 6px; }
details summary { cursor: pointer; }

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { display: flex; flex-wrap: wrap; gap: 2px; }
  .nav .sep { display: none; }
  .content, .top { padding-left: 16px; padding-right: 16px; }
}

/* The bank's grid card: 26 small cells, readable at a glance so a missing
   letter is obvious rather than something you find out during a payment. */
.grid-card { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 52px)); gap: 6px; margin: 10px 0 4px; }
.grid-cell { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.grid-letter { font-size: 11px; font-weight: 700; color: var(--muted); }
.grid-cell input { width: 100%; padding: 6px 2px; text-align: center; font-family: ui-monospace, monospace; }
.grid-cell input.on { border-color: var(--brand); }
