/* Adjust layout framing only on unauthenticated login view so authenticated workspace iframe container keeps full viewport height */
body:not(.erp-authenticated) .erp-shell,
body:not(.erp-authenticated) .erp-main-shell {
    height: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

body:not(.erp-authenticated) .erp-workspace {
    padding: 0 !important;
    margin: 0 !important;
    height: 100% !important;
    border-radius: 0 !important;
    border: none !important;
}

body:not(.erp-authenticated) .erp-workspace-body,
body:not(.erp-authenticated) .erp-workspace-content {
    padding: 0 !important;
    margin: 0 !important;
    height: 100% !important;
    background: none !important;
    border: none !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
}

.custom-home-flex {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 100%;
    width: 100%;
    background-color: #d4d0c8;
    font-family: 'Inter', Arial, sans-serif;
}

.custom-home-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    color: #ffffff;
    padding: 4px 16px;
    min-height: 40px;
    flex-shrink: 0;
    z-index: 10;
}

.header-logo {
    max-height: 40px;
    object-fit: contain;
}

.header-left-group {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.header-company-name {
    font-size: 20px;
    font-weight: bold;
    line-height: 1;
}

.custom-home-header .header-dialogue {
    display: block !important;
    max-width: 560px;
    min-width: 0;
    width: auto !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0;
    padding: 0 0 0 10px !important;
    border: 0 !important;
    border-left: 1px solid rgba(255,255,255,0.35) !important;
    border-radius: 0 !important;
    background: transparent !important;
    background-image: none !important;
    color: #e2e8f0 !important;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: none !important;
    outline: 0 !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}

.header-branch-name {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.custom-home-body {
    flex-grow: 1;
    background-color: #f1f5f9;
    background-size: contain;
    background-position: center center;
    background-repeat: no-repeat;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    position: relative;
}

.custom-home-footer {
    display: flex;
    height: 64px;
    min-height: 64px;
    flex-shrink: 0;
    border-top: 1px solid rgba(255,255,255,0.05);
    background: #0f172a;
    color: #e2e8f0;
    box-shadow: 0 -4px 15px rgba(0,0,0,0.2);
    z-index: 10;
}

.custom-footer-left {
    width: 60%;
    background: linear-gradient(90deg, #1e293b 0%, #0f172a 100%);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 2px 16px;
    border-right: 1px solid rgba(255,255,255,0.05);
}

.footer-logo {
    height: 58px;
    width: auto;
    max-width: 90px;
    object-fit: contain;
    background: transparent;
    padding: 0;
    border-radius: 0;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.35));
}

.footer-brand-logo {
    width: auto;
    height: 58px;
    max-width: 74px;
    object-fit: contain;
    background: transparent;
    padding: 0;
    border-radius: 0;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.35));
}

.footer-contact {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.footer-contact-dialogue {
    font-size: 14px;
    color: #94a3b8;
    letter-spacing: 0.5px;
}

.footer-contact-phones {
    font-size: 13px;
    font-weight: 600;
    color: #38bdf8;
    font-family: 'Inter', sans-serif;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.custom-footer-right {
    width: 40%;
    background: linear-gradient(90deg, #0f172a 0%, #172554 100%);
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    justify-content: center;
    gap: 10px;
    padding: 2px 16px;
}

.footer-brand-text {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
}

.footer-version {
    font-size: 26px;
    font-weight: bold;
    color: #00ffff;
    line-height: 1;
}

.footer-slogan {
    font-size: 14px;
    font-weight: bold;
    color: #ffffff;
    text-decoration: underline;
    margin-top: 6px;
}

.login-header-tools {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.erp-voice-assistant-home {
    margin-left: 0;
    min-width: 0;
    flex: 1 1 auto;
    align-items: flex-start;
}

.erp-voice-assistant-home .ribbon-voice-assistant-live {
    max-width: 220px;
}

/* ── Modern Responsive Login Card ── */
.login-overlay {
    margin: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 750px;
    padding: 0px 10px;
    z-index: 100;
    box-sizing: border-box;
}

.login-card {
    display: flex;
    flex-direction: row;
    width: 100%;
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
    border: none;
    margin: auto;
    box-sizing: border-box;
}

.login-hero {
    flex: 1;
    background: linear-gradient(135deg, #0f172a 0%, #0369a1 50%, #0ea5e9 100%);
    color: white;
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}

.login-hero-compact-badge {
    display: none;
}

.login-hero-logo-large {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 178px;
    margin-top: 14px;
    padding: 8px;
    border: 1px solid rgba(255,255,255,0.28);
    border-radius: 18px;
    background: linear-gradient(145deg, rgba(255,255,255,0.18), rgba(255,255,255,0.07));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 18px 35px rgba(15,23,42,0.28);
    display: flex;
    align-items: stretch;
    justify-content: stretch;
}

.login-form-side {
    flex: 1;
    padding: 16px 24px;
    background: linear-gradient(145deg, #9fd3e2 0%, #bfe5ef 48%, #8dc8dc 100%);
    display: flex;
    flex-direction: column;
    box-shadow: inset 1px 0 0 rgba(14,165,233,0.28);
    box-sizing: border-box;
}

.login-form-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 6px;
}

.login-field-row {
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.login-field-label {
    flex: 0 0 80px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0;
}

.login-field-control {
    flex: 1;
    position: relative;
    min-width: 0;
}

.login-field-input {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    background: #fff;
    transition: border-color 0.2s;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.01);
    box-sizing: border-box;
}

.login-field-input:focus {
    border-color: #0ea5e9;
}

.login-remember-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
}

.login-btn-submit {
    width: 100%;
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    color: white;
    padding: 6px 16px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    font-family: inherit;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* ── Mobile Resolution Media Query (Image 1 Style) ── */
@media (max-width: 767.98px) {
    .custom-home-header {
        display: none !important;
    }

    .custom-home-footer {
        display: none !important;
    }

    .custom-home-flex {
        min-height: 100dvh;
    }

    .custom-home-body {
        flex: 1 1 auto;
    }

    .login-overlay {
        padding: 10px 8px !important;
        max-width: 440px !important;
        width: 100% !important;
    }

    .login-card {
        flex-direction: column !important;
        border-radius: 16px !important;
        box-shadow: 0 20px 40px rgba(0,0,0,0.3) !important;
        max-width: 100% !important;
    }

    .login-hero {
        flex: 0 0 auto !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 14px !important;
        padding: 14px 16px !important;
        background: linear-gradient(135deg, #091a32 0%, #026ca8 55%, #0284c7 100%) !important;
    }

    .login-hero-compact-badge {
        display: flex !important;
        width: 54px !important;
        height: 54px !important;
        min-width: 54px !important;
        background: #ffffff !important;
        border-radius: 12px !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 4px !important;
        box-shadow: 0 4px 12px rgba(0,0,0,0.25) !important;
        flex-shrink: 0 !important;
        box-sizing: border-box !important;
    }

    .login-hero-compact-badge img {
        width: 100% !important;
        height: 100% !important;
        object-fit: contain !important;
    }

    .login-hero-text {
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        min-width: 0 !important;
        flex: 1 1 auto !important;
    }

    .login-hero-text h1 {
        font-size: 20px !important;
        font-weight: 800 !important;
        line-height: 1.1 !important;
        margin: 0 !important;
        color: #ffffff !important;
    }

    .login-hero-text h1 span {
        font-size: 14px !important;
        font-weight: 600 !important;
        opacity: 0.95 !important;
    }

    .login-hero-text p {
        font-size: 9.5px !important;
        font-weight: 700 !important;
        letter-spacing: 0.8px !important;
        text-transform: uppercase !important;
        margin: 3px 0 0 0 !important;
        opacity: 0.9 !important;
        color: #e0f2fe !important;
    }

    .login-hero-text .login-hero-tagline {
        font-size: 11px !important;
        margin-top: 3px !important;
        opacity: 0.85 !important;
        line-height: 1.25 !important;
        color: #f0f9ff !important;
    }

    .login-hero-logo-large {
        display: none !important;
    }

    .login-form-side {
        flex: 1 1 auto !important;
        padding: 14px 16px 18px !important;
        background: #9fd3e2 !important;
        box-shadow: none !important;
    }

    .login-header-tools {
        display: none !important;
    }

    .login-form-title {
        font-size: 17px !important;
        font-weight: 800 !important;
        color: #0f172a !important;
        margin-bottom: 10px !important;
        line-height: 1.2 !important;
    }

    .login-field-row {
        gap: 10px !important;
        margin-bottom: 5px !important;
    }

    .login-field-label {
        flex: 0 0 76px !important;
        font-size: 12.5px !important;
        font-weight: 700 !important;
        color: #1e293b !important;
    }

    .login-field-input {
        padding: 5px 8px !important;
        height: 32px !important;
        font-size: 13px !important;
        font-weight: 600 !important;
        color: #0f172a !important;
    }

    .login-remember-row {
        margin-top: 6px !important;
        margin-bottom: 10px !important;
    }

    .login-btn-submit {
        width: 100% !important;
        background: #1d4ed8 !important;
        color: #ffffff !important;
        padding: 10px 16px !important;
        font-size: 15px !important;
        font-weight: 700 !important;
        border-radius: 8px !important;
        box-shadow: 0 4px 12px rgba(29, 78, 216, 0.35) !important;
    }
}

/* ── Restaurant Touch Login (OptionID 58 = 1, Image 3 Style) ── */
.rest-login-container {
    margin: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px;
    box-sizing: border-box;
    width: auto;
    max-width: 100%;
    z-index: 100;
}

.rest-login-frame {
    display: inline-flex;
    flex-direction: row;
    background: #d4d0c8;
    border: 3px ridge #ece9d8;
    box-shadow: 0 15px 35px rgba(0,0,0,0.35);
    padding: 6px;
    gap: 6px;
    width: auto;
    max-width: 95vw;
    box-sizing: border-box;
    font-family: Arial, "MS Sans Serif", sans-serif;
    position: relative;
}

.rest-keypad-panel {
    flex: 0 0 auto;
    width: 330px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.rest-pass-display-wrapper {
    position: relative;
    width: 100%;
    height: 70px;
    background-color: #ffff00;
    border: 2px solid #808080;
    border-radius: 7px;
    box-shadow: inset 1px 1px 3px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.rest-pass-display-input {
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    outline: none;
    text-align: center;
    font-size: 36px;
    font-weight: 700;
    color: #000080;
    letter-spacing: 4px;
    font-family: Arial, monospace;
}

.rest-keypad-grid {
    display: grid;
    grid-template-columns: repeat(3, 75px) 90px;
    grid-template-rows: repeat(4, 62px) 52px;
    gap: 3px;
    width: 100%;
}

.rest-btn-num {
    font-size: 26px !important;
    font-weight: 900 !important;
    font-family: "Arial Black", Arial, sans-serif !important;
}

.rest-btn-clear {
    grid-column: 4 !important;
    grid-row: 1 / span 2 !important;
    font-size: 20px !important;
    font-weight: 800 !important;
}

.rest-btn-ok {
    grid-column: 4 !important;
    grid-row: 3 / span 2 !important;
    font-size: 20px !important;
    font-weight: 800 !important;
}

.rest-btn-quit {
    grid-column: 1 / span 4 !important;
    grid-row: 5 !important;
    border: 1px solid rgba(153, 27, 27, 0.92) !important;
    border-radius: 7px !important;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.42) 0%, rgba(255, 255, 255, 0) 42%),
        linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    color: #ffffff !important;
    font-size: 20px !important;
    font-weight: 800 !important;
    text-shadow: 0 1px 0 rgba(127, 29, 29, 0.5) !important;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.68),
        inset 0 -2px 0 rgba(153, 27, 27, 0.38),
        0 3px 7px rgba(153, 27, 27, 0.22) !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    user-select: none !important;
    transition: transform 0.14s ease, filter 0.14s ease, box-shadow 0.14s ease !important;
}

.rest-btn-quit:hover {
    filter: brightness(1.08) !important;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.78),
        inset 0 -2px 0 rgba(153, 27, 27, 0.45),
        0 5px 12px rgba(153, 27, 27, 0.35) !important;
}

.rest-btn-quit:active {
    transform: translateY(1px) !important;
    box-shadow:
        inset 0 2px 5px rgba(153, 27, 27, 0.5),
        0 2px 5px rgba(153, 27, 27, 0.25) !important;
}

/* ── Dynamic Content/Header-driven Width Right Panel ── */
.rest-lists-panel {
    flex: 0 0 auto;
    width: auto;
    min-width: 200px;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-sizing: border-box;
}

.rest-box-section {
    border: 2px inset #ffffff;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box;
}

.rest-box-header {
    background: #e2e8f0;
    color: #000000;
    font-size: 16px;
    font-weight: 900;
    font-family: Arial, sans-serif;
    letter-spacing: 0.8px;
    padding: 4px 10px;
    border-bottom: 2px solid #808080;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    white-space: nowrap;
}

.rest-table-scroll {
    overflow-y: auto;
    max-height: 155px;
    min-height: 140px;
    background: #ffffff;
    width: 100%;
}

.rest-table {
    width: 100%;
    border-collapse: collapse;
}

.rest-table tr {
    border-bottom: 1px solid #d4d0c8;
    cursor: pointer;
    transition: background-color 0.1s;
}

.rest-table tr:hover {
    background-color: #eff6ff;
}

.rest-table tr.selected {
    background-color: #dbeafe !important;
}

.rest-table td {
    padding: 6px 12px;
    font-size: 17px;
    font-weight: 700;
    font-family: Arial, sans-serif;
    white-space: nowrap;
}

.rest-emp-name-admin {
    color: #000000;
}
.rest-emp-name-red {
    color: #b91c1c;
}
.rest-emp-name-blue {
    color: #0284c7;
}

.rest-branch-booth-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 4px;
    background: #f8fafc;
}

.rest-branch-list {
    max-height: 90px;
    overflow-y: auto;
    border: 1px solid #cbd5e1;
    background: #fff;
}

.rest-booth-list {
    max-height: 75px;
    overflow-y: auto;
    border: 1px solid #cbd5e1;
    background: #fff;
}

.rest-pill-item {
    padding: 4px 8px;
    font-size: 14px;
    font-weight: 700;
    color: #0284c7;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.rest-pill-item:hover {
    background-color: #eff6ff;
}

.rest-pill-item.selected {
    background-color: #0284c7 !important;
    color: #ffffff !important;
}

.rest-booth-item {
    color: #16a34a;
}

.rest-booth-item.selected {
    background-color: #16a34a !important;
    color: #ffffff !important;
}

@media (max-width: 767.98px) {
    .rest-login-frame {
        flex-direction: column !important;
    }
    .rest-keypad-grid {
        grid-template-rows: repeat(4, 52px) 46px;
    }
    .rest-pass-display-wrapper {
        height: 58px;
    }
    .rest-pass-display-input {
        font-size: 28px;
    }
}

/* Project Selection Modal */
#pbProjectSelectModal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.65);
    backdrop-filter: blur(4px);
    z-index: 10050;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
#pbProjectSelectModal .pb-project-dialog {
    width: 100%;
    max-width: 820px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    box-shadow: 0 25px 50px -12px rgba(15,23,42,0.35);
    overflow: visible !important;
}
#pbProjectSelectModal .pb-project-dialog-header {
    padding: 12px 18px;
    background: linear-gradient(135deg, #0f172a, #1e293b) !important;
    color: #ffffff !important;
    font-weight: 700;
    font-size: 15px;
    border-radius: 9px 9px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
#pbProjectSelectModal select#pbProjectSelectCombo {
    display: block !important;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    height: 40px !important;
    padding: 6px 12px !important;
    border: 1px solid #94a3b8 !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    background: #ffffff !important;
    color: #0f172a !important;
    appearance: auto !important;
    -webkit-appearance: menulist !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    position: static !important;
}
