/* =========================
   RESET
========================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Inter, Arial, sans-serif;
}

body {
    background: #f1f5f9;
    color: #111827;
}

button,
input,
select {
    font-family: inherit;
}

/* =========================
   BUTTON
========================= */

.btn {
    border: none;
    border-radius: 12px;
    padding: 12px 16px;
    cursor: pointer;
    font-weight: 700;
    min-height: 44px;
}

.primary {
    background: #2563eb;
    color: white;
}

.danger {
    background: #dc2626;
    color: white;
}

.warning {
    background: #f59e0b !important;
    color: white !important;
}

.kitchen {
    background: #7c3aed !important;
    color: white !important;
}

.full {
    width: 100%;
}

/* =========================
   INDEX / DAFTAR MEJA
========================= */

.main-layout {
    min-height: 100vh;
    padding: 16px;
}

.top-header {
    background: #0f172a;
    color: white;
    border-radius: 18px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    gap: 12px;
}

.top-header h1 {
    font-size: 28px;
    margin: 0;
}

.top-header p {
    color: #cbd5e1;
    margin-top: 5px;
}

.table-main-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 14px;
}

.table-box {
    border-radius: 18px;
    padding: 18px;
    min-height: 135px;
    text-decoration: none;
    color: #111827;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 4px 15px rgba(0,0,0,.08);
    transition: 0.15s ease;
}

.table-box:hover {
    transform: translateY(-2px);
}

.table-box strong {
    font-size: 28px;
}

.table-box span {
    font-weight: 700;
}

.table-box small {
    font-weight: 700;
    opacity: 0.9;
}

.table-box b {
    font-size: 18px;
}

/* =========================
   SETTING MEJA
========================= */

.setting-box label {
    display: block;
    margin: 12px 0 6px;
    font-weight: 800;
}

.setting-row {
    display: flex;
    gap: 8px;
}

.setting-row input {
    flex: 1;
}

.setting-box input[type="text"] {
    width: 100%;
    padding: 13px;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    font-size: 15px;
}

.setting-box input[type="color"] {
    width: 100%;
    height: 48px;
    border: none;
    background: transparent;
    cursor: pointer;
}

/* =========================
   ORDER PAGE
========================= */

.order-page {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 15px;
    padding: 15px;
    height: 100vh;
}

.order-left,
.order-right {
    background: white;
    border-radius: 18px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,.08);
    overflow: hidden;
}

.order-top {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
}

.back-btn {
    background: #e5e7eb;
    padding: 10px 14px;
    border-radius: 12px;
    text-decoration: none;
    color: #111827;
    font-weight: 700;
    white-space: nowrap;
}

.order-table-info h2 {
    font-size: 24px;
}

.order-table-info small {
    color: #6b7280;
    font-weight: 700;
}

.order-meta {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 15px;
}

.meta-card {
    border: none;
    background: #f8fafc;
    border-radius: 12px;
    padding: 12px;
    font-weight: 700;
    cursor: pointer;
    min-height: 58px;
}

.order-list {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: auto;
    height: calc(100vh - 520px);
    min-height: 150px;
}

.order-item {
    display: grid;
    grid-template-columns: 30px 1fr auto auto;
    gap: 10px;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
}

.order-item:last-child {
    border-bottom: none;
}

.order-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
}

.item-info strong {
    display: block;
}

.item-info small {
    color: #6b7280;
}

.qty-control {
    display: flex;
    align-items: center;
    gap: 6px;
}

.qty-control button {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: #e5e7eb;
    cursor: pointer;
    font-weight: 900;
}

.qty-control span {
    font-weight: 900;
}

.summary-box {
    margin-top: 15px;
    border-top: 1px solid #e5e7eb;
    padding-top: 15px;
}

.summary-box div {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-weight: 700;
}

.summary-total {
    font-size: 22px;
    font-weight: 800;
    color: #2563eb;
}

.order-actions {
    margin-top: 15px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.order-actions button {
    border: none;
    border-radius: 10px;
    min-height: 42px;
    cursor: pointer;
    font-weight: 700;
    background: #e5e7eb;
}

.payment-actions {
    margin-top: 15px;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}

.payment-actions button {
    border: none;
    border-radius: 10px;
    min-height: 50px;
    background: #0f172a;
    color: white;
    font-weight: 700;
    cursor: pointer;
}

.pay-main {
    background: #16a34a !important;
}

/* =========================
   PRODUCT
========================= */

.product-search {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.product-search input,
.product-search select {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 12px;
    font-size: 14px;
}

.category-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    margin-bottom: 15px;
}

.category-bar button {
    border: none;
    border-radius: 10px;
    background: #e5e7eb;
    padding: 10px 14px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
}

.clean-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    height: calc(100vh - 145px);
    overflow-y: auto;
}

.clean-product-card {
    border: 1px solid #e5e7eb;
    border-radius: 15px;
    padding: 10px;
    text-align: center;
    background: white;
}

.clean-product-card img {
    width: 100%;
    height: 110px;
    object-fit: cover;
    border-radius: 10px;
}

.clean-product-card h4 {
    margin-top: 10px;
    font-size: 15px;
}

.clean-product-card p {
    margin: 8px 0;
    color: #2563eb;
    font-weight: 800;
}

.clean-product-card button {
    width: 100%;
    border: none;
    border-radius: 10px;
    background: #22c55e;
    color: white;
    padding: 10px;
    font-weight: 700;
    cursor: pointer;
}

/* =========================
   MODAL
========================= */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 999;
}

.modal.active {
    display: flex;
}

.modal-box {
    background: white;
    width: 95%;
    max-width: 450px;
    border-radius: 18px;
    padding: 20px;
}

.modal-box h3 {
    margin-bottom: 15px;
}

.modal-action {
    width: 100%;
    min-height: 50px;
    margin-bottom: 10px;
    border: none;
    border-radius: 12px;
    background: #2563eb;
    color: white;
    font-weight: 700;
    cursor: pointer;
}

.table-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.table-grid button {
    border: none;
    border-radius: 12px;
    min-height: 60px;
    background: #2563eb;
    color: white;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
}

/* =========================
   TABLET
========================= */

@media (max-width: 1024px) {
    .order-page {
        grid-template-columns: 43% 57%;
    }

    .order-actions {
        grid-template-columns: repeat(3, 1fr);
    }

    .payment-actions {
        grid-template-columns: repeat(3, 1fr);
    }

    .clean-product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* =========================
   MOBILE
========================= */

@media (max-width: 768px) {
    .top-header {
        padding: 14px;
        border-radius: 14px;
        align-items: stretch;
        flex-direction: column;
    }

    .top-header h1 {
        font-size: 22px;
    }

    .table-main-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .table-box {
        min-height: 100px;
        padding: 12px;
        border-radius: 14px;
    }

    .table-box strong {
        font-size: 22px;
    }

    .table-box b {
        font-size: 14px;
    }

    .order-page {
        grid-template-columns: 45% 55%;
        gap: 8px;
        padding: 8px;
        height: 100vh;
    }

    .order-left,
    .order-right {
        padding: 10px;
        border-radius: 14px;
    }

    .order-top {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .back-btn,
    .btn {
        text-align: center;
        font-size: 12px;
        padding: 9px;
        min-height: 38px;
    }

    .order-table-info h2 {
        font-size: 18px;
    }

    .order-meta {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .meta-card {
        min-height: 42px;
        padding: 8px;
        font-size: 11px;
    }

    .order-list {
        height: calc(100vh - 520px);
        min-height: 95px;
    }

    .order-item {
        grid-template-columns: 24px 1fr;
        gap: 6px;
        padding: 8px;
    }

    .order-item b {
        grid-column: span 2;
        font-size: 12px;
    }

    .item-info strong {
        font-size: 12px;
    }

    .item-info small {
        font-size: 11px;
    }

    .qty-control {
        grid-column: span 2;
    }

    .qty-control button {
        width: 28px;
        height: 28px;
    }

    .summary-box {
        font-size: 12px;
        margin-top: 10px;
        padding-top: 10px;
    }

    .summary-total {
        font-size: 16px;
    }

    .order-actions {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
        margin-top: 10px;
    }

    .order-actions button,
    .payment-actions button {
        min-height: 36px;
        font-size: 11px;
    }

    .payment-actions {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
        margin-top: 10px;
    }

    .pay-main {
        grid-column: span 2;
    }

    .product-search {
        flex-direction: column;
        gap: 6px;
    }

    .product-search input,
    .product-search select {
        padding: 9px;
        font-size: 12px;
    }

    .category-bar {
        gap: 6px;
        margin-bottom: 8px;
    }

    .category-bar button {
        padding: 8px 10px;
        font-size: 11px;
    }

    .clean-product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        height: calc(100vh - 150px);
    }

    .clean-product-card {
        padding: 8px;
        border-radius: 12px;
    }

    .clean-product-card img {
        height: 60px;
        border-radius: 8px;
    }

    .clean-product-card h4 {
        font-size: 11px;
        margin-top: 6px;
    }

    .clean-product-card p {
        font-size: 11px;
        margin: 5px 0;
    }

    .clean-product-card button {
        min-height: 34px;
        padding: 7px;
        font-size: 11px;
    }
}

/* =========================
   HP KECIL
========================= */

@media (max-width: 430px) {
    .main-layout {
        padding: 8px;
    }

    .order-page {
        grid-template-columns: 44% 56%;
        gap: 6px;
        padding: 6px;
    }

    .order-left,
    .order-right {
        padding: 8px;
        border-radius: 12px;
    }

    .order-list {
        height: calc(100vh - 540px);
        min-height: 80px;
    }

    .clean-product-grid {
        height: calc(100vh - 145px);
    }

    .table-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .table-grid button {
        min-height: 50px;
        font-size: 15px;
    }

    .setting-row {
        flex-direction: column;
    }
}