:root {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --panel-soft: #f7f9fc;
  --text: #333;
  --muted: #6b7280;
  --border: #e6ebf2;
  --primary: #1d4ed8;
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  margin: 0;
  padding: 24px;
  background: var(--bg);
  color: var(--text);
}

.doc-shell {
  max-width: 1400px;
  margin: 0 auto;
}

.doc-header,
.doc-body {
  background: var(--panel);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 20px;
}

.prose h2 {
  font-size: 1.6rem;
  margin-top: 0;
  margin-bottom: 0.5em;
}

.prose p {
  line-height: 1.65;
  color: var(--muted);
}

/* --- ADMIN PANEL & FORM STYLES --- */
#adminPanel {
  display: none;
  background: #eef8f2;
  border: 1px solid #dcefe2;
  padding: 24px;
  border-radius: 10px;
  margin-bottom: 32px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-weight: 600;
  font-size: 0.80rem;
}

.hint {
  font-size: 0.85rem;
  color: #166534;
  opacity: 0.8;
}

.form-input,
textarea,
select {
  width: 100%;
  padding: 10px;
  border: 1px solid #a7d7b9;
  border-radius: 8px;
  font-family: inherit;
  background: #ffffff;
}

textarea {
  min-height: 100px;
  resize: vertical;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  background: #ffffff;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid #a7d7b9;
}

.tools-grid2 {
  display: grid;
  gap: 10px;
  background: #ffffff;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid #a7d7b9;
}

.tool-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.form-button {
  background: var(--primary);
  color: #fff;
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 16px;
  width: 100%;
  transition: 0.2s ease;
}

.form-button:hover {
  background: #1e3a8a;
}

.form-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.logout-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  float: right;
  font-size: 0.85rem;
  margin-left: 8px;
}

#formStatus {
  margin-top: 12px;
  font-weight: 600;
  text-align: center;
  font-size: 0.9rem;
}

/* --- TABLE STYLES --- */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 14px;
}

th,
td {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid #edf1f6;
}

th {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--panel-soft);
}

.status-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

.status-completed {
  background: #eef8f2;
  color: #166534;
}

.status-running {
  background: #fff4ea;
  color: #92400e;
}

.status-queued {
  background: #e0f2fe;
  color: #075985;
}

.status-failed {
  background: #fee2e2;
  color: #991b1b;
}

.view-btn {
  text-decoration: none;
  background: #f6f0ff;
  color: #4b5563;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid #dbe7f5;
  font-size: 0.85rem;
  font-weight: 600;
}

.view-btn:hover {
  background: #e8f0ff;
  color: #1d4ed8;
  border-color: #bfd3fb;
}

.top-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
  margin-bottom: 16px;
}

.doc-link-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1;
  border: 1px solid #dbe7f5;
  background: #f6f0ff;
  color: #4b5563;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: 0.18s ease;
}

.doc-link-button:hover {
  background: #efe4ff;
  border-color: #cbb7f6;
  color: #1f2937;
  transform: translateY(-1px);
}

/* Initially hidden tier-gated nav items to prevent layout shift */
.tier-gated {
  display: none;
}

.footer-text {
  color: var(--text);
  font-size: 1rem;
  margin: 20px 0 20px 0;
  line-height: 1.6;
}