/* ==========================================================================
   Bokförklaring — "Huvudboken, moderniserad"
   Paper, ink, tabular figures — and the red margin rule that carries the
   severity. The visual language is the Swedish cash book's.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

html {
  /* Palette */
  --bf-paper:  #FAFAF7;   /* paper — white with a hint of warmth, not cream */
  --bf-ink:    #1B2A41;   /* ink — blue-black, never pure black */
  --bf-ink-2:  #52607A;   /* ink, thinned — secondary text */
  --bf-green:  #3E6B4F;   /* ledger green — accent, "the books add up" */
  --bf-red:    #B3402A;   /* margin red — error */
  --bf-ochre:  #C7862B;   /* ochre — warning */
  --bf-line:   #E4E2D8;   /* ruled paper */
  --bf-line-2: #EFEEE6;   /* fainter rule */

  /* Lumo mapped onto the palette */
  --lumo-base-color: var(--bf-paper);
  --lumo-body-text-color: var(--bf-ink);
  --lumo-secondary-text-color: var(--bf-ink-2);
  --lumo-primary-color: var(--bf-green);
  --lumo-primary-text-color: var(--bf-green);
  --lumo-primary-color-50pct: rgba(62, 107, 79, 0.5);
  --lumo-primary-color-10pct: rgba(62, 107, 79, 0.1);
  --lumo-error-color: var(--bf-red);
  --lumo-font-family: 'IBM Plex Sans', system-ui, sans-serif;
  --lumo-border-radius-m: 4px;
  --lumo-border-radius-l: 6px;

  background: var(--bf-paper);
}

/* --- The page ------------------------------------------------------------ */

.page {
  max-width: 46rem;
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 4rem) 1.25rem 6rem;
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  color: var(--bf-ink);
}

.masthead { margin-bottom: 2.5rem; }

.wordmark {
  font-size: clamp(2rem, 6vw, 2.75rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--bf-ink);
}

/* The wordmark's full stop in ledger green — a small, stubborn detail */
.wordmark::after {
  content: '.';
  color: var(--bf-green);
}

.tagline {
  margin: 0.5rem 0 0;
  font-size: 1.05rem;
  color: var(--bf-ink-2);
}

/* --- The drop zone ------------------------------------------------------- */

.dropzone {
  border: 1.5px dashed var(--bf-ink-2);
  border-radius: 6px;
  background: transparent;
  padding: 0.75rem;
  transition: border-color 120ms ease, background 120ms ease;
}
.dropzone:hover { border-color: var(--bf-green); }
.dropzone[dragover] {
  border-color: var(--bf-green);
  background: rgba(62, 107, 79, 0.06);
}

.footnote {
  font-size: 0.85rem;
  color: var(--bf-ink-2);
  margin-top: 0.5rem;
}

/* --- The ledger page: the report as a page from the books ---------------- */

.ledger-page {
  margin-top: 2.5rem;
  background: #fff;
  border: 1px solid var(--bf-line);
  border-radius: 6px;
  /* Ruled paper — discreet, a memory rather than a stage set */
  background-image: repeating-linear-gradient(
      to bottom, transparent 0, transparent 31px, var(--bf-line-2) 31px, var(--bf-line-2) 32px);
  overflow: hidden;
}

.ledger-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.5rem;
  align-items: baseline;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--bf-line);
}

.company { font-weight: 600; font-size: 1.05rem; }

.figure {
  font-family: 'IBM Plex Mono', monospace;
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  color: var(--bf-ink-2);
}

/* --- Summary badges ------------------------------------------------------ */

.summary {
  display: flex;
  gap: 0.6rem;
  padding: 1rem 1.5rem 0.25rem;
}

.badge {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.2rem 0.6rem;
  border-radius: 3px;
  border: 1px solid;
}
.badge--error   { color: var(--bf-red);    border-color: var(--bf-red);   background: rgba(179, 64, 42, 0.07); }
.badge--warning { color: var(--bf-ochre);  border-color: var(--bf-ochre); background: rgba(199, 134, 43, 0.08); }
.badge--info    { color: var(--bf-ink-2);  border-color: var(--bf-line);  background: #fff; }

/* --- The finding row: a ledger line with a margin rule ------------------- */
/* The signature: severity IS the cash book's red margin.                  */

.finding {
  position: relative;
  margin: 1.1rem 1.5rem;
  padding: 0.9rem 1.1rem 0.9rem 1.35rem;
  background: #fff;
  border: 1px solid var(--bf-line);
  border-radius: 4px;
}
.finding::before {
  content: '';
  position: absolute;
  inset: -1px auto -1px -1px;
  width: 4px;
  border-radius: 4px 0 0 4px;
}
.finding--error::before   { background: var(--bf-red); }
.finding--warning::before { background: var(--bf-ochre); }
.finding--info::before    { background: var(--bf-ink-2); }

.finding-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.finding h2 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}

.rule-code {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  color: var(--bf-ink-2);
  white-space: nowrap;
  border: 1px solid var(--bf-line);
  border-radius: 3px;
  padding: 0.1rem 0.4rem;
  background: var(--bf-paper);
}

.explanation {
  margin: 0.6rem 0 0;
  line-height: 1.55;
  font-size: 0.95rem;
}

.action {
  margin: 0.6rem 0 0;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--bf-line);
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--bf-green);
}
.action::before {
  content: 'Förslag — ';
  font-weight: 600;
}

/* --- All clear ----------------------------------------------------------- */

.all-clear {
  padding: 2.25rem 1.5rem 2.5rem;
  text-align: center;
}
.all-clear h2 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--bf-green);
}
.all-clear p { margin: 0.4rem 0 0; color: var(--bf-ink-2); }

/* --- Accessibility ------------------------------------------------------- */

:focus-visible { outline: 2px solid var(--bf-green); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* --- What we checked: the working out, folded away ------------------------ */
/* Quieter than a finding on purpose — this is the audit trail, not the news. */

.checked-panel {
  margin: 1.1rem 1.5rem 1.5rem;
  border-top: 1px solid var(--bf-line);
  padding-top: 0.9rem;
  background: transparent;
}
.checked-panel::part(summary) {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--bf-ink-2);
  padding: 0.2rem 0;
}
.checked-panel::part(content) { padding: 0; }

.checked-intro {
  margin: 0.4rem 0 1.1rem;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--bf-ink-2);
  max-width: 34rem;
}

/* Each check keeps the margin line, thinner and in ink — it belongs to the
   same form language as a finding without competing with one. */
.checked-rule {
  border-left: 2px solid var(--bf-line);
  padding: 0.1rem 0 0.1rem 0.85rem;
  margin-bottom: 1rem;
}

.checked-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.checked-what {
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--bf-ink);
}

/* A figure per line: label left, value right, leadered by the ruled paper. */
.checked-figure {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.82rem;
  padding: 0.1rem 0;
}
.checked-label {
  color: var(--bf-ink-2);
  white-space: nowrap;
}
.checked-value {
  font-family: 'IBM Plex Mono', monospace;
  font-variant-numeric: tabular-nums;
  color: var(--bf-ink);
  margin-left: auto;
  text-align: right;
}
