:root {
  --navy: #12233F;
  --navy-2: #1D3557;
  --paper: #F3EDE0;
  --panel: #FBF8F1;
  --ink: #14202E;
  --muted: #4B5A6B;          /* 6.6:1 on paper */
  --line: #D5CCB8;
  --field: #7A8595;          /* 3.6:1 input border */
  --amber: #E0A100;
  --amber-bg: #FFF1C9;
  --amber-ink: #6A4700;      /* on amber-bg 7:1 */
  --green: #1F7A4D;          /* white on it 5.3:1 */
  --green-bg: #DDF1E4;
  --green-ink: #145A38;
  --error: #A32A1B;

  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --r: 8px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 72px;
  --gutter: clamp(16px, 4vw, 32px);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font); font-size: 1rem; line-height: 1.55; overflow-wrap: break-word; }
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -0.01em; font-weight: 600; }
p { margin: 0 0 var(--s3); }
button, input, textarea { font: inherit; }
:focus-visible { outline: 3px solid var(--navy-2); outline-offset: 2px; }
.top :focus-visible, .banner :focus-visible { outline-color: #fff; }
.wrap { width: 100%; max-width: 1240px; margin-inline: auto; padding-inline: var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: #fff; color: var(--ink); padding: 10px 16px; border-radius: var(--r); }
.skip:focus { left: 8px; }
.ico { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* banner + header */
.banner { background: #FFF1C9; color: #3D2B00; border-bottom: 2px solid var(--amber); }
.banner p { margin: 0; padding: 10px var(--gutter); text-align: center; font-size: .9375rem; }
.top { background: var(--navy); color: #F3EFE4; padding: var(--s5) 0 var(--s4); }
.kicker { font-family: var(--mono); font-size: .8125rem; letter-spacing: .12em; text-transform: uppercase; color: #F2C14E; margin-bottom: var(--s3); }
.top h1 { font-size: clamp(1.75rem, 3.2vw, 2.5rem); max-width: 32ch; margin-bottom: var(--s4); }
.flow { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border-top: 1px solid #38507A; }
.flow li { display: flex; align-items: center; gap: var(--s3); padding: var(--s4) var(--s4) 0 0; position: relative; color: #B8C6DC; }
.flow li:not(:last-child)::after { content: ""; position: absolute; right: 12px; top: calc(var(--s4) + 15px); width: 14px; height: 14px; border-top: 2px solid #56709A; border-right: 2px solid #56709A; transform: rotate(45deg) scale(.7); }
.fn { flex: none; width: 32px; height: 32px; border-radius: 50%; border: 2px solid #56709A; display: grid; place-items: center; font-family: var(--mono); font-weight: 500; }
.ft { font-weight: 600; line-height: 1.25; }
.flow li.done { color: #DCE6F4; }
.flow li.done .fn { background: #2C8A5C; border-color: #2C8A5C; color: #fff; }
.flow li.now { color: #fff; }
.flow li.now .fn { background: #F2C14E; border-color: #F2C14E; color: var(--navy); }
.flow li.now::before { content: ""; position: absolute; left: 0; right: 16px; top: -2px; height: 3px; background: #F2C14E; }

/* layout */
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.02fr); gap: var(--s7); align-items: start; padding-top: var(--s6); }
.left { position: sticky; top: 16px; }
.workspace h2 { font-size: 1.25rem; margin-bottom: var(--s4); }

/* picker */
.picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); margin-bottom: var(--s4); }
.pick { text-align: left; display: flex; flex-direction: column; min-height: 56px; padding: 8px 12px; background: var(--panel); border: 2px solid var(--line); border-radius: var(--r); cursor: pointer; color: var(--ink); transition: border-color .15s ease, background-color .15s ease; }
.pick:hover { border-color: var(--navy-2); }
.pick .pn { font-family: var(--mono); font-size: .8125rem; color: var(--muted); }
.pick .pd { font-weight: 600; line-height: 1.25; font-size: .9375rem; }
.pick[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.pick[aria-pressed="true"] .pn { color: #F2C14E; }

/* photo stage */
.photo { position: relative; border-radius: 14px; overflow: hidden; padding: 8% 8% 12%; background:
  repeating-linear-gradient(45deg, rgba(255,255,255,.025) 0 2px, transparent 2px 6px),
  radial-gradient(120% 90% at 30% 10%, #4A5260 0%, #2B313B 60%, #1B2028 100%); box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
.photo::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(90% 70% at 40% 35%, transparent 55%, rgba(0,0,0,.35) 100%), linear-gradient(120deg, rgba(255,255,255,.07), transparent 40%); }
.photo-cap { position: absolute; left: 16px; bottom: 12px; margin: 0; font-family: var(--mono); font-size: .8125rem; color: #C5D0E0; z-index: 2; }
.slip-wrap { position: relative; width: 100%; max-width: 480px; margin-inline: auto; transform: rotate(var(--rot, -1deg)); filter: drop-shadow(0 14px 18px rgba(0,0,0,.5)) drop-shadow(0 2px 3px rgba(0,0,0,.5)); z-index: 1; }

/* the paper slip. All sizes in cqw so it scales like a photo */
.slip { container-type: inline-size; position: relative; width: 100%; padding: 5.5cqw 5.5cqw 6cqw; color: #2B3A55; overflow: hidden;
  background:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .35 0 0 0 0 .3 0 0 0 0 .2 0 0 0 .16 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>"),
    linear-gradient(172deg, #FCF9F0 0%, #F4EEDD 60%, #ECE4CE 100%);
  border-radius: 1cqw; }
.slip > * { position: relative; }
.s-head { display: grid; grid-template-columns: 1fr auto; column-gap: 3cqw; align-items: end; border-bottom: .5cqw solid #33456A; padding-bottom: 2cqw; margin-bottom: 2.5cqw; }
.s-title { grid-column: 1 / 2; font-family: var(--font); font-weight: 700; font-size: 8.4cqw; letter-spacing: .12em; color: #23385F; line-height: 1; }
.s-sub { grid-column: 1 / 2; grid-row: 2; font-family: var(--font); font-size: 2.6cqw; letter-spacing: .04em; color: #4C5F82; margin-top: 1.2cqw; }
.s-form { grid-column: 2; grid-row: 1; font-family: var(--mono); font-size: 2.6cqw; color: #4C5F82; border: .3cqw solid #7C8DAD; padding: .6cqw 1.4cqw; }
.srow { display: grid; gap: 2.5cqw; margin-bottom: 1.8cqw; }
.srow.c2 { grid-template-columns: 1fr 1.25fr; }
.srow.c1 { grid-template-columns: 1fr; }
.srow.c3 { grid-template-columns: 1fr 1fr .8fr; }
.cell { position: relative; border-bottom: .35cqw solid #8394B3; min-height: 14cqw; padding-top: 3.8cqw; border-radius: .6cqw; transition: background-color .2s ease, box-shadow .2s ease; }
.lab { position: absolute; top: .2cqw; left: 0; font-family: var(--font); font-size: 2.35cqw; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #5A6C8E; white-space: nowrap; }
.val { display: inline-block; color: var(--ink-hw, var(--ink)); font-size: var(--hw, 6cqw); line-height: 1.15; transform: rotate(var(--vr, -1deg)); transform-origin: left bottom; padding-left: 1cqw; }
.slip { --ink-hw: var(--ink); }
.cell.notes { min-height: 36cqw; background: repeating-linear-gradient(to bottom, transparent 0 calc(8.6cqw - .3cqw), #A9B8D0 calc(8.6cqw - .3cqw) 8.6cqw); background-position: 0 3cqw; border-bottom: 0; }
.cell.notes .val { display: block; line-height: 8.6cqw; font-size: var(--hw, 6cqw); margin-top: -.5cqw; }
.hw-caveat { font-family: "Caveat", "Segoe Script", "Bradley Hand", cursive; --hw: 7cqw; font-weight: 700; }
.hw-reenie { font-family: "Reenie Beanie", "Segoe Script", "Bradley Hand", cursive; --hw: 9cqw; }
.hw-kalam { font-family: "Kalam", "Segoe Script", "Bradley Hand", cursive; --hw: 5.4cqw; }
.slip .val { color: var(--ink); }
.hw-caveat [data-region="crew"] .val { --vr: -1.5deg; }
.hw-caveat [data-region="wo"] .val { --vr: .8deg; letter-spacing: .04em; }
.hw-caveat [data-region="client"] .val { --vr: -2deg; }
.hw-caveat [data-region="location"] .val { --vr: -.6deg; }
.hw-caveat [data-region="end"] .val { --vr: 1.4deg; }
.hw-caveat [data-region="hours"] .val { --vr: -1deg; }
.hw-caveat [data-region="notes"] .val { --vr: -.8deg; }
.hw-reenie [data-region="date"] .val { --vr: -3deg; }
.hw-reenie [data-region="crew"] .val { --vr: 2deg; }
.hw-reenie [data-region="wo"] .val { --vr: -4deg; letter-spacing: .06em; }
.hw-reenie [data-region="client"] .val { --vr: 3deg; }
.hw-reenie [data-region="location"] .val { --vr: -2deg; }
.hw-reenie [data-region="start"] .val { --vr: 3deg; }
.hw-reenie [data-region="end"] .val { --vr: -3deg; }
.hw-reenie [data-region="hours"] .val { --vr: 5deg; }
.hw-reenie [data-region="notes"] .val { --vr: 1.5deg; }
.hw-kalam [data-region="crew"] .val { --vr: -1deg; }
.hw-kalam [data-region="client"] .val { --vr: 1deg; }
.hw-kalam [data-region="notes"] .val { --vr: -1.2deg; }
.amb { position: relative; display: inline-block; }
.amb-d { position: relative; display: inline-block; width: .6em; height: 1em; vertical-align: baseline; }
.amb-d i { position: absolute; left: 0; top: 0; font-style: normal; }
.amb-d i:first-child { opacity: .85; }
.amb-d i:last-child { opacity: .7; transform: translate(.03em, .02em) scale(1.02); }
.s-sig { margin-top: 1.5cqw; display: flex; align-items: flex-end; gap: 3cqw; border-bottom: .35cqw solid #8394B3; height: 10cqw; }
.s-sig .lab { position: static; align-self: flex-start; padding-top: 1cqw; }
.s-sig svg { width: 30cqw; height: 8cqw; fill: none; stroke: var(--ink); stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; opacity: .8; }
.s-ring { display: none; position: absolute !important; right: 7cqw; bottom: 3cqw; width: 22cqw; height: 22cqw; border-radius: 50%; border: 1.4cqw solid rgba(125, 82, 38, .2); box-shadow: inset 0 0 2cqw rgba(125, 82, 38, .18), 0 0 1cqw rgba(125, 82, 38, .1); pointer-events: none; transform: rotate(20deg) scaleY(.94); }
.has-ring .s-ring { display: block; }
.s-crease { position: absolute !important; left: 0; right: 0; top: 46%; height: 3cqw; pointer-events: none; background: linear-gradient(to bottom, transparent, rgba(0,0,0,.04) 45%, rgba(255,255,255,.25) 55%, transparent); }
.messy { filter: contrast(.96) saturate(.9); }
.messy::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(60% 40% at 82% 88%, rgba(90, 110, 140, .13), transparent 70%); }

/* highlight boxes while reading */
.cell.hl { z-index: 2; }
.cell.hl-ok { background: rgba(31, 122, 77, .16); box-shadow: 0 0 0 .5cqw rgba(31, 122, 77, .9); }
.cell.hl-check { background: rgba(224, 161, 0, .2); box-shadow: 0 0 0 .5cqw rgba(200, 140, 0, .95); }

/* scan sweep line */
.scan-line { position: absolute; left: -1%; right: -1%; top: 0; height: 44px; margin-top: -44px; pointer-events: none; opacity: 0; z-index: 3;
  background: linear-gradient(to bottom, rgba(242, 193, 78, 0), rgba(242, 193, 78, .28)); border-bottom: 3px solid #F2C14E; }
.scan-line.run { animation: sweep 1.85s linear .1s forwards; }
@keyframes sweep { 0% { top: 0; opacity: 1; } 96% { opacity: 1; } 100% { top: calc(100% + 44px); opacity: 0; } }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 10px 20px; border-radius: var(--r); border: 2px solid transparent; font-weight: 600; cursor: pointer; text-decoration: none; transition: background-color .15s ease, transform .15s ease; }
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover:not(:disabled) { background: var(--navy-2); }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover:not(:disabled) { background: #186340; }
.btn-quiet { background: transparent; color: var(--navy); border-color: var(--navy); }
.btn-quiet:hover:not(:disabled) { background: var(--navy); color: #fff; }
.btn:disabled { background: #E3DDCE; color: #56606E; border-color: #CFC7B3; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: translateY(1px); }

/* form */
.readbar { display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s4); }
.read-status { margin: 0; color: var(--muted); font-size: .9375rem; flex: 1 1 200px; }
.sform { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: var(--s5); box-shadow: 0 1px 0 rgba(20, 32, 46, .04), 0 10px 24px -16px rgba(20, 32, 46, .3); }
.grid { display: grid; gap: var(--s3) var(--s4); margin-bottom: var(--s3); }
.g1 { grid-template-columns: 1fr; }
.g2 { grid-template-columns: 1fr 1fr; }
.g3 { grid-template-columns: 1fr 1fr 1fr; }
.fld { min-width: 0; padding: 2px 0; border-radius: var(--r); }
.fld.just { animation: flash .7s ease; }
@keyframes flash { from { background: #FFF1C9; } to { background: transparent; } }
.fl { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 2px var(--s2); margin-bottom: 4px; min-height: 26px; }
.fl label { font-weight: 600; font-size: .9375rem; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: .8125rem; font-weight: 600; line-height: 1; padding: 4px 8px; border-radius: 6px; white-space: nowrap; }
.chip:empty { display: none; }
.chip svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chip-ok { background: var(--green-bg); color: var(--green-ink); }
.chip-check { background: var(--amber-bg); color: var(--amber-ink); box-shadow: inset 0 0 0 1px #E0B84A; }
.fld input, .fld textarea { width: 100%; min-height: 46px; padding: 9px 12px; border: 2px solid var(--field); border-radius: var(--r); background: #fff; color: var(--ink); }
.fld textarea { resize: vertical; min-height: 84px; }
.mono { font-family: var(--mono); font-size: .9375rem; }
.fld input.needs-check, .fld textarea.needs-check { border-color: #C58A00; background: #FFF9E4; box-shadow: 0 0 0 3px rgba(224, 161, 0, .25); }
.fld input:focus-visible, .fld textarea:focus-visible { outline: 3px solid var(--navy-2); outline-offset: 1px; }
.hint { margin: 6px 0 0; font-size: .875rem; color: var(--amber-ink); font-weight: 600; }
.hint:empty { display: none; }
.confirm { margin-top: 6px; min-height: 44px; padding: 6px 16px; background: #fff; color: var(--amber-ink); border: 2px solid #C58A00; border-radius: var(--r); font-weight: 700; cursor: pointer; }
.confirm:hover { background: var(--amber-bg); }
.folder-line { display: flex; flex-direction: column; gap: 4px; margin: var(--s4) 0; padding: 10px 14px; background: #EEF2F8; border-left: 4px solid var(--navy-2); border-radius: 0 var(--r) var(--r) 0; }
.fk { font-size: .8125rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.folder-line code { font-family: var(--mono); font-size: .875rem; overflow-wrap: anywhere; color: var(--ink); }

.dup { display: flex; gap: var(--s3); margin: var(--s4) 0; padding: var(--s4); background: #FFF1C9; border: 2px solid #C58A00; border-radius: var(--r); color: #3D2B00; }
.dup .ico { margin-top: 2px; color: #8A5E00; }
.dup h3 { font-size: 1.125rem; margin-bottom: 6px; }
.dup p { font-size: .9375rem; }
.dup-actions { display: flex; flex-wrap: wrap; gap: var(--s2); }
.dup .btn-quiet { border-color: #7A5200; color: #5B3D00; }
.dup .btn-quiet:hover { background: #5B3D00; color: #fff; }
.filebar { display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap; margin-top: var(--s4); }
.file-help { margin: 0; flex: 1 1 200px; font-size: .9375rem; color: var(--muted); }
.filed-msg { margin: var(--s4) 0 0; padding: 10px 14px; background: var(--green-bg); color: var(--green-ink); border-radius: var(--r); font-weight: 600; font-family: var(--mono); font-size: .875rem; overflow-wrap: anywhere; }

/* records */
.records { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr); gap: var(--s7); align-items: start; padding: var(--s8) 0 var(--s8); }
.filed-head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s4); }
.filed h2, .why h2 { font-size: 1.5rem; }
.count { margin: 4px 0 0; color: var(--muted); font-size: .9375rem; }
.filed-tools { display: flex; gap: var(--s2); flex: 1 1 420px; justify-content: flex-end; }
input[type="search"] { min-height: 48px; flex: 1 1 240px; min-width: 0; padding: 9px 12px; border: 2px solid var(--field); border-radius: var(--r); background: #fff; color: var(--ink); }
input[type="search"]:focus-visible { outline-offset: 1px; }
.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.ftable { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.ftable th { text-align: left; font-size: .8125rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; padding: 12px 14px; background: #EFE8D6; border-bottom: 1px solid var(--line); }
.ftable td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ftable tbody tr:last-child td { border-bottom: 0; }
.ftable td.mono { font-size: .875rem; }
.ftable td.path { overflow-wrap: anywhere; min-width: 240px; }
.ftable tr.new td { animation: rowin 1.6s ease; }
@keyframes rowin { from { background: #FFF1C9; } to { background: transparent; } }
.ftable:has(tbody:empty) { display: none; }
.empty { padding: var(--s5); margin: 0; color: var(--muted); background: var(--panel); border: 1px dashed var(--field); border-radius: 12px; }
.table-wrap:has(tbody:empty) { display: none; }
.why { background: var(--navy); color: #EAF0F8; border-radius: 12px; padding: var(--s5); position: sticky; top: 16px; }
.why ul { list-style: none; margin: var(--s4) 0 0; padding: 0; display: grid; gap: var(--s4); }
.why li { padding-left: var(--s4); border-left: 3px solid #F2C14E; font-size: .9375rem; }
.why strong { display: block; color: #fff; font-size: 1.0625rem; margin-bottom: 2px; }
.site-footer { border-top: 1px solid var(--line); padding: var(--s5) 0 var(--s7); color: var(--muted); font-size: .9375rem; }
.site-footer p { margin: 0; max-width: 72ch; }

@media (max-width: 1000px) {
  .workspace { grid-template-columns: 1fr; gap: var(--s6); }
  .left, .why { position: static; }
  .records { grid-template-columns: 1fr; gap: var(--s6); }
}
@media (max-width: 720px) {
  .flow { grid-template-columns: 1fr 1fr; row-gap: var(--s3); }
  .flow li::after, .flow li.now::before { display: none; }
  .flow li { padding: var(--s3) var(--s3) 0 0; }
  .flow li.now .ft { text-decoration: underline; text-decoration-color: #F2C14E; text-underline-offset: 4px; text-decoration-thickness: 2px; }
  .photo { padding: 7% 5% 13%; }
  .sform { padding: var(--s4); }
  .g2 { grid-template-columns: 1fr; }
  .g3 { grid-template-columns: 1fr 1fr; }
  .g3 .fld[data-field="hours"] { grid-column: 1 / -1; }
  .picker { grid-template-columns: 1fr; }
  .pick { flex-direction: row; align-items: center; gap: var(--s3); }
  .readbar .btn, .filebar .btn { width: 100%; }
  .ftable thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .ftable, .ftable tbody, .ftable tr, .ftable td { display: block; width: 100%; }
  .ftable tr { padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); }
  .ftable tr:last-child { border-bottom: 0; }
  .ftable td { border: 0; padding: 4px 0; display: grid; grid-template-columns: 90px 1fr; gap: var(--s3); }
  .ftable td::before { content: attr(data-label); font-size: .8125rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding-top: 2px; }
  .ftable td.path { min-width: 0; }
  input[type="search"], .filed-tools .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media (min-width: 721px) {
  .ftable td[data-label="Date"], .ftable td[data-label="Crew"], .ftable td[data-label="WO"], .ftable td[data-label="Hours"] { white-space: nowrap; }
}
@media (max-width: 720px) {
  .filed-tools { flex-wrap: wrap; flex-basis: 100%; }
  input[type="search"] { flex-basis: 100%; }
}
