* { box-sizing: border-box; }
:root {
  --ink: #193247; --muted: #576b7d; --line: #dae4ed; --teal: #174f85;
  --light: #eef5fb; --panel: #fff; --shadow: 0 4px 20px rgba(12, 51, 55, .045);
  color: var(--ink); background: #f4f7fa;
  font-family: var(--brand-font);
  font-size: 16px; line-height: 1.6; -webkit-text-size-adjust: 100%;
}
body { margin: 0; min-height: 100vh; }
a { color: var(--teal); text-decoration: none; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid #307fba; outline-offset: 3px;
}
.masthead { background: white; border-bottom: 1px solid var(--line); }
.masthead-inner { max-width: 49rem; min-height: 4rem; margin: auto; padding: .55rem 1.5rem; display: flex; align-items: center; justify-content: space-between; gap: .8rem; }
.brand { display: inline-flex; align-items: center; gap: .65rem; color: var(--ink); font-weight: 750; letter-spacing: .035em; }
.header-link { padding: .45rem .8rem; font-size: .91rem; border: 1px solid var(--line); border-radius: .55rem; font-weight: 600; }
.shell { width: min(100%, 49rem); margin: auto; padding: 2.1rem 1.5rem calc(2rem + env(safe-area-inset-bottom)); }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.85rem, 4.3vw, 2.5rem); line-height: 1.24; letter-spacing: -.02em; }
h2 { font-size: 1.22rem; line-height: 1.45; letter-spacing: 0; }
h3 { font-size: 1rem; margin: 1.25rem 0 .55rem; }
.page-heading { margin-bottom: 1.45rem; }
.page-heading p, .signin p, .section-hint, .empty-state p { color: var(--muted); margin-top: .42rem; }
.panel, .record { background: var(--panel); border: 1px solid var(--line); border-radius: .95rem; box-shadow: var(--shadow); }
.panel { margin: 0 0 1rem; padding: 1.5rem; }
.panel > h2:first-child, .section-heading h2 { display: flex; align-items: baseline; gap: .5rem; }
.button { display: inline-flex; align-items: center; justify-content: center; width: 100%; min-height: 2.95rem; padding: .65rem 1.15rem; font: inherit; font-weight: 650; border: 1px solid transparent; border-radius: .65rem; text-align: center; cursor: pointer; }
.primary { color: #fff; background: var(--teal); }
.primary:hover { background: #103f6b; }
.quiet { color: var(--teal); border-color: #b9cfcd; background: white; }
.quiet:hover, .header-link:hover, .file-picker:hover { background: var(--light); }
.button:disabled { cursor: wait; opacity: .72; }
.entry-shell { max-width: 41rem; }
.welcome { position: relative; overflow: hidden; isolation: isolate; display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: 2rem; min-height: 12rem; margin: .25rem 0 1rem; color: white; border-radius: 1rem; background: linear-gradient(125deg, #153958, #205b91); }
.welcome::after { content: ""; position: absolute; z-index: -1; width: 15rem; height: 15rem; border: 1px solid #ffffff29; border-radius: 50%; right: -2rem; bottom: -11rem; box-shadow: 0 0 0 1.5rem #ffffff09, 0 0 0 3rem #ffffff09; }
.welcome-copy { max-width: 23rem; }
.welcome p { margin: .75rem 0 0; color: #e4f0fa; line-height: 1.8; }
.paper-art { flex: 0 0 5.7rem; height: 6rem; position: relative; }
.paper-front, .paper-back { width: 3.85rem; height: 4.8rem; position: absolute; border-radius: .5rem; }
.paper-back { top: .25rem; left: .25rem; background: #80bab1; transform: rotate(-11deg); }
.paper-front { top: .4rem; left: 1rem; background: #f2fff8; transform: rotate(7deg); padding: 1.15rem .65rem 0; box-shadow: 0 5px 12px #07333933; }
.paper-front i { display: block; opacity: .85; height: 3px; background: #7db0a5; margin-bottom: .4rem; border-radius: 2px; }
.paper-front i:last-child { width: 65%; }
.art-check { position: absolute; right: .1rem; bottom: .3rem; display: grid; place-items: center; width: 1.9rem; height: 1.9rem; color: #195952; background: #b1ebc5; border-radius: 50%; font-weight: bold; }
.signin p { margin-bottom: 1.2rem; }
.demo-form { margin-top: .6rem; }
.field { margin-top: 1.15rem; }
.field label { display: inline-flex; gap: .55rem; align-items: center; margin: 0 0 .4rem; font-weight: 650; }
.required, .optional { font-size: .82rem; font-weight: 480; }
.required { color: #8d4b3d; }
.optional, .hint, .section-hint, time, .record-foot { color: var(--muted); }
.hint, .section-hint, .submit-hint { font-size: .92rem; }
.hint { margin: 0 0 .45rem; }
.field input, .field textarea, .field select { display: block; width: 100%; border: 1px solid #c5d2df; background: #fff; color: var(--ink); border-radius: .55rem; min-height: 2.85rem; padding: .6rem .75rem; font: inherit; }
.field textarea { min-height: 7rem; max-height: 24rem; height: 7.5rem; resize: vertical; }
.field select { appearance: none; padding-right: 2.4rem; background-image: linear-gradient(45deg,transparent 50%,#4c706e 50%),linear-gradient(135deg,#4c706e 50%,transparent 50%); background-position: calc(100% - 19px) 51%,calc(100% - 14px) 51%; background-size: 5px 5px; background-repeat: no-repeat; }
.upload-tools { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: .55rem; margin-top: .9rem; }
.file-picker { position: relative; min-height: 4.2rem; overflow: hidden; display: flex; flex-direction: column; gap: .35rem; align-items: center; justify-content: center; border: 1px dashed #9ab3cb; border-radius: .65rem; font-size: .93rem; color: var(--teal); background: #f6f9fd; cursor: pointer; }
.file-picker input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.file-picker:focus-within { outline: 3px solid #307fba; outline-offset: 2px; }
.upload-icon { width: 1.15rem; height: .9rem; border: 1.7px solid currentColor; border-radius: 3px; position: relative; }
.camera-icon::before, .camera-icon::after, .photo-icon::before, .photo-icon::after, .file-icon::after { position: absolute; content: ""; }
.camera-icon::before { height: 3px; width: 8px; top: -4px; left: 3px; background: currentColor; border-radius: 3px 3px 0 0; }
.camera-icon::after { border: 1.4px solid currentColor; width: 5px; height: 5px; border-radius: 50%; left: 4px; top: 2px; }
.photo-icon { overflow: hidden; }
.photo-icon::before { width: 11px; height: 11px; border: 1.5px solid currentColor; transform: rotate(45deg); left: 6px; top: 6px; }
.photo-icon::after { width: 3px; height: 3px; border-radius: 50%; background: currentColor; left: 3px; top: 2px; }
.file-icon { width: .85rem; height: 1rem; }
.capture-panel { width: min(94vw, 28rem); max-height: 94vh; overflow: auto; border: 0; border-radius: 1rem; padding: 1rem; color: var(--ink); }
.capture-panel:not([open]) { display: none; }
.capture-panel::backdrop { background: rgba(13, 25, 37, .76); }
.capture-panel h2 { margin: 0 0 .5rem; }
.capture-panel video { display: block; width: 100%; height: min(52vh, 24rem); object-fit: contain; background: #111; border-radius: .6rem; }
.capture-panel .shutter { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.capture-panel .shutter.recording { background: #aa2432; color: white; }
.capture-actions { display: flex; justify-content: space-between; margin-top: .6rem; }
.capture-actions button { padding: .6rem; font: inherit; border: 0; color: var(--teal); background: transparent; }
.file-icon::after { top: 4px; left: 2px; right: 2px; border-top: 1px solid currentColor; height: 3px; border-bottom: 1px solid currentColor; }
.selected-row { display: flex; gap: 1rem; align-items: center; justify-content: space-between; padding: .45rem 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.remove-file { flex: 0 0 auto; padding: .4rem .2rem; border: 0; background: transparent; color: #80483d; font: inherit; font-size: .88rem; cursor: pointer; }
.form-actions { margin-top: 1rem; }
.submit-hint { color: var(--muted); margin-top: .35rem; text-align: center; }
.alert, .messages { margin: 0 0 1rem; padding: .9rem 1rem; border-radius: .6rem; }
.alert { color: #793d31; background: #fff1e9; }
.messages { color: #165947; background: #e0f4e9; }
.alert p { margin: .2rem 0 0; }
.errorlist { list-style: none; padding: 0; margin: .3rem 0 0; color: #954938; font-size: .92rem; }
.field-error input, .field-error textarea, .field-error select { border-color: #a65744; }
.heading-row, .section-heading, .record-meta, .record-foot, .timeline-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; }
.heading-row { align-items: flex-start; }
.compact { width: auto; min-height: 2.65rem; white-space: nowrap; }
.record { display: block; padding: 1.1rem 1.3rem; margin-bottom: .65rem; color: var(--ink); }
.record:hover { border-color: #8bb7b2; }
.number, time { font-variant-numeric: tabular-nums; }
.number { font-family: "IBM Plex Mono",Consolas,monospace; font-size: .93rem; }
.badge, .attachment-kind { display: inline-block; white-space: nowrap; background: #e1f1ed; color: #175c51; font-size: .83rem; border-radius: .4rem; padding: .12rem .55rem; font-weight: 620; }
.record-description { margin: .75rem 0; overflow-wrap: anywhere; }
.record-foot, .timeline-head time { font-size: .88rem; }
.empty-state { padding: 2.1rem 1rem; text-align: center; }
.empty-state > h2 { justify-content: center; }
.empty-state .button { width: auto; margin-top: 1rem; }
.empty-sheet { display: block; margin: 0 auto .85rem; width: 2rem; height: 2.5rem; border-radius: .35rem; border: 2px solid #83a9a3; background: repeating-linear-gradient(0deg, transparent 0 5px, #b4d2cc 5px 7px) center/50% 45% no-repeat; }
.timeline { list-style: none; margin: 1.2rem 0 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 1.15rem 1.35rem; margin-left: .3rem; border-left: 2px solid #d3e6e1; }
.timeline li:last-child { padding-bottom: 0; border-color: transparent; }
.timeline li::before { content: ""; position: absolute; width: .57rem; height: .57rem; background: #87aca4; border: 3px solid #fff; box-sizing: content-box; border-radius: 50%; top: .35rem; left: -.54rem; }
.timeline li:first-child::before { background: var(--teal); }
.timeline-head { align-items: baseline; flex-wrap: wrap; gap: .1rem .7rem; }
.prose, .facts dd, .attachment-list a { overflow-wrap: anywhere; }
.timeline .prose { margin-top: .3rem; }
.original { padding: .85rem 0; border-bottom: 1px solid var(--line); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .55rem 1.2rem; margin: 1rem 0 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.attachment-list { list-style: none; padding: 0; margin: 0; }
.attachment-list a { display: flex; align-items: baseline; gap: .55rem; padding: .5rem 0; }
.attachment-kind { flex: 0 0 auto; background: #eff3f3; color: #486266; }
@media (max-width: 520px) {
  .masthead-inner { padding-inline: 1rem; min-height: 3.6rem; }
  .shell { padding: 1.4rem .9rem calc(1.4rem + env(safe-area-inset-bottom)); }
  .panel, .record { padding: 1.1rem; }
  .welcome { padding: 1.35rem; min-height: 10rem; }
  .paper-art { transform: scale(.85); transform-origin: right center; flex-basis: 4.2rem; }
  .welcome-copy { max-width: 70%; }
  .entry-shell .signin { padding: 1.25rem; }
  .record-foot { flex-wrap: wrap; gap: .15rem .7rem; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
.stacked { margin-top: .6rem; }
