:root {
    --ink: #17211d;
    --muted: #68746e;
    --line: #d9dfdc;
    --paper: #ffffff;
    --canvas: #f3f5f1;
    --green: #08745b;
    --green-dark: #055846;
    --green-soft: #e6f3ee;
    --amber: #a45f0a;
    --amber-soft: #fff2dc;
    --red: #a33535;
    --red-soft: #fff0ef;
    --shadow: 0 12px 32px rgba(34, 55, 46, 0.08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background-color: var(--canvas);
    background-image: linear-gradient(rgba(23, 33, 29, 0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(23, 33, 29, 0.035) 1px, transparent 1px);
    background-size: 28px 28px;
    font-family: "DM Sans", sans-serif;
    letter-spacing: 0;
}

.app-header {
    color: white;
    background: #172b24;
    border-bottom: 4px solid #f0b44d;
}

.header-inner {
    width: min(1120px, calc(100% - 40px));
    min-height: 92px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-mark, .success-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 6px;
    background: #f0b44d;
    color: #172b24;
}

.brand-mark svg { width: 23px; height: 23px; }
.eyebrow, .step-label { margin: 0 0 3px; text-transform: uppercase; font-size: 11px; font-weight: 700; letter-spacing: 0.12em; }
.eyebrow { color: #a9b9b2; }

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 24px; line-height: 1.1; letter-spacing: 0; }
h2 { margin-bottom: 0; font-size: 24px; letter-spacing: 0; }
h3 { font-size: 15px; letter-spacing: 0; }

.local-badge {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #cbd6d1;
    font-size: 13px;
}

.local-badge span { width: 8px; height: 8px; border-radius: 50%; background: #55c89b; box-shadow: 0 0 0 4px rgba(85, 200, 155, 0.14); }

main { width: min(1120px, calc(100% - 40px)); margin: 36px auto 64px; }
.workspace, .results { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.workspace { padding: 30px; }

.section-heading, .results-title { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.section-heading { padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.step-label { color: var(--green); }

.csv-format { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 7px; color: var(--muted); font-size: 12px; }
.csv-format code { padding: 5px 8px; border: 1px solid var(--line); border-radius: 4px; background: #f7f9f7; color: #33433c; font-family: "IBM Plex Mono", monospace; font-size: 11px; }

.alert { margin-top: 22px; display: flex; gap: 10px; align-items: center; padding: 12px 14px; border: 1px solid #f1c6c1; border-radius: 6px; background: var(--red-soft); color: var(--red); font-size: 14px; }
.alert svg { width: 18px; flex: 0 0 auto; }

form { display: grid; grid-template-columns: 1fr 1fr; gap: 23px 20px; padding-top: 26px; }
.field { min-width: 0; }
.field-wide, .form-actions { grid-column: 1 / -1; }
.field > label:first-child { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 700; }
.field > small { display: block; margin-top: 7px; color: var(--muted); font-size: 12px; }

input[type="file"] { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.file-picker { min-height: 82px; padding: 14px; display: flex; align-items: center; gap: 13px; border: 1px dashed #9eaaa4; border-radius: 6px; background: #fafcf9; cursor: pointer; transition: border-color 160ms, background 160ms; }
.file-picker:hover { border-color: var(--green); background: #f4faf7; }
.file-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 5px; color: var(--green); background: var(--green-soft); }
.file-icon svg { width: 22px; }
.file-picker strong, .file-picker small { display: block; }
.file-picker strong { margin-bottom: 3px; font-size: 14px; }
.file-picker small { color: var(--muted); font-size: 12px; }
.browse-label { margin-left: auto; padding: 8px 13px; border: 1px solid var(--line); border-radius: 5px; background: white; font-size: 12px; font-weight: 700; }

.input-shell { height: 44px; display: flex; align-items: center; gap: 9px; padding: 0 12px; border: 1px solid #aeb8b3; border-radius: 5px; background: white; transition: border-color 160ms, box-shadow 160ms; }
.input-shell:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgba(8, 116, 91, 0.12); }
.input-shell svg { width: 18px; color: var(--muted); flex: 0 0 auto; }
.input-shell input { min-width: 0; width: 100%; height: 100%; padding: 0; border: 0; outline: 0; color: var(--ink); background: transparent; font: 13px "IBM Plex Mono", monospace; letter-spacing: 0; }
.input-shell input::placeholder { color: #98a29d; }
.folder-button {
    min-height: 32px;
    width: 32px;
    flex: 0 0 32px;
    padding: 0;
    border: 1px solid var(--line);
    color: var(--green);
    background: #f5f9f7;
}
.folder-button:hover { color: white; background: var(--green); transform: none; }
.folder-button svg { width: 17px; }

.form-actions { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding-top: 4px; color: var(--muted); font-size: 12px; }
button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 0 20px; border: 0; border-radius: 5px; color: white; background: var(--green); font: 700 13px "DM Sans", sans-serif; cursor: pointer; transition: background 160ms, transform 160ms; }
button:hover { background: var(--green-dark); transform: translateY(-1px); }
button:disabled { opacity: 0.7; cursor: wait; transform: none; }
button svg { width: 18px; }

.results { margin-top: 24px; overflow: hidden; }
.results-title { padding: 24px 30px; border-bottom: 1px solid var(--line); }
.success-icon { width: 38px; height: 38px; margin-right: -8px; color: white; background: var(--green); }
.success-icon svg { width: 20px; }
.results-title > div:nth-child(2) { margin-right: auto; }
.results-title h2 { font-size: 19px; }
.destination { max-width: 48%; margin: 0; display: flex; align-items: center; gap: 8px; color: var(--muted); font: 11px "IBM Plex Mono", monospace; overflow-wrap: anywhere; }
.destination svg { width: 17px; flex: 0 0 auto; color: var(--green); }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); background: #f8faf8; border-bottom: 1px solid var(--line); }
.metrics div { min-height: 104px; display: flex; flex-direction: column; justify-content: center; padding: 20px 30px; border-right: 1px solid var(--line); }
.metrics div:last-child { border-right: 0; }
.metrics span { color: var(--muted); font-size: 12px; }
.metrics strong { margin-top: 5px; font-size: 28px; line-height: 1; }
.metric-missing strong { color: var(--amber); }

.result-columns { display: grid; grid-template-columns: 1fr 1fr; }
.result-group { min-width: 0; padding: 26px 30px 30px; }
.result-group + .result-group { border-left: 1px solid var(--line); }
.result-group h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.result-group h3 svg { width: 18px; color: var(--green); }
.file-list, .missing-list { margin: 0; padding: 0; list-style: none; max-height: 260px; overflow: auto; }
.file-list li { display: flex; align-items: center; gap: 9px; padding: 9px 0; border-bottom: 1px solid #edf0ee; font: 12px "IBM Plex Mono", monospace; overflow-wrap: anywhere; }
.file-list li:last-child { border-bottom: 0; }
.file-list svg { width: 16px; flex: 0 0 auto; color: var(--muted); }
.missing-list { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 7px; }
.missing-list li { padding: 6px 9px; border-radius: 4px; color: var(--amber); background: var(--amber-soft); font: 11px "IBM Plex Mono", monospace; }
.empty-state { margin-bottom: 0; color: var(--muted); font-size: 13px; }
.success-text { display: flex; align-items: center; gap: 8px; color: var(--green); }
.success-text svg { width: 18px; }

@media (max-width: 720px) {
    .header-inner, main { width: min(100% - 24px, 1120px); }
    .header-inner { min-height: 78px; }
    .local-badge { display: none; }
    main { margin-top: 20px; }
    .workspace { padding: 20px; }
    .section-heading, .results-title { align-items: flex-start; flex-wrap: wrap; }
    .csv-format { justify-content: flex-start; }
    form, .result-columns { grid-template-columns: 1fr; }
    .field-wide, .form-actions { grid-column: auto; }
    .form-actions { align-items: stretch; flex-direction: column; }
    button { width: 100%; }
    .results-title { padding: 20px; }
    .destination { max-width: 100%; width: 100%; }
    .metrics { grid-template-columns: 1fr 1fr; }
    .metrics div { min-height: 88px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
    .metrics div:nth-child(2) { border-right: 0; }
    .metrics div:nth-child(3), .metrics div:nth-child(4) { border-bottom: 0; }
    .result-group { padding: 22px 20px; }
    .result-group + .result-group { border-left: 0; border-top: 1px solid var(--line); }
}

@media (max-width: 420px) {
    h2 { font-size: 21px; }
    .file-picker { align-items: flex-start; flex-wrap: wrap; }
    .browse-label { margin-left: 57px; }
}
/* Web retrieval extensions; base Finance palette retained from the POC. */
[hidden] { display:none !important; }
body { font-family:system-ui,-apple-system,"Segoe UI",sans-serif; background-image:none; }
button { font-family:inherit; }
.intro { margin:0 0 28px; }.intro h2 { font-size:30px; margin-bottom:8px; }.intro p { color:var(--muted); margin:0; }
:focus-visible { outline:3px solid #b37414; outline-offset:3px; }
.method { border:0; padding:0; margin:0; display:flex; gap:14px; }
.method legend { font-size:13px; font-weight:700; margin-bottom:10px; }
.method label { flex:1; padding:16px; background:#fafcf9; border:1px solid var(--line); border-radius:6px; cursor:pointer; font-size:14px; }
.method label:has(input:checked) { border-color:var(--green); background:var(--green-soft); }
.method small { display:block; margin:6px 0 0 25px; color:var(--muted); font-size:12px; }
input[type=radio],input[type=checkbox] { accent-color:var(--green); }
.upload { padding:20px; border:1px dashed #9eaaa4; border-radius:6px; background:#fafcf9; }
.upload strong { font-size:14px; }.upload p { font-size:12px; color:var(--muted); margin:6px 0 16px; }
input[type=file] { position:static; width:100%; height:auto; overflow:visible; opacity:1; font:13px system-ui; }
input[type=file]::file-selector-button { border:1px solid var(--line); border-radius:4px; background:white; padding:9px 14px; margin-right:12px; cursor:pointer; }
.upload small { display:block; margin-top:10px; color:var(--muted); }
textarea { width:100%; padding:12px; border:1px solid #aeb8b3; border-radius:5px; font:14px system-ui; resize:vertical; }
.folder-row { display:flex; gap:10px; }.folder-row .input-shell { flex:1; }.input-shell input { font:13px system-ui; }
.secondary { border:1px solid var(--line); background:white; color:var(--green-dark); }.secondary:hover { background:var(--green-soft); }
.preference-row { display:flex; flex-wrap:wrap; align-items:center; gap:14px; font-size:12px; color:var(--muted); }
.text-button { min-height:34px; background:transparent; color:var(--green); padding:0 8px; }.text-button:hover { background:var(--green-soft); }
#progress { margin-top:20px; display:flex; gap:16px; align-items:center; color:var(--green-dark); font-size:14px; }progress { accent-color:var(--green); width:160px; }
.downloads { display:flex; gap:10px; }.result-columns { grid-template-columns:2fr 1fr; }.table-scroll { max-height:360px; overflow:auto; }
table { width:100%; border-collapse:collapse; text-align:left; font-size:12px; }th { padding:10px 8px; color:var(--muted); background:#f8faf8; position:sticky; top:0; }td { padding:12px 8px; border-bottom:1px solid var(--line); overflow-wrap:anywhere; }th:first-child { width:28%; }
.found-status { color:#055846; }.missing-status { color:#895006; }.result-note { border-top:1px solid var(--line); padding:16px 30px; margin:0; color:var(--muted); font-size:12px; }
footer { margin-top:24px; font-size:12px; color:var(--muted); text-align:center; }
@media(max-width:800px) { .folder-row,.downloads { flex-wrap:wrap; }.folder-row .input-shell { flex-basis:100%; }.result-columns { grid-template-columns:1fr; }.method { flex-wrap:wrap; }.method label { min-width:180px; }.downloads { width:100%; } }

.destination-card { border: 1px solid #d8dee7; border-radius: 10px; padding: 1rem; background: #fafbfc; }
.checkbox-row { display: flex; align-items: center; gap: .5rem; margin-top: .75rem; font-weight: 500; }
.error-text { color: #a33; }
.save-progress, .save-summary { margin-top: 1rem; }
.save-progress { display: flex; align-items: center; gap: .75rem; }
.save-errors { margin-top: .5rem; color: #a33; }

/* Browser-only edition additions */
.privacy-note{max-width:960px;margin:0 auto 1.25rem;padding:.9rem 1.1rem;border:1px solid #cfe3d4;background:#f2f9f3;border-radius:10px;color:#24513a;font-size:.92rem;line-height:1.45}
.check-col{width:2.2rem;text-align:center}
.selection-tools{margin:.25rem 0 .5rem}
#found-rows td:first-child{text-align:center}

/* Saved preferences panel */
.saved-data{max-width:960px;margin:0 auto 1.25rem;padding:1rem 1.25rem;border:1px solid var(--line,#d8dee7);border-radius:10px;background:#fff}
.saved-data .section-heading{padding-bottom:10px;margin-bottom:6px}
.saved-note{margin:.25rem 0 .5rem;font-size:12px;color:var(--muted,#5d6b63)}
.saved-list{margin:.25rem 0 0;padding-left:1.1rem;font-size:.9rem;color:#24513a}
.saved-list li{margin:.15rem 0}
