.fx-h-layout {
    display: grid;
    grid-template-columns: clamp(265px, var(--fx-h-pane-width, 300px), min(520px, 45%)) 1.25rem minmax(0, 1fr);
    align-items: start;
    row-gap: 1.25rem;
}

.fx-h-resize {
    position: relative;
    align-self: stretch;
    cursor: col-resize;
    touch-action: none;
    user-select: none;
}

.fx-h-resize::before,
.fx-h-resize::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.fx-h-resize::before {
    top: .85rem;
    bottom: .85rem;
    width: 1px;
    background: var(--color-line, #ddd6cb);
}

.fx-h-resize::after {
    top: 1.15rem;
    width: 7px;
    height: 1.6rem;
    border-inline: 2px solid var(--color-text-muted, #5a554d);
}

.fx-h-resize:is(:hover, :focus-visible)::after {
    border-color: var(--color-focus, #1a73e8);
}

.fx-h-layout[hidden],
.fx-h-layout [hidden],
.fx-h-total[hidden],
.fx-h-total [hidden],
.fx-h-account-bar [hidden] {
    display: none;
}

.fx-h-controls,
.fx-h-result,
.fx-h-total {
    min-width: 0;
    padding: 1rem;
    border: 1px solid var(--color-line, #ddd6cb);
    border-radius: var(--radius-md, 14px);
    background: var(--color-surface, #fff);
}

.fx-h-controls fieldset {
    min-width: 0;
    margin-inline: 0;
    padding: 0;
    border: 0;
}

.fx-h-controls h3,
.fx-h-editor h3 {
    margin: 0 0 .65rem;
    font-size: 1rem;
    font-weight: 650;
}

.fx-h-layout label {
    display: grid;
    gap: .28rem;
    min-width: 0;
    color: var(--color-text-muted, #5a554d);
    font-size: .875rem;
}

.fx-h-layout input:not([type="checkbox"]),
.fx-h-layout select,
.fx-h-threshold input,
.fx-h-threshold select,
.fx-h-editor input:not([type="checkbox"]) {
    width: 100%;
    min-width: 0;
    min-height: 2.5rem;
    padding: .4rem .46rem;
    border: 1px solid var(--color-line, #ddd6cb);
    border-radius: var(--radius-sm, 8px);
    background: var(--color-surface, #fff);
    font: inherit;
    color: var(--color-text, #1f1c18);
}

.fx-h-controls input[type="file"] {
    padding: .25rem;
    font-size: .83rem;
}

.fx-h-source {
    margin-top: .85rem;
    padding-top: .7rem;
    border-top: 1px solid var(--color-line);
}

.fx-h-fileline {
    justify-content: space-between;
    margin-top: .45rem;
}

.fx-h-fileline span {
    max-width: 100%;
    overflow-wrap: anywhere;
    font-size: .82rem;
    color: var(--color-text-muted, #5a554d);
}

.fx-h-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .6rem;
    align-items: end;
}

.fx-h-grid .fx-button {
    width: 100%;
}

.fx-h-field-with-tooltip {
    position: relative;
}

.fx-h-field-tooltip {
    position: absolute;
    z-index: 3;
    bottom: calc(100% + .2rem);
    left: 0;
    visibility: hidden;
    padding: .2rem .45rem;
    border-radius: .3rem;
    background: var(--color-text, #1f1c18);
    color: var(--color-surface, #fff);
    font-size: .8rem;
    white-space: nowrap;
}

.fx-h-field-with-tooltip:is(:hover, :focus-within) .fx-h-field-tooltip {
    visibility: visible;
}

.fx-h-controls section[data-future] {
    margin-top: 1rem;
}

.fx-h-max-drop,
.fx-h-ruin-row {
    margin-top: .6rem;
}

.fx-h-ruin-row {
    display: grid;
    grid-template-columns: minmax(0, 10rem) max-content;
    gap: .6rem;
    align-items: end;
}

.fx-h-ruin-feedback > .fx-button {
    min-height: 2rem;
    padding: .2rem .55rem;
    margin-top: .55rem;
    font-size: .875rem;
}

.fx-h-inline {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .45rem;
}

.fx-h-inline > select,
.fx-h-inline > input:not([type="checkbox"]) {
    width: auto;
    flex: 1 1 6.2rem;
}

.fx-h-inline > .fx-button {
    flex-shrink: 0;
}

.fx-h-layout .fx-h-check {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}

.fx-h-layout .fx-h-check input {
    flex: none;
}

.fx-h-disclosure {
    margin-block: .8rem;
    padding-top: .45rem;
    border-top: 1px solid var(--color-line, #ddd6cb);
}

.fx-h-disclosure summary {
    margin-bottom: .45rem;
    cursor: pointer;
    font-size: .9rem;
    font-weight: 650;
}

.fx-h-schedule {
    margin-top: .9rem;
}

.fx-h-schedule ul {
    padding: 0;
    margin: .35rem 0 0;
    list-style: none;
}

.fx-h-schedule li {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: .45rem;
    margin-top: .3rem;
    font-size: .85rem;
}

.fx-h-schedule li > span {
    overflow-wrap: anywhere;
}

.fx-h-schedule-actions {
    display: flex;
    gap: .35rem;
}

.fx-h-schedule-actions .fx-button {
    min-height: 2rem;
    padding: .25rem .5rem;
}

.fx-h-edits {
    margin-block: .75rem .4rem;
}

.fx-h-actions {
    display: flex;
    gap: .45rem;
}

.fx-h-actions > .fx-button {
    padding-inline: .55rem;
    font-size: .9rem;
}

.fx-h-run {
    flex: 1;
    min-width: 0;
}

.fx-h-controls .fx-h-settings { margin-top: .85rem; }
.fx-h-controls [data-cancel] { margin-top: .5rem; }

.fx-h-status {
    margin: .55rem 0 0;
    font-size: .875rem;
    overflow-wrap: anywhere;
    color: var(--color-text-muted, #5a554d);
}

.fx-h-status:empty {
    display: none;
}

.fx-h-error {
    color: #9a3240;
}

.fx-h-result > .fx-h-status {
    margin-top: 0;
}

.fx-h-position {
    margin-bottom: .7rem;
    padding-bottom: .65rem;
    border-bottom: 1px solid var(--color-line, #ddd6cb);
}

.fx-h-position-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .3rem .8rem;
    margin-bottom: .5rem;
}

.fx-h-position-heading h3 {
    margin: 0;
    font-size: .95rem;
}

.fx-h-position-heading span {
    font-size: .82rem;
    color: var(--color-text-muted, #5a554d);
}

.fx-h-position-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 7.2rem), 1fr));
    gap: .5rem;
    align-items: end;
}

.fx-h-position-inputs .fx-h-field-tooltip {
    width: max-content;
    max-width: 100%;
    white-space: normal;
}

.fx-h-cards {
    margin-block: .45rem;
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}

.fx-h-cards:empty {
    display: none;
}

.fx-h-cards > div {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: .55rem;
    min-width: 0;
    padding: .28rem .55rem;
    border: 1px solid var(--color-line, #ddd6cb);
    border-radius: var(--radius-sm, 8px);
    background: var(--color-bg, #faf7f2);
}

.fx-h-cards dt {
    font-size: .8rem;
    color: var(--color-text-muted, #5a554d);
}

.fx-h-cards dd {
    margin: 0;
    font-size: .95rem;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.fx-h-threshold {
    margin-block: .8rem;
    font-size: .9rem;
}

.fx-h-threshold > input[data-threshold] {
    flex-grow: 0;
    width: 8rem;
}

.fx-h-threshold > select {
    flex: none;
}

.fx-h-graph {
    border: 1px solid var(--color-line, #ddd6cb);
    padding: .65rem;
    border-radius: var(--radius-sm, 8px);
}

.fx-h-graph label {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
}

.fx-h-graph label select {
    max-width: 13rem;
}

.fx-h-graph canvas,
.fx-h-total-chart {
    display: block;
    width: 100%;
    height: 228px;
    margin-top: .45rem;
}

.fx-h-table-scroll {
    margin-top: .8rem;
    max-height: 25rem;
    overflow: auto;
    border: 1px solid var(--color-line, #ddd6cb);
    border-radius: var(--radius-sm, 8px);
}

.fx-h-table-export {
    margin-top: .45rem;
    justify-content: flex-end;
}

.fx-h-table-export .fx-h-status { margin: 0; }
.fx-h-table-export .fx-button { min-height: 2rem; padding: .2rem .55rem; font-size: .875rem; }

.fx-h-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: .85rem;
    font-variant-numeric: tabular-nums;
}

.fx-h-table th,
.fx-h-table td {
    padding: .36rem clamp(.26rem, .48vw, .65rem);
    text-align: right;
    border-bottom: 1px solid var(--color-line, #ddd6cb);
}

.fx-h-table td { white-space: nowrap; }

.fx-h-table td:first-child,
.fx-h-table th:first-child {
    text-align: left;
    white-space: normal;
}

.fx-h-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--color-panel, #f3efe8);
}

.fx-h-table .fx-h-summary-row {
    background: #eef1ec;
}

.fx-h-table thead tr:nth-child(2).fx-h-summary-row {
    background: #e5efe8;
}

.fx-h-table .fx-h-stop {
    color: #963b47;
}

.fx-h-table .fx-h-edited {
    background: #fff1d1;
}

.fx-h-cell {
    width: 100%;
    text-align: right;
    cursor: pointer;
    padding: .05rem;
    background: transparent;
    border: 0;
    color: inherit;
    font: inherit;
    border-radius: 3px;
}

.fx-h-cell:hover {
    background: #e8efe8;
}

.fx-h-range-list {
    margin: .45rem 0 0;
    padding-left: 1.15rem;
    font-size: .85rem;
}

.fx-h-account-bar,
.fx-h-account-bar > div {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .45rem;
    margin-bottom: .4rem;
}

.fx-h-account-bar > div {
    margin: 0;
}

.fx-h-account-bar .fx-button {
    min-height: 34px;
    padding: 4px 10px;
    font-size: .875rem;
}

.fx-h-account-bar [aria-pressed="true"] {
    background: var(--color-accent, #252423);
    border-color: var(--color-accent, #252423);
    color: #fff;
}

.fx-h-editor {
    max-width: min(92vw, 26rem);
    margin: auto;
    padding: 1.25rem;
    border: 1px solid var(--color-line, #ddd6cb);
    border-radius: var(--radius-md, 14px);
    color: var(--color-text, #1f1c18);
    background: var(--color-surface, #fff);
}

.fx-h-editor::backdrop {
    background: rgba(25, 22, 18, .35);
}

.fx-h-editor .fx-h-inline {
    margin-top: .8rem;
}

.fx-h-schedule-editor {
    width: min(92vw, 25rem);
}

.fx-h-schedule-years {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
    gap: .4rem;
    max-height: min(48vh, 22rem);
    overflow-y: auto;
    padding: .35rem;
}

.fx-h-schedule-years label {
    display: flex;
    align-items: center;
    gap: .35rem;
    white-space: nowrap;
}

@media (max-width: 1180px) {
    .fx-h-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .fx-h-resize {
        display: none;
    }
}

@media (min-width: 740px) and (max-width: 1180px) {
    .fx-h-controls .fx-h-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 740px) {
    .fx-h-layout {
        gap: .8rem;
    }

    .fx-h-controls,
    .fx-h-result,
    .fx-h-total {
        padding: .75rem;
    }

    .fx-h-controls, .fx-h-result { scroll-margin-top: 54px; }

    .fx-h-layout input:not([type="checkbox"]),
    .fx-h-layout select,
    .fx-h-threshold input,
    .fx-h-threshold select {
        min-height: 44px;
        font-size: 1rem;
    }

    .fx-h-layout .fx-h-check, .fx-h-disclosure summary { min-height: 44px; }
    .fx-h-disclosure summary { padding-block: .55rem; }
    .fx-h-controls input[type="file"]::file-selector-button { min-height: 33px; }
    .fx-h-account-bar > [data-accounts] { width: 100%; }
    .fx-h-account-bar .fx-button { min-width: 44px; min-height: 44px; max-width: 100%; overflow-wrap: anywhere; }

    .fx-h-cards {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .fx-h-threshold {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto minmax(5rem, .55fr);
    }

    .fx-h-threshold > :is([data-metric], [data-reached]) { grid-column: 1 / -1; }
    .fx-h-threshold > :is(select, input[data-threshold]) { width: 100%; }
    .fx-h-threshold [data-reached]:empty { display: none; }
    .fx-h-graph label select { flex: 1; }

    .fx-h-table-scroll { max-height: min(25rem, 70dvh); }
    .fx-h-table-scroll th { white-space: nowrap; }
    .fx-h-table-scroll tr > :first-child {
        position: sticky;
        inset-inline-start: 0;
        z-index: 1;
        background: var(--color-surface);
        box-shadow: 1px 0 var(--color-line);
        white-space: nowrap;
    }

    .fx-h-table-scroll :is([data-account-table] tbody tr > :first-child) {
        white-space: normal;
        min-width: 5.5rem;
        max-width: 8rem;
        overflow-wrap: anywhere;
    }

    .fx-h-table-scroll thead tr:not(.fx-h-summary-row) > :first-child { background: var(--color-panel); }
    .fx-h-table-scroll .fx-h-summary-row > :first-child { background: inherit; }
    .fx-h-table-scroll .fx-h-cell { min-height: 2rem; }
    .fx-h-table-scroll > table { min-width: max-content; }
    .fx-h-result .fx-mobile-table-hint { margin-top: .65rem; }
    .fx-mobile-table-hint + .fx-h-table-scroll { margin-top: .3rem; }
    .fx-h-schedule-actions .fx-button, .fx-h-ruin-feedback > .fx-button,
    .fx-h-table-export .fx-button { min-height: 44px; }
    .fx-h-editor { max-height: 90vh; max-height: 90dvh; overflow: auto; }
}
