:root {
    --app-primary: #3498db;
    --app-primary-dark: #2176ae;
    --app-background: #f4f6f9;
    --app-surface: #ffffff;
    --app-border: #e2e8f0;
    --app-text: #1f2d3d;
    --app-muted: #6b778c;
    --app-success: #27ae60;
    --app-warning: #f39c12;
    --app-danger: #e74c3c;
    --app-radius-sm: 8px;
    --app-radius-md: 12px;
    --app-radius-lg: 18px;
    --app-shadow-sm: 0 2px 10px rgba(31, 45, 61, .06);
    --app-shadow-md: 0 10px 30px rgba(31, 45, 61, .09);
    --app-transition: 180ms ease;
    --app-page-gutter: 1rem;
    --app-card-padding-x: 1.15rem;
    --app-card-padding-y: 1rem;
    --app-section-gap: 1.5rem;
    --app-control-height: 42px;
    --app-table-cell-x: .68rem;
    --app-table-cell-y: .72rem;
}

body[class*="role-"] { color: var(--app-text); background: var(--app-background); }
body[class*="role-"] .content-wrapper { min-width: 0; background: var(--app-background); }
body[class*="role-"] .content-header { padding-top: 1.25rem; padding-bottom: .85rem; }
body[class*="role-"] .content-header h1 { color: var(--app-text); font-size: clamp(1.35rem, 2vw, 1.75rem); font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
body[class*="role-"] .breadcrumb { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .15rem; margin: 0; font-size: .82rem; overflow-wrap: anywhere; }
body[class*="role-"] .breadcrumb-item { max-width: 100%; }

body[class*="role-"] .card-dashboard,
body[class*="role-"] .card:not(.small-box) { border: 1px solid var(--app-border); border-radius: var(--app-radius-md); box-shadow: var(--app-shadow-sm); }
body[class*="role-"] .card-header { min-width: 0; padding: var(--app-card-padding-y) var(--app-card-padding-x); border-bottom: 1px solid var(--app-border); background: var(--app-surface); }
body[class*="role-"] .card-header:has(.card-title) { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
body[class*="role-"] .card-title { min-width: 0; margin: 0; color: var(--app-text); font-size: 1rem; font-weight: 650; line-height: 1.35; overflow-wrap: anywhere; }
body[class*="role-"] .card-header .badge { flex: 0 0 auto; margin-left: auto; }
body[class*="role-"] .card-header > .btn,
body[class*="role-"] .card-header > a[class*="btn"] { margin-left: auto; }
body[class*="role-"] .card-body { min-width: 0; padding: var(--app-card-padding-y) var(--app-card-padding-x); }
body[class*="role-"] .card-footer { padding: .9rem var(--app-card-padding-x); border-top: 1px solid var(--app-border); background: var(--app-surface); }

body[class*="role-"] .form-label { margin-bottom: .42rem; color: #34445d; font-size: .86rem; font-weight: 600; }
body[class*="role-"] .form-control,
body[class*="role-"] .form-select { min-height: var(--app-control-height); border-color: #d7dee8; border-radius: var(--app-radius-sm); color: var(--app-text); font-size: .9rem; transition: border-color var(--app-transition), box-shadow var(--app-transition); }
body[class*="role-"] textarea.form-control { min-height: 88px; line-height: 1.55; resize: vertical; }
body[class*="role-"] .form-control:focus,
body[class*="role-"] .form-select:focus { border-color: var(--app-primary); box-shadow: 0 0 0 3px rgba(52, 152, 219, .14); }
body[class*="role-"] .form-control:disabled,
body[class*="role-"] .form-select:disabled,
body[class*="role-"] .form-control[readonly] { background: #f1f4f8; color: #66758a; opacity: 1; }
body[class*="role-"] .form-text { color: var(--app-muted); font-size: .78rem; line-height: 1.45; }
body[class*="role-"] .invalid-feedback { font-size: .78rem; }

/* Shared containment and form rhythm for every authenticated complaint detail page. */
body[class*="role-"] .complaint-detail-page,
body[class*="role-"] .complaint-detail-page > [class*="col-"] { min-width: 0; }
body[class*="role-"] .complaint-detail-page .card { max-width: 100%; }
body[class*="role-"] .complaint-detail-page .card-body,
body[class*="role-"] .complaint-detail-page .card-footer { overflow-wrap: anywhere; }
body[class*="role-"] .complaint-detail-page form > .mb-3,
body[class*="role-"] .complaint-detail-page .action-field { margin-bottom: 1.05rem; }
body[class*="role-"] .complaint-detail-page .form-control,
body[class*="role-"] .complaint-detail-page .form-select { width: 100%; max-width: 100%; }
body[class*="role-"] .complaint-detail-page textarea.form-control { min-height: 90px; }
body[class*="role-"] .complaint-detail-page img,
body[class*="role-"] .complaint-detail-page video { max-width: 100%; }
body[class*="role-"] .complaint-detail-page .btn.w-100 { min-height: 43px; }

body[class*="role-"] .btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 38px; border-radius: var(--app-radius-sm); font-size: .86rem; font-weight: 600; transition: transform var(--app-transition), box-shadow var(--app-transition), background-color var(--app-transition); }
body[class*="role-"] .btn-sm { min-height: 32px; font-size: .78rem; }
body[class*="role-"] .btn > i { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; line-height: 1; }

/* Button dimensions by function: toolbar/header, form, and compact table action. */
body[class*="role-"] .dashboard-search-actions .btn,
body[class*="role-"] .dashboard-header-action,
body[class*="role-"] .filter-form-actions .btn,
body[class*="role-"] .filter-action-btn,
body[class*="role-"] .card-header .history-list-actions .btn {
    min-height: 44px;
    height: 44px;
    padding: 9px 18px !important;
    gap: 8px;
    border-radius: var(--app-radius-sm) !important;
    font-size: .875rem;
    line-height: 1.2;
    white-space: nowrap;
}
body[class*="role-"] .dashboard-quick-search .form-control {
    min-height: 44px;
    height: 44px;
}
body[class*="role-"] .centered-form-actions > .btn,
body[class*="role-"] .centered-form-actions > form > .btn,
body[class*="role-"] .complaint-detail-page .btn.w-100,
body[class*="role-"] .complaint-conversation-actions .btn {
    min-height: 42px;
    padding-top: 9px !important;
    padding-bottom: 9px !important;
    line-height: 1.2;
}
body[class*="role-"] .app-col-action .btn-sm,
body[class*="role-"] td.text-center .btn-sm,
body[class*="role-"] .app-icon-action {
    min-height: 34px;
    height: 34px;
    border-radius: var(--app-radius-sm) !important;
    line-height: 1;
}
body[class*="role-"] .btn:focus-visible { outline: 0; box-shadow: 0 0 0 3px rgba(52, 152, 219, .22); }
body[class*="role-"] .btn:not(:disabled):active { transform: translateY(1px); }

body[class*="role-"] .badge { display: inline-flex; align-items: center; justify-content: center; max-width: none; padding: .38rem .62rem; border-radius: 999px; font-size: .72rem; font-weight: 650; line-height: 1.2; white-space: nowrap; text-align: center; word-break: normal; overflow-wrap: normal; }
body[class*="role-"] .table-responsive { border-radius: var(--app-radius-sm); overflow-x: auto; -webkit-overflow-scrolling: touch; }
body[class*="role-"] .table-responsive > table { width: 100%; min-width: 0; table-layout: auto; }
body[class*="role-"] .table { margin-bottom: 0; color: var(--app-text); font-size: .86rem; vertical-align: middle; }
body[class*="role-"] .table thead th { padding: var(--app-table-cell-y) var(--app-table-cell-x); border-bottom-width: 1px; background: #f7f9fc; color: #526176; font-size: .75rem; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; white-space: nowrap; }
body[class*="role-"] .table.table-header-navy thead th { padding: 13px 15px; border: 0; border-bottom: 1px solid rgba(255,255,255,.12); background: #122543; color: #fff; font-size: .75rem; font-weight: 700; line-height: 1.35; vertical-align: middle; }
body[class*="role-"] .table.table-header-navy thead th:first-child { border-top-left-radius: var(--app-radius-md); }
body[class*="role-"] .table.table-header-navy thead th:last-child { border-top-right-radius: var(--app-radius-md); }
body[class*="role-"] .table tbody td { padding: var(--app-table-cell-y) var(--app-table-cell-x); border-color: #edf0f4; word-break: normal; overflow-wrap: normal; }
body[class*="role-"] .table-hover tbody tr:hover { background: #f8fbff; }
body[class*="role-"] .app-col-compact { width: 48px; white-space: nowrap; text-align: center; }
body[class*="role-"] .app-col-numeric { width: 72px; white-space: nowrap; text-align: center; }
body[class*="role-"] .app-col-nowrap { width: 96px; white-space: nowrap; text-align: center; }
body[class*="role-"] .app-col-ticket { width: 125px; white-space: nowrap; }
body[class*="role-"] .app-col-date { width: 122px; white-space: nowrap; }
body[class*="role-"] .app-col-email { width: 17%; white-space: nowrap; }
body[class*="role-"] .app-col-medium { width: 15%; white-space: normal; word-break: normal; overflow-wrap: break-word; }
body[class*="role-"] .app-col-flexible { width: 24%; white-space: normal; word-break: normal; overflow-wrap: break-word; }
body[class*="role-"] .app-col-action { width: 96px; white-space: nowrap; text-align: center; }
body[class*="role-"] .app-col-action .btn,
body[class*="role-"] .app-col-action form { flex: 0 0 auto; }
body[class*="role-"] .app-icon-action { width: 34px; min-width: 34px; height: 34px; min-height: 34px; padding: 0; line-height: 1; }
body[class*="role-"] .pagination { flex-wrap: wrap; gap: .25rem; }
body[class*="role-"] .page-link { min-width: 34px; border-radius: 7px; color: var(--app-primary-dark); text-align: center; }

body[class*="role-"] .alert { border-radius: var(--app-radius-sm); font-size: .88rem; line-height: 1.5; }
body[class*="role-"] .modal-content { border: 0; border-radius: var(--app-radius-md); box-shadow: var(--app-shadow-md); }
body[class*="role-"] .modal-header,
body[class*="role-"] .modal-footer { border-color: var(--app-border); }
body[class*="role-"] input[type="password"]::-ms-reveal,
body[class*="role-"] input[type="password"]::-ms-clear,
.auth-input input[type="password"]::-ms-reveal,
.auth-input input[type="password"]::-ms-clear { display: none; width: 0; height: 0; }

.has-password-toggle { position: relative; }
.has-password-toggle > input.form-control,
.has-password-toggle > .form-control { padding-right: 46px; }
.has-password-toggle input[type="password"]::-ms-reveal,
.has-password-toggle input[type="password"]::-ms-clear { display: none; width: 0; height: 0; }
.ui-password-toggle { position: absolute; z-index: 4; top: 50%; right: 8px; display: inline-grid; width: 34px; height: 34px; padding: 0; place-items: center; transform: translateY(-50%); border: 0; border-radius: 7px; background: transparent; color: #6c7788; cursor: pointer; }
.ui-password-toggle:hover { background: #eef6ff; color: var(--app-primary-dark); }
.ui-password-toggle:focus-visible { outline: 0; box-shadow: 0 0 0 3px rgba(52, 152, 219, .2); }
.ui-password-toggle i { pointer-events: none; }

.auth-shell .auth-card { border: 1px solid rgba(255,255,255,.08); box-shadow: var(--app-shadow-md); }
.auth-shell .form-control,
.auth-shell .form-select { border-color: #d7dee8; border-radius: var(--app-radius-sm); }
.auth-shell .form-control:focus,
.auth-shell .form-select:focus { border-color: var(--app-primary); box-shadow: 0 0 0 3px rgba(52,152,219,.14); }
.auth-shell .alert { border-radius: var(--app-radius-sm); font-size: .84rem; }
.auth-shell .has-password-toggle input[type="password"]::-ms-reveal,
.auth-shell .has-password-toggle input[type="password"]::-ms-clear { display: none; }

/* Shared compact multi-select used by complaint workflow forms. */
.complaint-detail-page .unit-multiselect { position: relative; width: 100%; min-width: 0; margin-bottom: .65rem; }
.complaint-detail-page .unit-combobox-control { position: relative; width: 100%; padding: .35rem .5rem; border: 1px solid #ced4da; border-radius: 8px; background: #fff; cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease; }
.complaint-detail-page .unit-combobox-control:focus-within { border-color: #86b7fe; box-shadow: 0 0 0 .2rem rgba(13,110,253,.12); }
.complaint-detail-page .unit-combobox-control.is-invalid { border-color: #dc3545; }
.complaint-detail-page .unit-combobox-control.is-disabled { background: #f8fafc; cursor: not-allowed; opacity: .82; }
.complaint-detail-page .unit-multiselect-chips { display: flex; flex-wrap: wrap; gap: .25rem; min-width: 0; }
.complaint-detail-page .unit-combobox-control .unit-multiselect-chips:empty { display: none; }
.complaint-detail-page .unit-chip { display: inline-flex; align-items: center; gap: .2rem; max-width: 100%; padding: .18rem .4rem; border: 1px solid #c5d9f3; border-radius: 999px; background: #f0f6ff; color: #234f84; font-size: .73rem; font-weight: 500; line-height: 1.2; }
.complaint-detail-page .unit-chip-remove { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 16px; width: 16px; height: 16px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #52749c; font-size: .9rem; line-height: 1; cursor: pointer; }
.complaint-detail-page .unit-chip-remove:hover { background: #d7e8fb; color: #173e6d; }
.complaint-detail-page .unit-combobox-control .unit-multiselect-toggle { display: flex; align-items: center; justify-content: space-between; gap: .5rem; width: 100%; min-height: 26px; margin-top: .1rem; padding: .1rem .1rem 0; border: 0; background: transparent; color: #637087; text-align: left; font-size: .8rem; line-height: 1.25; cursor: pointer; }
.complaint-detail-page .unit-multiselect-toggle i { flex: 0 0 auto; color: #8290a5; font-size: .68rem; transition: transform .15s ease; pointer-events: none; }
.complaint-detail-page .unit-multiselect-toggle:disabled { cursor: not-allowed; }
.complaint-detail-page .unit-multiselect-option:has(input:disabled) { background: #f8fafc; color: #7b8798; cursor: not-allowed; }
.complaint-detail-page .unit-multiselect-toggle[aria-expanded="true"] i { transform: rotate(180deg); }
.complaint-detail-page .unit-multiselect-menu { position: absolute; inset: auto 0 auto 0; display: none; width: 100%; max-height: 248px; margin-top: .3rem; padding: 4px 0; overflow-x: hidden; overflow-y: auto; border: 1px solid #dce3ec; border-radius: 8px; background: #fff; box-shadow: 0 7px 18px rgba(24,39,75,.11); z-index: 1050; scrollbar-width: thin; }
.complaint-detail-page .unit-multiselect-menu.show { display: block; }
.complaint-detail-page .unit-multiselect-option { position: relative; display: flex; align-items: center; gap: 10px; min-height: 40px; margin: 0; padding: 10px 14px 10px 18px; box-sizing: border-box; overflow: visible; border-radius: 5px; color: #34445d; cursor: pointer; font-size: 14px; font-weight: 500; line-height: normal; }
.complaint-detail-page .unit-multiselect-option:hover { background: #f1f6fc; }
.complaint-detail-page .unit-multiselect-option.is-selected { background: #edf5ff; color: #234f84; }
.complaint-detail-page .unit-multiselect-option .form-check-input { position: static; inset: auto; float: none; flex: 0 0 16px; width: 16px; height: 16px; margin: 0; transform: none; }
.complaint-detail-page .unit-multiselect-option .unit-option-label { position: static; display: block; flex: 1 1 auto; min-width: 0; margin: 0; padding: 0; overflow: visible; color: inherit; font-size: 14px; font-weight: 500; line-height: 1.35; text-indent: 0; text-overflow: unset; white-space: normal; transform: none; }

/* Shared conversation section for complaint detail pages. */
.complaint-conversation-card { overflow: hidden; }
.complaint-conversation-list { display: grid; max-height: 380px; overflow-y: auto; }
.complaint-conversation-item { display: flex; align-items: flex-start; gap: .75rem; padding: .9rem 0; }
.complaint-conversation-item + .complaint-conversation-item { border-top: 1px solid var(--app-border); }
.complaint-conversation-avatar { display: grid; place-items: center; flex: 0 0 38px; width: 38px; height: 38px; border-radius: 50%; background: #edf4ff; color: #1769d2; }
.complaint-conversation-content { min-width: 0; flex: 1 1 auto; }
.complaint-conversation-meta { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.complaint-conversation-meta strong { color: #263851; }
.complaint-conversation-meta time { flex: 0 0 auto; color: var(--app-muted); font-size: .78rem; }
.complaint-conversation-role { display: inline-block; margin-left: .35rem; color: var(--app-muted); font-size: .72rem; }
.complaint-conversation-content p { margin: .4rem 0 0; line-height: 1.55; overflow-wrap: anywhere; white-space: pre-wrap; }
.complaint-conversation-attachment { margin-top: .55rem; max-width: 100%; overflow-wrap: anywhere; }
.complaint-conversation-empty { padding: 1.5rem 1rem; color: var(--app-muted); text-align: center; }
.complaint-conversation-form { display: grid; gap: 1rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--app-border); }
.complaint-conversation-form textarea.form-control { width: 100%; min-height: 100px; resize: vertical; }
.complaint-conversation-form input[type="file"] { width: 100%; }
.complaint-conversation-actions { display: flex; justify-content: flex-end; }
.complaint-conversation-actions .btn { min-height: 42px; }

/* Shared actions on Admin notification detail pages. */
.notification-detail-actions { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 12px; }
.notification-detail-action { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 46px; padding: .625rem 1rem; border-radius: 8px; font-size: .875rem; font-weight: 600; line-height: 1.25; }
.notification-detail-action i { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 1rem; width: 1rem; height: 1rem; font-size: .875rem; line-height: 1; }

@media (max-width: 991.98px) {
    body[class*="role-"] .content-header .row > [class*="col-"] { width: 100%; }
    body[class*="role-"] .breadcrumb { justify-content: flex-start; margin-top: .35rem; }
    body[class*="role-"] .complaint-detail-page > [class*="col-"] { width: 100%; max-width: 100%; }
}
@media (max-width: 1279.98px) {
    body[class*="role-"] .table-responsive > table { width: max-content; min-width: 100%; }
    body[class*="role-"] .app-col-compact { min-width: 48px; }
    body[class*="role-"] .app-col-numeric { min-width: 72px; }
    body[class*="role-"] .app-col-nowrap { min-width: 104px; }
    body[class*="role-"] .app-col-ticket { min-width: 135px; }
    body[class*="role-"] .app-col-date { min-width: 128px; }
    body[class*="role-"] .app-col-email { min-width: 180px; }
    body[class*="role-"] .app-col-medium { min-width: 150px; max-width: 240px; }
    body[class*="role-"] .app-col-flexible { min-width: 200px; max-width: 340px; }
    body[class*="role-"] .app-col-action { min-width: 96px; }
}
@media (max-width: 767.98px) {
    .complaint-detail-page .unit-multiselect-menu { max-height: 220px; }
    body[class*="role-"] .content-header { padding-top: 1rem; }
    body[class*="role-"] .card-header { align-items: flex-start; flex-wrap: wrap; padding: .9rem 1rem; }
    body[class*="role-"] .card-body { padding: 1rem; }
    body[class*="role-"] .card-header .badge { margin-left: auto; }
    body[class*="role-"] .table { font-size: .82rem; }
}
@media (max-width: 575.98px) {
    body[class*="role-"] .btn-mobile-block { width: 100%; }
    body[class*="role-"] .card-title { font-size: .95rem; }
    .auth-shell .auth-card { border-radius: var(--app-radius-lg); }
    body[class*="role-"] .complaint-detail-page { margin-right: 0; margin-left: 0; }
    body[class*="role-"] .complaint-detail-page > [class*="col-"] { padding-right: 0; padding-left: 0; }
    .complaint-conversation-meta { flex-direction: column; gap: .15rem; }
    .complaint-conversation-actions .btn { width: 100%; }
    .notification-detail-actions { align-items: stretch; }
    .notification-detail-action { flex: 1 1 100%; width: 100%; }
    body[class*="role-"] .dashboard-search-actions .btn,
    body[class*="role-"] .dashboard-header-action,
    body[class*="role-"] .filter-form-actions .btn,
    body[class*="role-"] .filter-action-btn,
    body[class*="role-"] .card-header .history-list-actions .btn { width: 100%; min-height: 44px; height: auto; }
}
