* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f5f5f7;
  color: #1a1a1a;
  line-height: 1.5;
}
.container { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }
code { background: #f0f0f2; padding: 1px 5px; border-radius: 3px; font-size: 0.85em; }

.navbar { background: #fff; border-bottom: 1px solid #e5e5e7; padding: 0.75rem 0; }
.navbar .container { display: flex; justify-content: space-between; align-items: center; padding: 0 1.5rem; }
.logo { font-weight: 600; font-size: 1.1rem; color: #1a1a1a; text-decoration: none; }
.navbar nav a { margin-left: 1.5rem; color: #555; text-decoration: none; font-size: 0.9rem; }
.navbar nav a:hover { color: #000; }
.navbar nav a.logout { color: #c92a2a; }

h1 { font-size: 1.5rem; margin-bottom: 1rem; }
h2 { font-size: 1.2rem; margin: 1.5rem 0 0.75rem; }
h3 { font-size: 1rem; margin: 1rem 0 0.5rem; color: #333; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.stat { background: #fff; padding: 1rem; border-radius: 8px; border: 1px solid #e5e5e7; }
.stat-label { font-size: 0.8rem; color: #888; text-transform: uppercase; letter-spacing: 0.03em; }
.stat-value { font-size: 1.75rem; font-weight: 600; margin-top: 0.25rem; }

.actions-bar { display: flex; gap: 0.5rem; margin-bottom: 1rem; align-items: center; flex-wrap: wrap; }
.inline-label { font-size: 0.85rem; color: #555; }

button, .btn-small, .btn-primary {
  background: #1a1a1a;
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  text-decoration: none;
  display: inline-block;
  font-family: inherit;
}
button:hover, .btn-small:hover, .btn-primary:hover { background: #000; }
button:disabled { background: #ccc; cursor: not-allowed; }
.btn-small { padding: 0.3rem 0.7rem; font-size: 0.8rem; }
.btn-small.danger { background: #c92a2a; padding: 0.3rem 0.6rem; }
.btn-small.danger:hover { background: #a01e1e; }

.data-table {
  width: 100%;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e5e5e7;
  border-collapse: collapse;
}
.data-table th, .data-table td {
  padding: 0.6rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.875rem;
}
.data-table th {
  background: #fafafa;
  font-weight: 500;
  color: #666;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.data-table tr:last-child td { border-bottom: none; }

.status {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: capitalize;
}
.status-pending { background: #fff4e5; color: #b35900; }
.status-generating { background: #e3f2ff; color: #0056b3; }
.status-generated { background: #e8f5e9; color: #2e7d32; }
.status-published { background: #d1f7c4; color: #1a5f1a; }
.status-failed { background: #fde0e0; color: #c92a2a; }
.status-info { background: #e3f2ff; color: #0056b3; }
.status-warning { background: #fff4e5; color: #b35900; }
.status-error { background: #fde0e0; color: #c92a2a; }

.alert { padding: 0.75rem 1rem; border-radius: 6px; margin-bottom: 1rem; }
.alert-warning { background: #fff4e5; color: #7a4c00; border: 1px solid #ffc876; }
.alert-error { background: #fde0e0; color: #8a1a1a; border: 1px solid #f5a5a5; }
.alert-success { background: #d1f7c4; color: #1a5f1a; border: 1px solid #8dd672; }

.login-page {
  background: #f5f5f7;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}
.login-box {
  background: #fff;
  padding: 2rem;
  border-radius: 10px;
  border: 1px solid #e5e5e7;
  width: 100%;
  max-width: 420px;
}
.login-box h1 { font-size: 1.3rem; margin-bottom: 0.25rem; }
.login-box form { margin-top: 1rem; }
.login-box input[type="password"] {
  width: 100%;
  padding: 0.6rem;
  margin: 0.5rem 0 1rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.95rem;
}
.login-box button { width: 100%; padding: 0.65rem; }

.settings-form fieldset {
  background: #fff;
  border: 1px solid #e5e5e7;
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.settings-form legend { font-weight: 600; padding: 0 0.5rem; color: #333; }
.settings-form label {
  display: block;
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: #444;
  font-weight: 500;
}
.settings-form input[type="text"],
.settings-form input[type="url"],
.settings-form input[type="password"],
.settings-form select,
.settings-form textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.9rem;
  margin-top: 0.25rem;
  font-family: inherit;
}
.settings-form small {
  display: block;
  color: #888;
  font-size: 0.75rem;
  margin-top: 0.25rem;
}
.form-actions { margin-top: 1rem; }

.review-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.review-header h1 { flex: 1; font-size: 1.3rem; margin: 0; min-width: 200px; }
.back { color: #555; text-decoration: none; font-size: 0.875rem; }
.back:hover { color: #000; }

.review-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 1.5rem;
}
.review-main {
  background: #fff;
  padding: 1.25rem;
  border-radius: 8px;
  border: 1px solid #e5e5e7;
}
.review-main label { display: block; margin-top: 0.75rem; font-weight: 500; font-size: 0.875rem; }
.review-main textarea,
.review-main input {
  width: 100%;
  padding: 0.6rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9rem;
  margin-top: 0.25rem;
}
.review-main textarea {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.5;
}

.publish-form { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #eee; }
.publish-btn { background: #2e7d32; padding: 0.7rem 1.75rem; }
.publish-btn:hover { background: #1e5e22; }

.review-sidebar {
  background: #fff;
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid #e5e5e7;
  height: fit-content;
}
.cover-preview { width: 100%; border-radius: 6px; display: block; }
.meta-list dt { font-size: 0.75rem; color: #888; margin-top: 0.5rem; }
.meta-list dd { font-size: 0.85rem; color: #333; }

.error-box {
  background: #fde0e0;
  color: #8a1a1a;
  padding: 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  white-space: pre-wrap;
  font-family: ui-monospace, monospace;
}

.muted { color: #888; }
.small { font-size: 0.8rem; }
.error { color: #c92a2a; font-size: 0.85rem; margin-top: 0.5rem; }
.nowrap { white-space: nowrap; }

@media (max-width: 768px) {
  .review-grid { grid-template-columns: 1fr; }
  .navbar nav a { margin-left: 0.75rem; font-size: 0.8rem; }
  .navbar .container { flex-wrap: wrap; }
}
