/* FIX740 — Unified Bootstrap UI/UX + compact copy
   Bootstrap 5.3 is already bundled by resources/css/app.css. This layer normalizes
   legacy/custom module controls without replacing their data/behavior. */

:root {
    --fix740-control-h: 40px;
    --fix740-control-h-sm: 34px;
    --fix740-radius: 10px;
    --fix740-radius-sm: 8px;
    --fix740-border: #dce4ee;
    --fix740-border-hover: #b9c7d9;
    --fix740-text: #23324a;
    --fix740-muted: #77869b;
    --fix740-soft: #f8fafc;
    --fix740-primary: #0d6efd;
    --fix740-danger: #dc3545;
    --fix740-shadow: 0 8px 24px rgba(15, 35, 65, .10);
    --fix740-focus: 0 0 0 .18rem rgba(13, 110, 253, .14);
}

.app-body.app-ui-unified-v740,
.auth-body.app-ui-unified-v740 {
    --bs-border-radius: var(--fix740-radius);
    --bs-border-radius-sm: var(--fix740-radius-sm);
    --bs-body-color: var(--fix740-text);
    --bs-border-color: var(--fix740-border);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

/* FIX740: remove non-essential explanatory copy across app pages. Data values,
   validation messages, warnings/errors, labels and actual table content stay visible. */
.app-ui-unified-v740 :where(
    [data-app-table-toolbar-description],
    .app-responsive-toolbar__heading > p,
    .mikrotik-panel-heading-copy > p,
    .mikrotik-overview-note,
    .mikrotik-device-meta,
    .mikrotik-bandwidth-meta,
    .router-section-subtitle,
    .mikrotik-modal-subtitle,
    .network-modal-subtitle,
    .modal-subtitle,
    .section-subtitle,
    .payment-verification-subtitle,
    .bulk-payment-verification-subtitle,
    .debt-payment-subtitle,
    .onu-browser-subtitle,
    .user-role-helper,
    .mikrotik-backup-field-help,
    .fix717-mode-help,
    .fix717-onu-hint,
    .network-clean-node-help,
    .network-splice-candidate-hint,
    .waxe-export-hint,
    .customer-registration-form-hint,
    .payroll-form-hint,
) {
    display: none !important;
}

/* Section heads become compact when their subtitle is removed. */
.app-ui-unified-v740 :where(
    .app-responsive-toolbar__heading,
    .mikrotik-panel-heading-copy,
    .settings-card-head > div,
    .network-modal-title-wrap > div
) {
    gap: 0 !important;
}

/* Global focus / hover language. */
.app-ui-unified-v740 :where(a, button, input, select, textarea, [role="button"], [tabindex]):focus-visible {
    outline: 2px solid rgba(13, 110, 253, .26);
    outline-offset: 2px;
}

/* Bootstrap buttons — same size, radius, icon alignment and motion everywhere. */
.app-ui-unified-v740 .btn:not(.btn-close) {
    min-height: var(--fix740-control-h);
    padding: .5rem .82rem;
    border-radius: var(--fix740-radius) !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .38rem;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.15;
    box-shadow: none;
    transition: color .15s ease, background-color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .12s ease;
}
.app-ui-unified-v740 .btn.btn-sm:not(.btn-close) {
    min-height: var(--fix740-control-h-sm);
    padding: .38rem .66rem;
    border-radius: var(--fix740-radius-sm) !important;
    font-size: 11px;
}
.app-ui-unified-v740 .btn.btn-lg:not(.btn-close) {
    min-height: 46px;
    padding: .62rem 1rem;
    font-size: 13px;
}
.app-ui-unified-v740 .btn:not(:disabled):not(.disabled):hover {
    transform: translateY(-1px);
}
.app-ui-unified-v740 .btn:not(:disabled):not(.disabled):active {
    transform: translateY(0);
}
.app-ui-unified-v740 .btn-primary {
    box-shadow: 0 4px 11px rgba(13, 110, 253, .16);
}
.app-ui-unified-v740 .btn-light,
.app-ui-unified-v740 .btn-outline-secondary {
    color: #46566d;
    border-color: var(--fix740-border);
    background: #fff;
}
.app-ui-unified-v740 .btn-light:hover,
.app-ui-unified-v740 .btn-outline-secondary:hover {
    color: #24354d;
    border-color: var(--fix740-border-hover);
    background: #f8fafc;
}
.app-ui-unified-v740 .btn-danger,
.app-ui-unified-v740 .btn-outline-danger:hover {
    box-shadow: 0 4px 11px rgba(220, 53, 69, .12);
}

/* Save / cancel areas in legacy forms use the same visual hierarchy. */
.app-ui-unified-v740 :where(
    .master-form-actions, .system-form-actions, .user-form-actions,
    .expense-form-actions, .other-income-form-actions, .package-form-actions,
    .region-form-actions, .modal-footer, .app-confirm-actions
) {
    gap: 8px !important;
}
.app-ui-unified-v740 :where(.modal-footer, .app-confirm-actions) .btn-light {
    min-width: 84px;
}
.app-ui-unified-v740 :where(.modal-footer, .app-confirm-actions) .btn-primary,
.app-ui-unified-v740 :where(.modal-footer, .app-confirm-actions) .btn-danger {
    min-width: 96px;
}

/* Inputs/search/selects. */
.app-ui-unified-v740 :where(.form-control, .form-select):not(.form-control-sm):not(.form-select-sm) {
    min-height: var(--fix740-control-h);
    border: 1px solid var(--fix740-border);
    border-radius: var(--fix740-radius) !important;
    color: var(--fix740-text);
    background-color: #fff;
    font-size: 12px;
    box-shadow: none !important;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.app-ui-unified-v740 textarea.form-control {
    min-height: 90px;
    height: auto;
}
.app-ui-unified-v740 :where(.form-control, .form-select):not(:disabled):hover {
    border-color: var(--fix740-border-hover);
}
.app-ui-unified-v740 :where(.form-control, .form-select):focus {
    border-color: #78a9f7 !important;
    box-shadow: var(--fix740-focus) !important;
}
.app-ui-unified-v740 :where(.form-control, .form-select)::placeholder {
    color: #a0adbd;
    opacity: 1;
}
.app-ui-unified-v740 :where(.form-control-sm, .form-select-sm) {
    min-height: var(--fix740-control-h-sm);
    border-radius: var(--fix740-radius-sm) !important;
    border-color: var(--fix740-border);
    font-size: 11px;
}
.app-ui-unified-v740 .input-group > :where(.form-control, .form-select, .input-group-text, .btn) {
    min-height: var(--fix740-control-h);
    border-color: var(--fix740-border);
}

/* Unified search wrappers (legacy modules keep their own JS). */
.app-ui-unified-v740 :where(
    .app-unified-table-search,
    .mikrotik-overview-quick-search-field,
    .network-search-wrap,
    .customer-search-wrap,
    .customer-mikrotik-secret-search,
    .invoice-search-wrap,
    .payment-search-wrap,
    .payments-search-wrap,
    .other-income-search-wrap,
    .expense-search-wrap,
    .collection-search,
    .user-search,
    .system-search,
    .invoice-data-search,
    .ppp-detail-customer-search,
    .mikrotik-search-box
) {
    border-radius: var(--fix740-radius) !important;
}
.app-ui-unified-v740 :where(
    .app-unified-table-search,
    .mikrotik-overview-quick-search-field,
    .network-search-wrap,
    .customer-search-wrap,
    .invoice-search-wrap,
    .payment-search-wrap,
    .payments-search-wrap,
    .other-income-search-wrap,
    .expense-search-wrap,
    .collection-search,
    .user-search,
    .system-search,
    .invoice-data-search
):focus-within {
    border-color: #78a9f7 !important;
    box-shadow: var(--fix740-focus) !important;
}

/* Dropdowns. */
.app-ui-unified-v740 .dropdown-menu:not(.gm-style *) {
    padding: 6px;
    border: 1px solid var(--fix740-border);
    border-radius: 12px !important;
    box-shadow: var(--fix740-shadow);
}
.app-ui-unified-v740 .dropdown-item {
    min-height: 36px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 8px;
    color: #35465e;
    font-size: 11.5px;
    font-weight: 620;
    transition: background-color .12s ease, color .12s ease;
}
.app-ui-unified-v740 .dropdown-item:hover,
.app-ui-unified-v740 .dropdown-item:focus {
    color: #0b5ed7;
    background: #eef5ff;
}
.app-ui-unified-v740 .dropdown-item.active,
.app-ui-unified-v740 .dropdown-item:active {
    color: #fff;
    background: var(--fix740-primary);
}
.app-ui-unified-v740 .dropdown-divider {
    margin: 5px 2px;
    border-color: #edf1f6;
}

/* Pagination. */
.app-ui-unified-v740 .pagination {
    gap: 5px;
    margin-bottom: 0;
}
.app-ui-unified-v740 .page-link {
    min-width: 34px;
    height: 34px;
    padding: 0 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--fix740-border) !important;
    border-radius: 9px !important;
    color: #50617a;
    background: #fff;
    font-size: 11px;
    font-weight: 700;
    box-shadow: none !important;
}
.app-ui-unified-v740 .page-link:hover {
    color: #0b5ed7;
    border-color: #afc9ef !important;
    background: #f1f6ff;
}
.app-ui-unified-v740 .page-item.active .page-link {
    color: #fff;
    border-color: var(--fix740-primary) !important;
    background: var(--fix740-primary);
}
.app-ui-unified-v740 .page-item.disabled .page-link {
    color: #a5b0bf;
    background: #f8fafc;
}

/* Toggle / checkbox / radio. */
.app-ui-unified-v740 .form-check-input {
    border-color: #c8d3e0;
    box-shadow: none !important;
    cursor: pointer;
}
.app-ui-unified-v740 .form-check-input:focus {
    border-color: #78a9f7;
    box-shadow: var(--fix740-focus) !important;
}
.app-ui-unified-v740 .form-switch .form-check-input {
    width: 2.2rem;
    min-width: 2.2rem;
    height: 1.2rem;
    border-radius: 999px;
}
.app-ui-unified-v740 .form-check-input:checked {
    border-color: var(--fix740-primary);
    background-color: var(--fix740-primary);
}

/* Close buttons, including custom module close controls. */
.app-ui-unified-v740 .btn-close,
.app-ui-unified-v740 button[class*="-close"]:not(.gm-ui-hover-effect) {
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    padding: 0 !important;
    display: inline-grid;
    place-items: center;
    border: 1px solid transparent;
    border-radius: 9px !important;
    background-color: transparent;
    color: #66758a;
    box-shadow: none !important;
    opacity: 1;
    transition: background-color .12s ease, border-color .12s ease, color .12s ease;
}
.app-ui-unified-v740 .btn-close:hover,
.app-ui-unified-v740 button[class*="-close"]:not(.gm-ui-hover-effect):hover {
    color: #23324a;
    border-color: #e2e8f0;
    background-color: #f4f7fb;
}

/* Cards / modals / tables. */
.app-ui-unified-v740 :where(.card, .modal-content, .settings-card, .mikrotik-panel, .master-form-card, .system-form-card) {
    border-color: #e3e9f1;
    border-radius: 13px;
}
.app-ui-unified-v740 .modal-content {
    box-shadow: 0 20px 60px rgba(15, 35, 65, .18);
}
.app-ui-unified-v740 .modal-header,
.app-ui-unified-v740 .modal-footer {
    border-color: #edf1f6;
}
.app-ui-unified-v740 .modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.app-ui-unified-v740 .modal-header > :first-child {
    min-width: 0;
    flex: 1 1 auto;
}
.app-ui-unified-v740 .modal-header :where(.modal-title, h1, h2, h3, h4, h5, h6) {
    margin-bottom: 0;
}
.app-ui-unified-v740 .modal-header .btn-close,
.app-ui-unified-v740 .modal-header > button[data-bs-dismiss="modal"],
.app-ui-unified-v740 .modal-header > button[data-bs-dismiss="offcanvas"] {
    margin-left: auto;
    flex: 0 0 auto;
    align-self: flex-start;
}
.app-ui-unified-v740 .table > :not(caption) > * > * {
    border-color: #e9eef5;
}
.app-ui-unified-v740 .table tbody tr {
    transition: background-color .12s ease;
}
.app-ui-unified-v740 .table tbody tr:hover > * {
    background-color: #f8fbff;
}

/* Compact toolbar spacing after descriptions are removed. */
.app-ui-unified-v740 .app-responsive-toolbar {
    align-items: center;
}
.app-ui-unified-v740 .app-responsive-toolbar__heading h3 {
    margin-bottom: 0 !important;
}

@media (max-width: 767.98px) {
    .app-ui-unified-v740 .btn:not(.btn-close) {
        min-height: 38px;
    }
    .app-ui-unified-v740 :where(.form-control, .form-select):not(.form-control-sm):not(.form-select-sm) {
        min-height: 40px;
        font-size: 16px; /* prevent iOS zoom on focus */
    }
    .app-ui-unified-v740 .dropdown-menu {
        max-width: calc(100vw - 24px);
    }
}
