/* =========================================================
   ARMS Mobile UI 2.0 - application shell
   Loaded after component-isolated styles.
   ========================================================= */

.arms-mobile-menu-button,
.arms-mobile-overlay,
.arms-mobile-sidebar-close,
.arms-mobile-sidebar-tools {
    display: none;
}

@media (max-width: 991.98px) {
    html,
    body {
        width: 100%;
        max-width: 100%;
        min-height: 100%;
        overflow-x: hidden;
        overscroll-behavior-y: none;
    }

    html {
        height: auto;
        background: #f3f6fa;
    }

    body {
        height: auto;
        background: #f3f6fa;
    }

    .arms-app {
        display: block !important;
        width: 100%;
        min-height: 100vh;
        min-height: 100svh;
    }

    .arms-main {
        width: 100% !important;
        min-width: 0;
        min-height: 0 !important;
        margin-left: 0 !important;
    }

    .arms-sidebar {
        position: fixed !important;
        inset: 0 auto 0 0;
        z-index: 2050;
        display: flex !important;
        width: min(88vw, 340px) !important;
        min-width: 0 !important;
        height: 100dvh !important;
        min-height: 0 !important;
        overflow: hidden !important;
        background:
            radial-gradient(circle at 0 0, rgba(37, 99, 235, .22), transparent 34%),
            #0f172a;
        box-shadow: 18px 0 50px rgba(2, 8, 23, .34);
        transform: translateX(-104%);
        transition: transform .22s ease;
        will-change: transform;
    }

    .arms-mobile-nav-open .arms-sidebar {
        transform: translateX(0);
    }

    .arms-mobile-overlay {
        position: fixed;
        inset: 0;
        z-index: 2040;
        width: 100%;
        height: 100%;
        padding: 0;
        border: 0;
        background: rgba(2, 8, 23, .62);
        backdrop-filter: blur(2px);
    }

    .arms-mobile-nav-open .arms-mobile-overlay {
        display: block;
    }

    .arms-mobile-nav-open {
        overflow: hidden;
    }

    .arms-mobile-sidebar-close {
        position: absolute;
        top: max(10px, env(safe-area-inset-top));
        right: 10px;
        z-index: 4;
        display: grid;
        width: 42px;
        height: 42px;
        place-items: center;
        padding: 0;
        border: 1px solid rgba(148, 163, 184, .26);
        border-radius: 12px;
        background: rgba(30, 41, 59, .9);
        color: #f8fafc;
        font-size: 1.65rem;
        line-height: 1;
    }

    .arms-sidebar-header {
        flex: 0 0 auto;
        padding:
            max(18px, calc(12px + env(safe-area-inset-top)))
            64px
            16px
            18px !important;
    }

    .arms-sidebar-logo {
        max-width: 205px !important;
    }

    .arms-navigation {
        display: block !important;
        min-height: 0;
        flex: 1 1 auto;
        padding: 14px 12px !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        overscroll-behavior: contain;
    }

    .arms-nav-section {
        margin-bottom: 18px !important;
    }

    .arms-nav-link,
    .arms-nav-dropdown-button {
        min-height: 48px;
        margin-bottom: 5px;
        padding: 11px 13px;
        border-radius: 11px;
        font-size: .94rem;
    }

    .arms-nav-submenu {
        margin: 4px 0 8px;
        padding-left: 10px;
        border-left: 1px solid rgba(148, 163, 184, .18);
    }

    .arms-nav-submenu-link {
        padding-left: 14px;
    }

    .arms-mobile-sidebar-tools {
        display: grid;
        flex: 0 0 auto;
        gap: 12px;
        padding:
            14px
            14px
            max(16px, calc(10px + env(safe-area-inset-bottom)));
        border-top: 1px solid rgba(148, 163, 184, .16);
        background: rgba(2, 8, 23, .4);
    }

    .arms-mobile-sidebar-search {
        min-width: 0;
    }

    .arms-mobile-sidebar-search .arms-global-search {
        display: block !important;
        width: 100% !important;
    }

    .arms-mobile-sidebar-search .arms-global-search-input {
        min-height: 46px;
        border-color: rgba(148, 163, 184, .28);
        background: rgba(248, 250, 252, .98);
        font-size: 16px;
    }

    .arms-mobile-sidebar-search .arms-global-search-panel {
        position: fixed;
        top: auto;
        right: 12px;
        bottom: max(12px, env(safe-area-inset-bottom));
        left: 12px;
        max-height: min(70dvh, 520px);
    }

    .arms-mobile-account-summary {
        display: flex;
        min-width: 0;
        align-items: center;
        gap: 10px;
        color: #e2e8f0;
    }

    .arms-mobile-account-summary .arms-user-avatar {
        width: 40px !important;
        height: 40px !important;
        flex: 0 0 40px;
    }

    .arms-mobile-account-summary > div:last-child {
        display: flex;
        min-width: 0;
        flex-direction: column;
    }

    .arms-mobile-account-summary strong,
    .arms-mobile-account-summary span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .arms-mobile-account-summary strong {
        color: #f8fafc;
        font-size: .88rem;
    }

    .arms-mobile-account-summary span {
        margin-top: 2px;
        color: #94a3b8;
        font-size: .74rem;
    }

    .arms-mobile-account-actions {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        gap: 10px;
    }

    .arms-mobile-account-actions .arms-language-switcher {
        display: inline-flex !important;
        border-color: rgba(148, 163, 184, .24);
        background: rgba(30, 41, 59, .78);
    }

    .arms-mobile-account-actions .arms-language-button {
        color: #cbd5e1;
    }

    .arms-mobile-account-actions .arms-language-button.active {
        color: #fff;
    }

    .arms-mobile-account-actions .arms-logout-button {
        display: inline-flex !important;
        width: 100%;
        min-height: 40px;
        align-items: center;
        justify-content: center;
        padding: 8px 12px !important;
        border-color: rgba(248, 113, 113, .32);
        background: rgba(127, 29, 29, .2);
        color: #fecaca;
        font-size: .82rem !important;
    }

    .arms-topbar {
        position: sticky !important;
        top: 0;
        z-index: 1030;
        display: flex !important;
        width: 100%;
        min-height: 64px;
        align-items: center !important;
        gap: 10px !important;
        padding:
            max(8px, env(safe-area-inset-top))
            10px
            8px !important;
        border-bottom: 1px solid #dbe5f0;
        background: rgba(255, 255, 255, .97);
        box-shadow: 0 5px 18px rgba(15, 23, 42, .08);
        backdrop-filter: blur(10px);
    }

    .arms-mobile-menu-button {
        display: inline-flex;
        width: 44px;
        height: 44px;
        flex: 0 0 44px;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        padding: 10px;
        border: 1px solid #cbd5e1;
        border-radius: 12px;
        background: #fff;
        box-shadow: 0 4px 12px rgba(15, 23, 42, .06);
    }

    .arms-mobile-menu-button span {
        display: block;
        width: 100%;
        height: 3px;
        border-radius: 999px;
        background: #0f2942;
    }

    .arms-header-context {
        display: flex !important;
        min-width: 0;
        flex: 1 1 auto;
        gap: 8px !important;
    }

    .arms-header-context-mark {
        display: block !important;
        width: 32px !important;
        height: 32px !important;
        flex: 0 0 32px;
    }

    .arms-header-context-label {
        display: none !important;
    }

    .arms-header-context-path {
        display: block;
        max-width: none !important;
        overflow: hidden;
        font-size: .8rem !important;
        line-height: 1.2;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .arms-topbar > .arms-global-search {
        display: none !important;
    }

    .arms-header-right {
        margin-left: 0 !important;
    }

    .arms-header-controls {
        gap: 0 !important;
    }

    .arms-header-controls > .arms-language-switcher,
    .arms-header-user,
    .arms-header-controls > .arms-account-actions {
        display: none !important;
    }

    .arms-notify-bell {
        width: 44px !important;
        height: 44px !important;
        border-color: #cbd5e1 !important;
        background: #0f172a !important;
    }

    .arms-notify-panel {
        top: calc(66px + env(safe-area-inset-top)) !important;
        right: 10px !important;
        bottom: max(10px, env(safe-area-inset-bottom));
        left: 10px;
        width: auto !important;
        max-height: none !important;
        border-radius: 16px !important;
    }

    .arms-notify-toast {
        top: calc(70px + env(safe-area-inset-top)) !important;
        right: 10px !important;
        left: 10px;
        width: auto !important;
    }

    .arms-content {
        width: 100%;
        min-width: 0;
        min-height: 0 !important;
        padding: 14px !important;
        overflow-x: clip;
        overscroll-behavior-y: none;
    }

    .arms-content > * {
        min-width: 0;
    }

    .arms-page-header {
        margin-bottom: 1rem !important;
        padding: 1rem !important;
        border-radius: 14px !important;
    }

    .arms-page-header-title-row {
        gap: .65rem !important;
    }

    .arms-page-header-copy h1 {
        overflow-wrap: anywhere;
        font-size: clamp(1.25rem, 6vw, 1.65rem) !important;
    }

    .arms-page-header-copy p {
        margin-top: .3rem !important;
        font-size: .84rem !important;
        line-height: 1.4 !important;
    }

    .arms-page-header-actions,
    .arms-ui-toolbar,
    .arms-ui-toolbar-primary,
    .arms-ui-toolbar-actions {
        width: 100%;
    }

    .arms-ui-toolbar {
        align-items: stretch !important;
        flex-direction: column !important;
        padding: .75rem !important;
    }

    .arms-ui-toolbar-primary,
    .arms-ui-toolbar-actions {
        min-width: 0;
        align-items: stretch !important;
    }

    .form-control,
    .form-select,
    textarea,
    input,
    select {
        max-width: 100%;
        font-size: 16px;
    }

    button,
    .btn,
    .arms-back-button {
        min-height: 44px;
        touch-action: manipulation;
    }

    .card,
    .arms-card,
    .arms-ui-card {
        min-width: 0;
    }

    .row > [class*="col-"] {
        min-width: 0;
    }

    .d-flex.flex-wrap.gap-2 {
        display: grid !important;
        grid-template-columns: 1fr;
    }

    .d-flex.flex-wrap.gap-2 > .btn {
        width: 100%;
    }

    .table-responsive {
        width: 100%;
        overflow-x: auto;
        border-radius: 12px;
        -webkit-overflow-scrolling: touch;
    }

    .table-responsive table {
        min-width: 720px;
    }

    .ticket-timeline-card {
        margin-top: 14px;
        max-height: none !important;
    }

    .timeline-scroll {
        max-height: 420px;
    }
}

@media (max-width: 575.98px) {
    .arms-content {
        padding: 10px !important;
    }

    .arms-header-context-mark {
        width: 29px !important;
        height: 29px !important;
        flex-basis: 29px;
    }

    .arms-header-context-path {
        font-size: .74rem !important;
    }

    .arms-page-header-eyebrow {
        margin-bottom: .35rem !important;
        font-size: .66rem !important;
    }

    .arms-back-button {
        width: 44px;
        flex: 0 0 44px;
        justify-content: center;
        padding: 0 !important;
    }

    .arms-back-button span:last-child {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
    }
}

@media (max-width: 359.98px) {
    .arms-header-context-mark {
        display: none !important;
    }

    .arms-header-context-path {
        font-size: .7rem !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .arms-sidebar {
        transition: none;
    }
}
