* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", sans-serif;
  background: #f6f8fa;
  color: #1f2328;
  font-size: 14px;
  line-height: 1.5;
}

.wrap { max-width: 1240px; margin: 0 auto; padding: 24px; }

.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  position: relative;
}
.version-badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; color: #656d76; background: #f6f8fa;
  border: 1px solid #d0d7de; border-radius: 10px; padding: 2px 8px;
}
.login-version { position: absolute; top: 16px; right: 16px; }
.login-card {
  background: #ffffff; border: 1px solid #d0d7de; border-radius: 8px;
  padding: 32px 36px; text-align: center; min-width: 320px;
  box-shadow: 0 1px 3px rgba(31,35,40,0.08);
}
.login-card h1 { margin: 0 0 8px 0; font-size: 20px; font-weight: 600; }
.login-card .hint { color: #656d76; font-size: 13px; margin: 0 0 20px 0; }
.login-card .login-error {
  margin-top: 16px; color: #cf222e; font-size: 12px; max-width: 280px;
}

header {
  display: flex; align-items: baseline; justify-content: space-between;
  padding-bottom: 16px; margin-bottom: 20px;
  border-bottom: 1px solid #d0d7de;
}
header h1 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
header .region {
  font-size: 12px; color: #656d76; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
header .whoami {
  font-size: 12px; color: #656d76;
}
header .whoami a { color: #0969da; }

.header-right { display: flex; align-items: center; gap: 12px; }

.env-switcher { display: flex; gap: 4px; }
.envswitch {
  background: #ffffff; border: 1px solid #d0d7de; color: #656d76;
  padding: 4px 10px; border-radius: 4px; font-size: 12px; cursor: pointer;
}
.envswitch:hover { background: #f3f4f6; color: #1f2328; }
.envswitch.active { background: #0969da; border-color: #0969da; color: #fff; }

.loading, .empty {
  padding: 40px; text-align: center; color: #656d76;
  background: #ffffff; border: 1px dashed #d0d7de; border-radius: 6px;
}
.empty { padding: 24px; font-style: italic; font-size: 13px; }

.matrix {
  width: 100%; border-collapse: collapse;
  background: #ffffff;
  margin-bottom: 16px; border: 1px solid #afb8c1;
}
.matrix th, .matrix td {
  padding: 10px 14px; text-align: center;
  border: 1px solid #d0d7de;
}
.matrix th {
  background: #f6f8fa; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.03em; color: #656d76;
}
.matrix th.prod { color: #cf222e; background: #fff1f0; border-color: #ffc1ba; }
.matrix td.prod { background: #fff8f7; border-color: #ffd8d3; }
.matrix td.db-label {
  text-align: left; font-weight: 600; padding-left: 16px;
  background: #f6f8fa; color: #424a53;
}
.stage-group-divider { border-left: 2px solid #afb8c1; }
.matrix button {
  background: #2da44e; border: 1px solid rgba(31,35,40,0.08);
  color: white; padding: 6px 14px; border-radius: 5px;
  cursor: pointer; font-size: 12px; font-weight: 500;
  transition: background 0.1s ease;
}
.matrix button:hover { background: #2c974b; }
.matrix button:active { background: #1a7f37; }
.matrix td.prod button { background: #cf222e; }
.matrix td.prod button:hover { background: #a40e26; }
.matrix td.prod button:active { background: #82071e; }


.catalog {
  background: #ffffff; border: 1px solid #d0d7de;
  padding: 14px 16px; border-radius: 6px; margin-bottom: 24px;
  display: flex; align-items: center; gap: 12px;
}
.catalog h3 { margin: 0; font-size: 13px; font-weight: 600; flex: 1; }
.catalog h3 .hint { color: #656d76; font-weight: normal; font-size: 12px; margin-left: 8px; }
.catalog button {
  background: #2da44e; border: 1px solid rgba(31,35,40,0.08);
  color: white; padding: 6px 14px; border-radius: 5px;
  cursor: pointer; font-size: 12px; font-weight: 500;
}
.catalog button:hover { background: #2c974b; }
.catalog button.prod-btn { background: #cf222e; }
.catalog button.prod-btn:hover { background: #a40e26; }

.builds h2 {
  font-size: 14px; text-transform: uppercase; letter-spacing: 0.05em;
  color: #656d76; margin: 24px 0 10px 0;
}

.build {
  background: #ffffff; border: 1px solid #d0d7de; border-radius: 6px;
  margin-bottom: 10px; overflow: hidden;
}
.build.prod { border-color: #ffc1ba; }

.build-header {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; cursor: pointer; user-select: none;
}
.build-header:hover { background: #f6f8fa; }

.status-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: #656d76; flex-shrink: 0;
}
.build.running .status-dot { background: #bf8700; animation: pulse 1.4s ease-in-out infinite; }
.build.success .status-dot { background: #1a7f37; }
.build.failed  .status-dot { background: #cf222e; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}

.build-label { font-weight: 600; flex: 1; font-size: 13px; }
.build-status {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em;
  color: #656d76; padding: 2px 8px; border: 1px solid #d0d7de; border-radius: 10px;
}
.build.running .build-status { color: #9a6700; border-color: #eac54f; }
.build.success .build-status { color: #1a7f37; border-color: #aceebb; }
.build.failed  .build-status { color: #cf222e; border-color: #ffc1ba; }

.copy-logs-btn {
  font-size: 11px; color: #1f2328; background: #f6f8fa;
  border: 1px solid #d0d7de; border-radius: 4px; padding: 3px 8px;
  cursor: pointer;
}
.copy-logs-btn:hover:not(:disabled) { background: #eaeef2; }
.copy-logs-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.build-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; color: #656d76;
}
.build a {
  color: #0969da; text-decoration: none; font-size: 12px;
  padding: 3px 8px; border: 1px solid #0969da; border-radius: 4px;
}
.build a:hover { background: rgba(9,105,218,0.08); }

.build-log {
  background: #f6f8fa; color: #1f2328; margin: 0;
  padding: 12px 16px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px; line-height: 1.55;
  max-height: 480px; overflow-y: auto;
  white-space: pre-wrap; word-break: break-word;
  border-top: 1px solid #eaeef2;
}

.confirm-backdrop {
  position: fixed; inset: 0; background: rgba(31,35,40,0.4);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.confirm-modal {
  background: #ffffff; border: 1px solid #d0d7de; border-radius: 8px;
  padding: 20px 24px; width: 460px; max-width: 90vw;
  box-shadow: 0 8px 24px rgba(31,35,40,0.2);
}
.confirm-modal h3 { margin: 0 0 12px 0; color: #cf222e; font-size: 16px; }
.confirm-modal p { margin: 8px 0; font-size: 13px; color: #424a53; }
.confirm-modal code {
  background: #f6f8fa; padding: 2px 6px; border-radius: 3px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #cf222e;
}
.confirm-modal input[type="text"] {
  width: 100%; padding: 8px 12px; background: #ffffff; color: #1f2328;
  border: 1px solid #d0d7de; border-radius: 5px; font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  margin-top: 4px;
}
.confirm-modal input[type="text"]:focus { outline: none; border-color: #0969da; }
.confirm-modal .row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.confirm-modal button {
  padding: 6px 14px; border-radius: 5px; font-size: 13px; cursor: pointer;
  border: 1px solid #d0d7de; background: #f6f8fa; color: #1f2328;
}
.confirm-modal button:hover { background: #eaeef2; }
.confirm-modal button.danger { background: #cf222e; border-color: #cf222e; color: white; }
.confirm-modal button.danger:hover:not(:disabled) { background: #a40e26; }
.confirm-modal button:disabled { opacity: 0.5; cursor: not-allowed; }

.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: #ffffff; border: 1px solid #d0d7de; border-radius: 6px;
  padding: 12px 16px; font-size: 13px; max-width: 400px;
  box-shadow: 0 8px 24px rgba(31,35,40,0.16);
}
.toast.error { border-color: #cf222e; color: #a40e26; }

/* ── Tabs ─────────────────────────────────────────────────────────── */
.tabs {
  display: flex; gap: 4px; margin-bottom: 20px;
  border-bottom: 1px solid #d0d7de;
}
.tabs .tab {
  background: transparent; border: none; color: #656d76;
  padding: 10px 18px; font-size: 13px; cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.1s ease, border-color 0.1s ease;
  margin-bottom: -1px;
}
.tabs .tab:hover:not(:disabled) { color: #1f2328; }
.tabs .tab.active {
  color: #1f2328; border-bottom-color: #0969da; font-weight: 600;
}
.tabs .tab:disabled { color: #afb8c1; cursor: not-allowed; }

/* ── Branch promotion tab ────────────────────────────────────────── */
.promote {
  display: flex; flex-direction: column; gap: 16px;
}

.promote-repo {
  background: #ffffff; border: 1px solid #d0d7de; border-radius: 6px;
  overflow: hidden;
}
.promote-repo-header {
  padding: 12px 16px; background: #f6f8fa;
  display: flex; align-items: baseline; gap: 12px;
  border-bottom: 1px solid #d0d7de;
}
.promote-repo-label { font-weight: 600; font-size: 14px; }
.promote-repo-slug {
  color: #656d76; font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.promote-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid #eaeef2;
}
.promote-row:last-child { border-bottom: none; }
.promote-row.prod { background: #fff8f7; }
.promote-row.prod:not(:last-child) { border-bottom-color: #ffe4df; }

.promote-arrow {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px; font-weight: 500; min-width: 180px;
}
.prod-badge {
  background: #cf222e; color: white; font-size: 10px;
  padding: 2px 6px; border-radius: 3px; letter-spacing: 0.05em;
  font-weight: 700;
}
.promote-automerge {
  display: flex; align-items: center; gap: 6px;
  color: #424a53; font-size: 12px; cursor: pointer;
  margin-left: auto;
}
.promote-automerge input { cursor: pointer; }

.promote-btn {
  background: #2da44e; border: 1px solid rgba(31,35,40,0.08);
  color: white; padding: 6px 14px; border-radius: 5px;
  cursor: pointer; font-size: 12px; font-weight: 500;
}
.promote-btn:hover { background: #2c974b; }
.promote-btn.prod-btn { background: #cf222e; }
.promote-btn.prod-btn:hover { background: #a40e26; }

.promote-results h2 {
  font-size: 14px; text-transform: uppercase; letter-spacing: 0.05em;
  color: #656d76; margin: 20px 0 10px 0;
}

.promote-result {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: #ffffff; border: 1px solid #d0d7de; border-radius: 6px;
  margin-bottom: 8px;
  font-size: 13px;
}
.promote-result.running .status-dot { background: #bf8700; animation: pulse 1.4s ease-in-out infinite; }
.promote-result.created .status-dot { background: #0969da; }
.promote-result.merged  .status-dot { background: #1a7f37; }
.promote-result.failed  .status-dot { background: #cf222e; }
.promote-result .build-label { flex: 1; }
.promote-result .build-status {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 2px 8px; border: 1px solid #d0d7de; border-radius: 10px;
  color: #656d76;
}
.promote-result.running .build-status { color: #9a6700; border-color: #eac54f; }
.promote-result.created .build-status { color: #0969da; border-color: #b6e3ff; }
.promote-result.merged  .build-status { color: #1a7f37; border-color: #aceebb; }
.promote-result.failed  .build-status { color: #cf222e; border-color: #ffc1ba; }
.promote-result a {
  color: #0969da; text-decoration: none; font-size: 12px;
  padding: 3px 8px; border: 1px solid #0969da; border-radius: 4px;
}
.promote-result a:hover { background: rgba(9,105,218,0.08); }
.promote-result .build-error {
  color: #a40e26; font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.github-connect-notice {
  background: #fbefff; border: 1px dashed #d8b9ff; color: #6639ba;
  padding: 10px 14px; border-radius: 6px; font-size: 12px;
  margin-bottom: 16px;
}
.github-connect-notice a { color: #6639ba; font-weight: 600; }

/* ── Auto pipeline tab ───────────────────────────────────────────── */
.pipeline-warning {
  background: #fff1f0; border: 1px dashed #ffc1ba; color: #a40e26;
  padding: 10px 14px; border-radius: 6px; font-size: 12px;
  margin-bottom: 16px;
}
.pipeline-error {
  color: #a40e26; font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 8px 16px; border-top: 1px solid #eaeef2;
}

.pipeline-full {
  background: #ffffff; border: 1px solid #d0d7de;
  padding: 14px 16px; border-radius: 6px; margin-bottom: 16px;
}
.pipeline-full h3 { margin: 0 0 10px 0; font-size: 13px; font-weight: 600; }
.pipeline-full h3 .hint { color: #656d76; font-weight: normal; font-size: 12px; margin-left: 8px; }
.pipeline-full-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0; border-top: 1px solid #eaeef2;
}
.pipeline-full-row:first-of-type { border-top: none; }
.pipeline-full-label { font-weight: 600; color: #424a53; font-size: 13px; }
.pipeline-full-btn {
  background: #8250df; border: 1px solid rgba(31,35,40,0.08);
  color: white; padding: 6px 14px; border-radius: 5px;
  cursor: pointer; font-size: 12px; font-weight: 500;
}
.pipeline-full-btn:hover { background: #8e5ce6; }
.pipeline-full-btn:active { background: #6639ba; }

/* --- Infoss migration console -------------------------------------------- */
/* Same light palette and 13px density as the rest of the app; the only new
   idea here is the status pill, because a run has seven outcomes and colour
   is what makes "one table failed" findable in an 83-row grid. */

.mig { margin-top: 16px; }

.mig-envbar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; margin-bottom: 16px;
  background: #ffffff; border: 1px solid #d0d7de; border-radius: 6px;
}
.mig-envbar label { font-size: 12px; color: #656d76; text-transform: uppercase; letter-spacing: 0.4px; }
.envbtn {
  background: #f6f8fa; border: 1px solid #d0d7de; color: #424a53;
  padding: 4px 12px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
.envbtn:hover:not(:disabled) { background: #eaeef2; color: #1f2328; }
.envbtn.active { background: #0969da; border-color: #0969da; color: #fff; }
.envbtn:disabled { opacity: 0.45; cursor: not-allowed; }
.mig-note { margin-left: auto; font-size: 12px; color: #656d76; font-style: italic; }

.mig-error {
  margin: 12px 0; padding: 10px 12px;
  background: #fff1f0; border: 1px solid #ffc1ba; border-radius: 6px;
  color: #a40e26; font-size: 13px; white-space: pre-wrap;
}

.mig h2 { font-size: 14px; margin: 20px 0 8px 0; display: flex; align-items: center; gap: 10px; }

.mig-table {
  width: 100%; border-collapse: collapse;
  background: #ffffff; border: 1px solid #d0d7de; border-radius: 6px;
  font-size: 13px;
}
/* The run grid is wide and the page must not scroll sideways because of it. */
.mig-run { overflow-x: auto; }
.mig-table th, .mig-table td {
  padding: 8px 10px; border-bottom: 1px solid #eaeef2; text-align: left; vertical-align: top;
}
.mig-table tr:last-child td { border-bottom: none; }
.mig-table th {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px;
  color: #656d76; font-weight: 600; background: #f6f8fa;
}
.mig-table tr.row-failed td { background: #fff8f7; }
.mig-table .mono { font-variant-numeric: tabular-nums; }

.mig-sub { font-size: 12px; color: #656d76; }
.mig-actions { white-space: nowrap; text-align: right; }
.linkbtn {
  background: none; border: none; color: #0969da;
  cursor: pointer; font-size: 13px; padding: 2px 6px;
}
.linkbtn:hover { text-decoration: underline; }

.mig-switch { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.mig-switch input { cursor: pointer; }

.mig-startrow td { background: #fafbfc; }
.mig-form { display: flex; flex-direction: column; gap: 10px; padding: 4px 0; }
.mig-formrow { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.mig-formrow input.yr { width: 80px; }
.mig-formrow input.dt { width: 220px; }
.mig-form input[type="number"], .mig-form input[type="datetime-local"] {
  background: #ffffff; border: 1px solid #d0d7de; color: #1f2328;
  border-radius: 6px; padding: 4px 8px; font-size: 13px;
}
.mig-form input:disabled { opacity: 0.4; }
.mig-write { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.gobtn {
  align-self: flex-start;
  background: #2da44e; border: none; color: #fff;
  padding: 6px 16px; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 600;
}
.gobtn:hover:not(:disabled) { background: #2c974b; }
.gobtn.danger { background: #cf222e; }
.gobtn.danger:hover:not(:disabled) { background: #a40e26; }
.gobtn:disabled { opacity: 0.45; cursor: not-allowed; }

.mig-progress {
  height: 6px; background: #eaeef2; border-radius: 3px;
  overflow: hidden; margin: 10px 0 6px 0;
}
.mig-bar { height: 100%; background: #0969da; transition: width 0.4s ease; }

.pill {
  display: inline-block; padding: 1px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.3px;
  border: 1px solid transparent;
}
.pill.ok        { color: #1a7f37; background: #dafbe1; border-color: #aceebb; }
.pill.running   { color: #9a6700; background: #fff8c5; border-color: #eac54f; }
.pill.fail      { color: #cf222e; background: #fff1f0; border-color: #ffc1ba; }
.pill.warn      { color: #9a6700; background: #fff8c5; border-color: #eac54f; }
/* Distinct from "ok" on purpose: a rehearsal migrated nothing, and a wall of
   green would be read as a company already loaded. */
.pill.rehearsal { color: #6639ba; background: #fbefff; border-color: #d8b9ff; }
.pill.muted     { color: #656d76; background: #f6f8fa; border-color: #d0d7de; }
.pill.pending   { color: #9a6700; background: #fff8c5; border-color: #eac54f; }
.pill.accepted  { color: #1a7f37; background: #dafbe1; border-color: #aceebb; }
.pill.revoked   { color: #656d76; background: #f6f8fa; border-color: #d0d7de; }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ── Admin (hidden tab) ──────────────────────────────────────────── */
.admin-totp-setup {
  background: #ffffff; border: 1px solid #d0d7de; border-radius: 6px;
  padding: 12px 16px; margin-bottom: 20px;
}
.admin-totp-setup .admin-accept-url { margin-bottom: 8px; }
.linkbtn:disabled { opacity: 0.5; cursor: not-allowed; }
.admin-form {
  background: #ffffff; border: 1px solid #d0d7de; border-radius: 6px;
  padding: 16px; margin-bottom: 24px; display: flex; flex-direction: column; gap: 12px;
}
.admin-form input[type="email"] {
  padding: 8px 12px; background: #ffffff; color: #1f2328;
  border: 1px solid #d0d7de; border-radius: 5px; font-size: 13px; max-width: 320px;
}
.admin-tabs-pick { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; }
.admin-tabs-pick label { cursor: pointer; display: flex; align-items: center; gap: 4px; }
.admin-form button {
  align-self: flex-start; background: #2da44e; border: 1px solid rgba(31,35,40,0.08);
  color: white; padding: 6px 14px; border-radius: 5px; cursor: pointer; font-size: 12px; font-weight: 500;
}
.admin-form button:hover:not(:disabled) { background: #2c974b; }
.admin-form button:disabled { opacity: 0.5; cursor: not-allowed; }
.admin-form .row { display: flex; gap: 8px; }
.admin-form input[type="text"] {
  padding: 8px 12px; background: #ffffff; color: #1f2328;
  border: 1px solid #d0d7de; border-radius: 5px; font-size: 13px; max-width: 160px;
}
.admin-accept-url {
  font-size: 12px; color: #656d76; margin-bottom: 20px; word-break: break-all;
}
.admin-accept-url code { color: #0969da; }
.admin-table { width: 100%; border-collapse: collapse; background: #ffffff; border: 1px solid #d0d7de; border-radius: 6px; }
.admin-table th, .admin-table td { padding: 8px 12px; text-align: left; font-size: 13px; border-bottom: 1px solid #eaeef2; }
.admin-table th { color: #656d76; font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; }
.admin-table tr:last-child td { border-bottom: none; }

/* ── Activity tab ────────────────────────────────────────────────── */
.activity-filter { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.activity-filter input[type="text"] {
  padding: 6px 10px; background: #ffffff; color: #1f2328;
  border: 1px solid #d0d7de; border-radius: 5px; font-size: 13px; max-width: 220px;
}
.activity-detail {
  max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: #424a53;
}
.activity-actions { display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.activity-logrow td { padding: 0; }
.activity-logrow .build-log { max-height: 320px; border-top: none; }
.activity-logrow .loading { margin: 0; border: none; background: transparent; }

/* ── Launcher tab ────────────────────────────────────────────────── */
.launcher-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
.launcher-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 24px 12px;
  background: #ffffff; border: 1px solid #d0d7de; border-radius: 10px;
  text-decoration: none; color: #1f2328;
  transition: border-color 0.1s ease, box-shadow 0.1s ease, transform 0.1s ease;
}
.launcher-tile:hover {
  border-color: #0969da; box-shadow: 0 4px 12px rgba(31,35,40,0.08);
  transform: translateY(-1px);
}
.launcher-icon { font-size: 28px; line-height: 1; }
.launcher-label { font-size: 13px; font-weight: 600; text-align: center; }
