/* =========================================================================
   Invest Nest — modern design system (offline, no build step)
   Desktop: sidebar + topbar.  Mobile: native-app feel (app bar + bottom tabs).
   ========================================================================= */

/* ---- Inter font (offline) ---- */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/inter/inter-400.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/inter/inter-500.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/inter/inter-600.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/inter/inter-700.woff2') format('woff2'); }

:root {
    --in-primary: #5b54f0;
    --in-primary-rgb: 91, 84, 240;
    --in-primary-dark: #463fce;
    --in-accent: #8b5cf6;
    --in-success: #16a34a;
    --in-body-bg: #f5f6fb;
    --in-surface: #ffffff;
    --in-ink: #111729;
    --in-muted: #6b7280;
    --in-border: #eceef3;
    --in-sidebar-bg: #0f1222;
    --in-radius-sm: 12px;
    --in-radius: 18px;
    --in-radius-lg: 24px;
    --in-shadow-sm: 0 1px 2px rgba(17, 23, 41, 0.06), 0 1px 3px rgba(17, 23, 41, 0.04);
    --in-shadow: 0 10px 30px rgba(17, 23, 41, 0.08);
    --in-shadow-lg: 0 24px 60px rgba(17, 23, 41, 0.16);
    --in-topbar-h: 64px;
    --in-bottomnav-h: 66px;
    --bs-body-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { -webkit-tap-highlight-color: transparent; }

/* Bootstrap 5 has no min-w-0 utility — needed so flex children can truncate */
.min-w-0 { min-width: 0 !important; }

body {
    font-family: var(--bs-body-font-family);
    background-color: var(--in-body-bg);
    color: var(--in-ink);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden; /* guard against accidental horizontal scroll on mobile */
}

/* Bootstrap accent overrides */
.btn { --bs-btn-font-weight: 600; border-radius: var(--in-radius-sm); padding: 0.6rem 1.05rem; }
.btn-lg { border-radius: var(--in-radius-sm); padding: 0.8rem 1.2rem; }
.btn-primary {
    --bs-btn-bg: var(--in-primary); --bs-btn-border-color: var(--in-primary);
    --bs-btn-hover-bg: var(--in-primary-dark); --bs-btn-hover-border-color: var(--in-primary-dark);
    --bs-btn-active-bg: var(--in-primary-dark); --bs-btn-active-border-color: var(--in-primary-dark);
    --bs-btn-disabled-bg: var(--in-primary); --bs-btn-disabled-border-color: var(--in-primary);
    box-shadow: 0 8px 20px rgba(var(--in-primary-rgb), 0.28);
}
.btn-primary:hover { box-shadow: 0 10px 24px rgba(var(--in-primary-rgb), 0.34); }
/* Links: scoped, NOT global !important (that was hiding text on coloured backgrounds) */
a { color: var(--in-primary); text-decoration: none; }
a:hover { color: var(--in-primary-dark); }
.text-primary { color: var(--in-primary) !important; }
.link-primary { color: var(--in-primary) !important; }
.bg-primary { background-color: var(--in-primary) !important; }

.form-control, .form-select {
    border-radius: var(--in-radius-sm);
    border-color: var(--in-border);
    padding: 0.5rem 0.85rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--in-primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--in-primary-rgb), 0.15);
}
/* Lighter placeholder so it's clearly a hint, not a typed value
   (esp. the masked "••••••••" hint on password fields). */
.form-control::placeholder { color: #b9bfca; opacity: 1; }
.form-control::-webkit-input-placeholder { color: #b9bfca; }
.form-control:-ms-input-placeholder { color: #b9bfca; }
.input-group-text { border-radius: var(--in-radius-sm); border-color: var(--in-border); }

/* Merge add-ons (e.g. a currency prefix) seamlessly with the field. Our radius
   overrides above otherwise leave each as a separate rounded box — and Bootstrap
   skips its own corner-flattening when the group has .has-validation, so enforce
   it here regardless of validation state. */
.input-group > :not(:first-child).form-control,
.input-group > :not(:first-child).form-select {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}
.input-group > :not(:last-child).form-control,
.input-group > :not(:last-child).form-select {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}
.input-group > .input-group-text:first-child {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}
.input-group > .input-group-text:last-child {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* Light buttons must always carry a visible outline/border (project rule) */
.btn-light,
.btn-light:visited {
    background-color: #fff;
    border-color: #d4d8e0;
    color: #344054;
}
.btn-light:hover {
    background-color: #f4f6fa;
    border-color: #b9bfcc;
    color: #1f2430;
}
.btn-light:focus,
.btn-light.focus,
.btn-light:focus-visible {
    border-color: var(--in-primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--in-primary-rgb), 0.15);
}
.btn-light:active,
.btn-light.active,
.btn-check:checked + .btn-light {
    background-color: #e9edf3 !important;
    border-color: #aab1c0 !important;
    color: #1f2430 !important;
}
.btn-light:disabled,
.btn-light.disabled { background-color: #fff; border-color: var(--in-border); }

/* Flash highlight for a section scrolled into view (member details quick links) */
.section-flash {
    animation: sectionFlash 3.2s ease-in-out;
    border-color: transparent !important;
}
@keyframes sectionFlash {
    /* three pulses over the duration -> a clear, longer "blink" */
    0%   { box-shadow: 0 0 0 0 rgba(var(--in-primary-rgb), 0);    transform: scale(1); }
    8%   { box-shadow: 0 0 0 4px rgba(var(--in-primary-rgb), 0.55), 0 16px 40px -10px rgba(var(--in-primary-rgb), 0.45); transform: scale(1.012); }
    20%  { box-shadow: 0 0 0 5px rgba(var(--in-primary-rgb), 0.12); transform: scale(1); }
    34%  { box-shadow: 0 0 0 4px rgba(var(--in-primary-rgb), 0.5); transform: scale(1.01); }
    48%  { box-shadow: 0 0 0 5px rgba(var(--in-primary-rgb), 0.12); transform: scale(1); }
    62%  { box-shadow: 0 0 0 4px rgba(var(--in-primary-rgb), 0.45); transform: scale(1.008); }
    100% { box-shadow: 0 0 0 0 rgba(var(--in-primary-rgb), 0);    transform: scale(1); }
}

/* Notification bell unread badge */
.notif-dot {
    position: absolute; top: -4px; right: -4px;
    min-width: 17px; height: 17px; padding: 0 4px;
    background: #ef4444; color: #fff;
    font-size: 10px; font-weight: 700; line-height: 17px;
    border-radius: 999px; text-align: center;
    box-shadow: 0 0 0 2px var(--in-surface);
}

/* =========================================================================
   Uniform input heights — every input/select/picker is the SAME height,
   project-wide (forms, filters, reports). Textareas stay auto + resizable.
   ========================================================================= */
:root { --in-input-h: 44px; }

.form-control,
.form-select,
.input-group > .form-control,
.input-group > .form-select,
.input-group-text,
.input-group > .btn,
input[type="text"].form-control,
input[type="email"].form-control,
input[type="password"].form-control,
input[type="number"].form-control,
input[type="search"].form-control,
input[type="tel"].form-control,
input[type="url"].form-control,
input[type="date"].form-control,
input[type="time"].form-control,
input[type="datetime-local"].form-control,
input[type="file"].form-control {
    height: var(--in-input-h);
    min-height: var(--in-input-h);
}

/* Vertically centre file-input content at the fixed height */
input[type="file"].form-control { display: flex; align-items: center; }

/* Select2 single control matches the same height exactly */
.select2-container--bootstrap-5 .select2-selection--single {
    height: var(--in-input-h) !important;
    min-height: var(--in-input-h) !important;
    display: flex;
    align-items: center;
}
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    padding-top: 0;
    padding-bottom: 0;
    line-height: 1.4;
}

/* Multiple control must grow with its chips, not clamp to a single line */
.select2-container--bootstrap-5 .select2-selection--multiple {
    height: auto !important;
    min-height: var(--in-input-h) !important;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.3rem 0.5rem;
}
.select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__rendered {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0;
    width: 100%;
}

/* Small variant kept consistent (e.g. compact file pickers) */
.form-control-sm, .form-select-sm { height: 36px; min-height: 36px; }

/* Textareas are the ONE exception: natural height + user-resizable vertically.
   CKEditor-managed textareas are excluded. */
textarea.form-control:not(.ckeditor) {
    height: auto;
    min-height: 110px;
    resize: vertical;
    padding: 0.6rem 0.85rem;
}

/* =========================================================================
   File upload preview (thumbnails) + lightbox
   ========================================================================= */
.file-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}
.file-preview.is-empty { display: none; }

.fp-thumb {
    width: 76px; height: 76px;
    border-radius: 12px; overflow: hidden;
    border: 1px solid var(--in-border);
    background: #f3f4f6;
    cursor: pointer; position: relative; flex-shrink: 0;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.fp-thumb:hover { transform: translateY(-2px); box-shadow: var(--in-shadow); }
.fp-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.fp-thumb .fp-zoom {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(17, 23, 41, 0.42); color: #fff; font-size: 18px;
    opacity: 0; transition: opacity 0.15s ease;
}
.fp-thumb:hover .fp-zoom { opacity: 1; }

.fp-file {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 12px; border: 1px solid var(--in-border);
    border-radius: 10px; background: #f9fafb; font-size: 13px; color: var(--in-ink);
    max-width: 240px;
}
.fp-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.lightbox {
    position: fixed; inset: 0; z-index: 100050;
    display: none; align-items: center; justify-content: center;
    padding: 24px;
    background: rgba(15, 18, 34, 0.86);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.lightbox.show { display: flex; }
.lightbox img {
    max-width: 92vw; max-height: 90vh;
    border-radius: 12px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}
.lightbox-close {
    position: absolute; top: 16px; right: 24px;
    color: #fff; font-size: 36px; line-height: 1; cursor: pointer;
    width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
}
/* Fallback shown when a document can't be previewed (PDF, Office, zip, …) */
.lightbox-fallback {
    display: none; flex-direction: column; align-items: center; justify-content: center;
    gap: 12px; text-align: center;
    width: min(420px, 90vw); padding: 40px 28px;
    background: #fff; border-radius: 16px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}
.lightbox-fallback i { font-size: 64px; color: var(--in-primary); }
.lightbox-fallback .lb-name { font-weight: 600; word-break: break-word; }
.lightbox-fallback .lb-note { font-size: 13px; color: var(--in-muted); }
.lightbox-fallback .lightbox-download { border: 1px solid #d4d8e0; }

/* =========================================================================
   Toastr — modernised, dismissable toasts (with close cross)
   ========================================================================= */
#toast-container > div {
    opacity: 1;
    border-radius: 14px;
    box-shadow: var(--in-shadow-lg);
    font-family: var(--bs-body-font-family);
    font-size: 14px;
    padding: 15px 18px 15px 50px;
    width: 320px;
}
#toast-container > div:hover { box-shadow: var(--in-shadow-lg); opacity: 1; }
#toast-container > .toast-success { background-color: #16a34a; }
#toast-container > .toast-error   { background-color: #dc2626; }
#toast-container > .toast-info    { background-color: var(--in-primary); }
#toast-container > .toast-warning { background-color: #f59e0b; }
.toast-title { font-weight: 600; }
.toast-message { line-height: 1.4; }
.toast-close-button {
    font-size: 20px; font-weight: 400; line-height: 1;
    opacity: 0.85; text-shadow: none; color: #fff;
    position: relative; top: -2px;
}
.toast-close-button:hover, .toast-close-button:focus { opacity: 1; color: #fff; }
#toast-container.toast-top-right > div { margin-top: 12px; }

@media (max-width: 575.98px) {
    #toast-container > div { width: auto; }
    #toast-container.toast-top-right {
        right: 12px; left: 12px;
        top: calc(12px + env(safe-area-inset-top));
    }
}

.card {
    border: 1px solid var(--in-border);
    border-radius: var(--in-radius);
    box-shadow: var(--in-shadow-sm);
}
.shadow-sm { box-shadow: var(--in-shadow-sm) !important; }
.shadow, .shadow-lg { box-shadow: var(--in-shadow) !important; }
.badge { font-weight: 600; border-radius: 999px; padding: 0.4em 0.7em; }

/* =========================================================================
   Full-window preloader
   ========================================================================= */
#app-preloader {
    position: fixed; inset: 0; width: 100%; height: 100%;
    display: none; align-items: center; justify-content: center; flex-direction: column; gap: 16px;
    background-color: rgba(15, 18, 34, 0.45);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    z-index: 100000;
}
#app-preloader.is-active { display: flex; }
#app-preloader .app-spinner {
    width: 54px; height: 54px;
    border: 5px solid rgba(255, 255, 255, 0.3); border-top-color: #fff;
    border-radius: 50%; animation: appSpin 0.85s linear infinite;
}
#app-preloader .app-spinner-text { color: #fff; font-size: 13.5px; font-weight: 500; letter-spacing: 0.3px; }
@keyframes appSpin { to { transform: rotate(360deg); } }

/* =========================================================================
   Auth — split-screen layout
   ========================================================================= */
.auth-split {
    display: flex;
    min-height: 100vh; min-height: 100dvh;
    background: var(--in-body-bg);
}

/* Left: animated brand showcase */
.auth-aside {
    position: relative; overflow: hidden;
    flex: 1 1 48%; max-width: 620px;
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 48px 56px;
    color: #fff;
    background:
        radial-gradient(900px 500px at 110% -10%, rgba(255,255,255,0.18), transparent 55%),
        linear-gradient(150deg, var(--in-primary-dark) 0%, var(--in-primary) 45%, var(--in-accent) 100%);
}
.auth-aside::before,
.auth-aside::after {
    content: ''; position: absolute; border-radius: 50%; filter: blur(8px);
    background: rgba(255,255,255,0.16); z-index: 0;
}
.auth-aside::before { width: 320px; height: 320px; top: -90px; right: -70px; animation: floatY 7s ease-in-out infinite; }
.auth-aside::after  { width: 240px; height: 240px; bottom: -80px; left: -60px; background: rgba(255,255,255,0.10); animation: floatY 9s ease-in-out infinite reverse; }
@keyframes floatY { 0%,100% { transform: translateY(0); } 50% { transform: translateY(22px); } }

.auth-aside > * { position: relative; z-index: 1; }
.auth-aside .aside-brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 19px; }
.auth-aside .aside-brand .brand-mark {
    width: 42px; height: 42px; border-radius: 13px; font-size: 22px;
    background: rgba(255,255,255,0.18); display: inline-flex; align-items: center; justify-content: center;
    backdrop-filter: blur(6px);
}
.auth-aside .aside-headline { font-size: 34px; line-height: 1.18; font-weight: 700; letter-spacing: -0.5px; }
.auth-aside .aside-sub { color: rgba(255,255,255,0.82); font-size: 15.5px; max-width: 30rem; }
.auth-aside .aside-features { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.auth-aside .aside-features li { display: flex; align-items: center; gap: 12px; font-size: 14.5px; color: rgba(255,255,255,0.92); }
.auth-aside .aside-features .feat-ic {
    width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
    background: rgba(255,255,255,0.16); display: inline-flex; align-items: center; justify-content: center; font-size: 18px;
}
.auth-aside .aside-stat {
    margin-top: 18px; align-self: flex-start;
    background: rgba(255,255,255,0.14); border: 1px solid rgba(255,255,255,0.22);
    backdrop-filter: blur(10px); border-radius: 16px; padding: 14px 18px;
    display: flex; align-items: center; gap: 14px; animation: floatY 6s ease-in-out infinite;
}
.auth-aside .aside-stat .stat-big { font-size: 24px; font-weight: 700; }

/* Right: form panel */
.auth-main {
    flex: 1 1 52%;
    display: flex; align-items: center; justify-content: center;
    padding: 40px 28px;
    padding-top: calc(40px + env(safe-area-inset-top));
    padding-bottom: calc(40px + env(safe-area-inset-bottom));
    position: relative;
    background:
        radial-gradient(680px 380px at 110% -10%, rgba(139, 92, 246, 0.10), transparent 60%),
        radial-gradient(620px 360px at -10% 120%, rgba(var(--in-primary-rgb), 0.10), transparent 60%),
        var(--in-body-bg);
}
/* Boxed, shadowed card — modern look on every screen size */
.auth-card {
    width: 100%; max-width: 430px;
    position: relative;
    background: var(--in-surface);
    border-radius: 22px;
    padding: 40px 38px;
    border: 1px solid rgba(17, 23, 41, 0.06);
    box-shadow:
        0 1px 2px rgba(17, 23, 41, 0.04),
        0 24px 60px -18px rgba(17, 23, 41, 0.22);
    overflow: hidden;
    animation: authIn 0.55s cubic-bezier(0.16, 0.84, 0.44, 1) both;
}
/* Gradient accent strip across the top of the card */
.auth-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 5px;
    background: linear-gradient(120deg, var(--in-primary), var(--in-accent), var(--in-primary));
    background-size: 200% 100%;
    animation: authSheen 6s ease-in-out infinite;
}
@keyframes authSheen { 0%, 100% { background-position: 0 0; } 50% { background-position: 100% 0; } }
@keyframes authIn { from { opacity: 0; transform: translateY(18px) scale(0.985); } to { opacity: 1; transform: none; } }

.auth-brand {
    width: 60px; height: 60px; border-radius: 18px;
    background: linear-gradient(135deg, var(--in-primary), var(--in-accent));
    color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 28px;
    box-shadow: 0 12px 26px rgba(var(--in-primary-rgb), 0.32);
}
/* App logo on the white auth card */
.auth-logo {
    display: inline-block;
    height: 54px; width: auto; max-width: 80%;
    object-fit: contain;
}
/* Compact brand shown on top of the form on mobile (aside hidden) */
.auth-mobile-brand { display: none; }

/* Interactive inputs — the whole group is ONE bordered, rounded field so the
   leading icon and the input merge seamlessly (no nested double-box). */
.auth-card .input-group {
    border: 1px solid var(--in-border);
    border-radius: var(--in-radius-sm);
    overflow: hidden;
    transition: box-shadow 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.auth-card .input-group > .form-control,
.auth-card .input-group > .input-group-text {
    border: 0;
    border-radius: 0;
    box-shadow: none !important;
}
.auth-card .input-group:focus-within {
    border-color: var(--in-primary);
    box-shadow: 0 0 0 4px rgba(var(--in-primary-rgb), 0.14);
    transform: translateY(-1px);
}
.auth-card .input-group:focus-within .input-group-text:first-child { color: var(--in-primary); }
/* Taller, rounder fields for a modern feel */
.auth-card .form-control,
.auth-card .input-group-text { height: 44px; font-size: 15px; }
.auth-card .input-group-text { background: transparent !important; color: var(--in-muted); }
.auth-card .form-label { font-size: 13.5px; margin-bottom: 6px; }
.password-toggle { cursor: pointer; color: var(--in-muted); transition: color 0.15s; }
.password-toggle:hover { color: var(--in-primary); }
/* Logo sits in a soft tinted chip */
.auth-card .auth-logo {
    padding: 4px 6px;
}

/* Animated gradient submit button */
.btn-auth {
    background: linear-gradient(120deg, var(--in-primary), var(--in-accent), var(--in-primary));
    background-size: 200% 100%;
    color: #fff; border: 0;
    transition: background-position 0.5s ease, transform 0.12s ease, box-shadow 0.2s ease;
    box-shadow: 0 10px 24px rgba(var(--in-primary-rgb), 0.32);
}
.btn-auth:hover { background-position: 100% 0; color: #fff; box-shadow: 0 12px 30px rgba(var(--in-primary-rgb), 0.42); }
.btn-auth:active { transform: translateY(1px); }

/* Caps lock hint + password strength */
.caps-hint { display: none; color: #b45309; font-size: 12.5px; margin-top: 6px; }
.caps-hint.show { display: flex; align-items: center; gap: 6px; }
.pw-strength { height: 6px; border-radius: 999px; background: #eceef3; overflow: hidden; margin-top: 8px; display: none; }
.pw-strength.show { display: block; }
.pw-strength > span { display: block; height: 100%; width: 0; border-radius: 999px; transition: width 0.25s ease, background 0.25s ease; }
.pw-meter-label { font-size: 12px; color: var(--in-muted); margin-top: 4px; min-height: 1em; }

.otp-inputs input {
    width: 100%; max-width: 54px; height: 60px; text-align: center;
    font-size: 24px; font-weight: 700; border-radius: 14px;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}
.otp-inputs input:focus { transform: translateY(-2px); }

/* Responsive: collapse the aside on tablets/phones */
@media (max-width: 991.98px) {
    .auth-aside { display: none; }
    .auth-main {
        background:
            radial-gradient(900px 460px at 100% -10%, rgba(139, 92, 246, 0.16), transparent 55%),
            radial-gradient(760px 420px at -10% 110%, rgba(var(--in-primary-rgb), 0.14), transparent 55%),
            var(--in-body-bg);
    }
    .auth-card { padding: 30px 24px; }
    .auth-mobile-brand { display: block; }
}
@media (max-width: 575.98px) {
    .auth-main { padding: 20px 14px; }
    .auth-card { padding: 26px 20px; border-radius: 18px; }
}

/* =========================================================================
   App shell
   ========================================================================= */
.app-shell { display: flex; min-height: 100vh; min-height: 100dvh; }

/* Sidebar (desktop) */
.app-sidebar {
    width: 264px; flex-shrink: 0;
    background: var(--in-sidebar-bg); color: #aab2c5;
    position: fixed; inset: 0 auto 0 0; z-index: 1045;
    display: flex; flex-direction: column;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.app-sidebar .sidebar-brand {
    padding: 20px 22px; color: #fff; font-size: 17px; font-weight: 700;
    display: flex; justify-content: center; align-items: center; gap: 11px; text-align: center;
}
.app-sidebar .sidebar-brand .brand-mark {
    width: 36px; height: 36px; border-radius: 11px;
    background: linear-gradient(135deg, var(--in-primary), var(--in-accent));
    display: inline-flex; align-items: center; justify-content: center; font-size: 19px;
}
/* App logo on the dark sidebar — shown on a light chip so any logo stays visible */
.app-sidebar .sidebar-logo-wrap {
    background: #fff;
    border-radius: 10px;
    padding: 6px 12px;
    display: inline-flex;
    align-items: center;
    max-width: 100%;
}
.app-sidebar .sidebar-logo {
    height: 30px;
    width: auto;
    max-width: 170px;
    display: block;
    object-fit: contain;
}
/* Logo links to the dashboard without altering the centred brand layout */
.app-sidebar .sidebar-brand-link {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    text-decoration: none;
    transition: opacity .15s ease;
}
.app-sidebar .sidebar-brand-link:hover { opacity: .85; }
.app-sidebar .sidebar-close {
    width: 36px; height: 36px; flex-shrink: 0;
    border: 0; border-radius: 10px; font-size: 17px;
    background: rgba(255, 255, 255, 0.08); color: #cbd5e1;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.app-sidebar .sidebar-close:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }
.sidebar-section-label {
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.09em;
    color: #5b6478; font-weight: 600; padding: 18px 24px 8px;
}
.app-sidebar .nav-link {
    color: #aab2c5; margin: 2px 12px; padding: 11px 14px; border-radius: 12px;
    display: flex; align-items: center; gap: 12px; font-size: 14.5px; font-weight: 500;
    transition: background 0.15s, color 0.15s;
}
.app-sidebar .nav-link:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.app-sidebar .nav-link.active {
    background: linear-gradient(135deg, var(--in-primary), var(--in-accent));
    color: #fff; box-shadow: 0 8px 20px rgba(var(--in-primary-rgb), 0.35);
}
.app-sidebar .nav-link i { font-size: 19px; flex-shrink: 0; }
.app-sidebar .nav-link span,
.app-sidebar .nav-link { min-width: 0; }

/* Scrollable nav area — vertical only (never wrap into a 2nd column / horizontal scroll) */
.sidebar-nav {
    flex-wrap: nowrap;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
/* Slim, theme-tinted scrollbar */
.sidebar-nav { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.18) transparent; }
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.16); border-radius: 999px; }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.3); }

/* Accordion sub-nav (e.g. Reports) */
.app-sidebar .nav-group-toggle { cursor: pointer; }
.app-sidebar .nav-group-toggle .nav-caret { transition: transform 0.2s ease; font-size: 13px; }
.app-sidebar .nav-group-toggle[aria-expanded="true"] .nav-caret { transform: rotate(180deg); }
.app-sidebar .sidebar-subnav { margin: 2px 12px 6px 30px; border-left: 1px solid rgba(255, 255, 255, 0.12); padding-left: 6px; }
.app-sidebar .sidebar-subnav .sub-link {
    color: #9aa3b7; margin: 1px 0; padding: 7px 12px; border-radius: 9px;
    font-size: 13.5px; font-weight: 500; display: flex; align-items: center; gap: 6px;
}
.app-sidebar .sidebar-subnav .sub-link i { font-size: 18px; opacity: 0.7; flex-shrink: 0; }
.app-sidebar .sidebar-subnav .sub-link:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.app-sidebar .sidebar-subnav .sub-link.active {
    background: rgba(var(--in-primary-rgb), 0.22); color: #fff;
}

/* Content column */
.app-content { flex: 1; margin-left: 264px; min-width: 0; display: flex; flex-direction: column; }

.app-topbar {
    height: var(--in-topbar-h);
    background: rgba(255, 255, 255, 0.85); backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--in-border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 22px; position: sticky; top: 0; z-index: 1030;
}
.app-topbar .topbar-title { font-size: 17px; font-weight: 700; margin: 0; }
.app-main { padding: 26px 22px; flex: 1; }

.icon-btn {
    width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--in-border);
    background: #fff; color: var(--in-ink); display: inline-flex; align-items: center; justify-content: center;
    font-size: 19px;
}
.icon-btn:hover { background: var(--in-body-bg); }

.avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: linear-gradient(135deg, var(--in-primary), var(--in-accent));
    color: #fff; display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px; flex-shrink: 0;
}

/* Stat cards */
.stat-card .stat-icon {
    width: 52px; height: 52px; border-radius: 14px;
    display: inline-flex; align-items: center; justify-content: center; font-size: 24px;
}

/* Sidebar backdrop (mobile drawer — not used by default since we use bottom nav) */
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(15, 18, 34, 0.5); z-index: 1040; }

/* Mobile bottom tab nav (hidden on desktop) */
.app-bottom-nav { display: none; }

/* =========================================================================
   Mobile — native-app feel
   ========================================================================= */
@media (max-width: 991.98px) {
    .app-sidebar .sidebar-brand{
        display: flex;
    }
    .app-sidebar { transform: translateX(-100%); box-shadow: var(--in-shadow-lg); padding-top: env(safe-area-inset-top); }
    .app-sidebar.is-open { transform: translateX(0); }
    .sidebar-backdrop.is-open { display: block; }
    .app-content { margin-left: 0; }

    /* Sticky app bar with safe-area inset */
    .app-topbar {
        height: auto; min-height: var(--in-topbar-h);
        padding-top: env(safe-area-inset-top);
        padding-left: 16px; padding-right: 16px;
    }
    .app-topbar .topbar-title { font-size: 16px; }

    .app-main {
        padding: 18px 16px;
        /* leave room for the bottom tab bar */
        padding-bottom: calc(var(--in-bottomnav-h) + env(safe-area-inset-bottom) + 18px);
    }

    /* Bottom tab bar like a native app */
    .app-bottom-nav {
        display: flex;
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 1035;
        background: rgba(255, 255, 255, 0.9);
        backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
        border-top: 1px solid var(--in-border);
        padding-bottom: env(safe-area-inset-bottom);
        box-shadow: 0 -8px 24px rgba(17, 23, 41, 0.06);
    }
    .app-bottom-nav .tab {
        flex: 1 1 0; min-width: 0;
        display: flex; flex-direction: column; align-items: center; justify-content: center;
        gap: 3px; padding: 9px 2px; height: var(--in-bottomnav-h);
        color: var(--in-muted); font-size: 10.5px; font-weight: 600; text-decoration: none;
        position: relative;
    }
    .app-bottom-nav .tab span {
        max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    .app-bottom-nav .tab i { font-size: 21px; }
    .app-bottom-nav .tab.active { color: var(--in-primary); }
    .app-bottom-nav .tab.active::before {
        content: ''; position: absolute; top: 0; width: 26px; height: 3px; border-radius: 0 0 4px 4px;
        background: var(--in-primary);
    }
    .app-bottom-nav .tab .tab-fab {
        width: 46px; height: 46px; margin-top: -22px; border-radius: 16px;
        background: linear-gradient(135deg, var(--in-primary), var(--in-accent)); color: #fff;
        display: inline-flex; align-items: center; justify-content: center; font-size: 23px;
        box-shadow: 0 10px 22px rgba(var(--in-primary-rgb), 0.4);
    }

    /* Cards get a touch larger radius on mobile for the app look */
    .card { border-radius: var(--in-radius); }
    .auth-card { max-width: 100%; box-shadow: var(--in-shadow); }
}

@media (max-width: 575.98px) {
    .auth-wrapper { padding-left: 14px; padding-right: 14px; }
    .app-main { padding-left: 14px; padding-right: 14px; }
}

/* =========================================================================
   Plugin parity (Bootstrap 5 sizing)
   ========================================================================= */
.select2-container--bootstrap-5 .select2-selection { min-height: calc(2.55rem + 2px); border-radius: var(--in-radius-sm); border-color: var(--in-border); }
.daterangepicker td.active, .daterangepicker td.active:hover { background-color: var(--in-primary); }
.daterangepicker .ranges li.active { background-color: var(--in-primary); }
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_current,
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box > div > div.xdsoft_current { background: var(--in-primary) !important; box-shadow: none !important; }

/* =========================================================================
   Responsive data tables — on small screens each row becomes a card so the
   full row (incl. action buttons) is visible without horizontal scrolling.
   Same markup as desktop; only `data-label` + helper classes drive this.
   ========================================================================= */
@media (max-width: 767.98px) {
    /* Never scroll horizontally on phones */
    .table-responsive { overflow-x: visible; }

    .table-stack { display: block; width: 100%; }
    .table-stack thead { display: none; }
    .table-stack tbody,
    .table-stack tr,
    .table-stack td { display: block; width: 100%; }

    .table-stack tbody { display: flex; flex-direction: column; gap: 12px; }

    .table-stack tr {
        background: #fff;
        border: 1px solid var(--in-border);
        border-radius: 14px;
        box-shadow: var(--in-shadow-sm);
        padding: 4px 14px;
    }

    /* Force-show columns that are hidden on desktop (phone / joined / role …) */
    .table-stack td {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        gap: 14px;
        text-align: right;
        padding: 11px 0;
        border: 0;
        border-bottom: 1px solid var(--in-border);
        white-space: normal;
    }
    .table-stack tr td:last-child { border-bottom: 0; }

    .table-stack td::before {
        content: attr(data-label);
        font-size: 11.5px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--in-muted);
        text-align: left;
        white-space: nowrap;
        flex-shrink: 0;
    }
    .table-stack td:not([data-label])::before { content: ''; }

    /* The name/avatar cell is the card header: full width, left aligned, no label */
    .table-stack td.cell-primary {
        justify-content: flex-start;
        text-align: left;
        padding-top: 14px;
    }
    .table-stack td.cell-primary::before { display: none; }
    .table-stack td.cell-primary .min-w-0 { flex: 1; }

    /* Actions cell: keep the buttons grouped on the right */
    .table-stack td.cell-actions { justify-content: space-between; }
    .table-stack td.cell-actions .d-inline-flex { flex-wrap: wrap; justify-content: flex-end; }

    /* Empty-state row spans normally */
    .table-stack td[colspan] { text-align: center; }
    .table-stack td[colspan]::before { display: none; }

    /* Pagination stays centered under the cards */
    .table-stack + .mt-3 .pagination { justify-content: center; }
}

/* Vote countdown / live timer (member poll page) */
.vote-countdown {
    border: 1px solid var(--in-border);
    border-radius: 16px;
    padding: 0.9rem 1rem;
    background: linear-gradient(135deg, rgba(var(--in-primary-rgb), 0.06), rgba(14, 165, 233, 0.06));
}
.vote-countdown .vc-head {
    display: flex; align-items: center; gap: 0.4rem;
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em;
    text-transform: uppercase; color: #8a90a2; margin-bottom: 0.6rem;
}
.vote-countdown.is-live .vc-head { color: #16a34a; }
.vote-countdown .vc-dot {
    width: 9px; height: 9px; border-radius: 50%; background: #16a34a; display: inline-block;
    box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.6); animation: vcPulse 1.4s infinite;
}
@keyframes vcPulse {
    70% { box-shadow: 0 0 0 8px rgba(22, 163, 74, 0); }
    100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}
.vote-countdown .vc-units { display: flex; align-items: center; gap: 0.4rem; }
.vote-countdown .vc-unit { display: flex; flex-direction: column; align-items: center; flex: 1; }
.vote-countdown .vc-num {
    width: 100%; text-align: center;
    font-size: 1.6rem; font-weight: 800; line-height: 1.1;
    font-variant-numeric: tabular-nums; font-feature-settings: "tnum";
    color: #fff; padding: 0.5rem 0.25rem; border-radius: 12px;
    background: linear-gradient(135deg, var(--in-primary), var(--in-accent));
    box-shadow: 0 4px 12px rgba(var(--in-primary-rgb), 0.25);
}
.vote-countdown .vc-label {
    font-size: 0.62rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.04em; color: #8a90a2; margin-top: 0.35rem;
}
.vote-countdown .vc-sep {
    font-size: 1.4rem; font-weight: 800; color: rgba(var(--in-primary-rgb), 0.4);
    align-self: flex-start; margin-top: 0.45rem;
}
.vote-countdown .vc-foot { margin-top: 0.6rem; font-size: 0.78rem; color: #8a90a2; }

/* Breadcrumb bar (admin & member panels) */
.app-breadcrumb { margin-bottom: 1rem; }
.app-breadcrumb .breadcrumb { font-size: 0.85rem; margin-bottom: 0; }
.app-breadcrumb .breadcrumb-item a { color: var(--in-primary); text-decoration: none; }
.app-breadcrumb .breadcrumb-item a:hover { text-decoration: underline; }
.app-breadcrumb .breadcrumb-item.active { color: #8a90a2; font-weight: 500; }

/* =========================================================================
   iOS / touch refinements
   ========================================================================= */
/* Keep text from inflating on orientation change (iOS Safari) */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* Momentum scrolling for inner scroll areas on iOS */
.table-responsive,
.modal-body,
.dropdown-menu { -webkit-overflow-scrolling: touch; }

/* Remove the grey tap flash on interactive elements */
a, button, .btn, .nav-link, .tab, [role="button"] { -webkit-tap-highlight-color: rgba(0, 0, 0, 0); }

/* iOS auto-zooms any focused field whose font-size is < 16px. Force 16px on
   phones so focusing an input never zooms/!shifts the layout. */
@media (max-width: 575.98px) {
    .form-control,
    .form-select,
    textarea.form-control,
    .select2-container--bootstrap-5 .select2-search__field,
    .input-group > .form-control { font-size: 16px; }

    /* Modal goes near-fullscreen-friendly on tiny screens */
    .modal-dialog { margin: 0.5rem; }
}

/* Very small phones: keep the countdown digits from overflowing */
@media (max-width: 380px) {
    .vote-countdown .vc-num { font-size: 1.25rem; padding: 0.4rem 0.15rem; }
    .vote-countdown .vc-sep { font-size: 1.1rem; }
    .vote-countdown .vc-label { font-size: 0.55rem; }
}
