:root {
  color-scheme: dark;
  --bg: #061f24;
  --bg-2: #082b30;
  --panel: #0d353b;
  --panel-2: #113f45;
  --line: rgba(192, 235, 213, 0.17);
  --ink: #eef8ef;
  --muted: #a8c8bf;
  --mint: #bfffc5;
  --mint-2: #83e5a5;
  --danger: #ff9c9c;
  --warning: #ffd190;
  --radius: 18px;
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 0%, rgba(75, 172, 120, 0.2), transparent 30rem),
    radial-gradient(circle at 95% 12%, rgba(42, 112, 120, 0.3), transparent 32rem),
    var(--bg);
  min-height: 100vh;
}

button, input { font: inherit; }
button { color: inherit; }
a { color: inherit; }

.topbar {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px clamp(20px, 4vw, 64px);
  border-bottom: 1px solid var(--line);
  background: rgba(6, 31, 36, 0.82);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-size: 25px;
  font-weight: 720;
  letter-spacing: -0.04em;
}

.brand img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.brand b {
  font-size: 14px;
  font-weight: 520;
  letter-spacing: 0;
  color: var(--muted);
  margin-left: 4px;
}

.session, .actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

main {
  width: min(1240px, calc(100% - 40px));
  margin: 34px auto 72px;
  display: grid;
  gap: 22px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(150deg, rgba(18, 66, 71, 0.93), rgba(8, 43, 48, 0.94));
  padding: clamp(22px, 3vw, 34px);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.17);
}

.current-panel {
  background:
    radial-gradient(circle at 100% 0%, rgba(191, 255, 197, 0.16), transparent 22rem),
    linear-gradient(145deg, #0d383d, #093035);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

h1, h2 {
  margin: 0;
  letter-spacing: -0.045em;
  line-height: 1.15;
}

h1 { font-size: clamp(30px, 4vw, 46px); }
h2 { font-size: clamp(24px, 3vw, 32px); }

.kicker {
  margin: 0 0 8px;
  color: var(--mint-2);
  font-size: 11px;
  letter-spacing: 0.16em;
  font-weight: 760;
}

.muted, .lede {
  color: var(--muted);
}

.lede {
  max-width: 76ch;
  line-height: 1.7;
  margin: 0 0 20px;
  font-size: 14px;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 680;
  white-space: nowrap;
}

.pill.pending { color: #163a2c; background: var(--mint); }
.pill.neutral { color: var(--muted); border: 1px solid var(--line); }
.pill.failed { color: var(--danger); border: 1px solid rgba(255, 156, 156, 0.4); }
.pill.warning { color: var(--warning); border: 1px solid rgba(255, 209, 144, 0.36); }

.release-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.metric {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(3, 23, 27, 0.25);
  min-width: 0;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 7px;
}

.metric strong, .metric code {
  display: block;
  font-size: 15px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

code {
  font-family: "Cascadia Code", Consolas, monospace;
  color: #d6ffe0;
}

.upload-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
  gap: 18px;
}

.upload-box, .validation-result {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(4, 26, 30, 0.28);
  padding: 20px;
}

.file-picker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px dashed rgba(191, 255, 197, 0.42);
  border-radius: 12px;
  padding: 17px;
  margin-bottom: 12px;
  font-weight: 670;
}

.file-picker input {
  max-width: 58%;
  color: var(--muted);
}

.progress-wrap { margin-top: 18px; }
progress {
  width: 100%;
  height: 12px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: #061c20;
}
progress::-webkit-progress-bar { background: #061c20; }
progress::-webkit-progress-value {
  background: linear-gradient(90deg, #55c886, var(--mint));
  border-radius: 999px;
}
progress::-moz-progress-bar { background: var(--mint-2); }

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-size: 12px;
  margin-top: 8px;
}

.validation-result {
  min-height: 160px;
}
.validation-result strong { color: var(--mint); }
.validation-result p {
  color: var(--muted);
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.validation-result.error strong { color: var(--danger); }
.validation-result.success strong { color: var(--mint); }

.button {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 15px;
  cursor: pointer;
  font-weight: 680;
  transition: transform 120ms ease, background 120ms ease, opacity 120ms ease;
}
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: 0.5; }
.button.primary { color: #072b1c; background: var(--mint); border-color: var(--mint); }
.button.ghost { background: transparent; color: var(--muted); }
.button.danger-ghost { background: transparent; color: var(--danger); border-color: rgba(255, 156, 156, 0.32); }
.button.small { padding: 8px 11px; font-size: 12px; }

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 880px;
}
th, td {
  text-align: left;
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: 13px;
}
th {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
td code { font-size: 12px; }
.actions-column { text-align: right; }
td.actions-column .actions { justify-content: flex-end; }
.empty { color: var(--muted); text-align: center; padding: 30px; }

.testflight-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
}
.testflight-form label {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
}
input[type="url"] {
  width: 100%;
  min-width: 0;
  color: var(--ink);
  background: rgba(4, 25, 29, 0.65);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}
input[type="url"]:focus-visible {
  outline: 2px solid var(--mint-2);
  outline-offset: 2px;
}

.message {
  padding: 14px 17px;
  border-radius: 12px;
  border: 1px solid rgba(191, 255, 197, 0.4);
  background: rgba(59, 135, 92, 0.16);
}
.message.error {
  border-color: rgba(255, 156, 156, 0.4);
  background: rgba(156, 64, 64, 0.14);
}

.skeleton { min-height: 95px; color: var(--muted); }

.auth-panel {
  width: min(560px, 100%);
  margin: 7vh auto 0;
}

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

.auth-brand img {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.auth-form {
  display: grid;
  gap: 16px;
}

.auth-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.auth-form input {
  width: 100%;
  color: var(--ink);
  background: rgba(4, 25, 29, 0.65);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px 14px;
  font-size: 16px;
}

.auth-form input:focus-visible {
  outline: 2px solid var(--mint-2);
  outline-offset: 2px;
}

.auth-form input[readonly] {
  color: var(--muted);
  background: rgba(4, 25, 29, 0.35);
}

.auth-submit {
  width: 100%;
  margin-top: 4px;
  min-height: 46px;
}

.totp-qr {
  display: grid;
  place-items: center;
  min-height: 246px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f4fff5;
  padding: 14px;
}

.totp-qr canvas,
.totp-qr img {
  display: block;
  width: min(232px, 100%);
  height: auto;
}

.totp-secret {
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 12px;
  overflow-wrap: anywhere;
  color: var(--muted);
}

footer {
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 900px) {
  .release-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .upload-layout { grid-template-columns: 1fr; }
  .testflight-form { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .topbar { align-items: flex-start; }
  .session { flex-direction: column; align-items: flex-end; }
  .session .muted { display: none; }
  .brand b { display: none; }
  main { width: min(100% - 24px, 1240px); margin-top: 18px; }
  .auth-panel { margin-top: 2vh; }
  .auth-brand img { width: 54px; height: 54px; }
  .panel { border-radius: 14px; padding: 18px; }
  .release-grid { grid-template-columns: 1fr; gap: 10px; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 10px; }
  .file-picker { align-items: stretch; flex-direction: column; }
  .file-picker input { max-width: 100%; }
  .testflight-form .actions { align-items: stretch; flex-direction: column; }
  .testflight-form .actions .button { width: 100%; }
  footer { flex-direction: column; gap: 8px; }
}
