    * { margin: 0; padding: 0; box-sizing: border-box; }
    
    :root {
      --primary: #03a7f9;
      --primary-dark: #0288d1;
      --bg: #f0f2f5;
      --card: #ffffff;
      --text: #1a1a2e;
      --text-light: #6b7280;
      --shadow: 0 2px 12px rgba(0,0,0,0.08);
      --radius: 12px;
      --border-color: #e5e7eb;
      --input-bg: #f9fafb;
      --header-bg: #ffffff;
      --nav-bg: #ffffff;
      --modal-bg: #ffffff;
    }

    body {
      font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
      background: transparent;
      color: var(--text);
      -webkit-font-smoothing: antialiased;
      transition: background 0.3s, color 0.3s;
    }

    /* ===== GLOBAL BLUE BACKGROUND (same animated desktop background) ===== */
    html, body { min-height: 100%; }
    #mobileAppRoot, #mMainApp, #mPageContent { background: transparent; }

    /* The desktop stylesheet is disabled in mobile mode, so keep its background
       canvas and animated layers available here without changing their design. */
    #container {
      background: #00adef;
      background: -moz-linear-gradient(-45deg, #00adef 0%, #0076e5 100%);
      background: -webkit-linear-gradient(-45deg, #00adef 0%, #0076e5 100%);
      background: linear-gradient(135deg, #00adef 0%, #0076e5 100%);
      filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00adef', endColorstr='#0076e5',GradientType=1);
      position: fixed;
      top: 0;
      left: 0;
      width: 100vw;
      height: 100vh;
      height: 100dvh;
      margin: 0;
      padding: 0;
      z-index: 0;
      pointer-events: none;
      overflow: hidden;
    }

    body.dark #container {
      background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    }

    #container-inside {
      position: relative;
      width: 100%;
      height: 100%;
      display: flex;
      align-items: center;
      justify-content: center;
      margin: 0 auto;
      padding: 0;
    }

    #circle-small,
    #circle-medium,
    #circle-large,
    #circle-xlarge,
    #circle-xxlarge {
      position: absolute;
      background: #fff;
      border-radius: 50%;
      pointer-events: none;
      -webkit-animation: circle-small-scale 3s ease-in-out infinite alternate;
      animation: circle-small-scale 3s ease-in-out infinite alternate;
      animation-timing-function: cubic-bezier(0.6, 0, 0.4, 1);
    }

    #circle-small { animation-delay: 0s; top: 200px; left: -150px; width: 300px; height: 300px; opacity: 0.4; }
    #circle-medium { animation-delay: 0.3s; top: 50px; left: -300px; width: 600px; height: 600px; opacity: 0.3; }
    #circle-large { animation-delay: 0.6s; top: -100px; left: -450px; width: 900px; height: 900px; opacity: 0.2; }
    #circle-xlarge { animation-delay: 0.9s; top: -250px; left: -600px; width: 1200px; height: 1200px; opacity: 0.1; }
    #circle-xxlarge { animation-delay: 1.2s; top: -400px; left: -750px; width: 1500px; height: 1500px; opacity: 0.05; }

    @-webkit-keyframes circle-small-scale {
      0% { -webkit-transform: scale(1); }
      100% { -webkit-transform: scale(1.1); }
    }
    @keyframes circle-small-scale {
      0% { transform: scale(1); }
      100% { transform: scale(1.1); }
    }

    /* Login shell is transparent so the animated canvas is visible exactly behind it. */
    #mLoginScreen { background: transparent; position: relative; z-index: 1; }
    #mobileAppRoot, #mMainApp { position: relative; z-index: 1; }
    /* Keep the mobile application shell closed until login; prevents the app
       from remaining visible behind the login screen after logout. */
    #mMainApp { display: none; }
    #mMainApp.active { display: block; }


    body.dark {
      --bg: #0f0f1a;
      --card: #1a1a2e;
      --text: #f0f0f0;
      --text-light: #9ca3af;
      --border-color: #3d3d5c;
      --input-bg: #1a1a2e;
      --header-bg: #1a1a2e;
      --nav-bg: #1a1a2e;
      --modal-bg: #1a1a2e;
      --shadow: 0 2px 12px rgba(0,0,0,0.3);
    }
    
    body.dark .app-header,
    body.dark .bottom-nav,
    body.dark .search-bar,
    body.dark .list-item,
    body.dark .stat-card,
    body.dark .login-box,
    body.dark .modal-box {
      background: var(--card);
      color: var(--text);
      border-color: var(--border-color);
    }
    
    body.dark .search-bar input,
    body.dark .form-group input,
    body.dark .form-group select,
    body.dark .form-group textarea,
    body.dark .pdf-upload-area {
      background: var(--input-bg);
      color: var(--text);
      border-color: var(--border-color);
    }
    
    body.dark .search-bar input::placeholder {
      color: var(--text-light);
    }
    
    body.dark .filter-btn {
      background: var(--card);
      color: var(--text-light);
      border-color: var(--border-color);
    }
    
    body.dark .filter-btn.active {
      background: var(--primary);
      color: white;
      border-color: var(--primary);
    }
    
    body.dark .modal-overlay .modal-box {
      background: var(--modal-bg);
      color: var(--text);
    }
    
    body.dark .client-policy-list .policy-mini {
      background: var(--input-bg);
    }
    
    body.dark .pdf-status {
      background: #0a1a0a;
    }
    
    body.dark .toast-msg {
      background: #2d2d44;
    }
    
    body.dark .toast-msg.success { background: #065f46; }
    body.dark .toast-msg.error { background: #991b1b; }
    body.dark .toast-msg.warning { background: #92400e; }
    body.dark .toast-msg.info { background: #1e3a5f; }

    body.dark .bottom-nav .nav-item {
      color: var(--text-light);
    }
    
    body.dark .bottom-nav .nav-item.active {
      color: var(--primary);
    }
    
    body.dark .bottom-nav .fab-btn {
      background: var(--primary);
    }

    /* ===== LOGIN SCREEN ===== */
    #mLoginScreen {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: transparent;
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 9999;
      padding: 20px;
    }
    #mLoginScreen.hidden {
      display: none;
    }
    .login-box {
      background: white;
      border-radius: 20px;
      padding: 32px 24px;
      max-width: 380px;
      width: 100%;
      box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    }
    body.dark .login-box {
      background: var(--card);
      color: var(--text);
    }
    .login-box .logo {
      text-align: center;
      margin-bottom: 20px;
    }
    .login-box .logo img {
      max-height: 70px;
      width: auto;
    }
    .login-box h2 {
      font-size: 1.3rem;
      font-weight: 700;
      text-align: center;
      color: var(--text);
      margin-bottom: 4px;
    }
    .login-box p {
      text-align: center;
      color: var(--text-light);
      font-size: 0.85rem;
      margin-bottom: 20px;
    }
    .login-box input {
      width: 100%;
      padding: 12px 14px;
      border: 2px solid #e5e7eb;
      border-radius: 10px;
      font-size: 0.95rem;
      margin-bottom: 12px;
      transition: border 0.2s;
      background: #f9fafb;
    }
    body.dark .login-box input {
      background: var(--input-bg);
      color: var(--text);
      border-color: var(--border-color);
    }
    .login-box input:focus {
      outline: none;
      border-color: var(--primary);
      background: white;
    }
    body.dark .login-box input:focus {
      background: var(--input-bg);
    }
    .login-box .remember-row {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 16px;
      font-size: 0.85rem;
      color: var(--text-light);
    }
    .login-box .remember-row input[type="checkbox"] {
      width: 18px;
      height: 18px;
      margin: 0;
      cursor: pointer;
      accent-color: var(--primary);
    }
    .login-box .btn-login {
      width: 100%;
      padding: 12px;
      background: var(--primary);
      color: white;
      border: none;
      border-radius: 10px;
      font-size: 1rem;
      font-weight: 600;
      cursor: pointer;
      transition: background 0.2s;
    }
    .login-box .btn-login:hover {
      background: var(--primary-dark);
    }
    .login-box .error-msg {
      color: #ef4444;
      font-size: 0.8rem;
      text-align: center;
      margin-top: 8px;
      display: none;
    }
    .login-box .error-msg.show {
      display: block;
    }

    /* ===== MAIN APP ===== */
    #mainApp {
      display: none;
      padding-bottom: 72px;
    }
    #mainApp.active {
      display: block;
    }

    /* ===== TOP HEADER ===== */
    .app-header {
      background: var(--header-bg);
      padding: 6px 10px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      position: sticky;
      top: 0;
      z-index: 100;
      box-shadow: 0 1px 4px rgba(0,0,0,0.06);
      border-bottom: 1px solid var(--border-color);
      min-height: 44px;
    }
    .app-header .brand {
      display: flex;
      align-items: center;
      gap: 6px;
      font-weight: 700;
      font-size: 0.85rem;
      color: var(--text);
    }
    .app-header .brand img {
      height: 26px;
      width: auto;
    }
    .app-header .brand span {
      color: var(--primary);
    }
    .app-header .header-actions {
      display: flex;
      align-items: center;
      gap: 4px;
      flex: 1;
      justify-content: flex-end;
    }
    
    /* Search in header */
    .header-search {
      display: flex;
      align-items: center;
      background: var(--input-bg);
      border-radius: 20px;
      padding: 2px 10px;
      border: 2px solid transparent;
      transition: border 0.2s, background 0.2s;
      flex: 1;
      max-width: 200px;
      min-width: 80px;
    }
    .header-search:focus-within {
      border-color: var(--primary);
      background: var(--card);
    }
    .header-search i {
      color: var(--text-light);
      font-size: 0.7rem;
      margin-right: 4px;
    }
    .header-search input {
      border: none;
      outline: none;
      background: transparent;
      font-size: 0.75rem;
      padding: 4px 0;
      color: var(--text);
      width: 100%;
      min-width: 50px;
    }
    .header-search input::placeholder {
      color: #9ca3af;
      font-size: 0.65rem;
    }
    .header-search .clear-btn {
      background: none;
      border: none;
      color: var(--text-light);
      cursor: pointer;
      padding: 0 2px;
      display: none;
      font-size: 0.7rem;
    }
    .header-search .clear-btn.show {
      display: block;
    }
    
    .app-header .header-actions .btn-icon {
      width: 30px;
      height: 30px;
      border-radius: 50%;
      border: none;
      background: #f3f4f6;
      color: var(--text);
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      font-size: 0.8rem;
      transition: background 0.2s;
      flex-shrink: 0;
    }
    body.dark .app-header .header-actions .btn-icon {
      background: #2d2d44;
      color: var(--text);
    }
    .app-header .header-actions .btn-icon:hover {
      background: #e5e7eb;
    }
    body.dark .app-header .header-actions .btn-icon:hover {
      background: #3d3d5c;
    }
    .user-badge {
      font-size: 0.6rem;
      color: var(--text-light);
      display: none;
      white-space: nowrap;
    }
    @media (min-width: 576px) {
      .user-badge { display: block; }
    }
    @media (max-width: 480px) {
      .header-search { max-width: 120px; min-width: 60px; }
      .header-search input { font-size: 0.65rem; }
      .app-header .brand { font-size: 0.7rem; }
      .app-header .brand img { height: 20px; }
    }

    /* ===== BOTTOM NAV ===== */
    .bottom-nav {
      position: fixed;
      bottom: 0;
      left: 0;
      right: 0;
      background: var(--nav-bg);
      display: flex;
      justify-content: space-around;
      padding: 4px 0 8px;
      border-top: 1px solid var(--border-color);
      z-index: 100;
      box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    }
    .bottom-nav .nav-item {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 1px;
      background: none;
      border: none;
      color: var(--text-light);
      font-size: 0.5rem;
      font-weight: 500;
      cursor: pointer;
      padding: 2px 6px;
      transition: color 0.2s;
      position: relative;
      min-width: 40px;
      flex: 1;
    }
    .bottom-nav .nav-item i {
      font-size: 1.1rem;
      transition: color 0.2s;
    }
    .bottom-nav .nav-item.active {
      color: var(--primary);
    }
    .bottom-nav .nav-item.active i {
      color: var(--primary);
    }
    .bottom-nav .nav-item .nav-badge {
      position: absolute;
      top: -2px;
      right: 2px;
      background: #ef4444;
      color: white;
      font-size: 0.4rem;
      border-radius: 50%;
      padding: 1px 4px;
      min-width: 12px;
      text-align: center;
    }
    .bottom-nav .fab-btn {
      background: var(--primary);
      color: white !important;
      width: 44px;
      height: 44px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      margin-top: -16px;
      box-shadow: 0 4px 15px rgba(3, 167, 249, 0.4);
    }
    .bottom-nav .fab-btn i {
      font-size: 1.2rem;
      color: white !important;
    }

    /* ===== PAGE CONTENT ===== */
    .page-content {
      padding: 10px;
      max-width: 800px;
      margin: 0 auto;
    }

    /* ===== DATE FILTER ===== */
    .filter-row {
      display: flex;
      flex-wrap: wrap;
      gap: 4px;
      margin-bottom: 10px;
    }
    .filter-row .filter-btn {
      padding: 3px 10px;
      border-radius: 16px;
      border: 2px solid var(--border-color);
      background: var(--card);
      font-size: 0.65rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s;
      color: var(--text-light);
    }
    .filter-row .filter-btn.active {
      border-color: var(--primary);
      background: var(--primary);
      color: white;
    }
    .filter-row .filter-btn:active {
      transform: scale(0.95);
    }
    .filter-row .filter-btn.custom-btn {
      border-style: dashed;
    }
    .custom-date-range {
      display: none;
      align-items: center;
      gap: 4px;
      width: 100%;
      margin-top: 4px;
      flex-wrap: wrap;
    }
    .custom-date-range.show {
      display: flex;
    }
    .custom-date-range input {
      padding: 3px 6px;
      border: 2px solid var(--border-color);
      border-radius: 6px;
      font-size: 0.7rem;
      flex: 1;
      min-width: 80px;
      background: var(--card);
      color: var(--text);
    }
    .custom-date-range .apply-btn {
      padding: 3px 12px;
      background: var(--primary);
      color: white;
      border: none;
      border-radius: 6px;
      font-size: 0.65rem;
      font-weight: 600;
      cursor: pointer;
    }

    /* ===== STATS ROW ===== */
    .stats-row {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 6px;
      margin-bottom: 10px;
    }
    @media (min-width: 480px) {
      .stats-row { grid-template-columns: repeat(4, 1fr); }
    }
    .stat-card {
      background: var(--card);
      border-radius: var(--radius);
      padding: 10px 8px;
      box-shadow: var(--shadow);
      text-align: center;
      color: var(--text);
    }
    .stat-card .number {
      font-size: 1.1rem;
      font-weight: 700;
      color: var(--text);
    }
    .stat-card .label {
      font-size: 0.55rem;
      color: var(--text-light);
      font-weight: 500;
      text-transform: uppercase;
      letter-spacing: 0.3px;
      margin-top: 1px;
    }
    .stat-card .icon {
      font-size: 0.9rem;
      margin-bottom: 2px;
    }
    .stat-card.purple .icon { color: #8b5cf6; }
    .stat-card.green .icon { color: #10b981; }
    .stat-card.orange .icon { color: #f59e0b; }
    .stat-card.blue .icon { color: #3b82f6; }
    .stat-card.red .icon { color: #ef4444; }

    /* ===== SECTION HEADER ===== */
    .section-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 8px;
      margin-top: 4px;
    }
    .section-header h3 {
      font-size: 0.85rem;
      font-weight: 600;
      color: var(--text);
    }
    .section-header .btn-add {
      background: var(--primary);
      color: white;
      border: none;
      padding: 4px 10px;
      border-radius: 16px;
      font-size: 0.7rem;
      font-weight: 600;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 4px;
      transition: background 0.2s;
    }
    .section-header .btn-add:hover {
      background: var(--primary-dark);
    }
    .section-header .btn-add i {
      font-size: 0.6rem;
    }
    .section-header .view-link {
      font-size: 0.7rem;
      color: var(--primary);
      background: none;
      border: none;
      cursor: pointer;
      font-weight: 500;
    }

    /* ===== LIST ITEMS ===== */
    .list-item {
      background: var(--card);
      border-radius: var(--radius);
      padding: 10px 12px;
      margin-bottom: 6px;
      box-shadow: var(--shadow);
      cursor: pointer;
      transition: transform 0.15s, box-shadow 0.15s;
      border-left: 4px solid var(--primary);
      color: var(--text);
    }
    .list-item:active {
      transform: scale(0.98);
    }
    .list-item .top-row {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      gap: 6px;
    }
    .list-item .title {
      font-weight: 600;
      font-size: 0.85rem;
      color: var(--text);
    }
    .list-item .subtitle {
      font-size: 0.7rem;
      color: var(--text-light);
      margin-top: 1px;
    }
    .list-item .badge-status {
      font-size: 0.55rem;
      padding: 1px 6px;
      border-radius: 16px;
      font-weight: 600;
      white-space: nowrap;
    }
    .badge-status.active { background: #d1fae5; color: #065f46; }
    .badge-status.inactive { background: #fee2e2; color: #991b1b; }
    .badge-status.renewal { background: #fef3c7; color: #92400e; }
    .badge-status.lead { background: #e0e7ff; color: #3730a3; }
    .badge-status.lost { background: #f3f4f6; color: #4b5563; }
    .badge-status.pending { background: #fef3c7; color: #92400e; }
    .badge-status.renewed { background: #dbeafe; color: #1e40af; }
    
    body.dark .badge-status.active { background: #0a3a2a; color: #6ee7b7; }
    body.dark .badge-status.inactive { background: #3a0a0a; color: #fca5a5; }
    body.dark .badge-status.renewal { background: #3a2a0a; color: #fcd34d; }
    body.dark .badge-status.lead { background: #1a1a3a; color: #818cf8; }
    body.dark .badge-status.lost { background: #2a2a2a; color: #9ca3af; }
    body.dark .badge-status.pending { background: #3a2a0a; color: #fcd34d; }
    body.dark .badge-status.renewed { background: #0a1a3a; color: #60a5fa; }

    .list-item .details {
      display: flex;
      flex-wrap: wrap;
      gap: 3px 8px;
      margin-top: 4px;
      font-size: 0.65rem;
      color: var(--text-light);
    }
    .list-item .details span {
      display: flex;
      align-items: center;
      gap: 3px;
    }
    .list-item .details i {
      font-size: 0.55rem;
      width: 12px;
    }
    .list-item .details .clickable-phone {
      color: var(--primary);
      cursor: pointer;
      font-weight: 500;
    }
    .list-item .details .clickable-phone:hover {
      text-decoration: underline;
    }
    .list-item .actions {
      display: flex;
      gap: 4px;
      margin-top: 4px;
      flex-wrap: wrap;
    }
    .list-item .actions .btn-sm {
      padding: 2px 8px;
      border-radius: 6px;
      font-size: 0.6rem;
      border: none;
      cursor: pointer;
      font-weight: 500;
      transition: opacity 0.2s;
    }
    .list-item .actions .btn-sm:active {
      opacity: 0.7;
    }
    .btn-sm.outline-primary { background: #e0f2fe; color: #0369a1; }
    .btn-sm.outline-success { background: #d1fae5; color: #065f46; }
    .btn-sm.outline-warning { background: #fef3c7; color: #92400e; }
    .btn-sm.outline-secondary { background: #f3f4f6; color: #4b5563; }
    .btn-sm.outline-whatsapp { background: #d1fae5; color: #075e54; }
    
    body.dark .btn-sm.outline-primary { background: #0a1a3a; color: #60a5fa; }
    body.dark .btn-sm.outline-success { background: #0a3a2a; color: #6ee7b7; }
    body.dark .btn-sm.outline-warning { background: #3a2a0a; color: #fcd34d; }
    body.dark .btn-sm.outline-secondary { background: #2a2a2a; color: #9ca3af; }
    body.dark .btn-sm.outline-whatsapp { background: #0a2a1a; color: #34d399; }

    .empty-state {
      text-align: center;
      padding: 24px 12px;
      color: var(--text-light);
    }
    .empty-state i {
      font-size: 1.8rem;
      color: #d1d5db;
      margin-bottom: 6px;
    }
    .empty-state p {
      font-size: 0.8rem;
    }

    /* ===== PAGINATION ===== */
    .pagination-container {
      display: flex;
      justify-content: center;
      align-items: center;
      gap: 6px;
      margin-top: 12px;
      padding: 8px 12px;
      background: var(--card);
      border-radius: var(--radius);
      box-shadow: var(--shadow);
      flex-wrap: wrap;
    }
    .pagination-container .page-btn {
      padding: 4px 10px;
      border-radius: 6px;
      border: 2px solid var(--border-color);
      background: var(--card);
      color: var(--text);
      font-size: 0.7rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s;
      min-width: 32px;
      text-align: center;
    }
    .pagination-container .page-btn:active {
      transform: scale(0.95);
    }
    .pagination-container .page-btn.active {
      border-color: var(--primary);
      background: var(--primary);
      color: white;
    }
    .pagination-container .page-btn:disabled {
      opacity: 0.4;
      cursor: not-allowed;
    }
    .pagination-container .page-info {
      font-size: 0.65rem;
      color: var(--text-light);
      padding: 0 6px;
    }
    .pagination-container .page-btn.ellipsis {
      border: none;
      background: transparent;
      cursor: default;
      color: var(--text-light);
    }

    /* ===== MODALS ===== */
    .modal-overlay {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(0,0,0,0.5);
      z-index: 200;
      display: none;
      align-items: flex-end;
      justify-content: center;
      padding: 10px;
      backdrop-filter: blur(4px);
    }
    .modal-overlay.show {
      display: flex;
    }
    .modal-overlay .modal-box {
      background: var(--modal-bg);
      border-radius: 20px 20px 0 0;
      max-width: 600px;
      width: 100%;
      max-height: 92vh;
      overflow-y: auto;
      padding: 14px 16px 18px;
      animation: slideUp 0.3s ease;
      color: var(--text);
    }
    @keyframes slideUp {
      from { transform: translateY(40px); opacity: 0; }
      to { transform: translateY(0); opacity: 1; }
    }
    .modal-overlay .modal-handle {
      width: 36px;
      height: 4px;
      background: #d1d5db;
      border-radius: 4px;
      margin: 0 auto 10px;
    }
    body.dark .modal-overlay .modal-handle {
      background: var(--border-color);
    }
    .modal-overlay .modal-title {
      font-size: 0.95rem;
      font-weight: 600;
      margin-bottom: 12px;
      display: flex;
      align-items: center;
      gap: 6px;
      color: var(--text);
    }
    .modal-overlay .modal-title i {
      color: var(--primary);
    }
    .modal-overlay .form-group {
      margin-bottom: 8px;
    }
    .modal-overlay .form-group label {
      display: block;
      font-size: 0.65rem;
      font-weight: 600;
      color: var(--text-light);
      margin-bottom: 2px;
      text-transform: uppercase;
      letter-spacing: 0.3px;
    }
    .modal-overlay .form-group input,
    .modal-overlay .form-group select,
    .modal-overlay .form-group textarea {
      width: 100%;
      padding: 6px 8px;
      border: 2px solid var(--border-color);
      border-radius: 8px;
      font-size: 0.8rem;
      transition: border 0.2s;
      background: var(--input-bg);
      font-family: inherit;
      color: var(--text);
    }
    .modal-overlay .form-group input:focus,
    .modal-overlay .form-group select:focus,
    .modal-overlay .form-group textarea:focus {
      outline: none;
      border-color: var(--primary);
      background: var(--card);
    }
    .modal-overlay .form-group textarea {
      resize: vertical;
      min-height: 40px;
    }
    .modal-overlay .form-row {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 6px;
    }
    .modal-overlay .form-actions {
      display: flex;
      gap: 6px;
      margin-top: 12px;
    }
    .modal-overlay .form-actions .btn {
      flex: 1;
      padding: 8px;
      border-radius: 10px;
      border: none;
      font-weight: 600;
      font-size: 0.8rem;
      cursor: pointer;
      transition: opacity 0.2s;
    }
    .modal-overlay .form-actions .btn:active {
      opacity: 0.7;
    }
    .modal-overlay .form-actions .btn-secondary {
      background: #f3f4f6;
      color: var(--text);
    }
    body.dark .modal-overlay .form-actions .btn-secondary {
      background: #2d2d44;
      color: var(--text);
    }
    .modal-overlay .form-actions .btn-primary {
      background: var(--primary);
      color: white;
    }

    /* PDF Upload */
    .pdf-upload-area {
      border: 2px dashed var(--border-color);
      border-radius: 8px;
      padding: 10px;
      text-align: center;
      cursor: pointer;
      transition: border 0.2s;
      background: var(--input-bg);
    }
    .pdf-upload-area:hover {
      border-color: var(--primary);
    }
    .pdf-upload-area .pdf-icon {
      font-size: 1.2rem;
      color: #ef4444;
    }
    .pdf-upload-area .pdf-text {
      font-size: 0.7rem;
      color: var(--text-light);
      margin-top: 2px;
    }
    .pdf-upload-area input[type="file"] {
      display: none;
    }
    .pdf-status {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 4px 8px;
      background: #f0fdf4;
      border-radius: 6px;
      margin-top: 4px;
      font-size: 0.7rem;
    }
    body.dark .pdf-status {
      background: #0a1a0a;
    }
    .pdf-status a {
      color: var(--primary);
      text-decoration: none;
      font-weight: 500;
      flex: 1;
    }
    .pdf-status .remove-pdf {
      color: #ef4444;
      background: none;
      border: none;
      cursor: pointer;
      font-size: 0.8rem;
    }

    /* ===== CLIENT DETAIL MODAL ===== */
    .client-detail-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 3px 10px;
      font-size: 0.75rem;
      margin: 4px 0 8px;
      color: var(--text);
    }
    .client-detail-grid .label {
      color: var(--text-light);
      font-size: 0.6rem;
      font-weight: 500;
      text-transform: uppercase;
    }
    .client-detail-grid .value {
      font-weight: 500;
      word-break: break-word;
      color: var(--text);
    }
    .client-policy-list {
      margin-top: 8px;
    }
    .client-policy-list .policy-mini {
      background: var(--input-bg);
      border-radius: 8px;
      padding: 6px 8px;
      margin-bottom: 4px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 0.7rem;
      flex-wrap: wrap;
      gap: 2px;
      color: var(--text);
    }
    .client-policy-list .policy-mini .pol-number {
      font-weight: 600;
    }
    .client-policy-list .policy-mini .pol-detail {
      font-size: 0.6rem;
      color: var(--text-light);
    }

    /* ===== TOAST ===== */
    .toast-container {
      position: fixed;
      top: 10px;
      left: 50%;
      transform: translateX(-50%);
      z-index: 9999;
      width: 90%;
      max-width: 400px;
      pointer-events: none;
    }
    .toast-msg {
      background: #1f2937;
      color: white;
      padding: 8px 14px;
      border-radius: 12px;
      font-size: 0.75rem;
      box-shadow: 0 8px 30px rgba(0,0,0,0.2);
      margin-bottom: 4px;
      display: flex;
      align-items: center;
      gap: 6px;
      pointer-events: auto;
      animation: toastIn 0.3s ease;
    }
    .toast-msg.success { background: #065f46; }
    .toast-msg.error { background: #991b1b; }
    .toast-msg.warning { background: #92400e; }
    .toast-msg.info { background: #1e40af; }
    @keyframes toastIn {
      from { transform: translateY(-20px); opacity: 0; }
      to { transform: translateY(0); opacity: 1; }
    }
    .toast-msg .close-toast {
      margin-left: auto;
      background: none;
      border: none;
      color: rgba(255,255,255,0.6);
      cursor: pointer;
      font-size: 0.9rem;
    }

    /* ===== WHATSAPP BUTTON ===== */
    .btn-whatsapp {
      background: #25D366;
      color: white;
      border: none;
      padding: 4px 12px;
      border-radius: 16px;
      font-size: 0.65rem;
      font-weight: 600;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 4px;
      transition: opacity 0.2s;
    }
    .btn-whatsapp:hover {
      opacity: 0.85;
    }
    .btn-whatsapp i {
      font-size: 0.8rem;
    }

    /* ===== RESPONSIVE ===== */
    @media (min-width: 768px) {
      .page-content { padding: 16px; }
      .modal-overlay { align-items: center; }
      .modal-overlay .modal-box { border-radius: 20px; max-height: 85vh; }
      .bottom-nav .nav-item { font-size: 0.6rem; }
      .bottom-nav .nav-item i { font-size: 1.2rem; }
      .header-search { max-width: 280px; }
    }

    @media (max-width: 480px) {
      .modal-overlay .form-row { grid-template-columns: 1fr; }
      .client-detail-grid { grid-template-columns: 1fr; }
      .list-item .top-row { flex-wrap: wrap; }
      .list-item .badge-status { font-size: 0.5rem; padding: 1px 5px; }
      .filter-row .filter-btn { font-size: 0.55rem; padding: 2px 7px; }
      .bottom-nav .nav-item { font-size: 0.45rem; min-width: 34px; }
      .bottom-nav .nav-item i { font-size: 0.95rem; }
      .bottom-nav .fab-btn { width: 38px; height: 38px; margin-top: -12px; }
      .bottom-nav .fab-btn i { font-size: 1rem; }
      .pagination-container .page-btn { font-size: 0.6rem; padding: 3px 7px; min-width: 28px; }
      .pagination-container .page-info { font-size: 0.55rem; }
    }

    /* ===== UTILITY ===== */
    .hidden { display: none !important; }
    .text-muted { color: var(--text-light); }
    .mt-1 { margin-top: 4px; }
    .mb-1 { margin-bottom: 4px; }
    .gap-1 { gap: 3px; }
    .flex { display: flex; }
    .flex-between { display: flex; justify-content: space-between; align-items: center; }
    .flex-center { display: flex; align-items: center; gap: 4px; }

    /* Scrollbar */
    ::-webkit-scrollbar { width: 3px; }
    ::-webkit-scrollbar-track { background: transparent; }
    ::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }
    body.dark ::-webkit-scrollbar-thumb { background: #3d3d5c; }


/* ===== MOBILE LOGIN VIEWPORT FIX =====
   Visual/layout-only: keeps the login usable on short, tall and rotated screens. */
html, body { min-height: 100%; }
#mLoginScreen { min-height: 100dvh; height: 100dvh; overflow-y: auto; padding: max(12px, env(safe-area-inset-top)) 14px max(12px, env(safe-area-inset-bottom)); }
.login-box { width: min(100%, 380px); max-height: calc(100dvh - 24px); overflow-y: auto; padding: 24px 20px; }
.login-box .logo { margin-bottom: 12px; }
.login-box .logo img { max-height: 62px; max-width: 70%; object-fit: contain; }
.login-box h2 { font-size: 1.18rem; }
.login-box p { margin-bottom: 14px; }
.login-box input { min-height: 44px; }
.login-box .btn-login { min-height: 46px; }
@media (max-height: 640px) {
  #mLoginScreen { align-items: flex-start; }
  .login-box { margin: 10px 0; padding: 16px 18px; }
  .login-box .logo img { max-height: 48px; }
  .login-box h2 { font-size: 1.05rem; }
  .login-box p { margin-bottom: 10px; }
  .login-box input { padding: 9px 12px; margin-bottom: 8px; }
  .login-box .btn-login { padding: 9px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  #mLoginScreen { align-items: flex-start; }
  .login-box { margin: 6px auto; max-height: calc(100dvh - 12px); padding: 12px 18px; }
  .login-box .logo { display:none; }
}
