/* Standard action colors sampled from the approved button references. */
:root {
    --ll-commit-button-color: #3A5F8A;
    --ll-edit-button-color: #165AA7;
}

/* Important layer rules outrank legacy unlayered !important page themes,
   without recoloring other .primary controls (e.g. search and delete). */
@layer ll-commit-buttons {
    /* 저장·취소·목록·수정은 모든 화면에서 동일한 가로 규격을 사용한다. */
    [data-ll-standard-action="true"] {
        box-sizing: border-box !important;
        flex: 0 0 86px !important;
        width: 86px !important;
        min-width: 86px !important;
        height: 38px !important;
        min-height: 38px !important;
        padding-left: 12px !important;
        padding-right: 12px !important;
        justify-content: center !important;
        text-align: center !important;
        white-space: nowrap !important;
    }
    /* 공통 작업 순서: 수정/저장 등 주요 작업 뒤에 목록 이동을 둔다. */
    [data-ll-standard-action="true"][data-ll-edit-action="true"] {
        order: 90 !important;
    }
    :is(button, a, input, [role="button"])[data-ll-edit-action="true"],
    :is(button, a, input, [role="button"])[data-ll-edit-action="true"]:is(:hover, :focus, :active, :disabled) {
        background-color: var(--ll-edit-button-color) !important;
        background-image: none !important;
        border-color: var(--ll-edit-button-color) !important;
        color: #fff !important;
    }
    [data-ll-edit-action="true"] :is(span, i, svg) { color: inherit !important; }
    [data-ll-edit-action="true"]:focus-visible {
        outline: 2px solid var(--ll-edit-button-color) !important;
        outline-offset: 3px !important;
    }
    [data-ll-standard-action="true"][data-ll-commit-button="true"] {
        order: 100 !important;
    }
    [data-ll-standard-action="true"][data-ll-list-action="true"] {
        order: 110 !important;
    }

    /* Delete actions are neutral white controls with orange text across pages/dialogs. */
    [data-ll-delete-button="true"],
    [data-ll-delete-button="true"]:is(:hover, :focus, :active, :disabled) {
        background-color: #fff !important;
        background-image: none !important;
        color: #d9480f !important;
        border: 1px solid #c8d0d9 !important;
        border-radius: 5px !important;
        box-shadow: none !important;
        filter: none !important;
        font-weight: 400 !important;
    }
    [data-ll-delete-button="true"] :is(span, strong, b, i, svg) { color: inherit !important; }
    [data-ll-delete-button="true"]:focus-visible { outline: 2px solid #d9480f !important; outline-offset: 3px !important; }
    [data-ll-delete-button="true"]:is(:disabled, [aria-disabled="true"]) { opacity: .45 !important; cursor: not-allowed !important; }
    /* Shared action typography; headings, table text and navigation links are unchanged. */
    :is(button, input[type="button"], input[type="submit"], input[type="reset"], [role="button"],
        a.btn, a[class*="button"], a[class*="-btn"]:not([class*="nav"])),
    :is(button, [role="button"], a.btn, a[class*="button"], a[class*="-btn"]:not([class*="nav"])) :is(span, strong, b) {
        font-weight: 400 !important;
    }
    :is(button, a, input, [role="button"])[data-ll-commit-button="true"],
    :is(button, a, input, [role="button"])[data-ll-commit-button="true"]:is(:hover, :focus, :active, :disabled) {
        background-color: var(--ll-commit-button-color) !important;
        background-image: none !important;
        border-color: var(--ll-commit-button-color) !important;
        color: #fff !important;
    }
    [data-ll-commit-button="true"] :is(span, i, svg) { color: inherit !important; }
    [data-ll-commit-button="true"]:focus-visible {
        outline: 2px solid var(--ll-commit-button-color) !important;
        outline-offset: 3px !important;
    }
    /* Export is a neutral action, including legacy buttons labelled '엑셀저장'. */
    [data-excel-download],
    [data-excel-download]:is(:hover, :focus, :active, :disabled) {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-sizing: border-box !important;
        height: 38px !important;
        min-height: 38px !important;
        padding: 0 16px !important;
        border: 1px solid #c8d0d9 !important;
        border-radius: 5px !important;
        background: #fff !important;
        color: #000 !important;
        font-size: 13px !important;
        font-weight: 400 !important;
        line-height: 20px !important;
        text-decoration: none !important;
        white-space: nowrap !important;
        box-shadow: none !important;
    }
    [data-excel-download] :is(span, strong, b, i, svg) { color: inherit !important; }
    [data-excel-download]:focus-visible {
        outline: 2px solid #165aa7 !important;
        outline-offset: 3px !important;
    }

    /* Keep the global radius after specialized delete/export declarations above. */
    html body :is(
        button,
        input[type="button"],
        input[type="submit"],
        input[type="reset"],
        [role="button"],
        a.btn,
        a[class*="button"],
        a[class*="-btn"],
        a[class*="_btn"]
    ) {
        border-radius: 1px !important;
    }
    .ll-list-toolbar {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 12px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    .ll-list-toolbar > .ll-list-toolbar-actions {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        width: auto !important;
        margin: 0 0 0 auto !important;
        float: none !important;
    }
    .ll-list-toolbar-actions > [data-excel-download] {
        width: auto !important;
        margin: 0 !important;
        float: none !important;
        position: static !important;
    }
}
