/* =====================================================================
   /adl/assets/css/adl-theme.css
   Shared look for every adl page, taken from the Adl platform home
   (web-dev.moj.gov.kw/adl-platform): Droid Arabic Naskh font, the gavel
   background, light rounded cards, navy text, navy gradient buttons.
   Loaded last in <head>, so it wins over the older page styles.
   Everything is local (no CDN), so nothing here can stall page load.
   ===================================================================== */

/* ===== FONTS (same files and metrics as the Adl platform) ===== */
@font-face {
    font-family: "AdlNaskh";
    src: url(/adl/assets/fonts/Droid-Arabic-Naskh-Regular.woff2) format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
    ascent-override: 30%;
    descent-override: 0%;
    line-gap-override: 70%;
}

@font-face {
    font-family: "AdlNaskh";
    src: url(/adl/assets/fonts/Droid-Arabic-Naskh-Bold.woff2) format("woff2");
    font-weight: 600 900;
    font-style: normal;
    font-display: swap;
    ascent-override: 30%;
    descent-override: 0%;
    line-gap-override: 70%;
}

@font-face {
    font-family: "AdlKufi";
    src: url(/adl/assets/fonts/NotoKufiArabic-latin.woff2) format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "AdlKufi";
    src: url(/adl/assets/fonts/NotoKufiArabic-arabic.woff2) format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

/* ===== TOKENS ===== */
:root {
    --adl-font: "AdlNaskh", "AdlKufi", Tahoma, Arial, sans-serif;
    --adl-navy: #1B3065;
    --adl-navy-2: #204872;
    --adl-blue: #4A65B2;
    --adl-blue-2: #365090;
    --adl-card: #ebebed;
    --adl-card-glass: rgba(235, 235, 237, 0.92);
    --adl-line: #d9dfeb;
    --adl-shadow: 12px 4px 33px 0 rgba(0, 0, 0, 0.25);
    --adl-shadow-hover: 12px 4px 33px 0 rgba(0, 0, 0, 0.25);
    --adl-gradient: linear-gradient(135deg, #4A65B2 0%, #365090 100%);
}

html[lang="en"] {
    --adl-font: "AdlKufi", "AdlNaskh", Tahoma, Arial, sans-serif;
}

/* ===== FONT EVERYWHERE (icon fonts left alone) ===== */
body,
body *:not(i):not(.fa):not(.fas):not(.far):not(.fab):not(.fal):not([class*="fa-"]):not([class*="glyphicon"]):not([class*="material-symbols"]):not([class*="material-icons"]):not([class^="bi-"]):not([class*=" bi-"]):not(code):not(pre):not(kbd):not(samp) {
    font-family: var(--adl-font) !important;
}

/* ===== BACKGROUND =====
   A fixed layer behind the page instead of a stretched section image:
   it never re-scales on long pages and scrolls without repainting. */
html {
    background: #ced7ea;
}

body {
    color: var(--adl-navy);
    background: transparent !important;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: #ced7ea url(/adl/assets/img/adl-bg.webp) center center / cover no-repeat;
}

.background-bg {
    background: transparent !important;
}

/* ===== HEADINGS / TEXT ===== */
h1, h2, h3, h4, h5, h6,
.title-lg,
.page-title,
.inputLabel,
.control-label,
.form-label,
label {
    color: var(--adl-navy);
}

a {
    color: var(--adl-blue-2);
}

/* on dark boxes the text stays the box's own (usually white) colour */
:is(.hero-section, .text-white, .bg-primary, .bg-dark, .bg-secondary, .bg-success, .bg-danger, .bg-info, .footer, .sidebar-header, .rowHeaderResult, .receiptHeaderResult)
    :is(h1, h2, h3, h4, h5, h6, label, a, .title-lg, .page-title, .inputLabel, .control-label, .form-label) {
    color: inherit;
}

/* The blue title ribbon, the content cards (.main-card, .sidebar-card, .form-shell...)
   and the side menu keep the look they already had: only font, background,
   tiles, inputs, buttons and tables come from this file. */

/* ===== SERVICE TILES (the cards in the image) ===== */
.moj-service-card,
.tile-btn {
    background: var(--adl-card) !important;
    border: 1px solid transparent !important;
    border-radius: 28px !important;
    box-shadow: var(--adl-shadow) !important;
    color: var(--adl-navy) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.moj-service-card .moj-card-title,
.tile-btn .t-title {
    color: var(--adl-navy);
    font-weight: 400;
}

.moj-service-card:hover,
.tile-btn:hover,
.tile-btn.active {
    background: var(--adl-gradient) !important;
    box-shadow: var(--adl-shadow-hover) !important;
    color: #fff !important;
}

.moj-service-card:hover .moj-card-title,
.tile-btn:hover .t-title,
.tile-btn.active .t-title {
    color: #fff;
}

/* ===== SERVICE CARDS ON EVERY PAGE (adl + adlN) =====
   One look for all card grids, copied from the home page (index.jsp):
   #ebebed card, 28px corners, soft shadow, navy icon and title, blue
   gradient with white icon/text on hover; 227 x 260 with an 80px icon on
   desktop. ".services-grid" + "html body" make this win over the cards'
   own <style> blocks in tasdeedComp.jsp, requestType.jsp, home.jsp ...
   (the wide "تحدث معنا" .service-card banner is not in a grid: untouched). */
html body .services-grid {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 16px !important;
    padding: 20px 0 !important;
    max-width: 1320px;
    margin-left: auto;
    margin-right: auto;
}

html body .services-grid .moj-service-card,
html body .services-grid .service-card {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    text-align: center !important;
    width: 160px !important;
    min-height: 120px !important;
    height: auto !important;
    aspect-ratio: auto !important;
    padding: 12px !important;
    gap: 8px !important;
    background: var(--adl-card) !important;
    border: 1px solid transparent !important;
    border-radius: 28px !important;
    box-shadow: var(--adl-shadow) !important;
    color: var(--adl-navy) !important;
    text-decoration: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    transform: none;
    transition: transform 0.3s ease, background 0.3s ease, color 0.3s ease, box-shadow 0.3s ease !important;
}

html body .services-grid .moj-service-card .moj-icon-wrap,
html body .services-grid .service-card .service-icon {
    width: 56px !important;
    height: 56px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
}

html body .services-grid .moj-service-card .moj-icon-wrap img,
html body .services-grid .moj-service-card .moj-icon-wrap svg,
html body .services-grid .service-card .service-icon img,
html body .services-grid .service-card .service-icon svg {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    filter: none !important;
    transition: filter 0.3s ease !important;
}

html body .services-grid .moj-service-card .moj-card-title,
html body .services-grid .service-card .service-title {
    color: var(--adl-navy) !important;
    font-size: 12px !important;
    font-weight: 400 !important;
    line-height: 1.4 !important;
    margin: 0 !important;
    width: 100%;
}

html body .services-grid .moj-service-card .moj-card-sub,
html body .services-grid .service-card .service-subtitle {
    color: var(--adl-navy) !important;
    font-size: 12px !important;
    line-height: 1.3 !important;
    margin: 0 !important;
    width: 100%;
}

html body .services-grid .moj-service-card:empty,
html body .services-grid .moj-service-card .moj-card-sub:empty {
    display: none !important;
}

html body .services-grid .moj-service-card:hover,
html body .services-grid .service-card:hover {
    transform: scale(1.05) !important;
    background: var(--adl-gradient) !important;
    box-shadow: var(--adl-shadow-hover) !important;
}

html body .services-grid .moj-service-card:hover,
html body .services-grid .moj-service-card:hover *,
html body .services-grid .service-card:hover,
html body .services-grid .service-card:hover * {
    color: #fff !important;
}

html body .services-grid .moj-service-card:hover img,
html body .services-grid .moj-service-card:hover svg,
html body .services-grid .service-card:hover img,
html body .services-grid .service-card:hover svg {
    filter: brightness(0) invert(1) !important;
}

@media (min-width: 768px) {
    html body .services-grid {
        gap: 20px !important;
    }

    html body .services-grid .moj-service-card,
    html body .services-grid .service-card {
        width: 200px !important;
        min-height: 120px !important;
        gap: 8px !important;
    }

    html body .services-grid .moj-service-card .moj-icon-wrap,
    html body .services-grid .service-card .service-icon {
        width: 56px !important;
        height: 56px !important;
    }

    html body .services-grid .moj-service-card .moj-card-title,
    html body .services-grid .service-card .service-title {
        font-size: 12px !important;
    }
}

@media (min-width: 1024px) {
    html body .services-grid {
        padding: 40px 0 !important;
    }

    html body .services-grid .moj-service-card,
    html body .services-grid .service-card {
        width: 227px !important;
        min-height: 272px !important;
        gap: 20px !important;
    }

    html body .services-grid .moj-service-card .moj-icon-wrap,
    html body .services-grid .service-card .service-icon {
        width: 80px !important;
        height: 80px !important;
    }

    html body .services-grid .moj-service-card .moj-card-title,
    html body .services-grid .service-card .service-title {
        font-size: 28px !important;
    }
}

/* a selected card (forms page): same look as hover */
html body .services-grid .moj-service-card.is-active {
    background: var(--adl-gradient) !important;
    box-shadow: var(--adl-shadow-hover) !important;
}

html body .services-grid .moj-service-card.is-active,
html body .services-grid .moj-service-card.is-active * {
    color: #fff !important;
}

html body .services-grid .moj-service-card.is-active img {
    filter: brightness(0) invert(1) !important;
}

/* ===== RESULT MESSAGES (no data, invalid search, access denied ...) =====
   viewResults/nodataFound.jsp and friends: one card in the home card style */
.adl-msg {
    max-width: 460px;
    margin: 30px auto;
    padding: 32px 24px 28px;
    text-align: center;
    background: var(--adl-card);
    border-radius: 28px;
    box-shadow: var(--adl-shadow);
    color: var(--adl-navy);
}

.adl-msg-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 16px;
    display: block;
}

.adl-msg-text {
    margin: 0;
    font-size: 20px;
    font-weight: 400;
    line-height: 1.7;
    color: var(--adl-navy);
}

.adl-msg-warn .adl-msg-text {
    color: #a3262c;
}

/* casesFromTo.jsp: .cases-grid > col > a.case-link > .case-card, same home card look */
html body .cases-grid {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 20px !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

html body .cases-grid > [class*="col"] {
    flex: 0 0 auto !important;
    width: auto !important;
    max-width: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

html body .cases-grid .case-card {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    width: 227px !important;
    min-height: 272px !important;
    height: auto !important;
    padding: 12px !important;
    gap: 12px !important;
    background: var(--adl-card) !important;
    border: 1px solid transparent !important;
    border-radius: 28px !important;
    box-shadow: var(--adl-shadow) !important;
    transition: transform 0.3s ease, background 0.3s ease, box-shadow 0.3s ease !important;
}

html body .cases-grid .case-card::before {
    display: none !important;
}

html body .cases-grid .case-icon {
    width: 80px !important;
    height: 80px !important;
    margin: 0 !important;
}

html body .cases-grid .case-title {
    color: var(--adl-navy) !important;
    font-size: 28px !important;
    font-weight: 400 !important;
    margin: 0 !important;
}

html body .cases-grid .case-desc {
    color: var(--adl-navy) !important;
    font-size: 14px !important;
    margin: 0 !important;
}

html body .cases-grid .case-link:hover .case-card {
    transform: scale(1.05) !important;
    background: var(--adl-gradient) !important;
    box-shadow: var(--adl-shadow-hover) !important;
}

html body .cases-grid .case-link:hover .case-card,
html body .cases-grid .case-link:hover .case-card * {
    color: #fff !important;
}

html body .cases-grid .case-link:hover .case-icon {
    filter: brightness(0) invert(1) !important;
}

@media (max-width: 767px) {
    html body .cases-grid .case-card {
        width: 160px !important;
        min-height: 120px !important;
    }

    html body .cases-grid .case-title {
        font-size: 12px !important;
    }
}

/* ===== INNER-PAGE TILES (judicial inquiry, payment ...) =====
   Same size and look as the home page cards (index.jsp .moj-service-card):
   227 x 260, 20px apart, 80px icon, 24px title. The ".tiles-row" prefix
   makes these win over the inline !important styles in navPage.jsp. */
.tiles-row.tiles-row {
    max-width: 1340px;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
}

.tiles-row .row {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    row-gap: 20px !important;
    column-gap: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.tiles-row [class*="col"] {
    display: flex !important;
    justify-content: center !important;
    flex: 0 0 auto !important;
    width: auto !important;
    max-width: none !important;
    padding: 0 10px !important;
    margin-bottom: 0 !important;
}

.tiles-row .tile-btn,
.tiles-row .customTabs {
    width: 227px !important;
    min-height: 272px !important;
    height: auto !important;
    padding: 12px !important;
    gap: 20px !important;
    background: var(--adl-card) !important;
    border: 1px solid transparent !important;
    border-radius: 28px !important;
    box-shadow: var(--adl-shadow) !important;
    transition: transform 0.3s ease, background 0.3s ease, box-shadow 0.3s ease !important;
}

.tiles-row .tile-btn img,
.tiles-row .tile-btn svg,
.tiles-row .customTabs img {
    width: 80px !important;
    height: 80px !important;
    margin-bottom: 0 !important;
}

.tiles-row .tile-btn,
.tiles-row .tile-btn *,
.tiles-row .customTabs,
.tiles-row .customTabs * {
    color: var(--adl-navy) !important;
}

.tiles-row .tile-btn .t-title,
.tiles-row .customTabs {
    font-size: 24px !important;
    font-weight: 400 !important;
    line-height: 1.4 !important;
}

.tiles-row .tile-btn:hover,
.tiles-row .tile-btn.active,
.tiles-row .customTabs:hover {
    transform: scale(1.05) !important;
    background: var(--adl-gradient) !important;
    box-shadow: var(--adl-shadow-hover) !important;
}

.tiles-row .tile-btn:hover,
.tiles-row .tile-btn:hover *,
.tiles-row .tile-btn.active,
.tiles-row .tile-btn.active *,
.tiles-row .customTabs:hover,
.tiles-row .customTabs:hover * {
    color: #fff !important;
}

.tiles-row .tile-btn:hover img,
.tiles-row .tile-btn.active img,
.tiles-row .customTabs:hover img {
    filter: brightness(0) invert(1) !important;
}

.tiles-row .tile-btn.is-visited,
.tiles-row .customTabs.is-visited {
    border: 2px solid var(--adl-navy) !important;
}

/* desktop: all tiles of a page in ONE row (judicial inquiry has 7, wider than most
   screens at 227px): each tile is at most the home size and they shrink together */
@media (min-width: 1024px) {
    .tiles-row.tiles-row {
        max-width: 1760px;
    }

    .tiles-row.tiles-row .row {
        flex-wrap: nowrap !important;
    }

    /* stronger than navPage.jsp's own ".tiles-row .col { flex: 0 0 auto }" */
    .tiles-row.tiles-row .row > [class*="col"] {
        flex: 0 1 247px !important;
        width: auto !important;
        min-width: 0 !important;
    }

    .tiles-row .tile-btn,
    .tiles-row .customTabs {
        width: 100% !important;
        max-width: 227px !important;
    }

    /* container-aware: 28px when the tile is 227px wide (as on the platform), smaller when 7 tiles share a row */
    .tiles-row.tiles-row .row > [class*="col"] {
        container-type: inline-size;
    }

    .tiles-row .tile-btn .t-title {
        font-size: clamp(16px, 1.5vw, 28px) !important;
        font-size: clamp(14px, 12.3cqw, 28px) !important;
    }
}

/* tablet and phone: the same sizes and breakpoints as the home cards (index.jsp):
   below 768px 160 x 120 with 16px between them (two per row on a phone),
   768-1023px 200 x 120 with 20px between them */
@media (max-width: 1023px) {
    .tiles-row .tile-btn,
    .tiles-row .customTabs {
        width: 200px !important;
        min-height: 120px !important;
        gap: 8px !important;
    }

    .tiles-row .tile-btn img,
    .tiles-row .tile-btn svg,
    .tiles-row .customTabs img {
        width: 56px !important;
        height: 56px !important;
    }

    .tiles-row .tile-btn .t-title,
    .tiles-row .customTabs {
        font-size: 12px !important;
    }

    html body .cases-grid .case-card {
        width: 200px !important;
        min-height: 120px !important;
    }
}

@media (max-width: 767px) {
    .tiles-row .row {
        row-gap: 16px !important;
    }

    .tiles-row.tiles-row .row > [class*="col"] {
        padding: 0 8px !important;
    }

    .tiles-row .tile-btn,
    .tiles-row .customTabs {
        width: 160px !important;
    }

    html body .cases-grid {
        gap: 16px !important;
    }

    html body .cases-grid .case-card {
        width: 160px !important;
    }
}

/* ===== INPUTS (white, like the platform search box) ===== */
.form-control,
.form-select,
.inputTextBox,
.inputText,
.moj-input,
.select-input,
input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="search"],
select,
textarea {
    background-color: #fff;
    border: 1px solid var(--adl-line);
    border-radius: 8px;
    color: var(--adl-navy);
    font-weight: 400;
}

.form-control:focus,
.form-select:focus,
.inputTextBox:focus,
.inputText:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="date"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--adl-blue);
    box-shadow: 0 0 0 3px rgba(74, 101, 178, 0.18);
}

input[readonly],
input[disabled],
select[disabled],
textarea[readonly] {
    background-color: #f3f5f9;
}

/* ===== BUTTONS ===== */
.btn-primary,
.commandButton,
.btnMoj,
input[type="submit"],
input[type="button"],
input[type="reset"],
button[type="submit"] {
    background: var(--adl-gradient) !important;
    color: #fff !important;
    border: 0 !important;
    border-radius: 10px !important;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(27, 48, 101, 0.18);
    cursor: pointer;
    transition: filter 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary:hover,
.commandButton:hover,
.btnMoj:hover,
input[type="submit"]:hover,
input[type="button"]:hover,
input[type="reset"]:hover,
button[type="submit"]:hover {
    filter: brightness(1.08);
    box-shadow: 0 4px 14px rgba(27, 48, 101, 0.25);
}

.btn-primary:disabled,
.commandButton:disabled,
input[type="submit"]:disabled,
input[type="button"]:disabled,
button[type="submit"]:disabled {
    filter: grayscale(0.6);
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary,
.btn-outline-primary {
    border-radius: 10px;
}

/* ===== RESULT TABLES ===== */
.resultTable,
.table {
    background: rgba(255, 255, 255, 0.94);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--adl-shadow);
}

.rowHeaderResult,
.rowHeaderResult th,
.rowHeaderResult td,
th.rowHeaderResult,
.receiptHeaderResult,
.table thead th {
    background: #4A65B2 !important;
    background-image: linear-gradient(180deg, #4A65B2 0%, #365090 100%) !important;
    color: #fff !important;
    font-weight: 700;
}

.rowHeaderResult a,
.receiptHeaderResult a {
    color: #fff !important;
}

.resultRowOdd {
    background-color: #ffffff;
}

.resultRowEven {
    background-color: #f2f5fa;
}

/* ===== ENGLISH: hidden for a moment while adl-i18n.js swaps the Arabic text ===== */
html.adl-i18n-pending body {
    visibility: hidden;
}

/* ===== ENGLISH: older pages hard-code dir="rtl" / direction:rtl on their
   tables and boxes; adl-i18n.js adds .adl-en so all of them read left-to-right ===== */
html.adl-en body,
html.adl-en body * {
    direction: ltr !important;
}

/* ===== PRINT: plain white paper ===== */
@media print {
    html,
    body {
        background: #fff !important;
    }

    body::before {
        display: none !important;
    }

    .main-card,
    .card,
    .resultTable,
    .table {
        box-shadow: none !important;
        background: #fff !important;
    }
}

/* ===== SAME ICON SIZE AND COLOUR EVERYWHERE =====
   Result / message / report icons are 80px like the card icons, and drawn in the platform navy (#1B3065).
   (Inline SVGs keep their own shapes; CSS wins over their stroke attributes.) */
html body .res-icon,
html body .empty-wrap .empty-icon,
html body .adl-msg-icon,
html body .cases-grid .case-icon {
    width: 80px !important;
    height: 80px !important;
}

html body .res-icon *,
html body .empty-icon svg *,
html body .adl-msg-icon *,
html body .case-icon * {
    stroke: var(--adl-navy) !important;
}

html body .res-icon circle[r="40"],
html body .empty-icon circle[r="40"],
html body .case-icon circle[r="40"] {
    fill: rgba(27, 48, 101, .08) !important;
}

/* the signed-in user's name in the blue ribbon: icon + name */
.adl-user-ic {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    margin-inline-end: 8px;
    flex-shrink: 0;
}

.adl-user-ic svg {
    display: block;
    width: 22px;
    height: 22px;
}

/* Signed in: the ribbon shows the user-name icon and the name, so the service logo beside it is dropped */
.all-panel-title:has(.adl-user-ic) > .panel-icon,
.all-panel-title:has(.adl-user-ic) > img.panel-icon {
    display: none !important;
}

/* Result tables: body cells are always dark text on white / light rows, never white on white
   (inline styles still win, so coloured cells keep their colour) */
html body .table > tbody > tr > td,
html body .table > tbody > tr > th {
    color: #212529;
    background-color: #fff;
}

html body .table > tbody > tr:nth-child(even) > td,
html body .table > tbody > tr:nth-child(even) > th {
    background-color: #f2f5fa;
}

html body .table > tbody > tr > td a {
    color: var(--adl-blue-2);
}

/* phone: when the cards sit inside a narrower box (a white .main-card), shrink them a little so two
   still fit in a row, as on the home page (never wider than the home card's 160px) */
@media (max-width: 767px) {
    html body .services-grid .moj-service-card,
    html body .services-grid .service-card {
        width: min(160px, calc(50% - 8px)) !important;
    }
}

/* ===== TABLES ON SMALL SCREENS (logged in or not) =====
   A result table wider than the screen scrolls sideways inside its own box instead of pushing the
   whole page or being cut off. Tables inside a .table-responsive already scroll, and nested
   (layout) tables are left alone. */
@media (max-width: 991px) {
    html body table:is(.table, .resultTable, .grid-table, .kv-table, .dataTable):not(.table-responsive table):not(table table),
    html body table:has(.rowHeaderResult, .receiptHeaderResult):not(.table-responsive table):not(table table) {
        display: block;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    html body table:is(.table, .resultTable, .grid-table, .kv-table, .dataTable) td,
    html body table:is(.table, .resultTable, .grid-table, .kv-table, .dataTable) th {
        min-width: 64px;
    }
}

/* small screens: a long table keeps its own height and scrolls inside its box (up/down as well as
   sideways) with the header row staying on top, instead of making the whole page endlessly long */
@media (max-width: 991px) {
    html body table:is(.table, .resultTable, .grid-table, .kv-table, .dataTable):not(.table-responsive table):not(table table),
    html body table:has(.rowHeaderResult, .receiptHeaderResult):not(.table-responsive table):not(table table) {
        max-height: 70vh;
        overflow: auto;
        overscroll-behavior: contain;
    }

    html body table:is(.table, .resultTable, .grid-table, .kv-table, .dataTable) thead th,
    html body table:has(.rowHeaderResult, .receiptHeaderResult) th.rowHeaderResult,
    html body table:has(.rowHeaderResult, .receiptHeaderResult) tr.rowHeaderResult th,
    html body table:has(.rowHeaderResult, .receiptHeaderResult) tr.rowHeaderResult td {
        position: sticky;
        top: 0;
        z-index: 2;
    }
}

/* casesFromTo.jsp (individuals): .cases-grid > .row > col > a.case-link > .case-card.
   The page's own "height:100%" chain made the cards float away from the footer on phones; the cards
   are laid out like the home cards instead, centred, two per row when they fit. */
html body .cases-grid .row {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 16px !important;
    margin: 0 !important;
    --bs-gutter-x: 0;
    --bs-gutter-y: 0;
}

html body .cases-grid .row > [class*="col"] {
    flex: 0 0 auto !important;
    width: auto !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

html body .cases-grid .case-link {
    height: auto !important;
    display: block !important;
}

html body .cases-grid .case-card {
    height: auto !important;
}

@media (max-width: 1023px) {
    html body .cases-grid .case-icon {
        width: 56px !important;
        height: 56px !important;
    }

    html body .cases-grid .case-title {
        font-size: 14px !important;
    }

    html body .cases-grid .case-desc {
        font-size: 12px !important;
        line-height: 1.3 !important;
    }

    html body .cases-grid .case-go {
        font-size: 12px !important;
        padding: 6px 14px !important;
    }
}

/* ===== NO BLINK BETWEEN PAGES =====
   Moving from one adl page to another used to look like a full refresh (white flash, header redrawn,
   fonts swapping). With cross-document view transitions the browser keeps the old page on screen until
   the new one is ready and cross-fades them; the header and footer have their own names, so they stay
   exactly where they are instead of being redrawn. Browsers without support just navigate as before. */
@view-transition {
    navigation: auto;
}

.header {
    view-transition-name: adl-header;
}

footer,
.footer {
    view-transition-name: adl-footer;
}

::view-transition-group(root) {
    animation-duration: 0.18s;
}

::view-transition-old(adl-header),
::view-transition-new(adl-header),
::view-transition-old(adl-footer),
::view-transition-new(adl-footer) {
    animation: none;
}

/* the page colour is there from the first paint, so nothing shows white while a page loads */
html {
    background-color: #ced7ea;
}

/* dropdowns styled as .btnMoj: the open list has a white background, so its options need dark text */
select.btnMoj option,
select.btnMoj optgroup {
    color: #1B3065 !important;
    background: #fff !important;
    font-weight: 400;
}
