:root {
  --bg: #f3f5f7;
  --panel: #ffffff;
  --panel-alt: #f8fafc;
  --ink: #172033;
  --muted: #5b6576;
  --line: #d9e0e8;
  --accent: #111827;
  --accent-soft: #eaf0f7;
  --ok: #176534;
  --warn: #9a3412;
  --danger: #991b1b;
  --shadow: 0 18px 44px rgba(15, 23, 42, 0.08);
  --radius: 22px;
}

* { box-sizing: border-box; }

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

.page {
  width: min(1480px, calc(100% - 40px));
  margin: 28px auto 64px;
}

.navbar,
.panel,
.card,
.status-card,
.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.navbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 16px 20px;
  margin-bottom: 22px;
}

.brand {
  display: grid;
  gap: 2px;
}

.brand strong {
  font-size: 19px;
}

.brand span {
  font-size: 13px;
  color: var(--muted);
}

.nav-links,
.nav-user,
.actions,
.inline-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.nav-links a {
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  padding: 10px 12px;
  border-radius: 12px;
}

.nav-links a.active,
.nav-links a:hover {
  background: var(--accent-soft);
}

.hero {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 20px;
  margin-bottom: 22px;
}

.hero h1,
.page-title h1 {
  margin: 0 0 12px;
  font-size: clamp(32px, 4vw, 50px);
  line-height: 1.06;
}

.subtitle {
  color: var(--muted);
  line-height: 1.55;
  font-size: 17px;
  margin: 0;
}

.status-card,
.panel,
.card {
  padding: 22px;
}

.page-title {
  margin-bottom: 20px;
}

.grid-2,
.grid-3,
.grid-4 {
  display: grid;
  gap: 16px;
}

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

.metric {
  display: grid;
  gap: 8px;
  background: var(--panel-alt);
  border-radius: 18px;
  padding: 18px;
}

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

.metric strong {
  font-size: 30px;
}

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

h2, h3 {
  margin: 0 0 8px;
}

p {
  margin-top: 0;
}

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

input[type="file"],
input[type="text"],
input[type="password"],
input[type="number"],
input[type="search"],
textarea,
select {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  padding: 12px 14px;
  width: 100%;
  font: inherit;
}

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

label {
  display: grid;
  gap: 7px;
  font-weight: 700;
  color: var(--muted);
  font-size: 14px;
}

.form-grid {
  display: grid;
  gap: 14px;
}

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

.form-grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

button,
.button-link {
  border: none;
  border-radius: 14px;
  padding: 12px 16px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

button.secondary,
.button-link.secondary {
  background: #e5e7eb;
  color: var(--ink);
}

button.success {
  background: #166534;
}

button.warn {
  background: #9a3412;
}

button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.message {
  border-radius: 16px;
  padding: 14px 16px;
  margin-top: 14px;
  line-height: 1.5;
  background: var(--accent-soft);
}

.message.ok {
  color: var(--ok);
  background: #edfdf3;
}

.message.error {
  color: var(--danger);
  background: #fef2f2;
}

.message.warn {
  color: var(--warn);
  background: #fff7ed;
}

.hidden { display: none !important; }

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

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

th, td {
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  position: sticky;
  top: 0;
  z-index: 1;
}

td {
  max-width: 340px;
  word-break: break-word;
}

.badge {
  display: inline-flex;
  padding: 6px 10px;
  background: var(--accent-soft);
  border-radius: 999px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.ready,
.badge.done {
  color: var(--ok);
  background: #edfdf3;
}

.badge.running,
.badge.queued {
  color: #1d4ed8;
  background: #eff6ff;
}

.badge.error {
  color: var(--danger);
  background: #fef2f2;
}

.row-changed {
  background: #fffbea;
}

pre {
  white-space: pre-wrap;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 18px;
  padding: 16px;
  overflow: auto;
}

.checkbox-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: #fff;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.checkbox-item input {
  width: auto;
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 12px;
  align-items: center;
  margin-top: 18px;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.login-shell {
  width: min(620px, calc(100% - 32px));
}

.login-card {
  padding: 36px;
}

.login-form {
  display: grid;
  gap: 16px;
}

@media (max-width: 1080px) {
  .hero,
  .grid-2,
  .grid-3,
  .grid-4,
  .form-grid.cols-2,
  .form-grid.cols-3 {
    grid-template-columns: 1fr;
  }

  .navbar {
    flex-direction: column;
    align-items: flex-start;
  }
}
