:root {
    color-scheme: light;
    --ink: #182333;
    --muted: #6f7c8f;
    --line: #e6ebf2;
    --panel: rgba(255, 255, 255, 0.92);
    --soft: #f5f8fb;
    --brand: #ad7a3c;
    --brand-2: #6b4124;
    --accent: #0f9f82;
    --danger: #e44848;
    --shadow: 0 24px 80px rgba(23, 34, 52, 0.14);
    --radius: 22px;
    --coffee-image: url("assets/coffee-hero.jpg");
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 16% 8%, rgba(173, 122, 60, 0.14), transparent 28rem),
        linear-gradient(135deg, #fffaf3 0%, #f5f7fb 45%, #eef7f2 100%);
}

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

button {
    cursor: pointer;
}

[hidden] {
    display: none !important;
}

.menu-page {
    padding-bottom: 40px;
}

.menu-header {
    position: relative;
    display: grid;
    justify-items: center;
    gap: 10px;
    min-height: 430px;
    align-content: center;
    padding: 54px 20px 118px;
    text-align: center;
    color: #fff;
    background:
        linear-gradient(115deg, rgba(21, 12, 8, 0.88), rgba(61, 35, 17, 0.56) 48%, rgba(15, 11, 8, 0.74)),
        var(--coffee-image);
    background-size: cover;
    background-position: center 44%;
    overflow: hidden;
    isolation: isolate;
}

.menu-header::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background:
        linear-gradient(100deg, transparent 0%, rgba(255, 235, 190, 0.16) 48%, transparent 64%),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px 82px);
    transform: translateX(-18%);
    animation: heroShine 9s ease-in-out infinite alternate;
    pointer-events: none;
}

.menu-header::after {
    content: "";
    position: absolute;
    inset: auto -8% -76px;
    height: 150px;
    border-radius: 50% 50% 0 0;
    background: #f7f8fb;
}

.admin-btn-nav,
.back-btn {
    color: inherit;
    text-decoration: none;
}

.admin-btn-nav {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 2;
    display: inline-grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.26);
    border-radius: 50%;
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(14px);
}

.brand-mark {
    z-index: 1;
    display: inline-grid;
    min-width: 76px;
    min-height: 76px;
    padding: 14px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 24px;
    font-weight: 900;
    font-size: 22px;
    letter-spacing: 0;
    background: rgba(255, 255, 255, 0.17);
    box-shadow: 0 18px 54px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(16px);
}

.table-chip {
    z-index: 1;
    margin: 0;
    padding: 7px 14px;
    border-radius: 999px;
    color: #5b351d;
    font-weight: 800;
    background: #fff6df;
}

.menu-header h1 {
    z-index: 1;
    margin: 8px 0 0;
    font-size: clamp(34px, 7vw, 70px);
    line-height: 0.96;
    letter-spacing: 0;
}

.menu-header p {
    z-index: 1;
    max-width: 720px;
    margin: 0;
    color: rgba(255, 255, 255, 0.88);
    font-size: clamp(16px, 2.2vw, 22px);
}

.menu-shell {
    position: relative;
    z-index: 2;
    width: min(1120px, calc(100% - 28px));
    margin: -76px auto 0;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 34px 110px rgba(33, 21, 12, 0.18);
    backdrop-filter: blur(22px);
}

.menu-shell::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(255, 244, 224, 0.38));
}

.menu-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
}

.search-field {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 54px;
    padding: 0 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    color: var(--muted);
    background: #fff;
}

.search-field input {
    width: 100%;
    border: 0;
    outline: 0;
    color: var(--ink);
    background: transparent;
}

.menu-count {
    padding: 14px 18px;
    border-radius: 18px;
    color: var(--brand-2);
    font-weight: 900;
    background: #fff4e0;
}

.categories {
    display: flex;
    gap: 10px;
    padding: 16px 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.categories::-webkit-scrollbar {
    display: none;
}

.category-btn {
    flex: 0 0 auto;
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: #536174;
    font-weight: 850;
    background: #fff;
    box-shadow: 0 8px 20px rgba(24, 35, 51, 0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.category-btn.active,
.category-btn:hover {
    transform: translateY(-2px);
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, #c88a44, #6b3b1e);
    box-shadow: 0 16px 34px rgba(108, 65, 36, 0.26);
}

.menu-container {
    display: grid;
    gap: 14px;
}

.menu-card {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: stretch;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(255, 250, 242, 0.76));
    box-shadow: 0 12px 30px rgba(24, 35, 51, 0.06);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.menu-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(105deg, transparent 20%, rgba(255, 255, 255, 0.6) 48%, transparent 70%);
    transform: translateX(-120%);
    transition: transform 0.55s ease;
    pointer-events: none;
}

.menu-card:hover {
    transform: translateY(-4px);
    border-color: #ecd2aa;
    box-shadow: 0 22px 56px rgba(70, 44, 22, 0.12);
}

.menu-card:hover::before {
    transform: translateX(120%);
}

.product-info {
    min-width: 0;
}

.product-category {
    display: inline-flex;
    margin-bottom: 10px;
    padding: 6px 10px;
    border-radius: 999px;
    color: var(--brand-2);
    font-size: 12px;
    font-weight: 900;
    background: #fff2dc;
}

.product-name {
    margin: 0;
    font-size: clamp(20px, 3.6vw, 28px);
    line-height: 1.1;
    letter-spacing: 0;
}

.product-details {
    margin: 8px 0 0;
    color: var(--muted);
    line-height: 1.5;
}

.product-side {
    display: grid;
    justify-items: end;
    gap: 10px;
}

.product-price {
    align-self: start;
    padding: 10px 13px;
    border-radius: 16px;
    color: #fff;
    font-size: 18px;
    font-weight: 950;
    background: linear-gradient(135deg, #12b98d, #077462);
    box-shadow: 0 14px 26px rgba(15, 159, 130, 0.22);
}

.menu-card-img,
.no-img-placeholder {
    width: 116px;
    height: 92px;
    border-radius: 18px;
    object-fit: cover;
}

.no-img-placeholder {
    display: grid;
    place-items: center;
    color: #9e6730;
    font-size: 30px;
    background:
        radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.85), transparent 36%),
        linear-gradient(135deg, #fff3dc, #f2d3a4);
}

.empty-state {
    margin: 0;
    padding: 26px;
    border: 1px dashed #cfd8e5;
    border-radius: 20px;
    color: var(--muted);
    text-align: center;
    background: #fff;
}

.menu-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    justify-content: center;
    padding: 24px 4px 4px;
    color: var(--muted);
}

.menu-footer a {
    color: var(--brand-2);
    font-weight: 800;
    text-decoration: none;
}

.admin-page {
    padding: 26px 16px 60px;
}

.admin-container {
    width: min(1220px, 100%);
    margin: 0 auto;
}

.admin-topbar,
.form-actions,
.form-row,
.admin-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.admin-topbar {
    justify-content: space-between;
    margin-bottom: 16px;
}

.back-btn,
.btn-secondary,
.btn-submit,
.btn-login,
.btn-delete {
    border: 0;
    border-radius: 16px;
    font-weight: 900;
    text-decoration: none;
    transition: 0.18s ease;
}

.back-btn,
.btn-secondary {
    padding: 12px 16px;
    color: #41506a;
    background: #fff;
    border: 1px solid var(--line);
}

.btn-submit,
.btn-login {
    position: relative;
    overflow: hidden;
    padding: 13px 18px;
    color: #fff;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    box-shadow: 0 14px 32px rgba(108, 65, 36, 0.18);
}

.btn-submit.accent,
.btn-login {
    background: linear-gradient(135deg, #17b990, #0a7d6c);
}

.btn-submit::after,
.btn-login::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.28), transparent);
    transform: translateX(-120%);
    transition: transform 0.45s ease;
}

.btn-submit:hover,
.btn-login:hover,
.btn-secondary:hover,
.btn-delete:hover,
.back-btn:hover {
    transform: translateY(-2px);
}

.btn-submit:hover::after,
.btn-login:hover::after {
    transform: translateX(120%);
}

.btn-delete {
    padding: 11px 14px;
    color: #fff;
    background: var(--danger);
}

.admin-hero,
.admin-form,
.admin-section,
.qr-card,
.stat-card,
.security-warning {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: 0 16px 44px rgba(24, 35, 51, 0.08);
}

.admin-hero {
    padding: clamp(24px, 4vw, 44px);
    color: #fff;
    background:
        linear-gradient(115deg, rgba(33, 23, 16, 0.78), rgba(99, 61, 28, 0.44)),
        var(--coffee-image);
    background-size: cover;
    background-position: center;
    box-shadow: 0 24px 70px rgba(74, 44, 22, 0.18);
}

.admin-hero span {
    font-weight: 900;
    color: #ffe9be;
}

.admin-hero h1 {
    margin: 8px 0;
    font-size: clamp(34px, 6vw, 66px);
    line-height: 0.96;
    letter-spacing: 0;
}

.admin-hero p {
    max-width: 640px;
    margin: 0;
    color: rgba(255, 255, 255, 0.88);
    font-size: 18px;
}

.security-warning {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
    padding: 16px;
    color: #9a5a00;
    border-color: #ffd48a;
    background: #fff8e8;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin: 16px 0;
}

.stat-card {
    padding: 18px;
}

.stat-card span,
.qr-card span,
.helper-text,
.admin-list-item small {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.stat-card strong {
    display: block;
    margin-top: 8px;
    font-size: 30px;
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 16px;
}

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

.account-form {
    border-color: #cbeee5;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(232, 255, 247, 0.72));
}

.qr-grid {
    grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
}

.qr-card,
.admin-form,
.admin-section {
    padding: 22px;
}

.qr-card {
    display: grid;
    justify-items: center;
    text-align: center;
}

.qr-card-head {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
}

.qr-card-head h2,
.admin-form h2,
.admin-section h2 {
    margin: 6px 0 0;
    font-size: 22px;
}

#qr-image {
    width: min(280px, 100%);
    margin: 20px 0 14px;
    border: 12px solid #fff;
    border-radius: 22px;
    box-shadow: 0 14px 36px rgba(24, 35, 51, 0.12);
}

#qr-label {
    margin: 0;
    font-weight: 950;
}

#qr-url-text {
    max-width: 100%;
    color: var(--muted);
    word-break: break-all;
}

.form-group {
    display: grid;
    gap: 7px;
    margin-top: 14px;
}

.form-row {
    align-items: end;
}

.form-row > * {
    flex: 1 1 0;
}

label {
    color: #4b596d;
    font-size: 14px;
    font-weight: 900;
}

input,
textarea,
select {
    width: 100%;
    min-height: 48px;
    border: 1px solid #d9e1ec;
    border-radius: 14px;
    padding: 12px 14px;
    color: var(--ink);
    background: #fff;
    outline: 0;
}

textarea {
    resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(173, 122, 60, 0.13);
}

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

.check-row input {
    width: auto;
    min-height: 0;
}

.admin-list {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

.admin-list-item {
    display: flex;
    gap: 14px;
    align-items: center;
    justify-content: space-between;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
}

.admin-inline-copy,
.admin-product-summary {
    display: flex;
    gap: 12px;
    align-items: center;
    min-width: 0;
}

.admin-inline-copy {
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
}

.admin-product-summary > div {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.admin-product-summary span {
    color: var(--muted);
}

.admin-thumb {
    flex: 0 0 auto;
    width: 58px;
    height: 58px;
    border-radius: 16px;
    object-fit: cover;
}

.admin-thumb-empty {
    display: grid;
    place-items: center;
    color: #b78b50;
    background: #fff4e0;
}

.notice {
    position: fixed;
    top: 18px;
    left: 50%;
    z-index: 1000;
    min-width: min(420px, calc(100% - 28px));
    transform: translateX(-50%);
    padding: 14px 18px;
    border-radius: 16px;
    color: #07634f;
    font-weight: 900;
    text-align: center;
    background: #e8fff7;
    border: 1px solid #a9f0d7;
    box-shadow: var(--shadow);
}

.notice.error {
    color: #9c2626;
    background: #fff0f0;
    border-color: #ffc9c9;
}

.login-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    display: grid;
    place-items: center;
    padding: 18px;
    background:
        linear-gradient(rgba(18, 24, 34, 0.68), rgba(18, 24, 34, 0.78)),
        var(--coffee-image);
    background-size: cover;
    background-position: center;
    backdrop-filter: blur(16px);
}

.login-box {
    width: min(420px, 100%);
    padding: 30px;
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(18px);
}

@keyframes heroShine {
    from {
        transform: translateX(-24%);
        opacity: 0.72;
    }
    to {
        transform: translateX(18%);
        opacity: 1;
    }
}

.login-icon {
    display: grid;
    width: 58px;
    height: 58px;
    place-items: center;
    border-radius: 18px;
    color: #fff;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
}

.login-box h1 {
    margin: 18px 0;
}

.login-box form {
    display: grid;
    gap: 12px;
}

@media (max-width: 820px) {
    .menu-shell {
        width: min(100% - 18px, 720px);
        padding: 12px;
        border-radius: 24px;
    }

    .menu-toolbar,
    .menu-card,
    .admin-grid,
    .qr-grid,
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .menu-count {
        text-align: center;
    }

    .product-side {
        grid-template-columns: auto 1fr;
        align-items: center;
        justify-items: stretch;
    }

    .menu-card-img,
    .no-img-placeholder {
        justify-self: end;
        width: 96px;
        height: 78px;
    }

    .form-row,
    .admin-list-item,
    .admin-product-summary,
    .admin-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .admin-topbar {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-actions {
        width: 100%;
    }

    .admin-actions button {
        width: 100%;
    }
}

@media print {
    body {
        background: #fff;
    }

    body * {
        visibility: hidden;
    }

    #qr-print-area,
    #qr-print-area * {
        visibility: visible;
    }

    #qr-print-area {
        position: absolute;
        inset: 20px auto auto 20px;
        width: 360px;
        box-shadow: none;
    }
}
