@font-face {
    font-family: "Manrope";
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url("../fonts/manrope-latin-200-800.101877a7a906.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Manrope";
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url("../fonts/manrope-latin-ext-200-800.623714ac1d99.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
    color-scheme: light;
    --bg: #f6f7f4;
    --surface: #ffffff;
    --surface-soft: #edf7f4;
    --ink: #172026;
    --muted: #64707a;
    --line: #d8dfdf;
    --primary: #0f766e;
    --primary-dark: #115e59;
    --accent: #b7791f;
    --danger: #b42318;
    --warning: #a15c07;
    --success: #237347;
    --shadow: 0 12px 40px rgba(23, 32, 38, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: "Manrope", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
textarea {
    font: inherit;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 72px;
    padding: 0 32px;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(12px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--primary);
    color: white;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 18px;
    color: var(--muted);
    font-weight: 700;
}

.nav-actions form {
    margin: 0;
}

.link-button {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-weight: 700;
}

.page-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 34px 0 64px;
}

.workspace-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}

.split-header {
    align-items: center;
}

.workspace-header h1,
.auth-copy h1 {
    margin: 0;
    font-size: 34px;
    line-height: 1.1;
    letter-spacing: 0;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--primary-dark);
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}

.upload-panel,
.summary-band,
.progress-panel,
.chat-section,
.finding-section,
.structure-section,
.position-section,
.job-section,
.form-panel,
.related-panel,
.auth-form {
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.upload-panel,
.summary-band,
.progress-panel,
.chat-section,
.finding-section,
.structure-section,
.position-section,
.form-panel,
.related-panel {
    margin-bottom: 24px;
}

.upload-form {
    display: grid;
    gap: 18px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

label,
.form-grid label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-weight: 700;
}

.full-field {
    grid-column: 1 / -1;
}

.field {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
}

.field:focus {
    outline: 3px solid rgba(15, 118, 110, 0.18);
    border-color: var(--primary);
}

.file-field {
    padding: 8px;
}

.compact-field {
    min-width: 0;
}

small {
    color: var(--muted);
    font-weight: 500;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 800;
    white-space: nowrap;
}

.primary-button {
    background: var(--primary);
    color: white;
}

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

.secondary-button,
.small-button {
    background: white;
    color: var(--ink);
    border-color: var(--line);
}

.danger-button {
    background: white;
    color: var(--danger);
    border-color: #fac5bd;
}

.danger-button:hover {
    background: #fff0ed;
}

.small-button {
    min-height: 36px;
    padding: 8px 12px;
}

.document-list {
    display: grid;
    gap: 14px;
}

.document-card,
.resource-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.document-card h2,
.resource-card h2 {
    margin: 0 0 4px;
    font-size: 19px;
}

.document-card p,
.resource-card p {
    margin: 0;
    color: var(--muted);
}

.document-meta,
.resource-meta,
.header-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.resource-list {
    display: grid;
    gap: 14px;
}

.resource-main {
    min-width: 0;
}

.resource-main h2,
.resource-main p {
    overflow-wrap: anywhere;
}

.resource-meta {
    color: var(--muted);
    font-size: 14px;
    font-weight: 750;
}

.management-form {
    display: grid;
    gap: 18px;
}

.boolean-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.inline-check {
    display: inline-flex;
    width: max-content;
    max-width: 100%;
    min-height: 42px;
    align-items: center;
    gap: 9px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fbfa;
    color: var(--ink);
}

.toggle-field {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
    gap: 24px;
    align-items: start;
}

.related-panel {
    display: grid;
    gap: 12px;
}

.related-list {
    display: grid;
    gap: 10px;
}

.related-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.related-item strong,
.related-item small {
    display: block;
}

.related-item strong {
    overflow-wrap: anywhere;
}

.related-item small {
    margin-top: 2px;
    color: var(--muted);
}

.compact-empty {
    padding: 20px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 5px 10px;
    border-radius: 999px;
    background: #e7edf0;
    color: #334155;
    font-size: 13px;
    font-weight: 800;
}

.status-completed,
.status-succeeded {
    background: #dff3e7;
    color: var(--success);
}

.status-failed,
.status-cancelled,
.severity-critical {
    background: #fde8e6;
    color: var(--danger);
}

.status-stopped,
.status-paused {
    background: #f1f5f9;
    color: #475569;
}

.status-needs_input,
.status-review,
.status-warning,
.severity-warning {
    background: #fff4da;
    color: var(--warning);
}

.status-analyzing,
.status-calculating,
.status-running,
.status-queued,
.status-pending,
.status-uploaded,
.status-extracting {
    background: var(--surface-soft);
    color: var(--primary-dark);
}

.empty-state {
    padding: 28px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.68);
    text-align: center;
}

.empty-state h2,
.summary-band h2,
.progress-panel h2,
.chat-section h2,
.finding-section h2,
.structure-section h2,
.position-section h2,
.job-section h2 {
    margin: 0 0 12px;
    font-size: 21px;
}

.empty-state p,
.summary-band p,
.finding-item p {
    margin: 0;
    color: var(--muted);
}

.finding-section {
    display: grid;
    gap: 14px;
}

.finding-item {
    display: grid;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.recommendation {
    padding: 10px 12px;
    background: var(--surface-soft);
    border-radius: 8px;
}

.hidden {
    display: none;
}

.header-subline {
    margin: 10px 0 0;
    color: var(--muted);
    font-weight: 700;
}

.progress-panel {
    display: grid;
    gap: 12px;
}

.progress-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.progress-heading h2,
.progress-panel p {
    margin: 0;
}

.progress-track {
    width: 100%;
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: #e7edf0;
}

.progress-fill {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: var(--primary);
    transition: width 0.3s ease;
}

.progress-details summary {
    width: max-content;
    color: var(--primary-dark);
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
    list-style: none;
}

.progress-details summary::-webkit-details-marker {
    display: none;
}

.progress-details summary::before {
    content: "+";
    display: inline-grid;
    place-items: center;
    width: 20px;
    height: 20px;
    margin-right: 7px;
    border: 1px solid #b7cac4;
    border-radius: 999px;
    color: var(--primary-dark);
}

.progress-details[open] summary::before {
    content: "-";
    background: var(--primary);
    color: white;
}

.progress-events {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.progress-event {
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr);
    gap: 10px;
    padding: 9px 0;
    border-top: 1px solid var(--line);
}

.progress-event span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.progress-event p {
    margin: 0;
    color: var(--ink);
}

.chat-section {
    display: grid;
    gap: 16px;
    margin-bottom: 24px;
}

.chat-list {
    display: grid;
    gap: 12px;
}

.chat-message {
    max-width: min(760px, 100%);
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
}

.chat-date-divider {
    display: flex;
    justify-content: center;
    margin: 2px 0;
}

.chat-date-divider span {
    padding: 5px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.82);
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
}

.chat-message p {
    margin: 6px 0 0;
    color: var(--ink);
    white-space: pre-line;
}

.chat-time {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    text-align: right;
}

.chat-open-questions {
    border-color: #f2c46d;
    background: #fffaf0;
}

.chat-question-list {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.chat-question-list > div {
    padding: 10px 12px;
    border: 1px solid #f2dfb7;
    border-radius: 8px;
    background: white;
}

.chat-question-list p {
    margin: 4px 0 0;
    color: var(--muted);
}

.chat-live-output {
    border-color: #b7cac4;
    background: #f8fbfa;
}

.chat-live-events {
    display: grid;
    gap: 4px;
    margin-top: 10px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
}

.chat-cli-output {
    max-height: 260px;
    margin: 10px 0 0;
    padding: 10px 12px;
    overflow: auto;
    border: 1px solid #c8d8d3;
    border-radius: 8px;
    background: #10201e;
    color: #e9fff8;
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    line-height: 1.45;
    white-space: pre-wrap;
}

.chat-live-empty {
    color: var(--muted);
    font-size: 13px;
}

.chat-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.chat-attachments a {
    display: inline-flex;
    max-width: 240px;
    min-height: 28px;
    align-items: center;
    padding: 4px 8px;
    overflow: hidden;
    border: 1px solid #c8d8d3;
    border-radius: 999px;
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-user {
    justify-self: end;
    background: var(--surface-soft);
}

.chat-assistant,
.chat-system {
    justify-self: start;
}

.chat-form {
    display: grid;
    gap: 10px;
}

.chat-input {
    resize: vertical;
}

.upload-dropzone {
    display: grid;
    gap: 8px;
    padding: 14px;
    border: 1px dashed #b7cac4;
    border-radius: 8px;
    background: #f8fbfa;
    color: var(--primary-dark);
    cursor: pointer;
    font-size: 14px;
    font-weight: 800;
}

.upload-dropzone input {
    width: 100%;
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
}

.chat-file-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chat-file-list span {
    display: inline-flex;
    max-width: 260px;
    min-height: 28px;
    align-items: center;
    padding: 4px 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #eef6f3;
    color: #36514a;
    font-size: 12px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.section-heading span {
    color: var(--muted);
    font-weight: 800;
}

.structure-details summary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: var(--primary-dark);
    cursor: pointer;
    font-size: 14px;
    font-weight: 800;
}

.structure-list {
    display: grid;
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--line);
}

.structure-row {
    display: grid;
    grid-template-columns: 126px 120px minmax(220px, 1fr) 160px;
    gap: 10px;
    align-items: center;
    min-width: 720px;
    padding: 8px 10px;
    background: white;
    font-size: 13px;
}

.structure-row + .structure-row {
    border-top: 1px solid var(--line);
}

.structure-level-1 {
    padding-left: 18px;
}

.structure-level-2 {
    padding-left: 30px;
}

.structure-level-3 {
    padding-left: 42px;
}

.structure-level-4 {
    padding-left: 54px;
}

.structure-level-5,
.structure-level-6 {
    padding-left: 66px;
}

.structure-type {
    width: max-content;
    max-width: 100%;
    padding: 3px 7px;
    overflow: hidden;
    border-radius: 999px;
    background: #eef6f3;
    color: #36514a;
    font-size: 11px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.structure-code {
    color: var(--muted);
    font-weight: 800;
}

.structure-amount {
    justify-self: end;
    color: var(--ink);
    font-weight: 900;
    white-space: nowrap;
}

.structure-subtotal,
.structure-total,
.structure-summary {
    background: #f8fbfa;
}

.structure-total {
    color: var(--primary-dark);
}

.position-table-shell {
    display: grid;
    gap: 8px;
}

.position-scrollbar {
    display: none;
    height: 14px;
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8faf9;
}

.position-table-shell.is-scrollable .position-scrollbar {
    display: block;
}

.position-scrollbar > div {
    height: 1px;
}

.position-table {
    display: grid;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--line);
}

.position-row {
    display: grid;
    grid-template-columns: 132px minmax(250px, 2fr) 154px 158px 128px 172px;
    gap: 10px;
    align-items: start;
    min-width: 1024px;
    margin: 0;
    padding: 9px 10px;
    background: white;
    transition: background 180ms ease, box-shadow 180ms ease;
}

.position-row + .position-row {
    border-top: 1px solid var(--line);
}

.position-row.is-saving {
    box-shadow: inset 3px 0 var(--accent);
}

.position-row.is-saved {
    animation: saved-row 1400ms ease;
}

.position-row.is-error {
    box-shadow: inset 3px 0 var(--danger);
}

.position-head {
    align-items: center;
    background: #e8efed;
    color: #526068;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.position-row > span {
    min-width: 0;
}

.position-row strong,
.position-row small {
    display: block;
}

.position-row strong {
    color: var(--ink);
    font-size: 14px;
    line-height: 1.25;
}

.position-ref {
    display: grid;
    gap: 4px;
}

.page-link {
    width: max-content;
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.position-title-cell {
    display: grid;
    gap: 6px;
    align-items: start;
}

.position-title-cell strong {
    overflow-wrap: anywhere;
}

.position-description {
    position: relative;
}

.position-description summary {
    display: inline-flex;
    width: max-content;
    min-height: 26px;
    align-items: center;
    gap: 6px;
    padding: 3px 8px 3px 5px;
    border: 1px solid #c8d8d3;
    border-radius: 999px;
    background: #f8faf9;
    color: var(--primary-dark);
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    list-style: none;
}

.details-icon {
    display: grid;
    place-items: center;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: #e4f1ed;
    color: var(--primary-dark);
    font-size: 13px;
    line-height: 1;
}

.details-icon::before {
    content: "+";
}

.position-description summary::-webkit-details-marker,
.price-history summary::-webkit-details-marker {
    display: none;
}

.position-description[open] summary,
.position-description[open] .details-icon {
    background: var(--primary);
    color: white;
}

.position-description[open] .details-icon::before {
    content: "-";
}

.position-description p {
    margin: 8px 0 0;
    padding: 10px 12px;
    border: 1px solid #dbe7e3;
    border-radius: 8px;
    background: #f8fbfa;
    color: #46535c;
    font-size: 13px;
    line-height: 1.45;
}

.position-table .field {
    min-height: 34px;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 14px;
}

.inline-fields {
    display: grid;
    grid-template-columns: minmax(84px, 1fr) 56px;
    gap: 6px;
}

.unit-field {
    text-align: center;
}

.price-cell {
    display: grid;
    gap: 5px;
    align-content: start;
    justify-items: start;
    min-width: 0;
}

.price-input-line {
    display: block;
}

.price-tooltip {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 30;
    display: none;
    width: min(340px, 82vw);
    gap: 6px;
    padding: 10px 12px;
    border: 1px solid #c9d8d4;
    border-radius: 8px;
    background: #10201e;
    color: white;
    box-shadow: var(--shadow);
    font-size: 12px;
    font-weight: 650;
    line-height: 1.35;
    text-align: left;
    white-space: normal;
}

.price-tooltip strong {
    display: block;
    color: white;
    font-size: 12px;
    line-height: 1.35;
}

.price-tooltip a {
    color: #a7f3d0;
    overflow-wrap: anywhere;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.price-origin-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-width: 0;
    align-items: center;
}

.price-origin {
    position: relative;
    display: inline-flex;
    max-width: 100%;
    min-height: 24px;
    align-items: center;
    gap: 5px;
    padding: 2px 7px 2px 3px;
    overflow: visible;
    border: 1px solid #c8d8d3;
    border-radius: 999px;
    background: #f8fbfa;
    color: #2e4740;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.price-origin-web {
    cursor: help;
}

.price-origin-icon {
    display: block;
    width: 18px;
    height: 18px;
    padding: 2px;
    border-radius: 999px;
    background: #dcefeb;
}

.price-origin-web .price-origin-icon {
    background: #fff3d6;
    color: #875111;
}

.price-origin-web:hover .price-origin-tooltip,
.price-origin-web:focus-within .price-origin-tooltip {
    display: grid;
}

.total-price {
    color: #20313a;
    font-size: 14px;
    font-weight: 800;
}

.price-history {
    width: 100%;
    min-width: 0;
    font-size: 12px;
}

.price-history.is-empty {
    display: none;
}

.price-history summary {
    width: max-content;
    max-width: 100%;
    color: var(--muted);
    cursor: pointer;
    font-weight: 800;
    list-style: none;
    white-space: nowrap;
}

.price-history-list {
    display: grid;
    gap: 8px;
    width: max-content;
    max-width: 100%;
    min-width: min(250px, 100%);
    margin-top: 6px;
}

.price-history-entry {
    display: grid;
    gap: 3px;
    padding: 7px 8px;
    border: 1px solid #d8e6e2;
    border-radius: 8px;
    background: #fff;
}

.price-history-time {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.2;
}

.price-history-change {
    display: inline-flex;
    max-width: 100%;
    gap: 5px;
    align-items: baseline;
    overflow-x: auto;
    color: #20313a;
    font-size: 12px;
    font-weight: 750;
    line-height: 1.25;
    white-space: nowrap;
}

.price-history-change strong {
    color: var(--primary-dark);
    font-size: inherit;
    font-weight: 800;
}

.row-actions {
    position: relative;
    display: flex;
    min-height: 100%;
    align-self: start;
    align-items: flex-start;
    justify-content: center;
}

.review-warning {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.review-warning.is-hidden,
.review-ok.is-hidden {
    display: none;
}

.review-warning-button {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    margin: 0;
    padding: 0;
    border: 1px solid #f2c46d;
    border-radius: 999px;
    background: #fff7df;
    cursor: help;
}

.review-warning-button svg {
    display: block;
    width: 18px;
    height: 18px;
    fill: var(--warning);
}

.review-tooltip {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 35;
    display: none;
    width: min(320px, 76vw);
    gap: 6px;
    padding: 10px 12px;
    border: 1px solid #f2c46d;
    border-radius: 8px;
    background: #1f1710;
    color: white;
    box-shadow: var(--shadow);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
    text-align: left;
}

.review-warning:hover .review-tooltip,
.review-warning:focus-within .review-tooltip {
    display: grid;
}

.review-ok {
    color: var(--muted);
    font-weight: 800;
}

.autosave-status {
    position: absolute;
    right: 0;
    bottom: -2px;
    left: 0;
    min-height: 17px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-align: center;
}

@keyframes saved-row {
    0% {
        background: #dff3e7;
    }

    100% {
        background: white;
    }
}

.job-list {
    display: grid;
    gap: 8px;
}

.job-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.job-item:last-child {
    border-bottom: 0;
}

.auth-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
    gap: 44px;
    align-items: center;
    min-height: calc(100vh - 180px);
}

.auth-copy p:last-child {
    max-width: 560px;
    color: var(--muted);
}

.auth-form {
    display: grid;
    gap: 16px;
}

.auth-form input {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.form-errors,
.errorlist {
    margin: 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: #fde8e6;
    color: var(--danger);
}

.message-stack {
    width: min(1180px, calc(100% - 32px));
    margin: 18px auto 0;
    display: grid;
    gap: 10px;
}

.message {
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: white;
    font-weight: 700;
}

.message.success {
    border-color: #b9e4c8;
    background: #eaf8ef;
}

.message.error {
    border-color: #fac5bd;
    background: #fff0ed;
}

@media (max-width: 780px) {
    .topbar,
    .workspace-header,
    .document-card,
    .resource-card,
    .auth-layout {
        align-items: stretch;
        flex-direction: column;
    }

    .topbar {
        padding: 16px;
    }

    .nav-actions,
    .document-meta,
    .resource-meta,
    .header-actions {
        justify-content: flex-start;
    }

    .workspace-header,
    .detail-grid,
    .auth-layout {
        display: grid;
        gap: 18px;
    }

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

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

    .workspace-header h1,
    .auth-copy h1 {
        font-size: 30px;
    }

    .upload-panel,
    .summary-band,
    .progress-panel,
    .chat-section,
    .finding-section,
    .position-section,
    .job-section,
    .form-panel,
    .related-panel,
    .auth-form {
        padding: 18px;
    }

    .related-item {
        grid-template-columns: 1fr;
    }

    .job-item {
        grid-template-columns: 1fr;
    }
}
