/* Screen surfaces for the Twenty-One child, including inherited and module views. */
@media screen {
    /* Round the layers that touch the inside of the 2px frame. Menus and focus rings can extend outside it. */
    .ar-next #main-body .card {
        --ar-inner-corner: calc(var(--radius, 12px) - 2px);
    }
    .ar-auth #main-body :is(.login-form > .card, .primary-content > .card, .primary-content > .row > .card) {
        --ar-inner-corner: 14px;
    }
    .ar-next #main-body .card > :is(.card-header, .card-body, .card-footer, .list-group, .collapsable-card-body):first-child {
        border-top-left-radius: var(--ar-inner-corner);
        border-top-right-radius: var(--ar-inner-corner);
    }
    .ar-next #main-body .card > :is(.card-header, .card-body, .card-footer, .list-group, .collapsable-card-body):last-child,
    .ar-next #main-body .card-sidebar > .card-header:has(.card-minimise.minimised) {
        border-bottom-left-radius: var(--ar-inner-corner);
        border-bottom-right-radius: var(--ar-inner-corner);
    }
    .ar-next #main-body .card :is(.collapsable-card-body, .list-group-flush) > :first-child {
        border-top-left-radius: inherit;
        border-top-right-radius: inherit;
    }
    .ar-next #main-body .card :is(.collapsable-card-body, .list-group-flush) > :last-child {
        border-bottom-left-radius: inherit;
        border-bottom-right-radius: inherit;
    }

    /* Outline card exteriors in both appearances. Native row and header dividers keep their widths. */
    .ar-next #main-body :is(.card, .panel, .well, .ar-brief-card, .ar-panel, .ar-invoice-ledger,
        .product-details-tab-container, .store-domain-tab-content, .ar-billing-card, .ar-payment-summary),
    .ar-next #main-body :is(#tableQuotesList_wrapper, #tableServicesList_wrapper, #tableDomainsList_wrapper),
    .ar-next #order-standard_cart :is(.product, .order-summary, .view-cart-items, #noAddons),
    .ar-next .ar-rail-note,
    .ar-invoice-detail :is(.invoice-container, .card) {
        border-style: solid;
        /* Cart templates load later and use their own ID-scoped border shorthands. */
        border-width: 2px !important;
    }
    .ar-next #main-body :is(#tableQuotesList_wrapper, #tableServicesList_wrapper, #tableDomainsList_wrapper),
    .ar-next #main-body .well {border-color: var(--line);}
    [data-ar-next-theme="dark"] .ar-invoice-detail {
        --id-canvas: #101319;
        --id-sheet: #000;
        --id-row: #000;
        --id-border: #363e49;
    }

    [data-ar-next-theme="dark"] body.ar-next:where(:not(.ar-dashboard)) {
        & :is(#main-body, .modal-content, .popover) {
            --canvas: #101319;
            --surface: #000;
            --raised: #101319;
            --secondary: #181b20;
            --hover: #21252c;
            --line: #363e49;
            --line-soft: #282d35;
            --active: #191c21;
            --active-text: #fff;
            --accent: #e4c993;
            --on-accent: #221b10;
            --primary: #ebd2a2;
            --primary-text: #221b10;
            --primary-hover: #f6e3bd;
            --focus: #e4c993;
            --iv-panel: var(--surface);
            --iv-head: var(--raised);
            --iv-row: var(--surface);
            --iv-alt: #080a0c;
            --iv-input: var(--raised);
            --iv-hover: var(--hover);
            --iv-selected: var(--secondary);
        }
        /* Authentication owns a full-bleed image behind its form. */
        &:not(.ar-auth) #main-body {background: var(--canvas);}
        &.ar-auth #main-body .card {background: var(--surface);}
        & .ar-rail-note {
            background: #000;
            border-color: #363e49;
        }
        & :is(.modal-content, .popover, .popover-header) {
            background-color: #000;
            color: #f4f4f1;
            border-color: #363e49;
        }
        /* The list and cart templates also consume their own scoped theme variables. */
        & #main-body :is(#tableServicesList_wrapper, #tableDomainsList_wrapper, #domainForm) {
            --surface: #000;
            --raised: #15181d;
            --secondary: #181b20;
            --hover: #21252c;
            --accent: #e4c993;
        }
        & #main-body #order-standard_cart {
            --accent: #ebd2a2;
            --on-accent: #221b10;
        }

        & #main-body :is(.card, .panel, .order-summary, .summary-container, .ar-invoice-ledger,
            .card-header, .panel-heading, .card-body, .panel-body, .card-footer, .panel-footer, .list-group-item,
            .well, .product-details .product-icon, .announcements .announcement article) {
            background-color: #000;
            border-color: #363e49;
            color: #f4f4f1;
        }
        /* Bootstrap background utilities use !important even on mobile sidebar cards. */
        & #main-body :is(.card.bg-light, .product-details-tab-container.bg-white, .store-domain-tab-content.bg-white) {
            background-color: #000 !important;
            border-color: var(--line);
        }
        & #main-body :is(.view-ticket .posted-by, .view-ticket .attachment-list figure, .nav-tabs .nav-link.active) {
            background-color: var(--raised);
            color: var(--text);
            border-color: var(--line);
        }
        & #main-body :is(a.list-group-item, .list-group-item-action):is(:hover, :focus-visible, .active) {
            background: #191c21;
            color: #fff;
        }
        & #main-body .list-group-item.active {box-shadow: inset 3px 0 #e4c993;}

        & #main-body :is(.form-control, .custom-select, .input-group-text, .dataTables_filter input, .dataTables_length select) {
            background-color: #101319;
            border-color: #65707d;
            color: #f4f4f1;
        }
        & #main-body .form-control::placeholder {color: #b7bec7; opacity: 1;}
        & #main-body :is(.form-control, .custom-select):disabled {background-color: #1b1e23; color: #b7bec7;}

        & #main-body :is(.btn-primary, .btn-transfer, .btn-checkout) {
            background: #ebd2a2;
            border-color: #ebd2a2;
            color: #221b10;
        }
        & #main-body :is(.btn-primary, .btn-transfer, .btn-checkout):not(:disabled, .disabled):hover {
            background: #f6e3bd;
            color: #17120b;
        }
        & #main-body :is(.btn-default, .page-link) {
            background: #111419;
            border-color: #4a535e;
            color: #eee7da;
        }
        & #main-body .page-item.active .page-link {
            background: #ebd2a2;
            color: #221b10;
            border-color: #ebd2a2;
        }
        & #main-body .page-item.disabled .page-link {background: #101319; color: #a8afb8;}
        & #main-body :is(a, input, select, button, textarea):focus-visible {
            outline: 2px solid #e4c993;
            outline-offset: 2px;
        }

        & #main-body .table {background: #000; color: #f4f4f1;}
        & #main-body .table th {background-color: #15181d; color: #f4f4f1; border-color: #363e49;}
        & #main-body .table td {border-color: #363e49;}
        & #main-body #tableQuotesList_wrapper {
            padding: 1rem;
            background: #000;
            color: #f4f4f1;
            border: 1px solid #363e49;
            border-radius: 12px;
        }
        & #main-body #tableQuotesList_wrapper :is(.dataTables_info, label) {color: #c1c8d0;}
        & #main-body #tableQuotesList :is(tbody tr, tbody td) {background: #000; color: #f4f4f1;}
        & #main-body #tableQuotesList tbody tr:hover td:not(.dataTables_empty) {background: #191c21;}
        & #main-body #tableQuotesList thead th {background-color: #15181d; color: #f4f4f1;}
        & #main-body #tableQuotesList thead :is(.sorting_asc, .sorting_desc) {
            box-shadow: inset 0 -2px #e4c993;
        }
        & #main-body #tableQuotesList thead .sorting_asc::before,
        & #main-body #tableQuotesList thead .sorting_desc::after {color: #e4c993; opacity: 1;}
        & #main-body .table-container:has(#tableQuotesList) {max-width: 100%; overflow-x: auto;}

        /* Keep the four native alert meanings distinguishable even when several appear together. */
        & #main-body .alert-info {background: #101d25; color: #c6e7f5; border-color: #426275;}
        & #main-body .alert-success {background: #10221c; color: #c6ecd6; border-color: #416854;}
        & #main-body .alert-warning {background: #252014; color: #f4deb0; border-color: #76623a;}
        & #main-body .alert-danger {background: #2a191c; color: #ffd0d2; border-color: #795057;}
        & #main-body .alert a:not(.btn) {color: inherit; text-decoration: underline;}
    }
}
