/* =========================================================
   CCHAP Full-page restructuring v3
   Scope: visual layout/composition only. No workflow/data logic.
   Loaded after cchap-ui.css and cchap-layout-v2.css.
   ========================================================= */

:root {
    --cchap3-xs: .45rem;
    --cchap3-sm: .7rem;
    --cchap3-md: .9rem;
    --cchap3-lg: 1.05rem;
    --cchap3-border: #dce8e2;
    --cchap3-soft: #f6faf8;
    --cchap3-green: #0b7a58;
    --cchap3-green-dark: #064b38;
    --cchap3-ink: #17342a;
    --cchap3-muted: #667a72;
}

/* ---------- Global page rhythm ---------- */
body.cchap-ui.portal-ui-v3 .dashboard-page,
body.cchap-ui.portal-ui-v3 .order-create-page,
body.cchap-ui.portal-ui-v3 .order-details-page,
body.cchap-ui.portal-ui-v3 .queue-page,
body.cchap-ui.portal-ui-v3 .chat-page,
body.cchap-ui.portal-ui-v3 .forecast-page,
body.cchap-ui.portal-ui-v3 .report-page,
body.cchap-ui.portal-ui-v3 .sms-page {
    padding-top: .85rem !important;
    padding-bottom: 1.4rem !important;
}
body.cchap-ui.portal-ui-v3 .dashboard-heading {
    min-height: 0 !important;
    margin-bottom: .8rem !important;
    padding: .78rem .9rem !important;
    border-radius: .95rem !important;
}
body.cchap-ui.portal-ui-v3 .dashboard-heading h1 {
    margin: .12rem 0 .15rem !important;
    font-size: clamp(1.35rem, 1.8vw, 1.85rem) !important;
}
body.cchap-ui.portal-ui-v3 .dashboard-heading p {
    margin: .15rem 0 0 !important;
    font-size: .82rem !important;
    line-height: 1.4 !important;
}
body.cchap-ui.portal-ui-v3 main .content-card {
    min-height: 0 !important;
    height: auto !important;
    padding: .85rem !important;
    border-radius: .9rem !important;
}
body.cchap-ui.portal-ui-v3 main .content-card.p-0 { padding: 0 !important; }
body.cchap-ui.portal-ui-v3 main .content-card h2 {
    margin-top: .15rem;
    margin-bottom: .55rem;
    font-size: 1rem !important;
}
body.cchap-ui.portal-ui-v3 main .form-label {
    margin-bottom: .28rem;
    font-size: .74rem;
    font-weight: 700;
}
body.cchap-ui.portal-ui-v3 main .form-control,
body.cchap-ui.portal-ui-v3 main .form-select,
body.cchap-ui.portal-ui-v3 main .input-group-text {
    min-height: 38px;
    padding-block: .42rem;
    font-size: .84rem;
}
body.cchap-ui.portal-ui-v3 main textarea.form-control { min-height: 72px; }
body.cchap-ui.portal-ui-v3 main .btn:not(.btn-lg) {
    min-height: 36px;
    padding: .38rem .72rem;
    font-size: .8rem;
}
body.cchap-ui.portal-ui-v3 main .btn-lg {
    min-height: 42px;
    padding: .5rem .9rem;
    font-size: .88rem;
}
body.cchap-ui.portal-ui-v3 main .table > :not(caption) > * > * {
    padding: .5rem .58rem;
    vertical-align: middle;
}
body.cchap-ui.portal-ui-v3 main .table th {
    font-size: .69rem;
    letter-spacing: .03em;
}
body.cchap-ui.portal-ui-v3 main .table td { font-size: .78rem; }
body.cchap-ui.portal-ui-v3 main .empty-state {
    min-height: 0 !important;
    padding: 1.6rem .9rem !important;
}
body.cchap-ui.portal-ui-v3 main .alert { padding: .65rem .8rem; }

/* ---------- Orders / Order Reports ---------- */
body.cchap-ui .cchap-orders-page .order-filter-panel {
    margin-bottom: .65rem !important;
    padding: .7rem .8rem !important;
    border-radius: .85rem;
}
body.cchap-ui .cchap-orders-page .cchap-filter-heading {
    margin-bottom: .5rem !important;
}
body.cchap-ui .cchap-orders-page .cchap-filter-heading h2 { font-size: .9rem !important; }
body.cchap-ui .cchap-orders-page .cchap-order-filter-grid {
    grid-template-columns: minmax(118px,.7fr) minmax(120px,.75fr) minmax(100px,.6fr) minmax(210px,1.5fr) auto;
    gap: .5rem;
}
body.cchap-ui .cchap-orders-page .order-summary-grid {
    gap: .5rem;
    margin-bottom: .65rem !important;
}
body.cchap-ui .cchap-orders-page .order-summary-card {
    min-height: 54px !important;
    padding: .55rem .7rem !important;
    border-radius: .72rem;
}
body.cchap-ui .cchap-orders-page .order-summary-card span { font-size: .66rem !important; }
body.cchap-ui .cchap-orders-page .order-summary-card strong { font-size: .98rem !important; }
body.cchap-ui .cchap-orders-page .order-inbox-table { margin: 0; }

/* ---------- Production Schedule ---------- */
body.cchap-ui .cchap-production-page .dashboard-heading { margin-bottom: .65rem !important; }
body.cchap-ui .cchap-production-page .queue-status-strip {
    gap: .45rem;
    margin-bottom: .6rem;
}
body.cchap-ui .cchap-production-page .queue-status-pill {
    min-height: 42px;
    padding: .48rem .65rem;
    border-radius: .65rem;
}
body.cchap-ui .cchap-production-page .queue-status-pill span { font-size: .7rem; }
body.cchap-ui .cchap-production-page .queue-status-pill strong { font-size: .92rem; }
body.cchap-ui .cchap-production-page .queue-compact-panel {
    margin-bottom: .65rem !important;
    padding: .72rem !important;
}
body.cchap-ui .cchap-production-page .queue-panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: .45rem;
}
body.cchap-ui .cchap-production-page .queue-panel-heading h2 {
    margin: .1rem 0 0 !important;
    font-size: .92rem !important;
}
body.cchap-ui .cchap-production-page .queue-panel-heading p {
    margin: .1rem 0 0;
    font-size: .75rem;
}
body.cchap-ui .cchap-production-page .table-responsive { margin-top: .35rem !important; }
body.cchap-ui .cchap-production-page .alert-warning { margin-bottom: .6rem !important; }

/* ---------- Admin Order Review ---------- */
body.cchap-ui .admin-order-review-page .order-review-top-grid {
    display: grid;
    grid-template-columns: minmax(285px,.62fr) minmax(0,1.7fr);
    gap: .7rem;
    align-items: start;
    margin-bottom: .75rem;
}
body.cchap-ui .admin-order-review-page .order-review-toolbar {
    grid-template-columns: 1fr;
    gap: .55rem;
    margin: 0 !important;
    padding: .72rem !important;
}
body.cchap-ui .admin-order-review-page .order-review-toolbar > div:first-child p {
    font-size: .74rem;
}
body.cchap-ui .admin-order-review-page .order-review-date {
    padding: .48rem .55rem;
}
body.cchap-ui .admin-order-review-page .order-review-date strong { font-size: .9rem; }
body.cchap-ui .admin-order-review-page .order-review-actions {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: .4rem;
}
body.cchap-ui .admin-order-review-page .order-review-actions form,
body.cchap-ui .admin-order-review-page .order-review-actions .btn { width: 100%; }
body.cchap-ui .admin-order-review-page .order-review-schedule-card {
    min-width: 0;
    margin: 0 !important;
    padding: .7rem !important;
}
body.cchap-ui .admin-order-review-page .order-review-schedule-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: .35rem;
}
body.cchap-ui .admin-order-review-page .order-review-schedule-heading h2 {
    margin: 0 !important;
    font-size: .9rem !important;
}
body.cchap-ui .admin-order-review-page .order-review-schedule-card .table-responsive { margin-top: .35rem !important; }
body.cchap-ui .admin-order-review-page .admin-order-layout {
    grid-template-columns: minmax(0,1.65fr) minmax(250px,.68fr);
    gap: .7rem;
}
body.cchap-ui .admin-order-review-page .admin-order-main,
body.cchap-ui .admin-order-review-page .admin-order-side { gap: .6rem; }
body.cchap-ui .admin-order-review-page .admin-order-layout .content-card { padding: .75rem !important; }
body.cchap-ui .admin-order-review-page .admin-order-layout .order-detail-list {
    gap: 0 .7rem;
    margin-top: .45rem;
}
body.cchap-ui .admin-order-review-page .admin-order-layout .order-detail-list > div {
    padding: .35rem 0;
}
body.cchap-ui .admin-order-review-page .queue-summary-card .admin-queue-inline {
    gap: .35rem .65rem;
    padding-bottom: .45rem;
}

/* ---------- Notifications ---------- */
body.cchap-ui .cchap-notifications-page .dashboard-heading {
    display: flex;
    align-items: center;
}
body.cchap-ui .cchap-notifications-page .notification-filter-bar {
    display: flex;
    gap: .4rem;
    margin-bottom: .55rem;
}
body.cchap-ui .cchap-notifications-page .notifications-card { padding: .35rem !important; }
body.cchap-ui .cchap-notifications-page .notification-list { gap: .28rem; }
body.cchap-ui .cchap-notifications-page .notification-item {
    grid-template-columns: 1.85rem minmax(0,1fr);
    gap: .55rem;
    padding: .5rem .58rem !important;
    border-radius: .65rem;
}
body.cchap-ui .cchap-notifications-page .notification-icon {
    width: 1.85rem;
    height: 1.85rem;
    font-size: .76rem;
}
body.cchap-ui .cchap-notifications-page .notification-title-row {
    display: grid;
    grid-template-columns: minmax(0,1fr) auto;
    align-items: baseline;
    gap: .55rem;
}
body.cchap-ui .cchap-notifications-page .notification-title-row h2 { font-size: .84rem !important; }
body.cchap-ui .cchap-notifications-page .notification-title-row time {
    white-space: nowrap;
    font-size: .65rem;
}
body.cchap-ui .cchap-notifications-page .notification-content p {
    margin: .1rem 0 .32rem;
    font-size: .75rem;
}
body.cchap-ui .cchap-notifications-page .notification-actions {
    display: flex;
    align-items: center;
    gap: .35rem;
}
body.cchap-ui .cchap-notifications-page .notification-actions form { margin: 0; }

/* ---------- Chat (customer + admin) ---------- */
body.cchap-ui .cchap-chat-page,
body.cchap-ui .cchap-chat-inbox-page { padding-bottom: .85rem !important; }
body.cchap-ui .cchap-chat-shell {
    width: min(100%, 1180px);
    max-width: 1180px;
}
body.cchap-ui .cchap-chat-page .customer-chat-card {
    display: flex;
    flex-direction: column;
    height: clamp(430px, calc(100vh - 170px), 680px);
    min-height: 0 !important;
    border-radius: .9rem;
}
body.cchap-ui .cchap-chat-page .customer-chat-header {
    flex: 0 0 auto;
    padding: .65rem .8rem;
}
body.cchap-ui .cchap-chat-page .customer-chat-avatar {
    width: 2.25rem;
    height: 2.25rem;
}
body.cchap-ui .cchap-chat-page .customer-chat-stream {
    flex: 1 1 auto;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    padding: .75rem;
    gap: .55rem;
}
body.cchap-ui .cchap-chat-page .customer-message-bubble {
    padding: .55rem .7rem;
    border-radius: .85rem;
}
body.cchap-ui .cchap-chat-page .customer-chat-composer.cchap-chat-composer {
    flex: 0 0 auto;
    grid-template-columns: 2.25rem minmax(0,1fr) auto;
    gap: .4rem;
    padding: .5rem .6rem !important;
}
body.cchap-ui .cchap-chat-page .cchap-chat-attach {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: .58rem;
}
body.cchap-ui .cchap-chat-page .cchap-chat-message-wrap textarea {
    min-height: 2.25rem !important;
    max-height: 5.5rem;
    padding: .42rem .6rem;
}
body.cchap-ui .cchap-chat-page .customer-chat-composer .btn {
    height: 2.25rem;
    min-height: 2.25rem;
}
body.cchap-ui .cchap-chat-page .cchap-chat-file-name { font-size: .65rem; }
body.cchap-ui .cchap-chat-inbox-shell .dashboard-heading { margin-bottom: .55rem !important; }
body.cchap-ui .cchap-chat-inbox-shell .customer-chat-card { border-radius: .9rem; }
body.cchap-ui .cchap-chat-inbox-shell .chat-inbox-item {
    gap: .65rem;
    padding: .65rem .75rem;
}
body.cchap-ui .cchap-chat-inbox-shell .chat-inbox-avatar {
    width: 2.35rem;
    height: 2.35rem;
}

/* ---------- Service Management ---------- */
body.cchap-ui .admin-services-page .dashboard-heading { margin-bottom: .65rem !important; }
body.cchap-ui .admin-services-page .cchap-service-management-grid {
    grid-template-columns: repeat(4,minmax(0,1fr));
    gap: .65rem;
}
body.cchap-ui .admin-services-page .service-admin-card {
    padding: .62rem !important;
    border-radius: .78rem;
}
body.cchap-ui .admin-services-page .service-admin-image {
    aspect-ratio: 16/8.5;
    margin-bottom: .5rem !important;
    border-radius: .62rem !important;
}
body.cchap-ui .admin-services-page .service-admin-meta h2 { font-size: .9rem !important; }
body.cchap-ui .admin-services-page .service-admin-meta p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: .72rem;
}
body.cchap-ui .admin-services-page .service-stats {
    gap: .28rem;
    margin: .5rem 0;
}
body.cchap-ui .admin-services-page .service-stats span {
    padding: .32rem .25rem;
    font-size: .62rem;
}
body.cchap-ui .admin-services-page .service-stats strong { font-size: .76rem; }
body.cchap-ui .admin-services-page .service-admin-actions { gap: .3rem; }
body.cchap-ui .admin-services-page .service-admin-actions .btn { min-height: 34px; }

/* ---------- Client Management ---------- */
body.cchap-ui .cchap-client-list-page .client-search-card {
    display: block;
    margin-bottom: .55rem !important;
    padding: .65rem .75rem !important;
}
body.cchap-ui .cchap-client-list-page .client-search-card .row {
    display: grid;
    grid-template-columns: minmax(0,1fr) auto;
    gap: .55rem;
    align-items: end;
    margin: 0;
}
body.cchap-ui .cchap-client-list-page .client-search-card .row > div {
    width: auto;
    max-width: none;
    padding: 0;
}
body.cchap-ui .cchap-client-list-page .client-list-toolbar { padding: .45rem .6rem; }
body.cchap-ui .cchap-client-details-page .cchap-client-header {
    grid-template-columns: minmax(190px,.65fr) minmax(0,2.35fr);
    gap: .55rem .75rem;
    margin-bottom: .55rem !important;
    padding: .65rem !important;
}
body.cchap-ui .cchap-client-details-page .client-profile-avatar {
    width: 2.4rem;
    height: 2.4rem;
    font-size: .9rem;
}
body.cchap-ui .cchap-client-details-page .client-profile-grid { gap: .38rem; }
body.cchap-ui .cchap-client-details-page .client-profile-grid > div {
    min-height: 0 !important;
    padding: .45rem .5rem;
}
body.cchap-ui .cchap-client-details-page .client-history-filter-card {
    margin-bottom: .55rem !important;
    padding: .65rem .72rem !important;
}
body.cchap-ui .cchap-client-details-page .client-history-filter-card > .d-flex {
    margin-bottom: .45rem !important;
}
body.cchap-ui .cchap-client-details-page .client-history-filter-card p { display: none; }
body.cchap-ui .cchap-client-details-page .client-history-filter-grid {
    display: grid;
    grid-template-columns: minmax(120px,.7fr) minmax(120px,.7fr) minmax(100px,.58fr) minmax(220px,1.5fr);
    gap: .5rem;
    align-items: end;
}
body.cchap-ui .cchap-client-details-page .client-history-filter-field { min-width: 0; }
body.cchap-ui .cchap-client-details-page .client-history-summary {
    gap: .45rem;
    margin-bottom: .55rem !important;
}
body.cchap-ui .cchap-client-details-page .client-history-summary article {
    min-height: 50px;
    padding: .5rem .62rem;
    border-radius: .65rem;
}
body.cchap-ui .cchap-client-details-page .client-history-summary span { font-size: .66rem; }
body.cchap-ui .cchap-client-details-page .client-history-summary strong { font-size: .92rem; }

/* ---------- System Settings ---------- */
body.cchap-ui .admin-settings-page .cchap-settings-grid {
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: .65rem;
}
body.cchap-ui .admin-settings-page .settings-group-card {
    padding: .72rem !important;
}
body.cchap-ui .admin-settings-page .settings-group-card h2 {
    margin-bottom: .5rem !important;
    font-size: .92rem !important;
}
body.cchap-ui .admin-settings-page .settings-group-card .row {
    --bs-gutter-x: .55rem;
    --bs-gutter-y: .55rem;
}
body.cchap-ui .admin-settings-page .settings-group-card textarea[rows="6"] { min-height: 5.8rem !important; }
body.cchap-ui .admin-settings-page .settings-group-card textarea[rows="4"] { min-height: 4.6rem !important; }
body.cchap-ui .admin-settings-page .form-text { font-size: .66rem; line-height: 1.3; }
body.cchap-ui .admin-settings-page .settings-actions { margin-top: .65rem; }

/* ---------- Customer Service Specification / Ordering ---------- */
body.cchap-ui .cchap-order-create-page .dashboard-heading { margin-bottom: .65rem !important; }
body.cchap-ui .cchap-order-create-page .order-layout-reminder {
    margin-bottom: .65rem;
    padding: .55rem .7rem;
    border-radius: .7rem;
    font-size: .75rem;
}
body.cchap-ui .cchap-order-create-page .service-configurator {
    grid-template-columns: minmax(0,1.75fr) minmax(250px,.58fr);
    gap: .7rem;
}
body.cchap-ui .cchap-order-create-page .service-picker-card,
body.cchap-ui .cchap-order-create-page .service-estimate-panel {
    border-radius: .9rem;
}
body.cchap-ui .cchap-order-create-page .service-picker-product {
    grid-template-columns: minmax(180px,220px) 1fr;
    gap: .8rem;
    padding: .75rem;
}
body.cchap-ui .cchap-order-create-page .service-gallery__viewport { height: 145px; }
body.cchap-ui .cchap-order-create-page .service-picker-product__info h2 {
    margin: .25rem 0;
    font-size: 1.25rem;
}
body.cchap-ui .cchap-order-create-page .service-picker-product__info p {
    font-size: .78rem;
    line-height: 1.35;
}
body.cchap-ui .cchap-order-create-page .service-picker-fields-grid {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    align-items: start;
}
body.cchap-ui .cchap-order-create-page .service-picker-fields-grid > .service-picker-group {
    min-width: 0;
    padding: .7rem .75rem;
    border-right: 1px solid #edf2ef;
}
body.cchap-ui .cchap-order-create-page .service-picker-fields-grid > .service-picker-group:nth-child(even) { border-right: 0; }
body.cchap-ui .cchap-order-create-page .service-picker-fields-grid > .service-picker-group--combined-order {
    grid-column: 1 / -1;
    border-right: 0;
}
body.cchap-ui .cchap-order-create-page .service-picker-group__title {
    margin-bottom: .45rem;
    font-size: .85rem;
}
body.cchap-ui .cchap-order-create-page .service-option-grid { gap: .4rem; }
body.cchap-ui .cchap-order-create-page .service-option-chip {
    min-height: 38px;
    padding: .45rem .55rem;
    border-radius: .65rem;
    font-size: .76rem;
}
body.cchap-ui .cchap-order-create-page .service-option-tile {
    min-height: 54px;
    padding: .5rem .6rem;
    border-radius: .65rem;
}
body.cchap-ui .cchap-order-create-page .service-option-tile strong { font-size: .82rem; }
body.cchap-ui .cchap-order-create-page .service-option-tile span { font-size: .68rem; }
body.cchap-ui .cchap-order-create-page .service-picker-text { min-height: 38px; border-radius: .65rem; }
body.cchap-ui .cchap-order-create-page .service-picker-note { margin-top: .3rem; font-size: .69rem; }
body.cchap-ui .cchap-order-create-page .quantity-stepper {
    grid-template-columns: 38px 68px 38px;
    border-radius: .65rem;
}
body.cchap-ui .cchap-order-create-page .service-combined-order-row {
    grid-template-columns: minmax(150px,.55fr) minmax(220px,1.2fr);
    gap: .5rem;
}
body.cchap-ui .cchap-order-create-page .service-combined-field { padding: .5rem; }
body.cchap-ui .cchap-order-create-page .service-configurator__summary { top: .7rem; }
body.cchap-ui .cchap-order-create-page .service-estimate-panel { padding: .75rem; }
body.cchap-ui .cchap-order-create-page .service-estimate-panel h3 { margin: .35rem 0; font-size: .94rem; }
body.cchap-ui .cchap-order-create-page .service-estimate-panel .estimate-total { font-size: 1.5rem; }
body.cchap-ui .cchap-order-create-page .service-order-actions { margin-top: .65rem !important; gap: .4rem; }
body.cchap-ui .cchap-order-create-page .service-order-actions .btn { min-height: 40px; }

/* ---------- Laser material selection ---------- */
body.cchap-ui .cchap-laser-page {
    padding-top: .7rem !important;
    padding-bottom: 1rem !important;
}
body.cchap-ui .cchap-laser-page .laser-material-hero--compact {
    max-width: 1320px;
    margin-bottom: .65rem;
    padding: .65rem .8rem;
    border-radius: .85rem;
}
body.cchap-ui .cchap-laser-page .laser-material-hero h1 {
    margin: .15rem 0;
    font-size: 1.55rem;
}
body.cchap-ui .cchap-laser-page .laser-material-picker-shell {
    max-width: 1320px;
    border-radius: .85rem;
}
body.cchap-ui .cchap-laser-page .laser-material-picker-toolbar { padding: .55rem .7rem; }
body.cchap-ui .cchap-laser-page .laser-material-scroll { padding: .65rem; }
body.cchap-ui .cchap-laser-page .cchap-laser-material-grid {
    grid-template-columns: repeat(4,minmax(0,1fr)) !important;
    gap: .55rem;
}
body.cchap-ui .cchap-laser-page .laser-material-card--compact { border-radius: .7rem; }
body.cchap-ui .cchap-laser-page .laser-material-card--compact .laser-material-card__image { aspect-ratio: 16/9; }
body.cchap-ui .cchap-laser-page .laser-material-card--compact .laser-material-card__body { padding: .55rem; }
body.cchap-ui .cchap-laser-page .laser-material-card__tag {
    margin-bottom: .25rem;
    padding: .22rem .42rem;
    font-size: .6rem;
}
body.cchap-ui .cchap-laser-page .laser-material-card__price {
    padding-top: .4rem;
    font-size: .76rem;
}
body.cchap-ui .cchap-laser-page .laser-material-card__select {
    right: .4rem;
    bottom: .4rem;
    padding: .28rem .45rem;
    font-size: .65rem;
}

/* ---------- Customer Orders & Tracking ---------- */
body.cchap-ui .cchap-customer-orders-page .dashboard-heading { margin-bottom: .6rem !important; }
body.cchap-ui .cchap-customer-orders-page > .container-fluid > .content-card.p-2 {
    margin-bottom: .6rem !important;
    padding: .3rem !important;
}
body.cchap-ui .cchap-customer-orders-page .customer-order-hub-tabs {
    gap: .3rem !important;
}
body.cchap-ui .cchap-customer-orders-page .customer-order-hub-tabs .nav-link {
    padding: .45rem .58rem !important;
    border-radius: .65rem !important;
    font-size: .76rem !important;
}
body.cchap-ui .cchap-customer-orders-page .order-filter-bar {
    margin-bottom: .55rem !important;
    padding-bottom: .1rem;
}
body.cchap-ui .cchap-customer-orders-page .order-filter { padding: .35rem .55rem; font-size: .7rem; }
body.cchap-ui .cchap-customer-orders-page .customer-order-grid {
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: .6rem;
}
body.cchap-ui .cchap-customer-orders-page .customer-quotation-grid,
body.cchap-ui .cchap-customer-orders-page .customer-tracking-grid {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: .6rem;
}
body.cchap-ui .cchap-customer-orders-page .customer-order-grid__item,
body.cchap-ui .cchap-customer-orders-page .customer-quotation-grid__item,
body.cchap-ui .cchap-customer-orders-page .customer-tracking-grid__item { min-width: 0; }
body.cchap-ui .cchap-customer-orders-page .customer-order-card,
body.cchap-ui .cchap-customer-orders-page .customer-quotation-card,
body.cchap-ui .cchap-customer-orders-page .customer-queue-card {
    min-height: 0 !important;
    height: 100% !important;
    padding: .65rem !important;
    border-radius: .72rem;
}
body.cchap-ui .cchap-customer-orders-page .customer-order-card h2,
body.cchap-ui .cchap-customer-orders-page .customer-quotation-card h2,
body.cchap-ui .cchap-customer-orders-page .customer-queue-card h2 {
    margin: .2rem 0 .1rem !important;
    font-size: .9rem !important;
}
body.cchap-ui .cchap-customer-orders-page .order-reference { margin-bottom: .4rem; font-size: .68rem; }
body.cchap-ui .cchap-customer-orders-page .order-card-details {
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: .28rem;
    margin: .45rem 0;
}
body.cchap-ui .cchap-customer-orders-page .order-card-details > div { padding: .38rem .42rem; }
body.cchap-ui .cchap-customer-orders-page .estimate-breakdown > div { padding: .35rem 0; }
body.cchap-ui .cchap-customer-orders-page .customer-queue-number {
    margin: .45rem 0;
    padding: .42rem .5rem;
}
body.cchap-ui .cchap-customer-orders-page .queue-time-grid.customer-grid {
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: .3rem;
}
body.cchap-ui .cchap-customer-orders-page .queue-time-grid.customer-grid > div { padding: .4rem .45rem; }

/* ---------- Specific customer order / quotation / schedule ---------- */
body.cchap-ui .cchap-order-detail-page .cchap-order-detail-header {
    display: grid;
    grid-template-columns: minmax(0,1fr) auto;
    align-items: center !important;
    padding: .68rem .78rem !important;
}
body.cchap-ui .cchap-order-detail-page .cchap-order-detail-header .mt-3 { margin-top: .35rem !important; }
body.cchap-ui .cchap-order-detail-page .cchap-order-progress-card { padding: .65rem .72rem !important; }
body.cchap-ui .cchap-order-detail-page .order-progress-heading {
    align-items: center;
    margin-bottom: .45rem;
}
body.cchap-ui .cchap-order-detail-page .order-completion-summary > div {
    padding: .4rem .55rem !important;
    border-radius: .6rem !important;
}
body.cchap-ui .cchap-order-detail-page .order-completion-summary .fs-5 { font-size: .88rem !important; }
body.cchap-ui .cchap-order-detail-page .order-timeline { padding: .05rem 0 .25rem; }
body.cchap-ui .cchap-order-detail-page .timeline-step { gap: .25rem; }
body.cchap-ui .cchap-order-detail-page .timeline-step > span { width: 1.45rem; height: 1.45rem; }
body.cchap-ui .cchap-order-detail-page .timeline-step::before { top: .71rem; }
body.cchap-ui .cchap-order-detail-page .timeline-step small { font-size: .62rem; }
body.cchap-ui .cchap-order-detail-page .order-rejected-actions {
    display: grid;
    grid-template-columns: minmax(0,1.7fr) minmax(180px,.55fr);
    gap: .55rem;
}
body.cchap-ui .cchap-order-detail-page .order-rejected-actions form {
    min-height: 0 !important;
    height: auto !important;
    padding: .65rem !important;
}
body.cchap-ui .cchap-order-detail-page .order-overview-grid {
    grid-template-columns: minmax(0,1.6fr) minmax(260px,.7fr);
    gap: .65rem;
}
body.cchap-ui .cchap-order-detail-page .order-overview-grid .content-card { padding: .7rem !important; }
body.cchap-ui .cchap-order-detail-page .order-specifications-grid {
    gap: .25rem .6rem;
    margin-top: .45rem;
}
body.cchap-ui .cchap-order-detail-page .order-specifications-grid > div { padding: .35rem .4rem; }
body.cchap-ui .cchap-order-detail-page .order-pricing-card .estimate-breakdown > div { padding-block: .36rem; }
body.cchap-ui .cchap-order-detail-page .order-queue-card {
    grid-template-columns: minmax(150px,.7fr) minmax(0,1.7fr) auto;
    gap: .55rem;
    padding: .55rem .65rem !important;
}
body.cchap-ui .cchap-order-detail-page .order-queue-details { gap: .3rem .65rem; }

/* ---------- Profile / Security ---------- */
body.cchap-ui .cchap-profile-page .profile-security-grid {
    display: grid;
    grid-template-columns: minmax(0,1.35fr) minmax(280px,.72fr);
    gap: .7rem;
    align-items: start;
}
body.cchap-ui .cchap-profile-page .profile-security-grid > div { min-width: 0; }
body.cchap-ui .cchap-profile-page .profile-security-grid .content-card {
    min-height: 0 !important;
    height: auto !important;
    padding: .75rem !important;
}
body.cchap-ui .cchap-profile-page .profile-security-grid form.row {
    --bs-gutter-x: .55rem;
    --bs-gutter-y: .55rem;
}
body.cchap-ui .cchap-profile-page .profile-password-card form { gap: .55rem !important; }

/* ---------- Customer dashboard ---------- */
body.cchap-ui .cchap-customer-dashboard .dashboard-heading { margin-bottom: .65rem !important; }
body.cchap-ui .cchap-customer-dashboard .customer-dashboard-order-section { margin-top: .65rem !important; }
body.cchap-ui .cchap-customer-dashboard .customer-dashboard-section-heading {
    align-items: center;
    gap: .6rem;
}
body.cchap-ui .cchap-customer-dashboard .customer-dashboard-service-search {
    margin: .5rem 0 .6rem;
    width: min(100%, 470px);
}
body.cchap-ui .cchap-customer-dashboard .customer-service-grid {
    display: grid;
    grid-template-columns: repeat(4,minmax(0,1fr));
    gap: .6rem;
}
body.cchap-ui .cchap-customer-dashboard .service-search-item { min-width: 0; }
body.cchap-ui .cchap-customer-dashboard .dashboard-service-card {
    height: 100% !important;
    min-height: 0 !important;
    border-radius: .75rem;
}
body.cchap-ui .cchap-customer-dashboard .dashboard-service-copy { padding: .6rem !important; }
body.cchap-ui .cchap-customer-dashboard .dashboard-service-copy h3 { font-size: .88rem !important; }
body.cchap-ui .cchap-customer-dashboard .dashboard-service-copy p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: .7rem;
}
body.cchap-ui .cchap-customer-dashboard .dashboard-service-actions .btn { min-height: 34px; }
body.cchap-ui .cchap-customer-dashboard .content-card.mt-3 { margin-top: .65rem !important; }

/* ---------- Broad consistency for remaining admin/client modules ---------- */
body.cchap-ui.portal-ui-v3 main .row.g-4,
body.cchap-ui.portal-ui-v3 main .row.g-3 { align-items: start; }
body.cchap-ui.portal-ui-v3 main .card,
body.cchap-ui.portal-ui-v3 main .metric-card,
body.cchap-ui.portal-ui-v3 main .forecast-service-card,
body.cchap-ui.portal-ui-v3 main .dss-card,
body.cchap-ui.portal-ui-v3 main .report-filter-card {
    min-height: 0 !important;
    height: auto !important;
}
body.cchap-ui.portal-ui-v3 main .section-title-row,
body.cchap-ui.portal-ui-v3 main .content-card > .d-flex:first-child {
    gap: .55rem !important;
}
body.cchap-ui.portal-ui-v3 main .section-title-row { margin-bottom: .65rem !important; }
body.cchap-ui.portal-ui-v3 main .badge.fs-6 { font-size: .72rem !important; }

/* ---------- Responsive rules ---------- */
@media (max-width: 1399.98px) {
    body.cchap-ui .admin-services-page .cchap-service-management-grid,
    body.cchap-ui .cchap-customer-dashboard .customer-service-grid,
    body.cchap-ui .cchap-laser-page .cchap-laser-material-grid { grid-template-columns: repeat(3,minmax(0,1fr)) !important; }
    body.cchap-ui .cchap-customer-orders-page .customer-order-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 1199.98px) {
    body.cchap-ui .admin-order-review-page .order-review-top-grid { grid-template-columns: 1fr; }
    body.cchap-ui .admin-order-review-page .order-review-toolbar { grid-template-columns: minmax(0,1fr) auto auto; }
    body.cchap-ui .cchap-order-create-page .service-configurator { grid-template-columns: minmax(0,1fr) minmax(235px,.58fr); }
    body.cchap-ui .cchap-client-details-page .client-history-filter-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
}

@media (max-width: 991.98px) {
    body.cchap-ui .cchap-orders-page .cchap-order-filter-grid,
    body.cchap-ui .cchap-client-details-page .client-history-filter-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    body.cchap-ui .admin-order-review-page .admin-order-layout,
    body.cchap-ui .cchap-order-detail-page .order-overview-grid,
    body.cchap-ui .cchap-profile-page .profile-security-grid,
    body.cchap-ui .cchap-order-create-page .service-configurator { grid-template-columns: 1fr; }
    body.cchap-ui .cchap-order-create-page .service-configurator__summary { position: static; }
    body.cchap-ui .cchap-order-create-page .service-picker-fields-grid { grid-template-columns: 1fr; }
    body.cchap-ui .cchap-order-create-page .service-picker-fields-grid > .service-picker-group { border-right: 0; }
    body.cchap-ui .admin-settings-page .cchap-settings-grid { grid-template-columns: 1fr; }
    body.cchap-ui .cchap-customer-dashboard .customer-service-grid,
    body.cchap-ui .admin-services-page .cchap-service-management-grid,
    body.cchap-ui .cchap-laser-page .cchap-laser-material-grid { grid-template-columns: repeat(2,minmax(0,1fr)) !important; }
    body.cchap-ui .cchap-client-details-page .cchap-client-header { grid-template-columns: 1fr; }
    body.cchap-ui .cchap-client-list-page .client-search-card .row { grid-template-columns: 1fr; }
    body.cchap-ui .cchap-client-list-page .client-search-card .row > div:last-child { text-align: left !important; }
}

@media (max-width: 767.98px) {
    body.cchap-ui .admin-order-review-page .order-review-toolbar { grid-template-columns: 1fr; }
    body.cchap-ui .cchap-notifications-page .notification-title-row { grid-template-columns: 1fr; gap: .1rem; }
    body.cchap-ui .cchap-notifications-page .notification-title-row time { white-space: normal; }
    body.cchap-ui .cchap-order-create-page .service-picker-product { grid-template-columns: 1fr; }
    body.cchap-ui .cchap-order-create-page .service-gallery__viewport { height: 180px; }
    body.cchap-ui .cchap-order-create-page .service-combined-order-row,
    body.cchap-ui .cchap-order-detail-page .order-rejected-actions { grid-template-columns: 1fr; }
    body.cchap-ui .cchap-customer-orders-page .customer-order-grid,
    body.cchap-ui .cchap-customer-orders-page .customer-quotation-grid,
    body.cchap-ui .cchap-customer-orders-page .customer-tracking-grid { grid-template-columns: 1fr; }
    body.cchap-ui .cchap-order-detail-page .cchap-order-detail-header { grid-template-columns: 1fr; }
    body.cchap-ui .cchap-order-detail-page .order-queue-card { grid-template-columns: 1fr; }
    body.cchap-ui .cchap-chat-page .customer-chat-card { height: calc(100dvh - 135px); min-height: 420px !important; }
}

@media (max-width: 575.98px) {
    body.cchap-ui.portal-ui-v3 .dashboard-heading { padding: .65rem .7rem !important; }
    body.cchap-ui .cchap-orders-page .cchap-order-filter-grid,
    body.cchap-ui .cchap-client-details-page .client-history-filter-grid,
    body.cchap-ui .cchap-production-page .queue-status-strip,
    body.cchap-ui .cchap-client-details-page .client-history-summary,
    body.cchap-ui .cchap-customer-dashboard .customer-service-grid,
    body.cchap-ui .admin-services-page .cchap-service-management-grid,
    body.cchap-ui .cchap-laser-page .cchap-laser-material-grid { grid-template-columns: 1fr !important; }
    body.cchap-ui .cchap-production-page .queue-status-strip { grid-template-columns: repeat(2,minmax(0,1fr)) !important; }
    body.cchap-ui .cchap-chat-page .customer-chat-composer.cchap-chat-composer { grid-template-columns: 2.15rem minmax(0,1fr) auto; }
    body.cchap-ui .cchap-chat-page .customer-chat-composer .btn { padding-inline: .55rem; }
}

/* Laptop-height tuning: remove decorative vertical waste at the panel target size. */
@media (min-width: 992px) and (max-height: 820px) {
    body.cchap-ui.portal-ui-v3 .dashboard-page { padding-top: .65rem !important; padding-bottom: 1rem !important; }
    body.cchap-ui.portal-ui-v3 .dashboard-heading { margin-bottom: .6rem !important; padding: .62rem .75rem !important; }
    body.cchap-ui .cchap-chat-page .customer-chat-card { height: calc(100vh - 140px); }
    body.cchap-ui .cchap-order-create-page .service-gallery__viewport { height: 125px; }
    body.cchap-ui .cchap-order-create-page .service-picker-fields-grid > .service-picker-group { padding-block: .55rem; }
}
