:root {
  color-scheme: light;
  --ink: #10231d;
  --muted: #607069;
  --paper: #f4f2ea;
  --card: #fffdf7;
  --accent: #0d6b50;
  --line: #d8ddd6;
  --danger: #ad3d35;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: radial-gradient(circle at top left, #dcecdf 0, transparent 34rem), var(--paper); }
.admin-shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 48px 0; }
.admin-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 32px; margin-bottom: 26px; }
h1 { margin: 4px 0 10px; font-family: Georgia, serif; font-size: clamp(40px, 7vw, 64px); line-height: 1; font-weight: 500; letter-spacing: -.04em; }
h2 { margin: 3px 0 0; font-size: 24px; }
h3 { margin: 8px 0 5px; overflow-wrap: anywhere; font-size: 17px; }
.eyebrow { margin: 0; color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .14em; }
.muted { margin: 0; color: var(--muted); line-height: 1.5; }
.header-actions, .task-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.header-actions form { margin: 0; }
.button { display: inline-flex; justify-content: center; margin: 0; padding: 10px 14px; border: 0; border-radius: 9px; color: white; background: var(--accent); font: inherit; font-size: 14px; font-weight: 750; text-decoration: none; cursor: pointer; }
.button.secondary { border: 1px solid var(--line); color: var(--ink); background: #fffdf7; }
.button.danger { background: var(--danger); }
.button.danger.ghost { border: 1px solid #e6c2be; color: #8a302a; background: #fff7f5; }
.button.quarantine { border: 1px solid #d3a845; color: #5d420c; background: #ffe7aa; }
.button.compact { padding: 8px 12px; }
.button:disabled { opacity: .45; cursor: default; }
.warning, .error { margin: 16px 0; padding: 13px 16px; border-radius: 10px; }
.warning { border: 1px solid #e8cf94; color: #6f5117; background: #fff5d8; }
.error { border: 1px solid #e6c2be; color: #7c211d; background: #f8e5e2; }
.hidden { display: none !important; }
.settings-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, .75fr); gap: 28px; align-items: end; margin: 22px 0; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); box-shadow: 0 10px 35px rgba(23, 50, 39, .06); }
.settings-card h2 { margin-bottom: 8px; }
.model-controls { display: grid; gap: 9px; }
.model-controls label { color: var(--muted); font-size: 13px; font-weight: 750; }
.model-controls select { width: 100%; min-width: 0; padding: 11px 38px 11px 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: white; font: inherit; }
.model-controls select:disabled { opacity: .65; }
.model-selects { display: grid; grid-template-columns: minmax(0, 2fr) minmax(150px, 1fr); gap: 10px; }
.model-selects label { display: grid; gap: 7px; }
.model-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.model-status { min-height: 18px; color: var(--muted); overflow-wrap: anywhere; }
.model-status.error-text { color: var(--danger); }
.model-status.success-text { color: var(--accent); }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 22px 0; }
.metrics article { display: grid; gap: 4px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); box-shadow: 0 10px 35px rgba(23, 50, 39, .06); }
.metrics span { font-family: Georgia, serif; font-size: 34px; }
.metrics small { color: var(--muted); font-weight: 700; }
.task-section { margin-top: 26px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 12px; }
.task-list { display: grid; gap: 10px; }
.task-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 18px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.task-card:has(.position) { grid-template-columns: 42px minmax(0, 1fr) auto; }
.position { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: var(--accent); background: #e1eee6; font-weight: 850; }
.task-main code { display: block; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.task-main p, .task-main small { display: block; margin: 9px 0 0; color: var(--muted); }
.status-badge { display: inline-flex; padding: 4px 8px; border-radius: 999px; font-size: 11px; font-weight: 850; text-transform: uppercase; letter-spacing: .06em; }
.status-badge.processing { color: #74520e; background: #f8e8bd; }
.status-badge.queued { color: #176045; background: #dcefe5; }
.status-badge.completed { color: #176045; background: #dcefe5; }
.status-badge.failed { color: #8a302a; background: #f5dfdc; }
.status-badge.needs_review { color: #74520e; background: #f8e8bd; }
.status-badge.cancelled { color: #56615c; background: #e5e9e6; }
.history-section { padding-top: 12px; border-top: 1px solid var(--line); }
.history-card { grid-template-columns: minmax(0, 1fr) auto; }
.empty-state { padding: 30px; border: 1px dashed #abb8b1; border-radius: 14px; color: var(--muted); text-align: center; }
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-card { width: min(430px, 100%); padding: 30px; border: 1px solid var(--line); border-radius: 20px; background: var(--card); box-shadow: 0 20px 70px rgba(23, 50, 39, .12); }
.login-card h1 { font-size: 42px; }
.login-card form { display: grid; gap: 14px; margin-top: 24px; }
.login-card label { display: grid; gap: 8px; color: var(--muted); font-size: 14px; font-weight: 700; }
.login-card input { width: 100%; padding: 13px 14px; border: 1px solid var(--line); border-radius: 9px; background: white; font: inherit; }
.login-card button { width: 100%; }
.login-error { margin: 0; color: var(--danger); font-size: 14px; }
.back-link { display: inline-block; margin-top: 22px; color: var(--accent); font-size: 14px; }

@media (max-width: 720px) {
  .admin-shell { padding-top: 28px; }
  .admin-header { flex-direction: column; }
  .settings-card { grid-template-columns: 1fr; }
  .model-selects { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .task-card, .task-card:has(.position) { grid-template-columns: 38px minmax(0, 1fr); }
  .task-card:not(:has(.position)) { grid-template-columns: 1fr; }
  .history-card { grid-template-columns: 1fr; }
  .task-actions { grid-column: 1 / -1; }
}

@media (max-width: 440px) {
  .metrics { grid-template-columns: 1fr; }
}
