/* Shared, progressive controls for interactive article worksheets. */
.article-prose .kk-worksheet-toolbar {
    margin-block: 1.5rem;
    padding: 1rem 1.2rem;
    border: 1px solid color-mix(in srgb, currentColor 30%, transparent);
    border-radius: .7rem;
    background: color-mix(in srgb, currentColor 6%, transparent);
    font-size: .9rem;
    line-height: 1.5;
}
.article-prose .kk-worksheet-toolbar p { margin: 0; }
.article-prose .kk-worksheet-privacy { font-weight: 700; }
.article-prose .kk-worksheet-status { margin-top: .4rem; font-size: .82rem; }
.article-prose .kk-worksheet-actions { display: flex; align-items: end; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.article-prose .kk-worksheet-input {
    display: block;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    min-height: 2.5rem;
    padding: .45rem .55rem;
    border: 1px solid color-mix(in srgb, currentColor 45%, transparent);
    border-radius: .4rem;
    background: color-mix(in srgb, currentColor 5%, transparent);
    color: inherit;
    font: inherit;
    font-size: .92rem;
    line-height: 1.4;
}
.article-prose .kk-worksheet-input::placeholder { color: currentColor; opacity: .55; }
.article-prose .kk-worksheet-input[aria-invalid="true"] { border-width: 2px; border-style: dashed; }
.article-prose .kk-worksheet-input:focus-visible,
.article-prose .kk-worksheet-button:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.article-prose .kk-worksheet-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.5rem;
    padding: .45rem .7rem;
    border: 1px solid color-mix(in srgb, currentColor 45%, transparent);
    border-radius: .4rem;
    background: color-mix(in srgb, currentColor 8%, transparent);
    color: inherit;
    font: inherit;
    font-size: .85rem;
    font-weight: 700;
    line-height: 1.3;
    cursor: pointer;
}
.article-prose .kk-worksheet-button:hover { background: color-mix(in srgb, currentColor 15%, transparent); }
.article-prose .kk-worksheet-button:disabled { opacity: .5; cursor: default; }
.article-prose .kk-worksheet-confirm { margin-top: 1rem; padding-top: .75rem; border-top: 1px solid color-mix(in srgb, currentColor 25%, transparent); }
.article-prose .kk-worksheet-confirm[hidden],
.article-prose .kk-worksheet-file[hidden],
.article-prose .kk-worksheet-result[hidden] { display: none; }
.article-prose .kk-worksheet-confirm p { margin-bottom: .55rem; }
.article-prose .kk-worksheet-confirm button + button { margin-left: .5rem; }
.article-prose .kk-worksheet-hint { margin-block: .4rem 1rem; font-size: .82rem; line-height: 1.5; opacity: .85; }
.article-prose .kk-worksheet-result { margin-block: 1rem 0; font-size: .88rem; font-weight: 700; line-height: 1.5; }
.article-prose .kk-entry > span:last-child { flex: 0 1 15rem; min-width: 9rem; white-space: normal; }
.article-prose .kk-entry .kk-worksheet-input { text-align: right; }
.article-prose .kk-budget-row > span:nth-child(2),
.article-prose .kk-budget-row > span:nth-child(3) { min-width: 0; }
.article-prose .kk-budget-row .kk-worksheet-input { min-height: 2.3rem; padding-inline: .35rem; text-align: right; font-variant-numeric: tabular-nums; }
.article-prose .kk-budget-total > span { white-space: normal; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.article-prose .kk-comparison-overview { display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin-bottom: 1rem; font-size: .9rem; font-weight: 700; }
.article-prose .kk-comparison-overview p { margin: 0; }
.article-prose .kk-comparison-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.article-prose .kk-comparison-card { min-width: 0; padding: 1rem; border: 1px solid color-mix(in srgb, currentColor 30%, transparent); border-radius: .6rem; }
.article-prose .kk-comparison-card legend { padding-inline: .3rem; font-weight: 750; }
.article-prose .kk-comparison-field { display: grid; gap: .3rem; margin-block: 0 1rem; font-size: .82rem; line-height: 1.45; }
.article-prose .kk-comparison-field textarea { min-height: 4.5rem; resize: vertical; }
.article-prose .kk-comparison > .kk-worksheet-button { margin-top: 1rem; }
@media (max-width: 639px) {
    .article-prose .kk-comparison-cards { grid-template-columns: minmax(0, 1fr); }
    .article-prose .kk-worksheet-actions { align-items: stretch; }
}
@media (max-width: 480px) {
    .article-prose .kk-worksheet-toolbar { padding: 1rem; }
    .article-prose .kk-entry { align-items: stretch; flex-direction: column; }
    .article-prose .kk-entry > span:last-child { flex: none; width: 100%; min-width: 0; }
    .article-prose .kk-budget-head { display: none; }
    .article-prose .kk-budget-row,
    .article-prose .kk-budget-total { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .25rem .6rem; }
    .article-prose .kk-budget-row > span:first-child,
    .article-prose .kk-budget-total > span:first-child { grid-column: 1 / -1; }
    .article-prose .kk-budget-row > span:nth-child(2)::before,
    .article-prose .kk-budget-total > span:nth-child(2)::before { content: 'Planned'; display: block; font-size: .72rem; font-weight: 700; text-align: left; }
    .article-prose .kk-budget-row > span:nth-child(3)::before,
    .article-prose .kk-budget-total > span:nth-child(3)::before { content: 'Actual'; display: block; font-size: .72rem; font-weight: 700; text-align: left; }
}
@media print {
    .article-prose .kk-worksheet-toolbar,
    .article-prose .kk-comparison > .kk-worksheet-button,
    .article-prose .kk-comparison-card > .kk-worksheet-button { display: none; }
    .article-prose .kk-worksheet-input { background: transparent; color: inherit; }
    .article-prose .kk-comparison-card { break-inside: avoid; }
}
