:root {
  --bg: #f7f3ee;
  --ink: #111827;
  --muted: #607083;
  --panel: rgba(255, 255, 255, 0.86);
  --panel-solid: #ffffff;
  --line: rgba(25, 36, 54, 0.12);
  --rail: #10151e;
  --rail-soft: rgba(255, 255, 255, 0.08);
  --accent: #f05267;
  --accent-2: #ff9a5b;
  --teal: #13b89a;
  --violet: #6d5dfc;
  --ok: #0f9f7f;
  --warn: #c47a18;
  --danger: #d9364b;
  --shadow: 0 24px 70px rgba(23, 30, 42, 0.14);
  --soft-shadow: 0 14px 38px rgba(23, 30, 42, 0.1);
  --radius: 8px;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 14% 8%, rgba(255, 154, 91, 0.28), transparent 30%),
    radial-gradient(circle at 84% 0%, rgba(19, 184, 154, 0.24), transparent 28%),
    linear-gradient(135deg, #fff8ef 0%, #effaf7 47%, #f3f4ff 100%);
  color: var(--ink);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(17, 24, 39, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 24, 39, 0.035) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.9), transparent 78%);
}

button,
input {
  font: inherit;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, opacity 0.18s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:active:not(:disabled) {
  transform: translateY(0);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
summary:focus-visible,
.dropzone:focus-visible {
  outline: 3px solid rgba(109, 93, 252, 0.36);
  outline-offset: 3px;
}

.app-shell {
  position: relative;
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(19, 26, 38, 0.98), rgba(12, 16, 24, 0.98)),
    radial-gradient(circle at top left, rgba(240, 82, 103, 0.28), transparent 34%);
  color: #fff;
  box-shadow: 18px 0 44px rgba(15, 23, 42, 0.16);
}

.rail::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(140deg, rgba(19, 184, 154, 0.18), transparent 48%);
}

.brand,
.rail-status,
.rail-nav {
  position: relative;
  z-index: 1;
}

.brand,
.rail-status {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #ffffff, #eef9f6);
  color: #111827;
  font-weight: 900;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.24);
}

.brand strong,
.rail-status strong {
  display: block;
  font-size: 16px;
}

.brand small,
.rail-status small {
  display: block;
  color: #b8c6d5;
  font-size: 12px;
}

.rail-nav {
  display: grid;
  gap: 8px;
}

.rail-nav a {
  color: #d4dde8;
  text-decoration: none;
  padding: 12px;
  border-radius: var(--radius);
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.rail-nav a.active,
.rail-nav a:hover {
  background: linear-gradient(135deg, rgba(240, 82, 103, 0.24), rgba(19, 184, 154, 0.14));
  color: #fff;
  transform: translateX(2px);
}

.rail-status {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(18px);
}

.pulse {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--teal);
  box-shadow: 0 0 0 7px rgba(19, 184, 154, 0.16);
}

.workspace {
  position: relative;
  z-index: 1;
  padding: 28px;
}

.topbar {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
  padding: 26px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(17, 24, 39, 0.94), rgba(38, 50, 72, 0.9)),
    radial-gradient(circle at 12% 10%, rgba(240, 82, 103, 0.45), transparent 36%),
    radial-gradient(circle at 90% 0%, rgba(19, 184, 154, 0.42), transparent 34%);
  box-shadow: var(--shadow);
  color: #fff;
  overflow: hidden;
}

.topbar::after {
  content: "";
  position: absolute;
  right: 18%;
  top: 0;
  width: 220px;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
  transform: skewX(-22deg);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 34px;
  line-height: 1.1;
  letter-spacing: 0;
}

.topbar p {
  max-width: 760px;
  margin-top: 10px;
  color: #d8e2ee;
  font-size: 15px;
  line-height: 1.65;
}

.top-actions {
  position: relative;
  z-index: 1;
}

.ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 14px;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(14px);
}

.ghost:hover {
  background: rgba(255, 255, 255, 0.18);
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 352px;
  gap: 18px;
  align-items: stretch;
}

.drop-panel,
.settings,
.results {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(18px);
}

.drop-panel {
  padding: 18px;
}

.dropzone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 292px;
  padding: 34px;
  border: 1.5px dashed rgba(240, 82, 103, 0.44);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 250, 246, 0.72)),
    radial-gradient(circle at 50% 0%, rgba(255, 154, 91, 0.18), transparent 38%);
  text-align: center;
  outline: none;
  overflow: hidden;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.dropzone::before {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(19, 184, 154, 0.08), transparent 42%, rgba(109, 93, 252, 0.08));
  pointer-events: none;
}

.dropzone > * {
  position: relative;
  z-index: 1;
}

.dropzone.dragover,
.dropzone:focus {
  border-color: var(--teal);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(241, 255, 250, 0.82)),
    radial-gradient(circle at 50% 0%, rgba(19, 184, 154, 0.2), transparent 40%);
  box-shadow: 0 18px 50px rgba(19, 184, 154, 0.16);
  transform: translateY(-1px);
}

.dropzone svg {
  width: 46px;
  height: 46px;
  margin-bottom: 14px;
  color: var(--accent);
  filter: drop-shadow(0 8px 18px rgba(240, 82, 103, 0.22));
}

.dropzone h2 {
  font-size: 24px;
  line-height: 1.2;
}

.dropzone p {
  margin-top: 8px;
  color: var(--muted);
}

.drop-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.drop-actions button,
.primary-run {
  height: 46px;
  padding: 0 18px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 12px 22px rgba(17, 24, 39, 0.12);
}

.drop-actions .secondary {
  background: #edf2f5;
  color: var(--ink);
  box-shadow: none;
}

.file-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 40px;
  margin: 14px 0;
}

.file-pill {
  max-width: 280px;
  padding: 8px 10px;
  border: 1px solid rgba(19, 184, 154, 0.18);
  border-radius: var(--radius);
  background: rgba(234, 255, 249, 0.82);
  color: #17352f;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.primary-run {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 18px 34px rgba(240, 82, 103, 0.26);
}

.primary-run:hover:not(:disabled) {
  box-shadow: 0 20px 38px rgba(240, 82, 103, 0.34);
}

.settings {
  padding: 18px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-head h2 {
  font-size: 20px;
}

.section-head span {
  color: var(--muted);
  font-size: 12px;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 16px;
}

.mode-option {
  position: relative;
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px !important;
  min-height: 76px;
  margin: 0 !important;
  padding: 12px;
  border: 1px solid rgba(96, 112, 131, 0.22);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(249, 252, 255, 0.78)),
    radial-gradient(circle at top left, rgba(240, 82, 103, 0.12), transparent 44%);
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.mode-option:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(23, 30, 42, 0.09);
}

.mode-option input {
  appearance: none;
  width: 18px;
  height: 18px;
  margin: 0;
  border: 2px solid #a7b2bf;
  border-radius: 999px;
  background: #fff;
  box-shadow: inset 0 0 0 4px #fff;
}

.mode-option:has(input:checked) {
  border-color: rgba(19, 184, 154, 0.58);
  background:
    linear-gradient(135deg, rgba(232, 255, 249, 0.96), rgba(255, 247, 240, 0.86)),
    radial-gradient(circle at 0% 0%, rgba(19, 184, 154, 0.18), transparent 46%);
  box-shadow: 0 14px 34px rgba(19, 184, 154, 0.13);
}

.mode-option input:checked {
  border-color: var(--teal);
  background: var(--teal);
}

.mode-option strong,
.mode-option small {
  display: block;
  min-width: 0;
}

.mode-option strong {
  color: #1d2a3a;
  font-size: 14px;
}

.mode-option small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.settings label {
  display: grid;
  gap: 7px;
  margin: 12px 0;
}

.settings label span,
summary {
  color: #344254;
  font-size: 13px;
  font-weight: 800;
}

.settings input[type="number"] {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.settings input[type="number"]:focus {
  border-color: rgba(109, 93, 252, 0.56);
  box-shadow: 0 0 0 4px rgba(109, 93, 252, 0.1);
}

.toggle-row {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}

.toggle {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 10px !important;
  color: #2c363f;
  font-size: 14px;
  font-weight: 800;
}

.toggle input {
  position: absolute;
  opacity: 0;
}

.toggle span {
  position: relative;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: #c8d1d9;
  box-shadow: inset 0 1px 3px rgba(15, 23, 42, 0.18);
}

.toggle span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #fff;
  transition: transform 0.18s ease;
  box-shadow: 0 4px 9px rgba(15, 23, 42, 0.18);
}

.toggle input:checked + span {
  background: linear-gradient(135deg, var(--teal), #35d0ad);
}

.toggle input:checked + span::after {
  transform: translateX(18px);
}

details {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

summary {
  cursor: pointer;
}

.results {
  margin-top: 18px;
  padding: 18px;
}

.result-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 18px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.76);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 660px;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
  vertical-align: middle;
}

th:first-child,
td:first-child {
  max-width: 220px;
}

td:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

th {
  color: #5b6878;
  background: rgba(248, 250, 252, 0.8);
  font-size: 12px;
  text-transform: uppercase;
}

th:last-child,
td:last-child {
  width: 124px;
  min-width: 124px;
  text-align: right;
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: 0;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.selected {
  background: linear-gradient(90deg, rgba(19, 184, 154, 0.08), rgba(255, 154, 91, 0.06));
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 900;
}

.status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
}

.status.done { color: var(--ok); }
.status.running { color: var(--warn); }
.status.queued { color: #617180; }
.status.error { color: var(--danger); }

.expire-note {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.metric-note {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}

.download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  min-width: 94px;
  padding: 0 12px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #111827, #263349);
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 10px 18px rgba(17, 24, 39, 0.16);
}

.inspector {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.log-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #111827;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.log-title {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  color: #b7c5d8;
  font-size: 12px;
  font-weight: 900;
}

pre {
  min-height: 220px;
  max-height: 360px;
  margin: 0;
  padding: 12px;
  overflow: auto;
  color: #e8f7f1;
  font: 12px/1.55 Consolas, "Courier New", monospace;
  white-space: pre-wrap;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (max-width: 1040px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .rail {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
  }

  .rail-nav,
  .rail-status {
    display: none;
  }

  .grid,
  .result-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .workspace {
    padding: 16px;
  }

  .topbar {
    display: grid;
    padding: 22px;
  }

  h1 {
    font-size: 28px;
  }

  .dropzone {
    min-height: 300px;
    padding: 26px 18px;
  }

  .drop-actions {
    display: grid;
    width: 100%;
  }

  .drop-actions button {
    width: 100%;
  }

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

  .rail {
    padding: 16px;
  }

  table {
    min-width: 0;
  }

  th,
  td {
    padding: 12px 10px;
    font-size: 13px;
  }

  th:first-child,
  td:first-child {
    max-width: 128px;
  }

  th:nth-child(4),
  td:nth-child(4),
  th:nth-child(5),
  td:nth-child(5) {
    display: none;
  }

  th:last-child,
  td:last-child {
    width: 104px;
    min-width: 104px;
  }

  .download {
    min-width: 82px;
    padding: 0 10px;
    font-size: 12px;
  }
}
