﻿:root {
    --bg: #f6f7f8;
    --surface: #ffffff;
    --surface-soft: #fbfbfc;
    --text: #161616;
    --muted: #707070;
    --muted-strong: #3b3b3b;
    --line: #e5e7eb;
    --line-strong: #cfd4d8;
    --primary: #3fbbd5;
    --primary-dark: #229db8;
    --primary-soft: #eaf9fc;
    --danger: #b42318;
    --success: #067647;
    --warning: #b45309;
    --shadow: 0 12px 28px rgba(22, 22, 22, 0.07);
    --shadow-soft: 0 6px 16px rgba(22, 22, 22, 0.05);
}

* {
    box-sizing: border-box;
}

html {
    background: var(--bg);
}

body {
    margin: 0;
    padding: 0 0 78px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.72) 0, rgba(245, 246, 248, 0) 220px),
        var(--bg);
    color: var(--text);
    font-family: "Product Sans", "Google Sans", "Segoe UI", Roboto, Arial, sans-serif;
    line-height: 1.45;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

input,
select,
textarea,
button {
    width: 100%;
    min-height: 44px;
    border-radius: 8px;
}

input,
select,
textarea {
    padding: 10px 12px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(63, 187, 213, 0.18);
}

button {
    cursor: pointer;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 14px;
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid rgba(229, 231, 235, 0.92);
    backdrop-filter: blur(14px);
}

.brand {
    min-width: 0;
    font-size: 17px;
    font-weight: 500;
    letter-spacing: 0;
}

.brand-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: auto;
    min-height: 38px;
}

.brand-logo img {
    display: block;
    width: auto;
    height: 32px;
    max-width: 156px;
    object-fit: contain;
}

.admin-brand-logo {
    gap: 10px;
}

.admin-brand-logo .admin-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted-strong);
    font-size: 12px;
    font-weight: 500;
}

.cart-pill {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: auto;
    min-height: 38px;
    padding: 7px 10px 7px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--muted-strong);
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow-soft);
}

.cart-pill strong {
    display: grid;
    place-items: center;
    min-width: 24px;
    height: 24px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 12px;
}

.cart-pill svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.page {
    width: min(1160px, 100%);
    margin: 0 auto;
    padding: 14px;
}

.hero-compact,
.section-title {
    padding: 10px 0 16px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    width: auto;
    min-height: 36px;
    margin: 2px 0 8px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--muted-strong);
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow-soft);
}

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

.hero-compact h1,
.section-title h1,
.product-detail h1,
.success-box h1 {
    margin: 0 0 6px;
    font-size: 28px;
    font-weight: 500;
    line-height: 1.08;
    letter-spacing: 0;
}

.hero-compact p,
.section-title p,
.category,
.cart-item p {
    margin: 0;
    color: var(--muted);
}

.catalog-controls {
    display: grid;
    gap: 10px;
}

.search-panel,
.checkout-form,
.admin-panel,
.login-card,
.success-box {
    display: grid;
    gap: 12px;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
}

.search-panel {
    position: sticky;
    top: 61px;
    z-index: 7;
    grid-template-columns: 1fr auto;
    align-items: end;
    padding: 10px;
    border-color: rgba(63, 187, 213, 0.35);
    box-shadow: 0 8px 22px rgba(22, 22, 22, 0.08);
}

.search-panel label,
.filter-panel label,
.checkout-form label,
.admin-panel label,
.login-card label {
    display: grid;
    gap: 6px;
    color: var(--muted-strong);
    font-size: 12px;
    font-weight: 500;
}

.search-panel input {
    min-height: 46px;
    border-color: var(--line-strong);
    font-size: 15px;
}

.search-panel .primary-button {
    width: auto;
    min-width: 92px;
}

.filter-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 9;
    display: grid;
    width: min(360px, calc(100vw - 28px));
    grid-template-columns: 1fr;
    gap: 8px;
    align-items: end;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.filter-panel label {
    gap: 4px;
}

.filter-panel select,
.filter-panel .filter-button {
    min-height: 38px;
    padding: 7px 9px;
    font-size: 13px;
}

.filter-panel label span {
    font-size: 11px;
}

.primary-button,
.add-form button,
.detail-add button,
.filter-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 14px;
    border: 0;
    border-radius: 8px;
    background: var(--text);
    color: #fff;
    font-weight: 500;
    box-shadow: 0 8px 18px rgba(22, 22, 22, 0.12);
    transition: background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.primary-button:hover,
.add-form button:hover,
.detail-add button:hover,
.filter-button:hover {
    background: #000;
    box-shadow: 0 10px 22px rgba(22, 22, 22, 0.16);
}

.filter-drawer {
    display: grid;
    gap: 8px;
}

.filter-drawer summary {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    width: max-content;
    min-height: 38px;
    padding: 7px 11px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    list-style: none;
    box-shadow: var(--shadow-soft);
}

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

.filter-drawer summary svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
}

.category-strip {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    margin: 12px -14px 4px;
    padding: 0 14px 8px;
    scroll-snap-type: x proximity;
}

.category-card {
    flex: 0 0 92px;
    display: grid;
    gap: 7px;
    scroll-snap-align: start;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    box-shadow: var(--shadow-soft);
}

.category-card.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(63, 187, 213, 0.16);
}

.category-cover {
    display: grid;
    place-items: center;
    width: 100%;
    aspect-ratio: 1.18;
    overflow: hidden;
    border-radius: 7px;
    background: linear-gradient(180deg, #fff 0%, #f4f6f8 100%);
}

.category-cover img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 5px;
}

.category-cover span {
    color: var(--primary-dark);
    font-size: 22px;
    font-weight: 500;
}

.category-card strong {
    overflow: hidden;
    color: var(--muted-strong);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.primary-button:active,
.add-form button:active,
.detail-add button:active,
.filter-button:active {
    transform: translateY(1px);
}

.filter-button {
    border: 1px solid var(--line-strong);
    background: #fff;
    color: var(--text);
    box-shadow: none;
    font-size: 13px;
}

.filter-button:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--text);
    box-shadow: none;
}

.full {
    width: 100%;
}

.result-count {
    display: inline-flex;
    width: auto;
    margin: 0;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
}

.catalog-resultbar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 12px 0 10px;
}

.filter-controls {
    flex: 0 0 auto;
}

.pagination {
    display: flex;
    gap: 8px;
    align-items: center;
    overflow-x: auto;
    margin: 16px 0 4px;
    padding: 4px 0 2px;
}

.pagination a,
.pagination span,
.pagination strong {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    min-width: 42px;
    min-height: 42px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--muted);
    font-size: 14px;
    font-weight: 500;
}

.pagination a {
    color: var(--primary);
    box-shadow: var(--shadow-soft);
}

.pagination strong {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.product-grid {
    display: grid;
    gap: 12px;
}

.product-grid-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.product-card {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 12px;
    padding: 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 1px 0 rgba(17, 24, 39, 0.02);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.product-card:hover {
    border-color: var(--line-strong);
    box-shadow: var(--shadow-soft);
}

.product-grid-compact .product-card {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 8px;
}

.product-grid-compact .product-info {
    gap: 5px;
}

.product-grid-compact .product-info h2 {
    display: -webkit-box;
    min-height: 36px;
    overflow: hidden;
    font-size: 13px;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-grid-compact .sku,
.product-grid-compact .category,
.product-grid-compact .price-row span {
    font-size: 11px;
}

.product-grid-compact .category {
    display: none;
}

.product-grid-compact .price-row {
    display: grid;
    gap: 3px;
}

.product-grid-compact .price-row strong {
    font-size: 13px;
}

.product-grid-compact .add-form {
    grid-template-columns: 52px 1fr;
    gap: 6px;
}

.product-grid-compact .add-form input,
.product-grid-compact .add-form button {
    min-height: 38px;
    padding: 6px 8px;
    font-size: 13px;
}

.product-image,
.detail-image {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    border: 1px solid #eef0f3;
    border-radius: 8px;
    background: linear-gradient(180deg, #fff 0%, #f4f6f8 100%);
}

.product-image img,
.detail-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    padding: 4px;
}

.image-placeholder {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.product-info {
    min-width: 0;
    display: grid;
    gap: 7px;
}

.sku {
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
}

.product-info h2,
.cart-item h2,
.admin-panel h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.24;
}

.product-info h2 a:hover {
    color: var(--primary-dark);
}

.price-row {
    display: grid;
    gap: 4px;
}

.price-row strong,
.detail-price {
    color: var(--text);
    font-weight: 600;
    line-height: 1.16;
}

.price-row strong {
    font-size: 15px;
}

.stock-ok,
.stock-out {
    display: inline-flex;
    width: max-content;
    max-width: 100%;
    padding: 3px 7px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
}

.stock-ok {
    background: #ecfdf3;
    color: var(--success);
}

.stock-out {
    background: #fff7ed;
    color: var(--warning);
}

.add-form {
    display: grid;
    grid-template-columns: 68px 1fr;
    gap: 8px;
    align-items: end;
}

.add-form input {
    text-align: center;
    font-weight: 500;
}

.product-detail {
    display: grid;
    gap: 16px;
}

.detail-body {
    display: grid;
    gap: 10px;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
}

.detail-price {
    font-size: 24px;
}

.description {
    margin: 6px 0 0;
}

.detail-add {
    display: grid;
    grid-template-columns: 82px 1fr;
    gap: 10px;
}

.empty-state {
    padding: 18px;
    background: #fff;
    border: 1px dashed var(--line-strong);
    border-radius: 8px;
    color: var(--muted);
    text-align: center;
}

.cart-list {
    display: grid;
    gap: 10px;
}

.cart-item {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 10px;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
}

.cart-item-image {
    display: block;
    width: 74px;
    aspect-ratio: 1;
    overflow: hidden;
    border: 1px solid #eef0f3;
    border-radius: 8px;
    background: linear-gradient(180deg, #fff 0%, #f4f6f8 100%);
}

.cart-item-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 4px;
}

.cart-item-main {
    min-width: 0;
    display: grid;
    gap: 6px;
}

.cart-item h2 {
    font-size: 14px;
}

.cart-item p {
    font-size: 13px;
}

.cart-item-main strong {
    font-size: 14px;
}

.cart-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 72px 56px 1fr;
    gap: 8px;
}

.ghost-button {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--danger);
    font-weight: 500;
}

.ghost-link {
    display: inline-flex;
    justify-content: center;
    color: var(--primary);
    font-weight: 500;
}

.checkout-bar {
    position: sticky;
    bottom: 70px;
    z-index: 8;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 12px;
    align-items: center;
    margin-top: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

.checkout-bar .primary-button,
.checkout-bar button {
    grid-column: 1 / -1;
}

.checkout-bar .continue-shopping {
    grid-column: 1 / -1;
    justify-content: center;
    min-height: 36px;
}

.checkout-bar.static {
    position: static;
}

.alert {
    padding: 10px 12px;
    border: 1px solid #fecdca;
    border-radius: 8px;
    background: #fff1f3;
    color: var(--danger);
}

.alert p {
    margin: 0;
}

.form-note {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.success-box {
    margin-top: 16px;
    text-align: center;
}

.success-box.compact {
    text-align: left;
}

.profile-title {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 12px;
}

.profile-title .ghost-link {
    flex: 0 0 auto;
}

.auth-form {
    max-width: 520px;
}

.order-list {
    display: grid;
    gap: 10px;
}

.order-card {
    display: grid;
    gap: 6px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.order-card div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.order-card strong,
.order-card p {
    margin: 0;
    font-weight: 500;
}

.order-card span {
    color: var(--muted);
    font-size: 13px;
}

.bottom-nav {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    min-height: 58px;
    border: 1px solid rgba(209, 213, 219, 0.9);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
    overflow: hidden;
}

.scroll-top-button {
    position: fixed;
    right: 16px;
    bottom: 82px;
    z-index: 19;
    display: grid;
    place-items: center;
    width: 42px;
    min-height: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--text);
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    backdrop-filter: blur(12px);
}

.scroll-top-button.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.scroll-top-button svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.bottom-nav a {
    display: flex;
    flex-direction: column;
    gap: 3px;
    align-items: center;
    justify-content: center;
    place-items: center;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
}

.bottom-nav svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.bottom-nav span {
    line-height: 1;
}

.bottom-nav a:hover {
    background: var(--surface-soft);
    color: var(--primary-dark);
}

.login-screen {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 16px;
}

.login-card {
    width: min(420px, 100%);
}

.login-card h1 {
    margin: 0;
}

.admin-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 0 0 12px;
}

.admin-tabs a {
    flex: 0 0 auto;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--muted-strong);
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow-soft);
}

.admin-tabs a:hover {
    border-color: var(--primary);
    color: var(--primary-dark);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.stat-grid article {
    padding: 12px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
}

.stat-grid span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
}

.stat-grid strong {
    font-size: 24px;
    font-weight: 500;
    line-height: 1.1;
}

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

.category-list {
    display: grid;
    gap: 10px;
}

.category-row,
.category-edit {
    display: grid;
    gap: 8px;
}

.category-row {
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.category-edit label span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 12px;
}

table {
    width: 100%;
    min-width: 620px;
    border-collapse: collapse;
}

th,
td {
    padding: 11px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    font-size: 14px;
}

th {
    color: var(--muted-strong);
    font-size: 12px;
    text-transform: uppercase;
}

@media (min-width: 720px) {
    body {
        padding-bottom: 0;
    }

    .bottom-nav {
        display: none;
    }

    .topbar {
        padding: 14px 24px;
    }

    .page {
        padding: 24px;
    }

    .search-panel {
        top: 69px;
        grid-template-columns: 1fr auto;
        align-items: end;
    }

    .filter-panel {
        grid-template-columns: 180px 180px auto;
        width: max-content;
        max-width: 100%;
    }

    .filter-panel label {
        width: 180px;
    }

    .filter-panel .filter-button {
        width: auto;
        min-width: 86px;
    }

    .category-strip {
        margin-right: 0;
        margin-left: 0;
        padding-right: 0;
        padding-left: 0;
    }

    .hero-compact h1,
    .section-title h1 {
        font-size: 34px;
    }

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

    .product-grid-compact {
        grid-template-columns: repeat(5, 1fr);
    }

    .product-card {
        grid-template-columns: 1fr;
    }

    .product-card:hover {
        transform: translateY(-1px);
    }

    .product-detail {
        grid-template-columns: 420px 1fr;
        align-items: start;
    }

    .detail-body {
        padding: 20px;
    }

    .checkout-bar {
        bottom: 16px;
        grid-template-columns: 1fr auto auto;
    }

    .checkout-bar .primary-button,
    .checkout-bar button {
        grid-column: auto;
        width: auto;
    }

    .checkout-bar .continue-shopping {
        grid-column: auto;
    }

    .category-row {
        grid-template-columns: 1fr 130px;
        align-items: end;
    }

    .category-edit {
        grid-template-columns: 1fr 120px;
        align-items: end;
    }
}

