/*
 * PTCLab Maglo User Workspace 7.7.0 — Phase 6 Final Polish & Production Hardening
 * Additive compatibility layer for the already-installed v7.6 user workspace.
 * No business rules, wallet logic, KYC logic, or database behavior is changed.
 */
:root {
    --ptclab-p6-focus: #c8ee44;
    --ptclab-p6-tap: 44px;
    --ptclab-p6-safe-top: env(safe-area-inset-top, 0px);
    --ptclab-p6-safe-right: env(safe-area-inset-right, 0px);
    --ptclab-p6-safe-bottom: env(safe-area-inset-bottom, 0px);
    --ptclab-p6-safe-left: env(safe-area-inset-left, 0px);
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body.ptclab-p6 {
    overflow-x: hidden;
    min-width: 0;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body.ptclab-p6,
body.ptclab-p6 * {
    box-sizing: border-box;
}

body.ptclab-p6 img,
body.ptclab-p6 svg,
body.ptclab-p6 video,
body.ptclab-p6 canvas {
    max-width: 100%;
}

body.ptclab-p6 img {
    height: auto;
}

body.ptclab-p6 button,
body.ptclab-p6 input,
body.ptclab-p6 select,
body.ptclab-p6 textarea {
    font: inherit;
}

body.ptclab-p6 button,
body.ptclab-p6 [role="button"],
body.ptclab-p6 a,
body.ptclab-p6 input,
body.ptclab-p6 select,
body.ptclab-p6 textarea {
    -webkit-tap-highlight-color: transparent;
}

body.ptclab-p6 a,
body.ptclab-p6 button,
body.ptclab-p6 [role="button"],
body.ptclab-p6 input,
body.ptclab-p6 select,
body.ptclab-p6 textarea,
body.ptclab-p6 [tabindex] {
    scroll-margin-block: 88px;
}

body.ptclab-p6 :focus {
    outline: 2px solid var(--ptclab-p6-focus);
    outline-offset: 2px;
}

@supports selector(:focus-visible) {
    body.ptclab-p6 :focus:not(:focus-visible) {
        outline: none;
    }

    body.ptclab-p6 :focus-visible {
        outline: 3px solid var(--ptclab-p6-focus);
        outline-offset: 3px;
    }
}

.ptclab-p6-skip {
    position: fixed;
    top: calc(8px + var(--ptclab-p6-safe-top));
    left: calc(8px + var(--ptclab-p6-safe-left));
    z-index: 2147483646;
    transform: translateY(-160%);
    padding: 10px 14px;
    border-radius: 10px;
    background: #111827;
    color: #ffffff !important;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 8px 30px rgba(0, 0, 0, .28);
}

.ptclab-p6-skip:focus {
    transform: translateY(0);
}

body.ptclab-p6 .ptclab-p6-main,
body.ptclab-p6 .page-wrapper,
body.ptclab-p6 .dashboard-content,
body.ptclab-p6 .dashboard-body,
body.ptclab-p6 main,
body.ptclab-p6 .container,
body.ptclab-p6 .container-fluid,
body.ptclab-p6 .row,
body.ptclab-p6 [class*="col-"] {
    min-width: 0;
}

body.ptclab-p6 .card,
body.ptclab-p6 .dashboard-card,
body.ptclab-p6 .widget,
body.ptclab-p6 .box,
body.ptclab-p6 .panel {
    max-width: 100%;
}

body.ptclab-p6 .ptclab-p6-table-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-inline: contain;
    scrollbar-gutter: stable;
}

body.ptclab-p6 .ptclab-p6-table-scroll > table {
    width: 100%;
    min-width: max-content;
    margin-bottom: 0;
}

body.ptclab-p6 .table-responsive {
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-inline: contain;
}

body.ptclab-p6 .ptclab-p6-scroll-region {
    scrollbar-width: thin;
}

body.ptclab-p6 .ptclab-p6-scroll-region::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

body.ptclab-p6 .ptclab-p6-scroll-region::-webkit-scrollbar-thumb {
    background: rgba(127, 127, 127, .45);
    border-radius: 999px;
}

body.ptclab-p6 .ptclab-p6-icon-control {
    min-width: var(--ptclab-p6-tap);
    min-height: var(--ptclab-p6-tap);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

body.ptclab-p6 .ptclab-p6-touch-control {
    min-height: var(--ptclab-p6-tap);
}

body.ptclab-p6 .form-control,
body.ptclab-p6 .form-select,
body.ptclab-p6 select,
body.ptclab-p6 textarea,
body.ptclab-p6 input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]) {
    max-width: 100%;
}

body.ptclab-p6 .invalid-feedback[role="alert"],
body.ptclab-p6 .form-error[role="alert"],
body.ptclab-p6 .error[role="alert"] {
    scroll-margin-top: 96px;
}

body.ptclab-p6 .modal,
body.ptclab-p6 .offcanvas,
body.ptclab-p6 [role="dialog"] {
    max-width: 100vw;
}

body.ptclab-p6 .modal-dialog {
    margin-left: max(.5rem, var(--ptclab-p6-safe-left));
    margin-right: max(.5rem, var(--ptclab-p6-safe-right));
}

body.ptclab-p6 .dropdown-menu {
    max-width: calc(100vw - 24px - var(--ptclab-p6-safe-left) - var(--ptclab-p6-safe-right));
    overflow-wrap: anywhere;
}

body.ptclab-p6 .ptclab-p6-reveal {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .24s ease, transform .24s ease;
}

body.ptclab-p6 .ptclab-p6-reveal.ptclab-p6-inview {
    opacity: 1;
    transform: none;
}

body.ptclab-p6 .ptclab-p6-sidebar-toggle {
    position: fixed;
    top: calc(12px + var(--ptclab-p6-safe-top));
    left: calc(12px + var(--ptclab-p6-safe-left));
    z-index: 2147483000;
    width: 44px;
    height: 44px;
    border: 1px solid rgba(127, 127, 127, .24);
    border-radius: 12px;
    background: rgba(17, 24, 39, .94);
    color: #fff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .22);
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex-direction: column;
    display: none;
}

body.ptclab-p6 .ptclab-p6-sidebar-toggle > span {
    display: block;
    width: 19px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

body.ptclab-p6 .ptclab-p6-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2147482000;
    display: none;
    background: rgba(0, 0, 0, .48);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

body.ptclab-p6.ptclab-p6-sidebar-open {
    overflow: hidden;
    touch-action: none;
}

body.ptclab-p6.ptclab-p6-sidebar-open .ptclab-p6-backdrop {
    display: block;
}

/* Tablet: preserve desktop density while preventing clipped cards/tables. */
@media (max-width: 1199.98px) {
    body.ptclab-p6 .container,
    body.ptclab-p6 .container-lg,
    body.ptclab-p6 .container-md,
    body.ptclab-p6 .container-sm,
    body.ptclab-p6 .container-xl,
    body.ptclab-p6 .container-xxl {
        max-width: 100%;
    }

    body.ptclab-p6 .card-body,
    body.ptclab-p6 .dashboard-card,
    body.ptclab-p6 .widget {
        min-width: 0;
    }
}

/* Tablet/mobile navigation fallback. The JS only enables this on a sidebar that lacks its own mobile toggle. */
@media (max-width: 991.98px) {
    body.ptclab-p6.ptclab-p6-own-sidebar .ptclab-p6-sidebar-toggle {
        display: flex;
    }

    body.ptclab-p6.ptclab-p6-own-sidebar .ptclab-p6-sidebar {
        position: fixed !important;
        top: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        z-index: 2147482500 !important;
        width: min(86vw, 320px) !important;
        max-width: 320px !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        overflow-y: auto !important;
        overscroll-behavior: contain;
        padding-top: max(16px, var(--ptclab-p6-safe-top));
        padding-bottom: max(16px, var(--ptclab-p6-safe-bottom));
        transform: translate3d(-108%, 0, 0) !important;
        transition: transform .22s ease !important;
        box-shadow: 22px 0 55px rgba(0, 0, 0, .32);
        visibility: visible !important;
    }

    body.ptclab-p6.ptclab-p6-own-sidebar.ptclab-p6-sidebar-open .ptclab-p6-sidebar {
        transform: translate3d(0, 0, 0) !important;
    }

    body.ptclab-p6 .ptclab-p6-main,
    body.ptclab-p6 .dashboard-content,
    body.ptclab-p6 .dashboard-body,
    body.ptclab-p6 main,
    body.ptclab-p6 .page-wrapper {
        max-width: 100vw;
    }

    body.ptclab-p6 table {
        font-size: .95em;
    }
}

@media (max-width: 767.98px) {
    body.ptclab-p6 .card-body,
    body.ptclab-p6 .modal-body,
    body.ptclab-p6 .modal-header,
    body.ptclab-p6 .modal-footer {
        padding-left: clamp(12px, 4vw, 20px);
        padding-right: clamp(12px, 4vw, 20px);
    }

    body.ptclab-p6 .btn,
    body.ptclab-p6 button:not(.ptclab-p6-sidebar-toggle),
    body.ptclab-p6 input[type="button"],
    body.ptclab-p6 input[type="submit"],
    body.ptclab-p6 [role="button"] {
        min-height: var(--ptclab-p6-tap);
    }

    body.ptclab-p6 .pagination {
        flex-wrap: wrap;
        row-gap: 6px;
    }

    body.ptclab-p6 .d-flex.ptclab-p6-wrap-mobile,
    body.ptclab-p6 .ptclab-p6-toolbar {
        flex-wrap: wrap !important;
        gap: 8px;
    }
}

@media (max-width: 575.98px) {
    body.ptclab-p6 {
        padding-bottom: var(--ptclab-p6-safe-bottom);
    }

    /* Prevent Safari/iOS input-focus zoom without changing desktop typography. */
    body.ptclab-p6 input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
    body.ptclab-p6 select,
    body.ptclab-p6 textarea {
        font-size: max(16px, 1em);
    }

    body.ptclab-p6 .modal-dialog {
        width: auto;
        max-width: none;
    }

    body.ptclab-p6 .dropdown-menu {
        max-width: calc(100vw - 16px);
    }

    body.ptclab-p6 .ptclab-p6-table-scroll {
        margin-inline: 0;
    }
}

/* Mouse/trackpad only: micro-interactions are disabled on touch-only devices. */
@media (hover: hover) and (pointer: fine) {
    body.ptclab-p6 .card,
    body.ptclab-p6 .dashboard-card,
    body.ptclab-p6 .widget,
    body.ptclab-p6 .btn,
    body.ptclab-p6 button,
    body.ptclab-p6 a {
        transition-property: transform, box-shadow, border-color, background-color, color, opacity;
        transition-duration: .16s;
        transition-timing-function: ease;
    }

    body.ptclab-p6 .btn:not(:disabled):hover,
    body.ptclab-p6 button:not(:disabled):hover {
        transform: translateY(-1px);
    }
}

/* WCAG motion preference: animation becomes effectively instant and scrolling stops animating. */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto !important;
    }

    body.ptclab-p6 *,
    body.ptclab-p6 *::before,
    body.ptclab-p6 *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: .001ms !important;
        transition-delay: 0ms !important;
    }

    body.ptclab-p6 .ptclab-p6-reveal {
        opacity: 1 !important;
        transform: none !important;
    }
}

body.ptclab-p6.ptclab-p6-reduced-motion .ptclab-p6-reveal {
    opacity: 1;
    transform: none;
}

/* Modern engines get containment; older Safari/Firefox/Chromium simply ignore it. */
@supports (content-visibility: auto) {
    body.ptclab-p6 .ptclab-p6-defer-render {
        content-visibility: auto;
        contain-intrinsic-size: auto 420px;
    }
}

@supports (overflow: clip) {
    body.ptclab-p6 .ptclab-p6-clip-safe {
        overflow: clip;
    }
}

@media print {
    body.ptclab-p6 .ptclab-p6-sidebar-toggle,
    body.ptclab-p6 .ptclab-p6-backdrop,
    body.ptclab-p6 .ptclab-p6-skip {
        display: none !important;
    }

    body.ptclab-p6,
    body.ptclab-p6 .ptclab-p6-main,
    body.ptclab-p6 main {
        overflow: visible !important;
    }
}
