/* =============================================
   MOBILE UX ENHANCEMENT - Kalinka Dashboard 2.0
   Only active at mobile breakpoints.
   No changes to business logic, data, or API.
   ============================================= */

/* =============================================
   1. BOTTOM NAVIGATION
   ============================================= */

.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1100;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-light);
    box-shadow: 0 -2px 12px rgba(15, 23, 42, 0.06);
    padding: 0 0 env(safe-area-inset-bottom, 0);
}

.mobile-bottom-nav__list {
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    margin: 0;
    padding: 0;
    list-style: none;
}

.mobile-bottom-nav__item {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-bottom-nav__btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    width: 100%;
    min-height: 56px;
    padding: 6px 4px 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

.mobile-bottom-nav__btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: var(--kalinka-blue);
    border-radius: 0 0 2px 2px;
    transition: width 0.2s ease;
}

.mobile-bottom-nav__btn.active {
    color: var(--kalinka-blue);
}

.mobile-bottom-nav__btn.active::before {
    width: 32px;
}

.mobile-bottom-nav__icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-bottom-nav__icon svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.8;
}

.mobile-bottom-nav__label {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.01em;
    line-height: 1;
    white-space: nowrap;
}

/* =============================================
   2. BOTTOM SHEET
   ============================================= */

.mobile-sheet-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2500;
    background: rgba(0, 0, 0, 0);
    transition: background 0.25s ease;
}

.mobile-sheet-overlay.open {
    display: block;
    background: rgba(0, 0, 0, 0.4);
}

.mobile-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2501;
    background: #fff;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.12);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.mobile-sheet.open {
    transform: translateY(0);
}

.mobile-sheet__handle {
    display: flex;
    justify-content: center;
    padding: 10px 0 6px;
    cursor: grab;
    flex-shrink: 0;
}

.mobile-sheet__handle::after {
    content: '';
    width: 36px;
    height: 4px;
    background: var(--border-default);
    border-radius: 2px;
}

.mobile-sheet__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 20px 12px;
    flex-shrink: 0;
}

.mobile-sheet__title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
}

.mobile-sheet__close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-surface);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    -webkit-tap-highlight-color: transparent;
}

.mobile-sheet__body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 20px 20px;
    flex: 1;
}

/* "More" menu items inside bottom sheet */
.mobile-more-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-more-menu__item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 4px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.mobile-more-menu__item:last-child {
    border-bottom: none;
}

.mobile-more-menu__item:active {
    background: var(--bg-hover);
}

.mobile-more-menu__icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.mobile-more-menu__text {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
}

.mobile-more-menu__desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Filter bottom sheet */
.mobile-filter-sheet .mobile-sheet__body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.mobile-filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mobile-filter-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.mobile-filter-actions {
    display: flex;
    gap: 10px;
    padding: 16px 0 0;
    border-top: 1px solid var(--border-light);
    margin-top: 8px;
}

.mobile-filter-actions .btn {
    flex: 1;
    min-height: 44px;
    font-size: 15px;
}

/* =============================================
   3. MOBILE CARD LAYOUTS (Table → Cards)
   ============================================= */

.mobile-cards-container {
    display: none;
}

.mobile-deal-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 10px;
    transition: box-shadow 0.15s ease;
}

.mobile-deal-card:active {
    box-shadow: var(--shadow-md);
}

.mobile-deal-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.mobile-deal-card__name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    flex: 1;
    cursor: pointer;
}

.mobile-deal-card__actions {
    flex-shrink: 0;
    display: flex;
    gap: 4px;
}

.mobile-deal-card__action-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-light);
    background: var(--bg-surface);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    -webkit-tap-highlight-color: transparent;
}

.mobile-deal-card__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.mobile-deal-card__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
}

.mobile-deal-card__row + .mobile-deal-card__row {
    border-top: 1px solid var(--border-light);
}

.mobile-deal-card__label {
    font-size: 12px;
    color: var(--text-secondary);
}

.mobile-deal-card__value {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}

.mobile-deal-card__expand {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 0 0;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    width: 100%;
    gap: 4px;
    -webkit-tap-highlight-color: transparent;
}

.mobile-deal-card__expand-content {
    display: none;
    padding-top: 8px;
    border-top: 1px solid var(--border-light);
    margin-top: 8px;
}

.mobile-deal-card__expand-content.open {
    display: block;
}

/* Plan-fact card */
.mobile-planfact-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 10px;
}

.mobile-planfact-card__month {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.mobile-planfact-card__progress {
    margin-bottom: 10px;
}

.mobile-planfact-card__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
}

.mobile-planfact-card__label {
    font-size: 12px;
    color: var(--text-secondary);
}

.mobile-planfact-card__value {
    font-size: 14px;
    font-weight: 500;
    font-family: 'JetBrains Mono', monospace;
}

/* Scorecard card */
.mobile-scorecard-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 10px;
}

.mobile-scorecard-card__name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.mobile-scorecard-card__stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.mobile-scorecard-card__stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mobile-scorecard-card__stat-label {
    font-size: 11px;
    color: var(--text-muted);
}

.mobile-scorecard-card__stat-value {
    font-size: 14px;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

/* =============================================
   4. KPI CAROUSEL (horizontal swipe)
   ============================================= */

.mobile-kpi-carousel {
    display: none;
}

.mobile-kpi-carousel__track {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding: 4px 0 12px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.mobile-kpi-carousel__track::-webkit-scrollbar {
    display: none;
}

.mobile-kpi-carousel__card {
    flex: 0 0 calc(50% - 6px);
    min-width: 140px;
    scroll-snap-align: start;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 16px;
    box-shadow: var(--shadow-xs);
}

.mobile-kpi-carousel__value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    line-height: 1.2;
    margin-bottom: 4px;
}

.mobile-kpi-carousel__label {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.3;
}

.mobile-kpi-carousel__dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 4px 0 8px;
}

.mobile-kpi-carousel__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border-default);
    transition: all 0.2s ease;
}

.mobile-kpi-carousel__dot.active {
    background: var(--kalinka-blue);
    width: 18px;
    border-radius: 3px;
}

/* =============================================
   5. STICKY SECTION HEADERS
   ============================================= */

.mobile-sticky-header {
    display: none;
}

/* =============================================
   6. SEGMENTED CONTROL (period switcher)
   ============================================= */

.mobile-segmented {
    display: none;
}

.mobile-segmented__track {
    display: flex;
    background: var(--bg-surface);
    border-radius: 10px;
    padding: 3px;
    gap: 2px;
}

.mobile-segmented__btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    min-height: 36px;
}

.mobile-segmented__btn.active {
    background: var(--bg-secondary);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* =============================================
   7. MOBILE-ONLY RESPONSIVE RULES
   Activates at max-width: 768px
   ============================================= */

@media (max-width: 768px) {

    /* --- Show mobile components --- */
    .mobile-bottom-nav {
        display: block;
    }

    .mobile-cards-container {
        display: block;
    }

    .mobile-kpi-carousel {
        display: block;
    }

    .mobile-segmented {
        display: flex;
        margin-bottom: 16px;
    }

    /* --- Hide desktop elements on mobile --- */
    .tabs-nav {
        display: none !important;
    }

    /* Hide tables when cards are present */
    .has-mobile-cards > .table-wrapper,
    .has-mobile-cards > div[style*="overflow"] {
        display: none;
    }

    /* --- Main layout adjustments --- */
    body {
        padding-bottom: 0;
    }

    .dashboard {
        padding-bottom: calc(60px + env(safe-area-inset-bottom, 0));
    }

    .main-content {
        padding: 12px 12px 20px !important;
    }

    /* --- Header compact mobile --- */
    .header-content {
        padding: 8px 12px !important;
        flex-wrap: nowrap;
        gap: 8px;
    }

    .header-left {
        flex-shrink: 0;
    }

    .header-left .header-title {
        display: none;
    }

    .logo img {
        height: 28px;
    }

    .period-selector {
        order: 0 !important;
        width: auto !important;
        flex: 1;
        justify-content: center;
        gap: 6px;
    }

    .period-current {
        font-size: 13px !important;
        min-width: auto;
    }

    .period-btn {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }

    .period-type-toggle {
        display: none;
    }

    .header-right {
        flex-shrink: 0;
    }

    .sync-status {
        display: none !important;
    }

    .user-info {
        display: none !important;
    }

    .logout-btn {
        display: none !important;
    }

    .user-avatar {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }

    /* --- KPI Grid as carousel on mobile --- */
    .kpi-grid {
        display: none !important;
    }

    .kpi-grid + .mobile-kpi-carousel {
        display: block;
    }

    /* --- YTD Summary mobile --- */
    .ytd-summary {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }

    .ytd-item {
        padding: 12px !important;
    }

    .ytd-value {
        font-size: 16px !important;
    }

    .ytd-label {
        font-size: 11px !important;
    }

    /* --- Section cards compact --- */
    .section-card {
        border-radius: 12px !important;
        margin-bottom: 12px !important;
    }

    .section-header {
        padding: 12px 14px !important;
        flex-wrap: wrap;
        gap: 8px;
    }

    .section-icon {
        width: 34px;
        height: 34px;
        font-size: 14px;
    }

    .section-title {
        font-size: 15px !important;
    }

    .section-subtitle {
        font-size: 11px !important;
    }

    .section-body {
        padding: 12px 14px !important;
    }

    /* --- Filter bar mobile --- */
    .filter-bar {
        flex-direction: column !important;
        gap: 8px !important;
    }

    .search-wrapper {
        width: 100% !important;
    }

    .search-input {
        min-height: 44px;
        font-size: 16px !important; /* prevents iOS zoom */
    }

    .filter-select {
        min-height: 44px;
        font-size: 16px !important; /* prevents iOS zoom */
        width: 100% !important;
    }

    /* --- Buttons touch targets --- */
    .btn {
        min-height: 44px;
        padding: 10px 16px;
        font-size: 14px;
    }

    .btn-sm {
        min-height: 40px;
        padding: 8px 14px;
    }

    .btn-icon {
        min-width: 44px;
        min-height: 44px;
        font-size: 14px;
    }

    /* --- Typography mobile --- */
    .kpi-value {
        font-size: 20px !important;
    }

    .kpi-label {
        font-size: 12px !important;
    }

    /* --- P&L KPI grid mobile --- */
    .pnl-kpi-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }

    .pnl-kpi-card {
        padding: 12px !important;
    }

    .pnl-kpi-value {
        font-size: 16px !important;
    }

    .pnl-kpi-label {
        font-size: 11px !important;
    }

    /* --- Charts grid mobile --- */
    .pnl-charts-grid {
        grid-template-columns: 1fr !important;
    }

    /* --- Plan-Fact KPIs --- */
    .plan-fact-kpis {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }

    .plan-fact-kpi {
        padding: 12px !important;
    }

    .plan-fact-kpi-value {
        font-size: 16px !important;
    }

    .plan-fact-kpi-label {
        font-size: 11px !important;
    }

    /* --- Plan-Fact chart bars mobile --- */
    .plan-fact-chart {
        gap: 4px !important;
    }

    .month-bar {
        min-width: 0 !important;
    }

    .month-label {
        font-size: 9px !important;
    }

    /* --- ROP section mobile --- */
    .rop-kpi-row {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important;
    }

    .rop-kpi-card {
        padding: 10px 8px !important;
    }

    .rop-kpi-label {
        font-size: 9px !important;
    }

    .rop-kpi-value {
        font-size: 16px !important;
    }

    .rop-kpi-hint {
        font-size: 7px !important;
    }

    .rop-two-col {
        flex-direction: column !important;
        gap: 12px !important;
    }

    /* --- ROP scorecard table → cards --- */
    .rop-table {
        display: none !important;
    }

    /* --- Broker grid mobile --- */
    .broker-grid {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }

    /* --- Team metrics mobile --- */
    .tm-overall {
        flex-direction: row !important;
        justify-content: center !important;
        gap: 16px !important;
    }

    .tm-members-grid {
        grid-template-columns: 1fr !important;
    }

    /* Fix label overflow: "Вовлечённость" and "Выгорание" too long for 80px */
    .tm-bar-label {
        width: 90px !important;
        font-size: 9px !important;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .tm-bar-row {
        gap: 6px !important;
    }

    .tm-bar-value {
        min-width: 22px;
        text-align: right;
        font-size: 10px !important;
    }

    /* --- Mindmap / Strategy tree mobile --- */
    #mindmap-root {
        height: calc(100vh - 60px - 60px) !important; /* header + bottom nav */
    }

    /* Keep overflow hidden - JS handles pan/zoom via transforms.
       touch-action:none prevents browser gestures from conflicting. */
    .mn-viewport {
        touch-action: none;
    }

    .mn-toolbar {
        padding: 0 8px !important;
        height: 44px !important;
        gap: 4px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .mn-toolbar::-webkit-scrollbar {
        display: none;
    }

    .mn-viewport {
        padding-top: 44px !important;
    }

    .mn-title {
        font-size: 14px !important;
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mn-tb-btn {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        flex-shrink: 0;
    }

    .mn-zoom-val {
        font-size: 10px !important;
        min-width: 28px !important;
    }

    .mn-tb-divider {
        height: 20px;
    }

    .mn-tb-reset-pos,
    .mn-tb-auto-layout {
        font-size: 9px !important;
        padding: 3px 8px !important;
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* AI panel full-width on mobile */
    .mn-ai {
        width: 100% !important;
        top: auto !important;
        bottom: 0;
        height: 60vh !important;
        border-left: none !important;
        border-top: 1px solid rgba(0,0,0,.08);
        border-radius: 16px 16px 0 0;
    }

    /* Fold buttons larger for touch */
    .mn-fold {
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
    }

    /* Context menu - prevent going off-screen */
    .mn-ctx-menu {
        max-width: calc(100vw - 32px) !important;
    }

    /* Node well (+) button always visible on touch devices */
    .mn-node .mn-well {
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    /* --- Modals full-screen on mobile --- */
    .modal-overlay {
        padding: 0 !important;
        align-items: flex-end !important;
    }

    .modal,
    .modal-content {
        max-width: 100% !important;
        max-height: 100vh !important;
        border-radius: 16px 16px 0 0 !important;
        margin: 0;
    }

    .modal-body {
        max-height: calc(100vh - 140px) !important;
    }

    .modal-header {
        padding: 16px 16px !important;
    }

    .modal-body {
        padding: 16px !important;
    }

    .modal-footer {
        padding: 12px 16px !important;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0));
    }

    .modal-title {
        font-size: 16px !important;
    }

    /* --- Confirm dialog mobile --- */
    .confirm-dialog-box {
        margin: 0 16px;
    }

    /* --- Table responsive: horizontal scroll with shadow --- */
    .table-wrapper {
        position: relative;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table {
        font-size: 12px !important;
    }

    .data-table th,
    .data-table td {
        padding: 10px 8px !important;
        white-space: nowrap;
    }

    /* --- Empty states --- */
    .empty-state {
        padding: 24px 16px !important;
    }

    .empty-state-icon {
        font-size: 36px !important;
    }

    .empty-state-title {
        font-size: 15px !important;
    }

    /* --- Form inputs larger for touch --- */
    .form-input,
    .form-select,
    textarea {
        min-height: 44px;
        font-size: 16px !important; /* prevents iOS zoom */
    }

    /* --- Expense accordion touch targets --- */
    #expenseAccordion .accordion-header,
    #expenseAccordion [onclick] {
        min-height: 44px;
    }

    /* --- Toast notifications above bottom nav --- */
    .toast-container {
        bottom: calc(64px + env(safe-area-inset-bottom, 0)) !important;
    }

    /* --- Leaderboard items --- */
    .rop-leaderboard-item,
    [id="ropLeaderboard"] > div {
        padding: 10px 12px;
    }

    /* --- Make chart containers scrollable if needed --- */
    .pnl-chart-container {
        min-height: 200px;
    }

    /* --- Calendar tab mobile --- */
    .calendar-section {
        padding: 0 !important;
    }

    /* --- Import modal mobile --- */
    .import-modal .modal {
        max-height: 100vh !important;
        border-radius: 16px 16px 0 0 !important;
    }
}

/* =============================================
   8. SMALL MOBILE (max-width: 480px)
   ============================================= */

@media (max-width: 480px) {

    .main-content {
        padding: 8px 8px 16px !important;
    }

    .header-content {
        padding: 6px 10px !important;
    }

    .section-card {
        border-radius: 10px !important;
    }

    .section-header {
        padding: 10px 12px !important;
    }

    .section-body {
        padding: 10px 12px !important;
    }

    .mobile-kpi-carousel__card {
        flex: 0 0 calc(50% - 6px);
        min-width: 120px;
        padding: 12px;
    }

    .mobile-kpi-carousel__value {
        font-size: 18px;
    }

    .mobile-kpi-carousel__label {
        font-size: 11px;
    }

    .mobile-deal-card {
        padding: 12px;
    }

    .mobile-deal-card__name {
        font-size: 14px;
    }

    .ytd-summary {
        gap: 6px !important;
    }

    .ytd-item {
        padding: 10px !important;
    }

    .ytd-value {
        font-size: 14px !important;
    }

    .pnl-kpi-grid {
        grid-template-columns: 1fr !important;
    }

    /* Team bar labels even narrower on small screens */
    .tm-bar-label {
        width: 75px !important;
        font-size: 8px !important;
    }

    /* Mindmap toolbar compact */
    .mn-toolbar {
        padding: 0 6px !important;
    }

    .mn-title {
        max-width: 80px !important;
        font-size: 13px !important;
    }
}

/* =============================================
   9. ANIMATIONS
   ============================================= */

@media (max-width: 768px) {
    .mobile-sheet,
    .mobile-sheet-overlay {
        will-change: transform, opacity;
    }

    .tab-content {
        animation: none !important;
    }

    /* Smooth page transitions */
    .tab-content.active {
        animation: mobilePageIn 0.18s ease-out;
    }

    @keyframes mobilePageIn {
        from {
            opacity: 0;
            transform: translateY(8px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .mobile-sheet,
    .mobile-sheet-overlay,
    .mobile-bottom-nav__btn,
    .tab-content,
    .mobile-deal-card,
    .mobile-kpi-carousel__track {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* =============================================
   10. TOUCH DEVICE ENHANCEMENTS
   ============================================= */

@media (pointer: coarse) {
    /* Larger click areas for any interactive element */
    .sortable {
        padding: 12px 8px !important;
    }

    .badge {
        padding: 4px 10px;
        font-size: 12px;
    }

    /* Disable hover effects on touch */
    .data-table tr:hover td {
        background: transparent;
    }

    .section-card:hover {
        box-shadow: var(--shadow-md);
    }

    /* Progress bar tappable */
    .progress-bar {
        min-height: 8px;
    }
}
