:root {
  color-scheme: light;
  --bg: #fdf9fb;
  --card: #ffffff;
  --text: #1f1a17;
  --muted: #6b625c;
  --brand-purple: #c790d1;
  --brand-pink: #f39aa6;
  --brand-coral: #f7a19d;
  --accent: #b84d66;
  --accent-dark: #9a3f56;
  --border: #f0e4ea;
  --shadow: 0 10px 30px rgba(31, 26, 23, 0.08);
  --gradient: linear-gradient(90deg, var(--brand-purple), var(--brand-pink), var(--brand-coral));
  --sidebar-width: 240px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  background: var(--bg);
  color: var(--text);
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 1.25rem 0;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  padding: 0 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.sidebar-brand a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.sidebar-brand img {
  width: 40px;
  height: auto;
}

.sidebar-brand span {
  font-weight: 600;
  font-size: 1.1rem;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0 0.75rem;
  flex: 1;
}

.sidebar-nav a {
  display: block;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.95rem;
}

.sidebar-nav a:hover {
  background: #faf3f7;
}

.sidebar-nav a.active {
  background: #f8e8ef;
  color: var(--accent-dark);
  font-weight: 600;
}

.sidebar-footer {
  padding: 1rem 1.25rem 0;
  border-top: 1px solid var(--border);
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.sidebar-footer form {
  margin-top: 0.5rem;
}

.sidebar-footer button {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  padding: 0;
}

.main-content {
  flex: 1;
  min-width: 0;
}

.flash-messages {
  max-width: 1200px;
  margin: 1rem auto 0;
  padding: 0 1.5rem;
}

.flash {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

.flash-success {
  background: #e8f5ea;
  color: #1f5f2d;
}

.flash-error {
  background: #fdecea;
  color: #8a1f1f;
}

.page-header {
  padding: 1.5rem 1.5rem 0.5rem;
  max-width: 1200px;
}

.page-header h1 {
  margin: 0 0 0.25rem;
  font-size: 1.75rem;
}

.page-header p {
  margin: 0;
  color: var(--muted);
}

.admin-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin: 1rem 1.5rem 2rem;
  max-width: 1200px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.status-idle,
.status-queued {
  background: #f0f0f0;
  color: #555;
}

.status-running {
  background: #fff3cd;
  color: #856404;
}

.status-completed,
.status-complete,
.status-processed {
  background: #e8f5ea;
  color: #1f5f2d;
}

.status-failed,
.status-partial {
  background: #fdecea;
  color: #8a1f1f;
}

.btn {
  display: inline-block;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  text-decoration: none;
  font: inherit;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-dark);
}

.form-field {
  margin-bottom: 1rem;
}

.form-field label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 600;
}

.form-field input,
.form-field select {
  width: 100%;
  max-width: 420px;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
}

.form-error {
  color: #8a1f1f;
  margin-bottom: 1rem;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 2rem;
}

.login-card h1 {
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
}

.login-card p {
  color: var(--muted);
  margin: 0 0 1.5rem;
}

.processing-banner {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.processing-banner.running,
.processing-banner.queued {
  background: #fff3cd;
  color: #856404;
}

.processing-banner.failed {
  background: #fdecea;
  color: #8a1f1f;
}

.processing-banner.completed {
  background: #e8f5ea;
  color: #1f5f2d;
}

@media (max-width: 768px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}
