/* MCT CRM Release 06 - mobile-first enhancements, without altering desktop screens. */
.mobile-top-brand,.mobile-bottom-nav,.mobile-lead-cards,.mobile-appointment-cards,.mobile-setup-card { display:none; }
.mobile-install-banner[hidden],.mobile-scrim[hidden] { display:none!important; }
.mobile-install-banner { display:none; }
@media (max-width: 760px) {
    html { scroll-padding-bottom: 115px; -webkit-text-size-adjust:100%; }
    body { min-width: 320px; }
    body.mobile-drawer-open { overflow:hidden; }
    button,a,select,input,textarea { -webkit-tap-highlight-color:transparent; }
    .main-column { min-height:100dvh; }
    .topbar { height:66px; min-height:66px; position:sticky; top:0; z-index:25; padding:0 12px;
              background:rgba(255,255,255,.97); box-shadow:0 3px 15px rgba(33,64,82,.045); }
    .mobile-menu-button { flex:none; width:42px; height:42px; border-radius:12px; padding:10px; gap:5px; }
    .mobile-menu-button span { width:100%; }
    .mobile-top-brand { display:inline-flex; align-items:center; gap:6px; color:#3f3d3f; font-size:13px; font-weight:850;
                        white-space:nowrap; letter-spacing:.04em; margin-inline-start:2px; }
    .mobile-top-brand img { width:34px; height:34px; border-radius:8px; object-fit:contain; }
    .mobile-top-brand strong { color:#3096ba; }
    .topbar-spacer { flex:1; }
    .topbar-actions { gap:5px; }
    .topbar-actions .currency-pill { display:none; }
    .language-switch { padding:2px; }
    .language-button { min-width:36px; min-height:35px; padding:7px; font-size:11px; }
    .user-avatar { width:31px; height:31px; }
    .user-chip { gap:0; }
    .logout-button { font-size:11px; max-width:none; }
    .sidebar { z-index:65; width:min(82vw,310px); padding:18px 14px 30px; box-shadow:0 12px 38px rgba(16,39,55,.18); }
    /* Prevent an off-canvas sidebar from remaining visible or clickable in RTL/LTR. */
    .sidebar:not(.is-open) { visibility:hidden; pointer-events:none; }
    .sidebar.is-open { visibility:visible; pointer-events:auto; }
    .sidebar-brand { min-height:120px; }
    .sidebar-logo { max-width:210px; }
    .mobile-scrim:not([hidden]) { display:block; position:fixed; inset:0; background:rgba(21,40,53,.46); z-index:60; }
    .main-content { width:100%; padding:22px 14px calc(115px + env(safe-area-inset-bottom,0px)); }
    .page-heading { gap:14px; margin-bottom:20px; }
    .page-heading h1 { font-size:clamp(24px,6.5vw,32px); line-height:1.25; overflow-wrap:anywhere; }
    .page-heading p { font-size:13px; }
    .heading-meta { gap:8px; }
    .heading-meta .scope-pill { flex-basis:100%; }
    .page-actions { gap:8px; }
    .page-actions > a { flex:1 1 auto; min-height:44px; text-align:center; justify-content:center; }
    .page-actions > a.primary-button { margin:0; }
    .primary-button,.secondary-action { min-height:45px; font-size:13px; }
    .stats-grid { gap:11px; grid-template-columns:repeat(2,minmax(0,1fr)); }
    .stat-card { min-height:123px; padding:15px 12px; border-radius:15px; }
    .stat-top { gap:7px; font-size:12px; }
    .stat-icon { flex:none; }
    .stat-value { font-size:32px; }
    .stat-foot { font-size:11px; }
    .info-grid { grid-template-columns:minmax(0,1fr); }
    .info-card { border-radius:15px; min-height:100px; }
    .content-card { border-radius:15px; margin-top:15px; }
    .section-heading { min-height:66px; gap:8px; }
    .section-heading h2 { font-size:15px; }
    .data-table { min-width:575px; }
    .table-wrap { overflow-x:auto; -webkit-overflow-scrolling:touch; }
    .lead-list-card .table-wrap { display:none; }
    .mobile-lead-cards { display:grid; gap:10px; padding:14px; }
    .mobile-lead-card { border:1px solid #e4edf2; border-radius:13px; padding:15px; background:linear-gradient(135deg,#fff,#fbfdff); }
    .mobile-lead-top { display:flex; gap:8px; justify-content:space-between; align-items:center; }
    .mobile-lead-top strong { font-size:15px; color:#334d5c; overflow-wrap:anywhere; }
    .mobile-lead-phone { display:inline-block; margin-top:12px; color:#227ca1; font-size:17px; font-weight:750; direction:ltr; text-decoration:none; }
    .mobile-lead-meta { display:flex; flex-wrap:wrap; gap:8px 12px; color:#81919c; font-size:11px; margin:11px 0; }
    .mobile-appointment-cards { display:grid; gap:10px; padding:13px; }
    .mobile-appointment-card { padding:15px; border:1px solid #e3edf2; border-radius:13px; background:#fff; }
    .mobile-appointment-card strong { font-size:14px; color:#344f5d; display:block; margin:6px 0; }
    .mobile-appointment-card p { font-size:12px; color:#677f8d; margin:4px 0 12px; overflow-wrap:anywhere; }
    .mobile-appointment-date { color:#2a8eb1; font-size:12px; font-weight:800; }
    .mobile-appointment-cards + * { margin-top:10px; }
    .mobile-upcoming-section > .table-wrap { display:none; }
    .mobile-lead-open { display:flex; justify-content:space-between; gap:12px; padding-top:12px;
                        border-top:1px solid #edf3f6; color:#2684a9; font-size:13px; font-weight:750; }
    .is-rtl .mobile-lead-open span { transform:scaleX(-1); }
    .notification-entry { padding:16px; }
    .notification-entry form { width:100%; }
    .notification-entry form button { width:100%; }
    .push-enable-panel .panel-padding { padding:16px; }
    .push-control-row { flex-direction:column; gap:9px; }
    .push-control-row button { width:100%; }
    .mobile-setup-card { display:block; margin-top:0; margin-bottom:16px; }
    .mobile-setup-content { padding:15px; }
    .mobile-setup-content p { font-size:12px; line-height:1.75; color:#687e8b; margin:5px 0; }
    .mobile-setup-content .mobile-device-guide { color:#3a6b80; background:#f0f9fe; padding:10px 12px; border-radius:10px; }
    .mobile-setup-content .mobile-setup-live-status { color:#3b738a; font-weight:650; }
    #mobile-setup-install { width:100%; }
    .mobile-install-banner:not([hidden]) { display:flex; align-items:flex-start; flex-direction:column; gap:12px; border:1px solid #bfe9fb;
                                           border-radius:15px; background:#eaf9ff; margin:15px 14px 0; padding:15px; }
    .mobile-install-copy strong { color:#345368; font-size:14px; }
    .mobile-install-copy p { margin:6px 0 0; color:#5d7a8c; font-size:12px; line-height:1.7; }
    .mobile-install-copy .mobile-install-guide { color:#42718a; }
    .mobile-install-actions { display:flex; gap:10px; width:100%; }
    .mobile-install-button { background:#8ad7f8; color:#224d5e; font-weight:800; border:0; min-height:43px; border-radius:10px; flex:1; }
    .mobile-install-dismiss { border:1px solid #d0e7ef; background:#fff; color:#648394; border-radius:10px; padding:0 14px; }
    .mobile-bottom-nav { display:grid; position:fixed; bottom:0; inset-inline:0; z-index:35; grid-template-columns:repeat(5,minmax(0,1fr));
                          min-height:71px; padding:7px 3px calc(7px + env(safe-area-inset-bottom,0px));
                          background:rgba(255,255,255,.98); border-top:1px solid #e2ebf0; box-shadow:0 -4px 22px rgba(32,65,85,.065); }
    .mobile-nav-link { position:relative; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px;
                       min-width:0; color:#85929b; font-size:10px; font-weight:720; text-align:center; padding:3px 1px; border-radius:12px; }
    .mobile-nav-link span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:100%; }
    .mobile-nav-link svg { fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; width:22px; height:22px; }
    .mobile-nav-link.is-current { color:#177fa6; }
    .mobile-nav-link.is-current::before { content:""; position:absolute; top:-7px; width:30px; height:3px; border-radius:0 0 6px 6px; background:#53c3ee; }
    .mobile-nav-create .mobile-nav-plus { display:grid; place-items:center; width:39px; height:39px; margin-top:-14px; border-radius:13px;
                                           box-shadow:0 4px 10px rgba(34,150,192,.16); background:#8ad7f8; color:#23566c; font-size:28px; font-weight:450; }
    .mobile-nav-count { position:absolute; top:2px; inset-inline-end:6px; background:#cf5c58; color:#fff; border-radius:20px; min-width:16px; padding:1px 3px; font-size:9px; }
    .page-footer { display:none; }
    .login-body { min-height:100dvh; padding:68px 13px 24px; background:linear-gradient(155deg,#e7f7fd,#f5f8fa 45%,#fff); }
    .login-form-panel { padding:25px 20px 35px; }
    .login-layout { max-width:450px; border-radius:19px; box-shadow:0 15px 45px rgba(40,67,82,.10); }
    .login-mobile-logo-wrap { margin-bottom:10px; }
    .login-mobile-logo { width:min(100%,255px); }
    .login-form input { min-height:50px; font-size:16px; }
    .login-form label { font-size:13px; }
    .login-card h1 { font-size:24px; }
    .form-card { margin-top:0; }
    .form-field .field-control { min-height:46px; font-size:16px; }
    .form-actions { flex-direction:column; align-items:stretch; }
    .form-actions button,.form-actions a { width:100%; }
    .detail-grid { padding:8px 17px 19px; }
    .detail-grid > div strong { font-size:14px; }
    .pagination-row { flex-wrap:wrap; }
    .broadcast-preview { overflow-wrap:anywhere; }
}
@media (max-width:370px) {
    .mobile-top-brand { font-size:11px; }
    .mobile-top-brand img { width:28px; height:28px; }
    .language-button { min-width:32px; padding:5px; }
    .logout-button { padding:6px 3px; }
}
@media (prefers-reduced-motion:reduce) {
    .sidebar { transition:none; }
}

/* Release 06.2: mobile-width containment and compact header. Desktop is unchanged. */
@media (max-width:760px) {
    /* In RTL as well as LTR, no child can expand the entire phone canvas. */
    html, body { width:100%; max-width:100%; overflow-x:clip; }
    .app-shell, .main-column { width:100%; min-width:0; max-width:100%; }
    .main-content { width:100%; min-width:0; max-width:100%; }
    .page-heading, .page-heading > div, .heading-meta, .page-actions,
    .stats-grid, .info-grid, .content-card, .table-wrap, .section-heading,
    .info-card, .mobile-install-banner, .mobile-install-copy { min-width:0; max-width:100%; }
    .page-heading h1, .page-heading p, .info-card p, .section-heading h2,
    .section-heading p { overflow-wrap:anywhere; }
    .topbar { gap:8px; min-width:0; width:100%; max-width:100%; }
    .mobile-menu-button { flex:0 0 42px; }
    .mobile-top-brand { flex:0 1 auto; min-width:0; max-width:100%; }
    .mobile-top-brand span { overflow:hidden; text-overflow:ellipsis; }
    .topbar-spacer { min-width:0; flex:1 1 0; }
    .topbar-actions { flex:0 0 auto; min-width:0; max-width:calc(100% - 92px); gap:4px; }
    .language-switch { flex:none; }
    .logout-form, .logout-button { flex:0 0 auto; }
    .mobile-install-banner:not([hidden]) { width:calc(100% - 28px); max-width:calc(100% - 28px); }
    .mobile-install-copy { width:100%; }
    .mobile-install-actions { min-width:0; flex-wrap:wrap; }
    .mobile-install-actions > button { min-width:0; overflow-wrap:anywhere; }
    /* Wide legacy tables are never allowed to grow the page. */
    .table-wrap { width:100%; max-width:100%; overflow-x:auto; overscroll-behavior-x:contain; }
    .content-card { width:100%; }
    #recent-leads > .table-wrap { display:none; }
}
@media (max-width:540px) {
    /* The avatar remains accessible through the navigation; don't crowd the phone bar. */
    .topbar .user-chip { display:none; }
}
@media (max-width:430px) {
    /* Preserve the original MCT app mark, while saving space for both languages and logout. */
    .mobile-top-brand span { display:none; }
    .mobile-top-brand img { width:30px; height:30px; }
    .topbar { gap:7px; }
    .language-button { min-width:32px; padding:6px; }
    .logout-button { padding:7px 3px; font-size:10px; }
}
