@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500;600&family=Space+Grotesk:wght@500;600;700&display=swap");

:root {
  --blue-900: #043a8b;
  --blue-700: #005fe6;
  --blue-600: #0069ff;
  --blue-200: #cfe3ff;
  --ink-900: #0b1b3a;
  --ink-700: #324161;
  --ink-500: #5b6b8a;
  --surface: #ffffff;
  --surface-alt: #f2f6ff;
  --border: #d6e4ff;
  --shadow: 0 24px 60px rgba(9, 30, 66, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--ink-900);
  background:
    radial-gradient(circle at 12% 18%, rgba(0, 105, 255, 0.16), transparent 45%),
    radial-gradient(circle at 85% 10%, rgba(0, 105, 255, 0.12), transparent 40%),
    #f7f9fc;
}

.page {
  position: relative;
  min-height: 100vh;
  padding: 40px 56px 80px;
}

.page::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(0, 105, 255, 0.15) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: 0.35;
  pointer-events: none;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.8), transparent 60%);
}

.topbar,
.content {
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 32px;
  align-items: flex-start;
  margin-bottom: 36px;
}

.brand {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  max-width: 700px;
}

.logo {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--blue-600), #3f8cff);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
}

.logo-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  display: block;
}

.logo-bar {
  position: absolute;
  width: 34px;
  height: 6px;
  background: rgba(255, 255, 255, 0.7);
  bottom: 12px;
  border-radius: 999px;
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--blue-900);
  margin: 0 0 8px;
  font-weight: 600;
}

h1,
h2,
h3 {
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  margin: 0 0 12px;
}

h1 {
  font-size: 32px;
}

.subtitle {
  margin: 0;
  color: var(--ink-700);
  line-height: 1.5;
}

.status-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
}

.pill {
  background: var(--surface);
  color: var(--ink-700);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.card {
  background: var(--surface);
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 24px;
  animation: fadeUp 0.6s ease both;
}

.card-wide {
  grid-column: span 2;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  background: linear-gradient(135deg, rgba(0, 105, 255, 0.12), rgba(0, 105, 255, 0.02));
}

.hero-actions {
  display: grid;
  gap: 12px;
  justify-items: end;
}

.meta {
  font-size: 13px;
  color: var(--ink-500);
}

.button {
  border: none;
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: "IBM Plex Sans", sans-serif;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.button.primary {
  background: linear-gradient(135deg, var(--blue-600), var(--blue-700));
  color: #ffffff;
  box-shadow: 0 12px 26px rgba(0, 105, 255, 0.25);
}

.button.ghost {
  background: var(--surface-alt);
  color: var(--blue-900);
}

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

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

.config-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.label {
  margin: 0 0 4px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-500);
}

.value {
  margin: 0;
  font-weight: 600;
  color: var(--ink-900);
}

.hint,
.note {
  margin-top: 16px;
  font-size: 13px;
  color: var(--ink-500);
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  color: var(--ink-700);
}

input[type="date"],
input[type="number"] {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #ffffff;
  font-family: inherit;
}

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

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--ink-700);
}

.toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--blue-600);
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.table-actions {
  display: flex;
  gap: 10px;
}

.table-wrap {
  margin-top: 16px;
  overflow: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  max-height: 400px;
  overflow-y: auto;
}

.table-wrap::-webkit-scrollbar {
  width: 8px;
}

.table-wrap::-webkit-scrollbar-track {
  background: var(--surface-alt);
}

.table-wrap::-webkit-scrollbar-thumb {
  background: var(--blue-200);
  border-radius: 4px;
}

.table-wrap::-webkit-scrollbar-thumb:hover {
  background: var(--blue-600);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead {
  background: var(--surface-alt);
  position: sticky;
  top: 0;
  z-index: 1;
}

th,
td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

tbody tr:hover {
  background: rgba(0, 105, 255, 0.06);
}

.export-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.status-log {
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--surface-alt);
  border-radius: 12px;
  color: var(--ink-700);
  font-size: 13px;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .page {
    padding: 32px 20px 60px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .status-row {
    align-items: flex-start;
    flex-direction: row;
    flex-wrap: wrap;
  }

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

  .card-wide {
    grid-column: auto;
  }

  .hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-actions {
    justify-items: start;
  }

  .export-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Live Log Viewer */
.log-viewer-container {
  margin-top: 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--ink-900);
  animation: fadeUp 0.4s ease both;
}

.log-viewer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--blue-900), #0a1628);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.log-viewer-title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.log-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  animation: pulse 1.5s ease-in-out infinite;
}

.log-pulse.error {
  background: #ef4444;
  animation: none;
}

.log-pulse.complete {
  background: #4ade80;
  animation: none;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.log-viewer-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.log-viewer-controls .toggle.small {
  font-size: 11px;
}

.log-viewer-controls .toggle.small span {
  color: rgba(255, 255, 255, 0.7);
}

.button.ghost.small {
  padding: 6px 12px;
  font-size: 11px;
  border-radius: 6px;
}

.log-viewer {
  height: 320px;
  overflow-y: auto;
  padding: 16px;
  font-family: "SF Mono", "Monaco", "Inconsolata", "Fira Mono", monospace;
  font-size: 12px;
  line-height: 1.7;
  color: #e2e8f0;
  scroll-behavior: smooth;
}

.log-viewer::-webkit-scrollbar {
  width: 8px;
}

.log-viewer::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.log-viewer::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.log-viewer::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.log-entry {
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  animation: logSlideIn 0.2s ease;
}

.log-entry:last-child {
  border-bottom: none;
}

.log-entry .timestamp {
  color: #64748b;
  margin-right: 8px;
}

.log-entry .message {
  color: #e2e8f0;
}

.log-entry.error .message {
  color: #ef4444;
}

.log-entry.success .message {
  color: #4ade80;
}

.log-entry.info .message {
  color: #60a5fa;
}

@keyframes logSlideIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.log-viewer-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.3);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 11px;
}

.log-count {
  color: rgba(255, 255, 255, 0.5);
}

.log-status {
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
}

.log-status.running {
  color: #fbbf24;
}

.log-status.complete {
  color: #4ade80;
}

.log-status.error {
  color: #ef4444;
}

.download-button {
  margin-top: 16px;
  display: none;
  animation: fadeUp 0.4s ease both;
}

.download-button.visible {
  display: block;
}
