/* Adolvas: plain, warm, high contrast. Phone first. System fonts only. */
:root {
  --ink: #1f2420;
  --ink-soft: #46504a;
  --paper: #eef0e8;
  --card: #fffffb;
  --line: #c9cfc0;
  --falu: #a3221b;
  --falu-dark: #7e1812;
  --moss: #3d5a3a;
  --moss-bg: #dfeadb;
  --error-bg: #f8dedb;
  --focus: #1b5fb4;
  --tap: 3.5rem; /* 56px, above the 48px minimum */
  --radius: 14px;
}

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 112.5%; -webkit-text-size-adjust: 100%; } /* 18px base */

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
}

h1, h2 { line-height: 1.2; margin: 0 0 0.6rem; letter-spacing: -0.01em; }
h1 { font-size: 1.9rem; font-weight: 800; }
h2 { font-size: 1.35rem; font-weight: 700; }
p { margin: 0 0 0.8rem; max-width: 36rem; }

a { color: var(--falu-dark); text-underline-offset: 0.2em; }

:focus-visible { outline: 4px solid var(--focus); outline-offset: 3px; }

/* Header: a falu-red band, like the stuga wall. */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.75rem;
  padding: 0 1rem;
  background: var(--falu);
  color: #fff;
  border-bottom: 5px solid var(--ink);
}
.brand {
  color: #fff;
  font-size: 1.5rem;
  font-weight: 800;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  min-height: 3rem;
}
.who { font-size: 1.05rem; font-weight: 600; }

.page {
  max-width: 40rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

/* Card */
.card {
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 0 0 1rem;
}
.card > :last-child { margin-bottom: 0; }

/* Buttons */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--tap);
  padding: 0.6rem 1.25rem;
  margin: 0 0 0.75rem;
  border: 3px solid var(--falu-dark);
  border-radius: var(--radius);
  background: var(--falu);
  color: #fff;
  font: inherit;
  font-size: 1.2rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.btn:active { background: var(--falu-dark); }
.btn-quiet {
  background: var(--card);
  color: var(--ink);
  border-color: var(--ink);
}
.btn-quiet:active { background: var(--line); }

/* Fields */
.field { margin: 0 0 1rem; }
.field label, .choices legend {
  display: block;
  margin: 0 0 0.35rem;
  padding: 0;
  font-size: 1.1rem;
  font-weight: 700;
}
.field input {
  display: block;
  width: 100%;
  min-height: var(--tap);
  padding: 0.5rem 0.9rem;
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 1.3rem;
}
.field input.amount { text-align: right; font-variant-numeric: tabular-nums; }
.field-error { margin: 0.35rem 0 0; color: var(--falu-dark); font-weight: 700; }

/* Choice buttons: radio group drawn as big buttons */
.choices { border: 0; margin: 0 0 1rem; padding: 0; min-width: 0; }
.choice-row { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.choice { position: relative; flex: 1 1 8rem; }
.choice input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.choice span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 0.5rem 1rem;
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  background: var(--card);
  font-size: 1.2rem;
  font-weight: 700;
  text-align: center;
}
.choice input:checked + span {
  background: var(--moss);
  border-color: var(--moss);
  color: #fff;
}
.choice input:checked + span::before { content: "\2713\00a0"; }
.choice input:focus-visible + span { outline: 4px solid var(--focus); outline-offset: 3px; }

/* Flash */
.flash {
  margin: 0 0 1rem;
  padding: 0.9rem 1rem;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  font-weight: 700;
}
.flash-ok { background: var(--moss-bg); }
.flash-error { background: var(--error-bg); border-color: var(--falu-dark); }

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

.hint { margin: 0.35rem 0 0; font-size: 1.125rem; color: var(--muted); }

:root { --muted: #4a544e; }
.struck { color: var(--muted); }
.share-item { border-top: 2px solid var(--line); padding-top: 0.75rem; }

/* Documents and files */
.field input[type="file"] { padding: 0.9rem; min-height: 3.5rem; }
.doc-link { display: block; color: inherit; text-decoration: none; font-weight: 700; font-size: 1.25rem; }
.file-row { display: flex; align-items: center; gap: 1rem; color: inherit; text-decoration: none; min-height: 4rem; }
.file-thumb { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; flex: none; }
.file-icon {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  flex: none;
  border-radius: 8px;
  background: var(--line);
  font-weight: 700;
  font-size: 1.25rem;
}

/* Kassabok */
.field select, .field textarea {
  display: block;
  width: 100%;
  min-height: var(--tap);
  padding: 0.5rem 0.9rem;
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 1.3rem;
}
.annat-fields[hidden], .slag-wrap[hidden], .field[hidden] { display: none; }
.post-row { display: block; color: inherit; text-decoration: none; }
.post-meta, .post-receipt { display: block; color: var(--ink-soft); font-size: 1rem; }
.post-main { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; margin: 0.15rem 0; }
.post-text { font-weight: 700; font-size: 1.25rem; min-width: 0; overflow-wrap: anywhere; }
.post-amount { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.25rem; white-space: nowrap; }
.post-row.struck { opacity: 0.8; border-style: dashed; }
.post-row.struck .post-receipt { color: var(--falu-dark); font-weight: 700; }
.line { margin: 0 0 0.6rem; }
.history-item { border-top: 2px solid var(--line); padding-top: 0.6rem; }
.history-item ul { margin: 0 0 0.6rem; padding-left: 1.2rem; }
.file-block { margin: 0 0 1rem; }

/* Kassabok import */
.import-list { list-style: none; margin: 0; padding: 0; }
.import-item { display: block; border-top: 2px solid var(--line); padding: 0.6rem 0; overflow-wrap: anywhere; }
.import-item:first-child { border-top: 0; }

/* Behöver åtgärdas */
.todo-list { list-style: none; margin: 0 0 1rem; padding: 0; }
.todo-list li { border-bottom: 1px solid var(--line); }
.todo-list li:last-child { border-bottom: 0; }
.todo-list a { display: block; padding: 0.85rem 0; color: inherit; font-size: 1.1rem; }
.month-row { border-top: 1px solid var(--line); padding-top: 0.5rem; margin-top: 0.5rem; }

.table-scroll { overflow-x: auto; }
.table-scroll table { border-collapse: collapse; width: 100%; }
.table-scroll th, .table-scroll td { text-align: left; padding: 0.3rem 0.6rem; border-bottom: 1px solid #ccc; white-space: nowrap; }
