/* Meta Ad Account Audit — application chrome and report document styles.
   Palette is deliberately neutral with a single accent so it can be re-skinned
   to Agital brand assets by changing the custom properties below. */

:root {
  --ink:      #14181f;
  --ink-2:    #3d4757;
  --muted:    #6b7787;
  --line:     #e3e7ed;
  --line-2:   #eef1f5;
  --bg:       #f6f7f9;
  --surface:  #ffffff;
  --accent:   #2b4c8c;
  --accent-2: #eaf0fa;

  --good:  #1f7a4d;  --good-bg:  #e8f5ee;
  --ok:    #8a6100;  --ok-bg:    #fdf3dd;
  --bad:   #a32a20;  --bad-bg:   #fdeceb;
  --none:  #5c6672;  --none-bg:  #eef0f3;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: .88em; background: var(--line-2);
       padding: .12em .38em; border-radius: 4px; }
pre { overflow-x: auto; background: var(--line-2); padding: 12px; border-radius: 8px; }
h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -0.011em; }

/* ------------------------------------------------------------- chrome */

.chrome { background: var(--surface); border-bottom: 1px solid var(--line); }
.chrome-inner { max-width: 1180px; margin: 0 auto; padding: 0 24px;
                display: flex; align-items: center; gap: 28px; height: 56px; }
.brand { font-weight: 650; color: var(--ink); letter-spacing: -.01em; }
.chrome nav { display: flex; gap: 20px; }
.chrome nav a { color: var(--ink-2); font-size: 14px; }
.chrome nav a.on { color: var(--accent); font-weight: 550; }
.chrome-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }

.banner { background: #fff8e6; border-bottom: 1px solid #f0e0b0; color: #6b530d;
          padding: 10px 24px; font-size: 13.5px; text-align: center; }
.banner code { background: #f6ebcd; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 32px 24px 80px; }
.wrap.narrow { max-width: 720px; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between;
             gap: 24px; margin-bottom: 24px; }
.page-head h1 { margin: 0 0 4px; font-size: 26px; }
.page-head p { margin: 0; }

/* -------------------------------------------------------------- atoms */

.muted { color: var(--muted); }
.small { font-size: 13px; }
.right { text-align: right; }
.warn  { color: var(--bad); }
.row { display: flex; gap: 12px; align-items: center; }
.row.between { justify-content: space-between; width: 100%; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.hint { font-size: 13px; color: var(--muted); margin: -4px 0 4px; }

.card { background: var(--surface); border: 1px solid var(--line);
        border-radius: var(--radius); padding: 22px; margin-bottom: 20px; }
.card h2 { margin: 0 0 8px; font-size: 18px; }
.card h3 { margin: 0 0 8px; font-size: 15px; }
.card.subtle { background: transparent; border-style: dashed; }
.card.empty { text-align: center; padding: 48px 24px; }
.card.auth { margin-top: 12vh; }

.stack { display: flex; flex-direction: column; gap: 14px; }
.stack label, .card label { display: flex; flex-direction: column; gap: 6px;
                            font-size: 13.5px; font-weight: 550; color: var(--ink-2); }

input[type=text], input[type=email], input[type=password], input[type=date],
select, textarea {
  font: inherit; font-weight: 400; color: var(--ink);
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-2);
}
textarea { font-family: var(--mono); font-size: 13px; line-height: 1.6; resize: vertical; }

.btn, button.primary {
  display: inline-block; font: inherit; font-size: 14px; font-weight: 550;
  padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--line-2); text-decoration: none; }
.btn.primary, button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover, button.primary:hover { filter: brightness(1.08); }
.btn.small { padding: 5px 11px; font-size: 13px; }
.btn:disabled, button:disabled { opacity: .5; cursor: not-allowed; }
button.link { background: none; border: none; padding: 0; color: var(--accent);
              cursor: pointer; font: inherit; font-size: 13px; }

.pill { display: inline-block; font-size: 11.5px; font-weight: 600; letter-spacing: .02em;
        padding: 2px 8px; border-radius: 20px; background: var(--line-2); color: var(--ink-2); }
.warn-pill { background: var(--ok-bg); color: var(--ok); }

.status { font-size: 12.5px; font-weight: 600; padding: 3px 9px; border-radius: 20px; }
.status-complete   { background: var(--good-bg); color: var(--good); }
.status-failed     { background: var(--bad-bg);  color: var(--bad); }
.status-queued     { background: var(--none-bg); color: var(--none); }
.status-collecting,
.status-analyzing,
.status-rendering  { background: var(--accent-2); color: var(--accent); }

.error { background: var(--bad-bg); color: var(--bad); padding: 10px 14px;
         border-radius: 8px; font-size: 14px; }
.error.block pre { background: transparent; padding: 8px 0 0; white-space: pre-wrap; }
.notice { background: var(--accent-2); color: #23406f; padding: 12px 14px;
          border-radius: 8px; font-size: 13.5px; }

table.grid { width: 100%; border-collapse: collapse; background: var(--surface);
             border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.grid th { text-align: left; font-size: 12px; text-transform: uppercase;
                letter-spacing: .05em; color: var(--muted); font-weight: 600;
                padding: 11px 14px; border-bottom: 1px solid var(--line); background: #fafbfc; }
table.grid td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.grid tr:last-child td { border-bottom: none; }
table.grid.compact td, table.grid.compact th { padding: 7px 12px; }

/* ------------------------------------------------------------ progress */

.steps { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-wrap: wrap; gap: 20px; }
.steps li { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.steps .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.steps li.done { color: var(--ink-2); }
.steps li.done .dot { background: var(--good); }
.steps li.active { color: var(--accent); font-weight: 600; }
.steps li.active .dot { background: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

/* -------------------------------------------------------- prompt editor */

.prompt-editor { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
.version-list { list-style: none; margin: 0; padding: 0; }
.version-list li { padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.version-list li:last-child { border-bottom: none; }
.version-list li.active { background: var(--accent-2); margin: 0 -12px; padding: 10px 12px;
                          border-radius: 8px; border-bottom: none; }
.cost-inputs summary { cursor: pointer; font-weight: 550; font-size: 13.5px; color: var(--ink-2); }
.cost-inputs > *:not(summary) { margin-top: 12px; }

/* =================================================================
   REPORT DOCUMENT
   ================================================================= */

/* Wider than the app chrome: the document carries wide data tables alongside a
   fixed table of contents, and 1180px leaves the tables scrolling horizontally. */
.report-page { max-width: 1320px; margin: 0 auto; padding: 28px 24px 90px; }

.report-hero { background: var(--surface); border: 1px solid var(--line);
               border-radius: var(--radius); padding: 32px;
               display: flex; justify-content: space-between; align-items: flex-start;
               gap: 24px; margin-bottom: 18px; }
.eyebrow { margin: 0 0 6px; font-size: 12px; font-weight: 650; letter-spacing: .09em;
           text-transform: uppercase; color: var(--accent); }
.report-hero h1 { margin: 0 0 18px; font-size: 34px; letter-spacing: -.022em; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 28px; margin: 0; }
.hero-meta dt { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
                color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.hero-meta dd { margin: 0; font-size: 14px; font-weight: 550; }
.readonly-note { margin: 18px 0 0; font-size: 12.5px; color: var(--muted); }
.hero-actions { display: flex; gap: 10px; flex-shrink: 0; }

.verdict { background: #1d2531; color: #eef1f5; border-radius: var(--radius);
           padding: 26px 32px; margin-bottom: 18px; }
.verdict h2 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase;
              letter-spacing: .09em; color: #93a3b8; font-weight: 650; }
.verdict p { margin: 0; font-size: 19px; line-height: 1.5; letter-spacing: -.012em; }

.scorecard { display: grid; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
             gap: 12px; margin-bottom: 18px; }
.grade { background: var(--surface); border: 1px solid var(--line);
         border-radius: var(--radius); padding: 16px 18px;
         display: flex; flex-direction: column; }
.grade .dimension { margin: 0; font-size: 12px; font-weight: 650; min-height: 2.5em;
                    text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
/* Fixed mark row so grades line up across cards regardless of label length. */
.grade .mark { margin: 4px 0 12px; font-size: 34px; font-weight: 700; line-height: 1.1;
               letter-spacing: -.03em; height: 38px; display: flex; align-items: center; }
.grade .mark-word { font-size: 17px; letter-spacing: -.01em; }
.grade .note { margin: 0; font-size: 12.5px; color: var(--ink-2); line-height: 1.5; }
.tone-good .mark { color: var(--good); }
.tone-ok   .mark { color: var(--ok); }
.tone-bad  .mark { color: var(--bad); }
.tone-none .mark { color: var(--none); }

.findings { background: var(--surface); border: 1px solid var(--line);
            border-radius: var(--radius); padding: 24px 28px; margin-bottom: 22px; }
.findings h2 { margin: 0 0 12px; font-size: 12px; text-transform: uppercase;
               letter-spacing: .09em; color: var(--muted); font-weight: 650; }
.findings ol { margin: 0; padding-left: 22px; }
.findings li { margin-bottom: 8px; font-size: 15.5px; }

/* minmax(0, 1fr) rather than 1fr: a grid track's automatic minimum size is its
   content, so one wide table would otherwise stretch the whole page. */
.report-body { display: grid; grid-template-columns: 218px minmax(0, 1fr);
               gap: 34px; align-items: start; }

.toc { position: sticky; top: 24px; max-height: calc(100vh - 60px); overflow-y: auto; }
.toc-title { margin: 0 0 10px; font-size: 11.5px; text-transform: uppercase;
             letter-spacing: .07em; color: var(--muted); font-weight: 650; }
.toc nav { display: flex; flex-direction: column; gap: 1px; }
.toc a { font-size: 13px; color: var(--ink-2); padding: 4px 10px;
         border-left: 2px solid var(--line); line-height: 1.4; }
.toc a:hover { color: var(--accent); border-left-color: var(--accent);
               background: var(--accent-2); text-decoration: none; }
.toc a.lvl-3 { padding-left: 22px; font-size: 12.5px; color: var(--muted); }

/* ---- the document itself ---- */

.report { background: var(--surface); border: 1px solid var(--line);
          border-radius: var(--radius); padding: 52px 64px; font-size: 15.5px;
          line-height: 1.68; color: var(--ink-2); }
/* Constrain the measure of running prose without narrowing the card, so tables
   and code blocks can use the full width they need. */
.report > p, .report > ul, .report > ol, .report > blockquote { max-width: 74ch; }
.report > *:first-child { margin-top: 0; }
.report h1 { font-size: 30px; margin: 0 0 24px; color: var(--ink); letter-spacing: -.022em; }
.report h2 { font-size: 22px; margin: 46px 0 14px; padding-top: 22px;
             border-top: 1px solid var(--line); color: var(--ink); letter-spacing: -.018em; }
.report h2:first-of-type { border-top: none; padding-top: 0; }
.report h3 { font-size: 16.5px; margin: 30px 0 10px; color: var(--ink); }
.report h4 { font-size: 14.5px; margin: 22px 0 8px; color: var(--ink); }
.report p { margin: 0 0 15px; }
.report strong { color: var(--ink); font-weight: 650; }
.report ul, .report ol { margin: 0 0 16px; padding-left: 24px; }
.report li { margin-bottom: 7px; }
.report hr { border: none; border-top: 1px solid var(--line); margin: 38px 0; }

.report blockquote {
  margin: 20px 0; padding: 16px 22px; background: var(--accent-2);
  border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; color: #23406f;
}
.report blockquote p:last-child { margin-bottom: 0; }

.table-scroll { margin: 22px 0; overflow-x: auto; max-width: 100%;
                border: 1px solid var(--line-2); border-radius: 8px; }
.report table {
  width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 480px;
}
.report thead th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .045em;
  color: var(--muted); font-weight: 650; padding: 9px 12px; background: #fafbfc;
  border-bottom: 1.5px solid var(--line);
}
.report tbody td { padding: 9px 12px; border-bottom: 1px solid var(--line-2);
                   vertical-align: top; }
.report tbody tr:last-child td { border-bottom: none; }
.report tbody tr:hover { background: #fafbfc; }
/* Long identifiers and parameter strings must wrap rather than force the table
   into a horizontal scroll the reader will not discover. */
.report table code { background: transparent; padding: 0; font-size: .92em;
                     overflow-wrap: break-word; }
.report td:first-child, .report th:first-child { white-space: nowrap; }
/* Keep the result column readable when a parameters column wants to hog width. */
.report td:last-child, .report th:last-child { min-width: 8.5rem; }

.report pre { background: #1d2531; color: #dfe6ee; padding: 18px 20px;
              border-radius: 8px; font-size: 13px; line-height: 1.6; margin: 20px 0; }
.report pre code { background: transparent; color: inherit; padding: 0; }

.report-foot { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 22px;
               padding-top: 16px; font-size: 12.5px; color: var(--muted); }

/* ------------------------------------------------------------- print */

@media print {
  :root { --bg: #fff; }
  body { background: #fff; font-size: 10.5pt; }
  .chrome, .banner, .no-print, .toc, .report-foot { display: none !important; }
  .report-page { max-width: none; padding: 0; }
  .report-body { display: block; }
  .report { border: none; border-radius: 0; padding: 0; max-width: none;
            font-size: 10.5pt; line-height: 1.5; }
  .report-hero, .findings, .grade { border: 1px solid #ccc; break-inside: avoid; }
  .verdict { background: #1d2531 !important; -webkit-print-color-adjust: exact;
             print-color-adjust: exact; break-inside: avoid; }
  .scorecard { grid-template-columns: repeat(3, 1fr); }
  .report h2 { break-after: avoid; page-break-after: avoid; }
  .report table, .report pre, .report blockquote { break-inside: avoid; }
  .table-scroll { overflow: visible; border: none; }
  .report table { min-width: 0; font-size: 8.5pt; }
  a { color: inherit; text-decoration: none; }
}

@media (max-width: 900px) {
  .report-body { grid-template-columns: 1fr; }
  .toc { position: static; }
  .prompt-editor { grid-template-columns: 1fr; }
  .report { padding: 30px 24px; }
  .report-hero { flex-direction: column; }
}
