:root {
    --bg: #f7f3ee;
    --surface: #ffffff;
    --text: #241f19;
    --muted: #77705f;
    --line: #e6ddd0;
    --brand: #9d4e2f;
    --brand-dark: #7c3b21;
    --green: #2f5d50;
    --danger: #a33224;
    --soft: #f3e8dc;
    --shadow: 0 10px 30px rgba(35, 25, 15, 0.08);
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: "Segoe UI", Arial, Helvetica, sans-serif;
    background:
        radial-gradient(circle at top right, rgba(157, 78, 47, 0.08), transparent 28%),
        var(--bg);
    color: var(--text);
    line-height: 1.45;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: var(--brand);
    text-decoration: none;
}

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

.container {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}

.topbar-inner {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.brand {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
}

.brand span {
    color: var(--brand);
}

.nav {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.nav a {
    color: var(--text);
    font-weight: 600;
}

.nav a:hover {
    color: var(--brand);
}

.user-chip {
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--soft);
    color: var(--brand-dark);
    font-weight: 700;
    font-size: 0.92rem;
}

main {
    padding: 28px 0 70px;
    min-height: calc(100vh - 170px);
}

.footer {
    border-top: 1px solid var(--line);
    padding: 18px 0;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.72);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 11px 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

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

.btn-primary {
    background: var(--brand);
    color: #fff;
}

.btn-primary:hover {
    background: var(--brand-dark);
}

.btn-ghost {
    background: #fff;
    border-color: var(--line);
    color: var(--text);
}

.btn-ghost:hover {
    border-color: var(--brand);
    color: var(--brand);
}

.btn-danger {
    background: #fff;
    border-color: rgba(163, 50, 36, 0.35);
    color: var(--danger);
}

.btn-danger:hover {
    background: rgba(163, 50, 36, 0.08);
}

.btn-large {
    padding: 14px 22px;
    font-size: 1rem;
}

.loading,
.empty {
    padding: 42px 0;
    color: var(--muted);
    text-align: center;
}

.banner {
    position: relative;
    overflow: hidden;
    min-height: 340px;
    border-radius: 24px;
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: var(--shadow);
    display: grid;
    align-items: end;
}

.banner img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.banner-fallback {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(120deg, rgba(36, 31, 25, 0.12), rgba(36, 31, 25, 0.35)),
        repeating-linear-gradient(
            45deg,
            #d8b79a 0px,
            #d8b79a 18px,
            #cfa882 18px,
            #cfa882 36px,
            #c69a72 36px,
            #c69a72 54px
        );
}

.banner-content {
    position: relative;
    z-index: 2;
    padding: 34px;
    color: #fff;
    background: linear-gradient(180deg, transparent, rgba(20, 14, 10, 0.72));
    width: 100%;
}

.banner-content h1 {
    margin: 0 0 10px;
    font-size: clamp(2rem, 4vw, 4rem);
    line-height: 1.02;
    letter-spacing: -0.04em;
    max-width: 18ch;
}

.banner-content p {
    margin: 0 0 18px;
    max-width: 58ch;
    color: rgba(255, 255, 255, 0.88);
}

.toolbar {
    margin: 26px 0 18px;
    display: grid;
    gap: 14px;
}

.toolbar input[type="search"] {
    width: 100%;
    max-width: 420px;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 14px;
    padding: 13px 15px;
    outline: none;
}

.toolbar input[type="search"]:focus {
    border-color: var(--brand);
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.chip {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    border-radius: 999px;
    padding: 9px 14px;
    cursor: pointer;
    font-weight: 700;
}

.chip.active {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 18px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease;
}

.card:hover {
    transform: translateY(-3px);
    border-color: rgba(157, 78, 47, 0.35);
}

.thumb,
.thumb-sm,
.gallery {
    background: var(--soft);
}

.thumb {
    height: 220px;
}

.thumb img,
.thumb-sm img,
.gallery img,
.banner-preview img,
.cart-item .thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.card-body {
    padding: 16px;
    display: grid;
    gap: 12px;
}

.card-body h3 {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.25;
    min-height: 2.6em;
}

.price {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--green);
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--soft);
    color: var(--brand-dark);
    font-size: 0.8rem;
    font-weight: 800;
}

.badge-lista_salva {
    background: #edf3ef;
    color: var(--green);
}

.badge-aguardando_retorno {
    background: #fdf0e7;
    color: var(--brand);
}

.badge-concluido {
    background: #eef1f8;
    color: #314a7a;
}

.auth-card,
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: var(--shadow);
    padding: 24px;
}

.auth-card {
    max-width: 520px;
    margin: 28px auto;
}

.auth-card h2,
.panel h2 {
    margin-top: 0;
}

label {
    display: grid;
    gap: 7px;
    font-weight: 700;
    margin-bottom: 14px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="tel"],
input[type="file"],
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 13px;
    background: #fff;
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(157, 78, 47, 0.12);
}

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

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0 16px;
}

.check {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}

.check input {
    width: auto;
}

.contact-box {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.cart-item {
    display: grid;
    grid-template-columns: 84px 1fr 110px 120px 44px;
    gap: 14px;
    align-items: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 12px;
    margin-bottom: 12px;
}

.cart-item .thumb,
.thumb-sm {
    width: 84px;
    height: 84px;
    border-radius: 14px;
    overflow: hidden;
}

.cart-item .info {
    display: grid;
    gap: 6px;
}

.cart-item .qty {
    max-width: 100%;
}

.icon-btn {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--danger);
    width: 40px;
    height: 40px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.2rem;
}

.cart-footer {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.total {
    font-size: 1.2rem;
}

.actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.order-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 18px;
    margin-bottom: 14px;
    display: grid;
    gap: 10px;
}

.order-card header {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 18px 0;
}

.tab {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    padding: 11px 15px;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 800;
}

.tab.active {
    background: var(--text);
    border-color: var(--text);
    color: #fff;
}

.tab-content {
    min-height: 280px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.table-wrap {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
}

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

th,
td {
    text-align: left;
    padding: 13px 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

th {
    background: #fbf8f4;
    color: var(--muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

tr:last-child td {
    border-bottom: 0;
}

.thumb-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 12px 0;
}

.thumb-row img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--line);
}

.banner-preview {
    width: min(560px, 100%);
    height: 220px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--line);
    margin: 14px 0;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(20, 14, 10, 0.52);
    display: grid;
    place-items: center;
    padding: 20px;
}

.modal[hidden] {
    display: none;
}

.modal-box {
    position: relative;
    width: min(920px, 100%);
    max-height: calc(100vh - 40px);
    overflow: auto;
    background: #fff;
    border-radius: 22px;
    padding: 26px;
    box-shadow: var(--shadow);
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.4rem;
    line-height: 1;
}

.product-detail {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 22px;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    min-height: 320px;
}

.gallery img {
    height: 160px;
    border-radius: 14px;
    border: 1px solid var(--line);
}

.info h2 {
    margin: 0 0 10px;
}

.meta {
    color: var(--muted);
    margin: 8px 0 14px;
}

.qty-row {
    display: grid;
    gap: 8px;
    max-width: 160px;
    margin: 16px 0;
}

.toast {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 200;
    display: grid;
    gap: 10px;
}

.toast-item {
    background: #25201a;
    color: #fff;
    padding: 13px 16px;
    border-radius: 14px;
    box-shadow: var(--shadow);
    max-width: 320px;
    animation: toastIn 0.2s ease;
}

.toast-item.error {
    background: var(--danger);
}

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

@media (max-width: 900px) {
    .product-detail {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .topbar-inner {
        padding: 12px 0;
    }

    .nav {
        width: 100%;
        justify-content: flex-start;
    }

    .banner {
        min-height: 280px;
    }

    .banner-content {
        padding: 22px;
    }

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

    .cart-item .qty,
    .cart-item .subtotal,
    .cart-item .icon-btn {
        justify-self: start;
    }

    .cart-footer {
        align-items: flex-start;
    }
}