/* ================================================================
   SHEILA CONSULTANCY OPS v5.0 — Mobile Responsive Styles
   Mobile-only styles added via media queries.
   Desktop styles are NOT affected.
   ================================================================ */

/* ================================================================
   BREAKPOINTS USED:
   max-width: 1024px — Tablets (landscape + portrait)
   max-width: 768px  — Mobile / small tablets
   max-width: 480px  — Small phones
   max-width: 360px  — Very small phones
   ================================================================ */

/* ── TABLET (≤1024px) ──────────────────────────────────────────── */
@media (max-width: 1024px) {

  /* Slightly reduce sidebar width on tablet */
  :root {
    --sidebar-w: 220px;
  }

  /* Top nav search shrinks */
  .top-search-wrap {
    max-width: 220px;
  }

  /* Grid layouts collapse to 2 cols on tablets */
  .grid-3 { grid-template-columns: repeat(2, 1fr) !important; }
  .grid-4 { grid-template-columns: repeat(2, 1fr) !important; }

  /* Stat grid: 3 cols max on tablet */
  .stat-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }

  /* Filter bars wrap nicely */
  .filter-bar {
    flex-wrap: wrap;
  }

  /* Chart grid goes single column */
  .chart-grid-2 {
    grid-template-columns: 1fr !important;
  }

  /* Page content padding */
  .page-content {
    padding: 20px;
  }

  /* Live clock hidden on smaller tablets */
  #liveClock {
    display: none;
  }
}


/* ── MOBILE (≤768px) ───────────────────────────────────────────── */
@media (max-width: 768px) {

  /* ── Prevent horizontal scroll on body ── */
  html, body {
    overflow-x: hidden;
    max-width: 100vw;
  }

  /* ── App wrapper ── */
  .app-wrapper {
    flex-direction: column;
  }

  /* ════════════════════════════════════════
     SIDEBAR — slide-in overlay on mobile
  ════════════════════════════════════════ */
  .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: var(--sidebar-w, 248px) !important;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4,0,0.2,1) !important;
    z-index: 300 !important;
    /* Override collapsed state on mobile — always show full sidebar when open */
    backdrop-filter: blur(28px) saturate(170%) !important;
    -webkit-backdrop-filter: blur(28px) saturate(170%) !important;
  }

  /* When sidebar is open on mobile */
  .sidebar.mobile-open {
    transform: translateX(0) !important;
  }

  /* Collapsed sidebar on mobile still slides off screen */
  .sidebar.collapsed {
    width: var(--sidebar-w, 248px) !important;
  }

  /* Fully-hidden stays fully hidden */
  .sidebar.fully-hidden {
    transform: translateX(-100%) !important;
    width: 0 !important;
  }

  /* Mobile overlay (backdrop when sidebar is open) */
  .mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 299;
    cursor: pointer;
  }

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

  /* ════════════════════════════════════════
     MAIN CONTENT — full width on mobile
  ════════════════════════════════════════ */
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    min-width: 0;
  }

  .main-content.sidebar-collapsed {
    margin-left: 0 !important;
  }

  .main-content.sidebar-fully-hidden {
    margin-left: 0 !important;
  }

  /* ════════════════════════════════════════
     TOP NAV
  ════════════════════════════════════════ */
  .top-nav {
    padding: 0 12px !important;
    gap: 8px !important;
    height: 56px !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 200 !important;
  }

  /* Search bar in top nav — shrink on mobile */
  .top-search-wrap {
    flex: 1 !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  .top-search-wrap input {
    font-size: 13px;
    height: 34px;
  }

  /* Live clock — hide on mobile */
  #liveClock {
    display: none !important;
  }

  /* Theme pill — hide on mobile (accessible via profile/settings) */
  .theme-pill {
    display: none !important;
  }

  /* Breadcrumb — truncate on mobile */
  .breadcrumb {
    font-size: 12px;
    max-width: 150px;
    overflow: hidden;
  }

  .breadcrumb .bc-item {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100px;
  }

  /* Icon buttons in top nav — keep but slightly smaller */
  .icon-btn {
    width: 34px !important;
    height: 34px !important;
  }

  /* Nav user — hide text, keep avatar */
  .nav-user .nav-user-info,
  .nav-user span {
    display: none !important;
  }

  .nav-user {
    padding: 4px 6px !important;
    gap: 0 !important;
  }

  /* Notification dropdown — full width on mobile */
  .notif-dropdown {
    position: fixed !important;
    top: 56px !important;
    right: 8px !important;
    left: 8px !important;
    width: auto !important;
    max-width: none !important;
  }

  /* User dropdown — full width on mobile */
  .user-dd {
    position: fixed !important;
    top: 56px !important;
    right: 8px !important;
    left: auto !important;
    width: 240px !important;
  }

  /* ════════════════════════════════════════
     PAGE CONTENT
  ════════════════════════════════════════ */
  .page-content {
    padding: 12px !important;
  }

  /* ════════════════════════════════════════
     SECTION HEADER
  ════════════════════════════════════════ */
  .section-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
    margin-bottom: 16px !important;
  }

  .section-header h2 {
    font-size: 18px !important;
  }

  .section-header p {
    font-size: 12px !important;
  }

  .section-header .actions {
    width: 100% !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
  }

  .section-header .actions .btn {
    flex: 1 1 auto;
    min-width: 120px;
    justify-content: center;
    text-align: center;
  }

  /* ════════════════════════════════════════
     STAT GRID / KPI CARDS
  ════════════════════════════════════════ */
  .stat-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    margin-bottom: 16px !important;
  }

  /* Override inline grid-template-columns on stat-grid */
  .stat-grid[style*="grid-template-columns"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .stat-card {
    padding: 14px !important;
    gap: 10px !important;
  }

  .stat-icon {
    width: 38px !important;
    height: 38px !important;
    font-size: 16px !important;
  }

  .stat-value {
    font-size: 20px !important;
  }

  .stat-label {
    font-size: 10px !important;
  }

  /* ════════════════════════════════════════
     GRID LAYOUTS
  ════════════════════════════════════════ */
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .chart-grid-2 {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* ════════════════════════════════════════
     CARDS
  ════════════════════════════════════════ */
  .card {
    padding: 14px !important;
  }

  .card-header {
    margin-bottom: 12px !important;
  }

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

  /* ════════════════════════════════════════
     TABLES — horizontal scroll
  ════════════════════════════════════════ */
  .table-responsive {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-lg);
  }

  /* Ensure table doesn't squeeze on mobile — scroll instead */
  .data-table {
    min-width: 600px;
    font-size: 12px !important;
  }

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

  .data-table td {
    padding: 9px 10px !important;
    font-size: 12px !important;
  }

  /* Action buttons in table cells */
  .td-actions {
    flex-wrap: nowrap !important;
    gap: 3px !important;
  }

  .btn-xs {
    padding: 3px 6px !important;
    font-size: 10px !important;
  }

  /* ════════════════════════════════════════
     FORMS
  ════════════════════════════════════════ */

  /* Form rows go single column on mobile */
  .form-row {
    grid-template-columns: 1fr !important;
    gap: 0 !important;
  }

  .form-control {
    font-size: 16px !important; /* Prevents iOS auto-zoom */
    padding: 10px 13px !important;
    min-height: 44px; /* Touch target */
  }

  /* Select */
  select.form-control {
    min-height: 44px;
  }

  /* Textarea */
  textarea.form-control {
    font-size: 16px !important;
    min-height: 80px;
  }

  .form-group {
    margin-bottom: 14px !important;
  }

  /* Inline form layouts wrap on mobile */
  .filter-bar {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  .filter-bar .form-control {
    min-width: 0 !important;
    flex: 1 !important;
  }

  .filter-bar .btn {
    height: 44px !important;
    min-height: 44px;
  }

  .search-input-wrap,
  .search-wrap {
    max-width: 100% !important;
    min-width: 0 !important;
    flex: 1 !important;
  }

  /* ════════════════════════════════════════
     BUTTONS — touch-friendly
  ════════════════════════════════════════ */
  .btn {
    min-height: 38px;
    padding: 8px 14px !important;
    font-size: 13px !important;
    touch-action: manipulation;
  }

  .btn-sm {
    min-height: 34px;
    padding: 6px 10px !important;
    font-size: 11px !important;
  }

  .btn-lg {
    min-height: 48px;
    padding: 12px 20px !important;
    font-size: 14px !important;
  }

  /* ════════════════════════════════════════
     MODALS — full width on mobile
  ════════════════════════════════════════ */
  .modal-overlay {
    padding: 12px !important;
    align-items: flex-end !important; /* Sheet from bottom feel */
  }

  .modal {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 92vh !important;
    border-radius: 20px 20px 12px 12px !important;
    padding: 20px 16px 24px !important;
    overflow-y: auto !important;
  }

  /* Sheet handle visual cue */
  .modal::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: var(--border-strong);
    border-radius: 2px;
    margin: 0 auto 16px;
  }

  .modal-lg,
  .modal-xl {
    max-width: 100% !important;
  }

  .modal-header {
    margin-bottom: 14px !important;
    padding-bottom: 12px !important;
  }

  .modal-header h2,
  .modal-header h3 {
    font-size: 15px !important;
  }

  .modal-footer {
    flex-direction: column !important;
    gap: 8px !important;
    margin-top: 14px !important;
  }

  .modal-footer .btn {
    width: 100% !important;
    justify-content: center;
  }

  /* ════════════════════════════════════════
     TABS
  ════════════════════════════════════════ */
  .tabs {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* hide scrollbar but keep scrolling */
    flex-wrap: nowrap !important;
    gap: 0 !important;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .tab-btn {
    font-size: 12px !important;
    padding: 8px 12px !important;
    white-space: nowrap !important;
    flex-shrink: 0;
    min-height: 40px;
  }

  /* ════════════════════════════════════════
     TOAST NOTIFICATIONS — better mobile positioning
  ════════════════════════════════════════ */
  .toast-container {
    bottom: 16px !important;
    right: 12px !important;
    left: 12px !important;
    align-items: stretch;
  }

  .toast {
    max-width: 100% !important;
    width: 100%;
  }

  /* ════════════════════════════════════════
     FILTER BAR — stack on mobile
  ════════════════════════════════════════ */
  .card:has(.filter-bar) {
    padding: 12px !important;
  }

  /* ════════════════════════════════════════
     PAGINATION
  ════════════════════════════════════════ */
  .pagination {
    justify-content: center;
    gap: 4px;
  }

  .page-btn {
    min-width: 36px !important;
    height: 36px !important;
    font-size: 12px !important;
  }

  /* ════════════════════════════════════════
     WORKLOAD BAR (Dashboard)
  ════════════════════════════════════════ */
  .workload-bar {
    flex-wrap: wrap;
    gap: 6px;
  }

  .workload-writer {
    width: 100% !important;
    min-width: 0;
  }

  /* ════════════════════════════════════════
     QUICK ACTIONS GRID
  ════════════════════════════════════════ */
  .quick-action-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
  }

  .quick-action-btn {
    padding: 14px 8px !important;
    gap: 7px !important;
  }

  .quick-action-btn i {
    font-size: 18px !important;
  }

  .quick-action-btn span {
    font-size: 10.5px !important;
  }

  /* ════════════════════════════════════════
     CLIENT HERO (client-view.php)
  ════════════════════════════════════════ */
  .client-hero {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 14px !important;
  }

  .client-name {
    font-size: 18px !important;
  }

  .client-info-row {
    gap: 8px !important;
  }

  /* ════════════════════════════════════════
     INFO ROW (client-view, profile, etc.)
  ════════════════════════════════════════ */
  .info-row {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 3px !important;
    padding: 8px 0 !important;
  }

  .info-row-value {
    text-align: left !important;
    font-size: 13px !important;
  }

  /* ════════════════════════════════════════
     KANBAN BOARD
  ════════════════════════════════════════ */
  .kanban-board {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    overflow-x: visible !important;
  }

  /* ════════════════════════════════════════
     COLLECTION FORM (payment_collection.php)
  ════════════════════════════════════════ */
  .collection-form {
    padding: 16px !important;
  }

  /* Payment method radio grid */
  .method-radio-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  /* ════════════════════════════════════════
     INVOICE PAGE
  ════════════════════════════════════════ */
  /* Invoice header flex layout */
  [style*="display:grid"][style*="grid-template-columns:1fr 1fr"],
  [style*="display: grid"][style*="grid-template-columns: 1fr 1fr"] {
    display: block !important;
  }

  /* Invoice total rows */
  [style*="display:flex"][style*="gap:40px"],
  [style*="display: flex"][style*="gap: 40px"] {
    gap: 16px !important;
  }

  /* ════════════════════════════════════════
     DASHBOARD SPECIFIC INLINE STYLES
  ════════════════════════════════════════ */

  /* Recent projects grid (inline style override) */
  .card-body [style*="grid-template-columns"],
  .card [style*="grid-template-columns:repeat(auto-fill"] {
    display: block !important;
  }

  .card-body [style*="grid-template-columns"] > *,
  .card [style*="grid-template-columns:repeat(auto-fill"] > * {
    margin-bottom: 10px;
  }

  /* Dashboard card body flex rows with gap */
  .card-body[style*="display:flex"],
  .card-body[style*="display: flex"] {
    flex-wrap: wrap !important;
  }

  /* ════════════════════════════════════════
     PROFILE PAGE
  ════════════════════════════════════════ */
  .profile-cover {
    height: 100px !important;
  }

  .profile-avatar {
    width: 64px !important;
    height: 64px !important;
    font-size: 22px !important;
  }

  .profile-avatar-wrap {
    bottom: -20px !important;
    left: 16px !important;
  }

  /* ════════════════════════════════════════
     ANALYTICS PAGE
  ════════════════════════════════════════ */
  .metric-ring {
    width: 72px !important;
    height: 72px !important;
  }

  .metric-ring-value {
    font-size: 15px !important;
  }

  /* ════════════════════════════════════════
     ALERTS
  ════════════════════════════════════════ */
  .alert {
    font-size: 12px !important;
    padding: 10px 12px !important;
  }

  /* ════════════════════════════════════════
     EMPTY STATE
  ════════════════════════════════════════ */
  .empty-state {
    padding: 32px 16px !important;
  }

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

  /* ════════════════════════════════════════
     ROLE CALLOUT
  ════════════════════════════════════════ */
  .role-callout {
    flex-direction: column !important;
    gap: 8px !important;
    padding: 12px !important;
  }

  /* ════════════════════════════════════════
     TIMELINE
  ════════════════════════════════════════ */
  .timeline-header {
    flex-direction: column !important;
    gap: 4px !important;
  }

  .timeline-time {
    margin-left: 0 !important;
  }

  /* ════════════════════════════════════════
     REPORTS — filter layout
  ════════════════════════════════════════ */
  .reports-filter-row,
  [style*="display:flex"][style*="gap:12px"] {
    flex-wrap: wrap !important;
  }

  /* ════════════════════════════════════════
     MESSAGING PAGE
  ════════════════════════════════════════ */
  .messaging-layout,
  [style*="display:grid"][style*="grid-template-columns:300px"] {
    grid-template-columns: 1fr !important;
    display: block !important;
  }

  /* ════════════════════════════════════════
     SETTINGS PAGE — toggle rows
  ════════════════════════════════════════ */
  .settings-row,
  [style*="display:flex"][style*="justify-content:space-between"] {
    flex-wrap: wrap !important;
  }

  /* ════════════════════════════════════════
     UTILITY: Show/Hide on mobile
  ════════════════════════════════════════ */
  .hide-mobile {
    display: none !important;
  }

  .show-mobile {
    display: block !important;
  }

  /* ════════════════════════════════════════
     TOUCH TARGETS — all interactive elements
  ════════════════════════════════════════ */
  .nav-item {
    min-height: 44px !important;
    padding: 11px 10px !important;
  }

  .dropdown-item {
    min-height: 44px !important;
    padding: 12px 14px !important;
  }

  a, button {
    touch-action: manipulation;
  }

  /* ════════════════════════════════════════
     SIDEBAR NAV (when open on mobile)
     — show full width sidebar with all labels
  ════════════════════════════════════════ */

  /* When sidebar is open on mobile, never collapse labels */
  .sidebar.mobile-open .nav-item span,
  .sidebar.mobile-open .nav-section-label {
    opacity: 1 !important;
    width: auto !important;
    margin: initial !important;
  }

  .sidebar.mobile-open .nav-item {
    justify-content: flex-start !important;
    padding: 11px 10px !important;
  }

  .sidebar.mobile-open .sidebar-user-info {
    opacity: 1 !important;
    width: auto !important;
  }

  .sidebar.mobile-open .logo-text {
    opacity: 1 !important;
    width: auto !important;
    transform: none !important;
    pointer-events: auto !important;
  }

  /* Sidebar collapse button hidden on mobile */
  .sidebar-collapse-btn {
    display: none !important;
  }
}


/* ── SMALL PHONES (≤480px) ─────────────────────────────────────── */
@media (max-width: 480px) {

  /* Stat grid — single column on small phones */
  .stat-grid {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  /* Stat value larger spacing */
  .stat-value {
    font-size: 22px !important;
  }

  /* Section header h2 */
  .section-header h2 {
    font-size: 16px !important;
  }

  /* Page content tighter */
  .page-content {
    padding: 10px !important;
  }

  /* Top nav even more compact */
  .top-nav {
    padding: 0 10px !important;
    gap: 6px !important;
  }

  /* Breadcrumb minimal on very small screens */
  .breadcrumb .bc-item:not(.active) {
    display: none !important;
  }

  .breadcrumb i:not(:last-of-type) {
    display: none !important;
  }

  /* Button text in actions wrap */
  .section-header .actions .btn span,
  .section-header .actions .btn {
    font-size: 12px !important;
  }

  /* Card padding tighter */
  .card {
    padding: 12px !important;
  }

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

  .modal {
    border-radius: 20px 20px 0 0 !important;
    max-height: 95vh !important;
    padding: 16px 14px 20px !important;
  }

  /* Quick actions 2-col on small phones */
  .quick-action-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Filter bar: full width controls */
  .filter-bar > * {
    width: 100% !important;
    flex: 1 1 100% !important;
    min-width: 0 !important;
  }

  .filter-bar .btn {
    width: 100% !important;
  }

  /* Form controls */
  .form-control {
    font-size: 16px !important;
  }

  /* Notif dropdown full-width */
  .notif-dropdown {
    right: 0 !important;
    left: 0 !important;
    top: 56px !important;
    border-radius: 0 0 16px 16px !important;
  }

  /* Tables — always scroll */
  .table-responsive {
    border-radius: 10px;
  }

  .data-table {
    min-width: 500px;
    font-size: 11px !important;
  }

  .data-table th {
    font-size: 9px !important;
    padding: 7px 8px !important;
  }

  .data-table td {
    font-size: 11px !important;
    padding: 8px 8px !important;
  }

  /* Tabs font even smaller */
  .tab-btn {
    font-size: 11px !important;
    padding: 8px 10px !important;
  }

  /* Collection form */
  .collection-form {
    padding: 12px !important;
  }

  /* Pagination */
  .pagination {
    gap: 3px;
  }

  .page-btn {
    min-width: 32px !important;
    height: 32px !important;
    font-size: 11px !important;
  }

  /* Section header actions stack */
  .section-header .actions {
    flex-direction: column !important;
  }

  .section-header .actions .btn {
    width: 100% !important;
    justify-content: center !important;
  }

  /* User dropdown full width on small phones */
  .user-dd {
    right: 0 !important;
    left: 0 !important;
    width: 100% !important;
    border-radius: 0 0 16px 16px !important;
  }
}


/* ── VERY SMALL PHONES (≤360px) ────────────────────────────────── */
@media (max-width: 360px) {

  /* Absolute minimum font sizes */
  .page-content {
    padding: 8px !important;
  }

  .top-nav {
    padding: 0 8px !important;
    height: 52px !important;
  }

  .card {
    padding: 10px !important;
  }

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

  .stat-value {
    font-size: 20px !important;
  }

  .btn {
    padding: 8px 10px !important;
    font-size: 12px !important;
  }
}


/* ================================================================
   LOGIN PAGE — Mobile Specific
   ================================================================ */
@media (max-width: 768px) {

  /* Login page body — allow scroll on mobile */
  body.login-page-body {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    align-items: flex-start !important;
    padding: 16px !important;
    min-height: 100vh;
  }

  /* Hide brand panel (left side) on mobile — keep only login card */
  .brand-panel {
    display: none !important;
  }

  /* Login container — single column */
  .login-container {
    flex-direction: column !important;
    gap: 0 !important;
    justify-content: center !important;
    min-height: 100vh;
    padding: 20px 0 !important;
  }

  /* Login wrap full width */
  .login-wrap {
    width: 100% !important;
    max-width: 420px !important;
  }

  /* Login card — comfortable padding */
  .login-card {
    padding: 28px 20px 24px !important;
    border-radius: 20px !important;
  }

  /* Login form controls — base reset (for any non-icon inputs) */
  .login-card .form-control,
  .login-card input {
    font-size: 16px !important; /* Prevents iOS zoom */
    min-height: 44px !important;
  }

  /* ── FIX: Login input fields that have a left icon (.form-input inside .input-wrap)
     Must preserve left padding (44px) so the icon doesn't overlap typed text.
     Also ensures right padding for the password eye-button.
     Overrides the generic `padding: 10px 13px` above for these specific inputs. ── */
  .login-card .input-wrap .form-input {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    padding-left: 44px !important;  /* keeps space for left icon */
    padding-right: 44px !important; /* keeps space for eye-button */
    height: 46px !important;
    font-size: 16px !important;     /* Prevents iOS zoom */
    line-height: 46px;
  }

  /* Password field: only has right-side eye-button, left icon still needs room */
  .login-card .input-wrap .form-input[type="password"],
  .login-card .input-wrap .form-input[type="text"] {
    padding-left: 44px !important;
    padding-right: 44px !important;
  }

  /* Ensure the left icon is vertically centred and doesn't shift */
  .login-card .input-wrap .input-icon-left {
    left: 14px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    font-size: 14px !important;
    pointer-events: none !important;
    z-index: 2;
  }

  /* Ensure the eye-button stays on the right */
  .login-card .input-wrap .eye-btn {
    right: 12px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 2;
  }

  /* Submit button */
  .login-card .btn-primary,
  .login-card button[type="submit"] {
    width: 100% !important;
    min-height: 48px !important;
    font-size: 15px !important;
    justify-content: center !important;
  }
}

@media (max-width: 480px) {

  /* Login card even more compact on small phones */
  .login-card {
    padding: 24px 16px 20px !important;
    border-radius: 16px !important;
  }

  /* Logo on mobile */
  .login-logo-wrap img,
  .login-card .brand-logo-img {
    max-height: 60px !important;
  }

  /* Reinforce icon-safe padding on very small phones */
  .login-card .input-wrap .form-input {
    padding-left: 42px !important;
    padding-right: 42px !important;
    font-size: 16px !important;
  }

  .login-card .input-wrap .input-icon-left {
    left: 12px !important;
    font-size: 13px !important;
  }

  .login-card .input-wrap .eye-btn {
    right: 10px !important;
  }
}


/* ================================================================
   INVOICE PAGE — Mobile Print / View
   ================================================================ */
@media (max-width: 768px) {

  /* Invoice preview container */
  [style*="max-width:800px"] {
    max-width: 100% !important;
    margin: 0 !important;
  }

  /* Invoice header (gradient bar) — stack on mobile */
  [style*="background:linear-gradient"][style*="display:flex"] {
    flex-direction: column !important;
    gap: 16px !important;
    padding: 20px !important;
  }

  /* Invoice grid — stack */
  [style*="display:grid"][style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    display: block !important;
  }

  /* Invoice totals section */
  [style*="flex-direction:column"][style*="align-items:flex-end"] {
    align-items: flex-start !important;
  }

  [style*="display:flex"][style*="gap:40px"] {
    gap: 12px !important;
    justify-content: space-between !important;
    width: 100% !important;
  }

  /* Invoice action buttons */
  [style*="display:flex"][style*="justify-content:flex-end"] {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  [style*="display:flex"][style*="justify-content:flex-end"] .btn {
    width: 100% !important;
    justify-content: center !important;
  }

  /* Invoice input section */
  [style*="flex:1;min-width:260px"] {
    min-width: 0 !important;
    width: 100% !important;
  }
}


/* ================================================================
   DASHBOARD — Inline Style Overrides (Mobile only)
   ================================================================ */
@media (max-width: 768px) {

  /* Recent activity / project list flex rows */
  .card div[style*="display:flex"][style*="gap:28px"],
  .card div[style*="display:flex;align-items:center;gap:28px"] {
    flex-direction: column !important;
    gap: 12px !important;
    align-items: flex-start !important;
  }

  /* Dashboard sub-grids */
  .card div[style*="display:grid"][style*="minmax(250px"] {
    display: block !important;
  }

  .card div[style*="display:grid"][style*="minmax(250px"] > * {
    margin-bottom: 10px;
  }

  /* Dashboard section flex with gap:16px */
  div[style*="display:flex;align-items:center;gap:16px;flex-wrap:wrap"] {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  /* Donut chart legend layout */
  .card-body div[style*="display:flex;align-items:center;gap:28px"] {
    flex-direction: column !important;
    gap: 16px !important;
    align-items: center !important;
  }
}


/* ================================================================
   MESSAGING PAGE — Mobile Layout
   ================================================================ */
@media (max-width: 768px) {

  /* Two-panel layout collapses to single column */
  .messaging-layout {
    display: block !important;
  }

  /* Messaging 2-col layout (channels + messages) */
  div[style*="grid-template-columns:220px 1fr"],
  div[style*="grid-template-columns: 220px 1fr"] {
    grid-template-columns: 1fr !important;
    display: grid !important;
  }

  /* Message thread area */
  .message-panel {
    height: auto !important;
    max-height: 60vh;
  }

  /* Messaging: chat container height fix */
  div[style*="display:flex;flex-direction:column;height:600px"],
  div[style*="display: flex; flex-direction: column; height: 600px"] {
    height: auto !important;
    min-height: 400px !important;
  }

  /* Message list */
  .message-list {
    max-height: 400px !important;
    overflow-y: auto !important;
  }

  /* Message input at bottom */
  .message-input-area {
    position: sticky !important;
    bottom: 0 !important;
    background: var(--bg-surface) !important;
    padding: 8px !important;
  }

  /* Message send form */
  div[style*="display:flex;gap:10px;align-items:flex-end"],
  form[style*="display:flex;gap:10px"] {
    align-items: flex-end !important;
    gap: 6px !important;
  }
}


/* ================================================================
   TASKS / KANBAN — Mobile Layout
   ================================================================ */
@media (max-width: 768px) {

  /* Kanban horizontal scroll on small mobile */
  .kanban-board {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    overflow-x: visible !important;
  }

  /* Kanban column takes full width */
  .kanban-col {
    min-width: 0 !important;
    width: 100% !important;
  }

  .kanban-cards {
    padding: 8px !important;
  }

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


/* ================================================================
   ANALYTICS — Mobile Responsive Charts
   ================================================================ */
@media (max-width: 768px) {

  /* Chart containers — full width */
  .chart-container {
    min-height: 180px !important;
  }

  /* Analytics stat grids */
  .analytics-grid {
    display: block !important;
  }

  /* Analytics 2-col inline grid */
  div[style*="display:grid"][style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

/* ================================================================
   REPORTS — Mobile Responsive
   ================================================================ */
@media (max-width: 768px) {

  /* Reports 4-column stat grid */
  div[style*="grid-template-columns:repeat(4,1fr)"],
  div[style*="grid-template-columns: repeat(4, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 480px) {
  /* Reports 4-column stat grid — single col on small phones */
  div[style*="grid-template-columns:repeat(4,1fr)"],
  div[style*="grid-template-columns: repeat(4, 1fr)"] {
    grid-template-columns: 1fr !important;
  }
}

/* ================================================================
   PROJECT VIEW — Mobile Responsive
   ================================================================ */
@media (max-width: 768px) {

  /* Main 2fr/1fr project layout */
  div[style*="grid-template-columns:2fr 1fr"],
  div[style*="grid-template-columns: 2fr 1fr"] {
    grid-template-columns: 1fr !important;
    display: grid !important;
  }

  /* 1fr/1fr sub-grids in project view */
  div[style*="grid-template-columns:1fr 1fr"],
  div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
    display: grid !important;
  }
}

/* ================================================================
   CLIENT VIEW — Mobile Responsive
   ================================================================ */
@media (max-width: 768px) {

  /* Client view 4-column stats */
  /* Already handled by repeat(4,1fr) rule above, but add specific class */
  .client-stats-grid,
  div[style*="display:grid"][style*="repeat(4,1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 480px) {
  .client-stats-grid,
  div[style*="display:grid"][style*="repeat(4,1fr)"] {
    grid-template-columns: 1fr !important;
  }
}


/* ================================================================
   PAYMENT COLLECTION — Mobile Form
   ================================================================ */
@media (max-width: 768px) {

  /* Payment method grid (inline style override) */
  div[style*="display:grid"][style*="repeat(3"] {
    grid-template-columns: repeat(2, 1fr) !important;
    display: grid !important;
  }

  /* Project info panel 3-col grid */
  div[style*="display:grid"][style*="grid-template-columns:1fr 1fr 1fr"] {
    grid-template-columns: 1fr !important;
    display: grid !important;
  }

  /* Collection 2-col main grid */
  .collection-grid {
    grid-template-columns: 1fr !important;
  }

  /* Method radio labels */
  .method-radio-label {
    padding: 8px !important;
    font-size: 12px !important;
    min-height: 44px;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
}


/* ================================================================
   SEARCH RESULTS DROPDOWN — Mobile
   ================================================================ */
@media (max-width: 768px) {

  #searchResultsDrop {
    position: fixed !important;
    top: 56px !important;
    left: 8px !important;
    right: 8px !important;
    max-height: 50vh !important;
    z-index: 600 !important;
  }

  .search-result-item {
    padding: 12px 12px !important;
    min-height: 48px;
  }
}


/* ================================================================
   NOTIFICATIONS PAGE
   ================================================================ */
@media (max-width: 768px) {

  /* Notification items */
  .notif-item {
    padding: 10px 12px !important;
  }

  /* Notification icon */
  .notif-icon {
    width: 28px !important;
    height: 28px !important;
    font-size: 12px !important;
  }
}


/* ================================================================
   PRINT — Ensure invoice prints correctly even on mobile
   ================================================================ */
@media print {

  .sidebar,
  .top-nav,
  .mobile-overlay,
  .no-print,
  .toast-container,
  .notif-dropdown,
  .user-dd {
    display: none !important;
  }

  .main-content {
    margin-left: 0 !important;
  }

  .page-content {
    padding: 0 !important;
  }

  .card {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    backdrop-filter: none !important;
  }

  body {
    background: white !important;
    color: black !important;
  }
}
