:root {
    --color-bg: #f7f2e8;
    --color-panel: #fffaf0;
    --color-ink: #102433;
    --color-muted: #5d6b72;
    --color-teal: #2f7c78;
    --color-teal-dark: #245f5c;
    --color-gold: #c99b3b;
    --color-line: #e2d7c2;
    --color-alert: #fff3df;
    --color-alert-border: #d9902f;
    --shadow-soft: 0 18px 50px rgba(16, 36, 51, 0.10);
    --radius-large: 28px;
    --radius-medium: 18px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--color-bg);
}

body {
    min-height: 100%;
    margin: 0;
    color: var(--color-ink);
    background:
        radial-gradient(circle at top left, rgba(201, 155, 59, 0.16), transparent 34rem),
        linear-gradient(180deg, #fbf7ee 0%, var(--color-bg) 100%);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

a {
    color: var(--color-teal-dark);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.site-header,
.site-footer,
main {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 0;
}

.brand-link {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--color-ink);
    font-weight: 800;
    letter-spacing: -0.02em;
}

.brand-link:hover {
    text-decoration: none;
}

.brand-mark {
    display: inline-grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 50%;
    color: #fffaf0;
    background: var(--color-ink);
    box-shadow: 0 8px 22px rgba(16, 36, 51, 0.18);
}

.brand-text {
    font-size: 1.05rem;
}

.top-nav {
    display: flex;
    gap: 18px;
    font-size: 0.95rem;
    font-weight: 700;
}

.hero-section {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
    gap: 28px;
    align-items: stretch;
    padding: 54px 0 34px;
}

.hero-copy,
.hero-card,
.panel,
.preview-panel,
.value-section {
    border: 1px solid rgba(226, 215, 194, 0.95);
    background: rgba(255, 250, 240, 0.86);
    box-shadow: var(--shadow-soft);
    border-radius: var(--radius-large);
}

.hero-copy {
    padding: 42px;
}

.hero-card {
    padding: 32px;
    background:
        linear-gradient(145deg, rgba(47, 124, 120, 0.10), rgba(255, 250, 240, 0.92)),
        var(--color-panel);
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--color-teal-dark);
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    max-width: 820px;
    margin-bottom: 18px;
    font-size: clamp(2.4rem, 6vw, 5.2rem);
    line-height: 0.95;
    letter-spacing: -0.06em;
}

h2 {
    margin-bottom: 10px;
    font-size: clamp(1.35rem, 2vw, 2rem);
    line-height: 1.12;
    letter-spacing: -0.035em;
}

.hero-lede {
    max-width: 720px;
    color: var(--color-muted);
    font-size: 1.18rem;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 28px;
}

.button {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 999px;
    padding: 12px 20px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.button:hover {
    transform: translateY(-1px);
    text-decoration: none;
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
}

.button-primary {
    color: #fffaf0;
    background: var(--color-teal);
    box-shadow: 0 12px 24px rgba(47, 124, 120, 0.22);
}

.button-primary:hover {
    background: var(--color-teal-dark);
}

.button-secondary {
    color: var(--color-ink);
    background: rgba(201, 155, 59, 0.18);
    box-shadow: inset 0 0 0 1px rgba(201, 155, 59, 0.35);
}

.hero-card p,
.hero-card li,
.helper-text,
.value-section p,
.site-footer {
    color: var(--color-muted);
}

.hero-card ul {
    display: grid;
    gap: 10px;
    margin: 20px 0 0;
    padding-left: 20px;
}

.workflow-section {
    display: grid;
    gap: 28px;
    padding: 16px 0 38px;
}

.panel,
.preview-panel {
    padding: 28px;
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 12px;
}

.helper-text {
    margin-bottom: 18px;
}

.csv-editor {
    width: 100%;
    min-height: 280px;
    resize: vertical;
    border: 1px solid var(--color-line);
    border-radius: var(--radius-medium);
    padding: 18px;
    color: var(--color-ink);
    background: #fffdf8;
    box-shadow: inset 0 2px 8px rgba(16, 36, 51, 0.05);
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.92rem;
    line-height: 1.55;
}

.csv-editor:focus {
    outline: 3px solid rgba(47, 124, 120, 0.20);
    border-color: rgba(47, 124, 120, 0.65);
}

.csv-editor-small {
    min-height: 190px;
}

.results-area {
    display: grid;
    gap: 28px;
}

.hidden {
    display: none !important;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 12px;
}

.summary-card {
    min-height: 116px;
    display: grid;
    align-content: center;
    gap: 4px;
    padding: 18px;
    border: 1px solid rgba(226, 215, 194, 0.95);
    border-radius: var(--radius-medium);
    background: rgba(255, 250, 240, 0.90);
    box-shadow: 0 10px 28px rgba(16, 36, 51, 0.07);
}

.summary-number {
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: -0.05em;
}

.summary-label {
    color: var(--color-muted);
    font-size: 0.88rem;
    font-weight: 800;
}

.alert {
    border: 1px solid var(--color-alert-border);
    border-radius: var(--radius-medium);
    padding: 16px 18px;
    background: var(--color-alert);
    color: var(--color-ink);
    font-weight: 700;
}

.preview-grid {
    display: grid;
    gap: 18px;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--color-line);
    border-radius: var(--radius-medium);
    background: #fffdf8;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

th,
td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--color-line);
    text-align: left;
    vertical-align: top;
    font-size: 0.92rem;
}

th {
    color: var(--color-ink);
    background: rgba(201, 155, 59, 0.12);
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

td {
    color: var(--color-muted);
}

tr:last-child td {
    border-bottom: 0;
}

.status-ready {
    display: inline-flex;
    border-radius: 999px;
    padding: 4px 10px;
    color: #fffaf0;
    background: var(--color-teal);
    font-size: 0.78rem;
    font-weight: 900;
}

.status-review {
    display: inline-flex;
    border-radius: 999px;
    padding: 4px 10px;
    color: var(--color-ink);
    background: rgba(201, 155, 59, 0.22);
    font-size: 0.78rem;
    font-weight: 900;
}

.transform-divider {
    display: grid;
    grid-template-columns: minmax(60px, 1fr) auto minmax(60px, 1fr);
    align-items: center;
    gap: 14px;
    padding: 2px 18px;
}

.arrow-line {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(47, 124, 120, 0.45), transparent);
}

.arrow-circle {
    display: grid;
    width: 54px;
    height: 54px;
    place-items: center;
    border-radius: 50%;
    color: #fffaf0;
    background: linear-gradient(145deg, var(--color-teal), var(--color-teal-dark));
    box-shadow: 0 12px 28px rgba(47, 124, 120, 0.25);
    font-size: 1.8rem;
    font-weight: 900;
}

.cleaned-csv-panel {
    background:
        linear-gradient(145deg, rgba(47, 124, 120, 0.08), rgba(255, 250, 240, 0.92)),
        var(--color-panel);
}

.value-section {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 28px;
    align-items: center;
    margin: 0 auto 42px;
    padding: 32px;
}

.site-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 28px 0 44px;
    font-size: 0.92rem;
}

.site-footer p {
    margin: 0;
}

@media (max-width: 980px) {
    .hero-section,
    .value-section {
        grid-template-columns: 1fr;
    }

    .summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .site-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 16px;
    }
}

@media (max-width: 640px) {
    .site-header,
    .site-footer,
    main {
        width: min(100% - 22px, 1180px);
    }

    .hero-copy,
    .hero-card,
    .panel,
    .preview-panel,
    .value-section {
        padding: 22px;
        border-radius: 22px;
    }

    .hero-section {
        padding-top: 24px;
    }

    .panel-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }

    .top-nav {
        flex-wrap: wrap;
    }

    table {
        min-width: 720px;
    }
}

.spreadsheet-shell {
    overflow: auto;
    min-height: 330px;
    max-height: 520px;
    border: 1px solid var(--color-line);
    border-radius: var(--radius-medium);
    background: #fffdf8;
    box-shadow: inset 0 2px 8px rgba(16, 36, 51, 0.05);
}

.spreadsheet-editor {
    min-width: 900px;
}

.spreadsheet-empty {
    padding: 28px;
    color: var(--color-muted);
    font-weight: 700;
}

.sheet-row {
    display: grid;
    grid-template-columns: 54px repeat(var(--sheet-columns), minmax(180px, 1fr));
    min-width: max-content;
}

.sheet-corner,
.sheet-column-header,
.sheet-row-header,
.sheet-cell {
    min-height: 42px;
    border-right: 1px solid #d8d8d8;
    border-bottom: 1px solid #d8d8d8;
    padding: 8px 10px;
}

.sheet-corner,
.sheet-column-header {
    position: sticky;
    top: 0;
    z-index: 3;
    color: #f7f2e8;
    background: #202327;
    font-weight: 800;
    text-align: center;
}

.sheet-corner {
    left: 0;
    z-index: 4;
}

.sheet-row-header {
    position: sticky;
    left: 0;
    z-index: 2;
    color: #f7f2e8;
    background: #202327;
    font-weight: 800;
    text-align: center;
}

.sheet-cell {
    color: var(--color-ink);
    background: #ffffff;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.92rem;
    line-height: 1.35;
    white-space: pre-wrap;
    outline: none;
}

.sheet-cell:focus {
    position: relative;
    z-index: 5;
    box-shadow: inset 0 0 0 2px var(--color-teal);
    background: #fffef9;
}

.sheet-cell.header-cell {
    font-weight: 900;
    background: #f7f7f4;
}

.sheet-cell[data-empty="true"] {
    background: #fffaf0;
}

@media (max-width: 640px) {
    .spreadsheet-editor {
        min-width: 760px;
    }

    .sheet-row {
        grid-template-columns: 46px repeat(var(--sheet-columns), minmax(150px, 1fr));
    }
}

/* Spreadsheet-style raw CSV editor refinements */
.spreadsheet-shell {
    overflow: auto;
    min-height: 330px;
    max-height: 520px;
    border: 1px solid #c8c8c8;
    border-radius: var(--radius-medium);
    background: #ffffff;
    box-shadow: inset 0 2px 8px rgba(16, 36, 51, 0.05);
}

.spreadsheet-editor {
    min-width: 980px;
}

.sheet-row {
    display: grid;
    grid-template-columns: 54px repeat(var(--sheet-columns), 240px);
    min-width: max-content;
}

.sheet-corner,
.sheet-column-header,
.sheet-row-header,
.sheet-cell {
    height: 38px;
    min-height: 38px;
    max-height: 38px;
    border-right: 1px solid #cfcfcf;
    border-bottom: 1px solid #cfcfcf;
    padding: 8px 10px;
}

.sheet-corner,
.sheet-column-header {
    position: sticky;
    top: 0;
    z-index: 3;
    color: #222222;
    background: #e9e9e9;
    font-weight: 700;
    text-align: center;
}

.sheet-corner {
    left: 0;
    z-index: 4;
    background: #dcdcdc;
}

.sheet-row-header {
    position: sticky;
    left: 0;
    z-index: 2;
    color: #222222;
    background: #e9e9e9;
    font-weight: 700;
    text-align: center;
}

.sheet-cell {
    overflow: hidden;
    color: var(--color-ink);
    background: #ffffff;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.9rem;
    line-height: 1.35;
    white-space: nowrap;
    text-overflow: clip;
    outline: none;
}

.sheet-cell:focus {
    position: relative;
    z-index: 5;
    overflow: visible;
    box-shadow: inset 0 0 0 2px var(--color-teal);
    background: #ffffff;
}

.sheet-cell.header-cell {
    font-weight: 800;
    background: #f7f7f7;
}

.sheet-cell[data-empty="true"] {
    background: #fffaf0;
}

@media (max-width: 640px) {
    .spreadsheet-editor {
        min-width: 840px;
    }

    .sheet-row {
        grid-template-columns: 46px repeat(var(--sheet-columns), 210px);
    }

    .sheet-corner,
    .sheet-column-header,
    .sheet-row-header,
    .sheet-cell {
        height: 36px;
        min-height: 36px;
        max-height: 36px;
    }
}

/* Make active overflowing spreadsheet cells easier to read while editing */
.sheet-cell:focus {
    width: max-content;
    min-width: 100%;
    max-width: none;
    overflow: visible;
    white-space: nowrap;
    background: #ffffff;
    box-shadow:
        inset 0 0 0 2px var(--color-teal),
        0 0 0 1px #ffffff;
}

.sheet-cell:focus[data-empty="true"] {
    background: #fffaf0;
    box-shadow:
        inset 0 0 0 2px var(--color-teal),
        0 0 0 1px #fffaf0;
}

/* Raelway Systems site header alignment */
.site-header {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0 18px;
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    color: var(--color-ink);
    text-decoration: none;
}

.brand:hover {
    text-decoration: none;
}

.brand-logo {
    display: block;
    width: auto;
    height: 46px;
    object-fit: contain;
}

.brand-tagline {
    max-width: 330px;
    color: var(--color-muted);
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.25;
}

.nav-links {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 22px;
    font-size: 0.92rem;
    font-weight: 800;
}

.nav-links a {
    color: var(--color-teal-dark);
}

.brand-link,
.brand-mark,
.brand-text,
.top-nav {
    display: none;
}

@media (max-width: 760px) {
    .site-header {
        padding-top: 18px;
    }

    .nav {
        align-items: flex-start;
        flex-direction: column;
        gap: 16px;
    }

    .brand {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .brand-logo {
        height: 42px;
    }

    .brand-tagline {
        max-width: 100%;
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 14px;
    }
}

/* Final Raelway Systems site theme/header match */
:root {
    --color-bg: #f7f4ee;
    --color-panel: #ffffff;
    --color-ink: #18202a;
    --color-muted: #5f6b78;
    --color-teal: #315f72;
    --color-teal-dark: #244a59;
    --color-gold: #c18f3a;
    --color-line: #d9d2c7;
    --color-alert: #fff3df;
    --color-alert-border: #c18f3a;
    --shadow-soft: 0 22px 60px rgba(24, 32, 42, 0.12);
    --radius-large: 22px;
    --radius-medium: 18px;

    --bg: #f7f4ee;
    --panel: #ffffff;
    --ink: #18202a;
    --muted: #5f6b78;
    --line: #d9d2c7;
    --accent: #315f72;
    --accent-dark: #244a59;
    --accent-soft: #e5eff2;
    --gold: #c18f3a;
    --shadow: 0 22px 60px rgba(24, 32, 42, 0.12);
    --radius: 22px;
    --max: 1280px;
}

html {
    min-height: 100%;
    background: var(--bg);
    scroll-behavior: smooth;
    scrollbar-gutter: stable;
}

body {
    min-height: 100%;
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(49, 95, 114, 0.16), transparent 36rem),
        radial-gradient(circle at top right, rgba(193, 143, 58, 0.15), transparent 30rem),
        var(--bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.6;
}

a {
    color: inherit;
}

/* Exact-style site header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0;
    backdrop-filter: blur(16px);
    background: rgba(247, 244, 238, 0.82);
    border-bottom: 1px solid rgba(217, 210, 199, 0.72);
}

.nav {
    max-width: var(--max);
    margin: 0 auto;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0;
    text-decoration: none;
    min-width: 0;
    color: var(--ink);
}

.brand:hover {
    text-decoration: none;
}

.brand-logo {
    display: block;
    width: clamp(210px, 28vw, 340px);
    height: auto;
    max-height: 58px;
    object-fit: contain;
}

.brand-tagline {
    margin-left: 1.15rem;
    padding-left: 1.15rem;
    border-left: 1px solid rgba(49, 95, 114, 0.32);
    max-width: 260px;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.25;
}

.nav-links {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1.25rem;
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--muted);
}

.nav-links a {
    color: inherit;
    text-decoration: none;
}

.nav-links a:hover {
    color: var(--ink);
}

/* Bring demo buttons closer to the main site */
.button {
    min-height: 46px;
    padding: 0.8rem 1.15rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-weight: 750;
    line-height: 1;
}

.button-primary {
    color: #ffffff;
    background: var(--accent);
    box-shadow: 0 14px 28px rgba(49, 95, 114, 0.24);
}

.button-primary:hover {
    background: var(--accent-dark);
    box-shadow: 0 18px 34px rgba(49, 95, 114, 0.30);
}

.button-secondary {
    color: var(--ink);
    background: rgba(255, 255, 255, 0.72);
    border-color: var(--line);
    box-shadow: none;
}

.button-secondary:hover {
    background: #ffffff;
    box-shadow: 0 12px 28px rgba(24, 32, 42, 0.08);
}

.site-footer,
main {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
}

@media (max-width: 920px) {
    .nav {
        align-items: flex-start;
        flex-direction: column;
    }

    .nav-links {
        flex-wrap: wrap;
    }

    .brand-logo {
        width: clamp(190px, 60vw, 320px);
    }

    .brand-tagline {
        margin-left: 0;
        padding-left: 0;
        border-left: 0;
        max-width: 100%;
    }
}

@media (max-width: 640px) {
    .brand {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.65rem;
    }

    .brand-logo {
        height: auto;
        max-height: 54px;
    }
}

/* Main Raelway site header/layout final override */
:root {
    --color-bg: #f7f4ee;
    --color-panel: #ffffff;
    --color-ink: #18202a;
    --color-muted: #5f6b78;
    --color-teal: #315f72;
    --color-teal-dark: #244a59;
    --color-gold: #c18f3a;
    --color-line: #d9d2c7;
    --color-alert-border: #c18f3a;
    --shadow-soft: 0 22px 60px rgba(24, 32, 42, 0.12);
    --radius-large: 22px;

    --bg: #f7f4ee;
    --panel: #ffffff;
    --ink: #18202a;
    --muted: #5f6b78;
    --line: #d9d2c7;
    --accent: #315f72;
    --accent-dark: #244a59;
    --accent-soft: #e5eff2;
    --gold: #c18f3a;
    --shadow: 0 22px 60px rgba(24, 32, 42, 0.12);
    --radius: 22px;
    --max: 1280px;
}

html {
    background: var(--bg);
    scroll-behavior: smooth;
    scrollbar-gutter: stable;
}

body {
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(49, 95, 114, 0.16), transparent 36rem),
        radial-gradient(circle at top right, rgba(193, 143, 58, 0.15), transparent 30rem),
        var(--bg);
    line-height: 1.6;
}

body .site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: block;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    backdrop-filter: blur(16px);
    background: rgba(247, 244, 238, 0.82);
    border-bottom: 1px solid rgba(217, 210, 199, 0.72);
}

body .site-header .nav {
    max-width: var(--max);
    width: auto;
    margin: 0 auto;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

body .site-header .brand {
    display: inline-flex;
    align-items: center;
    flex-direction: row;
    gap: 0;
    min-width: 0;
    color: var(--ink);
    text-decoration: none;
}

body .site-header .brand:hover {
    text-decoration: none;
}

body .site-header .brand-logo {
    display: block;
    width: clamp(210px, 28vw, 340px);
    height: auto;
    max-height: 58px;
    object-fit: contain;
}

body .site-header .brand-tagline {
    display: inline-block;
    margin-left: 1.15rem;
    padding-left: 1.15rem;
    border-left: 1px solid rgba(49, 95, 114, 0.32);
    max-width: 260px;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.25;
}

body .site-header .nav-links {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 1.25rem;
    color: var(--muted);
    font-size: 0.95rem;
    font-weight: 400;
}

body .site-header .nav-links a {
    color: inherit;
    text-decoration: none;
}

body .site-header .nav-links a:hover {
    color: var(--ink);
}

body .brand-link,
body .brand-mark,
body .brand-text,
body .top-nav {
    display: none;
}

body main,
body .site-footer {
    width: min(1180px, calc(100% - 32px));
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 920px) {
    body .site-header .nav {
        align-items: flex-start;
        flex-direction: column;
    }

    body .site-header .nav-links {
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    body .site-header .brand-logo {
        width: clamp(190px, 60vw, 320px);
    }

    body .site-header .brand-tagline {
        margin-left: 0;
        padding-left: 0;
        border-left: 0;
        max-width: 100%;
    }
}

@media (max-width: 640px) {
    body .site-header .brand {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.65rem;
    }

    body .site-header .brand-logo {
        height: auto;
        max-height: 54px;
    }
}

/* Mobile spreadsheet overflow containment */
html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

main,
.workflow-section,
.panel,
.preview-panel,
.results-area,
.cleaned-csv-panel {
    min-width: 0;
    max-width: 100%;
}

.panel {
    overflow: hidden;
}

.spreadsheet-shell {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}

.spreadsheet-editor {
    width: max-content;
    min-width: 980px;
    max-width: none;
}

.sheet-row {
    width: max-content;
    min-width: max-content;
    grid-template-columns: 54px repeat(var(--sheet-columns), 260px);
}

@media (max-width: 760px) {
    body main,
    body .site-footer,
    main,
    .site-footer {
        width: min(100% - 24px, 1180px);
        max-width: calc(100% - 24px);
        margin-left: auto;
        margin-right: auto;
    }

    .hero-section,
    .workflow-section,
    .preview-grid,
    .results-area {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .hero-copy,
    .hero-card,
    .panel,
    .preview-panel,
    .value-section {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        padding: 22px;
    }

    .spreadsheet-shell {
        width: 100%;
        max-width: 100%;
        min-height: 320px;
        max-height: 470px;
    }

    .spreadsheet-editor {
        min-width: 860px;
    }

    .sheet-row {
        grid-template-columns: 46px repeat(var(--sheet-columns), 205px);
    }

    .sheet-corner,
    .sheet-column-header,
    .sheet-row-header,
    .sheet-cell {
        height: 36px;
        min-height: 36px;
        max-height: 36px;
    }
}
