.page-head {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: end;
  padding: 38px 34px;
  border-radius: 34px;
  border: 1px solid var(--shell-border);
  background: var(--surface);
  box-shadow:
    0 28px 70px rgba(112, 77, 173, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.page-head::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 14% 18%, rgba(255, 255, 255, 0.76), transparent 32%),
    radial-gradient(circle at 86% 18%, rgba(157, 46, 197, 0.12), transparent 24%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), transparent 40%);
}

.head-left,
.head-right {
  position: relative;
  z-index: 1;
}

.head-left {
  max-width: 42rem;
}

.page-head h1 {
  margin: 0 0 10px;
  font-size: clamp(2.6rem, 5vw, 4.2rem);
  line-height: 0.95;
  letter-spacing: -0.06em;
}

.muted {
  margin: 0;
  color: var(--copy-muted);
  line-height: 1.8;
}

.head-right {
  display: flex;
  justify-content: flex-end;
}

.panel {
  padding-top: 24px;
  display: grid;
  gap: 18px;
}

.filters {
  position: relative;
  overflow: visible;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 20px;
  border-radius: 28px;
  border: 1px solid var(--shell-border);
  background: var(--surface-soft);
  box-shadow:
    0 18px 40px rgba(90, 61, 140, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.62);
}

.search {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 0 16px;
  border-radius: 18px;
  border: 1px solid rgba(157, 46, 197, 0.12);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.56);
}

.search svg {
  color: var(--brand);
  flex: 0 0 auto;
}

.search input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
}

.search input::placeholder {
  color: #9186a6;
}

.filters-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}

.dropdown {
  position: relative;
  min-width: 180px;
}

.dropdown-btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 12px 16px;
  border-radius: 18px;
  border: 1px solid rgba(157, 46, 197, 0.12);
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.56);
  transition:
    background 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease,
    transform 0.12s ease;
}

.dropdown-btn:hover,
.dropdown.open .dropdown-btn {
  border-color: rgba(157, 46, 197, 0.22);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 28px rgba(157, 46, 197, 0.12);
}

.dropdown-list {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 100%;
  margin: 0;
  padding: 8px;
  border-radius: 18px;
  border: 1px solid var(--shell-border);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 24px 48px rgba(73, 48, 120, 0.16);
  backdrop-filter: blur(18px);
  list-style: none;
  display: none;
  z-index: 10;
}

.dropdown.open .dropdown-list {
  display: block;
}

.dropdown-list li {
  padding: 11px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}

.dropdown-list li:hover {
  background: rgba(157, 46, 197, 0.08);
}

.dropdown-list li.selected {
  background: rgba(157, 46, 197, 0.12);
  color: var(--brand);
  font-weight: 700;
}

.table {
  --tasks-table-columns: 152px minmax(220px, 1.45fr) minmax(120px, 1fr) 110px 150px 170px 132px;
  --tasks-table-min-width: 1080px;
  --tasks-table-shell-padding: 18px;
  --tasks-table-row-padding: 18px;
  --tasks-table-header-inline: calc(
    var(--tasks-table-shell-padding) + var(--tasks-table-row-padding)
  );
  position: relative;
  overflow-x: auto;
  border-radius: 28px;
  border: 1px solid var(--shell-border);
  background: var(--surface);
  box-shadow:
    0 18px 40px rgba(90, 61, 140, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.62);
}

.thead,
.trow {
  display: grid;
  grid-template-columns: var(--tasks-table-columns);
  gap: 14px;
  align-items: center;
}

.thead {
  min-width: var(--tasks-table-min-width);
  padding: 18px var(--tasks-table-header-inline);
  border-bottom: 1px solid rgba(157, 46, 197, 0.1);
  background: rgba(157, 46, 197, 0.04);
  color: #736986;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.tbody {
  display: grid;
  gap: 12px;
  min-width: var(--tasks-table-min-width);
  padding: var(--tasks-table-shell-padding);
}

.trow {
  padding: var(--tasks-table-row-padding);
  border-radius: 20px;
  border: 1px solid rgba(157, 46, 197, 0.1);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.56);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease;
}

.trow:hover {
  transform: translateY(-2px);
  border-color: rgba(157, 46, 197, 0.18);
  box-shadow: 0 18px 32px rgba(90, 61, 140, 0.12);
}

.thead > div,
.trow > div {
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.82rem;
  font-weight: 700;
  color: #5e4b8f;
  background: var(--pill-queued);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.78;
}

.pill.queued {
  background: var(--pill-queued);
  color: #6c4bd9;
}

.pill.preprocessing {
  background: var(--pill-pre);
  color: #3b5ccc;
}

.pill.training {
  background: var(--pill-train);
  color: #0f6ccf;
}

.pill.optimizing {
  background: var(--pill-opt);
  color: #0f8a6a;
}

.pill.packaging {
  background: var(--pill-pack);
  color: #aa6b00;
}

.pill.completed {
  background: var(--pill-done);
  color: #0b7a3a;
}

.pill.failed {
  background: var(--pill-fail);
  color: #b42318;
}

.filename {
  color: #3b2a7a;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
}

.filename:hover {
  text-decoration: underline;
}

.t-main {
  color: var(--text);
}

.t-meta {
  color: var(--copy-muted);
}

.cell-created {
  white-space: nowrap;
}

.thead .cell-actions {
  display: block;
  text-align: center;
}

.trow .cell-actions {
  display: grid;
  gap: 8px;
  align-content: center;
  justify-items: stretch;
}

.trow .cell-actions .tasks-btn {
  width: 100%;
  min-width: 0;
}

.tasks-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 16px;
  border-radius: 16px;
  text-decoration: none;
  cursor: pointer;
  font-weight: 700;
  border: 1px solid transparent;
  transition:
    background 0.18s ease,
    transform 0.12s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease;
}

.tasks-btn:active {
  transform: translateY(1px);
}

.tasks-btn-solid {
  background: linear-gradient(135deg, var(--brand), var(--brand-600));
  color: #fff;
  box-shadow: 0 14px 30px rgba(157, 46, 197, 0.18);
}

.tasks-btn-solid:hover {
  background: linear-gradient(135deg, #8e23b5, #b33fe0);
  box-shadow: 0 18px 34px rgba(157, 46, 197, 0.24);
}

.tasks-btn-ghost {
  color: var(--brand);
  background: rgba(124, 58, 237, 0.08);
  border-color: var(--shell-border);
  white-space: nowrap;
}

.tasks-btn-ghost:hover {
  background: rgba(124, 58, 237, 0.12);
  border-color: rgba(157, 46, 197, 0.2);
}

.empty {
  padding: 22px 24px 34px;
  text-align: center;
  color: var(--copy-muted);
}

.empty p {
  margin: 0 0 10px;
}

.trow-message {
  grid-template-columns: 1fr !important;
  text-align: center;
  padding: 48px 24px !important;
  border-radius: 24px;
  border: 2px dashed rgba(157, 46, 197, 0.1) !important;
  background: rgba(157, 46, 197, 0.02) !important;
  color: var(--copy-muted);
}

.row-msg {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}


.link-btn {
  border: none;
  background: none;
  color: var(--brand);
  font-weight: 700;
  cursor: pointer;
}

.filters-refresh-btn {
  min-width: 116px;
  min-height: 44px;
  padding: 8px 14px;
  font-size: 0.9rem;
  white-space: nowrap;
}

.refresh-icon {
  flex: 0 0 auto;
}

.filters-refresh-btn[aria-busy="true"] .refresh-icon {
  animation: public-tasks-spin 0.9s linear infinite;
}

.filters-refresh-btn[aria-busy="true"],
.tasks-btn[disabled],
.tasks-btn[aria-disabled="true"] {
  opacity: 0.50;
  cursor: not-allowed;
  box-shadow: none;
  filter: brightness(0.90) saturate(0.72);
}

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


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

/* Table loading opacity removed per user request */

html[data-theme="dark"] .page-head,
html[data-theme="dark"] .filters,
html[data-theme="dark"] .table,
html[data-theme="dark"] .trow,
html[data-theme="dark"] .dropdown-list {
  border-color: #304158;
  background: linear-gradient(180deg, rgba(20, 29, 46, 0.94), rgba(13, 20, 34, 0.88));
  box-shadow:
    0 22px 42px rgba(0, 0, 0, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

html[data-theme="dark"] .page-head::before {
  background:
    radial-gradient(circle at 14% 18%, rgba(30, 44, 68, 0.84), transparent 32%),
    radial-gradient(circle at 86% 18%, rgba(161, 96, 235, 0.14), transparent 24%),
    linear-gradient(180deg, rgba(17, 25, 39, 0.16), transparent 40%);
}

html[data-theme="dark"] .muted,
html[data-theme="dark"] .t-meta,
html[data-theme="dark"] .empty {
  color: #a7b5c8;
}

html[data-theme="dark"] .search,
html[data-theme="dark"] .dropdown-btn {
  background: rgba(17, 25, 39, 0.76);
  border-color: #304158;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

html[data-theme="dark"] .search input::placeholder {
  color: #95a4b8;
}

html[data-theme="dark"] .dropdown-btn:hover,
html[data-theme="dark"] .dropdown.open .dropdown-btn {
  background: rgba(24, 36, 56, 0.94);
  border-color: rgba(161, 96, 235, 0.22);
}

html[data-theme="dark"] .dropdown-list li:hover {
  background: rgba(161, 96, 235, 0.14);
}

html[data-theme="dark"] .thead {
  border-bottom-color: #304158;
  background: rgba(161, 96, 235, 0.06);
  color: #9cadc0;
}

html[data-theme="dark"] .filename {
  color: #efdfff;
}

html[data-theme="dark"] .tasks-btn-ghost {
  background: rgba(161, 96, 235, 0.12);
  border-color: #304158;
  color: #efdfff;
}

html[data-theme="dark"] .tasks-btn-ghost:hover {
  background: rgba(161, 96, 235, 0.18);
}

@media (max-width: 1040px) {
  .filters {
    grid-template-columns: 1fr;
    padding: 18px;
    border-radius: 22px;
  }

  .filters-actions {
    justify-content: stretch;
  }

  .filters-actions > * {
    flex: 1 1 0;
  }
}

@media (max-width: 900px) {
  .page-head {
    grid-template-columns: 1fr;
    padding: 32px 24px;
  }

  .head-right {
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .filters {
    grid-template-columns: 1fr;
    padding: 18px;
    border-radius: 22px;
  }

  .thead {
    display: none;
  }

  .table {
    overflow: visible;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
  }

  .tbody {
    min-width: 0;
    padding: 0;
  }

  .trow {
    grid-template-columns: 1fr;
    gap: 14px;
    border-radius: 22px;
  }

  .trow > div {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .trow > div::before {
    content: attr(data-label);
    color: #7a6f8c;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
  }

  .thead .cell-actions {
    text-align: left;
  }

  .trow .cell-actions {
    justify-items: stretch;
  }

  .tasks-btn,
  .tasks-btn-ghost {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tasks-btn,
  .dropdown-btn,
  .trow {
    transition: none;
  }
}
