:root {
  color-scheme: light;
  --bg: #f4f7fc;
  --surface: #ffffff;
  --surface-alt: #f8faff;
  --text: #111827;
  --muted: #5a667d;
  --line: #dbe3f1;
  --line-strong: #c5d2ea;
  --accent: #245ad8;
  --accent-soft: #e9f0ff;
  --success: #0f8f56;
  --error: #b42318;
}

* {
  box-sizing: border-box;
}

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

.layout {
  width: min(1240px, 96vw);
  margin: 22px auto 38px;
  display: grid;
  gap: 16px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.panel-head h1,
.panel-head h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}

.panel-head p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.signed-in {
  font-size: 13px;
  color: var(--muted);
}

.form {
  margin-top: 14px;
  display: grid;
  gap: 14px;
}

.dropzone {
  border: 1px dashed var(--line-strong);
  background: var(--surface-alt);
  border-radius: 8px;
  padding: 18px;
  cursor: pointer;
  display: grid;
  gap: 6px;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.dropzone:hover {
  border-color: #9db5e7;
  background: #f3f7ff;
}

.dropzone input[type="file"] {
  display: none;
}

.dropzone-title {
  font-size: 15px;
  font-weight: 600;
}

.dropzone-subtitle {
  font-size: 13px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

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

label {
  display: grid;
  gap: 6px;
}

label > span {
  font-size: 13px;
  color: var(--muted);
}

select,
input[type="number"],
input[type="text"],
input[type="password"] {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0 11px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

select:focus,
input[type="number"]:focus,
input[type="text"]:focus,
input[type="password"]:focus {
  border-color: #8ea8dc;
  box-shadow: 0 0 0 3px rgba(36, 90, 216, 0.08);
}

button,
.btn-link {
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

button:hover,
.btn-link:hover {
  border-color: var(--line-strong);
  background: #f7f9fe;
}

button:disabled,
.btn-link:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

#submit-btn {
  min-width: 168px;
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 600;
}

#submit-btn:hover {
  background: #1f4ebe;
  border-color: #1f4ebe;
}

.logout-btn {
  height: 32px;
  font-size: 13px;
}

.action-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.inline-note {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.progress-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px 12px;
  background: #fbfdff;
}

.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 13px;
}

#progress-stage {
  color: var(--muted);
}

#progress-percent {
  font-weight: 600;
}

.progress-track {
  width: 100%;
  height: 10px;
  background: #e8eef9;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #245ad8, #3d8dff);
  background-size: 32px 32px;
  transition: width 0.45s ease;
  animation: progressStripe 1.2s linear infinite;
}

.progress-wrap.complete .progress-fill {
  background: linear-gradient(90deg, #0e9e5d, #12b76a);
  animation: none;
}

.progress-wrap.error .progress-fill {
  background: linear-gradient(90deg, #c43226, #e35044);
  animation: none;
}

.status {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.status-error {
  color: var(--error);
}

.hidden {
  display: none;
}

.downloads {
  margin: 14px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn-link {
  background: var(--accent-soft);
  border-color: #cad9fc;
  color: #1c4eb9;
  font-weight: 500;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 920px;
  font-size: 13px;
}

thead {
  background: #f3f7ff;
}

th,
td {
  border-bottom: 1px solid #e7ecf7;
  text-align: left;
  padding: 8px 10px;
  vertical-align: top;
}

tbody tr:nth-child(even) {
  background: #fcfdff;
}

.pager {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

#page-label {
  font-size: 13px;
  color: var(--muted);
}

.login-layout {
  min-height: 100vh;
  place-content: center;
}

.login-panel {
  width: min(420px, 96vw);
  margin: 0 auto;
}

.error-text {
  margin: 12px 0 0;
  color: var(--error);
  font-size: 13px;
}

@keyframes progressStripe {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 32px 0;
  }
}

@media (max-width: 1024px) {
  .grid {
    grid-template-columns: repeat(2, minmax(165px, 1fr));
  }
}

@media (max-width: 640px) {
  .layout {
    width: 100%;
    margin: 0;
    padding: 12px;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  #submit-btn {
    width: 100%;
  }

  .action-row {
    align-items: stretch;
  }
}
