/* Same tokens, background and components as the ClipStack gateway (clip-stack/gateway/app/static/panel.html). */
:root {
  --page: #eef1fb; --ink: #1b2140; --muted: #6b7194; --faint: #9aa0bf;
  --glass: rgba(255, 255, 255, .58); --glass-strong: rgba(255, 255, 255, .78); --edge: rgba(255, 255, 255, .85);
  --line: rgba(27, 33, 64, .08); --field: rgba(255, 255, 255, .7); --field-edge: rgba(27, 33, 64, .1);
  --shadow: 0 1px 0 rgba(255, 255, 255, .9) inset, 0 18px 40px -18px rgba(64, 72, 140, .28);
  --blue: #4f6bff; --violet: #8b5cf6; --pink: #ec4899; --green: #14a06a; --red: #e5484d; --amber: #c27a00;
  --blue-soft: rgba(79, 107, 255, .1); --green-soft: rgba(20, 160, 106, .1); --red-soft: rgba(229, 72, 77, .1); --amber-soft: rgba(194, 122, 0, .12);
  --blob-a: #b9c6ff; --blob-b: #d8c3ff; --blob-c: #ffc9e3; --blob-d: #bfeee0;
  --code: rgba(255, 255, 255, .72);
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #0c0f22; --ink: #e8eaf6; --muted: #a0a6c8; --faint: #6e7499;
    --glass: rgba(26, 30, 60, .55); --glass-strong: rgba(30, 35, 70, .8); --edge: rgba(255, 255, 255, .09);
    --line: rgba(255, 255, 255, .07); --field: rgba(10, 13, 32, .5); --field-edge: rgba(255, 255, 255, .1);
    --shadow: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 18px 40px -18px rgba(0, 0, 0, .6);
    --blue: #7d93ff; --violet: #a78bfa; --pink: #f472b6; --green: #3ccf91; --red: #ff6b70; --amber: #f0b44c;
    --blue-soft: rgba(125, 147, 255, .14); --green-soft: rgba(60, 207, 145, .13); --red-soft: rgba(255, 107, 112, .14); --amber-soft: rgba(240, 180, 76, .14);
    --blob-a: #2a3a9e; --blob-b: #4b2a8f; --blob-c: #7a2559; --blob-d: #135a4c;
    --code: rgba(8, 10, 26, .6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--page); }
body { margin: 0; min-height: 100vh; background: var(--page); color: var(--ink);
       font: 14px/1.5 "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
p { margin: 0; }
h1 { font-size: 30px; line-height: 1.15; font-weight: 800; letter-spacing: -.02em; margin: 0 0 6px; }
h2 { font-size: 17px; font-weight: 700; letter-spacing: -.01em; margin: 0; }
code { font-family: var(--mono); font-size: 12px; background: var(--blue-soft); color: var(--blue); padding: 1px 6px; border-radius: 6px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* Animated background: slow-drifting colour blobs and a few glass bubbles. */
.bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .75; will-change: transform; }
.blob.a { width: 46vw; height: 46vw; left: -10vw; top: -14vw; background: var(--blob-a); animation: drift-a 26s ease-in-out infinite alternate; }
.blob.b { width: 40vw; height: 40vw; right: -8vw; top: 4vh; background: var(--blob-b); animation: drift-b 32s ease-in-out infinite alternate; }
.blob.c { width: 36vw; height: 36vw; right: 12vw; bottom: -14vw; background: var(--blob-c); animation: drift-c 38s ease-in-out infinite alternate; }
.blob.d { width: 30vw; height: 30vw; left: 8vw; bottom: -6vw; background: var(--blob-d); animation: drift-d 44s ease-in-out infinite alternate; }
.bubble { position: absolute; border-radius: 50%; border: 1px solid var(--edge);
          background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, .55), rgba(255, 255, 255, .06) 60%);
          backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); will-change: transform; }
.bubble.one { width: 120px; height: 120px; left: 6vw; top: 38vh; animation: float 18s ease-in-out infinite alternate; }
.bubble.two { width: 64px; height: 64px; right: 9vw; top: 30vh; animation: float 14s ease-in-out -4s infinite alternate; }
.bubble.three { width: 180px; height: 180px; right: 3vw; bottom: 8vh; animation: float 24s ease-in-out -9s infinite alternate; }
@keyframes drift-a { to { transform: translate(14vw, 10vh) scale(1.15); } }
@keyframes drift-b { to { transform: translate(-12vw, 16vh) scale(.9); } }
@keyframes drift-c { to { transform: translate(-16vw, -12vh) scale(1.2); } }
@keyframes drift-d { to { transform: translate(18vw, -10vh) scale(1.1); } }
@keyframes float { to { transform: translate(24px, -40px) rotate(20deg); } }

/* Layout */
.nav, main { position: relative; z-index: 1; }
.nav { max-width: 1180px; margin: 0 auto; padding: 18px 16px 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; letter-spacing: -.01em; color: var(--ink); }
.brand:hover { text-decoration: none; }
.nav nav { display: flex; align-items: center; gap: 4px; }
.nav form { margin: 0; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 26px 16px 72px; }
.wide { max-width: 1600px; margin: 0 auto; padding: 22px 16px 48px; }
body[data-page=run] .nav { max-width: 1600px; }
.center { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }

.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 22px; }
.top > div:first-child { flex: 1 1 380px; min-width: 0; }
.top .lead { color: var(--muted); max-width: 60ch; }
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.crumb a { color: var(--muted); font-weight: 600; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.actions.end { justify-content: flex-end; }

.card { background: var(--glass); border: 1px solid var(--edge); border-radius: 22px; box-shadow: var(--shadow);
        backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4); }
section.card, form.card { padding: 22px; margin-bottom: 18px; }
.head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.head .grow { flex: 1; min-width: 0; }
.head p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid2 > .card { margin-bottom: 0; }

.tile { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; color: #fff; flex: none;
        background: linear-gradient(135deg, var(--blue), var(--violet)); box-shadow: 0 8px 18px -8px var(--violet); }
.tile.sm { width: 32px; height: 32px; border-radius: 10px; }
.tile.sm .i { width: 16px; height: 16px; }
.tile.pink { background: linear-gradient(135deg, var(--violet), var(--pink)); box-shadow: 0 8px 18px -8px var(--pink); }
.tile.green { background: linear-gradient(135deg, var(--green), #5fd3a6); box-shadow: 0 8px 18px -8px var(--green); }
.tile.amber { background: linear-gradient(135deg, #f59e0b, #f472b6); box-shadow: 0 8px 18px -8px #f59e0b; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 2px 14px; padding: 16px 18px; }
.stat .tile { grid-row: span 2; }
.stat .label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.stat .value { font-size: 24px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.stat .value small { font-size: 12px; font-weight: 600; color: var(--faint); margin-left: 6px; letter-spacing: 0; }

/* Buttons */
button, .btn { text-decoration: none; font: inherit; font-weight: 600; font-size: 13px; color: var(--ink); background: var(--glass-strong);
               border: 1px solid var(--field-edge); border-radius: 11px; padding: 7px 13px; cursor: pointer; display: inline-flex; align-items: center;
               gap: 6px; white-space: nowrap; transition: transform .12s, box-shadow .15s, border-color .15s, background .15s, color .15s; }
button:hover:not(:disabled), .btn:hover { border-color: var(--blue); text-decoration: none; }
button:active:not(:disabled), .btn:active { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: default; }
button .i, .btn .i { width: 15px; height: 15px; }
button.icon, .btn.icon { padding: 7px; }
button.danger:hover:not(:disabled), .btn.danger:hover { border-color: var(--red); color: var(--red); }
button.primary, .btn.primary { color: #fff; border: 0; padding: 9px 18px; border-radius: 13px;
                               background: linear-gradient(135deg, var(--blue), var(--violet)); box-shadow: 0 10px 22px -10px var(--violet); }
button.primary:hover:not(:disabled), .btn.primary:hover { box-shadow: 0 12px 26px -8px var(--violet); }
button.primary.sm, .btn.primary.sm { padding: 7px 13px; border-radius: 11px; }
button.go, .btn.go { color: #fff; border: 0; background: linear-gradient(135deg, var(--green), #2bb88a); box-shadow: 0 10px 22px -10px var(--green); }
button.ghost, .btn.ghost { background: none; border-color: transparent; color: var(--muted); }
button.ghost:hover, .btn.ghost:hover { background: var(--glass-strong); border-color: var(--edge); color: var(--ink); }
.btn.ghost.on { background: var(--glass-strong); border-color: var(--edge); color: var(--ink); }
button.link { background: none; border: 0; padding: 0; color: var(--muted); font-weight: 600; }
button.link:hover:not(:disabled) { color: var(--red); }

/* Fields */
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.field { position: relative; display: flex; }
.field > .i { position: absolute; left: 12px; top: 11px; width: 16px; height: 16px; color: var(--faint); }
input, select, textarea { font: inherit; font-size: 13.5px; font-weight: 500; color: var(--ink); width: 100%;
                          background: var(--field); border: 1px solid var(--field-edge); border-radius: 12px; padding: 9px 12px;
                          transition: border-color .15s, box-shadow .15s; }
.field > input { padding-left: 36px; }
input::placeholder, textarea::placeholder { color: var(--faint); font-weight: 400; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px var(--blue-soft); }
select { width: auto; cursor: pointer; padding-right: 30px; appearance: none; -webkit-appearance: none;
         background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
         background-position: right 14px top 52%, right 9px top 52%; background-size: 5px 5px; background-repeat: no-repeat; }
select option { background: var(--page); color: var(--ink); }
textarea { resize: vertical; font-family: var(--mono); font-size: 12.5px; }
input[type=file] { padding: 7px; }
input[type=checkbox] { appearance: none; -webkit-appearance: none; width: 34px; height: 20px; padding: 0; margin: 0; flex: none; cursor: pointer;
                       border-radius: 999px; background: var(--field-edge); border: 0; position: relative; transition: background .2s; }
input[type=checkbox]::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
                              background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
input[type=checkbox]:checked { background: linear-gradient(135deg, var(--blue), var(--violet)); }
input[type=checkbox]:checked::after { transform: translateX(14px); }
label.check { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; }

/* Status badges, language tags */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 700;
         background: var(--glass-strong); border: 1px solid var(--edge); color: var(--muted); white-space: nowrap; text-transform: capitalize; }
a.badge:hover { text-decoration: none; border-color: currentColor; }
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.badge.passed { color: var(--green); background: var(--green-soft); border-color: transparent; }
.badge.failed, .badge.error, .badge.timeout { color: var(--red); background: var(--red-soft); border-color: transparent; }
.badge.running, .badge.queued { color: var(--amber); background: var(--amber-soft); border-color: transparent; }
.badge.running::before { animation: pulse 1.2s ease-in-out infinite; }
.badge.big { font-size: 13px; padding: 6px 14px; }
@keyframes pulse { 50% { opacity: .25; transform: scale(.7); } }
.tag { display: inline-flex; align-items: center; padding: 1px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
       background: var(--blue-soft); color: var(--blue); }
.tag.ts { background: var(--blue-soft); color: var(--violet); }
.tag.py { background: var(--green-soft); color: var(--green); }

/* Tests table */
.scroll { overflow-x: auto; margin: 0 -6px; padding: 0 6px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--faint); padding: 0 10px 10px; white-space: nowrap; }
td { padding: 12px 10px; border-top: 1px solid var(--line); vertical-align: middle; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: rgba(255, 255, 255, .25); }
td.num span { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 9px; background: var(--blue-soft); color: var(--blue); font-weight: 700; font-size: 12px; }
.tname { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tname a { color: var(--ink); font-weight: 700; }
.lastrun { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.empty { text-align: center; padding: 34px 12px 26px; }
.empty .tile { margin: 0 auto 12px; width: 52px; height: 52px; border-radius: 16px; }
.empty b { display: block; font-size: 15px; margin-bottom: 4px; }
.empty p { color: var(--muted); max-width: 52ch; margin: 0 auto 16px; }

/* Editor */
.editor-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.title-input { flex: 1 1 260px; min-width: 0; font-size: 19px; font-weight: 800; letter-spacing: -.01em; background: none; border-color: transparent; padding: 6px 10px; }
.title-input:hover { border-color: var(--field-edge); }
.editor .CodeMirror { height: 50vh; min-height: 280px; border: 1px solid var(--field-edge); border-radius: 14px; background: var(--code); color: var(--ink);
                      font: 13px/1.6 var(--mono); }
.editor .CodeMirror-focused { border-color: var(--blue); box-shadow: 0 0 0 4px var(--blue-soft); }
.editor .CodeMirror-gutters { background: transparent; border-right: 1px solid var(--line); border-radius: 14px 0 0 14px; }
.editor .CodeMirror-linenumber { color: var(--faint); }
.editor .CodeMirror-cursor { border-left: 2px solid var(--blue); }
.editor .CodeMirror-selected, .editor .CodeMirror-focused .CodeMirror-selected { background: var(--blue-soft); }
.CodeMirror.cm-s-default .cm-keyword { color: var(--violet); font-weight: 500; }
.CodeMirror.cm-s-default .cm-string, .CodeMirror.cm-s-default .cm-string-2 { color: var(--green); }
.CodeMirror.cm-s-default .cm-def, .CodeMirror.cm-s-default .cm-variable-2, .CodeMirror.cm-s-default .cm-variable-3, .CodeMirror.cm-s-default .cm-type { color: var(--blue); }
.CodeMirror.cm-s-default .cm-number, .CodeMirror.cm-s-default .cm-atom { color: var(--pink); }
.CodeMirror.cm-s-default .cm-comment { color: var(--faint); font-style: italic; }
.CodeMirror.cm-s-default .cm-property, .CodeMirror.cm-s-default .cm-variable, .CodeMirror.cm-s-default .cm-operator { color: var(--ink); }
.hint { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--muted); margin-top: 12px; line-height: 1.6; }
.hint .i { width: 16px; height: 16px; margin-top: 2px; color: var(--blue); }

/* Files and runs lists */
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.rows li:first-child { border-top: 0; padding-top: 2px; }
.rows .fic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); flex: none; }
.rows .fic .i { width: 15px; height: 15px; }
.fname { font-family: var(--mono); font-size: 12.5px; word-break: break-all; }
.rows .row-actions { margin-left: auto; display: flex; gap: 6px; }
.rows .row-actions button { padding: 5px 10px; font-size: 12px; }
.rows a.rid { font-weight: 700; color: var(--ink); min-width: 38px; }
.rows .when { margin-left: auto; font-size: 12px; color: var(--faint); }
.none { color: var(--muted); padding: 6px 0; }
.foot-link { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }

/* Run page */
.runview { display: grid; grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr); gap: 18px; align-items: start; }
.panel { overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.panel-head b { font-size: 14px; }
.panel-head .grow { flex: 1; min-width: 0; font-size: 12.5px; color: var(--amber); font-weight: 600; }
.frame { padding: 10px; }
#vnc { width: 100%; aspect-ratio: 1280 / 800; border: 0; border-radius: 12px; background: #05060f; display: block; }
.log { margin: 0; padding: 14px 16px; min-height: 260px; max-height: 58vh; overflow: auto; background: var(--code);
       font: 12px/1.55 var(--mono); white-space: pre-wrap; word-break: break-word; color: var(--ink); }
.artifacts { padding: 14px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.artifacts p { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.artifacts a { font-weight: 600; }
.artifacts video { width: 100%; border-radius: 12px; background: #000; }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.shots img { width: 100%; border-radius: 10px; border: 1px solid var(--edge); display: block; }

/* Login */
.login { width: 100%; max-width: 410px; padding: 34px 30px 28px; display: grid; gap: 14px; animation: rise .6s cubic-bezier(.2, .8, .2, 1) both; }
.login .tile { width: 56px; height: 56px; border-radius: 17px; margin: 0 auto 2px; }
.login .tile .i { width: 26px; height: 26px; }
.login h1 { font-size: 23px; text-align: center; margin: 0; }
.login .lead { color: var(--muted); text-align: center; margin: -8px 0 6px; }
.login .field > input { padding: 11px 44px 11px 40px; font-size: 14.5px; border-radius: 13px; }
.login .field > .i { left: 13px; top: 13px; width: 17px; height: 17px; }
.login button.primary { width: 100%; justify-content: center; font-size: 15px; font-weight: 700; padding: 12px 18px; border-radius: 14px; margin-top: 4px; }
.reveal { position: absolute; right: 6px; top: 6px; width: 32px; height: 32px; border: 0; border-radius: 9px; background: none;
          color: var(--faint); display: grid; place-items: center; padding: 0; }
.reveal:hover:not(:disabled) { color: var(--ink); background: var(--blue-soft); }
.reveal .i { width: 17px; height: 17px; }
.error { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--red-soft); color: var(--red);
         font-weight: 600; font-size: 13px; animation: shake .35s; }
.foot { text-align: center; color: var(--faint); font-size: 12px; }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98); } }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* Settings */
.narrow { max-width: 480px; }
.stack { display: grid; gap: 14px; }

/* Dialog */
.dialog { width: min(720px, calc(100% - 32px)); padding: 22px; border: 1px solid var(--edge); border-radius: 22px; color: var(--ink);
          background: var(--glass-strong); box-shadow: var(--shadow); backdrop-filter: blur(24px) saturate(1.4); -webkit-backdrop-filter: blur(24px) saturate(1.4); }
.dialog::backdrop { background: rgba(12, 15, 34, .45); backdrop-filter: blur(3px); }
.dialog form { display: grid; gap: 14px; }
.dialog .head { margin-bottom: 4px; }
.dialog textarea { min-height: 260px; background: var(--code); }

/* Toast */
#toast { position: fixed; z-index: 10; bottom: 20px; left: 50%; transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
         padding: 10px 18px; border-radius: 14px; font-weight: 600; background: var(--ink); color: var(--page); max-width: 90vw;
         box-shadow: 0 16px 30px -12px rgba(0, 0, 0, .4); transition: opacity .2s, transform .2s; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--red); color: #fff; }

@media (prefers-reduced-motion: reduce) { .blob, .bubble, .login, .error, .badge.running::before { animation: none; } }
@media (max-width: 980px) {
  .runview, .grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .wrap, .wide { padding-top: 18px; }
  h1 { font-size: 24px; }
  .stats { grid-template-columns: 1fr; }
  section.card, form.card { padding: 16px; border-radius: 18px; }
  .nav nav span { display: none; }
  .bubble { display: none; }
  .login { padding: 28px 20px 22px; border-radius: 22px; }
  th:nth-child(1), td.num { display: none; }
}
