/* Shared design system — kept byte-identical between webapp/ and
   controlplane/'s static/ dirs. */

:root {
  --ink: #17151f; --ink-soft: #3a3547;
  --paper: #faf9fc; --card-bg: #ffffff; --border: #e5e1ee; --border-soft: #efecf6;
  --muted: #6e6580; --muted-soft: #9891a6;
  --accent: #7c3aed; --accent-2: #9333ea; --accent-soft: #f3e8ff; --accent-line: #dcc9fb;
  --ok: #0ca30c; --ok-bg: #e3f6e2; --ok-line: #bfe8bd;
  --fail: #d03b3b; --fail-bg: #fbe4e4; --fail-line: #f2bdbd;
  --attn: #c2410c; --attn-bg: #ffedd5; --attn-line: #fbcf9d;
  /* Fixed, not themed — --ink itself flips light/dark, so terminal-style
     surfaces (log, code, tooltips) need a background that doesn't. */
  --terminal-bg: #16121f; --terminal-fg: #e5e1f0;
  --skip: #6e6580; --skip-bg: #efedf4; --skip-line: #ddd8ea;
  --shadow: 0 1px 2px rgba(23, 21, 31, .04), 0 8px 24px -12px rgba(23, 21, 31, .14);
  --font-ui: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Roboto Mono", Menlo, Consolas, monospace;

  /* Back-compat aliases: a handful of older component rules below still
     reference these names directly. New rules use the tokens above. */
  --purple: var(--accent); --purple-dark: var(--accent-2);
  --lavender: var(--accent-line); --lavender-bg: var(--accent-soft);
  --bg: var(--paper); --text: var(--ink);
  --ok-text: var(--ok); --leak-bg: var(--fail-bg); --leak-text: var(--fail);
  --warn-bg: var(--attn-bg); --warn-text: var(--attn);
  --skip-text: var(--muted); --info-bg: var(--accent-soft); --info-border: var(--accent-line);
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f1eef7; --ink-soft: #cdc6dd;
    --paper: #131019; --card-bg: #1b1725; --border: #2d2839; --border-soft: #251f30;
    --muted: #a89fbc; --muted-soft: #7b7290;
    --accent: #a875f5; --accent-2: #bf95fa; --accent-soft: #241a3d; --accent-line: #432d6e;
    --ok: #3ecf3e; --ok-bg: #0f2916; --ok-line: #1e5636;
    --fail: #f0605f; --fail-bg: #3a1414; --fail-line: #652222;
    --attn: #fb9a5c; --attn-bg: #3a2210; --attn-line: #6e4419;
    --skip: #a89fbc; --skip-bg: #211d2b; --skip-line: #332c42;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px -12px rgba(0, 0, 0, .5);
  }
}
:root[data-theme="dark"] {
  --ink: #f1eef7; --ink-soft: #cdc6dd;
  --paper: #131019; --card-bg: #1b1725; --border: #2d2839; --border-soft: #251f30;
  --muted: #a89fbc; --muted-soft: #7b7290;
  --accent: #a875f5; --accent-2: #bf95fa; --accent-soft: #241a3d; --accent-line: #432d6e;
  --ok: #3ecf3e; --ok-bg: #0f2916; --ok-line: #1e5636;
  --fail: #f0605f; --fail-bg: #3a1414; --fail-line: #652222;
  --attn: #fb9a5c; --attn-bg: #3a2210; --attn-line: #6e4419;
  --skip: #a89fbc; --skip-bg: #211d2b; --skip-line: #332c42;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px -12px rgba(0, 0, 0, .5);
}
:root[data-theme="light"] {
  --ink: #17151f; --ink-soft: #3a3547;
  --paper: #faf9fc; --card-bg: #ffffff; --border: #e5e1ee; --border-soft: #efecf6;
  --muted: #6e6580; --muted-soft: #9891a6;
  --accent: #7c3aed; --accent-2: #9333ea; --accent-soft: #f3e8ff; --accent-line: #dcc9fb;
  --ok: #0ca30c; --ok-bg: #e3f6e2; --ok-line: #bfe8bd;
  --fail: #d03b3b; --fail-bg: #fbe4e4; --fail-line: #f2bdbd;
  --attn: #c2410c; --attn-bg: #ffedd5; --attn-line: #fbcf9d;
  --skip: #6e6580; --skip-bg: #efedf4; --skip-line: #ddd8ea;
  --shadow: 0 1px 2px rgba(23, 21, 31, .04), 0 8px 24px -12px rgba(23, 21, 31, .14);
}

* { box-sizing: border-box; }
body {
  font-family: var(--font-ui);
  margin: 0; padding: 0;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
code { font-family: var(--font-mono); background: var(--accent-soft); padding: 0.05rem 0.3rem; border-radius: 4px; font-size: 0.85em; }
::selection { background: var(--accent-soft); color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
input[type="text"], input[type="password"], input[type="file"], textarea, select { font-family: inherit; }

/* ---- shell ---- */
.app-shell { display: flex; flex-direction: column; min-height: 100vh; }
.topbar { flex-shrink: 0; padding: 0.85rem 1.5rem; border-bottom: 1px solid var(--border); background: var(--card-bg); display: flex; align-items: center; }
.wordmark { font-size: 1.3rem; font-weight: 800; white-space: nowrap; letter-spacing: -.01em; }
.wm-dark { color: var(--accent); } .wm-light { color: var(--muted-soft); }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: .6rem; font-size: .82rem; }
.topbar-user form { display: flex; align-items: center; gap: .6rem; }
.topbar-user button { background: none; border: none; color: var(--accent); font-weight: 700; cursor: pointer; padding: 0; font-size: .82rem; }

.shell-body { display: flex; flex: 1; min-height: 0; }

.sidebar { width: 216px; flex-shrink: 0; border-right: 1px solid var(--border); background: var(--card-bg); padding: 1.1rem 0.8rem; display: flex; flex-direction: column; }
.sidebar nav { display: flex; flex-direction: column; gap: 0.1rem; }
.nav-section-label, .nav-group-label {
  display: block; font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted-soft); padding: 0.9rem 0.6rem 0.35rem;
}
.nav-section-label:first-child, .nav-group-label:first-of-type { padding-top: 0.1rem; }
.sidebar nav a {
  display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.6rem; border-radius: 8px;
  text-decoration: none; color: var(--ink-soft); font-size: 0.87rem; font-weight: 600; cursor: pointer;
}
.nav-icon, .nav-item .ic { width: 17px; height: 17px; flex-shrink: 0; }
.sidebar nav a:hover { background: var(--border-soft); }
.sidebar nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav-item .count {
  margin-left: auto; font-size: 0.66rem; font-weight: 800; background: var(--accent); color: #fff;
  border-radius: 99px; padding: 0.05rem 0.4rem; font-variant-numeric: tabular-nums;
}
.rail-foot { margin-top: auto; padding-top: .8rem; border-top: 1px solid var(--border-soft); }

.content { flex: 1; min-width: 0; padding: 1.6rem 2rem 4rem; max-width: 1180px; }

@media (max-width: 760px) {
  .shell-body { flex-direction: column; }
  .sidebar { width: auto; border-right: none; border-bottom: 1px solid var(--border); flex-direction: row; flex-wrap: wrap; align-items: center; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .rail-foot { margin-left: auto; margin-top: 0; border-top: none; padding-top: 0; }
}

.project-switcher { margin-bottom: 1rem; }
.project-switcher select {
  width: 100%; padding: 0.4rem 0.6rem; border: 1px solid var(--border); border-radius: 8px;
  font-family: inherit; font-size: 0.83rem; background: var(--paper); color: var(--ink);
}
.muted { color: var(--muted); }

/* ---- page head ---- */
.page-title { margin: 0 0 0.3rem; font-size: 1.45rem; font-weight: 800; letter-spacing: -.015em; text-wrap: balance; }
.page-subtitle { margin: 0 0 1.4rem; font-size: 0.88rem; color: var(--muted); max-width: 58ch; line-height: 1.55; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; flex-wrap: wrap; }

/* ---- generic surfaces ---- */
.card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px;
  padding: 1.15rem 1.35rem; margin-bottom: 1.15rem; box-shadow: var(--shadow);
}
.card h2 { margin-top: 0; margin-bottom: 0.75rem; font-size: 1.02rem; font-weight: 800; }

.feature-card {
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap;
  border-color: var(--accent-line); background: linear-gradient(135deg, var(--card-bg) 60%, var(--accent-soft));
}
.feature-card-text h2 { margin-bottom: 0.25rem; }
.feature-card-text p { margin: 0; color: var(--muted); max-width: 32rem; }
.feature-card-actions { display: flex; align-items: center; gap: 0.75rem; white-space: nowrap; }

.section-title { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 1.75rem 0 0.6rem; display: flex; align-items: center; gap: 0.5rem; }
.section-count { background: var(--skip-bg); color: var(--muted); font-size: 0.68rem; padding: 0.05rem 0.4rem; border-radius: 999px; text-transform: none; letter-spacing: normal; }

.banner { border-radius: 10px; padding: 0.75rem 1rem; margin-bottom: 1.25rem; border: 1px solid var(--accent-line); background: var(--accent-soft); color: var(--ink-soft); }
.banner-error { background: var(--fail-bg); border-color: var(--fail-line); color: var(--fail); }
.banner-warn { background: var(--attn-bg); border-color: var(--attn-line); color: var(--attn); }
.banner-warn ul { margin: 0.4rem 0 0; padding-left: 1.2rem; }
.banner-info { display: flex; align-items: center; gap: 0.5rem; }

.spinner { width: 0.85rem; height: 0.85rem; border: 2px solid var(--accent); border-top-color: transparent; border-radius: 50%; display: inline-block; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner, .pulse-dot { animation: none; } }

/* ---- buttons ---- */
button, .button {
  background: var(--accent); color: #fff; border: none; border-radius: 8px; padding: 0.55rem 1.05rem;
  cursor: pointer; text-decoration: none; display: inline-block; font-size: 0.86rem; font-weight: 700;
  font-family: inherit; transition: background 0.12s;
}
button:hover, .button:hover { background: var(--accent-2); }
button:disabled { background: var(--skip-line); cursor: not-allowed; }
.run-button { margin-top: 0.5rem; align-self: flex-start; }
.link { margin-left: 0.75rem; color: var(--accent); font-size: 0.88rem; }

.btn { border: none; border-radius: 8px; padding: 0.5rem 0.85rem; font-size: 0.82rem; font-weight: 700; cursor: pointer; font-family: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: .4rem; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); }
.btn-ghost { background: var(--border-soft); color: var(--ink-soft); }
.btn-ghost:hover { background: var(--border); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 0.36rem 0.65rem; font-size: 0.76rem; }
.btn-block { width: 100%; justify-content: center; }

/* ---- forms/fields ---- */
details.config { margin: 0.4rem 0; border-top: 1px solid var(--border); padding-top: 0.4rem; }
details.config summary { cursor: pointer; font-size: 0.82rem; color: var(--accent); font-weight: 700; }
.field { display: block; font-size: 0.82rem; margin: 0.55rem 0; }
.field span:first-child { display: block; margin-bottom: 0.2rem; color: var(--ink); font-weight: 600; }
.field input, .field textarea, .field select {
  width: 100%; padding: 0.45rem 0.6rem; border: 1px solid var(--border); border-radius: 8px;
  font-family: inherit; font-size: 0.85rem; background: var(--paper); color: var(--ink);
}
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.field-help, .field-default { display: block; color: var(--muted-soft); font-size: 0.75rem; margin-top: 0.15rem; }
.checkbox-field { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; }

/* ---- status pills / badges ---- */
.pill { font-size: 0.7rem; padding: 0.15rem 0.5rem; border-radius: 999px; white-space: nowrap; font-weight: 700; }
.pill-xlsx { background: var(--ok-bg); color: var(--ok); }
.pill-headless { background: var(--skip-bg); color: var(--muted); }
.pill-error { background: var(--fail-bg); color: var(--fail); }

.status { font-weight: 700; padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.85rem; text-transform: capitalize; }
.status-running { background: var(--accent-soft); color: var(--accent); }
.status-passed { background: var(--ok-bg); color: var(--ok); }
.status-failed, .status-error { background: var(--fail-bg); color: var(--fail); }
.status-queued, .status-unknown { background: var(--skip-bg); color: var(--skip); }
.status-aborted { background: var(--skip-bg); color: var(--muted); text-decoration: line-through; }

/* ---- job / watch page ---- */
.job-meta { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.abort-button { background: none; border: 1px solid var(--fail); color: var(--fail); border-radius: 8px; padding: 0.3rem 0.8rem; font-size: 0.82rem; font-weight: 700; cursor: pointer; }
.abort-button:hover { background: var(--fail-bg); }
.abort-button:disabled { opacity: 0.6; cursor: not-allowed; }

.pulse-dot { width: 8px; height: 8px; border-radius: 99px; background: var(--accent); flex-shrink: 0; display: inline-block; animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .55; transform: scale(.78); } }

.attn-callout { display: flex; gap: 0.8rem; align-items: flex-start; background: var(--attn-bg); border: 1px solid var(--attn-line); border-radius: 12px; padding: 0.9rem 1.05rem; margin-bottom: 1.2rem; }
.attn-callout.pass { background: var(--ok-bg); border-color: var(--ok-line); }
.attn-callout.fail { background: var(--fail-bg); border-color: var(--fail-line); }
.attn-callout .ic { font-size: 1.3rem; line-height: 1; flex-shrink: 0; }
.attn-callout .t { font-weight: 800; color: var(--attn); font-size: 0.92rem; }
.attn-callout.pass .t { color: var(--ok); } .attn-callout.fail .t { color: var(--fail); }
.attn-callout .d { font-size: 0.82rem; color: var(--ink-soft); margin-top: 0.2rem; line-height: 1.5; }

#log {
  background: var(--terminal-bg); color: var(--terminal-fg); padding: 1rem; border-radius: 8px; max-height: 380px;
  overflow-y: auto; white-space: pre-wrap; font-size: 0.82rem; line-height: 1.5; font-family: var(--font-mono);
}

.tab-bar { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; flex-wrap: wrap; }
.tab-btn { background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 0.55rem 0.85rem; font-family: inherit; font-size: 0.85rem; font-weight: 700; color: var(--muted); cursor: pointer; }
.tab-btn:hover { color: var(--ink); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-pane { display: none; position: relative; padding-top: 1.6rem; }
.tab-pane.active { display: block; }
.download-link { position: absolute; top: 0; right: 0; font-size: 0.8rem; color: var(--accent); text-decoration: none; }
.pane-body { padding-top: 0.25rem; }

.artifact-frame { width: 100%; height: 560px; border: 1px solid var(--border); border-radius: 8px; }

.screenshot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.6rem; }
.screenshot-grid img { width: 100%; display: block; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; transition: opacity 0.1s; }
.screenshot-grid img:hover { opacity: 0.85; }

.screenshot-modal { display: none; position: fixed; inset: 0; background: rgba(10, 8, 20, 0.88); z-index: 1000; align-items: center; justify-content: center; padding: 2.5rem; }
.screenshot-modal.open { display: flex; }
.screenshot-modal .modal-scroll { max-width: 90vw; max-height: 82vh; overflow: auto; }
.screenshot-modal img { max-width: 100%; display: block; border-radius: 6px; }
.modal-close, .modal-nav { position: absolute; background: rgba(255, 255, 255, 0.12); color: #fff; border: none; border-radius: 50%; width: 40px; height: 40px; font-size: 1.4rem; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.modal-close:hover, .modal-nav:hover { background: rgba(255, 255, 255, 0.28); }
.modal-close { top: 1.25rem; right: 1.25rem; }
.modal-prev { left: 1.25rem; top: 50%; transform: translateY(-50%); }
.modal-next { right: 1.25rem; top: 50%; transform: translateY(-50%); }
.modal-caption { position: absolute; bottom: 1.25rem; left: 50%; transform: translateX(-50%); color: #fff; font-size: 0.82rem; background: rgba(0, 0, 0, 0.45); padding: 0.3rem 0.9rem; border-radius: 999px; max-width: 80vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.watch-grid { display: grid; grid-template-columns: 1fr 240px; gap: 1.2rem; align-items: start; }
.side-card { padding: 1rem 1.05rem; display: flex; flex-direction: column; gap: 0.7rem; }
.side-card .row { display: flex; justify-content: space-between; font-size: 0.78rem; gap: 0.5rem; }
.side-card .row .k { color: var(--muted); } .side-card .row .v { font-weight: 700; text-align: right; font-family: var(--font-mono); font-size: 0.75rem; }
.side-card hr { border: none; border-top: 1px solid var(--border-soft); margin: 0.1rem 0; }
@media (max-width: 860px) { .watch-grid { grid-template-columns: 1fr; } }

/* ---- active-run strip (shown on any page while a job is running) ---- */
.active-strip { display: flex; align-items: center; gap: 0.7rem; background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent); border-radius: 10px; padding: 0.6rem 0.9rem; font-size: 0.83rem; font-weight: 600; margin-bottom: 1.3rem; flex-wrap: wrap; }
.active-strip .meta { color: var(--ink-soft); font-weight: 500; }
.active-strip a { margin-left: auto; color: var(--accent); font-weight: 700; text-decoration: none; white-space: nowrap; }
.active-strip a:hover { text-decoration: underline; }

/* ---- machine fleet chips (Run page) ---- */
.fleet { display: flex; flex-wrap: wrap; gap: 0.55rem; margin-bottom: 1.5rem; }
.chip { display: flex; align-items: center; gap: 0.5rem; background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px; padding: 0.5rem 0.75rem; font-size: 0.8rem; box-shadow: var(--shadow); }
.dot { width: 8px; height: 8px; border-radius: 99px; flex-shrink: 0; display: inline-block; }
.dot.on { background: var(--ok); } .dot.busy { background: var(--accent); } .dot.off { background: var(--muted-soft); }
.chip .name { font-weight: 700; font-family: var(--font-mono); font-size: 0.78rem; }
.chip .state { color: var(--muted); }
.chip.is-off { opacity: 0.6; }

/* ---- category pills ---- */
.cats { display: flex; gap: 0.4rem; margin-bottom: 1.1rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.cat-pill { border: none; background: none; padding: 0.55rem 0.2rem; margin-right: 1.2rem; font-size: 0.86rem; font-weight: 700; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; position: relative; top: 1px; }
.cat-pill.active { color: var(--accent); border-bottom-color: var(--accent); }
.cat-pill .n { color: var(--muted-soft); font-weight: 600; margin-left: 0.25rem; }
.cat-pill.active .n { color: var(--accent-line); }

/* ---- suite cards (Run page) ---- */
.suite-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); gap: 0.85rem; }
.suite-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 1rem 1.05rem; display: flex; flex-direction: column; gap: 0.55rem; box-shadow: var(--shadow); }
.suite-card .top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
.suite-card-name { font-weight: 700; font-size: 0.94rem; letter-spacing: -.005em; }
.suite-card-desc { color: var(--muted); font-size: 0.8rem; line-height: 1.45; flex: 1; }
.last-run { display: flex; align-items: center; gap: 0.35rem; font-size: 0.71rem; color: var(--muted-soft); }
.last-run .d { width: 6px; height: 6px; border-radius: 99px; flex-shrink: 0; display: inline-block; }
.last-run .d.ok { background: var(--ok); } .last-run .d.fail { background: var(--fail); } .last-run .d.none { background: var(--muted-soft); }
.suite-card-badges { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.suite-card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 0.15rem; gap: .5rem; }
.fields-hint { font-size: 0.72rem; color: var(--muted-soft); }

/* legacy suite-list tree pattern — still used by uploads.html to show a
   project/category tree, kept and reskinned rather than replaced */
.suite-list { background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); }
.suite-row { display: flex; align-items: flex-start; gap: 0.75rem; padding: 0 1rem; border-bottom: 1px solid var(--border); }
.suite-row:last-child { border-bottom: none; }
.suite-check { margin-top: 1.05rem; accent-color: var(--accent); flex-shrink: 0; }
.suite-details { flex: 1; min-width: 0; }
.suite-details summary { cursor: pointer; list-style: none; padding: 0.85rem 0; display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.suite-details summary::-webkit-details-marker { display: none; }
.suite-details summary::before { content: "▸"; color: var(--muted); display: inline-block; transition: transform 0.15s; font-size: 0.8rem; }
.suite-details[open] summary::before { transform: rotate(90deg); }
.suite-name { font-weight: 700; font-size: 0.94rem; }
.suite-badges { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.suite-row:hover { background: var(--border-soft); }
.suite-body { padding: 0 0 1rem; }
.suite-body p { margin: 0 0 0.6rem; font-size: 0.88rem; }
.registry-section { margin-bottom: 1rem; }

/* ---- slide-over configure & run panel ---- */
.overlay { position: fixed; inset: 0; background: rgba(19, 16, 25, .42); display: none; z-index: 40; }
.overlay.open { display: block; }
.panel { position: fixed; top: 0; right: 0; height: 100%; width: min(440px, 92vw); background: var(--card-bg); border-left: 1px solid var(--border); z-index: 41; transform: translateX(100%); transition: transform .22s ease; display: flex; flex-direction: column; box-shadow: -16px 0 40px -18px rgba(23, 21, 31, .35); }
.panel.open { transform: translateX(0); }
.panel-head { padding: 1.1rem 1.2rem; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.panel-head h3 { font-size: 1.02rem; font-weight: 800; margin: 0; }
.panel-head p { margin: .25rem 0 0; font-size: .78rem; color: var(--muted); }
.panel-close { border: none; background: var(--border-soft); width: 26px; height: 26px; border-radius: 99px; color: var(--muted); cursor: pointer; flex-shrink: 0; font-size: .9rem; line-height: 1; }
.panel-body { padding: 1.1rem 1.2rem; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 1rem; }
.panel-foot { padding: 1rem 1.2rem; border-top: 1px solid var(--border); }
.panel-foot .btn { width: 100%; padding: .65rem; font-size: .86rem; }
.panel-foot .note { font-size: .72rem; color: var(--muted-soft); margin-top: .5rem; text-align: center; }
.machine-choice { display: flex; flex-direction: column; gap: .4rem; }
.m-opt { display: flex; align-items: center; gap: .55rem; border: 1px solid var(--border); border-radius: 9px; padding: .5rem .65rem; cursor: pointer; font-size: .82rem; }
.m-opt.selected { border-color: var(--accent); background: var(--accent-soft); }
.m-opt.disabled { opacity: .5; cursor: not-allowed; }
.m-opt .name { font-family: var(--font-mono); font-weight: 700; }
.m-opt .state { margin-left: auto; color: var(--muted); font-size: .74rem; }
.adv-toggle { font-size: .78rem; font-weight: 700; color: var(--muted); background: none; border: none; cursor: pointer; text-align: left; padding: 0; }

.row-delete { background: none; border: 1px solid transparent; color: var(--muted); border-radius: 6px; width: 26px; height: 26px; font-size: 1rem; line-height: 1; cursor: pointer; padding: 0; }
.row-delete:hover { background: var(--fail-bg); color: var(--fail); border-color: var(--fail); }

/* ---- results / history ---- */
.stat-row { display: flex; gap: 0.8rem; margin-bottom: 1.3rem; flex-wrap: wrap; }
.stat { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 0.85rem 1.1rem; min-width: 120px; box-shadow: var(--shadow); }
.stat .num { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; }
.stat .lbl { font-size: 0.72rem; color: var(--muted); font-weight: 600; margin-top: 0.15rem; }
.stat.ok .num { color: var(--ok); } .stat.fail .num { color: var(--fail); } .stat.skip .num { color: var(--muted); }

.history-filters { display: flex; gap: 0.6rem; margin-bottom: 1rem; flex-wrap: wrap; }
.history-filters input, .history-filters select { padding: 0.45rem 0.6rem; border: 1px solid var(--border); border-radius: 8px; font-family: inherit; font-size: 0.83rem; background: var(--card-bg); color: var(--ink); }
.history-filters input { flex: 1; min-width: 180px; }

.batch-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.batch-item { background: var(--card-bg); border: 1px solid var(--border); border-radius: 9px; padding: 0.7rem 1rem; display: flex; align-items: center; justify-content: space-between; }
.batch-item a { color: var(--accent); }

.batch-bar { position: sticky; bottom: 1rem; background: var(--terminal-bg); color: var(--terminal-fg); border-radius: 12px; padding: 0.75rem 1.25rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2); }

.sheet-title { font-size: 0.95rem; margin: 1rem 0 0.4rem; color: var(--accent); font-weight: 700; }
.table-wrap { overflow-x: auto; }
.data-table, table.runs { border-collapse: collapse; width: 100%; font-size: 0.82rem; background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.data-table th, .data-table td, table.runs th, table.runs td { padding: 0.55rem 0.8rem; text-align: left; }
.data-table th, .data-table td { border: 1px solid var(--border); white-space: nowrap; }
.data-table th { background: var(--accent-soft); color: var(--accent-2); position: sticky; top: 0; font-weight: 700; }
.data-table td.ok { background: var(--ok-bg); color: var(--ok); font-weight: 700; }
.data-table td.leak { background: var(--fail-bg); color: var(--fail); font-weight: 800; }
.data-table td.warn { background: var(--attn-bg); color: var(--attn); font-weight: 700; }
.data-table td.skip { background: var(--skip-bg); color: var(--skip); font-style: italic; }

table.runs th { text-align: left; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted-soft); font-weight: 700; border-bottom: 1px solid var(--border); background: none; }
table.runs td { border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
table.runs tr:last-child td { border-bottom: none; }
table.runs tbody tr:hover { background: var(--border-soft); cursor: pointer; }
.run-label a { color: var(--ink); text-decoration: none; font-weight: 700; }
.run-machine { font-family: var(--font-mono); font-size: 0.76rem; color: var(--muted); }
.pill.passed { background: var(--ok-bg); color: var(--ok); }
.pill.failed, .pill.error { background: var(--fail-bg); color: var(--fail); }
.pill.aborted { background: var(--skip-bg); color: var(--muted); text-decoration: line-through; }
.pill.running { background: var(--accent-soft); color: var(--accent); }
.time-cell { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 0.78rem; }

/* ---- machines / fleet management ---- */
.machine-row { display: flex; align-items: center; gap: 0.8rem; padding: 0.8rem 0.95rem; border-bottom: 1px solid var(--border-soft); flex-wrap: wrap; }
.machine-row:last-child { border-bottom: none; }
.machine-row .name { font-family: var(--font-mono); font-weight: 700; font-size: 0.85rem; min-width: 140px; }
.machine-row .meta { font-size: 0.76rem; color: var(--muted); flex: 1; }

.empty-hero { background: var(--card-bg); border: 1px dashed var(--border); border-radius: 14px; padding: 2.2rem 1.8rem; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 0.6rem; }
.empty-hero .ic { width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; margin-bottom: 0.3rem; }
.empty-hero h3 { font-size: 1.05rem; font-weight: 800; margin: 0; }
.empty-hero p { margin: 0; color: var(--muted); font-size: 0.85rem; max-width: 44ch; line-height: 1.55; }

.wizard { max-width: 640px; display: flex; flex-direction: column; gap: 0.9rem; }
.wiz-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.wiz-head { display: flex; align-items: center; gap: 0.65rem; padding: 0.9rem 1.1rem; border-bottom: 1px solid var(--border-soft); }
.wiz-num { width: 22px; height: 22px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 0.72rem; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.wiz-num.done { background: var(--ok); color: #fff; }
.wiz-title { font-size: 0.87rem; font-weight: 800; }
.wiz-body { padding: 1rem 1.1rem 1.15rem; display: flex; flex-direction: column; gap: 0.8rem; }
.wiz-body p { margin: 0; font-size: 0.8rem; color: var(--muted); line-height: 1.55; }
.inline-row { display: flex; gap: 0.55rem; }
.inline-row input[type=text] { flex: 1; border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem 0.65rem; font-size: 0.83rem; background: var(--paper); color: var(--ink); font-family: inherit; }

.token-box { display: flex; align-items: center; gap: 0.6rem; background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 9px; padding: 0.65rem 0.8rem; font-family: var(--font-mono); font-size: 0.78rem; color: var(--accent); }
.token-box .val { flex: 1; overflow-x: auto; white-space: nowrap; }
.copy-btn { border: 1px solid var(--accent-line); background: var(--card-bg); color: var(--accent); border-radius: 7px; padding: 0.3rem 0.55rem; font-size: 0.72rem; font-weight: 700; cursor: pointer; flex-shrink: 0; }
.copy-btn:hover { background: var(--accent-soft); }
.token-warn { font-size: 0.72rem; color: var(--attn); font-weight: 600; }

.os-tabs { display: flex; gap: 0.3rem; }
.os-tab { border: 1px solid var(--border); background: var(--card-bg); color: var(--muted); border-radius: 7px; padding: 0.32rem 0.7rem; font-size: 0.75rem; font-weight: 700; cursor: pointer; }
.os-tab.active { background: var(--terminal-bg); color: var(--terminal-fg); border-color: var(--terminal-bg); }
.cmd-box { display: flex; align-items: center; gap: 0.6rem; background: var(--terminal-bg); color: var(--terminal-fg); border-radius: 9px; padding: 0.7rem 0.85rem; font-family: var(--font-mono); font-size: 0.76rem; }
.cmd-box .val { flex: 1; overflow-x: auto; white-space: nowrap; }
.cmd-box .copy-btn { border-color: #463f5c; background: #241f33; color: #cdc2ee; }

.waiting-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.7rem 0.85rem; background: var(--border-soft); border-radius: 9px; font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.success-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.7rem 0.85rem; background: var(--ok-bg); border: 1px solid var(--ok-line); border-radius: 9px; font-size: 0.82rem; font-weight: 700; color: var(--ok); flex-wrap: wrap; }
.success-row .go { margin-left: auto; }

/* ---- analytics ---- */
.analytics-filter { margin-bottom: 1.25rem; }
.analytics-filter select { padding: 0.4rem 0.6rem; border: 1px solid var(--border); border-radius: 8px; font-family: inherit; font-size: 0.85rem; background: var(--card-bg); color: var(--ink); }

.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 0.75rem; margin-bottom: 1.25rem; }
.stat-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 0.9rem 1rem; display: flex; flex-direction: column; gap: 0.2rem; box-shadow: var(--shadow); }
.stat-value { font-size: 1.5rem; font-weight: 800; }
.stat-value.ok { color: var(--ok); }
.stat-value.leak { color: var(--fail); }
.stat-label { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }

.trend-strip { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.trend-square { width: 18px; height: 18px; border-radius: 5px; display: inline-block; transition: transform 0.1s; }
.trend-square:hover { transform: scale(1.15); }
.trend-passed { background: var(--ok); }
.trend-failed { background: var(--fail); }
.trend-error { background: #991b1b; }
.trend-running { background: var(--attn); }
.trend-aborted { background: var(--muted-soft); }

.suite-bar-cell { width: 140px; }
.suite-bar { background: var(--skip-bg); border-radius: 999px; height: 8px; overflow: hidden; }
.suite-bar-fill { background: var(--ok); height: 100%; }

.failure-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.failure-item { border: 1px solid var(--border); border-radius: 10px; padding: 0.65rem 0.85rem; }
.failure-item-head { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; font-size: 0.88rem; }
.failure-item-head a { color: var(--accent); font-weight: 700; text-decoration: none; }
.failure-item-head a:hover { text-decoration: underline; }
.failure-detail { display: block; margin-top: 0.4rem; font-size: 0.78rem; color: var(--fail); background: var(--fail-bg); padding: 0.4rem 0.6rem; border-radius: 8px; white-space: pre-wrap; word-break: break-word; }

/* ---- 14-day status chart (Analytics) ---- */
.chart-card { padding: 1.2rem 1.3rem 1rem; position: relative; }
.chart-legend { display: flex; gap: 1.1rem; margin-bottom: 0; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 0.4rem; font-size: 0.76rem; color: var(--ink-soft); font-weight: 600; }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart-area { display: flex; gap: 0.6rem; }
.yaxis { display: flex; flex-direction: column; justify-content: space-between; font-size: 0.66rem; color: var(--muted-soft); text-align: right; padding-bottom: 22px; font-variant-numeric: tabular-nums; }
.bars { flex: 1; display: flex; align-items: flex-end; gap: 6px; height: 180px; position: relative; border-bottom: 1px solid var(--border); }
.bars::before, .bars::after { content: ""; position: absolute; left: 0; right: 0; height: 1px; background: var(--border-soft); }
.bars::before { top: 25%; } .bars::after { top: 62.5%; }
.bar-col { flex: 1; height: 100%; cursor: pointer; position: relative; }
.bar-inner { width: 22px; max-width: 70%; margin: 0 auto; height: 100%; display: flex; flex-direction: column-reverse; border-radius: 4px 4px 0 0; overflow: visible; }
.bar-inner .seg { width: 100%; }
.bar-inner .seg.passed { background: var(--ok); }
.bar-inner .seg.failed { background: var(--fail); }
.bar-inner .seg.aborted { background: var(--skip); opacity: .55; }
.bar-inner .seg:first-child { border-radius: 0 0 4px 4px; }
.bar-inner .seg:last-child { border-radius: 4px 4px 0 0; }
.bar-inner .seg + .seg { margin-bottom: 2px; }
.bar-col:hover .seg { filter: brightness(1.08); }
.bar-col:focus-visible .bar-inner { outline: 2px solid var(--accent); outline-offset: 2px; }
.bar-col .xlabel { position: absolute; bottom: -20px; left: 0; right: 0; text-align: center; font-size: 0.62rem; color: var(--muted-soft); font-variant-numeric: tabular-nums; }
.chart-tooltip { position: absolute; background: var(--terminal-bg); color: var(--terminal-fg); border-radius: 9px; padding: 0.55rem 0.7rem; font-size: 0.73rem; pointer-events: none; opacity: 0; transition: opacity .1s; z-index: 5; white-space: nowrap; box-shadow: var(--shadow); }
.chart-tooltip.show { opacity: 1; }
.chart-tooltip .tt-date { font-weight: 700; margin-bottom: .3rem; color: var(--paper); }
.chart-tooltip .tt-row { display: flex; gap: .5rem; align-items: center; }
.chart-tooltip .tt-key { width: 8px; height: 2px; border-radius: 1px; flex-shrink: 0; display: inline-block; }
.chart-tooltip .tt-val { font-weight: 800; font-variant-numeric: tabular-nums; }
.chart-tooltip .tt-lbl { color: #bdb6cc; }
@media (max-width: 760px) { .chart-area { flex-direction: column; } .yaxis { display: none; } }

/* ---- docs / markdown ---- */
.markdown-body { max-width: 760px; line-height: 1.65; }
.markdown-body h1, .markdown-body h2, .markdown-body h3 { color: var(--accent-2); margin-top: 1.75rem; }
.markdown-body h1:first-child, .markdown-body h2:first-child { margin-top: 0; }
.markdown-body a { color: var(--accent); }
.markdown-body code { background: var(--accent-soft); }
.markdown-body pre { background: var(--terminal-bg); color: var(--terminal-fg); padding: 1rem; border-radius: 10px; overflow-x: auto; }
.markdown-body pre code { background: none; color: inherit; padding: 0; }
.markdown-body table { border-collapse: collapse; width: 100%; margin: 1rem 0; font-size: 0.88rem; }
.markdown-body th, .markdown-body td { border: 1px solid var(--border); padding: 0.45rem 0.6rem; text-align: left; }
.markdown-body th { background: var(--accent-soft); color: var(--accent-2); }
.markdown-body hr { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }
.markdown-body blockquote { border-left: 3px solid var(--accent-line); margin: 0; padding-left: 1rem; color: var(--muted); }

.doc-list { display: flex; flex-direction: column; gap: 0.5rem; }
.doc-item { display: flex; align-items: center; gap: 0.7rem; background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px; padding: 0.8rem 1rem; text-decoration: none; color: var(--ink); }
.doc-item:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.doc-item .t { font-weight: 700; font-size: 0.85rem; }
.doc-item .d { font-size: 0.76rem; color: var(--muted); margin-top: 0.1rem; }

/* ---- uploads ---- */
.dropzone { border: 1.5px dashed var(--border); border-radius: 14px; padding: 2.2rem 1.5rem; text-align: center; background: var(--card-bg); display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.dropzone .ic { font-size: 1.6rem; }
.dropzone strong { font-size: 0.9rem; }
.dropzone p { margin: 0; font-size: 0.78rem; color: var(--muted); }

.upload-tree { display: flex; flex-direction: column; gap: 0.4rem; }
.upload-suite { border: 1px solid var(--border); border-radius: 10px; padding: 0.1rem 0.85rem; }
.upload-suite summary { cursor: pointer; padding: 0.6rem 0; font-weight: 700; font-size: 0.88rem; list-style: none; }
.upload-suite summary::-webkit-details-marker { display: none; }
.upload-run-list { list-style: none; margin: 0 0 0.75rem; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.upload-run-head { display: flex; align-items: center; gap: 0.6rem; font-size: 0.85rem; margin-bottom: 0.25rem; }
.upload-run-head a { color: var(--accent); text-decoration: none; font-weight: 700; }
.upload-run-head a:hover { text-decoration: underline; }
.upload-file-list { list-style: none; margin: 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: 0.2rem; }
.upload-file-list li { font-size: 0.83rem; position: relative; }
.upload-file-list li::before { content: "└"; position: absolute; left: -1.05rem; color: var(--border); }
.upload-file-list a { color: var(--ink); }

.file-list { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.file-list li { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.85rem; padding: 0.3rem 0; border-bottom: 1px solid var(--border); }
.file-list li:last-child { border-bottom: none; }
.file-list a { color: var(--accent); text-decoration: none; }
.file-list a:hover { text-decoration: underline; }

/* ---- login (controlplane) ---- */
.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--paper); padding: 1rem; }
.login-card { width: 320px; }
.login-card .page-title { font-size: 1.3rem; }
