:root {
    /* Premium Primary - Navy Blue */
    --primary-50: #e7f0fa;
    --primary-100: #cfdef5;
    --primary-200: #a0c0ec;
    --primary-300: #71a1e3;
    --primary-500: #0b509d;
    --primary-600: #09407e;
    --primary-700: #07305e;
    --primary-800: #04203f;
    --primary-900: #02101f;

    --primary-50: #e7f0fa;
    --primary-100: #cfdef5;
    --primary-200: #a0c0ec;
    --primary-300: #71a1e3;
    --primary-500: #0b509d;
    --primary-600: #09407e;
    --primary-700: #07305e;
    --primary-800: #04203f;
    --primary-900: #02101f;

    --secondary-50: #f9fafb;
    --secondary-100: #f3f4f6;
    --secondary-200: #e5e7eb;
    --secondary-300: #d1d5db;
    --secondary-400: #9ca3af;
    --secondary-500: #6b7280;
    --secondary-600: #4b5563;
    --secondary-900: #111827;

    --tertiary-100: #fee2e2;
    --tertiary-500: #ef4444;
    --tertiary-900: #7f1d1d;

    --surface: #ffffff;
    --text-h3: 1.25rem;
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --radius-xs: 4px;
    --radius-pill: 999px;
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);

    --input-border-width: 1px;
    --input-border-color: #e2e8f0;
    --input-radius: 12px;

    /* UI Tokens */
    --border-subtle: #edf2f9;
    --surface: #ffffff;
    --gray-100: #f8f9fa;
    --font-main: 'Inter', -apple-system, sans-serif;

    /* Shared Variables from _Create/_Details */
    --active-bg: var(--primary-500);
    --active-border: var(--primary-200);
    --card-active-bg: var(--primary-50);
    --text-active: var(--primary-900);
    --text-title-inactive: var(--secondary-600);
    --text-sub: var(--secondary-400);

    --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

:root {

    /* §1a  Border radius */
    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --radius-xs: 4px;
    --radius-pill: 999px;

    /* §1b  Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.25s ease;
    --transition-slow: 0.4s ease;
    --transition-spring: 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);

    /* §1c  Form field — color & style tokens (no sizing here) */
    --input-border-color: var(--secondary-200, #e2e8f0);
    --input-border-focus: var(--primary-500, #3b82f6);
    --input-border-error: var(--tertiary-500, #ef4444);
    --input-border-disabled: var(--secondary-200, #e2e8f0);
    --input-border-width: 1px;
    --input-radius: var(--radius-sm);
    --input-focus-ring: var(--primary-100, #dbeafe);

    --input-bg: var(--surface, #ffffff);
    --input-bg-disabled: var(--secondary-200, #f3f4f6);
    --input-bg-readonly: var(--secondary-50, #f8fafc);

    --input-text: var(--secondary-900, #0f172a);
    --input-placeholder: var(--secondary-400, #94a3b8);
    --input-text-disabled: var(--secondary-600, #94a3b8);
    --input-icon-color: var(--secondary-400, #94a3b8);

    --label-font-weight: 600;
    --label-color: var(--secondary-600, #475569);
    --label-gap: 6px;

    --helper-color: var(--secondary-500, #64748b);
    --helper-error-color: var(--tertiary-500, #ef4444);

    --textarea-min-h: 110px;
    --textarea-resize: vertical;

    --check-size: 16px;
    --check-radius: var(--radius-xs);
    --check-color: var(--primary-500, #3b82f6);
    --check-border: var(--secondary-300, #cbd5e1);
    --check-gap: 8px;

    --input-transition: all var(--transition-fast);

    /* §1d  Z-index scale */
    --z-below: -1;
    --z-base: 0;
    --z-raised: 10;
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-overlay: 300;
    --z-modal: 400;
    --z-toast: 500;
    --z-tooltip: 600;

    /* §1e  Shadow scale */
    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.10), 0 1px 2px -1px rgb(0 0 0 / 0.10);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.10), 0 2px 4px -2px rgb(0 0 0 / 0.10);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.10), 0 4px 6px -4px rgb(0 0 0 / 0.10);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.10), 0 8px 10px -6px rgb(0 0 0 / 0.10);
    --shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);
}

:root {
    --page-px: 40px;
    --page-py: 20px;
    --card-pad: 28px;
    --content-bottom-margin: 24px;
    --form-bottom-margin: 16px;
    --badge-pad: 4px 12px;

    /* Typography */
    --text-h1: 2rem;
    /* 32px */
    --text-h2: 1.5rem;
    /* 24px */
    --text-h3: 1.25rem;
    /* 20px */
    --text-body: 0.95rem;
    /* 15px */
    --text-sm: 0.85rem;
    /* 14px */
    --text-xs: 0.775rem;
    /* 12px */

    --label-font: 0.85rem;
    --helper-font: 0.775rem;
    --btn-font: 0.9rem;

    /* Layout */
    --modal-pad: 30px;
    --stats-icon: 44px;

    /* Components */
    --btn-pad: 10px 20px;
    --btn-sm-pad: 6px 12px;
    --filter-pad: 10px 20px;
    --table-th-pad: 12px 14px;
    --table-td-pad: 14px;
    --pg-btn-size: 32px;
    --type-cols: 3;
    --action-btn-size: 32px;

    /* Form sizing */
    --input-h: 42px;
    --input-pad: 0.6rem 1rem;
    --input-font: 0.9rem;
    --select-h: 42px;
    --select-pad: 0.6rem 1rem;
    --select-font: 0.9rem;
    --datetime-pad: 0.5rem 0;
    --datetime-font: 0.9rem;
    --field-gap: 20px;
    --field-row-gap: 16px;
    --input-group-gap: 8px;

    --popover-width: 380px;
}

.page-header {
    padding: var(--page-py) var(--page-px);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-title h1 {
    font-size: var(--text-h1);
    font-weight: 700;
    color: var(--primary-900);
    margin: 0;
}

.page-title p {
    font-size: var(--text-sm);
    color: var(--secondary-500);
    margin-top: 4px;
}

.btn {
    font-size: var(--btn-font) !important;
    padding: var(--btn-pad) !important;
}

.btn-new#btn-new-company {
    gap: 8px !important;
}

.btn-new#btn-new-company:hover {
    background-color: var(--primary-600);
    box-shadow: 0 4px 12px rgba(26, 77, 179, 0.25);
    transform: translateY(-1px);
}

.page-content {
    padding: 0 var(--page-px);
}

.stats-card-container {
    flex: 0 0 auto;
    width: 33.33%;
}

.stats-card {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: var(--card-pad);
    border: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    transition: var(--transition-base);
}

.stats-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--card-shadow);
    border-color: var(--primary-200);
}

.stats-info span {
    font-size: var(--text-xs) !important;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.stats-info h2 {
    font-size: var(--text-h2);
}

.stats-info-sub {
    opacity: 0.8;
    margin-bottom: 0;
}

.stats-icon-box {
    width: var(--stats-icon);
    height: var(--stats-icon);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: calc(var(--stats-icon) * 0.45);
    background: var(--primary-50);
    color: var(--primary-500);
}

.stats-icon-box.icon-blue {
    background: #e0f2fe;
    color: #0369a1;
}

.stats-icon-box.icon-purple {
    background: #f3e8ff;
    color: #7e22ce;
}

.stats-icon-box.icon-orange {
    background: #ffedd5;
    color: #c2410c;
}

.filter-item {
    border: var(--input-border-width) solid var(--input-border-color);
    border-radius: var(--input-radius);
    overflow: hidden;
    background-color: var(--input-bg);
}

.filter-item .form-control,
.filter-item .form-select {
    border: none !important;
    background-color: transparent !important;
    box-shadow: none !important;
}

.filter-item .input-group-text {
    background-color: transparent;
    border: none;
    color: var(--input-icon-color);
    padding-left: 15px;
}

.custom-table-container {
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.custom-table-wrap {
    padding: 10px;
}

.custom-table th {
    padding: var(--table-th-pad);
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--secondary-600);
    background: var(--gray-100);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    min-width: 10%;
}

.custom-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.custom-table th.sortable:hover {
    background-color: var(--secondary-200);
    color: var(--primary-900);
}

.custom-table th.sortable .sort-icon {
    margin-left: 6px;
    font-size: 0.85em;
    color: var(--secondary-400);
    transition: color 0.2s ease;
}

.custom-table th.sortable.active {
    color: var(--primary-600);
    background-color: var(--primary-50);
}

.custom-table th.sortable.active .sort-icon {
    color: var(--primary-500);
}

.custom-table td {
    padding: var(--table-td-pad);
    font-size: var(--text-sm);
    color: var(--secondary-900);
    vertical-align: middle;
}


.custom-table tbody tr {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.custom-table tbody tr:hover {
    background-color: var(--secondary-50) !important;
}

.custom-table tbody tr:active {
    background-color: var(--secondary-100) !important;
}


.pagination-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 0 24px;
}

.pg-info {
    font-size: var(--text-xs);
    color: var(--secondary-500);
}

.pg-btn {
    width: var(--pg-btn-size);
    height: var(--pg-btn-size);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--secondary-200);
    background: var(--surface);
    color: var(--secondary-600);
    transition: var(--transition-fast);
}

.pg-btn:hover {
    border-color: var(--primary-500);
    color: var(--primary-500);
}

.pg-btn.active {
    background: var(--primary-500);
    color: #fff;
    border-color: var(--primary-500);
}


.form-control,
.form-select {
    height: var(--input-h);
    padding: var(--input-pad);
    font-size: var(--input-font);
    font-family: var(--font-main, 'Inter', sans-serif);
    color: var(--input-text) !important;
    border: var(--input-border-width) solid var(--input-border-color);
    border-radius: var(--input-radius);
    transition: var(--input-transition);
    width: 100%;
}

.form-control::placeholder {
    color: var(--input-placeholder);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--input-border-focus);
    box-shadow: 0 0 0 3px var(--input-focus-ring);
    outline: none;
}

.form-control:disabled,
.form-select:disabled {
    background-color: var(--input-bg-disabled);
    color: var(--input-text-disabled) !important;
    border-color: var(--input-border-disabled);
    cursor: not-allowed;
    opacity: 1;
}

.form-control[readonly] {
    background-color: var(--input-bg-readonly);
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-color: var(--input-border-error);
    box-shadow: none;
}

.form-control.is-invalid:focus,
.form-select.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

textarea.form-control {
    height: auto;
    min-height: var(--textarea-min-h);
    resize: var(--textarea-resize);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    background-size: var(--accordion-btn-icon-width);
}

.form-label {
    font-size: var(--label-font);
    font-weight: var(--label-font-weight);
    color: var(--label-color);
    margin-bottom: var(--label-gap);
    display: block;
}

.form-text {
    font-size: var(--helper-font);
    color: var(--helper-color);
    margin-top: 4px;
}

.form-text.text-danger {
    color: var(--helper-error-color);
}

/* Input with icon */
.input-icon-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon-wrap .form-control {
    padding-left: 36px;
}

.input-icon-wrap .input-icon {
    position: absolute;
    left: 12px;
    font-size: 14px;
    color: var(--input-icon-color);
    pointer-events: none;
}


.filter-size {
    display: flex;
    border-radius: var(--input-radius);
    color: var(--secondary-500);
    align-items: center;
    gap: 4px;
    font-size: var(--input-font);
    padding: 0 10px;
}

.filter-size-select {
    border-radius: var(--input-radius);
    padding: var(--badge-pad);
    border: none;
}

.filter-advanced-search-btn {
    padding: 0 !important;
    background-color: var(--primary-500);
    color: var(--surface);
    border: var(--input-border-width) solid var(--input-border-color);
    border-radius: var(--bs-border-radius);
}

.filter-advanced-search-btn:hover {
    background-color: var(--primary-600);
    color: var(--surface);
}

.filter-advanced-search-btn i {
    font-size: var(--text-h3);
    width: var(--input-h);
    height: var(--input-h);
    line-height: var(--input-h);
    padding: 0;
}

.page-jump span {
    font-size: var(--text-sm);
    flex: 1 1 0;
}

.page-jump input {
    flex: 1 1 0;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: var(--field-gap);
}

.field-row {
    display: flex;
    gap: var(--field-row-gap);
    align-items: flex-start;
}

.form-row-mb {
    margin-bottom: var(--form-bottom-margin);
}

.content-mb {
    margin-bottom: var(--content-bottom-margin);
}

.action-btn {
    width: var(--action-btn-size);
    height: var(--action-btn-size);
}

.action-btn.audit-trail-btn {
    background-color: var(--primary-50);
    color: var(--primary-500);
}

.action-btn.audit-trail-btn:hover {
    background-color: var(--primary-100);
    color: var(--primary-600);
}

.row-card-actions {
    display: flex;
    gap: 4px;
}

/* ═══════════════════════════════════════════════
   Create / Edit Customer Modal — Redesign
   ═══════════════════════════════════════════════ */

/* ── Modal shell ── */
.cu-form-modal-content {
    border-radius: 20px;
    border: none;
    overflow: hidden;
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.18);
}

/* ── Gradient Banner Header ── */
.cu-form-modal-header {
    position: relative;
    background: linear-gradient(135deg, #0b509d 0%, #1a6ec7 50%, #3b82f6 100%);
    padding: 28px 32px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    overflow: hidden;
}

/* Decorative circles */
.cu-form-header-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.cu-form-header-circle {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
}

.cu-form-header-circle-1 {
    width: 180px;
    height: 180px;
    top: -60px;
    right: 80px;
}

.cu-form-header-circle-2 {
    width: 100px;
    height: 100px;
    bottom: -30px;
    right: 20px;
    background: rgba(255, 255, 255, 0.05);
}

.cu-form-header-circle-3 {
    width: 60px;
    height: 60px;
    top: 10px;
    right: 240px;
    background: rgba(255, 255, 255, 0.06);
}

/* Header content row */
.cu-form-header-content {
    display: flex;
    align-items: center;
    gap: 18px;
    position: relative;
    z-index: 1;
}

/* Icon badge */
.cu-form-header-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.18);
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    color: #ffffff;
    flex-shrink: 0;
    backdrop-filter: blur(8px);
    transition: transform 0.25s ease, background 0.25s ease;
}

.cu-form-modal-content:hover .cu-form-header-icon {
    transform: scale(1.05) rotate(4deg);
    background: rgba(255, 255, 255, 0.25);
}

/* Title and subtitle */
.cu-form-header-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 4px 0;
    letter-spacing: -0.01em;
}

.cu-form-header-subtitle {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.72);
    margin: 0;
    font-weight: 400;
}

/* Close button */
.cu-form-close-btn {
    position: relative;
    z-index: 1;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    backdrop-filter: blur(4px);
}

.cu-form-close-btn:hover {
    background: rgba(255, 255, 255, 0.28);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.55);
    transform: scale(1.08);
}

/* ── Body ── */
.cu-form-modal-body {
    padding: 28px 32px 8px;
    background: #ffffff;
}

/* ── Section divider labels ── */
.cu-form-section-label {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    margin: 20px 0 14px;
    padding-bottom: 8px;
    border-bottom: 1.5px solid #f1f5f9;
}

.cu-form-section-label:first-of-type {
    margin-top: 0;
}

.cu-form-section-label i {
    width: 26px;
    height: 26px;
    background: linear-gradient(135deg, #0b509d, #3b82f6);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: #fff;
    flex-shrink: 0;
}

/* ── Field labels ── */
.cu-form-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    margin-bottom: 6px;
}

/* ── Footer ── */
.cu-form-modal-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 32px 24px;
    background: #ffffff;
    border-top: 1.5px solid #f1f5f9;
}

.cu-form-btn-cancel {
    flex: 1;
    padding: 12px 20px;
    border-radius: 12px;
    border: 1.5px solid #e2e8f0;
    background: #f8fafc;
    color: #64748b;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cu-form-btn-cancel:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
    color: #475569;
}

.cu-form-btn-save {
    flex: 2;
    padding: 12px 24px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #0b509d 0%, #3b82f6 100%);
    color: #ffffff;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 8px 20px -4px rgba(11, 80, 157, 0.35);
    letter-spacing: 0.01em;
}

.cu-form-btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px -6px rgba(11, 80, 157, 0.45);
    filter: brightness(1.08);
}

.cu-form-btn-save:active {
    transform: translateY(0);
    box-shadow: 0 4px 10px -2px rgba(11, 80, 157, 0.3);
}

.cu-form-btn-save:disabled {
    opacity: 0.65;
    transform: none;
    cursor: not-allowed;
}