/* =========================================================
   CCHAP Layout Restructuring v2
   Structural UI composition only. Business logic is untouched.
   ========================================================= */

:root {
    --cchap2-gap-xs: .5rem;
    --cchap2-gap-sm: .75rem;
    --cchap2-gap: 1rem;
    --cchap2-card-pad: .9rem;
    --cchap2-border: #dce8e2;
    --cchap2-green: #0b7a58;
    --cchap2-green-dark: #064b38;
    --cchap2-surface: #fff;
    --cchap2-soft: #f5faf7;
}

/* Global composition: content follows content height; no decorative fillers. */
body.cchap-ui.portal-ui-v3 main,
body.cchap-ui.portal-ui-v3 main section,
body.cchap-ui.portal-ui-v3 main article,
body.cchap-ui.portal-ui-v3 main .content-card,
body.cchap-ui.portal-ui-v3 main .metric-card {
    min-height: 0;
}

body.cchap-ui.portal-ui-v3 main .content-card,
body.cchap-ui.portal-ui-v3 main .order-form-section,
body.cchap-ui.portal-ui-v3 main fieldset.content-card {
    height: auto;
}

body.cchap-ui.portal-ui-v3 main .dashboard-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    row-gap: var(--cchap2-gap-sm);
}

body.cchap-ui.portal-ui-v3 main .dashboard-heading h1,
body.cchap-ui .overview-hero h1 {
    margin-bottom: 0;
}

body.cchap-ui.portal-ui-v3 main .content-card > :last-child,
body.cchap-ui.portal-ui-v3 main .content-card > div:last-child > :last-child {
    margin-bottom: 0;
}

/* Shared compact information grids. */
.cchap-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .55rem .9rem;
}
.cchap-info-grid > div {
    min-width: 0;
    padding: .55rem .65rem;
    border: 1px solid var(--cchap2-border);
    border-radius: .7rem;
    background: var(--cchap2-soft);
}
.cchap-info-grid dt,
.cchap-info-grid span:first-child {
    color: #667a72;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .045em;
}
.cchap-info-grid dd,
.cchap-info-grid strong {
    display: block;
    margin: .15rem 0 0;
    overflow-wrap: anywhere;
    color: #17342a;
    font-size: .88rem;
    font-weight: 700;
}

.cchap-summary-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .65rem;
    margin-bottom: 1rem;
}
.cchap-summary-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    min-width: 0;
    padding: .7rem .8rem;
    border: 1px solid var(--cchap2-border);
    border-radius: .8rem;
    background: var(--cchap2-surface);
    box-shadow: 0 4px 14px rgba(6, 61, 45, .05);
}
.cchap-summary-item span {
    color: #5e746b;
    font-size: .76rem;
    font-weight: 700;
}
.cchap-summary-item strong {
    color: var(--cchap2-green-dark);
    font-size: 1.12rem;
    line-height: 1;
}

/* ADMIN DASHBOARD: two-column analytics composition from the CCHAP review. */
body.cchap-ui .dashboard-analytics-panel {
    display: grid;
    grid-template-columns: 1fr;
    gap: .65rem;
}
body.cchap-ui .dashboard-analytics-heading {
    margin: 0;
}
body.cchap-ui .dashboard-analytics-main {
    display: grid;
    grid-template-columns: minmax(0, 2.15fr) minmax(250px, .72fr);
    gap: .7rem;
    align-items: stretch;
}
body.cchap-ui .dashboard-analytics-left {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: .65rem;
    min-width: 0;
}
body.cchap-ui .dashboard-request-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .65rem;
    width: 100%;
    margin: 0;
}
body.cchap-ui .dashboard-request-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    min-height: 0;
}
body.cchap-ui .dashboard-request-card > div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: .75rem;
    align-items: center;
}
body.cchap-ui .dashboard-request-card small {
    grid-column: 1 / -1;
}
body.cchap-ui .dashboard-request-card strong {
    min-width: 0;
    overflow-wrap: anywhere;
}
body.cchap-ui .dashboard-request-card span:not(.dashboard-request-icon) {
    white-space: nowrap;
}
body.cchap-ui .dashboard-demand-trend-panel,
body.cchap-ui .dashboard-forecast-panel {
    height: auto;
    min-height: 0;
}
body.cchap-ui .dashboard-demand-trend-panel {
    min-width: 0;
}
body.cchap-ui .dashboard-forecast-panel {
    display: flex;
    flex-direction: column;
    align-self: stretch;
    height: 100%;
    min-width: 0;
}
body.cchap-ui .dashboard-forecast-heading {
    flex: 0 0 auto;
    margin-bottom: .4rem;
}
body.cchap-ui .dashboard-forecast-history-control {
    display: grid;
    grid-template-columns: 1fr;
    gap: .3rem;
    flex: 0 0 auto;
    margin: 0 0 .5rem;
    padding: .5rem .55rem;
    border: 1px solid #dfe9e5;
    border-radius: 10px;
    background: #fbfdfc;
}
body.cchap-ui .dashboard-forecast-history-control .form-label {
    margin: 0;
    color: #315c4f;
    line-height: 1.2;
}
body.cchap-ui .dashboard-forecast-history-control .form-select,
body.cchap-ui .dashboard-forecast-history-control .btn {
    min-height: 2rem;
}
body.cchap-ui .dashboard-forecast-values {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: repeat(4, minmax(0, 1fr));
    align-content: stretch;
    flex: 1 1 auto;
    gap: .4rem;
    margin-top: 0;
    min-height: 0;
}
body.cchap-ui .dashboard-forecast-value {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .7rem;
    min-height: 0;
    padding: .5rem .6rem;
}
body.cchap-ui .dashboard-forecast-value strong {
    margin: 0;
    font-size: 1.08rem;
    white-space: nowrap;
}
body.cchap-ui .dashboard-forecast-unit {
    display: inline !important;
    margin: 0 !important;
    color: #6f817a !important;
    font-size: .66rem !important;
    font-weight: 700;
    white-space: nowrap;
}
body.cchap-ui .dashboard-audit-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .25rem .9rem;
}
body.cchap-ui .dashboard-audit-item {
    min-width: 0;
    padding: .4rem 0;
}

/* ORDER INBOX / REPORTS: one compact filter row and summary row. */
body.cchap-ui .order-filter-panel {
    padding: .8rem .9rem;
}
body.cchap-ui .order-filter-panel > .cchap-filter-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: .7rem;
}
body.cchap-ui .order-filter-panel > .cchap-filter-heading h2 {
    margin: .15rem 0 0;
    font-size: 1rem;
}
body.cchap-ui .order-filter-panel > .cchap-filter-heading p {
    display: none;
}
body.cchap-ui .cchap-order-filter-grid {
    display: grid;
    grid-template-columns: minmax(135px, .8fr) minmax(150px, 1fr) minmax(105px, .65fr) minmax(210px, 1.4fr) auto;
    gap: .65rem;
    align-items: end;
}
body.cchap-ui .cchap-order-filter-grid > div {
    width: auto;
    max-width: none;
}
body.cchap-ui .order-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .65rem;
    margin-bottom: .9rem !important;
}
body.cchap-ui .order-summary-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    min-height: 0;
    padding: .65rem .75rem;
}
body.cchap-ui .order-summary-card span {font-size: .74rem;}
body.cchap-ui .order-summary-card strong {font-size: 1.1rem; white-space: nowrap;}
body.cchap-ui .order-summary-card small {display: none;}
body.cchap-ui .order-inbox-table tbody td {padding-block: .48rem;}

/* Generic report center: compress filter area and move table upward. */
body.cchap-ui .report-page .report-filter-card form.row,
body.cchap-ui .report-page .report-filter-primary-row .row {
    --bs-gutter-x: .65rem;
    --bs-gutter-y: .65rem;
}
body.cchap-ui .report-page .report-active-filters {margin-top: .65rem !important;}
body.cchap-ui .report-page .report-metric-card {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    column-gap: .55rem;
    padding: .65rem .7rem !important;
}
body.cchap-ui .report-page .report-metric-card .metric-icon {grid-row: 1 / span 2;}
body.cchap-ui .report-page .report-metric-card p {margin: 0;}
body.cchap-ui .report-page .report-metric-card strong {font-size: 1.1rem;}

/* PRODUCTION SCHEDULE: counts are status indicators, not full cards. */
body.cchap-ui .queue-status-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .55rem;
    margin: 0 0 .9rem;
}
body.cchap-ui .queue-status-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .65rem;
    padding: .6rem .75rem;
    border: 1px solid var(--cchap2-border);
    border-radius: .75rem;
    background: #fff;
}
body.cchap-ui .queue-status-pill span {
    color: #5e746b;
    font-size: .78rem;
    font-weight: 700;
}
body.cchap-ui .queue-status-pill strong {
    color: var(--cchap2-green-dark);
    font-size: 1rem;
}
body.cchap-ui .queue-page .content-card {margin-bottom: .9rem !important;}
body.cchap-ui .queue-page .content-card > .d-flex:first-child {align-items: center !important;}
body.cchap-ui .queue-page .content-card .table-responsive {margin-top: .65rem !important;}

/* ADMIN ORDER REVIEW: compact review toolbar and independent column heights. */
body.cchap-ui .order-review-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: .7rem;
    padding: .75rem .85rem !important;
}
body.cchap-ui .order-review-toolbar h2 {margin: .1rem 0 .1rem; font-size: 1rem;}
body.cchap-ui .order-review-toolbar p {margin: 0; font-size: .8rem;}
body.cchap-ui .order-review-date {
    padding: .5rem .65rem;
    border: 1px solid #cde2d7;
    border-radius: .7rem;
    background: #f4faf7;
    white-space: nowrap;
}
body.cchap-ui .order-review-date strong {display:block; font-size: 1rem;}
body.cchap-ui .order-review-actions {
    display: flex;
    gap: .45rem;
    flex-wrap: wrap;
}
body.cchap-ui .admin-order-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(285px, .72fr);
    gap: .9rem;
    align-items: start;
}
body.cchap-ui .admin-order-layout > * {min-width: 0;}
body.cchap-ui .admin-order-main,
body.cchap-ui .admin-order-side {
    display: grid;
    gap: .75rem;
    align-content: start;
}
body.cchap-ui .admin-order-layout .content-card {margin: 0 !important;}
body.cchap-ui .admin-order-layout .order-detail-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 .9rem;
    margin-top: .65rem;
}
body.cchap-ui .admin-order-layout .order-detail-list > div {
    display: grid;
    grid-template-columns: minmax(115px, .8fr) minmax(0, 1.2fr);
    gap: .5rem;
    padding: .48rem 0;
}
body.cchap-ui .admin-order-layout .estimate-breakdown {gap: 0;}
body.cchap-ui .admin-order-layout .estimate-breakdown > div {padding: .52rem 0;}
body.cchap-ui .queue-summary-card .order-detail-list {
    grid-template-columns: 1fr;
}
body.cchap-ui .admin-queue-inline {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem .9rem;
    padding: .25rem 0 .65rem;
}
body.cchap-ui .admin-queue-inline > span {font-size: .8rem; color: #5d7169;}
body.cchap-ui .admin-queue-inline strong {color: #17342a;}

/* NOTIFICATIONS: a row, not a large card. */
body.cchap-ui .notifications-card {padding: .45rem !important;}
body.cchap-ui .notification-list {display: grid; gap: .35rem;}
body.cchap-ui .notification-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: .65rem;
    min-height: 0;
    padding: .6rem .65rem !important;
    border: 1px solid #e4ece8;
    border-radius: .75rem;
    background: #fff;
}
body.cchap-ui .notification-item.unread {background: #f5fbf8; border-color: #cfe7db;}
body.cchap-ui .notification-icon {width: 2rem; height: 2rem; font-size: .85rem;}
body.cchap-ui .notification-content h2 {margin: 0; font-size: .9rem;}
body.cchap-ui .notification-content time {font-size: .68rem; color:#7a8d85;}
body.cchap-ui .notification-content p {margin: .15rem 0 .4rem; font-size: .8rem; line-height: 1.35;}
body.cchap-ui .notifications-page > .container-fluid > .d-flex.mb-4 {margin-bottom: .7rem !important;}

/* CHAT: one-line composer with image button, text field, send button. */
body.cchap-ui .customer-chat-card {display:flex; flex-direction:column; min-height:0;}
body.cchap-ui .customer-chat-stream {flex:1 1 auto;}
body.cchap-ui .customer-chat-composer.cchap-chat-composer {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: end;
    gap: .5rem;
    padding: .65rem .75rem !important;
    border-top: 1px solid var(--cchap2-border);
    background: #fff;
}
body.cchap-ui .cchap-chat-attach {
    display: inline-grid;
    place-items: center;
    width: 2.45rem;
    height: 2.45rem;
    padding: 0;
    border: 1px solid #cfe0d8;
    border-radius: .7rem;
    color: var(--cchap2-green);
    background: #f7fbf9;
    cursor: pointer;
}
body.cchap-ui .cchap-chat-attach:hover {background:#edf8f2;}
body.cchap-ui .cchap-chat-attach input {position:absolute; width:1px; height:1px; opacity:0; pointer-events:none;}
body.cchap-ui .cchap-chat-message-wrap {min-width:0;}
body.cchap-ui .cchap-chat-message-wrap textarea {
    min-height: 2.45rem !important;
    max-height: 7rem;
    resize: vertical;
}
body.cchap-ui .cchap-chat-file-name {
    display:block;
    grid-column: 2 / 4;
    margin-top: -.25rem;
    overflow:hidden;
    color:#6b7f77;
    font-size:.7rem;
    text-overflow:ellipsis;
    white-space:nowrap;
}

/* SERVICE MANAGEMENT: image, title, stats and actions form one compact unit. */
body.cchap-ui .service-management-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .8rem;
}
body.cchap-ui .service-management-grid > * {min-width:0;}
body.cchap-ui .service-admin-card {
    display: grid !important;
    grid-template-rows: auto auto auto auto;
    align-content: start;
    height: auto !important;
    padding: .75rem !important;
    border-radius: .95rem;
}
body.cchap-ui .service-admin-image {
    height: auto !important;
    aspect-ratio: 16 / 9;
    margin: 0 0 .65rem !important;
    border-radius: .75rem !important;
}
body.cchap-ui .service-admin-meta {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: .6rem;
}
body.cchap-ui .service-admin-meta h2 {margin:.12rem 0 .25rem; font-size:1rem;}
body.cchap-ui .service-admin-meta p {
    margin:0;
    color:#667a72;
    font-size:.78rem;
    line-height:1.35;
}
body.cchap-ui .service-stats {
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:.35rem;
    margin:.65rem 0;
}
body.cchap-ui .service-stats span {
    padding:.4rem .35rem;
    border-radius:.55rem;
    background:#f4faf7;
    text-align:center;
    font-size:.68rem;
}
body.cchap-ui .service-stats strong {display:block; font-size:.84rem;}
body.cchap-ui .service-admin-actions {display:flex; gap:.4rem; margin-top:0 !important;}
body.cchap-ui .service-admin-actions .btn {min-height:2.15rem;}

/* CLIENT MANAGEMENT: identity + metadata become one compact header. */
body.cchap-ui .client-profile-card.cchap-client-header {
    display: grid;
    grid-template-columns: minmax(220px, .8fr) minmax(0, 2.2fr);
    align-items: center;
    gap: .8rem 1rem;
    padding: .8rem !important;
}
body.cchap-ui .cchap-client-header .client-profile-header {
    padding:0;
    border:0;
}
body.cchap-ui .cchap-client-header .client-profile-grid {
    grid-template-columns: repeat(4,minmax(0,1fr));
    margin:0;
}
body.cchap-ui .client-history-filter-card {padding:.8rem !important;}
body.cchap-ui .client-history-filter-card > .d-flex {margin-bottom:.65rem !important; align-items:center !important;}
body.cchap-ui .client-history-filter-card form {
    display:grid;
    grid-template-columns:minmax(130px,.75fr) minmax(120px,.65fr) minmax(105px,.55fr) minmax(220px,1.5fr);
    gap:.65rem;
}
body.cchap-ui .client-history-filter-card form > div {width:auto; max-width:none;}
body.cchap-ui .client-history-summary {grid-template-columns:repeat(4,minmax(0,1fr)); margin-bottom:.8rem !important;}
body.cchap-ui .client-history-summary article {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:.65rem;
}
body.cchap-ui .client-history-summary strong {margin:0; font-size:1.05rem;}

/* SETTINGS: grouped sections share one responsive grid rather than full-width stacks. */
body.cchap-ui .settings-groups-grid {
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:.8rem;
    align-items:start;
}
body.cchap-ui .settings-groups-grid .content-card {margin:0 !important; padding:.85rem !important;}
body.cchap-ui .settings-groups-grid .content-card h2 {margin-bottom:.65rem; font-size:1rem;}
body.cchap-ui .settings-groups-grid textarea[rows="6"] {min-height:7rem;}
body.cchap-ui .settings-groups-grid textarea[rows="4"] {min-height:5.4rem;}
body.cchap-ui .settings-actions {display:flex; justify-content:flex-end; margin-top:.8rem;}

/* CLIENT ORDERING / SERVICE CONFIGURATOR: horizontal composition first. */
body.cchap-ui .service-configurator {align-items:start;}
body.cchap-ui .service-configurator__main {display:grid; gap:.75rem;}
body.cchap-ui .service-picker-group {margin:0;}
body.cchap-ui .service-picker-group .row {--bs-gutter-x:.65rem;--bs-gutter-y:.65rem;}
body.cchap-ui .service-estimate-panel {height:auto !important; min-height:0 !important;}
body.cchap-ui .service-estimate-panel .estimate-total {font-size:1.8rem; margin:.35rem 0 .65rem;}
body.cchap-ui .order-form-section .section-title-row {margin-bottom:.75rem;}
body.cchap-ui .order-form-section .row.g-4 {--bs-gutter-x:.75rem;--bs-gutter-y:.75rem;}

/* LASER MATERIALS: denser responsive grid without removing information. */
body.cchap-ui .laser-material-grid {grid-template-columns:repeat(4,minmax(0,1fr)); gap:.65rem;}
body.cchap-ui .laser-material-card__image {aspect-ratio:4/3; height:auto;}
body.cchap-ui .laser-material-card__body {padding:.7rem !important;}
body.cchap-ui .laser-material-card__body p {min-height:0 !important;}

/* CUSTOMER ORDERS HUB: compact tabs and cards. */
body.cchap-ui .customer-order-hub-tabs .nav-link {padding:.55rem .7rem; font-size:.82rem;}
body.cchap-ui .customer-orders-hub > .container-fluid > .content-card.p-2 {padding:.4rem !important; margin-bottom:.8rem !important;}
body.cchap-ui .customer-order-card,
body.cchap-ui .customer-quotation-card,
body.cchap-ui .customer-queue-card {
    height:auto !important;
    padding:.8rem !important;
    border-radius:.85rem;
}
body.cchap-ui .order-card-details {
    grid-template-columns:repeat(4,minmax(0,1fr));
    gap:.45rem;
    margin:.7rem 0;
}
body.cchap-ui .order-card-details > div {padding:.5rem .55rem;}
body.cchap-ui .quotation-total {font-size:1.55rem;}
body.cchap-ui .queue-number {font-size:1.45rem; margin:.2rem 0 .4rem;}

/* SPECIFIC CUSTOMER ORDER DETAILS: compact header, timeline, 2-column body, inline schedule. */
body.cchap-ui .order-details-page .dashboard-heading {
    padding:.75rem .85rem;
}
body.cchap-ui .order-details-page .dashboard-heading p {margin-bottom:0;}
body.cchap-ui .order-status-timeline-card,
body.cchap-ui .order-status-card {padding:.75rem !important;}
body.cchap-ui .order-timeline {padding:.2rem 0 .35rem;}
body.cchap-ui .timeline-step {gap:.35rem;}
body.cchap-ui .timeline-step > span {width:1.7rem;height:1.7rem;}
body.cchap-ui .timeline-step::before {top:.84rem;}
body.cchap-ui .order-overview-grid {
    display:grid;
    grid-template-columns:minmax(0,1.65fr) minmax(280px,.75fr);
    gap:.8rem;
    align-items:start;
}
body.cchap-ui .order-overview-grid > * {min-width:0;}
body.cchap-ui .order-specifications-grid {
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:.45rem .7rem;
}
body.cchap-ui .order-specifications-grid > div {padding:.45rem .5rem;}
body.cchap-ui .order-pricing-card {height:auto; align-self:start;}
body.cchap-ui .order-queue-card {
    grid-column:1 / -1;
    display:grid;
    grid-template-columns:auto minmax(0,1fr) auto;
    align-items:center;
    gap:.7rem;
    padding:.7rem .8rem !important;
}
body.cchap-ui .order-queue-card .order-card-heading {display:contents;}
body.cchap-ui .order-queue-card .order-card-heading > div {min-width:150px;}
body.cchap-ui .order-queue-details {
    display:flex;
    align-items:center;
    flex-wrap:wrap;
    gap:.45rem .9rem;
    margin:0;
}
body.cchap-ui .order-queue-details > div {display:flex; gap:.35rem; align-items:baseline;}
body.cchap-ui .order-queue-details dt {font-size:.7rem;color:#6d8078;}
body.cchap-ui .order-queue-details dd {margin:0;font-size:.8rem;font-weight:700;}

/* PROFILE/SECURITY: preserve two columns and eliminate unused card height. */
body.cchap-ui .dashboard-page .row.g-4 > [class*="col-lg-"] > .content-card {height:auto !important;}

/* Public/auth pages: reduce bulk but preserve established visual identity. */
body.cchap-ui.portal-ui-v3 .auth-card form {gap:.7rem !important;}
body.cchap-ui.portal-ui-v3 .auth-card .mb-4 {margin-bottom:.85rem !important;}

/* Responsive restructuring. */
@media (max-width: 1399.98px) {
    body.cchap-ui .service-management-grid {grid-template-columns:repeat(3,minmax(0,1fr));}
    body.cchap-ui .laser-material-grid {grid-template-columns:repeat(3,minmax(0,1fr));}
}

@media (max-width: 1199.98px) {
    body.cchap-ui .dashboard-analytics-main {grid-template-columns:minmax(0,1.75fr) minmax(220px,.7fr);}
    body.cchap-ui .admin-order-layout {grid-template-columns:minmax(0,1.35fr) minmax(260px,.8fr);}
    body.cchap-ui .client-profile-card.cchap-client-header {grid-template-columns:1fr;}
    body.cchap-ui .cchap-client-header .client-profile-grid {grid-template-columns:repeat(2,minmax(0,1fr));}
    body.cchap-ui .cchap-order-filter-grid {grid-template-columns:repeat(4,minmax(0,1fr));}
    body.cchap-ui .cchap-order-filter-grid .cchap-filter-reset {grid-column:4; justify-self:end;}
    body.cchap-ui .client-history-filter-card form {grid-template-columns:repeat(4,minmax(0,1fr));}
}

@media (max-width: 991.98px) {
    body.cchap-ui .dashboard-analytics-main,
    body.cchap-ui .admin-order-layout,
    body.cchap-ui .order-overview-grid {grid-template-columns:1fr;}
    body.cchap-ui .dashboard-forecast-panel {height:auto;}
    body.cchap-ui .dashboard-forecast-values {grid-template-columns:repeat(2,minmax(0,1fr)); grid-template-rows:repeat(2,minmax(0,1fr));}
    body.cchap-ui .order-queue-card {grid-column:auto; grid-template-columns:1fr; align-items:start;}
    body.cchap-ui .order-queue-card .order-card-heading {display:flex;}
    body.cchap-ui .dashboard-audit-list {grid-template-columns:1fr;}
    body.cchap-ui .service-management-grid,
    body.cchap-ui .laser-material-grid {grid-template-columns:repeat(2,minmax(0,1fr));}
    body.cchap-ui .settings-groups-grid {grid-template-columns:1fr;}
    body.cchap-ui .admin-order-layout .order-detail-list {grid-template-columns:1fr;}
}

@media (max-width: 767.98px) {
    .cchap-summary-row,
    body.cchap-ui .queue-status-strip,
    body.cchap-ui .order-summary-grid,
    body.cchap-ui .client-history-summary {grid-template-columns:repeat(2,minmax(0,1fr));}
    body.cchap-ui .cchap-order-filter-grid,
    body.cchap-ui .client-history-filter-card form {grid-template-columns:repeat(2,minmax(0,1fr));}
    body.cchap-ui .cchap-order-filter-grid .cchap-filter-reset {grid-column:auto; justify-self:stretch;}
    body.cchap-ui .order-review-toolbar {grid-template-columns:1fr; align-items:start;}
    body.cchap-ui .order-review-date {white-space:normal;}
    body.cchap-ui .dashboard-request-card > div {grid-template-columns:1fr;}
    body.cchap-ui .dashboard-request-card span:not(.dashboard-request-icon) {white-space:normal;}
    body.cchap-ui .order-card-details {grid-template-columns:repeat(2,minmax(0,1fr));}
    body.cchap-ui .order-specifications-grid {grid-template-columns:1fr;}
    body.cchap-ui .order-specification-wide {grid-column:auto !important;}
    body.cchap-ui .customer-chat-composer.cchap-chat-composer {grid-template-columns:auto minmax(0,1fr) auto;}
}

@media (max-width: 575.98px) {
    .cchap-info-grid,
    .cchap-summary-row,
    body.cchap-ui .queue-status-strip,
    body.cchap-ui .order-summary-grid,
    body.cchap-ui .client-history-summary,
    body.cchap-ui .dashboard-request-summary,
    body.cchap-ui .dashboard-forecast-values,
    body.cchap-ui .service-management-grid,
    body.cchap-ui .laser-material-grid,
    body.cchap-ui .cchap-order-filter-grid,
    body.cchap-ui .client-history-filter-card form,
    body.cchap-ui .cchap-client-header .client-profile-grid {grid-template-columns:1fr;}
    body.cchap-ui .order-card-details {grid-template-columns:1fr 1fr;}
    body.cchap-ui .dashboard-forecast-values {grid-template-rows:none;}
    body.cchap-ui .service-admin-actions {flex-wrap:wrap;}
    body.cchap-ui .service-admin-actions .btn {flex:1 1 auto;}
    body.cchap-ui .cchap-chat-file-name {grid-column:1 / -1;}
}

/* Customer schedule tracking cards: priority is informative, not dominant. */
body.cchap-ui .customer-queue-number {
    align-items: center;
    margin: .65rem 0;
    padding: .55rem .7rem;
    border-radius: .7rem;
}
body.cchap-ui .customer-queue-number span {font-size: .68rem;}
body.cchap-ui .customer-queue-number strong {font-size: 1.15rem;}
body.cchap-ui .queue-time-grid.customer-grid {
    gap: .45rem;
    margin-top: .45rem;
}
body.cchap-ui .queue-time-grid.customer-grid > div {padding: .5rem .55rem; border-radius: .65rem;}
body.cchap-ui .queue-time-grid.customer-grid span {font-size: .65rem;}
body.cchap-ui .queue-time-grid.customer-grid strong {font-size: .8rem;}

/* Compact quotation presentation. */
body.cchap-ui .customer-quotation-card .estimate-breakdown {gap: 0;}
body.cchap-ui .customer-quotation-card .estimate-breakdown > div {padding: .48rem 0;}
body.cchap-ui .customer-quotation-card > .d-flex:first-child {margin-bottom: .55rem !important;}

/* Client list search stays compact and keeps the table near the heading. */
body.cchap-ui .client-search-card {padding:.75rem .85rem !important; margin-bottom:.8rem !important;}
body.cchap-ui .client-search-card .row {--bs-gutter-x:.65rem;--bs-gutter-y:.45rem;}
body.cchap-ui .client-search-card small {display:block;margin-top:.25rem;font-size:.7rem;}
body.cchap-ui .client-list-toolbar {min-height:0;padding:.55rem .7rem;}

/* Customer dashboard service selection: search does not occupy the entire page width. */
body.cchap-ui .customer-dashboard-service-search {
    width:min(100%, 520px);
    margin:.7rem 0 .85rem;
}
body.cchap-ui .customer-dashboard-service-search .input-group-lg > * {min-height:2.45rem; font-size:.88rem;}
body.cchap-ui .customer-dashboard-order-section #serviceSearchResults {--bs-gutter-x:.75rem;--bs-gutter-y:.75rem;}
body.cchap-ui .dashboard-service-card {height:auto !important;}
body.cchap-ui .client-history-filter-card form.row {margin:0;}
body.cchap-ui .client-history-filter-card form.row > div {padding-left:0;padding-right:0;}

/* Ordering form: Layout + Quantity + Pick-Up are one logical group. */
body.cchap-ui .service-picker-group--combined-order {display:grid;gap:.7rem;}
body.cchap-ui .service-combined-layout {min-width:0;}
body.cchap-ui .service-combined-order-row {
    display:grid;
    grid-template-columns:minmax(180px,.65fr) minmax(240px,1.35fr);
    gap:.65rem;
    align-items:start;
}
body.cchap-ui .service-combined-field {
    min-width:0;
    padding:.65rem;
    border:1px solid #e1ebe6;
    border-radius:.7rem;
    background:#f8fbf9;
}
body.cchap-ui .service-combined-field .service-picker-note {margin-top:.35rem;}
@media (max-width:767.98px){
    body.cchap-ui .service-combined-order-row{grid-template-columns:1fr;}
}

/* Tables scroll inside their own region rather than widening the page. */
body.cchap-ui.portal-ui-v3 .table-responsive,
body.cchap-ui.portal-ui-v3 .table-wrap {overflow-x:auto; max-width:100%;}
