:root {
  --primary: #0f172a;
  --primary-hover: #1e293b;
  --bg: #f7f9fb;
  --card-bg: #ffffff;
  --text: #1e2430;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --input-border: #bac5d6;
  --radius: 8px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.container { 
  max-width: 1140px; 
  margin: 0 auto; 
  padding: 2rem 1.25rem; 
}

.topbar {
  background: var(--primary);
  color: #fff;
  padding: 0.75rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.topbar nav { display: flex; gap: 1.5rem; }
.topbar a { 
  color: #cbd5e1; 
  text-decoration: none; 
  font-weight: 500;
  font-size: 0.9rem;
  transition: color 0.2s;
}
.topbar a:hover { color: #fff; }

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.card h1 {
  margin-top: 0;
  margin-bottom: 1.25rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.narrow { max-width: 520px; margin-left: auto; margin-right: auto; }
.stack { display: grid; gap: 1rem; }

.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
  align-items: end; /* All items in the grid align to the bottom (the inputs) */
}

label { 
  display: flex;
  flex-direction: column;
  gap: 0.5rem; 
  font-size: 0.875rem; 
  font-weight: 600; 
  color: var(--text-muted);
}

label.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  padding-bottom: 0.6rem; /* Align text with input bottom roughly */
}

label.checkbox input {
  width: 1.1rem;
  height: 1.1rem;
  padding: 0;
  margin: 0;
}

input, select, button {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-family: inherit;
  transition: all 0.2s;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.1);
}

button, .btn { 
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer; 
  background: var(--primary); 
  color: #fff; 
  border: none; 
  font-weight: 600;
  text-decoration: none;
  font-size: 0.875rem;
}

button:hover, .btn:hover { 
  background: var(--primary-hover); 
  transform: translateY(-1px);
}

.btn-small {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  border-radius: 6px;
}

.secondary {
  background: #f1f5f9;
  color: var(--primary);
  border: 1px solid var(--border);
}

.secondary:hover {
  background: #e2e8f0;
}

button:active {
  transform: translateY(0);
}

.inline { display: inline-flex; gap: 0.75rem; align-items: center; margin: 0; }

table { 
  width: 100%; 
  border-collapse: separate; 
  border-spacing: 0;
  font-size: 0.85rem; 
}

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

th { 
  background: #f8fafc; 
  font-weight: 600; 
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

tr:hover td { background: #fdfdfd; }

ul { list-style: none; padding: 0; margin: 0; }
li { padding: 0.75rem 0; border-bottom: 1px solid var(--border); }
li:last-child { border-bottom: none; }

.report-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.report-info { display: flex; flex-direction: column; gap: 0.2rem; }
.report-ref { font-size: 0.75rem; color: var(--text-muted); font-family: ui-monospace, monospace; }
.report-actions { display: flex; gap: 0.5rem; }

.error { color: #dc2626; font-size: 0.875rem; margin-bottom: 1rem; }
.success { color: #16a34a; font-size: 0.875rem; margin-bottom: 1rem; }

.pager { 
  display: flex; 
  justify-content: space-between; 
  align-items: center;
  margin-top: 1.5rem; 
  color: var(--text-muted);
  font-size: 0.875rem;
}

.pager a {
  text-decoration: none;
  color: var(--primary);
  font-weight: 600;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.2s;
}

.pager a:hover {
  background: #f1f5f9;
  border-color: var(--input-border);
}

.details-grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1rem 2rem;
}

.details-grid dt {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.details-grid dd {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85rem;
}

.report-frame {
  width: 100%;
  min-height: 75vh;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

code {
  background: #f1f5f9;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85em;
}

@media (max-width: 720px) {
  .details-grid { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; gap: 1rem; align-items: flex-start; }
  .topbar nav { width: 100%; justify-content: space-between; }
}
