/* ══════════════════════════════════════════════════════════════════════════════
   PlanPulse Mobile Enhancements v1.0
   - Touch targets (Apple HIG 44px / Material Design 48dp)
   - iOS input zoom prevention (font-size >= 16px)
   - Safe area insets (notched devices)
   - Accessibility: prefers-reduced-motion, focus-visible, contrast
   - Bottom navigation bar for mobile
   - Z-index normalization
   ══════════════════════════════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════════════════════════════════
   PHASE 1 — P0 CRITICAL
   ══════════════════════════════════════════════════════════════════════════════ */

/* ──────────────────────────────────────────────────────────────────────────────
   1.1 Touch Targets — Minimum 44×44px (Apple HIG)
   ────────────────────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  /* Topbar icon buttons */
  .pp-icon-btn {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Generic icon-only buttons */
  .pp-btn-icon {
    min-width: 44px;
    min-height: 44px;
  }

  /* Pagination buttons */
  .pp-page-btn {
    min-width: 44px;
    height: 44px;
  }

  /* Language toggle buttons */
  .pp-seg-btn {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Dropdown items — comfortable tap targets */
  .pp-dropdown .dropdown-item {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  /* Small buttons — enforce minimum touch area */
  .pp-btn-sm {
    min-height: 44px;
    padding: 10px 16px;
  }

  /* Focus timer control buttons */
  #globalFocusReset,
  #globalFocusSkip {
    width: 44px !important;
    height: 44px !important;
  }

  /* Calendar nav buttons */
  .calendar-nav-btn {
    min-width: 44px;
    min-height: 44px;
  }

  /* Color swatches in forms */
  .color-swatch,
  .color-option {
    min-width: 44px;
    min-height: 44px;
  }

  /* Canvas item action buttons */
  .canvas-item-action,
  .btn-comment-item {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Sidebar nav links */
  .pp-nav-link {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  /* Close buttons */
  .btn-close {
    min-width: 44px;
    min-height: 44px;
  }

  /* Toast close */
  .pp-toast-close {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* ──────────────────────────────────────────────────────────────────────────────
   1.2 iOS Input Zoom Prevention — font-size >= 16px on inputs
   ────────────────────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
  textarea,
  select,
  .form-control,
  .form-select,
  .pp-form-input,
  .mw-input,
  [contenteditable="true"] {
    font-size: 16px !important;
  }
}

/* ──────────────────────────────────────────────────────────────────────────────
   1.3 Safe Area Insets — Notched/Dynamic Island devices
   ────────────────────────────────────────────────────────────────────────────── */

/* Topbar: respect top safe area */
.pp-topbar {
  padding-top: env(safe-area-inset-top);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* Toast container: avoid Dynamic Island */
.pp-toast-container {
  top: calc(80px + env(safe-area-inset-top));
}

/* Offcanvas sidebar */
.pp-offcanvas.offcanvas-start {
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  z-index: 1045;
  max-width: 280px;
}

/* Fixed positioned FABs */
@media (max-width: 768px) {
  .add-event-btn,
  [style*="position: fixed"][style*="bottom"] {
    bottom: calc(2rem + env(safe-area-inset-bottom)) !important;
  }
}

/* Error banner */
.pp-global-error-banner {
  padding-top: calc(12px + env(safe-area-inset-top));
}

/* Main content bottom padding for bottom nav */
@media (max-width: 767.98px) {
  .pp-main {
    padding-bottom: calc(60px + env(safe-area-inset-bottom)) !important;
  }
}


/* ══════════════════════════════════════════════════════════════════════════════
   PHASE 2 — P1 HIGH PRIORITY
   ══════════════════════════════════════════════════════════════════════════════ */

/* ──────────────────────────────────────────────────────────────────────────────
   2.1 Accessibility — prefers-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;
  }
}

/* ──────────────────────────────────────────────────────────────────────────────
   2.2 Z-Index Normalization
   ────────────────────────────────────────────────────────────────────────────── */

/* Layer system (from low to high):
   - Content:        1-100
   - Sticky/Topbar:  1000
   - Sidebar:        1040
   - Modal backdrop: 1050
   - Modal:          1055
   - Comments panel: 1060
   - Toast:          1080
   - Loading overlay: 1090
   - Error banner:   9999
*/

.pp-toast-container {
  z-index: 1080;
}

.pp-ai-modal {
  z-index: 1055;
}

.pp-loading-overlay {
  z-index: 1090;
}

/* ──────────────────────────────────────────────────────────────────────────────
   2.3 Bottom Navigation Bar — Mobile Only (Polished v2.0)
   ────────────────────────────────────────────────────────────────────────────── */

.pp-bottom-nav {
  display: none; /* Hidden on desktop */
}

@media (max-width: 767.98px) {
  .pp-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1040;
    background: rgba(255, 255, 255, 0.92);
    border-top: 1px solid var(--pp-border, #E2E8F0);
    height: 64px;
    padding: 0 8px;
    padding-bottom: env(safe-area-inset-bottom);
    align-items: center;
    justify-content: space-around;
    gap: 2px;
    box-shadow: 0 -1px 0 rgba(0,0,0,0.04), 0 -4px 20px rgba(0,0,0,0.06);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
  }

  .pp-bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 60px;
    min-height: 44px;
    padding: 6px 10px;
    text-decoration: none;
    color: var(--pp-muted, #64748B);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.01em;
    border-radius: 14px;
    border: none;
    background: transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    user-select: none;
    -webkit-user-select: none;
  }

  .pp-bottom-nav-item svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    fill: currentColor;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .pp-bottom-nav-item.active {
    color: var(--pp-accent, #2563EB);
    background: var(--pp-accent-soft, rgba(37, 99, 235, 0.08));
  }

  .pp-bottom-nav-item.active svg {
    transform: scale(1.1);
  }

  /* Active glow bar at top of nav item instead of tiny dot */
  .pp-bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--pp-accent, #2563EB);
  }

  /* Haptic press feedback */
  .pp-bottom-nav-item:active {
    transform: scale(0.92);
    transition: transform 0.1s ease;
  }

  /* Badge on bottom nav items */
  .pp-bottom-nav-item .pp-bottom-nav-badge {
    position: absolute;
    top: 4px;
    right: 50%;
    transform: translateX(14px);
    min-width: 16px;
    height: 16px;
    border-radius: 999px;
    background: #EF4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    padding: 0 5px;
  }
}

/* Dark mode bottom nav */
[data-theme="dark"] .pp-bottom-nav {
  background: rgba(30, 41, 59, 0.94);
  border-top-color: var(--pp-border, #334155);
  box-shadow: 0 -1px 0 rgba(255,255,255,0.04), 0 -4px 20px rgba(0,0,0,0.3);
}

[data-theme="dark"] .pp-bottom-nav-item.active {
  background: rgba(37, 99, 235, 0.14);
}

/* ──────────────────────────────────────────────────────────────────────────────
   2.4 Color Contrast Enhancement — Small Text
   ────────────────────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  /* Enforce higher contrast for small text (< 14px) */
  .text-muted.small,
  .text-muted.text-sm,
  small.text-muted,
  .mw-grid-label,
  .focus-stat-label,
  .pp-progress-labels {
    color: var(--pp-gray-700, #334155) !important;
  }

  [data-theme="dark"] .text-muted.small,
  [data-theme="dark"] .text-muted.text-sm,
  [data-theme="dark"] small.text-muted,
  [data-theme="dark"] .mw-grid-label,
  [data-theme="dark"] .focus-stat-label,
  [data-theme="dark"] .pp-progress-labels {
    color: var(--pp-gray-300, #CBD5E1) !important;
  }
}


/* ══════════════════════════════════════════════════════════════════════════════
   PHASE 3 — P2 MEDIUM PRIORITY
   ══════════════════════════════════════════════════════════════════════════════ */

/* ──────────────────────────────────────────────────────────────────────────────
   3.1 Focus Visible Indicators
   ────────────────────────────────────────────────────────────────────────────── */

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--pp-accent, #2563EB);
  outline-offset: 2px;
}

/* Remove default outline only when focus-visible is supported */
button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
  outline: none;
}

/* ──────────────────────────────────────────────────────────────────────────────
   3.2 Hardcoded Width Fixes
   ────────────────────────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .canvas-name-input {
    width: 100% !important;
    max-width: 100% !important;
  }

  .pp-table-search {
    min-width: unset !important;
    width: 100% !important;
  }
}

/* ──────────────────────────────────────────────────────────────────────────────
   3.3 Smooth Scrolling — iOS Momentum
   ────────────────────────────────────────────────────────────────────────────── */

.modal-body,
.offcanvas-body,
.comments-list,
.search-results,
#calWeekBody {
  -webkit-overflow-scrolling: touch;
}

/* ──────────────────────────────────────────────────────────────────────────────
   3.4 Topbar Logo — Mobile Optimization
   ────────────────────────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .pp-navbar-logo-img {
    height: 32px !important;
    max-width: 140px !important;
  }

  .pp-navbar-logo {
    position: static !important;
    left: auto !important;
  }
}

@media (min-width: 481px) and (max-width: 768px) {
  .pp-navbar-logo-img {
    height: 36px !important;
    max-width: 160px !important;
  }
}

/* ──────────────────────────────────────────────────────────────────────────────
   3.5 Notification Dropdown — Mobile Full Width
   ────────────────────────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .pp-notification-dropdown {
    width: calc(100vw - 32px) !important;
    max-width: none !important;
    position: fixed !important;
    left: 16px !important;
    right: 16px !important;
    top: 56px !important;
  }

  .pp-focus-timer-dropdown {
    width: calc(100vw - 32px) !important;
    max-width: none !important;
    position: fixed !important;
    left: 16px !important;
    right: 16px !important;
    top: 56px !important;
  }
}

/* ──────────────────────────────────────────────────────────────────────────────
   3.6 Scroll Snap for horizontal scrollable areas
   ────────────────────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .mw-grid,
  .page-actions {
    scroll-snap-type: x mandatory;
    scroll-padding: 0 16px;
  }

  .mw-grid > *,
  .page-actions > * {
    scroll-snap-align: start;
  }
}

/* ──────────────────────────────────────────────────────────────────────────────
   3.7 Business Model Canvas — Mobile Layout
   ────────────────────────────────────────────────────────────────────────────── */

/* -- Header: stack vertically on mobile -- */
@media (max-width: 768px) {
  .canvas-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px;
    padding: 12px !important;
  }

  .canvas-header > .d-flex {
    flex-wrap: wrap;
    gap: 8px;
  }

  .canvas-header .canvas-name-input {
    width: 100% !important;
    font-size: 16px !important;
    min-width: 0;
  }

  /* Meta row: wrap and scroll action buttons */
  .canvas-meta {
    flex-wrap: wrap !important;
    gap: 8px !important;
    justify-content: flex-start !important;
  }

  .canvas-meta .btn-group {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    display: flex !important;
    gap: 4px;
    padding-bottom: 4px;
  }

  .canvas-meta .btn-group .btn {
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 11px;
    padding: 6px 10px;
  }

  /* Grid: single column, full width blocks */
  .canvas-container {
    grid-template-columns: 1fr !important;
    grid-template-rows: none !important;
    gap: 12px !important;
    padding: 8px !important;
    min-height: auto !important;
  }

  .canvas-block {
    grid-column: 1 !important;
    grid-row: auto !important;
    min-height: 150px !important;
    width: 100% !important;
  }

  .canvas-block-header {
    padding: 10px 12px;
  }

  .canvas-block-title {
    font-size: 11px;
  }

  .canvas-block-content {
    padding: 10px;
    gap: 8px;
  }

  /* Sticky notes: always show actions (no hover on touch) */
  .canvas-item-actions {
    display: flex !important;
    opacity: 1 !important;
    gap: 6px;
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid rgba(0,0,0,0.06);
    justify-content: flex-end;
  }

  .canvas-item-action {
    width: 36px;
    height: 36px;
  }

  /* Modal: full width on mobile */
  .canvas-modal-content {
    max-width: calc(100vw - 24px) !important;
    margin: 12px;
    border-radius: 12px !important;
  }

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

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

  .canvas-modal-footer {
    padding: 12px 16px !important;
  }

  /* Color picker: touch-friendly */
  .color-option {
    width: 44px !important;
    height: 44px !important;
  }
}

/* Tablet: 2 columns instead of 4 */
@media (min-width: 769px) and (max-width: 1024px) {
  .canvas-container {
    grid-template-columns: repeat(2, 1fr) !important;
    grid-template-rows: auto !important;
    gap: 10px;
  }

  .canvas-block {
    grid-column: auto !important;
    grid-row: auto !important;
  }

  /* Cost/Revenue span full width */
  .canvas-block[data-block="cost_structure"],
  .canvas-block[data-block="revenue_streams"] {
    grid-column: span 1 !important;
  }

  .canvas-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px;
  }

  .canvas-meta {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
}

/* ──────────────────────────────────────────────────────────────────────────────
   3.8 KPI Table — Mobile: un-stick columns, shrink widths
   ────────────────────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  /* Remove min-width so table fits screen or scrolls nicely */
  .kpi-table {
    min-width: 600px !important;
  }

  /* Un-stick all columns — they eat up the entire viewport */
  .kpi-sticky-1,
  .kpi-sticky-2,
  .kpi-sticky-3 {
    position: static !important;
    left: auto !important;
  }

  /* Shrink fixed widths */
  .kpi-col-sparkline {
    width: 60px !important;
    min-width: 60px !important;
  }

  .kpi-col-title {
    width: 160px !important;
    min-width: 160px !important;
  }

  .kpi-col-target {
    width: 70px !important;
    min-width: 70px !important;
  }

  /* Input fields: wide enough to show numbers */
  .kpi-input {
    width: 100% !important;
    max-width: none !important;
    min-width: 70px !important;
    font-size: 14px !important;
    padding: 6px 8px !important;
    text-align: center;
  }

  /* Period columns: enforce minimum width so inputs are usable */
  .kpi-table td:not(.kpi-col-sparkline):not(.kpi-col-title):not(.kpi-col-target),
  .kpi-table th:not(.kpi-col-sparkline):not(.kpi-col-title):not(.kpi-col-target) {
    min-width: 90px !important;
  }

  .kpi-cell {
    min-height: 48px !important;
  }

  /* Toolbar: stack vertically */
  .indicators-toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }

  .indicators-toolbar .d-flex.gap-2 {
    flex-wrap: wrap !important;
  }

  /* Scroll hint — subtle shadow on right edge */
  .kpi-grid {
    position: relative;
  }

  .kpi-grid::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 20px;
    height: 100%;
    background: linear-gradient(to left, rgba(0,0,0,0.06), transparent);
    pointer-events: none;
    border-radius: 0 12px 12px 0;
  }

  /* KPI sub info: truncate */
  .kpi-sub-compact {
    font-size: 10px !important;
    flex-wrap: wrap;
  }

  .kpi-title {
    font-size: 13px !important;
  }

  /* Attainment bar */
  .kpi-attainment-bar-inline {
    max-width: 80px !important;
  }
}

/* ──────────────────────────────────────────────────────────────────────────────
   3.9 Print Styles — Hide mobile-only elements
   ────────────────────────────────────────────────────────────────────────────── */

@media print {
  .pp-bottom-nav {
    display: none !important;
  }
}

/* ══════════════════════════════════════════════════════════════════════════════
   PHASE 4 — MOBILE UX POLISH v2.0 (Professional Grade)
   ══════════════════════════════════════════════════════════════════════════════ */

/* ──────────────────────────────────────────────────────────────────────────────
   4.1 Tactile Feedback — Touch Press States (Global)
   ────────────────────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  /* Scale-down on press for all interactive elements */
  .pp-btn-v2:active,
  .btn:active:not(.pp-bottom-nav-item),
  .pp-nav-link:active,
  .pp-card-v2:active,
  .dropdown-item:active,
  .pp-seg-btn:active,
  .pp-user-btn:active,
  .pp-choice-btn:active,
  .pp-page-btn:active {
    transform: scale(0.97);
    transition: transform 0.1s ease;
  }

  @media (prefers-reduced-motion: reduce) {
    .pp-btn-v2:active,
    .btn:active,
    .pp-nav-link:active,
    .pp-card-v2:active,
    .dropdown-item:active {
      transform: none;
    }
  }

  /* Ripple surface for primary buttons */
  .pp-btn-primary,
  .btn-primary {
    position: relative;
    overflow: hidden;
  }

  /* Active background flash for touch targets */
  .pp-nav-link:active {
    background: rgba(0, 0, 0, 0.06);
  }
  [data-theme="dark"] .pp-nav-link:active {
    background: rgba(255, 255, 255, 0.06);
  }

  /* Card press: border flash */
  .pp-card-v2 {
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  }
  .pp-card-v2:active {
    border-color: var(--pp-accent, #2563EB);
    box-shadow: 0 0 0 2px var(--pp-accent-soft, rgba(37, 99, 235, 0.15));
  }

  /* Clickable table row press */
  tr[data-href]:active,
  .table-row-clickable:active {
    background: var(--pp-accent-soft, rgba(37, 99, 235, 0.06));
  }
}


/* ──────────────────────────────────────────────────────────────────────────────
   4.2 Topbar — Mobile Overflow Menu
   ────────────────────────────────────────────────────────────────────────────── */

.pp-topbar-overflow-toggle {
  display: none;
}

@media (max-width: 480px) {
  .pp-topbar .pp-theme-toggle,
  .pp-topbar .pp-seg,
  .pp-topbar #globalFocusTimerWidget,
  .pp-topbar [onclick*="ppOpenGuide"] {
    display: none !important;
  }

  .pp-topbar-overflow-toggle {
    display: inline-flex;
  }

  .pp-topbar-overflow-menu {
    min-width: 200px;
    border-radius: 16px;
    border: 1px solid var(--pp-border);
    box-shadow: var(--pp-shadow);
    padding: 6px;
    margin-top: 8px !important;
  }

  .pp-topbar-overflow-menu .dropdown-item {
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--pp-text);
    min-height: 44px;
  }

  .pp-topbar-overflow-menu .dropdown-item:hover {
    background: var(--pp-accent-soft);
  }

  .pp-topbar-overflow-menu .dropdown-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.7;
  }

  .pp-topbar-overflow-menu .dropdown-divider {
    margin: 4px 8px;
  }

  [data-theme="dark"] .pp-topbar-overflow-menu {
    background: #1E293B;
    border-color: #334155;
  }
}

@media (min-width: 481px) and (max-width: 640px) {
  .pp-topbar .pp-theme-toggle,
  .pp-topbar .pp-seg {
    display: none !important;
  }

  .pp-topbar-overflow-toggle {
    display: inline-flex;
  }
}


/* ──────────────────────────────────────────────────────────────────────────────
   4.3 Offcanvas Sidebar — Polished
   ────────────────────────────────────────────────────────────────────────────── */

@media (max-width: 767.98px) {
  .pp-offcanvas {
    border-right: none !important;
    border-radius: 0 20px 20px 0;
    box-shadow: 8px 0 40px rgba(0, 0, 0, 0.12);
  }

  .pp-offcanvas .offcanvas-body {
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  [data-theme="dark"] .pp-offcanvas .offcanvas-body {
    background: rgba(15, 23, 42, 0.97);
  }

  .pp-offcanvas .offcanvas-header {
    padding: 16px 16px 12px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--pp-border-2);
  }

  [data-theme="dark"] .pp-offcanvas .offcanvas-header {
    background: rgba(15, 23, 42, 0.97);
  }

  .pp-offcanvas .btn-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--pp-surface-2, #F1F5F9);
    opacity: 1;
    background-size: 16px;
    transition: background-color 0.15s;
  }

  .pp-offcanvas .btn-close:hover {
    background-color: var(--pp-border, #E2E8F0);
  }

  .offcanvas-backdrop {
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
  }
}


/* ──────────────────────────────────────────────────────────────────────────────
   4.4 Mobile Typography Scale
   ────────────────────────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  h1, .h1, .pp-page-title {
    font-size: 22px !important;
    line-height: 1.3;
  }

  h2, .h2 {
    font-size: 18px !important;
    line-height: 1.35;
  }

  h3, .h3 {
    font-size: 16px !important;
    line-height: 1.4;
  }

  h4, .h4 { font-size: 15px; }
  h5, .h5 { font-size: 14px; }
  h6, .h6 { font-size: 13px; }

  .pp-card-title-v2 {
    font-size: 16px;
  }

  .modal-title {
    font-size: 18px;
  }

  .dropdown-menu h6 {
    font-size: 14px;
  }
}


/* ──────────────────────────────────────────────────────────────────────────────
   4.5 Sticky Page Context Bar
   ────────────────────────────────────────────────────────────────────────────── */

@media (max-width: 767.98px) {
  .pp-page-context-bar {
    position: sticky;
    top: 56px;
    z-index: 1020;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    height: 44px;
    background: rgba(248, 250, 252, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--pp-border-2);
    font-size: 14px;
    font-weight: 600;
    color: var(--pp-text);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .pp-page-context-bar.pp-context-hidden {
    transform: translateY(-100%);
  }

  .pp-page-context-bar .pp-context-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.6;
  }

  .pp-page-context-bar .pp-context-badge {
    margin-left: auto;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--pp-accent-soft);
    color: var(--pp-accent);
  }

  [data-theme="dark"] .pp-page-context-bar {
    background: rgba(15, 23, 42, 0.92);
    border-bottom-color: rgba(51, 65, 85, 0.5);
  }
}


/* ──────────────────────────────────────────────────────────────────────────────
   4.6 Data Tables — Mobile Enhancements
   ────────────────────────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .table-responsive {
    position: relative;
  }

  .table-responsive::after {
    content: '';
    position: absolute;
    right: 0; top: 0; bottom: 0;
    width: 32px;
    background: linear-gradient(to right, transparent, rgba(248, 250, 252, 0.8));
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
  }

  .table-responsive.pp-table-scrollable::after {
    opacity: 1;
  }

  [data-theme="dark"] .table-responsive::after {
    background: linear-gradient(to right, transparent, rgba(15, 23, 42, 0.8));
  }

  .table td, .table th {
    padding: 10px 8px;
    font-size: 13px;
  }
}
