:root {
  --sintef-blue:   #0058A3;
  --sintef-dark:   #003D6B;
  --sintef-light:  #E5F0F9;
  --sintef-grey:   #6B7785;
  --bg:            #f7f9fb;
  --border:        #d4dae0;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Arial', 'Helvetica', system-ui, sans-serif;
  background: var(--bg);
  color: #222;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---- header ---------------------------------------------------------- */
.brand-header {
  background: var(--sintef-dark);
  color: white;
  padding: 10px 24px;
  display: flex; align-items: center; gap: 18px;
  border-bottom: 4px solid var(--sintef-blue);
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.brand-logo { height: 40px; display: block; }
.brand-title { font-size: 18px; font-weight: 600; letter-spacing: 0.3px; }
.brand-subtitle { font-size: 13px; color: rgba(255,255,255,0.85);
                  letter-spacing: 0.5px; font-weight: 500; }
.brand-nav { display: flex; gap: 14px; margin-left: 24px; }
.brand-nav a { color: rgba(255,255,255,0.85); text-decoration: none;
               font-weight: 600; font-size: 13px; }
.brand-nav a:hover { color: white; }
.brand-nav a.dashboard-link { background: var(--sintef-blue);
                              padding: 4px 10px; border-radius: 3px;
                              color: white; }
.brand-nav a.dashboard-link:hover { background: white; color: var(--sintef-dark); }
.brand-nav a.lang-switch { margin-left: auto; padding: 2px 6px;
                            font-size: 18px; line-height: 1;
                            text-decoration: none;
                            filter: grayscale(0.15);
                            transition: filter 0.15s, transform 0.15s; }
.brand-nav a.lang-switch:hover { filter: none; transform: scale(1.1); }

/* ---- footer ---------------------------------------------------------- */
.brand-footer {
  background: white;
  border-top: 1px solid var(--border);
  padding: 4px 24px;
  display: flex; align-items: center;
  margin-top: auto;
}
.empowered-by { height: 28px; width: auto; display: block; }

/* ---- pages ----------------------------------------------------------- */
.page { flex: 1 1 auto; padding: 32px 28px; max-width: 1080px;
        margin: 0 auto; width: 100%; }
.prose { line-height: 1.55; }
.prose h1 { color: var(--sintef-dark); border-bottom: 2px solid var(--sintef-blue);
            padding-bottom: 8px; margin-top: 0; }
.prose h2 { color: var(--sintef-dark); margin-top: 28px; }
.prose code { background: var(--sintef-light); padding: 1px 5px;
              border-radius: 2px; font-size: 0.92em; }
.prose pre { background: #1f2933; color: #f5f7fa; padding: 14px;
             border-radius: 4px; overflow-x: auto; }
.prose pre code { background: none; color: inherit; }
.prose table { border-collapse: collapse; margin: 14px 0; }
.prose table th { background: var(--sintef-light); color: var(--sintef-dark);
                  text-align: left; padding: 6px 12px; }
.prose table td { padding: 6px 12px; border-top: 1px solid #e3e7ec;
                  vertical-align: top; }

/* ---- data-missing banner --------------------------------------------- */
.data-warning { background: #fff8e1; border: 1px solid #f0c33c;
                border-left: 5px solid #d49b00; padding: 14px 18px;
                border-radius: 4px; margin-bottom: 24px; color: #5a4500; }
.data-warning strong { color: #5a4500; font-size: 15px;
                       display: block; margin-bottom: 4px; }
.data-warning p { margin: 0; font-size: 14px; line-height: 1.45; }
.data-warning code { background: rgba(255,255,255,0.6); padding: 1px 5px;
                     border-radius: 2px; font-size: 0.92em; }

/* ---- landing cards --------------------------------------------------- */
.hero h1 { color: var(--sintef-dark); border-bottom: 2px solid var(--sintef-blue);
           padding-bottom: 8px; }
.lede { font-size: 16px; color: #444; max-width: 800px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
             gap: 16px; margin-top: 28px; }
.card { background: white; padding: 18px 20px; border-radius: 4px;
        text-decoration: none; color: inherit; border: 1px solid var(--border);
        box-shadow: 0 1px 3px rgba(0,0,0,0.04); transition: transform 0.12s; }
.card:hover { transform: translateY(-2px);
              box-shadow: 0 4px 12px rgba(0,88,163,0.12);
              border-color: var(--sintef-blue); }
.card h3 { color: var(--sintef-dark); margin: 0 0 6px; }
.card p { color: #555; margin: 0; font-size: 14px; }
.dashboard-card { background: var(--sintef-light); }

.fan-illustration { margin: 28px 0; max-width: 760px; }
.fan-illustration--small { max-width: 380px; }

.intro-with-figure { display: flex; gap: 28px; align-items: flex-start;
                     margin: 28px 0; flex-wrap: wrap; }
.intro-with-figure .intro-prose { flex: 1 1 320px; min-width: 0; }
.intro-with-figure > .fan-illustration { flex: 0 0 380px; margin: 0; }
.intro-with-figure .intro-prose .fan-illustration { max-width: 380px; margin: 18px 0 0; }
@media (max-width: 720px) {
  .intro-with-figure > .fan-illustration { flex-basis: 100%; max-width: 380px; }
}
.fan-illustration__img { width: 100%; height: auto; display: block;
                         border: 1px solid var(--border); border-radius: 4px;
                         background: #fafafa; }
.fan-illustration figcaption { font-size: 13px; color: #555; margin-top: 8px;
                                font-style: italic; }

/* ---- chat ------------------------------------------------------------ */
.status { font-size: 12px; color: #555; padding: 8px 12px;
          background: var(--sintef-light); border-radius: 4px;
          margin-bottom: 16px; }
.chat { background: white; border: 1px solid var(--border);
        border-radius: 4px; padding: 14px; }
.messages { max-height: 60vh; overflow-y: auto; padding-right: 6px; }
.msg { padding: 10px 14px; border-radius: 4px; margin-bottom: 8px;
       background: var(--sintef-light); }
.msg-user { background: #eef2f6; }
.msg-error { background: #fff3cd; color: #663d00; }
.msg .role { font-weight: 700; color: var(--sintef-dark); font-size: 11px;
             margin-right: 10px; }
.msg .body { white-space: pre-wrap; display: inline; font-size: 13.5px; }
.msg .sources { margin-top: 6px; font-size: 11px; color: #666; font-style: italic; }
.ref-list { margin: 4px 0 0 18px; padding: 0; font-style: normal; }
.ref-list li { margin: 4px 0; line-height: 1.35; }
.ref-list li.ref-unused { opacity: 0.45; }
.ref-list li.ref-used::marker { color: var(--sintef-blue); font-weight: 700; }
.ref-list .score { color: #888; font-size: 10px; }
.ref-list .preview { color: #444; }
#ask-form { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
#ask-form textarea { flex: 1; padding: 8px 10px; border: 1px solid var(--border);
                     border-radius: 3px; font-family: inherit; }
#ask-form textarea:focus { outline: none; border-color: var(--sintef-blue);
                            box-shadow: 0 0 0 2px var(--sintef-light); }
.chat-actions { display: flex; gap: 8px; }
#ask-form button[type="submit"] { background: var(--sintef-blue); color: white;
                                  border: 0; padding: 8px 22px; border-radius: 3px;
                                  font-weight: 600; cursor: pointer; }
#ask-form button[type="submit"]:hover { background: var(--sintef-dark); }
#reset-btn { background: white; color: var(--sintef-dark); border: 1px solid var(--border);
             padding: 8px 16px; border-radius: 3px; cursor: pointer; }
#reset-btn:hover { border-color: var(--sintef-blue); color: var(--sintef-blue); }

/* ---- report page (sidebar TOC + body) -------------------------------- */
.report-page {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
  max-width: 1200px;
  margin: 0 auto;
}
.report-sidebar {
  position: sticky; top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  font-size: 13px;
  padding-right: 8px;
}
.report-toc h2 { font-size: 14px; color: var(--sintef-dark);
                 text-transform: uppercase; letter-spacing: 0.06em;
                 margin: 0 0 8px; }
.report-toc ul { list-style: none; padding-left: 0; margin: 0; }
.report-toc li { margin: 2px 0; }
.report-toc a { color: var(--sintef-dark); font-weight: 400;
                 font-size: 13px; text-decoration: none; }
.report-toc a:hover { text-decoration: underline; }
.report-toc li.toc-section { margin: 14px 0 4px; }
.report-toc li.toc-section > a,
.report-toc li.toc-chapter:not(.toc-indent) > a { font-weight: 700; }
.report-toc li.toc-chapter.toc-indent { padding-left: 14px; }
.report-toc ul.toc-subsub { padding-left: 14px; margin: 2px 0 6px; }
.report-toc ul ul { padding-left: 14px; margin-top: 2px; }
.report-part { color: var(--sintef-dark); font-size: 28px; font-weight: 700;
               border-bottom: 3px solid var(--sintef-blue);
               padding-bottom: 10px; margin: 36px 0 18px; }
.report-figure { margin: 22px 0; padding: 0; text-align: center; }
.report-figure img { max-width: 100%; height: auto; display: block;
                     margin: 0 auto; }
.report-figure figcaption,
.report-table figcaption { font-size: 13px; color: #444;
                             margin-top: 8px; text-align: left;
                             line-height: 1.45; }
.report-table { margin: 22px 0; }
.report-table table { margin: 0; }

.report-downloads { margin-top: 24px; padding-top: 16px;
                    border-top: 1px solid var(--border); }
.report-downloads h3 { font-size: 14px; color: var(--sintef-dark);
                       text-transform: uppercase; letter-spacing: 0.06em;
                       margin: 0 0 8px; }
.report-download-btn { display: block; padding: 6px 10px; margin: 4px 0;
                       background: var(--sintef-blue); color: white;
                       text-decoration: none; border-radius: 3px;
                       font-weight: 600; text-align: center; font-size: 13px; }
.report-download-btn:hover { background: var(--sintef-dark); }
.report-build-info { font-size: 11px; color: var(--sintef-grey);
                     margin: 8px 0 0; }

.report-body { min-width: 0; }
.report-body .report-subtitle {
  color: var(--sintef-grey); font-style: italic;
  margin-top: -10px; margin-bottom: 24px;
}
.report-chapter { margin-bottom: 28px; }
.report-chapter h2 { color: var(--sintef-dark);
                     border-bottom: 2px solid var(--sintef-blue);
                     padding-bottom: 6px; margin-top: 32px; }
.report-chapter h3 { color: var(--sintef-dark); margin-top: 22px; }
.report-chapter h4 { color: var(--sintef-dark); margin-top: 18px; }
.report-chapter img { max-width: 100%; height: auto;
                      display: block; margin: 14px auto; }

/* Pending-content placeholders mirror the LaTeX/PDF visual */
.pending {
  border-left: 3px solid #c8102e;
  background: #fff5f5;
  padding: 6px 10px;
  margin: 0.6em 0;
  font-size: 0.92em;
  color: #5a0000;
}
.pending-label { font-weight: 700; text-transform: uppercase;
                 font-size: 0.8em; margin-right: 0.5em; color: #c8102e; }

/* MathML — let the browser pick the font */
.math.display { display: block; text-align: center; margin: 0.6em 0; }
.math.inline  { padding: 0 2px; }

@media (max-width: 900px) {
  .report-page { grid-template-columns: 1fr; }
  .report-sidebar { position: static; max-height: none; }
}
