/* Customer workspace shares the approved administrative console. */
.customer-field-label { font-weight: inherit; }
.customer-field-help { margin: 7px 0 0; color: #526285; font-size: .8rem; line-height: 1.5; }
.customer-duplicate-link { display: inline-block; margin-top: 8px; color: #234d9c; text-decoration: underline; text-underline-offset: 3px; }
/* Customer detail: compact side-by-side reading at desktop sizes. */
.customer-editor__fields { display: grid; gap: 18px; }
@media (min-width: 821px) and (min-height: 480px) {
    .customer-form-page.page-shell { width: calc(100% - 28px); max-width: none; height: 100%; min-height: 0; margin: 0 auto; padding: 12px 0; }
    .customer-form-page .customer-editor { display: flex; flex-direction: column; height: 100%; min-height: 0; border-radius: 16px; }
    .customer-form-page .customer-editor__header { flex: 0 0 auto; min-height: 64px; padding: 12px 18px; gap: 16px; }
    .customer-form-page .customer-editor__header h1 { font-size: 1.4rem; line-height: 1.2; }
    .customer-form-page .customer-editor__header p { margin: 3px 0 0; font-size: .75rem; }
    .customer-form-page .customer-editor__back { min-height: 34px; padding: 7px 11px; font-size: .75rem; }
    .customer-form-page .customer-editor__form { display: flex; flex-direction: column; flex: 1; min-height: 0; gap: 10px; padding: 12px 18px; }
    .customer-form-page .customer-editor__fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(9, auto); align-content: start; align-items: start; gap: 6px 16px; flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #b8c8df #f2f5fa; padding: 2px 4px; }
    .customer-form-page .customer-field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; min-width: 0; }
    .customer-form-page .customer-field > label { padding: 0; font-size: .73rem; line-height: 1.25; }
    .customer-form-page .customer-field__control { min-width: 0; gap: 3px; max-width: none; }
    .customer-form-page .customer-fields-heading { grid-column: 1 / -1; margin: 3px 0 0; padding: 0 0 4px; border-bottom: 1px solid #dce5f4; color: #172f58; font-size: .8rem; line-height: 1.25; }
    .customer-form-page .customer-fields-heading:first-child { grid-row: 1; }
    .customer-form-page .customer-fields-heading:nth-of-type(2) { grid-row: 4; }
    .customer-form-page .customer-fields-heading:nth-of-type(3) { grid-row: 7; }
    .customer-form-page .customer-field--name { grid-column: 1 / -1; grid-row: 2; }
    .customer-form-page .customer-field--phone { grid-column: 1 / 3; grid-row: 3; }
    .customer-form-page .customer-field--email { grid-column: 3 / 5; grid-row: 3; }
    .customer-form-page .customer-field--wilaya { grid-column: 1 / 3; grid-row: 5; }
    .customer-form-page .customer-field--commune { grid-column: 3 / 5; grid-row: 5; }
    .customer-form-page .customer-field--address { grid-column: 1 / -1; grid-row: 6; }
    .customer-form-page .customer-field--notes { grid-column: 1 / 3; grid-row: 8; }
    .customer-form-page .customer-field--is_active { grid-column: 3 / 5; grid-row: 8; display: flex; align-items: center; gap: 9px; }
    .customer-form-page .customer-field--is_active > label { padding: 0; }
    .customer-form-page .customer-active-checkbox { width: 16px; height: 16px; accent-color: #315bd0; }
    .customer-form-page .customer-auto-code { grid-column: 3 / 5; grid-row: 9; align-self: start; margin: 0; color: #526285; font-size: .7rem; line-height: 1.4; }
    .customer-form-page .customer-editor .form-control { min-height: 33px; height: 33px; padding: 6px 9px; border-radius: 7px; font-size: .8rem; line-height: 1.25; }
    .customer-form-page .customer-editor textarea.form-control { min-height: 52px; height: 52px; }
    .customer-form-page .customer-field-help { margin: 1px 0 0; font-size: .65rem; line-height: 1.35; }
    .customer-form-page .error-message, .customer-form-page .customer-duplicate-link { margin: 3px 0 0; font-size: .72rem; line-height: 1.35; }
    .customer-form-page .customer-editor__actions { flex: 0 0 auto; min-height: 42px; margin: 0; padding-top: 8px; gap: 8px; }
    .customer-form-page .customer-editor__actions :is(button, .button-link) { min-height: 34px; padding: 7px 15px; border-radius: 9px; font-size: .76rem; }
}
.customer-detail-page .customer-detail-grid { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.15fr); gap: 20px; min-height: 0; }
.customer-detail-page .customer-detail-summary { min-width: 0; min-height: 0; }
.customer-detail-page .customer-detail__fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; margin: 0; }
.customer-detail-page .customer-detail__fields > div { display: block; min-width: 0; margin: 0; padding: 0 0 6px; border: 0; border-bottom: 1px solid #e1e7f1; }
.customer-detail-page .customer-detail__fields dt { margin: 0 0 3px; color: #526285; font-size: .7rem; font-weight: 600; line-height: 1.2; }
.customer-detail-page .customer-detail__fields dd { margin: 0; color: #172f58; font-size: .8rem; line-height: 1.35; overflow-wrap: anywhere; }
.customer-detail-page .customer-detail__fields .customer-detail__address, .customer-detail-page .customer-detail__fields > div:last-child { grid-column: 1 / -1; }
.customer-detail-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 12px; }
.customer-detail-metrics > div { display: grid; gap: 4px; min-width: 0; padding: 9px; border: 1px solid #e1e8f5; border-radius: 9px; background: #f5f8ff; }
.customer-detail-metrics span { color: #526285; font-size: .66rem; }
.customer-detail-metrics strong { color: #18346f; font-size: .78rem; overflow-wrap: anywhere; }
.customer-detail-page .customer-detail__fields .customer-detail__section { padding-block: 2px 0; border: 0; }
.customer-detail-page .customer-detail__section dt { color: #172f58; font-size: .78rem; font-weight: 700; }
.customer-detail-page h2 { margin: 0 0 12px; padding: 0; border: 0; font-size: .95rem; line-height: 1.35; }
.customer-detail-page .customer-documents { min-height: 0; margin: 0; padding: 0; border: 0; }
.customer-detail-page .customer-record-tabs { gap: 6px; }
.customer-detail-page .customer-record-tabs a { gap: 5px; min-height: 34px; padding: 6px 8px; font-size: .73rem; }
.customer-detail-page .customer-record-tabs a[aria-current] { background: #465f8b; }
.customer-detail-page .customer-record-list { margin: 10px 0; }
.customer-detail-page .customer-record-list a { min-height: 45px; padding: 8px 3px; gap: 8px; font-size: .73rem; }
.customer-detail-page .customer-record-list strong { color: #244d9e; }
.customer-detail-page .customer-record-list .empty-state { margin: 0; padding: 20px 10px; font-size: .8rem; line-height: 1.5; }
.customer-detail-page .customer-record-pagination { justify-content: space-between; gap: 6px; font-size: .73rem; }
.customer-detail-page .customer-record-pagination a { min-height: 34px; }
@media (min-width: 821px) and (min-height: 480px) {
    body:has(.customer-detail-page, .customer-form-page) .site-shell { display: grid; grid-template-rows: 64px minmax(0, 1fr); height: 100dvh; min-height: 0; }
    body:has(.customer-detail-page, .customer-form-page) .site-footer, body:has(.customer-detail-page, .customer-form-page) .mobile-action-bar { display: none; }
    body:has(.customer-detail-page, .customer-form-page) .topbar__inner { height: 64px; min-height: 0; padding-block: 6px; gap: 12px; }
    body:has(.customer-detail-page, .customer-form-page) .brand-logo { flex-basis: 42px; width: 42px; height: 42px; border-radius: 10px; }
    body:has(.customer-detail-page, .customer-form-page) .brand-title { font-size: .85rem; }
    body:has(.customer-detail-page, .customer-form-page) .brand-subtitle { font-size: .63rem; }
    body:has(.customer-detail-page, .customer-form-page) .topbar__brand { gap: 8px; }
    body:has(.customer-detail-page, .customer-form-page) .topbar__link, body:has(.customer-detail-page, .customer-form-page) .language-menu > summary { min-height: 34px; padding: 6px 9px; font-size: .75rem; }
    .customer-detail-page.page-shell { width: calc(100% - 28px); height: 100%; min-height: 0; margin: 0 auto; padding: 12px 0; }
    .customer-detail-page .customer-detail { display: flex; flex-direction: column; height: 100%; min-height: 0; padding: 17px 20px; border-radius: 16px; }
    .customer-detail-page .page-header { display: flex; flex-direction: row; align-items: center; flex: 0 0 auto; gap: 15px; margin: 0 0 16px; }
    .customer-detail-page .page-header > div:first-child { min-width: 0; }
    .customer-detail-page .page-header h1 { margin: 0; font-size: 1.4rem; line-height: 1.2; overflow-wrap: anywhere; }
    .customer-detail-page .page-header .subcopy { margin: 4px 0 0; font-size: .75rem; }
    .customer-detail-page .dashboard-actions { flex: 0 0 auto; display: flex; flex-direction: row; gap: 8px; padding: 0; margin: 0; border: 0; }
    .customer-detail-page .dashboard-actions .button-link { min-height: 36px; padding: 8px 12px; border-radius: 10px; font-size: .75rem; }
    .customer-detail-page .customer-detail-grid { flex: 1; overflow: hidden; }
    .customer-detail-page .customer-detail-summary { overflow-y: auto; padding-inline-end: 8px; scrollbar-width: thin; scrollbar-color: #b8c8df #f2f5fa; }
    .customer-detail-page .customer-documents { display: flex; flex-direction: column; overflow: hidden; }
    .customer-detail-page .customer-documents > h2, .customer-detail-page .customer-record-tabs, .customer-detail-page .customer-record-pagination { flex: 0 0 auto; }
    .customer-detail-page .customer-record-list { min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #b8c8df #f2f5fa; }
}
@media (max-width: 820px) {
    .customer-form-page .customer-editor__fields { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; overflow: visible; }
    .customer-form-page .customer-fields-heading, .customer-form-page .customer-field, .customer-form-page .customer-auto-code { grid-column: 1; grid-row: auto; }
    .customer-form-page .customer-field--is_active { justify-content: flex-start; }
    .customer-detail-metrics { grid-template-columns: minmax(0, 1fr); }
    .customer-detail-page .customer-detail-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; }
    .customer-detail-page .customer-detail__fields dd { font-size: .9rem; }
    .customer-detail-page .customer-record-tabs a { min-height: 44px; }
}
@media print {
    body:has(.customer-detail-page, .customer-form-page) .site-shell, .customer-detail-page.page-shell, .customer-detail-page .customer-detail { display: block; height: auto; }
    .customer-detail-page .customer-detail-grid { display: block; overflow: visible; }
    .customer-detail-page .customer-detail-summary, .customer-detail-page .customer-documents, .customer-detail-page .customer-record-list { overflow: visible; height: auto; }
}
.customer-workspace .cw-welcome { min-height: 126px; }
.customer-workspace .cw-welcome > div { width: 48%; }
.customer-workspace .cw-welcome h1 { font-size: 2rem; }
.cw-primary { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 10px 17px; border-radius: 22px; color: #fff; background: #1c43ac; font-size: .8rem; font-weight: 650; }
.cw-primary:hover { color: #fff; background: #143581; }
.cw-new-client { position: relative; z-index: 2; margin-inline-start: auto; }
.customer-workspace .warehouse-search { display: flex; align-items: center; width: min(560px, 64%); }
.customer-workspace .warehouse-search input { padding-inline-end: 92px; }
.cw-search-submit { position: absolute; inset-inline-end: 5px; min-height: 28px; padding: 4px 9px; border: 0; border-radius: 16px; color: #244798; background: #edf2ff; box-shadow: none; font-size: .65rem; }
.customer-workspace .cw-search-submit:hover { color: #fff; background: #315bd0; }
.cw-layout { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); align-items: start; gap: 14px; margin-top: 14px; }
.cw-list, .cw-profile { min-height: 350px; }
.cw-list { padding: 14px 0 0; overflow: visible; }
.cw-list > header, .cw-list > .cw-rule { margin-inline: 14px; }
.cw-filters { display: flex; align-items: center; gap: 7px; margin: 10px 14px 6px; }
.cw-filters input, .cw-filters select { min-height: 34px; width: auto; margin: 0; padding: 6px 9px; border: 1px solid #d8e1fa; border-radius: 18px; color: #213b79; background: #f7f9ff; font-size: .72rem; }
.cw-filters input { flex: 1; min-width: 80px; }
.cw-filters select { max-width: 140px; }
.cw-filters button { min-height: 34px; padding: 6px 10px; border: 0; border-radius: 9px; color: #fff; background: #315bd0; box-shadow: none; font-size: .72rem; }
.cw-rule { margin: 5px 0 9px; color: #526285; font-size: .67rem; line-height: 1.5; }
.cw-table-wrap { overflow-x: auto; }
.customer-workspace .cw-table { width: 100%; margin: 0; border-collapse: collapse; font-size: .72rem; }
.customer-workspace .cw-table th { padding: 8px 9px; color: #172d64; background: #eaf0ff; text-align: start; font-size: .68rem; letter-spacing: 0; text-transform: none; }
.customer-workspace .cw-table td { padding: 9px; border-bottom: 1px solid #eef1fa; color: #243b70; font-size: .7rem; }
.cw-table td:nth-child(2), .cw-table td:nth-child(4) { white-space: nowrap; }
.cw-table td.cw-email-column { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cw-table tr.is-selected { background: #edf3ff; }
.cw-table tr:hover { background: #f0f4ff; }
.cw-client-name { display: flex; align-items: center; gap: 7px; min-width: 125px; max-width: 200px; color: #172f6c; font-weight: 650; }
.cw-client-name:hover { text-decoration: underline; text-underline-offset: 3px; }
.cw-client-name > span:last-child { overflow-wrap: anywhere; }
.cw-initial { display: grid; flex: 0 0 24px; height: 24px; place-items: center; border: 1px solid #b0c8f4; border-radius: 50%; background: #e1ecff; color: #244e9e; font-size: .62rem; }
.cw-pagination { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 9px; padding: 12px 14px; color: #526285; font-size: .68rem; }
.cw-pagination nav { display: flex; align-items: center; gap: 8px; }
.cw-pagination a { display: inline-block; padding: 5px 7px; border: 1px solid #d8e1fa; border-radius: 6px; color: #234dce; background: #fff; }
.cw-exports { position: relative; color: #3154a9; font-size: .7rem; z-index: 5; }
.cw-exports summary { cursor: pointer; padding: 6px; }
.cw-exports > div { position: absolute; inset-inline-end: 0; display: grid; gap: 3px; width: 210px; padding: 8px; border: 1px solid #d8e1fa; border-radius: 10px; background: #fff; box-shadow: 0 8px 18px #15377818; }
.cw-exports a { padding: 8px; color: #244798; }
.cw-exports a:hover { background: #edf2ff; }
.cw-exports small { padding: 7px; color: #526285; }
.cw-profile { padding: 0 16px 12px; overflow: hidden; }
.cw-tabs { display: flex; gap: 4px; margin: 0 -16px 15px; padding: 8px 8px 0; border-bottom: 1px solid #dce5fa; }
.cw-tabs a { flex: 1; min-width: 0; padding: 10px 4px; border-radius: 8px 8px 0 0; color: #18346f; font-size: .69rem; font-weight: 650; text-align: center; }
.cw-tabs a[aria-current] { color: #fff; background: #3866dc; }
.cw-profile-heading { display: flex; align-items: center; gap: 18px; margin: 17px 0; }
.cw-avatar { display: grid; flex: 0 0 74px; height: 74px; place-items: center; border: 7px solid #e9f0ff; border-radius: 50%; color: #fff; background: #3575b9; font-size: 1.7rem; font-weight: 650; }
.cw-profile-heading > div { min-width: 0; }
.cw-profile-heading h2 { display: block; margin: 0 0 6px; font-size: 1.2rem; overflow-wrap: anywhere; }
.cw-contact { display: grid; gap: 9px; margin: 0 0 17px; }
.cw-contact > div { display: grid; grid-template-columns: 75px minmax(0, 1fr); gap: 8px; }
.cw-contact dt { color: #526285; font-size: .7rem; }
.cw-contact dd { margin: 0; color: #1c356f; font-size: .76rem; overflow-wrap: anywhere; }
.cw-contact a { color: #244d9e; }
.cw-profile-stats { display: grid; grid-template-columns: .8fr 1.3fr .8fr; padding: 14px 0; border-top: 1px solid #e7edfa; }
.cw-profile-stats > div { display: grid; gap: 4px; padding-inline: 8px; border-inline-end: 1px solid #e7edfa; }
.cw-profile-stats > div:last-child { border: 0; }
.cw-profile-stats strong { color: #18346f; font-size: .83rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.cw-profile-stats span { color: #526285; font-size: .67rem; }
.cw-balance { border-top: 1px solid #e7edfa; padding: 11px 0; font-size: .76rem; }
.cw-balance summary { cursor: pointer; color: #6f3048; }
.cw-balance summary strong { margin-inline-start: 7px; font-variant-numeric: tabular-nums; }
.cw-balance ul { margin: 9px 0 0; padding: 0; list-style: none; max-height: 180px; overflow-y: auto; }
.cw-balance li { display: grid; gap: 5px; padding: 8px 0; border-top: 1px solid #edf0fa; }
.cw-balance a { color: #244d9e; }
.cw-profile-actions { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 9px; padding-top: 9px; border-top: 1px solid #e7edfa; }
.cw-profile-actions a { color: #234dce; font-size: .72rem; }
.cw-records { margin: 0; padding: 0; list-style: none; }
.cw-records li + li { border-top: 1px solid #edf0fa; }
.cw-records a { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 49px; padding: 9px 0; color: #243b70; }
.cw-records a > span { display: grid; min-width: 0; gap: 4px; }
.cw-records strong { font-size: .72rem; overflow-wrap: anywhere; }
.cw-records small { color: #526285; font-size: .65rem; }
.cw-records bdi { flex: 0 0 auto; font-size: .7rem; font-variant-numeric: tabular-nums; }
.cw-records a:hover strong { text-decoration: underline; }
.cw-periods { display: flex; gap: 5px; }
.cw-periods a { padding: 5px 10px; border: 1px solid #dce5fa; border-radius: 16px; color: #3154a9; font-size: .67rem; }
.cw-periods a[aria-current] { color: #fff; background: #3866dc; border-color: #3866dc; }
.cw-empty { padding: 25px 12px; color: #526285; font-size: .8rem; line-height: 1.5; }
.cw-empty a { color: #234dce; }
.cw-back { display: none; }
.customer-workspace ::selection { color: #102860; background: #c9dcff; }
.customer-workspace input { caret-color: #315bd0; }
@media (min-width: 821px) and (max-width: 1100px) {
    .cw-email-column { display: none; }
    .cw-layout { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
    .cw-table .admin-status { white-space: normal; }
    .cw-profile { padding-inline: 12px; }
    .cw-profile-stats { grid-template-columns: 1fr 1.3fr; row-gap: 12px; }
    .cw-profile-stats > div:last-child { grid-column: 1 / -1; }
}
@media (max-width: 820px) {
    .cw-layout { grid-template-columns: minmax(0, 1fr); }
    .cw-profile, .cw-history, .cw-activity { display: none; }
    .customer-workspace--selected .cw-profile, .customer-workspace--selected .cw-history, .customer-workspace--selected .cw-activity { display: block; }
    .customer-workspace--selected .cw-profile { grid-row: 1; }
    .cw-back { display: block; margin: 13px 0; color: #244d9e; font-size: .8rem; }
    .cw-list { min-height: 0; }
    .cw-contact dt, .cw-contact dd, .cw-tabs a { font-size: .8rem; }
    .cw-profile-actions a, .cw-periods a { padding-block: 12px; }
    .cw-records a { min-height: 56px; }
    .customer-workspace .warehouse-search { width: 100%; }
    .customer-workspace .cw-welcome { align-items: flex-start; min-height: 180px; flex-direction: column; gap: 14px; }
    .customer-workspace .cw-welcome > div { width: 70%; }
    .cw-new-client { margin-inline-start: 0; }
    .cw-filters input, .cw-filters select, .cw-filters button { min-height: 42px; }
}
@media (max-width: 560px) {
    .cw-email-column, .cw-table th:nth-child(2), .cw-table td:nth-child(2) { display: none; }
    .cw-table .admin-status { white-space: normal; font-size: .62rem; }
    .cw-client-name { min-width: 95px; }
    .cw-filters { flex-wrap: wrap; }
    .cw-filters input { flex-basis: 100%; }
    .cw-filters select { flex: 1; max-width: none; }
    .cw-list > header { gap: 4px; }
    .cw-records a { align-items: flex-start; flex-direction: column; gap: 5px; }
}
