/* Кабинет (/app). Палитры и переключатель тем — styles/themes.css. */

.layout-app {
    margin: 0;
    background: var(--app-bg);
    color: var(--app-text);
    font-family: Manrope, Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    display: flex;
    align-items: center;
    gap: var(--app-gap);
    padding: 12px 16px;
    background: var(--app-surface);
    border-bottom: 1px solid var(--app-border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.app-topbar__brand,
.app-topbar .brand {
    font-family: Unbounded, Manrope, sans-serif;
    font-weight: 700;
    font-size: 20px;
    color: var(--app-text);
    text-decoration: none;
}

.app-topbar .brand__name {
    color: var(--app-text);
}

.app-topbar__user {
    margin-left: auto;
    color: var(--app-text-muted);
    font-size: 14px;
}

.app-topbar__uid {
    color: var(--app-text-muted);
    font-size: 12px;
}

.app-topbar__logout {
    color: var(--app-primary);
    text-decoration: none;
    font-size: 14px;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .app-topbar {
        flex-wrap: wrap;
        row-gap: 6px;
    }

    .app-topbar__user {
        order: 10;
        flex-basis: 100%;
        margin-left: 0;
    }
}

.app-main {
    flex: 1;
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 16px;
    box-sizing: border-box;
}

.app-flash {
    padding: 10px 14px;
    border-radius: var(--app-radius);
    margin-bottom: var(--app-gap);
    font-size: 14px;
}

.app-flash--error {
    background: #fdecea;
    color: var(--app-danger);
}

.app-flash--success {
    background: #eaf7ee;
    color: var(--app-success);
}

/* Auth page */
.app-auth {
    max-width: 380px;
    margin: 40px auto;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    padding: 28px 24px;
    box-sizing: border-box;
}

.app-auth__title {
    font-family: Unbounded, Manrope, sans-serif;
    font-size: 22px;
    margin: 0 0 6px 0;
}

.app-auth__subtitle {
    color: var(--app-text-muted);
    font-size: 14px;
    margin: 0 0 24px 0;
}

.app-auth__providers {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.app-auth__provider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--app-radius);
    border: 1px solid var(--app-border);
    background: var(--app-surface);
    color: var(--app-text);
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    transition: background-color .15s ease, border-color .15s ease;
}

.app-auth__provider:hover {
    background: #e0f2fe;
    border-color: var(--app-primary);
}

.app-auth__provider--yandex { border-color: #fc3f1d33; }
.app-auth__provider--google { border-color: #4285f433; }
.app-auth__provider--mail_ru { border-color: #005ff933; }
.app-auth__provider--max { border-color: #7b3ff233; font: inherit; cursor: pointer; }

.app-auth__provider--disabled {
    opacity: .55;
    cursor: not-allowed;
    pointer-events: none;
}

.app-auth__provider-badge {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--app-border);
    color: var(--app-text-muted);
    border-radius: 6px;
    padding: 2px 6px;
    margin-left: auto;
}

.app-auth__divider {
    text-align: center;
    color: var(--app-text-muted);
    font-size: 12px;
    margin: 18px 0;
    position: relative;
}

#telegram-login-container {
    display: flex;
    justify-content: center;
    min-height: 40px;
    align-items: center;
}

.app-auth__hint {
    font-size: 13px;
    color: var(--app-text-muted);
    text-align: center;
}

.app-auth__hint--error {
    color: var(--app-danger);
}

.app-auth__error {
    background: #fdecea;
    color: var(--app-danger);
    border-radius: var(--app-radius);
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 18px;
}

.app-auth__legal {
    margin: 24px 0 0;
    font-size: 12px;
    line-height: 1.45;
    color: var(--app-text-muted);
    text-align: center;
}

.app-auth__legal a {
    color: inherit;
}

/* Role picker (onboarding) */
.role-picker {
    max-width: 520px;
    margin: 40px auto;
}

.role-picker__title {
    font-family: Unbounded, Manrope, sans-serif;
    font-size: 22px;
    margin: 0 0 6px 0;
}

.role-picker__subtitle {
    color: var(--app-text-muted);
    font-size: 14px;
    margin: 0 0 24px 0;
}

.role-picker__cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

@media (min-width: 560px) {
    .role-picker__cards {
        grid-template-columns: repeat(3, 1fr);
    }
}

.role-picker__card {
    position: relative;
    border: 2px solid var(--app-border);
    border-radius: var(--app-radius);
    background: var(--app-surface);
    padding: 20px 16px;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s ease;
}

.role-picker__card.is-selected,
.role-picker__card:has(input:checked) {
    border-color: var(--app-primary);
    background: #e0f2fe;
}

.role-picker__card input {
    position: absolute;
    top: 12px;
    left: 12px;
}

.role-picker__card-title {
    font-weight: 700;
    margin-top: 8px;
}

.role-picker__card-desc {
    font-size: 12px;
    color: var(--app-text-muted);
    margin-top: 4px;
}

.role-picker__card-badge {
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--app-success);
    margin-top: 8px;
}

.role-picker__submit {
    margin-top: 24px;
    width: 100%;
    padding: 13px 16px;
    border: none;
    border-radius: var(--app-radius);
    background: var(--app-primary);
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
}

.role-picker__submit:hover {
    background: var(--app-primary-dark);
}

/* Dashboards */
.app-dashboard__title {
    font-family: Unbounded, Manrope, sans-serif;
    font-size: 24px;
    margin: 8px 0 20px 0;
}

.app-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--app-gap);
}

@media (min-width: 640px) {
    .app-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 960px) {
    .app-cards {
        grid-template-columns: repeat(3, 1fr);
    }
}

.app-card {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    padding: 18px;
}

.app-card--storefront {
    position: relative;
    border: 2px solid #d97706;
    background: color-mix(in srgb, var(--app-surface) 85%, #fbbf24 25%);
}

.app-card--storefront::before {
    content: "🏪";
    position: absolute;
    top: -12px;
    right: 14px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    background: #d97706;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .25);
}

.app-card__title {
    font-weight: 700;
    margin: 0 0 6px 0;
}

.app-card__desc {
    color: var(--app-text-muted);
    font-size: 14px;
    margin: 0;
}

#catalog-count {
    margin-bottom: 12px;
}

.app-card__danger {
    font: inherit;
    font-weight: 600;
    margin-top: 12px;
    padding: 9px 16px;
    border: 1px solid var(--app-danger);
    border-radius: 8px;
    background: var(--app-surface);
    color: var(--app-danger);
    cursor: pointer;
}

.app-card__danger:hover {
    background: var(--app-danger);
    color: var(--app-surface);
}

.app-summary-list {
    margin: 10px 0 0;
    padding-left: 18px;
    font-size: 14px;
    color: var(--app-text);
}

.app-summary-list li {
    margin-bottom: 4px;
}

/* Listing form (seller) */
.listing-form {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    padding: 18px;
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.listing-form__row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

@media (min-width: 560px) {
    .listing-form__row {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }
}

.listing-form input,
.listing-form select {
    padding: 10px 12px;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
    width: 100%;
    /* Без этого select остаётся с браузерным шрифтом и высотой и не встаёт в ряд с полями. */
    height: 40px;
    color: inherit;
    line-height: normal;
}

/* Подсказки справочника: название лота выбирается только отсюда. */
.listing-suggest__anchor {
    position: relative;
}

.listing-suggest {
    position: absolute;
    z-index: 20;
    top: 100%;
    left: 0;
    right: 0;
    margin: 2px 0 0;
    padding: 0;
    list-style: none;
    max-height: 260px;
    overflow-y: auto;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .12);
}

.listing-suggest li {
    border-bottom: 1px solid var(--app-border);
}

.listing-suggest li:last-child {
    border-bottom: 0;
}

.listing-suggest button {
    display: block;
    width: 100%;
    padding: 8px 12px;
    text-align: left;
    background: none;
    border: 0;
    cursor: pointer;
    font: inherit;
}

.listing-suggest button:hover {
    background: var(--app-bg);
}

.listing-suggest__cat {
    color: var(--app-text-muted);
    font-size: .85em;
}

.listing-suggest__empty {
    padding: 8px 12px;
    color: var(--app-text-muted);
}

.listing-form__actions {
    display: flex;
    gap: 10px;
}

.listing-form__actions button {
    padding: 10px 18px;
    border-radius: 8px;
    border: none;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
}

#listing-form-submit {
    background: var(--app-primary);
    color: #fff;
}

#listing-form-submit:hover {
    background: var(--app-primary-dark);
}

#listing-form-cancel {
    background: var(--app-border);
    color: var(--app-text);
}

.listing-card__image {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 10px;
    background: var(--app-bg);
}

/* Черновики лотов из фото: dropzone и строки загрузки */
.dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 24px 16px;
    margin: 8px 0 12px;
    border: 2px dashed var(--app-border);
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
}

.dropzone--active {
    border-color: var(--app-primary, #2e7d32);
    background: var(--app-surface-muted, rgba(46, 125, 50, 0.06));
}

.dropzone__title {
    font-weight: 600;
}

.dropzone__uploads {
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
    font-size: 14px;
}

.dropzone__upload {
    padding: 2px 0;
}

.dropzone__upload--done {
    color: var(--app-text-muted);
}

.dropzone__upload--error {
    color: var(--app-danger);
}

.listing-card--draft {
    border-style: dashed;
}

.listing-card__photos {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    list-style: none;
    margin: 6px 0;
    padding: 0;
}

.listing-card__photo {
    position: relative;
}

.listing-card__photo img {
    display: block;
    width: 64px;
    height: 48px;
    object-fit: cover;
    border-radius: 4px;
    border: 2px solid transparent;
}

.listing-card__photo--main img {
    border-color: var(--app-primary, #2e7d32);
}

.listing-card__photo button {
    position: absolute;
    top: -6px;
    width: 20px;
    height: 20px;
    padding: 0;
    border-radius: 50%;
    font-size: 12px;
    line-height: 1;
}

.listing-card__photo button[data-remove-image] {
    right: -6px;
}

.listing-card__photo button[data-main-image] {
    left: -6px;
}

.listing-card__upload {
    display: inline-block;
    margin-top: 10px;
    font-size: 12px;
    color: var(--app-primary);
    cursor: pointer;
    text-decoration: underline;
}

.listing-card__badge {
    font-size: 11px;
    background: #fdecea;
    color: var(--app-danger);
    border-radius: 6px;
    padding: 2px 6px;
    font-weight: 700;
    text-transform: uppercase;
}

.listing-card__badge--tier-novice { background: #f0f0f0; color: #757575; }
.listing-card__badge--tier-bronze { background: #f3e0d0; color: #8a5a2b; }
.listing-card__badge--tier-silver { background: #e8e8ec; color: #5b5b66; }
.listing-card__badge--tier-gold { background: #fdf1c8; color: #8a6d1a; }

.listing-card__actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.listing-card__actions button {
    padding: 7px 12px;
    border-radius: 8px;
    border: 1px solid var(--app-border);
    background: var(--app-surface);
    font-size: 13px;
    cursor: pointer;
}

.listing-card__actions button:hover {
    border-color: var(--app-primary);
}

/* Cart (buyer catalog) */
.cart-panel {
    position: sticky;
    bottom: 12px;
    margin-top: 24px;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    padding: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .08);
}

.cart-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.cart-panel__title {
    margin: 0;
    font-size: 16px;
}

.cart-panel__clear {
    border: none;
    background: none;
    color: var(--app-danger);
    font-size: 13px;
    cursor: pointer;
    padding: 0;
    white-space: nowrap;
}

.cart-panel__clear:hover {
    text-decoration: underline;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    padding: 6px 0;
    border-bottom: 1px solid var(--app-border);
}

.cart-item span:first-child {
    flex: 1;
}

.cart-item button {
    border: none;
    background: none;
    color: var(--app-danger);
    cursor: pointer;
    font-size: 14px;
}

#fulfillment-type,
#delivery-address {
    padding: 10px 12px;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
}

#checkout-btn {
    margin-top: 12px;
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: var(--app-primary);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

#checkout-btn:hover {
    background: var(--app-primary-dark);
}

.order-hold-continue {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 14px;
    border-radius: 8px;
    background: var(--app-primary);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
}

.order-hold-continue:hover {
    background: var(--app-primary-dark);
}

/* Trip tabs (courier) */
.trip-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.trip-tab {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--app-border);
    background: var(--app-surface);
    font-size: 14px;
    cursor: pointer;
}

.trip-tab.is-active {
    background: var(--app-primary);
    color: #fff;
    border-color: var(--app-primary);
}

#trip-detail button,
.listing-card__actions button {
    margin-right: 6px;
    margin-top: 6px;
}

.rate-block {
    margin-top: 10px;
}

.rate-block button {
    padding: 6px 10px;
    margin-right: 4px;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    background: var(--app-surface);
    cursor: pointer;
}

.rate-block button:hover {
    border-color: var(--app-primary);
}

/* Вход по телефону */
.app-auth__phone {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.app-auth__phone input {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    font: inherit;
    border: 1px solid var(--app-border);
    border-radius: 8px;
}

.app-auth__phone button {
    width: 100%;
    padding: 12px 16px;
    font: inherit;
    font-weight: 600;
    border: 0;
    border-radius: var(--app-radius);
    background: var(--app-primary);
    color: #fff;
    cursor: pointer;
}

.app-auth__phone button:disabled {
    opacity: .6;
    cursor: default;
}

.app-auth__phone #phone-step,
.app-auth__phone #code-step {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.app-auth__phone #phone-step[hidden],
.app-auth__phone #code-step[hidden] {
    display: none;
}

.app-auth__phone .app-auth__link {
    background: none;
    color: var(--app-primary);
    font-weight: 400;
    padding: 4px;
}

.app-auth__hint--error {
    color: var(--app-danger);
}

/* Способ получения по каждому лоту в корзине, лоты сгруппированы по продавцам */
.cart-fulfillment {
    border: 1px solid var(--app-border);
    border-radius: 8px;
    margin: 10px 0;
    padding: 8px 12px;
}

.cart-fulfillment__seller {
    font-size: 14px;
    font-weight: 600;
    padding: 0 4px;
}

.cart-fulfillment__lot {
    font-size: 14px;
    margin: 8px 0 2px;
}

.cart-fulfillment__option {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 14px;
    padding: 4px 0;
    cursor: pointer;
}

.cart-fulfillment__option small {
    color: var(--app-text-muted);
}

.order-shipment {
    border-top: 1px solid var(--app-border);
    padding-top: 8px;
    margin-top: 8px;
}

.order-handover-code {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 4px;
}
