* { box-sizing: border-box; }
body { font-family: Arial, sans-serif; background: #f7f7f7; margin: 0; color: #222; }
.container { max-width: 1200px; margin: auto; padding: 20px; }
h1, h2, h3 { color: #222; }
a { color: #222; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 20px; }
.card { background: white; padding: 25px; text-align: center; border-radius: 12px; text-decoration: none; color: #222; font-weight: bold; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.card:hover { background: #ffe9c7; }
form, .box { background: white; padding: 15px; border-radius: 10px; margin-bottom: 20px; }
input, select, textarea, button { width: 100%; padding: 12px; margin: 7px 0; font-size: 16px; }
button { background: #111; color: white; border: none; border-radius: 8px; cursor: pointer; }
button:hover { opacity: .9; }
.status-card { background: white; padding: 20px; border-radius: 12px; margin-bottom: 15px; box-shadow: 0 2px 7px rgba(0,0,0,0.1); }
.status-card button { margin-top: 8px; }
.table-wrap { overflow-x: auto; background: #fff; border-radius: 10px; padding: 10px; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: 10px; border-bottom: 1px solid #ddd; text-align: left; white-space: nowrap; }
th { background: #222; color: #fff; }
.success { background: #e7f8e7; color: #137333; padding: 12px; border-radius: 8px; margin-bottom: 15px; }
.error { background: #fde8e8; color: #b00020; padding: 12px; border-radius: 8px; margin-bottom: 15px; }
.top-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 15px; }
.top-actions a { background: #222; color: #fff; padding: 10px 14px; border-radius: 8px; text-decoration: none; }
.variance-ok { color: green; font-weight: bold; }
.variance-bad { color: red; font-weight: bold; }
@media (max-width: 768px) { body { font-size: 16px; } .container { padding: 12px; } button { font-size: 18px; padding: 15px; } th, td { font-size: 14px; } }
@media print { .no-print, .top-actions, .filter-box { display: none !important; } body { background: #fff; } .container { max-width: 100%; } }
.auth-container { max-width: 460px; margin-top: 60px; }
.user-pill { background: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: 0 2px 7px rgba(0,0,0,0.08); }

/* Live order and chat improvements */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.live-pill { background: #e7f8e7; color: #137333; padding: 7px 12px; border-radius: 999px; font-weight: bold; }
.pending-alert { background: #fff3cd; color: #7a4d00; padding: 14px; border-radius: 10px; margin-bottom: 15px; font-weight: bold; border: 1px solid #ffd56a; }
.order-header { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.muted { color: #777; font-size: 0.8em; }
.last-message { background: #f4f4f4; padding: 8px; border-radius: 8px; }
.button-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin: 12px 0; }
.button-row button { margin: 0; }
.danger-btn { background: #b00020; }
.enable-sound-btn { width: auto; padding: 10px 14px; margin: 0; background: #0b57d0; }
.status-pending { color: #b26a00; }
.status-accepted { color: #0b57d0; }
.status-processing { color: #7a4d00; }
.status-ready { color: #137333; }
.status-completed { color: #555; }
.status-cancelled { color: #b00020; }
.status-border-pending { border-left: 8px solid #fbbc04; }
.status-border-accepted { border-left: 8px solid #0b57d0; }
.status-border-processing { border-left: 8px solid #ff9800; }
.status-border-ready { border-left: 8px solid #137333; }
.chat-box { background: #f8f8f8; border-radius: 10px; padding: 10px; max-height: 220px; overflow-y: auto; margin-top: 15px; }
.chat-empty { color: #777; font-style: italic; }
.chat-message { background: #fff; padding: 10px; border-radius: 10px; margin-bottom: 8px; border: 1px solid #eee; }
.chat-message strong { display: block; }
.chat-message span { color: #777; font-size: 12px; }
.chat-message p { margin: 6px 0 0; }
.from-kitchen { border-left: 5px solid #137333; }
.from-foh { border-left: 5px solid #0b57d0; }
.chat-form { display: grid; grid-template-columns: 1fr 170px; gap: 8px; align-items: center; margin-top: 10px; }
.chat-form input, .chat-form button { margin: 0; }


/* Responsive login page */
.login-page {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at top left, rgba(255, 211, 138, 0.55), transparent 32%),
        linear-gradient(135deg, #fff8ec 0%, #f3f4f6 45%, #ffffff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(16px, 3vw, 36px);
}

.login-wrapper {
    width: 100%;
    max-width: 1080px;
}

.login-card {
    display: grid;
    grid-template-columns: minmax(320px, 1.1fr) minmax(340px, 0.9fr);
    min-height: 620px;
    background: #fff;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 24px 70px rgba(17, 24, 39, 0.16);
    border: 1px solid rgba(17, 24, 39, 0.06);
}

.login-info {
    position: relative;
    color: #fff;
    padding: clamp(28px, 5vw, 58px);
    background:
        linear-gradient(135deg, rgba(0,0,0,0.78), rgba(0,0,0,0.45)),
        linear-gradient(135deg, #191919, #4a2b0f 55%, #c07719);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 34px;
}

.login-info::after {
    content: "";
    position: absolute;
    right: -80px;
    bottom: -80px;
    width: 260px;
    height: 260px;
    border-radius: 999px;
    background: rgba(255,255,255,0.12);
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    z-index: 1;
}

.brand-icon {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    background: #fff;
    color: #111;
    display: grid;
    place-items: center;
    font-weight: 800;
    letter-spacing: -1px;
    box-shadow: 0 10px 22px rgba(0,0,0,0.22);
}

.brand-lockup h1 {
    color: #fff;
    margin: 0;
    font-size: clamp(30px, 4vw, 44px);
    letter-spacing: -1px;
}

.brand-lockup p,
.login-copy p {
    margin: 4px 0 0;
    color: rgba(255,255,255,0.82);
}

.login-copy {
    position: relative;
    z-index: 1;
    max-width: 560px;
}

.login-copy h2 {
    color: #fff;
    font-size: clamp(28px, 4vw, 48px);
    line-height: 1.05;
    letter-spacing: -1.5px;
    margin: 0 0 16px;
}

.login-copy p {
    font-size: 17px;
    line-height: 1.7;
}

.role-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.role-chips span {
    padding: 10px 13px;
    border-radius: 999px;
    background: rgba(255,255,255,0.16);
    border: 1px solid rgba(255,255,255,0.22);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
}

.login-form-panel {
    padding: clamp(28px, 4vw, 54px);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-form-header h2 {
    margin: 0 0 8px;
    font-size: clamp(28px, 3vw, 38px);
    letter-spacing: -0.8px;
}

.login-form-header p {
    margin: 0 0 26px;
    color: #666;
}

.login-form {
    background: transparent;
    padding: 0;
    margin: 0;
    border-radius: 0;
}

.login-form label {
    display: block;
    font-weight: 700;
    margin: 16px 0 8px;
}

.login-form input {
    height: 52px;
    border: 1px solid #d8d8d8;
    border-radius: 14px;
    background: #fafafa;
    outline: none;
    transition: border-color .2s, box-shadow .2s, background .2s;
}

.login-form input:focus {
    border-color: #c07719;
    box-shadow: 0 0 0 4px rgba(192, 119, 25, 0.14);
    background: #fff;
}

.login-form button {
    margin-top: 22px;
    min-height: 54px;
    border-radius: 14px;
    font-weight: 800;
    background: linear-gradient(135deg, #111, #3b2a16);
    box-shadow: 0 12px 22px rgba(17, 24, 39, 0.16);
}

.login-error {
    border-radius: 12px;
}

.login-note {
    margin-top: 18px;
    color: #777;
    font-size: 14px;
    line-height: 1.5;
}

@media (max-width: 860px) {
    .login-card {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .login-info {
        min-height: 330px;
    }

    .login-copy h2 {
        max-width: 650px;
    }

    .chat-form { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
    .login-page {
        align-items: stretch;
        padding: 0;
        background: #fff;
    }

    .login-wrapper {
        max-width: none;
    }

    .login-card {
        border-radius: 0;
        min-height: 100vh;
        box-shadow: none;
        border: 0;
    }

    .login-info {
        min-height: auto;
        padding: 28px 22px;
        gap: 24px;
    }

    .brand-icon {
        width: 50px;
        height: 50px;
        border-radius: 15px;
    }

    .login-copy h2 {
        font-size: 28px;
    }

    .login-copy p {
        font-size: 15px;
    }

    .role-chips span {
        font-size: 13px;
        padding: 8px 10px;
    }

    .login-form-panel {
        padding: 28px 22px 34px;
    }

    .login-form input,
    .login-form button {
        min-height: 52px;
        font-size: 16px;
    }
}

/* Searchable product select */
.search-select-original {
    position: absolute !important;
    left: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.search-select {
    position: relative;
    width: 100%;
    margin: 7px 0;
}

.search-select-input {
    width: 100%;
    box-sizing: border-box;
    padding: 12px;
    font-size: 16px;
    border: 1px solid #d7d7d7;
    border-radius: 8px;
    background: #fff;
}

.search-select-input:focus {
    outline: none;
    border-color: #111;
    box-shadow: 0 0 0 3px rgba(0,0,0,0.08);
}

.search-select-error {
    border-color: #b00020 !important;
    box-shadow: 0 0 0 3px rgba(176,0,32,0.12) !important;
}

.search-select-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    max-height: 260px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 9999;
}

.search-select-option {
    display: block;
    width: 100%;
    padding: 12px 14px;
    margin: 0;
    border: 0;
    border-bottom: 1px solid #f0f0f0;
    border-radius: 0;
    background: #fff;
    color: #222;
    text-align: left;
    font-size: 15px;
    cursor: pointer;
}

.search-select-option:hover,
.search-select-option:focus {
    background: #ffe9c7;
    color: #111;
}

.search-select-empty {
    padding: 14px;
    color: #777;
    font-size: 14px;
}

@media (max-width: 768px) {
    .search-select-input,
    .search-select-option {
        font-size: 17px;
        padding: 15px;
    }

    .search-select-dropdown {
        max-height: 320px;
    }
}

/* Compact kitchen/front-of-house order controls */
.compact-actions {
    align-items: center;
    gap: 8px;
}
.compact-btn,
.button-row .compact-btn,
.compact-chat-form .compact-btn {
    width: auto;
    min-width: 96px;
    padding: 9px 12px;
    font-size: 14px;
    margin: 4px 4px 4px 0;
    display: inline-block;
}
.secondary-btn { background: #475569 !important; }
.success-btn { background: #137333 !important; }
.compact-head h1,
.compact-head h2 { margin-bottom: 4px; }
.compact-order-card {
    padding: 12px;
    margin-bottom: 10px;
}
.compact-order-header h2,
.compact-order-header h3 {
    margin: 0 0 6px;
    font-size: 20px;
}
.compact-order-card p {
    margin: 4px 0;
}
.compact-button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0;
}
.compact-items {
    margin: 6px 0;
    padding-left: 18px;
}
.order-chat-details {
    margin-top: 8px;
    border-top: 1px solid #e5e7eb;
    padding-top: 8px;
}
.order-chat-details summary {
    cursor: pointer;
    font-weight: 700;
    color: #334155;
    margin-bottom: 8px;
}
.compact-chat-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
    padding: 0;
    background: transparent;
}
.compact-chat-form input {
    margin: 0;
}
.compact-chat-form button {
    margin: 0;
}
.status-ready,
.status-border-ready .order-status {
    color: #b45309;
}
.status-border-ready {
    border-left: 5px solid #f59e0b;
}
.status-border-completed {
    opacity: 0.78;
}
.status-border-cancelled {
    opacity: 0.65;
}
@media (max-width: 768px) {
    .compact-btn,
    .button-row .compact-btn,
    .compact-chat-form .compact-btn {
        min-width: unset;
        width: auto;
        padding: 9px 11px;
        font-size: 13px;
    }
    .compact-chat-form {
        grid-template-columns: 1fr;
    }
    .compact-chat-form button {
        width: 100%;
    }
    .compact-order-header h2,
    .compact-order-header h3 {
        font-size: 18px;
    }
}


/* BiteEase V2 ERP controls */
.badge { display:inline-block; padding:4px 8px; border-radius:999px; background:#f1f5f9; font-size:12px; font-weight:700; }
.badge-good { background:#e7f8e7; color:#137333; }
.badge-warn { background:#fff3cd; color:#7a4d00; }
.badge-bad { background:#fde8e8; color:#b00020; }
.form-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(220px, 1fr)); gap:12px; }
.line-row { display:grid; grid-template-columns:1.2fr .7fr .6fr .7fr 1fr auto; gap:10px; align-items:end; padding:10px; border:1px solid #eee; border-radius:10px; margin-bottom:10px; background:#fff; }
.line-row-4 { grid-template-columns:1.3fr .7fr .7fr auto; }
.small-btn { width:auto; padding:8px 12px; font-size:14px; }
.secondary-btn { background:#555; }
.success-btn { background:#137333; }
.warning-note { background:#fff8e1; border:1px solid #ffe082; padding:12px; border-radius:10px; margin:12px 0; }
@media(max-width:850px){ .line-row,.line-row-4{grid-template-columns:1fr;} .small-btn{width:100%;} }
