:root {
    --newcy-blue: #2481cc;
    --newcy-blue-hover: #1f74b7;
    --newcy-blue-soft: #eaf4fb;
    --newcy-bg: #eef2f5;
    --newcy-card: #ffffff;
    --newcy-text: #17212b;
    --newcy-muted: #7d8b96;
    --newcy-border: #dce3e8;
    --newcy-green: #4bb34b;
    --newcy-shadow: 0 1px 2px rgba(37, 55, 70, .05);
}

html,
body {
    min-height: 100%;
}

body {
    color: var(--newcy-text) !important;
    background: var(--newcy-bg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--newcy-blue) !important;
    transition: color .16s ease, background-color .16s ease, border-color .16s ease;
}

a:hover {
    color: var(--newcy-blue-hover);
    text-decoration: none;
}

/* Navigation */
body > header {
    position: sticky;
    z-index: 1000;
    top: 0;
    border-bottom: 1px solid var(--newcy-border);
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 1px 0 rgba(32, 51, 64, .02);
    backdrop-filter: blur(14px);
}

.navbar.bg-dark {
    min-height: 68px;
    padding: 0 18px;
    background: transparent !important;
}

.navbar > .container {
    width: 100%;
    max-width: 1120px;
    padding: 0;
}

.navbar-dark .navbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-right: 24px;
    color: var(--newcy-text);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -.035em;
}

.navbar-dark .navbar-brand::before {
    content: "n";
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: #229ed9;
    font-size: 20px;
    font-weight: 800;
    line-height: 1;
}

.navbar-dark .navbar-brand:hover {
    color: var(--newcy-blue);
}

.navbar-nav {
    align-items: center;
    gap: 2px;
}

.navbar-dark .navbar-nav .nav-link {
    padding: 9px 10px;
    border-radius: 9px;
    color: #3f4f5c !important;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.navbar-dark .navbar-nav .nav-link:hover,
.navbar-dark .navbar-nav .nav-link:focus {
    color: var(--newcy-blue) !important;
    background: var(--newcy-blue-soft);
}

.navbar-dark .navbar-toggler {
    min-width: 46px;
    min-height: 42px;
    padding: 6px 8px;
    border: 2px solid var(--newcy-blue) !important;
    border-radius: 10px;
    color: var(--newcy-blue) !important;
    background: var(--newcy-blue-soft) !important;
    box-shadow: 0 2px 7px rgba(36, 129, 204, .16);
    opacity: 1;
}

.navbar-dark .navbar-toggler-icon {
    width: 26px;
    height: 26px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3E%3Cpath stroke='%232481cc' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2.6' d='M5 8h20M5 15h20M5 22h20'/%3E%3C/svg%3E") !important;
    opacity: 1;
}

.navbar-dark .navbar-toggler:hover,
.navbar-dark .navbar-toggler:focus {
    border-color: var(--newcy-blue-hover) !important;
    background: #dceefa !important;
    box-shadow: 0 0 0 3px rgba(36, 129, 204, .16);
}

/* Page shell */
main.flex-shrink-0 {
    flex: 1 0 auto;
}

main > .container {
    width: 100%;
    max-width: 960px;
    padding: 22px 18px 76px;
}

main > .container > br:first-of-type {
    display: none;
}

.breadcrumb {
    margin: 0 0 14px;
    padding: 0;
    background: transparent;
    color: var(--newcy-muted);
    font-size: 11px;
}

.breadcrumb-item + .breadcrumb-item::before {
    color: #aeb8bf;
}

.alert {
    border: 1px solid var(--newcy-border);
    border-radius: 10px;
    box-shadow: var(--newcy-shadow);
}

.body-content > .row {
    display: block;
    margin-right: 0;
    margin-left: 0;
}

.body-content > .row > .card,
.body-content > .card,
.body-content > .row > a,
.body-content > .row > a > .card {
    width: 100%;
}

.body-content > .row > a {
    display: block;
    color: inherit;
}

/* Cards and message lists */
.card,
.card.bg-light {
    border: 1px solid var(--newcy-border);
    border-radius: 12px;
    background: var(--newcy-card) !important;
    box-shadow: var(--newcy-shadow);
}

.body-content > .row > .card,
.body-content > .card,
.body-content > .row > a > .card {
    margin-bottom: 12px !important;
}

.card-body {
    padding: 19px 21px;
}

.card .d-flex img[style*="width: 50px"],
.card > .card-body > img[style*="width: 50px"] {
    width: 46px !important;
    height: 46px;
    flex: 0 0 46px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--newcy-blue-soft);
}

.card img[style*="max-width:320px"],
.card img[style*="max-width: 320px"] {
    max-width: min(320px, 100%) !important;
    height: auto;
    margin-top: 8px;
    border-radius: 10px;
}

.card .float-right {
    margin-bottom: 0;
    color: #96a1a9;
    font-size: 10px;
}

.card hr {
    border-color: #edf0f2;
}

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

/* Forms */
form .container {
    width: 100%;
    max-width: none;
    padding: 0;
}

.card-body form .row {
    align-items: center;
    gap: 8px;
    margin: 0;
}

.card-body form .row > [class*="col-"] {
    min-width: 0;
    padding: 0;
}

.card-body form .row > .col-lg,
.card-body form .row > .col-md {
    flex: 1 1 260px;
}

.card-body form .row > .col-sm {
    flex: 1 1 180px;
}

.card-body form .row > .col-sm-1 {
    flex: 0 0 auto;
    width: auto;
    max-width: none;
}

.form-control,
.select2-container--default .select2-selection--single {
    min-height: 44px;
    border: 1px solid #ccd7df;
    border-radius: 10px;
    color: var(--newcy-text);
    background: #fff;
    font-size: 12px;
    box-shadow: none;
}

.form-control:focus,
.select2-container--default.select2-container--focus .select2-selection--single {
    border-color: #78b5df;
    box-shadow: 0 0 0 3px rgba(36, 129, 204, .12);
}

.form-control::placeholder {
    color: #9ba7b0;
}

button.form-control,
input[type="submit"].form-control,
.col-sm-1 > button.form-control {
    min-width: 48px;
    border-color: var(--newcy-blue);
    color: #fff;
    background: var(--newcy-blue);
    cursor: pointer;
    font-weight: 700;
}

button.form-control:hover,
input[type="submit"].form-control:hover {
    border-color: var(--newcy-blue-hover);
    background: var(--newcy-blue-hover);
}

a.form-control {
    display: grid;
    place-items: center;
    padding: 5px;
    color: var(--newcy-blue);
    background: var(--newcy-blue-soft);
}

a.form-control img {
    width: 25px;
    height: 25px;
    object-fit: contain;
}

.select2-container {
    width: 100% !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    padding-left: 13px;
    color: var(--newcy-text);
    line-height: 42px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    top: 9px;
    right: 8px;
}

.select2-dropdown {
    overflow: hidden;
    border: 1px solid var(--newcy-border);
    border-radius: 10px;
    box-shadow: 0 10px 35px rgba(37, 55, 70, .12);
}

/* Search-first homepage treatment without changing its markup */
.site-index .body-content > .row:first-child > .card:has(form[action="/tg/search"]):not(:has(select)) {
    overflow: hidden;
    text-align: center;
}

.site-index .body-content > .row:first-child > .card:has(form[action="/tg/search"]):not(:has(select)) > .card-body:first-of-type {
    padding: 28px clamp(22px, 7vw, 68px);
}

.site-index .body-content > .row:first-child > .card:has(form[action="/tg/search"]):not(:has(select)) > .card-body + .card-body {
    border-top: 1px solid #e9eef1;
    background: #fbfcfd;
    text-align: left;
}

.site-index .body-content > .row:first-child > .card:has(form[action="/tg/search"]):not(:has(select)) > .card-body + .card-body > div {
    color: #586874;
    line-height: 2.05;
}

.site-index .body-content > .row:first-child > .card:has(form[action="/tg/search"]):not(:has(select)) > .card-body + .card-body a {
    color: #287cb8;
    font-weight: 600;
}

/* Search results, chats and service pages */
.site-index .body-content > .row:first-child > .card:has(select),
.site-index .body-content > .row:first-child > .card:has(input[name="exclude_q"]) {
    border-color: #d7e3eb;
    background: #f8fbfd !important;
}

.body-content > .row > a > .card:hover,
.body-content > .row > .card:hover {
    border-color: #cbd8e0;
}

.body-content > .row > a > .card:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 16px rgba(37, 55, 70, .07);
}

.body-content > .row > a > .card {
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

/* Existing pagination links become calm Telegram-like actions */
.body-content > .row:last-child > a,
.body-content > a[href*="offset="] {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 15px;
    border-radius: 9px;
    color: var(--newcy-blue);
    background: var(--newcy-blue-soft);
    font-size: 12px;
    font-weight: 600;
}

body > footer.footer {
    min-height: 70px;
    border-top: 1px solid var(--newcy-border);
    background: transparent;
}

body > footer .card:empty,
body > footer .card-body:empty {
    display: none;
}

@media (max-width: 1199px) {
    .navbar > .container {
        max-width: 100%;
    }

    .navbar-dark .navbar-nav .nav-link {
        padding-right: 7px;
        padding-left: 7px;
        font-size: 13px;
    }
}

@media (max-width: 767.98px) {
    body > header {
        position: relative;
    }

    .navbar.bg-dark {
        min-height: 62px;
        padding: 0 12px;
    }

    .navbar-dark .navbar-brand::before {
        width: 34px;
        height: 34px;
        font-size: 18px;
    }

    .navbar-collapse {
        margin: 8px -12px 0;
        padding: 8px 12px 13px;
        border-top: 1px solid var(--newcy-border);
        background: #fff;
    }

    .navbar-nav {
        display: grid;
        grid-template-columns: 1fr 1fr;
        align-items: stretch;
        gap: 3px;
    }

    .navbar-dark .navbar-nav .nav-link {
        padding: 11px 12px;
        font-size: 15px;
    }

    main > .container {
        padding: 10px 10px 48px;
    }

    .card,
    .card.bg-light {
        border-radius: 10px;
    }

    .card-body {
        padding: 16px;
    }

    .card-body form .row > [class*="col-"] {
        flex: 1 1 100%;
        width: 100%;
        max-width: none;
    }

    .card-body form .row > .col-sm-1 {
        flex-basis: calc(50% - 4px);
        width: calc(50% - 4px);
    }

    .card-body form .row > .col-sm-1 .form-control {
        width: 100%;
    }

    .site-index .body-content > .row:first-child > .card:has(form[action="/tg/search"]):not(:has(select)) > .card-body:first-of-type {
        padding: 18px 16px;
    }

    .site-index .body-content > .row:first-child > .card:has(form[action="/tg/search"]):not(:has(select)) > .card-body + .card-body > div {
        line-height: 1.8;
    }

    body > footer.footer {
        display: none;
    }
}

@media (max-width: 420px) {
    body {
        font-size: 13px;
    }

    .navbar-nav {
        grid-template-columns: 1fr;
    }

    .card-body form .row > .col-sm-1 {
        flex-basis: 100%;
        width: 100%;
    }

}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}
