:root {
  --bg: #ffffff; --text: #1f2328; --muted: #59636e; --line: #d1d9e0; --accent: #4f7a28; --accent-text: #ffffff; --error: #b42318;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #1b1d21; --text: #e6e8eb; --muted: #9aa4af; --line: #3a3f46; --accent: #8cc45a; --accent-text: #10210a; --error: #ff8a80; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; } /* also over display: flex/grid below */
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif; }
main { max-width: 720px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.4rem; margin: 0 0 4px; }
h2 { font-size: 1.1rem; margin: 24px 0 8px; }
.note { color: var(--muted); margin: 0; }
.error { color: var(--error); }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 8px 0; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }
.buttons { display: flex; flex-wrap: wrap; gap: 8px; }
/* buttons: green with white bold text (Hannu 6.11.2026): lighter on a light background (#5f9e32, contrast 3.3:1 – about
   as light as white text can go), #4a8a1f in dark mode (a lighter green would glow there) */
:root { --btn: #5f9e32; }
@media (prefers-color-scheme: dark) { :root { --btn: #4a8a1f; } }
.button { display: inline-block; min-height: 44px; padding: 10px 16px; border: 1px solid var(--btn); border-radius: 6px;
  background: var(--btn); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
/* one button style everywhere (Hannu 6.11.2026): "secondary" buttons are filled like Tallenna, not outlines */
.button.secondary { background: var(--btn); color: #fff; border-color: var(--btn); }
input[type=checkbox], input[type=radio] { accent-color: var(--btn); } /* the site's green, not the browser's blue */
#photos { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 12px; }
#photos li { border: 1px solid var(--line); border-radius: 6px; padding: 8px; }
#photos img { display: block; max-width: 100%; max-height: 240px; margin-bottom: 6px; border-radius: 4px; }
#photos p { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 480px) { dl { grid-template-columns: 1fr; } dt { margin-top: 6px; } }

/* ---------- reporting page (phase 1): phone-first, big targets ---------- */
:root { --field: #ffffff; --test-bg: #fdecec; }
@media (prefers-color-scheme: dark) { :root { --field: #24272c; --test-bg: #3a2224; } }
body.test { background: var(--test-bg); } /* test environment, as the apps' pale red */
.report main { max-width: 560px; }
/* top banner: FactoryTraining's layout (logo on a white plate, 34 px; 28 px on a phone) in the apps' green #8cc45a with
   their dark text #0f1a0f (white on this green is hard to read), with the page and language buttons */
.banner { background: #8cc45a; color: #0f1a0f; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 14px 24px; min-height: 68px; }
.banner .logo { display: inline-flex; align-items: center; background: #fff; border-radius: 10px; padding: 6px 12px; flex: none; }
.banner .logo img { height: 34px; width: auto; display: block; }
.banner h1 { margin: 0; font-size: 1.25rem; color: #0f1a0f; }
.banner .sp { flex: 1; }
.nav, .langs { display: flex; gap: 6px; }
.banner .nav button, .banner .langs button { min-width: 44px; min-height: 44px; padding: 10px 16px; border: 0; border-radius: 10px;
  background: rgba(15, 26, 15, 0.12); color: #0f1a0f; font: inherit; cursor: pointer; }
.banner .nav button.on, .banner .langs button.on { background: #fff; color: #0f1a0f; font-weight: 600; }
.risk button { min-width: 44px; min-height: 44px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--field); color: var(--text); font: inherit; cursor: pointer; }
.risk button.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 18px 0; }
.field > label:not(.check) { display: flex; flex-direction: column; gap: 6px; }
.label { font-weight: 600; }
.hint { color: var(--muted); font-size: 0.9rem; }
.value { padding: 4px 0; }
select, input:not([type=checkbox]), textarea { width: 100%; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 6px; background: var(--field); color: var(--text); font: inherit; }
textarea { resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.check input { width: 22px; height: 22px; }
.row { display: flex; align-items: center; gap: 6px; }
.row select:first-child { flex: 2; } .row select { flex: 1; }
.risk { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 8px; }
.riskclass { margin: 0; padding: 0 8px; border-radius: 6px; color: #10210a; font-weight: 600; min-height: 1.5em; }
.err { color: var(--error); font-size: 0.95rem; }
.errors { border: 1px solid var(--error); border-radius: 6px; padding: 8px 12px; color: var(--error); }
.errors p { margin: 4px 0; }
.button:disabled, .button.disabled { opacity: 0.5; pointer-events: none; }
.thumbs { list-style: none; padding: 0; margin: 4px 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.thumbs li { position: relative; }
.thumbs img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; }
.thumbs button { position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; border: 0; border-radius: 50%;
  background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 16px; cursor: pointer; }
.send { width: 100%; min-height: 56px; font-size: 1.1rem; font-weight: 600; }
footer { margin: 32px 0 8px; text-align: center; }
.link { border: 0; background: none; color: var(--muted); text-decoration: underline; font: inherit; cursor: pointer; min-height: 44px; }

/* ---------- observations page (phase 2a): list + report side by side on a desktop, one at a time on a phone ---------- */
.report main.wide { max-width: 980px; }
.obs { display: block; margin-top: 12px; }
/* risk colours of the report IDs: the apps' colours in dark mode, darker shades on white so yellow and light green read */
:root { --risk-1: #4e8a1e; --risk-2: #2f9e44; --risk-3: #a88400; --risk-4: #d06a00; --risk-5: #d11a1a; }
@media (prefers-color-scheme: dark) { :root { --risk-1: #8cc45a; --risk-2: #90ee90; --risk-3: #ffd700; --risk-4: #ffa500; --risk-5: #ff4d4d; } }
.risk-1 { color: var(--risk-1); } .risk-2 { color: var(--risk-2); } .risk-3 { color: var(--risk-3); } .risk-4 { color: var(--risk-4); } .risk-5 { color: var(--risk-5); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters select, .filters input[type=search] { width: auto; flex: 1 1 140px; }
.filters .check { min-height: 36px; }
/* the list: a window of 6 rows that scrolls by itself; the open report is shown under it */
.rows { list-style: none; padding: 0; margin: 8px 0; max-height: calc(6 * 37px + 2px); overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; }
.obs-list { container-type: inline-size; min-width: 0; }
.obsrow { display: grid; grid-template-columns: 9em 6.5em minmax(0, 1fr) 7.5em; gap: 8px; align-items: center;
  width: 100%; min-height: 36px; padding: 4px 8px; border: 0; border-bottom: 1px solid var(--line); background: none;
  color: var(--text); font: inherit; font-size: 0.95rem; text-align: left; cursor: pointer; }
.obsrow:hover { background: var(--field); }
.obsrow > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.obsrow .c-id { font-weight: 700; }
/* the columns follow the list's own width: the handler only when there is room, the area before the status */
.obsrow .c-owner { display: none; }
@container (min-width: 640px) { .obsrow { grid-template-columns: 9em 6.5em minmax(0, 1fr) 7.5em minmax(0, 10em); } .obsrow .c-owner { display: block; } }
@container (max-width: 400px) { .obsrow { grid-template-columns: max-content max-content minmax(0, 1fr); } .obsrow .c-area { display: none; } }
.obsrow.on { background: var(--field); box-shadow: inset 4px 0 0 var(--accent); }
.row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.row-top { display: flex; justify-content: space-between; gap: 8px; }
.muted { color: var(--muted); }
.obs-detail { min-width: 0; margin-top: 20px; scroll-margin-top: 8px; }
.band { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 12px 14px; border-radius: 8px; font-size: 1.1rem; }
.facts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 16px; margin: 4px 0 8px; }
.fact.wide { grid-column: 1 / -1; }
.fact { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.flabel { color: var(--muted); font-size: 0.85rem; }
.report-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; margin-top: 12px; align-items: start; }
.report-cols .handling { margin-top: 0; padding-top: 0; border-top: 0; }
.col-handling .field:first-child { margin-top: 0; }
@media (max-width: 480px) { .facts { grid-template-columns: 1fr; } .fact.empty { display: none; } }
@media (max-width: 900px) { .report-cols { grid-template-columns: 1fr; } .report-cols .handling { padding-top: 8px; border-top: 1px solid var(--line); } }
.block h3 { font-size: 1rem; margin: 14px 0 4px; }
.pre { white-space: pre-wrap; margin: 0; overflow-wrap: anywhere; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.thumb { padding: 0; border: 0; background: none; cursor: zoom-in; width: 100%; }
.pcell { position: relative; }
.pcell .del { position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; border: 0; border-radius: 50%;
  background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 16px; cursor: pointer; }
.block .buttons { margin-top: 8px; }
.toolbar { justify-content: flex-end; margin: 10px 0 0; }
.thumb img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; background: var(--line); }
.handling { margin-top: 16px; padding-top: 8px; border-top: 1px solid var(--line); }
.handling .row select { flex: 1; }
.handling .row { display: flex; gap: 8px; }
.notice { padding: 8px 12px; border-radius: 6px; border: 1px solid var(--accent); }
.notice.bad { border-color: var(--error); color: var(--error); }
.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.85); display: flex; align-items: center; justify-content: center; z-index: 10; cursor: zoom-out; }
.lightbox img { max-width: 96vw; max-height: 96vh; }
.handling textarea { min-height: 4lh; } /* 4 lines to start, then they grow with the text */
.editor { margin-top: 12px; }
@media (max-width: 600px) {
  .banner { padding: 12px 16px; }
  .banner .logo img { height: 28px; }
}
