/* Onsite: a phone-first look in the GOV.UK Design System style (as the EPR
   app): bold labels, hints under them, dark borders, a yellow focus ring.
   Self-contained (no Bootstrap), so it's all kept for offline use. */

:root {
    --blue: #00377d;
    --text: #0b0c0c;
    --secondary: #505a5f;
    --border: #0b0c0c;
    --light: #f3f2f1;
    --white: #ffffff;
    --focus: #ffdd00;
    --red: #d4351c;
    --green: #00703c;
    --orange: #b54700;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: #fff;
    color: var(--text);
    font: 19px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    -webkit-text-size-adjust: 100%;
}

a { color: #1d70b8; }
a:focus, button:focus, input:focus, select:focus, textarea:focus, .card:focus {
    outline: 3px solid var(--focus);
    outline-offset: 0;
    box-shadow: inset 0 0 0 2px var(--text);
}

.bar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
    background: var(--blue);
    color: #fff;
}
.bar .brand { color: var(--white); font-weight: 700; text-decoration: none; font-size: 22px; }
.net { font-size: 15px; padding: 2px 10px; border-radius: 12px; background: rgba(255, 255, 255, .15); }
.net.off { background: var(--orange); }

.page { padding: 16px 16px calc(env(safe-area-inset-bottom) + 40px); max-width: 720px; margin: 0 auto; }
.page.narrow { max-width: 460px; }

h1 { font-size: 30px; line-height: 1.15; margin: 8px 0 12px; color: var(--blue); }
h2 { font-size: 23px; margin: 28px 0 10px; color: var(--blue); }
h3 { font-size: 20px; margin: 1rem 0 6px; background: var(--green); color: var(--white); padding: 1rem; }
.lead { font-size: 21px; margin-top: 0; }
.muted, .hint, .small { color: var(--secondary); }
.small { font-size: 16px; }
.back { display: inline-block; margin: 4px 0 8px; font-size: 17px; }
.muted { font-size: 0.8rem; font-style: italic; }

.notice {
    border-left: 6px solid var(--blue);
    background: var(--light);
    padding: 10px 14px;
    margin: 0 0 12px;
}
.notice.error { border-color: var(--red); }
.notice.ok { border-color: var(--green); }
.notice.subtle { font-size: 16px; }
#banner { padding: 0 16px; max-width: 720px; margin: 12px auto 0; }
#banner:empty { display: none; }

.syncline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 16px; color: var(--secondary); margin-bottom: 8px; }
.syncline .btn { margin-left: auto; }

.cards { list-style: none; padding: 0; margin: 0; }
.cards li { margin-bottom: 10px; }
.cards li a { background: var(--light); }
.cards li a:hover { background: var(--focus); }
.card {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 14px;
    border: 2px solid var(--border);
    color: var(--text);
    text-decoration: none;
    background: var(--white);
}
.card .status { align-self: flex-start; }

.badge { display: inline-block; font-size: 15px; font-weight: 700; padding: 1px 8px; border-radius: 3px; background: var(--light); color: var(--text); float: right; }
.badge.draft { background: #fff7bf; }
.badge.waiting { background: #fcd6c3; }
.badge.sent { background: #cce2d8; color: #005a30; }
.badge.failed { background: #f4cdc6; color: #942514; }

.site { border-top: 2px solid var(--light); padding-top: 6px; }
.kits { list-style: none; padding: 0; margin: 0; }
.kits li { display: flex; flex-direction: column; padding: 8px 0; border-bottom: 1px solid #b1b4b6; }
.tag { align-self: flex-start; font-size: 14px; font-weight: 700; background: var(--green); color: var(--white); padding: 3px 6px; margin: 2px 0; }

.site h3 { background: var(--secondary); color: var(--white); }

/* Buttons */
.btn {
    display: inline-block;
    font: inherit;
    font-weight: 600;
    padding: 10px 16px;
    border: 0;
    border-radius: 0;
    box-shadow: 0 2px 0 #002d18;
    background: var(--green);
    color: var(--white);
    cursor: pointer;
    text-decoration: none;
    -webkit-appearance: none;
}
.btn.secondary { background: var(--light); color: var(--text); box-shadow: 0 2px 0 #929191; }
.btn.warning { background: var(--red); box-shadow: 0 2px 0 #55150b; }
.btn.small { font-size: 16px; padding: 6px 12px; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .5; cursor: default; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0; }

/* Form fields */
.field { margin: 0 0 22px; }
.field > label, .field > .label { display: block; font-weight: 700; margin-bottom: 2px; }
.field .hint { display: block; font-size: 17px; margin-bottom: 6px; }
.field .req { display: inline-block; font-size: 14px; font-weight: 700; background: var(--light); padding: 0 6px; margin-left: 6px; vertical-align: middle; }
.field.has-error { border-left: 5px solid var(--red); padding-left: 12px; }
.field .error-text { display: block; color: var(--red); font-weight: 700; margin-bottom: 4px; }
input[type=text], input[type=number], input[type=email], input[type=date], input[type=time], input[type=datetime-local], select, textarea {
    width: 100%;
    font: inherit;
    padding: 8px;
    border: 2px solid var(--border);
    border-radius: 0;
    background: #fff;
    color: var(--text);
    -webkit-appearance: none;
}
select { background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M0 0l6 8 6-8z' fill='%230b0c0c'/%3E%3C/svg%3E") no-repeat right 12px center; padding-right: 32px; }
textarea { min-height: 110px; }
.choices { display: flex; flex-direction: column; gap: 8px; }
.choice { display: flex; align-items: center; gap: 10px; padding: 4px 0; font-weight: 400; }
.choice input { width: 32px; height: 32px; margin: 0; flex: 0 0 auto; accent-color: var(--text); }
fieldset.group { border: 0; padding: 0; margin: 0 0 8px; }
fieldset.group > legend { font-size: 23px; font-weight: 700; padding: 0; margin: 24px 0 10px; }
.info { background: var(--light); padding: 10px 14px; margin-bottom: 18px; }
.divider { border: 0; border-top: 2px solid #b1b4b6; margin: 24px 0; }
.repeat { border: 2px solid var(--light); padding: 10px 12px; margin-bottom: 16px; }
.repeat > h3 { margin-top: 0; }

/* Matrix (a row per item: e.g. each kit) */
.matrix { width: 100%; border-collapse: collapse; font-size: 17px; }
.matrix th, .matrix td { border-bottom: 1px solid #b1b4b6; padding: 6px 4px; text-align: left; vertical-align: top; }
.matrix input[type=text], .matrix select { font-size: 16px; padding: 4px; }
.matrix-wrap { overflow-x: auto; }

/* Photos */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin: 8px 0; }
.photo { position: relative; }
.photo img { width: 100%; aspect-ratio: 1; object-fit: cover; border: 2px solid var(--border); display: block; }
.photo button { position: absolute; top: 4px; right: 4px; font-size: 14px; padding: 2px 8px; }
.photo input { margin-top: 4px; font-size: 14px; padding: 4px; }

/* Signature */
.sigpad { width: 100%; max-width: 600px; aspect-ratio: 2 / 1; border: 2px solid var(--border); touch-action: none; background: #fff; display: block; }

.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 10px 0; border-bottom: 1px solid #b1b4b6; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.list li .grow { flex: 1 1 60%; }
