/* ============================================================
   Easy Invoice - Smart System form polish
   Applies a consistent POS / Retail / E-commerce / Accounting
   treatment to standard system forms without changing behavior.
   ============================================================ */

:root {
    --ei-form-dark: #203A4E;
    --ei-form-dark-2: #2C4A5E;
    --ei-form-mid: #3D5A6F;
    --ei-form-muted: #6B8FA3;
    --ei-form-teal: #17A2B8;
    --ei-form-green: #28A745;
    --ei-form-red: #DC3545;
    --ei-form-amber: #F2A70B;
    --ei-form-bg: #EEF4F7;
    --ei-form-surface: #FFFFFF;
    --ei-form-surface-2: #F7FAFC;
    --ei-form-border: #D4E2EA;
    --ei-form-border-strong: #BFD4DF;
    --ei-form-text: #102A3A;
    --ei-form-text-soft: #4D6475;
    --ei-form-shadow: 0 12px 28px rgba(15,39,64,.09);
    --ei-form-shadow-soft: 0 8px 18px rgba(15,39,64,.06);
}

.ei-main:not(.auth-main) {
    color: var(--ei-form-text);
}

.ei-main:not(.auth-main) :where(form, .card, .panel, .subpanel, .modal-content, .table-wrap, .dataTables_wrapper),
.modal :where(form, .card, .panel, .subpanel, .modal-content) {
    min-width: 0;
}

.ei-main:not(.auth-main) :where(.card, .panel, .subpanel):has(.form-control, .form-select, input, select, textarea),
.ei-main:not(.auth-main) :where(.card, .panel, .subpanel):has(form) {
    border-color: var(--ei-form-border);
    border-radius: 8px;
    box-shadow: var(--ei-form-shadow-soft);
}

.ei-main:not(.auth-main) :where(.card-header, .panel-head, .subpanel-head):has(+ .card-body),
.ei-main:not(.auth-main) :where(.card-header, .panel-head, .subpanel-head):has(+ form) {
    background:
        linear-gradient(90deg, rgba(23,162,184,.045) 1px, transparent 1px),
        linear-gradient(180deg, #FFFFFF, #F3FAFC);
    background-size: 24px 24px, auto;
    border-bottom-color: var(--ei-form-border);
}

.ei-main:not(.auth-main) :where(form) :where(label, .form-label, .control-label),
.modal :where(form) :where(label, .form-label, .control-label) {
    color: var(--ei-form-text-soft);
    font-family: "IBM Plex Mono", monospace;
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .055em;
    line-height: 1.2;
    margin-bottom: .32rem;
    text-transform: uppercase;
}

.ei-main:not(.auth-main) :where(.form-control, .form-select, .input-group-text),
.modal :where(.form-control, .form-select, .input-group-text) {
    min-height: 42px;
    border-color: var(--ei-form-border);
    border-radius: 7px;
    color: var(--ei-form-text);
    font-weight: 600;
    box-shadow: none;
}

.ei-main:not(.auth-main) :where(.form-control, .form-select),
.modal :where(.form-control, .form-select) {
    background:
        linear-gradient(90deg, rgba(23,162,184,.025) 1px, transparent 1px),
        #FAFCFD;
    background-size: 18px 18px;
    transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease, transform .16s ease;
}

.ei-main:not(.auth-main) :where(.form-control:hover, .form-select:hover),
.modal :where(.form-control:hover, .form-select:hover) {
    border-color: var(--ei-form-border-strong);
}

.ei-main:not(.auth-main) :where(.form-control:focus, .form-select:focus),
.modal :where(.form-control:focus, .form-select:focus) {
    border-color: var(--ei-form-teal);
    background-color: #FFFFFF;
    box-shadow: 0 0 0 .18rem rgba(23,162,184,.14);
}

.ei-main:not(.auth-main) :where(.form-control:disabled, .form-select:disabled, .form-control[readonly]),
.modal :where(.form-control:disabled, .form-select:disabled, .form-control[readonly]) {
    color: #6F8190;
    background:
        linear-gradient(90deg, rgba(44,74,94,.025) 1px, transparent 1px),
        #EEF4F7;
    background-size: 18px 18px;
    opacity: 1;
}

.ei-main:not(.auth-main) :where(textarea.form-control),
.modal :where(textarea.form-control) {
    min-height: 92px;
    line-height: 1.42;
    resize: vertical;
}

.ei-main:not(.auth-main) :where(input[type="date"].form-control, input[type="time"].form-control, input[type="datetime-local"].form-control),
.modal :where(input[type="date"].form-control, input[type="time"].form-control, input[type="datetime-local"].form-control) {
    font-family: "IBM Plex Sans", sans-serif;
}

.ei-main:not(.auth-main) :where(input[type="number"].form-control),
.modal :where(input[type="number"].form-control) {
    font-family: "IBM Plex Mono", monospace;
}

.ei-main:not(.auth-main) :where(.form-control[type="file"]),
.modal :where(.form-control[type="file"]) {
    min-height: 44px;
    padding: .52rem .65rem;
}

.ei-main:not(.auth-main) :where(.form-control[type="file"])::file-selector-button,
.modal :where(.form-control[type="file"])::file-selector-button {
    min-height: 30px;
    margin: -.32rem .75rem -.32rem -.48rem;
    border: 0;
    border-right: 1px solid var(--ei-form-border);
    background: #EAF8FB;
    color: #0D6370;
    font-family: "IBM Plex Mono", monospace;
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.ei-main:not(.auth-main) :where(.input-group),
.modal :where(.input-group) {
    align-items: stretch;
}

.ei-main:not(.auth-main) :where(.input-group-text),
.modal :where(.input-group-text) {
    background:
        linear-gradient(90deg, rgba(23,162,184,.05) 1px, transparent 1px),
        #F1F8FA;
    background-size: 18px 18px;
    color: var(--ei-form-mid);
    font-family: "IBM Plex Mono", monospace;
    font-size: .68rem;
    font-weight: 800;
}

.ei-main:not(.auth-main) :where(.form-check),
.modal :where(.form-check) {
    min-height: 32px;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.ei-main:not(.auth-main) :where(.form-check-input),
.modal :where(.form-check-input) {
    width: 1.05rem;
    height: 1.05rem;
    margin-top: 0;
    border-color: #AFC6D2;
    cursor: pointer;
}

.ei-main:not(.auth-main) :where(.form-check-input:checked),
.modal :where(.form-check-input:checked) {
    background-color: var(--ei-form-teal);
    border-color: var(--ei-form-teal);
}

.ei-main:not(.auth-main) :where(.form-check-input:focus),
.modal :where(.form-check-input:focus) {
    border-color: var(--ei-form-teal);
    box-shadow: 0 0 0 .18rem rgba(23,162,184,.16);
}

.ei-main:not(.auth-main) :where(.form-check-label),
.modal :where(.form-check-label) {
    color: var(--ei-form-text-soft);
    font-size: .86rem;
    font-weight: 700;
}

.ei-main:not(.auth-main) :where(.text-danger, .field-validation-error, .validation-summary-errors),
.modal :where(.text-danger, .field-validation-error, .validation-summary-errors) {
    color: #A51D2B !important;
    font-size: .8rem;
    font-weight: 700;
}

.ei-main:not(.auth-main) :where(.validation-summary-errors),
.modal :where(.validation-summary-errors) {
    padding: .75rem .9rem;
    border: 1px solid rgba(220,53,69,.22);
    border-radius: 8px;
    background: rgba(220,53,69,.055);
}

.ei-main:not(.auth-main) :where(.btn),
.modal :where(.btn) {
    border-radius: 7px;
    font-weight: 800;
    letter-spacing: 0;
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease;
}

.ei-main:not(.auth-main) :where(.btn:hover),
.modal :where(.btn:hover) {
    transform: translateY(-1px);
}

.ei-main:not(.auth-main) :where(.btn-primary, .btn-info),
.modal :where(.btn-primary, .btn-info) {
    border-color: #0EA5B7;
    background: linear-gradient(135deg, #0EA5B7, #17A2B8);
    box-shadow: 0 9px 18px rgba(23,162,184,.22);
    color: #FFFFFF;
}

.ei-main:not(.auth-main) :where(.btn-success),
.modal :where(.btn-success) {
    border-color: #20903C;
    background: linear-gradient(135deg, #20903C, #28A745);
    box-shadow: 0 9px 18px rgba(40,167,69,.22);
    color: #FFFFFF;
}

.ei-main:not(.auth-main) :where(.btn-danger),
.modal :where(.btn-danger) {
    border-color: #C72F40;
    background: linear-gradient(135deg, #C72F40, #DC3545);
    box-shadow: 0 9px 18px rgba(220,53,69,.18);
    color: #FFFFFF;
}

.ei-main:not(.auth-main) :where(.btn-secondary, .btn-outline-secondary),
.modal :where(.btn-secondary, .btn-outline-secondary) {
    border-color: #C9D9E2;
    background: #F4F8FB;
    color: var(--ei-form-mid);
}

.ei-main:not(.auth-main) :where(.btn-outline-primary, .btn-outline-info),
.modal :where(.btn-outline-primary, .btn-outline-info) {
    border-color: rgba(23,162,184,.42);
    color: #0D6370;
    background: #F7FCFD;
}

.ei-main:not(.auth-main) :where(.btn-outline-success),
.modal :where(.btn-outline-success) {
    border-color: rgba(40,167,69,.42);
    color: #1E7D36;
    background: #F7FCF8;
}

.ei-main:not(.auth-main) :where(.modal-content):not(.accounts-modal):not(.loc-modal):not(.rem-modal),
.modal-content:not(.accounts-modal):not(.loc-modal):not(.rem-modal) {
    border: 1px solid rgba(44,74,94,.16);
    border-radius: 10px;
    box-shadow: 0 24px 64px rgba(15,39,64,.24);
    overflow: hidden;
}

.ei-main:not(.auth-main) :where(.modal-header):not(.accounts-modal-header):not(.loc-modal-header):not(.rem-modal-header),
.modal-header:not(.accounts-modal-header):not(.loc-modal-header):not(.rem-modal-header) {
    min-height: 62px;
    background:
        linear-gradient(90deg, rgba(255,255,255,.055) 1px, transparent 1px),
        linear-gradient(135deg, #203A4E, #2F5369);
    background-size: 26px 26px, auto;
    border-bottom: 0;
    color: #FFFFFF;
}

.ei-main:not(.auth-main) :where(.modal-title),
.modal :where(.modal-title) {
    font-family: "IBM Plex Mono", monospace;
    font-size: .82rem;
    font-weight: 900;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.ei-main:not(.auth-main) :where(.modal-footer),
.modal :where(.modal-footer) {
    background: #F7FAFC;
    border-top-color: var(--ei-form-border);
}

.ei-main:not(.auth-main) :where(.select2-container),
.modal :where(.select2-container) {
    width: 100% !important;
}

.ei-main:not(.auth-main) :where(.select2-container--default .select2-selection--single),
.modal :where(.select2-container--default .select2-selection--single) {
    min-height: 42px;
    border-color: var(--ei-form-border);
    border-radius: 7px;
    background:
        linear-gradient(90deg, rgba(23,162,184,.025) 1px, transparent 1px),
        #FAFCFD;
    background-size: 18px 18px;
}

.ei-main:not(.auth-main) :where(.select2-container--default .select2-selection--single .select2-selection__rendered),
.modal :where(.select2-container--default .select2-selection--single .select2-selection__rendered) {
    color: var(--ei-form-text);
    font-weight: 600;
    line-height: 40px;
    padding-left: .75rem;
}

.ei-main:not(.auth-main) :where(.select2-container--default .select2-selection--single .select2-selection__arrow),
.modal :where(.select2-container--default .select2-selection--single .select2-selection__arrow) {
    height: 40px;
}

.ei-main:not(.auth-main) :where(.select2-container--default.select2-container--focus .select2-selection--single),
.modal :where(.select2-container--default.select2-container--focus .select2-selection--single) {
    border-color: var(--ei-form-teal);
    box-shadow: 0 0 0 .18rem rgba(23,162,184,.14);
}

.select2-dropdown {
    border-color: var(--ei-form-border-strong);
    border-radius: 8px;
    box-shadow: 0 16px 36px rgba(15,39,64,.14);
    overflow: hidden;
}

.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
    background: var(--ei-form-teal);
}

.dataTables_wrapper :where(input, select),
div.dataTables_wrapper :where(input, select) {
    min-height: 34px;
    border: 1px solid var(--ei-form-border) !important;
    border-radius: 7px !important;
    background: #FAFCFD !important;
    color: var(--ei-form-text);
    font-weight: 700;
}

.dataTables_wrapper :where(label),
div.dataTables_wrapper :where(label) {
    color: var(--ei-form-text-soft);
    font-family: "IBM Plex Mono", monospace;
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .04em;
}

.ei-main:not(.auth-main) :where(.filter-panel, .filters-panel, .filters-card, .search-panel, .report-filter-card, .accounts-filters, .audit-filter-card) {
    border: 1px solid var(--ei-form-border);
    border-radius: 8px;
    background:
        linear-gradient(90deg, rgba(23,162,184,.035) 1px, transparent 1px),
        linear-gradient(180deg, #FFFFFF, #F6FAFC);
    background-size: 24px 24px, auto;
    box-shadow: var(--ei-form-shadow-soft);
}

.ei-main:not(.auth-main) :where(.row.g-2, .row.g-3, .row.g-4) > [class*="col"] {
    min-width: 0;
}

.ei-main:not(.auth-main) :where(table .form-control, table .form-select),
.modal :where(table .form-control, table .form-select) {
    min-height: 34px;
    padding-top: .32rem;
    padding-bottom: .32rem;
    border-radius: 6px;
    font-size: .86rem;
}

.ei-main:not(.auth-main) :where(.swal2-popup) {
    border-radius: 10px;
}

.ei-action-tray,
.ei-main:not(.auth-main) :where(.row-actions, .table-actions, .actions-cell, .action-buttons, .payables-row-actions, .purchase-action-group, .ar-action-group, .tm-td-actions),
.modal :where(.row-actions, .table-actions, .actions-cell, .action-buttons, .payables-row-actions, .purchase-action-group, .ar-action-group, .tm-td-actions) {
    --ei-action-slot-size: 34px;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: var(--ei-action-slot-size);
    justify-content: center;
    align-items: center;
    gap: .38rem;
    min-width: calc((var(--ei-action-slot-count, 2) * var(--ei-action-slot-size)) + ((var(--ei-action-slot-count, 2) - 1) * .38rem));
}

.ei-action-tray--1 {
    --ei-action-slot-count: 1;
}

.ei-action-tray--2,
.payables-row-actions,
.tm-td-actions {
    --ei-action-slot-count: 2;
}

.ei-action-tray--3,
.ar-action-group {
    --ei-action-slot-count: 3;
}

.ei-action-tray :where(.btn, button, a),
.ei-main:not(.auth-main) :where(.row-actions, .table-actions, .actions-cell, .action-buttons, .payables-row-actions, .purchase-action-group, .ar-action-group) :where(.btn, button, a),
.modal :where(.row-actions, .table-actions, .actions-cell, .action-buttons, .payables-row-actions, .purchase-action-group, .ar-action-group) :where(.btn, button, a) {
    width: var(--ei-action-slot-size);
    min-width: var(--ei-action-slot-size);
    height: var(--ei-action-slot-size);
    min-height: var(--ei-action-slot-size);
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    white-space: nowrap;
}

.ei-action-tray :where(.btn i, button i, a i),
.ei-main:not(.auth-main) :where(.row-actions, .table-actions, .actions-cell, .action-buttons, .payables-row-actions, .purchase-action-group, .ar-action-group) :where(.btn i, button i, a i),
.modal :where(.row-actions, .table-actions, .actions-cell, .action-buttons, .payables-row-actions, .purchase-action-group, .ar-action-group) :where(.btn i, button i, a i) {
    margin: 0 !important;
}

.ei-action-placeholder,
.action-placeholder,
.ar-action-spacer,
.tm-btn-placeholder {
    width: var(--ei-action-slot-size, 34px);
    min-width: var(--ei-action-slot-size, 34px);
    height: var(--ei-action-slot-size, 34px);
    min-height: var(--ei-action-slot-size, 34px);
    visibility: hidden;
    pointer-events: none;
}

@media (max-width: 768px) {
    .ei-main:not(.auth-main) :where(.form-control, .form-select, .input-group-text),
    .modal :where(.form-control, .form-select, .input-group-text) {
        min-height: 44px;
    }

    .ei-main:not(.auth-main) :where(form) :where(label, .form-label, .control-label),
    .modal :where(form) :where(label, .form-label, .control-label) {
        font-size: .64rem;
    }

    .ei-main:not(.auth-main) :where(.btn),
    .modal :where(.btn) {
        min-height: 40px;
    }
}
