@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800&family=Tajawal:wght@400;500;700;800&display=swap');

/* ============================================================
   Oryx Control — design tokens (CSS-only refresh, additive)
   ============================================================ */
:root {
    --mes-bg: #e8f0f4;
    --mes-bg-deep: #d6e3ea;
    --mes-surface: #fbfdfe;
    --mes-surface-strong: #ffffff;
    --mes-panel: #f1f6f9;
    --mes-border: #c7d5de;
    --mes-border-strong: #9aaebb;
    --mes-heading: #101c28;
    --mes-ink: #1d2b36;
    --mes-text: #293945;
    --mes-muted: #5a6b78;
    --mes-label: #334552;
    --mes-link: #0b5f9c;
    --mes-primary: #126eac;
    --mes-primary-dark: #0b5f9c;
    --mes-success: #1c8d5a;
    --mes-danger: #c92f45;
    --mes-warning: #bd7f16;
    --mes-control: #65727c;
    --mes-shadow: 0 14px 32px rgba(45, 68, 83, .16);
    --mes-soft-shadow: 0 8px 20px rgba(45, 68, 83, .12);
    --mes-font: "Segoe UI", Tahoma, Arial, sans-serif;
    --mes-font-display: "Cairo", "Tajawal", "Segoe UI", Tahoma, Arial, sans-serif;
    --mes-font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

    --ink: var(--mes-ink);
    --ink-2: #263845;
    --surface: var(--mes-surface);
    --line: var(--mes-border);
    --paper: var(--mes-surface);
    --card: var(--mes-surface);
    --card-fg: var(--mes-ink);
    --oryx: var(--mes-primary);
    --run: var(--mes-success);
    --stop: var(--mes-danger);
    --attn: var(--mes-warning);
    --info: #2d6f8f;
    --radius: 8px;
    --shadow: var(--mes-shadow);
}

/* ============================================================
   ORIGINAL RULES (preserved verbatim — functional + layout)
   ============================================================ */
/* MAIN ELEMENTS */
html {
    height:100%;
}

body {
    /* background: url(https://barcodes-public.oss-ap-southeast-1.aliyuncs.com/mes/medias/home-menu-bg-overlay.svg), linear-gradient(to right bottom, #77717e, #c9a8a9); */
    /* background: url(https://barcodes-public.oss-ap-southeast-1.aliyuncs.com/mes/medias/home-menu-bg-overlay.svg), linear-gradient(to right bottom, #77717e, #c9a8a9); */
    /* background: url(https://mbcn-cdn-public.oss-cn-shenzhen.aliyuncs.com/public/SquaresMajorbird-3000x2000-v16-BC.jpg), linear-gradient(to right bottom, #77717e, #c9a8a9); */
    background: url(https://barcodes-public.oss-ap-southeast-1.aliyuncs.com/mes/medias/background-light.svg);
    background-color: #0e567e;
    overflow-x: hidden;
    background-size: cover;
    background-position: bottom center;
    height:100%;
    background-repeat: no-repeat;
}
html.home .card {
    background: rgba(255, 255, 255, 0.5);
    color: #333;
}
img.top-logo {
    width: 65px;
    display: inline !important;
    float:left;
    margin-right: 20px;
}
img.home-logo {
    width: 200px;
}
html.home .btn-light {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border:none;
}


.mb_content {
    padding-top: 62px;
}
.mb_mobile_form .form-row, .mb_mobile_form select, .mb_mobile_form input{
    font-size:10px;
    min-height:auto
}
.mb_mobile_form button{
    padding:0;
    width:100%;
}
/* CONTROLS */
.numeric-btn {
    width:100%;
    min-height:80px;
    font-weight: bold;
    font-size:  32px;
}
.mb_hardware_controlled {
    background-color: black!important;
    color:white!important;
    font-weight: bold;
}
.numeric_counter {
    background-color: black!important;
    color:red!important;
    font-weight: bold;
    padding:5px;
    text-transform: uppercase;
}
.numeric_counter.positive {
    color:greenyellow!important;
}
.numeric_counter.large {
    padding:10px;
    font-size:25px;
}
form .row {
    min-height: 80px;
}
.mobile_only {
    display:none
}
.invisible {
    display:none!important;
}

.mb_scan_history{
    overflow-y: scroll;
    max-height: 200px;
}
button.mb_big {
    width: 100%;
    min-height: 80px;
}

.mb_history button {
    min-height: auto;
}
h1 {
    color: #2c3067;
    margin-bottom: 30px;
}
.menu-big-choice {
    min-height:500px;
    width:100%;
    height:100%;
    padding-top:30%;
}
/* .menu-back-btn {
    float:right;
    width:100px;
} */
.menu-card {
    padding:10px;
}
.loading .not_mb_loader {
    display: none;
}
.not_loading .mb_loader {
    display: none
}
.loading .mb_loader {
    display: inline-block!important
}

button.selected,
button.selected:hover,
button.selected:focus {
    background-color: black;
}

button.qc_defect_size.selected {
    color: orange!important
}

.modal-footer {
    display: inline-block;
}

/* MOBILE */

@media (max-width:600px){
    h1 {
        font-size: 30px;
    }
    #input_free {
        display:none;
    }

    .mobile_only {
        display: block
    }
}

.row.mjb-feed {
    display: inline;
    margin-left: 10px;
}

/* ============================================================
   ENHANCEMENT LAYER (visual only — placed after originals so it
   wins on equal specificity; no selectors/ids/classes added)
   ============================================================ */

/* Type + workstation background */
body {
    color: var(--mes-text);
    font-family: var(--mes-font);
    font-size: 16px;
    line-height: 1.5;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, .34) 0 16%, transparent 16% 54%, rgba(255, 255, 255, .22) 54% 66%, transparent 66%),
        linear-gradient(rgba(255, 255, 255, .2) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .16) 1px, transparent 1px),
        linear-gradient(180deg, #e7eff3 0%, var(--mes-bg) 52%, var(--mes-bg-deep) 100%) fixed;
    background-size: 100% 100%, 28px 28px, 28px 28px, auto;
    background-color: var(--mes-bg);
    background-repeat: no-repeat;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

html {
    color: var(--mes-text);
}

* {
    box-sizing: border-box;
}

a {
    color: var(--mes-link);
}

a:hover,
a:focus {
    color: var(--mes-primary-dark);
}

input,
button,
select,
textarea {
    font-family: var(--mes-font);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--mes-heading);
    font-family: var(--mes-font-display);
    font-weight: 800;
    line-height: 1.25;
}

p,
li,
td,
th,
.card-body,
.modal-body
{
    color: var(--mes-text);
}

small,
.small,
.text-muted {
    color: var(--mes-muted)!important;
}

.container,
.container-fluid {
    padding-left: 24px;
    padding-right: 24px;
}

body#mb_recorder .container-fluid {
    min-height: 100%;
    padding-bottom: 24px;
}

img.top-logo,
img.home-logo {
    background: rgba(255, 255, 255, .88);
    border: 1px solid rgba(150, 169, 181, .5);
    border-radius: var(--radius);
    box-shadow: var(--mes-soft-shadow);
}

img.top-logo {
    padding: 5px;
}

img.home-logo {
    padding: 12px;
}

/* Main top titles: override legacy inline white titles for light mode. */
#head_menu,
#top-logo + h4,
#top-logo + h4 span {
    color: var(--mes-heading)!important;
    font-family: var(--mes-font-display);
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.35;
    letter-spacing: 0;
}

#top-logo + h4 {
    margin: 4px 0 0;
}

/* Solid light panels for shop-floor legibility. */
.card,
html.home .card {
    color: var(--mes-text);
    background: rgba(248, 251, 253, .94);
    border: 1px solid rgba(150, 169, 181, .68);
    border-radius: var(--radius);
    box-shadow: var(--mes-shadow);
}

.modal-content,
.toast {
    color: var(--mes-text);
    border: 1px solid var(--mes-border-strong);
    border-radius: var(--radius);
    box-shadow: 0 18px 44px rgba(23, 43, 57, .28);
}

.modal-header,
/* .toast-header, */
.card-header {
    background: linear-gradient(180deg, #ffffff, #e9f1f5);
    border-bottom-color: #ccd9e1;
}

.card h3,
.card h4,
.card h5,
.card h6,
.modal-content h3,
.modal-content h4,
.modal-content h5,
.modal-content h6 {
    color: var(--mes-heading);
}

.card label,
.form-group label,
.modal-content label {
    color: var(--mes-label);
    font-weight: 700;
    margin-bottom: .35rem;
}

.card-body {
    padding: 1.15rem;
}

.dy-form-card {
    color: var(--mes-text);
    font-family: var(--mes-font);
}

.dy-form-card label,
.dy-form-card .dy-form-label {
    color: var(--mes-label);
    font-family: var(--mes-font-display);
    font-size: .98rem;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: .35rem;
}

.dy-form-card .form-control {
    color: var(--mes-text);
    font-family: var(--mes-font);
}

.dy-action-button {
    font-family: var(--mes-font-display);
    font-weight: 800;
    letter-spacing: 0;
}

.menu-back-btn,
.nav-link,
.username,
.mb_binded,
.mb_logout_btn,
.mb_scan_ok_btn,
.mb_device_scan_btn {
    font-family: var(--mes-font-display);
}

.menu-back-btn,
.nav-link {
    font-weight: 800;
}

.username {
    color: var(--mes-muted);
    font-size: .92em;
    font-weight: 700;
}

.nav-link {
    color: var(--mes-muted);
    background: transparent;
    border: 1px solid transparent;
}

.nav-link:hover,
.nav-link:focus {
    color: var(--mes-primary-dark);
}

.nav-link.active {
    color: var(--mes-heading);
    background: #ffffff;
    border-color: var(--mes-border);
    box-shadow: var(--mes-soft-shadow);
}

.mb_binded,
.numeric-btn.mb_binded {
    font-family: var(--mes-font-display);
    font-weight: 800;
    letter-spacing: 0;
}

.dy-log-card {
    color: var(--mes-text);
    background: rgba(248, 251, 253, .94)!important;
    border: 1px solid rgba(150, 169, 181, .68)!important;
    box-shadow: var(--mes-shadow);
    font-family: var(--mes-font);
}

.dy-log-card h6,
.dy-log-card .mb_scan_history_description {
    font-family: var(--mes-font-display);
    color: #FFFFFF;
}

.dy-top-title,
.dy-top-title span,
.dy-modal-title,
.dy-modal-subtitle,
.dy-modal-label,
.dy-history,
.dy-history-entry,
.dy-history .mb_history_title,
.dy-history .mb_history_description,
.dy-history .mb_history_timestamp,
.dy-history .mb_history_ref,
.dy-history .mb_history_fromTo,
.dy-history .mb_history_meta,
.card label, .form-group label, .modal-content label,
.form-control
 {
    font-family: var(--mes-font-display);
}

.dy-top-title {
    color: var(--mes-heading)!important;
}

.dy-modal-title {
    color: var(--mes-heading);
    font-size: 1.7rem;
    font-weight: 800;
    line-height: 1.2;
}

.dy-modal-subtitle,
.dy-modal-label {
    color: var(--mes-label);
    font-size: .95rem;
    font-weight: 700;
}

.dy-history .mb_history_title {
    color: var(--mes-heading);
    font-size: 1rem;
    font-weight: 800;
}

.dy-history .mb_history_description {
    color: var(--mes-text);
    font-weight: 700;
}

.dy-history .mb_history_timestamp,
.dy-history .mb_history_ref,
.dy-history .mb_history_fromTo,
.dy-history .mb_history_meta {
    color: var(--mes-muted)!important;
    font-size: .9rem;
    font-weight: 500;
}

/* Page titles remain readable on the pale background. */
h1 {
    color: var(--mes-heading);
    letter-spacing: 0;
    text-shadow: none;
    font-weight: 800;
    line-height: 1.2;
    border-bottom: 1px solid rgba(150, 169, 181, .45);
    padding-bottom: 12px;
}

html.home h1 {
    border-bottom: 0;
}

/* Buttons: heavier touch targets with clear state colors. */
.btn {
    border-radius: var(--radius);
    font-weight: 700;
    letter-spacing: 0;
    border-width: 1px;
    box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .14);
    transition: transform .04s ease, box-shadow .12s ease, filter .12s ease, background-color .12s ease, border-color .12s ease;
}

.btn:hover {
    filter: brightness(1.04);
}

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

.btn-primary {
    background-color: var(--mes-primary);
    border-color: var(--mes-primary-dark);
    color: #fff;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--mes-primary-dark);
    border-color: #075a97;
    color: #fff;
}

.btn-success {
    background-color: var(--mes-success);
    border-color: #17834f;
    color: #fff;
}

.btn-danger {
    background-color: var(--mes-danger);
    border-color: #bd293d;
    color: #fff;
}

.btn-warning {
    background-color: var(--mes-warning);
    border-color: #9f6810;
    color: #fff;
}

.btn-secondary,
.numeric-btn.btn-secondary {
    background-color: var(--mes-control);
    border-color: #586671;
    color: #fff;
}

.btn-light,
html.home .btn-light,
.card .btn-light,
html.home .card .btn-light {
    background: #f7fbfd;
    color: var(--mes-heading);
    border: 1px solid #b8c9d3;
}

.btn-light:hover,
.btn-light:focus,
html.home .btn-light:hover,
html.home .btn-light:focus,
.card .btn-light:hover,
.card .btn-light:focus,
html.home .card .btn-light:hover,
html.home .card .btn-light:focus {
    background: #e8f3fa;
    color: var(--mes-heading);
}

/* Numeric keypad, inspired by the reference but not copied. */
.numeric-btn {
    min-height: 86px;
    border-radius: var(--radius);
    border: 1px solid #586671;
    background: var(--mes-control);
    color: #fff;
    font-size: 34px;
    font-weight: 800;
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18);
}

button.mb_big {
    border-radius: var(--radius);
}

.mb_numpad .row {
    min-height: 0;
}

/* Selected state stays unmistakable. */
button.selected,
button.selected:hover,
button.selected:focus {
    background-color: #142332;
    color: #fff;
    border-color: var(--mes-primary);
    box-shadow: 0 0 0 3px rgba(11, 127, 211, .32), inset 0 -2px 0 rgba(0, 0, 0, .2);
}

button.qc_defect_size.selected {
    color: #fff5c7!important;
}

/* Numeric readout remains an instrument display. */
.numeric_counter {
    font-family: var(--mes-font-mono);
    letter-spacing: 0;
    border-radius: var(--radius);
    border: 2px solid #142332;
    background: #142332!important;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, .65), 0 1px 0 rgba(255, 255, 255, .25);
    text-shadow: none;
}

.numeric_counter.positive {
    color: #68d985!important;
}

/* Visible keyboard focus. */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.form-control:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 3px solid rgba(11, 127, 211, .34);
    outline-offset: 2px;
}

.form-control:focus {
    border-color: var(--mes-primary);
    box-shadow: 0 0 0 .2rem rgba(11, 127, 211, .18);
}

/* Inputs: larger, clearer, and consistent with the H5 refresh. */
.form-control {
    min-height: 46px;
    color: var(--mes-text);
    background-color: var(--mes-surface-strong);
    border-color: #b8c9d3;
    border-radius: var(--radius);
    font-weight: 500;
    box-shadow: 0 1px 0 rgba(255, 255, 255, .8);
}

.form-control[readonly],
.form-control:disabled {
    background-color: #eef4f7;
    color: #405260;
}

.form-control::placeholder {
    color: #788894;
    opacity: 1;
}

select.form-control,
.custom-select {
    min-height: 46px;
}

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

/* Menu tiles feel tappable without turning sections into cards. */
.menu-card {
    border-radius: var(--radius);
    transition: transform .1s ease, box-shadow .12s ease, border-color .12s ease;
    overflow: hidden;
}

.menu-card:hover {
    transform: translateY(-2px);
    border-color: var(--mes-primary);
    box-shadow: 0 16px 34px rgba(36, 69, 90, .2);
}

.card-img-top {
    height: 180px;
    object-fit: cover;
    border-radius: 8px 8px 0 0;
    background: #d8e4ea;
}

.menu-card .card-body {
    background: linear-gradient(180deg, #ffffff, #f3f8fa);
    padding: .9rem;
}

.menu-card .card-title {
    color: var(--mes-heading);
    font-weight: 800;
    line-height: 1.35;
    margin-bottom: 0;
}

.menu-big-choice {
    min-height: 340px;
    height: auto;
    padding: 0 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: normal;
}

.menu-big-choice h3 {
    margin: 0;
    color: inherit;
    font-weight: 800;
    line-height: 1.25;
}

.mb_scan_history {
    border: 1px solid #c1d0d9;
    border-radius: var(--radius);
    background: #000000;
    padding: 8px;
}

.table {
    color: var(--mes-text);
    background: var(--mes-surface-strong);
    border: 1px solid #c1d0d9;
}

.table thead th {
    background: #e8f0f4;
    color: var(--mes-heading);
    border-bottom: 2px solid #bdccd5;
    font-weight: 800;
}

.table td,
.table th {
    border-color: #d2dfe6;
}

.alert {
    border-radius: var(--radius);
}

@media (max-width:600px) {
    body {
        background-size: 100% 100%, 22px 22px, 22px 22px, auto;
    }

    .container,
    .container-fluid {
        padding-left: 12px;
        padding-right: 12px;
    }

    .card-body {
        padding: .9rem;
    }

    .btn,
    button.mb_big {
        min-height: 48px;
    }

    .numeric-btn {
        min-height: 68px;
        font-size: 26px;
    }

    .card-img-top {
        height: 132px;
    }

    .menu-big-choice {
        min-height: 180px;
        padding: 0 12px;
    }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}
