:root {
    --orange-50: #FFF4EC;
    --orange-100: #FFE3CE;
    --orange-500: #FF8A3D;
    --orange-600: #F26D0C;
    --blue-500: #3B82F6;
    --blue-50: #EAF2FF;
    --gray-50: #FAFAFA;
    --gray-100: #F2F2F3;
    --gray-200: #E7E7E9;
    --gray-400: #B0B2B8;
    --gray-500: #8B8D93;
    --gray-700: #55575D;
    --gray-900: #1D1E20;
    --white: #FFFFFF;
    --kakao-yellow: #FEE500;
    --kakao-text: #391B1B;
    --radius-s: 8px;
    --radius-m: 14px;
    --radius-l: 20px;
    --shadow-card: 0 1px 3px rgba(29, 30, 32, 0.06);
    --font-sans: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard Variable",
                 "Pretendard", "Malgun Gothic", sans-serif;
}

* { box-sizing: border-box; }

html {
    overflow-x: clip;
}

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--gray-50);
    color: var(--gray-900);
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
    touch-action: manipulation;
    overflow-x: clip;
    overflow-wrap: break-word;
    width: 100%;
    max-width: 100%;
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }

/* ---------- Header ---------- */
.site-header {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.header-inner {
    max-width: 1080px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 20px;
}

.header-row-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.logo-mark {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: var(--orange-500);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
}

.logo-text {
    font-weight: 800;
    font-size: 18px;
    color: var(--gray-900);
}

.search-form {
    width: 100%;
    display: flex;
    align-items: center;
    background: var(--gray-100);
    border-radius: 999px;
    padding: 0 14px;
}

.search-input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    padding: 10px 6px;
    font-size: 14px;
    outline: none;
    color: var(--gray-900);
}

.search-input::placeholder { color: var(--gray-400); }

.search-btn {
    border: none;
    background: transparent;
    color: var(--gray-500);
    display: flex;
    align-items: center;
    padding: 4px;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 14px;
    flex-shrink: 0;
}

.nav-link { color: var(--gray-700); font-weight: 600; text-decoration: none; transition: color 0.15s ease; }
.nav-link:hover { color: var(--orange-600); }
.nav-link-active { color: var(--orange-600); font-weight: 700; }
.nav-link-strong { color: var(--orange-600); font-weight: 700; }
.nav-user { color: var(--gray-500); font-size: 13.5px; }

/* ---------- Header User Menu & Dropdown ---------- */
.user-menu-wrapper {
    position: relative;
    display: inline-block;
}

.user-menu-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    color: var(--gray-800);
    font-size: 13.5px;
    font-weight: 700;
    user-select: none;
}

.user-menu-btn:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
    box-shadow: var(--shadow-sm);
}

.user-menu-wrapper.open .user-menu-btn {
    border-color: var(--orange-500);
    box-shadow: 0 0 0 3px rgba(255, 111, 15, 0.15);
    background: var(--orange-50);
}

.user-avatar-mini {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--orange-50);
    color: var(--orange-600);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border: 1.5px solid var(--orange-200);
    flex-shrink: 0;
}

.user-name-label {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1;
}

.dropdown-chevron {
    color: var(--gray-400);
    transition: transform 0.2s ease, color 0.15s ease;
    flex-shrink: 0;
}

.user-menu-wrapper.open .dropdown-chevron {
    transform: rotate(180deg);
    color: var(--orange-600);
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 210px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-m);
    box-shadow: 0 12px 28px -4px rgba(0, 0, 0, 0.12), 0 6px 12px -2px rgba(0, 0, 0, 0.05);
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.96);
    transform-origin: top right;
    transition: opacity 0.18s cubic-bezier(0.16, 1, 0.3, 1), 
                transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), 
                visibility 0.18s;
    z-index: 300;
}

.user-menu-wrapper.open .user-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.dropdown-user-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px 10px;
}

.dropdown-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--orange-50);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    border: 1.5px solid var(--orange-200);
    flex-shrink: 0;
}

.dropdown-user-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.dropdown-user-name {
    font-size: 14px;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-user-id {
    font-size: 11.5px;
    color: var(--gray-500);
    margin-top: 2px;
}

.dropdown-divider {
    height: 1px;
    background: var(--gray-100);
    margin: 4px 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-s);
    font-size: 13.5px;
    font-weight: 600;
    color: var(--gray-700);
    text-decoration: none;
    transition: all 0.15s ease;
}

.dropdown-item:hover {
    background: var(--gray-50);
    color: var(--gray-900);
}

.dropdown-item.active {
    background: var(--orange-50);
    color: var(--orange-600);
    font-weight: 700;
}

.dropdown-item-icon {
    font-size: 15px;
    width: 20px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

.dropdown-group-title {
    font-size: 11px;
    font-weight: 800;
    color: var(--gray-400);
    padding: 6px 12px 2px;
    letter-spacing: 0.5px;
}

.dropdown-item-danger {
    color: #DC2626;
}

.dropdown-item-danger:hover {
    background: #FEF2F2;
    color: #B91C1C;
}

/* ---------- Admin & Template Management ---------- */
.admin-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--gray-100);
}
.admin-tab {
    padding: 12px 18px;
    font-size: 15px;
    font-weight: 700;
    color: var(--gray-500);
    border-bottom: 2.5px solid transparent;
    margin-bottom: -2px;
    text-decoration: none;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.admin-tab:hover { color: var(--gray-900); }
.admin-tab.active {
    color: var(--orange-600);
    border-bottom-color: var(--orange-500);
}

.admin-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.admin-search-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex: 1;
    max-width: 360px;
}
.admin-search-input {
    padding: 8px 12px;
    font-size: 13.5px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-s);
    outline: none;
    flex: 1;
}
.admin-search-input:focus { border-color: var(--orange-500); }

.admin-table-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-l);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}
.admin-table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 13.5px;
}
.admin-table th {
    background: var(--gray-50);
    color: var(--gray-700);
    font-weight: 700;
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}
.admin-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-800);
    vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: rgba(255, 111, 15, 0.02); }

.admin-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-xs {
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 700;
    border-radius: 4px;
    line-height: 1.2;
    cursor: pointer;
    border: 1px solid transparent;
}
.btn-outline {
    background: var(--white);
    border-color: var(--gray-300);
    color: var(--gray-700);
}
.btn-outline:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}
.btn-outline-danger {
    background: var(--white);
    border-color: #FECACA;
    color: #DC2626;
}
.btn-outline-danger:hover {
    background: #FEF2F2;
    border-color: #EF4444;
}

/* ---------- Description Template Selector in write.php ---------- */
.description-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    margin-bottom: 6px;
    flex-wrap: wrap;
    gap: 8px;
}
.description-label-row .form-label {
    margin: 0 !important;
}
.template-picker-group {
    display: flex;
    align-items: center;
    gap: 6px;
}
.template-select {
    padding: 5px 8px;
    font-size: 12.5px;
    font-weight: 600;
    border: 1.5px solid var(--orange-300);
    border-radius: var(--radius-s);
    background: var(--orange-50);
    color: var(--orange-800);
    cursor: pointer;
    outline: none;
}
.template-select:focus {
    border-color: var(--orange-500);
}

/* Template Cards in Admin */
.template-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.template-item-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-m);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.15s ease;
}
.template-item-card:hover {
    border-color: var(--orange-300);
}
.template-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.template-item-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: 6px;
}
.template-preview-box {
    background: var(--gray-50);
    border-radius: var(--radius-s);
    padding: 10px 12px;
    font-size: 12.5px;
    color: var(--gray-700);
    white-space: pre-wrap;
    line-height: 1.5;
    font-family: inherit;
    border: 1px solid var(--gray-100);
    max-height: 120px;
    overflow-y: auto;
}

.category-bar {
    border-top: 1px solid var(--gray-100);
    overflow-x: auto;
    scrollbar-width: none;
}
.category-bar::-webkit-scrollbar { display: none; }

.category-bar-inner {
    max-width: 1080px;
    margin: 0 auto;
    display: flex;
    gap: 8px;
    padding: 10px 20px;
    white-space: nowrap;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border-radius: 999px;
    background: var(--gray-100);
    color: var(--gray-700);
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}

.chip-icon { font-size: 14px; }

.chip-active {
    background: var(--orange-500);
    color: var(--white);
}

/* ---------- Layout ---------- */
.site-main {
    flex: 1 0 auto;
    min-height: 60vh;
}

.page-container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 24px 20px 48px;
}

.page-container.narrow {
    max-width: 560px;
}

.section-title {
    font-size: 20px;
    font-weight: 800;
    margin: 4px 0 18px;
}

.result-summary {
    font-size: 14px;
    color: var(--gray-700);
    margin: 0 0 16px;
}

/* ---------- Product grid / cards ---------- */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px 16px;
}

.product-card {
    display: block;
}

.product-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: var(--radius-m);
    overflow: hidden;
    background: var(--gray-100);
}

.product-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    background: var(--orange-50);
}

.thumb-overlay {
    position: absolute;
    inset: 0;
    background: rgba(29, 30, 32, 0.55);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.product-info { padding: 10px 2px 0; }

.product-title {
    font-size: 14.5px;
    font-weight: 600;
    margin: 0 0 4px;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-meta {
    font-size: 12.5px;
    color: var(--gray-500);
    margin: 0 0 6px;
}

.product-price {
    font-size: 15px;
    font-weight: 800;
    margin: 0;
    color: var(--gray-900);
}

/* ---------- Empty state ---------- */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--gray-700);
}
.empty-emoji { font-size: 40px; margin: 0 0 10px; }
.empty-title { font-weight: 700; font-size: 16px; margin: 0 0 6px; }
.empty-desc { font-size: 14px; color: var(--gray-500); margin: 0 0 16px; }

/* ---------- Badges ---------- */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    margin: 10px 0;
}
.badge-selling { background: var(--orange-50); color: var(--orange-600); }
.badge-reserved { background: var(--blue-50); color: var(--blue-500); }
.badge-done { background: var(--gray-100); color: var(--gray-500); }
.badge-auction { background: #F3E8FF; color: #7E22CE; }
.badge-member { background: #E0F2FE; color: #0369A1; }
.badge-guest { background: #ECFDF5; color: #047857; }
.badge-winning { background: #FEF3C7; color: #B45309; }

/* ---------- Flash messages (Legacy fallback) ---------- */
.flash-message {
    padding: 12px 16px;
    border-radius: var(--radius-s);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
}
.flash-success { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; }
.flash-error { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }

/* ---------- Floating Toast Notification ---------- */
.toast-container {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
    width: 90%;
    max-width: 440px;
}
.toast {
    pointer-events: auto;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 16px;
    background: #ffffff;
    border-radius: var(--radius-m);
    box-shadow: 0 10px 25px -4px rgba(0, 0, 0, 0.12), 0 4px 8px -2px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--gray-200);
    animation: toastSlideDown 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.toast-hiding {
    opacity: 0 !important;
    transform: translateY(-16px) scale(0.96) !important;
}
@keyframes toastSlideDown {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
.toast-icon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    flex-shrink: 0;
}
.toast-message {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.45;
    color: var(--gray-900);
    word-break: break-word;
}
.toast-close {
    background: transparent;
    border: none;
    color: var(--gray-400);
    font-size: 16px;
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease;
}
.toast-close:hover {
    color: var(--gray-700);
}
.toast-success {
    border-left: 4.5px solid #10B981;
}
.toast-success .toast-icon {
    background: #ECFDF5;
    color: #059669;
}
.toast-error {
    border-left: 4.5px solid #EF4444;
}
.toast-error .toast-icon {
    background: #FEF2F2;
    color: #DC2626;
}
.toast-info {
    border-left: 4.5px solid var(--orange-500);
}
.toast-info .toast-icon {
    background: var(--orange-50);
    color: var(--orange-600);
}

/* ---------- Auction Section ---------- */
.auction-box {
    margin: 24px 0;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-m);
    padding: 20px;
    box-shadow: var(--shadow-card);
}
.auction-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-100);
}
.auction-title {
    font-size: 17px;
    font-weight: 800;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}
.auction-winner-box {
    background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
    border: 1.5px solid #FCD34D;
    border-radius: var(--radius-m);
    padding: 18px 20px;
    margin-bottom: 20px;
}
.auction-winner-title {
    font-size: 16px;
    font-weight: 800;
    color: #92400E;
    margin: 0 0 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.auction-winner-info {
    font-size: 14px;
    line-height: 1.6;
    color: #78350F;
}
.auction-winner-contact {
    display: inline-block;
    background: #FFF;
    padding: 6px 12px;
    border-radius: var(--radius-s);
    font-weight: 700;
    color: #B45309;
    border: 1px solid #FDE68A;
    margin-top: 6px;
}
.bid-form-container {
    background: var(--gray-50);
    border-radius: var(--radius-s);
    padding: 16px;
    margin-bottom: 20px;
    border: 1px solid var(--gray-200);
}
.bid-form-title {
    font-size: 14.5px;
    font-weight: 700;
    margin: 0 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.bid-guest-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
}
.bid-guest-contact-field {
    grid-column: 1 / -1;
}
.quick-bid-row {
    display: flex;
    gap: 6px;
    margin: 8px 0 14px;
    flex-wrap: wrap;
}
.quick-bid-btn {
    border: 1px solid var(--gray-300);
    background: var(--white);
    border-radius: 999px;
    padding: 5px 11px;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.15s;
}
.quick-bid-btn:hover {
    border-color: var(--orange-500);
    color: var(--orange-500);
    background: var(--orange-50);
}
.bid-history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 380px;
    overflow-y: auto;
}
.bid-history-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
    background: var(--gray-50);
    border-radius: var(--radius-s);
    border: 1px solid var(--gray-200);
    transition: background 0.15s ease;
}
.bid-history-item.is-highest {
    background: #FFF7ED;
    border-color: #FFEDD5;
}
.bid-history-item.is-winner {
    background: #FEF3C7;
    border-color: #FCD34D;
}
.bid-history-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.bidder-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13.5px;
    flex-wrap: wrap;
    min-width: 0;
}
.bid-rank {
    font-weight: 800;
    color: var(--gray-500);
    font-size: 12px;
    flex-shrink: 0;
}
.bidder-badge {
    display: inline-block;
    padding: 1.5px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
    white-space: nowrap;
}
.bidder-name {
    font-weight: 700;
    color: var(--gray-900);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 140px;
}
.bid-time-text {
    font-size: 11.5px;
    color: var(--gray-400);
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: auto;
}
.bid-history-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    border-top: 1px dashed rgba(0, 0, 0, 0.07);
    padding-top: 8px;
}
.bid-price-wrap {
    display: flex;
    align-items: baseline;
    gap: 6px;
    white-space: nowrap;
}
.bid-price-label {
    font-size: 11.5px;
    color: var(--gray-500);
    font-weight: 600;
}
.bid-price-text {
    font-size: 16px;
    font-weight: 800;
    color: var(--gray-900);
    letter-spacing: -0.2px;
}
.bid-history-item.is-highest .bid-price-text {
    color: var(--orange-600);
}
.bid-history-item.is-winner .bid-price-text {
    color: #B45309;
}
.bid-close-form {
    margin: 0;
    flex-shrink: 0;
}
.bid-close-btn {
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 700;
    background: var(--orange-500);
    color: var(--white);
    border: none;
    border-radius: var(--radius-s);
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.15s ease;
}
.bid-close-btn:hover {
    background: var(--orange-600);
}

/* ---------- Forms / Auth ---------- */
.auth-box {
    background: var(--white);
    border-radius: var(--radius-l);
    padding: 32px 26px;
    margin-top: 30px;
    box-shadow: var(--shadow-card);
}
.auth-title { font-size: 20px; font-weight: 800; margin: 0 0 6px; }
.auth-sub { font-size: 13.5px; color: var(--gray-500); margin: 0 0 20px; }
.auth-switch { text-align: center; font-size: 13.5px; color: var(--gray-500); margin-top: 16px; }
.auth-switch a { color: var(--orange-600); font-weight: 700; }

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--gray-700);
    margin: 16px 0 6px;
}
.form-label:first-child { margin-top: 0; }

.form-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-s);
    font-size: 14.5px;
    background: var(--white);
    color: var(--gray-900);
    outline: none;
}
.form-input:focus { border-color: var(--orange-500); }
.form-textarea { resize: vertical; font-family: inherit; }

.form-errors {
    background: #FFF1EE;
    color: #D64545;
    border-radius: var(--radius-s);
    padding: 12px 14px;
    font-size: 13.5px;
    margin-bottom: 16px;
}
.form-errors p { margin: 2px 0; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    border-radius: var(--radius-s);
    padding: 12px 18px;
    font-size: 14.5px;
    font-weight: 700;
    text-align: center;
}
.btn-block { width: 100%; margin-top: 22px; }
.btn-primary { background: var(--orange-500); color: var(--white); }
.btn-primary:hover { background: var(--orange-600); }
.btn-outline { background: var(--white); color: var(--gray-700); border: 1px solid var(--gray-200); }
.btn-danger { background: var(--white); color: #D64545; border: 1px solid #FFD6D2; }
.btn-kakao { background: var(--kakao-yellow); color: var(--kakao-text); }

.price-row { display: flex; align-items: center; gap: 12px; }
.price-row .form-input { flex: 1; min-width: 0; }
.checkbox-label { font-size: 13.5px; color: var(--gray-700); white-space: nowrap; display: flex; align-items: center; gap: 5px; }

.contact-section {
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1px solid var(--gray-100);
}
.sale-type-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 6px 0 16px;
}
.sale-type-card {
    padding: 12px 10px;
    font-size: 13.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.contact-type-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 6px 0 14px;
}
.radio-card {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-s);
    padding: 10px 6px;
    text-align: center;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--gray-700);
    cursor: pointer;
    overflow-wrap: break-word;
    word-break: keep-all;
    transition: all 0.15s ease;
}
.radio-card:hover {
    border-color: var(--orange-500);
}
.radio-card:has(input:checked) {
    border-color: var(--orange-500);
    background: var(--orange-50);
    color: var(--orange-600);
    font-weight: 700;
}
.radio-card input { margin-right: 4px; accent-color: var(--orange-500); }

#normalPriceSection,
#auctionPriceSection {
    margin-top: 18px;
    margin-bottom: 6px;
}
#normalPriceSection .form-label,
#auctionPriceSection .form-label {
    margin-top: 0 !important;
    margin-bottom: 8px;
}
.price-unit {
    font-size: 14px;
    font-weight: 700;
    color: var(--gray-700);
    white-space: nowrap;
    padding-left: 2px;
}

.form-hint {
    font-size: 12px;
    color: var(--orange-600);
    margin: 6px 0 0;
}

.contact-fields { display: flex; flex-direction: column; gap: 8px; }
.contact-fields + .contact-fields { margin-top: 10px; }

.existing-images { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.existing-image { width: 84px; text-align: center; font-size: 11px; color: var(--gray-500); }
.existing-image img { width: 84px; height: 84px; object-fit: cover; border-radius: var(--radius-s); margin-bottom: 4px; }

/* ---------- Image Uploader & Preview ---------- */
.image-uploader {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.file-input-hidden {
    display: none;
}
.image-upload-trigger {
    width: 84px;
    height: 84px;
    border: 1.5px dashed var(--gray-400);
    border-radius: var(--radius-s);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    cursor: pointer;
    background: var(--white);
    color: var(--gray-500);
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    user-select: none;
    flex-shrink: 0;
}
.image-upload-trigger:hover {
    border-color: var(--orange-500);
    color: var(--orange-500);
    background: var(--orange-50);
}
.upload-text {
    font-size: 11px;
    font-weight: 600;
}
.upload-count {
    font-size: 10px;
    color: var(--gray-400);
    font-weight: 700;
}
.image-upload-trigger:hover .upload-count {
    color: var(--orange-500);
}
.image-preview-list {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.image-preview-item {
    position: relative;
    width: 84px;
    height: 84px;
    border-radius: var(--radius-s);
    overflow: hidden;
    border: 1px solid var(--gray-200);
    background: var(--gray-100);
    flex-shrink: 0;
}
.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.image-preview-item .remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(29, 30, 32, 0.75);
    color: var(--white);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: background 0.15s;
}
.image-preview-item .remove-btn:hover {
    background: #e53e3e;
}
.image-preview-item .first-badge {
    position: absolute;
    bottom: 4px;
    left: 4px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
}

/* ---------- Product detail ---------- */
.detail-gallery { margin: 0 -20px 16px; }
.gallery-main {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: var(--gray-100);
    overflow: hidden;
}
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.gallery-empty { display: flex; align-items: center; justify-content: center; font-size: 44px; background: var(--orange-50); }
.gallery-thumbs { display: flex; gap: 8px; padding: 10px 20px 0; overflow-x: auto; }
.gallery-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: var(--radius-s); flex-shrink: 0; cursor: pointer; border: 2px solid transparent; }
.gallery-thumb:hover { border-color: var(--orange-500); }

.detail-seller { font-size: 13.5px; color: var(--gray-500); margin-bottom: 4px; }
.detail-seller-name { font-weight: 700; color: var(--gray-900); }
.detail-title { font-size: 19px; font-weight: 800; margin: 4px 0 4px; }
.detail-meta { font-size: 12.5px; color: var(--gray-500); margin: 0; }
.detail-description { font-size: 14.5px; line-height: 1.6; color: var(--gray-900); margin: 14px 0 20px; white-space: pre-line; }

.reference-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--orange-600);
    background: var(--orange-50);
    padding: 9px 14px;
    border-radius: var(--radius-s);
    margin: 0 0 18px;
}

.remember-row {
    margin-top: 14px;
}

.gallery-main img { cursor: zoom-in; }

.detail-price-bar {
    border-top: 1px solid var(--gray-100);
    padding-top: 14px;
    margin-bottom: 20px;
}
.detail-price { font-size: 20px; font-weight: 800; }

.contact-box {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-m);
    padding: 18px;
    margin: 24px 0 20px;
}
.contact-box-title { font-size: 14px; font-weight: 700; margin: 0 0 12px; }

.contact-unified-card {
    background: var(--orange-50);
    border: 1px solid var(--orange-100);
    border-radius: var(--radius-m);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.contact-unified-text {
    font-size: 15px;
    line-height: 1.6;
    color: var(--gray-900);
    word-break: break-all;
    font-weight: 500;
}
.contact-unified-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 138, 61, 0.2);
}

.account-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--orange-50);
    border-radius: var(--radius-s);
    padding: 14px;
    margin-bottom: 10px;
}
.account-info { min-width: 0; }
.account-bank { font-size: 12.5px; color: var(--gray-500); margin: 0 0 2px; }
.account-number { font-size: 16px; font-weight: 800; margin: 0 0 2px; letter-spacing: 0.3px; }
.account-holder { font-size: 12.5px; color: var(--gray-500); margin: 0; }

.kakao-card { margin-top: 4px; }
.kakao-id-label { font-size: 12.5px; color: var(--gray-500); margin: 0 0 6px; }

/* ---------- Post Owner Management Bar (Top of Post) ---------- */
.post-owner-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #FFF7ED;
    border: 1px solid #FFEDD5;
    border-radius: var(--radius-m);
    padding: 10px 14px;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 10px;
}
.owner-status-box {
    display: flex;
    align-items: center;
    gap: 8px;
}
.owner-status-label {
    font-size: 12.5px;
    font-weight: 700;
    color: #9A3412;
    white-space: nowrap;
}
.owner-status-form {
    margin: 0;
}
.owner-status-select {
    padding: 4px 10px;
    font-size: 13px;
    font-weight: 700;
    border-radius: 999px;
    border: 1.5px solid var(--orange-400);
    background: var(--white);
    color: var(--orange-800);
    cursor: pointer;
    outline: none;
    transition: all 0.15s ease;
}
.owner-status-select:focus {
    border-color: var(--orange-600);
    box-shadow: 0 0 0 2px rgba(234, 88, 12, 0.2);
}
.owner-action-btns {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

/* ---------- My page & Profile ---------- */
.mypage-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--gray-100);
}
.mypage-tab {
    padding: 12px 18px;
    font-size: 15px;
    font-weight: 700;
    color: var(--gray-500);
    border-bottom: 2.5px solid transparent;
    margin-bottom: -2px;
    text-decoration: none;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.mypage-tab:hover {
    color: var(--gray-900);
}
.mypage-tab.active {
    color: var(--orange-600);
    border-bottom-color: var(--orange-500);
}
.profile-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-l);
    padding: 24px;
    box-shadow: var(--shadow-card);
    margin-bottom: 20px;
}
.profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}
.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--orange-50);
    color: var(--orange-600);
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 2px solid var(--orange-200);
}
.profile-info {
    min-width: 0;
    flex: 1;
}
.profile-name {
    font-size: 18px;
    font-weight: 800;
    color: var(--gray-900);
    margin: 0 0 4px;
}
.profile-meta {
    font-size: 13px;
    color: var(--gray-500);
    margin: 0;
}
.profile-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    background: var(--gray-50);
    border-radius: var(--radius-m);
    padding: 14px 10px;
    text-align: center;
}
@media (max-width: 480px) {
    .profile-stats { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}
.stat-box {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.stat-num {
    font-size: 18px;
    font-weight: 800;
    color: var(--gray-900);
}
.stat-label {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--gray-500);
}
.profile-section {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-l);
    padding: 24px;
    box-shadow: var(--shadow-card);
    margin-bottom: 20px;
}
.profile-section-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--gray-900);
    margin: 0 0 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-100);
}
.form-input-readonly {
    background: var(--gray-50);
    color: var(--gray-500);
    cursor: not-allowed;
    border-color: var(--gray-200);
}
.form-note {
    font-size: 12px;
    color: var(--gray-500);
    margin: 6px 0 0;
}

.my-list { display: flex; flex-direction: column; }
.my-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 10px;
    border-radius: var(--radius-s);
    border-bottom: 1px solid var(--gray-100);
    text-decoration: none;
    transition: background 0.15s ease;
}
.my-item:hover {
    background: var(--gray-50);
}
.my-item:last-child {
    border-bottom: none;
}
.my-item-thumb { width: 68px; height: 68px; border-radius: var(--radius-s); overflow: hidden; flex-shrink: 0; background: var(--gray-100); }
.my-item-thumb img { width: 100%; height: 100%; object-fit: cover; }
.my-item-info { flex: 1; min-width: 0; }
.my-item-info .product-title { font-size: 15px; font-weight: 700; color: var(--gray-900); margin: 0 0 3px; line-height: 1.35; }
.my-item-info .product-meta { font-size: 12.5px; color: var(--gray-500); margin: 0 0 4px; }
.my-item-info .product-price { font-size: 15px; font-weight: 800; color: var(--gray-900); margin: 0; }
.my-item .badge { margin: 0; flex-shrink: 0; }

/* ---------- FAB ---------- */
.fab-write {
    position: fixed;
    right: 24px;
    bottom: 28px;
    background: var(--orange-500);
    color: var(--white);
    border-radius: 999px;
    padding: 14px 20px 14px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 14.5px;
    box-shadow: 0 6px 18px rgba(255, 138, 61, 0.4);
    z-index: 40;
}
.fab-write:hover { background: var(--orange-600); }

/* ---------- Footer ---------- */
.site-footer {
    border-top: 1px solid var(--gray-200);
    background: var(--white);
    margin-top: auto;
}
.footer-inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: 14px 20px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 16px;
}
.footer-info {
    display: flex;
    align-items: center;
    gap: 8px;
}
.footer-logo {
    font-size: 13.5px;
    font-weight: 800;
    color: var(--gray-800);
}
.footer-desc {
    font-size: 12px;
    color: var(--gray-500);
    padding-left: 8px;
    border-left: 1px solid var(--gray-200);
}
.footer-copy {
    font-size: 12px;
    color: var(--gray-400);
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
    .header-inner { padding: 10px 16px; }
    .header-nav { gap: 10px; font-size: 13px; }
    .category-bar-inner { padding: 8px 16px; }
    .page-container { padding: 16px 14px 36px; }
    .footer-inner { padding: 12px 16px 16px; }
    .detail-gallery { margin: 0 -16px 16px; }
    .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 10px; }
    .contact-type-options { grid-template-columns: repeat(3, 1fr); }
    .post-owner-bar { flex-direction: column; align-items: stretch; gap: 10px; }
    .owner-action-btns { width: 100%; justify-content: flex-end; }
    .admin-header-bar { flex-direction: column; align-items: stretch; }
    .admin-search-form { max-width: 100%; }
}

@media (max-width: 480px) {
    .header-nav { gap: 8px; font-size: 12.5px; }
    .nav-user { display: none; }
    .bid-history-item { padding: 10px 12px; }
    .bidder-name { max-width: 105px; font-size: 13px; }
    .bid-price-text { font-size: 15px; }
    .admin-tabs { overflow-x: auto; white-space: nowrap; gap: 4px; padding-bottom: 2px; }
    .admin-tab { padding: 10px 12px; font-size: 13.5px; }
}

/* ---------- Custom Alert & Confirm Modal ---------- */
.custom-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 17, 23, 0.48);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 16px;
}
.custom-modal-overlay.active {
    opacity: 1;
}
.custom-modal-card {
    background: var(--white);
    border-radius: 20px;
    width: 100%;
    max-width: 370px;
    padding: 24px 22px 20px;
    box-shadow: 0 20px 48px -6px rgba(0, 0, 0, 0.22), 0 8px 16px -4px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transform: scale(0.92) translateY(10px);
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.custom-modal-overlay.active .custom-modal-card {
    transform: scale(1) translateY(0);
}
.custom-modal-icon-wrap {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 14px;
    flex-shrink: 0;
}
.custom-modal-icon-wrap.type-info {
    background: var(--orange-50);
    color: var(--orange-600);
}
.custom-modal-icon-wrap.type-warning {
    background: #FEF3C7;
    color: #D97706;
}
.custom-modal-icon-wrap.type-danger {
    background: #FEE2E2;
    color: #DC2626;
}
.custom-modal-icon-wrap.type-success {
    background: #D1FAE5;
    color: #059669;
}
.custom-modal-body {
    width: 100%;
    margin-bottom: 20px;
}
.custom-modal-title {
    font-size: 17.5px;
    font-weight: 800;
    color: var(--gray-900);
    margin: 0 0 8px;
    letter-spacing: -0.3px;
}
.custom-modal-message {
    font-size: 14px;
    line-height: 1.6;
    color: var(--gray-700);
    margin: 0;
    white-space: pre-line;
    word-break: break-all;
}
.custom-modal-actions {
    width: 100%;
    display: flex;
    gap: 8px;
}
.custom-modal-btn {
    flex: 1;
    padding: 12px 14px;
    font-size: 14px;
    font-weight: 700;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.custom-modal-btn:active {
    transform: scale(0.98);
}
.custom-modal-cancel {
    background: var(--gray-100);
    color: var(--gray-700);
}
.custom-modal-cancel:hover {
    background: var(--gray-200);
    color: var(--gray-900);
}
.custom-modal-confirm.btn-primary {
    background: var(--orange-500);
    color: var(--white);
}
.custom-modal-confirm.btn-primary:hover {
    background: var(--orange-600);
}
.custom-modal-confirm.btn-danger {
    background: #EF4444;
    color: var(--white);
}
.custom-modal-confirm.btn-danger:hover {
    background: #DC2626;
}

/* ---------- Lightbox ---------- */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 11, 0.94);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
}
.lightbox-overlay.active { display: flex; }

.lightbox-image {
    max-width: 92vw;
    max-height: 86vh;
    object-fit: contain;
}

.lightbox-close,
.lightbox-nav {
    position: absolute;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-close {
    top: 18px;
    right: 18px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 17px;
}

.lightbox-nav {
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 24px;
}
.lightbox-prev { left: 12px; }
.lightbox-next { right: 12px; }

.lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    font-weight: 700;
}

@media (max-width: 640px) {
    .lightbox-nav { width: 38px; height: 38px; font-size: 20px; }
}

/* ---------- Accessibility ---------- */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--orange-500);
    outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
