/* ==========================================================================
   Custom Overrides — rminvest-panel
   Enterprise UI/UX layer on top of the legacy Bootstrap 4 theme.
   Loaded last (see app\assets\AppAsset) so it owns the final cascade.

   Conventions:
   - All design decisions live in :root tokens (section 0).
   - No `!important` unless overriding a legacy inline/positioned rule.
   - Feature styles are scoped by page class to avoid global pollution.
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. DESIGN TOKENS
   -------------------------------------------------------------------------- */

:root {
    /* Brand & semantic colors */
    --rmi-primary: #2d7bf4;
    --rmi-primary-hover: #1a6be0;
    --rmi-primary-rgb: 45, 123, 244;

    --rmi-success: #0acf97;
    --rmi-success-hover: #09b882;
    --rmi-success-rgb: 10, 207, 151;

    --rmi-danger: #f1556c;
    --rmi-danger-hover: #dc3f58;
    --rmi-danger-rgb: 241, 85, 108;

    --rmi-warning: #f9bc0b;
    --rmi-warning-hover: #e0a800;
    --rmi-warning-rgb: 249, 188, 11;
    --rmi-warning-text: #c89a00;

    --rmi-info: #4eb7eb;
    --rmi-info-hover: #39a5dc;
    --rmi-info-rgb: 78, 183, 235;

    /* Neutrals */
    --rmi-text: #313a46;
    --rmi-text-soft: #5a6577;
    --rmi-text-muted: #98a6ad;
    --rmi-border: #e3eaef;
    --rmi-border-strong: #d1d9e0;
    --rmi-surface: #ffffff;
    --rmi-surface-alt: #f8fafc;
    --rmi-surface-muted: #f3f6f8;
    --rmi-surface-hover: #f9fbfd;

    /* Shape */
    --rmi-radius: 6px;
    --rmi-radius-lg: 8px;

    /* Layout */
    --rmi-sidebar-width: 240px;
    --rmi-header-height: 56px;
    --rmi-content-max: 1400px;

    /* Typography */
    --rmi-font-sans: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --rmi-font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;

    /* Elevation */
    --rmi-shadow-card: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.03);
    --rmi-shadow-xs: 0 1px 2px rgba(49, 58, 70, 0.04);
    --rmi-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --rmi-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --rmi-shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.15);
}

/* --------------------------------------------------------------------------
   1. ACCESSIBILITY — Visible keyboard focus, quiet mouse focus
   -------------------------------------------------------------------------- */

:focus:not(:focus-visible) {
    outline: none;
}

:focus-visible {
    outline: 2px solid var(--rmi-primary);
    outline-offset: 2px;
}

/* !important is required to defeat the legacy `.btn { outline: none !important }`. */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.nav-link:focus-visible,
.page-link:focus-visible,
.dropdown-item:focus-visible {
    outline: 2px solid var(--rmi-primary) !important;
    outline-offset: 2px;
}

/* Inputs communicate focus through their own ring (see section 6). */
.form-control:focus,
.custom-select:focus,
.select2-container--focus .select2-selection--single {
    outline: none;
}

/* --------------------------------------------------------------------------
   2. TYPOGRAPHY
   -------------------------------------------------------------------------- */

body {
    font-family: var(--rmi-font-sans);
    font-size: 14px;
    line-height: 1.5;
    color: var(--rmi-text);
    padding-bottom: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, .h1,
h2, .h2,
h3, .h3,
h4, .h4,
h5, .h5,
h6, .h6 {
    font-family: var(--rmi-font-sans);
    color: var(--rmi-text);
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

h1, .h1 { font-size: 24px; }
h2, .h2 { font-size: 20px; }
h3, .h3 { font-size: 18px; }
h4, .h4 { font-size: 16px; }
h5, .h5 { font-size: 14px; }
h6, .h6 { font-size: 13px; }

p {
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.text-muted {
    color: var(--rmi-text-muted) !important;
}

small, .small {
    font-size: 12px;
    color: var(--rmi-text-muted);
}

/* --------------------------------------------------------------------------
   3. PAGE HEADER
   -------------------------------------------------------------------------- */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}

.page-header .page-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--rmi-text);
    margin: 0;
    line-height: 1.3;
}

.page-header .page-subtitle {
    font-size: 13px;
    font-weight: 400;
    color: var(--rmi-text-muted);
    margin: 4px 0 0;
}

.page-header .page-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.back-link {
    display: inline-flex;
    align-items: center;
    font-size: 13px;
    color: var(--rmi-text-muted);
    text-decoration: none;
    margin-bottom: 12px;
    transition: color 0.15s ease;
}

.back-link:hover {
    color: var(--rmi-primary);
    text-decoration: none;
}

.back-link i {
    margin-right: 4px;
    font-size: 12px;
}

/* --------------------------------------------------------------------------
   4. CARDS & DATA PANEL
   -------------------------------------------------------------------------- */

.card {
    border: 1px solid var(--rmi-border);
    border-radius: var(--rmi-radius);
    background-color: var(--rmi-surface);
    box-shadow: var(--rmi-shadow-card);
    margin-bottom: 20px;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.card-body {
    padding: 16px;
}

.card-header {
    background-color: var(--rmi-surface);
    border-bottom: 1px solid var(--rmi-border);
    padding: 16px 20px;
}

.card-footer {
    background-color: var(--rmi-surface);
    border-top: 1px solid var(--rmi-border);
    padding: 12px 20px;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--rmi-text);
    margin-bottom: 12px;
}

.card-box {
    border: 1px solid var(--rmi-border);
    border-radius: var(--rmi-radius);
    background-color: var(--rmi-surface);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: none;
}

/* Data panel: search form + table + pagination as one cohesive surface. */
.data-panel {
    overflow: hidden;
}

.data-panel .card-body.p-0 {
    padding: 0;
}

.data-panel .search-form {
    border: none;
    border-bottom: 1px solid var(--rmi-border);
    border-radius: 0;
    margin-bottom: 0;
    padding: 16px 20px;
    background-color: transparent;
}

.data-panel .table-responsive {
    border-radius: 0;
}

.data-panel .card-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    background-color: var(--rmi-surface);
    border-top: 1px solid var(--rmi-border);
    padding: 12px 20px;
}

.data-panel .card-footer .pagination {
    margin-top: 0;
}

/* --------------------------------------------------------------------------
   5. BUTTONS
   -------------------------------------------------------------------------- */

.btn {
    font-size: 14px;
    font-weight: 500;
    padding: 6px 16px;
    border-radius: var(--rmi-radius);
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    line-height: 1.4;
    white-space: nowrap;
}

.btn i {
    font-size: 13px;
}

.btn-primary {
    background-color: var(--rmi-primary);
    border-color: var(--rmi-primary);
    color: #ffffff;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--rmi-primary-hover);
    border-color: var(--rmi-primary-hover);
    color: #ffffff;
}

.btn-secondary {
    background-color: var(--rmi-surface);
    border-color: var(--rmi-border);
    color: var(--rmi-text);
}

.btn-secondary:hover,
.btn-secondary:focus {
    background-color: var(--rmi-surface-muted);
    border-color: var(--rmi-border-strong);
    color: var(--rmi-text);
}

.btn-light {
    background-color: var(--rmi-surface-muted);
    border-color: var(--rmi-border);
    color: var(--rmi-text);
}

.btn-light:hover,
.btn-light:focus {
    background-color: var(--rmi-border);
    border-color: var(--rmi-border-strong);
    color: var(--rmi-text);
}

.btn-success {
    background-color: var(--rmi-success);
    border-color: var(--rmi-success);
    color: #ffffff;
}

.btn-success:hover,
.btn-success:focus {
    background-color: var(--rmi-success-hover);
    border-color: var(--rmi-success-hover);
    color: #ffffff;
}

.btn-warning {
    background-color: var(--rmi-warning);
    border-color: var(--rmi-warning);
    color: #ffffff;
}

.btn-warning:hover,
.btn-warning:focus {
    background-color: var(--rmi-warning-hover);
    border-color: var(--rmi-warning-hover);
    color: #ffffff;
}

.btn-danger {
    background-color: var(--rmi-danger);
    border-color: var(--rmi-danger);
    color: #ffffff;
}

.btn-danger:hover,
.btn-danger:focus {
    background-color: var(--rmi-danger-hover);
    border-color: var(--rmi-danger-hover);
    color: #ffffff;
}

.btn-info {
    background-color: var(--rmi-info);
    border-color: var(--rmi-info);
    color: #ffffff;
}

.btn-info:hover,
.btn-info:focus {
    background-color: var(--rmi-info-hover);
    border-color: var(--rmi-info-hover);
    color: #ffffff;
}

.btn-sm {
    font-size: 13px;
    padding: 4px 10px;
}

.btn-sm i {
    font-size: 12px;
}

.btn-lg {
    font-size: 15px;
    padding: 8px 20px;
}

.btn-group-sm > .btn {
    padding: 4px 8px;
    font-size: 13px;
}

.btn .waves-ripple {
    display: none !important;
}

.btn:active,
.btn.active {
    box-shadow: none;
}

.btn:disabled,
.btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* --------------------------------------------------------------------------
   6. FORMS
   -------------------------------------------------------------------------- */

.form-control {
    border: 1px solid var(--rmi-border-strong);
    border-radius: var(--rmi-radius);
    font-size: 14px;
    padding: 7px 12px;
    color: var(--rmi-text);
    background-color: var(--rmi-surface);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    height: calc(2.25rem + 2px);
}

.form-control:focus {
    border-color: var(--rmi-primary);
    box-shadow: 0 0 0 3px rgba(var(--rmi-primary-rgb), 0.12);
    outline: none;
}

.form-control:disabled,
.form-control[readonly] {
    background-color: var(--rmi-surface-muted);
    border-color: var(--rmi-border);
    color: var(--rmi-text-muted);
}

.form-control::placeholder {
    color: var(--rmi-text-muted);
    opacity: 1;
}

select.form-control {
    appearance: auto;
}

textarea.form-control {
    min-height: 100px;
}

.form-control-lg {
    height: calc(2.875rem + 2px);
    padding: 10px 16px;
    font-size: 15px;
}

.form-control-sm {
    height: calc(1.8125rem + 2px);
    padding: 4px 10px;
    font-size: 13px;
}

label,
.form-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--rmi-text);
    margin-bottom: 4px;
}

.form-horizontal .control-label,
.text-right label {
    text-align: right;
    padding-top: 8px;
}

.help-block,
.form-hint {
    font-size: 12px;
    color: var(--rmi-text-muted);
    margin-top: 4px;
}

.has-error .form-control {
    border-color: var(--rmi-danger);
}

.has-error .form-control:focus {
    box-shadow: 0 0 0 3px rgba(var(--rmi-danger-rgb), 0.12);
}

.has-error .help-block,
.has-error .errorMessage {
    color: var(--rmi-danger);
    font-size: 12px;
    margin-top: 4px;
}

.has-success .form-control {
    border-color: var(--rmi-success);
}

.input-group .form-control {
    z-index: 1;
}

.input-group-prepend .btn,
.input-group-append .btn {
    border-color: var(--rmi-border-strong);
    background-color: var(--rmi-surface-muted);
    color: var(--rmi-text);
}

/* Search / filter toolbar */
.search-form {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    padding: 16px 20px;
    background: var(--rmi-surface);
    border: 1px solid var(--rmi-border);
    border-radius: var(--rmi-radius);
    margin-bottom: 12px;
}

.search-form .form-group {
    margin-bottom: 0;
    min-width: 160px;
}

.search-form .form-group label {
    font-size: 12px;
    font-weight: 500;
    color: var(--rmi-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 4px;
    display: block;
}

.search-form .btn {
    height: 38px;
}

.search-form .btn + .btn {
    margin-left: 0;
}

.form-inline .form-group {
    margin-bottom: 0;
}

.form-inline .form-control {
    min-width: 160px;
}

.custom-control-label {
    font-size: 14px;
    color: var(--rmi-text);
}

/* Form section grouping */
.form-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--rmi-text);
    margin: 0 0 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--rmi-border);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--rmi-border);
}

/* Required marker follows Yii ActiveForm's `.required` container class. */
.form-group.required > label::after,
label.required::after {
    content: ' *';
    color: var(--rmi-danger);
}

/* Password visibility toggles (input-group addon). */
.input-group-text.eye-toggle {
    cursor: pointer;
    background-color: var(--rmi-surface-muted);
    color: var(--rmi-text-soft);
}

.input-group-text.eye-toggle:hover {
    color: var(--rmi-primary);
}

/* Select2 alignment */
.select2-container--default .select2-selection--single {
    height: 38px;
    border: 1px solid var(--rmi-border-strong);
    border-radius: var(--rmi-radius);
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 36px;
    padding-left: 12px;
    color: var(--rmi-text);
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 36px;
}

.select2-container--default .select2-selection--single:focus {
    border-color: var(--rmi-primary);
    outline: none;
}

.select2-container--open .select2-dropdown {
    border-color: var(--rmi-border-strong);
    border-radius: var(--rmi-radius);
}

.select2-results__option--highlighted[aria-selected] {
    background-color: var(--rmi-primary);
}

/* --------------------------------------------------------------------------
   7. TABLES
   -------------------------------------------------------------------------- */

.table {
    color: var(--rmi-text);
    margin-bottom: 0;
}

/* Selectors mirror the legacy `.table > thead > tr > th` specificity and win by order. */
.table thead tr th {
    font-family: var(--rmi-font-sans);
    font-size: 11px;
    font-weight: 600;
    color: var(--rmi-text-soft);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-top: none;
    border-bottom: 1px solid var(--rmi-border);
    padding: 12px 14px;
    white-space: nowrap;
    background-color: var(--rmi-surface-alt);
}

.table tbody tr td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--rmi-surface-muted);
    vertical-align: middle;
    font-size: 14px;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr {
    transition: background-color 0.12s ease;
}

.table-hover tbody tr:hover {
    background-color: var(--rmi-surface-hover);
}

.table tbody tr.table-danger,
.table tbody tr.table-danger > td {
    background-color: rgba(var(--rmi-danger-rgb), 0.06);
}

.table-hover tbody tr.table-danger:hover,
.table-hover tbody tr.table-danger:hover > td {
    background-color: rgba(var(--rmi-danger-rgb), 0.1);
}

.table-responsive {
    border: none;
    margin: 0;
    padding: 0;
}

.table a {
    color: var(--rmi-primary);
    text-decoration: none;
}

.table a:hover {
    color: var(--rmi-primary-hover);
    text-decoration: underline;
}

/* Align numeric columns with tabular figures for scannability. */
.table td.text-right,
.table th.text-right {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.row-number {
    color: var(--rmi-text-muted);
    font-size: 13px;
}

.table-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--rmi-text-muted);
}

.table-empty i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: var(--rmi-surface-muted);
    color: var(--rmi-text-muted);
    font-size: 22px;
    margin-bottom: 14px;
    opacity: 1;
}

.table-empty p {
    margin: 0;
    font-size: 14px;
}

.table-empty small {
    display: block;
    margin-top: 2px;
}

.table-empty-sm {
    padding: 24px 16px;
}

.table-empty-sm i {
    font-size: 24px;
    margin-bottom: 8px;
}

.col-action {
    width: 120px;
    text-align: right;
}

.table-responsive:focus {
    outline: 2px solid rgba(var(--rmi-primary-rgb), 0.25);
    outline-offset: -1px;
}

/* --------------------------------------------------------------------------
   8. STATUS BADGES
   -------------------------------------------------------------------------- */

.badge {
    font-family: var(--rmi-font-sans);
    font-size: 11.5px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    line-height: 1;
    white-space: nowrap;
    box-shadow: none;
}

.badge-primary {
    background-color: rgba(var(--rmi-primary-rgb), 0.12);
    color: var(--rmi-primary);
}

.badge-success {
    background-color: rgba(var(--rmi-success-rgb), 0.12);
    color: var(--rmi-success);
}

.badge-warning {
    background-color: rgba(var(--rmi-warning-rgb), 0.12);
    color: var(--rmi-warning-text);
}

.badge-danger {
    background-color: rgba(var(--rmi-danger-rgb), 0.12);
    color: var(--rmi-danger);
}

.badge-info {
    background-color: rgba(var(--rmi-info-rgb), 0.12);
    color: var(--rmi-info);
}

.badge-secondary {
    background-color: rgba(152, 166, 173, 0.12);
    color: var(--rmi-text-muted);
}

.badge-light {
    background-color: var(--rmi-surface-muted);
    color: var(--rmi-text-muted);
    border: 1px solid var(--rmi-border);
}

.badge-outline {
    font-size: 11px;
    border: 1px solid var(--rmi-border);
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 4px;
}

.status-dot-success { background-color: var(--rmi-success); }
.status-dot-warning { background-color: var(--rmi-warning); }
.status-dot-danger { background-color: var(--rmi-danger); }
.status-dot-info { background-color: var(--rmi-info); }
.status-dot-secondary { background-color: var(--rmi-text-muted); }

/* --------------------------------------------------------------------------
   9. PAGINATION
   -------------------------------------------------------------------------- */

.pagination {
    margin-top: 16px;
    margin-bottom: 0;
}

.page-item {
    margin: 0 2px;
}

.page-link {
    font-size: 13px;
    font-weight: 500;
    color: var(--rmi-text);
    background-color: var(--rmi-surface);
    border: 1px solid var(--rmi-border);
    padding: 6px 12px;
    border-radius: var(--rmi-radius);
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.page-link:hover {
    background-color: var(--rmi-surface-muted);
    border-color: var(--rmi-border-strong);
    color: var(--rmi-primary);
}

.page-item.active .page-link {
    background-color: var(--rmi-primary);
    border-color: var(--rmi-primary);
    color: #ffffff;
}

.page-item.disabled .page-link {
    background-color: var(--rmi-surface-muted);
    border-color: var(--rmi-border);
    color: var(--rmi-border-strong);
}

/* --------------------------------------------------------------------------
   10. ALERTS / FLASH MESSAGES
   -------------------------------------------------------------------------- */

.alert {
    border: none;
    border-radius: var(--rmi-radius);
    font-size: 14px;
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert-success {
    background-color: rgba(var(--rmi-success-rgb), 0.1);
    color: #098760;
}

.alert-danger {
    background-color: rgba(var(--rmi-danger-rgb), 0.1);
    color: #c0324a;
}

.alert-warning {
    background-color: rgba(var(--rmi-warning-rgb), 0.1);
    color: #8a6d00;
}

.alert-info {
    background-color: rgba(var(--rmi-info-rgb), 0.1);
    color: #2c7bb5;
}

.alert .close {
    font-size: 18px;
    opacity: 0.5;
    padding: 0;
    margin-left: auto;
}

.alert .close:hover {
    opacity: 0.8;
}

/* --------------------------------------------------------------------------
   11. MODAL
   -------------------------------------------------------------------------- */

.modal-content {
    border: none;
    border-radius: var(--rmi-radius-lg);
    box-shadow: var(--rmi-shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--rmi-border);
    padding: 16px 20px;
}

.modal-header .modal-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--rmi-text);
}

.modal-header .close {
    font-size: 22px;
    opacity: 0.4;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    border-top: 1px solid var(--rmi-border);
    padding: 12px 20px;
}

/* --------------------------------------------------------------------------
   12. SIDEBAR
   -------------------------------------------------------------------------- */

.left.side-menu {
    background-color: var(--rmi-surface);
    border-right: 1px solid var(--rmi-border);
    width: var(--rmi-sidebar-width);
}

.sidebar-backdrop {
    display: none;
}

.side-menu .user-box {
    display: none;
}

#sidebar-menu {
    padding-top: calc(var(--rmi-header-height) + 12px);
}

.side-menu .metismenu > li > a {
    font-size: 14px;
    color: var(--rmi-text-soft);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background-color 0.15s ease, color 0.15s ease;
    border-left: 3px solid transparent;
    text-decoration: none;
}

.side-menu .metismenu > li > a:hover {
    color: var(--rmi-primary);
    background-color: rgba(var(--rmi-primary-rgb), 0.04);
    text-decoration: none;
}

.side-menu .metismenu > li.active > a {
    color: var(--rmi-primary);
    background-color: rgba(var(--rmi-primary-rgb), 0.06);
    border-left-color: var(--rmi-primary);
    font-weight: 500;
    padding-left: 17px;
}

.side-menu .metismenu > li > a > i {
    font-size: 16px;
    width: 20px;
    text-align: center;
    color: var(--rmi-text-muted);
}

.side-menu .metismenu > li.active > a > i {
    color: var(--rmi-primary);
}

.side-menu .metismenu .nav-second-level {
    background-color: var(--rmi-surface-alt);
}

.side-menu .metismenu .nav-second-level > li > a {
    font-size: 13px;
    padding: 8px 20px 8px 50px;
    color: var(--rmi-text-soft);
}

.side-menu .metismenu .nav-second-level > li > a:hover {
    color: var(--rmi-primary);
}

.side-menu .metismenu .nav-second-level > li.active > a {
    color: var(--rmi-primary);
    font-weight: 500;
}

.side-menu .metismenu .menu-title {
    padding: 18px 20px 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--rmi-text-muted);
    pointer-events: none;
    cursor: default;
}

.menu-arrow {
    margin-left: auto;
    font-size: 10px;
    color: var(--rmi-text-muted);
    transition: transform 0.2s ease;
}

.topbar-left {
    padding: 0 20px;
    border-bottom: 1px solid var(--rmi-border);
    height: var(--rmi-header-height);
    display: flex;
    align-items: center;
    justify-content: center;
}

.topbar-left .logo {
    line-height: 1;
    display: flex;
    align-items: center;
}

.topbar-left .logo img {
    max-height: 28px;
    display: block;
}

/* Override legacy 70px from style.css */
.side-menu .topbar-left {
    height: var(--rmi-header-height) !important;
    line-height: var(--rmi-header-height);
    padding-top: 0;
    padding-bottom: 0;
}

/* --------------------------------------------------------------------------
   13. TOPBAR
   -------------------------------------------------------------------------- */

.topbar {
    background-color: var(--rmi-surface);
    border-bottom: 1px solid var(--rmi-border);
    box-shadow: var(--rmi-shadow-xs);
    padding: 0 20px;
    height: var(--rmi-header-height);
    display: flex;
    align-items: center;
}

.topbar .navbar-custom {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar .button-menu-mobile {
    display: none;
    background: none;
    border: none;
    color: var(--rmi-text-soft);
    font-size: 20px;
    padding: 4px 8px;
    height: auto;
    width: auto;
    cursor: pointer;
}

.topbar .button-menu-mobile:hover {
    color: var(--rmi-primary);
}

.topbar .navbar-custom .dropdown {
    margin-left: auto;
}

.topbar .nav-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: var(--rmi-radius);
    color: var(--rmi-text);
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
}

.topbar .nav-user:hover {
    background-color: var(--rmi-surface-muted);
    text-decoration: none;
    color: var(--rmi-text);
}

.topbar .nav-user img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.topbar .nav-user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}

.topbar .nav-user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--rmi-text);
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar .nav-user-role {
    font-size: 11px;
    color: var(--rmi-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.topbar .profile-dropdown {
    min-width: 180px;
    border: 1px solid var(--rmi-border);
    border-radius: var(--rmi-radius);
    box-shadow: var(--rmi-shadow-md);
    padding: 4px 0;
}

.topbar .profile-dropdown .dropdown-item {
    font-size: 14px;
    padding: 8px 16px;
    color: var(--rmi-text);
}

.topbar .profile-dropdown .dropdown-item:hover {
    background-color: var(--rmi-surface-muted);
    color: var(--rmi-primary);
}

/* --------------------------------------------------------------------------
   14. CONTENT AREA & FOOTER
   -------------------------------------------------------------------------- */

.content-page {
    margin-left: var(--rmi-sidebar-width);
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.2s ease;
    overflow: visible !important;
}

.content-page .content {
    flex: 1;
    padding: 20px;
    margin-top: 0 !important;
}

.content-page .container-fluid {
    max-width: var(--rmi-content-max);
    margin-left: auto;
    margin-right: auto;
    padding-left: 0;
    padding-right: 0;
}

/* Override style.css absolute footer */
.footer {
    position: static !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    padding: 14px 20px;
    font-size: 12px;
    color: var(--rmi-text-muted);
    border-top: 1px solid var(--rmi-border);
    background-color: var(--rmi-surface);
    margin-top: auto;
}

#wrapper {
    overflow: visible !important;
    height: auto !important;
    min-height: 100vh;
}

/* --------------------------------------------------------------------------
   15. LOGIN / AUTH PAGES
   -------------------------------------------------------------------------- */

.account-pages {
    background-color: var(--rmi-surface-muted);
    min-height: 100vh;
}

.account-pages .wrapper-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    position: relative;
    z-index: 1;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--rmi-surface);
    border: 1px solid var(--rmi-border);
    border-top: 3px solid var(--rmi-primary);
    border-radius: var(--rmi-radius-lg);
    padding: 32px;
    box-shadow: var(--rmi-shadow-md);
}

.login-card .login-logo {
    text-align: center;
    margin-bottom: 24px;
}

.login-card .login-logo img {
    max-height: 48px;
}

.login-card .login-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--rmi-text);
    text-align: center;
    margin-bottom: 4px;
}

.login-card .login-subtitle {
    font-size: 13px;
    color: var(--rmi-text-muted);
    text-align: center;
    margin-bottom: 20px;
}

.login-card .form-group {
    margin-bottom: 16px;
}

.login-card .form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--rmi-text-soft);
    margin-bottom: 6px;
}

.login-card .btn-login {
    width: 100%;
    padding: 10px;
    font-size: 14px;
    font-weight: 600;
}

.account-copyright {
    font-size: 12px;
    color: var(--rmi-text-muted);
}

/* --------------------------------------------------------------------------
   16. MEMBER VIEW — Tabs & detail grids
   -------------------------------------------------------------------------- */

.member-nav {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--rmi-border);
    margin-bottom: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.member-nav .nav-link {
    font-size: 13px;
    font-weight: 500;
    color: var(--rmi-text-muted);
    padding: 10px 16px;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    background: none;
    white-space: nowrap;
    transition: color 0.15s ease, border-color 0.15s ease;
    cursor: pointer;
}

.member-nav .nav-link:hover {
    color: var(--rmi-primary);
}

.member-nav .nav-link.active {
    color: var(--rmi-primary);
    border-bottom-color: var(--rmi-primary);
    background: none;
}

.member-view .tab-content > .tab-pane {
    display: none;
}

.member-view .tab-content > .tab-pane.active {
    display: block;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.detail-grid-full {
    grid-template-columns: 1fr;
}

.detail-item {
    margin-bottom: 0;
}

.detail-item-full {
    grid-column: 1 / -1;
}

.detail-item .detail-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--rmi-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 2px;
}

.detail-item .detail-value {
    font-size: 14px;
    color: var(--rmi-text);
    word-break: break-word;
}

.detail-section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--rmi-text);
    margin: 20px 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--rmi-border);
}

.detail-divider {
    border: none;
    border-top: 1px solid var(--rmi-surface-muted);
    margin: 16px 0;
}

/* --------------------------------------------------------------------------
   17. EMPTY STATE
   -------------------------------------------------------------------------- */

.empty-state {
    text-align: center;
    padding: 48px 20px;
}

.empty-state i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background-color: var(--rmi-surface-muted);
    color: var(--rmi-text-muted);
    font-size: 26px;
    margin-bottom: 16px;
}

.empty-state .empty-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--rmi-text);
    margin-bottom: 4px;
}

.empty-state .empty-text {
    font-size: 14px;
    color: var(--rmi-text-muted);
    margin: 0;
}

.empty-state-sm {
    padding: 24px 0;
}

.empty-state-sm .empty-title {
    font-size: 14px;
}

/* --------------------------------------------------------------------------
   18. LOADING STATE
   -------------------------------------------------------------------------- */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--rmi-border);
    border-top-color: var(--rmi-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --------------------------------------------------------------------------
   19. INFO CARD
   -------------------------------------------------------------------------- */

.info-card {
    border: 1px solid var(--rmi-border);
    border-radius: var(--rmi-radius);
    background: var(--rmi-surface);
    padding: 20px;
    margin-bottom: 20px;
}

.info-card .info-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.info-card .info-item {
    flex: 1;
    min-width: 160px;
}

.info-card .info-item .info-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--rmi-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 2px;
}

.info-card .info-item .info-value {
    font-size: 14px;
    color: var(--rmi-text);
}

.info-card .info-divider {
    width: 100%;
    border: none;
    border-top: 1px solid var(--rmi-border);
    margin: 12px 0;
}

.info-card .info-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--rmi-text);
    margin: 16px 0 8px 0;
}

/* --------------------------------------------------------------------------
   20. DASHBOARD
   -------------------------------------------------------------------------- */

.dashboard-page .dashboard-stat-card {
    border: 1px solid var(--rmi-border);
    border-radius: var(--rmi-radius);
    height: 100%;
}

.dashboard-page .dashboard-stat-card .card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.dashboard-page .stat-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--rmi-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}

.dashboard-page .stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--rmi-text);
    line-height: 1.2;
    word-break: break-word;
    font-variant-numeric: tabular-nums;
}

.dashboard-page .dashboard-stat-card:hover {
    border-color: var(--rmi-border-strong);
    box-shadow: var(--rmi-shadow-md);
}

.dashboard-page .stat-foot {
    font-size: 12px;
    color: var(--rmi-text-muted);
    margin-top: 4px;
    line-height: 1.4;
}

.dashboard-page .stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.dashboard-page .stat-icon-warning {
    background-color: rgba(var(--rmi-warning-rgb), 0.12);
    color: var(--rmi-warning-text);
}

.dashboard-page .stat-icon-info {
    background-color: rgba(var(--rmi-info-rgb), 0.12);
    color: var(--rmi-info);
}

.dashboard-page .stat-link {
    display: inline-block;
    margin-top: 10px;
    font-size: 12px;
    font-weight: 500;
    color: var(--rmi-primary);
    text-decoration: none;
}

.dashboard-page .stat-link:hover {
    color: var(--rmi-primary-hover);
    text-decoration: none;
}

.dashboard-page .stat-link-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
    font-size: 12px;
}

.dashboard-page .stat-link-group .stat-link {
    margin-top: 0;
}

.dashboard-page .card-header .card-title {
    font-size: 14px;
    font-weight: 600;
}

.dashboard-page .dashboard-actions .btn {
    justify-content: flex-start;
    margin-bottom: 8px;
    text-align: left;
    font-weight: 400;
    width: 100%;
}

.dashboard-page .dashboard-actions .btn:last-child {
    margin-bottom: 0;
}

.dashboard-page .dashboard-summary-list .list-group-item {
    font-size: 13px;
    padding: 10px 16px;
    border-color: var(--rmi-surface-muted);
}

.dashboard-page .dashboard-summary-list .badge {
    font-size: 12px;
}

.dashboard-page .card-footer {
    background-color: var(--rmi-surface);
    border-top: 1px solid var(--rmi-border);
    padding: 12px 16px;
}

.dashboard-stat-row > [class*="col-"] {
    display: flex;
    margin-bottom: 16px;
}

.dashboard-stat-row .dashboard-stat-card {
    flex: 1;
}

.dashboard-page .table th,
.dashboard-page .table td {
    white-space: nowrap;
}

.dashboard-page .table td:nth-child(3) {
    white-space: normal;
    min-width: 140px;
}

/* --------------------------------------------------------------------------
   21. TRANSACTION DETAIL
   -------------------------------------------------------------------------- */

.trx-id {
    font-family: var(--rmi-font-mono);
    font-size: 13px;
    letter-spacing: 0.02em;
    color: var(--rmi-text);
}

.trx-detail-page .back-link {
    margin-bottom: 16px;
}

.trx-summary-card .trx-id {
    font-weight: 600;
}

.trx-proof-card .card-header {
    padding: 12px 16px;
}

.trx-proof-img {
    max-width: 240px;
    border: 1px solid var(--rmi-border);
    border-radius: var(--rmi-radius);
    cursor: zoom-in;
    background: var(--rmi-surface-alt);
    display: block;
}

.trx-switch-flow {
    display: flex;
    align-items: stretch;
    gap: 12px;
}

.trx-switch-flow .trx-switch-card {
    flex: 1;
    margin-bottom: 0;
}

.trx-switch-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    color: var(--rmi-text-muted);
    font-size: 14px;
}

.trx-switch-arrow i {
    width: 32px;
    height: 32px;
    border: 1px solid var(--rmi-border);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--rmi-surface);
}

.trx-bank-grid {
    gap: 16px;
}

.trx-bank-grid .detail-value.trx-id {
    font-weight: 600;
    letter-spacing: 0.02em;
}

.trx-proof-divider {
    border: none;
    border-top: 1px solid var(--rmi-surface-muted);
    margin: 16px 0;
}

.trx-proof-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 28px 20px;
    border: 1px dashed var(--rmi-border);
    border-radius: var(--rmi-radius);
    background: var(--rmi-surface-alt);
    color: var(--rmi-text-muted);
    font-size: 13px;
    text-align: center;
}

.trx-proof-empty i {
    font-size: 24px;
    opacity: 0.5;
}

.trx-proof-empty-lg {
    min-height: 120px;
}

.trx-proof-empty-md {
    min-height: 100px;
}

.trx-proof-link {
    display: inline-block;
}

.trx-proof-fallback {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    border: 1px solid var(--rmi-warning);
    border-radius: var(--rmi-radius);
    background: rgba(var(--rmi-warning-rgb), 0.08);
    color: #8a6d00;
    font-size: 12px;
}

.trx-bank-card .card-header .badge,
.trx-proof-card .card-header .badge {
    font-weight: 400;
}

/* --------------------------------------------------------------------------
   22. MEMBER DETAIL
   -------------------------------------------------------------------------- */

.member-detail-page .member-summary-card {
    border-left: 3px solid var(--rmi-primary);
    background: var(--rmi-surface);
}

.member-detail-page .member-summary-card .info-value {
    font-weight: 500;
}

.member-detail-page .member-nav {
    position: relative;
    scrollbar-width: thin;
    scrollbar-color: var(--rmi-border-strong) transparent;
}

.member-detail-page .member-nav::-webkit-scrollbar {
    height: 4px;
}

.member-detail-page .member-nav::-webkit-scrollbar-thumb {
    background: var(--rmi-border-strong);
    border-radius: 2px;
}

.member-detail-page .detail-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--rmi-text);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 20px 0 12px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--rmi-surface-muted);
}

.member-detail-page .card .card-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--rmi-surface-muted);
}

.member-detail-page .empty-state {
    padding: 24px 0;
}

/* --------------------------------------------------------------------------
   23. ATTACHMENTS, MEDIA & MISC UTILITIES
   -------------------------------------------------------------------------- */

.banner-thumb {
    border: 1px solid var(--rmi-border);
    border-radius: var(--rmi-radius);
    background: var(--rmi-surface-alt);
    max-width: 120px;
    max-height: 60px;
    object-fit: cover;
}

.banner-fallback {
    display: none;
}

.cell-truncate {
    max-width: 180px;
}

.text-break-all {
    word-break: break-all;
}

.im-preview {
    max-width: 300px;
    border: 1px solid var(--rmi-border);
    border-radius: var(--rmi-radius);
}

.banner-preview {
    max-width: 200px;
    border-radius: var(--rmi-radius);
}

.attachment-thumb {
    max-height: 220px;
    width: 100%;
    object-fit: cover;
    border: 1px solid var(--rmi-border);
    border-radius: var(--rmi-radius);
}

.attachment-signature {
    max-height: 120px;
    max-width: 100%;
}

.attachment-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.attachment-signature-box {
    display: inline-block;
    background: var(--rmi-surface);
    border: 1px solid var(--rmi-border);
    border-radius: var(--rmi-radius);
    padding: 8px;
}

.error-icon {
    font-size: 48px;
    color: var(--rmi-danger);
    margin-bottom: 16px;
}

.error-message {
    max-width: 500px;
    margin: 16px auto;
    text-align: left;
}

.error-text {
    color: var(--rmi-text-muted);
    margin-bottom: 16px;
}

/* --------------------------------------------------------------------------
   24. UTILITY CLASSES
   -------------------------------------------------------------------------- */

.text-primary { color: var(--rmi-primary) !important; }
.text-success { color: var(--rmi-success) !important; }
.text-danger { color: var(--rmi-danger) !important; }
.text-warning { color: var(--rmi-warning) !important; }
.text-info { color: var(--rmi-info) !important; }
.text-muted { color: var(--rmi-text-muted) !important; }

.bg-primary-light { background-color: rgba(var(--rmi-primary-rgb), 0.08); }
.bg-success-light { background-color: rgba(var(--rmi-success-rgb), 0.08); }
.bg-danger-light { background-color: rgba(var(--rmi-danger-rgb), 0.08); }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }

.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }

/* --------------------------------------------------------------------------
   25. RESPONSIVE
   -------------------------------------------------------------------------- */

@media (max-width: 991.98px) {
    .content-page {
        margin-left: 0;
    }

    .topbar .button-menu-mobile {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .left.side-menu {
        position: fixed;
        top: 0;
        left: calc(-1 * var(--rmi-sidebar-width));
        width: var(--rmi-sidebar-width);
        height: 100vh;
        z-index: 1050;
        transition: left 0.2s ease;
        overflow-y: auto;
    }

    .left.side-menu.open {
        left: 0;
    }

    .sidebar-backdrop {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.3);
        z-index: 1049;
    }

    .sidebar-backdrop.show {
        display: block;
    }

    .content-page .content {
        padding: 16px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .page-header .page-actions {
        width: 100%;
    }

    .search-form {
        padding: 12px;
    }

    .search-form .form-group {
        min-width: 100%;
    }

    .info-card .info-row {
        flex-direction: column;
        gap: 12px;
    }

    .detail-grid {
        grid-template-columns: 1fr 1fr;
    }

    .member-nav {
        padding-bottom: 4px;
    }

    .table-responsive {
        border: 1px solid var(--rmi-border);
        border-radius: var(--rmi-radius);
    }

    .trx-switch-flow {
        flex-direction: column;
        gap: 0;
    }

    .trx-switch-arrow {
        padding: 8px 0;
        transform: rotate(90deg);
    }

    .trx-proof-img {
        max-width: 100%;
    }

    .trx-bank-grid {
        grid-template-columns: 1fr;
    }

    .form-horizontal .control-label,
    .text-right label,
    .col-sm-3.text-right {
        text-align: left !important;
        padding-top: 0;
        margin-bottom: 4px;
    }
}

@media (max-width: 575.98px) {
    .content-page .content {
        padding: 12px;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .page-header .page-title {
        font-size: 18px;
    }

    .btn-group-sm > .btn,
    .btn-sm {
        padding: 3px 6px;
    }

    .dashboard-page .stat-value {
        font-size: 18px;
    }

    .dashboard-page .stat-icon {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }
}

/* --------------------------------------------------------------------------
   26. LEGACY THEME FIXES (style.css workarounds)
   -------------------------------------------------------------------------- */

.slimscroll-menu {
    overflow: visible !important;
}

.slimScrollDiv {
    overflow: visible !important;
}

.slimScrollBar {
    opacity: 0.35 !important;
}

.card > .table-responsive,
.card-body.p-0 > .table-responsive {
    border-radius: var(--rmi-radius);
    overflow: hidden;
}

.card .table-empty {
    padding: 36px 20px;
}

/* --------------------------------------------------------------------------
   27. PRINT
   -------------------------------------------------------------------------- */

@media print {
    .topbar,
    .left.side-menu,
    .footer,
    .btn,
    .back-link,
    .search-form,
    .pagination {
        display: none !important;
    }

    .content-page {
        margin-left: 0 !important;
    }

    .card {
        border: 1px solid #ddd !important;
        box-shadow: none !important;
    }

    body {
        font-size: 12px;
    }

    .member-detail-page .member-nav,
    .member-detail-page .back-link,
    .member-detail-page .page-actions {
        display: none !important;
    }

    .member-detail-page .tab-content > .tab-pane {
        display: block !important;
        opacity: 1 !important;
        margin-bottom: 20px;
    }
}
