.app-main:has(.statement-adjustments) { overflow-x: clip; overflow-y: visible; }

.statement-adjustments {
    color: var(--text);
    width: 100%;
    min-width: 0;
    font-size: 14px;
    line-height: 1.5;
    letter-spacing: 0;
}

.statement-adjustments h1,
.statement-adjustments h2,
.statement-adjustments h3 { margin: 0; color: var(--text); }
.statement-adjustments h1 { font-size: 28px; font-weight: 750; line-height: 1.25; }
.statement-adjustments h2 { font-size: 18px; font-weight: 700; }
.statement-adjustments h3 { margin: 24px 0 16px; font-size: 14px; font-weight: 700; }

.adjustment-heading,
.adjustment-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.adjustment-heading { padding: 16px 0 24px; flex-wrap: wrap; }
.adjustment-heading > div { min-width: 0; }
.adjustment-heading h1 { overflow-wrap: anywhere; }
.adjustment-kicker { margin: 0 0 6px; font-size: 12px; font-weight: 700; color: var(--primary-strong); }

.adjustment-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
    padding: 20px 24px;
    background: var(--surface);
    border-block: 1px solid var(--line-soft);
}
.adjustment-period { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px; }
.adjustment-period label { width: 190px; }
.statement-adjustments label { display: flex; flex-direction: column; gap: 8px; min-width: 0; font-size: 12px; font-weight: 650; color: var(--muted); }
.statement-adjustments input,
.statement-adjustments select,
.statement-adjustments textarea {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    font: inherit;
    font-size: 14px;
    font-weight: 400;
    background: var(--surface);
    color: var(--text);
}
.statement-adjustments textarea { resize: vertical; }
.statement-adjustments input:focus,
.statement-adjustments select:focus,
.statement-adjustments textarea:focus { outline: 2px solid #dbeafe; outline-offset: 1px; border-color: var(--primary); }
.statement-adjustments button,
.adjustment-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 18px;
    border-radius: 8px;
    font: inherit;
    font-weight: 650;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.adjustment-primary { background: var(--primary); color: #fff; border: 1px solid var(--primary); }
.adjustment-primary:hover { background: var(--primary-strong); border-color: var(--primary-strong); }
.adjustment-primary:disabled { background: var(--line-soft); border-color: var(--line); color: var(--muted); cursor: not-allowed; }
.adjustment-link { border: 1px solid var(--line); background: var(--surface); color: var(--primary-strong); }
.adjustment-link:hover { background: #eff6ff; border-color: #bfdbfe; }
.adjustment-cancel { border: 1px solid #fecaca; color: #b91c1c; background: #fff; }
.adjustment-cancel:hover { background: #fef2f2; }
.statement-adjustments button:focus-visible,
.statement-adjustments a:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }

.adjustment-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 24px 0; }
.adjustment-metric { min-width: 0; padding: 18px; background: var(--surface); border: 1px solid var(--line-soft); border-top: 3px solid #93c5fd; border-radius: 8px; }
.metric-surplus { border-top-color: #6ee7b7; }
.metric-net { border-top-color: #67e8f9; }
.metric-difference { border-top-color: #fcd34d; }
.adjustment-summary span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.adjustment-summary strong { display: block; font-size: 16px; font-weight: 750; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.adjustment-warning { color: #b91c1c !important; }

.adjustment-form-section,
.adjustment-review,
.adjustment-register { margin-top: 24px; background: var(--surface); border-block: 1px solid var(--line-soft); }
.adjustment-section-heading { padding: 18px 24px; border-bottom: 1px solid var(--line-soft); }
.adjustment-section-heading h2 { min-width: 0; overflow-wrap: anywhere; }
.adjustment-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 24px; padding: 24px; }
.adjustment-wide { grid-column: 1 / -1; }
.adjustment-form-footer { padding-top: 20px; border-top: 1px solid var(--line-soft); }
.statement-adjustments output { display: block; padding: 10px 12px; min-height: 44px; background: var(--surface-muted); border: 1px solid var(--line); border-radius: 8px; font-size: 14px; color: var(--text); font-weight: 650; overflow-wrap: anywhere; }

.adjustment-review { scroll-margin-top: 100px; padding-bottom: 8px; }
.adjustment-review-values { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--line-soft); }
.adjustment-review-values dt { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.adjustment-review-values dd { margin: 0; color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.adjustment-evidence { margin: 12px 24px; overflow-wrap: anywhere; line-height: 1.7; }
.adjustment-evidence strong { display: inline-block; min-width: 110px; color: var(--muted); font-size: 12px; font-weight: 650; }
.adjustment-reference-detail span { display: block; white-space: pre-line; }
.adjustment-origin { color: var(--muted); font-size: 12px; }
.adjustment-reference { margin-top: 8px; font-size: 12px; }
.adjustment-reference summary { color: var(--primary-strong); cursor: pointer; }
.adjustment-reference p { margin-top: 8px; white-space: pre-line; overflow-wrap: anywhere; }
.adjustment-review > .adjustment-warning { margin: 16px 24px; }
.adjustment-review > .adjustment-table-scroll { margin: 24px; max-width: calc(100% - 48px); border: 1px solid var(--line-soft); border-radius: 8px; }
.adjustment-decision { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 16px; margin: 24px; }
.adjustment-decision label { flex: 1; min-width: 180px; }
.adjustment-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.adjustment-review > h3 { margin-inline: 24px; }
.adjustment-history { margin: 0 24px 16px 30px; border-left: 2px solid #bfdbfe; padding-left: 20px; }
.adjustment-history li { padding: 0 0 20px; list-style: none; overflow-wrap: anywhere; }
.adjustment-history strong { font-size: 13px; }
.adjustment-history span { display: block; margin: 4px 0; font-size: 12px; color: var(--muted); }
.adjustment-history p { margin: 6px 0 0; font-size: 13px; line-height: 1.6; }

.adjustment-table-scroll { overflow-x: auto; width: 100%; min-width: 0; max-width: 100%; }
.statement-adjustments table { border-collapse: collapse; width: 100%; min-width: 680px; font-size: 13px; }
.statement-adjustments th { background: var(--surface-muted); color: var(--muted); font-size: 11px; font-weight: 700; text-align: left; }
.statement-adjustments td,
.statement-adjustments th { padding: 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.statement-adjustments th:first-child,
.statement-adjustments td:first-child { padding-left: 24px; }
.statement-adjustments td:first-child { min-width: 170px; max-width: 320px; overflow-wrap: anywhere; }
.statement-adjustments tr:last-child td { border-bottom: 0; }
.statement-adjustments tbody tr:hover { background: #f8fbff; }
.statement-adjustments .number { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.statement-adjustments small { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; max-width: 250px; overflow-wrap: anywhere; }
.statement-adjustments td a { display: inline-flex; align-items: center; justify-content: center; min-height: 34px; padding: 6px 12px; color: var(--primary-strong); border: 1px solid #bfdbfe; border-radius: 6px; background: #eff6ff; font-size: 12px; font-weight: 650; text-decoration: none; }
.statement-adjustments td a:hover { background: #dbeafe; }
.adjustment-status,
.adjustment-period-badge { display: inline-block; border-radius: 6px; font-size: 11px; font-weight: 650; padding: 5px 9px; white-space: nowrap; }
.adjustment-period-badge { color: var(--muted); background: var(--surface-muted); border: 1px solid var(--line-soft); }
.status-draft { background: #fffbeb; color: #92400e; }
.status-approved { background: #ecfdf5; color: #047857; }
.status-cancelled { background: #fef2f2; color: #b91c1c; }
.adjustment-empty { text-align: center !important; padding: 40px !important; color: var(--muted); }

@media (max-width: 1100px) {
    .adjustment-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
    .statement-adjustments h1 { font-size: 24px; }
    .statement-adjustments h2 { font-size: 16px; }
    .adjustment-toolbar { align-items: flex-start; padding: 20px 16px; gap: 16px; }
    .adjustment-period { width: 100%; }
    .adjustment-period label { flex: 1; min-width: 0; width: auto; }
    .adjustment-summary { gap: 12px; }
    .adjustment-metric { padding: 14px; }
    .adjustment-summary strong { font-size: 14px; }
    .adjustment-form { grid-template-columns: 1fr; padding: 20px 16px; }
    .adjustment-wide { grid-column: auto; }
    .adjustment-section-heading { padding: 16px; }
    .adjustment-review-values { grid-template-columns: 1fr; gap: 14px; margin: 20px 16px; }
    .adjustment-evidence { margin-inline: 16px; }
    .adjustment-evidence strong { display: block; }
    .adjustment-review > .adjustment-table-scroll { margin: 20px 16px; max-width: calc(100% - 32px); }
    .adjustment-decision { margin: 20px 16px; }
    .adjustment-decision label { min-width: 100%; }
    .adjustment-actions { width: 100%; }
    .adjustment-actions button { flex: 1; }
    .adjustment-review > h3 { margin-inline: 16px; }
    .adjustment-history { margin-inline: 22px 16px; }
}
