* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Microsoft YaHei", Arial, sans-serif;
    background: #f5f7fb;
    color: #1f2937;
}

a {
    color: #2563eb;
    text-decoration: none;
}

.site-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: min(1120px, calc(100% - 24px));
    margin: 0 auto;
}

.topbar {
    background: #111827;
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 14px 0;
}

.brand {
    color: #fff;
    font-size: 20px;
    font-weight: 700;
}

.nav {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.nav a {
    color: #e5e7eb;
}

.nav-user {
    display: inline-flex;
    align-items: center;
}

.nav-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    background: #374151;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.nav-user-name {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #f9fafb;
    font-size: 13px;
}

.hero {
    padding: 28px 0 18px;
}

.hero-card,
.card,
.stats-card,
.post-card,
.auth-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.hero-card {
    padding: 24px;
}

.grid {
    display: grid;
    gap: 16px;
}

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

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

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

.home-stat-item {
    text-align: center;
    padding: 6px 10px;
}

.home-stat-item + .home-stat-item {
    border-left: 1px solid #e5e7eb;
}

.posts {
    padding-bottom: 32px;
}

.search-card {
    margin: 14px 0 18px;
}

.search-panel {
    padding: 0;
    overflow: hidden;
}

.search-summary {
    display: none;
    list-style: none;
    cursor: pointer;
    padding: 16px 18px;
    font-size: 15px;
    font-weight: 700;
    color: #111827;
}

.search-summary::-webkit-details-marker {
    display: none;
}

.search-panel-body {
    padding: 18px;
}

.search-form {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    align-items: end;
}

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

.search-actions .btn {
    text-align: center;
}

.sale-list {
    display: grid;
    gap: 14px;
    overflow-x: auto;
}

.post-card,
.card,
.auth-card,
.stats-card {
    padding: 18px;
}

.sale-row {
    min-width: 980px;
    display: grid;
    grid-template-columns: minmax(240px, 1.8fr) 90px 105px 70px 105px 105px 76px;
    align-items: center;
    gap: 8px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
    padding: 12px 14px;
}

.sale-row-head {
    background: #eef2ff;
    box-shadow: none;
    color: #374151;
    font-weight: 700;
    font-size: 13px;
}

.sale-col {
    min-width: 0;
    font-size: 13px;
}

.sale-col-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sale-title-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
    width: 100%;
}

.sale-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex: 0 0 28px;
    background: #e5e7eb;
}

.sale-title-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sale-buy-mobile {
    display: none;
    flex: 0 0 auto;
    min-width: 60px;
    padding: 7px 10px;
    font-size: 12px;
    text-align: center;
}

.trade-amount-highlight {
    color: #dc2626;
    font-weight: 700;
}

.sale-col-action {
    text-align: right;
}

.sale-col-action .btn {
    min-width: 60px;
    padding: 7px 10px;
    font-size: 12px;
}

.pagination {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 18px;
}

.page-link {
    display: inline-block;
    min-width: 42px;
    padding: 9px 14px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #dbe3f0;
    color: #1f2937;
    text-align: center;
}

.page-link.active {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.post-meta,
.muted {
    color: #6b7280;
    font-size: 14px;
}

.amount {
    font-size: 28px;
    font-weight: 700;
    color: #111827;
    margin: 10px 0;
}

.buy-summary-card {
    display: grid;
    gap: 14px;
}

.buy-summary-item {
    background: #eef2f6;
    border: 1px solid #d7dee8;
    border-radius: 16px;
    padding: 16px 18px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.buy-summary-item h1 {
    margin: 0 0 8px;
}

.buy-summary-title {
    font-size: 24px;
    line-height: 1.35;
}

.buy-summary-item .muted {
    display: block;
    margin: 0 0 8px;
}

.buy-summary-item .muted:last-child {
    margin-bottom: 0;
}

.buy-summary-item .amount {
    margin: 0 0 8px;
}

.buy-summary-price {
    font-size: 22px;
    line-height: 1.3;
}

.btn,
button,
input[type="submit"] {
    border: 0;
    border-radius: 10px;
    background: #2563eb;
    color: #fff;
    padding: 10px 16px;
    font-size: 14px;
    cursor: pointer;
    display: inline-block;
}

.btn-secondary {
    background: #0f766e;
}

.btn-danger {
    background: #dc2626;
}

.btn-muted {
    background: #6b7280;
}

form {
    display: grid;
    gap: 12px;
}

label {
    display: grid;
    gap: 6px;
    font-size: 14px;
}

input,
select,
textarea {
    width: 100%;
    padding: 11px 12px;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    font-size: 14px;
    background: #fff;
}

textarea {
    min-height: 110px;
    resize: vertical;
}

.alert {
    margin: 16px 0;
    padding: 12px 14px;
    border-radius: 12px;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
}

.panel {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 16px;
    padding: 26px 0 32px;
}

.sidebar,
.main {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
    padding: 18px;
}

.menu {
    display: grid;
    gap: 8px;
}

.menu a {
    padding: 10px 12px;
    background: #f3f4f6;
    border-radius: 10px;
    color: #111827;
}

.menu a.active {
    background: #dbeafe;
    color: #1d4ed8;
}

.table-wrap {
    overflow-x: auto;
}

.table-wrap form {
    display: grid;
    gap: 8px;
}

.table-actions {
    min-width: 88px;
}

.table-actions form {
    margin: 0 0 8px;
}

.table-actions .btn,
.table-actions button {
    width: 100%;
    text-align: center;
}

.table-actions > .btn {
    display: block;
    margin: 0 0 8px;
}

.batch-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.batch-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.batch-check input {
    width: auto;
    margin: 0;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 10px 8px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
    vertical-align: top;
}

.avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    background: #e5e7eb;
}

.footer {
    margin-top: auto;
    padding: 0;
    background: #111827;
    color: #cbd5e1;
}

.footer-bottom {
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
    padding: 16px 0;
    font-size: 13px;
}

.footer-copy {
    color: #94a3b8;
}

.footer-nav {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.footer-nav a {
    color: #e5e7eb;
}

.footer-nav a:hover {
    color: #ffffff;
}

.split {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    font-size: 12px;
}

@media (max-width: 860px) {
    .grid-3,
    .grid-2,
    .panel {
        grid-template-columns: 1fr;
    }

    .home-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0;
    }

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

    .topbar-inner {
        align-items: flex-start;
        flex-direction: column;
    }

    .container {
        width: min(100% - 16px, 1120px);
    }

    .sidebar,
    .main,
    .post-card,
    .sale-item,
    .hero-card,
    .auth-card,
    .card,
    .stats-card {
        border-radius: 12px;
    }

    .amount {
        font-size: 24px;
    }

    .sale-row {
        border-radius: 12px;
        min-width: 920px;
    }

    .footer-bottom {
        justify-content: center;
        text-align: center;
        padding: 18px 0;
    }

    .footer-nav {
        justify-content: center;
    }
}

@media (max-width: 640px) {
    .home-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0;
    }

    .home-stats {
        padding: 12px 8px;
    }

    .home-stat-item {
        padding: 4px 6px;
    }

    .home-stats .amount {
        font-size: 20px;
        margin: 6px 0;
    }

    .home-stats .muted {
        font-size: 12px;
    }

    .search-summary {
        display: block;
    }

    .search-panel:not([open]) .search-panel-body {
        display: none;
    }

    .search-panel[open] .search-summary {
        border-bottom: 1px solid #e5e7eb;
    }

    .search-form {
        grid-template-columns: 1fr;
    }

    .search-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .sale-list {
        overflow-x: visible;
    }

    .sale-row-head {
        display: none;
    }

    .sale-row {
        min-width: 0;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px 14px;
        padding: 14px;
    }

    .sale-col {
        display: flex;
        flex-direction: column;
        gap: 4px;
        font-size: 13px;
    }

    .sale-col::before {
        content: attr(data-label);
        color: #6b7280;
        font-size: 12px;
    }

    .sale-col-title {
        grid-column: 1 / -1;
        align-items: flex-start;
    }

    .sale-col-title::before,
    .sale-col-action::before {
        display: none;
    }

    .sale-title-main {
        align-items: flex-start;
    }

    .sale-title-text {
        white-space: normal;
        line-height: 1.4;
    }

    .sale-buy-mobile {
        display: inline-block;
    }

    .sale-col-action {
        display: none;
    }
}
