:root {
  --bg: #ffffff;
  --panel: #ffffff;
  --ink: #1e293b;
  --muted: #64748b;
  --accent: #0f766e;
  --accent-2: #0ea5a4;
  --border: #dbe3ef;
  --button-active: rgb(37, 99, 235);
  --button-disabled: #9aa4b2;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: "Segoe UI", "SF Pro Text", "Helvetica Neue", sans-serif;
}

.top-brand {
  padding: 28px 0 0 72px;
}

.top-brand img {
  display: block;
  width: 120px;
  max-width: 44vw;
  height: auto;
}

.app {
  max-width: 840px;
  margin: 64px auto 0;
  padding: 0 20px 32px;
}

.hero h1 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: 0.2px;
}

.hero p {
  margin: 10px 0 0;
  color: var(--muted);
}

@media (max-width: 720px) {
  .top-brand {
    padding: 16px 0 0 20px;
  }
  .top-brand img {
    width: 130px;
  }
  .app {
    margin-top: 28px;
  }
}

.card,
.status-card {
  margin-top: 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.auth-box {
  text-align: center;
  padding: 12px 0;
}

.auth-box h2 {
  margin: 0 0 8px;
  font-size: 1.35rem;
}

.auth-box p {
  margin: 0 0 14px;
  color: var(--muted);
}

#ms-login-btn {
  display: inline-block;
  margin-top: 0;
}

form {
  display: grid;
  gap: 10px;
  min-width: 0;
}

form > * {
  min-width: 0;
}

label {
  font-size: 0.92rem;
  color: var(--muted);
}

input[type="file"],
select,
input[type="text"] {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 40px 10px 10px;
  background: #fff;
  font-size: 0.95rem;
}

input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.file-upload-row {
  width: 100%;
  max-width: 100%;
  border: none;
  border-radius: 10px;
  background: transparent;
  padding: 8px 0;
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}

select {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23374151' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 14px 14px;
}

input[type="text"] {
  padding: 10px;
}

.upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  color: #374151;
  background: #fff;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  flex: 0 0 auto;
  white-space: nowrap;
}

.upload-btn img {
  width: 16px;
  height: 16px;
  opacity: 0.85;
}

.selected-file-name {
  display: block;
  color: #b3b8c2;
  font-size: 0.95rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1 auto;
  min-width: 0;
}

button {
  margin-top: 8px;
  border: 1px solid var(--button-active);
  border-radius: 10px;
  padding: 11px 16px;
  font-weight: 600;
  color: white;
  background: var(--button-active);
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, opacity 120ms ease;
}

button:disabled {
  border-color: var(--button-disabled);
  background: var(--button-disabled);
  color: #f1f5f9;
  opacity: 1;
  cursor: not-allowed;
}

button.cancel-state {
  border: 1px solid rgb(255, 0, 0);
  color: #ff6666;
  background: rgb(255, 238, 238);
}

button.cancel-state:hover:enabled {
  border-color: #ff6666;
  background: #ffe9e9;
}

button.cancel-state:disabled {
  border-color: #f7b3b3;
  background: #fff3f3;
  color: #f3a5a5;
  cursor: not-allowed;
}

.status {
  font-weight: 600;
}

.details {
  margin: 10px 0 0;
  white-space: normal;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  min-height: 0;
  padding: 12px;
  color: #334155;
}

.details-progress {
  background: rgb(233 244 252);
  border: 1px solid rgb(185 232 255);
  color: rgb(160 174 192);
  padding: 14px 16px;
}

.details-error {
  background: rgb(252 233 233);
  border: 1px solid rgb(255 185 185);
  color: rgb(234 70 70);
}

.progress-top-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: nowrap;
  align-items: center;
}

.progress-pulse-text {
  font-weight: 500;
  font-size: 16px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: rgb(150 162 178);
  animation: pulseText 2.2s ease-in-out infinite;
}

.progress-eta {
  font-size: 16px;
  line-height: 1.2;
  color: rgb(150 162 178);
}

.progress-subtitle {
  margin-top: 8px;
  font-size: 16px;
  text-align: center;
  color: rgb(165 176 191);
}

.progress-track {
  margin-top: 12px;
  height: 10px;
  width: 100%;
  background: rgb(180 195 212);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 3%;
  background: rgb(72, 146, 255);
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(72, 146, 255, 0.25) inset;
  transition: width 700ms linear;
}

@keyframes pulseText {
  0% { color: rgb(150 162 178); }
  50% { color: rgb(210 220 232); }
  100% { color: rgb(150 162 178); }
}

.details a {
  color: var(--button-active);
  font-weight: 600;
  text-decoration: underline;
}

.download-label {
  color: #8b93a1;
  margin-bottom: 4px;
}

.download-link {
  display: inline;
  color: var(--button-active);
  font-weight: 700;
  text-decoration: underline;
}

.download-link:hover {
  text-decoration: underline;
}

.download-link img {
  width: 16px;
  height: 16px;
  margin-left: 6px;
  vertical-align: -2px;
  display: inline-block;
}
