/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Design tokens ──────────────────────────────────────── */
:root {
  --bg:       #f4f6fb;
  --surface:  #ffffff;
  --navy:     #1a1a2e;
  --accent:   #4f46e5;
  --text:     #1a1a2e;
  --muted:    #6b7280;
  --border:   #e5e7eb;
  --radius:   8px;
  --header-h: 52px;
}

/* ── Base ───────────────────────────────────────────────── */
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Site header ────────────────────────────────────────── */
.site-header {
  height: var(--header-h);
  background: var(--navy);
  display: flex;
  align-items: center;
  padding: 0 24px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-logo {
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.5px;
  text-decoration: none;
}
.site-logo:hover { text-decoration: none; opacity: 0.85; }

/* ── Flash messages ─────────────────────────────────────── */
.messages {
  list-style: none;
  padding: 12px 24px 0;
  max-width: 1160px;
  margin: 0 auto;
  width: 100%;
}
.message {
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 8px;
}
.message--success { background: #d1fae5; color: #065f46; }
.message--error   { background: #fee2e2; color: #991b1b; }
.message--warning { background: #fef3c7; color: #92400e; }
.message--info    { background: #dbeafe; color: #1e40af; }

/* ── Site main ──────────────────────────────────────────── */
.site-main {
  flex: 1;
  padding: 28px 24px 48px;
  max-width: 1160px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

/* ── Breadcrumbs ────────────────────────────────────────── */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.breadcrumbs .sep { color: var(--border); }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--accent); }

/* ── Page header ────────────────────────────────────────── */
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 22px; font-weight: 700; }
.page-header p  { color: var(--muted); margin-top: 4px; font-size: 14px; }

/* ── Card list ──────────────────────────────────────────── */
.card-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  border-color: #c7d2fe;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  display: block;
  color: var(--accent);
}
.card-title:hover { text-decoration: underline; }
.card-desc { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* ── Page tabs (subproject submenu) ─────────────────────── */
.page-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 0;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
  flex-wrap: wrap;
}

.page-tab {
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  border-radius: 6px 6px 0 0;
  border: 1px solid transparent;
  border-bottom: none;
  margin-bottom: -2px;
  transition: color 0.12s, background 0.12s;
}
.page-tab:hover {
  color: var(--accent);
  background: #eff2ff;
  text-decoration: none;
}
.page-tab--active {
  color: var(--accent);
  background: var(--surface);
  border-color: var(--border);
  border-bottom-color: var(--surface);
  font-weight: 600;
}

/* ── Report wrapper + iframe ────────────────────────────── */
.report-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-top: 0;
}

.report-iframe {
  width: 100%;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  /* Height is expanded by JS onload; this is the minimum fallback */
  min-height: 600px;
  height: 80vh;
  display: block;
}

/* When there are no tabs, give the iframe a full border */
.report-wrapper:first-child .report-iframe {
  border-top: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 16px;
}

/* ── Report placeholder ─────────────────────────────────── */
.report-placeholder {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 48px 32px;
  text-align: center;
  color: var(--muted);
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  font-size: 14px;
}
.report-placeholder a { color: var(--accent); }
.report-placeholder--error {
  border-color: #fca5a5;
  background: #fff5f5;
}
.report-placeholder--error p { color: #991b1b; font-weight: 600; }
.report-placeholder--error pre {
  font-size: 12px;
  color: #b91c1c;
  background: #fee2e2;
  padding: 12px;
  border-radius: 4px;
  max-width: 600px;
  text-align: left;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Empty state ────────────────────────────────────────── */
.empty { color: var(--muted); font-size: 14px; padding: 20px 0; }
.empty a { color: var(--accent); }
