:root {
  color-scheme: light;
  --page-bg: #f6f7fb;
  --surface: #ffffff;
  --surface-soft: #fbfbfd;
  --surface-muted: #f2f4f8;
  --border: #e6e8f0;
  --border-strong: #d9deea;
  --text: #1f2635;
  --muted: #6f7788;
  --muted-strong: #4e5668;
  --accent: #7c1d34;
  --accent-strong: #5d1023;
  --accent-soft: #f6e8ed;
  --accent-soft-border: #efccd7;
  --danger: #c14e5f;
  --shadow: 0 16px 36px rgba(24, 31, 44, 0.06), 0 4px 12px rgba(24, 31, 44, 0.03);
  font-family: "Manrope", "Avenir Next", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--text);
}

button,
input,
textarea,
select {
  font: inherit;
}

.top-accent {
  position: fixed;
  inset: 0 0 auto;
  height: 22px;
  z-index: 30;
  background:
    repeating-linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.04) 0,
      rgba(255, 255, 255, 0.04) 18px,
      rgba(255, 255, 255, 0.01) 18px,
      rgba(255, 255, 255, 0.01) 36px
    ),
    linear-gradient(90deg, #6d1430 0%, #923255 100%);
}

.shell {
  min-height: 100vh;
  padding-top: 22px;
}

.hidden {
  display: none !important;
}

.eyebrow,
.sidebar-label,
.stat-label {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.eyebrow,
.sidebar-label {
  color: #939cb0;
}

.row,
.spread,
.table-actions,
.modal-toolbar-actions,
.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.spread {
  justify-content: space-between;
}

.stack {
  display: grid;
  gap: 16px;
}

.compact {
  gap: 10px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.brand-lockup,
.sidebar-brand {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.brand-mark {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(160deg, var(--accent) 0%, #9a3a57 100%);
  color: white;
  font-size: 0.92rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  box-shadow: 0 12px 24px rgba(124, 29, 52, 0.22);
}

.brand-mark.large {
  width: 74px;
  height: 74px;
  font-size: 1.1rem;
  border-radius: 22px;
}

.login-screen {
  min-height: calc(100vh - 22px);
  display: grid;
  place-items: center;
  padding: 36px 20px;
}

.login-layout {
  width: min(1120px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(380px, 0.95fr);
  gap: 24px;
  align-items: stretch;
}

.login-aside {
  border: 1px solid var(--border);
  border-radius: 30px;
  padding: 34px;
  background:
    radial-gradient(circle at top left, rgba(124, 29, 52, 0.12), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(251, 251, 253, 0.94));
  box-shadow: var(--shadow);
  display: grid;
  gap: 28px;
}

.login-aside h1,
.sidebar-brand h1 {
  margin: 8px 0 0;
  font-size: clamp(2.2rem, 4vw, 3.6rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
}

.login-aside p {
  margin: 14px 0 0;
  max-width: 34rem;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.6;
}

.login-points {
  display: grid;
  gap: 14px;
}

.login-point {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(230, 232, 240, 0.92);
  border-radius: 18px;
  padding: 16px 18px;
  display: grid;
  gap: 6px;
}

.login-point strong {
  font-size: 1rem;
}

.login-point span {
  color: var(--muted);
  line-height: 1.45;
}

.login-panel {
  padding: 32px;
  align-self: center;
}

.panel-heading h2 {
  margin: 10px 0 0;
  font-size: 2rem;
  letter-spacing: -0.04em;
}

.panel-heading p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.app-shell {
  width: min(1480px, calc(100vw - 36px));
  margin: 0 auto;
  padding: 28px 0 40px;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
}

.sidebar {
  position: sticky;
  top: 50px;
  align-self: start;
  min-height: calc(100vh - 92px);
  padding: 26px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.sidebar-brand h1 {
  font-size: 2rem;
}

.workspace-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-soft);
  padding: 14px 16px;
  display: grid;
  gap: 10px;
}

.workspace-value {
  display: grid;
  gap: 4px;
}

.workspace-value strong {
  font-size: 1.02rem;
}

.workspace-value span {
  color: var(--muted);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.sidebar-link {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid transparent;
  border-radius: 18px;
  background: transparent;
  color: var(--muted-strong);
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
}

.sidebar-link:hover {
  background: #fbfbfd;
  border-color: var(--border);
  transform: translateY(-1px);
}

.sidebar-link.active {
  background: #f8f3f5;
  border-color: var(--border);
  color: var(--accent-strong);
  box-shadow: inset 0 0 0 1px rgba(124, 29, 52, 0.04);
}

.nav-icon {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: #f2f4f8;
  color: var(--muted-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.nav-icon svg {
  width: 18px;
  height: 18px;
}

.sidebar-link.active .nav-icon {
  background: var(--accent);
  color: white;
  box-shadow: 0 8px 18px rgba(124, 29, 52, 0.18);
}

.nav-copy {
  display: grid;
  gap: 3px;
}

.nav-title {
  font-weight: 800;
}

.nav-note {
  font-size: 0.8rem;
  color: var(--muted);
}

.sidebar-footer {
  margin-top: auto;
}

.main-shell {
  display: grid;
  gap: 24px;
  align-content: start;
}

.view-panel {
  display: grid;
  gap: 18px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.page-head h2 {
  margin: 0;
  font-size: clamp(2.2rem, 4vw, 3.4rem);
  letter-spacing: -0.055em;
}

.page-head p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.head-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-pill {
  border: 1px solid var(--accent-soft-border);
  border-radius: 999px;
  padding: 10px 16px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
}

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

.stat-card {
  padding: 18px 20px;
  display: grid;
  gap: 10px;
}

.stat-label {
  color: #9aa2b4;
}

.stat-value {
  font-size: 2rem;
  line-height: 1;
  letter-spacing: -0.05em;
}

.stat-note {
  color: var(--muted);
  font-size: 0.95rem;
}

.filter-card,
.upload-controls {
  padding: 18px 20px;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.content-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.35fr) 410px;
}

.upload-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.5fr) 360px;
}

.settings-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.95fr);
  align-items: start;
}

.table-card,
.form-card,
.progress-card,
.action-card,
.settings-card {
  padding: 20px;
}

.settings-primary-card {
  display: grid;
  gap: 16px;
}

.settings-full-card {
  grid-column: 1 / -1;
}

.settings-side-stack {
  display: grid;
  gap: 18px;
  align-content: start;
}

.settings-form {
  gap: 18px;
}

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

.setting-panel {
  min-width: 0;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-soft);
  display: grid;
  gap: 8px;
}

.setting-label {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #939cb0;
}

.setting-value {
  font-size: 0.98rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.setting-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.setting-note-block {
  color: var(--muted);
  line-height: 1.55;
}

.settings-actions {
  display: grid;
  gap: 10px;
  justify-items: start;
}

.settings-submit {
  min-width: 220px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.card-head h3 {
  margin: 0;
  font-size: 1.55rem;
  letter-spacing: -0.03em;
}

.card-head p {
  margin: 8px 0 0;
  color: var(--muted);
}

.table-shell {
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  background: var(--surface);
}

.table-head {
  display: grid;
  gap: 14px;
  padding: 14px 18px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
  color: #8a92a5;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.server-table-head {
  grid-template-columns: 1.3fr 1fr 1fr 1fr 0.9fr;
}

.upload-table-head {
  grid-template-columns: 88px 1.2fr 1.3fr 1.1fr;
}

.table-body {
  display: grid;
}

.table-row {
  display: grid;
  gap: 14px;
  align-items: center;
  padding: 18px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.table-row:first-child {
  border-top: 0;
}

.server-table-row {
  grid-template-columns: 1.3fr 1fr 1fr 1fr 0.9fr;
}

.upload-table-row {
  grid-template-columns: 88px 1.2fr 1.3fr 1.1fr;
}

.upload-table-row.is-selected {
  background: #fcf7f8;
}

.table-cell {
  display: grid;
  gap: 6px;
}

.table-cell strong {
  font-size: 1rem;
}

.table-cell span,
.table-cell small {
  color: var(--muted);
  line-height: 1.45;
}

.table-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.empty-state {
  padding: 26px 18px;
  color: var(--muted);
}

label,
.field-stack {
  display: grid;
  gap: 8px;
}

label span {
  color: var(--muted);
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  padding: 14px 16px;
  outline: none;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(124, 29, 52, 0.55);
  box-shadow: 0 0 0 4px rgba(124, 29, 52, 0.09);
}

input[type="search"]::-webkit-search-cancel-button {
  cursor: pointer;
}

input[type="file"] {
  padding: 10px;
  background: var(--surface-soft);
}

input[type="file"]::file-selector-button {
  margin-right: 12px;
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 800;
  cursor: pointer;
}

textarea {
  min-height: 128px;
  resize: vertical;
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #70788a 50%),
    linear-gradient(135deg, #70788a 50%, transparent 50%);
  background-position:
    calc(100% - 20px) calc(50% - 2px),
    calc(100% - 13px) calc(50% - 2px);
  background-size: 7px 7px, 7px 7px;
  background-repeat: no-repeat;
}

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

.field-combo {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: var(--surface-soft);
}

.toggle input {
  width: auto;
  margin: 0;
}

button {
  border: 0;
  border-radius: 16px;
  padding: 13px 18px;
  background: var(--accent);
  color: white;
  font-weight: 800;
  cursor: pointer;
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(124, 29, 52, 0.18);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
  box-shadow: none;
}

button.ghost {
  background: var(--surface-soft);
  color: var(--muted-strong);
  border: 1px solid var(--border);
}

button.ghost:hover {
  box-shadow: 0 8px 16px rgba(24, 31, 44, 0.08);
}

button.danger {
  background: #fff1f3;
  color: var(--danger);
  border: 1px solid #ffdbe2;
}

.wide-button {
  width: 100%;
}

.tiny-button {
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 0.9rem;
}

.inline-input {
  display: grid;
  gap: 8px;
}

.folder-control {
  display: grid;
  gap: 10px;
}

.folder-input-row {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.select-cell {
  display: flex;
  justify-content: center;
}

.select-cell input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.folder-caption {
  font-size: 0.84rem;
  color: var(--muted);
}

.metric-line {
  display: grid;
  gap: 10px;
}

.bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #eceef4;
  overflow: hidden;
}

.fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, #a84260 100%);
  transition: width 180ms ease;
}

.fill.secondary {
  background: linear-gradient(90deg, #7b1d34 0%, #cf5f82 100%);
}

.job-target {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-soft);
}

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

.status-pill {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.status-pill.queued {
  background: #eef0f6;
  color: #697386;
}

.status-pill.running {
  background: #fbe8ee;
  color: var(--accent-strong);
}

.status-pill.completed {
  background: #e8f8ee;
  color: #237451;
}

.status-pill.failed,
.status-pill.partial_failed {
  background: #fff0f2;
  color: var(--danger);
}

.muted {
  color: var(--muted);
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.setting-row:last-child {
  border-bottom: 0;
}

.setting-row-block {
  align-items: flex-start;
}

.success-note {
  margin: 0;
  color: #237451;
  font-weight: 700;
}

.settings-card .stack.compact p {
  margin: 0;
}

.error {
  margin: 0;
  color: var(--danger);
  font-weight: 700;
}

.modal {
  position: fixed;
  inset: 22px 0 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 28px 18px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 25, 35, 0.42);
  backdrop-filter: blur(6px);
}

.modal-panel {
  position: relative;
  width: min(760px, calc(100vw - 40px));
  max-height: calc(100vh - 96px);
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: 0 32px 70px rgba(20, 25, 35, 0.18);
  padding: 22px;
  display: grid;
  gap: 16px;
  overflow: hidden;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.modal-head h3 {
  margin: 0;
  font-size: 1.65rem;
  letter-spacing: -0.03em;
}

.modal-head p {
  margin: 8px 0 0;
  color: var(--muted);
}

.icon-button {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 14px;
  background: var(--surface-soft);
  color: var(--muted-strong);
  border: 1px solid var(--border);
  font-size: 1.5rem;
  line-height: 1;
}

.modal-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.path-chip {
  min-width: 0;
  flex: 1 1 auto;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  padding: 12px 16px;
  color: var(--muted-strong);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-list {
  min-height: 180px;
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface-soft);
}

.browser-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  background: white;
}

.browser-row:first-child {
  border-top: 0;
}

.browser-row strong {
  display: block;
  margin-bottom: 4px;
}

.browser-row span {
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 1320px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .content-grid,
  .upload-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1080px) {
  .app-shell {
    width: min(100vw - 24px, 100%);
    grid-template-columns: 1fr;
    padding: 18px 0 30px;
  }

  .sidebar {
    position: static;
    min-height: auto;
  }

  .sidebar-nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .filter-card,
  .upload-controls {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 840px) {
  .login-layout {
    grid-template-columns: 1fr;
  }

  .page-head {
    flex-direction: column;
    align-items: stretch;
  }

  .stats-grid,
  .filter-card,
  .upload-controls {
    grid-template-columns: 1fr;
  }

  .settings-grid,
  .settings-side-stack,
  .settings-summary-grid {
    grid-template-columns: 1fr;
  }

  .server-table-head,
  .server-table-row,
  .upload-table-head,
  .upload-table-row {
    grid-template-columns: 1fr;
  }

  .table-head {
    display: none;
  }

  .table-row {
    gap: 16px;
  }

  .table-actions {
    justify-content: flex-start;
  }

  .folder-input-row,
  .field-combo,
  .split,
  .modal-toolbar {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .modal-toolbar-actions,
  .form-actions {
    width: 100%;
    flex-wrap: wrap;
  }
}

@media (max-width: 620px) {
  .settings-submit {
    width: 100%;
    min-width: 0;
  }

  .login-screen {
    padding: 20px 14px;
  }

  .login-aside,
  .login-panel {
    padding: 22px;
  }

  .app-shell {
    width: calc(100vw - 16px);
  }

  .sidebar {
    padding: 18px;
  }

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

  .modal {
    padding: 18px 12px;
  }

  .modal-panel {
    width: calc(100vw - 24px);
    padding: 18px;
  }

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