/* =========================================================
   CREATIVITY BUSINESS SOLUTION - PHONE / TABLET LAYOUT
   All mobile layout rules live in this file.
========================================================= */

@media (max-width: 1100px) {
    .cbs-app-header {
        grid-template-columns: minmax(280px, 1fr) minmax(260px, 430px) auto;
    }
    .cbs-user-copy { display:none; }
    .cbs-kpi-grid { grid-template-columns:repeat(2, minmax(0, 1fr)); }
    .cbs-module-grid { grid-template-columns:repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
    :root { --cbs-header-height: 62px; --cbs-footer-height: 42px; }

    body { padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }

    .cbs-public-header { padding:0 12px; gap:10px; }
    .cbs-brand-copy small { display:none; }
    .cbs-public-nav { display:none; }
    .cbs-public-actions { margin-left:auto; }
    .cbs-public-signin { min-height:38px; padding:0 13px; }

    .cbs-public-main { padding:calc(var(--cbs-header-height) + 18px) 14px calc(var(--cbs-footer-height) + 18px); align-items:start; }
    .cbs-public-grid { grid-template-columns:1fr; gap:18px; }
    .cbs-login-card { order:-1; width:min(560px, 100%); margin:0 auto; }
    .cbs-public-intro { width:min(760px, 100%); margin:0 auto; }
    .cbs-public-intro h1 { font-size:clamp(34px, 8.5vw, 54px); }
    .cbs-public-preview { display:none; }

    .cbs-app-header {
        padding:0 10px;
        grid-template-columns:minmax(0, 1fr) auto;
        gap:8px;
    }
    .cbs-app-header-center { display:none; }
    .cbs-header-divider, .cbs-page-title { display:none; }
    .cbs-app-brand > span small { display:none; }
    .cbs-app-header-actions { gap:6px; }
    .cbs-notification-button { display:none; }
    .cbs-user-box { border:0; padding:0; background:transparent; }

    .cbs-sidebar {
        width:min(290px, calc(100vw - 48px));
        transform:translateX(-105%);
        box-shadow:12px 0 28px rgba(0,0,0,.18);
    }
    body.cbs-mobile-sidebar-open .cbs-sidebar { transform:translateX(0); }
    body.cbs-sidebar-collapsed .cbs-sidebar { width:min(290px, calc(100vw - 48px)); }
    body.cbs-sidebar-collapsed .cbs-nav-group-toggle span,
    body.cbs-sidebar-collapsed .cbs-nav-link span { display:inline; }
    body.cbs-sidebar-collapsed .cbs-nav-link { justify-content:flex-start; padding:0 11px; }
    body.cbs-sidebar-collapsed .cbs-nav-group-toggle { justify-content:space-between; min-height:32px; }
    body.cbs-sidebar-collapsed .cbs-nav-group-toggle .cbs-icon { width:15px; height:15px; }

    .cbs-sidebar-overlay {
        position:fixed;
        z-index:1150;
        inset:var(--cbs-header-height) 0 var(--cbs-footer-height) 0;
        display:block;
        pointer-events:none;
        opacity:0;
        background:rgba(0,0,0,.38);
        transition:opacity 150ms ease;
    }
    body.cbs-mobile-sidebar-open .cbs-sidebar-overlay { pointer-events:auto; opacity:1; }

    .cbs-app-main,
    body.cbs-sidebar-collapsed .cbs-app-main {
        margin-left:0;
        padding:calc(var(--cbs-header-height) + 14px) 12px calc(var(--cbs-footer-height) + 14px);
    }

    .cbs-dashboard-grid { grid-template-columns:1fr; }
    .cbs-page-head { align-items:flex-start; }

    .cbs-theme-panel { top:calc(var(--cbs-header-height) + 7px); right:8px; width:min(300px, calc(100vw - 16px)); }
}

@media (max-width: 560px) {
    html, body { font-size:14px; }
    input, select, textarea { font-size:16px !important; }

    .cbs-brand img { width:36px; height:36px; }
    .cbs-brand-copy strong { font-size:14px; }
    .cbs-public-signin { display:none; }

    .cbs-public-main { padding-left:10px; padding-right:10px; }
    .cbs-login-card { padding:18px 14px; border-radius:12px; }
    .cbs-login-heading { margin-bottom:18px; }
    .cbs-login-heading h2 { font-size:20px; }
    .cbs-feature-grid { grid-template-columns:1fr; }
    .cbs-public-note { align-items:flex-start; }

    .cbs-app-brand > span { display:none; }
    .cbs-app-header-actions .cbs-icon-button { width:38px; height:38px; }
    .cbs-user-avatar { width:34px; height:34px; }

    .cbs-page-head { display:block; }
    .cbs-page-actions { margin-top:10px; }
    .cbs-page-head h1 { font-size:22px; }
    .cbs-kpi-grid { grid-template-columns:1fr; gap:9px; }
    .cbs-kpi-card { min-height:100px; }
    .cbs-module-grid { grid-template-columns:1fr; }

    .cbs-public-footer,
    .cbs-app-footer { padding:0 10px; }
    .cbs-footer-secondary { display:none; }

    .cbs-toast { left:10px; right:10px; max-width:none; }
}

/* =========================================================
   CUSTOMERS LIST - TABLET / PHONE
========================================================= */

@media (max-width: 1000px) {
    .cbs-customer-toolbar { flex-wrap: wrap; }
    .cbs-customer-searchbox { width: 100%; flex: 1 1 100%; }
    .cbs-customer-toolbar-spacer { display: none; }
    .cbs-customer-result-meta { margin-left: auto; }
}

@media (max-width: 760px) {
    .cbs-customers-page-head .cbs-page-actions { display: flex; }

    .cbs-customer-list-card {
        border: 0;
        background: transparent;
        overflow: visible;
    }

    .cbs-customer-list-scroll { overflow: visible; }
    .cbs-customer-grid-header { display: none; }

    .cbs-customer-row {
        min-width: 0;
        min-height: 0;
        margin-bottom: 10px;
        padding: 0;
        display: grid;
        grid-template-columns: 72px minmax(0, 1fr);
        overflow: hidden;
        border: 1px solid var(--cbs-accent-border);
        border-radius: 12px;
        background: var(--cbs-surface);
    }

    .cbs-customer-row:nth-child(odd) { background: var(--cbs-surface); }

    .cbs-customer-cell {
        min-width: 0;
        padding: 11px 12px;
        border-right: 0;
        border-bottom: 1px solid var(--cbs-border-soft);
    }

    .cbs-customer-image-cell {
        grid-column: 1;
        grid-row: 1;
        align-items: center;
        justify-content: center;
        border-right: 1px solid var(--cbs-border-soft);
    }

    .cbs-customer-info-cell {
        grid-column: 2;
        grid-row: 1;
    }

    .cbs-customer-contact-cell,
    .cbs-customer-rep-cell,
    .cbs-customer-online-cell,
    .cbs-customer-order-cell,
    .cbs-customer-open-balance-cell {
        grid-column: 1 / -1;
        position: relative;
        padding-top: 28px;
        align-items: stretch;
        text-align: left;
    }

    .cbs-customer-cell[data-label]::before {
        content: attr(data-label);
        position: absolute;
        top: 9px;
        left: 12px;
        color: var(--cbs-accent);
        font-size: 9px;
        font-weight: 850;
        letter-spacing: .075em;
        text-transform: uppercase;
    }

    .cbs-customer-image-cell::before,
    .cbs-customer-info-cell::before { display: none; }

    .cbs-customer-open-balance-cell { border-bottom: 0; }
    .cbs-open-balance { width: min(180px, 100%); }
    .cbs-customer-open-balance-cell > small { text-align: left; }

    .cbs-customer-pager {
        border: 1px solid var(--cbs-accent-border);
        border-radius: 11px;
        grid-template-columns: 1fr 1fr;
        margin-top: 8px;
    }

    .cbs-customer-pager .cbs-pager-info {
        grid-column: 1 / -1;
        grid-row: 1;
    }

    .cbs-customer-pager .cbs-pager-button:first-child { grid-column: 1; grid-row: 2; }
    .cbs-customer-pager .cbs-pager-button:last-child { grid-column: 2; grid-row: 2; }
}

@media (max-width: 560px) {
    .cbs-customer-toolbar { padding: 8px; }
    .cbs-customer-toolbar .cbs-button { flex: 1 1 auto; min-height: 40px; padding: 0 12px; }
    .cbs-customer-result-meta { width: 100%; justify-content: center; margin-left: 0; }
    .cbs-customer-image { width: 56px; height: 56px; }
    .cbs-customer-row { grid-template-columns: 68px minmax(0, 1fr); }
    .cbs-customer-name { font-size: 14px; }
}

/* =========================================================
   SITE MASTER v8 RESPONSIVE OVERRIDES
========================================================= */
@media (max-width: 1250px) {
    .cbs-app-header { grid-template-columns:minmax(330px,1fr) minmax(280px,420px) auto; }
    .cbs-overview-kpis { grid-template-columns:repeat(3,minmax(0,1fr)); }
    .cbs-center-card-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
}

@media (max-width: 1000px) {
    .cbs-app-header { grid-template-columns:minmax(300px,1fr) minmax(240px,340px) auto; }
    .cbs-user-copy { display:none; }
    .cbs-user-box { min-width:0; padding:0; }
    .cbs-center-card-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

@media (max-width: 860px) {
    .cbs-app-header { grid-template-columns:minmax(0,1fr) auto; padding:0 10px; }
    .cbs-app-brand { min-width:0; }
    .cbs-header-page-copy { display:none; }
    .cbs-sidebar-stage { height:100%; }
    .cbs-sidebar-main { padding:12px 9px; }
    .cbs-center-panel { inset:0; }
    .cbs-center-links > a { min-height:58px; }
    .cbs-app-main { padding-top:calc(var(--cbs-header-height) + 12px); }
    .cbs-home-head { align-items:flex-start; }
    .cbs-home-filters { display:none; }
    .cbs-overview-kpis { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .cbs-dashboard-bottom { grid-template-columns:1fr; }
    .cbs-footer-right { display:none; }
}

@media (max-width: 620px) {
    .cbs-app-brand > span { display:none; }
    .cbs-app-header-left { gap:6px; }
    .cbs-app-header-actions > .cbs-icon-button:nth-of-type(2) { display:none; }
    .cbs-overview-kpis { grid-template-columns:1fr 1fr; gap:8px; }
    .cbs-overview-kpi { min-height:78px; padding:9px; grid-template-columns:36px 1fr; gap:8px; }
    .cbs-overview-kpi-icon { width:36px; height:36px; }
    .cbs-overview-kpi strong { font-size:15px; }
    .cbs-center-card-grid { grid-template-columns:1fr; gap:8px; }
    .cbs-dashboard-center-card { min-height:126px; }
    .cbs-home-dashboard { width:100%; }
    .cbs-footer-left .cbs-footer-divider, .cbs-footer-left > span:nth-of-type(2), .cbs-footer-left > span:nth-of-type(4) { display:none; }
}

@media (max-width: 420px) {
    .cbs-overview-kpis { grid-template-columns:1fr; }
    .cbs-app-header-actions .cbs-notification-button { display:none; }
    .cbs-center-panel-head { min-height:58px; }
    .cbs-center-links { padding:8px 7px; }
    .cbs-center-links > a { grid-template-columns:34px minmax(0,1fr); gap:8px; }
}

/* =========================================================
   CUSTOMER CENTER + TABBED DETAIL RESPONSIVE v20260830_15
========================================================= */
@media (max-width:1000px) {
    .cbs-standard-searchbox { width:100%; flex:1 1 100%; }
    .cbs-direct-toolbar { flex-wrap:wrap; }
    .cbs-five-kpis { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .cbs-split-workspace { grid-template-columns:1fr; }
    .cbs-trip-list-panel { max-height:320px; overflow:auto; }
    .cbs-detail-kpis { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .cbs-detail-info-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

@media (max-width:760px) {
    .cbs-standard-table-card { border:0; background:transparent; }
    .cbs-data-grid-header { display:none; }
    .cbs-data-grid-row { min-height:0; margin-bottom:9px; display:grid; grid-template-columns:1fr 1fr!important; overflow:hidden; border:1px solid var(--cbs-accent-border); border-radius:11px; background:var(--cbs-surface); }
    .cbs-data-grid-row:nth-child(even) { background:var(--cbs-surface); }
    .cbs-data-cell { position:relative; min-height:66px; padding:27px 11px 10px; border-right:0; border-bottom:1px solid var(--cbs-border-soft); }
    .cbs-data-cell[data-label]::before { content:attr(data-label); position:absolute; top:8px; left:11px; color:var(--cbs-accent); font-size:9px; font-weight:850; letter-spacing:.055em; text-transform:uppercase; }
    .cbs-data-number { align-items:flex-start; text-align:left; }
    .cbs-record-header { align-items:flex-start; }
    .cbs-record-actions { max-width:48%; }
    .cbs-detail-tabs { top:var(--cbs-header-height); }
    .cbs-inline-form-grid { grid-template-columns:1fr; }
    .cbs-inline-form-wide { grid-column:auto; }
}

@media (max-width:560px) {
    .cbs-five-kpis,.cbs-detail-kpis { grid-template-columns:1fr; }
    .cbs-data-grid-row { grid-template-columns:1fr!important; }
    .cbs-record-header { display:block; }
    .cbs-record-actions { max-width:none; margin-top:10px; justify-content:flex-start; }
    .cbs-record-copy strong { font-size:16px; }
    .cbs-detail-info-grid { grid-template-columns:1fr; }
    .cbs-detail-info-wide { grid-column:auto; }
    .cbs-customer-actions-cell { position:absolute; top:7px; right:7px; border:0; padding:0; }
    .cbs-customer-row { position:relative; }
    .cbs-row-menu-popover { position:fixed; top:auto; right:12px; left:12px; bottom:calc(var(--cbs-footer-height) + 10px); width:auto; }
}
@media (max-width:760px) {
    .cbs-customer-row { position:relative; }
    .cbs-customer-actions-cell { position:absolute; top:7px; right:7px; z-index:25; padding:0; border:0; }
}

/* =========================================================
   MOBILE TYPOGRAPHY ROLE LOCK v20260830_17
   Keep mobile page copy aligned with the same global type roles.
========================================================= */
@media (max-width:860px) {
    .cbs-nav-text,
    .cbs-center-links strong,
    .cbs-customer-name,
    .cbs-data-cell,
    .cbs-data-cell strong,
    .cbs-data-primary-link,
    .cbs-detail-tab,
    .cbs-record-copy strong {
        font-size:var(--cbs-font-primary);
    }

    .cbs-center-links small,
    .cbs-customer-secondary,
    .cbs-customer-contact-line,
    .cbs-row-customer-copy small,
    .cbs-data-cell small,
    .cbs-record-copy span {
        font-size:var(--cbs-font-secondary);
    }

    .cbs-customer-cell[data-label]::before,
    .cbs-data-cell[data-label]::before {
        font-size:var(--cbs-font-label);
    }

    .cbs-customer-image { width:52px; height:52px; }
    .cbs-customer-row { grid-template-columns:64px minmax(0,1fr); }
}

/* Full-height sidebar and header that begins at the rail edge. */
@media (max-width:1250px) {
    .cbs-app-body .cbs-app-header { grid-template-columns:minmax(0,1fr) auto; }
    .cbs-app-body .cbs-app-header-center { display:none; }
}
@media (max-width:1100px) {
    .cbs-app-body .cbs-user-copy { display:none; }
    .cbs-app-body .cbs-user-box { min-width:0; padding:0; }
}
@media (max-width:860px) {
    .cbs-app-body .cbs-app-header,body.cbs-sidebar-collapsed .cbs-app-header { left:0; padding:0 10px; gap:8px; }
    .cbs-app-body .cbs-mobile-menu-button { display:inline-flex; }
    .cbs-app-body .cbs-sidebar,body.cbs-sidebar-collapsed .cbs-sidebar { top:0; width:min(var(--cbs-sidebar-width),calc(100vw - 40px)); }
    .cbs-app-body .cbs-sidebar-overlay { z-index:1350; inset:0 0 var(--cbs-footer-height); background:rgba(0,0,0,.5); }
    .cbs-app-body.cbs-mobile-sidebar-open { overflow:hidden; }
    .cbs-app-body .cbs-sidebar-business { height:auto; min-height:128px; }
    .cbs-app-body .cbs-header-page-copy { display:block; min-width:0; }
    .cbs-app-body .cbs-page-subtitle { display:none; }
    .cbs-app-body .cbs-app-header-actions>[data-coming-soon] { display:none; }
    .cbs-app-body .cbs-nav-group-title { min-height:0; }
}
@media (max-width:420px) {
    .cbs-app-body .cbs-app-header-actions { gap:3px; }
    .cbs-app-body .cbs-app-header-actions .cbs-icon-button { width:34px; height:36px; }
    .cbs-app-body .cbs-page-title { font-size:var(--cbs-font-primary); }
}
