:root {
  --bg: #f6f7f8;
  --surface: #ffffff;
  --surface-2: #eef1f3;
  --text: #1d252c;
  --muted: #68737d;
  --line: #d8dde2;
  --accent: #0d766f;
  --accent-2: #145c57;
  --danger: #b42318;
  --warn: #a15c00;
  --ok: #087443;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  padding: 0 16px;
  cursor: pointer;
  transition: background 0.16s ease, transform 0.16s ease;
}

button:hover {
  background: var(--accent-2);
}

button:active {
  transform: translateY(1px);
}

button.secondary,
button.ghost {
  background: var(--surface-2);
  color: var(--text);
}

button.secondary:hover,
button.ghost:hover {
  background: #e0e5e9;
}

button.small {
  min-height: 30px;
  padding: 0 10px;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 0 10px;
}

label {
  display: grid;
  gap: 7px;
  color: #33404a;
  font-size: 13px;
  font-weight: 600;
}

.hidden {
  display: none !important;
}

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

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  margin: 0 0 8px;
}

.error {
  min-height: 20px;
  color: var(--danger);
  margin: 0;
}

.login-view {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(13, 118, 111, 0.08), rgba(255, 255, 255, 0) 44%),
    var(--bg);
}

.login-panel {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 30px;
  display: grid;
  gap: 18px;
  box-shadow: 0 18px 50px rgba(29, 37, 44, 0.08);
  animation: enter 0.35s ease both;
}

.login-panel h1,
.topbar h1,
.sidebar h2 {
  margin: 0;
}

.console-view {
  min-height: 100svh;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
}

.sidebar {
  background: #172126;
  color: #fff;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.sidebar .muted,
.sidebar .eyebrow {
  color: #aab7bd;
}

.sidebar h2 {
  font-size: 21px;
}

.sidebar nav {
  margin-top: 28px;
  display: grid;
  gap: 8px;
}

.nav-item {
  width: 100%;
  text-align: left;
  background: rgba(255,255,255,0.11);
}

.workspace {
  min-width: 0;
  padding: 26px;
  display: grid;
  gap: 18px;
  align-content: start;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
}

.topbar > div {
  min-width: 0;
}

.topbar button {
  flex: 0 0 auto;
}

.filters {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(5, minmax(120px, 1fr)) auto;
  gap: 12px;
  align-items: end;
}

.filter-actions {
  display: flex;
  gap: 8px;
  min-width: 104px;
}

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

.summary > div {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.summary span {
  display: block;
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}

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

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel-head {
  min-height: 58px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-head h3 {
  margin: 0;
  font-size: 16px;
}

.fields-panel .panel-head {
  align-items: flex-start;
}

.field-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.field-selector {
  padding: 14px 16px 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
}

.field-option {
  min-height: 54px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 8px;
  row-gap: 2px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-weight: 700;
}

.field-option input {
  grid-row: 1 / span 2;
  width: 16px;
  min-height: 16px;
}

.field-option small {
  color: var(--muted);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
}

.field-option.image-field {
  border-color: rgba(13, 118, 111, 0.35);
  background: #f3fbf8;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
  white-space: nowrap;
}

th {
  color: #46535d;
  background: #f9fafb;
  font-weight: 700;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: #3a4650;
  font-size: 12px;
  margin-right: 4px;
}

.pill.ok {
  color: var(--ok);
  background: #e7f6ee;
}

.pill.warn {
  color: var(--warn);
  background: #fff2db;
}

.pill.danger {
  color: var(--danger);
  background: #fde8e6;
}

.jobs-list {
  display: grid;
  gap: 0;
}

.job {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 9px;
}

.job:last-child {
  border-bottom: 0;
}

.job-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
}

.progress {
  height: 8px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.24s ease;
}

.job-meta {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 12px;
}

.download {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
}

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

@media (max-width: 1120px) {
  .console-view {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    flex-direction: row;
    align-items: center;
    gap: 16px;
  }

  .sidebar nav {
    margin-top: 0;
  }

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

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

@media (max-width: 680px) {
  .workspace {
    padding: 16px;
  }

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

  .filters,
  .summary {
    grid-template-columns: 1fr;
  }

  .filter-actions {
    flex-direction: column;
  }
}
