/* Shared look for every console page. Page files only add layout. */
:root {
  --bg:#f6f6f4; --surface:#fff; --ink:#1b1c1e; --ink2:#46494e; --muted:#80848b; --line:#e6e5e1;
  --brand:#0f4c41; --brand-2:#0b3d34; --brand-soft:#e7f0ed; --bar:#2f7a6a;
  --ok:#1d7446; --ok-soft:#e8f3ec; --bad:#b3261e; --bad-soft:#fbeceb; --warn:#8a5a00; --warn-soft:#fbf3e2;
}
* { box-sizing:border-box; }
body { margin:0; background:var(--bg); color:var(--ink);
       font:14px/1.55 Inter,"Segoe UI",system-ui,-apple-system,sans-serif; -webkit-font-smoothing:antialiased; }
[hidden] { display:none !important; }

/* top bar */
.top { background:var(--surface); border-bottom:1px solid var(--line); position:sticky; top:0; z-index:20; }
.top-in { max-width:1240px; margin:0 auto; padding:0 28px; height:60px; display:flex; align-items:center; gap:36px; }
.brand { font-weight:700; font-size:17px; letter-spacing:-.02em; color:var(--brand); }
.nav { display:flex; gap:4px; height:100%; }
.nav a { display:flex; align-items:center; padding:0 12px; color:var(--muted); text-decoration:none;
         font-weight:500; border-bottom:2px solid transparent; margin-bottom:-1px; }
.nav a:hover { color:var(--ink); }
.nav a.on { color:var(--ink); border-bottom-color:var(--brand); }
.status { margin-left:auto; display:flex; align-items:center; gap:8px; color:var(--muted); font-size:13px; }
.dot { width:8px; height:8px; border-radius:50%; background:var(--muted); }
.dot.ok { background:var(--ok); } .dot.bad { background:var(--bad); } .dot.warn { background:#d99a00; }

main { max-width:1240px; margin:0 auto; padding:32px 28px 60px; }
.head { display:flex; align-items:flex-end; justify-content:space-between; gap:16px; margin-bottom:22px; flex-wrap:wrap; }
.head h1 { font-size:24px; font-weight:650; letter-spacing:-.02em; margin:0 0 4px; }
.head p { margin:0; color:var(--muted); }
.controls { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }

/* cards */
.card { background:var(--surface); border:1px solid var(--line); border-radius:12px; padding:22px 24px; }
.card h2 { font-size:15px; font-weight:600; margin:0 0 14px; }
.card .cap { font-size:13px; color:var(--muted); margin:-10px 0 16px; }
.card-head { display:flex; justify-content:space-between; align-items:baseline; gap:12px; margin-bottom:14px; }
.card-head h2 { margin:0; }
.card-head a, .card-head .link { font-size:13px; }
.stack > * + * { margin-top:20px; }

/* form */
.field { margin-bottom:16px; }
.field label, .label { display:block; font-size:13px; font-weight:500; color:var(--ink2); margin-bottom:6px; }
.field input, .field select, .field textarea, .input {
  width:100%; height:40px; padding:0 12px; border:1px solid var(--line); border-radius:8px;
  background:var(--surface); color:var(--ink); font:inherit; }
.field textarea { height:auto; min-height:84px; padding:10px 12px; resize:vertical; line-height:1.6; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus {
  outline:none; border-color:var(--brand); box-shadow:0 0 0 3px var(--brand-soft); }
.field.row2 { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.field.row2 > div { min-width:0; }
.hint { font-size:12.5px; color:var(--muted); margin-top:6px; }
.check { display:flex; gap:8px; align-items:center; font-size:13.5px; color:var(--ink2); }
.check input { width:auto; height:auto; accent-color:var(--brand); }
.toggle { display:grid; grid-auto-flow:column; grid-auto-columns:1fr; background:var(--bg); border:1px solid var(--line);
          border-radius:9px; padding:3px; gap:3px; }
.toggle button { height:34px; padding:0 14px; border:0; border-radius:6px; background:transparent; color:var(--ink2);
                 font:inherit; font-weight:500; cursor:pointer; white-space:nowrap; }
.toggle button.on { background:var(--surface); color:var(--ink); box-shadow:0 1px 2px rgba(0,0,0,.08); font-weight:600; }
.toggle.soft { background:var(--surface); }
.toggle.soft button { height:32px; }
.toggle.soft button.on { background:var(--brand-soft); color:var(--brand); box-shadow:none; }

.btn { height:40px; padding:0 18px; border:0; border-radius:8px; background:var(--brand); color:#fff;
       font:inherit; font-weight:600; cursor:pointer; white-space:nowrap; display:inline-flex; align-items:center; justify-content:center; gap:8px; }
.btn:hover:not(:disabled) { background:var(--brand-2); }
.btn:disabled { opacity:.5; cursor:default; }
.btn.full { width:100%; }
.btn.sm { height:34px; padding:0 14px; font-size:13.5px; }
.btn.quiet { background:var(--surface); color:var(--ink2); border:1px solid var(--line); font-weight:500; }
.btn.quiet:hover:not(:disabled) { background:var(--bg); }
.btn.danger { background:var(--surface); color:var(--bad); border:1px solid #efc9c6; font-weight:500; }
.btn.danger:hover:not(:disabled) { background:var(--bad-soft); }
.link { background:none; border:0; padding:0; color:var(--brand); font:inherit; font-size:13px; cursor:pointer; text-decoration:none; font-weight:500; }
.link:hover { text-decoration:underline; }

.note { border-radius:8px; padding:10px 12px; font-size:13px; margin-bottom:14px; display:none; }
.note.show { display:block; } .note.bad { background:var(--bad-soft); color:var(--bad); }
.note.ok { background:var(--ok-soft); color:var(--ok); } .note.live { background:var(--brand-soft); color:var(--brand); }
.pin { display:flex; justify-content:space-between; align-items:center; background:var(--bg);
       border-radius:8px; padding:10px 12px; font-size:13px; color:var(--ink2); }
.pin b { font-variant-numeric:tabular-nums; letter-spacing:.08em; color:var(--ink); font-size:15px; }

.badge { display:inline-block; font-size:12px; font-weight:600; padding:3px 10px; border-radius:99px; background:var(--bg); color:var(--ink2); white-space:nowrap; }
.badge.ok { background:var(--ok-soft); color:var(--ok); } .badge.bad { background:var(--bad-soft); color:var(--bad); }
.badge.warn { background:var(--warn-soft); color:var(--warn); } .badge.live { background:var(--brand-soft); color:var(--brand); }
.badge.outline { background:transparent; border:1px solid var(--line); color:var(--ink2); font-weight:500; }
.empty { text-align:center; color:var(--muted); padding:48px 16px; }
.empty strong { display:block; color:var(--ink2); font-weight:600; margin-bottom:4px; }
.muted { color:var(--muted); }
/* Arabic names inside an English page: keep their own order, keep the column aligned. */
.bidi { unicode-bidi:plaintext; text-align:left; }
.num { font-variant-numeric:tabular-nums; }

/* tables */
table { width:100%; border-collapse:collapse; }
th { text-align:left; font-size:12px; font-weight:500; color:var(--muted); padding:0 12px 10px; border-bottom:1px solid var(--line); }
td { padding:12px; border-bottom:1px solid var(--line); font-size:13.5px; vertical-align:middle; }
tr:last-child td { border-bottom:0; }
tr.row { cursor:pointer; } tr.row:hover td { background:var(--bg); }
td.n { font-variant-numeric:tabular-nums; color:var(--ink2); white-space:nowrap; }

/* steps */
.steps { list-style:none; margin:0; padding:0; }
.steps li { display:grid; grid-template-columns:28px 1fr; gap:12px; position:relative; padding-bottom:16px; }
.steps li:last-child { padding-bottom:0; }
.steps li:not(:last-child)::before { content:""; position:absolute; left:11px; top:26px; bottom:2px; width:2px; background:var(--line); }
.steps li.done:not(:last-child)::before { background:#b9d6c6; }
.mark { width:24px; height:24px; border-radius:50%; border:2px solid var(--line); background:var(--surface);
        display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:700; color:transparent; }
.done .mark { background:var(--ok); border-color:var(--ok); color:#fff; }
.fail .mark { background:var(--bad); border-color:var(--bad); color:#fff; }
.active .mark { border-color:var(--brand); }
.active .mark::after { content:""; width:8px; height:8px; border-radius:50%; background:var(--brand); animation:blink 1.1s infinite; }
@keyframes blink { 50% { opacity:.25; } }
.steps .t { font-weight:500; color:var(--ink2); padding-top:1px; }
.steps .pending .t { color:var(--muted); font-weight:400; }
.steps .d { font-size:13px; color:var(--muted); }

.result { margin-top:20px; border-top:1px solid var(--line); padding-top:16px; }
.result .big { font-size:16px; font-weight:600; }
.ref { display:inline-block; margin-top:8px; font-variant-numeric:tabular-nums; background:var(--bg);
       border-radius:6px; padding:4px 10px; font-size:13px; }
details { margin-top:16px; }
summary { cursor:pointer; color:var(--brand); font-size:13px; font-weight:500; }
.log { margin-top:10px; font-size:13px; max-height:320px; overflow:auto; }
.log div { display:grid; grid-template-columns:56px 1fr; gap:10px; padding:5px 0; border-bottom:1px solid var(--line); }
.log span:first-child { color:var(--muted); font-variant-numeric:tabular-nums; }
.log .fresh { animation:fresh 1.6s ease-out; }
@keyframes fresh { from { background:var(--brand-soft); } to { background:transparent; } }

/* workflow graph */
.graph-wrap { position:relative; }
.graph { width:100%; height:auto; display:block; }
.graph .edge { fill:none; stroke:#d7d6d1; stroke-width:1.6; }
.graph .edge.error { stroke-dasharray:4 4; opacity:.0; }
.graph .edge.taken { stroke:var(--brand); stroke-width:2.6; opacity:1; }
.graph .edge.latest { stroke-dasharray:7 5; animation:flow .7s linear infinite; }
@keyframes flow { to { stroke-dashoffset:-12; } }
.graph .ekey circle { fill:var(--surface); stroke:#d7d6d1; stroke-width:1.2; }
.graph .ekey text { font-size:11px; font-weight:600; fill:var(--muted); text-anchor:middle; dominant-baseline:central; }
.graph .ekey rect { fill:var(--surface); stroke:#d7d6d1; stroke-width:1.2; }
.graph .ekey.taken circle, .graph .ekey.taken rect { fill:var(--brand); stroke:var(--brand); }
.graph .ekey.taken text { fill:#fff; }
.graph .ekey.error { display:none; }
.graph .ekey.error.taken { display:inline; }
.graph .elabel rect { fill:var(--brand); }
.graph .elabel text { font-size:11px; font-weight:600; fill:#fff; dominant-baseline:central; }
.graph .node rect { fill:var(--surface); stroke:#dedcd6; stroke-width:1.2; rx:9; }
.graph .node .kind { font-size:10.5px; fill:var(--muted); }
.graph .node .lab { font-size:12.5px; font-weight:600; fill:var(--ink2); }
.graph .node.pending { opacity:.72; }
.graph .node.visited rect { fill:#f1f7f4; stroke:#9cc7b3; }
.graph .node.visited .lab { fill:var(--ink); }
.graph .node.current rect { fill:var(--brand-soft); stroke:var(--brand); stroke-width:2.2; }
.graph .node.current .lab { fill:var(--brand); }
.graph .node .ring { fill:none; stroke:var(--brand); stroke-width:2; opacity:0; }
.graph .node.current .ring { animation:ring 1.4s ease-out infinite; }
@keyframes ring { 0% { opacity:.55; transform:scale(1); } 100% { opacity:0; transform:scale(1.12); } }
.graph .node.end-ok rect { fill:var(--ok); stroke:var(--ok); } .graph .node.end-ok .lab, .graph .node.end-ok .kind { fill:#fff; }
.graph .node.end-bad rect { fill:var(--bad); stroke:var(--bad); } .graph .node.end-bad .lab, .graph .node.end-bad .kind { fill:#fff; }
.graph .node.end-warn rect { fill:#b7791f; stroke:#b7791f; } .graph .node.end-warn .lab, .graph .node.end-warn .kind { fill:#fff; }
.graph .node.end-live rect { fill:var(--brand); stroke:var(--brand); } .graph .node.end-live .lab, .graph .node.end-live .kind { fill:#fff; }
.graph .node.failed rect { fill:var(--bad-soft); stroke:var(--bad); }
.graph .note-text { font-size:10.5px; fill:var(--brand); font-weight:500; }
.legend { display:flex; gap:16px; font-size:12px; color:var(--muted); margin-top:10px; flex-wrap:wrap; }
.legend i { display:inline-block; width:10px; height:10px; border-radius:3px; margin-right:6px; vertical-align:-1px; border:1px solid #dedcd6; background:var(--surface); }
.legend i.v { background:#f1f7f4; border-color:#9cc7b3; } .legend i.c { background:var(--brand-soft); border-color:var(--brand); }
.legend i.e { background:var(--ok); border-color:var(--ok); }

/* modal and drawer */
.scrim { position:fixed; inset:0; background:rgba(20,22,24,.38); z-index:40; display:flex; align-items:flex-start; justify-content:center; padding:7vh 16px; overflow:auto; }
.modal { background:var(--surface); border-radius:14px; width:100%; max-width:520px; box-shadow:0 20px 50px rgba(0,0,0,.18); }
.modal-head { padding:20px 24px 0; }
.modal-head h3 { margin:0; font-size:17px; font-weight:650; }
.modal-head p { margin:3px 0 0; color:var(--muted); font-size:13px; }
.modal-body { padding:18px 24px 6px; }
.modal-foot { padding:14px 24px 20px; display:flex; justify-content:flex-end; gap:10px; align-items:center; }
.drawer { position:fixed; top:0; right:0; bottom:0; width:min(640px, 100vw); background:var(--surface); z-index:50;
          box-shadow:-12px 0 40px rgba(0,0,0,.14); overflow:auto; padding:24px 26px 40px; }
.drawer-scrim { position:fixed; inset:0; background:rgba(20,22,24,.25); z-index:45; }

.tip { position:fixed; pointer-events:none; background:var(--ink); color:#fff; font-size:12.5px;
       padding:6px 10px; border-radius:6px; display:none; z-index:60; }
.toast { position:fixed; bottom:24px; left:50%; transform:translateX(-50%); background:var(--ink); color:#fff;
         padding:9px 16px; border-radius:8px; font-size:13px; z-index:70; }

/* signed-in user in the top bar */
.who { display:flex; align-items:center; gap:12px; margin-left:18px; font-size:13px; color:var(--muted); }
.who a { color:var(--brand); font-weight:500; text-decoration:none; }
.who a:hover { text-decoration:underline; }
