/* app_tester console
   Dense, information-first. A test studio is read far more than it is clicked, so the
   defaults favour scanning: tabular numerals, tight rows, one accent colour reserved for
   interaction and verdict colour reserved for meaning. */

:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #dfe3e8;
  --border-strong: #c6ccd4;
  --text: #16191d;
  --text-dim: #5b6570;
  --text-faint: #8b95a1;
  --accent: #2f5cff;
  --accent-soft: #e8edff;
  --pass: #0f8a4a;
  --pass-soft: #e3f5ea;
  --fail: #c62f3d;
  --fail-soft: #fdeaec;
  --error: #b4700a;
  --error-soft: #fcf1dd;
  --run: #2f5cff;
  --run-soft: #e8edff;
  --shadow: 0 1px 2px rgba(16, 20, 26, .06), 0 4px 12px rgba(16, 20, 26, .05);
  --radius: 7px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1116;
  --surface: #161b22;
  --surface-2: #1c222b;
  --border: #262d38;
  --border-strong: #38414f;
  --text: #e6edf3;
  --text-dim: #9aa6b4;
  --text-faint: #6e7b8b;
  --accent: #6b8cff;
  --accent-soft: #1b2440;
  --pass: #46c98a;
  --pass-soft: #12291f;
  --fail: #ff6b78;
  --fail-soft: #2c1519;
  --error: #e0a83c;
  --error-soft: #2b2113;
  --run: #6b8cff;
  --run-soft: #1b2440;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .3);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e1116; --surface: #161b22; --surface-2: #1c222b;
    --border: #262d38; --border-strong: #38414f;
    --text: #e6edf3; --text-dim: #9aa6b4; --text-faint: #6e7b8b;
    --accent: #6b8cff; --accent-soft: #1b2440;
    --pass: #46c98a; --pass-soft: #12291f;
    --fail: #ff6b78; --fail-soft: #2c1519;
    --error: #e0a83c; --error-soft: #2b2113;
    --run: #6b8cff; --run-soft: #1b2440;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 18px rgba(0,0,0,.3);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 ui-sans-serif, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
[x-cloak] { display: none !important; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }

/* ── shell ─────────────────────────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: 216px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand {
  padding: 16px 18px 14px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 9px;
}
.brand-mark {
  /* An image now, not a lettermark. object-fit keeps the bird's proportions at every size
     it is used — 30px in the sidebar, 72px on the sign-in screen. */
  width: 30px; height: 30px; flex: none; object-fit: contain;
}
.brand-name { font-weight: 640; letter-spacing: -.01em; }
.brand-sub { font-size: 11px; color: var(--text-faint); }
.nav { padding: 10px 8px; display: flex; flex-direction: column; gap: 1px; flex: 1; overflow-y: auto; }
.nav-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-faint); padding: 12px 10px 5px; font-weight: 600;
}
.nav a {
  display: flex; align-items: center; gap: 9px; padding: 7px 10px;
  border-radius: 6px; color: var(--text-dim); font-weight: 500; font-size: 13.5px;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav .ico { width: 16px; text-align: center; opacity: .85; flex: none; }
.nav-count {
  margin-left: auto; font-size: 11px; background: var(--surface-2);
  border-radius: 20px; padding: 1px 7px; color: var(--text-dim);
}
.sidebar-foot { border-top: 1px solid var(--border); padding: 10px; }
.who { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 6px; }
.who:hover { background: var(--surface-2); }
.avatar {
  width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft);
  color: var(--accent); display: grid; place-items: center;
  font-size: 11px; font-weight: 700; flex: none;
}
.who-name { font-size: 13px; font-weight: 560; line-height: 1.2; }
.who-role { font-size: 11px; color: var(--text-faint); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 52px; border-bottom: 1px solid var(--border); background: var(--surface);
  display: flex; align-items: center; gap: 12px; padding: 0 20px;
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 15.5px; font-weight: 620; margin: 0; letter-spacing: -.01em; }
.topbar .spacer { flex: 1; }
.content { padding: 20px; max-width: 1500px; width: 100%; }

/* ── primitives ────────────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-head {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.card-head h2 { margin: 0; font-size: 13.5px; font-weight: 620; }
.card-body { padding: 16px; }
.grid { display: grid; gap: 14px; }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1100px) { .cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .cols-3, .cols-2 { grid-template-columns: 1fr; }
}

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); border-radius: 6px; font: inherit; font-size: 13px;
  font-weight: 540; cursor: pointer; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); background: var(--accent); }
.btn-danger { color: var(--fail); border-color: var(--border-strong); }
.btn-danger:hover:not(:disabled) { background: var(--fail-soft); }
.btn-sm { padding: 3px 9px; font-size: 12px; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }

input[type=text], input[type=password], input[type=email], input[type=number],
select, textarea {
  width: 100%; padding: 7px 10px; border: 1px solid var(--border-strong);
  border-radius: 6px; background: var(--surface); color: var(--text);
  font: inherit; font-size: 13.5px;
}
textarea { font-family: var(--mono); font-size: 12.5px; line-height: 1.65; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent);
}
label { display: block; font-size: 12px; font-weight: 580; color: var(--text-dim); margin-bottom: 5px; }
.field { margin-bottom: 14px; }
.hint { font-size: 11.5px; color: var(--text-faint); margin-top: 4px; }

.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px;
  border-radius: 20px; font-size: 11.5px; font-weight: 620; letter-spacing: .01em;
  background: var(--surface-2); color: var(--text-dim); white-space: nowrap;
}
.pill.pass    { background: var(--pass-soft);  color: var(--pass); }
.pill.fail    { background: var(--fail-soft);  color: var(--fail); }
.pill.error   { background: var(--error-soft); color: var(--error); }
.pill.running { background: var(--run-soft);   color: var(--run); }
.pill.queued  { background: var(--surface-2);  color: var(--text-dim); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.pill.running .dot { animation: pulse 1.3s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }

table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-faint); font-weight: 640; padding: 8px 14px;
  border-bottom: 1px solid var(--border); background: var(--surface-2);
  position: sticky; top: 0;
}
td { padding: 9px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--surface-2); }
.table-wrap { overflow-x: auto; }

.stat { padding: 14px 16px; }
.stat-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-faint); font-weight: 620;
}
.stat-value { font-size: 26px; font-weight: 660; letter-spacing: -.02em; margin-top: 4px; }
.stat-sub { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }

.empty { padding: 44px 20px; text-align: center; color: var(--text-faint); }
.empty-icon { font-size: 30px; opacity: .4; margin-bottom: 10px; }

.banner {
  padding: 10px 14px; border-radius: 6px; font-size: 13px;
  display: flex; gap: 9px; align-items: flex-start; margin-bottom: 14px;
}
.banner.err  { background: var(--fail-soft);  color: var(--fail); }
.banner.warn { background: var(--error-soft); color: var(--error); }
.banner.ok   { background: var(--pass-soft);  color: var(--pass); }
.banner.info { background: var(--accent-soft); color: var(--accent); }
.banner-body { flex: 1; min-width: 0; }
.banner strong { display: block; margin-bottom: 2px; }

/* ── login ─────────────────────────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 372px; }
.login-head { text-align: center; margin-bottom: 22px; }
.login-head .brand-mark { width: 72px; height: 72px; margin: 0 auto 10px; display: block; }
.login-head h1 { font-size: 19px; margin: 0 0 3px; font-weight: 640; letter-spacing: -.02em; }
.login-head p { margin: 0; color: var(--text-faint); font-size: 13px; }

/* ── run timeline ──────────────────────────────────────────────────────── */
.timeline { display: flex; flex-direction: column; }
.tl-step {
  display: grid; grid-template-columns: 34px 1fr auto; gap: 11px;
  padding: 9px 14px; border-bottom: 1px solid var(--border); align-items: start;
}
.tl-step:last-child { border-bottom: none; }
.tl-n {
  font-family: var(--mono); font-size: 11.5px; color: var(--text-faint);
  text-align: right; padding-top: 2px;
}
.tl-text { min-width: 0; }
.tl-title { font-size: 13.5px; word-break: break-word; }
.tl-assert {
  margin-top: 5px; padding: 6px 9px; border-radius: 5px; background: var(--surface-2);
  font-size: 12.5px; border-left: 2px solid var(--border-strong);
}
.tl-assert.fail { background: var(--fail-soft); border-left-color: var(--fail); }
.tl-assert .k { color: var(--text-faint); font-weight: 600; }
.tl-note { margin-top: 4px; font-size: 12px; color: var(--text-dim); font-style: italic; }

.shots { display: flex; gap: 10px; flex-wrap: wrap; }
.shot {
  width: 132px; border: 1px solid var(--border); border-radius: 6px; overflow: hidden;
  background: var(--surface-2); cursor: zoom-in;
}
.shot img { width: 100%; display: block; aspect-ratio: 9/19.5; object-fit: cover; object-position: top; }
.shot-cap {
  padding: 5px 7px; font-size: 10.5px; color: var(--text-dim);
  border-top: 1px solid var(--border); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lightbox {
  position: fixed; inset: 0; background: rgba(8, 10, 14, .88); z-index: 100;
  display: grid; place-items: center; padding: 28px; cursor: zoom-out;
}
.lightbox img { max-width: 100%; max-height: 92vh; border-radius: 7px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.lightbox-cap {
  position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%);
  color: #fff; font-size: 12.5px; background: rgba(0,0,0,.6); padding: 5px 12px; border-radius: 20px;
}

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(8, 10, 14, .5); z-index: 90;
  display: grid; place-items: center; padding: 20px;
}
.modal { width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; }
.modal.wide { max-width: 980px; }

.toast-stack { position: fixed; bottom: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: 6px; padding: 10px 14px; box-shadow: var(--shadow); min-width: 250px; max-width: 400px;
  font-size: 13px;
}
.toast.err { border-left-color: var(--fail); }
.toast.ok  { border-left-color: var(--pass); }
.toast strong { display: block; margin-bottom: 2px; font-size: 12.5px; }
.toast .msg { color: var(--text-dim); font-size: 12.5px; }

.spinner {
  width: 13px; height: 13px; border: 2px solid var(--border-strong);
  border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.small { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.row { display: flex; align-items: center; gap: 9px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wrap-anywhere { overflow-wrap: anywhere; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag {
  font-size: 11px; padding: 1px 7px; border-radius: 4px;
  background: var(--surface-2); color: var(--text-dim); font-weight: 550;
}
.kv { display: grid; grid-template-columns: minmax(96px, auto) 1fr; gap: 6px 14px; font-size: 13px; }
.kv dt { color: var(--text-faint); font-size: 12px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.progress { height: 4px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); transition: width .3s; }
pre.block {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px;
  padding: 11px 13px; overflow-x: auto; margin: 0;
}
