/* Enhanced Responsive Design - Faza 7 */

/* Modal mobile — 95vw na wszystkich urządzeniach mobilnych */
@media (max-width: 768px) {
    .modal-dialog {
        width: 95vw;
        max-width: 95vw !important;
        margin: 0.5rem auto;
    }
    .modal-content,
    .ds-modal-content {
        max-width: 95vw;
    }
    /* Usunięcie nadpisania Bootstrap dla modal-sm na mobile */
    .modal-dialog.modal-sm {
        max-width: 95vw !important;
    }
}

/* Extra Small Devices (phones, 575px and down) */
@media (max-width: 575.98px) {
    /* Main content padding for mobile */
    main.container-fluid {
        padding-top: 60px !important;
        padding-bottom: 85px !important;
    }

    /* Modal adjustments */
    .modal-dialog {
        padding: 0.5rem;
        min-height: calc(100vh - 1rem);
    }

    .modal-content,
    .ds-modal-content {
        max-width: 95vw;
        margin: 0.5rem auto;
    }
    
    /* Typography */
    body {
        font-size: 0.875rem;
    }
    
    h1 { font-size: 1.4rem !important; }
    h2 { font-size: 1.2rem !important; }
    h3 { font-size: 1.05rem !important; }
    h4 { font-size: 0.95rem !important; }
    h5 { font-size: 0.85rem !important; }
    h6 { font-size: 0.75rem !important; }

    /* Dashboard header */
    .d-flex.justify-content-between.align-items-center {
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
    }

    .d-flex.gap-2 {
        flex-wrap: wrap !important;
        width: 100% !important;
        justify-content: flex-start !important;
    }
    
    /* Container */
    .container, .container-fluid {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    /* Stat cards */
    .stat-card {
        padding: 0.75rem !important;
    }

    .stat-icon {
        width: 35px !important;
        height: 35px !important;
        font-size: 1rem !important;
        margin-bottom: 0.4rem !important;
    }

    .stat-value {
        font-size: 1.15rem !important;
        margin-bottom: 0.15rem !important;
    }

    .stat-label {
        font-size: 0.65rem !important;
    }

    /* Dashboard cards */
    .dashboard-card .card-header {
        padding: 0.75rem 1rem !important;
    }

    .dashboard-card .card-header h5 {
        font-size: 0.9rem !important;
    }

    .dashboard-card .card-body {
        padding: 0.75rem !important;
    }

    /* Buttons */
    .btn {
        padding: 0.4rem 0.75rem !important;
        font-size: 0.8rem !important;
    }

    .btn-sm {
        padding: 0.3rem 0.6rem !important;
        font-size: 0.75rem !important;
    }

    .btn-dashboard {
        padding: 0.4rem 0.8rem !important;
        font-size: 0.8rem !important;
    }

    .ds-btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.75rem;
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .ds-btn-group {
        display: flex;
        flex-direction: column;
        width: 100%;
    }
    
    .ds-btn-group .ds-btn {
        margin-bottom: 0.25rem;
        border-radius: 0.375rem !important;
    }

    /* Goal cards */
    .goal-card {
        padding: 0.75rem !important;
        margin-bottom: 0.75rem !important;
    }

    .goal-card h6 {
        font-size: 0.85rem !important;
    }

    .goal-card .badge {
        font-size: 0.7rem !important;
        padding: 0.2rem 0.4rem !important;
    }

    .mini-progress {
        height: 6px !important;
    }

    /* Note cards */
    .note-card {
        padding: 0.75rem !important;
        margin-bottom: 0.5rem !important;
    }

    .note-card .fw-semibold {
        font-size: 0.8rem !important;
    }

    .note-card .small {
        font-size: 0.7rem !important;
    }

    /* Category items */
    .category-item {
        padding: 0.5rem !important;
        margin-bottom: 0.4rem !important;
        flex-wrap: wrap !important;
    }

    .category-item .fw-bold,
    .category-item .fw-semibold {
        font-size: 0.8rem !important;
    }

    /* Forms */
    .ds-form-control {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    .ds-form-label {
        font-size: 0.75rem;
        margin-bottom: 0.25rem;
    }

    .form-check-input {
        width: 1rem !important;
        height: 1rem !important;
    }

    .form-check-label {
        font-size: 0.8rem !important;
    }

    /* Tables */
    .ds-table {
        font-size: 0.75rem;
    }
    
    .ds-table th,
    .ds-table td {
        padding: 0.5rem;
        vertical-align: middle;
    }
    
    .table-responsive {
        border-radius: 0.375rem;
        margin-bottom: 1rem;
    }

    /* Expense items */
    .expense-item {
        padding: 0.5rem !important;
        margin-bottom: 0.4rem !important;
        flex-wrap: wrap !important;
        gap: 0.3rem !important;
    }

    .expense-item .btn-group {
        flex-wrap: wrap !important;
        gap: 0.25rem !important;
    }

    .expense-item .btn-group .btn {
        padding: 0.25rem 0.5rem !important;
        font-size: 0.7rem !important;
    }

    .payment-badge {
        font-size: 0.6rem !important;
        padding: 0.1rem 0.3rem !important;
    }

    /* Filter forms */
    .form-filter {
        padding: 0.75rem !important;
    }

    /* Modals */
    .ds-modal-content {
        margin: 0.5rem;
        border-radius: 0.5rem;
    }
    
    .ds-modal-header {
        padding: 0.75rem;
    }
    
    .ds-modal-body {
        padding: 0.75rem;
    }
    
    /* Alerts */
    .ds-alert {
        padding: 0.75rem;
        font-size: 0.875rem;
        margin-bottom: 0.75rem;
    }
    
    /* Progress bars */
    .ds-progress {
        height: 0.5rem;
        border-radius: 0.25rem;
    }
    
    /* Badges */
    .ds-badge {
        font-size: 0.625rem;
        padding: 0.25rem 0.5rem;
    }

    .badge {
        font-size: 0.7rem !important;
        padding: 0.25rem 0.5rem !important;
    }
    
    /* Dropdowns */
    .ds-dropdown-menu {
        min-width: 200px;
        font-size: 0.875rem;
    }
    
    .ds-dropdown-item {
        padding: 0.5rem 0.75rem;
    }
    
    /* Mobile bottom navigation */
    .navbar.fixed-bottom {
        background: linear-gradient(135deg, var(--ds-primary), var(--ds-secondary));
        padding: 0.5rem 0;
        height: auto;
    }
    
    .navbar.fixed-bottom .d-flex {
        gap: 0.25rem;
    }
    
    .navbar.fixed-bottom a {
        font-size: 0.625rem;
        padding: 0.25rem;
        flex: 1;
        text-align: center;
    }
    
    .navbar.fixed-bottom i {
        font-size: 1rem;
        display: block;
        margin-bottom: 0.125rem;
    }
    
    .navbar.fixed-bottom span {
        display: block;
    }

    /* Charts */
    .chart-container {
        position: relative;
        height: 200px !important;
        margin-bottom: 1rem;
    }
    
    /* Dashboard widgets */
    .dashboard-widget {
        margin-bottom: 1rem;
    }
    
    .dashboard-widget .ds-card {
        height: 100%;
    }

    /* Row columns on mobile */
    .row {
        margin-left: -0.5rem !important;
        margin-right: -0.5rem !important;
    }

    .row > [class*="col-"] {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    /* Expense form */
    .expense-form .row {
        gap: 0.5rem;
    }
    
    .expense-form .col-12,
    .expense-form .col-md-6 {
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }
    
    /* Calendar */
    .calendar-container {
        font-size: 0.75rem;
    }
    
    .calendar-day {
        min-height: 50px !important;
        padding: 0.2rem !important;
    }

    .calendar-day .dropdown-toggle {
        font-size: 0.65rem !important;
        padding: 0.1rem 0.2rem !important;
    }

    .calendar-day table td,
    .calendar-day table th {
        padding: 0.15rem !important;
        font-size: 0.7rem !important;
    }
    
    /* Notifications */
    .notification-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .notification {
        margin-bottom: 0.5rem;
        font-size: 0.875rem;
    }
    
    /* Trash items */
    .trash-item {
        padding: 0.75rem;
        margin-bottom: 0.5rem;
    }
    
    .trash-item .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    /* Goals */
    .goal-card {
        margin-bottom: 1rem;
    }
    
    .goal-progress {
        height: 0.75rem;
    }
    
    /* Analytics */
    .analytics-chart {
        height: 200px;
        margin-bottom: 1rem;
    }
    
    .analytics-stats {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
    
    /* Settings */
    .settings-section {
        margin-bottom: 1.5rem;
    }
    
    .settings-item {
        padding: 0.75rem;
        border-bottom: 1px solid var(--bs-border-color);
    }
    
    /* Loading states */
    .ds-loading {
        position: relative;
    }
    
    .ds-loading::after {
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
    }

    /* Card headers gradient fix for mobile */
    .card-header {
        padding: 0.75rem 1rem !important;
    }

    /* List group items */
    .list-group-item {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.85rem !important;
    }

    /* Input groups */
    .input-group-text {
        padding: 0.35rem 0.6rem !important;
        font-size: 0.8rem !important;
    }

    /* Summary badges */
    .summary-badge {
        font-size: 0.65rem !important;
        padding: 0.15rem 0.5rem !important;
    }

    /* Widget settings modal items */
    .widget-option {
        padding: 0.5rem !important;
        margin-bottom: 0.5rem !important;
    }

    .widget-option .form-check-input {
        margin-right: 0.5rem !important;
    }

    .widget-option label {
        font-size: 0.8rem !important;
    }

    /* Settings sidebar on mobile */
    .settings-sidebar {
        flex-direction: column !important;
        width: 100% !important;
    }

    .settings-nav-link {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.85rem !important;
    }

    /* Pagination */
    .pagination .page-link {
        padding: 0.3rem 0.6rem !important;
        font-size: 0.8rem !important;
    }
}

/* Small Devices (landscape phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767.98px) {
    /* Navigation */
    .navbar-nav {
        flex-direction: row;
    }
    
    .navbar-nav .nav-link {
        padding: 0.5rem 0.75rem !important;
    }
    
    /* Cards */
    .ds-card {
        margin-bottom: 1.25rem;
    }
    
    /* Dashboard */
    .dashboard-widgets {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }
    
    /* Forms */
    .form-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }
    
    /* Tables */
    .ds-table {
        font-size: 0.875rem;
    }
    
    /* Charts */
    .chart-container {
        height: 300px;
    }
    
    /* Mobile bottom navigation adjustments */
    .navbar.fixed-bottom .d-flex {
        max-width: 600px;
        margin: 0 auto;
    }
}

/* Medium Devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991.98px) {
    /* Navigation */
    .ds-navbar {
        padding: 0.75rem 0;
    }

    .navbar-nav {
        flex-direction: row;
    }

    /* Mobile top bar for tablets */
    .mobile-top-bar {
        height: 56px !important;
    }

    .mobile-menu-btn {
        width: 44px !important;
        height: 44px !important;
    }

    .mobile-icon {
        width: 40px !important;
        height: 40px !important;
    }

    .mobile-icon-btn {
        width: 40px !important;
        height: 40px !important;
    }

    .mobile-side-menu {
        width: 300px !important;
    }

    .mobile-user-menu {
        width: 280px !important;
    }

    /* Dashboard */
    .dashboard-widgets {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 1.25rem;
    }
    
    /* Cards */
    .ds-card {
        margin-bottom: 1.5rem;
        transition: transform 0.2s ease;
    }
    
    .ds-card:hover {
        transform: translateY(-2px);
    }
    
    /* Forms */
    .form-row {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }
    
    /* Tables */
    .ds-table {
        font-size: 0.9rem;
    }
    
    /* Charts */
    .chart-container {
        height: 350px;
    }
    
    /* Analytics */
    .analytics-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }
    
    /* Sidebar for tablets */
    .tablet-sidebar {
        position: fixed;
        top: 0;
        left: -250px;
        width: 250px;
        height: 100vh;
        background: var(--bs-body-bg);
        border-right: 1px solid var(--bs-border-color);
        transition: left 0.3s ease;
        z-index: 1040;
    }
    
    .tablet-sidebar.show {
        left: 0;
    }
    
    .tablet-sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1035;
        display: none;
    }
    
    .tablet-sidebar-overlay.show {
        display: block;
    }
}

/* Mobile range: 576px to 991.98px - ensure mobile nav works */
@media (max-width: 991.98px) {
    .desktop-navbar {
        display: none !important;
    }
    .mobile-top-bar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 9999 !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        height: 52px !important;
        padding: 0 0.75rem !important;
        background: #1a365d !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
    }

    .mobile-menu-btn {
        width: 40px !important;
        height: 40px !important;
        border: none !important;
        background: transparent !important;
        color: #ffffff !important;
        font-size: 1.25rem !important;
        border-radius: 8px !important;
        cursor: pointer !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .mobile-logo {
        color: #ffffff !important;
        font-size: 1.1rem !important;
        font-weight: 700 !important;
        text-decoration: none !important;
        display: flex !important;
        align-items: center !important;
        gap: 0.4rem !important;
        white-space: nowrap !important;
    }

    .mobile-icons {
        display: flex !important;
        align-items: center !important;
        gap: 0.25rem !important;
    }

    .mobile-icon {
        width: 36px !important;
        height: 36px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        color: #ffffff !important;
        border-radius: 8px !important;
        text-decoration: none !important;
    }

    .mobile-icon-btn {
        width: 36px !important;
        height: 36px !important;
        border: none !important;
        background: transparent !important;
        color: #ffffff !important;
        font-size: 0.95rem !important;
        border-radius: 8px !important;
        cursor: pointer !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .mobile-side-menu {
        position: fixed !important;
        top: 0 !important;
        left: -280px !important;
        width: 280px !important;
        height: 100vh !important;
        max-height: 100vh !important;
        background: #1a365d !important;
        z-index: 10001 !important;
        transition: left 0.3s ease !important;
        overflow-y: auto !important;
        display: block !important;
    }

    .mobile-side-menu.active {
        left: 0 !important;
    }

    .mobile-side-menu-overlay {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        background: rgba(0, 0, 0, 0.5) !important;
        z-index: 10000 !important;
        display: none !important;
    }

    .mobile-side-menu-overlay.active {
        display: block !important;
    }

    .mobile-user-menu {
        position: fixed !important;
        top: 52px !important;
        right: -280px !important;
        width: 260px !important;
        max-height: calc(100vh - 52px) !important;
        background: #1a365d !important;
        z-index: 10001 !important;
        transition: right 0.3s ease !important;
        overflow-y: auto !important;
        display: block !important;
        border-radius: 0 0 0 12px !important;
    }

    .mobile-user-menu.active {
        right: 0 !important;
    }

    .mobile-user-menu-overlay {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        background: rgba(0, 0, 0, 0.5) !important;
        z-index: 10000 !important;
        display: none !important;
    }

    .mobile-user-menu-overlay.active {
        display: block !important;
    }

    .mobile-menu-header {
        padding: 0.75rem 1rem !important;
        font-size: 0.8rem !important;
        font-weight: 600 !important;
        color: rgba(255, 255, 255, 0.5) !important;
        text-transform: uppercase !important;
        letter-spacing: 0.5px !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
        margin-bottom: 0.25rem !important;
        display: flex !important;
        align-items: center !important;
        gap: 0.5rem !important;
    }

    .mobile-menu-item {
        display: flex !important;
        align-items: center !important;
        gap: 0.75rem !important;
        padding: 0.75rem 1rem !important;
        color: #ffffff !important;
        text-decoration: none !important;
        font-size: 0.9rem !important;
        transition: background 0.2s !important;
        border-left: 3px solid transparent !important;
    }

    .mobile-menu-item i {
        width: 20px !important;
        text-align: center !important;
        font-size: 0.95rem !important;
        flex-shrink: 0 !important;
    }

    /* Mobile submenu styles */
    .mobile-dropdown-toggle {
        cursor: pointer !important;
        position: relative !important;
    }

    .mobile-dropdown-arrow {
        position: absolute !important;
        right: 1rem !important;
        font-size: 0.7rem !important;
        transition: transform 0.3s ease !important;
    }

    .mobile-dropdown-toggle.active .mobile-dropdown-arrow {
        transform: rotate(180deg) !important;
    }

    .mobile-submenu {
        max-height: 0 !important;
        overflow: hidden !important;
        transition: max-height 0.3s ease !important;
        background: rgba(0, 0, 0, 0.15) !important;
    }

    .mobile-submenu.open {
        max-height: 600px !important;
    }

    .mobile-submenu-item {
        display: flex !important;
        align-items: center !important;
        gap: 0.75rem !important;
        padding: 0.65rem 1rem 0.65rem 2.5rem !important;
        color: rgba(255, 255, 255, 0.85) !important;
        text-decoration: none !important;
        font-size: 0.85rem !important;
        transition: background 0.2s !important;
        border-left: 2px solid transparent !important;
    }

    .mobile-submenu-item:active {
        background: rgba(255, 255, 255, 0.1) !important;
        border-left-color: rgba(255, 255, 255, 0.3) !important;
    }

    .mobile-submenu-item i {
        width: 18px !important;
        text-align: center !important;
        font-size: 0.85rem !important;
        flex-shrink: 0 !important;
    }

    main.container-fluid {
        padding-top: 60px !important;
    }
}

/* Large Devices (desktops, 992px and up) */
@media (min-width: 992px) and (max-width: 1199.98px) {
    /* Dashboard */
    .dashboard-widgets {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 1.5rem;
    }
    
    /* Main content area */
    .main-content {
        display: grid;
        grid-template-columns: 1fr 300px;
        gap: 2rem;
    }
    
    /* Charts */
    .chart-container {
        height: 400px;
    }
    
    /* Analytics */
    .analytics-stats {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.25rem;
    }
    
    /* Tables */
    .ds-table {
        font-size: 0.95rem;
    }
    
    /* Hover effects */
    .ds-card {
        transition: all 0.3s ease;
    }
    
    .ds-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.15);
    }
    
    .ds-btn {
        transition: all 0.3s ease;
    }
    
    .ds-btn:hover {
        transform: translateY(-2px);
    }
}

/* Extra Large Devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    /* Container */
    .container {
        max-width: 1140px;
    }
    
    /* Dashboard */
    .dashboard-widgets {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 2rem;
    }
    
    /* Main content */
    .main-content {
        display: grid;
        grid-template-columns: 1fr 350px;
        gap: 2.5rem;
    }
    
    /* Charts */
    .chart-container {
        height: 450px;
    }
    
    /* Typography */
    h1 { font-size: 2.5rem; }
    h2 { font-size: 2rem; }
    h3 { font-size: 1.75rem; }
    h4 { font-size: 1.5rem; }
    h5 { font-size: 1.25rem; }
    h6 { font-size: 1rem; }
    
    /* Enhanced hover effects */
    .ds-card {
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .ds-card:hover {
        transform: translateY(-6px);
        box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.15);
    }
    
    /* Animations */
    .ds-animate {
        animation-duration: 0.6s;
    }
    
    /* Sidebar */
    .desktop-sidebar {
        width: 280px;
        background: var(--bs-body-bg);
        border-right: 1px solid var(--bs-border-color);
        padding: 1.5rem;
    }
}

/* Special device orientations */
@media (max-width: 767.98px) and (orientation: landscape) {
    /* Landscape phone adjustments */
    .navbar.fixed-bottom {
        height: 50px;
        padding: 0.25rem 0;
    }
    
    .navbar.fixed-bottom i {
        font-size: 0.875rem;
    }
    
    .navbar.fixed-bottom span {
        font-size: 0.5rem;
    }
    
    .ds-modal-content {
        margin: 1rem;
        max-height: 80vh;
        overflow-y: auto;
    }
}

@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
    /* Portrait tablet adjustments */
    .dashboard-widgets {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .analytics-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Print styles */
@media print {
    .navbar,
    .navbar.fixed-bottom,
    .btn,
    .notification-container,
    .modal {
        display: none !important;
    }
    
    .ds-card {
        border: 1px solid #000 !important;
        box-shadow: none !important;
        break-inside: avoid;
        margin-bottom: 1rem;
    }
    
    .ds-table {
        border: 1px solid #000 !important;
    }
    
    .ds-table th,
    .ds-table td {
        border: 1px solid #000 !important;
    }
    
    body {
        font-size: 12pt;
        color: #000 !important;
        background: #fff !important;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Enhanced visuals for retina displays */
    .ds-card {
        border-width: 0.5px;
    }
    
    .ds-btn {
        border-width: 0.5px;
    }
    
    .ds-table {
        border-width: 0.5px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .ds-card:hover {
        transform: none !important;
    }
    
    .ds-btn:hover {
        transform: none !important;
    }
}

/* Dark mode specific responsive adjustments */
@media (max-width: 575.98px) {
    [data-theme="dark"] .ds-card {
        background: var(--bs-body-bg);
        border-color: var(--bs-border-color);
    }
    
    [data-theme="dark"] .navbar.fixed-bottom {
        background: linear-gradient(135deg, #2c3e50, #34495e);
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .ds-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .ds-card {
        cursor: pointer;
    }
    
    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }
}

/* ── Analytics tabs — collapsible on mobile ── */
.an-tabs-toggle {
    display: none;
    width: 100%;
    padding: .55rem 1rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    color: #374151;
    align-items: center;
    justify-content: space-between;
    margin-bottom: .75rem;
    gap: .5rem;
}
.an-tabs-toggle-icon {
    transition: transform .2s ease;
    font-size: .75rem;
    color: #9ca3af;
    flex-shrink: 0;
}
.an-tabs-toggle.open .an-tabs-toggle-icon {
    transform: rotate(180deg);
}

@media (max-width: 768px) {
    .an-tabs-toggle { display: flex; }

    .an-tabs {
        flex-direction: column !important;
        display: none !important;
        border: 1.5px solid #e5e7eb;
        border-radius: 10px;
        overflow: hidden;
        margin-bottom: 1rem;
        background: #fff;
        box-shadow: 0 4px 16px rgba(0,0,0,.08);
        position: relative;
        z-index: 50;
        width: 100% !important;
        min-width: 0 !important;
    }
    .an-tabs.open {
        display: flex !important;
    }
    .an-tab {
        border-radius: 0 !important;
        border: none !important;
        border-bottom: 1px solid rgba(0,0,0,.06) !important;
        padding: .65rem 1rem !important;
        font-size: .875rem !important;
    }
    .an-tab:last-child {
        border-bottom: none !important;
    }
    .an-tab.active {
        background: #6366f1 !important;
        color: #fff !important;
    }

    /* dark */
    [data-theme="dark"] .an-tabs-toggle { background: #1a1d2e; border-color: rgba(255,255,255,.1); color: #f9fafb; }
    [data-theme="dark"] .an-tabs { background: #1a1d2e; border-color: rgba(255,255,255,.08); }
    [data-theme="dark"] .an-tab { border-color: rgba(255,255,255,.06) !important; }
    [data-theme="dark"] .an-tab.active { background: #6366f1 !important; }

    /* gold */
    [data-theme="gold"] .an-tabs-toggle { background: #1A1A1A; border-color: rgba(212,175,55,.2); color: #D4AF37; }
    [data-theme="gold"] .an-tabs { background: #1A1A1A; border-color: rgba(212,175,55,.15); }
    [data-theme="gold"] .an-tab { border-color: rgba(212,175,55,.08) !important; color: #D4AF37; }
    [data-theme="gold"] .an-tab.active { background: #D4AF37 !important; color: #fff !important; }

    /* purple */
    [data-theme="purple"] .an-tabs-toggle { background: #f8f6fa; border-color: rgba(157,134,184,.2); color: #2d1a40; }
    [data-theme="purple"] .an-tabs { background: #f8f6fa; border-color: rgba(157,134,184,.15); }
    [data-theme="purple"] .an-tab { border-color: rgba(157,134,184,.08) !important; color: rgba(157,134,184,.8); }
    [data-theme="purple"] .an-tab.active { background: #9d86b8 !important; color: #fff !important; }
}

/* Focus indicators for keyboard navigation */
@media (focus-visible) {
    .ds-btn:focus-visible,
    .ds-form-control:focus-visible,
    .nav-link:focus-visible {
        outline: 2px solid var(--ds-primary);
        outline-offset: 2px;
    }
}