:root {
    --portal-bg: #f6f8fb;
    --portal-text: #172033;
    --portal-muted: #667085;
    --portal-line: #d9e0ea;
    --portal-accent: #2457c5;
    --portal-accent-2: #10a37f;
    --portal-surface: #ffffff;
    --portal-radius: 8px;
    --portal-shadow: 0 18px 42px rgba(20, 35, 70, .08);
}

body {
    color: var(--portal-text);
    background: var(--portal-bg);
    letter-spacing: 0;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
}

.front-body {
    background:
        linear-gradient(180deg, #ffffff 0, #f6f8fb 460px),
        var(--portal-bg);
}

.site-logo {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.hero-section {
    padding: 64px 0 46px;
}

.hero-search .form-control,
.hero-search .btn {
    min-height: 56px;
}

.hero-panel,
.auth-card,
.admin-panel,
.stat-card {
    background: var(--portal-surface);
    border: 1px solid var(--portal-line);
    border-radius: var(--portal-radius);
    box-shadow: var(--portal-shadow);
}

.hero-panel {
    padding: 18px;
}

.mini-row {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px;
    color: var(--portal-text);
    border-radius: 8px;
}

.mini-row + .mini-row {
    border-top: 1px solid #edf1f6;
}

.mini-row:hover {
    background: #f7f9fc;
}

.mini-icon {
    width: 42px;
    height: 42px;
    display: inline-grid;
    place-items: center;
    border-radius: 8px;
    background: #e9f1ff;
    color: var(--portal-accent);
    font-weight: 700;
}

.section-label {
    color: var(--portal-accent);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.chip {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 14px;
    color: var(--portal-text);
    background: #fff;
    border: 1px solid var(--portal-line);
    border-radius: 999px;
}

.chip:hover {
    color: var(--portal-accent);
    border-color: #a9bce9;
}

.page-head {
    padding: 34px 0 24px;
    background: #fff;
    border-bottom: 1px solid var(--portal-line);
}

.filter-bar,
.admin-search {
    display: grid;
    grid-template-columns: minmax(220px, 1.5fr) repeat(3, minmax(150px, 1fr)) auto;
    gap: 10px;
}

.software-card {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    color: var(--portal-text);
    background: #fff;
    border: 1px solid var(--portal-line);
    border-radius: var(--portal-radius);
    overflow: hidden;
    box-shadow: 0 12px 28px rgba(20, 35, 70, .06);
}

.software-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--portal-shadow);
}

.software-cover {
    display: block;
    aspect-ratio: 16 / 9;
    background-color: #e7ecf5;
    background-size: cover;
    background-position: center;
}

.software-card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 15px;
}

.meta-line {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
    color: var(--portal-muted);
    font-size: 13px;
}

.detail-cover {
    aspect-ratio: 16 / 10;
    background-color: #e7ecf5;
    background-size: cover;
    background-position: center;
    border: 1px solid var(--portal-line);
    border-radius: var(--portal-radius);
}

.detail-grid {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 10px 18px;
    padding: 18px;
    background: #fff;
    border: 1px solid var(--portal-line);
    border-radius: var(--portal-radius);
}

.detail-grid dt {
    color: var(--portal-muted);
    font-weight: 600;
}

.detail-grid dd {
    margin-bottom: 0;
}

.software-description {
    padding: 24px;
    background: #fff;
    border: 1px solid var(--portal-line);
    border-radius: var(--portal-radius);
    line-height: 1.75;
}

.software-info-section {
    padding: 24px;
    background: #fff;
    border: 1px solid var(--portal-line);
    border-radius: var(--portal-radius);
}

.software-info-section h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 16px;
}

.screenshot-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.screenshot-item {
    display: block;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: #eef2f7;
    border: 1px solid var(--portal-line);
    border-radius: 8px;
}

.screenshot-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.software-text-block {
    white-space: pre-wrap;
    line-height: 1.75;
    color: var(--portal-text);
    overflow-wrap: anywhere;
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.price-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100%;
    padding: 24px;
    background: #fff;
    border: 1px solid var(--portal-line);
    border-radius: var(--portal-radius);
    box-shadow: 0 12px 28px rgba(20, 35, 70, .06);
}

.price-amount {
    color: var(--portal-text);
    font-size: 32px;
    font-weight: 800;
}

.auth-wrap,
.admin-login-body {
    min-height: calc(100vh - 120px);
    display: grid;
    place-items: center;
    padding: 32px 16px;
}

.auth-card,
.admin-login-card {
    width: min(440px, 100%);
    padding: 26px;
}

.captcha-button {
    padding: 0;
    width: 150px;
    min-width: 150px;
    height: 46px;
    overflow: hidden;
}

.captcha-button img {
    display: block;
    width: 150px;
    height: 46px;
}

.admin-login-body {
    background: linear-gradient(135deg, #eef4ff, #f8fafc 52%, #ecfdf5);
}

.admin-login-card {
    background: #fff;
    border: 1px solid var(--portal-line);
    border-radius: var(--portal-radius);
    box-shadow: var(--portal-shadow);
}

.admin-body {
    background: #f3f5f9;
}

.admin-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 250px 1fr;
}

.admin-sidebar {
    background: #101828;
    color: #fff;
    padding: 22px 16px;
}

.admin-brand {
    display: block;
    color: #fff;
    font-weight: 700;
    font-size: 18px;
    margin-bottom: 24px;
}

.admin-nav {
    display: grid;
    gap: 6px;
}

.admin-nav a {
    display: flex;
    align-items: center;
    min-height: 42px;
    padding: 0 12px;
    color: #cbd5e1;
    border-radius: 8px;
}

.admin-nav a:hover,
.admin-nav a.active {
    color: #fff;
    background: #243047;
}

.admin-main {
    min-width: 0;
}

.admin-topbar {
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 24px;
    background: #fff;
    border-bottom: 1px solid var(--portal-line);
}

.admin-content {
    padding: 24px;
}

.stat-card {
    padding: 16px;
}

.stat-card span {
    display: block;
    color: var(--portal-muted);
    font-size: 13px;
}

.stat-card strong {
    display: block;
    font-size: 28px;
    line-height: 1.2;
    margin-top: 4px;
}

.panel-head {
    padding: 16px 18px;
    border-bottom: 1px solid var(--portal-line);
    font-weight: 700;
}

.balance-summary {
    display: grid;
    gap: 2px;
    min-width: 180px;
    padding: 12px 16px;
    background: #f6f8fb;
    border: 1px solid var(--portal-line);
    border-radius: 8px;
}

.balance-summary span {
    color: var(--portal-muted);
    font-size: 12px;
}

.balance-summary strong {
    font-size: 24px;
    line-height: 1.15;
}

.recharge-panel .input-group-text {
    min-width: 52px;
    justify-content: center;
    font-weight: 700;
}

.recharge-table a {
    color: var(--portal-accent);
}

.tag-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 18px;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid var(--portal-line);
    border-radius: 8px;
}

.empty-state {
    padding: 28px;
    text-align: center;
    color: var(--portal-muted);
    background: #fff;
    border: 1px solid var(--portal-line);
    border-radius: var(--portal-radius);
}

.content-page {
    max-width: 860px;
    padding: 30px;
    background: #fff;
    border: 1px solid var(--portal-line);
    border-radius: var(--portal-radius);
    box-shadow: 0 12px 28px rgba(20, 35, 70, .06);
}

.content-page-body {
    white-space: pre-wrap;
    line-height: 1.8;
    overflow-wrap: anywhere;
}

.legal-editor {
    min-height: 460px;
    line-height: 1.6;
}

@media (max-width: 991.98px) {
    .navbar .container {
        align-items: flex-start;
    }

    .navbar-collapse {
        padding-top: 12px;
    }

    .navbar-nav {
        gap: 2px;
    }

    .navbar-nav .nav-link {
        padding: 10px 0;
    }

    .navbar .d-flex.flex-wrap {
        width: 100%;
        align-items: stretch !important;
    }

    .navbar .btn-group {
        width: 100%;
    }

    .navbar .btn-group .btn {
        flex: 1 1 0;
    }

    .navbar .btn:not(.navbar-toggler) {
        min-height: 38px;
    }

    .filter-bar {
        grid-template-columns: 1fr 1fr;
    }

    .filter-bar .btn {
        grid-column: span 2;
    }

    .pricing-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-shell {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        position: static;
    }

    .admin-nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 575.98px) {
    body {
        font-size: 15px;
    }

    .container {
        padding-left: 18px;
        padding-right: 18px;
    }

    .container > .row.g-5 {
        --bs-gutter-x: 1.5rem;
    }

    .hero-section {
        padding: 34px 0 28px;
    }

    .hero-section .display-5 {
        font-size: 2rem;
        line-height: 1.15;
    }

    .hero-panel {
        padding: 12px;
        box-shadow: 0 10px 24px rgba(20, 35, 70, .06);
    }

    .page-head {
        padding: 24px 0 18px;
    }

    .page-head .h2,
    .page-head h1 {
        font-size: 1.45rem;
        margin-bottom: 10px !important;
    }

    .content-page {
        padding: 18px;
    }

    .content-page-body {
        line-height: 1.7;
    }

    .legal-editor {
        min-height: 340px;
    }

    .hero-search .form-control,
    .hero-search .btn {
        min-height: 48px;
    }

    .filter-bar,
    .admin-search {
        grid-template-columns: 1fr;
    }

    .filter-bar .btn {
        grid-column: auto;
    }

    .software-card {
        display: grid;
        grid-template-columns: 108px 1fr;
        border-radius: 8px;
        box-shadow: 0 8px 18px rgba(20, 35, 70, .05);
    }

    .software-cover {
        align-self: start;
        width: 82px;
        height: 82px;
        min-height: 0;
        margin: 14px 0 14px 14px;
        border-radius: 8px;
        background-size: contain;
        background-repeat: no-repeat;
    }

    .software-card-body {
        padding: 14px;
        min-width: 0;
    }

    .software-card-body .badge {
        align-self: flex-start;
    }

    .software-card-body strong,
    .software-card-body .small {
        display: -webkit-box;
        overflow: hidden;
        -webkit-box-orient: vertical;
    }

    .software-card-body strong {
        -webkit-line-clamp: 2;
    }

    .software-card-body .small {
        -webkit-line-clamp: 2;
    }

    .meta-line {
        flex-direction: column;
        gap: 4px;
        font-size: 12px;
    }

    .detail-cover {
        aspect-ratio: 16 / 9;
    }

    .detail-grid {
        grid-template-columns: 1fr;
        gap: 4px;
        padding: 14px;
    }

    .detail-grid dt {
        font-size: 12px;
    }

    .detail-grid dd + dt {
        margin-top: 8px;
    }

    .software-description {
        padding: 16px;
    }

    .software-info-section {
        padding: 16px;
    }

    .software-info-section h2 {
        font-size: 18px;
    }

    .screenshot-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .pricing-grid {
        grid-template-columns: 1fr;
    }

    .price-card {
        padding: 18px;
    }

    .price-amount {
        font-size: 28px;
    }

    .auth-wrap {
        min-height: auto;
        place-items: start center;
        padding: 22px 16px 36px;
    }

    .auth-card,
    .admin-login-card {
        padding: 22px;
        box-shadow: 0 10px 26px rgba(20, 35, 70, .07);
    }

    .auth-card .h4 {
        font-size: 1.35rem;
    }

    .auth-card .input-group {
        display: flex;
        flex-wrap: nowrap;
    }

    .auth-card .input-group .form-control {
        width: 100%;
        min-width: 0;
    }

    .captcha-button {
        flex: 0 0 128px;
        width: 128px;
        min-width: 128px;
    }

    .captcha-button,
    .captcha-button img {
        height: 42px;
    }

    .captcha-button img {
        width: 128px;
        object-fit: cover;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-card strong {
        font-size: 24px;
    }

    .panel-head {
        padding: 14px;
    }

    .balance-summary {
        display: flex;
        width: 100%;
        min-width: 0;
        align-items: center;
        justify-content: space-between;
    }

    .balance-summary strong {
        font-size: 21px;
    }

    .recharge-panel {
        padding: 18px !important;
    }

    .table-responsive {
        border-radius: 8px;
    }

    .table {
        font-size: 14px;
    }

    .table th,
    .table td {
        white-space: nowrap;
        padding: 12px 14px;
    }

    .account-downloads thead,
    .recharge-table thead {
        display: none;
    }

    .account-downloads tbody,
    .account-downloads tr,
    .account-downloads td,
    .recharge-table tbody,
    .recharge-table tr,
    .recharge-table td {
        display: block;
        width: 100%;
    }

    .account-downloads tr,
    .recharge-table tr {
        padding: 12px 14px;
    }

    .account-downloads tr + tr,
    .recharge-table tr + tr {
        border-top: 1px solid var(--portal-line);
    }

    .account-downloads td,
    .recharge-table td {
        padding: 0;
        border: 0;
        white-space: normal;
    }

    .account-downloads td + td,
    .recharge-table td + td {
        margin-top: 8px;
    }

    .account-downloads td.text-end {
        text-align: left !important;
    }

    .admin-content,
    .admin-topbar {
        padding-left: 16px;
        padding-right: 16px;
    }

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