:root {
  /* Pastelowy gradient tła (lilak → niebieski → mięta) */
  --bg: #cff6ea;
  --bg-soft: #ebe4ff;
  --bg-mid: #e0f2fe;
  --card: rgba(255, 255, 255, 0.88);
  --card-soft: #f7f4ff;
  --text: #342f55;
  --muted: #6f6a8e;
  --border: #e0daf2;
  --input-border: #d2caeb;
  --input-bg: #faf8ff;
  --accent: #9d8af0;
  --accent-strong: #8470e0;
  --success: #3db39c;
  --danger: #e88896;
  --warning: #e5b84a;
  --shadow-tint: rgba(91, 76, 140, 0.14);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 14px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 16px var(--shadow-tint);
  backdrop-filter: blur(14px);
}

.site-nav__brand {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text);
  text-decoration: none;
}

.site-nav__brand:hover {
  color: var(--accent-strong);
}

.site-nav .btn {
  flex-shrink: 0;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.5;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  background: linear-gradient(155deg, var(--bg-soft) 0%, var(--bg-mid) 48%, var(--bg) 100%);
  background-attachment: fixed;
}

.page {
  flex: 1;
  display: grid;
  place-items: start center;
  padding: 28px 16px 28px;
}

.page--center {
  place-items: center;
  padding: 24px 16px;
}

.site-footer {
  text-align: center;
  padding: 0 16px 24px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
}

.panel {
  width: 100%;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 18px;
  padding: 24px;
  box-shadow:
    0 4px 24px var(--shadow-tint),
    0 1px 3px rgba(91, 76, 140, 0.06);
  backdrop-filter: blur(14px);
}

.panel-narrow {
  max-width: 460px;
}

.panel-wide {
  max-width: 760px;
}

.dashboard-panel {
  max-width: 1280px;
}

.tabbed-dashboard {
  width: 100%;
  max-width: 1280px;
}

.tabs-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-bottom: 14px;
  padding: 0 2px;
  border-bottom: 1px solid rgba(224, 218, 242, 0.85);
}

.tabs-bar__tab {
  margin: 0;
  padding: 10px 16px 12px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  border-radius: 10px 10px 0 0;
  cursor: pointer;
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease;
}

.tabs-bar__tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.35);
}

.tabs-bar__tab.is-active {
  color: var(--text);
  border-bottom-color: var(--accent-strong);
  background: rgba(255, 255, 255, 0.5);
}

.tab-panel--empty {
  min-height: 200px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
  margin-top: 30px;
}

.dashboard-col {
  min-width: 0;
}

.dashboard-col--right {
  width: 100%;
  min-width: 0;
}

.dashboard-col--left .dropzone {
  min-height: 220px;
}

.dashboard-col--left #uploadForm.section {
  margin-top: 0;
}

.dashboard-intro {
  margin-top: 4px;
}

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

.header h1,
.header h2,
.panel h2 {
  margin: 0;
  font-size: 1.75rem;
  line-height: 1.25;
}

.header h1 {
  font-weight: 500;
  letter-spacing: 0.08em;
}

.header h2,
.panel h2 {
  font-weight: 700;
  letter-spacing: -0.02em;
}

.muted {
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  margin: 0;
}

.section {
  margin-top: 18px;
}

.field {
  margin-bottom: 12px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
  color: #524c75;
}

input[type="text"],
input[type="password"],
input[type="file"] {
  width: 100%;
  border: 1px solid var(--input-border);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text);
}

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

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

input[type="file"].file-input-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(100%);
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

label.btn {
  cursor: pointer;
}

.btn {
  border: 1px solid var(--input-border);
  border-radius: 10px;
  padding: 11px 16px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 120ms ease, background-color 120ms ease, border-color 120ms ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
  border-color: rgba(132, 112, 224, 0.35);
  color: #fff;
  box-shadow: 0 2px 12px rgba(132, 112, 224, 0.28);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #7665d4, #a08fef);
  border-color: rgba(132, 112, 224, 0.45);
  box-shadow: 0 4px 16px rgba(132, 112, 224, 0.32);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.55);
  color: var(--text);
}

.btn-secondary:hover {
  background: rgba(157, 138, 240, 0.14);
  border-color: var(--accent);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.6;
  cursor: default;
  pointer-events: none;
}

.btn-block {
  width: 100%;
}

.btn-danger {
  background: linear-gradient(135deg, #d9707e, var(--danger));
  border-color: rgba(232, 136, 150, 0.45);
  color: #fff;
  box-shadow: 0 2px 12px rgba(232, 136, 150, 0.28);
}

.btn-danger:hover {
  background: linear-gradient(135deg, #c85f6e, #e898a4);
  border-color: rgba(232, 136, 150, 0.55);
  box-shadow: 0 4px 16px rgba(232, 136, 150, 0.32);
}

.confirm-dialog {
  max-width: calc(100vw - 32px);
  width: min(400px, 100%);
  padding: 0;
  border: none;
  background: transparent;
}

.confirm-dialog::backdrop {
  background: rgba(52, 47, 85, 0.45);
  backdrop-filter: blur(4px);
}

.confirm-dialog__box {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 18px;
  padding: 24px;
  box-shadow:
    0 8px 32px var(--shadow-tint),
    0 2px 8px rgba(91, 76, 140, 0.1);
}

.confirm-dialog__title {
  margin: 0 0 12px;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.confirm-dialog__text {
  margin: 0 0 22px;
  line-height: 1.5;
}

.confirm-dialog__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.dropzone {
  position: relative;
  border: 2px dashed var(--input-border);
  border-radius: 16px;
  padding: 36px 28px;
  min-height: 240px;
  background: linear-gradient(145deg, rgba(157, 138, 240, 0.12), rgba(125, 211, 252, 0.14));
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  gap: 20px;
}

.dropzone > p:first-of-type {
  text-align: center;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.45;
}

.dropzone > p.section {
  text-align: center;
  margin-top: 0;
}

.dropzone-selected {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 3.25rem;
}

.dropzone-selected__inner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  max-width: 100%;
  padding: 10px 10px 10px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(91, 76, 140, 0.06);
}

.dropzone-selected__label {
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--text);
  word-break: break-word;
}

.dropzone-clear {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  min-width: 32px;
  padding: 0;
  margin: -2px -4px -2px 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    color 0.15s ease,
    background 0.15s ease,
    transform 0.15s ease;
}

.dropzone-clear:hover {
  color: var(--danger);
  background: rgba(232, 136, 150, 0.14);
}

.dropzone-clear:active {
  transform: scale(0.94);
}

.dropzone-clear:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.dropzone-clear svg {
  display: block;
}

.dropzone.is-dragover {
  border-color: var(--accent);
  background: linear-gradient(145deg, rgba(157, 138, 240, 0.22), rgba(125, 211, 252, 0.28));
}

.dropzone-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.dropzone-actions {
  justify-content: center;
}

.status-card {
  margin-top: 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  background: var(--card-soft);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.45;
}

.jobs-card {
  margin-top: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  background: var(--card-soft);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  height: 100%;
  display: flex;
  flex-direction: column;
}

.jobs-card h2 {
  font-size: 1.1rem;
}

.jobs-table-wrap {
  overflow-x: auto;
}

.jobs-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
  table-layout: fixed;
}

.jobs-table-wrap {
  flex: 1;
  min-height: 0;
}

.jobs-table th:nth-child(1),
.jobs-table td:nth-child(1) {
  width: 29%;
}

.jobs-table th:nth-child(2),
.jobs-table td:nth-child(2) {
  width: 23%;
}

.jobs-table th:nth-child(3),
.jobs-table td:nth-child(3) {
  width: 21%;
}

.jobs-table th:nth-child(4),
.jobs-table td:nth-child(4) {
  width: 19%;
}

.jobs-table th:nth-child(5),
.jobs-table td:nth-child(5) {
  width: 8%;
  text-align: center;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.pagination-info {
  flex: 1;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.pagination-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.jobs-table th,
.jobs-table td {
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
  padding: 7px 8px;
  line-height: 1.25;
}

.jobs-table th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.jobs-table td {
  font-size: 14px;
  color: var(--text);
}

.jobs-table th:nth-child(1),
.jobs-table th:nth-child(2),
.jobs-table th:nth-child(3),
.jobs-table tbody td:nth-child(1),
.jobs-table tbody td:nth-child(2),
.jobs-table tbody td:nth-child(3) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jobs-table tbody tr:last-child td {
  border-bottom: none;
}

.jobs-table .btn {
  font-size: 13px;
  padding: 7px 10px;
}

.jobs-table .btn-icon {
  width: 34px;
  height: 34px;
  min-width: 34px;
  padding: 0;
}

.jobs-table .btn-icon svg {
  display: block;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(100%);
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.status-card .muted {
  font-size: inherit;
  font-weight: inherit;
  color: var(--muted);
}

.status-card #jobIdLabel {
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  color: var(--text);
  margin-top: 4px;
}

.status-card .chip {
  font-size: inherit;
  font-weight: inherit;
}

.status-card #progressText {
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  color: var(--text);
}

.status-card .error-text {
  font-size: inherit;
  font-weight: inherit;
}

.status-card .error-list {
  font-size: inherit;
  font-weight: inherit;
}

.status-card summary {
  font-size: inherit;
  font-weight: inherit;
  color: var(--muted);
}

.status-card .btn {
  font-size: inherit;
  font-weight: inherit;
}

.status-card .json-pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
}

.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: rgba(157, 138, 240, 0.12);
}

.chip-processing {
  color: #b8860f;
  background: rgba(229, 184, 74, 0.18);
  border-color: rgba(229, 184, 74, 0.45);
}

.chip-done {
  color: #2a8f7c;
  background: rgba(61, 179, 156, 0.15);
  border-color: rgba(61, 179, 156, 0.4);
}

.chip-error {
  color: #b84555;
  background: rgba(232, 136, 150, 0.16);
  border-color: rgba(232, 136, 150, 0.45);
}

.progress-wrap {
  margin-top: 6px;
}

.progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(52, 47, 85, 0.08);
  overflow: hidden;
}

.progress-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #a599ea, #7dd3fc);
  transition: width 220ms ease;
  border-radius: 999px;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.error-text {
  color: #b03d4f;
  font-size: 14px;
  margin-top: 8px;
}

.error-list {
  margin: 8px 0 0;
  padding-left: 18px;
  color: #a03647;
  font-size: 13px;
}

.json-details {
  margin-top: 10px;
}

.json-pre {
  margin: 8px 0 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f2eff9;
  padding: 12px;
  color: #453d63;
  font-size: 12px;
  overflow: auto;
}

.hidden {
  display: none !important;
}

.error-banner {
  color: #b03d4f;
  font-size: 14px;
  margin-bottom: 12px;
}

a {
  color: var(--accent-strong);
  font-weight: 600;
}

a:hover {
  color: var(--accent);
}

summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
  font-size: 15px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .btn,
  .progress-fill {
    transition: none;
  }
}

@media (max-width: 920px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .jobs-card {
    margin-top: 0;
  }

  .dashboard-col--right {
    min-width: 0;
  }
}
