:root {
    --bg: #fdf6ec;
    --surface: #fffaf2;
    --brand: #4a2c22;
    --accent: #a9744f;
    --muted: #8a7466;
    --line: #e6d8c8;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, system-ui, sans-serif;
    background: var(--bg);
    color: var(--brand);
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    background: var(--brand);
    color: #fff;
    flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 44px; height: 44px; border-radius: 12px; background: #fff2; }
.brand h1 { margin: 0; font-size: 22px; }
.brand span { font-size: 13px; opacity: .8; }

.actions { display: flex; gap: 8px; }

button {
    font: inherit;
    cursor: pointer;
    border-radius: 10px;
    padding: 9px 14px;
    border: 1px solid transparent;
}

.primary { background: var(--brand); color: #fff; }
.ghost { background: #fff3; color: inherit; border-color: #fff5; }
.panel .ghost, .modal .ghost { background: transparent; color: var(--brand); border-color: var(--line); }
.close { background: transparent; border: none; font-size: 18px; color: inherit; }

.sale-banner {
    background: #b3402f;
    color: #fff;
    text-align: center;
    padding: 8px;
    font-weight: bold;
}

main { max-width: 1100px; margin: 0 auto; padding: 16px; }

.filters input[type="search"] {
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--surface);
    font: inherit;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.chip {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 14px;
}
.chip.active { background: var(--brand); color: #fff; }

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

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.card img { width: 100%; height: 150px; object-fit: cover; background: #f0e4d6; }
.card .body { padding: 10px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card h3 { margin: 0; font-size: 15px; }
.card .unit { font-size: 12px; color: var(--muted); }
.price { display: flex; align-items: center; gap: 8px; }
.price .old { text-decoration: line-through; color: var(--muted); font-size: 13px; }
.price .now { color: var(--accent); font-weight: bold; }
.badge { background: #b3402f; color: #fff; border-radius: 8px; padding: 1px 6px; font-size: 12px; }
.out { color: #b3402f; font-size: 13px; }

.empty { text-align: center; color: var(--muted); padding: 30px; }
.hidden { display: none !important; }

footer { text-align: center; padding: 20px; color: var(--muted); }
footer a { color: var(--accent); }

.panel {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: min(420px, 100%);
    background: var(--surface);
    box-shadow: 0 0 30px #0003;
    display: flex;
    flex-direction: column;
    z-index: 20;
}

.panel.wide { width: min(720px, 100%); }
.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
}
.panel-head h2 { margin: 0; font-size: 18px; }
.panel-body { flex: 1; overflow: auto; padding: 14px 16px; }
.panel-foot { border-top: 1px solid var(--line); padding: 14px 16px; display: grid; gap: 8px; }

.cart-line { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.qty { display: flex; align-items: center; gap: 6px; }
.qty button { padding: 2px 10px; border: 1px solid var(--line); background: #fff; }

input, select, textarea {
    font: inherit;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #fff;
    width: 100%;
}

textarea { min-height: 70px; }

.modal {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    z-index: 30;
}
.modal-box {
    background: var(--surface);
    padding: 18px;
    border-radius: 18px;
    width: min(380px, 92vw);
    display: grid;
    gap: 10px;
}

.overlay { position: fixed; inset: 0; background: #0006; z-index: 10; }

.admin-block { border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin-bottom: 16px; }
.admin-block h3 { margin: 0 0 10px; font-size: 16px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.row input { flex: 1; min-width: 130px; }
.narrow { max-width: 110px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.form-grid textarea, .form-grid input[type="file"] { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 6px; }
.check input { width: auto; }
.status { color: var(--accent); font-size: 13px; }
.error { color: #b3402f; margin: 0; }

.admin-list { max-height: 260px; overflow: auto; display: grid; gap: 6px; }
.admin-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 14px;
}
.admin-row .tools { display: flex; gap: 6px; }
.admin-row button { padding: 4px 10px; }

@media (max-width: 520px) {
    .form-grid { grid-template-columns: 1fr; }
    .brand span { display: none; }
}
