:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --line: #d9dee6;
  --line-strong: #c2c9d4;
  --text: #17202a;
  --muted: #647181;
  --accent: #0f766e;
  --accent-dark: #0b5f58;
  --warning: #a15c00;
  --failed: #b42318;
  --success: #087443;
  --focus: #2563eb;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1120px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 24px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.2;
}

h2 {
  font-size: 16px;
}

.source,
footer {
  color: var(--muted);
}

.source {
  margin: 4px 0 0;
  font-size: 12px;
}

.topbar-actions,
.section-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.date-pill {
  display: inline-flex;
  min-width: 118px;
  justify-content: center;
  padding: 7px 10px;
  border: 1px solid var(--line);
  background: #fbfcfd;
  border-radius: 6px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.tabs {
  display: flex;
  gap: 2px;
  padding: 0 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.tab {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 13px 16px;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  cursor: pointer;
}

.tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
  font-weight: 650;
}

main {
  padding: 18px 24px 28px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.toolbar {
  display: flex;
  align-items: end;
  gap: 12px;
  margin-bottom: 12px;
}

.toolbar.compact {
  align-items: stretch;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

input[type="search"],
input[type="text"],
select {
  width: 220px;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  padding: 0 10px;
}

select {
  padding-right: 28px;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.search-field input {
  width: 320px;
}

.status-text {
  min-height: 34px;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.summary-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 30px;
  margin-bottom: 10px;
}

.metric {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  box-shadow: var(--shadow);
  white-space: nowrap;
}

.metric strong {
  font-variant-numeric: tabular-nums;
}

.table-wrap {
  overflow: visible;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  background: #eef2f6;
  color: #344154;
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

td {
  height: 44px;
}

tbody tr:hover {
  background: #f7faf9;
}

td:nth-child(1) {
  width: 28%;
  font-weight: 650;
}

td:nth-child(2) {
  width: 35%;
}

td:nth-child(3) {
  width: 20%;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

td:nth-child(4) {
  width: 17%;
}

.empty-row {
  color: var(--muted);
  text-align: center;
  height: 96px;
}

.primary-button,
.secondary-button,
.doc-button {
  height: 34px;
  border-radius: 6px;
  cursor: pointer;
}

.primary-button {
  border: 1px solid var(--accent-dark);
  color: #ffffff;
  background: var(--accent);
  padding: 0 13px;
  font-weight: 700;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.secondary-button {
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--text);
  padding: 0 11px;
}

.doc-menu-wrap {
  position: relative;
  display: inline-block;
  width: 176px;
}

.doc-button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--text);
  padding: 0 9px 0 10px;
}

.doc-menu {
  position: absolute;
  z-index: 10;
  top: 38px;
  right: 0;
  width: 260px;
  display: none;
  padding: 5px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  box-shadow: 0 14px 26px rgba(16, 24, 40, 0.16);
}

.doc-menu.open {
  display: grid;
}

.doc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 32px;
  padding: 7px 8px;
  border-radius: 4px;
  color: var(--text);
  text-decoration: none;
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
}

.doc-item:hover {
  background: #edf7f5;
}

.doc-item.disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.7;
}

.doc-status {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.doc-status.failed {
  color: var(--failed);
}

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

.history-list-panel,
.history-detail,
.admin-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.history-list-panel {
  padding: 12px;
}

.history-detail {
  padding: 12px;
}

.history-list {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 210px);
  overflow: auto;
}

.history-entry {
  width: 100%;
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.history-entry.active {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.history-entry-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-weight: 750;
}

.history-counts {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.admin-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.admin-panel {
  padding: 14px;
}

.admin-panel form,
form.admin-panel {
  display: grid;
  gap: 12px;
}

.admin-panel input[type="text"] {
  width: 100%;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
}

.status-succeeded,
.status-cached {
  color: var(--success);
}

.status-running,
.status-queued,
.status-partial {
  color: var(--warning);
}

.status-failed {
  color: var(--failed);
}

footer {
  padding: 12px 24px 22px;
  font-size: 12px;
}
