:root {
    --font-sans: "Segoe UI", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
    --font-display: "Trebuchet MS", "Segoe UI", "Arial Narrow", Arial, sans-serif;
    --bg: #eef3ef;
    --surface: #ffffff;
    --surface-soft: #f7faf8;
    --text: #11242d;
    --muted: #607b87;
    --line: #d8e4df;
    --primary: #0f5b6f;
    --primary-hover: #0a4757;
    --accent: #ca7b2f;
    --good: #2f7c56;
    --danger: #a63e3e;
    --danger-hover: #8f3131;
    --radius-lg: 22px;
    --radius-md: 14px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font-family: var(--font-sans);
    background:
        radial-gradient(900px 450px at -5% -10%, #d1e8d8 0%, transparent 58%),
        radial-gradient(900px 500px at 110% 0%, #d2e8f1 0%, transparent 54%),
        linear-gradient(160deg, #eef3ef 0%, #edf2f8 100%);
}

.blur-circle {
    position: fixed;
    border-radius: 999px;
    filter: blur(55px);
    z-index: -1;
    opacity: 0.5;
}

.blur-a {
    width: 240px;
    height: 240px;
    left: -55px;
    bottom: 15%;
    background: #ffd18c;
}

.blur-b {
    width: 300px;
    height: 300px;
    right: -80px;
    top: 18%;
    background: #95becf;
}

.layout {
    max-width: 1180px;
    margin: 0 auto;
    padding: 22px 16px 36px;
}

.topbar {
    display: block;
    background: linear-gradient(145deg, #ffffff 0%, #f4f8f7 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    box-shadow: 0 14px 30px rgba(17, 36, 45, 0.06);
}

.topbar h1 {
    font-family: var(--font-display);
    margin: 0;
    font-size: clamp(24px, 4vw, 34px);
    line-height: 1.1;
}

.topbar p {
    margin: 8px 0 0;
    font-size: 14px;
    color: var(--muted);
    line-height: 1.4;
}

.tabs {
    margin-top: 16px;
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.tab {
    border: 1px solid #c5d4da;
    background: #eaf2f4;
    color: var(--text);
    border-radius: 999px;
    padding: 11px 18px;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
}

.tab.active {
    background: linear-gradient(135deg, #0f5b6f, #1d7484);
    color: #fff;
    border-color: #0f5b6f;
}

.tab-cart {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.tab-badge {
    display: inline-flex;
    min-width: 22px;
    height: 22px;
    border-radius: 999px;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    font-size: 11px;
    font-weight: 800;
    background: #d43838;
    color: #fff;
    box-shadow: 0 4px 10px rgba(212, 56, 56, 0.35);
}

.tab-badge.bump {
    animation: badge-bump 0.28s ease;
}

main {
    margin-top: 16px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.section-head {
    margin-bottom: 12px;
}

.section-head h2 {
    margin: 0;
    font-size: 24px;
}

.section-head p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.shop-head {
    margin-bottom: 12px;
}

.shop-toolbar {
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    gap: 8px;
    align-items: center;
}

.shop-back,
.shop-filter {
    margin-top: 0;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    padding: 0;
    font-size: 18px;
    line-height: 1;
}

.shop-back {
    background: linear-gradient(135deg, #1d5bd4, #2e73f5);
}

.shop-filter {
    color: #1f2d39;
    background: #ffffff;
    border: 1px solid #d6dee6;
}

.shop-filter:hover {
    background: #f3f6f9;
}

.shop-filter.active {
    color: #ffffff;
    background: linear-gradient(135deg, #1d5bd4, #2e73f5);
    border-color: #1d5bd4;
}

.shop-search-wrap {
    position: relative;
}

.shop-search-input {
    margin-top: 0;
    height: 44px;
    border: 0;
    border-radius: 12px;
    background: #eef1f5;
    color: #1f2d39;
    padding: 0 38px 0 14px;
}

.shop-search-input:focus {
    outline: 2px solid #cadeff;
}

.shop-search-clear {
    position: absolute;
    right: 8px;
    top: 7px;
    width: 30px;
    height: 30px;
    margin: 0;
    padding: 0;
    border-radius: 9px;
    background: transparent;
    color: #7d8a97;
    border: 0;
    font-size: 20px;
}

.shop-search-clear:hover {
    background: #e0e6ee;
    color: #516170;
}

.shop-caption {
    margin: 12px 0 0;
    font-size: 30px;
    line-height: 1.05;
    font-weight: 800;
    letter-spacing: -0.3px;
}

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

.card {
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #e6eaf0;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-2px);
    border-color: #d7e1ec;
    box-shadow: 0 10px 20px rgba(17, 36, 45, 0.08);
}

.card-media {
    position: relative;
    margin: 8px 8px 0;
    border-radius: 12px;
    background: #f0f2f5;
    overflow: hidden;
}

.card-fav {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    margin: 0;
    border-radius: 9px;
    border: 1px solid #dde4eb;
    background: #ffffffd9;
    color: #a9b3bf;
    padding: 0;
    font-size: 15px;
    line-height: 1;
}

.card-fav:hover {
    background: #f8fafd;
    color: #8f9cab;
}

.card img {
    width: 100%;
    height: 136px;
    object-fit: cover;
    display: block;
}

.card-body {
    padding: 8px 10px 10px;
}

.card-title {
    margin: 0;
    font-size: 15px;
    line-height: 1.2;
    min-height: 36px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-price-row {
    margin-top: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.price {
    color: #111f2c;
    font-weight: 800;
    font-size: 29px;
    letter-spacing: -0.4px;
    line-height: 1;
}

.price-old {
    color: #8e9ba8;
    text-decoration: line-through;
    font-size: 12px;
    margin-top: 4px;
}

.discount-pill {
    display: inline-block;
    background: #ffc83d;
    color: #6b4a00;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 13px;
    font-weight: 700;
}

.card-cta {
    margin-top: 8px;
    height: 36px;
    border-radius: 10px;
    background: #f4f6f8;
    color: #4f5e6d;
    border: 1px solid #e2e8ef;
    font-size: 14px;
    font-weight: 600;
}

.card-cta:hover {
    background: #ecf1f5;
}

.post-list,
.admin-grid,
.panel,
.mini-list,
.orders-grid {
    animation: rise 0.35s ease;
}

.post {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px;
    margin-bottom: 10px;
}

.post h4 {
    margin: 0 0 7px;
    font-size: 17px;
}

.post p {
    margin: 0 0 8px;
    line-height: 1.5;
}

.post small {
    color: var(--muted);
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 14px;
}

.panel {
    background: var(--surface);
    border-radius: 18px;
    border: 1px solid var(--line);
    padding: 14px;
}

.panel.wide {
    grid-column: 1 / -1;
}

.panel h3 {
    margin: 2px 0 10px;
    font-size: 18px;
}

.manage-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
}

.manage-columns h4 {
    margin: 4px 0 8px;
    font-size: 14px;
    color: #2f4f5b;
}

.manage-list {
    display: grid;
    gap: 8px;
}

.manage-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid #dce7e3;
    border-radius: 12px;
    background: var(--surface-soft);
    padding: 9px 10px;
}

.manage-meta {
    min-width: 0;
}

.manage-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0;
}

.manage-title {
    margin: 0;
    font-weight: 700;
    font-size: 14px;
    line-height: 1.3;
    color: #173843;
}

.manage-sub {
    margin: 3px 0 0;
    font-size: 12px;
    color: var(--muted);
}

.manage-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.tag {
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 700;
}

.tag.catalog {
    background: #e4f0f4;
    color: #2f5969;
}

.tag.fix {
    background: #fff0de;
    color: #9f611f;
}

.tag.off {
    background: #f2ecec;
    color: #754747;
}

.btn-inline {
    width: auto;
    min-width: 112px;
    margin-top: 0;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 12px;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #b24a4a);
}

.btn-danger:hover {
    background: linear-gradient(135deg, var(--danger-hover), #9e3838);
}

.btn-edit {
    background: #e7f1fb;
    color: #1f4b67;
    border: 1px solid #c7dced;
}

.btn-edit:hover {
    background: #d9e9f8;
}

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

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

.cart-item {
    border: 1px solid #dce7e3;
    border-radius: 14px;
    background: var(--surface);
    padding: 10px;
    display: grid;
    grid-template-columns: 78px 1fr auto;
    gap: 10px;
    align-items: center;
}

.cart-item-media {
    width: 78px;
    height: 78px;
    border-radius: 12px;
    overflow: hidden;
    background: #f3f6f8;
}

.cart-item-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cart-item-title {
    margin: 0;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.25;
}

.cart-item-sub {
    margin: 5px 0 0;
    font-size: 12px;
    color: var(--muted);
}

.cart-item-total {
    margin: 6px 0 0;
    font-size: 14px;
    font-weight: 800;
    color: #173843;
}

.cart-item-actions {
    display: grid;
    gap: 8px;
    min-width: 110px;
}

.cart-item-remove {
    background: #f7e6e6;
    color: #8d3434;
}

.cart-item-remove:hover {
    background: #efd8d8;
}

.order-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px;
    box-shadow: 0 10px 24px rgba(17, 36, 45, 0.05);
}

.order-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.order-title {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
}

.order-time {
    font-size: 12px;
    color: var(--muted);
}

.order-status {
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 800;
    background: #e6f2f7;
    color: #2a5b6e;
}

.order-status.paid {
    background: #d9f2e5;
    color: #1f6f4d;
}

.order-status.completed {
    background: #e9f3d8;
    color: #5a6f1f;
}

.order-status.cancelled {
    background: #f5e3e3;
    color: #8e3737;
}

.order-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
}

.order-cell {
    border: 1px dashed #d9e3e0;
    border-radius: 10px;
    background: #f9fcfa;
    padding: 8px;
}

.order-label {
    margin: 0;
    font-size: 11px;
    color: #6b818b;
}

.order-value {
    margin: 3px 0 0;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
}

.order-items-lines {
    margin-top: 8px;
    display: grid;
    gap: 5px;
}

.order-item-line {
    font-size: 12px;
    color: #2b4f5a;
}

.order-actions {
    margin-top: 10px;
    border-top: 1px dashed #dce6e2;
    padding-top: 10px;
}

.accept-form {
    margin-top: 8px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
}

.accept-form input {
    margin-top: 0;
}

.accept-note {
    margin-top: 8px;
    font-size: 12px;
    color: #2f7c56;
    font-weight: 700;
}

label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--muted);
}

input,
textarea,
select,
button {
    width: 100%;
    margin-top: 4px;
    border: 1px solid #cbd7dc;
    border-radius: 12px;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 14px;
    background: #fff;
}

textarea {
    min-height: 90px;
    resize: vertical;
}

button {
    background: linear-gradient(135deg, #0f5b6f, #1b6f80);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    border: none;
}

button:hover {
    background: linear-gradient(135deg, #0d5062, #166170);
}

.row-form {
    display: flex;
    gap: 8px;
}

.row-form input {
    flex: 1;
}

.row-form button {
    width: auto;
    min-width: 120px;
}

.mini-list {
    max-height: 280px;
    overflow: auto;
    border-top: 1px dashed #d2dfe3;
    padding-top: 10px;
    font-size: 13px;
}

.list-row {
    padding: 9px 0;
    border-bottom: 1px solid #eef2f4;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(7, 20, 27, 0.62);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 14px;
    z-index: 20;
}

.modal-card {
    background: #fff;
    border-radius: 16px;
    padding: 16px;
    width: min(540px, 100%);
    max-height: 88vh;
    overflow: auto;
    position: relative;
}

.modal-card img {
    width: 100%;
    max-height: 340px;
    border-radius: 12px;
    object-fit: contain;
    background: #f4f6fa;
}

.close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: #ffffffd8;
    color: #25363d;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.price-line {
    margin: 10px 0 14px;
}

.stock-line {
    margin: 0 0 14px;
    color: #2a4a55;
}

.old-price-line {
    margin: 10px 0 4px;
    color: #8a9490;
    text-decoration: line-through;
}

.modal-cart {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 8px 0 10px;
}

.status {
    margin-top: 10px;
    font-weight: 700;
    font-size: 13px;
}

.panel-hint {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.choice-group {
    margin: 10px 0;
    padding: 10px;
    border: 1px solid #d8e4df;
    border-radius: 12px;
    background: #f8fbfa;
}

.choice-group legend {
    padding: 0 5px;
    color: #34545f;
    font-weight: 700;
    font-size: 13px;
}

.choice-option {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 8px;
    color: #2a4650;
}

.choice-option:last-child {
    margin-bottom: 0;
}

.choice-option input[type="radio"] {
    width: auto;
    margin: 0;
}

.order-summary {
    margin-top: 10px;
    border: 1px dashed #cfe0d8;
    border-radius: 12px;
    background: #f8fcfa;
    padding: 10px;
}

.summary-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    font-size: 13px;
    color: #2f4f5a;
}

.summary-row + .summary-row {
    margin-top: 7px;
}

.summary-row.total {
    padding-top: 7px;
    border-top: 1px solid #d9e6e1;
    font-size: 15px;
    font-weight: 800;
}

.pay-note {
    margin: 8px 0 10px;
    line-height: 1.45;
}

.payment-details {
    margin: 0;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid #d8e3ef;
    background: #f6f9ff;
    white-space: pre-wrap;
    font-family: inherit;
}

.btn-secondary {
    margin-top: 8px;
    background: #e9f0f2;
    color: #2c4a56;
}

.btn-secondary:hover {
    background: #dbe7ec;
}

.payment-step {
    margin-top: 10px;
    border: 1px dashed #d8e3ef;
    border-radius: 12px;
    padding: 10px;
    background: #fbfdff;
}

.dialog-overlay {
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(8, 18, 25, 0.62);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.dialog-card {
    width: min(520px, 100%);
    background: #ffffff;
    border: 1px solid #d6e2de;
    border-radius: 16px;
    box-shadow: 0 18px 42px rgba(17, 36, 45, 0.18);
    padding: 14px;
    position: relative;
}

.dialog-card h3 {
    margin: 0;
    font-size: 19px;
    font-weight: 800;
}

.dialog-card p {
    margin: 8px 0 0;
    color: #29424d;
    line-height: 1.45;
    white-space: pre-wrap;
}

#dialogInput {
    margin-top: 10px;
}

.product-edit-card {
    width: min(760px, 100%);
    max-height: 90vh;
    overflow-y: auto;
}

.product-image-preview {
    margin-top: 6px;
    width: min(220px, 100%);
    aspect-ratio: 4 / 3;
    border-radius: 14px;
    overflow: hidden;
    background: #f2f6f8;
    border: 1px solid #d8e3e8;
}

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

.dialog-actions {
    margin-top: 12px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.empty {
    background: var(--surface);
    padding: 14px;
    border-radius: 14px;
    border: 1px dashed #d2dee3;
    color: var(--muted);
}

.hidden {
    display: none !important;
}

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

@keyframes badge-bump {
    0% {
        transform: scale(1);
    }
    45% {
        transform: scale(1.22);
    }
    100% {
        transform: scale(1);
    }
}

@media (max-width: 900px) {
    .topbar {
        padding: 14px 14px;
    }
}

@media (max-width: 560px) {
    .layout {
        padding: 14px 12px 24px;
    }

    .section-head h2 {
        font-size: 22px;
    }

    .row-form {
        flex-direction: column;
    }

    .manage-item {
        flex-direction: column;
        align-items: stretch;
    }

    .manage-actions {
        width: 100%;
    }

    .btn-inline {
        width: 100%;
    }

    .shop-caption {
        font-size: 32px;
    }

    .modal-cart {
        grid-template-columns: 1fr;
    }

    .cart-item {
        grid-template-columns: 68px 1fr;
    }

    .cart-item-actions {
        grid-column: 1 / -1;
        grid-template-columns: 1fr;
    }

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

    .dialog-actions {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 780px) {
    .catalog-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 12px;
    }
}

@media (min-width: 1060px) {
    .catalog-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}
