/* ============================================================================
   Dubai Sports — Golden Visa
   Design system built on the Dubai Sports Brand Guidelines (17/11/2025 - V1)

   Palette (guidelines p.11):
     Charcoal Grey  P 179-14 C  #353535
     Teal           808 C       #51b499
     White                      #ffffff
   Deep green surfaces are a darkened derivative of the brand teal, used for
   the header/footer bar so the white logo lockups read at full contrast
   (guidelines p.5: "use the white logo placed on our main dark colour").
   ========================================================================= */

/* ---------------------------------------------------------------- tokens */
:root {
    /* brand */
    --dsc-teal: #51b499;
    --dsc-teal-700: #2f7f69;
    --dsc-teal-600: #3e9c82;
    --dsc-teal-300: #8ed0bc;
    --dsc-teal-100: #d6efe7;
    --dsc-teal-50: #eef8f5;
    --dsc-charcoal: #353535;

    /* deep green header/footer */
    --dsc-deep: #12241c;
    --dsc-deep-2: #1b3329;
    --dsc-deep-3: #234032;
    --dsc-deep-line: rgba(255, 255, 255, .14);

    /* surfaces */
    --surface: #ffffff;
    --surface-sunken: #f3f6f5;
    --surface-raised: #ffffff;
    --surface-muted: #f8faf9;

    /* text */
    --text: #222826;
    --text-muted: #626e6a;
    --text-subtle: #8a9591;
    --text-on-dark: #ffffff;
    --text-on-dark-muted: rgba(255, 255, 255, .72);

    /* lines */
    --border: #e3e9e7;
    --border-strong: #cfd8d5;

    /* semantic */
    --ok: #2f7f69;
    --ok-bg: #e7f4ef;
    --warn: #a8760c;
    --warn-bg: #fdf3e0;
    --danger: #b3352a;
    --danger-bg: #fbeceb;
    --info: #2b6a86;
    --info-bg: #e8f2f7;

    /* elevation */
    --shadow-xs: 0 1px 2px rgba(18, 36, 28, .06);
    --shadow-sm: 0 2px 6px rgba(18, 36, 28, .07);
    --shadow-md: 0 6px 20px rgba(18, 36, 28, .09);
    --shadow-lg: 0 18px 44px rgba(18, 36, 28, .14);

    /* geometry */
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 18px;
    --r-pill: 999px;

    /* type */
    --font-sans: 'Poppins', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-arabic: 'IBM Plex Sans Arabic', 'Noto Kufi Arabic', 'Segoe UI', 'Tahoma', sans-serif;

    /* layout */
    --header-h: 92px;
    --focus-ring: 0 0 0 3px rgba(81, 180, 153, .38);
}

html[dir="rtl"] {
    --font-sans: var(--font-arabic);
}

/* ------------------------------------------------------------------ base */
*,
*::before,
*::after { box-sizing: border-box; }

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: var(--font-sans);
    font-size: .95rem;
    line-height: 1.6;
    color: var(--text);
    background: var(--surface-sunken);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.25;
    color: var(--text);
    margin: 0 0 .5rem;
    letter-spacing: -.01em;
}

h1 { font-size: clamp(1.5rem, 1.15rem + 1.5vw, 2.1rem); }
h2 { font-size: clamp(1.3rem, 1.05rem + 1.1vw, 1.7rem); }
h3 { font-size: clamp(1.15rem, 1rem + .6vw, 1.35rem); }
h4 { font-size: 1.08rem; }
h5 { font-size: 1rem; }

html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] h3,
html[dir="rtl"] h4 { letter-spacing: 0; }

a { color: var(--dsc-teal-700); text-decoration: none; }
a:hover { color: var(--dsc-teal-600); text-decoration: underline; }

p { margin: 0 0 1rem; }

:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
    border-radius: var(--r-sm);
}

.text-muted { color: var(--text-muted) !important; }

/* skip link — keyboard users land on content, not the logo */
.skip-link {
    position: absolute;
    inset-inline-start: 1rem;
    top: -3rem;
    z-index: 2000;
    background: var(--dsc-teal);
    color: #fff;
    padding: .6rem 1.1rem;
    border-radius: 0 0 var(--r-sm) var(--r-sm);
    font-weight: 600;
    transition: top .15s ease;
}
.skip-link:focus { top: 0; color: #fff; text-decoration: none; }

/* ---------------------------------------------------------------- header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: linear-gradient(100deg, var(--dsc-deep) 0%, var(--dsc-deep-2) 55%, var(--dsc-deep-3) 100%);
    box-shadow: 0 2px 14px rgba(18, 36, 28, .22);
}

/* teal hairline under the bar — the one flash of brand colour up top */
.site-header::after {
    content: "";
    display: block;
    height: 3px;
    background: linear-gradient(90deg, var(--dsc-teal) 0%, var(--dsc-teal-700) 60%, transparent 100%);
}
html[dir="rtl"] .site-header::after {
    background: linear-gradient(270deg, var(--dsc-teal) 0%, var(--dsc-teal-700) 60%, transparent 100%);
}

/* Three independent flex items — the two logo lockups and the action group —
   so a narrow screen can wrap the actions onto their own row instead of
   overflowing the bar sideways. */
.site-header__bar {
    /* Full width on purpose: the two logo lockups belong in the corners of the
       screen, not inset to the content column. */
    padding: 1rem 1.75rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .6rem 1rem;
}

.site-header__logo { flex: 0 0 auto; }
.site-header__logo img { display: block; width: auto; }
.site-header__logo--gov { order: 1; }
.site-header__logo--gov img { height: 52px; }
.site-header__logo--dsc { order: 3; }
.site-header__logo--dsc img { height: 34px; }

.site-header__actions {
    order: 2;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    min-width: 0;
}

/* header buttons */
.hbtn {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .45rem .85rem;
    border-radius: var(--r-pill);
    border: 1px solid var(--dsc-deep-line);
    background: rgba(255, 255, 255, .07);
    color: var(--text-on-dark);
    font-size: .85rem;
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, transform .15s ease;
    white-space: nowrap;
}
.hbtn:hover {
    background: rgba(255, 255, 255, .15);
    border-color: rgba(255, 255, 255, .3);
    color: #fff;
    text-decoration: none;
}
.hbtn:active { transform: translateY(1px); }
.hbtn--solid {
    background: var(--dsc-teal);
    border-color: var(--dsc-teal);
    color: #10241c;
    font-weight: 600;
}
.hbtn--solid:hover { background: var(--dsc-teal-300); border-color: var(--dsc-teal-300); color: #10241c; }
.hbtn i { font-size: .9em; }

/* language switch */
.lang-switch {
    display: inline-flex;
    padding: 3px;
    border-radius: var(--r-pill);
    background: rgba(255, 255, 255, .09);
    border: 1px solid var(--dsc-deep-line);
}
.lang-switch a {
    padding: .28rem .7rem;
    border-radius: var(--r-pill);
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-on-dark-muted);
    line-height: 1.3;
    transition: background .15s ease, color .15s ease;
}
.lang-switch a:hover { color: #fff; text-decoration: none; }
.lang-switch a.is-active { background: var(--dsc-teal); color: #10241c; }

/* the user chip */
.user-chip {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    max-width: 190px;
    padding: .3rem .35rem .3rem .3rem;
    border-radius: var(--r-pill);
    border: 1px solid var(--dsc-deep-line);
    background: rgba(255, 255, 255, .07);
    color: var(--text-on-dark);
    font-size: .85rem;
    cursor: pointer;
}
.user-chip:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.user-chip__avatar {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--dsc-teal);
    color: #10241c;
    font-weight: 700;
    font-size: .78rem;
}
.user-chip__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-inline-end: .3rem;
}

.dropdown-menu {
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-md);
    padding: .35rem;
    font-size: .9rem;
}
.dropdown-item { border-radius: var(--r-sm); padding: .5rem .75rem; }
.dropdown-item:active { background: var(--dsc-teal); color: #10241c; }
.dropdown-item i { width: 1.1rem; text-align: center; color: var(--text-subtle); }

/* --------------------------------------------------------------- pagehead */
.page-head {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.page-head__inner {
    max-width: 1320px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 1.35rem;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
}
.page-head__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--dsc-teal-700);
    margin-bottom: .3rem;
}
html[dir="rtl"] .page-head__eyebrow { letter-spacing: 0; }
/* Applicant names, reference ids and email addresses land here and can be long
   with no break opportunity, which pushed the page sideways on small screens. */
.page-head h1 { margin: 0; overflow-wrap: anywhere; }
.page-head__sub {
    margin: .35rem 0 0;
    color: var(--text-muted);
    font-size: .92rem;
    max-width: 60ch;
    overflow-wrap: anywhere;
}
.page-head > div { min-width: 0; }
.page-head__actions { display: flex; flex-wrap: wrap; gap: .5rem; }

/* ------------------------------------------------------------------ shell */
.page-shell {
    flex: 1 0 auto;
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    padding: 1.75rem 1.25rem 3rem;
}
.page-shell--narrow { max-width: 940px; }
.page-shell--tight { max-width: 520px; }

/* ------------------------------------------------------------------ cards */
.card-dsc {
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.card-dsc + .card-dsc { margin-top: 1.25rem; }

.card-dsc__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: 1rem 1.35rem;
    background: var(--surface-muted);
    border-bottom: 1px solid var(--border);
}
.card-dsc__head h2,
.card-dsc__head h3,
.card-dsc__head h4 {
    margin: 0;
    font-size: 1.02rem;
    display: flex;
    align-items: center;
    gap: .6rem;
}
.card-dsc__head h2 i,
.card-dsc__head h3 i,
.card-dsc__head h4 i { color: var(--dsc-teal-700); font-size: .95em; }
.card-dsc__body { padding: 1.35rem; }
.card-dsc__body > :last-child { margin-bottom: 0; }
.card-dsc__foot {
    padding: 1rem 1.35rem;
    background: var(--surface-muted);
    border-top: 1px solid var(--border);
}

/* section legend inside a form */
.form-section {
    border: 0;
    padding: 0;
    margin: 0 0 1.75rem;
}
.form-section:last-of-type { margin-bottom: 0; }
.form-section__legend {
    float: none;
    width: auto;
    display: flex;
    align-items: center;
    gap: .65rem;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--dsc-teal-700);
    padding: 0 0 .75rem;
    margin: 0 0 1.15rem;
    border-bottom: 1px solid var(--border);
}
html[dir="rtl"] .form-section__legend { letter-spacing: 0; }
.form-section__legend .n {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--dsc-teal-100);
    color: var(--dsc-teal-700);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: 0;
}

/* ---------------------------------------------------------------- buttons */
.btn {
    --btn-bg: transparent;
    --btn-fg: var(--text);
    --btn-bd: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .55rem 1.15rem;
    font-family: inherit;
    font-size: .9rem;
    font-weight: 600;
    line-height: 1.45;
    border-radius: var(--r-sm);
    border: 1px solid var(--btn-bd);
    background: var(--btn-bg);
    color: var(--btn-fg);
    cursor: pointer;
    transition: filter .15s ease, background .15s ease, box-shadow .15s ease, transform .1s ease;
    text-decoration: none;
}
.btn:hover { text-decoration: none; filter: brightness(.94); color: var(--btn-fg); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { box-shadow: var(--focus-ring); }
.btn:disabled,
.btn.disabled { opacity: .55; pointer-events: none; }

.btn-primary   { --btn-bg: var(--dsc-teal-700); --btn-fg: #fff; --btn-bd: var(--dsc-teal-700); }
.btn-success   { --btn-bg: var(--ok);        --btn-fg: #fff; --btn-bd: var(--ok); }
.btn-danger    { --btn-bg: var(--danger);    --btn-fg: #fff; --btn-bd: var(--danger); }
.btn-warning   { --btn-bg: var(--warn);      --btn-fg: #fff; --btn-bd: var(--warn); }
.btn-info      { --btn-bg: var(--info);      --btn-fg: #fff; --btn-bd: var(--info); }
.btn-secondary { --btn-bg: var(--surface);   --btn-fg: var(--text); --btn-bd: var(--border-strong); }
.btn-secondary:hover { --btn-bg: var(--surface-muted); filter: none; }
.btn-light     { --btn-bg: rgba(255,255,255,.16); --btn-fg: #fff; --btn-bd: rgba(255,255,255,.28); }
.btn-link      { --btn-fg: var(--dsc-teal-700); --btn-bd: transparent; padding-inline: .4rem; }
.btn-link:hover { text-decoration: underline; filter: none; }

.btn-outline-primary { --btn-fg: var(--dsc-teal-700); --btn-bd: var(--dsc-teal-300); --btn-bg: var(--surface); }
.btn-outline-primary:hover { --btn-bg: var(--dsc-teal-50); filter: none; }
.btn-outline-danger  { --btn-fg: var(--danger); --btn-bd: #eec4c0; --btn-bg: var(--surface); }
.btn-outline-danger:hover { --btn-bg: var(--danger-bg); filter: none; }
.btn-outline-info    { --btn-fg: var(--info); --btn-bd: #bcd8e4; --btn-bg: var(--surface); }
.btn-outline-info:hover { --btn-bg: var(--info-bg); filter: none; }
.btn-outline-secondary { --btn-fg: var(--text-muted); --btn-bd: var(--border-strong); --btn-bg: var(--surface); }
.btn-outline-secondary:hover { --btn-bg: var(--surface-muted); filter: none; }

.btn-sm { padding: .35rem .75rem; font-size: .81rem; border-radius: 7px; }

/* On touch screens the compact controls — row actions, the language switch —
   come out around 26px tall, which is fiddly to hit accurately. Give them a
   comfortable minimum without changing the desktop density. */
@media (max-width: 767.98px) {
    .btn-sm {
        min-height: 38px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .lang-switch a {
        min-height: 38px;
        min-width: 38px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .site-footer__links a {
        min-height: 38px;
        display: inline-flex;
        align-items: center;
    }
}
.btn-lg { padding: .75rem 1.6rem; font-size: 1rem; }
.btn-block { width: 100%; }

/* icon-only button keeps a real hit target */
.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    flex: 0 0 auto;
}

/* ------------------------------------------------------------------ forms */
.form-label {
    display: block;
    margin-bottom: .35rem;
    font-size: .84rem;
    font-weight: 600;
    color: var(--text);
}
.form-label .req { color: var(--danger); margin-inline-start: .15rem; }
.form-hint { display: block; margin-top: .3rem; font-size: .78rem; color: var(--text-muted); }

.form-control,
.form-select {
    display: block;
    width: 100%;
    padding: .6rem .8rem;
    font-family: inherit;
    font-size: .92rem;
    line-height: 1.5;
    color: var(--text);
    background-color: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    transition: border-color .15s ease, box-shadow .15s ease;
    /* 16px on mobile stops iOS Safari zooming the viewport on focus */
    min-height: 42px;
}

/* The file input inside a dropzone is invisible but still focusable, so keep it
   at 16px too rather than letting it inherit a smaller size. */
.dropzone input[type="file"] { font-size: 16px; }
.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23626e6a'%3E%3Cpath d='M8 11.2 3.4 6.6l1-1L8 9.2l3.6-3.6 1 1z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .7rem center;
    background-size: 16px;
    padding-inline-end: 2.1rem;
}
html[dir="rtl"] .form-select { background-position: left .7rem center; }

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--dsc-teal);
    box-shadow: var(--focus-ring);
}
.form-control::placeholder { color: var(--text-subtle); }
.form-control:disabled,
.form-select:disabled,
.form-control[readonly] {
    background-color: #eff2f1;
    color: var(--text-muted);
    cursor: not-allowed;
}
textarea.form-control { min-height: 92px; resize: vertical; }

/* validation */
.form-control.is-invalid,
.form-select.is-invalid,
.input-validation-error {
    border-color: var(--danger);
    background-color: #fffafa;
}
.form-control.is-invalid:focus,
.input-validation-error:focus { box-shadow: 0 0 0 3px rgba(179, 53, 42, .18); }
.field-validation-error,
.text-danger {
    display: inline-block;
    margin-top: .3rem;
    font-size: .8rem;
    color: var(--danger) !important;
    font-weight: 500;
}
.field-validation-valid { display: none; }
.validation-summary-valid { display: none; }

/* checkbox / radio */
.form-check { display: flex; align-items: flex-start; gap: .55rem; margin-bottom: .4rem; }
.form-check-input {
    flex: 0 0 auto;
    width: 1.15rem;
    height: 1.15rem;
    margin-top: .18rem;
    accent-color: var(--dsc-teal-700);
    cursor: pointer;
}
.form-check-label { cursor: pointer; font-size: .9rem; }

/* yes/no switch used for "do you have a rank?" style questions */
.switch-question {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .9rem 1.1rem;
    background: var(--dsc-teal-50);
    border: 1px solid var(--dsc-teal-100);
    border-radius: var(--r-md);
    margin-bottom: 1.25rem;
}
.switch-question__text { font-weight: 600; font-size: .92rem; margin: 0; }
.form-switch { display: inline-flex; align-items: center; gap: .6rem; }
.form-switch input[type="checkbox"] {
    appearance: none;
    width: 46px;
    height: 26px;
    border-radius: var(--r-pill);
    background: var(--border-strong);
    position: relative;
    cursor: pointer;
    transition: background .18s ease;
    flex: 0 0 auto;
    margin: 0;
}
.form-switch input[type="checkbox"]::after {
    content: "";
    position: absolute;
    top: 3px;
    inset-inline-start: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: var(--shadow-xs);
    transition: transform .18s ease;
}
.form-switch input[type="checkbox"]:checked { background: var(--dsc-teal-700); }
.form-switch input[type="checkbox"]:checked::after { transform: translateX(20px); }
html[dir="rtl"] .form-switch input[type="checkbox"]:checked::after { transform: translateX(-20px); }
.form-switch input[type="checkbox"]:focus-visible { box-shadow: var(--focus-ring); }

/* segmented emirates-id entry */
.segmented-input { display: flex; gap: .5rem; align-items: center; }
.segmented-input .form-control {
    text-align: center;
    font-variant-numeric: tabular-nums;
    letter-spacing: .06em;
    direction: ltr;
}
.segmented-input .sep { color: var(--text-subtle); font-weight: 600; }

/* --------------------------------------------------------------- dropzone */
.dropzone {
    position: relative;
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: 1rem 1.1rem;
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--r-md);
    background: var(--surface-muted);
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
    min-height: 76px;
}
.dropzone:hover { border-color: var(--dsc-teal); background: var(--dsc-teal-50); }
.dropzone.is-dragover { border-color: var(--dsc-teal); background: var(--dsc-teal-100); }
.dropzone.is-filled { border-style: solid; border-color: var(--dsc-teal); background: var(--dsc-teal-50); }
.dropzone.is-error { border-color: var(--danger); background: var(--danger-bg); }
.dropzone__icon {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: var(--r-sm);
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--dsc-teal-700);
    font-size: 1.05rem;
}
.dropzone.is-error .dropzone__icon { color: var(--danger); }
.dropzone__text { min-width: 0; flex: 1 1 auto; }
.dropzone__title {
    display: block;
    font-size: .88rem;
    font-weight: 600;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dropzone__meta { display: block; font-size: .76rem; color: var(--text-muted); }
.dropzone.is-error .dropzone__meta { color: var(--danger); }
.dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}
.dropzone__clear {
    flex: 0 0 auto;
    border: 0;
    background: transparent;
    color: var(--text-subtle);
    font-size: .95rem;
    cursor: pointer;
    padding: .3rem;
    position: relative;
    z-index: 2;
}
.dropzone__clear:hover { color: var(--danger); }

/* ----------------------------------------------------------------- tables */
/* every table scrolls inside its own box; the page itself never scrolls sideways */
.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    background: var(--surface);
}
.table-dsc {
    width: 100%;
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
    font-size: .88rem;
}
.table-dsc thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--dsc-deep-2);
    color: #fff;
    font-weight: 600;
    font-size: .78rem;
    letter-spacing: .05em;
    text-transform: uppercase;
    text-align: start;
    padding: .7rem .85rem;
    white-space: nowrap;
}
html[dir="rtl"] .table-dsc thead th { letter-spacing: 0; }
.table-dsc tbody td {
    padding: .7rem .85rem;
    border-top: 1px solid var(--border);
    vertical-align: middle;
}
.table-dsc tbody tr:hover { background: var(--dsc-teal-50); }
.table-dsc tbody tr:first-child td { border-top: 0; }
.table-dsc .nowrap { white-space: nowrap; }
.table-dsc .actions {
    display: flex;
    gap: .35rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* A wide table scrolls inside its own box, which can push the actions column
   out of sight. Pin it to the trailing edge so Edit/Delete stay reachable. */
@media (min-width: 768px) {
    .table-dsc thead th:last-child,
    .table-dsc tbody td:last-child {
        position: sticky;
        inset-inline-end: 0;
        z-index: 2;
    }
    .table-dsc thead th:last-child {
        background: var(--dsc-deep-2);
        z-index: 3;
    }
    .table-dsc tbody td:last-child {
        background: var(--surface);
        box-shadow: -10px 0 8px -8px rgba(18, 36, 28, .16);
    }
    html[dir="rtl"] .table-dsc tbody td:last-child {
        box-shadow: 10px 0 8px -8px rgba(18, 36, 28, .16);
    }
    .table-dsc tbody tr:hover td:last-child { background: var(--dsc-teal-50); }
}

.table-empty {
    padding: 2.5rem 1.25rem;
    text-align: center;
    color: var(--text-muted);
}
.table-empty i { font-size: 1.8rem; color: var(--border-strong); display: block; margin-bottom: .6rem; }

/* below 768px each row becomes a stacked card, labelled by data-label */
@media (max-width: 767.98px) {
    .table-wrap { border: 0; background: transparent; overflow-x: visible; }
    .table-dsc,
    .table-dsc tbody,
    .table-dsc tr,
    .table-dsc td { display: block; width: 100%; }
    .table-dsc thead { display: none; }
    .table-dsc tbody tr {
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--r-md);
        box-shadow: var(--shadow-xs);
        margin-bottom: .75rem;
        padding: .35rem .25rem;
    }
    .table-dsc tbody tr:hover { background: var(--surface); }
    .table-dsc tbody td {
        border: 0;
        border-bottom: 1px dashed var(--border);
        padding: .55rem .85rem;
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 1rem;
        text-align: end;
    }
    .table-dsc tbody td:last-child { border-bottom: 0; }
    .table-dsc tbody td::before {
        content: attr(data-label);
        flex: 0 0 40%;
        text-align: start;
        font-size: .74rem;
        font-weight: 700;
        letter-spacing: .05em;
        text-transform: uppercase;
        color: var(--text-muted);
    }
    html[dir="rtl"] .table-dsc tbody td::before { letter-spacing: 0; }
    .table-dsc tbody td:not([data-label])::before { content: none; }
    .table-dsc .actions { justify-content: flex-end; }
}

/* ----------------------------------------------------------------- badges */
.badge-dsc {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .22rem .6rem;
    border-radius: var(--r-pill);
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .02em;
    white-space: nowrap;
    border: 1px solid transparent;
}
.badge-dsc::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.badge-pending      { background: var(--warn-bg);  color: var(--warn);   border-color: #f0dcb4; }
.badge-approved     { background: var(--ok-bg);    color: var(--ok);     border-color: #bfe2d6; }
.badge-rejected     { background: var(--danger-bg);color: var(--danger); border-color: #eec4c0; }
.badge-preapproved  { background: var(--info-bg);  color: var(--info);   border-color: #bcd8e4; }
.badge-neutral      { background: #eef1f0;         color: var(--text-muted); border-color: var(--border); }

.lock-pill {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .75rem;
    font-weight: 600;
}
.lock-pill--locked { color: var(--danger); }
.lock-pill--open { color: var(--ok); }

/* ----------------------------------------------------------------- alerts */
.alert {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .85rem 1.1rem;
    border-radius: var(--r-md);
    border: 1px solid transparent;
    font-size: .9rem;
    margin-bottom: 1.25rem;
}
.alert i.alert__icon { font-size: 1.05rem; margin-top: .1rem; flex: 0 0 auto; }
.alert__body { flex: 1 1 auto; min-width: 0; }
.alert .btn-close { flex: 0 0 auto; }
/* Server-rendered flash messages. Visible by default; dialogs.js removes this
   block and shows toasts instead when the dialog library is available. */
.flash-stack {
    max-width: var(--shell-max, 1200px);
    margin: 1rem auto 0;
    padding: 0 1.5rem;
    display: grid;
    gap: .6rem;
}
@media (max-width: 575.98px) { .flash-stack { padding: 0 1rem; } }

.alert-success { background: var(--ok-bg);     color: #1d5646; border-color: #bfe2d6; }
.alert-danger  { background: var(--danger-bg); color: #8c281f; border-color: #eec4c0; }
.alert-warning { background: var(--warn-bg);   color: #7a560a; border-color: #f0dcb4; }
.alert-info    { background: var(--info-bg);   color: #1f5065; border-color: #bcd8e4; }

/* ------------------------------------------------------------------ stats */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.75rem;
}
.stat-card {
    display: block;
    position: relative;
    padding: 1.15rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-xs);
    color: var(--text);
    overflow: hidden;
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--dsc-teal-300);
    text-decoration: none;
    color: var(--text);
}
.stat-card::before {
    content: "";
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    width: 4px;
    background: var(--accent, var(--dsc-teal));
}
.stat-card__label {
    display: flex;
    align-items: center;
    gap: .45rem;
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: .3rem;
}
html[dir="rtl"] .stat-card__label { letter-spacing: 0; }
.stat-card__label i { color: var(--accent, var(--dsc-teal-700)); }
.stat-card__value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}
.stat-card__meta { font-size: .78rem; color: var(--text-subtle); }
.stat-card--pending     { --accent: #d29a1e; }
.stat-card--approved    { --accent: var(--ok); }
.stat-card--preapproved { --accent: var(--info); }
.stat-card--rejected    { --accent: var(--danger); }
.stat-card--all         { --accent: var(--dsc-charcoal); }

/* simple horizontal bar list for the stat breakdowns */
.bar-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .7rem; }
.bar-list li { display: grid; gap: .3rem; }
.bar-list__top {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-size: .84rem;
}
.bar-list__name { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-list__count { color: var(--text-muted); font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.bar-list__track { height: 6px; border-radius: var(--r-pill); background: #eef1f0; overflow: hidden; }
.bar-list__fill {
    height: 100%;
    border-radius: var(--r-pill);
    background: linear-gradient(90deg, var(--dsc-teal) 0%, var(--dsc-teal-700) 100%);
    transition: width .5s cubic-bezier(.2, .8, .3, 1);
}
html[dir="rtl"] .bar-list__fill { background: linear-gradient(270deg, var(--dsc-teal) 0%, var(--dsc-teal-700) 100%); }

/* ------------------------------------------------------------ filter bar */
.filter-bar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 1.1rem 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-xs);
}
.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: .85rem;
}
.filter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}
.filter-actions .spacer { flex: 1 1 auto; }

/* --------------------------------------------------------------- modals */
.modal-content {
    border: 0;
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.modal-header {
    background: var(--dsc-deep-2);
    color: #fff;
    border-bottom: 0;
    padding: 1rem 1.35rem;
    align-items: center;
}
.modal-title { font-size: 1.02rem; margin: 0; color: #fff; display: flex; align-items: center; gap: .55rem; }
.modal-header .btn-close {
    filter: invert(1) grayscale(1) brightness(2);
    opacity: .8;
}
.modal-header .btn-close:hover { opacity: 1; }
.modal-body { padding: 1.35rem; }
.modal-footer {
    padding: 1rem 1.35rem;
    background: var(--surface-muted);
    border-top: 1px solid var(--border);
    gap: .5rem;
}
.modal-footer > * { margin: 0; }
/* on small screens a modal should use the full height, not float in the middle */
@media (max-width: 575.98px) {
    .modal-dialog { margin: .5rem; }
    .modal-body { max-height: calc(100vh - 12rem); overflow-y: auto; }
}

/* ------------------------------------------------------------ repeatables */
.repeat-item {
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface);
    padding: 1.15rem 1.25rem 1rem;
    margin-bottom: 1rem;
}
.repeat-item__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: 1rem;
    padding-bottom: .65rem;
    border-bottom: 1px dashed var(--border);
}
.repeat-item__title {
    font-size: .82rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0;
}
html[dir="rtl"] .repeat-item__title { letter-spacing: 0; }
.repeat-add {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    width: 100%;
    padding: .75rem;
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--r-md);
    background: var(--surface-muted);
    color: var(--dsc-teal-700);
    font-weight: 600;
    font-size: .88rem;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}
.repeat-add:hover { border-color: var(--dsc-teal); background: var(--dsc-teal-50); }

/* ------------------------------------------------------------------ misc */
.kv-list { display: grid; gap: .1rem; margin: 0; }
.kv-list__row {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem 1rem;
    padding: .5rem 0;
    border-bottom: 1px dashed var(--border);
}
.kv-list__row:last-child { border-bottom: 0; }
.kv-list__k { flex: 0 0 190px; color: var(--text-muted); font-size: .84rem; font-weight: 600; }
.kv-list__v { flex: 1 1 200px; font-size: .92rem; word-break: break-word; }
@media (max-width: 575.98px) { .kv-list__k { flex-basis: 100%; } }

/* Definition-list flavour of kv-list, used by the email diagnostics page. */
dl.kv-list {
    display: grid;
    grid-template-columns: minmax(150px, 190px) 1fr;
    gap: 0;
    align-items: baseline;
}
dl.kv-list dt,
dl.kv-list dd {
    padding: .55rem 0;
    border-bottom: 1px solid var(--border);
    margin: 0;
}
dl.kv-list dt:last-of-type,
dl.kv-list dd:last-of-type { border-bottom: 0; }
@media (max-width: 575.98px) {
    dl.kv-list { grid-template-columns: 1fr; }
    dl.kv-list dt { padding-bottom: 0; border-bottom: 0; }
}

/* Configuration problems, listed before anyone tries to send. */
.issue-list { margin: 0; padding: 0; list-style: none; }
.issue-list li {
    position: relative;
    padding: .6rem .8rem .6rem 2.1rem;
    margin-bottom: .5rem;
    background: var(--warn-bg);
    border: 1px solid rgba(168, 118, 12, .25);
    border-radius: var(--r-sm);
    font-size: .92rem;
    line-height: 1.6;
}
.issue-list li:last-child { margin-bottom: 0; }
.issue-list li::before {
    content: "!";
    position: absolute;
    inset-inline-start: .8rem;
    top: .62rem;
    width: 1.05rem;
    height: 1.05rem;
    border-radius: 50%;
    background: var(--warn);
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    line-height: 1.05rem;
    text-align: center;
}
html[dir="rtl"] .issue-list li { padding: .6rem 2.1rem .6rem .8rem; }

.divider { height: 1px; background: var(--border); margin: 1.5rem 0; border: 0; }

.spinner-overlay {
    position: fixed;
    inset: 0;
    z-index: 1090;
    display: none;
    place-items: center;
    background: rgba(18, 36, 28, .55);
    backdrop-filter: blur(2px);
}
.spinner-overlay.is-open { display: grid; }
.spinner-overlay__box {
    background: var(--surface);
    border-radius: var(--r-lg);
    padding: 1.75rem 2.25rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
    max-width: 320px;
}
.spinner-ring {
    width: 40px;
    height: 40px;
    margin: 0 auto .9rem;
    border: 3px solid var(--dsc-teal-100);
    border-top-color: var(--dsc-teal-700);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- footer */
.site-footer {
    flex: 0 0 auto;
    margin-top: auto;
    background: linear-gradient(100deg, var(--dsc-deep) 0%, var(--dsc-deep-2) 100%);
    color: var(--text-on-dark-muted);
    font-size: .85rem;
}
.site-footer__inner {
    padding: 1.5rem 1.75rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.site-footer__brand { display: flex; align-items: center; gap: 1.25rem; }
.site-footer a { color: #fff; }
.site-footer a:hover { color: var(--dsc-teal-300); }
.site-footer__links { display: flex; flex-wrap: wrap; gap: 1.25rem; }

/* --------------------------------------------------------- print (exports) */
@media print {
    .site-header, .site-footer, .page-head__actions, .filter-bar, .actions, .no-print { display: none !important; }
    body { background: #fff; }
    .card-dsc { box-shadow: none; border-color: #ccc; }
}

/* ------------------------------------------------------- responsive tuning */
@media (max-width: 991.98px) {
    :root { --header-h: 76px; }
    .site-header__logo--gov img { height: 42px; }
    .site-header__logo--dsc img { height: 28px; }
    .page-shell { padding: 1.25rem 1rem 2.5rem; }
    .page-head__inner { padding: 1.15rem 1rem 1rem; }
}

/* Below this width the logos take the first row and the actions the second. */
@media (max-width: 700px) {
    .site-header__logo--dsc { order: 2; margin-inline-start: auto; }
    .site-header__actions {
        order: 3;
        flex-basis: 100%;
        justify-content: space-between;
        margin-inline-start: 0;
    }
}

@media (max-width: 767.98px) {
    /* keep inputs at 16px so iOS does not zoom the page on focus */
    .form-control,
    .form-select { font-size: 16px; }
    .site-header__bar { padding: .7rem 1rem; gap: .5rem .75rem; }
    .site-footer__inner { padding: 1.25rem 1rem; }
    .site-header__logo--gov img { height: 34px; }
    .site-header__logo--dsc img { height: 22px; }
    .user-chip { max-width: 12rem; }
    .page-head__inner { flex-direction: column; align-items: stretch; }
    .page-head__actions .btn { flex: 1 1 auto; }
    .stat-card__value { font-size: 1.65rem; }
    .filter-actions .btn { flex: 1 1 calc(50% - .25rem); }
    .filter-actions .spacer { display: none; }
    .card-dsc__head { padding: .85rem 1rem; }
    .card-dsc__body { padding: 1rem; }
}

@media (max-width: 400px) {
    .site-header__logo--gov img { height: 28px; }
    .site-header__logo--dsc img { height: 18px; }
    .hbtn { padding: .4rem .6rem; font-size: .78rem; }
    .segmented-input { gap: .3rem; }
    .segmented-input .form-control { padding-inline: .3rem; }
}

/* ------------------------------------------------------------- dialogs */
/* SweetAlert2, restyled to match the rest of the portal. The library ships
   its own rounded-blue look; these rules pull it onto the brand palette,
   typeface and radii so a confirmation does not read as a third-party popup. */

.swal2-container { z-index: 1100; }               /* above Bootstrap modals */

/* Toasts anchor to the top corners, where the sticky header already sits.
   Push the toast layer clear of it so it never covers the language switch
   or the user menu. Only the toast positions move; centred dialogs stay put. */
.swal2-container.swal2-top-end,
.swal2-container.swal2-top-start,
.swal2-container.swal2-top {
    padding-top: calc(var(--header-h) + .6rem);
}

.gv-swal {
    font-family: var(--font-sans);
    border-radius: var(--r-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    background: var(--surface);
    color: var(--text);
    padding: 1.75rem 1.5rem 1.35rem;
}

.gv-swal__title {
    font-family: var(--font-sans);
    font-size: 1.18rem;
    font-weight: 600;
    color: var(--text);
    padding: 0;
    margin-bottom: .35rem;
}

.gv-swal__body {
    font-size: .95rem;
    color: var(--text-muted);
    margin: 0;
    padding: 0 .5rem;
    line-height: 1.55;
}

.gv-swal__actions {
    gap: .55rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}
.gv-swal__actions .btn { min-width: 7rem; }

.gv-swal__validation {
    background: var(--danger-bg);
    color: var(--danger);
    border-radius: var(--r-sm);
    font-size: .85rem;
}

/* the library's own focus ring clashes with ours */
.gv-swal .btn:focus,
.gv-swal .btn:focus-visible { box-shadow: var(--focus-ring) !important; }

.gv-swal .swal2-input,
.gv-swal .swal2-textarea {
    font-family: var(--font-sans);
    margin-inline: 0;
    width: 100%;
}
.gv-swal .swal2-input-label {
    font-family: var(--font-sans);
    font-size: .84rem;
    font-weight: 600;
    color: var(--text);
    justify-content: flex-start;
    margin-bottom: .3rem;
}

/* ------- delete confirmation ------- */
.gv-swal__lead  { margin: 0 0 .85rem; }
.gv-swal__who {
    margin: 0 0 .95rem;
    padding: .7rem .8rem;
    background: var(--danger-bg);
    border: 1px solid rgba(179, 53, 42, .22);
    border-radius: var(--r-sm);
    line-height: 1.5;
}
.gv-swal__who code {
    font-size: .88rem;
    color: var(--danger);
    background: none;
    padding: 0;
    word-break: break-all;
}
.gv-swal__ask {
    margin: 0 0 .3rem;
    font-size: .9rem;
    color: var(--text-muted);
}

/* ------- toasts ------- */
.gv-swal-toast {
    font-family: var(--font-sans);
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    background: var(--surface);
}
.gv-swal-toast .swal2-title {
    font-family: var(--font-sans);
    font-size: .92rem;
    font-weight: 500;
    color: var(--text);
    margin: 0;
    text-align: start;
}
.gv-swal-toast .swal2-timer-progress-bar { background: var(--dsc-teal); }

/* RTL: SweetAlert keys off dir on the container, but the icon spacing needs help */
html[dir="rtl"] .gv-swal-toast .swal2-icon { margin-inline: 0 .6rem; }

/* Comfortable tap targets in dialogs. Note we run with buttonsStyling:false, so
   SweetAlert does NOT add its .swal2-styled class — target the role classes it
   always applies instead. */
.gv-swal__actions .swal2-confirm,
.gv-swal__actions .swal2-cancel,
.gv-swal__actions .swal2-deny { min-height: 44px; }

@media (max-width: 575.98px) {
    .gv-swal { padding: 1.35rem 1.1rem 1.1rem; }

    /* Stack full-width on phones: side-by-side buttons get too narrow to hit
       accurately, and column-reverse keeps the confirm action on top. */
    .gv-swal .gv-swal__actions {
        flex-direction: column-reverse;
        flex-wrap: nowrap;
        gap: .5rem;
        /* The actions row is auto-sized by SweetAlert's grid, so it hugs its
           content; stretch it first or the buttons have nothing to fill. */
        width: 100%;
        align-items: stretch;
    }
    .gv-swal .gv-swal__actions .swal2-confirm,
    .gv-swal .gv-swal__actions .swal2-cancel,
    .gv-swal .gv-swal__actions .swal2-deny {
        width: 100%;
        margin: 0;
    }
}

/* Reduced motion is handled in dialogs.js via SweetAlert's showClass/hideClass.
   It must NOT be done with `animation: none` here: SweetAlert removes the popup
   on animationend, so suppressing the animation in CSS means that event never
   fires and the dialog is never cleaned up, leaving body{overflow:hidden} and a
   page that cannot scroll. */
