:root {
  color-scheme: light;
  --bg: #f3f5f7;
  --card: #ffffff;
  --ink: #17202a;
  --muted: #687584;
  --line: #dce2e8;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --success: #0f8a5f;
  --warning: #b7791f;
  --danger: #c2413b;
  --shadow: 0 12px 32px rgba(24, 39, 75, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
button, input, textarea, select { font: inherit; }
.hidden { display: none !important; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(420px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 36px; box-shadow: var(--shadow); }
.brand-mark { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; background: var(--accent); color: white; font-weight: 800; margin-bottom: 28px; }

.app-shell { width: min(1380px, calc(100% - 40px)); margin: 0 auto; padding: 36px 0 60px; }
.topbar { display: flex; justify-content: space-between; gap: 24px; align-items: center; margin-bottom: 26px; }
.topbar h1, .card h2, .job-dialog h2, .login-card h1 { margin: 4px 0 0; letter-spacing: -0.025em; }
.topbar-actions { display: flex; gap: 12px; align-items: center; }
.eyebrow { margin: 0; color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.muted { color: var(--muted); }

.grid-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, .75fr); gap: 20px; margin-bottom: 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 24px; box-shadow: var(--shadow); }
.card-heading { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 22px; }

.field { display: grid; gap: 8px; margin: 22px 0; }
.field > span { font-size: 13px; font-weight: 700; }
.field small { color: var(--muted); line-height: 1.45; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px; background: #fbfcfd; color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s; }
textarea { resize: vertical; min-height: 220px; line-height: 1.55; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.inline-fields { display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.field.compact { margin: 0; }
.field.compact input { width: 130px; }
.file-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.file-row input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.file-button { cursor: pointer; }

.button { border: 1px solid transparent; border-radius: 10px; padding: 10px 15px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; transition: transform .12s, background .12s; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.button.primary { background: var(--accent); color: white; }
.button.primary:hover { background: var(--accent-dark); }
.button.ghost { background: white; color: var(--ink); border-color: var(--line); }
.button.danger { background: #fff1f0; color: var(--danger); border-color: #f0c5c1; }
.button.wide { width: 100%; }
.submit-job { min-height: 44px; }
.icon-button { border: 0; background: transparent; color: var(--muted); font-size: 30px; cursor: pointer; line-height: 1; }

.form-error { color: var(--danger); min-height: 20px; margin: 12px 0 0; font-size: 13px; }
.counter { background: #eef4ff; color: var(--accent); border-radius: 999px; padding: 7px 11px; font-size: 12px; font-weight: 800; }
.notice { background: #f6f8fb; border-left: 3px solid var(--accent); border-radius: 5px; padding: 13px 14px; color: var(--muted); line-height: 1.5; font-size: 13px; }
.stats-list { margin: 22px 0; display: grid; gap: 14px; }
.stats-list div { display: flex; justify-content: space-between; gap: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.stats-list dt { color: var(--muted); }
.stats-list dd { margin: 0; font-weight: 750; text-align: right; }

.status-pill { display: inline-flex; align-items: center; gap: 7px; border-radius: 999px; padding: 7px 11px; font-size: 12px; font-weight: 800; }
.status-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-pill.neutral { background: #edf0f4; color: #66717f; }
.status-pill.success { background: #e6f6ef; color: var(--success); }
.status-pill.warning { background: #fff4df; color: var(--warning); }
.status-pill.danger { background: #fff0ef; color: var(--danger); }
.status-pill.running { background: #eaf1ff; color: var(--accent); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); }
td { padding: 13px 10px; border-bottom: 1px solid #edf0f3; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.row-action { padding: 7px 10px; }
.empty-state { color: var(--muted); text-align: center; padding: 30px 10px 12px; }
.progress { display: flex; align-items: center; gap: 10px; min-width: 150px; }
.progress-track { width: 90px; height: 6px; background: #e7ebef; border-radius: 999px; overflow: hidden; }
.progress-track span { display: block; height: 100%; background: var(--accent); }

.global-message { margin-bottom: 20px; padding: 12px 15px; border-radius: 10px; background: #fff4df; color: #805b19; border: 1px solid #f1d9aa; }

.job-dialog { width: min(1050px, calc(100% - 32px)); max-height: calc(100vh - 42px); border: 1px solid var(--line); border-radius: 18px; padding: 24px; box-shadow: 0 24px 90px rgba(0, 0, 0, .22); }
.job-dialog::backdrop { background: rgba(19, 28, 38, .54); backdrop-filter: blur(2px); }
.dialog-heading, .dialog-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.summary-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 22px 0; }
.summary-item { background: #f6f8fa; border-radius: 12px; padding: 14px; }
.summary-item span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 5px; }
.summary-item strong { font-size: 22px; }
.dialog-toolbar { margin: 20px 0 12px; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.filter-field select { width: 260px; }
.result-table-wrap { max-height: 46vh; }
.error-panel { background: #fff0ef; color: #8c302b; border: 1px solid #f0c5c1; border-radius: 10px; padding: 12px 14px; }
.email-cell { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }

@media (max-width: 820px) {
  .app-shell { width: min(100% - 24px, 1380px); padding-top: 22px; }
  .grid-layout { grid-template-columns: 1fr; }
  .topbar, .dialog-heading, .dialog-toolbar { align-items: flex-start; flex-direction: column; }
  .topbar-actions { width: 100%; justify-content: space-between; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .inline-fields { align-items: stretch; flex-direction: column; }
  .field.compact input, .submit-job, .filter-field select { width: 100%; }
  .file-row { align-items: stretch; flex-direction: column; }
}
