:root {
    --companies-navy: #08253f;
    --companies-blue: #006f9f;
    --companies-blue-dark: #00577e;
    --companies-muted: #637b8d;
    --companies-line: #dce6ed;
    --companies-soft: #f4f8fa;
    --companies-sky: #eaf5fa;
    --companies-white: #fff;
    --companies-shadow: 0 10px 28px rgba(8, 37, 63, 0.06);
    --companies-radius: 16px;
    --companies-container: 1240px;
}

body.companies-page {
    overflow-x: hidden;
    background: #f8fafb;
    color: var(--companies-navy);
}

body.companies-filter-open { overflow: hidden; }

.companies-container {
    width: min(calc(100% - 32px), var(--companies-container));
    margin-inline: auto;
}

.companies-main { min-height: 70vh; }

.companies-hero {
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid #e7eef3;
    background: #fff;
}

.companies-breadcrumb {
    display: flex;
    align-items: center;
    gap: 9px;
    padding-top: 26px;
    color: #7890a1;
    font-size: 0.78rem;
    font-weight: 600;
}

.companies-breadcrumb a {
    color: var(--companies-blue);
    text-decoration: none;
}

.companies-breadcrumb a:hover { color: var(--companies-blue-dark); }
.companies-breadcrumb i { font-size: 0.7rem; }

.companies-hero-grid {
    display: grid;
    min-height: 245px;
    grid-template-columns: minmax(320px, 0.8fr) minmax(460px, 1.2fr);
    align-items: center;
    gap: clamp(28px, 6vw, 90px);
}

.companies-hero-copy { padding: 32px 0 48px; }

.companies-eyebrow {
    margin: 0 0 8px;
    color: var(--companies-blue);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.companies-hero h1 {
    margin: 0;
    color: var(--companies-navy);
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2.5rem, 4.8vw, 4.45rem);
    font-weight: 500;
    letter-spacing: -0.045em;
    line-height: 1;
}

.companies-hero-copy > p:last-child {
    max-width: 470px;
    margin: 20px 0 0;
    color: #4e687c;
    font-size: clamp(0.96rem, 1.3vw, 1.08rem);
    line-height: 1.75;
}

.companies-hero-visual {
    align-self: stretch;
    min-width: 0;
}

.companies-hero-visual img {
    display: block;
    width: 100%;
    height: 100%;
    max-height: 270px;
    object-fit: cover;
    object-position: 58% 64%;
    mask-image: linear-gradient(to right, transparent 0, #000 19%, #000 100%);
}

.companies-search-wrap {
    position: relative;
    z-index: 2;
    margin-top: -1px;
    background: #fff;
}

.companies-search-panel {
    display: grid;
    grid-template-columns: minmax(220px, 1.6fr) minmax(180px, 1.1fr) minmax(170px, 1fr) minmax(160px, 0.95fr) auto;
    gap: 10px;
    padding: 18px;
    border: 1px solid var(--companies-line);
    border-radius: 0 0 var(--companies-radius) var(--companies-radius);
    background: var(--companies-white);
    box-shadow: var(--companies-shadow);
}

.companies-field {
    position: relative;
    min-width: 0;
}

.companies-field > i {
    position: absolute;
    top: 50%;
    left: 14px;
    color: var(--companies-blue);
    font-size: 0.94rem;
    transform: translateY(-50%);
    pointer-events: none;
}

.companies-field input,
.companies-field select {
    width: 100%;
    height: 48px;
    border: 1px solid #cedbe4;
    border-radius: 10px;
    background: #fff;
    color: var(--companies-navy);
    font: inherit;
    font-size: 0.82rem;
    outline: 0;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.companies-field input { padding: 0 14px 0 42px; }

.companies-field select {
    appearance: none;
    padding: 0 38px 0 14px;
    background-image: linear-gradient(45deg, transparent 50%, #688194 50%), linear-gradient(135deg, #688194 50%, transparent 50%);
    background-position: calc(100% - 17px) 21px, calc(100% - 12px) 21px;
    background-repeat: no-repeat;
    background-size: 5px 5px, 5px 5px;
}

.companies-field input:focus,
.companies-field select:focus {
    border-color: var(--companies-blue);
    box-shadow: 0 0 0 3px rgba(0, 111, 159, 0.13);
}

.companies-field input::placeholder { color: #8295a3; }

.companies-button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.companies-button:hover { transform: translateY(-1px); }

.companies-button-primary {
    background: var(--companies-blue);
    color: #fff;
}

.companies-button-primary:hover {
    background: var(--companies-blue-dark);
    color: #fff;
}

.companies-button-secondary {
    border-color: #b9cad6;
    background: #fff;
    color: var(--companies-navy);
}

.companies-button-secondary:hover {
    border-color: var(--companies-blue);
    color: var(--companies-blue);
}

.companies-search-button {
    min-width: 116px;
    height: 48px;
}

.companies-validation {
    margin: 10px 0 0;
    color: #b42318;
    font-size: 0.78rem;
}

.companies-directory { padding: 30px 0 64px; }

.companies-results-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.companies-result-count {
    margin: 0;
    color: var(--companies-navy);
    font-size: 0.88rem;
    font-weight: 600;
}

.companies-result-count strong { font-size: 1rem; }

.companies-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.companies-sort-form {
    display: flex;
    align-items: center;
    gap: 9px;
}

.companies-sort-form label {
    color: #718797;
    font-size: 0.76rem;
    white-space: nowrap;
}

.companies-sort-form select {
    height: 42px;
    min-width: 170px;
    padding: 0 34px 0 12px;
    border: 1px solid #cedbe4;
    border-radius: 9px;
    background: #fff;
    color: var(--companies-navy);
    font: inherit;
    font-size: 0.78rem;
}

.companies-filter-open {
    display: none;
    height: 42px;
    padding: 0 15px;
}

.companies-layout {
    display: grid;
    grid-template-columns: 254px minmax(0, 1fr);
    align-items: start;
    gap: 24px;
}

.companies-filter-overlay { display: none; }

.companies-filter-panel {
    position: sticky;
    top: 102px;
    overflow: hidden;
    border: 1px solid var(--companies-line);
    border-radius: var(--companies-radius);
    background: #fff;
    box-shadow: 0 7px 22px rgba(8, 37, 63, 0.035);
}

.companies-filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 19px 20px;
    border-bottom: 1px solid #e7eef3;
}

.companies-filter-header h2 {
    margin: 0;
    color: var(--companies-navy);
    font-size: 0.94rem;
    font-weight: 700;
}

.companies-clear-link {
    color: var(--companies-blue);
    font-size: 0.72rem;
    font-weight: 700;
    text-decoration: none;
}

.companies-filter-close {
    display: none;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--companies-line);
    border-radius: 9px;
    background: #fff;
    color: var(--companies-navy);
}

.companies-filter-body { padding: 20px; }

.companies-filter-section + .companies-filter-section {
    margin-top: 24px;
    padding-top: 22px;
    border-top: 1px solid #edf2f5;
}

.companies-filter-section h3 {
    margin: 0 0 12px;
    color: var(--companies-navy);
    font-size: 0.78rem;
    font-weight: 700;
}

.companies-filter-location input {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border: 1px solid #cedbe4;
    border-radius: 9px;
    color: var(--companies-navy);
    font: inherit;
    font-size: 0.76rem;
    outline: 0;
}

.companies-filter-location input:focus {
    border-color: var(--companies-blue);
    box-shadow: 0 0 0 3px rgba(0, 111, 159, 0.12);
}

.companies-category-options {
    display: grid;
    gap: 10px;
    max-height: 330px;
    overflow-y: auto;
    padding-right: 4px;
    scrollbar-width: thin;
}

.companies-category-option {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 9px;
    color: #405b6f;
    font-size: 0.75rem;
    line-height: 1.4;
    cursor: pointer;
}

.companies-category-option input {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    margin: 1px 0 0;
    accent-color: var(--companies-blue);
}

.companies-filter-footer {
    display: grid;
    gap: 10px;
    padding: 0 20px 20px;
}

.companies-filter-footer .companies-button { width: 100%; }

.companies-results { min-width: 0; }

.companies-card-list {
    display: grid;
    gap: 14px;
}

.company-directory-card {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr) auto;
    align-items: center;
    gap: 20px;
    min-height: 178px;
    padding: 22px;
    border: 1px solid var(--companies-line);
    border-radius: var(--companies-radius);
    background: #fff;
    box-shadow: 0 6px 22px rgba(8, 37, 63, 0.035);
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.company-directory-card:hover {
    border-color: #bdd1dd;
    box-shadow: var(--companies-shadow);
    transform: translateY(-1px);
}

.company-card-logo {
    display: flex;
    width: 88px;
    height: 88px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid #d9e4eb;
    border-radius: 16px;
    background: #f7fafc;
}

.company-card-logo img {
    display: block;
    width: 100%;
    height: 100%;
    padding: 7px;
    object-fit: contain;
}

.company-logo-fallback {
    display: inline-flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    background: var(--companies-sky);
    color: var(--companies-blue);
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.company-card-content { min-width: 0; }

.company-card-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.company-card-heading h2 {
    margin: 0;
    font-size: 1.02rem;
    font-weight: 700;
    line-height: 1.35;
}

.company-card-heading h2 a {
    color: var(--companies-navy);
    text-decoration: none;
}

.company-card-heading h2 a:hover { color: var(--companies-blue); }

.company-primary-category {
    margin: 3px 0 0;
    color: var(--companies-blue);
    font-size: 0.72rem;
    font-weight: 600;
}

.company-location {
    display: flex;
    max-width: 210px;
    align-items: center;
    gap: 6px;
    margin: 2px 0 0;
    color: #718797;
    font-size: 0.7rem;
    line-height: 1.4;
    text-align: right;
}

.company-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-top: 10px;
    color: #5f7789;
    font-size: 0.69rem;
}

.company-facts span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.company-facts i { color: var(--companies-blue); }

.company-summary {
    display: -webkit-box;
    overflow: hidden;
    max-width: 720px;
    margin: 11px 0 0;
    color: #526b7e;
    font-size: 0.76rem;
    line-height: 1.6;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.company-service-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
}

.company-service-tags li {
    padding: 5px 9px;
    border-radius: 6px;
    background: var(--companies-soft);
    color: #587184;
    font-size: 0.65rem;
    font-weight: 500;
}

.company-card-actions {
    display: flex;
    min-width: 132px;
    justify-content: flex-end;
}

.company-card-actions .companies-button {
    min-width: 132px;
    padding: 0 16px;
}

.companies-empty {
    padding: 68px 24px;
    border: 1px solid var(--companies-line);
    border-radius: var(--companies-radius);
    background: #fff;
    text-align: center;
}

.companies-empty-icon {
    display: inline-flex;
    width: 58px;
    height: 58px;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    background: var(--companies-sky);
    color: var(--companies-blue);
    font-size: 1.35rem;
}

.companies-empty h2 {
    margin: 18px 0 8px;
    font-size: 1.24rem;
}

.companies-empty p {
    max-width: 460px;
    margin: 0 auto;
    color: var(--companies-muted);
    font-size: 0.84rem;
    line-height: 1.65;
}

.companies-empty-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 22px;
}

.companies-empty-actions .companies-button { padding: 0 18px; }

.companies-pagination { margin-top: 28px; }

.companies-pagination .pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
    margin: 0;
}

.companies-pagination .page-item .page-link {
    display: inline-flex;
    min-width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--companies-line);
    border-radius: 8px;
    background: #fff;
    color: var(--companies-navy);
    font-size: 0.74rem;
    box-shadow: none;
}

.companies-pagination .page-item.active .page-link {
    border-color: var(--companies-blue);
    background: var(--companies-blue);
    color: #fff;
}

.companies-pagination .page-item.disabled .page-link {
    background: #f4f7f9;
    color: #9aacb8;
}

.companies-trust { padding: 0 0 66px; }

.companies-trust-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border: 1px solid var(--companies-line);
    border-radius: var(--companies-radius);
    background: #f1f7fa;
}

.companies-trust-item {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 20px;
}

.companies-trust-item + .companies-trust-item { border-left: 1px solid #dbe6ed; }

.companies-trust-icon {
    display: inline-flex;
    width: 42px;
    height: 42px;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: #fff;
    color: var(--companies-blue);
    font-size: 1rem;
}

.companies-trust-item h3 {
    margin: 0;
    font-size: 0.74rem;
    font-weight: 700;
}

.companies-trust-item p {
    margin: 4px 0 0;
    color: #698092;
    font-size: 0.64rem;
    line-height: 1.5;
}

.companies-sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    clip-path: inset(50%) !important;
}

@media (max-width: 1180px) {
    .companies-search-panel {
        grid-template-columns: minmax(220px, 1.5fr) minmax(170px, 1fr) minmax(160px, 1fr) minmax(160px, 1fr);
    }

    .companies-search-button { grid-column: 1 / -1; }

    .company-directory-card {
        grid-template-columns: 82px minmax(0, 1fr);
    }

    .company-card-logo { width: 78px; height: 78px; }

    .company-card-actions {
        grid-column: 2;
        justify-content: flex-start;
    }
}

@media (max-width: 1024px) {
    .companies-hero-grid { grid-template-columns: minmax(290px, 0.9fr) 1.1fr; }
    .companies-layout { grid-template-columns: 230px minmax(0, 1fr); gap: 18px; }
    .companies-filter-body { padding: 18px; }
    .companies-filter-header { padding-inline: 18px; }
    .companies-trust-grid { grid-template-columns: repeat(2, 1fr); }
    .companies-trust-item:nth-child(3) { border-left: 0; border-top: 1px solid #dbe6ed; }
    .companies-trust-item:nth-child(4) { border-top: 1px solid #dbe6ed; }
}

@media (max-width: 900px) {
    .companies-hero-grid { grid-template-columns: 1fr 1fr; }
    .companies-search-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .companies-search-button { grid-column: auto; }
    .companies-layout { display: block; }
    .companies-filter-open { display: inline-flex; }

    .companies-filter-overlay {
        position: fixed;
        z-index: 1050;
        inset: 0;
        display: block;
        visibility: hidden;
        background: rgba(4, 24, 41, 0.46);
        opacity: 0;
        transition: opacity 170ms ease, visibility 170ms ease;
    }

    .companies-filter-overlay.is-open { visibility: visible; opacity: 1; }

    .companies-filter-panel {
        position: fixed;
        z-index: 1060;
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        max-height: min(88vh, 720px);
        overflow-y: auto;
        border-width: 1px 0 0;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -18px 44px rgba(8, 37, 63, 0.18);
        transform: translateY(105%);
        transition: transform 190ms ease;
    }

    .companies-filter-panel.is-open { transform: translateY(0); }
    .companies-filter-panel .companies-filter-header { position: sticky; z-index: 1; top: 0; background: #fff; }
    .companies-filter-close { display: inline-flex; }
    .companies-filter-footer { position: sticky; bottom: 0; padding-top: 14px; border-top: 1px solid var(--companies-line); background: #fff; }
    .companies-category-options { max-height: none; }
}

@media (max-width: 767px) {
    .companies-container { width: min(calc(100% - 24px), var(--companies-container)); }
    .companies-breadcrumb { padding-top: 18px; }
    .companies-breadcrumb i,
    .companies-breadcrumb span { display: none; }
    .companies-breadcrumb a::before { content: "← "; }

    .companies-hero-grid { display: block; min-height: 0; }
    .companies-hero-copy { padding: 24px 0 30px; }
    .companies-hero h1 { font-size: clamp(2.35rem, 12vw, 3.1rem); }
    .companies-hero-copy > p:last-child { margin-top: 14px; font-size: 0.92rem; line-height: 1.65; }
    .companies-hero-visual { display: none; }
    .companies-search-panel { grid-template-columns: 1fr; padding: 14px; border-radius: 0 0 14px 14px; }
    .companies-search-button { width: 100%; }
    .companies-directory { padding-top: 24px; }
    .companies-results-toolbar { align-items: flex-end; }
    .companies-toolbar-actions { align-items: flex-end; }
    .companies-sort-form { display: grid; gap: 4px; }
    .companies-sort-form select { min-width: 150px; }
    .company-directory-card { grid-template-columns: 68px minmax(0, 1fr); gap: 14px; padding: 18px; }
    .company-card-logo { width: 66px; height: 66px; border-radius: 13px; }
    .company-card-heading { display: block; }
    .company-location { max-width: none; margin-top: 7px; text-align: left; }
    .company-facts,
    .company-summary,
    .company-service-tags,
    .company-card-actions { grid-column: 1 / -1; }
    .company-facts { margin-top: 0; }
    .company-summary { font-size: 0.78rem; -webkit-line-clamp: 3; }
    .company-card-actions { display: grid; }
    .company-card-actions .companies-button { width: 100%; min-height: 46px; }
    .companies-empty { padding: 50px 18px; }
    .companies-trust-grid { grid-template-columns: 1fr; }
    .companies-trust-item + .companies-trust-item { border-top: 1px solid #dbe6ed; border-left: 0; }
    .companies-trust { padding-bottom: 48px; }
}

@media (max-width: 430px) {
    .companies-results-toolbar { display: grid; gap: 13px; }
    .companies-toolbar-actions { display: grid; grid-template-columns: auto minmax(0, 1fr); }
    .companies-sort-form { min-width: 0; }
    .companies-sort-form select { width: 100%; min-width: 0; }
    .company-directory-card { grid-template-columns: 58px minmax(0, 1fr); padding: 16px; }
    .company-card-logo { width: 56px; height: 56px; }
    .company-card-heading h2 { font-size: 0.96rem; }
    .companies-empty-actions { display: grid; }
}

@media (max-width: 390px) {
    .companies-container { width: min(calc(100% - 20px), var(--companies-container)); }
    .companies-search-panel { padding: 12px; }
    .companies-toolbar-actions { grid-template-columns: 1fr; }
    .companies-filter-open { width: 100%; }
    .companies-sort-form select { height: 44px; }
}

@media (max-width: 375px) {
    .companies-hero-copy > p:last-child { font-size: 0.86rem; }
    .company-directory-card { gap: 11px; padding: 14px; }
    .company-facts { display: grid; gap: 6px; }
    .company-service-tags li { font-size: 0.62rem; }
}

@media (prefers-reduced-motion: reduce) {
    .companies-filter-overlay,
    .companies-filter-panel,
    .company-directory-card,
    .companies-button { transition: none; }
}
