:root{
    --bg:#f2f3f5;
    --card:#ffffff;
    --accent:#2ea6ff;
}

html{
    -webkit-text-size-adjust: 100%;
}

body{
    margin:0;
    font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto;
    background:var(--bg);
}

/* контент */
#app{
    padding:16px;
    padding-bottom:90px;
}

/* карточки */
.card{
    background:var(--card);
    border-radius:16px;
    padding:12px;
    margin-bottom:14px;
    box-shadow:0 2px 8px rgba(0,0,0,0.05);
}

.card img{
    width:100%;
    border-radius:12px;
}

.price{
    font-size:18px;
    font-weight:600;
    margin:6px 0 10px;
}

/* кнопки */
button{
    border:none;
    border-radius:12px;
    background:var(--accent);
    color:white;
    padding:12px;
    font-size:15px;
}

/* qty */
.qty{
    display:flex;
    align-items:center;
    gap:10px;
    margin:8px 0;
}

.qty button{
    width:36px;
    height:36px;
    padding:0;
    border-radius:10px;
}

/* tabbar */
#tabbar{
    position:fixed;
    bottom:0;
    left:0;
    right:0;
    height:70px;

    background:white;
    border-top:1px solid #ddd;

    display:flex;
    justify-content:space-around;
    align-items:center;

    padding-bottom:env(safe-area-inset-bottom);
}

#tabbar button{
    background:none;
    color:#555;
    font-size:13px;
    display:flex;
    flex-direction:column;
    align-items:center;
    gap:3px;
}

#tabbar button span{
    font-size:22px;
}

#tabbar button.active{
    color:var(--accent);
    font-weight:600;
}

.screen{
    animation:fadeIn .18s ease;
}

@keyframes fadeIn{
    from{opacity:0; transform:translateY(6px);}
    to{opacity:1; transform:translateY(0);}
}

/* skeleton */
.skeleton{
    background:linear-gradient(90deg,#eee,#f5f5f5,#eee);
    background-size:200% 100%;
    animation:skeleton 1.2s infinite;
    border-radius:12px;
}

@keyframes skeleton{
    0%{background-position:200% 0}
    100%{background-position:-200% 0}
}

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

.form input,
.form select{
    width:100%;
    height:48px;
    padding:0 14px;
    border-radius:12px;
    border:1px solid #ddd;
    font-size:16px;
    background:#fff;
    box-sizing:border-box;
}

.form textarea{

    width:100%;
    min-height:110px;

    padding:14px;

    border-radius:12px;
    border:1px solid #ddd;

    font-size:16px;
    background:#fff;

    resize:none;
    box-sizing:border-box;
}

textarea::placeholder{
    color:#aaa;
}

.form select{
    appearance:none;
    -webkit-appearance:none;
    -moz-appearance:none;

    background-image:url("data:image/svg+xml;utf8,<svg fill='black' height='20' viewBox='0 0 20 20' width='20' xmlns='http://www.w3.org/2000/svg'><path d='M5 7l5 6 5-6z'/></svg>");
    background-repeat:no-repeat;
    background-position:right 12px center;
    background-size:16px;
}

.form textarea{
    min-height:90px;
}

.form label{
    font-size:13px;
    color:#666;
    margin-top:6px;
}

/* toast */

#toast{
    position:fixed;
    left:50%;
    bottom:90px;
    transform:translateX(-50%) translateY(20px);
    background:rgba(0,0,0,.85);
    color:white;
    padding:12px 16px;
    border-radius:14px;
    font-size:14px;
    opacity:0;
    pointer-events:none;
    transition:.25s;
    z-index:1000;
}

#toast.show{
    opacity:1;
    transform:translateX(-50%) translateY(0);
}

.products{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:14px;
    padding-bottom:80px;
}

.product-card{
    background:#ffffff;
    border-radius:18px;
    overflow:hidden;
    display:flex;
    flex-direction:column;
    height:100%;
}

/* КОНТЕЙНЕР ФОТО */
.product-photo{
    width:100%;
    aspect-ratio:1/1;
    background:#ddd;
    overflow:hidden;
}

.product-photo img{
    width:100%;
    height:100%;
    object-fit:cover;
    display:block;
}

.product-info{
    padding:12px;
    display:flex;
    flex-direction:column;
    flex:1;
}

.product-title{
    font-weight:600;
    font-size:15px;
    /*min-height:38px;*/
    display:-webkit-box;
    -webkit-line-clamp:2;
    -webkit-box-orient:vertical;
    overflow:hidden;
}

.product-price{
    font-size:18px;
    font-weight:700;
    margin:6px 0 10px;
}

.product-card button{
    width:100%;
    border-radius:12px;
    padding:12px;
    background:var(--tg-button);
    color:white;
    border:none;
    font-weight:600;
    margin-top:auto;
}

#topbar{
    padding:12px 16px 6px;
    background:white;
    border-bottom:1px solid #eee;
}

#profile{
    display:flex;
    align-items:center;
    gap:12px;
}

#avatar{
    width:42px;
    height:42px;
    border-radius:50%;
    background:#ddd;
    object-fit:cover;
}

#username{
    font-weight:600;
}

#myOrdersBtn{
    font-size:13px;
    color:#2ea6ff;
    margin-top:2px;
}

.order-top{
    display:flex;
    justify-content:space-between;
}

.order-date{
    font-size:13px;
    color:#777;
    margin:4px 0;
}

.status{
    font-size:12px;
    background:#e8f4ff;
    color:#2ea6ff;
    padding:4px 8px;
    border-radius:8px;
}

.segmented{
    display:flex;
    background:var(--tg-secondary);
    border-radius:12px;
    padding:4px;
}

.segmented button{
    flex:1;
    padding:10px;
    border:none;
    background:transparent;
    border-radius:10px;
    font-size:14px;
    color:var(--tg-hint);
}

.segmented button.active{
    background:var(--tg-bg);
    color:var(--tg-text);
    box-shadow:0 1px 4px rgba(0,0,0,.08);
}

.product-hero{
    width:100%;
    height:320px;
    overflow:hidden;
    border-radius:24px;
    margin:12px 12px 0;
}

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

.product-page{
    padding:18px 16px 24px;
}

.product-page h2{
    margin-top:14px;
    margin-bottom:8px;
}

.product-page .price{
    font-size:26px;
    font-weight:800;
    margin:8px 0 12px;
}

#cartTab{
    position:relative;
}

#cartBadge{
    position:absolute;
    top:6px;        /* опускаем ниже */
    right:12px;

    min-width:18px; /* увеличиваем кружок */
    height:18px;
    padding:0 6px;

    background:#2ea6ff;
    color:#fff;

    font-size:12px;
    font-weight:700;
    line-height:18px;
    text-align:center;

    border-radius:999px;

    opacity:0;
    transition:.18s ease;

    box-shadow:0 0 0 2px white;
}

#cartBadge.show{
    opacity:1;
}

.badge-text{
    display:inline-block;
    transform:scale(.75);
    transform-origin:center;
}


/* ===== CART ===== */

.cart-item{
    display:flex;
    gap:12px;
    padding:12px;
    background:var(--card);
    border-radius:18px;
    margin-bottom:14px;
    box-shadow:0 2px 8px rgba(0,0,0,.05);
}

.cart-photo{
    width:84px;
    height:84px;
    border-radius:14px;
    overflow:hidden;
    flex-shrink:0;
    background:#eee;
}

.cart-photo img{
    width:100%;
    height:100%;
    object-fit:cover;
}

.cart-body{
    flex:1;
    display:flex;
    flex-direction:column;
    justify-content:space-between;
}

.cart-title{
    font-weight:600;
    font-size:15px;
}

.cart-price{
    font-size:16px;
    font-weight:700;
    margin-top:2px;
}

.cart-controls{
    display:flex;
    justify-content:space-between;
    align-items:center;
    margin-top:6px;
}

.cart-controls .remove{
    background:#f1f3f5;
    color:#444;
    padding:8px 12px;
    border-radius:10px;
    font-size:13px;
}

.cart-summary{
    position:sticky;
    bottom:78px;
    background:var(--card);
    padding:14px;
    border-radius:18px;
    box-shadow:0 4px 16px rgba(0,0,0,.08);
    margin-top:10px;
}

.cart-summary .total{
    display:flex;
    justify-content:space-between;
    font-size:18px;
    margin-bottom:10px;
}

/* ABOUT PAGE */

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

.acc-head{
    width:100%;
    text-align:left;
    background:#f1f3f5;
    color:#333;
    padding:16px;
    border-radius:14px;
    font-weight:600;
}

.acc-head span{
    display:inline-block;
    transition:.2s;
}

.acc-head.open span{
    transform:rotate(90deg);
}

.acc-body{
    max-height:0;
    overflow:hidden;
    transition:max-height .25s ease;
    background:#fff;
    border-radius:14px;
    padding:0 16px;
}

.acc-body.open{
    padding:14px 16px;
    max-height:4000px;
}

.about-contacts{
    margin-top:20px;
    color:#555;
    font-size:14px;
    line-height:1.45;
}

.about-page{
    line-height:1.6;
    color:#333;
}

.about-page h1{
    margin-bottom:10px;
}

.about-page h3{
    margin-top:22px;
    margin-bottom:8px;
}

.about-page .lead{
    font-size:16px;
    color:#444;
}

.about-list{
    padding-left:18px;
    margin:10px 0;
}

.about-list li{
    margin-bottom:6px;
}

.acc-body h3{
    margin-top:18px;
    margin-bottom:6px;
}

.acc-body p{
    margin:6px 0 10px;
}

.acc-body ol{
    padding-left:18px;
    margin-bottom:14px;
}

.acc-body li{
    margin-bottom:6px;
}

.care-list{
    padding-left:18px;
}

#tabbar i{
    width:22px;
    height:22px;
    stroke-width:2;
}

#tabbar button{
    color:#6b7280;
}

#tabbar button.active{
    color:var(--tg-button);
}

#tabbar button.active i{
    stroke:var(--tg-button);
}

.form-row{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:12px;
    align-items:end;
}

.form-row > *{
    min-width:0;
}

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

.form-row .field{
    display:flex;
    flex-direction:column;
    width:100%;
}

.form-row input,
.form-row select{
    width:100%;
    box-sizing:border-box;
}

.form input[type="date"]{
    width:100%;
    min-width:0;
}

input[type="date"]{
    appearance:none;
    -webkit-appearance:none;
}

.phone-link{
    color:#2ea6ff;
    text-decoration:none;
    font-weight:600;
}
