* {
    box-sizing: border-box;
}

html {
    overflow-y: scroll;
    scrollbar-gutter: stable;
}

body {
    margin: 0;
    min-height: 100vh;
    background: #f6f7fb;
    color: #172033;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
    color: #1f5eff;
    text-decoration: none;
}

.topbar {
    align-items: center;
    background: #ffffff;
    border-bottom: 1px solid #e4e7ef;
    display: flex;
    justify-content: space-between;
    padding: 16px clamp(20px, 5vw, 56px);
}

.brand {
    color: #172033;
    font-size: 18px;
    font-weight: 700;
}

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

.nav-email {
    color: #5d6678;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.page {
    align-content: start;
    align-items: start;
    display: grid;
    gap: 14px;
    grid-auto-rows: max-content;
    justify-items: stretch;
    min-height: calc(100vh - 65px);
    padding: 20px 20px 32px;
    width: 100%;
}

.main-tabs {
    background: #ffffff;
    border: 1px solid #d8deeb;
    border-radius: 8px;
    box-shadow: 0 10px 26px rgba(23, 32, 51, 0.06);
    display: grid;
    gap: 6px;
    grid-template-columns: repeat(2, 1fr);
    margin-inline: auto;
    max-width: 1040px;
    padding: 6px;
    width: 100%;
}

.main-tab {
    align-items: center;
    border-radius: 6px;
    color: #2a3448;
    display: flex;
    font-weight: 800;
    justify-content: center;
    min-height: 46px;
    padding: 12px 14px;
    text-align: center;
}

.main-tab.active {
    background: #1f5eff;
    color: #ffffff;
}

.main-tab:not(.active):hover,
.main-tab:not(.active):focus-visible {
    background: #eef3ff;
    color: #1f5eff;
}

.panel,
.auth-card {
    background: #ffffff;
    border: 1px solid #e4e7ef;
    border-radius: 8px;
    box-shadow: 0 16px 40px rgba(23, 32, 51, 0.08);
    margin-inline: auto;
    width: min(100%, 460px);
}

.panel {
    padding: 40px;
}

.auth-card {
    padding: 32px;
}

.auth-divider {
    align-items: center;
    color: #8a93a5;
    display: flex;
    font-size: 13px;
    gap: 12px;
    margin: 18px 0 8px;
}

.auth-divider::before,
.auth-divider::after {
    background: #e4e7ef;
    content: "";
    flex: 1;
    height: 1px;
}

.eyebrow {
    color: #1f5eff;
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 8px;
}

h1 {
    font-size: 30px;
    line-height: 1.2;
    margin: 0 0 12px;
}

p {
    color: #5d6678;
    line-height: 1.6;
}

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

label {
    color: #2a3448;
    font-size: 14px;
    font-weight: 700;
    margin-top: 8px;
}

input {
    border: 1px solid #cbd2e1;
    border-radius: 8px;
    font: inherit;
    padding: 12px 14px;
    width: 100%;
}

textarea {
    border: 1px solid #cbd2e1;
    border-radius: 8px;
    font: inherit;
    min-height: 120px;
    padding: 12px 14px;
    resize: vertical;
    width: 100%;
}

input:focus,
textarea:focus {
    border-color: #1f5eff;
    box-shadow: 0 0 0 3px rgba(31, 94, 255, 0.12);
    outline: none;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.button,
.secondary,
.link-button {
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}

.button {
    background: #1f5eff;
    border: 1px solid #1f5eff;
    color: #ffffff;
    display: inline-flex;
    justify-content: center;
    padding: 12px 18px;
}

.button.small {
    padding: 8px 12px;
}

.button.full {
    margin-top: 10px;
    width: 100%;
}

.secondary {
    border: 1px solid #cbd2e1;
    color: #172033;
    display: inline-flex;
    padding: 12px 18px;
}

.secondary.full {
    justify-content: center;
    margin-top: 10px;
    width: 100%;
}

.secondary:disabled {
    background: #eef2f8;
    color: #8a93a5;
    cursor: not-allowed;
}

.danger-button {
    background: #b42318;
    border: 1px solid #b42318;
    border-radius: 8px;
    color: #ffffff;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    justify-content: center;
    padding: 10px 14px;
    width: 100%;
}

.link-button {
    background: transparent;
    border: 0;
    color: #1f5eff;
    padding: 0;
}

.help {
    color: #6d7587;
    font-size: 13px;
    line-height: 1.5;
}

.help ul {
    margin: 0;
    padding-left: 18px;
}

.error {
    color: #b42318;
    font-size: 14px;
}

.switch {
    margin: 18px 0 0;
    text-align: center;
}

.messages {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

.message {
    border-radius: 8px;
    font-size: 14px;
    padding: 10px 12px;
}

.message.success {
    background: #e8f7ee;
    color: #17663a;
}

.message.error {
    background: #fff0ee;
    color: #b42318;
}

.message.warning {
    background: #fff7e6;
    color: #8a4b00;
}

.page-messages {
    max-width: 1040px;
    width: 100%;
}

.site-tip {
    background: #fff7e6;
    border: 1px solid #f2c66d;
    border-radius: 8px;
    color: #7a4300;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.5;
    margin-inline: auto;
    max-width: 1040px;
    padding: 10px 14px;
    width: 100%;
}

.status-box {
    background: #f6f7fb;
    border: 1px solid #e4e7ef;
    border-radius: 8px;
    color: #2a3448;
    display: grid;
    gap: 8px;
    margin-bottom: 18px;
    padding: 12px;
}

.consignment-page {
    display: grid;
    gap: 16px;
    margin-inline: auto;
    max-width: 1040px;
    width: 100%;
}

.consignment-main-tabs {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    box-shadow: none;
}

.consignment-main-tabs + .consignment-page {
    margin-top: -14px;
}

.list-header {
    align-items: center;
    background: #ffffff;
    border: 1px solid #d8deeb;
    border-radius: 0 0 8px 8px;
    border-top: 0;
    display: flex;
    gap: 18px;
    justify-content: space-between;
    padding: 6px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.type-tabs {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.type-tab {
    align-items: center;
    background: #ffffff;
    border: 1px solid #d7deec;
    border-radius: 8px;
    color: #2a3448;
    display: inline-flex;
    font-weight: 800;
    justify-content: center;
    line-height: 1;
    min-height: 46px;
    padding: 10px 16px;
    text-decoration: none;
}

.type-tab.active {
    background: #1f5eff;
    border-color: #1f5eff;
    color: #ffffff;
}

.search-form {
    align-items: center;
    background: #ffffff;
    border: 1px solid #e4e7ef;
    border-radius: 8px;
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr auto auto;
    padding: 14px;
}

.item-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.item-card {
    background: #ffffff;
    border: 1px solid #e4e7ef;
    border-radius: 8px;
    overflow: hidden;
}

.image-link {
    background: transparent;
    border: 0;
    color: #ffffff;
    display: block;
    padding: 0;
    position: relative;
    width: 100%;
}

.item-card img,
.image-placeholder {
    aspect-ratio: 4 / 3;
    display: grid;
    object-fit: cover;
    place-items: center;
    width: 100%;
}

.image-link span {
    background: rgba(23, 32, 51, 0.72);
    border-radius: 8px;
    bottom: 12px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    opacity: 0;
    padding: 6px 10px;
    position: absolute;
    right: 12px;
    transition: opacity 0.16s ease;
}

.image-link:hover span,
.image-link:focus-visible span {
    opacity: 1;
}

.image-viewer[hidden] {
    display: none;
}

.image-viewer {
    inset: 0;
    padding: 24px;
    position: fixed;
    z-index: 20;
}

.image-viewer-backdrop {
    background: rgba(23, 32, 51, 0.74);
    border: 0;
    cursor: pointer;
    inset: 0;
    position: absolute;
}

.image-viewer-dialog {
    display: grid;
    height: 100%;
    place-items: center;
    position: relative;
}

.image-viewer-dialog img {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.34);
    max-height: calc(100vh - 72px);
    max-width: min(100%, 1080px);
    object-fit: contain;
}

.image-viewer-close {
    align-items: center;
    background: #ffffff;
    border: 0;
    border-radius: 999px;
    color: #172033;
    cursor: pointer;
    display: inline-flex;
    font-size: 28px;
    height: 40px;
    justify-content: center;
    line-height: 1;
    position: absolute;
    right: 12px;
    top: 12px;
    width: 40px;
}

.image-placeholder {
    background: #eef2f8;
    color: #6d7587;
    font-weight: 700;
}

.item-body {
    display: grid;
    gap: 10px;
    padding: 16px;
}

.item-body h2 {
    font-size: 20px;
    margin: 0;
    overflow-wrap: anywhere;
}

.item-price {
    color: #1f5eff;
    font-size: 18px;
    font-weight: 800;
}

.status-badge {
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
    justify-self: start;
    padding: 5px 10px;
}

.status-active {
    background: #e8f7ee;
    color: #17663a;
}

.status-sold {
    background: #eef3ff;
    color: #1f5eff;
}

.status-expired {
    background: #fff7e6;
    color: #8a4b00;
}

.status-withdrawn {
    background: #eef2f8;
    color: #5d6678;
}

.status-delisted {
    background: #fff0ee;
    color: #b42318;
}

.item-body p {
    margin: 0;
    overflow-wrap: anywhere;
}

.muted {
    color: #8a93a5;
}

.meta {
    color: #6d7587;
    display: flex;
    flex-wrap: wrap;
    font-size: 13px;
    gap: 8px;
    justify-content: space-between;
}

.kook-id-label {
    color: #172033;
    font-size: 15px;
    font-weight: 800;
}

.delete-form {
    margin-top: 4px;
}

.item-actions {
    display: grid;
    gap: 8px;
}

.item-actions form {
    display: block;
}

.item-actions .secondary.full {
    margin-top: 0;
}

.contact-button {
    margin-top: 0;
}

.cooldown-text {
    color: #8a93a5;
    font-size: 13px;
}

.delete-dialog[hidden] {
    display: none;
}

.delete-dialog {
    inset: 0;
    padding: 20px;
    position: fixed;
    z-index: 30;
}

.dialog-backdrop {
    background: rgba(23, 32, 51, 0.58);
    border: 0;
    cursor: pointer;
    inset: 0;
    position: absolute;
}

.dialog-panel {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(23, 32, 51, 0.28);
    display: grid;
    gap: 12px;
    left: 50%;
    max-width: 420px;
    padding: 24px;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: calc(100% - 40px);
}

.dialog-panel h2 {
    font-size: 22px;
    margin: 0;
    overflow-wrap: anywhere;
}

.dialog-panel p {
    margin: 0;
}

.dialog-actions {
    display: grid;
    gap: 10px;
    margin-top: 6px;
}

.dialog-cancel {
    justify-self: center;
    padding: 8px 12px;
}

.empty-state {
    color: #6d7587;
    padding: 4px 0;
    text-align: center;
}

@media (max-width: 560px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .nav {
        flex-wrap: wrap;
        width: 100%;
    }

    .panel,
    .auth-card {
        padding: 24px;
    }

    h1 {
        font-size: 26px;
    }

    .list-header {
        align-items: stretch;
        flex-direction: column;
        justify-content: flex-start;
    }

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