:root {
  --bg: #f1f5f9;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --fg: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --pass: #16a34a;
  --fail: #dc2626;
  --warn: #d97706;
  --heal: #7c3aed;
  --field: #ffffff;
  --code: #f1f5f9;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px 0 rgb(15 23 42 / 0.05);
  --shadow-md: 0 4px 12px -2px rgb(15 23 42 / 0.08), 0 2px 6px -2px rgb(15 23 42 / 0.04);
  --shadow-lg: 0 20px 36px -8px rgb(15 23 42 / 0.16), 0 8px 16px -6px rgb(15 23 42 / 0.08);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #090d16;
    --panel: #111827;
    --panel-2: #161f33;
    --fg: #f1f5f9;
    --muted: #94a3b8;
    --line: #1e293b;
    --line-strong: #334155;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --pass: #4ade80;
    --fail: #f87171;
    --warn: #fbbf24;
    --heal: #a78bfa;
    --field: #0b1120;
    --code: #1e293b;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 14px -2px rgb(0 0 0 / 0.45);
    --shadow-lg: 0 24px 48px -12px rgb(0 0 0 / 0.65);
  }
}

:root[data-theme="dark"] {
  --bg: #090d16;
  --panel: #111827;
  --panel-2: #161f33;
  --fg: #f1f5f9;
  --muted: #94a3b8;
  --line: #1e293b;
  --line-strong: #334155;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --pass: #4ade80;
  --fail: #f87171;
  --warn: #fbbf24;
  --heal: #a78bfa;
  --field: #0b1120;
  --code: #1e293b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  display: flex;
  min-height: 100vh;
  font: 14px/1.5 "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
}

/* Hide main app workspace when unauthenticated */
body.unauthenticated #sidebar,
body.unauthenticated main,
body.unauthenticated #detail {
  display: none !important;
}

body:not(.unauthenticated) #authScreen {
  display: none !important;
}

/* ==========================================================================
   Full-Screen Login / Auth Page
   ========================================================================== */

.auth-screen {
  flex: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  background:
    radial-gradient(circle at 15% 20%, color-mix(in srgb, var(--accent) 16%, transparent) 0%, transparent 45%),
    radial-gradient(circle at 85% 80%, color-mix(in srgb, var(--heal) 14%, transparent) 0%, transparent 45%),
    var(--bg);
}

.auth-shell {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.95fr;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.auth-Showcase {
  padding: 44px 40px;
  background: linear-gradient(145deg, #1e1b4b 0%, #312e81 55%, #1e293b 100%);
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.brand-mark {   /* the Qritly logo (static/img/logo-128.png, made by scripts/make_logos.py) */
  display: block;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgb(99 102 241 / 0.4);
  flex-shrink: 0;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-sub {
  font-size: 12px;
  color: #cbd5e1;
}

.auth-Showcase h2 {
  font-size: 26px;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
}

.auth-lead {
  font-size: 14px;
  line-height: 1.6;
  color: #cbd5e1;
  margin: 0 0 28px;
}

.auth-features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-features li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgb(255 255 255 / 0.06);
  border: 1px solid rgb(255 255 255 / 0.1);
  border-radius: 12px;
  padding: 12px 14px;
}

.auth-features .feat-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgb(255 255 255 / 0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.auth-features strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 2px;
}

.auth-features span {
  font-size: 12px;
  color: #cbd5e1;
}

.auth-features code {
  background: rgb(0 0 0 / 0.3);
  color: #e2e8f0;
}

.auth-card {
  padding: 44px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--panel);
}

.auth-card-head {
  margin-bottom: 24px;
}

.auth-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 999px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--line));
  margin-bottom: 12px;
}

.auth-card-head h3 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}

.auth-card-head p {
  margin: 0;
  font-size: 13px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg);
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.auth-link {
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
}

.auth-link:hover {
  text-decoration: underline;
}

.auth-form input {
  height: 40px;
  padding: 8px 12px;
  font-size: 14px;
  border-radius: var(--radius-sm);
}

.auth-submit {
  height: 42px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  margin-top: 4px;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 35%, transparent);
}

.auth-alert {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
}

.auth-alert.error {
  color: var(--fail);
  background: color-mix(in srgb, var(--fail) 10%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--fail) 30%, var(--line));
}

.auth-alert.ok {
  color: var(--pass);
  background: color-mix(in srgb, var(--pass) 10%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--pass) 30%, var(--line));
}

.auth-card-foot {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.5;
}

/* ==========================================================================
   Form Controls, Buttons & Code
   ========================================================================== */

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 13px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 140ms ease;
  box-shadow: var(--shadow-sm);
}

button:hover:not(:disabled) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 4%, var(--panel));
}

button:disabled {
  opacity: 0.5;
  cursor: default;
  box-shadow: none;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  font-weight: 600;
}

button.primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

button.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  justify-content: flex-start;
  text-align: left;
  box-shadow: none;
  padding: 7px 10px;
}

button.ghost:hover:not(:disabled) {
  background: var(--panel-2);
  color: var(--fg);
  border-color: transparent;
}

button.danger {
  color: var(--fail);
  border-color: color-mix(in srgb, var(--fail) 35%, var(--line));
}

button.danger:hover:not(:disabled) {
  background: color-mix(in srgb, var(--fail) 10%, var(--panel));
  border-color: var(--fail);
}

button.small {
  padding: 4px 9px;
  font-size: 12px;
  border-radius: 6px;
}

button.icon-btn {
  padding: 6px 9px;
}

input, select, textarea {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--field);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

code, pre {
  background: var(--code);
  border-radius: 6px;
  font: 12px/1.45 "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

code { padding: 2px 5px; }
pre { padding: 10px 12px; overflow: auto; max-height: 260px; white-space: pre-wrap; word-break: break-all; border: 1px solid var(--line); }
.muted { color: var(--muted); }

/* ==========================================================================
   Sidebar Navigation
   ========================================================================== */

#sidebar {
  width: 248px;
  flex-shrink: 0;
  padding: 18px 14px;
  border-right: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 6px 12px;
}

#sidebar h1 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.2;
}

.brand-caption {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.ws-box {
  position: relative;
  padding: 10px 10px 10px 10px;
  margin-bottom: 6px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.ws-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.ws-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  display: inline-block;
  margin: 0;
  line-height: 1.2;
}

.ws-settings-btn {
  margin-left: auto;
  padding: 2px 6px;
  font-size: 13px;
  line-height: 1;
  border-radius: 6px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  flex-shrink: 0;
}

.ws-settings-btn:hover:not(:disabled) {
  background: var(--panel);
  color: var(--fg);
  border-color: var(--line);
}

.ws-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.ws-row select {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 500;
}

.nav-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 6px 8px 2px;
}

#folders {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#folders a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: inherit;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background 120ms ease, color 120ms ease;
}

#folders a:hover {
  background: var(--panel-2);
}

#folders a.active {
  background: var(--accent);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 6px color-mix(in srgb, var(--accent) 30%, transparent);
}

#folders a .count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  background: color-mix(in srgb, currentColor 12%, transparent);
  opacity: 0.85;
}

#folders a .fa {
  display: none;
  padding: 1px 4px;
  border: 0;
  background: transparent;
  box-shadow: none;
  font-size: 12px;
  line-height: 1;
  color: inherit;
  opacity: 0.85;
}
#folders a .fa:first-of-type { margin-left: auto; }
#folders a .fa:hover:not(:disabled) {
  opacity: 1;
  background: color-mix(in srgb, currentColor 14%, transparent);
}
#folders a .fa:disabled,
#folders a .fa.disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
#folders a:hover .fa { display: inline-flex; }
#folders a:hover .count { display: none; }
#folders a .fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 4px;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.account-btn {
  font-weight: 600;
  color: var(--fg) !important;
}

/* ==========================================================================
   Main Content, Toolbar & Table
   ========================================================================== */

main {
  flex: 1;
  min-width: 0;
  padding: 22px 26px;
  overflow-x: auto;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.toolbar-left, .toolbar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.toolbar h2 {
  margin: 0 8px 0 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.toolbar .spacer { flex: 1; }

.opt {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.opt-check {
  padding: 5px 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

#search {
  width: 260px;
}

.actionbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 14px;
  margin-bottom: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
  box-shadow: var(--shadow-sm);
}

.actionbar label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 500;
}

.actionbar select { padding: 4px 8px; }
.danger-text { color: var(--fail); }

.table-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
}

th, td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 600;
  background: var(--panel-2);
}

tr:last-child td { border-bottom: none; }
tbody tr { cursor: pointer; transition: background 100ms ease; }
tbody tr:hover { background: var(--panel-2); }
tbody tr.open {
  background: color-mix(in srgb, var(--accent) 6%, var(--panel));
  box-shadow: inset 3px 0 0 var(--accent);
}

td.cb, th.cb { width: 36px; text-align: center; }
.tname { font-weight: 600; color: var(--fg); }
.tdesc {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

td:nth-child(6) { min-width: 170px; }
td:nth-child(7) { white-space: nowrap; }

.empty-state {
  padding: 28px 20px;
  text-align: center;
  margin: 0;
}

/* ==========================================================================
   Badges & Run Jobs
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: 1px solid color-mix(in srgb, currentColor 28%, transparent);
  background: color-mix(in srgb, currentColor 10%, var(--panel));
}

.badge.passed { color: var(--pass); }
.badge.failed, .badge.error { color: var(--fail); }
.badge.never, .badge.stopped { color: var(--muted); }
.badge.running { color: var(--accent); }
.badge.healed { color: var(--heal); }

.when {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
}

#jobs .job {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 10px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

#jobs .job.done { border-color: var(--pass); }
#jobs .job.error { border-color: var(--fail); }
#jobs .job .x { margin-left: auto; }
#jobs pre { margin: 6px 0 0; max-height: 160px; }

/* ==========================================================================
   Detail Drawer & Step Editor
   ========================================================================== */

#detail {
  width: 500px;
  flex-shrink: 0;
  border-left: 1px solid var(--line);
  background: var(--panel);
  padding: 20px;
  overflow: auto;
  max-height: 100vh;
  position: sticky;
  top: 0;
  box-shadow: -4px 0 16px rgb(15 23 42 / 0.04);
}

#detail h3 {
  margin: 20px 0 8px;
  font-size: 14px;
  font-weight: 700;
}

#detail label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin: 10px 0 4px;
}

#detail input, #detail textarea, #detail select { width: 100%; }
#detail .actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

.tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.tabs button.on { background: var(--accent); color: #fff; border-color: var(--accent); }

ol.steps {
  padding-left: 0;
  list-style: none;
  margin: 0;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

ol.steps li {
  display: flex;
  gap: 8px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

ol.steps li:last-child { border-bottom: none; }
ol.steps li .n { width: 26px; text-align: right; color: var(--muted); font-weight: 600; flex-shrink: 0; }
ol.steps li .s { flex: 1; min-width: 0; word-break: break-word; }
ol.steps li.noise { opacity: 0.6; }
ol.steps li.noise .st { text-decoration: line-through; }
ol.steps li .why { display: block; font-size: 11px; color: var(--warn); text-decoration: none; }
ol.steps li .heal { display: block; font-size: 11px; color: var(--heal); }

.typ {
  font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--code);
  color: var(--accent);
}

.notes {
  font-size: 12px;
  color: var(--fg);
  background: var(--panel-2);
  border: 1px solid var(--line);
  padding: 10px;
  border-radius: var(--radius-sm);
}
.notes .log-line { white-space: pre-wrap; margin-bottom: 6px; line-height: 1.45; }
.notes .log-line:last-child { margin-bottom: 0; }
.notes .log-line .when { color: var(--muted); margin-right: 4px; }

/* Test editor step list: every step in its own frame; the thin gaps between them show "+" / "Paste" on hover. */
ol.steps.edit-steps { border: none; border-radius: 0; overflow: visible; }
ol.steps.edit-steps li.editable,
ol.steps.edit-steps li.newstep,
ol.steps.edit-steps li.addstep {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
ol.steps.edit-steps li.editable:last-child { border-bottom: 1px solid var(--line); }
ol.steps.edit-steps li.addstep { margin-top: 2px; border-style: dashed; }
ol.steps.edit-steps li.editable[draggable="true"] { cursor: grab; }
ol.steps.edit-steps li.dragging { opacity: 0.45; }
ol.steps.edit-steps li.drop-before { box-shadow: 0 -3px 0 var(--accent); }
ol.steps.edit-steps li.drop-after { box-shadow: 0 3px 0 var(--accent); }

ol.steps.edit-steps li.gap {
  position: relative;
  height: 10px;
  padding: 0;
  border: none;
  background: transparent;
  justify-content: center;
  align-items: center;
}
ol.steps.edit-steps li.gap .gap-tools {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  display: flex;
  gap: 4px;
  transform: translate(-50%, -50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}
ol.steps.edit-steps li.gap:hover .gap-tools,
ol.steps.edit-steps li.gap .gap-tools:focus-within { opacity: 1; pointer-events: auto; }
ol.steps.edit-steps li.gap:hover::before {   /* a faint line marks where the new step goes */
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  top: 50%;
  border-top: 1px dashed var(--accent);
}
ol.steps.edit-steps li.gap .gap-tools button { padding: 1px 8px; font-size: 11px; line-height: 1.3; background: var(--panel); }
ol.steps.edit-steps li.gap .gap-add { font-weight: 700; color: var(--accent); }
ol.steps.edit-steps.dragging-steps li.gap .gap-tools { display: none; }
ol.steps.edit-steps li.gap.drop-here::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 3px solid var(--accent);
  transform: translateY(-50%);
}

.hist { font-size: 13px; }
.hist div { display: flex; gap: 8px; align-items: center; padding: 4px 0; cursor: pointer; }
.hist div:hover { text-decoration: underline; }

ol.steps li.editable, ol.steps li.addstep { cursor: pointer; }
ol.steps li.editable:hover, ol.steps li.addstep:hover { background: var(--panel-2); }
ol.steps li.on { background: var(--panel-2); outline: 1px solid var(--accent); }
ol.steps li .step-copy-btn {
  align-self: flex-start;
  flex-shrink: 0;
  opacity: 0;
  padding: 2px 6px;
  font-size: 11px;
  line-height: 1.2;
  transition: opacity 0.12s ease;
}
ol.steps li.editable:hover .step-copy-btn,
ol.steps li .step-copy-btn:focus-visible {
  opacity: 0.85;
}
ol.steps li .step-copy-btn:hover {
  opacity: 1;
}

.editor {
  margin-top: 8px;
  padding: 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: default;
}

.editor textarea { width: 100%; font-size: 13px; }
.editor .actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.editor .hint { font-size: 11px; margin-top: 6px; }
.ederr { font-size: 12px; color: var(--fail); margin-top: 6px; }
.ederr.muted { color: var(--muted); }
.editor .tabs { margin-bottom: 6px; }
#detail .editor .smartbox { display: flex; color: inherit; align-items: center; gap: 6px; margin: 6px 0 0; font-size: 12px; cursor: pointer; }
#detail .editor .smartbox input { width: auto; padding: 0; margin: 0; }
.editor select { width: 100%; }
ol.steps li.addstep { cursor: default; }
ol.steps li.addstep:hover { background: transparent; }

.danger-zone {
  margin-top: 28px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}

.notes-wrap { margin-top: 8px; font-size: 12px; }
.notes-wrap summary { cursor: pointer; }

/* ==========================================================================
   Dialogs, JSON Tree, Menus & Dependencies
   ========================================================================== */

dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  color: var(--fg);
  padding: 24px;
  box-shadow: var(--shadow-lg);
}

dialog::backdrop {
  background: rgb(15 23 42 / 0.55);
  backdrop-filter: blur(4px);
}

dialog#report { width: min(1100px, 95vw); max-height: 92vh; }
#report img { max-width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm); }
#report h3 { margin: 18px 0 6px; }
#report .err { color: var(--fail); white-space: pre-wrap; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
#report .verdict { padding: 10px 12px; border-left: 3px solid var(--heal); background: var(--panel-2); margin: 8px 0; border-radius: 6px; }
#report table { font-size: 12px; }
#report td.url { word-break: break-all; max-width: 520px; }
#report tr.bad td { color: var(--fail); }
#report details pre { margin: 4px 0; }
#report .close { float: right; }
#report video { max-width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #000; display: block; }

.json { font: 12px ui-monospace, Menlo, monospace; background: var(--code); border-radius: 6px; padding: 8px 10px; max-height: 360px; overflow: auto; margin: 4px 0; }
.json details.jt { padding-left: 14px; }
.json details.jt > summary { margin-left: -14px; cursor: pointer; list-style: none; }
.json details.jt > summary::before { content: "▸ "; color: var(--muted); }
.json details.jt[open] > summary::before { content: "▾ "; }
.json .jl { padding-left: 14px; word-break: break-all; }
.json > .jl, .json > details.jt { padding-left: 14px; }
.jk { color: var(--accent); }
.js { color: var(--pass); }
.jnum, .jb { color: var(--warn); }
.jn { color: var(--muted); }

td.grip, th.grip { width: 18px; padding-left: 0; padding-right: 0; color: var(--muted); cursor: grab; user-select: none; }
tr.dragging { opacity: 0.4; }

dialog#settings { width: min(900px, 95vw); max-height: 90vh; }
#settings .close { float: right; }
#settings table.form { font-size: 13px; margin: 8px 0; }
#settings table.form td { padding: 6px; }
#settings table.form input, #settings table.form select { width: 100%; }
#settings .row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0; }
#settings .block-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin: 10px 0; background: var(--panel-2); }
#settings .block-card .bName { flex: 1; font-weight: 600; min-width: 200px; }
#settings .block-card textarea { width: 100%; font: 12px ui-monospace, Menlo, monospace; }
#settings tr.newrow td { background: var(--panel-2); }

#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--fg);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  z-index: 60;
  box-shadow: var(--shadow-lg);
}

svg.ai { width: 1em; height: 1em; fill: currentColor; vertical-align: -0.12em; color: var(--heal); flex-shrink: 0; }
button.primary svg.ai { color: #fff; }

td.acts { white-space: nowrap; text-align: right; }
td.acts > * { margin-left: 3px; }
button.kebab { padding: 3px 8px; font-size: 14px; line-height: 1; font-weight: 700; }
button.bug { color: var(--fail); border-color: color-mix(in srgb, var(--fail) 40%, var(--line)); }
a.jira {
  display: inline-block;
  padding: 3px 8px;
  font-size: 12px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line));
}

.menu {
  position: absolute;
  z-index: 50;
  min-width: 210px;
  max-height: 320px;
  overflow: auto;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.menu button {
  display: flex;
  width: 100%;
  gap: 8px;
  align-items: center;
  border: 0;
  border-radius: 6px;
  text-align: left;
  padding: 7px 12px;
  background: transparent;
  font-size: 13px;
  box-shadow: none;
}

.menu button:hover, .menu button.on { background: var(--panel-2); }
.menu .sub { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; }

#varMenu { width: 440px; max-width: calc(100vw - 24px); }
#varMenu button { display: grid; grid-template-columns: 112px 1fr; column-gap: 10px; align-items: baseline; }
#varMenu .vd { color: var(--fg); font-size: 12px; }
#varMenu .ve { grid-column: 2; color: var(--muted); font-size: 11px; font-family: ui-monospace, Menlo, monospace; }

.cause-line { font-size: 11px; font-weight: 600; margin-top: 2px; color: var(--muted); }
.cause-line.data { color: var(--warn); }
.cause-line.app { color: var(--fail); }
.cause-line.ui { color: var(--heal); }
.cause-line.timing, .cause-line.check { color: var(--accent); }
.hist .cause-line { margin: 0; }

.cause-box {
  border-left: 4px solid var(--muted);
  background: var(--panel-2);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin: 4px 0 12px;
}

.cause-box .ck { font-weight: 700; font-size: 15px; margin-bottom: 2px; }
.cause-box .hint { margin-top: 6px; color: var(--muted); }
.cause-box.data { border-color: var(--warn); }
.cause-box.app { border-color: var(--fail); }
.cause-box.ui { border-color: var(--heal); }
.cause-box.timing, .cause-box.check { border-color: var(--accent); }
.rep-acts { float: right; margin-right: 36px; }

ol.steps .hint-warn { font-size: 11px; color: var(--warn); margin-top: 1px; }

.live {
  border: 1px solid color-mix(in srgb, var(--pass) 45%, var(--line));
  background: color-mix(in srgb, var(--pass) 7%, var(--panel));
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 8px 0;
  font-size: 13px;
}

.live .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--pass); margin-right: 6px; }
.live .actions { margin-top: 6px; }
ol.steps li.live-here { box-shadow: inset 3px 0 0 var(--pass); }
button.live-btn { color: var(--pass); border-color: color-mix(in srgb, var(--pass) 45%, var(--line)); }
img.live-shot { max-width: 100%; margin-top: 6px; border: 1px solid var(--line); border-radius: 6px; }
.try { margin-top: 6px; font-size: 13px; }
.try.ok { color: var(--pass); }
.try.bad { color: var(--fail); white-space: pre-wrap; }

table.form.kv th { text-align: left; width: 120px; font-weight: 500; color: var(--muted); }
table.form.kv input { width: 100%; }

.suggest {
  border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--line));
  background: color-mix(in srgb, var(--warn) 8%, var(--panel));
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 8px 0;
  font-size: 13px;
}

.suggest .actions { margin-top: 6px; }

dialog#newTestDlg, dialog#transferDlg, dialog#depRunDlg,
dialog#moveWorkspaceDlg, dialog#devicesDlg, dialog#authDlg, dialog#bugReportDlg {
  width: min(640px, 95vw);
}

dialog#workspaceDlg {
  width: min(740px, 95vw);
}

/* askDialog(): the dashboard's own prompt/confirm */
dialog#askDlg { width: min(420px, 92vw); }
#askDlg h3 { margin: 0 0 6px; }
#askDlg .ask-msg { margin: 0 0 10px; color: var(--muted); font-size: 13px; word-break: break-word; }
#askDlg label { display: block; margin: 4px 0; font-size: 13px; color: var(--muted); }
#askDlg input { width: 100%; box-sizing: border-box; }
#askDlg .ederr:empty { display: none; }
#askDlg .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

#newTestDlg .close, #transferDlg .close, #depRunDlg .close,
#workspaceDlg .close, #moveWorkspaceDlg .close, #devicesDlg .close, #authDlg .close, #bugReportDlg .close { float: right; }

#newTestDlg h3, #transferDlg h3, #depRunDlg h3,
#workspaceDlg h3, #moveWorkspaceDlg h3, #devicesDlg h3, #authDlg h3, #bugReportDlg h3 { margin-top: 0; margin-bottom: 12px; font-size: 18px; }

#newTestDlg .nt label, #transferDlg .nt label,
#workspaceDlg .nt label, #moveWorkspaceDlg .nt label, #devicesDlg .nt label, #authDlg .nt label, #bugReportDlg .nt label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin: 12px 0 5px;
}

#newTestDlg .nt input, #newTestDlg .nt textarea, #newTestDlg .nt select,
#transferDlg .nt input:not([type=checkbox]):not([type=file]),
#workspaceDlg .nt input, #workspaceDlg .nt select,
#moveWorkspaceDlg .nt input, #moveWorkspaceDlg .nt select,
#devicesDlg .nt input, #devicesDlg .nt select,
#authDlg .nt input,
#bugReportDlg .nt input, #bugReportDlg .nt textarea, #bugReportDlg .nt select { width: 100%; box-sizing: border-box; }

#workspaceDlg .nt .ws-inline-row input,
#workspaceDlg .nt .ws-create-row input,
#devicesDlg .nt .ws-create-row input {
  width: auto;
  flex: 1;
  min-width: 180px;
  margin: 0;
}

#newTestDlg .actions, #transferDlg .actions, #depRunDlg .actions,
#workspaceDlg .actions, #moveWorkspaceDlg .actions, #devicesDlg .actions, #authDlg .actions, #bugReportDlg .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.ws-list, .devices-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 12px 0 16px;
}

.ws-item, .device-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: var(--panel-2);
}

.ws-item + .ws-item,
.device-item + .device-item {
  margin-top: 2px;
}

.ws-item.active {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}

.ws-item-main, .device-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.ws-item-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
  margin-right: 12px;
}

.ws-item-name {
  font-weight: 600;
  color: var(--fg);
  margin-right: 2px;
}

.ws-member-icon-btn {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  margin-left: 2px;
}

.ws-item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}

.ws-inline-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.ws-inline-row[hidden] {
  display: none !important;
}

.ws-inline-row input {
  flex: 1;
}

.ws-create-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.ws-del-wrap {
  position: relative;
  display: inline-flex;
}

.ws-del-wrap[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  right: 0;
  white-space: nowrap;
  padding: 5px 9px;
  border-radius: 6px;
  background: var(--fg);
  color: var(--bg);
  font-size: 11px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  z-index: 80;
  pointer-events: none;
}

.ws-del-btn:disabled {
  opacity: 0.45;
  filter: grayscale(1);
  cursor: not-allowed;
}

.device-info {
  min-width: 0;
  flex: 1;
}

.device-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.device-meta {
  font-size: 12px;
  margin-top: 2px;
}

#transferDlg .nt label.check { display: flex; gap: 6px; align-items: center; color: var(--fg); font-size: 13px; }
#transferDlg .nt label.check input { width: auto; }
#transferDlg ul { margin: 6px 0; padding-left: 18px; font-size: 13px; }

/* Inline test dependencies & hierarchy tree */
.tcell-tree { display: flex; align-items: flex-start; gap: 6px; padding-left: 8px; border-left: 2px solid color-mix(in srgb, var(--accent) 35%, var(--line)); }
.tcell-body { flex: 1; min-width: 0; }
.dep-branch { color: var(--accent); font-weight: 700; font-size: 14px; line-height: 1.25; user-select: none; flex-shrink: 0; }
tr.dep-row { background: color-mix(in srgb, var(--accent) 2.5%, var(--panel)); }
tr.drop-into { outline: 2px dashed var(--accent); outline-offset: -2px; background: color-mix(in srgb, var(--accent) 10%, var(--panel)) !important; }
tr.drop-above td { box-shadow: inset 0 2px 0 var(--accent); }
tr.drop-below td { box-shadow: inset 0 -2px 0 var(--accent); }
.trow-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
button.dep-chip, button.dep-add { padding: 1px 8px; font-size: 11px; border-radius: 999px; line-height: 1.4; box-shadow: none; }
button.dep-chip {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--panel));
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
}
button.dep-add { color: var(--muted); border-color: transparent; background: transparent; opacity: 0.55; }
tbody tr:hover button.dep-add, button.dep-add:focus { opacity: 1; border-color: var(--line); background: var(--panel); }

#depMenu { min-width: 260px; max-width: 380px; }
.menu-hd { padding: 4px 12px 2px; font-size: 11px; font-weight: 600; color: var(--muted); }
#depMenu button.dep-prev { color: var(--accent); }
#depMenu .dep-cname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#depMenu .dep-cfolder { margin-left: auto; font-size: 11px; flex-shrink: 0; }
dialog#depRunDlg { width: min(500px, 95vw); }
.dep-chains { margin: 6px 0; padding-left: 18px; font-size: 13px; }
.dep-chains li { margin: 3px 0; }
.dep-step { color: var(--accent); font-weight: 500; }

/* Responsive adjustments */
@media (max-width: 900px) {
  body { flex-direction: column; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-Showcase { padding: 28px 24px; }
  .auth-card { padding: 28px 24px; }
  #sidebar { width: auto; border-right: none; border-bottom: 1px solid var(--line); }
  #detail { width: auto; max-height: none; position: static; border-left: none; border-top: 1px solid var(--line); }
  main { padding: 14px 16px; }
  #search { width: 100%; }
  table { display: block; overflow-x: auto; }
}

/* Report: a long failing URL (sign-in redirects, tracking params) wraps instead of widening the dialog */
.fail-url { overflow-wrap: anywhere; }

/* Bug Report dialog & screenshot previews */
dialog#bugReportDlg { width: min(560px, 95vw); }
#bugReportDlg .nt label:first-of-type { margin-top: 4px; }
#bugReportDlg #bugDesc {
  resize: vertical;
  min-height: 100px;
}
.bug-linked-box {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  margin: 4px 0 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--muted);
}
.bug-linked-box b {
  color: var(--fg);
  font-weight: 600;
}
#bugReportDlg input[type="file"] {
  width: 100%;
  padding: 8px 10px;
  background: var(--panel-2);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}
#bugReportDlg input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--fg);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}
#bugReportDlg input[type="file"]::file-selector-button:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 4%, var(--panel));
}
.bug-shot-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.bug-shot-list:empty,
#bugReportErr:empty {
  display: none;
  margin: 0;
}
.bug-shot-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.bug-shot-item img {
  width: 56px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--line);
  flex-shrink: 0;
}
.bug-shot-name {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================================================
   Downloads page (/downloads): replaces the test list in <main>
   ========================================================================== */

.sidebar-download {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent) 10%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line));
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background 140ms ease, border-color 140ms ease;
}
.sidebar-download[hidden] { display: none; }
.sidebar-download:hover,
.sidebar-download.active {
  background: color-mix(in srgb, var(--accent) 16%, var(--panel));
  border-color: var(--accent);
}
.sidebar-download svg { width: 16px; height: 16px; }
.sidebar-download svg, .dl-hero-btn svg, .dl-btn svg, .dl-icon svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

body.view-downloads main > :not(#downloadsPage) { display: none !important; }
body.view-downloads #detail { display: none !important; }
body.view-downloads #folders a.active { background: transparent; color: inherit; font-weight: inherit; box-shadow: none; }
#downloadsPage { max-width: 1120px; margin: 0 auto; }
.dl-loading { padding: 40px 0; text-align: center; }

.dl-hero {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 28px;
  padding: 34px 36px;
  margin-bottom: 20px;
  border-radius: 20px;
  color: #f8fafc;
  background:
    radial-gradient(circle at 92% 12%, rgb(167 139 250 / 0.28) 0%, transparent 42%),
    linear-gradient(145deg, #1e1b4b 0%, #312e81 55%, #1e293b 100%);
  box-shadow: var(--shadow-lg);
}
.dl-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.12);
  border: 1px solid rgb(255 255 255 / 0.16);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #e0e7ff;
}
.dl-hero h2 { margin: 14px 0 8px; font-size: 26px; line-height: 1.2; letter-spacing: -0.02em; }
.dl-hero p { margin: 0; color: #cbd5e1; max-width: 46ch; }
.dl-hero-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 22px; }
.dl-hero-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 10px;
  background: #ffffff;
  color: #312e81;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 8px 20px -6px rgb(0 0 0 / 0.45);
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.dl-hero-btn svg { width: 18px; height: 18px; }
.dl-hero-btn:hover { transform: translateY(-1px); box-shadow: 0 12px 24px -8px rgb(0 0 0 / 0.5); }
.dl-hero-btn.disabled { background: rgb(255 255 255 / 0.14); color: #cbd5e1; box-shadow: none; transform: none; }
.dl-hero-meta { font-size: 12px; color: #a5b4fc; }
.dl-hero-meta code { background: rgb(0 0 0 / 0.3); color: #e2e8f0; }

.dl-steps {
  list-style: none;
  counter-reset: dl;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-self: center;
}
.dl-steps li {
  counter-increment: dl;
  position: relative;
  padding: 11px 14px 11px 50px;
  border-radius: 12px;
  background: rgb(255 255 255 / 0.06);
  border: 1px solid rgb(255 255 255 / 0.1);
}
.dl-steps li::before {
  content: counter(dl);
  position: absolute;
  left: 14px;
  top: 12px;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: rgb(255 255 255 / 0.14);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
}
.dl-steps b { display: block; font-size: 13px; color: #ffffff; }
.dl-steps span { font-size: 12px; color: #cbd5e1; }
.dl-link {
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  color: #a5b4fc;
  font-size: 12px;
  font-weight: 600;
}
.dl-link:hover:not(:disabled) { background: none; color: #ffffff; text-decoration: underline; }

.dl-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.dl-card {
  display: flex;
  flex-direction: column;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 160ms ease, border-color 160ms ease;
}
.dl-card:hover { box-shadow: var(--shadow-md); }
.dl-card.mine { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.dl-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.dl-card-head h3 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.dl-card-head .muted { font-size: 12px; }
.dl-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
  flex-shrink: 0;
}
.dl-icon svg { width: 22px; height: 22px; }
.dl-yours {
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
}
.dl-rows { display: flex; flex-direction: column; gap: 8px; }
.dl-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: var(--radius);
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.dl-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dl-row-text b { font-size: 13px; }
.dl-row-text .muted { font-size: 12px; }
.dl-meta { margin-top: 4px; font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.dl-sha {
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 5px;
  font: 11px/1.6 "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  box-shadow: none;
  background: var(--code);
  border-color: transparent;
  color: var(--muted);
}
.dl-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--fg);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  transition: all 140ms ease;
}
.dl-btn svg { width: 15px; height: 15px; }
.dl-btn:hover { border-color: var(--accent); color: var(--accent); }
.dl-btn.primary { background: var(--accent); border-color: var(--accent); color: #ffffff; }
.dl-btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #ffffff; }
.dl-btn.disabled { color: var(--muted); border-style: dashed; background: transparent; cursor: default; }
.dl-btn.disabled:hover { border-color: var(--line-strong); color: var(--muted); }
.dl-foot { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }

@media (max-width: 1100px) {
  .dl-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .dl-hero { grid-template-columns: 1fr; padding: 24px 20px; }
  .dl-grid { grid-template-columns: 1fr; }
}
