/* Heamatit Marketplace — Frontend RTL */

.hm-root {
    direction: rtl;
    font-family: var(--hm-font);
    color: var(--hm-fg);
    line-height: 1.6;
    box-sizing: border-box;
    background: var(--hm-bg);
    transition: background 0.25s ease, color 0.25s ease;
}

.hm-root--framed {
    border-radius: 16px;
    box-shadow: var(--hm-shadow-lg);
    margin: calc(var(--hm-spacing) * 2) 0;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--hm-border);
}

.hm-root--framed > .hm-container {
    padding-top: calc(var(--hm-spacing) * 7);
}

.hm-root *,
.hm-root *::before,
.hm-root *::after {
    box-sizing: border-box;
}

.hm-container {
    max-width: min(960px, 100%);
    margin: 0 auto;
    padding: clamp(12px, 3vw, calc(var(--hm-spacing) * 3));
}

.hm-container--wide {
    max-width: min(1200px, 100%);
}

/* Card */
.hm-card {
    background: var(--hm-bg-card);
    border: 1px solid var(--hm-border);
    border-radius: var(--hm-radius);
    box-shadow: var(--hm-shadow);
    padding: calc(var(--hm-spacing) * 3);
}

.hm-card + .hm-card {
    margin-top: calc(var(--hm-spacing) * 2);
}

.hm-card__title {
    margin: 0 0 calc(var(--hm-spacing) * 2);
    font-size: clamp(1.15rem, 3.5vw, 1.5rem);
    font-weight: 700;
    line-height: 1.35;
}

.hm-card__subtitle {
    margin: 0 0 calc(var(--hm-spacing) * 3);
    color: var(--hm-fg-muted);
    font-size: 0.95rem;
}

/* Badge */
.hm-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.4;
}

.hm-badge--pending_review { background: #FEF3C7; color: #92400E; }
.hm-badge--published { background: #D1FAE5; color: #065F46; }
.hm-badge--rejected { background: #FEE2E2; color: #991B1B; }
.hm-badge--sold { background: #E0E7FF; color: #3730A3; }
.hm-badge--archived { background: #F3F4F6; color: #4B5563; }
.hm-badge--pending,
.hm-badge--under_review,
.hm-badge--seller_contacted,
.hm-badge--reserved { background: #FEF3C7; color: #92400E; }
.hm-badge--completed { background: #D1FAE5; color: #065F46; }
.hm-badge--cancelled { background: #FEE2E2; color: #991B1B; }

/* Theme toggle */
.hm-theme-toggle {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 10;
    width: 40px;
    height: 40px;
    border: 1px solid var(--hm-border);
    border-radius: 10px;
    background: var(--hm-bg-card);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--hm-shadow);
    transition: border-color 0.2s, transform 0.15s;
}

.hm-theme-toggle:hover {
    border-color: var(--hm-primary);
    transform: scale(1.05);
}

.hm-theme-toggle__icon {
    font-size: 1.1rem;
    line-height: 1;
}

/* Marketplace nav */
.hm-marketplace-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px calc(var(--hm-spacing) * 3) 12px;
    padding-inline-start: calc(var(--hm-spacing) * 3 + 52px);
    border-bottom: 1px solid var(--hm-border);
    background: var(--hm-bg-card);
}

.hm-marketplace-nav__link {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--hm-fg-muted);
    border: 1px solid transparent;
    transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.hm-marketplace-nav__link:hover {
    color: var(--hm-fg);
    background: var(--hm-bg);
}

.hm-marketplace-nav__link.is-active {
    color: var(--hm-primary-contrast);
    background: var(--hm-primary);
    border-color: var(--hm-primary);
}

/* Button */
.hm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--hm-radius);
    font-family: var(--hm-font);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.hm-btn:hover {
    transform: translateY(-1px);
}

.hm-btn--primary {
    background: var(--hm-primary);
    color: #0A0A0A;
}

.hm-btn--primary:hover {
    background: var(--hm-primary-hover);
    color: #0A0A0A;
}

.hm-btn--outline {
    background: transparent;
    border: 1px solid var(--hm-border);
    color: var(--hm-fg);
}

.hm-btn--block {
    width: 100%;
}

/* Alert */
.hm-alert {
    padding: calc(var(--hm-spacing) * 2);
    border-radius: var(--hm-radius);
    margin-bottom: calc(var(--hm-spacing) * 2);
    font-size: 0.95rem;
}

.hm-alert--success { background: #DCFCE7; color: #166534; border: 1px solid #BBF7D0; }
.hm-alert--error { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }
.hm-alert--info { background: #DBEAFE; color: #1E40AF; border: 1px solid #BFDBFE; }

/* Form */
.hm-form {
    display: flex;
    flex-direction: column;
    gap: calc(var(--hm-spacing) * 2.5);
}

.hm-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hm-field__label {
    font-weight: 600;
    font-size: 0.9rem;
}

.hm-field__hint {
    font-size: 0.8rem;
    color: var(--hm-fg-muted);
}

.hm-field__input,
.hm-field__select,
.hm-field__textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--hm-border);
    border-radius: var(--hm-radius);
    background: var(--hm-bg);
    color: var(--hm-fg);
    font-family: var(--hm-font);
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.hm-field__input:focus,
.hm-field__select:focus,
.hm-field__textarea:focus {
    outline: none;
    border-color: var(--hm-primary);
    box-shadow: 0 0 0 3px var(--hm-primary-muted);
}

.hm-field__textarea {
    min-height: 120px;
    resize: vertical;
}

.hm-field__radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: calc(var(--hm-spacing) * 2);
}

.hm-field__radio {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border: 1px solid var(--hm-border);
    border-radius: var(--hm-radius);
    cursor: pointer;
    flex: 1;
    min-width: 140px;
}

.hm-field__radio:has(input:checked) {
    border-color: var(--hm-primary);
    background: var(--hm-primary-muted);
}

.hm-field__radio input {
    accent-color: var(--hm-primary);
}

/* Image upload */
.hm-upload {
    border: 2px dashed var(--hm-border);
    border-radius: var(--hm-radius);
    padding: calc(var(--hm-spacing) * 3);
    text-align: center;
    background: var(--hm-bg-muted);
    cursor: pointer;
    transition: border-color 0.2s;
}

.hm-upload:hover,
.hm-upload--dragover {
    border-color: var(--hm-primary);
}

.hm-upload__preview {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}

.hm-upload__thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--hm-border);
}

/* Table */
.hm-table-wrap {
    overflow-x: auto;
    border-radius: var(--hm-radius);
    border: 1px solid var(--hm-border);
}

.hm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.hm-table th,
.hm-table td {
    padding: 14px 16px;
    text-align: right;
    border-bottom: 1px solid var(--hm-border);
}

.hm-table th {
    background: var(--hm-bg-muted);
    font-weight: 600;
    color: var(--hm-fg-muted);
    font-size: 0.8rem;
    text-transform: none;
}

.hm-table tr:last-child td {
    border-bottom: none;
}

.hm-table__thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 8px;
}

.hm-table__placeholder {
    width: 48px;
    height: 48px;
    background: var(--hm-bg-muted);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--hm-fg-muted);
    font-size: 0.7rem;
}

/* Dashboard header */
.hm-dashboard-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: calc(var(--hm-spacing) * 3);
}

.hm-dashboard-header__greeting {
    margin: 0;
    font-size: 1.25rem;
}

/* Pagination */
.hm-pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: calc(var(--hm-spacing) * 3);
}

.hm-pagination a,
.hm-pagination span {
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--hm-border);
    text-decoration: none;
    color: var(--hm-fg);
    font-size: 0.9rem;
}

.hm-pagination .current {
    background: var(--hm-primary);
    border-color: var(--hm-primary);
    color: #0A0A0A;
    font-weight: 600;
}

/* Empty state */
.hm-empty {
    text-align: center;
    padding: calc(var(--hm-spacing) * 6) calc(var(--hm-spacing) * 3);
    color: var(--hm-fg-muted);
}

.hm-empty__icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
}

/* Responsive — tablet & mobile */
@media (max-width: 1024px) {
    .hm-container--wide {
        padding-inline: clamp(12px, 2.5vw, 24px);
    }

    .hm-detail {
        gap: calc(var(--hm-spacing) * 3);
    }

    .hm-detail__serial {
        font-size: clamp(1.25rem, 4vw, 1.75rem);
    }
}

@media (max-width: 768px) {
    .hm-root--framed {
        margin: calc(var(--hm-spacing)) 0;
        border-radius: 12px;
    }

    .hm-root--framed > .hm-container {
        padding-top: calc(var(--hm-spacing) * 6);
    }

    .hm-marketplace-nav {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 12px 16px;
        padding-inline-start: calc(16px + 44px);
        gap: 6px;
    }

    .hm-marketplace-nav::-webkit-scrollbar {
        display: none;
    }

    .hm-marketplace-nav__link {
        flex-shrink: 0;
        white-space: nowrap;
        padding: 8px 14px;
        font-size: 0.82rem;
    }

    .hm-theme-toggle {
        top: 10px;
        left: 10px;
        width: 36px;
        height: 36px;
    }

    .hm-card {
        padding: clamp(14px, 3vw, calc(var(--hm-spacing) * 2.5));
    }

    .hm-card + .hm-card {
        margin-top: calc(var(--hm-spacing) * 1.5);
    }

    .hm-card__subtitle {
        margin-bottom: calc(var(--hm-spacing) * 2);
        font-size: 0.9rem;
    }

    .hm-field__radio-group {
        flex-direction: column;
        gap: calc(var(--hm-spacing));
    }

    .hm-field__radio {
        min-width: 0;
        width: 100%;
    }

    .hm-dashboard-header {
        flex-direction: column;
        align-items: stretch;
    }

    .hm-detail {
        grid-template-columns: 1fr;
    }

    .hm-filters {
        flex-direction: column;
    }

    .hm-filters__search,
    .hm-filters__select {
        min-width: 0;
        width: 100%;
    }

    .hm-market-ticker {
        grid-template-columns: 1fr;
    }

    .hm-inventory-summary {
        grid-template-columns: 1fr;
    }

    .hm-table th,
    .hm-table td {
        padding: 10px 12px;
        font-size: 0.85rem;
    }

    .hm-auth__tabs {
        grid-template-columns: 1fr;
    }

    .hm-auth__row {
        flex-direction: column;
        align-items: flex-start;
    }

    .hm-auth__actions {
        flex-direction: column;
    }

    .hm-auth__actions .hm-btn {
        width: 100%;
    }

    .hm-btn {
        min-height: 44px;
    }
}

@media (max-width: 480px) {
    .hm-root--framed {
        margin: 0;
        border-radius: 0;
        border-inline: none;
    }

    .hm-container {
        padding: 12px;
    }

    .hm-marketplace-nav {
        padding-inline-start: 52px;
    }

    .hm-listing-grid {
        grid-template-columns: 1fr;
    }

    .hm-listing-card__serial {
        font-size: 1rem;
        word-break: break-word;
    }

    .hm-listing-card__meta {
        flex-wrap: wrap;
    }

    .hm-detail__spec {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .hm-detail__thumb {
        width: 56px;
        height: 56px;
    }

    .hm-serials {
        max-height: 240px;
    }

    .hm-serials__row {
        grid-template-columns: 28px 1fr;
    }

    .hm-upload {
        padding: calc(var(--hm-spacing) * 2);
    }

    .hm-upload__thumb {
        width: 64px;
        height: 64px;
    }

    .hm-qty__controls {
        width: 100%;
        justify-content: space-between;
    }

    .hm-qty__input {
        flex: 1;
        width: auto;
    }

    .hm-pagination {
        flex-wrap: wrap;
    }

    .hm-auth__title {
        font-size: 1.35rem;
    }
}

/* Legacy alias — keep small-phone rules unified above */
@media (max-width: 640px) {
    .hm-container {
        padding: clamp(12px, 4vw, calc(var(--hm-spacing) * 2));
    }
}

/* Marketplace */
.hm-marketplace-header {
    margin-bottom: calc(var(--hm-spacing) * 4);
    text-align: center;
}

.hm-marketplace-header__title {
    margin: 0 0 8px;
    font-size: clamp(1.35rem, 4.5vw, 2rem);
    font-weight: 700;
    line-height: 1.3;
}

.hm-marketplace-header__subtitle {
    margin: 0;
    color: var(--hm-fg-muted);
}

.hm-market-ticker {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: calc(var(--hm-spacing) * 3);
}

.hm-market-ticker--compact {
    margin-bottom: calc(var(--hm-spacing) * 2);
}

.hm-market-ticker__item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 18px;
    background: var(--hm-bg-card);
    border: 1px solid var(--hm-border);
    border-radius: var(--hm-radius);
    box-shadow: var(--hm-shadow);
}

.hm-market-ticker__item--offer {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(16, 185, 129, 0.12));
}

.hm-market-ticker__label {
    color: var(--hm-fg-muted);
    font-size: 0.85rem;
}

.hm-market-ticker__value {
    font-size: 1.15rem;
    font-weight: 700;
}

.hm-market-ticker__note {
    font-size: 0.85rem;
    color: var(--hm-fg);
}

/* OLX-style promo banner */
.hm-promo-banner {
    position: relative;
    margin-bottom: calc(var(--hm-spacing) * 3);
    border-radius: calc(var(--hm-radius) + 4px);
    overflow: hidden;
    border: 2px solid rgba(201, 162, 39, 0.45);
    box-shadow: 0 12px 40px rgba(201, 162, 39, 0.18);
    background: linear-gradient(135deg, #0f766e 0%, #115e59 35%, #0A0A0A 100%);
    color: #fff;
}

.hm-promo-banner--compact {
    margin-bottom: calc(var(--hm-spacing) * 2);
}

.hm-promo-banner__strip {
    display: flex;
    gap: 48px;
    padding: 8px 0;
    background: rgba(0, 0, 0, 0.25);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    animation: hm-promo-marquee 22s linear infinite;
}

.hm-promo-banner__strip span {
    flex-shrink: 0;
    color: #fff;
    opacity: 0.95;
}

@keyframes hm-promo-marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.hm-promo-banner__body {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 20px;
    align-items: center;
    padding: 22px 24px;
}

.hm-promo-banner__badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 88px;
    padding: 12px 14px;
    border-radius: 14px;
    background: linear-gradient(180deg, #F59E0B, #D97706);
    color: #0A0A0A;
    font-size: 0.8rem;
    font-weight: 800;
    text-align: center;
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.45);
    line-height: 1.3;
}

.hm-promo-banner__badge-icon {
    font-size: 1.6rem;
    line-height: 1;
}

.hm-promo-banner__content {
    min-width: 0;
}

.hm-promo-banner__title {
    display: block;
    margin: 0 0 6px;
    font-size: clamp(1.15rem, 2.5vw, 1.65rem);
    font-weight: 800;
    line-height: 1.35;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.hm-promo-banner__subtitle {
    margin: 0;
    font-size: clamp(0.9rem, 1.8vw, 1.05rem);
    color: #fff;
    opacity: 0.92;
    line-height: 1.5;
}

.hm-promo-banner__prices {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.hm-promo-banner__price {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 120px;
    padding: 12px 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.22);
    backdrop-filter: blur(6px);
    text-align: center;
}

.hm-promo-banner__price--buy {
    background: rgba(16, 185, 129, 0.22);
    border-color: rgba(16, 185, 129, 0.45);
}

.hm-promo-banner__price--sell {
    background: rgba(201, 162, 39, 0.22);
    border-color: rgba(201, 162, 39, 0.5);
}

.hm-promo-banner__price-label {
    font-size: 0.75rem;
    font-weight: 600;
    opacity: 0.88;
}

.hm-promo-banner__price-value {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.hm-promo-banner--compact .hm-promo-banner__strip {
    display: none;
}

.hm-promo-banner--compact .hm-promo-banner__body {
    grid-template-columns: auto 1fr;
    padding: 16px 18px;
    gap: 14px;
}

.hm-promo-banner--compact .hm-promo-banner__prices {
    grid-column: 1 / -1;
    justify-content: stretch;
}

.hm-promo-banner--compact .hm-promo-banner__price {
    flex: 1;
    min-width: 0;
}

.hm-promo-banner--prices-only .hm-promo-banner__body {
    grid-template-columns: auto 1fr;
}

.hm-promo-banner--prices-only .hm-promo-banner__content:empty {
    display: none;
}

.hm-promo-banner--prices-only:not(.hm-promo-banner--compact) .hm-promo-banner__body {
    grid-template-columns: auto 1fr;
}

.hm-promo-banner--prices-only:not(.hm-promo-banner--compact) .hm-promo-banner__prices {
    justify-content: flex-end;
}

.hm-promo-banner--compact .hm-promo-banner__title {
    font-size: 1.05rem;
}

.hm-promo-banner--compact .hm-promo-banner__badge {
    min-width: 72px;
    padding: 10px;
    font-size: 0.72rem;
}

@media (max-width: 768px) {
    .hm-promo-banner__body {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        padding: 18px 16px;
        text-align: center;
    }

    .hm-promo-banner__badge {
        align-self: center;
        flex-shrink: 0;
    }

    .hm-promo-banner__content {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        flex: 1 1 auto;
    }

    .hm-promo-banner__title,
    .hm-promo-banner__subtitle {
        white-space: normal;
        overflow-wrap: anywhere;
        word-break: normal;
        line-height: 1.55;
    }

    .hm-promo-banner__title {
        font-size: clamp(1rem, 4.5vw, 1.25rem);
    }

    .hm-promo-banner__subtitle {
        font-size: clamp(0.85rem, 3.8vw, 0.95rem);
    }

    .hm-promo-banner__prices {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        width: 100%;
        justify-content: stretch;
    }

    .hm-promo-banner__price {
        min-width: 0;
        width: 100%;
    }

    .hm-promo-banner--compact .hm-promo-banner__body,
    .hm-promo-banner--prices-only .hm-promo-banner__body,
    .hm-promo-banner--prices-only:not(.hm-promo-banner--compact) .hm-promo-banner__body {
        display: flex;
        flex-direction: column;
        grid-template-columns: unset;
    }

    .hm-promo-banner--compact .hm-promo-banner__prices {
        grid-column: auto;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        flex-direction: unset;
    }
}

@media (max-width: 480px) {
    .hm-promo-banner__strip {
        font-size: 0.7rem;
    }

    .hm-promo-banner__badge {
        min-width: 0;
        width: 100%;
        max-width: 280px;
    }

    .hm-promo-banner__price-value {
        font-size: 1.1rem;
    }
}

.hm-inventory-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.hm-inventory-summary__item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 16px;
    border: 1px solid var(--hm-border);
    border-radius: 12px;
    background: var(--hm-bg-muted);
}

.hm-inventory-summary__item span {
    color: var(--hm-fg-muted);
    font-size: 0.85rem;
}

.hm-inventory-summary__item strong {
    font-size: 1.2rem;
}

.hm-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: calc(var(--hm-spacing) * 4);
    align-items: stretch;
}

.hm-filters__search {
    flex: 1;
    min-width: 200px;
}

.hm-filters__select {
    min-width: 160px;
}

.hm-listing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
    gap: clamp(12px, 2.5vw, calc(var(--hm-spacing) * 3));
}

.hm-listing-card {
    background: var(--hm-bg-card);
    border: 1px solid var(--hm-border);
    border-radius: var(--hm-radius);
    overflow: hidden;
    box-shadow: var(--hm-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s;
}

.hm-listing-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--hm-shadow-lg);
}

.hm-listing-card__link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.hm-listing-card__media {
    aspect-ratio: 4/3;
    background: var(--hm-bg-muted);
    overflow: hidden;
}

.hm-listing-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hm-listing-card__placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--hm-fg-muted);
    font-weight: 600;
}

.hm-listing-card__body {
    padding: calc(var(--hm-spacing) * 2);
}

.hm-listing-card__type {
    font-size: 0.8rem;
    color: var(--hm-primary);
    font-weight: 600;
}

.hm-listing-card__serial {
    margin: 4px 0 8px;
    font-size: 1.1rem;
}

.hm-listing-card__meta {
    display: flex;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--hm-fg-muted);
}

/* Detail */
.hm-back-link {
    display: inline-block;
    margin-bottom: calc(var(--hm-spacing) * 2);
    color: var(--hm-fg-muted);
    text-decoration: none;
    font-size: 0.9rem;
}

.hm-back-link:hover {
    color: var(--hm-primary);
}

.hm-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: calc(var(--hm-spacing) * 4);
    align-items: start;
}

.hm-detail__main-image {
    border-radius: var(--hm-radius);
    overflow: hidden;
    border: 1px solid var(--hm-border);
    aspect-ratio: 1;
}

.hm-detail__main-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hm-detail__placeholder {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--hm-bg-muted);
    border-radius: var(--hm-radius);
    color: var(--hm-fg-muted);
}

.hm-detail__thumbs {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.hm-detail__thumb {
    width: 64px;
    height: 64px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: none;
}

.hm-detail__thumb.is-active {
    border-color: var(--hm-primary);
}

.hm-detail__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hm-detail__serial {
    margin: 12px 0 24px;
    font-size: 1.75rem;
}

.hm-detail__specs {
    display: grid;
    gap: 12px;
    margin: 0 0 24px;
}

.hm-detail__spec {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--hm-border);
}

.hm-detail__spec dt {
    color: var(--hm-fg-muted);
    font-weight: 500;
}

.hm-detail__spec dd {
    margin: 0;
    font-weight: 600;
}

.hm-detail__notes h3 {
    margin: 0 0 8px;
    font-size: 1rem;
}

.hm-detail__purchase {
    margin-top: calc(var(--hm-spacing) * 3);
    padding-top: calc(var(--hm-spacing) * 3);
    border-top: 1px solid var(--hm-border);
}

.hm-detail__purchase-note {
    font-size: 0.85rem;
    color: var(--hm-fg-muted);
    margin: 0 0 16px;
}

.hm-qty {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.hm-qty__label {
    font-size: 0.9rem;
    font-weight: 600;
}

.hm-qty__controls {
    display: inline-flex;
    align-items: center;
    gap: 0;
    border: 1px solid var(--hm-border);
    border-radius: 10px;
    overflow: hidden;
    background: var(--hm-bg-card);
    width: fit-content;
}

.hm-qty__btn {
    width: 44px;
    height: 44px;
    border: none;
    background: var(--hm-bg-muted);
    color: var(--hm-fg);
    font-size: 1.25rem;
    font-weight: 600;
    cursor: pointer;
    line-height: 1;
}

.hm-qty__btn:hover:not(:disabled) {
    background: var(--hm-primary-muted);
    color: var(--hm-primary);
}

.hm-qty__btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.hm-qty__input {
    width: 64px;
    height: 44px;
    border: none;
    border-inline: 1px solid var(--hm-border);
    text-align: center;
    font-family: var(--hm-font);
    font-size: 1rem;
    font-weight: 600;
    background: transparent;
    color: var(--hm-fg);
    -moz-appearance: textfield;
}

.hm-qty__input::-webkit-outer-spin-button,
.hm-qty__input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.hm-qty__hint {
    font-size: 0.8rem;
    color: var(--hm-fg-muted);
}

.hm-listing-card__price {
    font-weight: 700;
    color: var(--hm-primary);
}

.hm-listing-card__market-note {
    margin: 10px 0 0;
    font-size: 0.82rem;
    color: #047857;
}

.hm-btn--buy {
    font-size: 1.1rem;
    padding: 16px 32px;
}

/* Serial inputs on sell form */
.hm-serials {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
    max-height: 320px;
    overflow: auto;
    padding: 4px 2px;
}

.hm-serials__row {
    display: grid;
    grid-template-columns: 36px 1fr;
    gap: 8px;
    align-items: center;
}

.hm-serials__label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--hm-fg-muted);
    text-align: center;
}

.hm-serials-paste {
    margin-top: 12px;
}

.hm-serials-paste summary {
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--hm-primary);
    margin-bottom: 8px;
}

.hm-serials-paste .hm-field__textarea {
    margin-bottom: 8px;
}

.hm-serial-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
}

.hm-serial-chips__item {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.8rem;
    padding: 4px 8px;
    border: 1px solid var(--hm-border);
    border-radius: 6px;
    background: var(--hm-bg-muted);
}

.hm-detail__serials {
    margin: 16px 0;
}

.hm-detail__serials h3 {
    margin: 0 0 4px;
    font-size: 0.95rem;
}

/* Ratings */
.hm-rating {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    color: var(--hm-fg);
}

.hm-rating--inline {
    margin-top: 8px;
    margin-bottom: 12px;
}

.hm-rating--card {
    font-size: 0.85rem;
    margin: 4px 0 8px;
    color: #b45309;
}

.hm-rating__stars {
    color: #b45309;
    letter-spacing: 1px;
}

.hm-rating__avg {
    font-weight: 700;
}

.hm-rating__count {
    color: var(--hm-fg-muted);
    font-size: 0.85rem;
}

.hm-rating--done {
    color: #b45309;
    white-space: nowrap;
}

.hm-rate-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 160px;
}

.hm-rate-form__stars {
    display: inline-flex;
    flex-direction: row-reverse;
    gap: 2px;
}

.hm-rate-form__star {
    cursor: pointer;
    font-size: 1.25rem;
    color: var(--hm-border);
    line-height: 1;
}

.hm-rate-form__star input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.hm-rate-form__star:hover,
.hm-rate-form__star:hover ~ .hm-rate-form__star,
.hm-rate-form__star:has(input:checked),
.hm-rate-form__star:has(input:checked) ~ .hm-rate-form__star {
    color: #b45309;
}

.hm-rate-form__comment {
    font-size: 0.85rem;
    padding: 6px 8px;
    min-height: auto;
}

.hm-btn--sm {
    padding: 6px 12px;
    font-size: 0.85rem;
    width: fit-content;
}

.hm-container--narrow {
    max-width: min(480px, 100%);
}

/* Auth page */
.hm-auth__header {
    text-align: center;
    margin-bottom: calc(var(--hm-spacing) * 3);
}

.hm-auth__brand {
    margin: 0 0 calc(var(--hm-spacing));
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--hm-accent);
}

.hm-auth__title {
    margin: 0 0 calc(var(--hm-spacing));
    font-size: 1.75rem;
    font-weight: 700;
}

.hm-auth__subtitle {
    margin: 0;
    color: var(--hm-fg-muted);
}

.hm-auth__tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: calc(var(--hm-spacing));
    margin-bottom: calc(var(--hm-spacing) * 2);
}

.hm-auth__tab {
    display: block;
    padding: 12px 16px;
    border-radius: var(--hm-radius);
    border: 1px solid var(--hm-border);
    background: var(--hm-bg-card);
    color: var(--hm-fg-muted);
    text-align: center;
    text-decoration: none;
    font-weight: 600;
    transition: border-color 0.2s, color 0.2s, box-shadow 0.2s;
}

.hm-auth__tab.is-active,
.hm-auth__tab:hover {
    border-color: var(--hm-accent);
    color: var(--hm-fg);
    box-shadow: var(--hm-shadow);
}

.hm-auth__panel {
    margin-top: 0;
}

.hm-auth__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: calc(var(--hm-spacing) * 2);
}

@media (max-width: 640px) {
    .hm-auth__grid {
        grid-template-columns: 1fr;
    }
}

.hm-auth__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: calc(var(--hm-spacing) * 2);
    margin-bottom: calc(var(--hm-spacing) * 2);
    flex-wrap: wrap;
}

.hm-auth__remember {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--hm-fg-muted);
    font-size: 0.92rem;
}

.hm-auth__link {
    color: var(--hm-accent);
    font-weight: 600;
    text-decoration: none;
}

.hm-auth__link:hover {
    text-decoration: underline;
}

.hm-auth__footer {
    margin: calc(var(--hm-spacing) * 2) 0 0;
    text-align: center;
    color: var(--hm-fg-muted);
    font-size: 0.92rem;
}

.hm-auth__footer a {
    color: var(--hm-accent);
    font-weight: 600;
    text-decoration: none;
}

.hm-auth__footer a:hover {
    text-decoration: underline;
}

.hm-auth__actions {
    display: flex;
    flex-wrap: wrap;
    gap: calc(var(--hm-spacing));
}

.hm-auth {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

@media (max-width: 768px) {
    .hm-root--auth {
        width: 100vw;
        max-width: 100vw;
        margin-inline: calc(50% - 50vw);
        border-radius: 0;
        border-inline: none;
        box-shadow: none;
    }

    .hm-root--auth > .hm-container,
    .hm-root--auth .hm-container--narrow {
        width: 100%;
        max-width: 100%;
        padding-inline: clamp(16px, 4vw, 24px);
        padding-top: calc(var(--hm-spacing) * 5);
    }

    .hm-auth__header {
        margin-bottom: calc(var(--hm-spacing) * 2);
    }

    .hm-auth__title {
        font-size: clamp(1.25rem, 5.5vw, 1.65rem);
        line-height: 1.35;
    }

    .hm-auth__subtitle {
        font-size: 0.92rem;
        line-height: 1.6;
    }

    .hm-auth__tabs {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .hm-auth__tab {
        padding: 12px 10px;
        font-size: 0.88rem;
    }

    .hm-auth__panel.hm-card {
        padding: 20px 16px;
    }

    .hm-auth__row {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .hm-auth .hm-field__input,
    .hm-auth .hm-field__textarea {
        width: 100%;
        min-height: 48px;
        font-size: 16px;
    }

    .hm-auth .hm-btn--block {
        width: 100%;
        min-height: 48px;
        font-size: 1rem;
    }

    .hm-auth__footer {
        font-size: 0.92rem;
        line-height: 1.55;
    }
}

@media (max-width: 480px) {
    .hm-root--auth > .hm-container {
        padding-inline: 14px;
    }

    .hm-auth__tab {
        padding: 11px 8px;
        font-size: 0.82rem;
    }
}

.hm-btn--ghost {
    background: transparent;
    border: 1px solid var(--hm-border);
    color: var(--hm-fg-muted);
}

.hm-btn--ghost:hover {
    border-color: var(--hm-fg-muted);
    color: var(--hm-fg);
}

.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}
