:root {
    --cream: #fff8ec;
    --beige: #f3dfc1;
    --caramel: #c57a34;
    --coffee: #6f3f24;
    --brown: #3c2415;
    --soft-brown: #8e6245;
    --white: #fffdf8;
    --danger: #9d3328;
    --success: #2f714c;
    --shadow: 0 18px 45px rgba(60, 36, 21, 0.14);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--cream);
    color: var(--brown);
    font-family: "Inter", Arial, sans-serif;
    line-height: 1.5;
}

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

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px clamp(18px, 5vw, 64px);
    background: rgba(255, 248, 236, 0.94);
    border-bottom: 1px solid rgba(111, 63, 36, 0.15);
    backdrop-filter: blur(12px);
}

.brand {
    font-family: "Playfair Display", Georgia, serif;
    font-size: clamp(1.4rem, 4vw, 2rem);
    font-weight: 700;
}

.nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px 18px;
    font-size: 0.95rem;
    font-weight: 700;
}

.button-link,
.primary-button,
.secondary-button,
.danger-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border: 0;
    border-radius: 8px;
    padding: 10px 18px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.primary-button {
    background: var(--coffee);
    color: var(--white);
}

.secondary-button,
.button-link {
    background: var(--beige);
    color: var(--brown);
}

.danger-button {
    background: #f7d5cd;
    color: var(--danger);
}

.hero {
    min-height: calc(100vh - 78px);
    display: grid;
    align-items: center;
    padding: 48px clamp(18px, 6vw, 80px);
    background:
        linear-gradient(90deg, rgba(60, 36, 21, 0.86), rgba(60, 36, 21, 0.42)),
        url("https://images.unsplash.com/photo-1509365465985-25d11c17e812?auto=format&fit=crop&w=1800&q=80") center/cover;
    color: var(--white);
}

.hero-content {
    max-width: 680px;
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--caramel);
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.hero .eyebrow {
    color: #ffd8a4;
}

h1,
h2,
h3 {
    font-family: "Playfair Display", Georgia, serif;
    line-height: 1.05;
}

h1 {
    margin: 0 0 16px;
    font-size: clamp(3rem, 11vw, 7rem);
}

h2 {
    margin: 0 0 16px;
    font-size: clamp(1.6rem, 5vw, 2.5rem);
}

h3 {
    margin: 0 0 8px;
    font-size: 1.35rem;
}

.hero p {
    max-width: 560px;
    font-size: 1.15rem;
}

.hero-actions,
.cart-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.features,
.menu-page,
.cart-page,
.auth-page,
.confirmation-page {
    width: min(1180px, calc(100% - 36px));
    margin: 0 auto;
}

.features {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
    gap: 14px;
    padding: 28px 0 48px;
}

.features article,
.product-card,
.cart-item,
.checkout-panel,
.auth-card,
.confirmation-card,
.empty-state {
    background: var(--white);
    border: 1px solid rgba(111, 63, 36, 0.15);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.features article {
    display: grid;
    align-content: start;
    min-height: 174px;
    padding: 22px 18px 26px;
}

.features span {
    display: block;
    margin-bottom: 8px;
    color: var(--brown);
    font-size: 1.55rem;
    line-height: 1.1;
}

.features h2 {
    margin-bottom: 10px;
    color: var(--brown);
    font-size: clamp(2rem, 3vw, 2.35rem);
}

.features p {
    margin: 0;
    max-width: 30ch;
    color: var(--brown);
    font-size: 0.95rem;
    line-height: 1.4;
}

.page-title {
    padding: 42px 0 12px;
}

.page-title h1 {
    color: var(--brown);
    font-size: clamp(2.5rem, 8vw, 5rem);
}

.success,
.alert {
    border-radius: 8px;
    padding: 12px 14px;
    font-weight: 800;
}

.success {
    background: #daf1df;
    color: var(--success);
}

.alert {
    background: #f7d5cd;
    color: var(--danger);
}

.category-section {
    display: none;
    padding: 22px 0;
}

.category-section.active {
    display: block;
}

.category-picker {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin: 10px 0 22px;
}

.category-button {
    min-height: 86px;
    border: 1px solid rgba(111, 63, 36, 0.18);
    border-radius: 8px;
    padding: 18px;
    background: var(--white);
    color: var(--brown);
    box-shadow: var(--shadow);
    font: inherit;
    font-size: 1.12rem;
    font-weight: 900;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.category-button:hover,
.category-button.active {
    transform: translateY(-2px);
    border-color: var(--caramel);
    background: #fff1dc;
}

.product-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: start;
    gap: 18px;
}

.product-card {
    display: flex;
    flex: 0 1 calc((100% - 54px) / 4);
    flex-direction: column;
    justify-content: flex-start;
    align-self: flex-start;
    overflow: hidden;
    gap: 0;
    min-width: 0;
    padding: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 22px 50px rgba(60, 36, 21, 0.2);
}

.product-card p,
.cart-item p,
.confirmation-card p {
    color: var(--soft-brown);
}

.product-card strong,
.cart-item strong {
    color: var(--coffee);
    font-size: 1.15rem;
}

.product-select {
    display: block;
    min-height: 100%;
    width: 100%;
    border: 0;
    padding: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.product-content {
    display: grid;
    align-content: start;
    gap: 0;
    min-height: 100%;
    padding: 18px 20px 20px;
}

.product-name,
.product-description,
.product-price {
    display: block;
    width: 100%;
    margin-left: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.product-name {
    color: var(--brown);
    font-family: "Playfair Display", Georgia, serif;
    font-size: 1.35rem;
    font-weight: 700;
}

.product-description {
    min-height: 72px;
    margin: 8px 0 14px;
    color: var(--soft-brown);
    font-size: 0.95rem;
}

.product-price {
    margin: 0;
    color: var(--coffee);
    font-size: 1.15rem;
    font-weight: 900;
}

.product-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    margin-top: 16px;
    margin-left: 0;
    border-radius: 8px;
    padding: 8px 12px;
    background: var(--beige);
    color: var(--coffee);
    font-size: 0.9rem;
    font-weight: 900;
}

.product-card.is-sold-out {
    opacity: 0.62;
}

.product-card.is-sold-out .product-select {
    cursor: not-allowed;
}

.product-card.is-sold-out .product-cta {
    background: #8f8a82;
    color: #fff;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
}

.checkbox-row input[type="checkbox"] {
    width: 18px !important;
    min-width: 18px;
    max-width: 18px;
    min-height: 18px !important;
    height: 18px !important;
    flex: 0 0 18px;
    margin: 0;
    padding: 0;
}

.checkbox-row span:first-of-type {
    flex: 1;
}

.checkbox-row.is-disabled {
    color: #8f8a82;
}

.checkbox-row.is-disabled input {
    cursor: not-allowed;
}

.sold-out-badge {
    margin-left: auto;
    border-radius: 999px;
    padding: 3px 8px;
    background: #8f8a82;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 900;
}

.product-detail-page {
    width: min(1240px, calc(100% - 36px));
    margin: 0 auto;
    padding: 30px 0 56px;
}

.detail-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.back-link {
    display: inline-flex;
    color: var(--coffee);
    font-weight: 900;
}

.product-detail-layout {
    display: grid;
    grid-template-columns: minmax(260px, 0.9fr) minmax(360px, 1.15fr) minmax(280px, 0.85fr);
    gap: 18px;
    align-items: start;
}

.product-detail-info,
.extras-side-panel,
.order-summary-panel {
    background: var(--white);
    border: 1px solid rgba(111, 63, 36, 0.15);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.product-detail-info {
    display: grid;
    gap: 18px;
    padding: 24px;
}

.product-detail-info h1 {
    margin-bottom: 0;
    color: var(--brown);
    font-size: clamp(2.5rem, 5vw, 4rem);
}

.product-detail-description {
    margin: 0;
    color: var(--soft-brown);
    font-size: 1rem;
}

.product-detail-price {
    color: var(--coffee);
    font-size: 1.7rem;
}

.product-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid rgba(111, 63, 36, 0.12);
    padding-top: 16px;
}

.product-meta span,
.summary-label {
    color: var(--soft-brown);
    font-size: 0.9rem;
    font-weight: 800;
}

.product-note {
    margin: 0;
    border-radius: 8px;
    padding: 12px;
    background: #fff4df;
    color: var(--coffee);
    font-size: 0.92rem;
    font-weight: 700;
}

.extras-side-panel {
    padding: 20px;
}

.extras-side-panel h2,
.order-summary-panel h2 {
    margin-bottom: 6px;
    font-size: clamp(1.7rem, 3vw, 2.15rem);
}

.extras-side-panel > p,
.order-summary-panel > p {
    margin: 0 0 18px;
    color: var(--soft-brown);
}

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

.extra-choice {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    margin: 0;
    border: 1px solid rgba(111, 63, 36, 0.12);
    border-radius: 8px;
    padding: 10px 12px;
    background: #fffaf1;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.extra-choice:hover {
    border-color: rgba(197, 122, 52, 0.4);
    background: #fff3e2;
    transform: translateY(-1px);
}

.extra-choice strong {
    margin-left: auto;
    color: var(--coffee);
    font-size: 0.9rem;
}

.order-summary-panel {
    display: grid;
    gap: 16px;
    padding: 20px;
}

.summary-line,
.summary-total,
#selectedExtrasList li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.summary-line {
    border-bottom: 1px solid rgba(111, 63, 36, 0.12);
    padding-bottom: 14px;
}

.summary-extras {
    display: grid;
    gap: 10px;
}

#selectedExtrasList {
    display: grid;
    gap: 8px;
    min-height: 34px;
    margin: 0;
    padding: 0;
    list-style: none;
    color: var(--soft-brown);
}

#selectedExtrasList li {
    border-radius: 8px;
    padding: 8px 10px;
    background: #fffaf1;
    font-size: 0.92rem;
}

#selectedExtrasList strong {
    color: var(--coffee);
}

.summary-total {
    border-top: 1px solid rgba(111, 63, 36, 0.12);
    padding-top: 16px;
    color: var(--brown);
    font-size: 1.15rem;
    font-weight: 900;
}

.summary-total strong {
    color: var(--coffee);
    font-size: 1.75rem;
}

.detail-actions {
    display: grid;
    gap: 10px;
    margin-top: 4px;
}

.detail-actions .danger-button {
    width: 100%;
}

.cart-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    padding-bottom: 56px;
}

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

.cart-item {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 20px;
}

.checkout-panel {
    align-self: start;
    padding: 22px;
}

.total {
    margin: 0 0 18px;
    color: var(--coffee);
    font-size: 2rem;
    font-weight: 900;
}

.form {
    display: grid;
    gap: 16px;
}

.form label {
    display: grid;
    gap: 7px;
    color: var(--coffee);
    font-weight: 900;
}

input,
select,
textarea {
    width: 100%;
    min-height: 46px;
    border: 1px solid rgba(111, 63, 36, 0.25);
    border-radius: 8px;
    padding: 10px 12px;
    background: var(--white);
    color: var(--brown);
    font: inherit;
    resize: vertical;
}

.admin-body {
    background: #211812;
    color: #f8efe2;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px clamp(18px, 5vw, 64px);
    background: #17110d;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-page {
    width: min(1180px, calc(100% - 36px));
    margin: 0 auto;
    padding: 36px 0 56px;
}

.admin-title h1 {
    color: #f8efe2;
    font-size: clamp(2.4rem, 7vw, 4.8rem);
}

.admin-dashboard-page {
    display: grid;
    min-height: calc(100vh - 74px);
    align-content: center;
}

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
}

.dashboard-card {
    display: grid;
    min-height: 260px;
    align-content: space-between;
    gap: 18px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 28px;
    background:
        linear-gradient(145deg, rgba(197, 122, 52, 0.16), rgba(47, 36, 28, 0.96)),
        #2f241c;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.26);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 216, 164, 0.36);
    box-shadow: 0 30px 72px rgba(0, 0, 0, 0.34);
}

.dashboard-card span {
    color: var(--caramel);
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
}

.dashboard-card h2 {
    margin-bottom: 0;
    color: #fff8ec;
    font-size: clamp(2.2rem, 4vw, 3.4rem);
}

.dashboard-card p {
    margin: 0;
    color: #d8c4aa;
}

.dashboard-card strong {
    width: fit-content;
    border-radius: 999px;
    padding: 7px 12px;
    background: rgba(255, 248, 236, 0.1);
    color: #ffe0b8;
}

.admin-section-layout {
    display: grid;
    grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.admin-list-panel {
    min-width: 0;
}

.admin-grid {
    display: grid;
    grid-template-columns: minmax(260px, 0.8fr) minmax(340px, 1.1fr) minmax(340px, 1fr);
    gap: 20px;
}

.admin-panel,
.admin-login {
    background: #2f241c;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 22px;
    box-shadow: 0 22px 50px rgba(0, 0, 0, 0.22);
}

.admin-panel h2,
.admin-login h1 {
    color: #fff8ec;
}

.extras-admin-list,
.products-admin-list,
.orders-list {
    display: grid;
    gap: 12px;
}

.orders-list-wide {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.extra-admin-row,
.product-admin-card,
.admin-order {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 14px;
    min-width: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 14px;
    background: #3a2c22;
}

.extra-admin-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.extra-admin-row div {
    display: grid;
    gap: 3px;
}

.extra-admin-row span,
.product-status-form span,
.admin-order span,
.admin-order p {
    color: #d8c4aa;
}

.product-status-form .product-admin-status {
    width: fit-content;
    border-radius: 999px;
    padding: 3px 8px;
    background: rgba(197, 122, 52, 0.24);
    color: #ffe0b8;
    font-size: 0.78rem;
    font-weight: 900;
}

.product-admin-card.is-sold-out .product-admin-status {
    background: var(--danger);
    color: #fff;
}

.add-product-form,
.product-edit-form {
    display: grid;
    gap: 12px;
}

.add-product-form {
    margin-bottom: 18px;
}

.product-admin-card {
    display: grid;
    gap: 14px;
}

.product-admin-card.is-sold-out {
    border-color: rgba(157, 51, 40, 0.7);
    background: #3b1f1d;
}

.product-status-form {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.product-status-form div {
    display: grid;
    gap: 4px;
}

.product-edit-form {
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-inline-actions {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
}

.switch {
    position: relative;
    display: inline-flex;
    width: 54px;
    height: 30px;
}

.switch input {
    position: absolute;
    opacity: 0;
}

.switch span {
    width: 100%;
    border-radius: 999px;
    background: #74665a;
    cursor: pointer;
    transition: background 0.2s ease;
}

.switch span::before {
    content: "";
    position: absolute;
    top: 4px;
    left: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s ease;
}

.switch input:checked + span {
    background: var(--caramel);
}

.switch input:checked + span::before {
    transform: translateX(24px);
}

.add-extra-form {
    margin-top: 18px;
}

.admin-body input,
.admin-body select,
.admin-body textarea {
    background: #211812;
    color: #fff8ec;
    border-color: rgba(255, 255, 255, 0.16);
}

.order-head,
.order-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.order-head {
    flex: 0 0 auto;
}

.order-products {
    flex: 1 1 auto;
    min-width: 0;
}

.order-head div {
    display: grid;
    gap: 4px;
}

.order-status {
    border-radius: 999px;
    padding: 5px 10px;
    background: rgba(197, 122, 52, 0.24);
    color: #ffe0b8;
    font-size: 0.82rem;
    font-weight: 900;
}

.order-products p {
    overflow-wrap: anywhere;
}

.order-footer {
    flex: 0 0 auto;
    align-items: flex-end;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 12px;
}

.order-meta {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.order-meta strong {
    color: #fff8ec;
}

.order-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    max-width: 100%;
}

.admin-order.is-cancelled {
    border-color: rgba(157, 51, 40, 0.8);
    background: #3b1f1d;
    text-decoration: line-through;
}

.admin-order.is-cancelled .order-status {
    background: var(--danger);
    color: #fff;
}

.admin-order.is-completed {
    border-color: rgba(47, 113, 76, 0.75);
    background: #203329;
}

.admin-order.is-completed .order-status {
    background: var(--success);
    color: #fff;
}

.order-action-form {
    display: inline-flex;
    min-width: 0;
}

.order-action-form button {
    min-height: 38px;
    white-space: nowrap;
}

.auth-page,
.confirmation-page {
    display: grid;
    min-height: calc(100vh - 78px);
    place-items: center;
    padding: 36px 0;
}

.auth-card,
.confirmation-card,
.empty-state {
    width: min(520px, 100%);
    padding: clamp(24px, 6vw, 40px);
}

.confirmation-card {
    width: min(720px, 100%);
}

.auth-card h1,
.confirmation-card h1 {
    color: var(--brown);
    font-size: clamp(2.25rem, 8vw, 4.5rem);
}

.order-summary {
    display: grid;
    gap: 12px;
    margin: 22px 0;
}

.order-summary article {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(111, 63, 36, 0.15);
}

@media (min-width: 760px) {
    .cart-layout {
        grid-template-columns: minmax(0, 1fr) 330px;
    }

    .cart-item {
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
    }
}

@media (max-width: 1060px) {
    .product-card {
        flex-basis: calc((100% - 36px) / 3);
    }

    .product-detail-layout {
        grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
    }

    .order-summary-panel {
        grid-column: 1 / -1;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: start;
    }

    .order-summary-panel h2,
    .summary-line,
    .summary-extras {
        grid-column: 1;
    }

    .summary-total,
    .detail-actions {
        grid-column: 2;
        min-width: 260px;
    }
}

@media (max-width: 980px) {
    .dashboard-cards,
    .admin-section-layout {
        grid-template-columns: 1fr;
    }

    .dashboard-card {
        min-height: 210px;
    }
}

@media (max-width: 760px) {
    .product-card {
        flex-basis: calc((100% - 18px) / 2);
    }
}

@media (max-width: 620px) {
    .site-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .nav {
        justify-content: flex-start;
    }

    .hero {
        min-height: 76vh;
    }
}

@media (max-width: 520px) {
    .product-card {
        flex-basis: 100%;
    }
}

@media (max-width: 860px) {
    .admin-grid {
        grid-template-columns: 1fr;
    }

    .features {
        grid-template-columns: 1fr;
    }

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

    .order-summary-panel {
        grid-template-columns: 1fr;
    }

    .order-summary-panel h2,
    .summary-line,
    .summary-extras,
    .summary-total,
    .detail-actions {
        grid-column: auto;
        min-width: 0;
    }

    .order-head,
    .order-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .order-actions {
        width: 100%;
        justify-content: stretch;
    }

    .order-action-form,
    .order-action-form button {
        width: 100%;
    }
}

/* Tabla de usuarios y bitacora (U2) */
.tabla-scroll { overflow-x: auto; }
.tabla-admin { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.tabla-admin th, .tabla-admin td { padding: 10px 12px; border-bottom: 1px solid rgba(0, 0, 0, 0.08); text-align: left; vertical-align: middle; }
.tabla-admin th { font-weight: 600; white-space: nowrap; }
.tabla-admin select { padding: 6px 8px; border-radius: 8px; margin-right: 6px; min-width: 110px; }
.tabla-admin .order-action-form { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; }

/* Acceso al panel desde la tienda (solo admin/empleado) */
.nav .nav-panel { padding: 6px 12px; border-radius: 999px; background: #6b3a1f; color: #fff7ec; }
.nav .nav-panel:hover { background: #4f2a15; }
