:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #172033;
  --muted: #647084;
  --line: #d9dee8;
  --accent: #1f6feb;
  --danger: #b42318;
  --ok: #137333;
  --warn: #a15c07;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--accent); text-decoration: none; }
.app-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
}
.shell {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 18px;
  background: var(--panel);
  border-right: 1px solid var(--line);
}
.brand { font-weight: 700; }
.nav {
  display: grid;
  gap: 6px;
}
.nav a {
  display: block;
  padding: 10px 12px;
  border-radius: 6px;
  color: var(--text);
}
.nav a:hover { background: #eef2f7; }
.logout { margin: auto 0 0; }
.logout button { width: 100%; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
h1 { font-size: 28px; margin: 0; }
h2 { font-size: 18px; margin: 0 0 12px; }
.panel, .card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 18px; margin-bottom: 18px;
}
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.stat span { color: var(--muted); display: block; font-size: 13px; }
.stat strong { font-size: 28px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 14px; }
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px;
  font: inherit; color: var(--text); background: white;
}
textarea { min-height: 90px; }
button, .button {
  border: 0; border-radius: 6px; background: var(--accent); color: white;
  padding: 10px 14px; font: inherit; cursor: pointer; display: inline-block;
}
button.secondary, .button.secondary { background: #eef2f7; color: var(--text); }
button.danger { background: var(--danger); }
table { width: 100%; border-collapse: collapse; background: var(--panel); }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
.status { display: inline-block; border-radius: 999px; padding: 3px 8px; background: #eef2f7; font-size: 13px; }
.status-completed { background: #dcfce7; color: var(--ok); }
.status-completed_with_errors, .status-ocr, .status-translating { background: #fff7ed; color: var(--warn); }
.status-failed { background: #fee2e2; color: var(--danger); }
.alert { color: var(--danger); background: #fff1f0; border: 1px solid #ffd1cc; padding: 10px; border-radius: 6px; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.login { max-width: 420px; margin: 12vh auto; }

@media (max-width: 760px) {
  .sidebar {
    width: 220px;
    gap: 12px;
    padding: 14px 16px;
  }
  .logout { margin: 0; }
  .shell { padding: 16px; }
  .page-header {
    align-items: flex-start;
    flex-direction: column;
  }
}
