/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   portal-mobile.css — Client portal mobile-first polish
   Registered after style.css so these rules cascade on top.
   Uses !important only where style.css specificity requires it.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

:root {
    --pm-blue:   #1a73e8;
    --pm-tap:    46px;
    --pm-radius: 14px;
}

/* ── No horizontal scroll on client pages ──────────────────────── */
body.customers { overflow-x: hidden; }

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   LOGIN PAGE  (body.customers_login)
   NOTE: navbar is intentionally NOT hidden — topbar links must
   remain visible on desktop. The nav collapses normally on mobile.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

/* Break the Bootstrap container constraints so auth-page can be
   full-viewport-width (alerts container is empty on login). */
body.customers_login #content > .container {
    max-width: 100% !important;
    width:     100% !important;
    padding:   0    !important;
    margin:    0    !important;
}
body.customers_login #content > .container > .row {
    margin-left:  0 !important;
    margin-right: 0 !important;
}

/* ── Auth page: full-width area with background image (desktop) ── */
.auth-page {
    min-height: calc(100vh - 60px - 50px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 16px;
    box-sizing: border-box;
    /* Dark navy overlay over the city photo */
    background:
        linear-gradient(135deg, rgba(13,37,71,.85) 0%, rgba(10,60,120,.55) 100%),
        url('../../../../media/background.jpg') center / cover no-repeat;
}

/* Mobile: plain soft background, no image, start near top */
@media (max-width: 767px) {
    .auth-page {
        background: #f0f2f5 !important;
        align-items: flex-start;
        padding: 18px 12px 28px;
        min-height: calc(100vh - 60px - 36px);
    }
}

/* ── Auth card: the white login box ────────────────────────────── */
.auth-card {
    width: 100%;
    max-width: 440px;
    background: #fff;
    border-radius: var(--pm-radius);
    padding: 36px 32px 28px;
    box-shadow: 0 10px 48px rgba(0,0,0,.30);
    box-sizing: border-box;
}

@media (max-width: 767px) {
    .auth-card {
        max-width: 100%;
        border-radius: 13px;
        padding: 26px 18px 22px;
        box-shadow: 0 3px 16px rgba(0,0,0,.09);
    }
}

/* ── Card heading ───────────────────────────────────────────────── */
.auth-form-heading {
    text-align: center;
    margin-bottom: 22px;
}
.auth-form-heading h2 {
    font-size:   1.18rem !important;
    font-weight: 700     !important;
    color:       #1a1a1a !important;
    margin:      0       !important;
    line-height: 1.3;
}
.auth-form-heading p {
    font-size: .81rem;
    color:     #999;
    margin:    5px 0 0;
}

/* ── Labels ─────────────────────────────────────────────────────── */
.auth-card .form-group label,
.auth-card label.control-label {
    font-size:     13px   !important;
    font-weight:   500    !important;
    color:         #444   !important;
    margin-bottom: 6px;
    display:       block;
}

/* ── Inputs: 46 px — override style.css height: 36px ────────────── */
body.customers_login .auth-card input[type="text"],
body.customers_login .auth-card input[type="password"],
body.customers_login .auth-card input[type="email"],
body.customers_login .auth-card input[type="tel"] {
    height:        var(--pm-tap)         !important;
    font-size:     15px                  !important;
    border-radius: 8px                   !important;
    border:        1.5px solid #e0e0e0   !important;
    padding:       10px 14px             !important;
    box-shadow:    none                  !important;
    line-height:   1                     !important;
    transition:    border-color .15s, box-shadow .15s;
}
body.customers_login .auth-card input[type="text"]:focus,
body.customers_login .auth-card input[type="password"]:focus,
body.customers_login .auth-card input[type="email"]:focus,
body.customers_login .auth-card input[type="tel"]:focus {
    border-color: var(--pm-blue)                    !important;
    box-shadow:   0 0 0 3px rgba(26,115,232,.13)    !important;
    outline:      none                              !important;
}

/* ── Bootstrap-select (language picker) ─────────────────────────── */
body.customers_login .auth-card .bootstrap-select > .btn {
    height:        var(--pm-tap)          !important;
    border-radius: 8px                    !important;
    border:        1.5px solid #e0e0e0    !important;
    font-size:     14px                   !important;
    box-shadow:    none                   !important;
    line-height:   calc(var(--pm-tap) - 4px) !important;
}

/* ── Submit / register buttons ──────────────────────────────────── */
.auth-card .btn-block {
    height:        var(--pm-tap);
    font-size:     15px;
    font-weight:   600;
    border-radius: 8px;
    margin-top:    8px;
    padding-top:   0;
    padding-bottom:0;
    line-height:   var(--pm-tap);
}

/* ── Remember-me checkbox ───────────────────────────────────────── */
.auth-card .checkbox { margin: 14px 0 4px; }
.auth-card .checkbox label {
    font-size:    13px;
    cursor:       pointer;
    padding-left: 0;
    display:      flex;
    align-items:  center;
    gap:          8px;
    min-height:   26px;
}
.auth-card .checkbox input[type="checkbox"] {
    position:     static;
    margin:       0;
    width:        17px;
    height:       17px;
    accent-color: var(--pm-blue);
    flex-shrink:  0;
}

/* ── Forgot-password link ───────────────────────────────────────── */
.auth-forgot {
    display:         block;
    text-align:      center;
    margin-top:      14px;
    font-size:       13px;
    color:           #aaa;
    text-decoration: none;
}
.auth-forgot:hover, .auth-forgot:focus {
    color:           var(--pm-blue);
    text-decoration: underline;
}

/* ── Login footer: minimal strip ────────────────────────────────── */
body.customers_login footer,
body.customers_login footer.footer {
    height:     auto       !important;
    padding:    10px 16px  !important;
    margin-top: 0          !important;
}
body.customers_login footer .copyright-footer {
    font-size:   .78rem !important;
    font-weight: normal !important;
    color:       #ccc   !important;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   GENERAL FOOTER (non-login)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
footer.footer {
    height:  auto             !important;
    padding: 14px 0 12px      !important;
}
footer.footer .copyright-footer {
    font-size:   .8rem  !important;
    font-weight: normal !important;
    color:       #aaa   !important;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   CARWASH APP TOPBAR — icon-only at very narrow widths
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
@media (max-width: 380px) {
    .cw-app-bar-actions a .cw-btn-lbl {
        display: none;
    }
    .cw-app-bar-actions a {
        padding:         0 8px;
        min-width:       40px;
        min-height:      40px;
        justify-content: center;
    }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   CARWASH DASHBOARD — action-circle tap targets (30→38 px)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.cw-order-btn {
    width:      38px !important;
    height:     38px !important;
    min-width:  38px !important;
    min-height: 38px !important;
    border-radius: 50%   !important;
    font-size:  .85rem   !important;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   FOCUS RINGS (accessibility)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(26,115,232,.45);
    outline-offset: 2px;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   MOBILE ALERTS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
@media (max-width: 767px) {
    .alert { border-radius: 10px; font-size: .9rem; }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   EASY REGISTRATION PAGE  (body.register-easy)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
body.register-easy #content > .container {
    max-width: 100% !important;
    width:     100% !important;
    padding:   0    !important;
    margin:    0    !important;
}
body.register-easy #content > .container > .row {
    margin-left:  0 !important;
    margin-right: 0 !important;
}

/* ── Customer type toggle ──────────────────────────────────────── */
.reg-type-toggle {
    display:        flex;
    gap:            8px;
    margin-bottom:  4px;
}
.reg-type-btn {
    flex:            1 1 0;
    display:         flex;
    align-items:     center;
    justify-content: center;
    gap:             6px;
    height:          44px;
    border:          1.5px solid #e0e0e0;
    border-radius:   10px;
    background:      #f8f9fa;
    color:           #555;
    font-size:       .88rem;
    font-weight:     500;
    cursor:          pointer;
    transition:      border-color .15s, background .15s, color .15s;
    padding:         0 12px;
    line-height:     1;
}
.reg-type-btn i { font-size: .9rem; }
.reg-type-btn:hover {
    border-color: var(--pm-blue);
    color:        var(--pm-blue);
    background:   #f0f4ff;
}
.reg-type-btn--active {
    border-color: var(--pm-blue) !important;
    background:   #e8f0fe       !important;
    color:        var(--pm-blue) !important;
    font-weight:  600            !important;
}

/* ── Lookup status area ────────────────────────────────────────── */
.reg-lookup-status {
    border-radius: 8px;
    padding:       10px 14px;
    font-size:     .88rem;
    line-height:   1.4;
    margin-bottom: 8px;
}
.reg-lookup-loading {
    color:      #888;
}
.reg-lookup-loading i { margin-right: 5px; }
.reg-lookup-success {
    color:        #1b5e20;
    background:   #e8f5e9;
    border-radius: 8px;
    padding:       10px 14px;
    display:       flex;
    align-items:   center;
    gap:           8px;
    font-size:     .9rem;
}
.reg-lookup-success i  { color: #43a047; font-size: 1.1rem; flex-shrink: 0; }
.reg-lookup-error {
    color:        #b71c1c;
    background:   #ffeaea;
    border-radius: 8px;
    padding:       10px 14px;
    display:       flex;
    align-items:   flex-start;
    gap:           8px;
    font-size:     .88rem;
}
.reg-lookup-error i { color: #e53935; font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   COMPANY / DATABASE SELECTOR — trigger button
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.portal-coy-btn {
    display:         inline-flex;
    align-items:     center;
    gap:             5px;
    background:      rgba(255,255,255,.13);
    border:          1px solid rgba(255,255,255,.25);
    border-radius:   8px;
    color:           #fff;
    font-size:       .82rem;
    font-weight:     500;
    padding:         0 10px;
    height:          38px;
    cursor:          pointer;
    line-height:     1;
    /* responsive: never crowds the navbar, never overflows viewport */
    min-width:       44px;
    max-width:       min(260px, calc(100vw - 160px));
    overflow:        hidden;
    flex-shrink:     0;
    transition:      background .15s, border-color .15s;
    margin-left:     8px;
    margin-top:      7px;
    margin-bottom:   7px;
}
.portal-coy-btn:hover,
.portal-coy-btn:focus {
    background:    rgba(255,255,255,.23);
    border-color:  rgba(255,255,255,.50);
    outline:       none;
}
.portal-coy-btn .coy-icon {
    font-size:   .85rem;
    opacity:     .85;
    flex-shrink: 0;
}
.portal-coy-btn .coy-name {
    overflow:      hidden;
    text-overflow: ellipsis;
    white-space:   nowrap;
    min-width:     0;
    flex:          1 1 auto;
}
.portal-coy-btn .coy-hint {
    font-size:   .72rem;
    opacity:     .75;
    font-weight: 400;
    white-space: nowrap;
    flex-shrink: 0;
}
.portal-coy-btn .coy-chevron {
    display:         flex;
    align-items:     center;
    justify-content: center;
    width:           20px;
    height:          20px;
    border-radius:   999px;
    background:      rgba(255,255,255,.18);
    font-size:       .72rem;
    flex-shrink:     0;
    opacity:         1;
}
/* Mobile: hide the "Салбар сонгох" hint, keep icon + name + chevron */
@media (max-width: 767px) {
    .portal-coy-btn .coy-hint { display: none; }
    .portal-coy-btn { max-width: min(220px, calc(100vw - 150px)); }
}
/* Very narrow (≤340px): hide name too, icon + chevron only */
@media (max-width: 340px) {
    .portal-coy-btn .coy-name  { display: none; }
    .portal-coy-btn { padding: 0 8px; }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   COMPANY / DATABASE SELECTOR — modal & backdrop
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.db-sel-backdrop {
    position:   fixed;
    inset:      0;
    background: rgba(0,0,0,.45);
    z-index:    1050;
    animation:  db-fade-in .15s ease;
}
.db-sel-modal {
    position:        fixed;
    inset:           0;
    z-index:         1051;
    display:         flex;
    align-items:     center;
    justify-content: center;
    padding:         20px 16px;
    box-sizing:      border-box;
    pointer-events:  none;
}
.db-sel-dialog {
    background:    #fff;
    border-radius: 16px;
    width:         100%;
    max-width:     520px;
    max-height:    80vh;
    display:       flex;
    flex-direction:column;
    box-shadow:    0 20px 60px rgba(0,0,0,.25);
    pointer-events:all;
    animation:     db-slide-up .2s ease;
    overflow:      hidden;
}
/* Mobile: bottom sheet */
@media (max-width: 767px) {
    .db-sel-modal {
        align-items:  flex-end;
        padding:      0;
    }
    .db-sel-dialog {
        max-width:     100%;
        border-radius: 20px 20px 0 0;
        max-height:    88vh;
        animation:     db-sheet-up .22s ease;
    }
}

/* ── Header ─────────────────────────────────────────────────── */
.db-sel-header {
    display:         flex;
    align-items:     flex-start;
    justify-content: space-between;
    padding:         20px 20px 14px;
    border-bottom:   1px solid #f0f0f0;
    flex-shrink:     0;
}
.db-sel-title {
    font-size:   1rem;
    font-weight: 700;
    color:       #1a1a1a;
    line-height: 1.3;
}
.db-sel-subtitle {
    font-size: .8rem;
    color:     #888;
    margin-top: 3px;
}
.db-sel-close {
    background:  none;
    border:      none;
    font-size:   1.4rem;
    line-height: 1;
    color:       #999;
    cursor:      pointer;
    padding:     0 0 0 12px;
    flex-shrink: 0;
    transition:  color .12s;
}
.db-sel-close:hover { color: #333; }

/* ── Search ──────────────────────────────────────────────────── */
.db-sel-search-wrap {
    position:    relative;
    padding:     12px 16px;
    flex-shrink: 0;
    border-bottom: 1px solid #f0f0f0;
}
.db-sel-search-icon {
    position:  absolute;
    left:      28px;
    top:       50%;
    transform: translateY(-50%);
    color:     #bbb;
    font-size: .85rem;
}
.db-sel-search {
    width:         100%;
    box-sizing:    border-box;
    height:        40px;
    border:        1.5px solid #e0e0e0;
    border-radius: 8px;
    padding:       0 14px 0 36px;
    font-size:     14px;
    color:         #333;
    outline:       none;
    transition:    border-color .15s, box-shadow .15s;
}
.db-sel-search:focus {
    border-color: var(--pm-blue);
    box-shadow:   0 0 0 3px rgba(26,115,232,.12);
}

/* ── List ────────────────────────────────────────────────────── */
.db-sel-list {
    overflow-y: auto;
    padding:    8px 0 12px;
    flex:       1 1 auto;
}
.db-sel-item {
    display:         flex;
    align-items:     center;
    gap:             13px;
    padding:         12px 20px;
    min-height:      64px;
    text-decoration: none;
    color:           #222;
    transition:      background .12s;
    cursor:          pointer;
    box-sizing:      border-box;
}
.db-sel-item:hover {
    background: #f5f7ff;
    color:      #222;
}
.db-sel-item--cur {
    background: #eef3ff;
}
.db-sel-item--cur:hover { background: #e4ecff; }

/* ── Avatar ──────────────────────────────────────────────────── */
.db-sel-avatar {
    width:           44px;
    height:          44px;
    border-radius:   12px;
    display:         flex;
    align-items:     center;
    justify-content: center;
    flex-shrink:     0;
}
.db-sel-avatar i {
    font-size: 1.15rem;
    color:     rgba(255,255,255,.92);
}

/* ── Info: column layout so badge sits under the name ────────── */
.db-sel-info {
    flex:           1 1 auto;
    min-width:      0;
    display:        flex;
    flex-direction: column;
    align-items:    flex-start;
    gap:            4px;
}
.db-sel-name {
    font-size:              .93rem;
    font-weight:            500;
    line-height:            1.35;
    /* allow up to 2 lines — readable for long Mongolian names */
    display:                -webkit-box;
    -webkit-line-clamp:     2;
    -webkit-box-orient:     vertical;
    overflow:               hidden;
    white-space:            normal;
    width:                  100%;
}
.db-sel-badge {
    font-size:   .72rem;
    font-weight: 600;
    color:       var(--pm-blue);
    background:  #e8f0fe;
    border-radius:4px;
    padding:     2px 6px;
    white-space: nowrap;
    align-self:  flex-start;
    flex-shrink: 0;
}
.db-sel-check {
    color:       var(--pm-blue);
    font-size:   .9rem;
    flex-shrink: 0;
    align-self:  center;
}

/* ── Empty state ─────────────────────────────────────────────── */
.db-sel-empty {
    text-align:  center;
    color:       #bbb;
    font-size:   .88rem;
    padding:     24px 20px;
}

/* ── Animations ──────────────────────────────────────────────── */
@keyframes db-fade-in  { from { opacity: 0 } to { opacity: 1 } }
@keyframes db-slide-up { from { opacity: 0; transform: translateY(16px) } to { opacity: 1; transform: none } }
@keyframes db-sheet-up { from { transform: translateY(100%) } to { transform: none } }

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   MAIN PORTAL SHARED — mobile UX improvements
   Scoped to body.customers so nothing leaks to admin.
   All rules use @media (max-width: 767px) unless noted.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

/* ── 1. NAVBAR / HEADER ──────────────────────────────────────── */
@media (max-width: 767px) {
    /* Logo: slimmer vertical padding, keep aligned */
    body.customers .navbar a.navbar-brand {
        padding:    12px 0 12px 0 !important;
        margin-top: 0 !important;
    }
    body.customers .navbar a.navbar-brand img {
        height:      30px !important;
        margin-left: 12px !important;
    }
    /* Logo-text fallback */
    body.customers .navbar-default .navbar-brand.logo-text {
        margin-top:  12px !important;
        margin-left: 12px !important;
        font-size:   18px !important;
    }
    /* Hamburger: larger tap area, subtle pill style */
    body.customers .navbar-toggle {
        margin-top:    10px !important;
        margin-bottom: 10px !important;
        margin-right:  10px !important;
        padding:       9px 11px !important;
        min-width:     42px;
        min-height:    42px;
        border-radius: 9px !important;
        background:    rgba(255,255,255,.12) !important;
        border:        1px solid rgba(255,255,255,.22) !important;
    }
    body.customers .navbar-toggle .icon-bar {
        width:         22px;
        height:        2px;
        border-radius: 2px;
    }
    body.customers .navbar-toggle .icon-bar + .icon-bar { margin-top: 5px; }
    /* Collapsed menu panel */
    body.customers .navbar-collapse.in,
    body.customers .navbar-collapse.collapsing {
        background:   rgba(0,0,0,.15);
        border-top:   1px solid rgba(255,255,255,.12) !important;
        padding-top:  4px !important;
        padding-bottom: 10px !important;
        max-height:   70vh;
        overflow-y:   auto;
        -webkit-overflow-scrolling: touch;
    }
    /* Nav links in collapsed menu: bigger tap target */
    body.customers .navbar-default .navbar-nav > li > a {
        line-height: 1.4 !important;
        padding:     12px 18px !important;
        font-size:   14px !important;
        min-height:  44px;
        display:     flex;
        align-items: center;
    }
    /* Profile avatar row */
    body.customers .navbar-nav > li.customers-nav-item-profile > .dropdown-toggle {
        padding:     10px 18px !important;
        display:     flex !important;
        align-items: center !important;
        gap:         10px !important;
    }
    body.customers .client-profile-image-small {
        width:  36px !important;
        height: 36px !important;
    }
    /* Dropdown menu items inside collapsed mobile nav */
    body.customers .navbar-default .navbar-nav .open .dropdown-menu > li > a {
        padding:     11px 26px !important;
        font-size:   14px !important;
        min-height:  42px;
        display:     flex;
        align-items: center;
        color:       rgba(255,255,255,.90) !important;
    }
    body.customers .navbar-default .navbar-nav .open .dropdown-menu > li > a:hover {
        background: rgba(255,255,255,.12) !important;
        color: #fff !important;
    }
    /* Login-style nav button (for guest pages) */
    body.customers .navbar-default .navbar-nav > li.customers-nav-item-login > a {
        margin:      10px 18px !important;
        line-height: 40px !important;
        padding:     0 16px !important;
        border-radius: 8px !important;
    }
}

/* ── 2. CUSTOMER TOP-SUBMENU (Calendar / Files strip) ───────── */
@media (max-width: 767px) {
    body.customers .submenu.customer-top-submenu {
        display:    flex !important;
        float:      none !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 0;
        margin-bottom: 14px !important;
        margin-top:    0 !important;
        padding-bottom: 2px;
        width: 100% !important;
    }
    body.customers .submenu.customer-top-submenu::-webkit-scrollbar { display: none; }
    body.customers .submenu.customer-top-submenu li {
        display:    inline-flex !important;
        margin-right: 0 !important;
        flex-shrink: 0;
    }
    body.customers .submenu.customer-top-submenu li a {
        font-size:     13px !important;
        padding:       8px 14px !important;
        border-radius: 20px;
        border:        1px solid #dde3ef;
        background:    #fff;
        color:         #555 !important;
        white-space:   nowrap;
        margin-right:  8px;
        display:       inline-flex;
        align-items:   center;
        gap:           5px;
        min-height:    36px;
        text-decoration: none;
    }
    body.customers .submenu.customer-top-submenu li a:hover,
    body.customers .submenu.customer-top-submenu li a:focus {
        color:        var(--pm-blue) !important;
        border-color: var(--pm-blue);
        background:   #f0f4ff;
    }
}

/* ── 3. PANEL / CARD SPACING ─────────────────────────────────── */
@media (max-width: 767px) {
    body.customers .panel_s {
        border-radius: 10px;
        margin-bottom: 14px !important;
    }
    body.customers .panel_s > .panel-body {
        padding: 14px !important;
    }
    body.customers .panel_s > .panel-heading {
        padding: 10px 14px !important;
        font-size: 14px !important;
    }
    /* Section-heading panels (title-only banner above content panel) */
    body.customers .panel_s.section-heading > .panel-body {
        padding:     10px 14px !important;
        display:     flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap:   wrap;
        gap:         6px;
    }
    body.customers .panel_s.section-heading .section-text {
        font-size:   1rem !important;
        margin:      0 !important;
        font-weight: 500;
    }
    /* View-account-statement link inside section-heading */
    body.customers .view-account-statement {
        font-size: .83rem !important;
        display:   inline-block;
    }
    /* Content container: tighter side gutters on phone */
    body.customers #content > .container {
        padding-left:  10px !important;
        padding-right: 10px !important;
    }
    body.customers #wrapper { padding-bottom: 12px; }
}

/* ── 4. TABLES — horizontal scroll (DataTables wrapper) ─────── */
@media (max-width: 767px) {
    /* DataTables auto-generates .dataTables_wrapper — make it scroll */
    body.customers .dataTables_wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    /* Table cell sizing: compact but readable on phone */
    body.customers .table > thead > tr > th,
    body.customers .table > tbody > tr > td {
        font-size:   12.5px !important;
        padding:     7px 8px !important;
        white-space: nowrap;
    }
    /* DataTables controls — layout */
    body.customers .dataTables_wrapper > .row:first-child {
        display:   flex;
        flex-wrap: wrap;
        gap:       8px;
        margin-bottom: 8px;
    }
    /* Search filter: full width */
    body.customers .dataTables_filter {
        float:      none !important;
        text-align: left !important;
        width:      100%;
    }
    body.customers .dataTables_filter label {
        width:       100%;
        display:     flex;
        align-items: center;
        gap:         8px;
        font-size:   13px !important;
    }
    body.customers .dataTables_filter input,
    body.customers .dataTables_filter input:focus {
        flex:          1 !important;
        width:         100% !important;
        height:        38px !important;
        border-radius: 8px !important;
        border:        1.5px solid #dde0e8 !important;
        font-size:     14px !important;
        padding:       0 12px !important;
        margin-left:   0 !important;
        box-shadow:    none !important;
        transition:    border-color .15s;
    }
    body.customers .dataTables_filter input:focus {
        border-color: var(--pm-blue) !important;
        box-shadow:   0 0 0 3px rgba(26,115,232,.10) !important;
    }
    /* Length select */
    body.customers .dataTables_length {
        float:     none !important;
        font-size: 13px !important;
    }
    body.customers .dataTables_length select {
        height:        34px !important;
        border-radius: 6px !important;
        font-size:     13px !important;
    }
    /* Info + pagination */
    body.customers .dataTables_info {
        font-size:   12px !important;
        padding-top: 4px !important;
        float:       none !important;
    }
    body.customers .dataTables_paginate {
        float:      none !important;
        text-align: left !important;
        margin-top: 8px !important;
    }
    body.customers .dataTables_paginate .paginate_button {
        min-width:   34px !important;
        min-height:  34px !important;
        line-height: 34px !important;
        padding:     0 8px !important;
        font-size:   13px !important;
        border-radius: 6px !important;
    }
}

/* ── 5. NAV TABS — horizontal scroll instead of full-width stack */
@media (max-width: 767px) {
    body.customers .nav-tabs {
        display:     flex !important;
        flex-wrap:   nowrap !important;
        overflow-x:  auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        margin-bottom: 14px !important;
        border-bottom: 2px solid #e4e5e7 !important;
        border-top:    none !important;
        padding-bottom: 0 !important;
        gap: 0;
    }
    body.customers .nav-tabs::-webkit-scrollbar { display: none; }
    body.customers .nav-tabs > li {
        width:      auto !important;   /* undo style.css width:100% */
        flex-shrink: 0;
    }
    body.customers .nav-tabs > li > a {
        white-space: nowrap;
        font-size:   13px !important;
        padding:     10px 13px !important;
    }
    body.customers .nav-tabs-flat li:first-child a {
        padding-left: 13px !important;
    }
}

/* ── 6. KNOWLEDGE BASE ─────────────────────────────────────────── */
@media (max-width: 767px) {
    /* Jumbotron search area: flush to edges, compact height */
    body.customers .kb-search-jumbotron {
        margin-top:    -12px !important;
        margin-left:   -10px !important;
        margin-right:  -10px !important;
        padding:       18px 14px 16px !important;
        border-radius: 0 !important;
        background:    #f0f2f8 !important;
        border-bottom: 1px solid #e0e4ee;
    }
    body.customers .kb-search-heading {
        font-size:     1.1rem !important;
        margin-bottom: 12px !important;
        font-weight:   700;
        line-height:   1.3;
    }
    /* Search input: taller, full width */
    body.customers .kb-search input[type="search"],
    body.customers .kb-search-input {
        height:        46px !important;
        font-size:     15px !important;
        padding-left:  14px !important;
        border-radius: 8px 0 0 8px !important;
    }
    body.customers .kb-search input[type="search"]:focus,
    body.customers .kb-search-input:focus {
        padding-left: 14px !important;
    }
    body.customers .kb-search button[type="submit"],
    body.customers .kb-search-button {
        height:        46px !important;
        padding:       0 16px !important;
        line-height:   46px !important;
        font-size:     14px !important;
        border-radius: 0 8px 8px 0 !important;
    }
    /* KB category list items */
    body.customers .article_group_wrapper {
        padding: 12px 14px !important;
    }
    body.customers .article_group_wrapper h4 {
        font-size:     .97rem !important;
        margin-bottom: 4px !important;
        line-height:   1.35;
    }
    body.customers .articles_list li {
        margin-bottom: 16px !important;
    }
    body.customers .kb-article {
        font-size: 14px !important;
        line-height: 1.65;
    }
}

/* ── 7. DASHBOARD / HOME ──────────────────────────────────────── */
@media (max-width: 767px) {
    /* Greeting */
    body.customers #greeting {
        font-size:     1.05rem !important;
        margin-bottom: 10px !important;
        margin-top:    2px !important;
    }
    /* Projects summary heading */
    body.customers .projects-summary-heading {
        font-size:     .97rem !important;
        margin-bottom: 8px !important;
    }
    /* Chart: cap height on small screens */
    body.customers #client-home-chart {
        max-height: 240px !important;
    }
    /* Invoice / payment stats row: horizontal scroll */
    body.customers .invoices-stats-wrapper,
    body.customers .panel_s .list-status {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    /* Year / currency selectors: full width on mobile */
    body.customers .section-client-dashboard .col-md-3 {
        padding-left:  0 !important;
        padding-right: 0 !important;
    }
    body.customers .section-client-dashboard .form-group select {
        width: 100%;
    }
}

/* ── 8. FORM CONTROLS (portal pages, not auth) ───────────────── */
/* Excludes .customers_login and .register-easy (already tuned above) */
@media (max-width: 767px) {
    body.customers:not(.customers_login):not(.register-easy) .form-control,
    body.customers:not(.customers_login):not(.register-easy) input[type="text"],
    body.customers:not(.customers_login):not(.register-easy) input[type="email"],
    body.customers:not(.customers_login):not(.register-easy) input[type="tel"],
    body.customers:not(.customers_login):not(.register-easy) input[type="search"],
    body.customers:not(.customers_login):not(.register-easy) input[type="password"] {
        height:    42px !important;
        font-size: 15px !important;
    }
    body.customers:not(.customers_login):not(.register-easy) textarea.form-control {
        height:    auto !important;
        font-size: 15px !important;
    }
    body.customers:not(.customers_login):not(.register-easy) select.form-control {
        height:    42px !important;
        font-size: 15px !important;
    }
    /* Horizontal form: stack label above input on mobile */
    body.customers .form-horizontal .control-label {
        text-align:     left !important;
        padding-bottom: 4px !important;
        font-weight:    500;
    }
    /* Form group spacing */
    body.customers .form-group { margin-bottom: 14px; }
}

/* ── 9. BUTTONS (portal pages) ──────────────────────────────── */
@media (max-width: 767px) {
    /* General portal button: minimum comfortable tap height */
    body.customers .btn:not(.btn-xs):not(.navbar-toggle):not(.close):not(.db-sel-close) {
        min-height: 38px;
        font-size:  13px;
    }
    /* ._buttons pattern: already full-width from style.css; reinforce */
    body.customers ._buttons .btn {
        margin-bottom: 6px !important;
    }
}

/* ── 10. MODALS on mobile ─────────────────────────────────────── */
@media (max-width: 767px) {
    .modal-dialog {
        margin: 8px !important;
    }
    .modal-content {
        border-radius: 12px !important;
    }
    .modal-header  { padding: 14px 16px !important; }
    .modal-body    { padding: 14px 16px !important; }
    .modal-footer  {
        padding:     10px 16px !important;
        display:     flex;
        flex-wrap:   wrap;
        gap:         8px;
    }
    .modal-footer .btn {
        flex:      1 1 auto;
        min-width: 100px;
    }
}

/* ── 11. INVOICE / ESTIMATE / PDF VIEW pages ─────────────────── */
@media (max-width: 767px) {
    /* Preview area: reduce side padding */
    body.customers .viewinvoice .panel-body,
    body.customers .viewestimate .panel-body {
        padding: 10px !important;
    }
    /* Status badge: don't float, stack below heading */
    body.customers .content-view-status {
        float:        none !important;
        display:      block;
        width:        fit-content;
        margin-left:  0 !important;
        margin-top:   8px;
        margin-bottom: 4px;
    }
    /* Action buttons on invoice/estimate: full-width stack */
    body.customers .preview-sticky-container .action-button,
    body.customers .preview-sticky-container .content-view-status {
        width:        100% !important;
        margin-bottom: 6px !important;
        text-align:   center;
    }
}

/* ── 12. PROFILE / CONTACTS PAGE ─────────────────────────────── */
@media (max-width: 767px) {
    body.customers .client-profile-image-thumb {
        width:  120px !important;
        height: 120px !important;
    }
    /* Profile info block */
    body.customers .media-body { word-break: break-word; }
}

/* ── 13. FOOTER (general portal pages) ──────────────────────── */
/* Already tuned in the footer section above; no additional rules needed */

/* ── 14. TICKETS / SUPPORT ───────────────────────────────────── */
@media (max-width: 767px) {
    body.customers .ticket-info p { font-size: 13.5px; }
    /* Open ticket form */
    body.customers form.dropzone {
        min-height: 80px;
    }
    body.customers .dropzone .dz-message {
        margin-top: 20px;
        font-size:  14px;
    }
}

/* ── 15. ANNOUNCEMENTS ───────────────────────────────────────── */
@media (max-width: 767px) {
    body.customers .announcement {
        font-size: 13.5px;
        line-height: 1.6;
    }
    body.customers .announcement small {
        font-size: 12px;
    }
}

/* ── 16. INVOICES — card list on mobile ─────────────────────── */
@media (max-width: 767px) {
    /* Stats grid: 2×2 instead of 4 stacked */
    body.customers .invoices-stats {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        margin-bottom: 14px;
    }
    body.customers .invoices-stats .col-md-3 {
        flex: 1 1 calc(50% - 5px);
        width: auto;
        padding: 0;
    }
    body.customers .invoices-stats .col-md-3 .row {
        background: #fff;
        border: 1px solid #e4eaf5;
        border-radius: 10px;
        padding: 10px 12px;
        margin: 0;
    }
    body.customers .invoices-stats .col-md-3 .row > [class*="col-"] {
        padding: 0;
    }
    body.customers .invoices-stats .stats-status {
        font-size: 12px;
        color: #888;
        margin-bottom: 2px;
    }
    body.customers .invoices-stats .stats-numbers {
        font-size: 18px;
        font-weight: 700;
        color: #1a1a1a;
        line-height: 1.2;
    }
    body.customers .invoices-stats .progress {
        height: 5px;
        border-radius: 999px;
        margin-top: 6px;
        margin-bottom: 0;
    }

    /* Hide table header */
    body.customers .table-invoices thead {
        display: none;
    }

    /* Table/tbody become block containers */
    body.customers .table-invoices,
    body.customers .table-invoices tbody {
        display: block;
        width: 100%;
    }

    /* Each row = a card */
    body.customers .table-invoices tbody tr {
        display: block;
        position: relative;
        background: #fff;
        border: 1px solid #e4eaf5;
        border-radius: 12px;
        padding: 14px 14px 12px;
        margin-bottom: 10px;
        box-shadow: 0 1px 4px rgba(0,0,0,.06);
    }

    /* All cells block by default */
    body.customers .table-invoices tbody td {
        display: block;
        border: none !important;
        padding: 0;
        white-space: normal;
    }

    /* Invoice number — large, links inherit color */
    body.customers .table-invoices .td-inv-number {
        font-size: 15px;
        font-weight: 700;
        padding-right: 100px;
        margin-bottom: 6px;
    }
    body.customers .table-invoices .td-inv-number a.invoice-number {
        color: #1a1a1a;
        text-decoration: none;
    }
    body.customers .table-invoices .td-inv-number a.invoice-number:active {
        color: #1a73e8;
    }

    /* Status badge — absolute top-right */
    body.customers .table-invoices .td-inv-status {
        position: absolute;
        top: 14px;
        right: 14px;
    }

    /* Amount — large, bold, separator */
    body.customers .table-invoices .td-inv-amount {
        font-size: 17px;
        font-weight: 700;
        color: #1a1a1a;
        padding-bottom: 8px;
        margin-bottom: 6px;
        border-bottom: 1px solid #f0f2f8 !important;
    }

    /* Date / duedate — label + value row */
    body.customers .table-invoices .td-inv-date,
    body.customers .table-invoices .td-inv-duedate {
        display: flex;
        justify-content: space-between;
        font-size: 12.5px;
        color: #555;
        padding: 2px 0;
    }
    body.customers .table-invoices .td-inv-date::before {
        content: attr(data-label);
        color: #999;
        margin-right: 8px;
        white-space: nowrap;
    }
    body.customers .table-invoices .td-inv-duedate::before {
        content: attr(data-label);
        color: #999;
        margin-right: 8px;
        white-space: nowrap;
    }

    /* Hide non-essential columns on mobile */
    body.customers .table-invoices .td-inv-natus,
    body.customers .table-invoices .td-inv-posname,
    body.customers .table-invoices .td-inv-orderstatus {
        display: none;
    }

    /* Wrap DataTables pagination/filter normally */
    body.customers .dataTables_wrapper .dataTables_filter {
        text-align: left;
    }
}

/* ── 17. INVOICE TABLE — DataTables ajax overrides ──────────── */
/* DataTables manages search/pagination; Section 16 card CSS handles mobile layout */

@media (max-width: 767px) {
    /* DataTables wraps table in .dataTables_wrapper + inner .table-responsive.
       On mobile, .table-invoices is display:block (card layout) — no x-scroll needed. */
    body.customers #client-invoices-table_wrapper .table-responsive {
        overflow-x: visible;
        border: none;
        margin-bottom: 0;
    }
    /* Processing spinner centred over cards */
    body.customers #client-invoices-table_processing {
        border-radius: 8px;
        font-size: 13px;
        padding: 8px 18px;
        background: rgba(255, 255, 255, .92);
        box-shadow: 0 2px 8px rgba(0, 0, 0, .10);
    }
}
