/* ═══════════════════════════════════════════════════════════════
   BENSTRACK — MOBILE NATIVE APP EXPERIENCE
   Only loaded on screens ≤ 768px (via <link media> in HTML).
   Transforms the web app into an iOS/Android-native feel.
   ═══════════════════════════════════════════════════════════════ */

/* ── Reset & Base ──────────────────────────────────────────── */
html {
    font-size: 100% !important;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: contain;
}

body {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/* Smooth scrolling for all scrollable containers */
* {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
}
*::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

/* ── Hide desktop sidebar completely ───────────────────────── */
.sidebar,
.sidebar-overlay,
.sidebar-toggle-btn {
    display: none !important;
}

/* ── Main content: full width, navbar spacing ──────────────── */
main.main-content {
    margin-left: 0 !important;
    width: 100% !important;
    padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px));
    min-height: 100vh;
    min-height: 100dvh;
}

/* ── Bottom Navigation Bar ─────────────────────────────────── */
.mobile-bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    height: calc(64px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(255, 255, 255, 0.88);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-top: 0.5px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 -1px 12px rgba(0, 0, 0, 0.04);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hide when keyboard is open (JS adds this class) */
.mobile-bottom-nav.nav-hidden {
    transform: translateY(100%);
}

.mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-decoration: none;
    color: #8e8e93;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    padding: 6px 0 2px;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.18s ease;
    min-height: 48px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.mobile-nav-item svg {
    width: 24px;
    height: 24px;
    stroke-width: 1.6;
    transition: transform 0.15s ease;
}

.mobile-nav-item.active {
    color: #4f46e5;
}

.mobile-nav-item.active svg {
    transform: scale(1.08);
}

/* Tap ripple effect */
.mobile-nav-item::after {
    content: '';
    position: absolute;
    inset: 4px 8px;
    border-radius: 12px;
    background: currentColor;
    opacity: 0;
    transition: opacity 0.2s;
}

.mobile-nav-item:active::after {
    opacity: 0.08;
}

/* ── Page Hero — Compact native header ─────────────────────── */
.page-hero {
    padding: 14px 16px 10px !important;
    gap: 6px !important;
    flex-direction: column !important;
    align-items: center !important;
    border-radius: 0 !important;
    margin: 0 !important;
    /* Frosted glass effect */
    background: linear-gradient(135deg, #0d1829 0%, #132040 50%, #0f1629 100%) !important;
    position: sticky;
    top: 0;
    z-index: 100;
}

.page-hero-text {
    text-align: center !important;
    transform: none !important;
    position: static !important;
}

.page-hero-title {
    font-size: 1.3rem !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.page-hero-title .hero-icon {
    width: 22px !important;
    height: 22px !important;
}

.page-hero-subtitle {
    display: none !important;
}

/* KPI bar — clean centered, no box */
.portfolio-kpi-bar {
    width: 100% !important;
    flex-wrap: nowrap !important;
    justify-content: center !important;
    padding: 0 !important;
    overflow: visible;
}

.kpi-card {
    display: flex;
    gap: 0;
    flex-wrap: nowrap !important;
    width: auto;
    justify-content: center;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border-radius: 0 !important;
}

.kpi-item + .kpi-item {
    border-left: 1px solid rgba(255,255,255,0.15) !important;
}

.kpi-item {
    flex: 0 0 auto !important;
    min-width: 0 !important;
    padding: 4px 16px !important;
    text-align: center;
}

.kpi-label {
    font-size: 0.58rem !important;
    opacity: 0.5;
    margin-bottom: 2px;
}

.kpi-value,
.kpi-global-value {
    font-size: 1.05rem !important;
    font-weight: 700 !important;
    letter-spacing: -0.02em;
}

.kpi-global-pnl {
    font-size: 0.85rem !important;
    font-weight: 700 !important;
    letter-spacing: -0.02em;
}

.page-hero-spacer {
    display: none !important;
}

/* ── Container — Full bleed ────────────────────────────────── */
.container {
    padding: 0 12px !important;
}

#calculator-view .container,
#company-analysis-view .ca-container {
    padding: 12px !important;
}

/* ── Cards — Edge-to-edge mobile style ─────────────────────── */
.portfolio-card,
.input-section,
.holdings-card,
.dividends-card {
    border-radius: 16px !important;
    margin: 8px 0 !important;
    padding: 14px 14px !important;
    border: none !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 0 0 0.5px rgba(0, 0, 0, 0.04) !important;
}

.portfolio-card:hover,
.input-section:hover {
    transform: none !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 0 0 0.5px rgba(0, 0, 0, 0.04) !important;
}

/* ── Add Position — Compact ────────────────────────────────── */
.add-position-header {
    padding: 4px 0 !important;
}

.add-position-toggle-btn {
    width: 100%;
    justify-content: center;
    padding: 12px 16px !important;
    border-radius: 12px !important;
    font-size: 0.88rem !important;
}

.add-position-panel {
    padding: 12px 0 0 !important;
}

.add-row {
    margin-bottom: 10px !important;
    padding: 12px !important;
    border-radius: 12px !important;
}

.add-row-label {
    font-size: 0.75rem !important;
    margin-bottom: 8px !important;
}

.add-row-fields {
    flex-wrap: wrap !important;
    gap: 8px !important;
}

.add-row-fields .form-group {
    min-width: unset !important;
    width: 100% !important;
    flex: 1 1 100% !important;
}

.add-row-fields input[type="text"],
.add-row-fields input[type="number"] {
    height: 44px !important;
    font-size: 16px !important; /* Prevents iOS zoom on focus */
    border-radius: 10px !important;
    padding: 0 12px !important;
}

.add-btn-compact {
    width: 100% !important;
    height: 44px !important;
    border-radius: 10px !important;
    font-size: 0.88rem !important;
    justify-content: center;
}

/* Autocomplete dropdown — full width & touch-friendly */
.suggestions-list {
    max-height: 50vh !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12) !important;
}

.suggestion-item {
    padding: 12px 14px !important;
    min-height: 48px !important;
    font-size: 0.9rem !important;
}

/* ── Charts — Full width stacked ───────────────────────────── */
.charts-dual-layout {
    flex-direction: column !important;
    gap: 8px !important;
}

.chart-donut-col,
.chart-history-col {
    width: 100% !important;
    min-width: unset !important;
}

/* Donut chart — compact */
.donut-canvas-wrap {
    min-height: 340px !important;
    height: 340px !important;
}

/* History chart — taller for readability */
.chart-canvas-wrap {
    height: 280px !important;
}

/* Segmented controls — full width scroll */
.donut-seg-ctrl {
    width: 100%;
    padding: 0 0 8px !important;
}

.dseg-wrap {
    width: 100%;
    justify-content: center;
}

.dseg-btn {
    flex: 1;
    text-align: center;
    padding: 7px 8px !important;
    font-size: 0.72rem !important;
    min-height: 36px;
}

/* Chart header — wrap filters */
.chart-header {
    flex-wrap: wrap !important;
    gap: 6px !important;
    margin-bottom: 10px !important;
}

/* Time filters — horizontal scroll */
.time-filters {
    overflow-x: auto;
    flex-wrap: nowrap !important;
    width: 100%;
    justify-content: flex-start;
    gap: 4px !important;
    padding: 2px 3px !important;
    -webkit-overflow-scrolling: touch;
}

.time-filter-btn {
    padding: 6px 12px !important;
    font-size: 0.7rem !important;
    min-height: 32px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* History mode (Total / Earnings / % Return) segmented */
.hseg-wrap {
    width: 100%;
}

.hseg-btn {
    flex: 1;
    text-align: center;
    min-height: 36px;
}

/* Benchmark selector — horizontal scroll */
#benchmark-row {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.benchmark-btn {
    min-height: 36px;
    white-space: nowrap;
    padding: 6px 14px !important;
}

/* ── Holdings Table — Mobile card-like rows ────────────────── */
.holdings-header {
    flex-wrap: wrap !important;
    gap: 8px !important;
    margin-bottom: 10px;
}

.holdings-header h2 {
    font-size: 1.1rem !important;
}

.currency-toggle-container {
    font-size: 0.78rem !important;
}

.holdings-summary {
    flex-direction: row !important;
    gap: 12px !important;
    align-items: center !important;
    margin-bottom: 10px;
}

.table-scroll-wrap {
    margin: 0 -14px;
    padding: 0 14px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

#portfolio-table {
    font-size: 0.78rem !important;
}

#portfolio-table th {
    font-size: 0.65rem !important;
    padding: 8px 6px !important;
    white-space: nowrap;
}

#portfolio-table td {
    padding: 10px 6px !important;
    vertical-align: middle;
}

/* Hide columns progressively: Quantity(2), Avg Price(3), Cur Price(4) */
#portfolio-table th:nth-child(2),
#portfolio-table td:nth-child(2),
#portfolio-table th:nth-child(3),
#portfolio-table td:nth-child(3),
#portfolio-table th:nth-child(4),
#portfolio-table td:nth-child(4) {
    display: none !important;
}

/* Stock cell — compact */
.stock-cell {
    gap: 8px !important;
}

.stock-logo {
    width: 32px !important;
    height: 32px !important;
    border-radius: 8px !important;
}

.stock-name {
    font-size: 0.8rem !important;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stock-symbol {
    font-size: 0.65rem !important;
}

/* Action buttons — always visible on mobile (no hover) */
.stock-actions {
    opacity: 1 !important;
    gap: 4px !important;
}

.stock-actions button {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px;
    min-height: 28px;
}

/* Gain/Loss column */
.gain-value {
    font-size: 0.8rem !important;
}

.gain-percent {
    font-size: 0.68rem !important;
}

/* GL toggle — reflow to not overlap Gain/Loss title */
.gl-th {
    position: relative;
    padding-top: 0.5rem !important;
}

.gl-toggle {
    position: static !important;
    display: flex !important;
    justify-content: center;
    margin-bottom: 4px;
}

.gl-th-inner {
    justify-content: center;
}

/* Sortable headers — larger touch target */
.sortable {
    min-height: 44px;
    cursor: pointer;
}

/* Clickable row — touch feedback */
#portfolio-table tbody tr {
    transition: background 0.12s ease;
    -webkit-tap-highlight-color: transparent;
}

#portfolio-table tbody tr:active {
    background: rgba(79, 70, 229, 0.04) !important;
}

/* Asset chart button — larger */
.asset-chart-btn {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px;
}

/* ── Dividends — Compact ───────────────────────────────────── */
.dividends-header {
    padding: 10px 0 !important;
    gap: 8px !important;
    min-height: 48px;
}

.dividends-header h2 {
    font-size: 1rem !important;
}

.dividends-total-badge {
    font-size: 0.78rem !important;
    padding: 3px 10px !important;
}

/* ── Modals — Bottom sheet style ───────────────────────────── */
.modal {
    align-items: flex-end !important;
    padding: 0 !important;
}

.modal-content,
.pro-modal-content {
    margin: 0 !important;
    border-radius: 20px 20px 0 0 !important;
    position: relative !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: 92vh !important;
    max-height: 92dvh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    animation: slideUp 0.32s cubic-bezier(0.32, 0.72, 0, 1) !important;
}

.pro-modal-wide {
    max-width: 100% !important;
}

/* Bottom sheet drag indicator */
.modal-content::before,
.pro-modal-content::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: #d1d5db;
    border-radius: 2px;
    margin: 8px auto 4px;
    flex-shrink: 0;
}

/* Modal header — compact */
.pro-modal-header {
    padding: 12px 16px !important;
}

.pro-modal-title {
    font-size: 1.05rem !important;
}

.pro-modal-close {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px;
    font-size: 1.3rem !important;
}

/* Modal body */
.pro-modal-body {
    padding: 14px 16px !important;
}

/* Modal footer — sticky at bottom */
.pro-modal-footer {
    position: sticky;
    bottom: 0;
    background: var(--white);
    padding: 12px 16px !important;
    flex-direction: column !important;
    gap: 8px !important;
    border-top: 1px solid var(--border-color);
    z-index: 2;
}

.pro-modal-footer button {
    width: 100% !important;
    height: 48px !important;
    border-radius: 12px !important;
    font-size: 0.92rem !important;
    justify-content: center;
}

/* Asset Chart Modal — full screen */
.asset-chart-modal-content {
    max-height: 95vh !important;
    max-height: 95dvh !important;
    border-radius: 20px 20px 0 0 !important;
}

.asset-chart-header {
    flex-wrap: wrap !important;
    gap: 10px !important;
    padding: 14px 16px 10px !important;
}

.asset-chart-title {
    gap: 10px !important;
}

.asset-chart-logo {
    width: 36px !important;
    height: 36px !important;
}

.asset-chart-title h2 {
    font-size: 1.05rem !important;
}

.asset-chart-filters {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap !important;
}

.asset-chart-container {
    height: 260px !important;
    padding: 0 8px !important;
}

.close-asset-chart-modal {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px;
    font-size: 1.4rem !important;
    top: 16px !important;
    right: 12px !important;
}

/* Asset lots table */
.asset-lots-section {
    padding: 12px 14px !important;
}

.asset-lots-title {
    font-size: 0.9rem !important;
    margin-bottom: 8px !important;
}

.asset-lots-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -14px;
    padding: 0 14px;
}

.asset-lots-table {
    font-size: 0.72rem !important;
}

.asset-lots-table th,
.asset-lots-table td {
    padding: 8px 6px !important;
    white-space: nowrap;
}

/* ── Edit Position Modal — Compact ─────────────────────────── */
.lot-row {
    flex-wrap: wrap !important;
    gap: 6px !important;
}

.lot-row input {
    height: 40px !important;
    font-size: 16px !important; /* Prevent iOS zoom */
    border-radius: 8px !important;
}

.remove-lot-btn {
    height: 40px !important;
    width: 40px !important;
    min-width: 40px;
}

/* ── Auth Modal — Native feel ──────────────────────────────── */
.auth-modal {
    margin: 0 !important;
    border-radius: 20px 20px 0 0 !important;
    padding: 20px 16px !important;
    max-height: 92vh !important;
    width: 100% !important;
    max-width: 100% !important;
    animation: slideUp 0.32s cubic-bezier(0.32, 0.72, 0, 1) !important;
}

.auth-modal::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: #d1d5db;
    border-radius: 2px;
    margin: 0 auto 12px;
}

.auth-input {
    height: 48px !important;
    font-size: 16px !important; /* Prevent iOS zoom */
    border-radius: 12px !important;
}

.auth-submit-btn {
    height: 48px !important;
    border-radius: 12px !important;
    font-size: 0.95rem !important;
}

.google-login-btn {
    height: 48px !important;
    border-radius: 12px !important;
}

/* ── Company Analysis — Mobile ─────────────────────────────── */
.ca-container {
    padding: 12px !important;
}

.ca-search-row {
    flex-wrap: wrap !important;
    gap: 8px !important;
}

.ca-search-row input {
    height: 44px !important;
    font-size: 16px !important;
    border-radius: 10px !important;
}

.ca-search-row .ca-search-btn {
    width: 100% !important;
    height: 44px !important;
    border-radius: 10px !important;
}

.ca-profile-main {
    flex-direction: column !important;
    gap: 12px !important;
}

.ca-stats-grid {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
}

.ca-stat-group {
    padding: 12px !important;
    border-radius: 12px !important;
}

.ca-charts-grid,
.ca-independent-charts {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
}

.ca-charts-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
}

.ca-period-toggle {
    width: 100%;
}

.ca-period-btn {
    flex: 1;
    text-align: center;
    min-height: 36px;
}

/* CA price filter — horizontal scroll */
.ca-price-filters {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap !important;
}

.ca-price-filter {
    min-height: 32px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Intrinsic Value Calculator — Mobile ───────────────────── */
.iv-search-card,
.iv-params-card {
    padding: 14px !important;
    border-radius: 14px !important;
}

.iv-search-row {
    flex-wrap: wrap !important;
    gap: 8px !important;
}

.iv-search-row input {
    height: 44px !important;
    font-size: 16px !important;
    border-radius: 10px !important;
}

.iv-load-btn {
    width: 100% !important;
    height: 44px !important;
    border-radius: 10px !important;
}

.iv-params-layout {
    flex-direction: column !important;
}

.iv-period-col {
    flex: none !important;
    padding-right: 0 !important;
    padding-bottom: 14px !important;
}

.iv-params-divider {
    width: 100% !important;
    height: 1px !important;
    margin: 0 0 14px !important;
}

.iv-assumptions-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
}

.iv-years-number {
    font-size: 2.4rem !important;
}

.iv-company-chips {
    gap: 6px !important;
    flex-wrap: wrap !important;
}

.iv-chip {
    min-width: 70px !important;
    padding: 6px 10px !important;
    font-size: 0.72rem !important;
}

/* Results grid */
.iv-results-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
}

.iv-result-card {
    padding: 14px !important;
    border-radius: 12px !important;
}

/* ── Wishlist — Full width cards ────────────────────────────── */
.wl-cards-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
}

.wl-card {
    padding: 14px !important;
    border-radius: 14px !important;
    border: none !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 0 0 0.5px rgba(0, 0, 0, 0.04) !important;
}

.wl-card:hover {
    transform: none !important;
}

.wl-card-logo {
    width: 40px !important;
    height: 40px !important;
}

.wl-card-name {
    max-width: 160px !important;
}

/* Wishlist form */
#wishlist-form {
    flex-direction: column !important;
    gap: 8px !important;
}

#wishlist-form input {
    height: 44px !important;
    font-size: 16px !important;
    border-radius: 10px !important;
}

#wishlist-form button {
    width: 100% !important;
    height: 44px !important;
    border-radius: 10px !important;
}

/* ── Crypto cards — Mobile ─────────────────────────────────── */
.crypto-card-header {
    flex-wrap: wrap !important;
}

.crypto-card-stats {
    grid-template-columns: 1fr 1fr !important;
}

.crypto-stat:nth-child(2) {
    border-right: none !important;
}

.crypto-stat:nth-child(1),
.crypto-stat:nth-child(2) {
    border-bottom: 1px solid var(--border-color) !important;
}

.crypto-card-price-block {
    align-items: flex-start !important;
    width: 100% !important;
}

/* ── Terms/Privacy Modal — Bottom sheet ────────────────────── */
.terms-modal-overlay {
    align-items: flex-end !important;
    padding: 0 !important;
}

.terms-modal {
    border-radius: 20px 20px 0 0 !important;
    max-height: 88vh !important;
    max-height: 88dvh !important;
    max-width: 100% !important;
    animation: slideUp 0.32s cubic-bezier(0.32, 0.72, 0, 1) !important;
}

/* ── Onboarding — Mobile ───────────────────────────────────── */
.ob-card {
    width: min(96vw, 360px) !important;
    border-radius: 12px !important;
}

.ob-visual {
    height: 120px !important;
    padding: 10px 18px 0 !important;
}

/* ── Animations ────────────────────────────────────────────── */
@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0.5;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ── Utility: Safe-area aware spacing ──────────────────────── */
.view-container {
    padding-bottom: 16px;
}

/* ── Mobile Settings Panel (replaces sidebar settings) ─────── */
.mobile-settings-panel {
    display: none;
    position: fixed;
    bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    left: 0;
    right: 0;
    z-index: 9998;
    background: var(--white);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.1);
    padding: 20px 16px calc(8px + env(safe-area-inset-bottom, 0px));
    animation: slideUp 0.28s cubic-bezier(0.32, 0.72, 0, 1);
    max-height: 60vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-settings-panel.open {
    display: block;
}

.mobile-settings-panel::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: #d1d5db;
    border-radius: 2px;
    margin: 0 auto 16px;
}

.mobile-settings-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9997;
    background: rgba(0, 0, 0, 0.3);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

.mobile-settings-overlay.open {
    display: block;
    animation: fadeIn 0.2s ease;
}

.mobile-settings-section {
    margin-bottom: 16px;
}

.mobile-settings-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: #8e8e93;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
    padding: 0 4px;
}

.mobile-settings-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    background: #f5f5f7;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-color);
    cursor: pointer;
    margin-bottom: 6px;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s ease;
    min-height: 48px;
}

.mobile-settings-btn:active {
    background: #e8e8ed;
}

.mobile-settings-btn svg {
    width: 20px;
    height: 20px;
    color: #636366;
    flex-shrink: 0;
}

.mobile-settings-btn .ms-btn-label {
    flex: 1;
    text-align: left;
}

.mobile-settings-btn .ms-btn-value {
    font-size: 0.82rem;
    color: #8e8e93;
}

.mobile-settings-btn .ms-btn-chevron {
    color: #c7c7cc;
}

/* Auth button in settings */
.mobile-settings-auth {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px;
    background: #4f46e5;
    color: white;
    border: none;
    border-radius: 14px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    justify-content: center;
    min-height: 48px;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s ease;
}

.mobile-settings-auth:active {
    background: #4338ca;
}

/* ── Small phones (< 480px) — Extra compact ────────────────── */
@media (max-width: 480px) {
    .page-hero-title { font-size: 1.15rem !important; }
    .page-hero-subtitle { font-size: 0.7rem !important; }

    .donut-canvas-wrap {
        min-height: 300px !important;
        height: 300px !important;
    }

    .chart-canvas-wrap { height: 240px !important; }

    /* Also hide Mkt Value (5th col) on very small screens */
    #portfolio-table th:nth-child(5),
    #portfolio-table td:nth-child(5) {
        display: none !important;
    }

    .kpi-item { flex: 1 1 100% !important; }

    .ca-stats-grid { grid-template-columns: 1fr !important; }

    .container { padding: 0 8px !important; }
}

/* ── Landscape mode optimization ───────────────────────────── */
@media (max-height: 500px) and (orientation: landscape) {
    .page-hero {
        padding: 8px 16px !important;
        position: static;
    }

    .mobile-bottom-nav {
        height: 52px;
    }

    .mobile-nav-item span:last-child {
        display: none;
    }

    .chart-canvas-wrap { height: 200px !important; }
    .donut-canvas-wrap { min-height: 260px !important; height: 260px !important; }

    .modal-content,
    .pro-modal-content {
        max-height: 100vh !important;
    }
}
