:root {
    --accent: #6540c8;
    --accent-hover: #5031a5;
    --accent-soft: #f3effc;
}

h1:focus {
    outline: none;
}

html {
    font-family: "Segoe UI", "Yu Gothic UI", "Meiryo", sans-serif;
}

body {
    margin: 0;
    overflow-wrap: anywhere;
}

* {

    box-sizing: border-box;

}

a {

    color: var(--accent);

}

:is(a, button, input, select, textarea, summary):focus-visible {
    outline: 3px solid #237fbc;
    outline-offset: 3px;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled,
select:disabled,
input:disabled,
textarea:disabled {
    cursor: not-allowed;
    opacity: 0.62;
}

h1,
h2,
h3 {
    letter-spacing: 0;
    margin: 0;
}

.page-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.page-header {
    align-items: flex-start;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.page-header h1 {
    font-size: 1.45rem;
}

.page-header p {
    color: #5a6575;
    margin: 0.25rem 0 0;
}

.toolbar,
.section-heading,
.form-grid,
.row-actions,
.tab-bar {
    align-items: center;
    display: flex;
    gap: 0.6rem;
}

.toolbar,
.section-heading {
    justify-content: space-between;
    flex-wrap: wrap;
}

.row-actions {
    flex-wrap: wrap;
}

.data-table .table-action,
.data-table .audit-link {
    flex-shrink: 0;
    white-space: nowrap;
}

.section-heading {
    margin-bottom: 0.75rem;
}

.section-heading h2 {
    font-size: 1.05rem;
}

.tab-bar {
    border-bottom: 1px solid #d7dde6;
    flex-wrap: wrap;
    padding-bottom: 0.25rem;
}

.tab-button,
.primary-button,
.secondary-button,
.table-action,
.text-button {
    background: #ffffff;
    border: 1px solid #b8c2d0;
    border-radius: 6px;
    color: #17202f;
    min-height: 34px;
    padding: 0.42rem 0.7rem;
}

.primary-button {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}

.secondary-button:hover,
.table-action:hover,
.text-button:hover,
.tab-button:hover {
    border-color: #7c8aa0;
}

.tab-button.active {
    background: #1f2933;
    border-color: #1f2933;
    color: #ffffff;
}

.danger-button {
    border-color: #c26b6b;
    color: #9b2424;
}

.panel {
    background: #ffffff;
    border: 1px solid #d7dde6;
    border-radius: 8px;
    padding: 1rem;
    min-width: 0;
}

.split-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
}

.form-grid {
    align-items: end;
    flex-wrap: wrap;
}

.form-grid > .field {
    flex: 1 1 200px;
    min-width: 0;
}

.page-header > *,
.section-heading > * {
    min-width: 0;
    max-width: 100%;
}
.form-grid > .field.wide-field {
    flex-basis: 320px;
}
.field input, .field select, .field textarea {
    width: 100%;
    min-width: 0;
}
.form-columns {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    margin-bottom: 1rem;
}
.form-fields {
    border: 0;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    min-width: 0;
}
.form-fields > .field {
    min-width: 0;
}
.panel-group {
    border: 0;
    padding: 0;
    min-width: 0;
}
.panel-group:disabled {
    opacity: 0.75;
}
.location-language-selector {
    flex-wrap: wrap;
}
.header-settings-content .action-feedback, .header-settings-content .error-summary {
    margin-top: 0.75rem;
}
.full-width {
    grid-column: 1 / -1;
}
.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}
.field-help {
    color: #5a6575;
    font-size: 0.85rem;
    line-height: 1.6;
    margin: 0.25rem 0 0.75rem;
}
.advanced-settings {
    border: 1px solid #d7dde6;
    border-radius: 6px;
    padding: 0.75rem;
    min-width: 0;
}
.advanced-settings summary {
    cursor: pointer;
    color: #475364;
    font-weight: 600;
}
.advanced-settings[open] summary {
    margin-bottom: 0.75rem;
}
.advanced-settings .field + .field {
    margin-top: 1rem;
}
.action-feedback {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    background: #edf4f8;
    color: #334b60;
}
.success-feedback {
    background: #eefaf3;
    border: 1px solid #92c7a6;
    color: #205b37;
}
.getting-started {
    background: #edf6f8;
    border: 1px solid #b9d9df;
    border-radius: 8px;
    padding: 1.25rem;
}
.getting-started h2 {
    font-size: 1.05rem;
}
.getting-started p {
    color: #475364;
    font-size: 0.85rem;
    line-height: 1.6;
    margin: 0.35rem 0 0.75rem;
}
.getting-started-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    padding: 0;
    margin: 1rem 0 0;
    list-style: none;
}
.getting-started-steps li {
    display: flex;
    gap: 0.65rem;
}
.getting-started-steps a {
    font-weight: 600;
}
.getting-started-steps .muted {
    font-size: 0.8rem;
}
.step-number {
    background: var(--accent);
    color: white;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 1.65rem;
    height: 1.65rem;
    font-size: 0.85rem;
}
#project-form {
    scroll-margin-top: 110px;
}

.field,
.field-inline,
.project-switcher,
.location-language-selector label {
    display: flex;
    flex-direction: column;
    gap: 0.28rem;
}

.field-inline {
    min-width: 150px;
}

.field span,
.field-inline span,
.project-switcher span,
.location-language-selector span {
    color: #5a6575;
    font-size: 0.78rem;
    font-weight: 600;
}

input,
select,
textarea {
    background: #ffffff;
    border: 1px solid #c6cfda;
    border-radius: 6px;
    box-sizing: border-box;
    color: #1f2933;
    min-height: 36px;
    padding: 0.42rem 0.55rem;
}

textarea {
    min-height: 92px;
    resize: vertical;
}

.project-switcher {
    min-width: 220px;
    flex: 0 1 280px;
}

.project-switcher select {

    border-color: var(--accent);

    background: #f3fafb;

    font-weight: 600;

    width: 100%;

}

.location-language-selector {
    align-items: end;
    display: flex;
    gap: 0.5rem;
}

.credit-badge {
    align-items: center;
    border: 1px solid #c6cfda;
    border-radius: 6px;
    display: flex;
    gap: 0.55rem;
    min-height: 36px;
    padding: 0 0.65rem;
    white-space: nowrap;
}

.credit-badge span {
    color: #5a6575;
    font-size: 0.78rem;
    font-weight: 700;
}

.credit-badge.normal {
    background: #eefaf3;
    border-color: #92c7a6;
}

.credit-badge.warning {
    background: #fff7e8;
    border-color: #d7ae62;
}

.credit-badge.exhausted {
    background: #fff1f1;
    border-color: #d98b8b;
}

.data-table-wrap {
    overflow-x: auto;
    min-width: 0;
    overscroll-behavior-x: contain;
    width: 100%;
}

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

.data-table th,
.data-table td {
    border-bottom: 1px solid #e2e6ed;
    padding: 0.58rem 0.65rem;
    text-align: left;
    vertical-align: top;
}

.data-table th {
    background: #f1f4f8;
    color: #475364;
    font-size: 0.78rem;
    font-weight: 700;
}

.actions-column {
    min-width: 180px;
    width: 1%;
}

.state-row {
    background: #ffffff;
    border: 1px solid #d7dde6;
    border-radius: 8px;
    color: #5a6575;
    padding: 1rem;
}

.state-row-error,
.error-summary {
    background: #fff1f1;
    border-color: #d98b8b;
    color: #842020;
}

.error-summary {
    border: 1px solid #d98b8b;
    border-radius: 8px;
    padding: 0.8rem 1rem;
}

.error-summary ul {
    margin: 0.4rem 0 0;
    padding-left: 1.2rem;
}

.job-panel {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.muted {
    color: #6b7280;
}

.audit-link {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}

.audit-link:hover {
    text-decoration: underline;
}

.metric-strip {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric {
    background: #ffffff;
    border: 1px solid #d7dde6;
    border-radius: 8px;
    padding: 0.85rem;
}

.metric span {
    color: #5a6575;
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
}

.metric strong {
    display: block;
    font-size: 1.25rem;
    margin-top: 0.25rem;
}

.dashboard-metrics {
    grid-template-columns: repeat(4, minmax(140px, 1fr));
}

.dense-form {
    align-items: end;
}

.wide-field {
    flex: 1 1 320px;
}

.button-row {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.75rem;
}

.option-grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0.75rem 0;
}

fieldset {
    border: 1px solid #d7dde6;
    border-radius: 8px;
    margin: 0;
    padding: 0.75rem;
}

legend {
    color: #475364;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0 0.25rem;
}

.check-list {
    display: grid;
    gap: 0.45rem;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.check-option {
    align-items: center;
    color: #1f2933;
    display: inline-flex;
    gap: 0.42rem;
    min-height: 36px;
}

.check-option input {
    min-height: auto;
}

.compact-check {
    align-self: end;
}

.job-status-card {
    align-items: center;
    display: grid;
    gap: 0.6rem;
    grid-template-columns: minmax(120px, 1fr) minmax(90px, auto) minmax(160px, 2fr) auto auto;
}

.job-status-card progress {
    accent-color: var(--accent);
    height: 16px;
    width: 100%;
}

.detail-list {
    display: grid;
    gap: 0.6rem;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    margin-bottom: 1rem;
}

.detail-list div {
    border: 1px solid #e2e6ed;
    border-radius: 6px;
    padding: 0.65rem;
}

.detail-list span {
    color: #5a6575;
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
}

.detail-list strong {
    display: block;
    margin-top: 0.2rem;
    overflow-wrap: anywhere;
}

.subsection-title {
    font-size: 0.95rem;
    margin: 1rem 0 0.5rem;
}

.json-field textarea {
    font-family: Consolas, "Courier New", monospace;
    min-height: 220px;
}

.rank-distribution {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.table-number {
    text-align: right;
    white-space: nowrap;
}

@media (max-width: 920px) {
    .page-header,
    .toolbar,
    .section-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .split-grid,
    .metric-strip {
        grid-template-columns: 1fr;
    }

    .location-language-selector,
    .form-grid {
        align-items: stretch;
        flex-direction: column;
    }

    .option-grid,
    .dashboard-metrics {
        grid-template-columns: 1fr;
    }

    .job-status-card {
        align-items: stretch;
        grid-template-columns: 1fr;
    }

    .project-switcher {
        min-width: 0;
    }

    .getting-started-steps {

        grid-template-columns: 1fr;

    }
    .form-grid > .field,
    .form-grid > .field.wide-field {
        flex-basis: auto;
    }
    #project-form {
        scroll-margin-top: 1rem;
    }
}

@media (max-width: 560px) {
    .form-fields {
        grid-template-columns: 1fr;
    }
    .wide-field {
        flex-basis: auto;
    }
    .form-actions > button {
        width: 100%;
    }
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* Authentication pages (login, account) */
.auth-page {
    align-items: center;
    background: #f6f7f9;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem 1rem;
}

.auth-shell {
    background: #ffffff;
    border: 1px solid #d9dee7;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
    max-width: 24rem;
    padding: 2rem;
    width: 100%;
}

    .auth-shell h1 {
        font-size: 1.25rem;
        margin: 0 0 1.25rem;
    }

.auth-form .form-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 1rem;
}

.auth-form .form-row-inline {
    align-items: center;
    flex-direction: row;
    gap: 0.5rem;
}

.auth-form label {
    font-size: 0.85rem;
    font-weight: 600;
}

.auth-form input[type="email"],
.auth-form input[type="password"] {
    border: 1px solid #cbd2dc;
    border-radius: 4px;
    font-size: 0.95rem;
    padding: 0.5rem;
}

.auth-form small {
    color: #6b7280;
    font-size: 0.75rem;
}

.auth-form .btn-primary {
    background: var(--accent);
    border: none;
    border-radius: 4px;
    color: #ffffff;
    cursor: pointer;
    font-size: 0.95rem;
    padding: 0.55rem 1.25rem;
    width: 100%;
}

    .auth-form .btn-primary:hover {
        background: var(--accent-hover);
    }

.alert {
    border-radius: 4px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    padding: 0.65rem 0.75rem;
}

.alert-error {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #991b1b;
}

.alert-success {
    background: #dcfce7;
    border: 1px solid #86efac;
    color: #166534;
}

.account-summary {
    margin-bottom: 2rem;
}

.table-scroll-hint {
    display: none;
}

@media (max-width: 560px) {
    .table-scroll-hint {
        color: #5a6575;
        display: block;
        font-size: 0.8rem;
        margin: 0.75rem 0 0.4rem;
    }

    .data-table-wrap:focus-visible {
        outline: 3px solid #237fbc;
        outline-offset: 2px;
    }

    input,
    select,
    textarea,
    .auth-form input[type="email"],
    .auth-form input[type="password"] {
        font-size: 16px;
        max-width: 100%;
        min-width: 0;
    }

    button,
    .tab-button,
    .primary-button,
    .secondary-button,
    .table-action,
    .text-button,
    select,
    input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
    .check-option,
    .auth-form .form-row-inline,
    .advanced-settings summary,
    .getting-started-steps a {
        min-height: 44px;
    }

    .advanced-settings summary {
        align-content: center;
    }

    .getting-started-steps a {
        align-items: center;
        display: inline-flex;
    }

    .auth-form .form-row-inline label {
        align-content: center;
        min-height: 44px;
    }

    .data-table .table-action,
    .data-table .audit-link {
        align-items: center;
        display: inline-flex;
        min-height: 44px;
    }

    .auth-shell {
        padding: 1.5rem;
    }
}

    .account-summary dt {
        color: #6b7280;
        font-size: 0.8rem;
    }

    .account-summary dd {
        font-size: 0.95rem;
        margin: 0.25rem 0 0;
    }
.guest-login {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #cbd5e1;
}

.guest-mode-badge {
    border-radius: 0.4rem;
    padding: 0.35rem 0.6rem;
    background: #e0f2fe;
    color: #075985;
    font-weight: 700;
    white-space: nowrap;
}

.guest-demo-notice {
    margin-bottom: 1rem;
    padding: 1rem;
    border: 1px solid #7dd3fc;
    border-radius: 0.5rem;
    background: #f0f9ff;
    color: #0c4a6e;
}

.guest-demo-notice p {
    margin: 0.5rem 0 0;
}

/* Research and reading share one accent and a clear primary action. */
.primary-button:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
a.primary-button, a.secondary-button, a.text-button { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.advanced-options { min-width: 0; }
.advanced-options > summary, .guest-demo-notice > summary { cursor: pointer; min-height: 44px; align-content: center; font-weight: 600; }
.advanced-options[open] > summary { margin-bottom: 0.75rem; }
.advanced-options .form-grid { margin-top: 0.75rem; }
.read-only-notice { border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 0.75rem 1rem; }
.read-only-notice summary { color: #49308c; cursor: pointer; min-height: 44px; align-content: center; font-weight: 600; }
.read-only-notice p { margin: 0.3rem 0 0; color: #475364; font-size: 0.9rem; }
.guest-demo-notice { padding: 0.2rem 0.75rem; background: #f4f2fb; border-color: #d7cfee; }
.guest-demo-notice summary { font-size: 0.85rem; }
.data-table .table-status { white-space: nowrap; overflow-wrap: normal; }
.research-flow textarea { min-height: 130px; }
.research-flow .button-row { margin-top: 1rem; }
.brief-content { max-width: 75ch; line-height: 1.8; margin: 1.5rem 0; }
.brief-content section + section { margin-top: 1.5rem; }
.brief-content h3 { font-size: 1rem; color: #49308c; }
.brief-content p { margin: 0.5rem 0; white-space: pre-wrap; }
.brief-content li { padding: 0.25rem 0; }
.brief-workspace fieldset { border: 1px solid #d7dde6; border-radius: 6px; padding: 1rem; margin: 1rem 0; min-width: 0; }
.brief-list { list-style: none; padding: 0; margin: 0; }
.brief-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid #e3e7ee; }
.brief-list li:last-child { border-bottom: 0; }
.brief-list h3 { font-size: 1rem; }
.brief-list p { color: #5a6575; margin: 0.35rem 0 0; font-size: 0.9rem; }
.status-pill { display: inline-block; padding: 0.3rem 0.6rem; border-radius: 999px; background: var(--accent-soft); color: #49308c; white-space: nowrap; font-size: 0.85rem; }
.dashboard-start { padding: 2rem; }
.dashboard-primary-metrics .metric { border-top: 3px solid var(--accent); }
.auth-brand { color: var(--accent); font-size: 1.5rem; font-weight: 750; }
.auth-tagline { margin: 0.5rem 0 1.75rem; color: #5a6575; }
.auth-shell h1 { font-size: 1.25rem; }
.guest-login .secondary-button { width: 100%; border-color: var(--accent); color: var(--accent); font-weight: 600; }
.guest-login p { color: #5a6575; font-size: 0.9rem; line-height: 1.7; }
@media (max-width: 560px) {
    .page-header { gap: 0.5rem; }
    .page-header h1 { font-size: 1.3rem; }
    .page-header p { font-size: 0.85rem; }
    .guest-demo-notice { margin-bottom: 0.75rem; }
    .brief-list li { grid-template-columns: minmax(0, 1fr) auto; gap: 0.75rem; }
    .brief-list li > div:first-child { grid-column: 1 / -1; }
    .brief-list .status-pill { justify-self: start; }
    .dashboard-primary-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-start { padding: 1rem; }
}

/* Mobile research keeps key values and actions together without horizontal swiping. */
body:has(dialog[open]) { overflow: hidden; }
.mobile-card-details { display: none; }
.research-flow > summary, .result-filters > summary { cursor: pointer; min-height: 44px; align-content: center; font-weight: 600; overflow-wrap: anywhere; }
.research-flow[open] > summary { margin-bottom: 0.5rem; }
.research-flow .input-count { margin: 0 0 0.75rem; font-size: 0.85rem; }
.result-filters { margin-bottom: 0.75rem; }
.result-filters[open] > summary { margin-bottom: 0.5rem; }
.completion-notice { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; }
.completion-notice .primary-button { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; white-space: nowrap; }
#search-volume-results { scroll-margin-top: 6rem; }
#search-volume-results .muted { font-size: 0.85rem; font-weight: 400; }
.read-only-notice { padding: 0.2rem 0.75rem; }
.read-only-notice[open] { padding-bottom: 0.75rem; }

@media (max-width: 920px) {
    html { scroll-padding-bottom: calc(5rem + env(safe-area-inset-bottom)); }
    .page-header, .compact-heading { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
    .page-header > div:first-child, .compact-heading > h2 { flex: 1; }
    .page-header > .toolbar { flex-direction: row; flex: 0 0 auto; }
    .page-header > button, .compact-heading > button { flex-shrink: 0; }
    .page-header .project-context { display: none; }
    .page-header h1 { overflow-wrap: anywhere; }
    #search-volume-results { scroll-margin-top: 0.75rem; }
}
@media (max-width: 560px) {
    .desktop-table-hint { display: none; }
    .data-table.mobile-cards { display: block; width: 100%; min-width: 0; }
    .mobile-cards thead { display: none; }
    .mobile-cards tbody { display: block; }
    .mobile-cards tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem 1rem; padding: 0.85rem; border: 1px solid #d7dde6; border-radius: 8px; background: white; }
    .mobile-cards tr + tr { margin-top: 0.75rem; }
    .data-table.mobile-cards td { display: block; padding: 0; border: 0; white-space: normal; min-width: 0; text-align: left; }
    .data-table.mobile-cards .card-secondary { display: none; }
    .mobile-cards .card-title { grid-column: 1 / -1; font-size: 1rem; font-weight: 600; overflow-wrap: anywhere; }
    .mobile-cards .card-metric::before { content: attr(data-label); display: block; color: #5a6575; font-size: 0.75rem; margin-bottom: 0.15rem; }
    .mobile-cards .card-metric { font-size: 1rem; }
    .mobile-cards .mobile-card-details, .mobile-cards .actions-column { grid-column: 1 / -1; }
    .mobile-cards summary { min-height: 44px; align-content: center; cursor: pointer; color: var(--accent); font-weight: 600; }
    .mobile-cards dl { margin: 0; }
    .mobile-cards dl > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 0.5rem; padding-block: 0.4rem; border-top: 1px solid #edf0f4; }
    .mobile-cards dt { color: #5a6575; }
    .mobile-cards dd { margin: 0; overflow-wrap: anywhere; }
    .mobile-cards .table-action, .mobile-cards .audit-link { min-height: 44px; display: inline-flex; align-items: center; }
    .research-flow { padding: 0.75rem; }
    .result-filters { font-size: 0.9rem; }
}

/* The guest landing connects the available sample screens into a short walkthrough. */
.demo-walkthrough { padding: 1.5rem; border: 1px solid #d9dff0; border-radius: 16px; background: linear-gradient(125deg, #f0f4ff, #fbfaff); }
.demo-intro { display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; }
.demo-eyebrow { color: #475d96; font-size: .72rem; font-weight: 700; letter-spacing: .12em; }
.demo-intro h2 { margin: .5rem 0; font-size: 1.45rem; line-height: 1.5; color: #1d3159; }
.demo-intro p, .demo-note { color: #58657c; line-height: 1.7; }
.demo-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; list-style: none; margin: 1.25rem 0; padding: 0; }
.demo-steps li { min-width: 0; }
.demo-steps a { height: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: .6rem; padding: 1rem; border: 1px solid #dfe5f0; border-radius: 12px; background: white; color: #263650; text-decoration: none; box-sizing: border-box; }
.demo-steps a:hover { border-color: #7285ba; box-shadow: 0 5px 18px #283c6410; }
.demo-steps a:focus-visible { outline: 3px solid #475d96; outline-offset: 3px; }
.demo-step-number { color: #556cb0; font-size: .82rem; font-weight: 700; letter-spacing: .12em; }
.demo-steps strong { font-size: 1.05rem; }
.demo-steps a > span:not(.demo-step-number):not(.demo-step-action) { color: #5c697c; font-size: .88rem; line-height: 1.7; }
.demo-step-action { margin-top: auto; color: #3a5595; font-size: .84rem; font-weight: 600; }
.demo-note { margin: 0; font-size: .78rem; }
.reason-summary { padding-top: 1rem; line-height: 1.8; }
.json-preview { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .85rem; max-width: 100%; }
.guest-login-feature { padding: 1.2rem; border: 1px solid #d9dff0; border-radius: 12px; background: #f3f6ff; margin: 1.25rem 0; }
.guest-login-feature h2 { margin-top: 0; font-size: 1.1rem; }
@media (max-width: 760px) {
    .demo-walkthrough { padding: 1rem; }
    .demo-intro { align-items: flex-start; flex-direction: column; }
    .demo-intro h2 { font-size: 1.2rem; }
    .demo-steps { grid-template-columns: 1fr; gap: .75rem; }
}
.metric-guide { margin-bottom: 1rem; }
.metric-definitions { margin-bottom: 0; }
.metric-definitions > div { display: grid; grid-template-columns: minmax(8rem, .8fr) 3fr; gap: 1rem; padding-block: .6rem; border-top: 1px solid #e4e8f0; }
.metric-definitions dt { font-weight: 600; }
.metric-definitions dd { margin: 0; color: #58657c; line-height: 1.7; }
.monthly-detail summary { cursor: pointer; color: var(--accent); white-space: nowrap; }
.monthly-detail dl { min-width: 12rem; }
.monthly-detail dl > div { display: flex; justify-content: space-between; gap: 1rem; line-height: 1.8; }
.monthly-detail dd { margin: 0; }
@media (max-width: 560px) { .metric-definitions > div { grid-template-columns: 1fr; gap: .3rem; } }
