:root {
  --navy: #0b1e33;
  --navy-2: #12293f;
  --teal: #0d9488;
  --teal-dark: #0b7a70;
  --border: #dfe6ec;
  --bg: #f4f7f9;
  --text: #1c2b36;
  --muted: #64798a;
  --red: #c0362c;
  --red-bg: #fdeceb;
  --green: #1a7f4e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

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

a { color: var(--teal-dark); }

/* --- Topbar --- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--navy);
  color: #fff;
  padding: 14px 28px;
}

.topbar .muted { color: #b7c4cf; margin-right: 12px; }

.topbar-right { display: flex; align-items: center; }

.brand { display: flex; align-items: center; gap: 10px; }

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
}

.brand-name { font-weight: 600; font-size: 16px; letter-spacing: 0.2px; }

/* --- Buttons --- */
.btn {
  border: none;
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); }
.btn-block { width: 100%; margin-top: 8px; }

.btn-link {
  background: transparent;
  color: #cfe0ea;
  text-decoration: underline;
  padding: 4px 0;
  font-weight: 500;
}

.btn-play {
  background: var(--green);
  color: #fff;
  margin-left: auto;
}
.btn-play:hover { background: #146b41; }
.btn-play:disabled { opacity: 0.6; cursor: default; }

/* --- Auth screen --- */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 45%, var(--bg) 45%);
}

.auth-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(11, 30, 51, 0.25);
  padding: 36px 32px;
  width: 340px;
}

.auth-card .brand { margin-bottom: 20px; }
.auth-card h1 { margin: 0 0 4px; font-size: 22px; }
.auth-card p.muted { margin-top: 0; margin-bottom: 20px; }

.auth-card label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 14px 0 6px;
}

.auth-card input[type="text"],
.auth-card input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
}

/* --- Layout --- */
.container {
  max-width: 760px;
  margin: 32px auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px 24px;
}

.card h2 { margin-top: 0; font-size: 17px; }

/* --- Dropzone --- */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 30px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--teal);
  background: #f0fbfa;
}

.dropzone-icon {
  font-size: 22px;
  color: var(--teal);
  margin-bottom: 6px;
}

.upload-status { margin-top: 14px; }
.upload-status:empty { margin-top: 0; }

/* --- Alerts --- */
.alert {
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  margin-top: 10px;
}

.alert-error {
  background: var(--red-bg);
  color: var(--red);
}

.alert ul { margin: 6px 0 0; padding-left: 18px; }

/* --- Run rows --- */
#run-list { display: flex; flex-direction: column; gap: 14px; }

.run-row {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
}

.run-row-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.run-meta { font-size: 13px; color: var(--muted); }

.status-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #e7ebee;
  color: var(--muted);
}

.status-validated { background: #e2f6ea; color: var(--green); }
.status-provisioning, .status-running { background: #fff3d9; color: #92680a; }
.status-completed { background: #e2f6ea; color: var(--green); }
.status-invalid, .status-failed { background: var(--red-bg); color: var(--red); }

.run-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 14px;
}

.check-icon { color: var(--green); font-weight: 700; }

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #e0c477;
  border-top-color: #92680a;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.run-instance { font-size: 13px; margin-top: 8px; }

.result-gallery {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.result-thumb {
  display: block;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  text-decoration: none;
  transition: border-color 0.15s;
}

.result-thumb:hover { border-color: var(--teal); }

.result-thumb img {
  display: block;
  width: 100%;
  height: 90px;
  object-fit: contain;
  background: #f4f7f9;
}

.result-thumb-caption {
  display: block;
  padding: 6px 8px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
