:root {
  --color-bg: #F5F5F7;
  --color-surface: #FFFFFF;
  --color-primary: #007AFF;
  --color-primary-dark: #0060DF;
  --color-primary-light: rgba(0, 122, 255, 0.08);
  --color-success: #34C759;
  --color-warning: #FF9F0A;
  --color-error: #FF3B30;
  --color-text: #1D1D1F;
  --color-text-muted: #6E6E73;
  --color-border: #E5E5EA;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.10);

  --transition: 0.18s ease;

  --status-pass-bg: rgba(52, 199, 89, 0.14);
  --status-pass-fg: #1F8B3B;
  --status-fail-bg: rgba(255, 59, 48, 0.12);
  --status-fail-fg: #D70015;
  --status-warning-bg: rgba(255, 159, 10, 0.16);
  --status-warning-fg: #B25000;
  --status-in_progress-bg: rgba(0, 122, 255, 0.12);
  --status-in_progress-fg: #0060DF;
  --status-not_tested-bg: rgba(110, 110, 115, 0.10);
  --status-not_tested-fg: #6E6E73;
  --status-unknown-bg: rgba(175, 82, 222, 0.12);
  --status-unknown-fg: #862E9C;
}

* { box-sizing: border-box; }

body {
  font-family: "Be Vietnam Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; }

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--color-surface);
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
  gap: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

header strong {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.logo-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

header button {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--transition), border-color var(--transition);
}

header button:hover {
  background: var(--color-bg);
  border-color: #d5d5da;
}

.notification-button { margin-right: 12px; }

.notification-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  margin-left: 5px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--color-error);
  color: white;
  font-size: 11px;
  font-weight: 700;
}

.notification-badge.is-clear { background: var(--color-success); }

.help-button {
  display: inline-flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  background: var(--color-surface-solid);
  color: var(--color-text-muted);
  font-size: 15px;
  font-weight: 700;
}
.help-button:hover { background: var(--color-surface-secondary); color: var(--color-text); }

#project-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 24px;
  background: var(--color-surface);
  flex-wrap: wrap;
  border-bottom: 1px solid var(--color-border);
}

.tab {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background-color var(--transition), color var(--transition);
}

.tab:hover { background: var(--color-bg); color: var(--color-text); }

.tab.active {
  background: var(--color-primary);
  color: white;
}

#project-tabs button:not(.tab) {
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  font-size: 13px;
  color: var(--color-text-muted);
  transition: background-color var(--transition), color var(--transition);
}

#project-tabs button:not(.tab):hover {
  background: var(--color-bg);
  color: var(--color-text);
}

#global-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

#global-actions .build-select-hint {
  margin-right: auto;
}

#filters {
  display: flex;
  gap: 10px;
  padding: 16px 24px;
  flex-wrap: wrap;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

#filters select, #filters input {
  padding: 7px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color var(--transition), box-shadow var(--transition);
}

#filters button {
  padding: 7px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-primary);
  font-size: 13px;
  font-weight: 600;
}

#filters select:focus, #filters input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px var(--color-primary-light);
}

main { padding: 24px 24px 40px; }

#global-actions #btn-create-build {
  padding: 7px 14px;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--transition), color var(--transition);
}

#btn-create-build:hover {
  background: var(--color-primary);
  color: white;
}

#global-actions #btn-back-to-builds {
  padding: 7px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--transition);
}

#btn-back-to-builds:hover { background: #e9e9eb; }

.build-select-hint {
  font-size: 12px;
  color: var(--color-text-muted);
}

.tc-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}

.tc-row:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.test-step-section {
  margin: 4px -16px -14px;
  border-top: 1px solid var(--color-border);
  background: #fafafa;
}

.test-step-row {
  display: grid;
  grid-template-columns: 1fr 1.6fr 1.6fr 100px 120px 1.1fr 1.3fr 90px;
  gap: 10px;
  align-items: start;
  padding: 10px 16px;
  border-bottom: 1px solid var(--color-border);
}

.step-connector {
  color: var(--color-text-muted);
  font-size: 12px;
  text-align: right;
  padding: 5px 4px;
}

.step-title { font-weight: 500; }

.step-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.step-select-wrap { padding: 5px 6px; }
.step-select { width: 16px; height: 16px; accent-color: var(--color-primary); }

.step-summary {
  color: var(--color-text-muted);
  font-size: 12px;
  padding: 5px 6px;
}

.add-step-btn {
  border: none;
  background: transparent;
  color: var(--color-primary);
  font-size: 12px;
  font-weight: 600;
  padding: 10px 16px;
  margin-left: 28%;
  cursor: pointer;
}

.add-step-btn:hover { text-decoration: underline; }

.test-step-row select:disabled,
.tc-row-main input:disabled {
  cursor: default;
  opacity: 0.8;
}

.tc-row.dragging { opacity: 0.4; }
.tc-row.drag-over-top { border-top: 2px solid var(--color-primary); }
.tc-row.drag-over-bottom { border-bottom: 2px solid var(--color-primary); }

.tc-header, .tc-row-main {
  display: grid;
  grid-template-columns: 1fr 1.6fr 1.6fr 100px 120px 1.1fr 1.3fr 90px;
  gap: 10px;
  align-items: start;
}

.tc-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  border-radius: var(--radius) var(--radius) 0 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 10px 16px;
  margin: 0 24px;
}

.tc-header span {
  border-right: 1px solid var(--color-border);
  padding-right: 8px;
}

.tc-header span:last-child { border-right: none; }

.tc-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
}

.tc-action-btn {
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  color: var(--color-text-muted);
  transition: background-color var(--transition), color var(--transition);
}

.tc-action-btn:hover { background: var(--color-bg); color: var(--color-text); }
.tc-delete-btn:hover { background: var(--status-fail-bg); color: var(--color-error); }
.tc-drag-handle { cursor: grab; }
.tc-drag-handle:active { cursor: grabbing; }

select.test-flag-select {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  border-radius: 999px;
  padding: 5px 24px 5px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  background-color: var(--status-not_tested-bg);
  color: var(--status-not_tested-fg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236E6E73'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: background-color var(--transition);
}

select.test-flag-select.tf-yes { background-color: var(--status-pass-bg); color: var(--status-pass-fg); }
select.test-flag-select.tf-no { background-color: var(--status-fail-bg); color: var(--status-fail-fg); }
select.test-flag-select.tf-todo { background-color: var(--status-not_tested-bg); color: var(--status-not_tested-fg); }

.editable, .editable-list {
  border: 1px dashed transparent;
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  min-height: 1.2em;
  transition: background-color var(--transition), border-color var(--transition);
}

.editable:focus, .editable-list:focus {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  outline: none;
}

.editable-list {
  font-family: inherit;
  font-size: inherit;
  width: 100%;
  resize: vertical;
}

.tc-last-tested {
  display: block;
  font-size: 12px;
  color: var(--color-text-muted);
  overflow-wrap: break-word;
}

/* Status select rendered as a colored badge/pill instead of a plain dropdown */
select.status-select {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  border-radius: 999px;
  padding: 5px 28px 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  background-color: var(--status-not_tested-bg);
  color: var(--status-not_tested-fg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236E6E73'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: background-color var(--transition);
}

select.status-select.status-pass { background-color: var(--status-pass-bg); color: var(--status-pass-fg); }
select.status-select.status-fail { background-color: var(--status-fail-bg); color: var(--status-fail-fg); }
select.status-select.status-warning { background-color: var(--status-warning-bg); color: var(--status-warning-fg); }
select.status-select.status-in_progress { background-color: var(--status-in_progress-bg); color: var(--status-in_progress-fg); }
select.status-select.status-not_tested { background-color: var(--status-not_tested-bg); color: var(--status-not_tested-fg); }
select.status-select.status-unknown { background-color: var(--status-unknown-bg); color: var(--status-unknown-fg); }

.notes-input {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 13px;
  width: 100%;
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.notes-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px var(--color-primary-light);
}

.tc-note-cell { display: flex; min-width: 0; align-items: center; gap: 5px; }
.tc-note-cell .notes-input { min-width: 0; padding: 5px 7px; font-size: 12px; }
.tc-note-link { display: inline-flex; width: 28px; height: 28px; flex: 0 0 28px; align-items: center; justify-content: center; border-radius: 8px; background: var(--color-primary-light); color: var(--color-primary); }
.tc-note-link[hidden] { display: none; }
.tc-note-link:hover { background: rgba(0,122,255,.16); }
.tc-note-link svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Auth page layout, used by login.html — a two-column card: form on the
   left, illustration on the right, matching a common login-page pattern. */
body.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  display: flex;
  width: 100%;
  max-width: 900px;
  min-height: 480px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.auth-form-col {
  flex: 1 1 380px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 44px;
}

.auth-brand-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 40px;
}

.auth-brand-row span {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--color-text-muted);
}

.auth-card h1 {
  margin: 0 0 6px;
  font-size: 26px;
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.auth-card p.subtitle {
  margin: 0 0 28px;
  color: var(--color-text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.auth-form-col label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

.auth-card select,
.auth-card input {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 20px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.auth-card select:focus,
.auth-card input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px var(--color-primary-light);
}

.auth-card button {
  width: 100%;
  padding: 11px 12px;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--transition), box-shadow var(--transition);
}

.auth-card button:hover { background: var(--color-primary-dark); box-shadow: var(--shadow-sm); }
.auth-flow[hidden] { display: none; }
.auth-error { min-height: 18px; margin: -8px 0 10px; color: var(--color-error); font-size: 12px; }
.auth-switch { margin: 18px 0 0; color: var(--color-text-muted); font-size: 13px; text-align: center; }
.auth-card .auth-switch button {
  display: inline;
  width: auto;
  padding: 0;
  background: transparent;
  color: var(--color-primary);
  font-size: inherit;
}
.auth-card .auth-switch button:hover { background: transparent; color: var(--color-primary-dark); box-shadow: none; text-decoration: underline; }
.auth-illustration-col {
  flex: 1 1 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: var(--color-bg);
}

.auth-illustration {
  display: block;
  width: 100%;
  max-width: 420px;
  height: auto;
  object-fit: contain;
}

@media (max-width: 760px) {
  .auth-illustration-col { display: none; }
  .auth-card { max-width: 420px; }
  .auth-form-col { padding: 40px 32px; }
}

#global-actions button {
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--color-primary);
  color: white;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--transition), box-shadow var(--transition);
}

#global-actions button:hover { background: var(--color-primary-dark); box-shadow: var(--shadow-sm); }

.bulk-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-left: 10px;
  border-left: 1px solid var(--color-border);
}

.bulk-actions[hidden] { display: none; }
.bulk-actions strong { color: var(--color-text-muted); font-size: 12px; white-space: nowrap; }
.bulk-actions select { padding: 7px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); }

dialog {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px 28px;
  box-shadow: var(--shadow-md);
  max-width: 420px;
  width: 92vw;
}

dialog.wide-dialog { max-width: 760px; }
dialog.runner-dialog { max-width: 680px; }

.import-dialog textarea {
  min-height: 220px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
}

.import-file-label input { padding: 8px; background: var(--color-surface-secondary); }
.import-format-hint { margin: -2px 0 14px; color: var(--color-text-muted); font-size: 12px; }
.import-preview { margin: 12px 0 16px; padding: 14px 16px; border: 1px solid var(--color-border); border-radius: 12px; background: var(--color-surface-secondary); }
.import-preview p { margin: 5px 0 0; color: var(--color-text-muted); font-size: 13px; }
.import-preview .import-preview-warning { color: var(--color-warning); }

.help-dialog { max-height: min(760px, 88vh); overflow-y: auto; }
.help-dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.help-dialog-header .page-eyebrow { margin-bottom: 2px; }
.help-dialog-header h2 { margin-bottom: 18px; }
.help-dialog-header .icon-button { flex: 0 0 auto; border: 0; background: var(--color-surface-secondary); color: var(--color-text-muted); font-size: 22px; font-weight: 400; }
.help-guide { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.help-guide section { display: flex; gap: 11px; padding: 14px; border: 1px solid var(--color-border); border-radius: 13px; background: var(--color-surface-secondary); }
.help-guide section > span { display: inline-flex; width: 25px; height: 25px; flex: 0 0 25px; align-items: center; justify-content: center; border-radius: 50%; background: var(--color-primary); color: white; font-size: 11px; font-weight: 700; }
.help-guide h3 { margin: 1px 0 4px; font-size: 13px; }
.help-guide p { margin: 0; color: var(--color-text-muted); font-size: 12px; line-height: 1.5; }
.help-api-guide { margin-top: 14px; padding: 18px; border: 1px solid rgba(0,122,255,.2); border-radius: 16px; background: rgba(0,122,255,.055); }
.help-api-heading { display: flex; align-items: flex-start; gap: 12px; }
.help-api-heading .page-eyebrow { margin: 0 0 2px; }
.help-api-heading h3 { margin: 0 0 4px; font-size: 16px; letter-spacing: -.015em; }
.help-api-heading p:last-child { margin: 0; color: var(--color-text-muted); font-size: 12px; }
.help-api-icon { display: inline-flex; width: 30px; height: 30px; flex: 0 0 30px; align-items: center; justify-content: center; border-radius: 9px; background: var(--color-primary); color: white; font-size: 18px; font-weight: 700; }
.help-api-steps { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0 0; padding: 0; list-style: none; counter-reset: api-step; }
.help-api-steps li { min-width: 0; padding: 13px 14px; border-radius: 12px; background: var(--color-surface); box-shadow: var(--shadow-sm); counter-increment: api-step; }
.help-api-steps li > strong { display: flex; align-items: center; gap: 7px; font-size: 12px; }
.help-api-steps li > strong::before { content: counter(api-step); display: inline-flex; width: 20px; height: 20px; flex: 0 0 20px; align-items: center; justify-content: center; border-radius: 50%; background: var(--color-primary-light); color: var(--color-primary-dark); font-size: 10px; }
.help-api-steps p { margin: 7px 0 0; color: var(--color-text-muted); font-size: 11px; line-height: 1.55; }
.help-api-steps code, .help-api-heading code, .help-api-note code { font-family: "SFMono-Regular", Consolas, monospace; font-size: .94em; }
.help-api-steps pre { max-width: 100%; margin: 9px 0 0; padding: 9px 10px; overflow-x: auto; border-radius: 8px; background: var(--color-surface-secondary); color: var(--color-text); font-size: 10px; line-height: 1.5; }
.help-api-steps pre code { white-space: pre; }
.help-api-endpoint { color: var(--color-primary-dark) !important; }
.help-api-note { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: rgba(255,159,10,.1); color: var(--color-text-muted); font-size: 11px; line-height: 1.5; }
.help-tip { margin-top: 12px; padding: 12px 14px; border-radius: 11px; background: var(--color-primary-light); color: var(--color-text-muted); font-size: 12px; }
.help-tip strong { color: var(--color-primary); }

dialog.wide-dialog > label,
dialog.runner-dialog > label {
  display: block;
  margin-bottom: 12px;
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 600;
}

dialog.wide-dialog > label input,
dialog.wide-dialog > label textarea,
dialog.runner-dialog > label input,
dialog.runner-dialog > label textarea {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 9px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font: inherit;
}

.runner-progress,
.runner-navigation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 600;
}

.runner-context { margin: 0 0 5px; color: var(--color-text-muted); font-size: 12px; }
.runner-dialog h2 { margin-bottom: 22px; font-size: 22px; }

.runner-status-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 18px 0;
}

.runner-status-actions button,
.runner-navigation button,
.runner-progress button,
.dialog-close-btn {
  padding: 9px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text);
  font-weight: 600;
}

.runner-status-actions button[data-run-status="pass"] { background: var(--status-pass-bg); color: var(--status-pass-fg); }
.runner-status-actions button[data-run-status="fail"] { background: var(--status-fail-bg); color: var(--status-fail-fg); }
.runner-status-actions button[data-run-status="warning"] { background: var(--status-warning-bg); color: var(--status-warning-fg); }
.runner-status-actions button[data-run-status="in_progress"] { background: var(--status-in_progress-bg); color: var(--status-in_progress-fg); }

.failure-list { display: grid; gap: 8px; max-height: 60vh; overflow-y: auto; margin-bottom: 16px; }

.failure-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-warning);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  text-align: left;
}

.failure-item.failure-fail { border-left-color: var(--color-error); }
.failure-item span, .failure-item small { color: var(--color-text-muted); }

.step-history-list { display: grid; gap: 6px; max-height: 260px; overflow-y: auto; }
.history-item { padding: 9px 10px; border-radius: var(--radius-sm); background: var(--color-bg); font-size: 12px; }

dialog::backdrop { background: rgba(0, 0, 0, 0.35); }

dialog h2 {
  margin: 0 0 16px;
  font-size: 17px;
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

dialog form label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 10px;
}

dialog form label .required { color: var(--color-error); }

dialog form input,
dialog form select,
dialog form textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color var(--transition), box-shadow var(--transition);
}

dialog form input:focus,
dialog form select:focus,
dialog form textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px var(--color-primary-light);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.dialog-actions button {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--transition), box-shadow var(--transition);
}

.account-actions { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; }
#account-current-wrap[hidden] { display: none; }
#account-logout { color: var(--color-error); }
.members-dialog { max-height: min(760px, 88vh); overflow-y: auto; }
.members-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.members-header h2 { margin-bottom: 12px; }
.members-header .icon-button { border: 0; background: var(--color-surface-secondary); color: var(--color-text-muted); font-size: 21px; }
.members-list { display: grid; gap: 8px; margin: 18px 0; }
.member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 14px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface-solid);
}
.member-row.disabled { opacity: .62; background: var(--color-surface-secondary); }
.member-identity { display: grid; gap: 3px; min-width: 0; }
.member-identity strong { overflow-wrap: anywhere; font-size: 13px; }
.member-identity span { overflow-wrap: anywhere; color: var(--color-text-muted); font-size: 11px; }
.member-actions { display: flex; flex: 0 0 auto; gap: 6px; }
.member-actions button { min-height: 32px; padding: 6px 11px; font-size: 12px; }
.member-current-label { color: var(--color-text-muted); font-size: 11px; }

@media (max-width: 600px) {
  .member-row { align-items: stretch; flex-direction: column; }
  .member-actions { width: 100%; }
  .member-actions button { flex: 1 1 auto; }
  .account-actions { grid-template-columns: 1fr 1fr; }
  .account-actions span { display: none; }
}

#btn-cancel-testcase { background: var(--color-bg); color: var(--color-text); }
#btn-cancel-testcase:hover { background: #e9e9eb; }
#btn-save-testcase { background: var(--color-primary); color: white; }
#btn-save-testcase:hover { background: var(--color-primary-dark); box-shadow: var(--shadow-sm); }

#build-report {
  padding: 24px 24px 40px;
  overflow-x: auto;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 56px 24px;
  text-align: center;
  color: var(--color-text-muted);
}

.empty-state-icon {
  width: 40px;
  height: 40px;
  color: var(--color-border);
}

.empty-state-icon svg { width: 100%; height: 100%; }

.empty-state p {
  margin: 0;
  font-size: 13px;
  max-width: 320px;
}

.stat-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  flex: 1 1 140px;
  padding: 16px 18px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.stat-label {
  margin-top: 4px;
  font-size: 12px;
  color: var(--color-text-muted);
}

.overall-status-card {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 20px 24px;
  margin-bottom: 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.overall-chart-wrap { flex: 0 0 auto; }

.overall-status-card h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
}

.overall-status-card p {
  margin: 3px 0 14px;
  color: var(--color-text-muted);
  font-size: 12px;
}

.status-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.status-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--color-text-muted);
  font-size: 12px;
}

.status-legend i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-donut { display: block; overflow: visible; }

.donut-base,
.donut-segment {
  fill: none;
  stroke-width: 5;
  transform: rotate(-90deg);
  transform-origin: 21px 21px;
}

.donut-base { stroke: var(--color-border); }
.donut-segment { transition: stroke-width var(--transition), opacity var(--transition); }
.donut-segment:hover { stroke-width: 6; opacity: 0.88; }

.donut-value,
.donut-label {
  fill: var(--color-text);
  text-anchor: middle;
  font-family: inherit;
  pointer-events: none;
}

.donut-value { font-size: 7px; font-weight: 700; }
.donut-label { fill: var(--color-text-muted); font-size: 2.7px; font-weight: 600; letter-spacing: 0.2px; }

.project-overview-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.project-overview-toolbar input {
  width: min(100%, 300px);
  padding: 9px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 13px;
}

.project-overview-toolbar input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px var(--color-primary-light);
}

.project-donut-cell { min-width: 230px; }

.project-status-summary {
  display: flex;
  align-items: center;
  gap: 12px;
}

.project-status-summary .status-donut { flex: 0 0 auto; }

.project-status-legend {
  display: grid;
  grid-template-columns: repeat(2, max-content);
  gap: 3px 10px;
  color: var(--color-text-muted);
  font-size: 11px;
}

.project-status-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.project-status-legend i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.project-name-button {
  border: none;
  background: transparent;
  padding: 2px 0;
  color: var(--color-primary);
  font-size: 13px;
  font-weight: 650;
  text-align: left;
}

.project-name-button:hover { text-decoration: underline; }

.project-last-tested {
  min-width: 145px;
  color: var(--color-text-muted);
  font-size: 12px !important;
}

.project-search-empty td {
  padding: 28px !important;
  text-align: center !important;
  color: var(--color-text-muted);
}

.project-has-failures td:first-child {
  box-shadow: inset 3px 0 0 var(--color-error);
}

.build-report-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.build-report-table th, .build-report-table td {
  padding: 12px 16px;
  text-align: left;
  font-size: 13px;
  border-bottom: 1px solid var(--color-border);
}

.build-report-table th {
  background: var(--color-bg);
  color: var(--color-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.3px;
}

.build-report-table tr:last-child td { border-bottom: none; }

.report-build-name { font-weight: 600; color: var(--color-text); }
.report-pass { color: var(--color-success); font-weight: 600; }
.report-fail { color: var(--color-error); font-weight: 600; }
.report-warning { color: var(--color-warning); font-weight: 600; }

.report-view-btn {
  padding: 6px 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--transition), color var(--transition);
}

.report-view-btn:hover { background: var(--color-primary); color: white; }
.report-secondary-btn { background: var(--color-surface-secondary); color: var(--color-text); }
.report-secondary-btn:hover { background: rgba(120, 120, 128, 0.18); color: var(--color-text); }

.report-actions-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  white-space: nowrap;
}

.report-danger-btn {
  background: var(--status-fail-bg);
  color: var(--color-error);
}
.report-danger-btn:hover { background: var(--color-error); color: white; }

@media (max-width: 800px) {
  .tc-row-main, .test-step-row { grid-template-columns: 1fr; }
  .step-connector { text-align: left; }
  .add-step-btn { margin-left: 0; }
  .tc-header { display: none; }
  header, #project-tabs, #filters, #global-actions { padding-left: 16px; padding-right: 16px; }
  main, #build-report { padding: 16px; }
  .overall-status-card { align-items: flex-start; gap: 18px; padding: 18px; }
  .overall-chart-wrap .status-donut { width: 108px; height: 108px; }
  .project-overview-toolbar { justify-content: stretch; }
  .project-overview-toolbar input { width: 100%; }
  .runner-status-actions { grid-template-columns: repeat(2, 1fr); }
  .bulk-actions { width: 100%; padding: 8px 0 0; border-left: none; border-top: 1px solid var(--color-border); flex-wrap: wrap; }
}

/* Apple-inspired minimal system */
:root {
  --color-bg: #f5f5f7;
  --color-surface: rgba(255, 255, 255, 0.86);
  --color-surface-solid: #ffffff;
  --color-surface-secondary: #f2f2f7;
  --color-primary: #007aff;
  --color-primary-dark: #0066d6;
  --color-primary-light: rgba(0, 122, 255, 0.10);
  --color-text: #1d1d1f;
  --color-text-muted: #6e6e73;
  --color-border: rgba(60, 60, 67, 0.14);
  --radius-sm: 9px;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.035);
  --shadow-md: 0 14px 40px rgba(0, 0, 0, 0.12);
  --shadow-hover: none;
}

html, body { max-width: 100%; }
body { min-width: 320px; }

button, input, select, textarea { font: inherit; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[contenteditable="true"]:focus-visible {
  outline: 3px solid rgba(0, 122, 255, 0.35);
  outline-offset: 2px;
}

.app-header {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 30;
  height: 56px;
  padding: 0 20px;
  background: rgba(250, 250, 252, 0.78);
  border-bottom: 1px solid var(--color-border);
  backdrop-filter: saturate(180%) blur(20px);
}

.brand strong { font-size: 15px; letter-spacing: -0.01em; }
.header-actions { display: flex; align-items: center; gap: 8px; }

.user-menu-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none !important;
  background: transparent !important;
  padding: 4px 6px !important;
}

#user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(145deg, #5ac8fa, #007aff);
  color: white;
  font-size: 12px;
  font-weight: 700;
}

.app-shell { display: block; min-height: 100vh; padding-top: 56px; }

.sidebar {
  position: fixed;
  top: 56px;
  left: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  width: 248px;
  flex-direction: column;
  height: auto;
  padding: 18px 12px 14px;
  overflow-y: auto;
  background: rgba(242, 242, 247, 0.78);
  border-right: 1px solid var(--color-border);
  backdrop-filter: saturate(160%) blur(18px);
}

.sidebar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 8px;
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

#project-tabs { display: block; padding: 0; border: 0; background: transparent; }
.sidebar-project-group { position: relative; }

#project-tabs .tab {
  display: flex;
  width: 100%;
  min-height: 40px;
  align-items: center;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  color: var(--color-text);
  font-size: 14px;
  font-weight: 550;
  text-align: left;
}

#project-tabs .all-projects-tab { margin-bottom: 2px; font-size: 15px; font-weight: 650; }

#project-tabs .tab:hover { background: rgba(120, 120, 128, 0.10); }
#project-tabs .tab.active { background: rgba(0, 122, 255, 0.14); color: var(--color-primary); font-weight: 650; }

.sidebar-project-action {
  position: absolute;
  top: 2px;
  right: 3px;
  width: 30px !important;
  height: 30px !important;
  opacity: 0;
}
.sidebar-project-rename { right: 35px; }
.sidebar-project-rename.only-action { right: 3px; }
#project-tabs .tab.has-one-action { padding-right: 42px; }
#project-tabs .tab.has-two-actions { padding-right: 74px; }

.sidebar-project-group:hover .sidebar-project-action,
.sidebar-project-action:focus-visible { opacity: 1; }

.sidebar-builds { margin: 2px 0 6px 18px; padding-left: 8px; border-left: 1px solid var(--color-border); }
.sidebar-build {
  display: block;
  width: 100%;
  padding: 6px 8px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 12px;
  text-align: left;
}
.sidebar-build:hover, .sidebar-build.active { background: rgba(120,120,128,.10); color: var(--color-text); }
.sidebar-build.active { font-weight: 600; }
.sidebar-footer { display: grid; gap: 4px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--color-border); }
.sidebar-footer button { padding: 7px 9px; border: none; border-radius: 8px; background: transparent; color: var(--color-text-muted); text-align: left; }
.sidebar-footer button:hover { background: rgba(120,120,128,.10); color: var(--color-text); }

.workspace {
  width: calc(100% - 248px);
  min-width: 0;
  margin-left: 248px;
}
.has-sheet-tabs .workspace { padding-bottom: 46px; }

.sheet-tabbar {
  position: fixed;
  z-index: 24;
  right: 0;
  bottom: 0;
  left: 248px;
  display: flex;
  height: 46px;
  align-items: flex-end;
  gap: 6px;
  padding: 6px 18px 0;
  border-top: 1px solid var(--color-border);
  background: rgba(246,246,248,.92);
  box-shadow: 0 -5px 18px rgba(0,0,0,.035);
  backdrop-filter: blur(24px) saturate(180%);
}
.sheet-tabbar[hidden] { display: none; }
.sheet-tab-list { display: flex; min-width: 0; max-width: calc(100% - 38px); align-items: flex-end; gap: 3px; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.sheet-tab {
  display: flex;
  height: 34px;
  flex: 0 0 auto;
  align-items: center;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 9px 9px 0 0;
  cursor: grab;
  position: relative;
}
.sheet-tab:active { cursor: grabbing; }
.sheet-tab.dragging { opacity: .42; }
.sheet-tab.sheet-drag-before::before,
.sheet-tab.sheet-drag-after::after {
  position: absolute;
  z-index: 2;
  top: 4px;
  bottom: 3px;
  width: 3px;
  border-radius: 999px;
  background: var(--color-primary);
  content: '';
}
.sheet-tab.sheet-drag-before::before { left: -3px; }
.sheet-tab.sheet-drag-after::after { right: -3px; }
.sheet-drag-handle {
  display: inline-flex;
  width: 18px;
  height: 26px;
  flex: 0 0 18px;
  align-items: center;
  justify-content: center;
  margin-left: 3px;
  color: var(--color-text-muted);
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.sheet-drag-handle:active { cursor: grabbing; }
.sheet-drag-handle svg { width: 14px; height: 14px; fill: currentColor; stroke: none; }
.sheet-tab:hover { background: rgba(120,120,128,.09); }
.sheet-tab.active {
  border-color: var(--color-border);
  background: var(--color-surface-solid);
  box-shadow: inset 0 2px 0 var(--color-primary);
}
.sheet-tab-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 190px;
  padding: 8px 12px;
  overflow: hidden;
  border: 0;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sheet-type-icon { display: inline-flex; width: 14px; height: 14px; flex: 0 0 14px; color: var(--color-text-muted); }
.sheet-type-icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.sheet-tab.active .sheet-type-icon { color: var(--color-primary); }
.sheet-tab.active .sheet-tab-name { color: var(--color-text); font-weight: 650; }
.sheet-tab-remove,
.sheet-tab-rename {
  display: inline-flex;
  width: 25px;
  height: 25px;
  align-items: center;
  justify-content: center;
  margin-right: 4px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 17px;
  line-height: 1;
}
.sheet-tab-rename {
  margin-right: 1px;
  color: var(--color-text-muted);
}
.sheet-tab-rename svg { width: 14px; height: 14px; }
.sheet-tab-rename:hover { background: rgba(0,122,255,.10); color: var(--color-primary); }
.sheet-tab-remove:hover { background: rgba(255,59,48,.12); color: var(--color-error); }
.sheet-tab-add {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  margin-bottom: 1px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 9px;
  background: var(--color-surface-solid);
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
  font-size: 20px;
  line-height: 1;
}
.sheet-tab-add:hover { background: var(--color-surface-secondary); }
.sheet-type-hint { margin: -2px 0 14px; color: var(--color-text-muted); font-size: 12px; line-height: 1.5; }
.doc-sheet { width: 100%; max-width: 100%; padding: 0 28px 54px; overflow-x: clip; }
.markdown-body,
.doc-editor {
  width: 100%;
  min-height: 420px;
  margin: 0;
  padding: clamp(24px, 4vw, 52px);
  border: 1px solid var(--color-border);
  border-radius: 18px;
  background: var(--color-surface-solid);
  box-shadow: var(--shadow-sm);
}
.doc-editor { display: block; resize: vertical; color: var(--color-text); font: 14px/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.doc-editor[hidden], .markdown-body[hidden] { display: none; }
.markdown-body { overflow-x: hidden; color: var(--color-text); font-size: 15px; line-height: 1.7; overflow-wrap: anywhere; }
.markdown-body > :first-child { margin-top: 0; }
.markdown-body > :last-child { margin-bottom: 0; }
.markdown-body h1, .markdown-body h2, .markdown-body h3 { margin: 1.5em 0 .55em; letter-spacing: -.025em; line-height: 1.25; }
.markdown-body h1 { padding-bottom: .35em; border-bottom: 1px solid var(--color-border); font-size: 30px; }
.markdown-body h2 { font-size: 23px; }
.markdown-body h3 { font-size: 18px; }
.markdown-body p, .markdown-body ul, .markdown-body ol, .markdown-body pre, .markdown-body blockquote, .markdown-body table { margin: 0 0 1em; }
.markdown-body code { padding: .15em .35em; border-radius: 5px; background: var(--color-surface-secondary); font: .9em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.markdown-body pre { overflow-x: auto; padding: 15px; border-radius: 11px; background: var(--color-surface-secondary); }
.markdown-body pre code { padding: 0; background: transparent; }
.markdown-body blockquote { margin-left: 0; padding-left: 14px; border-left: 3px solid var(--color-primary); color: var(--color-text-muted); }
.markdown-body table { width: 100%; max-width: 100%; border-collapse: collapse; table-layout: fixed; }
.markdown-body th, .markdown-body td { min-width: 0; padding: 8px 12px; overflow-wrap: anywhere; border: 1px solid var(--color-border); text-align: left; vertical-align: top; }
.markdown-body th { background: var(--color-surface-secondary); }
.markdown-body a { color: var(--color-primary); }
.doc-empty { color: var(--color-text-muted); text-align: center; }
.has-sheet-tabs .toast-region { bottom: 58px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 30px 28px 18px; }
.workspace-toolbar { position: relative; }
.page-eyebrow { margin: 0 0 3px; color: var(--color-primary); font-size: 12px; font-weight: 650; }
.page-header h1 { margin: 0; font-size: clamp(24px, 3vw, 30px); font-weight: 700; letter-spacing: -0.035em; line-height: 1.15; }
.page-subtitle { margin: 5px 0 0; color: var(--color-text-muted); font-size: 13px; }

.page-actions { position: relative; display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 0; background: transparent; border: 0; flex-wrap: wrap; }
#global-actions.page-actions { padding: 0; background: transparent; border: 0; }
.new-actions-wrap { position: relative; }
.new-actions-wrap .popover-menu { top: 42px; right: 0; }

.primary-button,
#global-actions .primary-button {
  min-height: 34px;
  padding: 7px 15px;
  border: none;
  border-radius: 999px;
  background: var(--color-primary);
  color: white;
  font-size: 13px;
  font-weight: 600;
}

#global-actions #btn-create-build.primary-button { border: 0; background: var(--color-primary); color: white; }

.secondary-button,
#global-actions .secondary-button {
  min-height: 34px;
  padding: 7px 13px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface-solid);
  color: var(--color-text);
  font-size: 13px;
  font-weight: 550;
  box-shadow: var(--shadow-sm);
}

.secondary-button:hover,
#global-actions .secondary-button:hover { background: var(--color-surface-secondary); color: var(--color-text); box-shadow: none; }

.icon-button,
#global-actions .icon-button {
  display: inline-flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 50%;
}

.icon-button svg,
#search-icon svg,
.tc-action-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mobile-only { display: none; }
.sidebar-scrim { display: none; }

.popover-menu,
.filter-popover {
  position: absolute;
  z-index: 25;
  padding: 6px;
  border: 1px solid var(--color-border);
  border-radius: 13px;
  background: rgba(255,255,255,.94);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(24px) saturate(180%);
}

.popover-menu { top: 42px; right: 0; min-width: 160px; }
.popover-menu button { width: 100%; padding: 8px 10px !important; border: 0 !important; border-radius: 8px !important; background: transparent !important; color: var(--color-text) !important; text-align: left; }
.popover-menu button:hover { background: var(--color-surface-secondary) !important; }

.filter-bar { position: relative; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 28px 14px; padding: 0; background: transparent; border: 0; }
#filters.filter-bar { padding: 0; background: transparent; border: 0; }
.search-field { display: flex; width: min(360px, 100%); align-items: center; gap: 7px; padding: 0 11px; border: 1px solid var(--color-border); border-radius: 11px; background: var(--color-surface-solid); }
#search-icon { display: flex; color: var(--color-text-muted); }
#search-icon svg { width: 16px; height: 16px; }
.search-field input { width: 100%; padding: 9px 0 !important; border: 0 !important; background: transparent !important; box-shadow: none !important; }
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-chip { padding: 6px 9px !important; border: 0 !important; border-radius: 999px !important; background: var(--color-primary-light) !important; color: var(--color-primary) !important; font-size: 12px !important; }
.filter-popover { top: 44px; right: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: min(420px, calc(100vw - 32px)); padding: 16px; }
.filter-popover[hidden], .popover-menu[hidden] { display: none; }
.filter-popover label { display: grid; gap: 4px; color: var(--color-text-muted); font-size: 11px; font-weight: 600; }
.filter-popover input, .filter-popover select { width: 100%; padding: 8px 9px; border: 1px solid var(--color-border); border-radius: 8px; background: var(--color-surface-solid); color: var(--color-text); }
.filter-popover-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 6px; padding-top: 6px; }

#testcase-list { padding: 0 28px 44px; overflow-x: clip; }
.show-more-cases {
  display: block;
  margin: 16px auto 2px;
  padding: 9px 16px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface-solid);
  color: var(--color-primary);
  box-shadow: var(--shadow-sm);
  font-size: 12px;
  font-weight: 600;
}
.show-more-cases:hover { background: var(--color-surface-secondary); }
.tc-header, .tc-row-main, .test-step-row { grid-template-columns: 36px minmax(220px, 1fr) 82px 126px minmax(150px, 220px) minmax(120px, 160px) 92px; }
.tc-header { position: static; margin: 0 28px; padding: 8px 14px; border: 0; background: transparent; color: var(--color-text-muted); text-transform: none; font-size: 11px; letter-spacing: 0; }

/* Lives on the right of the filter/search row to stay compact. margin-left:auto
   pushes the whole group to the far right; the filter bar wraps it under only
   when the row genuinely runs out of width. */
.checklist-metrics { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 12px; margin: 0 0 0 auto; }
.checklist-metrics[hidden] { display: none; }
.metrics-bar { display: flex; width: min(180px, 40vw); height: 8px; border-radius: 999px; overflow: hidden; background: var(--color-surface-secondary); box-shadow: inset 0 0 0 1px var(--color-border); }
.metrics-seg { height: 100%; }
.metrics-summary { display: flex; align-items: baseline; gap: 7px; white-space: nowrap; }
.metrics-passrate { font-size: 13px; font-weight: 700; color: var(--color-text); }
.metrics-done { font-size: 11px; color: var(--color-text-muted); }
.metrics-legend { display: flex; flex-wrap: wrap; gap: 4px 9px; }
.metrics-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--color-text-muted); white-space: nowrap; }
.metrics-chip i { width: 8px; height: 8px; border-radius: 50%; }

@keyframes tc-spin { to { transform: rotate(360deg); } }
#btn-refresh.is-spinning svg { animation: tc-spin .6s linear infinite; transform-origin: center; }
@media (prefers-reduced-motion: reduce) { #btn-refresh.is-spinning svg { animation: none; } }

@media (min-width: 901px) {
  .checklist-view .workspace-toolbar {
    position: sticky;
    z-index: 19;
    top: 56px;
    border-bottom: 1px solid var(--color-border);
    background: rgba(245,245,247,.92);
    box-shadow: 0 5px 18px rgba(0,0,0,.035);
    backdrop-filter: saturate(180%) blur(20px);
  }
  .checklist-view .page-header {
    min-height: 52px;
    align-items: center;
    gap: 14px;
    padding: 9px 28px 5px;
  }
  .checklist-view .page-header-copy { min-width: 150px; }
  .checklist-view .page-eyebrow { margin-bottom: 1px; font-size: 10px; }
  .checklist-view .page-header h1 { font-size: 21px; line-height: 1.05; }
  .checklist-view .page-subtitle { display: none; }
  .checklist-view #global-actions.page-actions { gap: 6px; flex-wrap: wrap; }
  .checklist-view #active-build-hint { display: none; }
  .checklist-view #global-actions .primary-button,
  .checklist-view #global-actions .secondary-button {
    min-height: 30px;
    padding: 5px 11px;
    font-size: 12px;
  }
  .checklist-view #global-actions .icon-button { width: 30px; height: 30px; padding: 0; }
  .checklist-view .bulk-actions { gap: 4px; padding-left: 7px; }
  .checklist-view .bulk-actions strong { font-size: 11px; }
  .checklist-view .bulk-actions select { max-width: 112px; padding: 5px 7px; font-size: 12px; }
  .checklist-view #filters.filter-bar { min-height: 38px; margin: 0 28px 3px; gap: 6px; }
  .checklist-view .search-field { width: min(300px, 100%); }
  .checklist-view .search-field input { padding: 6px 0 !important; font-size: 12px; }
  .checklist-view #btn-filter-popover { min-height: 30px; padding: 5px 10px; font-size: 12px; }
  .checklist-view .filter-chip { padding: 4px 8px !important; font-size: 11px !important; }
  .checklist-view .tc-header { margin: 0 28px; padding: 5px 14px 6px; }
  .checklist-view .checklist-metrics { margin-left: auto; gap: 5px 10px; }
}

.tc-row { gap: 0; margin-bottom: 10px; padding: 0; overflow: hidden; border: 1px solid var(--color-border); border-radius: 15px; background: var(--color-surface-solid); box-shadow: var(--shadow-sm); }
.tc-row:hover { transform: none; box-shadow: var(--shadow-sm); }
.tc-row-main { padding: 14px; align-items: center; }
.parent-marker { display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; border-radius: 8px; background: var(--color-surface-secondary); color: var(--color-text-muted); font-size: 9px; font-weight: 700; }
.parent-info { display: grid; min-width: 0; gap: 2px; }
.feature-label { width: fit-content; min-height: 0; padding: 0; color: var(--color-primary); font-size: 11px; font-weight: 600; }
.parent-title {
  min-width: 0;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  resize: none;
  color: var(--color-text);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.4;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.parent-title, .feature-label, .step-title { width: 100%; border: 0; background: transparent; }
.feature-label { max-width: 150px; }
.step-summary { padding: 0; font-size: 11px; }

.test-step-section { margin: 0; border-top: 1px solid var(--color-border); background: rgba(242,242,247,.45); }
.test-step-row { padding: 10px 14px; align-items: center; border-bottom: 1px solid var(--color-border); }
.test-step-row:last-of-type { border-bottom: 0; }
.step-select-wrap { display: flex; padding: 0; justify-content: center; }
.step-title-wrap { gap: 4px; }
.step-title { min-width: 0; min-height: 22px; padding: 0; overflow: hidden; resize: none; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; font-size: 13px; }
.tc-row-main .test-flag-select,
.test-step-row .test-flag-select { width: fit-content; max-width: 82px; }
.add-step-btn { margin: 0 0 0 50px; padding: 9px 12px; }
.tc-row-actions { opacity: 0.45; }
.tc-row:hover .tc-row-actions, .tc-row-actions:focus-within { opacity: 1; }
.tc-action-btn { display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; padding: 0; }
.tc-action-btn:disabled { opacity: 0.25; cursor: default; }

.build-report-table { border-color: var(--color-border); border-radius: 15px; box-shadow: var(--shadow-sm); }
.build-report-table th { background: var(--color-surface-secondary); text-transform: none; letter-spacing: 0; }
#build-report { padding: 0 28px 44px; }
.overall-status-card { border-color: var(--color-border); box-shadow: var(--shadow-sm); }
.report-danger-btn { width: 30px; height: 30px; padding: 0; opacity: .45; }
.build-report-table tr:hover .report-danger-btn, .report-danger-btn:focus-visible { opacity: 1; }

.toast-region { position: fixed; z-index: 100; right: 18px; bottom: 18px; display: grid; gap: 8px; pointer-events: none; }
.toast { min-width: 220px; max-width: 360px; padding: 11px 14px; border: 1px solid var(--color-border); border-radius: 12px; background: rgba(255,255,255,.92); color: var(--color-text); box-shadow: var(--shadow-md); backdrop-filter: blur(20px); font-size: 13px; animation: toast-in .2s ease-out; }
.toast.error { border-left: 3px solid var(--color-error); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

dialog { border-color: var(--color-border); background: rgba(255,255,255,.96); backdrop-filter: blur(28px) saturate(180%); }
dialog::backdrop { background: rgba(0,0,0,.24); backdrop-filter: blur(2px); }
.confirmation-message { margin: -6px 0 18px; color: var(--color-text-muted); font-size: 13px; line-height: 1.5; }
.message-value { padding: 12px; overflow-wrap: anywhere; white-space: pre-wrap; border-radius: 10px; background: var(--color-surface-secondary); font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; user-select: all; }
.danger-button { padding: 8px 16px; border: none; border-radius: var(--radius-sm); background: var(--color-error); color: white; font-weight: 600; }

.auth-card { max-width: 860px; border-color: var(--color-border); box-shadow: 0 22px 70px rgba(0,0,0,.12); }

@media (min-width: 1400px) and (min-height: 800px) {
  body.auth-page { padding: 40px; }
  .auth-card {
    max-width: 1120px;
    min-height: min(640px, calc(100vh - 96px));
  }
  .auth-form-col { padding: 64px 68px; }
  .auth-brand-row { margin-bottom: 48px; }
  .auth-card h1 { font-size: 30px; }
  .auth-card p.subtitle { margin-bottom: 32px; font-size: 14px; }
  .auth-card select, .auth-card input { min-height: 48px; font-size: 15px; }
  .auth-card button { min-height: 48px; font-size: 15px; }
  .auth-illustration-col { padding: 48px; }
  .auth-illustration { max-width: 520px; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #000000;
    --color-surface: rgba(28,28,30,.88);
    --color-surface-solid: #1c1c1e;
    --color-surface-secondary: #2c2c2e;
    --color-text: #f5f5f7;
    --color-text-muted: #a1a1a6;
    --color-border: rgba(235,235,245,.16);
    --color-primary: #0a84ff;
    --color-primary-dark: #409cff;
    --color-primary-light: rgba(10,132,255,.16);
  }
  .app-header, .sidebar { background: rgba(28,28,30,.78); }
  .sheet-tabbar { background: rgba(20,20,22,.92); }
  .popover-menu, .filter-popover, dialog, .toast { background: rgba(44,44,46,.96); }
  .test-step-section { background: rgba(44,44,46,.45); }
  .checklist-view .workspace-toolbar { background: rgba(20,20,22,.92); }
.auth-illustration-col { background: #f5f5f7; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media (min-width: 901px) and (max-width: 1200px) {
  .tc-header { display: none !important; }
  .tc-row-main { grid-template-columns: 32px minmax(0, 1fr) auto; padding: 13px; }
  .tc-row-main .test-flag-select { grid-column: 2; grid-row: 2; }
  .tc-row-main .status-select { grid-column: 3; grid-row: 2; justify-self: start; }
  .tc-row-main .tc-note-cell { grid-column: 2 / -1; grid-row: 3; }
  .tc-row-main .tc-last-tested { display: none; }
  .tc-row-main .tc-row-actions { grid-column: 3; grid-row: 1; }
  .test-step-row { grid-template-columns: 28px minmax(0,1fr) auto; gap: 8px; padding: 12px; }
  .test-step-row .test-flag-select { grid-column: 2; grid-row: 2; }
  .test-step-row .status-select { grid-column: 2; grid-row: 3; justify-self: start; }
  .test-step-row .tc-note-cell { grid-column: 2 / -1; grid-row: 4; }
  .test-step-row .tc-last-tested { grid-column: 2; grid-row: 5; }
  .test-step-row .tc-row-actions { grid-column: 3; grid-row: 1 / span 5; }
}

@media (max-width: 900px) {
  .mobile-only { display: inline-flex; }
  .sidebar { position: fixed; z-index: 50; top: 0; left: 0; height: 100vh; width: min(300px, 86vw); transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow-md); }
  .workspace { width: 100%; margin-left: 0; }
  .sheet-tabbar { left: 0; padding-right: 12px; padding-left: 12px; }
  .sidebar-scrim { position: fixed; z-index: 45; inset: 0; width: 100%; height: 100%; border: 0; background: rgba(0,0,0,.28); opacity: 0; pointer-events: none; transition: opacity .22s ease; }
  .sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-open .sidebar-scrim { display: block; opacity: 1; pointer-events: auto; }
  .page-header { align-items: flex-start; padding: 24px 18px 14px; flex-direction: column; }
  .page-actions { justify-content: flex-start; }
  .filter-bar { margin: 0 18px 12px; flex-wrap: wrap; }
  .search-field { flex: 1 1 240px; }
  #testcase-list, #build-report { padding: 0 18px 32px; }
  .doc-sheet { padding: 0 18px 52px; }
  .markdown-body, .doc-editor { min-height: 360px; padding: 22px 18px; border-radius: 15px; }
  .tc-header { display: none !important; }
  .tc-row-main { grid-template-columns: 32px minmax(0, 1fr) auto; padding: 13px; }
  .tc-row-main .test-flag-select { grid-column: 2; grid-row: 2; }
  .tc-row-main .status-select { grid-column: 3; grid-row: 2; justify-self: start; }
  .tc-row-main .tc-note-cell { grid-column: 2 / -1; grid-row: 3; }
  .tc-row-main .tc-last-tested { display: none; }
  .tc-row-main .tc-row-actions { grid-column: 3; grid-row: 1; }
  .test-step-row { grid-template-columns: 28px minmax(0,1fr) auto; gap: 8px; padding: 12px; }
  .test-step-row .test-flag-select { grid-column: 2; grid-row: 2; }
  .test-step-row .status-select { grid-column: 2; grid-row: 3; justify-self: start; }
  .test-step-row .tc-note-cell { grid-column: 2 / -1; grid-row: 4; }
  .test-step-row .tc-last-tested { grid-column: 2; grid-row: 5; }
  .test-step-row .tc-row-actions { grid-column: 3; grid-row: 1 / span 5; }
  .project-donut-cell { min-width: 210px; }
}

@media (max-width: 560px) {
  .app-header { padding: 0 12px; }
  .header-actions { gap: 3px; }
  .notification-button { margin-right: 0; padding: 5px 8px !important; }
  .button-label, #current-user { display: none; }
  .page-actions { width: 100%; }
  .build-select-hint { display: none !important; }
  .filter-popover { grid-template-columns: 1fr; left: 0; right: auto; }
  .filter-popover-actions { grid-column: 1; }
  .overall-status-card { flex-direction: column; }
  .overall-status-card,
  .overall-status-card > div { min-width: 0; width: 100%; }
  .status-legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 10px; }
  .status-legend span { min-width: 0; white-space: nowrap; font-size: 11px; }

  .build-report-table,
  .build-report-table tbody { display: block; width: 100%; }
  .build-report-table thead { display: none; }
  .build-report-table { overflow: visible; border: 0; background: transparent; box-shadow: none; }
  .build-report-table tbody { display: grid; gap: 10px; }
  .build-report-table tr[data-project-name] {
    display: grid;
    width: 100%;
    max-width: 100%;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 9px 14px;
    padding: 15px;
    border: 1px solid var(--color-border);
    border-radius: 15px;
    background: var(--color-surface-solid);
    box-shadow: var(--shadow-sm);
  }
  .build-report-table tr[data-project-name] td {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0;
    border: 0;
    font-size: 12px;
  }
  .build-report-table tr[data-project-name] td:first-child { grid-column: 1; }
  .build-report-table tr[data-project-name] td:nth-child(2) { grid-column: 1 / -1; }
  .build-report-table tr[data-project-name] td:nth-child(3)::before { content: "Tests"; }
  .build-report-table tr[data-project-name] td:nth-child(4)::before { content: "Pass rate"; }
  .build-report-table tr[data-project-name] td:nth-child(5)::before { content: "Last tested"; }
  .build-report-table tr[data-project-name] td:nth-child(6)::before { content: "Builds"; }
  .build-report-table tr[data-project-name] td:nth-child(n+3):nth-child(-n+6)::before {
    color: var(--color-text-muted);
    font-size: 11px;
  }
  .build-report-table tr[data-project-name] td:nth-child(n+3):nth-child(-n+6) { grid-column: 1 / -1; }
  .build-report-table tr[data-project-name] td:last-child { grid-column: 2; grid-row: 1; }
  .project-name-button { overflow-wrap: anywhere; font-size: 14px; }
  .project-donut-cell { min-width: 0; }
  .project-status-summary { width: 100%; }
  .project-status-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-search-empty { display: block; }
  .project-search-empty td { display: block; border: 0; }
  .runner-status-actions { grid-template-columns: 1fr 1fr; }
  .auth-page { padding: 12px; }
  .auth-form-col { padding: 34px 24px; }
  .help-guide { grid-template-columns: 1fr; }
  .help-api-steps { grid-template-columns: 1fr; }
  .help-api-guide { padding: 15px; }
  .help-dialog { padding: 22px 18px; }
}
