.site-header-sticky { position: sticky; top: 0; z-index: 1030; }
.site-header-group { overflow-wrap: anywhere; }
.site-header .navbar > .container { gap: .5rem; }
.site-header .navbar-brand {
    margin: 0;
    max-inline-size: 12rem;
    flex: 0 1 auto;
    white-space: normal;
    line-height: 1.2;
    font-size: clamp(.92rem, 2.7vw, 1.45rem);
}
.site-header .navbar-brand img { display: block; max-inline-size: 100%; height: auto; max-height: 40px; }
.site-header .navbar-toggler { flex: none; padding-inline: .5rem; min-height: 42px; }
.site-header .navbar-collapse, .site-nav-actions, .site-nav-actions > * { min-inline-size: 0; }
.site-header .dropdown-item, .site-nav-actions .btn { white-space: normal; overflow-wrap: anywhere; }
.site-header .dropdown-menu { max-inline-size: min(22rem, calc(100vw - 2rem)); text-align: start; }
.site-header .nav-link { white-space: nowrap; }

.site-search { flex: 1 1 14rem; min-inline-size: 0; max-inline-size: 19rem; position: relative; }
.site-search input {
    display: block;
    width: 100%;
    min-inline-size: 0;
    min-height: 42px;
    padding: .45rem .65rem;
    border: 1px solid var(--gray-200, #d9d9dd);
    border-radius: .65rem;
    background: #fff;
    color: #222226;
    font: inherit;
    font-size: clamp(.75rem, 2.6vw, 1rem);
}
.site-search input:focus { outline: 2px solid var(--primary-color, var(--primary, #d32f2f)); outline-offset: 1px; }
.site-search-panel {
    position: absolute;
    z-index: 1100;
    inset-block-start: calc(100% + 5px);
    inset-inline: 0;
    max-height: min(320px, 55vh);
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #fff;
    color: #222226;
    border: 1px solid #d9d9dd;
    border-radius: .65rem;
    box-shadow: 0 8px 24px rgb(0 0 0 / 14%);
    overflow-wrap: anywhere;
}
.site-search [hidden] { display: none !important; }
.site-search-panel ul { list-style: none; margin: 0; padding: 0; }
.site-search-panel a { display: block; color: inherit; text-decoration: none; padding: .55rem .7rem; }
.site-search-panel a:hover, .site-search-panel [aria-selected="true"] { background: #f7f7f8; color: var(--primary-color, var(--primary, #d32f2f)); }
.site-search-panel small { display: block; color: #55555a; }
.site-search-empty { margin: 0; padding: .7rem; }

.main-content, .main-content > .container, .legacy-site :is(.grid, .form-row, .lb-grid) > * { min-width: 0; }
:is(.main-content, .legacy-site) :is(img, video) { max-inline-size: 100%; }
:is(.main-content, .legacy-site) :is(.card, h1, h2, h3, p, a) { overflow-wrap: anywhere; }
.footer :is(.row > *, .newsletter input, li .d-flex > div) { min-inline-size: 0; }
.footer :is(a, p, h5) { overflow-wrap: anywhere; }
.footer img { max-inline-size: 100%; height: auto; max-height: 40px; }
.footer .social-media > div { flex-wrap: wrap; }
.legacy-site .nav-container { flex-wrap: wrap; }
.legacy-site .nav-container > .site-search { min-inline-size: 8rem; }
.legacy-site .nav-links { min-inline-size: 0; }

@media (max-width: 1399.98px) {
    .site-header .navbar > .container, .site-header .navbar > .container-fluid { flex-wrap: wrap; }
    .site-header .navbar-collapse.show { max-height: 65vh; max-height: 65dvh; overflow-y: auto; }
    .site-header .nav-link { white-space: normal; }
    .site-header .site-nav-actions { justify-content: center; padding-block: .35rem; }
}

@media (max-width: 767.98px) {
    .site-header .navbar-brand { max-inline-size: min(31vw, 8rem); }
    .site-header .site-search, .legacy-site .site-search { max-inline-size: none; flex-basis: 0; }
    .site-header .site-search-panel { inset-inline-end: -1.7rem; }
    .site-search input { font-size: 16px; }
    .site-search input::placeholder { font-size: .75rem; }
    .main-content { padding-block: 1rem 1.5rem; }
    .main-content :is(.section, .card) { min-width: 0; }
    .main-content .section { padding-inline: clamp(.45rem, 2vw, 1rem); }
    .main-content .hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; }
    .main-content .hero-actions .btn { margin: 0 !important; }
    .main-content .btn-lg { font-size: 1rem; }
    .main-content :is(input.form-control, textarea.form-control, select.form-control, select.form-select) { font-size: max(1em, 16px); }
    .main-content :is(.grid-2, .grid-3, .grid-4), .legacy-site :is(.grid-2, .grid-3, .grid-4) {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
    }
    .footer .nav { gap: .25rem; }
    .footer .nav-link { padding-inline: .5rem; }
    .legacy-site .nav-container { gap: .5rem; padding-inline: .7rem; }
    .legacy-site .nav-container > .brand { min-width: 0; max-inline-size: 36vw; gap: .3rem; font-size: .85rem; }
    .legacy-site .brand .logo { flex: 0 0 32px; height: 32px; font-size: .75rem; }
    .legacy-site .nav-container > :is(button, .btn) { flex: none; }
    .legacy-site .nav-container > .site-search { min-inline-size: 0; }
    .legacy-site .lb-social-entry .form-group { min-width: min(100%, 220px); }
    .legacy-site .lb-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Saved-records tables (letters, my files) become stacked cards on phones,
   so Arabic words and dates never break into single letters. */
.stack-table td, .stack-table th { word-break: normal; overflow-wrap: normal; }
.stack-table .stack-nowrap { white-space: nowrap; }
.stack-table .stack-filename { overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .stack-table thead { display: none; }
  .stack-table, .stack-table tbody, .stack-table tr, .stack-table td { display: block; width: 100%; }
  .stack-table tr { border: 1px solid #e5e5e8; border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; background: #fff; }
  .stack-table td { border: 0 !important; padding: 4px 0 !important; text-align: start; }
  .stack-table td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; font-weight: 600; color: #6b6b72; }
  .stack-table td.stack-actions { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 8px !important; }
  .stack-table td.stack-actions form { display: inline-flex !important; margin: 0; }
  .stack-table td.stack-empty { text-align: center; }
}

/* Terms and conditions text (terms page, account policy, home page) */
.terms-text { line-height: 1.9; overflow-wrap: anywhere; }
.terms-text h2 { font-size: clamp(1.4rem, 5vw, 2rem); font-weight: 700; margin-bottom: .5rem; }
.terms-text h3 { font-size: clamp(1.05rem, 4vw, 1.25rem); font-weight: 700; color: var(--primary-dark, #B71C1C); margin: 0 0 .5rem; }
.terms-text .terms-updated { color: #6b6b72; font-size: .9rem; }
.terms-text ul { padding-inline-start: 1.25rem; margin-bottom: 1rem; }
.terms-text li + li { margin-top: .25rem; }
.terms-text article.terms-article { margin-top: 1.75rem; }
.terms-text--collapsible details.terms-article { border: 1px solid #e5e5e8; border-radius: 12px; background: #fff; margin-top: .75rem; }
.terms-text--collapsible details.terms-article > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 12px 16px; cursor: pointer; list-style: none; touch-action: manipulation; }
.terms-text--collapsible details.terms-article > summary::-webkit-details-marker { display: none; }
.terms-text--collapsible details.terms-article > summary::after { content: '+'; flex: none; font-size: 1.4rem; line-height: 1; color: var(--primary-dark, #B71C1C); }
.terms-text--collapsible details.terms-article[open] > summary::after { content: '−'; }
.terms-text--collapsible details.terms-article > summary:focus-visible { outline: 3px solid rgba(211, 47, 47, .45); outline-offset: 2px; border-radius: 12px; }
.terms-text--collapsible details.terms-article > summary h3 { margin: 0; }
.terms-text--collapsible details.terms-article > :not(summary) { padding-inline: 16px; }
.terms-text--collapsible details.terms-article > :last-child { padding-bottom: 12px; }
.terms-text .terms-signature { margin-top: 1.5rem; text-align: center; }
.terms-text--collapsible details.terms-article > ul { padding-inline-start: calc(16px + 1.25rem); }

/* Free edit window (letters and contracts), mobile first */
.edit-window { display:flex; align-items:center; gap:6px; flex-wrap:wrap; margin:6px 0 0; padding:4px 10px; border-radius:999px; font-size:13px; font-weight:600; line-height:1.6; width:fit-content; max-width:100%; }
.edit-window.is-open { background:#E8F5E9; color:#1B5E20; }
.edit-window.is-closed { background:#F3F3F5; color:#55555A; }
.edit-window.is-review { background:#FFF4E5; color:#8A4B00; }
.edit-window.is-draft { background:#F7F7F8; color:#6B6B72; font-weight:500; }
.edit-window-banner { display:grid; gap:8px; margin:0 0 14px; padding:12px 14px; border-radius:12px; border:1px solid #E5E5E8; background:#fff; }
.edit-window-banner[hidden] { display:none !important; }
.edit-window-banner .edit-window { margin:0; }
.edit-window-banner p { margin:0; font-size:14px; line-height:1.7; }
.edit-window-banner .btn { min-height:44px; width:100%; }
.edit-window-notice { margin:10px 0 0; padding:10px 12px; border-radius:10px; background:#FDF3F3; color:#7A1F27; font-size:13px; line-height:1.8; }
@media (min-width:600px) { .edit-window-banner .btn { width:auto; justify-self:start; } }
[data-new-version][hidden], [data-free-edit][hidden] { display:none !important; }
.btn[hidden], .card[hidden], .edit-window-notice[hidden] { display:none !important; }
