:root {
    --navy: #0D1C2B;
    --green: #39A935;
    --forest: #047B35;
    --line: #dce5e0;
    --muted: #56645f;
    --surface: #f4f7f5;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--navy);
    background: var(--surface);
    font-synthesis: none;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select { font: inherit; }
button { cursor: pointer; border: 1px solid transparent; border-radius: 9px; padding: 12px 18px; min-height: 44px; background: var(--forest); color: white; font-weight: 650; }
button:hover { filter: brightness(.95); }
button:disabled { cursor: not-allowed; opacity: .55; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #8cce89; outline-offset: 3px; }
input, select { border: 1px solid #b8c9bf; border-radius: 8px; background: white; padding: 12px; width: 100%; min-height: 46px; color: var(--navy); }
label { display: flex; flex-direction: column; gap: 8px; font-size: 14px; font-weight: 600; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(26px, 3vw, 36px); letter-spacing: -.9px; margin-bottom: 10px; }
h2 { font-size: 22px; letter-spacing: -.4px; margin-bottom: 8px; }
p { line-height: 1.55; }
small, .small { font-size: 12px; line-height: 1.5; }
.muted { color: var(--muted); }
.eyebrow { font-size: 11px; font-weight: 750; letter-spacing: 1.6px; display: block; margin-bottom: 12px; color: var(--forest); }
.topbar { background: var(--navy); color: white; display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 20px max(24px, calc((100vw - 1180px) / 2)); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand strong { display: block; font-size: 17px; }
.brand small { display: block; font-size: 9px; letter-spacing: 2px; margin-top: 6px; color: #b9c8c2; }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border: 1px solid #64786a; border-radius: 12px; font-size: 26px; font-weight: 800; }
.brand-mark span { color: var(--green); font-size: 30px; margin-left: -2px; }
.user-area { display: flex; align-items: center; gap: 18px; font-size: 13px; }
.ghost { background: transparent; color: white; border-color: #52616c; }
main { max-width: 1230px; margin: auto; padding: 32px 24px 16px; }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 14px; }
.badge { border-radius: 24px; padding: 9px 14px; background: #e7f3e9; color: #125c2a; font-size: 12px; white-space: nowrap; }
.badge.warning { background: #fff2d4; color: #785013; }
.panel { background: white; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 3px 8px #0d1c2b03; }
.toolbar { padding: 18px 22px; display: flex; align-items: end; gap: 18px; }
.toolbar label { flex: 1; }
.secondary { background: white; color: var(--forest); border-color: var(--line); }
.danger { background: #fff; color: #a12727; border-color: #e7caca; }
.text-button { color: var(--forest); background: transparent; padding: 8px 10px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 22px 0 12px; }
.stat { border: 1px solid var(--line); background: white; padding: 20px 24px; border-radius: 12px; }
.stat:first-child { border-top: 3px solid var(--green); }
.stat > span { color: var(--muted); font-size: 13px; }
.stat strong { display: block; font-size: 40px; font-weight: 650; letter-spacing: -1.6px; margin: 7px 0; }
.stat small { color: var(--muted); }
.sync-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--muted); }
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin: 16px 0 22px; overflow-x: auto; }
.tabs button { border-radius: 0; background: transparent; color: var(--muted); border-bottom: 3px solid transparent; padding: 14px 2px; white-space: nowrap; }
.tabs .active { color: var(--forest); border-bottom-color: var(--forest); }
.content-panel { padding: 26px; min-height: 280px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.section-heading p { margin-bottom: 0; }
.search-label { margin-bottom: 12px; }
.search-label input { font-size: 18px; padding: 16px; background: #f9fbfa; }
.results { margin-top: 12px; }
.child-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); padding: 17px 0; }
.child-row strong { display: block; font-size: 15px; margin-bottom: 6px; }
.child-row small { color: var(--muted); }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.empty { text-align: center; padding: 45px 18px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: end; margin: 20px 0; }
.notice { padding: 16px; border-radius: 8px; background: #f0f7ee; margin: 18px 0; font-size: 14px; line-height: 1.5; }
.notice.warning { background: #fff4df; }
.date-row { display: grid; grid-template-columns: 1fr 170px 90px; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.inline-check { display: flex; flex-direction: row; align-items: center; font-weight: 400; }
.inline-check input { width: auto; min-height: auto; }
.duplicate { padding: 14px; background: #fff9ed; margin: 10px 0; border-radius: 8px; }
.preview-table { max-height: 300px; overflow: auto; margin: 16px 0; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: var(--surface); position: sticky; top: 0; }
footer { padding: 28px 0 12px; text-align: center; font-size: 11px; color: var(--muted); }
footer span { padding: 0 8px; }
dialog { border: 1px solid var(--line); border-radius: 16px; width: min(650px, calc(100% - 28px)); padding: 28px; color: var(--navy); max-height: 90dvh; }
dialog::backdrop { background: #0d1c2b80; }
dialog label { margin-bottom: 12px; }
.message-dialog { width: min(460px, calc(100% - 28px)); padding: 0; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 60px #0d1c2b40; }
.message-dialog form { padding: 26px; }
.message-heading { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.message-heading .eyebrow { margin: 0 0 5px; }
.message-heading h2 { margin: 0; }
.message-icon { display: grid; place-items: center; flex: 0 0 42px; width: 42px; height: 42px; border-radius: 50%; background: #e7f3e9; color: var(--forest); font-size: 22px; font-weight: 750; }
.message-icon.warning { background: #fff2d4; color: #785013; }
.message-icon.danger { background: #fae9e7; color: #a12727; }
.message-dialog #message-copy { color: var(--muted); line-height: 1.6; margin: 0 0 22px; overflow-wrap: anywhere; }
.message-dialog .actions { justify-content: end; margin-top: 22px; }
.message-dialog #message-cancel[hidden], .message-dialog #message-input-wrap[hidden] { display: none; }
.message-dialog #message-input-wrap { margin-top: 18px; }
.message-dialog #message-confirm.danger { background: #a12727; color: white; }
.qr-dialog { width: min(440px, calc(100% - 28px)); text-align: center; }
.qr-dialog .section-heading { text-align: left; }
.qr-child-name { font-size: 18px; font-weight: 700; }
.qr-image { display: block; width: min(280px, 100%); aspect-ratio: 1; object-fit: contain; margin: 18px auto; padding: 18px; background: white; border: 1px solid var(--line); }
.qr-actions { justify-content: center; }
.button-link { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 12px 18px; border-radius: 9px; background: var(--forest); color: white; font-weight: 650; text-decoration: none; }
.scanner-dialog { width: min(620px, calc(100% - 24px)); padding: 22px; }
.scanner-dialog .section-heading { margin-bottom: 10px; }
.scanner-frame { width: 100%; aspect-ratio: 4 / 3; overflow: hidden; background: var(--navy); border-radius: 8px; }
.scanner-frame video { width: 100%; height: 100%; object-fit: cover; }
.scanner-status { min-height: 24px; margin: 12px 0; font-weight: 650; }
.scanner-result { padding: 14px; margin: 12px 0; border-left: 4px solid var(--green); background: #e7f3e9; }
.scanner-result.warning { border-color: #a66a13; background: #fff2d4; }
.scanner-result.danger { border-color: #a12727; background: #fae9e7; }
.scanner-result p { margin: 6px 0 0; }
.scanner-result .actions { margin-top: 12px; }
.scanner-actions { justify-content: end; margin-top: 16px; }
@media print {
    body * { visibility: hidden !important; }
    #qr-dialog, #qr-dialog * { visibility: visible !important; }
    #qr-dialog { position: absolute; inset: 0; width: 100%; max-width: none; max-height: none; margin: 0; padding: 18mm; border: 0; box-shadow: none; }
    #qr-dialog [data-close], #qr-dialog .qr-actions, #qr-pending { display: none !important; }
    .qr-image { width: 80mm; padding: 8mm; border: 0; }
}
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--navy); color: white; border-radius: 10px; padding: 16px 24px; box-shadow: 0 6px 22px #0003; max-width: calc(100% - 24px); z-index: 10; }
.login-wrap { min-height: 100dvh; display: grid; grid-template-columns: 1fr 1fr; background: white; }
.login-brand { background: var(--navy); color: white; padding: 12vh 12%; display: flex; flex-direction: column; align-items: start; justify-content: center; }
.login-brand > p { color: #c3d5ca; font-size: 12px; letter-spacing: 1px; margin: 24px 0; }
.login-brand h1 { font-size: clamp(30px, 4vw, 56px); line-height: 1.15; }
.login-panel { width: min(420px, 85%); margin: auto; padding: 28px; border: none; box-shadow: none; }
.login-panel label { margin: 22px 0; }
.login-panel > button { width: 100%; }
#login-error { color: #a12727; font-size: 14px; margin-top: 16px; }
@media (max-width: 740px) {
    .topbar { padding: 16px; flex-wrap: wrap; }
    .user-area { gap: 8px; margin-left: auto; }
    .user-area button { font-size: 12px; padding: 8px 12px; }
    .brand strong { font-size: 14px; }
    .brand small { font-size: 8px; letter-spacing: 1px; }
    .user-area > span { display: none; }
    main { padding: 24px 14px; }
    .page-heading { align-items: start; flex-direction: column; }
    .toolbar { flex-wrap: wrap; padding: 16px; gap: 12px; }
    .toolbar label { flex-basis: 100%; }
    .stats { gap: 8px; }
    .stat { padding: 12px; }
    .stat > span { font-size: 11px; }
    .stat strong { font-size: 30px; }
    .stat small { font-size: 10px; }
    .content-panel { padding: 18px; }
    .section-heading { align-items: start; flex-direction: column; }
    .child-row { align-items: start; }
    .child-row .actions { flex-direction: column; align-items: end; }
    .child-row button { font-size: 12px; padding: 10px; }
    .tabs { gap: 20px; }
    .tabs button { font-size: 13px; }
    .form-grid { grid-template-columns: 1fr; }
    .date-row { grid-template-columns: 1fr 130px; }
    .login-wrap { grid-template-columns: 1fr; }
    .login-brand { padding: 28px; }
    .login-brand h1 { font-size: 30px; }
    .login-brand > p { margin: 12px 0; }
    .login-panel { padding: 30px 0; }
}
