@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&family=Fraunces:wght@600;700&display=swap');

:root {
    --bg-1: #f8f4e4;
    --bg-2: #e6edd0;
    --bg-3: #f6e9d7;
    --accent: #d39c6a;
    --accent-strong: #b97742;
    --accent-soft: #f3dfc7;
    --olive: #cfd7b0;
    --ink: #2a2a2a;
    --muted: #6b6b6b;
    --card: #fffdf8;
    --card-border: rgba(188, 160, 125, 0.22);
    --shadow: 0 18px 40px rgba(72, 54, 34, 0.12);
    --success: #2f9d64;
    --error: #b55246;
    --tabbar-height: 78px;
    --suffix-width: 72px;
    --topbar-height: 72px;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    color: var(--ink);
    font-family: 'DM Sans', sans-serif;
}

body.modal-open {
    position: fixed;
    overflow: hidden;
    width: 100%;
}

.bg {
    min-height: 100vh;
    background: linear-gradient(180deg, var(--bg-1), var(--bg-2));
    position: relative;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.bg::before,
.bg::after {
    content: '';
    position: absolute;
    z-index: 0;
    border-radius: 50%;
    opacity: 0.6;
    filter: blur(0.5px);
}

.bg::before {
    width: 420px;
    height: 420px;
    background: radial-gradient(circle, var(--bg-3), transparent 70%);
    top: -120px;
    right: -120px;
}

.bg::after {
    width: 520px;
    height: 520px;
    background: radial-gradient(circle, #d8e3b8, transparent 70%);
    bottom: -220px;
    left: -160px;
}

.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    transform: translateZ(0);
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--topbar-height);
    padding: 20px 40px;
    background: rgba(255, 253, 245, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #efe6d6;
}

.topbar-actions {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.cart-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 14px;
    background: #fff7ea;
    border: 1px solid #e6d8c6;
    color: #a46a36;
    text-decoration: none;
    box-shadow: 0 8px 16px rgba(165, 117, 66, 0.15);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cart-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 20px rgba(165, 117, 66, 0.2);
}

.cart-icon {
    width: 20px;
    height: 20px;
}

.cart-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    border-radius: 999px;
    background: #1d4fff;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

.brand {
    font-family: 'Fraunces', serif;
    font-weight: 700;
    font-size: 22px;
    letter-spacing: 0.3px;
}

.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: calc(8px + var(--topbar-height)) 32px calc(28px + var(--tabbar-height));
    position: relative;
    z-index: 1;
    flex: 1 0 auto;
}

.hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 12px 0 24px;
}

.eyebrow {
    color: var(--muted);
    font-weight: 700;
    letter-spacing: 0.2px;
}

h1 {
    margin: 8px 0 0;
    font-size: 28px;
    font-family: 'Fraunces', serif;
}

.section {
    margin-top: 30px;
}

.section-title {
    font-weight: 700;
    margin-bottom: 12px;
    font-size: 16px;
}

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

.card {
    background: var(--card);
    border: 1px solid var(--card-border);
    padding: 18px;
    border-radius: 18px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    animation: float-in 0.6s ease both;
}

.card:nth-child(2) { animation-delay: 0.05s; }
.card:nth-child(3) { animation-delay: 0.1s; }
.card:nth-child(4) { animation-delay: 0.15s; }

.card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 45px rgba(72, 54, 34, 0.18);
}

.card.highlight {
    background: linear-gradient(160deg, var(--accent), var(--accent-strong));
    color: #fff;
    border: none;
}

.card-icon {
    font-size: 24px;
    margin-bottom: 6px;
}

.card-value {
    font-size: 22px;
    font-weight: 700;
}

.card-label {
    font-size: 13px;
    color: var(--muted);
}

.card.highlight .card-label {
    color: #fef6ea;
}

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

.pill {
    border: none;
    padding: 14px 18px;
    border-radius: 14px;
    background: linear-gradient(120deg, var(--accent), var(--accent-strong));
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 10px 20px rgba(185, 119, 66, 0.25);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.pill:hover {
    transform: translateY(-2px);
}

.pill.light {
    background: linear-gradient(120deg, #d9e3b6, var(--olive));
    color: #3a4a2e;
    font-weight: 600;
}

.pill-icon {
    font-size: 14px;
    line-height: 1;
}

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

.panel {
    background: var(--card);
    border-radius: 18px;
    padding: 20px;
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow);
}

.order-builder {
    border: 2px solid #1d4fff;
    background: #fffdf8;
}

.panel-title {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 12px;
}

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

.panel-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.inline-form {
    margin: 0;
}

.order-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
}

.upload-block {
    margin-top: 14px;
    display: grid;
    gap: 10px;
}

.upload-title {
    font-weight: 700;
}

.upload-area {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 16px;
    align-items: center;
    border: 1px solid #e3d7c2;
    border-radius: 14px;
    padding: 14px;
    background: #fff;
}

.upload-btn {
    border: 2px dashed #d4a77a;
    background: #fff7ed;
    color: #b16a2f;
    font-weight: 700;
    border-radius: 14px;
    padding: 18px 10px;
    cursor: pointer;
}

.upload-input {
    display: none;
}

.upload-preview {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 72px;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 4px;
    scrollbar-width: thin;
    scrollbar-color: #d6b38b transparent;
}

.upload-thumb {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e6d8c6;
    background: #fff;
}

.upload-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upload-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 14px;
    line-height: 20px;
    cursor: pointer;
}

.upload-count {
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
}

.upload-info {
    color: var(--muted);
    font-size: 13px;
}

.group-block {
    margin-top: 14px;
}

.group-header-line {
    padding: 10px 12px;
    border-radius: 12px;
    background: #f5f7ff;
    border-left: 4px solid #1d4fff;
    font-weight: 700;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

.group-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.group-meta {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
}

.group-total {
    color: #1d7c3a;
    font-size: 14px;
}

.group-caret {
    font-size: 16px;
    transition: transform 0.2s ease;
}

.group-block.collapsed .group-caret {
    transform: rotate(-90deg);
}

.group-block.collapsed .group-table {
    display: none;
}

.group-table {
    border: 1px solid #e6d8c6;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    width: 100%;
}

.group-table.no-qty .group-row {
    grid-template-columns: 30px minmax(0, 3.2fr) 77px;
}

.group-table.no-qty .group-row.header > :nth-child(3),
.group-table.no-qty .qty-cell {
    display: none;
}

.group-row {
    display: grid;
    grid-template-columns: 30px minmax(0, 3.2fr) 57px 77px;
    gap: 10px;
    padding: 12px 14px;
    align-items: center;
    border-bottom: 1px solid #f1e6d3;
}

.group-row.is-muted {
    opacity: 0.45;
    filter: grayscale(0.2);
}

.group-row.is-selected {
    opacity: 1;
    filter: none;
}

.check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 20px;
    height: 20px;
}

.check input {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #222;
    border-radius: 6px;
    display: inline-block;
    position: relative;
    cursor: pointer;
    background: #fff;
}

.check input:checked {
    border-color: #2f8b2f;
    background: linear-gradient(180deg, #4fd14f, #27a627);
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.15);
}

.check input:checked + .check-mark::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 7px;
    border-left: 3px solid #fff;
    border-bottom: 3px solid #fff;
    transform: rotate(-50deg);
    top: 3px;
    left: 3px;
}

.check-mark {
    position: absolute;
    width: 20px;
    height: 20px;
    pointer-events: none;
    top: 0;
    left: 0;
}

.order-summary-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid #e6d8c6;
    margin-top: 4px;
}

.order-summary-title {
    font-weight: 700;
    color: var(--muted);
}

.order-summary-total {
    font-size: 18px;
    font-weight: 800;
    color: #1d7c3a;
}

.group-row.header {
    font-weight: 700;
    background: #fbf6ea;
    text-transform: uppercase;
    font-size: 12px;
}

.group-row:last-child {
    border-bottom: none;
}

.item-name {
    font-weight: 700;
}

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

.modal-input.small {
    height: 40px;
}

.price-muted {
    color: var(--muted);
    font-weight: 700;
}

.panel.empty-state {
    text-align: center;
    color: var(--muted);
    padding: 28px;
}

.panel h2 {
    margin-top: 0;
    font-family: 'Fraunces', serif;
}

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

label {
    display: grid;
    gap: 6px;
    font-weight: 600;
    color: var(--muted);
}

input,
select {
    padding: 11px 12px;
    border-radius: 12px;
    border: 1px solid #e3d7c2;
    font-size: 14px;
    background: #fff;
}

input:focus,
select:focus {
    outline: 2px solid #f0d6b5;
    border-color: #f0d6b5;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 999px;
    padding: 8px 16px;
    border: 1px solid #e6d8c6;
    background: #fffaf0;
    color: var(--ink);
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    justify-content: center;
}

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

.btn.primary {
    background: var(--accent-strong);
    color: #fff;
    border: none;
    padding: 10px 18px;
    box-shadow: 0 8px 18px rgba(185, 119, 66, 0.3);
}

.btn.ghost {
    background: #f7efdf;
}

.btn.outline {
    border: 1px solid #7aa2ff;
    color: #2f5dd7;
    background: #f4f7ff;
}

.btn.success {
    border: none;
    background: #198754;
    color: #fff;
}

.btn.danger {
    border: 1px solid #f0b6b0;
    background: #fff2f0;
    color: #c2473e;
}

.toggle {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px;
    border-radius: 999px;
    background: #fff;
    box-shadow: var(--shadow);
}

.toggle-label {
    font-weight: 700;
    color: var(--muted);
}

.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #d9e3b6;
    transition: 0.2s;
    border-radius: 999px;
}

.slider::before {
    position: absolute;
    content: \"\";
    height: 20px;
    width: 20px;
    left: 3px;
    top: 3px;
    background-color: white;
    transition: 0.2s;
    border-radius: 50%;
}

.switch input:checked + .slider {
    background-color: #88a2ff;
}

.switch input:checked + .slider::before {
    transform: translateX(20px);
}

.order-card {
    display: grid;
    grid-template-columns: 1fr;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    border-radius: 18px;
    background: #fffdf8;
    border: 3px solid #1d4fff;
    box-shadow: var(--shadow);
    max-width: 100%;
    width: 100%;
    min-width: 0;
}

.order-main {
    display: grid;
    grid-template-columns: 1.2fr 1fr 0.8fr;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.order-items {
    grid-column: 1 / -1;
    display: grid;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #e6d8c6;
    min-width: 0;
}

.order-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    color: var(--muted);
}

.order-item-name {
    font-weight: 600;
    color: var(--ink);
}

.order-item-qty {
    margin-left: 6px;
    font-weight: 700;
    color: #8a6a4a;
}

.order-item-total {
    font-weight: 700;
    color: #1d7c3a;
}

.order-images {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 72px;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-top: 10px;
    scrollbar-width: thin;
    scrollbar-color: #d6b38b transparent;
    max-width: 100%;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
    justify-content: start;
}

.order-images-wrap {
    width: 98%;
    max-width: 98%;
    margin: 0 auto;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: #d6b38b transparent;
}

.order-images-wrap::-webkit-scrollbar {
    height: 6px;
}

.order-images-wrap::-webkit-scrollbar-track {
    background: transparent;
}

.order-images-wrap::-webkit-scrollbar-thumb {
    background: linear-gradient(120deg, #e0c29c, #cfa477);
    border-radius: 999px;
}

.order-images-wrap::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(120deg, #d2b07f, #b78859);
}

.order-image {
    width: 72px;
    height: 72px;
    border-radius: 12px;
    object-fit: cover;
    border: 1px solid #e6d8c6;
}

.upload-preview::-webkit-scrollbar,
.order-images::-webkit-scrollbar {
    height: 6px;
}

.upload-preview::-webkit-scrollbar-track,
.order-images::-webkit-scrollbar-track {
    background: transparent;
}

.upload-preview::-webkit-scrollbar-thumb,
.order-images::-webkit-scrollbar-thumb {
    background: linear-gradient(120deg, #e0c29c, #cfa477);
    border-radius: 999px;
}

.upload-preview::-webkit-scrollbar-thumb:hover,
.order-images::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(120deg, #d2b07f, #b78859);
}

.order-title {
    font-size: 18px;
    font-weight: 700;
}

.order-meta {
    color: var(--muted);
    font-size: 13px;
}

.order-tag {
    justify-self: start;
    background: #f2f2f2;
    border-radius: 10px;
    padding: 6px 10px;
    font-weight: 700;
    font-size: 12px;
}

.order-prices {
    justify-self: end;
    text-align: right;
    display: grid;
    gap: 4px;
}

.order-total {
    font-size: 18px;
    font-weight: 700;
    color: #1d7c3a;
}

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

.order-actions {
    display: grid;
    gap: 8px;
}

.order-list {
    display: grid;
    gap: 16px;
    min-width: 0;
}

.order-card-action {
    display: block;
    cursor: pointer;
    text-align: left;
    border: 3px solid #1d4fff;
    width: 100%;
    background: #fffdf8;
    overflow: hidden;
    max-width: 100%;
}

.order-card-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.12);
}

.order-card-action:active {
    transform: translateY(0);
}

.cart-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid #e6d8c6;
    background: linear-gradient(120deg, #fff6e6, #fffdf8);
}

.cart-summary-label {
    font-weight: 700;
    color: var(--muted);
}

.cart-summary-value {
    font-size: 20px;
    font-weight: 800;
    color: #1d7c3a;
}

.alert {
    padding: 10px 14px;
    border-radius: 12px;
    margin: 10px 0;
    font-weight: 600;
}

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

.alert-error {
    background: #fde7e4;
    color: var(--error);
}

.table {
    background: var(--card);
    border-radius: 16px;
    border: 1px solid var(--card-border);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.table-row {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr 1fr;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid #f1e6d3;
    align-items: center;
    font-size: 14px;
}

.table-row.header {
    font-weight: 700;
    background: #fbf6ea;
}

.table-row.empty {
    display: block;
    text-align: center;
    color: var(--muted);
}

.muted {
    color: var(--muted);
    font-size: 13px;
}

.auth-card {
    max-width: 380px;
    margin: 80px auto;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 18px;
    padding: 24px;
    box-shadow: var(--shadow);
}

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

.menu {
    position: relative;
}

.menu-trigger {
    list-style: none;
    cursor: pointer;
    border-radius: 999px;
    padding: 8px 14px;
    border: 1px solid #e6d8c6;
    background: #fffaf0;
    font-weight: 600;
}

.menu-trigger::-webkit-details-marker {
    display: none;
}

.menu[open] .menu-trigger {
    background: #f7efdf;
    color: var(--accent-strong);
}

.menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: #fffaf0;
    border: 1px solid #e6d8c6;
    border-radius: 14px;
    min-width: 160px;
    box-shadow: var(--shadow);
    padding: 6px;
    display: grid;
    gap: 4px;
    z-index: 20;
}

.menu-item {
    text-decoration: none;
    color: var(--ink);
    font-weight: 600;
    padding: 8px 10px;
    border-radius: 10px;
}

.menu-item:hover {
    background: #f7efdf;
}

.tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
    padding: 10px 8px 14px;
    background: rgba(255, 253, 245, 0.95);
    border-top: 1px solid #efe6d6;
    backdrop-filter: blur(12px);
    z-index: 20;
}

.tab {
    display: grid;
    justify-items: center;
    text-decoration: none;
    color: var(--muted);
    font-weight: 600;
    font-size: 12px;
    gap: 4px;
    padding: 6px 4px;
    border-radius: 12px;
}

.tab-icon {
    font-size: 18px;
}

.tab.active {
    color: var(--accent-strong);
    background: #f7efdf;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.tab-panel .page-head {
    margin-bottom: 12px;
}

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

.cta-bar {
    display: flex;
    gap: 12px;
    align-items: center;
}

.cta-button {
    border: none;
    padding: 12px 16px;
    border-radius: 14px;
    background: linear-gradient(120deg, var(--accent), var(--accent-strong));
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(185, 119, 66, 0.25);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.cta-button.compact {
    padding: 8px 12px;
    font-size: 13px;
    border-radius: 12px;
    box-shadow: 0 6px 14px rgba(185, 119, 66, 0.2);
}

.table-card {
    background: rgba(255, 253, 248, 0.9);
    border-radius: 24px;
    padding: 10px 0;
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow);
}

.table-grid {
    display: grid;
    grid-template-columns: 180px 1.2fr 0.9fr 0.9fr;
    align-items: center;
    padding: 16px 24px;
    font-size: 14px;
    border-bottom: 1px solid rgba(227, 215, 194, 0.5);
}

.table-grid.header {
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.7px;
}

.table-grid:last-child {
    border-bottom: none;
}

.table-grid.empty {
    grid-template-columns: 1fr;
    justify-items: center;
    color: var(--muted);
}

.recipe-grid {
    grid-template-columns: 1.6fr 0.8fr 1fr 140px;
}

.modal-wide {
    width: min(960px, 96vw);
}

.modal-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    margin-top: 4px;
}

.recipe-items {
    display: grid;
    gap: 10px;
}

.recipe-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 44px;
    gap: 10px;
    align-items: center;
}

.recipe-row .modal-input {
    height: 44px;
}

.recipe-row .icon-btn {
    height: 44px;
    width: 44px;
}

.backup-panel {
    display: grid;
    gap: 16px;
}

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

.settings-grid {
    grid-template-columns: 1.5fr 1fr 140px;
}

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

.group-scroll {
    max-height: 42vh;
    overflow-y: auto;
    padding-right: 6px;
}

.group-card {
    border: 1px solid #e3d7c2;
    border-radius: 16px;
    padding: 14px;
    background: #fff;
}

.group-header {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
}

.group-actions {
    display: flex;
    gap: 6px;
}

.group-items {
    margin-top: 12px;
    display: grid;
    gap: 10px;
}

.btn-outline {
    border: 1px solid #d7b48f;
    background: #f7efdf;
    color: #7a5533;
    border-radius: 12px;
    padding: 10px 14px;
    font-weight: 700;
    cursor: pointer;
    justify-self: start;
}

.btn-outline:hover {
    background: #f2e3cc;
}

.item-row {
    display: grid;
    grid-template-columns: 1fr 1fr 46px;
    grid-template-rows: auto auto;
    gap: 10px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px dashed rgba(184, 164, 134, 0.4);
}

.item-row:last-child {
    border-bottom: none;
}

.item-row .input-group {
    width: 100%;
}

.item-col {
    width: 100%;
}

.item-type {
    grid-column: 1;
    grid-row: 1;
}

.item-recipe {
    grid-column: 2;
    grid-row: 1;
}

.item-standard {
    grid-column: 2;
    grid-row: 2;
}

.item-multiplier {
    grid-column: 1;
    grid-row: 2;
    margin-top: 0;
}

.item-delete {
    grid-column: 3;
    grid-row: 1 / 3;
    align-self: start;
    display: grid;
    justify-items: end;
}

.item-delete .icon-btn {
    width: 40px;
    height: 40px;
}

.item-row .icon-btn {
    width: 40px;
    height: 40px;
    justify-self: end;
}

.item-row .modal-input {
    height: 44px;
}

.item-select {
    display: grid;
}

.item-cost {
    font-size: 12px;
    color: var(--muted);
    display: grid;
    gap: 4px;
    text-align: right;
}

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

.inline-form {
    margin: 0;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    border: none;
    background: #f0e3d1;
    color: #6d4b2b;
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 16px;
}

.icon-btn.secondary {
    background: #f6f0e6;
    color: #8a6a4b;
}

.icon-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.stock-value {
    font-weight: 700;
}

.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.modal.is-open {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(40, 33, 24, 0.45);
    backdrop-filter: blur(2px);
}

.modal-card {
    position: relative;
    z-index: 1;
    background: #efede9;
    border-radius: 22px;
    padding: 22px;
    width: min(460px, 92vw);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    max-height: 70vh;
    overflow-y: hidden;
}

.modal-shell {
    display: flex;
    flex-direction: column;
    height: 70vh;
}

.modal-scroll-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 100%;
    min-height: 0;
}

.modal-shell.compact {
    height: auto;
    max-height: 70vh;
}

.modal-shell.compact .modal-body-scroll {
    flex: 0 0 auto;
    overflow: visible;
    max-height: none;
    padding-right: 0;
}

.modal-body-scroll {
    overflow-y: auto;
    padding-right: 6px;
    flex: 1 1 auto;
    min-height: 0;
}

.modal-footer {
    flex: 0 0 auto;
    background: #efede9;
    padding-top: 12px;
}

.modal-footer-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
}

.modal-title {
    font-family: 'Fraunces', serif;
    font-size: 22px;
    margin: 0 0 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-subtitle {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 16px;
}

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

.modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.modal-input {
    padding: 11px 12px;
    border-radius: 12px;
    border: 1px solid #e3d7c2;
    background: #fff;
    font-size: 14px;
    width: 100%;
    height: 44px;
}

.input-group {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    background: #fff;
    border: 1px solid #e3d7c2;
    border-radius: 12px;
    overflow: hidden;
}

.input-group .modal-input {
    border: none;
    border-radius: 0;
}

.input-suffix {
    padding: 0 12px;
    color: var(--muted);
    font-weight: 600;
    font-size: 12px;
    border-left: 1px solid #e9ddc8;
    background: #f8f4ee;
    height: 100%;
    display: grid;
    place-items: center;
    width: var(--suffix-width);
    min-width: var(--suffix-width);
    white-space: nowrap;
}

.ghost-field {
    visibility: hidden;
}

.input-suffix.empty {
    color: transparent;
}

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

.btn-soft {
    border-radius: 14px;
    padding: 12px 14px;
    border: none;
    background: #fff;
    cursor: pointer;
    font-weight: 700;
}

.note-card {
    background: #fff;
    border-radius: 12px;
    padding: 12px;
    border: 1px solid #e3d7c2;
    display: grid;
    gap: 6px;
    font-size: 13px;
}

.profile-card {
    max-width: 520px;
    margin: 0 auto;
    background: #fffdf8;
    border-radius: 24px;
    padding: 26px;
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow);
    text-align: center;
}

.profile-avatar {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: linear-gradient(140deg, var(--accent), var(--accent-strong));
    color: #fff;
    font-weight: 700;
    font-size: 30px;
    display: grid;
    place-items: center;
    margin: 0 auto 12px;
    box-shadow: 0 12px 24px rgba(185, 119, 66, 0.25);
}

.profile-name {
    font-weight: 700;
    font-size: 18px;
    margin-bottom: 16px;
}

.profile-form {
    display: grid;
    gap: 12px;
    text-align: left;
}

.tabs {
    display: inline-flex;
    gap: 8px;
    padding: 6px;
    background: #f6efe4;
    border-radius: 999px;
    border: 1px solid #e6d8c6;
}

.tab-btn {
    border: none;
    background: transparent;
    padding: 10px 16px;
    border-radius: 999px;
    font-weight: 700;
    color: var(--muted);
    cursor: pointer;
}

.tab-btn.active {
    background: #fff;
    color: var(--accent-strong);
    box-shadow: 0 6px 14px rgba(72, 54, 34, 0.12);
}

.tab-panel {
    display: none;
}

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

@media (max-width: 880px) {
    .cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .table-grid {
        grid-template-columns: 160px 1fr 0.9fr 0.9fr;
        padding: 14px 18px;
    }

    .recipe-grid {
        grid-template-columns: 1.4fr 0.8fr 0.9fr 120px;
    }

    .settings-grid {
        grid-template-columns: 1.3fr 1fr 120px;
    }

    .order-card {
        grid-template-columns: 1fr;
        text-align: left;
    }

    .order-prices {
        justify-self: start;
        text-align: left;
    }

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

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

    .group-row {
        grid-template-columns: 40px 1fr;
        grid-template-rows: auto auto;
        row-gap: 6px;
    }

    .group-row > :nth-child(3),
    .group-row > :nth-child(4) {
        grid-column: 2;
        justify-self: start;
    }

    .upload-area {
        grid-template-columns: 1fr;
        justify-items: start;
    }
}

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

@media (max-width: 720px) {
    .topbar {
        flex-direction: row;
        gap: 12px;
    }

    .table-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .page-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .table-grid {
        grid-template-columns: 1fr;
        gap: 10px;
        align-items: start;
    }

    .item-row {
        grid-template-columns: 1fr 1fr 46px;
        grid-template-rows: auto auto auto;
    }

    .item-type {
        grid-column: 1 / 3;
        grid-row: 1;
    }

    .item-recipe {
        grid-column: 1 / 3;
        grid-row: 2;
    }

    .item-multiplier {
        grid-column: 1;
        grid-row: 3;
    }

    .item-standard {
        grid-column: 2;
        grid-row: 3;
    }

    .item-delete {
        grid-column: 3;
        grid-row: 1 / 4;
        align-self: start;
    }

    .recipe-row {
        grid-template-columns: 1fr;
    }

    .table-actions {
        order: 1;
    }

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

    .toggle {
        align-self: flex-start;
    }

    .order-builder {
        border-width: 2px;
    }

    .modal-card {
        max-height: 80vh;
        margin-top: 6vh;
    }

    .modal-body-scroll {
        max-height: 56vh;
    }

    .modal-shell {
        height: 80vh;
    }

    .group-table {
        overflow-x: hidden;
    }

    .group-row.header {
        grid-template-columns: 40px 1fr;
    }

    .group-row.header > :nth-child(3),
    .group-row.header > :nth-child(4) {
        display: none;
    }
}
