/* MenuShop E2E 測試平台 — 可愛圓潤風格
   主色 #3FBA88 / hover #29A379 / 淺綠 #ECF8F3 */

:root {
  --primary: #3FBA88;
  --primary-dark: #29A379;
  --primary-tint: #E8F8F1;
  --primary-soft: #B8EBD4;
  --text: #3A4A42;
  --text-light: rgba(58, 74, 66, 0.55);
  --border: #D4E8DC;
  --border-light: #E8F2EC;
  --bg: #F3FAF6;
  --bg-blush: #FFF8F5;
  --surface: #FFFFFF;
  --danger: #F07178;
  --warning: #E8A85C;
  --shadow: 0 4px 16px rgba(63, 186, 136, 0.1);
  --shadow-hover: 0 8px 24px rgba(63, 186, 136, 0.16);
  --radius-sm: 14px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --radius-pill: 999px;
  --fs-2xs: 12px;
  --fs-xs: 14px;
  --fs-sm: 14px;
  --fs-md: 16px;
  --fs-base: 18px;
  --fs-body: 18px;
  --fs-lg: 20px;
  --fs-xl: 22px;
  --fs-2xl: 24px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* html/body 勿設 overflow-x: hidden，否則 header sticky 會失效 */
body {
  margin: 0;
  font-family: "Nunito", "PingFang TC", "Microsoft JhengHei", sans-serif;
  font-size: var(--fs-body);
  background:
    radial-gradient(ellipse 80% 50% at 10% 0%, #D4F5E8 0%, transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 5%, #FFE8DF 0%, transparent 50%),
    radial-gradient(ellipse 50% 30% at 50% 100%, #E0F4FF 0%, transparent 45%),
    var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  overscroll-behavior-x: none;
}

header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  box-shadow: 0 2px 20px rgba(63, 186, 136, 0.08);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px 16px;
  min-width: 0;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-xl);
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.02em;
  text-decoration: none;
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.brand:hover { color: var(--primary-dark); }
.brand-logo {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 8px;
  display: block;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: wrap;
}

.site-nav a {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text-light);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}
.site-nav a:hover {
  color: var(--primary-dark);
  background: var(--primary-tint);
}
.site-nav a.active {
  color: var(--primary-dark);
  background: var(--primary-tint);
}

.conn {
  font-size: var(--fs-sm);
  font-weight: 600;
  padding: 4px 14px;
  border-radius: var(--radius-pill);
  flex: 0 0 auto;
  white-space: nowrap;
  margin-left: auto;
}
.conn.lost {
  color: var(--danger);
  background: #FFE8EA;
}

main {
  width: 100%;
  max-width: 1080px;
  min-width: 0;
  margin: 28px auto;
  padding: 0 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  overflow-x: clip;
}

.card {
  background: var(--surface);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
}
.card:hover {
  box-shadow: var(--shadow-hover);
}

.card h2 {
  font-size: var(--fs-lg);
  font-weight: 800;
  margin-bottom: 16px;
  padding-left: 0;
  border-left: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card h2::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-tint);
  flex-shrink: 0;
}

.field { margin-bottom: 16px; }
#launch-card > .field { margin-bottom: 24px; }
#launch-card > .field:has(+ .field) {
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-light);
}
.launch-actions {
  display: flex;
  justify-content: center;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
}
#launch-card > .launch-actions ~ p {
  text-align: center;
}
.field > label,
.field-label-row > label {
  display: block;
  font-weight: 700;
  font-size: var(--fs-md);
  margin-bottom: 8px;
  color: var(--text);
}
.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.field-label-row > label {
  margin-bottom: 0;
}
button.secondary.suite-toggle-btn {
  flex-shrink: 0;
  padding: 6px 14px;
  font-size: var(--fs-xs);
  width: 124px;
  text-align: center;
}

select {
  font-family: inherit;
  font-size: var(--fs-md);
  font-weight: 600;
  padding: 10px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  min-width: 0;
  max-width: 100%;
  width: min(260px, 100%);
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}
select:focus, input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-tint);
}

input[type='checkbox'] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  display: inline-grid;
  place-content: center;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
input[type='checkbox']:hover { transform: scale(1.08); }
input[type='checkbox']:checked {
  background: var(--primary);
  border-color: var(--primary);
}
input[type='checkbox']:checked::before {
  content: "";
  width: 10px;
  height: 10px;
  background: #fff;
  clip-path: polygon(14% 44%, 0 65%, 40% 100%, 100% 16%, 82% 0, 37% 68%);
}

.suite-filter {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 14px;
  padding: 6px 8px;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
}

.suite-filter-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  min-width: 0;
  padding: 6px 4px;
}

.suite-filter-row--all {
  padding-bottom: 8px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--border);
}

.suite-filter-row:not(.suite-filter-row--all) + .suite-filter-row {
  border-top: 1px solid var(--border-light);
}

.suite-filter-row.is-current {
  background: rgba(255, 255, 255, 0.72);
  margin-left: -4px;
  margin-right: -4px;
  padding-left: 8px;
  padding-right: 8px;
  border-radius: 10px;
}

.suite-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.suite-filter-btn {
  font-family: inherit;
  font-size: var(--fs-2xs);
  font-weight: 700;
  line-height: 1.3;
  padding: 5px 11px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.suite-filter-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.85);
}

.suite-filter-btn.is-active {
  background: #fff;
  color: var(--primary-dark);
  box-shadow: 0 1px 3px rgba(63, 186, 136, 0.18);
}

.suite-filter-group {
  flex: 0 0 auto;
  min-width: 4.5em;
  padding: 5px 8px 5px 2px;
  font-weight: 800;
  color: var(--text);
  text-align: left;
  background: transparent;
}

.suite-filter-group:hover,
.suite-filter-group.is-active {
  color: var(--primary-dark);
  background: transparent;
  box-shadow: none;
}

.suite-list { display: flex; flex-direction: column; gap: 20px; }

.suite-category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.suite-category-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  font-weight: 800;
  color: var(--text-light);
  margin: 0;
}
.suite-category-title::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary-soft);
  flex-shrink: 0;
}
.suite-list-group { display: flex; flex-direction: column; gap: 10px; }

.suite-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  padding: 12px 16px;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  background: var(--bg);
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}
.suite-item:hover {
  background: var(--primary-tint);
  border-color: var(--primary-soft);
  transform: translateY(-1px);
}
.suite-item:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-tint);
}
.suite-item .suite-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.suite-item .suite-name { font-weight: 700; font-size: var(--fs-md); line-height: 1.4; }
.suite-item .suite-desc {
  font-size: var(--fs-xs);
  color: var(--text-light);
  font-weight: 500;
  padding-left: 30px;
  line-height: 1.4;
}
.field > label.suite-item {
  display: flex;
  margin-bottom: 0;
}

.device-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.device-list .suite-item {
  height: 100%;
}
.device-chip.device-desktop { color: #1A5F9E; background: #D4E6F7; }
.device-chip.device-tablet { color: #A15C00; background: #FDEBD0; }
.device-chip.device-mobile { color: #8A1C5A; background: #F7D6E8; }
.test-list .t-device {
  font-size: var(--fs-2xs);
  font-weight: 700;
  border-radius: var(--radius-pill);
  padding: 1px 10px;
  flex-shrink: 0;
}

button.primary {
  font-family: inherit;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-pill);
  padding: 12px 28px;
  font-size: var(--fs-base);
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(63, 186, 136, 0.35);
  transition: transform 0.15s, box-shadow 0.2s, filter 0.2s;
}
button.primary:hover {
  filter: brightness(1.05);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(63, 186, 136, 0.4);
}
button.primary:active { transform: translateY(0); }
button.primary:disabled {
  background: var(--border);
  box-shadow: none;
  cursor: not-allowed;
  filter: none;
  transform: none;
}

button.secondary {
  font-family: inherit;
  background: #fff;
  color: var(--text);
  border: 2px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 9px 20px;
  font-size: var(--fs-md);
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s, transform 0.15s;
}
button.secondary:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: var(--primary-tint);
  transform: translateY(-1px);
}

button.danger-button {
  font-family: inherit;
  background: #fff;
  color: var(--danger);
  border: 2px solid var(--danger);
  border-radius: var(--radius-pill);
  padding: 8px 18px;
  font-size: var(--fs-sm);
  font-weight: 800;
  cursor: pointer;
  transition: color 0.2s, background 0.2s, opacity 0.2s;
}
button.danger-button:hover { background: #FFE8EA; }
button.danger-button:disabled { cursor: wait; opacity: 0.6; }

#suite-toggle-all {
  background: #fff;
  color: var(--primary-dark);
  border-color: var(--primary);
}

#suite-toggle-all:hover {
  background: #fff;
  color: var(--primary-dark);
  border-color: var(--primary);
}

.text-input {
  font-family: inherit;
  font-size: var(--fs-md);
  font-weight: 600;
  padding: 10px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  width: 100%;
  max-width: 420px;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.cred-grid { display: flex; gap: 10px; flex-wrap: wrap; }
.cred-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 140px;
}
.cred-field > label {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.cred-grid input {
  font-family: inherit;
  font-size: var(--fs-md);
  font-weight: 600;
  padding: 10px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  width: 100%;
  min-width: 0;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.cred-grid input.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(206, 73, 73, 0.15);
}
#guest-contact-error {
  margin-top: 10px;
}

input::placeholder,
.text-input::placeholder {
  color: rgba(58, 74, 66, 0.32);
  font-weight: 400;
}

.hint { font-size: var(--fs-xs); color: var(--text-light); margin: 8px 0; font-weight: 500; }
.hint.is-warning { color: var(--warning); }

#cred-details {
  border: 2px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  background: #fff;
}
#cred-details summary {
  cursor: pointer;
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--text);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  user-select: none;
}
#cred-details summary::-webkit-details-marker { display: none; }
#cred-details summary::after {
  content: '';
  display: inline-block;
  width: 0.4em;
  height: 0.4em;
  border-right: 2px solid var(--text-light);
  border-bottom: 2px solid var(--text-light);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
  flex-shrink: 0;
  margin-top: -3px;
}
#cred-details summary:hover::after {
  border-color: var(--primary);
}
#cred-details[open] summary {
  margin-bottom: 8px;
}
#cred-details[open] summary::after {
  transform: rotate(-135deg);
  margin-top: 2px;
}
#cred-details .cred-grid { margin-top: 4px; }

.suite-item.is-disabled {
  opacity: 0.48;
  cursor: not-allowed;
}
.suite-item.is-disabled input { cursor: not-allowed; }
.suite-incompat {
  display: block;
  margin-top: 4px;
  color: var(--warning);
  font-weight: 700;
  font-size: var(--fs-xs);
}

.error { font-size: var(--fs-sm); color: var(--danger); margin-top: 8px; font-weight: 700; }

.meta { font-size: var(--fs-sm); color: var(--text-light); margin-bottom: 12px; font-weight: 600; }

.live-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.badge,
.suite-chip {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: 700;
  line-height: 1.4;
  border-radius: var(--radius-pill);
  padding: 3px 10px;
  vertical-align: middle;
}

.badge.queued { background: #F0F0F0; color: var(--text-light); }
.badge.running { background: #E0F0FF; color: #3A7AB8; }
.badge.passed { background: var(--primary-tint); color: var(--primary-dark); }
.badge.failed { background: #FFE8EA; color: var(--danger); }
.badge.error { background: #FFF3E0; color: var(--warning); }
.badge.cancelled { background: #F0F0F0; color: #6B625C; }

.progress {
  height: 12px;
  background: var(--border-light);
  border-radius: var(--radius-pill);
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06);
}
.progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--primary-soft), var(--primary));
  border-radius: var(--radius-pill);
  transition: width 0.35s ease;
}
.progress-text { font-size: var(--fs-xs); color: var(--text-light); margin-top: 8px; font-weight: 600; }

.test-list { list-style: none; margin-top: 14px; }
.test-list li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 12px;
  border-top: none;
  border-radius: var(--radius-sm);
  font-size: var(--fs-md);
  flex-wrap: wrap;
  margin-bottom: 4px;
  background: var(--bg);
}
.test-list .t-icon { width: 22px; text-align: center; flex-shrink: 0; }
.test-list .t-suite {
  font-size: var(--fs-2xs);
  font-weight: 700;
  color: var(--primary-dark);
  background: var(--primary-tint);
  border-radius: var(--radius-pill);
  padding: 1px 10px;
  flex-shrink: 0;
}
.test-list .t-title { flex: 1; font-weight: 600; }
.test-list .t-dur { font-size: var(--fs-xs); color: var(--text-light); flex-shrink: 0; font-weight: 600; }
.test-list .t-error, .test-list .t-skip, .test-list .t-note {
  font-size: var(--fs-xs);
  color: var(--danger);
  white-space: pre-wrap;
  word-break: break-all;
  flex-basis: 100%;
  margin-left: 28px;
  font-weight: 500;
}
.test-list .t-skip { color: var(--warning); }
.test-list .t-note { color: var(--text); }
.test-list .t-skip.mode { color: #3A7AB8; }
.skip-kind {
  display: inline-block;
  font-size: var(--fs-2xs);
  font-weight: 800;
  line-height: 1.4;
  border-radius: var(--radius-pill);
  padding: 0 8px;
  margin-right: 6px;
  vertical-align: baseline;
}
.skip-kind.mode { background: #E0F0FF; color: #3A7AB8; }
.skip-kind.precondition { background: #FFF3E0; color: #A86B24; }
.note-kind {
  display: inline-block;
  font-size: var(--fs-2xs);
  font-weight: 800;
  line-height: 1.4;
  border-radius: var(--radius-pill);
  padding: 0 8px;
  margin-right: 6px;
  vertical-align: baseline;
  background: #E7F2EA;
  color: #2E7D4F;
}
.test-list li.failed .t-title { color: var(--danger); }
.test-list li.interrupted .t-title { color: var(--warning); }
.test-list li.skipped .t-title { color: var(--text-light); }

.table-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-light);
}

table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
th, td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
  vertical-align: top;
}
th {
  color: var(--text-light);
  font-weight: 800;
  background: var(--bg);
  font-size: var(--fs-xs);
  letter-spacing: 0.02em;
}
tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.15s; }
tbody tr:hover { background: var(--primary-tint); }

.cell-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.35;
}
.col-time,
.col-env {
  white-space: normal;
}

.col-suite {
  min-width: 220px;
  max-width: 280px;
  width: 240px;
  white-space: normal;
}

.col-device {
  min-width: 88px;
  white-space: normal;
}

.col-suite .suite-chip {
  max-width: 100%;
  margin: 2px 4px 2px 0;
  border-radius: 10px;
  padding: 5px 10px;
  line-height: 1.45;
  font-size: var(--fs-2xs);
  white-space: normal;
  overflow-wrap: break-word;
  word-break: keep-all;
  text-wrap: balance;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.suite-chip {
  margin: 2px 4px 2px 0;
}

.suite-tooltip {
  position: relative;
  cursor: default;
  outline: none;
}

.suite-tooltip::before,
.suite-tooltip::after {
  position: absolute;
  left: 50%;
  z-index: 20;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 4px);
  transition:
    opacity 0.16s ease,
    transform 0.16s ease,
    visibility 0.16s;
}

.suite-tooltip::before {
  content: "";
  bottom: calc(100% + 3px);
  width: 9px;
  height: 9px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transform: translate(-50%, 4px) rotate(45deg);
}

.suite-tooltip::after {
  content: attr(data-tooltip);
  bottom: calc(100% + 8px);
  width: max-content;
  max-width: 240px;
  padding: 7px 11px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-hover);
  font-size: var(--fs-2xs);
  font-weight: 700;
  line-height: 1.45;
  text-align: center;
  white-space: nowrap;
}

.suite-tooltip:hover,
.suite-tooltip:focus-visible {
  z-index: 21;
}

.suite-tooltip:hover::before,
.suite-tooltip:hover::after,
.suite-tooltip:focus-visible::before,
.suite-tooltip:focus-visible::after {
  opacity: 1;
  visibility: visible;
}

.suite-tooltip:hover::before,
.suite-tooltip:focus-visible::before {
  transform: translate(-50%, 0) rotate(45deg);
}

.suite-tooltip:hover::after,
.suite-tooltip:focus-visible::after {
  transform: translate(-50%, 0);
}

.suite-tooltip:focus-visible {
  box-shadow: 0 0 0 3px rgba(63, 186, 136, 0.2);
}

.suite-chip.c0  { color: #1B7A52; background: #D5F5E3; }
.suite-chip.c1  { color: #1A5F9E; background: #D4E6F7; }
.suite-chip.c2  { color: #A15C00; background: #FDEBD0; }
.suite-chip.c3  { color: #B03A3A; background: #F5D6D6; }
.suite-chip.c4  { color: #0B6E6E; background: #D0F0F0; }
.suite-chip.c5  { color: #5A4A2E; background: #EDE4D4; }
.suite-chip.c6  { color: #8A1C5A; background: #F7D6E8; }
.suite-chip.c7  { color: #6B5B00; background: #F5F0C8; }
.suite-chip.c8  { color: #2C3E6B; background: #D8DEEB; }
.suite-chip.c9  { color: #8B3A1A; background: #F5D9CC; }
.suite-chip.c10 { color: #3D5C1A; background: #E2EDD0; }
.suite-chip.c11 { color: #4A5568; background: #E2E8F0; }

td a {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: 700;
  line-height: 1.4;
  border-radius: var(--radius-pill);
  padding: 2px 10px;
  vertical-align: middle;
  color: var(--primary-dark);
  text-decoration: none;
  background: #fff;
  border: 1.5px solid var(--primary);
  transition: background 0.15s, color 0.15s;
}
td a:hover {
  background: var(--primary-tint);
  text-decoration: none;
}

.col-stats { white-space: nowrap; }
.stats-row {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  font-variant-numeric: tabular-nums;
}
.stats-line {
  display: grid;
  grid-template-columns: 4.75em 1em 4.75em;
  align-items: baseline;
}
.stats-line.skips {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 0;
  grid-template-columns: none;
}
.stats-line.skips .stat-sep { margin: 0 0.35em; }
.stat {
  font-weight: 800;
  white-space: nowrap;
}
.stat-n {
  display: inline-block;
  min-width: 1.35em;
  text-align: right;
  margin-right: 0.2em;
}
.stat-sep {
  text-align: center;
  color: var(--text-light);
  font-weight: 500;
}
.stat.pass { color: var(--primary-dark); }
.stat.fail { color: var(--danger); }
.stat.skip { color: var(--warning); }
.stat.mode { color: #3A7AB8; }
.stat.precondition { color: #A86B24; }
.stat.interrupt { color: #6B625C; }

/* ---- 自訂測試流程 ---- */

.flow-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.flow-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: var(--fs-md);
  background: var(--bg);
  transition: border-color 0.2s, background 0.2s;
}
.flow-row:hover {
  border-color: var(--primary-soft);
  background: var(--primary-tint);
}
.flow-row .flow-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.flow-row .flow-name { display: flex; align-items: center; font-weight: 700; }
.flow-row .flow-desc { font-size: var(--fs-xs); color: var(--text-light); font-weight: 500; }
.flow-row .flow-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.flow-row button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  font-family: inherit;
  line-height: 0;
  border: none;
  background: none;
  color: var(--primary-dark);
  cursor: pointer;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  transition: color 0.15s, background 0.15s;
}
.flow-row button svg {
  display: block;
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.flow-row button:hover { background: rgba(63, 186, 136, 0.15); }
.flow-row button:focus-visible {
  outline: 3px solid var(--primary-soft);
  outline-offset: 2px;
}
.flow-row button.danger { color: var(--danger); }
.flow-row button.danger:hover { background: #FFE8EA; }

#flow-editor {
  margin-top: 18px;
  border-top: 2px dashed var(--border);
  padding-top: 18px;
}
.flow-uselogin {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-md);
  font-weight: 600;
  margin-bottom: 16px;
  cursor: pointer;
}

#step-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.step-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg);
}
.step-row .step-no {
  font-size: var(--fs-xs);
  font-weight: 800;
  color: #fff;
  width: 24px;
  height: 24px;
  line-height: 24px;
  text-align: center;
  background: var(--primary);
  border-radius: 50%;
  flex-shrink: 0;
}
.step-row select, .step-row input {
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
}
.step-row select { min-width: 130px; }
.step-row input { flex: 1; min-width: 120px; }
.step-row .step-btns { display: flex; gap: 2px; }
.step-row .step-btns button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
  font-size: var(--fs-md);
  color: var(--text-light);
  padding: 4px 8px;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
}
.step-row .step-btns button:hover {
  color: var(--primary-dark);
  background: var(--primary-tint);
}

.flow-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}
.flow-editor-actions button {
  width: 140px;
}

.suite-tag {
  display: inline-flex;
  align-items: center;
  font-size: var(--fs-2xs);
  font-weight: 700;
  line-height: 1;
  color: var(--primary-dark);
  background: var(--primary-tint);
  border: 2px solid var(--primary-soft);
  border-radius: var(--radius-pill);
  padding: 3px 10px;
  margin-left: 6px;
  vertical-align: middle;
}

.field-error { font-size: var(--fs-xs); color: var(--danger); margin-top: 6px; font-weight: 700; }

/* ---- 通行碼 ---- */

.auth-overlay[hidden] { display: none; }
.auth-overlay {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 30% 20%, #D4F5E8 0%, transparent 55%),
    radial-gradient(ellipse 50% 40% at 80% 70%, #FFE8DF 0%, transparent 50%),
    var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
  overflow: auto;
}
.auth-box {
  background: #fff;
  border: 2px solid var(--border-light);
  border-top: none;
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: center;
  box-shadow: var(--shadow-hover);
  position: relative;
}
.auth-box::before {
  content: "";
  position: absolute;
  top: 0;
  left: 24px;
  right: 24px;
  height: 5px;
  border-radius: 0 0 var(--radius-pill) var(--radius-pill);
  background: linear-gradient(90deg, var(--primary-soft), var(--primary));
}
.auth-box h2 {
  font-size: var(--fs-xl);
  font-weight: 800;
  color: var(--primary);
  border: none;
  padding: 0;
  margin: 0;
  display: block;
}
.auth-box h2::before { display: none; }
.auth-box input {
  font-family: inherit;
  font-size: var(--fs-md);
  font-weight: 600;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.to-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 40;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  font-family: inherit;
  font-size: var(--fs-2xl);
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(63, 186, 136, 0.4);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.2s, visibility 0.2s, transform 0.2s, filter 0.15s, box-shadow 0.2s;
}
.to-top.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}
.to-top:hover {
  filter: brightness(1.05);
  box-shadow: 0 6px 20px rgba(63, 186, 136, 0.45);
}
.to-top:active {
  transform: translateY(2px);
}

@media (max-width: 640px) {
  header {
    border-radius: 0 0 var(--radius-md) var(--radius-md);
  }
  .header-inner { padding: 12px 14px; gap: 10px; }
  .brand { font-size: var(--fs-base); width: 100%; }
  .site-nav { flex: 1 1 100%; order: 3; }
  .conn { margin-left: 0; }
  .card { padding: 18px 16px; border-radius: var(--radius-md); }
  .live-heading { align-items: flex-start; }
  .live-heading .danger-button { flex-shrink: 0; }
  select { width: 100%; }
  .device-list {
    grid-template-columns: 1fr;
  }
  .cred-grid {
    flex-direction: column;
  }
  .cred-field {
    min-width: 0;
    width: 100%;
    flex: none;
  }
  .step-row select { min-width: 0; width: 100%; }
  .step-row input { min-width: 0; }
  .to-top {
    right: 14px;
    bottom: 14px;
    width: 44px;
    height: 44px;
  }
}

main[hidden], #launch-card[hidden] { display: none; }
#session-info { display: inline-flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
#session-info button { padding: .25rem .65rem; }
#readonly-note { border-left: .25rem solid #41635a; }
#auth-control { margin-block: 1rem; }
#auth-control form { display: grid; gap: .75rem; }
