:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --border: #e2e6ee;
  --text: #1a2332;
  --muted: #6b778c;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --ok: #159947;
  --bad: #c0353a;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.06);
  --radius: 12px;
  --font: "DM Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 10% -10%, #dbe7ff 0%, transparent 55%),
    radial-gradient(900px 400px at 90% 0%, #e8eef8 0%, transparent 50%),
    var(--bg);
}

.app-shell {
  height: 100%;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 12px;
  padding: 16px 20px 12px;
  max-width: 1440px;
  margin: 0 auto;
}

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

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #1e293b, #0f172a);
  color: #93c5fd;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 14px;
}

.brand {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--muted);
}

.status-completed {
  background: #eaf8ef;
  border-color: #b7e4c7;
  color: var(--ok);
}

.status-processing {
  background: #eef4ff;
  border-color: #c7d7fe;
  color: var(--accent);
}

.status-error {
  background: #fdecec;
  border-color: #f3c1c3;
  color: var(--bad);
}

.badge-spin {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}

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

.icon-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  width: 36px;
  height: 36px;
  cursor: pointer;
}

.home-link {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.home-link:hover {
  color: var(--text);
  border-color: #cbd5e1;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: #e8eef8;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #334155;
}

.control-bar {
  display: grid;
  grid-template-columns: 1fr 200px auto;
  gap: 12px;
  align-items: end;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}

.field input,
.field select {
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 0 12px;
  font: inherit;
  background: #fbfcfe;
  color: var(--text);
}

.field input:focus,
.field select:focus {
  outline: 2px solid #bfdbfe;
  border-color: #93c5fd;
}

.control-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 0 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  color: var(--text);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-icon {
  font-size: 0.75rem;
}

.panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  min-height: 0;
}

.panel {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
  background: #0f172a;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid #1e293b;
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  color: #cbd5e1;
  font-size: 0.85rem;
  font-weight: 600;
  background: #111827;
  border-bottom: 1px solid #1f2937;
}

.diff-badge {
  background: #14532d;
  color: #86efac;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 600;
}

.panel-body {
  min-height: 0;
  height: 100%;
}

.panel-placeholder {
  height: 100%;
  display: grid;
  place-items: center;
  color: #94a3b8;
  font-size: 0.95rem;
  padding: 24px;
  text-align: center;
}

.status-bar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.82rem;
  color: var(--muted);
}

.status-left,
.status-right {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.ok {
  color: var(--ok);
  font-weight: 600;
}

.bad {
  color: var(--bad);
  font-weight: 600;
}

@media (max-width: 960px) {
  .control-bar {
    grid-template-columns: 1fr;
  }

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

  .app-shell {
    height: auto;
    min-height: 100%;
  }

  .panel {
    min-height: 360px;
  }
}
