:root {
  --bg: #eef3f8;
  --panel: #ffffff;
  --ink: #172334;
  --muted: #5f7085;
  --line: #d9e2ec;
  --header: #0f2742;
  --accent: #1f5d91;
  --accent-dark: #123e68;
  --success: #1f7a4d;
  --danger: #b33a3a;
  --warning: #b36b1e;
  --orange: #c96f1f;
  --info: #1867a7;
  --muted-success: #597966;
  --shadow: 0 10px 30px rgba(15, 39, 66, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(31, 93, 145, 0.10), transparent 30%),
    linear-gradient(180deg, #f7fafd 0%, var(--bg) 100%);
}

a { color: inherit; text-decoration: none; }
code { padding: 2px 6px; border-radius: 8px; background: #edf2f7; }
.shell { width: min(1280px, calc(100% - 32px)); margin: 0 auto; }
.app-header { background: linear-gradient(120deg, #102947, #17395f); color: #fff; box-shadow: var(--shadow); }
.shell-header { display: flex; justify-content: space-between; align-items: center; padding: 28px 0; gap: 24px; }
.brand-block { display: flex; flex-direction: column; gap: 4px; }
.header-actions { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; justify-content: flex-end; }
.header-nav { display: flex; gap: 18px; flex-wrap: wrap; }
.header-nav a { color: rgba(255,255,255,0.92); font-weight: 600; }
.session-box { display: flex; align-items: center; gap: 12px; }
.session-user {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.14);
  color: rgba(255,255,255,0.94);
  font-weight: 600;
}
.logout-form { margin: 0; }
.logout-form button {
  min-height: 40px; padding: 0 16px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.08); color: #fff; font: inherit; font-weight: 700; cursor: pointer;
}
.logout-form button:hover { background: rgba(255,255,255,0.16); }
.main-shell { padding: 28px 0 48px; }
.eyebrow { margin: 0 0 8px; text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.78rem; color: var(--muted); }
.app-header .eyebrow { color: rgba(255,255,255,0.72); }
h1, h2, h3, h4, p { margin-top: 0; }
.hero { display: flex; justify-content: space-between; gap: 24px; align-items: end; margin-bottom: 24px; }
.hero.compact { align-items: center; }
.hero-copy { max-width: 520px; color: var(--muted); }
.card-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 24px; }
.detail-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.metric-card, .panel, .audit-card, .alert {
  background: var(--panel);
  border: 1px solid rgba(217, 226, 236, 0.9);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.metric-card { padding: 18px 20px; min-height: 120px; display: flex; flex-direction: column; justify-content: space-between; }
.metric-card span { color: var(--muted); font-size: 0.92rem; }
.metric-card strong { font-size: 1.3rem; line-height: 1.25; }
.metric-card.wide { grid-column: span 2; }
.panel { padding: 20px; margin-bottom: 24px; }
.form-panel { max-width: 760px; }
.filters, .job-form { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.filters input, .filters button, .job-form input, .job-form button {
  min-height: 44px; border-radius: 12px; border: 1px solid var(--line); padding: 0 14px; font: inherit;
}
.filters button, .button-primary, .job-form button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 12px; border: none;
  background: linear-gradient(120deg, var(--accent), var(--accent-dark)); color: #fff; font-weight: 700; cursor: pointer;
  box-shadow: 0 8px 20px rgba(18, 62, 104, 0.16);
}
.checkbox { display: flex; gap: 10px; align-items: center; min-height: 44px; color: var(--muted); }
.checkbox input { min-height: auto; width: 18px; height: 18px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field-file input { padding: 10px 14px; }
.help-text { margin: 4px 0 0; color: var(--muted); grid-column: 1 / -1; }
.table-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 16px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 980px; }
th, td { padding: 14px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
thead th { font-size: 0.84rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.badge {
  display: inline-flex; align-items: center; padding: 6px 10px; border-radius: 999px; font-size: 0.82rem; font-weight: 700;
}
.badge-success { color: #eaf7ef; background: var(--success); }
.badge-danger { color: #fff0f0; background: var(--danger); }
.badge-warning { color: #fff7e6; background: var(--warning); }
.badge-orange { color: #fff7ea; background: var(--orange); }
.badge-info { color: #edf7ff; background: var(--info); }
.badge-muted-success { color: #eff7f1; background: var(--muted-success); }
.badge-muted { color: #f5f7fa; background: #7a8896; }
.action-link { color: var(--accent); font-weight: 700; }
.button-primary { white-space: nowrap; }
pre {
  margin: 0; padding: 16px; overflow-x: auto; white-space: pre-wrap; word-break: break-word;
  background: #0f1d2d; color: #d7e5f4; border-radius: 14px; font-size: 0.88rem;
}
.audit-card { padding: 18px; margin-bottom: 16px; }
.audit-header { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.detail-list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-bottom: 16px; }
.detail-list div { padding: 14px; border-radius: 12px; background: #f6f9fc; }
.detail-list dt { color: var(--muted); font-size: 0.83rem; margin-bottom: 6px; }
.detail-list dd { margin: 0; font-weight: 600; }
.json-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.empty-state { color: var(--muted); text-align: center; padding: 24px 0; }
.alert { padding: 16px 18px; margin-bottom: 24px; }
.alert-danger { border-color: rgba(179, 58, 58, 0.35); background: #fff4f4; color: #7e2121; }
.progress-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.progress-bar {
  width: 100%; height: 16px; background: #e5edf6; border-radius: 999px; overflow: hidden;
}
.progress-fill {
  height: 100%; background: linear-gradient(120deg, var(--accent), #2d87cb); border-radius: 999px; transition: width 0.35s ease;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(56, 182, 255, 0.20), transparent 30%),
    radial-gradient(circle at bottom right, rgba(15, 39, 66, 0.35), transparent 32%),
    linear-gradient(145deg, #0b1f35 0%, #123559 45%, #174974 100%);
}

.login-shell {
  width: min(100%, 1080px);
  display: flex;
  justify-content: center;
}

.login-card {
  width: min(460px, 100%);
  padding: 36px 34px 30px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 28px 80px rgba(7, 20, 36, 0.30);
  border: 1px solid rgba(255, 255, 255, 0.45);
}

.login-brand {
  margin-bottom: 28px;
}

.login-eyebrow {
  color: var(--accent);
}

.login-title {
  margin: 0 0 12px;
  font-size: 2rem;
  line-height: 1.05;
  color: #0f2742;
}

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

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

.login-input {
  min-height: 48px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid #cbd7e4;
  background: #fff;
  font: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-input:focus {
  outline: none;
  border-color: #2d87cb;
  box-shadow: 0 0 0 4px rgba(45, 135, 203, 0.14);
}

.login-button {
  min-height: 50px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(120deg, #1567ab, #0f3f69);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(15, 63, 105, 0.22);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.login-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 28px rgba(15, 63, 105, 0.26);
}

.login-error {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #fff2f2;
  border: 1px solid rgba(179, 58, 58, 0.22);
  color: #8f2424;
  font-weight: 600;
}

.login-footer {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid #e5edf6;
}

.security-note {
  color: var(--muted);
  font-size: 0.92rem;
}

@media (max-width: 800px) {
  .shell { width: min(100% - 20px, 100%); }
  .shell-header, .hero { flex-direction: column; align-items: flex-start; }
  .header-actions { width: 100%; justify-content: flex-start; }
  .session-box { width: 100%; justify-content: space-between; }
  .metric-card.wide { grid-column: span 1; }
  .table-meta, .progress-meta { flex-direction: column; align-items: flex-start; }
  .login-card { padding: 28px 22px 24px; }
}
